rtMedia for WordPress, BuddyPress and bbPress - Version 2.6

Version Description

  • Added Privacy for Media.
  • Added crude support for activity privacy (due for revision)
  • Revised media count functionality
  • Fixed widget to recognise enabled/disabled media types
  • Renamed 'Featured' to 'Set as Album Cover' in the UI for clarity
  • Fixed featured functionality
  • Fixed download functionality
  • Rewritten query functions
  • Improved css and js
  • Major code refactoring
Download this release

Release Info

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

Code changes from version 2.5.5 to 2.6

Files changed (62) hide show
  1. Screenshot1.png +0 -0
  2. Screenshot2.png +0 -0
  3. Screenshot3.png +0 -0
  4. Screenshot4.png +0 -0
  5. Screenshot5.png +0 -0
  6. Screenshot6.png +0 -0
  7. Screenshot7.png +0 -0
  8. Screenshot8.png +0 -0
  9. Screenshot9.png +0 -0
  10. Screenshots10.png +0 -0
  11. Screenshots11.png +0 -0
  12. app/admin/BPMediaAdmin.php +226 -179
  13. app/assets/css/main.css +45 -19
  14. app/assets/img/admin-menu.png +0 -0
  15. app/assets/img/donate.gif +0 -0
  16. app/assets/img/donate.png +0 -0
  17. app/assets/img/paypal-donate-button.png +0 -0
  18. app/assets/img/rtcamp-logo.png +0 -0
  19. app/assets/img/tab-icon.png +0 -0
  20. app/assets/js/admin.js +152 -67
  21. app/assets/js/bp-media-uploader.js +4 -4
  22. app/assets/js/main.js +13 -31
  23. app/helper/BPMediaSettings.php +119 -28
  24. app/helper/rtPluginInfo.php +0 -0
  25. app/helper/rtPluginUpdate.php +0 -0
  26. app/helper/rtPluginUpdateChecker.php +59 -59
  27. app/helper/rtProgress.php +36 -0
  28. app/main/BPMediaComponent.php +253 -461
  29. app/main/BPMediaLoader.php +2 -0
  30. app/main/BuddyPressMedia.php +55 -15
  31. app/main/group/BPMediaGroupAction.php +0 -61
  32. app/main/group/BPMediaGroupElementExtension.php +2 -3
  33. app/main/includes/BPMediaActions.php +130 -93
  34. app/main/includes/BPMediaFilters.php +1 -1
  35. app/main/includes/BPMediaFunction.php +1 -13
  36. app/main/includes/BPMediaHostWordpress.php +33 -35
  37. app/main/includes/BPMediaTemplateFunctions.php +3 -4
  38. app/main/privacy/BPMediaPrivacy.php +268 -32
  39. app/main/privacy/BPMediaPrivacyScreen.php +64 -0
  40. app/main/privacy/BPMediaPrivacySettings.php +102 -0
  41. app/main/profile/BPMediaAlbum.php +23 -25
  42. app/main/profile/BPMediaAlbumScreen.php +25 -37
  43. app/main/profile/BPMediaScreen.php +34 -45
  44. app/main/profile/BPMediaTemplate.php +16 -14
  45. app/main/query/BPMediaQuery.php +158 -4
  46. app/main/widgets/BPMediaWidget.php +78 -187
  47. index.php +3 -2
  48. languages/buddypress-media-de.mo +0 -0
  49. languages/buddypress-media-es.mo +0 -0
  50. languages/buddypress-media-fr.mo +0 -0
  51. languages/buddypress-media-it.mo +0 -0
  52. languages/buddypress-media-ja.mo +0 -0
  53. languages/buddypress-media-nl.mo +0 -0
  54. languages/buddypress-media-pl.mo +0 -0
  55. languages/buddypress-media-pt_BR.mo +0 -0
  56. languages/buddypress-media-sr.mo +0 -0
  57. languages/buddypress-media.mo +0 -0
  58. languages/buddypress-media.po +424 -310
  59. phpunit.xml +19 -0
  60. readme.txt +87 -46
  61. tests/MyPluginTest.php +16 -0
  62. tests/bootstrap.php +14 -0
Screenshot1.png ADDED
Binary file
Screenshot2.png ADDED
Binary file
Screenshot3.png ADDED
Binary file
Screenshot4.png ADDED
Binary file
Screenshot5.png ADDED
Binary file
Screenshot6.png ADDED
Binary file
Screenshot7.png ADDED
Binary file
Screenshot8.png ADDED
Binary file
Screenshot9.png ADDED
Binary file
Screenshots10.png ADDED
Binary file
Screenshots11.png ADDED
Binary file
app/admin/BPMediaAdmin.php CHANGED
@@ -17,6 +17,7 @@ if (!class_exists('BPMediaAdmin')) {
17
  public $bp_media_feed;
18
 
19
  public function __construct() {
 
20
  $bp_media_feed = new BPMediaFeed();
21
  add_action('wp_ajax_bp_media_fetch_feed', array($bp_media_feed, 'fetch_feed'), 1);
22
  $bp_media_support = new BPMediaSupport();
@@ -25,6 +26,7 @@ if (!class_exists('BPMediaAdmin')) {
25
  add_action('wp_ajax_bp_media_submit_request', array($bp_media_support, 'submit_request'), 1);
26
  add_action('wp_ajax_bp_media_fetch_feed', array($bp_media_feed, 'fetch_feed'), 1);
27
  add_action('wp_ajax_bp_media_linkback', array($this, 'linkback'), 1);
 
28
  if (is_admin()) {
29
  add_action('admin_enqueue_scripts', array($this, 'ui'));
30
  add_action(bp_core_admin_hook(), array($this, 'menu'));
@@ -38,19 +40,22 @@ if (!class_exists('BPMediaAdmin')) {
38
  }
39
 
40
  /**
41
- * Generates the Admin UI
42
  *
43
  * @param string $hook
44
  */
45
 
46
  /**
47
- *
48
  * @param type $hook
49
  */
50
  public function ui($hook) {
51
  $admin_ajax = admin_url('admin-ajax.php');
52
  wp_enqueue_script('bp-media-admin', BP_MEDIA_URL . 'app/assets/js/admin.js');
53
  wp_localize_script('bp-media-admin', 'bp_media_admin_ajax', $admin_ajax);
 
 
 
54
  wp_enqueue_style('bp-media-admin', BP_MEDIA_URL . 'app/assets/css/main.css');
55
  }
56
 
@@ -62,8 +67,14 @@ if (!class_exists('BPMediaAdmin')) {
62
  public function menu() {
63
  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'));
64
  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'));
 
 
 
65
  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'));
66
  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'));
 
 
 
67
  }
68
 
69
  /**
@@ -73,6 +84,14 @@ if (!class_exists('BPMediaAdmin')) {
73
  $this->render_page('bp-media-settings', 'bp_media');
74
  }
75
 
 
 
 
 
 
 
 
 
76
  /**
77
  * Render the BuddyPress Media Addons page
78
  */
@@ -88,7 +107,7 @@ if (!class_exists('BPMediaAdmin')) {
88
  }
89
 
90
  /**
91
- *
92
  * @return type
93
  */
94
  static function get_current_tab() {
@@ -102,7 +121,7 @@ if (!class_exists('BPMediaAdmin')) {
102
  */
103
 
104
  /**
105
- *
106
  * @param type $page
107
  * @param type $option_group
108
  */
@@ -115,7 +134,7 @@ if (!class_exists('BPMediaAdmin')) {
115
  <?php settings_errors(); ?>
116
  <div class="columns-2">
117
  <h3 class="bp-media-settings-tabs"><?php
118
- $this->sub_tabs();
119
  ?>
120
  </h3>
121
 
@@ -133,7 +152,7 @@ if (!class_exists('BPMediaAdmin')) {
133
  do_settings_sections($page);
134
  }
135
  ?>
136
- <div class="rt-link alignright"><?php _e('By', BP_MEDIA_TXT_DOMAIN); ?> <a href="http://rtcamp.com" title="<?php _e('Empowering The Web With WordPress', BP_MEDIA_TXT_DOMAIN); ?>"><?php _e('rtCamp', BP_MEDIA_TXT_DOMAIN); ?></a></div>
137
  </div>
138
 
139
  </form>
@@ -143,164 +162,178 @@ if (!class_exists('BPMediaAdmin')) {
143
  </div>
144
  </div><!-- .metabox-holder -->
145
  </div><!-- .bp-media-admin --><?php
146
- }
147
-
148
- /**
149
- * Adds a tab for Media settings in the BuddyPress settings page
150
- *
151
- * @global type $bp_media
152
- */
153
- public function tab() {
154
-
155
- $tabs_html = '';
156
- $idle_class = 'nav-tab';
157
- $active_class = 'nav-tab nav-tab-active';
158
- $tabs = array();
159
-
160
- // Check to see which tab we are on
161
- $tab = $this->get_current_tab();
162
- /* BuddyPress Media */
163
- $tabs[] = array(
164
- 'href' => bp_get_admin_url(add_query_arg(array('page' => 'bp-media-settings'), 'admin.php')),
165
- 'title' => __('BuddyPress Media', BP_MEDIA_TXT_DOMAIN),
166
- 'name' => __('BuddyPress Media', BP_MEDIA_TXT_DOMAIN),
167
- 'class' => ($tab == 'bp-media-settings' || $tab == 'bp-media-addons' || $tab == 'bp-media-support') ? $active_class : $idle_class
168
- );
169
-
170
- foreach ($tabs as $tab) {
171
- $tabs_html.= '<a id="bp-media" title= "' . $tab['title'] . '" href="' . $tab['href'] . '" class="' . $tab['class'] . '">' . $tab['name'] . '</a>';
172
- }
173
- echo $tabs_html;
174
- }
175
-
176
- /**
177
- * Adds a sub tabs to the BuddyPress Media settings page
178
- *
179
- * @global type $bp_media
180
- */
181
- public function sub_tabs() {
182
- $tabs_html = '';
183
- $idle_class = 'nav-tab';
184
- $active_class = 'nav-tab nav-tab-active';
185
- $tabs = array();
186
-
187
- // Check to see which tab we are on
188
- $tab = $this->get_current_tab();
189
- /* BuddyPress Media */
190
- $tabs[] = array(
191
- 'href' => bp_get_admin_url(add_query_arg(array('page' => 'bp-media-settings'), 'admin.php')),
192
- 'title' => __('BuddyPress Media Settings', BP_MEDIA_TXT_DOMAIN),
193
- 'name' => __('Settings', BP_MEDIA_TXT_DOMAIN),
194
- 'class' => ($tab == 'bp-media-settings') ? $active_class : $idle_class . ' first_tab'
195
- );
196
-
197
- $tabs[] = array(
198
- 'href' => bp_get_admin_url(add_query_arg(array('page' => 'bp-media-addons'), 'admin.php')),
199
- 'title' => __('BuddyPress Media Addons', BP_MEDIA_TXT_DOMAIN),
200
- 'name' => __('Addons', BP_MEDIA_TXT_DOMAIN),
201
- 'class' => ($tab == 'bp-media-addons') ? $active_class : $idle_class
202
- );
203
-
204
- $tabs[] = array(
205
- 'href' => bp_get_admin_url(add_query_arg(array('page' => 'bp-media-support'), 'admin.php')),
206
- 'title' => __('BuddyPress Media Support', BP_MEDIA_TXT_DOMAIN),
207
- 'name' => __('Support', BP_MEDIA_TXT_DOMAIN),
208
- 'class' => ($tab == 'bp-media-support') ? $active_class : $idle_class . ' last_tab'
209
- );
210
- $tabs = apply_filters('bp_media_add_sub_tabs', $tabs, $tab);
211
- foreach ($tabs as $tab) {
212
- $tabs_html.= '<a title="' . $tab['title'] . '" href="' . $tab['href'] . '" class="' . $tab['class'] . '">' . $tab['name'] . '</a>';
213
- }
214
- echo $tabs_html;
215
- }
216
-
217
- /*
218
- * Updates the media count of all users.
219
- */
220
-
221
- /**
222
- *
223
- * @global type $wpdb
224
- * @return boolean
225
- */
226
- public function update_count() {
227
- global $wpdb;
228
- $query =
229
- "SELECT
230
- post_author,
 
 
 
 
 
 
 
 
 
 
 
 
231
  SUM(CASE WHEN post_mime_type LIKE 'image%' THEN 1 ELSE 0 END) as Images,
232
  SUM(CASE WHEN post_mime_type LIKE 'audio%' THEN 1 ELSE 0 END) as Audio,
233
  SUM(CASE WHEN post_mime_type LIKE 'video%' THEN 1 ELSE 0 END) as Videos,
234
- SUM(CASE WHEN post_type LIKE 'bp_media_album' THEN 1 ELSE 0 END) as Albums,
235
- COUNT(*) as Total
236
  FROM
237
- $wpdb->posts RIGHT JOIN $wpdb->postmeta on wp_postmeta.post_id = wp_posts.id
238
- WHERE
239
- `meta_key` = 'bp-media-key' AND
240
- `meta_value` > 0 AND
 
241
  ( post_mime_type LIKE 'image%' OR post_mime_type LIKE 'audio%' OR post_mime_type LIKE 'video%' OR post_type LIKE 'bp_media_album')
242
- GROUP BY post_author";
243
- $result = $wpdb->get_results($query);
244
- if (!is_array($result))
245
- return false;
246
-
247
- foreach ($result as $obj) {
248
-
249
- $count = array(
250
- 'images' => isset($obj->Images) ? $obj->Images : 0,
251
- 'videos' => isset($obj->Videos) ? $obj->Videos : 0,
252
- 'audio' => isset($obj->Audio) ? $obj->Audio : 0,
253
- 'albums' => isset($obj->Albums) ? $obj->Albums : 0
254
- );
255
- bp_update_user_meta($obj->post_author, 'bp_media_count', $count);
256
- }
257
- return true;
258
- }
259
-
260
- /* Multisite Save Options - http://wordpress.stackexchange.com/questions/64968/settings-api-in-multisite-missing-update-message#answer-72503 */
261
-
262
- /**
263
- *
264
- * @global type $bp_media_admin
265
- */
266
- public function save_multisite_options() {
267
- global $bp_media_admin;
268
- if (isset($_POST['refresh-count'])) {
269
- $bp_media_admin->update_count();
270
- }
271
- do_action('bp_media_sanitize_settings', $_POST);
272
-
273
- if (isset($_POST['bp_media_options'])) {
274
- bp_update_option('bp_media_options', $_POST['bp_media_options']);
275
-
276
- // redirect to settings page in network
277
- wp_redirect(
278
- add_query_arg(
279
- array('page' => 'bp-media-settings', 'updated' => 'true'), (is_multisite() ? network_admin_url('admin.php') : admin_url('admin.php'))
280
- )
281
- );
282
- exit;
283
- }
284
- }
285
-
286
- /* Admin Sidebar */
287
-
288
- /**
289
- *
290
- * @global type $bp_media
291
- */
292
- public function admin_sidebar() {
293
- $current_user = wp_get_current_user();
294
-
295
- $message = sprintf(__('I use @buddypressmedia http://goo.gl/8Upmv on %s', BP_MEDIA_TXT_DOMAIN),home_url());
296
- $addons = '<label for="bp-media-add-linkback"><input' . checked(bp_get_option('bp_media_add_linkback', false), true, false) . ' type="checkbox" name="bp-media-add-linkback" value="1" id="bp-media-add-linkback"/> ' . __('Add link to footer', BP_MEDIA_TXT_DOMAIN) . '</label>
 
 
297
  <ul>
298
  <li><a href="http://twitter.com/home/?status=' . $message . '" target= "_blank"><input type="button" value="' . __('Tweet', BP_MEDIA_TXT_DOMAIN) . '" class="button button-tweet"></a></li>
299
  <li><a href="http://wordpress.org/support/view/plugin-reviews/buddypress-media?rate=5#postform" target= "_blank"><input type="button" value="' . __('Rate on WordPress.org', BP_MEDIA_TXT_DOMAIN) . '" class="button button-rating"></a></li>
300
  </ul>';
301
- new BPMediaAdminWidget('spread-the-word', __('Spread the Word', BP_MEDIA_TXT_DOMAIN), $addons);
302
 
303
- $donate = '<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
304
  <!-- Identify your business so that you can collect the payments. -->
305
  <input type="hidden" name="business"
306
  value="paypal@rtcamp.com">
@@ -308,21 +341,19 @@ if (!class_exists('BPMediaAdmin')) {
308
  <input type="hidden" name="cmd" value="_donations">
309
  <!-- Specify details about the contribution -->
310
  <input type="hidden" name="item_name" value="BuddyPress Media">
311
- <input type="text" name="amount" size="3">
312
- <label><b>' . __('USD', BP_MEDIA_TXT_DOMAIN) . '</b></label> <br/>
313
  <input type="hidden" name="currency_code" value="USD">
314
  <!-- Display the payment button. -->
315
  <input type="hidden" name="cpp_header_image" value="' . BP_MEDIA_URL . 'app/assets/img/rtcamp-logo.png">
316
- <input type="image" name="submit" border="0"
317
- src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif"
318
  alt="PayPal - The safer, easier way to pay online">
319
- <img alt="" border="0" width="1" height="1"
320
- src="https://www.paypal.com/en_US/i/scr/pixel.gif" >
321
  </form>';
322
- new BPMediaAdminWidget('donate', __('Donate', BP_MEDIA_TXT_DOMAIN), $donate);
323
 
324
- $branding = '<form action="http://rtcamp.us1.list-manage1.com/subscribe/post?u=85b65c9c71e2ba3fab8cb1950&amp;id=9e8ded4470" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
325
- <div class="mc-field-group">
326
  <input type="email" value="' . $current_user->user_email . '" name="EMAIL" placeholder="Email" class="required email" id="mce-EMAIL">
327
  <input style="display:none;" type="checkbox" checked="checked" value="1" name="group[1721][1]" id="mce-group[1721]-1721-0"><label for="mce-group[1721]-1721-0">
328
  <div id="mce-responses" class="clear">
@@ -337,22 +368,38 @@ if (!class_exists('BPMediaAdmin')) {
337
  <li><a href="' . sprintf('%s', 'https://twitter.com/rtcamp/') . '" title="' . __('Follow us on Twitter', BP_MEDIA_TXT_DOMAIN) . '" class="bp-media-twitter bp-media-social">' . __('Twitter', BP_MEDIA_TXT_DOMAIN) . '</a></li>
338
  <li><a href="' . sprintf('%s', 'http://feeds.feedburner.com/rtcamp/') . '" title="' . __('Subscribe to our feeds', BP_MEDIA_TXT_DOMAIN) . '" class="bp-media-rss bp-media-social">' . __('RSS Feed', BP_MEDIA_TXT_DOMAIN) . '</a></li>
339
  </ul>';
340
- new BPMediaAdminWidget('branding', __('Subscribe', BP_MEDIA_TXT_DOMAIN), $branding);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
341
 
342
- $news = '<img src ="' . admin_url('/images/wpspin_light.gif') . '" /> Loading...';
343
- new BPMediaAdminWidget('latest-news', __('Latest News', BP_MEDIA_TXT_DOMAIN), $news);
344
- }
345
-
346
- public function linkback() {
347
- if (isset($_POST['linkback']) && $_POST['linkback']) {
348
- return bp_update_option('bp_media_add_linkback', true);
349
- } else {
350
- return bp_update_option('bp_media_add_linkback', false);
351
  }
352
- die;
353
- }
354
-
355
- }
356
-
357
- }
358
  ?>
17
  public $bp_media_feed;
18
 
19
  public function __construct() {
20
+ add_action('init',array($this, 'video_transcoding_survey_response'));
21
  $bp_media_feed = new BPMediaFeed();
22
  add_action('wp_ajax_bp_media_fetch_feed', array($bp_media_feed, 'fetch_feed'), 1);
23
  $bp_media_support = new BPMediaSupport();
26
  add_action('wp_ajax_bp_media_submit_request', array($bp_media_support, 'submit_request'), 1);
27
  add_action('wp_ajax_bp_media_fetch_feed', array($bp_media_feed, 'fetch_feed'), 1);
28
  add_action('wp_ajax_bp_media_linkback', array($this, 'linkback'), 1);
29
+ add_action('wp_ajax_bp_media_convert_videos_form', array($this, 'convert_videos_mailchimp_send'), 1);
30
  if (is_admin()) {
31
  add_action('admin_enqueue_scripts', array($this, 'ui'));
32
  add_action(bp_core_admin_hook(), array($this, 'menu'));
40
  }
41
 
42
  /**
43
+ * Generates the Admin UI.
44
  *
45
  * @param string $hook
46
  */
47
 
48
  /**
49
+ *
50
  * @param type $hook
51
  */
52
  public function ui($hook) {
53
  $admin_ajax = admin_url('admin-ajax.php');
54
  wp_enqueue_script('bp-media-admin', BP_MEDIA_URL . 'app/assets/js/admin.js');
55
  wp_localize_script('bp-media-admin', 'bp_media_admin_ajax', $admin_ajax);
56
+ wp_localize_script('bp-media-admin', 'settings_url', add_query_arg(
57
+ array('page' => 'bp-media-settings'), (is_multisite() ? network_admin_url('admin.php') : admin_url('admin.php'))
58
+ ) . '#privacy_enabled');
59
  wp_enqueue_style('bp-media-admin', BP_MEDIA_URL . 'app/assets/css/main.css');
60
  }
61
 
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
  }
79
 
80
  /**
84
  $this->render_page('bp-media-settings', 'bp_media');
85
  }
86
 
87
+ public function privacy_page() {
88
+ $this->render_page('bp-media-privacy');
89
+ }
90
+
91
+ public function convert_videos_page() {
92
+ $this->render_page('bp-media-convert-videos');
93
+ }
94
+
95
  /**
96
  * Render the BuddyPress Media Addons page
97
  */
107
  }
108
 
109
  /**
110
+ *
111
  * @return type
112
  */
113
  static function get_current_tab() {
121
  */
122
 
123
  /**
124
+ *
125
  * @param type $page
126
  * @param type $option_group
127
  */
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
 
152
  do_settings_sections($page);
153
  }
154
  ?>
155
+ <div class="rt-link alignright"><?php _e('By', BP_MEDIA_TXT_DOMAIN); ?> <a href="http://rtcamp.com" title="<?php _e('Empowering The Web With WordPress', BP_MEDIA_TXT_DOMAIN); ?>"><img src="<?php echo BP_MEDIA_URL; ?>app/assets/img/rtcamp-logo.png"></a></div>
156
  </div>
157
 
158
  </form>
162
  </div>
163
  </div><!-- .metabox-holder -->
164
  </div><!-- .bp-media-admin --><?php
165
+ }
166
+
167
+ /**
168
+ * Adds a tab for Media settings in the BuddyPress settings page
169
+ *
170
+ * @global type $bp_media
171
+ */
172
+ public function tab() {
173
+
174
+ $tabs_html = '';
175
+ $idle_class = 'nav-tab';
176
+ $active_class = 'nav-tab nav-tab-active';
177
+ $tabs = array();
178
+
179
+ // Check to see which tab we are on
180
+ $tab = $this->get_current_tab();
181
+ /* BuddyPress Media */
182
+ $tabs[] = array(
183
+ 'href' => bp_get_admin_url(add_query_arg(array('page' => 'bp-media-settings'), 'admin.php')),
184
+ 'title' => __('BuddyPress Media', BP_MEDIA_TXT_DOMAIN),
185
+ 'name' => __('BuddyPress Media', BP_MEDIA_TXT_DOMAIN),
186
+ 'class' => ($tab == 'bp-media-settings' || $tab == 'bp-media-addons' || $tab == 'bp-media-support') ? $active_class : $idle_class
187
+ );
188
+
189
+
190
+ foreach ($tabs as $tab) {
191
+ $tabs_html.= '<a id="bp-media" title= "' . $tab['title'] . '" href="' . $tab['href'] . '" class="' . $tab['class'] . '">' . $tab['name'] . '</a>';
192
+ }
193
+ echo $tabs_html;
194
+ }
195
+
196
+ /**
197
+ * Adds a sub tabs to the BuddyPress Media settings page
198
+ *
199
+ * @global type $bp_media
200
+ */
201
+ public function sub_tabs() {
202
+ $tabs_html = '';
203
+ $idle_class = 'nav-tab';
204
+ $active_class = 'nav-tab nav-tab-active';
205
+ $tabs = array();
206
+
207
+ // Check to see which tab we are on
208
+ $tab = $this->get_current_tab();
209
+ /* BuddyPress Media */
210
+ $tabs[] = array(
211
+ 'href' => bp_get_admin_url(add_query_arg(array('page' => 'bp-media-settings'), 'admin.php')),
212
+ 'title' => __('BuddyPress Media Settings', BP_MEDIA_TXT_DOMAIN),
213
+ 'name' => __('Settings', BP_MEDIA_TXT_DOMAIN),
214
+ 'class' => ($tab == 'bp-media-settings') ? $active_class : $idle_class . ' first_tab'
215
+ );
216
+
217
+ $tabs[] = array(
218
+ 'href' => bp_get_admin_url(add_query_arg(array('page' => 'bp-media-addons'), 'admin.php')),
219
+ 'title' => __('BuddyPress Media Addons', BP_MEDIA_TXT_DOMAIN),
220
+ 'name' => __('Addons', BP_MEDIA_TXT_DOMAIN),
221
+ 'class' => ($tab == 'bp-media-addons') ? $active_class : $idle_class
222
+ );
223
+
224
+ $tabs[] = array(
225
+ 'href' => bp_get_admin_url(add_query_arg(array('page' => 'bp-media-support'), 'admin.php')),
226
+ 'title' => __('BuddyPress Media Support', BP_MEDIA_TXT_DOMAIN),
227
+ 'name' => __('Support', BP_MEDIA_TXT_DOMAIN),
228
+ 'class' => ($tab == 'bp-media-support') ? $active_class : $idle_class . ' last_tab'
229
+ );
230
+
231
+ if ( bp_get_option('bp-media-survey', true) ) {
232
+ $tabs[] = array(
233
+ 'href' => bp_get_admin_url(add_query_arg(array('page' => 'bp-media-convert-videos'), 'admin.php')),
234
+ 'title' => __('BuddyPress Media Covert Videos', BP_MEDIA_TXT_DOMAIN),
235
+ 'name' => __('Convert Videos', BP_MEDIA_TXT_DOMAIN),
236
+ 'class' => ($tab == 'bp-media-convert-videos') ? $active_class : $idle_class . ' last_tab'
237
+ );
238
+ }
239
+
240
+ $tabs = apply_filters('bp_media_add_sub_tabs', $tabs, $tab);
241
+ foreach ($tabs as $tab) {
242
+ $tabs_html.= '<a title="' . $tab['title'] . '" href="' . $tab['href'] . '" class="' . $tab['class'] . ' ' . sanitize_title($tab['name']) . '">' . $tab['name'] . '</a>';
243
+ }
244
+ echo $tabs_html;
245
+ }
246
+
247
+ /*
248
+ * Updates the media count of all users.
249
+ */
250
+
251
+ /**
252
+ *
253
+ * @global type $wpdb
254
+ * @return boolean
255
+ */
256
+ public function update_count() {
257
+ global $wpdb;
258
+
259
+ $query =
260
+ "SELECT
261
+ p.post_author,pmp.meta_value,
262
  SUM(CASE WHEN post_mime_type LIKE 'image%' THEN 1 ELSE 0 END) as Images,
263
  SUM(CASE WHEN post_mime_type LIKE 'audio%' THEN 1 ELSE 0 END) as Audio,
264
  SUM(CASE WHEN post_mime_type LIKE 'video%' THEN 1 ELSE 0 END) as Videos,
265
+ SUM(CASE WHEN post_type LIKE 'bp_media_album' THEN 1 ELSE 0 END) as Albums
 
266
  FROM
267
+ $wpdb->posts p inner join $wpdb->postmeta pm on pm.post_id = p.id INNER JOIN $wpdb->postmeta pmp
268
+ on pmp.post_id = p.id WHERE
269
+ pm.meta_key = 'bp-media-key' AND
270
+ pm.meta_value > 0 AND
271
+ pmp.meta_key = 'bp_media_privacy' AND
272
  ( post_mime_type LIKE 'image%' OR post_mime_type LIKE 'audio%' OR post_mime_type LIKE 'video%' OR post_type LIKE 'bp_media_album')
273
+ GROUP BY p.post_author,pmp.meta_value order by p.post_author";
274
+ $result = $wpdb->get_results($query);
275
+ if (!is_array($result))
276
+ return false;
277
+ $formatted = array();
278
+ foreach ($result as $obj) {
279
+ $formatted[$obj->post_author][$obj->meta_value] = array(
280
+ 'image' => $obj->Images,
281
+ 'video' => $obj->Videos,
282
+ 'audio' => $obj->Audio,
283
+ 'album' => $obj->Albums,
284
+ );
285
+ }
286
+
287
+ foreach ($formatted as $user => $obj) {
288
+ bp_update_user_meta($user, 'bp_media_count', $obj);
289
+ }
290
+ return true;
291
+ }
292
+
293
+ /* Multisite Save Options - http://wordpress.stackexchange.com/questions/64968/settings-api-in-multisite-missing-update-message#answer-72503 */
294
+
295
+ /**
296
+ *
297
+ * @global type $bp_media_admin
298
+ */
299
+ public function save_multisite_options() {
300
+ global $bp_media_admin;
301
+ if (isset($_POST['refresh-count'])) {
302
+ $bp_media_admin->update_count();
303
+ }
304
+ do_action('bp_media_sanitize_settings', $_POST);
305
+
306
+ if (isset($_POST['bp_media_options'])) {
307
+ bp_update_option('bp_media_options', $_POST['bp_media_options']);
308
+ //
309
+ // // redirect to settings page in network
310
+ wp_redirect(
311
+ add_query_arg(
312
+ array('page' => 'bp-media-settings', 'updated' => 'true'), (is_multisite() ? network_admin_url('admin.php') : admin_url('admin.php'))
313
+ )
314
+ );
315
+ exit;
316
+ }
317
+ }
318
+
319
+ /* Admin Sidebar */
320
+
321
+ /**
322
+ *
323
+ * @global type $bp_media
324
+ */
325
+ public function admin_sidebar() {
326
+ $current_user = wp_get_current_user();
327
+
328
+ $message = sprintf(__('I use @buddypressmedia http://goo.gl/8Upmv on %s', BP_MEDIA_TXT_DOMAIN), home_url());
329
+ $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>
330
  <ul>
331
  <li><a href="http://twitter.com/home/?status=' . $message . '" target= "_blank"><input type="button" value="' . __('Tweet', BP_MEDIA_TXT_DOMAIN) . '" class="button button-tweet"></a></li>
332
  <li><a href="http://wordpress.org/support/view/plugin-reviews/buddypress-media?rate=5#postform" target= "_blank"><input type="button" value="' . __('Rate on WordPress.org', BP_MEDIA_TXT_DOMAIN) . '" class="button button-rating"></a></li>
333
  </ul>';
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">
341
  <input type="hidden" name="cmd" value="_donations">
342
  <!-- Specify details about the contribution -->
343
  <input type="hidden" name="item_name" value="BuddyPress Media">
344
+ <label><b>' . __('USD', BP_MEDIA_TXT_DOMAIN) . '</b></label>
345
+ <input type="text" name="amount" size="3">
346
  <input type="hidden" name="currency_code" value="USD">
347
  <!-- Display the payment button. -->
348
  <input type="hidden" name="cpp_header_image" value="' . BP_MEDIA_URL . 'app/assets/img/rtcamp-logo.png">
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>';
353
+ new BPMediaAdminWidget('donate', __('Donate', BP_MEDIA_TXT_DOMAIN), $donate);
354
 
355
+ $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>
356
+ <div class="mc-field-group">
357
  <input type="email" value="' . $current_user->user_email . '" name="EMAIL" placeholder="Email" class="required email" id="mce-EMAIL">
358
  <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">
359
  <div id="mce-responses" class="clear">
368
  <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>
369
  <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>
370
  </ul>';
371
+ new BPMediaAdminWidget('branding', __('Subscribe', BP_MEDIA_TXT_DOMAIN), $branding);
372
+
373
+ $news = '<img src ="' . admin_url('/images/wpspin_light.gif') . '" /> Loading...';
374
+ new BPMediaAdminWidget('latest-news', __('Latest News', BP_MEDIA_TXT_DOMAIN), $news);
375
+ }
376
+
377
+ public function linkback() {
378
+ if (isset($_POST['linkback']) && $_POST['linkback']) {
379
+ return bp_update_option('bp_media_add_linkback', true);
380
+ } else {
381
+ return bp_update_option('bp_media_add_linkback', false);
382
+ }
383
+ die;
384
+ }
385
+
386
+ public function convert_videos_mailchimp_send() {
387
+ if ($_POST['interested'] == 'Yes' && !empty($_POST['choice'])) {
388
+ 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/'));
389
+ } else {
390
+ bp_update_option('bp-media-survey', 0);
391
+ }
392
+ echo 'Thank you for your time.';
393
+ die;
394
+ }
395
+
396
+ public function video_transcoding_survey_response(){
397
+ if ( isset($_GET['survey-done']) && ($_GET['survey-done'] == md5('survey-done')) ) {
398
+ bp_update_option('bp-media-survey', 0);
399
+ }
400
+ }
401
+
402
+ }
403
 
 
 
 
 
 
 
 
 
 
404
  }
 
 
 
 
 
 
405
  ?>
app/assets/css/main.css CHANGED
@@ -3,7 +3,8 @@
3
  */
4
  .bp_media_content img{max-width:98%;}
5
  .bp_media_content .mejs-poster img{max-width: 100%;}
6
- .bp_media_title {display:block;font-size:20px;font-weight:bold;}
 
7
  ul.bp-media-gallery{overflow: hidden}
8
  .bp_media_description {display:block;margin-top:20px;}
9
  ul.bp-media-gallery.item-list{overflow:visible;margin: 1% 0;width: auto;}
@@ -16,7 +17,7 @@ ul.bp-media-gallery li span img{height: 150px;}
16
  .bp-media-single .activity-list .activity-content,.bp-media-single div.activity-comments{margin-left:0;}
17
  #bp-media-selected-album{max-width: 320px;}
18
  /*li.media div.activity-content div.activity-inner p{display:none;}*/
19
- div.bp_media_title{margin-bottom:10px;}
20
  #bp-media-footer {color: #4D4D4D;text-align: center;text-shadow: #FAFAFA 1px 1px 0;}
21
  #wpbody-content div.metabox-fixed{width: 280px;margin-right: -300px;float: right;}
22
  #wpbody-content div.wrap.bp-media-admin .columns-2{margin-right:300px;padding-top: 0;margin-top: 15px;width: 600px}
@@ -124,8 +125,28 @@ ul#social li{display:inline;}
124
  ul#activity-stream li.media.album_updated ul{}
125
  ul#activity-stream li.media.album_updated ul li{float: left;margin-right:2%}
126
 
127
-
 
 
 
 
 
 
128
  /* Addons page Styling */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
  #bp-media-addons-list_metabox {background: #ffffff}
130
  .products ul:after, ul.products:after {clear: both;content: "";display: block;}
131
  .products ul, ul.products {clear: both;list-style: none outside none;margin: 0 0 14px;padding: 0;}
@@ -143,21 +164,7 @@ ul#activity-stream li.media.album_updated ul li{float: left;margin-right:2%}
143
  .coming-soon.coming-soon-l { background-position: 0 0; width:250px; top:-12px; left:-18px;}
144
  .coming-soon.coming-soon-r { background-position: 347px 0; width:174px; bottom:-14px; right:-12px;}
145
  .coming-soon.coming-soon-r:hover{background-position: 175px 0;}
146
- /*.bp-media-addon .add_to_cart_button{background-image: linear-gradient(bottom, #F7F6F7 47%, #DFDBDF 74%);
147
- background-image: -o-linear-gradient(bottom, #F7F6F7 0%, #DFDBDF 100%);
148
- background-image: -moz-linear-gradient(bottom, #F7F6F7 0%, #DFDBDF 100%);
149
- background-image: -webkit-linear-gradient(bottom, #F7F6F7 0%, #DFDBDF 100%);
150
- background-image: -ms-linear-gradient(bottom, #F7F6F7 0%, #DFDBDF 100%);
151
- background-image: -webkit-gradient(linear,left bottom,left top,color-stop(0, #F7F6F7),color-stop(1, #DFDBDF));
152
- border: 1px solid #C7C0C7;border-radius: 2px 2px 2px 2px;box-shadow: 0 -1px 0 rgba(0, 0, 0, 0.075) inset, 0 1px 0 rgba(255, 255, 255, 0.3) inset, 0 1px 2px rgba(0, 0, 0, 0.1);color: #5E5E5E;cursor: pointer;font-family: inherit;font-size: 14px;font-weight: bold;float: right;left: auto;margin: 0;overflow: visible;padding: 6px 10px;position: relative;text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);font-family: "HelveticaNeue-Light","Helvetica Neue Light","Helvetica Neue",sans-serif;}
153
-
154
- .bp-media-addon .add_to_cart_button:hover{background-image: linear-gradient(bottom, #F7F6F7 47%, #DFDBDF 74%);
155
- background-image: -o-linear-gradient(bottom, #F7F6F7 0%, #D3CED3 100%);
156
- background-image: -moz-linear-gradient(bottom, #F7F6F7 0%, #D3CED3 100%);
157
- background-image: -webkit-linear-gradient(bottom, #F7F6F7 0%, #D3CED3 100%);
158
- background-image: -ms-linear-gradient(bottom, #F7F6F7 0%, #D3CED3 100%);
159
- background-image: -webkit-gradient(linear,left bottom,left top,color-stop(1, #F7F6F7),color-stop(1, #D3CED3));}
160
- */
161
  .bp-media-addon .product_footer{margin: 20px 0 0;overflow: hidden;}
162
  .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)}
163
  .bp-media-addon .product_footer .product_demo_link{font-size: 16px;margin: 8px 20px; font-weight: bold}
@@ -188,12 +195,31 @@ background-image: -webkit-gradient(linear,left bottom,left top,color-stop(1, #F7
188
  .template_select_label{float: left}
189
  .template_select_container{overflow-x:scroll; width:405px;float: left}
190
  #bp_media_settings_form .support_form_laoder{height: 100px; width: 200px; background: url("../img/loader.gif") no-repeat }
191
- /* Miscellinus */
192
  #normal-sortables .postbox .bp-media-form .submit{float: none; margin-left: 150px}
193
  .rt-success{background-color: #E1FFDF;border-color: #2ACF2A;}
194
  .rt-update{background-color: #FFEAA6;border-color:#E1CA82;}
195
  img.bp-media-donation-image{display:block;margin: 10px auto;}
196
  #donate form{text-align: center;}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
197
 
198
  @media (min-width: 981px) and (max-width: 1096px) {
199
  li #bp-media-upload-ui #drag-drop-area{padding: 10px 0;}
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;}
8
  ul.bp-media-gallery{overflow: hidden}
9
  .bp_media_description {display:block;margin-top:20px;}
10
  ul.bp-media-gallery.item-list{overflow:visible;margin: 1% 0;width: auto;}
17
  .bp-media-single .activity-list .activity-content,.bp-media-single div.activity-comments{margin-left:0;}
18
  #bp-media-selected-album{max-width: 320px;}
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}
125
  ul#activity-stream li.media.album_updated ul{}
126
  ul#activity-stream li.media.album_updated ul li{float: left;margin-right:2%}
127
 
128
+ .wrap.bp-media-admin .bp-media-settings-tabs a.nav-tab{padding-left:20px;background:url('../img/tab-icon.png') 3px -4px no-repeat;}
129
+ .wrap.bp-media-admin .bp-media-settings-tabs a.nav-tab.addons{background-position-y:-34px;}
130
+ .wrap.bp-media-admin .bp-media-settings-tabs a.nav-tab.support{background-position-y:-64px;}
131
+ .wrap.bp-media-admin .bp-media-settings-tabs a.nav-tab.update-database{background-position-y:-94px;}
132
+ .wrap.bp-media-admin .bp-media-settings-tabs a.nav-tab.ffmpeg{background-position-y:-154px;}
133
+ .wrap.bp-media-admin .bp-media-settings-tabs a.nav-tab.kaltura{background-position-y:-184px;}
134
+ .wrap.bp-media-admin .bp-media-settings-tabs a.nav-tab.convert-videos{background-position-y:-214px;}
135
  /* Addons page Styling */
136
+
137
+ a.toplevel_page_bp-media-settings div.wp-menu-image{
138
+ background:url('../img/admin-menu.png') 0 -32px no-repeat;
139
+ }
140
+ .media ul#bp-media-upload-set-privacy li input[type="radio"]{float:left;}
141
+ #rt-donate-button, .rt-link img{vertical-align: middle;}
142
+ #adminmenu .menu-icon-generic.toplevel_page_bp-media-settings div.wp-menu-image{
143
+ background-position: 0 -32px;
144
+ }
145
+ #adminmenu .menu-icon-generic.wp-has-current-submenu.toplevel_page_bp-media-settings div.wp-menu-image,
146
+ #adminmenu .menu-icon-generic.toplevel_page_bp-media-settings:hover div.wp-menu-image{
147
+ background-position-y:0;
148
+ }
149
+
150
  #bp-media-addons-list_metabox {background: #ffffff}
151
  .products ul:after, ul.products:after {clear: both;content: "";display: block;}
152
  .products ul, ul.products {clear: both;list-style: none outside none;margin: 0 0 14px;padding: 0;}
164
  .coming-soon.coming-soon-l { background-position: 0 0; width:250px; top:-12px; left:-18px;}
165
  .coming-soon.coming-soon-r { background-position: 347px 0; width:174px; bottom:-14px; right:-12px;}
166
  .coming-soon.coming-soon-r:hover{background-position: 175px 0;}
167
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
168
  .bp-media-addon .product_footer{margin: 20px 0 0;overflow: hidden;}
169
  .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)}
170
  .bp-media-addon .product_footer .product_demo_link{font-size: 16px;margin: 8px 20px; font-weight: bold}
195
  .template_select_label{float: left}
196
  .template_select_container{overflow-x:scroll; width:405px;float: left}
197
  #bp_media_settings_form .support_form_laoder{height: 100px; width: 200px; background: url("../img/loader.gif") no-repeat }
198
+ /* Miscellaneous */
199
  #normal-sortables .postbox .bp-media-form .submit{float: none; margin-left: 150px}
200
  .rt-success{background-color: #E1FFDF;border-color: #2ACF2A;}
201
  .rt-update{background-color: #FFEAA6;border-color:#E1CA82;}
202
  img.bp-media-donation-image{display:block;margin: 10px auto;}
203
  #donate form{text-align: center;}
204
+ /* Privacy settings */
205
+ #bp-media-upload-set-privacy li{margin: 10px 0;overflow: hidden;}
206
+ #bp-media-upload-set-privacy .album-set-privacy-radio{}
207
+ #bp-media-upload-set-privacy .album-set-privacy-label{margin: 0;font-weight: normal;}
208
+ /*Transcoding Teaser*/
209
+ .para-blockquote { background: #E5E5E5; padding: 10px; font-style: italic; }
210
+
211
+ #rtprogressbar {
212
+ background-color: #444;
213
+ border-radius: 13px;
214
+ padding: 3px;
215
+ }
216
+
217
+ #rtprogressbar div {
218
+ background-color: #fb6003;
219
+ width: 0;
220
+ height: 20px;
221
+ border-radius: 10px;
222
+ }
223
 
224
  @media (min-width: 981px) and (max-width: 1096px) {
225
  li #bp-media-upload-ui #drag-drop-area{padding: 10px 0;}
app/assets/img/admin-menu.png ADDED
Binary file
app/assets/img/donate.gif DELETED
Binary file
app/assets/img/donate.png DELETED
Binary file
app/assets/img/paypal-donate-button.png ADDED
Binary file
app/assets/img/rtcamp-logo.png CHANGED
Binary file
app/assets/img/tab-icon.png ADDED
Binary file
app/assets/js/admin.js CHANGED
@@ -1,74 +1,159 @@
1
  jQuery(document).ready(function(){
2
 
3
- /* Linkback */
4
- jQuery('#spread-the-word').on('click','#bp-media-add-linkback',function(){
5
- var data = {
6
- action: 'bp_media_linkback',
7
- linkback: jQuery('#bp-media-add-linkback:checked').length
8
- };
9
- jQuery.post(bp_media_admin_ajax,data,function(response){
10
- });
11
- })
12
-
13
- /* Fetch Feed */
14
- var bp_media_news_section = jQuery('#latest-news');
15
- if(bp_media_news_section.length>0){
16
- var data = {
17
- action: 'bp_media_fetch_feed'
18
- };
19
- jQuery.post(bp_media_admin_ajax,data,function(response){
20
- bp_media_news_section.find('.inside').html(response);
21
- });
22
- }
23
 
24
- /* Select Request */
25
- jQuery('#bp-media-settings-boxes').on('change', '#select-request', function(){
26
- if(jQuery(this).val()){
27
- jQuery('#bp_media_settings_form .bp-media-metabox-holder').html()
28
- jQuery('#bp_media_settings_form .bp-media-metabox-holder').html('<div class="support_form_laoder"></div>');
29
- var data = {
30
- action: 'bp_media_select_request',
31
- form: jQuery(this).val()
32
- };
33
-
34
- // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
35
- jQuery.post(ajaxurl, data, function(response) {
36
- jQuery('#bp_media_settings_form .bp-media-metabox-holder').html()
37
- jQuery('#bp_media_settings_form .bp-media-metabox-holder').html(response).fadeIn('slow');
38
- });
39
- }
40
- });
41
 
42
- /* Cancel Request */
43
- jQuery('#bp-media-settings-boxes').on('click', '#cancel-request', function(){
44
- if(jQuery(this).val()){
45
- jQuery('#bp_media_settings_form .bp-media-metabox-holder').html()
46
- jQuery('#bp_media_settings_form .bp-media-metabox-holder').html('<div class="support_form_laoder"></div>');
47
- var data = {
48
- action: 'bp_media_cancel_request'
49
- };
50
-
51
- // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
52
- jQuery.post(ajaxurl, data, function(response) {
53
- jQuery('#bp_media_settings_form .bp-media-metabox-holder').html()
54
- jQuery('#bp_media_settings_form .bp-media-metabox-holder').html(response).fadeIn('slow');
55
- });
56
- }
57
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
 
59
- /* Submit Request */
60
- jQuery('.bp-media-support').on('submit', '#bp_media_settings_form', function(e){
61
- e.preventDefault();
62
- var data = {
63
- action: 'bp_media_submit_request',
64
- form_data: jQuery('form').serialize()
65
- };
66
-
67
- // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
68
- jQuery.post(ajaxurl, data, function(response) {
69
- jQuery('#bp_media_settings_form .bp-media-metabox-holder').html()
70
- jQuery('#bp_media_settings_form .bp-media-metabox-holder').html(response).fadeIn('slow');
71
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  });
 
 
73
 
74
- });
1
  jQuery(document).ready(function(){
2
 
3
+ /* Linkback */
4
+ jQuery('#spread-the-word').on('click','#bp-media-add-linkback',function(){
5
+ var data = {
6
+ action: 'bp_media_linkback',
7
+ linkback: jQuery('#bp-media-add-linkback:checked').length
8
+ };
9
+ jQuery.post(bp_media_admin_ajax,data,function(response){
10
+ });
11
+ })
 
 
 
 
 
 
 
 
 
 
 
12
 
13
+ /* Fetch Feed */
14
+ var bp_media_news_section = jQuery('#latest-news');
15
+ if(bp_media_news_section.length>0){
16
+ var data = {
17
+ action: 'bp_media_fetch_feed'
18
+ };
19
+ jQuery.post(bp_media_admin_ajax,data,function(response){
20
+ bp_media_news_section.find('.inside').html(response);
21
+ });
22
+ }
 
 
 
 
 
 
 
23
 
24
+ /* Select Request */
25
+ jQuery('#bp-media-settings-boxes').on('change', '#select-request', function(){
26
+ if(jQuery(this).val()){
27
+ jQuery('#bp_media_settings_form .bp-media-metabox-holder').html()
28
+ jQuery('#bp_media_settings_form .bp-media-metabox-holder').html('<div class="support_form_laoder"></div>');
29
+ var data = {
30
+ action: 'bp_media_select_request',
31
+ form: jQuery(this).val()
32
+ };
33
+
34
+ // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
35
+ jQuery.post(ajaxurl, data, function(response) {
36
+ jQuery('#bp_media_settings_form .bp-media-metabox-holder').html()
37
+ jQuery('#bp_media_settings_form .bp-media-metabox-holder').html(response).fadeIn('slow');
38
+ });
39
+ }
40
+ });
41
+
42
+ /* Cancel Request */
43
+ jQuery('#bp-media-settings-boxes').on('click', '#cancel-request', function(){
44
+ if(jQuery(this).val()){
45
+ jQuery('#bp_media_settings_form .bp-media-metabox-holder').html()
46
+ jQuery('#bp_media_settings_form .bp-media-metabox-holder').html('<div class="support_form_laoder"></div>');
47
+ var data = {
48
+ action: 'bp_media_cancel_request'
49
+ };
50
+
51
+ // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
52
+ jQuery.post(ajaxurl, data, function(response) {
53
+ jQuery('#bp_media_settings_form .bp-media-metabox-holder').html()
54
+ jQuery('#bp_media_settings_form .bp-media-metabox-holder').html(response).fadeIn('slow');
55
+ });
56
+ }
57
+ });
58
+
59
+ /* Submit Request */
60
+ jQuery('.bp-media-support').on('submit', '#bp_media_settings_form', function(e){
61
+ e.preventDefault();
62
+ var data = {
63
+ action: 'bp_media_submit_request',
64
+ form_data: jQuery('form').serialize()
65
+ };
66
+
67
+ // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
68
+ jQuery.post(ajaxurl, data, function(response) {
69
+ jQuery('#bp_media_settings_form .bp-media-metabox-holder').html()
70
+ jQuery('#bp_media_settings_form .bp-media-metabox-holder').html(response).fadeIn('slow');
71
+ });
72
+ });
73
 
74
+ function fireRequest(data) {
75
+ return jQuery.post(ajaxurl, data, function(response){
76
+ if(response != 0){
77
+ var redirect = false;
78
+ var progw = Math.ceil((((parseInt(response)*20)+parseInt(data.values['finished']))/parseInt(data.values['total'])) *100);
79
+ console.log(progw);
80
+ if(progw>100){progw=100;redirect=true};
81
+ jQuery('#rtprogressbar>div').css('width',progw+'%');
82
+ finished = jQuery('#rtprivacyinstaller span.finished').html();
83
+ jQuery('#rtprivacyinstaller span.finished').html(parseInt(finished)+data.count);
84
+ if ( redirect ) {
85
+ jQuery.post(ajaxurl, { action: 'bp_media_privacy_redirect' }, function(response){
86
+ window.location = settings_url;
87
+ });
88
+ }
89
+ } else {
90
+ jQuery('#map_progress_msgs').html('<div class="map_mapping_failure">Row '+response+' failed.</div>');
91
+ }
92
+ });
93
+ }
94
+
95
+ jQuery('#rtprivacyinstall').click(function(e){
96
+ e.preventDefault();
97
+ $progress_parent = jQuery('#rtprivacyinstaller');
98
+ $progress_parent.find('.rtprivacytype').each(function(){
99
+ $type=jQuery(this).attr('id');
100
+ if($type=='total'){
101
+ $values=[];
102
+ jQuery(this).find('input').each(function(){
103
+
104
+ $values [jQuery(this).attr('name')]=[jQuery(this).val()];
105
+
106
+ });
107
+ $data = {};
108
+ for(var i=1;i<=$values['steps'][0];i++ ){
109
+ $count=20;
110
+ if(i==$values['steps'][0]){
111
+ $count=parseInt($values['laststep'][0]);
112
+ if($count==0){$count=20};
113
+ }
114
+ newvals = {
115
+ 'page':i,
116
+ 'action':'bp_media_privacy_install',
117
+ 'count':$count,
118
+ 'values':$values
119
+ }
120
+ $data[i] = newvals;
121
+ }
122
+ var $startingpoint = jQuery.Deferred();
123
+ $startingpoint.resolve();
124
+ jQuery.each($data, function(i, v){
125
+ $startingpoint = $startingpoint.pipe( function() {
126
+ return fireRequest(v);
127
+ });
128
+ });
129
+
130
+
131
+ }
132
+ });
133
+ });
134
+
135
+ jQuery('#bp-media-settings-boxes').on('click','.interested',function(){
136
+ jQuery('.interested-container').removeClass('hidden');
137
+ jQuery('.choice-free').attr('required','required');
138
+ });
139
+ jQuery('#bp-media-settings-boxes').on('click','.not-interested',function(){
140
+ jQuery('.interested-container').addClass('hidden');
141
+ jQuery('.choice-free').removeAttr('required');
142
+ });
143
+
144
+ jQuery('#video-transcoding-main-container').on('click','.video-transcoding-survey',function(e){
145
+ e.preventDefault();
146
+ var data = {
147
+ action: 'bp_media_convert_videos_form',
148
+ email: jQuery('.email').val(),
149
+ url: jQuery('.url').val(),
150
+ choice: jQuery('input[name="choice"]:checked').val(),
151
+ interested: jQuery('input[name="interested"]:checked').val()
152
+ }
153
+ jQuery.post(ajaxurl, data, function(response){
154
+ jQuery('#video-transcoding-main-container').html('<p><strong>'+response+'</strong></p>');
155
  });
156
+ return false;
157
+ });
158
 
159
+ });
app/assets/js/bp-media-uploader.js CHANGED
@@ -4,7 +4,7 @@
4
  */
5
 
6
  jQuery(document).ready(function(){
7
-
8
  var selected = jQuery('#bp-media-album-prompt select').val();
9
  var in_list = 0;
10
  if(jQuery('#'+bp_media_uploader_params.container).length==0)
@@ -60,7 +60,7 @@ jQuery(document).ready(function(){
60
  if ( in_list == 0 )
61
  jQuery('#bp-media-album-prompt p').show();
62
  });
63
-
64
  //Normal Uplaoder
65
  var bp_media_is_multiple_upload = false;
66
  var bp_media_uploader=new plupload.Uploader(bp_media_uploader_params);
@@ -115,6 +115,6 @@ jQuery(document).ready(function(){
115
  } else
116
  location.reload(true);
117
  });
118
-
119
-
120
  });
4
  */
5
 
6
  jQuery(document).ready(function(){
7
+
8
  var selected = jQuery('#bp-media-album-prompt select').val();
9
  var in_list = 0;
10
  if(jQuery('#'+bp_media_uploader_params.container).length==0)
60
  if ( in_list == 0 )
61
  jQuery('#bp-media-album-prompt p').show();
62
  });
63
+
64
  //Normal Uplaoder
65
  var bp_media_is_multiple_upload = false;
66
  var bp_media_uploader=new plupload.Uploader(bp_media_uploader_params);
115
  } else
116
  location.reload(true);
117
  });
118
+
119
+
120
  });
app/assets/js/main.js CHANGED
@@ -21,11 +21,6 @@ jQuery(document).ready(function(){
21
  jQuery(bp_media_recent_tabs).tabs();
22
  }
23
 
24
- // var bp_media_popular_tabs = jQuery('#popular-media-tabs');
25
- // if(bp_media_popular_tabs.length>0){
26
- // jQuery( bp_media_popular_tabs ).tabs();
27
- // }
28
-
29
  var tallest = 0;
30
  jQuery('#recent-media-tabs .bp-media-tab-panel').each(function() {
31
 
@@ -69,35 +64,22 @@ jQuery(document).ready(function(){
69
  },1000);
70
 
71
  /* Add Featured Image */
72
-
73
- jQuery('.bp-media-featured').live('click',function(e){
74
  e.preventDefault();
75
  var post_id = jQuery(this).attr('data-post-id');
76
- var post_date = new Date();
77
- var feature = bp_media_vars.feature;
78
- var rfeature = bp_media_vars.removefeature;
79
- var date = post_date.getFullYear()+'-'+(post_date.getMonth() + 1) +'-'+post_date.getDate()+' '+ post_date.getHours()+':'+(post_date.getMinutes() + 1)+':'+(post_date.getSeconds()+1);
80
- var curr_obj = jQuery(this);
81
- var remove_featured = 0;
82
- if(jQuery(this).attr('data-remove-featured')){
83
- remove_featured = jQuery(this).attr('data-remove-featured');
 
 
 
84
  }
85
- jQuery.ajax({
86
- url:bp_media_vars.ajax_url,
87
- type:'POST',
88
- data:'action=my_featured_action&post_id='+post_id+'&remove_featured='+remove_featured+'&post_date='+date,
89
- success:function( results )
90
- {
91
- if(remove_featured == 1){
92
- curr_obj.text(feature);
93
- curr_obj.attr('data-remove-featured','0');
94
- } else {
95
- curr_obj.text(rfeature);
96
- curr_obj.attr('data-remove-featured','1');
97
- }
98
-
99
- }
100
- });
101
  });
102
 
103
  });
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
 
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
  });
app/helper/BPMediaSettings.php CHANGED
@@ -11,6 +11,11 @@ if (!class_exists('BPMediaSettings')) {
11
 
12
  public function __construct() {
13
  add_action('admin_init', array($this, 'settings'));
 
 
 
 
 
14
  }
15
 
16
  /**
@@ -25,7 +30,7 @@ if (!class_exists('BPMediaSettings')) {
25
  */
26
  public function settings() {
27
  global $bp_media_addon;
28
- add_settings_section('bpm-media-type', __('Enable BuddyPress Media on', BP_MEDIA_TXT_DOMAIN), '', 'bp-media-settings');
29
  // add_settings_field('bpm-admin-profile', __('User profiles', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-media-type', array(
30
  // 'setting' => 'bp_media_options',
31
  // 'option' => 'enable_on_profile',
@@ -35,37 +40,70 @@ if (!class_exists('BPMediaSettings')) {
35
  add_settings_field('bpm-admin-group', __('Groups', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-media-type', array(
36
  'setting' => 'bp_media_options',
37
  'option' => 'enable_on_group',
38
- 'desc' => __('Check to enable BuddyPress Media in Groups', BP_MEDIA_TXT_DOMAIN)
39
  )
40
  );
41
 
42
- add_settings_section('bpm-settings', __('Enable Media Types on', BP_MEDIA_TXT_DOMAIN), is_multisite() ? array($this, 'network_notices') : '', 'bp-media-settings');
43
  add_settings_field('bpm-video', __('Video', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-settings', array(
44
  'setting' => 'bp_media_options',
45
  'option' => 'videos_enabled',
46
- 'desc' => __('Check to enable video upload functionality', BP_MEDIA_TXT_DOMAIN)
47
  ));
48
  add_settings_field('bpm-audio', __('Audio', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-settings', array(
49
  'setting' => 'bp_media_options',
50
  'option' => 'audio_enabled',
51
- 'desc' => __('Check to enable audio upload functionality', BP_MEDIA_TXT_DOMAIN)
52
  ));
53
  add_settings_field('bpm-image', __('Images', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-settings', array(
54
  'setting' => 'bp_media_options',
55
  'option' => 'images_enabled',
56
- 'desc' => __('Check to enable images upload functionality', BP_MEDIA_TXT_DOMAIN)
57
  ));
58
 
59
- add_settings_section('bpm-miscellaneous', __('Miscellaneous Settings', BP_MEDIA_TXT_DOMAIN), '', 'bp-media-settings');
60
- add_settings_field('bpm-download', __('Download', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-miscellaneous', array(
 
 
 
 
 
61
  'setting' => 'bp_media_options',
62
  'option' => 'download_enabled',
63
- 'desc' => __('Check to enable download functionality', BP_MEDIA_TXT_DOMAIN)
64
  ));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  add_settings_field('bpm-admin-bar-menu', __('Admin bar menu', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-miscellaneous', array(
66
  'setting' => 'bp_media_options',
67
  'option' => 'show_admin_menu',
68
- 'desc' => __('Check to enable menu in WordPress admin bar', BP_MEDIA_TXT_DOMAIN)
69
  )
70
  );
71
  add_settings_field('bpm-other-settings', __('Re-Count Media Entries', BP_MEDIA_TXT_DOMAIN), array($this, 'button'), 'bp-media-settings', 'bpm-miscellaneous', array(
@@ -83,9 +121,45 @@ if (!class_exists('BPMediaSettings')) {
83
  'new_feature' => __('Suggest a New Feature', BP_MEDIA_TXT_DOMAIN),
84
  'bug_report' => __('Submit a Bug Report', BP_MEDIA_TXT_DOMAIN))
85
  ));
 
 
 
 
 
 
 
 
86
  register_setting('bp_media', 'bp_media_options', array($this, 'sanitize'));
87
  }
88
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  public function network_notices() {
90
  $flag = 1;
91
  if (get_site_option('bpm-media-enable', false)) {
@@ -140,13 +214,13 @@ if (!class_exists('BPMediaSettings')) {
140
  add_settings_error(__('Recount Fail', BP_MEDIA_TXT_DOMAIN), 'bpm-recount-fail', __('Recounting Failed', BP_MEDIA_TXT_DOMAIN));
141
  }
142
  }
143
- if (!isset($_POST['bp_media_options']['enable_on_profile']) && !isset($_POST['bp_media_options']['enable_on_group'])) {
144
- if (is_multisite())
145
- update_site_option('bpm-media-enable', __('Enable BuddyPress Media on either User Profiles or Groups or both. Atleast one should be selected.', BP_MEDIA_TXT_DOMAIN));
146
- else
147
- add_settings_error(__('Enable BuddyPress Media', BP_MEDIA_TXT_DOMAIN), 'bpm-media-enable', __('Enable BuddyPress Media on either User Profiles or Groups or both. Atleast one should be selected.', BP_MEDIA_TXT_DOMAIN));
148
- $input['enable_on_profile'] = 1;
149
- }
150
  if (!isset($_POST['bp_media_options']['videos_enabled']) && !isset($_POST['bp_media_options']['audio_enabled']) && !isset($_POST['bp_media_options']['images_enabled'])) {
151
  if (is_multisite())
152
  update_site_option('bpm-media-type', __('Atleast one Media Type Must be selected', BP_MEDIA_TXT_DOMAIN));
@@ -155,7 +229,7 @@ if (!class_exists('BPMediaSettings')) {
155
  $input['images_enabled'] = 1;
156
  }
157
  if (is_multisite())
158
- update_site_option('bpm-settings-saved', __('Settings saved.', BP_MEDIA_FFMPEG_TXT_DOMAIN));
159
  do_action('bp_media_sanitize_settings', $_POST, $input);
160
  return $input;
161
  }
@@ -199,7 +273,7 @@ if (!class_exists('BPMediaSettings')) {
199
  ?>
200
  <label for="<?php echo $option; ?>">
201
  <input<?php checked($options[$option]); ?> name="<?php echo $name; ?>" id="<?php echo $option; ?>" value="1" type="checkbox" />
202
- <?php echo $desc; ?>
203
  </label><?php
204
  }
205
 
@@ -246,7 +320,7 @@ if (!class_exists('BPMediaSettings')) {
246
  }
247
 
248
  foreach ($radios as $value => $desc) {
249
- ?>
250
  <label for="<?php echo sanitize_title($desc); ?>"><input<?php checked($options[$option], $value); ?> value="<?php echo $value; ?>" name="<?php echo $name; ?>" id="<?php echo sanitize_title($desc); ?>" type="radio" /><?php echo $desc; ?></label><br /><?php
251
  }
252
  }
@@ -272,6 +346,7 @@ if (!class_exists('BPMediaSettings')) {
272
  'option' => '',
273
  'desc' => '',
274
  'password' => false,
 
275
  );
276
  $args = wp_parse_args($args, $defaults);
277
  extract($args);
@@ -289,12 +364,12 @@ if (!class_exists('BPMediaSettings')) {
289
  if ((isset($options[$option]) && empty($options[$option])) || !isset($options[$option])) {
290
  $options[$option] = '';
291
  }
292
- ?>
293
- <label for="<?php echo sanitize_title($option); ?>"><input value="<?php echo $options[$option]; ?>" name="<?php echo $name; ?>" id="<?php echo sanitize_title($option); ?>" type="<?php echo $password ? 'password' : 'text'; ?>" /><?php
294
  if (!empty($desc)) {
295
  echo '<br /><span class="description">' . $desc . '</span>';
296
  }
297
- ?></label><br /><?php
298
  }
299
 
300
  /**
@@ -335,14 +410,14 @@ if (!class_exists('BPMediaSettings')) {
335
  if ((isset($options[$option]) && empty($options[$option])) || !isset($options[$option])) {
336
  $options[$option] = '';
337
  }
338
- ?>
339
  <select name="<?php echo $name; ?>" id="<?php echo $option; ?>"><?php if ($none) { ?>
340
  <option><?php __e('None', BP_MEDIA_TXT_DOMAIN); ?></option><?php
341
  }
342
  foreach ($values as $value => $text) {
343
- ?>
344
- <option<?php selected($options[$option], $value); ?> value="<?php echo $value; ?>"><?php echo $text; ?></option><?php }
345
  ?>
 
 
346
  </select><?php
347
  }
348
 
@@ -377,12 +452,28 @@ if (!class_exists('BPMediaSettings')) {
377
  $button = $option;
378
  submit_button($name, '', $button, false);
379
  if (!empty($desc)) {
380
- ?>
381
  <span class="description"><?php echo $desc; ?></a><?php
382
  }
383
  }
384
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
385
  }
386
 
387
  }
388
- ?>
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
  /**
30
  */
31
  public function settings() {
32
  global $bp_media_addon;
33
+ add_settings_section('bpm-media-type', __('Activate BuddyPress Media', BP_MEDIA_TXT_DOMAIN), '', 'bp-media-settings');
34
  // add_settings_field('bpm-admin-profile', __('User profiles', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-media-type', array(
35
  // 'setting' => 'bp_media_options',
36
  // 'option' => 'enable_on_profile',
40
  add_settings_field('bpm-admin-group', __('Groups', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-media-type', array(
41
  'setting' => 'bp_media_options',
42
  'option' => 'enable_on_group',
43
+ 'desc' => __('Enable BuddyPress Media in Groups', BP_MEDIA_TXT_DOMAIN)
44
  )
45
  );
46
 
47
+ add_settings_section('bpm-settings', __('Enabled Media Types', BP_MEDIA_TXT_DOMAIN), is_multisite() ? array($this, 'network_notices') : '', 'bp-media-settings');
48
  add_settings_field('bpm-video', __('Video', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-settings', array(
49
  'setting' => 'bp_media_options',
50
  'option' => 'videos_enabled',
51
+ 'desc' => __('Enable videos', BP_MEDIA_TXT_DOMAIN)
52
  ));
53
  add_settings_field('bpm-audio', __('Audio', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-settings', array(
54
  'setting' => 'bp_media_options',
55
  'option' => 'audio_enabled',
56
+ 'desc' => __('Enable audio', BP_MEDIA_TXT_DOMAIN)
57
  ));
58
  add_settings_field('bpm-image', __('Images', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-settings', array(
59
  'setting' => 'bp_media_options',
60
  'option' => 'images_enabled',
61
+ 'desc' => __('Enable images', BP_MEDIA_TXT_DOMAIN)
62
  ));
63
 
64
+ add_settings_section('bpm-media-fine', __('Media Display', BP_MEDIA_TXT_DOMAIN), '', 'bp-media-settings');
65
+ add_settings_field('bpm-media-count', __('No. of media items per view', BP_MEDIA_TXT_DOMAIN), array($this, 'textbox'), 'bp-media-settings', 'bpm-media-fine', array(
66
+ 'setting' => 'bp_media_options',
67
+ 'option' => 'default_count',
68
+ 'desc' => __('No. of media items displayed per view (defaults to 10)', BP_MEDIA_TXT_DOMAIN)
69
+ ));
70
+ add_settings_field('bpm-download', __('Download Button', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-media-fine', array(
71
  'setting' => 'bp_media_options',
72
  'option' => 'download_enabled',
73
+ 'desc' => __('Display download button under media', BP_MEDIA_TXT_DOMAIN)
74
  ));
75
+ if (BPMediaPrivacy::is_installed()) {
76
+ add_settings_section('bpm-privacy', __('Privacy', BP_MEDIA_TXT_DOMAIN), '', 'bp-media-settings');
77
+ add_settings_field('bpm-privacy-enabled', __('Enable Privacy', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-privacy', array(
78
+ 'setting' => 'bp_media_options',
79
+ 'option' => 'privacy_enabled',
80
+ 'desc' => __('Enable privacy', BP_MEDIA_TXT_DOMAIN)
81
+ ));
82
+
83
+ add_settings_section('bpm-privacy-levels', __('Default Privacy Levels', BP_MEDIA_TXT_DOMAIN), '', 'bp-media-settings');
84
+ add_settings_field('bpm-privacy-override-enabled', __('User Override', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-privacy-levels', array(
85
+ 'setting' => 'bp_media_options',
86
+ 'option' => 'privacy_override_enabled',
87
+ 'desc' => __('Allow users to set privacy and override the defaults', BP_MEDIA_TXT_DOMAIN)
88
+ ));
89
+ add_settings_field('bpm-privacy-private-enabled', __('Default Privacy', BP_MEDIA_TXT_DOMAIN), array($this, 'radio'), 'bp-media-settings', 'bpm-privacy-levels', array(
90
+ 'setting' => 'bp_media_options',
91
+ 'option' => 'default_privacy_level',
92
+ 'radios' => array(
93
+ 6 => __('<strong>Private</strong>, Visible only to the user', BP_MEDIA_TXT_DOMAIN),
94
+ 4 => __('<strong>Friends</strong>, Visible to user\'s friends', BP_MEDIA_TXT_DOMAIN),
95
+ 2 => __('<strong>Users</strong>, Visible to registered users', BP_MEDIA_TXT_DOMAIN),
96
+ 0 => __('<strong>Public</strong>, Visible to the world', BP_MEDIA_TXT_DOMAIN)
97
+ ),
98
+ 'default' => 0,
99
+ ));
100
+ }
101
+ add_settings_section('bpm-miscellaneous', __('Miscellaneous Settings', BP_MEDIA_TXT_DOMAIN), '', 'bp-media-settings');
102
+
103
  add_settings_field('bpm-admin-bar-menu', __('Admin bar menu', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-miscellaneous', array(
104
  'setting' => 'bp_media_options',
105
  'option' => 'show_admin_menu',
106
+ 'desc' => __('Enable menu in WordPress admin bar', BP_MEDIA_TXT_DOMAIN)
107
  )
108
  );
109
  add_settings_field('bpm-other-settings', __('Re-Count Media Entries', BP_MEDIA_TXT_DOMAIN), array($this, 'button'), 'bp-media-settings', 'bpm-miscellaneous', array(
121
  'new_feature' => __('Suggest a New Feature', BP_MEDIA_TXT_DOMAIN),
122
  'bug_report' => __('Submit a Bug Report', BP_MEDIA_TXT_DOMAIN))
123
  ));
124
+ if (!BPMediaPrivacy::is_installed()) {
125
+ $bp_media_privacy = new BPMediaPrivacySettings();
126
+ add_filter('bp_media_add_sub_tabs', array($bp_media_privacy, 'ui'), 99, 2);
127
+ add_settings_section('bpm-privacy', __('Update Database', BP_MEDIA_TXT_DOMAIN), array($bp_media_privacy, 'init'), 'bp-media-privacy');
128
+ }
129
+
130
+ add_settings_section('bpm-convert-videos', '', array($this, 'convert_videos_form'), 'bp-media-convert-videos');
131
+
132
  register_setting('bp_media', 'bp_media_options', array($this, 'sanitize'));
133
  }
134
 
135
+ public function convert_videos_form() {
136
+ global $current_user;
137
+ get_currentuserinfo();
138
+ ?>
139
+ <div id="video-transcoding-main-container">
140
+ <h2>Survey</h2>
141
+ <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>
142
+ <h3>Would you be interested?</h3>
143
+ <label><input class="interested" name="interested" type="radio" value="Yes" required="required" /> Yes</label>&nbsp;&nbsp;&nbsp;
144
+ <label><input class="not-interested" name="interested" type="radio" value="No" required="required" /> No</label>
145
+ <div class="interested-container hidden">
146
+ <p class="para-blockquote">Glad to see your interest.<br />
147
+ Please provide a little more information to help us plan this service better.</p>
148
+ <label><h3>Email</h3> <input class="email" type="email" name="email" size="35" value="<?php echo $current_user->user_email; ?>" placeholder="Email" /></label>
149
+
150
+ <h3>How would you use this feature?</h3>
151
+ <ul>
152
+ <li><label><input class="choice-free" type="radio" name="choice" value="Free" /> Free-only. I will use free-encoding quota only.</label></li>
153
+ <li><label><input type="radio" name="choice" value="$9" /> I am ready to pay $9 per month for generous encoding quota.</label></li>
154
+ <li><label><input type="radio" name="choice" value="$99" /> I am ready to pay $99 per month for unlimited video encoding!</label></li>
155
+ </div>
156
+ <input class="url" type="hidden" name="url" value="<?php echo home_url(); ?>" />
157
+ <br />
158
+ <br />
159
+ <input class="button button-primary video-transcoding-survey" type="submit" value="Submit" />
160
+ </div><?php
161
+ }
162
+
163
  public function network_notices() {
164
  $flag = 1;
165
  if (get_site_option('bpm-media-enable', false)) {
214
  add_settings_error(__('Recount Fail', BP_MEDIA_TXT_DOMAIN), 'bpm-recount-fail', __('Recounting Failed', BP_MEDIA_TXT_DOMAIN));
215
  }
216
  }
217
+ // if (!isset($_POST['bp_media_options']['enable_on_profile']) && !isset($_POST['bp_media_options']['enable_on_group'])) {
218
+ // if (is_multisite())
219
+ // 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));
220
+ // else
221
+ // 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));
222
+ // $input['enable_on_profile'] = 1;
223
+ // }
224
  if (!isset($_POST['bp_media_options']['videos_enabled']) && !isset($_POST['bp_media_options']['audio_enabled']) && !isset($_POST['bp_media_options']['images_enabled'])) {
225
  if (is_multisite())
226
  update_site_option('bpm-media-type', __('Atleast one Media Type Must be selected', BP_MEDIA_TXT_DOMAIN));
229
  $input['images_enabled'] = 1;
230
  }
231
  if (is_multisite())
232
+ update_site_option('bpm-settings-saved', __('Settings saved.', BP_MEDIA_TXT_DOMAIN));
233
  do_action('bp_media_sanitize_settings', $_POST, $input);
234
  return $input;
235
  }
273
  ?>
274
  <label for="<?php echo $option; ?>">
275
  <input<?php checked($options[$option]); ?> name="<?php echo $name; ?>" id="<?php echo $option; ?>" value="1" type="checkbox" />
276
+ <?php echo $desc; ?>
277
  </label><?php
278
  }
279
 
320
  }
321
 
322
  foreach ($radios as $value => $desc) {
323
+ ?>
324
  <label for="<?php echo sanitize_title($desc); ?>"><input<?php checked($options[$option], $value); ?> value="<?php echo $value; ?>" name="<?php echo $name; ?>" id="<?php echo sanitize_title($desc); ?>" type="radio" /><?php echo $desc; ?></label><br /><?php
325
  }
326
  }
346
  'option' => '',
347
  'desc' => '',
348
  'password' => false,
349
+ 'hidden' => false,
350
  );
351
  $args = wp_parse_args($args, $defaults);
352
  extract($args);
364
  if ((isset($options[$option]) && empty($options[$option])) || !isset($options[$option])) {
365
  $options[$option] = '';
366
  }
367
+ ?>
368
+ <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
369
  if (!empty($desc)) {
370
  echo '<br /><span class="description">' . $desc . '</span>';
371
  }
372
+ ?></label><br /><?php
373
  }
374
 
375
  /**
410
  if ((isset($options[$option]) && empty($options[$option])) || !isset($options[$option])) {
411
  $options[$option] = '';
412
  }
413
+ ?>
414
  <select name="<?php echo $name; ?>" id="<?php echo $option; ?>"><?php if ($none) { ?>
415
  <option><?php __e('None', BP_MEDIA_TXT_DOMAIN); ?></option><?php
416
  }
417
  foreach ($values as $value => $text) {
 
 
418
  ?>
419
+ <option<?php selected($options[$option], $value); ?> value="<?php echo $value; ?>"><?php echo $text; ?></option><?php }
420
+ ?>
421
  </select><?php
422
  }
423
 
452
  $button = $option;
453
  submit_button($name, '', $button, false);
454
  if (!empty($desc)) {
455
+ ?>
456
  <span class="description"><?php echo $desc; ?></a><?php
457
  }
458
  }
459
 
460
+ public function privacy_notice() {
461
+ if (BPMediaPrivacy::is_installed())
462
+ return;
463
+ $url = add_query_arg(
464
+ array('page' => 'bp-media-privacy'), (is_multisite() ? network_admin_url('admin.php') : admin_url('admin.php'))
465
+ );
466
+
467
+ $notice = '
468
+ <div class="error">
469
+ <p>' . __('BuddyPress Media 2.6 requires a database upgrade. ', BP_MEDIA_TXT_DOMAIN)
470
+ . '<a href="' . $url . '">' . __('Update Database', BP_MEDIA_TXT_DOMAIN) . '.</a></p>
471
+ </div>
472
+ ';
473
+ echo $notice;
474
+ }
475
+
476
  }
477
 
478
  }
479
+ ?>
app/helper/rtPluginInfo.php CHANGED
File without changes
app/helper/rtPluginUpdate.php CHANGED
File without changes
app/helper/rtPluginUpdateChecker.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  /**
4
  * Description of rtUpdateCheker
5
- * A custom plugin update checker.
6
  *
7
  * @author faishal
8
  */
@@ -20,16 +20,16 @@ class rtPluginUpdateChecker {
20
 
21
  /**
22
  * Class constructor.
23
- *
24
  * @param string $metadataUrl The URL of the plugin's metadata file.
25
  * @param string $pluginFile Fully qualified path to the main plugin file.
26
  * @param string $slug The plugin's 'slug'. If not specified, the filename part of $pluginFile sans '.php' will be used as the slug.
27
  * @param integer $checkPeriod How often to check for updates (in hours). Defaults to checking every 12 hours. Set to 0 to disable automatic update checks.
28
- * @param string $optionName Where to store book-keeping info about update checks. Defaults to 'external_updates-$slug'.
29
  */
30
 
31
  /**
32
- *
33
  * @param type $metadataUrl
34
  * @param type $pluginFile
35
  * @param type $slug
@@ -58,9 +58,9 @@ class rtPluginUpdateChecker {
58
  }
59
 
60
  /**
61
- * Install the hooks required to run periodic update checks and inject update info
62
- * into WP data structures.
63
- *
64
  * @return void
65
  */
66
  protected function installHooks() {
@@ -89,8 +89,8 @@ class rtPluginUpdateChecker {
89
 
90
  register_deactivation_hook($this->pluginFile, array($this, '_removeUpdaterCron'));
91
 
92
- //In case Cron is disabled or unreliable, we also manually trigger
93
- //the periodic checks while the user is browsing the Dashboard.
94
  add_action('admin_init', array($this, 'maybeCheckForUpdates'));
95
  } else {
96
  //Periodic checks are disabled.
@@ -102,13 +102,13 @@ class rtPluginUpdateChecker {
102
 
103
  /**
104
  * Add our custom schedule to the array of Cron schedules used by WP.
105
- *
106
  * @param array $schedules
107
  * @return array
108
  */
109
 
110
  /**
111
- *
112
  * @param type $schedules
113
  * @return type
114
  */
@@ -139,7 +139,7 @@ class rtPluginUpdateChecker {
139
  */
140
 
141
  /**
142
- *
143
  * @return type
144
  */
145
  public function getCronHookName() {
@@ -148,15 +148,15 @@ class rtPluginUpdateChecker {
148
 
149
  /**
150
  * Retrieve plugin info from the configured API endpoint.
151
- *
152
  * @uses wp_remote_get()
153
- *
154
  * @param array $queryArgs Additional query arguments to append to the request. Optional.
155
  * @return PluginInfo
156
  */
157
 
158
  /**
159
- *
160
  * @param type $queryArgs
161
  * @return type
162
  */
@@ -207,18 +207,18 @@ class rtPluginUpdateChecker {
207
 
208
  /**
209
  * Retrieve the latest update (if any) from the configured API endpoint.
210
- *
211
  * @uses PluginUpdateChecker::requestInfo()
212
- *
213
  * @return PluginUpdate An instance of PluginUpdate, or NULL when no updates are available.
214
  */
215
 
216
  /**
217
- *
218
  * @return null
219
  */
220
  public function requestUpdate() {
221
- //For the sake of simplicity, this function just calls requestInfo()
222
  //and transforms the result accordingly.
223
  $pluginInfo = $this->requestInfo(array('checking_for_updates' => '1'));
224
  if ($pluginInfo == null) {
@@ -229,12 +229,12 @@ class rtPluginUpdateChecker {
229
 
230
  /**
231
  * Get the currently installed version of the plugin.
232
- *
233
  * @return string Version number.
234
  */
235
 
236
  /**
237
- *
238
  * @return null
239
  */
240
  public function getInstalledVersion() {
@@ -263,14 +263,14 @@ class rtPluginUpdateChecker {
263
  }
264
 
265
  /**
266
- * Check for plugin updates.
267
  * The results are stored in the DB option specified in $optionName.
268
- *
269
  * @return PluginUpdate|null
270
  */
271
 
272
  /**
273
- *
274
  * @return null
275
  */
276
  public function checkForUpdates() {
@@ -295,7 +295,7 @@ class rtPluginUpdateChecker {
295
 
296
  $state->lastCheck = time();
297
  $state->checkedVersion = $installedVersion;
298
- $this->setUpdateState($state); //Save before checking in case something goes wrong
299
 
300
  $state->update = $this->requestUpdate();
301
  $this->setUpdateState($state);
@@ -305,12 +305,12 @@ class rtPluginUpdateChecker {
305
 
306
  /**
307
  * Check for updates only if the configured check interval has already elapsed.
308
- *
309
  * @return void
310
  */
311
 
312
  /**
313
- *
314
  * @return type
315
  */
316
  public function maybeCheckForUpdates() {
@@ -331,12 +331,12 @@ class rtPluginUpdateChecker {
331
 
332
  /**
333
  * Load the update checker state from the DB.
334
- *
335
  * @return StdClass|null
336
  */
337
 
338
  /**
339
- *
340
  * @return null
341
  */
342
  public function getUpdateState() {
@@ -353,13 +353,13 @@ class rtPluginUpdateChecker {
353
 
354
  /**
355
  * Persist the update checker state to the DB.
356
- *
357
  * @param StdClass $state
358
  * @return void
359
  */
360
 
361
  /**
362
- *
363
  * @param type $state
364
  */
365
  private function setUpdateState($state) {
@@ -381,11 +381,11 @@ class rtPluginUpdateChecker {
381
  }
382
 
383
  /**
384
- * Intercept plugins_api() calls that request information about our plugin and
385
- * use the configured API endpoint to satisfy them.
386
- *
387
  * @see plugins_api()
388
- *
389
  * @param mixed $result
390
  * @param string $action
391
  * @param array|object $args
@@ -393,7 +393,7 @@ class rtPluginUpdateChecker {
393
  */
394
 
395
  /**
396
- *
397
  * @param type $result
398
  * @param type $action
399
  * @param type $args
@@ -416,13 +416,13 @@ class rtPluginUpdateChecker {
416
 
417
  /**
418
  * Insert the latest update (if any) into the update list maintained by WP.
419
- *
420
  * @param StdClass $updates Update list.
421
  * @return StdClass Modified update list.
422
  */
423
 
424
  /**
425
- *
426
  * @param StdClass $updates
427
  * @return \StdClass
428
  */
@@ -457,7 +457,7 @@ class rtPluginUpdateChecker {
457
  */
458
 
459
  /**
460
- *
461
  * @return null
462
  */
463
  public function getUpdate() {
@@ -489,7 +489,7 @@ class rtPluginUpdateChecker {
489
  */
490
 
491
  /**
492
- *
493
  * @param type $pluginMeta
494
  * @param type $pluginFile
495
  * @param type $pluginData
@@ -563,19 +563,19 @@ class rtPluginUpdateChecker {
563
  }
564
 
565
  /**
566
- * Register a callback for filtering query arguments.
567
- *
568
  * The callback function should take one argument - an associative array of query arguments.
569
  * It should return a modified array of query arguments.
570
- *
571
  * @uses add_filter() This method is a convenience wrapper for add_filter().
572
- *
573
  * @param callable $callback
574
  * @return void
575
  */
576
 
577
  /**
578
- *
579
  * @param type $callback
580
  */
581
  public function addQueryArgFilter($callback) {
@@ -584,19 +584,19 @@ class rtPluginUpdateChecker {
584
 
585
  /**
586
  * Register a callback for filtering arguments passed to wp_remote_get().
587
- *
588
  * The callback function should take one argument - an associative array of arguments -
589
  * and return a modified array or arguments. See the WP documentation on wp_remote_get()
590
- * for details on what arguments are available and how they work.
591
- *
592
  * @uses add_filter() This method is a convenience wrapper for add_filter().
593
- *
594
  * @param callable $callback
595
  * @return void
596
  */
597
 
598
  /**
599
- *
600
  * @param type $callback
601
  */
602
  public function addHttpRequestArgFilter($callback) {
@@ -605,22 +605,22 @@ class rtPluginUpdateChecker {
605
 
606
  /**
607
  * Register a callback for filtering the plugin info retrieved from the external API.
608
- *
609
- * The callback function should take two arguments. If the plugin info was retrieved
610
- * successfully, the first argument passed will be an instance of PluginInfo. Otherwise,
611
- * it will be NULL. The second argument will be the corresponding return value of
612
  * wp_remote_get (see WP docs for details).
613
- *
614
  * The callback function should return a new or modified instance of PluginInfo or NULL.
615
- *
616
  * @uses add_filter() This method is a convenience wrapper for add_filter().
617
- *
618
  * @param callable $callback
619
  * @return void
620
  */
621
 
622
  /**
623
- *
624
  * @param type $callback
625
  */
626
  public function addResultFilter($callback) {
@@ -641,7 +641,7 @@ class rtPluginUpdateChecker {
641
  */
642
 
643
  /**
644
- *
645
  * @param type $tag
646
  * @param type $callback
647
  * @param type $priority
2
 
3
  /**
4
  * Description of rtUpdateCheker
5
+ * A custom plugin update checker.
6
  *
7
  * @author faishal
8
  */
20
 
21
  /**
22
  * Class constructor.
23
+ *
24
  * @param string $metadataUrl The URL of the plugin's metadata file.
25
  * @param string $pluginFile Fully qualified path to the main plugin file.
26
  * @param string $slug The plugin's 'slug'. If not specified, the filename part of $pluginFile sans '.php' will be used as the slug.
27
  * @param integer $checkPeriod How often to check for updates (in hours). Defaults to checking every 12 hours. Set to 0 to disable automatic update checks.
28
+ * @param string $optionName Where to store book-keeping info about update checks. Defaults to 'external_updates-$slug'.
29
  */
30
 
31
  /**
32
+ *
33
  * @param type $metadataUrl
34
  * @param type $pluginFile
35
  * @param type $slug
58
  }
59
 
60
  /**
61
+ * Install the hooks required to run periodic update checks and inject update info
62
+ * into WP data structures.
63
+ *
64
  * @return void
65
  */
66
  protected function installHooks() {
89
 
90
  register_deactivation_hook($this->pluginFile, array($this, '_removeUpdaterCron'));
91
 
92
+ //In case Cron is disabled or unreliable, we also manually trigger
93
+ //the periodic checks while the user is browsing the Dashboard.
94
  add_action('admin_init', array($this, 'maybeCheckForUpdates'));
95
  } else {
96
  //Periodic checks are disabled.
102
 
103
  /**
104
  * Add our custom schedule to the array of Cron schedules used by WP.
105
+ *
106
  * @param array $schedules
107
  * @return array
108
  */
109
 
110
  /**
111
+ *
112
  * @param type $schedules
113
  * @return type
114
  */
139
  */
140
 
141
  /**
142
+ *
143
  * @return type
144
  */
145
  public function getCronHookName() {
148
 
149
  /**
150
  * Retrieve plugin info from the configured API endpoint.
151
+ *
152
  * @uses wp_remote_get()
153
+ *
154
  * @param array $queryArgs Additional query arguments to append to the request. Optional.
155
  * @return PluginInfo
156
  */
157
 
158
  /**
159
+ *
160
  * @param type $queryArgs
161
  * @return type
162
  */
207
 
208
  /**
209
  * Retrieve the latest update (if any) from the configured API endpoint.
210
+ *
211
  * @uses PluginUpdateChecker::requestInfo()
212
+ *
213
  * @return PluginUpdate An instance of PluginUpdate, or NULL when no updates are available.
214
  */
215
 
216
  /**
217
+ *
218
  * @return null
219
  */
220
  public function requestUpdate() {
221
+ //For the sake of simplicity, this function just calls requestInfo()
222
  //and transforms the result accordingly.
223
  $pluginInfo = $this->requestInfo(array('checking_for_updates' => '1'));
224
  if ($pluginInfo == null) {
229
 
230
  /**
231
  * Get the currently installed version of the plugin.
232
+ *
233
  * @return string Version number.
234
  */
235
 
236
  /**
237
+ *
238
  * @return null
239
  */
240
  public function getInstalledVersion() {
263
  }
264
 
265
  /**
266
+ * Check for plugin updates.
267
  * The results are stored in the DB option specified in $optionName.
268
+ *
269
  * @return PluginUpdate|null
270
  */
271
 
272
  /**
273
+ *
274
  * @return null
275
  */
276
  public function checkForUpdates() {
295
 
296
  $state->lastCheck = time();
297
  $state->checkedVersion = $installedVersion;
298
+ $this->setUpdateState($state); //Save before checking in case something goes wrong
299
 
300
  $state->update = $this->requestUpdate();
301
  $this->setUpdateState($state);
305
 
306
  /**
307
  * Check for updates only if the configured check interval has already elapsed.
308
+ *
309
  * @return void
310
  */
311
 
312
  /**
313
+ *
314
  * @return type
315
  */
316
  public function maybeCheckForUpdates() {
331
 
332
  /**
333
  * Load the update checker state from the DB.
334
+ *
335
  * @return StdClass|null
336
  */
337
 
338
  /**
339
+ *
340
  * @return null
341
  */
342
  public function getUpdateState() {
353
 
354
  /**
355
  * Persist the update checker state to the DB.
356
+ *
357
  * @param StdClass $state
358
  * @return void
359
  */
360
 
361
  /**
362
+ *
363
  * @param type $state
364
  */
365
  private function setUpdateState($state) {
381
  }
382
 
383
  /**
384
+ * Intercept plugins_api() calls that request information about our plugin and
385
+ * use the configured API endpoint to satisfy them.
386
+ *
387
  * @see plugins_api()
388
+ *
389
  * @param mixed $result
390
  * @param string $action
391
  * @param array|object $args
393
  */
394
 
395
  /**
396
+ *
397
  * @param type $result
398
  * @param type $action
399
  * @param type $args
416
 
417
  /**
418
  * Insert the latest update (if any) into the update list maintained by WP.
419
+ *
420
  * @param StdClass $updates Update list.
421
  * @return StdClass Modified update list.
422
  */
423
 
424
  /**
425
+ *
426
  * @param StdClass $updates
427
  * @return \StdClass
428
  */
457
  */
458
 
459
  /**
460
+ *
461
  * @return null
462
  */
463
  public function getUpdate() {
489
  */
490
 
491
  /**
492
+ *
493
  * @param type $pluginMeta
494
  * @param type $pluginFile
495
  * @param type $pluginData
563
  }
564
 
565
  /**
566
+ * Register a callback for filtering query arguments.
567
+ *
568
  * The callback function should take one argument - an associative array of query arguments.
569
  * It should return a modified array of query arguments.
570
+ *
571
  * @uses add_filter() This method is a convenience wrapper for add_filter().
572
+ *
573
  * @param callable $callback
574
  * @return void
575
  */
576
 
577
  /**
578
+ *
579
  * @param type $callback
580
  */
581
  public function addQueryArgFilter($callback) {
584
 
585
  /**
586
  * Register a callback for filtering arguments passed to wp_remote_get().
587
+ *
588
  * The callback function should take one argument - an associative array of arguments -
589
  * and return a modified array or arguments. See the WP documentation on wp_remote_get()
590
+ * for details on what arguments are available and how they work.
591
+ *
592
  * @uses add_filter() This method is a convenience wrapper for add_filter().
593
+ *
594
  * @param callable $callback
595
  * @return void
596
  */
597
 
598
  /**
599
+ *
600
  * @param type $callback
601
  */
602
  public function addHttpRequestArgFilter($callback) {
605
 
606
  /**
607
  * Register a callback for filtering the plugin info retrieved from the external API.
608
+ *
609
+ * The callback function should take two arguments. If the plugin info was retrieved
610
+ * successfully, the first argument passed will be an instance of PluginInfo. Otherwise,
611
+ * it will be NULL. The second argument will be the corresponding return value of
612
  * wp_remote_get (see WP docs for details).
613
+ *
614
  * The callback function should return a new or modified instance of PluginInfo or NULL.
615
+ *
616
  * @uses add_filter() This method is a convenience wrapper for add_filter().
617
+ *
618
  * @param callable $callback
619
  * @return void
620
  */
621
 
622
  /**
623
+ *
624
  * @param type $callback
625
  */
626
  public function addResultFilter($callback) {
641
  */
642
 
643
  /**
644
+ *
645
  * @param type $tag
646
  * @param type $callback
647
  * @param type $priority
app/helper/rtProgress.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * To change this template, choose Tools | Templates
5
+ * and open the template in the editor.
6
+ */
7
+
8
+ /**
9
+ * Description of rtProgress
10
+ *
11
+ * @author saurabh
12
+ */
13
+ class rtProgress {
14
+
15
+ /**
16
+ *
17
+ */
18
+ function __construct() {
19
+
20
+ }
21
+
22
+ function progress_ui($progress){
23
+ echo '
24
+ <div id="rtprogressbar">
25
+ <div style="width:'.$progress.'%"></div>
26
+ </div>
27
+ ';
28
+ }
29
+
30
+ function progress($progress,$total){
31
+ return ($progress/$total)*100;
32
+ }
33
+
34
+ }
35
+
36
+ ?>
app/main/BPMediaComponent.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * Don't load this file directly!
4
  */
@@ -19,56 +20,55 @@ class BPMediaComponent extends BP_Component {
19
  *
20
  * @var array
21
  */
22
- var $messages = array(
23
- 'error' => array(),
24
- 'info' => array(),
25
- 'updated' => array()
26
- );
27
 
28
- /**
29
- * Initialise the component with appropriate parameters.
30
  * Add hook for plugins, themes, extensions to hook on to
31
  * Activates the component
32
  * Registers necessary post types
33
  *
34
- * @global object $bp The global BuddyPress object
35
- */
36
- function __construct() {
37
- global $bp;
38
- parent::start(BP_MEDIA_SLUG, BP_MEDIA_LABEL, BP_MEDIA_PATH);
39
- do_action('bp_media_init');
40
- $bp->active_components[$this->id] = '1';
41
- add_action('init', array(&$this, 'register_post_types'), 10);
42
- }
43
 
44
- /**
45
  * Initialise the global variables of the BuddyPress Media
46
  * and its parent class.
47
  * Add necessary slugs and search functionality
48
- *
49
- * @global object $bp The global BuddyPress object
50
- */
51
- function setup_globals() {
52
- global $bp;
53
- $globals = array(
54
- 'slug' => BP_MEDIA_SLUG,
55
- 'root_slug' => isset(
56
- $bp->pages->{$this->id}->slug) ?
57
- $bp->pages->{$this->id}->slug
58
- : BP_MEDIA_SLUG,
59
- // 'has_directory' => true, // Set to false if not required
60
- 'search_string' => __('Search Media...', BP_MEDIA_TXT_DOMAIN),
61
- );
62
- parent::setup_globals($globals);
63
- }
64
 
65
- /**
66
  * Sets up BuddyPress Media navigation and tabs on profile
67
- *
68
- * @global object $bp The global BuddyPress object
69
- */
70
- function setup_nav() {
71
- global $bp, $bp_media;
72
 
73
  $enabled = $bp_media->enabled();
74
  $default_tab = $bp_media->default_tab();
@@ -78,460 +78,252 @@ class BPMediaComponent extends BP_Component {
78
 
79
 
80
  /* Media Screens */
81
- foreach ($enabled as $tab=>$active){
82
- if($active==true){
83
- $tabs = $tab;
84
- if($tabs!='audio'&&$tabs!='upload'){
85
- $tabs .= 's';
86
- }
87
- if($tab=='upload'){
88
- ${'bp_media_'.$tab} = new BPMediaUploadScreen(
89
- $tab,
90
- constant('BP_MEDIA_'.strtoupper($tabs).'_SLUG')
91
- );
92
- }elseif($tab=='album'){
93
- $bp_media_album = new BPMediaAlbumScreen(
94
- $tab,
95
- constant('BP_MEDIA_'.strtoupper($tabs).'_SLUG')
96
- );
97
- }else{
98
- ${'bp_media_'.$tab} = new BPMediaScreen(
99
- $tab,
100
- constant('BP_MEDIA_'.strtoupper($tabs).'_SLUG')
101
- );
 
 
102
  }
103
  }
104
- }
 
 
 
105
 
106
  /* Switch between different screens depending on context */
107
- switch ($bp->current_component) {
108
- case BP_MEDIA_IMAGES_SLUG:
109
- if ( $enabled['image'] && is_numeric($bp->current_action)) {
110
- $bp->action_variables[0] = $bp->current_action;
111
- $bp->current_action = BP_MEDIA_IMAGES_ENTRY_SLUG;
112
- }
113
- break;
114
- case BP_MEDIA_AUDIO_SLUG:
115
- if ($enabled['audio'] && is_numeric($bp->current_action)) {
116
- $bp->action_variables[0] = $bp->current_action;
117
- $bp->current_action = BP_MEDIA_AUDIO_ENTRY_SLUG;
118
- }
119
- break;
120
- case BP_MEDIA_VIDEOS_SLUG:
121
- if ($enabled['video'] && is_numeric($bp->current_action)) {
122
- $bp->action_variables[0] = $bp->current_action;
123
- $bp->current_action = BP_MEDIA_VIDEOS_ENTRY_SLUG;
124
- }
125
- break;
126
- case BP_MEDIA_ALBUMS_SLUG:
127
- if (is_numeric($bp->current_action)) {
128
- $bp->action_variables[0] = $bp->current_action;
129
- $bp->current_action = BP_MEDIA_ALBUMS_ENTRY_SLUG;
130
- }
131
- break;
132
- }
133
 
134
  /* Create the main navigation on profile */
135
- $main_nav = array(
136
- 'name' => __(BP_MEDIA_LABEL, BP_MEDIA_TXT_DOMAIN),
137
- 'slug' => BP_MEDIA_SLUG,
138
- 'position' => 80,
139
- 'screen_function' => array(${'bp_media_'.$default_tab}, 'screen'),
140
- 'default_subnav_slug' => constant('BP_MEDIA_'.strtoupper($defaults_tab).'_SLUG')
141
- );
142
 
143
  /* Create an empty sub navigation */
144
- $sub_nav[] = array();
145
 
146
  /* Set up navigation */
147
- parent::setup_nav($main_nav, $sub_nav);
148
-
149
  /* Set up individual screens for each nav/sub nav */
150
- if($enabled['image']){
151
- bp_core_new_nav_item(array(
152
- 'name' => __(BP_MEDIA_IMAGES_LABEL, BP_MEDIA_TXT_DOMAIN),
153
- 'slug' => BP_MEDIA_IMAGES_SLUG,
154
- 'screen_function' => array($bp_media_image, 'screen'),
155
- ));
156
-
157
-
158
-
159
- bp_core_new_subnav_item(array(
160
- 'name' => 'View',
161
- /* Display name for the nav item(It won't be shown anywhere) */
162
- 'slug' => BP_MEDIA_IMAGES_ENTRY_SLUG,
163
- /* URL slug for the nav item */
164
- 'parent_slug' => BP_MEDIA_IMAGES_SLUG,
165
- /* URL slug of the parent nav item */
166
- 'parent_url' => trailingslashit(bp_loggedin_user_domain()
167
- . BP_MEDIA_IMAGES_SLUG),
168
- /* URL of the parent item */
169
- 'position' => 90,
170
- /* Index of where this nav item should be positioned */
171
- 'screen_function' => array($bp_media_image, 'screen'),
172
- /* The name of the function to run when clicked */
173
- ));
174
-
175
- bp_core_new_subnav_item(array(
176
- 'name' => 'Edit',
177
- /* Display name for the nav item(It won't be shown anywhere) */
178
- 'slug' => BP_MEDIA_IMAGES_EDIT_SLUG,
179
- /* URL slug for the nav item */
180
- 'parent_slug' => BP_MEDIA_IMAGES_SLUG,
181
- /* URL slug of the parent nav item */
182
- 'parent_url' => trailingslashit(bp_loggedin_user_domain()
183
- . BP_MEDIA_IMAGES_SLUG),
184
- /* URL of the parent item */
185
- 'position' => 90,
186
- /* Index of where this nav item should be positioned */
187
- 'screen_function' => array($bp_media_image, 'edit_screen'),
188
- /* The name of the function to run when clicked */
189
- ));
190
-
191
- bp_core_new_subnav_item(array(
192
- 'name' => 'Delete',
193
- /* Display name for the nav item(It won't be shown anywhere) */
194
- 'slug' => BP_MEDIA_DELETE_SLUG,
195
- /* URL slug for the nav item */
196
- 'parent_slug' => BP_MEDIA_IMAGES_SLUG,
197
- /* URL slug of the parent nav item */
198
- 'parent_url' => trailingslashit(bp_loggedin_user_domain()
199
- . BP_MEDIA_IMAGES_SLUG),
200
- /* URL of the parent item */
201
- 'position' => 90,
202
- /* Index of where this nav item should be positioned */
203
- 'screen_function' => array($bp_media_image, 'screen'),
204
- /* The name of the function to run when clicked */
205
- ));
206
-
207
- bp_core_new_subnav_item(array(
208
- 'name' => 'Page',
209
- /* Display name for the nav item(It won't be shown anywhere) */
210
- 'slug' => 'page',
211
- /* URL slug for the nav item */
212
- 'parent_slug' => BP_MEDIA_IMAGES_SLUG,
213
- /* URL slug of the parent nav item */
214
- 'parent_url' => trailingslashit(bp_loggedin_user_domain()
215
- . BP_MEDIA_IMAGES_SLUG),
216
- /* URL of the parent item */
217
- 'position' => 90,
218
- /* Index of where this nav item should be positioned */
219
- 'screen_function' => array($bp_media_image, 'screen'),
220
- /* The name of the function to run when clicked */
221
- ));
222
- }
223
-
224
- if($enabled['video']){
225
- bp_core_new_nav_item(array(
226
- 'name' => __(BP_MEDIA_VIDEOS_LABEL, BP_MEDIA_TXT_DOMAIN),
227
- 'slug' => BP_MEDIA_VIDEOS_SLUG,
228
- 'screen_function' => array($bp_media_video, 'screen')
229
- ));
230
-
231
- bp_core_new_subnav_item(array(
232
- 'name' => 'Watch',
233
- /* Display name for the nav item(It won't be shown anywhere) */
234
- 'slug' => BP_MEDIA_VIDEOS_ENTRY_SLUG,
235
- /* URL slug for the nav item */
236
- 'parent_slug' => BP_MEDIA_VIDEOS_SLUG,
237
- /* URL slug of the parent nav item */
238
- 'parent_url' => trailingslashit(bp_loggedin_user_domain()
239
- . BP_MEDIA_VIDEOS_SLUG),
240
- /* URL of the parent item */
241
- 'position' => 90,
242
- /* Index of where this nav item should be positioned */
243
- 'screen_function' => array($bp_media_video, 'screen'),
244
- /* The name of the function to run when clicked */
245
- ));
246
-
247
- bp_core_new_subnav_item(array(
248
- 'name' => 'Edit',
249
- /* Display name for the nav item(It won't be shown anywhere) */
250
- 'slug' => BP_MEDIA_VIDEOS_EDIT_SLUG,
251
- /* URL slug for the nav item */
252
- 'parent_slug' => BP_MEDIA_VIDEOS_SLUG,
253
- /* URL slug of the parent nav item */
254
- 'parent_url' => trailingslashit(bp_loggedin_user_domain()
255
- . BP_MEDIA_VIDEOS_SLUG),
256
- /* URL of the parent item */
257
- 'position' => 90,
258
- /* Index of where this nav item should be positioned */
259
- 'screen_function' => array($bp_media_video, 'edit_screen'),
260
- /* The name of the function to run when clicked */
261
- ));
262
-
263
- bp_core_new_subnav_item(array(
264
- 'name' => 'Delete',
265
- /* Display name for the nav item(It won't be shown anywhere) */
266
- 'slug' => BP_MEDIA_DELETE_SLUG,
267
- /* URL slug for the nav item */
268
- 'parent_slug' => BP_MEDIA_VIDEOS_SLUG,
269
- /* URL slug of the parent nav item */
270
- 'parent_url' => trailingslashit(bp_loggedin_user_domain()
271
- . BP_MEDIA_VIDEOS_SLUG),
272
- /* URL of the parent item */
273
- 'position' => 90,
274
- /* Index of where this nav item should be positioned */
275
- 'screen_function' => array($bp_media_video, 'screen'),
276
- /* The name of the function to run when clicked */
277
- ));
278
-
279
- bp_core_new_subnav_item(array(
280
- 'name' => 'Page',
281
- /* Display name for the nav item(It won't be shown anywhere) */
282
- 'slug' => 'page',
283
- /* URL slug for the nav item */
284
- 'parent_slug' => BP_MEDIA_VIDEOS_SLUG,
285
- /* URL slug of the parent nav item */
286
- 'parent_url' => trailingslashit(bp_loggedin_user_domain()
287
- . BP_MEDIA_VIDEOS_SLUG),
288
- /* URL of the parent item */
289
- 'position' => 90,
290
- /* Index of where this nav item should be positioned */
291
- 'screen_function' => array($bp_media_video, 'screen'),
292
- /* The name of the function to run when clicked */
293
- ));
294
  }
295
-
296
- if($enabled['audio']){
297
- bp_core_new_nav_item(array(
298
- 'name' => __(BP_MEDIA_AUDIO_LABEL, BP_MEDIA_TXT_DOMAIN),
299
- 'slug' => BP_MEDIA_AUDIO_SLUG,
300
- 'screen_function' => array($bp_media_audio, 'screen')
301
- ));
302
-
303
- bp_core_new_subnav_item(array(
304
- 'name' => 'Listen',
305
- /* Display name for the nav item(It won't be shown anywhere) */
306
- 'slug' => BP_MEDIA_AUDIO_ENTRY_SLUG,
307
- /* URL slug for the nav item */
308
- 'parent_slug' => BP_MEDIA_AUDIO_SLUG,
309
- /* URL slug of the parent nav item */
310
- 'parent_url' => trailingslashit(bp_loggedin_user_domain()
311
- . BP_MEDIA_AUDIO_SLUG), /* URL of the parent item */
312
- 'position' => 90,
313
- /* Index of where this nav item should be positioned */
314
- 'screen_function' => array($bp_media_audio, 'screen'),
315
- /* The name of the function to run when clicked */
316
- ));
317
-
318
- bp_core_new_subnav_item(array(
319
- 'name' => 'Edit',
320
- /* Display name for the nav item(It won't be shown anywhere) */
321
- 'slug' => BP_MEDIA_AUDIO_EDIT_SLUG,
322
- /* URL slug for the nav item */
323
- 'parent_slug' => BP_MEDIA_AUDIO_SLUG,
324
- /* URL slug of the parent nav item */
325
- 'parent_url' => trailingslashit(bp_loggedin_user_domain()
326
- . BP_MEDIA_AUDIO_SLUG),
327
- /* URL of the parent item */
328
- 'position' => 90,
329
- /* Index of where this nav item should be positioned */
330
- 'screen_function' => array($bp_media_audio, 'edit_screen'),
331
- /* The name of the function to run when clicked */
332
- ));
333
-
334
- bp_core_new_subnav_item(array(
335
- 'name' => 'Delete',
336
- /* Display name for the nav item(It won't be shown anywhere) */
337
- 'slug' => BP_MEDIA_DELETE_SLUG,
338
- /* URL slug for the nav item */
339
- 'parent_slug' => BP_MEDIA_AUDIO_SLUG,
340
- /* URL slug of the parent nav item */
341
- 'parent_url' => trailingslashit(bp_loggedin_user_domain()
342
- . BP_MEDIA_AUDIO_SLUG),
343
- /* URL of the parent item */
344
- 'position' => 90,
345
- /* Index of where this nav item should be positioned */
346
- 'screen_function' => array($bp_media_audio, 'screen'),
347
- /* The name of the function to run when clicked */
348
- ));
349
-
350
- bp_core_new_subnav_item(array(
351
- 'name' => 'Page',
352
- /* Display name for the nav item(It won't be shown anywhere) */
353
- 'slug' => 'page',
354
- /* URL slug for the nav item */
355
- 'parent_slug' => BP_MEDIA_AUDIO_SLUG,
356
- /* URL slug of the parent nav item */
357
- 'parent_url' => trailingslashit(bp_loggedin_user_domain()
358
- . BP_MEDIA_AUDIO_SLUG), /* URL of the parent item */
359
- 'position' => 90,
360
- /* Index of where this nav item should be positioned */
361
- 'screen_function' => array($bp_media_audio, 'screen'),
362
- /* The name of the function to run when clicked */
363
- ));
364
  }
365
 
366
- bp_core_new_nav_item(array(
367
- 'name' => __(BP_MEDIA_ALBUMS_LABEL, BP_MEDIA_TXT_DOMAIN),
368
- 'slug' => BP_MEDIA_ALBUMS_SLUG,
369
- 'screen_function' => array($bp_media_album, 'screen'),
370
- ));
371
-
372
- bp_core_new_subnav_item(array(
373
- 'name' => 'View',
374
- /* Display name for the nav item(It won't be shown anywhere) */
375
- 'slug' => BP_MEDIA_ALBUMS_ENTRY_SLUG,
376
- /* URL slug for the nav item */
377
- 'parent_slug' => BP_MEDIA_ALBUMS_SLUG,
378
- /* URL slug of the parent nav item */
379
- 'parent_url' => trailingslashit(bp_loggedin_user_domain()
380
- . BP_MEDIA_ALBUMS_SLUG),
381
- /* URL of the parent item */
382
- 'position' => 90,
383
- /* Index of where this nav item should be positioned */
384
- 'screen_function' => array($bp_media_album, 'screen'),
385
- /* The name of the function to run when clicked */
386
- ));
387
 
388
- bp_core_new_subnav_item(array(
389
- 'name' => 'Edit',
390
- /* Display name for the nav item(It won't be shown anywhere) */
391
- 'slug' => BP_MEDIA_ALBUMS_EDIT_SLUG,
392
- /* URL slug for the nav item */
393
- 'parent_slug' => BP_MEDIA_ALBUMS_SLUG,
394
- /* URL slug of the parent nav item */
395
- 'parent_url' => trailingslashit(bp_loggedin_user_domain()
396
- . BP_MEDIA_ALBUMS_SLUG),
397
- /* URL of the parent item */
398
- 'position' => 90,
399
- /* Index of where this nav item should be positioned */
400
- 'screen_function' => array($bp_media_album, 'edit_screen'),
401
- /* The name of the function to run when clicked */
402
- ));
 
 
 
 
 
 
 
 
 
 
403
 
404
- bp_core_new_subnav_item(array(
405
- 'name' => 'Delete',
406
- /* Display name for the nav item(It won't be shown anywhere) */
407
- 'slug' => BP_MEDIA_DELETE_SLUG,
408
- /* URL slug for the nav item */
409
- 'parent_slug' => BP_MEDIA_ALBUMS_SLUG,
410
- /* URL slug of the parent nav item */
411
- 'parent_url' => trailingslashit(bp_loggedin_user_domain()
412
- . BP_MEDIA_ALBUMS_SLUG),
413
- /* URL of the parent item */
414
- 'position' => 90,
415
- /* Index of where this nav item should be positioned */
416
- 'screen_function' => array($bp_media_album, 'screen'),
417
- /* The name of the function to run when clicked */
418
- ));
419
-
420
- bp_core_new_subnav_item(array(
421
- 'name' => 'Page',
422
- /* Display name for the nav item(It won't be shown anywhere) */
423
- 'slug' => 'page',
424
- /* URL slug for the nav item */
425
- 'parent_slug' => BP_MEDIA_ALBUMS_SLUG,
426
- /* URL slug of the parent nav item */
427
- 'parent_url' => trailingslashit(bp_loggedin_user_domain()
428
- . BP_MEDIA_ALBUMS_SLUG),
429
- /* URL of the parent item */
430
- 'position' => 90,
431
- /* Index of where this nav item should be positioned */
432
- 'screen_function' => array($bp_media_album, 'screen'),
433
- /* The name of the function to run when clicked */
434
- ));
435
- bp_core_new_nav_item(array(
436
- 'name' => __(BP_MEDIA_UPLOAD_LABEL, BP_MEDIA_TXT_DOMAIN),
437
- 'slug' => BP_MEDIA_UPLOAD_SLUG,
438
- 'screen_function' => array($bp_media_upload, 'upload_screen'),
439
- 'user_has_access' => bp_is_my_profile()
440
- ));
441
- }
442
-
443
- /**
444
- * Register Custom Post Types required by BuddyPress Media
445
- */
446
- function register_post_types() {
447
 
448
  /* Set up Album labels */
449
- $album_labels = array(
450
- 'name' => __('Albums',
451
- BP_MEDIA_TXT_DOMAIN),
452
- 'singular_name' => __('Album',
453
- BP_MEDIA_TXT_DOMAIN),
454
- 'add_new' => __('Create',
455
- BP_MEDIA_TXT_DOMAIN),
456
- 'add_new_item' => __('Create Album',
457
- BP_MEDIA_TXT_DOMAIN),
458
- 'edit_item' => __('Edit Album',
459
- BP_MEDIA_TXT_DOMAIN),
460
- 'new_item' => __('New Album',
461
- BP_MEDIA_TXT_DOMAIN),
462
- 'all_items' => __('All Albums',
463
- BP_MEDIA_TXT_DOMAIN),
464
- 'view_item' => __('View Album',
465
- BP_MEDIA_TXT_DOMAIN),
466
- 'search_items' => __('Search Albums',
467
- BP_MEDIA_TXT_DOMAIN),
468
- 'not_found' => __('No album found',
469
- BP_MEDIA_TXT_DOMAIN),
470
- 'not_found_in_trash' => __('No album found in Trash',
471
- BP_MEDIA_TXT_DOMAIN),
472
- 'parent_item_colon' => '',
473
- 'menu_name' => __('Albums',
474
- BP_MEDIA_TXT_DOMAIN)
475
- );
476
 
477
  /* Set up Album post type arguments */
478
- $album_args = array(
479
- 'labels' => $album_labels,
480
- 'public' => true,
481
- 'publicly_queryable' => true,
482
- 'show_ui' => false,
483
- 'show_in_menu' => false,
484
- 'query_var' => true,
485
- 'capability_type' => 'post',
486
- 'has_archive' => true,
487
- 'hierarchical' => false,
488
- 'menu_position' => null,
489
- 'supports' => array(
490
- 'title',
491
- 'author',
492
- 'thumbnail',
493
- 'excerpt',
494
- 'comments'
495
- )
496
- );
497
 
498
  /* register Album post type */
499
- register_post_type('bp_media_album', $album_args);
500
-
501
-
502
- /* Set up labels for Media post type */
503
- $labels = array(
504
- 'name' => __('Media', BP_MEDIA_TXT_DOMAIN),
505
- 'singular' => __('Media', BP_MEDIA_TXT_DOMAIN),
506
- 'add_new' => __('Add New Media', BP_MEDIA_TXT_DOMAIN)
507
- );
508
-
509
- /* Set up the arguments for Media post type */
510
- $args = array(
511
- 'label' => __('Media', BP_MEDIA_TXT_DOMAIN),
512
- 'labels' => $labels,
513
- 'description' => __(
514
- 'BuddyPress Media\'s Media Files',
515
- BP_MEDIA_TXT_DOMAIN
516
- ),
517
- 'public' => true,
518
- 'show_ui' => false,
519
- 'supports' => array(
520
  'title',
521
  'editor',
522
  'excerpt',
523
  'author',
524
  'thumbnail',
525
  'custom-fields'
526
- )
527
- );
528
 
529
  /* Register Media post type */
530
- register_post_type('bp_media', $args);
531
 
532
  /* Register parent's post types */
533
- parent::register_post_types();
534
- }
535
 
536
  }
537
 
1
  <?php
2
+
3
  /**
4
  * Don't load this file directly!
5
  */
20
  *
21
  * @var array
22
  */
23
+ var $messages = array(
24
+ 'error' => array( ),
25
+ 'info' => array( ),
26
+ 'updated' => array( )
27
+ );
28
 
29
+ /**
30
+ * Initialise the component with appropriate parameters.
31
  * Add hook for plugins, themes, extensions to hook on to
32
  * Activates the component
33
  * Registers necessary post types
34
  *
35
+ * @global object $bp The global BuddyPress object
36
+ */
37
+ function __construct() {
38
+ global $bp;
39
+ parent::start( BP_MEDIA_SLUG, BP_MEDIA_LABEL, BP_MEDIA_PATH );
40
+ do_action( 'bp_media_init' );
41
+ $bp->active_components[ $this->id ] = '1';
42
+ add_action( 'init', array( &$this, 'register_post_types' ), 10 );
43
+ }
44
 
45
+ /**
46
  * Initialise the global variables of the BuddyPress Media
47
  * and its parent class.
48
  * Add necessary slugs and search functionality
49
+ *
50
+ * @global object $bp The global BuddyPress object
51
+ */
52
+ function setup_globals() {
53
+ global $bp;
54
+ $globals = array(
55
+ 'slug' => BP_MEDIA_SLUG,
56
+ 'root_slug' => isset(
57
+ $bp->pages->{$this->id}->slug ) ?
58
+ $bp->pages->{$this->id}->slug : BP_MEDIA_SLUG,
59
+ // 'has_directory' => true, // Set to false if not required
60
+ 'search_string' => __( 'Search Media...', BP_MEDIA_TXT_DOMAIN ),
61
+ );
62
+ parent::setup_globals( $globals );
63
+ }
 
64
 
65
+ /**
66
  * Sets up BuddyPress Media navigation and tabs on profile
67
+ *
68
+ * @global object $bp The global BuddyPress object
69
+ */
70
+ function setup_nav() {
71
+ global $bp, $bp_media;
72
 
73
  $enabled = $bp_media->enabled();
74
  $default_tab = $bp_media->default_tab();
78
 
79
 
80
  /* Media Screens */
81
+
82
+ foreach ( $enabled as $tab => $active ) {
83
+ if ( $active == true ) {
84
+ $tabs = $tab;
85
+ if ( $tabs != 'audio' && $tabs != 'upload' ) {
86
+ $tabs .= 's';
87
+ }
88
+ if ( $tab == 'upload' ) {
89
+ ${'bp_media_' . $tab} = new BPMediaUploadScreen(
90
+ $tab,
91
+ constant( 'BP_MEDIA_' . strtoupper( $tabs ) . '_SLUG' )
92
+ );
93
+ } elseif ( $tab == 'album' ) {
94
+ $bp_media_album = new BPMediaAlbumScreen(
95
+ $tab,
96
+ constant( 'BP_MEDIA_' . strtoupper( $tabs ) . '_SLUG' )
97
+ );
98
+ } else {
99
+ ${'bp_media_' . $tab} = new BPMediaScreen(
100
+ $tab,
101
+ constant( 'BP_MEDIA_' . strtoupper( $tabs ) . '_SLUG' )
102
+ );
103
+ }
104
  }
105
  }
106
+
107
+ if(array_key_exists('privacy_override_enabled',$bp_media->options))
108
+ if(checked($bp_media->options['privacy_override_enabled'],true,false))
109
+ $bp_media_privacy_screen = new BPMediaPrivacyScreen();
110
 
111
  /* Switch between different screens depending on context */
112
+ switch ( $bp->current_component ) {
113
+ case BP_MEDIA_IMAGES_SLUG:
114
+ if ( $enabled[ 'image' ] && is_numeric( $bp->current_action ) ) {
115
+ $bp->action_variables[ 0 ] = $bp->current_action;
116
+ $bp->current_action = BP_MEDIA_IMAGES_VIEW_SLUG;
117
+ }
118
+ break;
119
+ case BP_MEDIA_AUDIO_SLUG:
120
+ if ( $enabled[ 'audio' ] && is_numeric( $bp->current_action ) ) {
121
+ $bp->action_variables[ 0 ] = $bp->current_action;
122
+ $bp->current_action = BP_MEDIA_AUDIO_VIEW_SLUG;
123
+ }
124
+ break;
125
+ case BP_MEDIA_VIDEOS_SLUG:
126
+ if ( $enabled[ 'video' ] && is_numeric( $bp->current_action ) ) {
127
+ $bp->action_variables[ 0 ] = $bp->current_action;
128
+ $bp->current_action = BP_MEDIA_VIDEOS_VIEW_SLUG;
129
+ }
130
+ break;
131
+ case BP_MEDIA_ALBUMS_SLUG:
132
+ if ( is_numeric( $bp->current_action ) ) {
133
+ $bp->action_variables[ 0 ] = $bp->current_action;
134
+ $bp->current_action = BP_MEDIA_ALBUMS_VIEW_SLUG;
135
+ }
136
+ break;
137
+ }
138
 
139
  /* Create the main navigation on profile */
140
+ $main_nav = array(
141
+ 'name' => __( BP_MEDIA_LABEL, BP_MEDIA_TXT_DOMAIN ),
142
+ 'slug' => BP_MEDIA_SLUG,
143
+ 'position' => 80,
144
+ 'screen_function' => array( ${'bp_media_' . $default_tab}, 'screen' ),
145
+ 'default_subnav_slug' => constant( 'BP_MEDIA_' . strtoupper( $defaults_tab ) . '_SLUG' )
146
+ );
147
 
148
  /* Create an empty sub navigation */
149
+ $sub_nav[ ] = array( );
150
 
151
  /* Set up navigation */
152
+ parent::setup_nav( $main_nav, $sub_nav );
 
153
  /* Set up individual screens for each nav/sub nav */
154
+ foreach ( $enabled as $type => $status ) {
155
+ if($status){
156
+ $screen_array[ ] = array(
157
+ 'type' => $type,
158
+ 'status' => $status,
159
+ 'subscreens' => true
160
+ );
161
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
162
  }
163
+ $screen_array = apply_filters( 'bpmedia_media_screens', $screen_array );
164
+ foreach ( $screen_array as $screen ) {
165
+ $type = $screen[ 'type' ];
166
+ $status = $screen[ 'status' ];
167
+ $subscreens = $screen[ 'subscreens' ];
168
+ if ( $type != 'upload' ) {
169
+ $types = $type;
170
+ if ( $type != 'audio' ) {
171
+ $types .='s';
172
+ }
173
+ bp_core_new_nav_item( array(
174
+ 'name' => __( constant( 'BP_MEDIA_' . strtoupper( $types ) . '_LABEL' ), BP_MEDIA_TXT_DOMAIN ),
175
+ 'slug' => constant( 'BP_MEDIA_' . strtoupper( $types ) . '_SLUG' ),
176
+ 'screen_function' => array( ${'bp_media_' . $type}, 'screen' ),
177
+ ) );
178
+ if ( $subscreens == true ) {
179
+ $subscreens_array = array(
180
+ 'view',
181
+ 'edit',
182
+ 'delete',
183
+ 'page'
184
+ );
185
+ $subscreens_array = apply_filters( 'bpmedia_media_type_subscreens', $subscreens_array );
186
+
187
+ foreach ( $subscreens_array as $subscreen ) {
188
+ $screen_to_load = 'screen';
189
+ if ( $subscreen == 'edit' ) {
190
+ $screen_to_load = $subscreen . '_' . $screen_to_load;
191
+ }
192
+ $slug = 'BP_MEDIA_';
193
+ if ( $subscreen != 'delete' ) {
194
+ $slug .= strtoupper( $types ) . '_';
195
+ }
196
+ if ( $subscreen != 'page' ) {
197
+ $slug .= strtoupper( $subscreen ) . '_';
198
+ }
199
+ $slug .= 'SLUG';
200
+
201
+ bp_core_new_subnav_item( array(
202
+ 'name' => ucfirst( $subscreen ),
203
+ /* Display name for the nav item(It won't be shown anywhere) */
204
+ 'slug' => constant( $slug ),
205
+ /* URL slug for the nav item */
206
+ 'parent_slug' => constant( 'BP_MEDIA_' . strtoupper( $types ) . '_SLUG' ),
207
+ /* URL slug of the parent nav item */
208
+ 'parent_url' => trailingslashit( bp_loggedin_user_domain()
209
+ . constant( 'BP_MEDIA_' . strtoupper( $types ) . '_SLUG' ) ),
210
+ /* URL of the parent item */
211
+ 'position' => 90,
212
+ /* Index of where this nav item should be positioned */
213
+ 'screen_function' => array( ${'bp_media_' . $type}, $screen_to_load ),
214
+ /* The name of the function to run when clicked */
215
+ ) );
216
+ }
217
+ }
218
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
219
  }
220
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
221
 
222
+ bp_core_new_nav_item( array(
223
+ 'name' => __( BP_MEDIA_UPLOAD_LABEL, BP_MEDIA_TXT_DOMAIN ),
224
+ 'slug' => BP_MEDIA_UPLOAD_SLUG,
225
+ 'screen_function' => array( $bp_media_upload, 'upload_screen' ),
226
+ 'user_has_access' => bp_is_my_profile()
227
+ ) );
228
+ if(array_key_exists('privacy_override_enabled',$bp_media->options))
229
+ if(checked($bp_media->options['privacy_override_enabled'],true,false))
230
+ bp_core_new_subnav_item( array(
231
+ 'name' => __( BP_MEDIA_USER_SETTINGS_LABEL, BP_MEDIA_TXT_DOMAIN ),
232
+ /* Display name for the nav item(It won't be shown anywhere) */
233
+ 'slug' => BP_MEDIA_USER_SETTINGS_SLUG,
234
+ /* URL slug for the nav item */
235
+ 'parent_slug' => BP_MEDIA_SLUG,
236
+ /* URL slug of the parent nav item */
237
+ 'parent_url' => trailingslashit( bp_loggedin_user_domain()
238
+ . BP_MEDIA_SLUG),
239
+ /* URL of the parent item */
240
+ 'position' => 900,
241
+ /* Index of where this nav item should be positioned */
242
+ 'screen_function' => array( $bp_media_privacy_screen, 'ui' ),
243
+ /* The name of the function to run when clicked */
244
+ 'user_has_access' => bp_is_my_profile()
245
+ ) );
246
+ }
247
 
248
+ /**
249
+ * Register Custom Post Types required by BuddyPress Media
250
+ */
251
+ function register_post_types() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
252
 
253
  /* Set up Album labels */
254
+ $album_labels = array(
255
+ 'name' => __( 'Albums', BP_MEDIA_TXT_DOMAIN ),
256
+ 'singular_name' => __( 'Album', BP_MEDIA_TXT_DOMAIN ),
257
+ 'add_new' => __( 'Create', BP_MEDIA_TXT_DOMAIN ),
258
+ 'add_new_item' => __( 'Create Album', BP_MEDIA_TXT_DOMAIN ),
259
+ 'edit_item' => __( 'Edit Album', BP_MEDIA_TXT_DOMAIN ),
260
+ 'new_item' => __( 'New Album', BP_MEDIA_TXT_DOMAIN ),
261
+ 'all_items' => __( 'All Albums', BP_MEDIA_TXT_DOMAIN ),
262
+ 'view_item' => __( 'View Album', BP_MEDIA_TXT_DOMAIN ),
263
+ 'search_items' => __( 'Search Albums', BP_MEDIA_TXT_DOMAIN ),
264
+ 'not_found' => __( 'No album found', BP_MEDIA_TXT_DOMAIN ),
265
+ 'not_found_in_trash' => __( 'No album found in Trash', BP_MEDIA_TXT_DOMAIN ),
266
+ 'parent_item_colon' => '',
267
+ 'menu_name' => __( 'Albums', BP_MEDIA_TXT_DOMAIN )
268
+ );
 
 
 
 
 
 
 
 
 
 
 
 
269
 
270
  /* Set up Album post type arguments */
271
+ $album_args = array(
272
+ 'labels' => $album_labels,
273
+ 'public' => true,
274
+ 'publicly_queryable' => true,
275
+ 'show_ui' => false,
276
+ 'show_in_menu' => false,
277
+ 'query_var' => true,
278
+ 'capability_type' => 'post',
279
+ 'has_archive' => true,
280
+ 'hierarchical' => false,
281
+ 'menu_position' => null,
282
+ 'supports' => array(
283
+ 'title',
284
+ 'author',
285
+ 'thumbnail',
286
+ 'excerpt',
287
+ 'comments'
288
+ )
289
+ );
290
 
291
  /* register Album post type */
292
+ register_post_type( 'bp_media_album', $album_args );
293
+
294
+
295
+ /* Set up labels for Media post type */
296
+ $labels = array(
297
+ 'name' => __( 'Media', BP_MEDIA_TXT_DOMAIN ),
298
+ 'singular' => __( 'Media', BP_MEDIA_TXT_DOMAIN ),
299
+ 'add_new' => __( 'Add New Media', BP_MEDIA_TXT_DOMAIN )
300
+ );
301
+
302
+ /* Set up the arguments for Media post type */
303
+ $args = array(
304
+ 'label' => __( 'Media', BP_MEDIA_TXT_DOMAIN ),
305
+ 'labels' => $labels,
306
+ 'description' => __(
307
+ 'BuddyPress Media\'s Media Files', BP_MEDIA_TXT_DOMAIN
308
+ ),
309
+ 'public' => true,
310
+ 'show_ui' => false,
311
+ 'supports' => array(
 
312
  'title',
313
  'editor',
314
  'excerpt',
315
  'author',
316
  'thumbnail',
317
  'custom-fields'
318
+ )
319
+ );
320
 
321
  /* Register Media post type */
322
+ register_post_type( 'bp_media', $args );
323
 
324
  /* Register parent's post types */
325
+ parent::register_post_types();
326
+ }
327
 
328
  }
329
 
app/main/BPMediaLoader.php CHANGED
@@ -62,6 +62,8 @@ class BPMediaLoader {
62
  public function load_component() {
63
  global $bp;
64
  $bp->{BP_MEDIA_SLUG} = new BPMediaComponent();
 
 
65
  }
66
 
67
  /**
62
  public function load_component() {
63
  global $bp;
64
  $bp->{BP_MEDIA_SLUG} = new BPMediaComponent();
65
+
66
+
67
  }
68
 
69
  /**
app/main/BuddyPressMedia.php CHANGED
@@ -226,8 +226,8 @@ class BuddyPressMedia {
226
  if ( ! defined( 'BP_MEDIA_IMAGES_SLUG' ) )
227
  define( 'BP_MEDIA_IMAGES_SLUG', 'photos' );
228
 
229
- if ( ! defined( 'BP_MEDIA_IMAGES_ENTRY_SLUG' ) )
230
- define( 'BP_MEDIA_IMAGES_ENTRY_SLUG', 'view' );
231
 
232
  if ( ! defined( 'BP_MEDIA_IMAGES_EDIT_SLUG' ) )
233
  define( 'BP_MEDIA_IMAGES_EDIT_SLUG', 'edit' );
@@ -236,8 +236,8 @@ class BuddyPressMedia {
236
  if ( ! defined( 'BP_MEDIA_VIDEOS_SLUG' ) )
237
  define( 'BP_MEDIA_VIDEOS_SLUG', 'videos' );
238
 
239
- if ( ! defined( 'BP_MEDIA_VIDEOS_ENTRY_SLUG' ) )
240
- define( 'BP_MEDIA_VIDEOS_ENTRY_SLUG', 'watch' );
241
 
242
  if ( ! defined( 'BP_MEDIA_VIDEOS_EDIT_SLUG' ) )
243
  define( 'BP_MEDIA_VIDEOS_EDIT_SLUG', 'edit' );
@@ -246,8 +246,8 @@ class BuddyPressMedia {
246
  if ( ! defined( 'BP_MEDIA_AUDIO_SLUG' ) )
247
  define( 'BP_MEDIA_AUDIO_SLUG', 'music' );
248
 
249
- if ( ! defined( 'BP_MEDIA_AUDIO_ENTRY_SLUG' ) )
250
- define( 'BP_MEDIA_AUDIO_ENTRY_SLUG', 'listen' );
251
 
252
  if ( ! defined( 'BP_MEDIA_AUDIO_EDIT_SLUG' ) )
253
  define( 'BP_MEDIA_AUDIO_EDIT_SLUG', 'edit' );
@@ -256,12 +256,16 @@ class BuddyPressMedia {
256
  if ( ! defined( 'BP_MEDIA_ALBUMS_SLUG' ) )
257
  define( 'BP_MEDIA_ALBUMS_SLUG', 'albums' );
258
 
259
- if ( ! defined( 'BP_MEDIA_ALBUMS_ENTRY_SLUG' ) )
260
- define( 'BP_MEDIA_ALBUMS_ENTRY_SLUG', 'list' );
261
 
262
  if ( ! defined( 'BP_MEDIA_ALBUMS_EDIT_SLUG' ) )
263
  define( 'BP_MEDIA_ALBUMS_EDIT_SLUG', 'edit' );
264
 
 
 
 
 
265
  /* UI Labels loaded via text domain, can be translated */
266
  if ( ! defined( 'BP_MEDIA_LABEL' ) )
267
  define( 'BP_MEDIA_LABEL', __( 'Media',
@@ -270,6 +274,9 @@ class BuddyPressMedia {
270
  if ( ! defined( 'BP_MEDIA_LABEL_SINGULAR' ) )
271
  define( 'BP_MEDIA_LABEL_SINGULAR', __( 'Media',
272
  $this->text_domain ) );
 
 
 
273
 
274
  if ( ! defined( 'BP_MEDIA_IMAGES_LABEL' ) )
275
  define( 'BP_MEDIA_IMAGES_LABEL', __( 'Photos', $this->text_domain ) );
@@ -343,9 +350,27 @@ class BuddyPressMedia {
343
  * Load accessory functions
344
  */
345
  // new BPMediaActivity();
346
- new BPMediaFilters();
347
- new BPMediaActions();
348
- new BPMediaFunction();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
349
  }
350
 
351
  /**
@@ -514,6 +539,8 @@ class BuddyPressMedia {
514
  );
515
  }
516
  }
 
 
517
  }
518
 
519
  /**
@@ -556,21 +583,32 @@ class BuddyPressMedia {
556
  'upload' => true
557
  );
558
  if ( array_key_exists( 'images_enabled', $options ) ) {
559
- if ( $options[ 'images_enabled' ] == 1 )
560
  $enabled[ 'image' ] = true;
 
561
  }
562
  if ( array_key_exists( 'videos_enabled', $options ) ) {
563
- if ( $options[ 'videos_enabled' ] == 1 )
564
  $enabled[ 'video' ] = true;
 
565
  }
566
  if ( array_key_exists( 'audio_enabled', $options ) ) {
567
- if ( $options[ 'audio_enabled' ] == 1 )
568
  $enabled[ 'audio' ] = true;
 
569
  }
570
 
571
  return $enabled;
572
  }
573
 
 
 
 
 
 
 
 
 
574
  function default_tab(){
575
  $enabled = $this->enabled();
576
  unset($enabled['upload']);
@@ -590,6 +628,7 @@ class BuddyPressMedia {
590
  return $defaults_tab;
591
  }
592
 
 
593
  static function get_wall_album( $group_id = false ) {
594
  global $wpdb;
595
  $group_id = ( ! $group_id) ? '1' : $group_id;
@@ -599,13 +638,14 @@ class BuddyPressMedia {
599
  LIKE '{$album_name}' AND ps.post_type='bp_media_album' AND
600
  pm.meta_key='bp-media-key' AND pm.meta_value ='{$group_id}'";
601
  $wall_albums = $wpdb->get_results( $query, ARRAY_A );
602
-
603
  if ( count( $wall_albums ) > 1 ) {
604
  return BuddyPressMedia::merge_duplicate_wall_albums( $wall_albums );
605
  } elseif($wall_albums) {
606
  return $wall_albums[ 0 ][ 'ID' ];
607
  }
608
  }
 
 
609
 
610
  static function merge_duplicate_wall_albums( $wall_albums ) {
611
  global $wpdb;
226
  if ( ! defined( 'BP_MEDIA_IMAGES_SLUG' ) )
227
  define( 'BP_MEDIA_IMAGES_SLUG', 'photos' );
228
 
229
+ if ( ! defined( 'BP_MEDIA_IMAGES_VIEW_SLUG' ) )
230
+ define( 'BP_MEDIA_IMAGES_VIEW_SLUG', 'view' );
231
 
232
  if ( ! defined( 'BP_MEDIA_IMAGES_EDIT_SLUG' ) )
233
  define( 'BP_MEDIA_IMAGES_EDIT_SLUG', 'edit' );
236
  if ( ! defined( 'BP_MEDIA_VIDEOS_SLUG' ) )
237
  define( 'BP_MEDIA_VIDEOS_SLUG', 'videos' );
238
 
239
+ if ( ! defined( 'BP_MEDIA_VIDEOS_VIEW_SLUG' ) )
240
+ define( 'BP_MEDIA_VIDEOS_VIEW_SLUG', 'watch' );
241
 
242
  if ( ! defined( 'BP_MEDIA_VIDEOS_EDIT_SLUG' ) )
243
  define( 'BP_MEDIA_VIDEOS_EDIT_SLUG', 'edit' );
246
  if ( ! defined( 'BP_MEDIA_AUDIO_SLUG' ) )
247
  define( 'BP_MEDIA_AUDIO_SLUG', 'music' );
248
 
249
+ if ( ! defined( 'BP_MEDIA_AUDIO_VIEW_SLUG' ) )
250
+ define( 'BP_MEDIA_AUDIO_VIEW_SLUG', 'listen' );
251
 
252
  if ( ! defined( 'BP_MEDIA_AUDIO_EDIT_SLUG' ) )
253
  define( 'BP_MEDIA_AUDIO_EDIT_SLUG', 'edit' );
256
  if ( ! defined( 'BP_MEDIA_ALBUMS_SLUG' ) )
257
  define( 'BP_MEDIA_ALBUMS_SLUG', 'albums' );
258
 
259
+ if ( ! defined( 'BP_MEDIA_ALBUMS_VIEW_SLUG' ) )
260
+ define( 'BP_MEDIA_ALBUMS_VIEW_SLUG', 'list' );
261
 
262
  if ( ! defined( 'BP_MEDIA_ALBUMS_EDIT_SLUG' ) )
263
  define( 'BP_MEDIA_ALBUMS_EDIT_SLUG', 'edit' );
264
 
265
+ /* Settings slug */
266
+ if ( ! defined( 'BP_MEDIA_USER_SETTINGS_SLUG' ) )
267
+ define( 'BP_MEDIA_USER_SETTINGS_SLUG', 'privacy' );
268
+
269
  /* UI Labels loaded via text domain, can be translated */
270
  if ( ! defined( 'BP_MEDIA_LABEL' ) )
271
  define( 'BP_MEDIA_LABEL', __( 'Media',
274
  if ( ! defined( 'BP_MEDIA_LABEL_SINGULAR' ) )
275
  define( 'BP_MEDIA_LABEL_SINGULAR', __( 'Media',
276
  $this->text_domain ) );
277
+ if ( ! defined( 'BP_MEDIA_USER_SETTINGS_LABEL' ) )
278
+ define( 'BP_MEDIA_USER_SETTINGS_LABEL', __( 'Privacy',
279
+ $this->text_domain ) );
280
 
281
  if ( ! defined( 'BP_MEDIA_IMAGES_LABEL' ) )
282
  define( 'BP_MEDIA_IMAGES_LABEL', __( 'Photos', $this->text_domain ) );
350
  * Load accessory functions
351
  */
352
  // new BPMediaActivity();
353
+ $class_construct = array(
354
+ // 'activity' => false,
355
+ 'filters' => false,
356
+ 'actions' => false,
357
+ 'function' => false,
358
+ 'privacy' =>false,
359
+ );
360
+ $class_construct = apply_filters('bpmedia_class_construct',$class_construct);
361
+
362
+ foreach ( $class_construct as $classname=>$global_scope ) {
363
+ $class = 'BPMedia' . ucfirst( $classname );
364
+ if ( class_exists( $class ) ) {
365
+ if($global_scope==true){
366
+ global ${'bp_media_'.$classname};
367
+ ${'bp_media_'.$classname} = new $class();
368
+ }else{
369
+ new $class();
370
+ }
371
+ }
372
+ }
373
+
374
  }
375
 
376
  /**
539
  );
540
  }
541
  }
542
+
543
+ BPMediaPrivacy::install();
544
  }
545
 
546
  /**
583
  'upload' => true
584
  );
585
  if ( array_key_exists( 'images_enabled', $options ) ) {
586
+ if ( $options[ 'images_enabled' ] == 1 ){
587
  $enabled[ 'image' ] = true;
588
+ }
589
  }
590
  if ( array_key_exists( 'videos_enabled', $options ) ) {
591
+ if ( $options[ 'videos_enabled' ] == 1 ){
592
  $enabled[ 'video' ] = true;
593
+ }
594
  }
595
  if ( array_key_exists( 'audio_enabled', $options ) ) {
596
+ if ( $options[ 'audio_enabled' ] == 1 ){
597
  $enabled[ 'audio' ] = true;
598
+ }
599
  }
600
 
601
  return $enabled;
602
  }
603
 
604
+ function default_count(){
605
+ $count = $this->posts_per_page;
606
+ if(array_key_exists('default_count',$this->options)){
607
+ $count = $this->options['default_count'];
608
+ }
609
+ return (!$count)?10:$count;
610
+ }
611
+
612
  function default_tab(){
613
  $enabled = $this->enabled();
614
  unset($enabled['upload']);
628
  return $defaults_tab;
629
  }
630
 
631
+ /*
632
  static function get_wall_album( $group_id = false ) {
633
  global $wpdb;
634
  $group_id = ( ! $group_id) ? '1' : $group_id;
638
  LIKE '{$album_name}' AND ps.post_type='bp_media_album' AND
639
  pm.meta_key='bp-media-key' AND pm.meta_value ='{$group_id}'";
640
  $wall_albums = $wpdb->get_results( $query, ARRAY_A );
 
641
  if ( count( $wall_albums ) > 1 ) {
642
  return BuddyPressMedia::merge_duplicate_wall_albums( $wall_albums );
643
  } elseif($wall_albums) {
644
  return $wall_albums[ 0 ][ 'ID' ];
645
  }
646
  }
647
+ *
648
+ */
649
 
650
  static function merge_duplicate_wall_albums( $wall_albums ) {
651
  global $wpdb;
app/main/group/BPMediaGroupAction.php CHANGED
@@ -6,67 +6,6 @@
6
  * @author faishal
7
  */
8
  class BPMediaGroupAction {
9
- /**
10
- * Called on bp_init by screen functions
11
- *
12
- * @uses global $bp, $bp_media_query
13
- *
14
- * @since BuddyPress Media 2.0
15
- */
16
-
17
- /**
18
- *
19
- * @global type $bp
20
- * @global WP_Query $bp_media_query
21
- * @global type $bp_media_posts_per_page
22
- */
23
- static function bp_media_groups_set_query() {
24
- global $bp, $bp_media, $bp_media_query, $bp_media_posts_per_page;
25
- $enabled = $bp_media->enabled();
26
- $default_tab = $bp_media->default_tab();
27
- $defaults_tab= $default_tab;
28
- if($default_tab!='audio') $defaults_tab.='s';
29
-
30
- if (isset($bp->current_action) && $bp->current_action == BP_MEDIA_SLUG) {
31
- $current_tab = constant('BP_MEDIA_'.strtoupper($defaults_tab).'_SLUG');
32
- if (isset($bp->action_variables[0])) {
33
- $current_tab = $bp->action_variables[0];
34
- }
35
- if ($current_tab) {
36
- switch ($current_tab) {
37
- case BP_MEDIA_IMAGES_SLUG:
38
- $type = 'image';
39
- break;
40
- case BP_MEDIA_AUDIO_SLUG:
41
- $type = 'audio';
42
- break;
43
- case BP_MEDIA_VIDEOS_SLUG:
44
- $type = 'video';
45
- break;
46
- default :
47
- $type = null;
48
- }
49
- if (bp_action_variable(1) == 'page' && is_numeric(bp_action_variable(2))) {
50
- $paged = bp_action_variable(2);
51
- } else {
52
- $paged = 1;
53
- }
54
- if ($type) {
55
- $args = array(
56
- 'post_type' => 'attachment',
57
- 'post_status' => 'any',
58
- 'post_mime_type' => $type,
59
- 'meta_key' => 'bp-media-key',
60
- 'meta_value' => -bp_get_current_group_id(),
61
- 'meta_compare' => '=',
62
- 'paged' => $paged,
63
- 'posts_per_page' => $bp_media_posts_per_page
64
- );
65
- $bp_media_query = new WP_Query($args);
66
- }
67
- }
68
- }
69
- }
70
 
71
  static function filter_entries(){
72
  global $bp_media;
6
  * @author faishal
7
  */
8
  class BPMediaGroupAction {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
 
10
  static function filter_entries(){
11
  global $bp_media;
app/main/group/BPMediaGroupElementExtension.php CHANGED
@@ -30,7 +30,6 @@ if (class_exists('BP_Group_Extension')) :
30
  */
31
  function display() {
32
  global $bp;
33
- BPMediaGroupAction::bp_media_groups_set_query();
34
  $current_tab = BP_MEDIA_IMAGES_SLUG;
35
  if (isset($bp->action_variables[0])) {
36
  $current_tab = $bp->action_variables[0];
@@ -84,8 +83,8 @@ if (class_exists('BP_Group_Extension')) :
84
  return;
85
  }
86
  if ($media_type == "album") {
87
- $bp_media_content = new BPMediaAlbumScreen($media_type, BP_MEDIA_ALBUMS_ENTRY_SLUG);
88
- $bp->action_variables[0] = BP_MEDIA_ALBUMS_ENTRY_SLUG;
89
  $bp_media_content->entry_screen();
90
  } else {
91
  $bp_media_content = new BPMediaScreen($media_type, $slug);
30
  */
31
  function display() {
32
  global $bp;
 
33
  $current_tab = BP_MEDIA_IMAGES_SLUG;
34
  if (isset($bp->action_variables[0])) {
35
  $current_tab = $bp->action_variables[0];
83
  return;
84
  }
85
  if ($media_type == "album") {
86
+ $bp_media_content = new BPMediaAlbumScreen($media_type, BP_MEDIA_ALBUMS_VIEW_SLUG);
87
+ $bp->action_variables[0] = BP_MEDIA_ALBUMS_VIEW_SLUG;
88
  $bp_media_content->entry_screen();
89
  } else {
90
  $bp_media_content = new BPMediaScreen($media_type, $slug);
app/main/includes/BPMediaActions.php CHANGED
@@ -20,15 +20,22 @@ class BPMediaActions {
20
  add_action('bp_activity_entry_meta', array($this, 'action_buttons'));
21
  add_action('bp_media_before_delete_media', 'BPMediaActions::delete_media_handler');
22
  add_action('bp_media_after_add_album', array($this, 'album_create_activity'));
 
23
  add_action('bp_media_album_updated', 'BPMediaActions::album_activity_update');
 
 
 
24
  add_action('bp_media_after_delete_media', array($this, 'album_activity_sync'));
25
  add_action('bp_media_after_add_media', 'BPMediaActions::activity_create_after_add_media', 10, 4);
26
  add_action('wp_ajax_bp_media_load_more', array($this, 'load_more'));
27
- // add_action('wp_ajax_bp_media_get_attachment_html', array($this, 'fetch_feed'), 1);
28
  add_action('wp_ajax_nopriv_bp_media_load_more', array($this, 'load_more'));
 
29
  add_action('delete_attachment', array($this, 'delete_attachment_handler'));
30
  add_action('wp_ajax_bp_media_add_album', array($this, 'add_album'));
31
- add_action('wp_ajax_nopriv_bp_media_add_album', array($this, 'add_album'));
 
 
 
32
  $linkback = bp_get_option('bp_media_add_linkback', false);
33
  if ($linkback)
34
  add_action('bp_footer', array($this, 'footer'));
@@ -47,12 +54,8 @@ class BPMediaActions {
47
  * @return type
48
  */
49
  static function handle_uploads() {
50
- global $bp, $bp_media_options;
51
- $bp_media_options = get_site_option('bp_media_options', array(
52
- 'videos_enabled' => true,
53
- 'audio_enabled' => true,
54
- 'images_enabled' => true,
55
- ));
56
  if (isset($_POST['action']) && $_POST['action'] == 'wp_handle_upload') {
57
  /** This section can help in the group activity handling */
58
  // if (isset($_POST['bp_media_group_id']) && intval($_POST['bp_media_group_id'])) {
@@ -163,8 +166,6 @@ class BPMediaActions {
163
  'displayed_user' => bp_displayed_user_id(),
164
  'loggedin_user' => bp_loggedin_user_id(),
165
  'current_group' => $cur_group_id,
166
- 'feature' => __('Featured', BP_MEDIA_TXT_DOMAIN),
167
- 'removefeature' => __('Remove Featured', BP_MEDIA_TXT_DOMAIN)
168
  );
169
 
170
  wp_localize_script('bp-media-default', 'bp_media_vars', $bp_media_vars);
@@ -296,7 +297,7 @@ class BPMediaActions {
296
  function action_buttons() {
297
  if (!in_array('bp_media_current_entry', $GLOBALS))
298
  return false;
299
- global $bp_media_current_entry, $bp_media_options;
300
 
301
  if ($bp_media_current_entry != NULL) {
302
  $featured_post = get_post_meta($bp_media_current_entry->get_id(), 'featured', true);
@@ -305,23 +306,23 @@ class BPMediaActions {
305
  echo '<a href="' . $bp_media_current_entry->get_edit_url()
306
  . '" class="button item-button bp-secondary-action bp-media-edit" title="'
307
  . __('Edit Media', BP_MEDIA_TXT_DOMAIN) . '">' . __('Edit', BP_MEDIA_TXT_DOMAIN) . '</a>';
308
-
309
- if ($bp_media_options['download_enabled'] == true)
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() && $featured_post == '')
315
- echo '<a href="' . $bp_media_current_entry->get_album_id()
316
- . '" rel="" 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
- . __('Featured Media', BP_MEDIA_TXT_DOMAIN) . '">' . __('Featured', BP_MEDIA_TXT_DOMAIN) . '</a>';
320
- else
321
- echo '<a href="' . $bp_media_current_entry->get_album_id() . '" rel="" data-remove-featured="1" 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
- . __('Featured Media', BP_MEDIA_TXT_DOMAIN) . '">' . __('Remove Featured', BP_MEDIA_TXT_DOMAIN) . '</a>';
 
325
  }
326
  }
327
 
@@ -340,7 +341,9 @@ class BPMediaActions {
340
  * @return boolean
341
  */
342
  static function init_count($user = null) {
343
- global $bp_media_count;
 
 
344
  if (!$user)
345
  $user = bp_displayed_user_id();
346
  if ($user < 1) {
@@ -349,10 +352,37 @@ class BPMediaActions {
349
  }
350
  $count = bp_get_user_meta($user, 'bp_media_count', true);
351
  if (!$count) {
352
- $bp_media_count = array('images' => 0, 'videos' => 0, 'audio' => 0, 'albums' => 0);
353
  bp_update_user_meta($user, 'bp_media_count', $bp_media_count);
354
  } else {
355
- $bp_media_count = $count;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
356
  }
357
  add_filter('bp_get_displayed_user_nav_' . BP_MEDIA_SLUG, 'BPMediaFilters::items_count_filter', 10, 2);
358
 
@@ -365,6 +395,42 @@ class BPMediaActions {
365
  return true;
366
  }
367
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
368
  /**
369
  * Displays the footer of the BuddyPress Media Plugin if enabled through the dashboard options page
370
  *
@@ -490,90 +556,45 @@ class BPMediaActions {
490
  */
491
  function load_more() {
492
 
493
- global $bp, $bp_media_query;
494
  $page = isset($_POST['page']) ? $_POST['page'] : die();
495
  $current_action = isset($_POST['current_action']) ? $_POST['current_action'] : null;
496
  $action_variables = isset($_POST['action_variables']) ? $_POST['action_variables'] : null;
497
  $displayed_user = isset($_POST['displayed_user']) ? $_POST['displayed_user'] : null;
498
  $loggedin_user = isset($_POST['loggedin_user']) ? $_POST['loggedin_user'] : null;
499
  $current_group = isset($_POST['current_group']) ? $_POST['current_group'] : null;
500
- $limit = 10;
501
- if ( ($displayed_user == $loggedin_user && $current_group == 0) || groups_is_user_member($loggedin_user, $current_group)) {
502
- $limit = get_option('posts_per_page');
503
- $offset = $limit*($page-1)-1;
504
  } else {
505
- $limit = get_option('posts_per_page');
506
- $offset = $limit*($page-1);
507
  }
 
 
 
 
 
 
 
508
  if ((!$displayed_user || intval($displayed_user) == 0) && (!$current_group || intval($current_group) == 0)) {
509
  die();
510
  }
511
- global $bp_media;
512
- $enabled = $bp_media->enabled();
513
-
514
- switch ($current_action) {
515
  case BP_MEDIA_IMAGES_SLUG:
516
- $args = array(
517
- 'post_type' => 'attachment',
518
- 'post_status' => 'any',
519
- 'post_mime_type' => 'image',
520
- 'meta_key' => 'bp-media-key',
521
- 'meta_value' => $current_group > 0 ? -$current_group : $displayed_user,
522
- 'meta_compare' => '=',
523
- 'offset' => $offset,
524
- 'posts_per_page' => $limit
525
- );
526
  break;
527
  case BP_MEDIA_AUDIO_SLUG:
528
- $args = array(
529
- 'post_type' => 'attachment',
530
- 'post_status' => 'any',
531
- 'post_mime_type' => 'audio',
532
- 'author' => $bp->displayed_user->id,
533
- 'meta_key' => 'bp-media-key',
534
- 'meta_value' => $current_group > 0 ? -$current_group : $displayed_user,
535
- 'meta_compare' => '=',
536
- 'offset' => $offset,
537
- 'posts_per_page' => $limit
538
- );
539
  break;
540
  case BP_MEDIA_VIDEOS_SLUG:
541
- $args = array(
542
- 'post_type' => 'attachment',
543
- 'post_status' => 'any',
544
- 'post_mime_type' => 'video',
545
- 'author' => $bp->displayed_user->id,
546
- 'meta_key' => 'bp-media-key',
547
- 'meta_value' => $current_group > 0 ? -$current_group : $displayed_user,
548
- 'meta_compare' => '=',
549
- 'offset' => $offset,
550
- 'posts_per_page' => $limit
551
- );
552
- break;
553
- case BP_MEDIA_ALBUMS_SLUG:
554
- if (isset($action_variables) && is_array($action_variables) && isset($action_variables[0]) && isset($action_variables[1])) {
555
- $args = array(
556
- 'post_type' => 'attachment',
557
- 'post_status' => 'any',
558
- 'author' => $displayed_user,
559
- 'post_parent' => $action_variables[1],
560
- 'offset' => $offset,
561
- 'posts_per_page' => $limit,
562
- 'post_mime_type' => $this->filter_entries(),
563
- );
564
- } else {
565
- $args = array(
566
- 'post_type' => 'bp_media_album',
567
- 'author' => $displayed_user,
568
- 'offset' => $offset,
569
- 'posts_per_page' => $limit,
570
- 'post_mime_type' => $this->filter_entries(),
571
- );
572
- }
573
  break;
574
- default:
575
- die();
576
  }
 
 
 
577
  $bp_media_query = new WP_Query($args);
578
  if (isset($bp_media_query->posts) && is_array($bp_media_query->posts) && count($bp_media_query->posts)) {
579
  foreach ($bp_media_query->posts as $attachment) {
@@ -757,5 +778,21 @@ class BPMediaActions {
757
  }
758
  }
759
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
760
  }
761
  ?>
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'), 99,2);
24
  add_action('bp_media_album_updated', 'BPMediaActions::album_activity_update');
25
+ add_action('bp_media_album_updated', array($this,'update_count'), 99,2);
26
+ add_action('bp_media_after_edit_album', array($this,'update_count'), 99,2);
27
+ add_action('bp_media_after_delete_album', array($this,'update_count'), 99,1);
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'));
36
+ add_action('bp_media_no_object_after_add_media', array($this,'update_count'), 99,2);
37
+ add_action('bp_media_after_update_media', array($this,'update_count'), 99,2);
38
+ add_action('bp_media_after_delete_media', array($this,'update_count'), 99,1);
39
  $linkback = bp_get_option('bp_media_add_linkback', false);
40
  if ($linkback)
41
  add_action('bp_footer', array($this, 'footer'));
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'])) {
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);
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);
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
 
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) {
352
  }
353
  $count = bp_get_user_meta($user, 'bp_media_count', true);
354
  if (!$count) {
355
+ $bp_media_count = array(array('images' => 0, 'videos' => 0, 'audio' => 0, 'albums' => 0));
356
  bp_update_user_meta($user, 'bp_media_count', $bp_media_count);
357
  } else {
358
+ $total = array(
359
+ 'images' => 0,
360
+ 'videos' => 0,
361
+ 'audio' => 0,
362
+ 'albums' => 0,
363
+ 'total' => 0
364
+ );
365
+ $total_count = 0;
366
+
367
+ foreach($count as $level=>$counts){
368
+ if($level<=$current_access){
369
+ foreach($counts as $media=>$number){
370
+ if(array_key_exists($media,$enabled)||array_key_exists($media.'s',$enabled)){
371
+ if($enabled[$media]){
372
+ $medias = $media;
373
+ if($media!='audio')$medias .='s';
374
+ $total[$medias] = $total[$medias] + $number;
375
+ if($media!='album'){
376
+ $total_count = $total_count+$total[$medias];
377
+ }
378
+ }
379
+ }
380
+ }
381
+ $total['total']= $total_count;
382
+ }
383
+ }
384
+
385
+ $bp_media_count = $total;
386
  }
387
  add_filter('bp_get_displayed_user_nav_' . BP_MEDIA_SLUG, 'BPMediaFilters::items_count_filter', 10, 2);
388
 
395
  return true;
396
  }
397
 
398
+ public function update_count() {
399
+ global $bp;
400
+ $user_id = $bp->loggedin_user->id;
401
+ global $wpdb;
402
+
403
+ $query =
404
+ "SELECT
405
+ SUM(CASE WHEN post_mime_type LIKE 'image%' THEN 1 ELSE 0 END) as Images,
406
+ SUM(CASE WHEN post_mime_type LIKE 'audio%' THEN 1 ELSE 0 END) as Audio,
407
+ SUM(CASE WHEN post_mime_type LIKE 'video%' THEN 1 ELSE 0 END) as Videos,
408
+ SUM(CASE WHEN post_type LIKE 'bp_media_album' THEN 1 ELSE 0 END) as Albums
409
+ FROM
410
+ $wpdb->posts p inner join $wpdb->postmeta pm on pm.post_id = p.id INNER JOIN $wpdb->postmeta pmp
411
+ on pmp.post_id = p.id WHERE
412
+ p.post_author = $user_id AND
413
+ pm.meta_key = 'bp-media-key' AND
414
+ pm.meta_value > 0 AND
415
+ pmp.meta_key = 'bp_media_privacy' AND
416
+ ( post_mime_type LIKE 'image%' OR post_mime_type LIKE 'audio%' OR post_mime_type LIKE 'video%' OR post_type LIKE 'bp_media_album')
417
+ GROUP BY pmp.meta_value";
418
+ $result = $wpdb->get_results($query);
419
+ if (!is_array($result))
420
+ return false;
421
+ foreach ($result as $level=>$obj) {
422
+ $formatted[$level] = array(
423
+ 'image'=>$obj->Images,
424
+ 'video'=>$obj->Videos,
425
+ 'audio'=>$obj->Audio,
426
+ 'album'=>$obj->Albums,
427
+ );
428
+ }
429
+ bp_update_user_meta($user_id, 'bp_media_count', $formatted);
430
+ return true;
431
+ }
432
+
433
+
434
  /**
435
  * Displays the footer of the BuddyPress Media Plugin if enabled through the dashboard options page
436
  *
556
  */
557
  function load_more() {
558
 
559
+ global $bp, $bp_media_query, $bp_media;
560
  $page = isset($_POST['page']) ? $_POST['page'] : die();
561
  $current_action = isset($_POST['current_action']) ? $_POST['current_action'] : null;
562
  $action_variables = isset($_POST['action_variables']) ? $_POST['action_variables'] : null;
563
  $displayed_user = isset($_POST['displayed_user']) ? $_POST['displayed_user'] : null;
564
  $loggedin_user = isset($_POST['loggedin_user']) ? $_POST['loggedin_user'] : null;
565
  $current_group = isset($_POST['current_group']) ? $_POST['current_group'] : null;
566
+ $album_id = isset($_POST['album_id']) ? $_POST['album_id'] : false;
567
+ if ($current_group) {
568
+ $type_var = isset($action_variables[0]) ? $action_variables[0] : '';
 
569
  } else {
570
+ $type_var = $current_action;
 
571
  }
572
+
573
+ if($current_action=='albums'){
574
+ if(isset($action_variables[1])){
575
+ $album_id= $action_variables[1];
576
+ }
577
+ }
578
+
579
  if ((!$displayed_user || intval($displayed_user) == 0) && (!$current_group || intval($current_group) == 0)) {
580
  die();
581
  }
582
+ switch ($type_var) {
 
 
 
583
  case BP_MEDIA_IMAGES_SLUG:
584
+ $type = 'image';
 
 
 
 
 
 
 
 
 
585
  break;
586
  case BP_MEDIA_AUDIO_SLUG:
587
+ $type = 'audio';
 
 
 
 
 
 
 
 
 
 
588
  break;
589
  case BP_MEDIA_VIDEOS_SLUG:
590
+ $type = 'video';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
591
  break;
592
+ default :
593
+ $type = null;
594
  }
595
+
596
+ $query = new BPMediaQuery();
597
+ $args = $query->init($type,$album_id,false, $page);
598
  $bp_media_query = new WP_Query($args);
599
  if (isset($bp_media_query->posts) && is_array($bp_media_query->posts) && count($bp_media_query->posts)) {
600
  foreach ($bp_media_query->posts as $attachment) {
778
  }
779
  }
780
 
781
+ public function set_album_cover() {
782
+ $id = $_POST['post_id'];
783
+ $album_id = $_POST['album_id'];
784
+ $album_cover = get_post_thumbnail_id($album_id);
785
+ $text = NULL;
786
+ if ($album_cover && ($album_cover == $id)) {
787
+ delete_post_thumbnail($album_id);
788
+ $text = __('Set as Album Cover', BP_MEDIA_TXT_DOMAIN);
789
+ } else {
790
+ set_post_thumbnail($album_id, $id);
791
+ $text = __('Unset as Album Cover', BP_MEDIA_TXT_DOMAIN);
792
+ }
793
+ echo $text;
794
+ die;
795
+ }
796
+
797
  }
798
  ?>
app/main/includes/BPMediaFilters.php CHANGED
@@ -191,7 +191,7 @@ class BPMediaFilters {
191
  $query = preg_replace('/WHERE/i', 'WHERE a.secondary_item_id!=-999 AND ', $query);
192
  return $query;
193
  }
194
-
195
  /**
196
  *
197
  * @global type $wpdb
191
  $query = preg_replace('/WHERE/i', 'WHERE a.secondary_item_id!=-999 AND ', $query);
192
  return $query;
193
  }
194
+
195
  /**
196
  *
197
  * @global type $wpdb
app/main/includes/BPMediaFunction.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  *
4
  */
@@ -6,8 +7,6 @@ class BPMediaFunction {
6
 
7
  function __construct() {
8
  add_filter('bp_get_activity_action', array($this, 'conditional_override_allowed_tags'), 1, 2);
9
- add_action('wp_ajax_my_featured_action', array($this, 'implement_featured_ajax'));
10
- add_action('wp_ajax_nopriv_my_featured_action', array($this, 'implement_featured_ajax'));
11
  }
12
 
13
  /**
@@ -245,17 +244,6 @@ class BPMediaFunction {
245
  echo '<input type="hidden" name="redirect_to" value="' . $bp_media_current_entry->get_url() . '">';
246
  }
247
 
248
- function implement_featured_ajax() {
249
- if (isset($_POST['post_id'])) {
250
- if (isset($_POST['post_date']) && $_POST['remove_featured'] == 0) {
251
- update_post_meta($_POST['post_id'], 'featured', date('Y-m-d H:i:s', strtotime($_POST['post_date'])));
252
- } else {
253
- update_post_meta($_POST['post_id'], 'featured', FALSE);
254
- }
255
- die(1);
256
- }
257
- }
258
-
259
  /**
260
  * Redirects the user to the location given in the parameter as well as set the message
261
  * and context of redirect
1
  <?php
2
+
3
  /**
4
  *
5
  */
7
 
8
  function __construct() {
9
  add_filter('bp_get_activity_action', array($this, 'conditional_override_allowed_tags'), 1, 2);
 
 
10
  }
11
 
12
  /**
244
  echo '<input type="hidden" name="redirect_to" value="' . $bp_media_current_entry->get_url() . '">';
245
  }
246
 
 
 
 
 
 
 
 
 
 
 
 
247
  /**
248
  * Redirects the user to the location given in the parameter as well as set the message
249
  * and context of redirect
app/main/includes/BPMediaHostWordpress.php CHANGED
@@ -57,12 +57,23 @@ class BPMediaHostWordpress {
57
  }
58
  if (empty($media->ID))
59
  throw new Exception(__('Sorry, the requested media does not exist.', BP_MEDIA_TXT_DOMAIN));
60
- $this->id = $media->ID;
61
- $this->description = $media->post_content;
62
- $this->name = $media->post_title;
63
- $this->owner = $media->post_author;
64
- $this->album_id = $media->post_parent;
65
- $meta_key = get_post_meta($this->id, 'bp-media-key', true);
 
 
 
 
 
 
 
 
 
 
 
66
  /**
67
  * We use bp-media-key to distinguish if the entry belongs to a group or not
68
  * if the value is less than 0 it means it the group id to which the media belongs
@@ -71,14 +82,19 @@ class BPMediaHostWordpress {
71
  * we use it as negative value in the bp-media-key meta key
72
  */
73
  $this->group_id = $meta_key < 0 ? -$meta_key : 0;
74
- if (!'bp_media_album' == $media->post_type || !empty($media->post_mime_type))
75
- preg_match_all('/audio|video|image/i', $media->post_mime_type, $result);
76
- else
77
- $result[0][0] = 'album';
78
- if (isset($result[0][0]))
79
- $this->type = $result[0][0];
80
- else
81
- return false;
 
 
 
 
 
82
  $this->set_permalinks();
83
  }
84
 
@@ -105,7 +121,7 @@ class BPMediaHostWordpress {
105
  function add_media($name, $description, $album_id = 0, $group = 0, $is_multiple = false, $is_activity = false, $files = false) {
106
  do_action('bp_media_before_add_media');
107
 
108
- global $bp, $wpdb, $bp_media_count, $bp_media;
109
  include_once(ABSPATH . 'wp-admin/includes/file.php');
110
  include_once(ABSPATH . 'wp-admin/includes/image.php');
111
 
@@ -135,7 +151,6 @@ class BPMediaHostWordpress {
135
  'post_content' => $content,
136
  'post_parent' => $post_id,
137
  );
138
- BPMediaActions::init_count(bp_loggedin_user_id());
139
  switch ($type) {
140
  case 'video/mp4' :
141
  case 'video/quicktime' :
@@ -166,7 +181,6 @@ class BPMediaHostWordpress {
166
  $activity_content = false;
167
  throw new Exception(__('The MP4 file you have uploaded is not a video file.', BP_MEDIA_TXT_DOMAIN));
168
  }
169
- $bp_media_count['videos'] = intval($bp_media_count['videos']) + 1;
170
  break;
171
  case 'audio/mpeg' :
172
  include_once(trailingslashit(BP_MEDIA_PATH) . 'lib/getid3/getid3.php');
@@ -196,13 +210,11 @@ class BPMediaHostWordpress {
196
  throw new Exception(__('The MP3 file you have uploaded is not an audio file.', BP_MEDIA_TXT_DOMAIN));
197
  }
198
  $type = 'audio';
199
- $bp_media_count['audio'] = intval($bp_media_count['audio']) + 1;
200
  break;
201
  case 'image/gif' :
202
  case 'image/jpeg' :
203
  case 'image/png' :
204
  $type = 'image';
205
- $bp_media_count['images'] = intval($bp_media_count['images']) + 1;
206
  break;
207
  default :
208
  unlink($file);
@@ -226,11 +238,11 @@ class BPMediaHostWordpress {
226
  $this->set_permalinks();
227
  if ($group == 0) {
228
  update_post_meta($attachment_id, 'bp-media-key', get_current_user_id());
229
- bp_update_user_meta(bp_loggedin_user_id(), 'bp_media_count', $bp_media_count);
230
  } else {
231
  update_post_meta($attachment_id, 'bp-media-key', (-$group));
232
  }
233
  do_action('bp_media_after_add_media', $this, $is_multiple, $is_activity, $group);
 
234
  return $attachment_id;
235
  }
236
 
@@ -365,7 +377,7 @@ class BPMediaHostWordpress {
365
  */
366
  function get_media_single_title() {
367
  global $bp_media_default_excerpts, $bp_media;
368
- $content = '<div class="bp_media_title">' . wp_html_excerpt($this->name, $bp_media_default_excerpts['single_entry_title']) . '</div>';
369
  return $content;
370
  }
371
 
@@ -636,21 +648,7 @@ class BPMediaHostWordpress {
636
  */
637
  function delete_media() {
638
  do_action('bp_media_before_delete_media', $this->id);
639
- global $bp_media_count;
640
- BPMediaActions::init_count($this->owner);
641
- switch ($this->type) {
642
- case 'image':
643
- $bp_media_count['images'] = intval($bp_media_count['images']) - 1;
644
- break;
645
- case 'video':
646
- $bp_media_count['videos'] = intval($bp_media_count['videos']) - 1;
647
- break;
648
- case 'audio':
649
- $bp_media_count['audio'] = intval($bp_media_count['audio']) - 1;
650
- break;
651
- }
652
  wp_delete_attachment($this->id, true);
653
- bp_update_user_meta($this->owner, 'bp_media_count', $bp_media_count);
654
  do_action('bp_media_after_delete_media', $this->id);
655
  }
656
 
57
  }
58
  if (empty($media->ID))
59
  throw new Exception(__('Sorry, the requested media does not exist.', BP_MEDIA_TXT_DOMAIN));
60
+ if (!'bp_media_album' == $media->post_type || !empty($media->post_mime_type))
61
+ preg_match_all('/audio|video|image/i', $media->post_mime_type, $result);
62
+ else
63
+ $result[0][0] = 'album';
64
+ if (isset($result[0][0]))
65
+ $this->type = $result[0][0];
66
+ else
67
+ return false;
68
+ // $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
+
77
  /**
78
  * We use bp-media-key to distinguish if the entry belongs to a group or not
79
  * if the value is less than 0 it means it the group id to which the media belongs
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;
93
+ $this->owner = $media->post_author;
94
+ $this->album_id = $media->post_parent;
95
+ $this->mime_type = $media->post_mime_type;
96
+
97
+
98
  $this->set_permalinks();
99
  }
100
 
121
  function add_media($name, $description, $album_id = 0, $group = 0, $is_multiple = false, $is_activity = false, $files = false) {
122
  do_action('bp_media_before_add_media');
123
 
124
+ global $bp, $wpdb, $bp_media;
125
  include_once(ABSPATH . 'wp-admin/includes/file.php');
126
  include_once(ABSPATH . 'wp-admin/includes/image.php');
127
 
151
  'post_content' => $content,
152
  'post_parent' => $post_id,
153
  );
 
154
  switch ($type) {
155
  case 'video/mp4' :
156
  case 'video/quicktime' :
181
  $activity_content = false;
182
  throw new Exception(__('The MP4 file you have uploaded is not a video file.', BP_MEDIA_TXT_DOMAIN));
183
  }
 
184
  break;
185
  case 'audio/mpeg' :
186
  include_once(trailingslashit(BP_MEDIA_PATH) . 'lib/getid3/getid3.php');
210
  throw new Exception(__('The MP3 file you have uploaded is not an audio file.', BP_MEDIA_TXT_DOMAIN));
211
  }
212
  $type = 'audio';
 
213
  break;
214
  case 'image/gif' :
215
  case 'image/jpeg' :
216
  case 'image/png' :
217
  $type = 'image';
 
218
  break;
219
  default :
220
  unlink($file);
238
  $this->set_permalinks();
239
  if ($group == 0) {
240
  update_post_meta($attachment_id, 'bp-media-key', get_current_user_id());
 
241
  } else {
242
  update_post_meta($attachment_id, 'bp-media-key', (-$group));
243
  }
244
  do_action('bp_media_after_add_media', $this, $is_multiple, $is_activity, $group);
245
+ do_action('bp_media_no_object_after_add_media', $this->id, $this->type);
246
  return $attachment_id;
247
  }
248
 
377
  */
378
  function get_media_single_title() {
379
  global $bp_media_default_excerpts, $bp_media;
380
+ $content = wp_html_excerpt($this->name, $bp_media_default_excerpts['single_entry_title']);
381
  return $content;
382
  }
383
 
648
  */
649
  function delete_media() {
650
  do_action('bp_media_before_delete_media', $this->id);
 
 
 
 
 
 
 
 
 
 
 
 
 
651
  wp_delete_attachment($this->id, true);
 
652
  do_action('bp_media_after_delete_media', $this->id);
653
  }
654
 
app/main/includes/BPMediaTemplateFunctions.php CHANGED
@@ -151,13 +151,13 @@ class BPMediaTemplateFunctions {
151
  return false;
152
  switch (get_post_meta($media->ID, 'bp_media_type', true)) {
153
  case 'video' :
154
- return trailingslashit(bp_displayed_user_domain() . BP_MEDIA_VIDEOS_SLUG . '/' . BP_MEDIA_VIDEOS_ENTRY_SLUG . '/' . $media->ID);
155
  break;
156
  case 'audio' :
157
- return trailingslashit(bp_displayed_user_domain() . BP_MEDIA_AUDIO_SLUG . '/' . BP_MEDIA_AUDIO_ENTRY_SLUG . '/' . $media->ID);
158
  break;
159
  case 'image' :
160
- return trailingslashit(bp_displayed_user_domain() . BP_MEDIA_IMAGES_SLUG . '/' . BP_MEDIA_IMAGES_ENTRY_SLUG . '/' . $media->ID);
161
  break;
162
  default :
163
  return false;
@@ -223,7 +223,6 @@ class BPMediaTemplateFunctions {
223
  $showmore = true;
224
  break;
225
  case 'albums':
226
- global $bp_media_albums_query;
227
  if (isset($bp_media_query->found_posts) && $bp_media_query->found_posts > 10)
228
  $showmore = true;
229
  break;
151
  return false;
152
  switch (get_post_meta($media->ID, 'bp_media_type', true)) {
153
  case 'video' :
154
+ return trailingslashit(bp_displayed_user_domain() . BP_MEDIA_VIDEOS_SLUG . '/' . BP_MEDIA_VIDEOS_VIEW_SLUG . '/' . $media->ID);
155
  break;
156
  case 'audio' :
157
+ return trailingslashit(bp_displayed_user_domain() . BP_MEDIA_AUDIO_SLUG . '/' . BP_MEDIA_AUDIO_VIEW_SLUG . '/' . $media->ID);
158
  break;
159
  case 'image' :
160
+ return trailingslashit(bp_displayed_user_domain() . BP_MEDIA_IMAGES_SLUG . '/' . BP_MEDIA_IMAGES_VIEW_SLUG . '/' . $media->ID);
161
  break;
162
  default :
163
  return false;
223
  $showmore = true;
224
  break;
225
  case 'albums':
 
226
  if (isset($bp_media_query->found_posts) && $bp_media_query->found_posts > 10)
227
  $showmore = true;
228
  break;
app/main/privacy/BPMediaPrivacy.php CHANGED
@@ -1,5 +1,4 @@
1
  <?php
2
-
3
  /*
4
  * To change this template, choose Tools | Templates
5
  * and open the template in the editor.
@@ -12,70 +11,307 @@
12
  */
13
  class BPMediaPrivacy {
14
 
15
- var $settings = array(
16
- 6 =>'private',
17
- 4 =>'friends',
18
- 2 =>'users',
19
- 0 =>'public'
20
- );
21
-
22
- var $enabled = false;
23
-
24
 
25
  /**
26
  *
27
  */
28
  function __construct() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  }
31
 
32
- function privacy_ui() {
 
 
 
 
 
 
 
 
 
 
 
 
33
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  }
35
 
36
  function save( $level = 0, $object_id = false ) {
37
 
38
- if(!array_key_exists($level,$this->settings))
39
  return false;
40
 
41
  return $this->save_by_object( $level, $object_id );
42
  }
43
 
44
- private function save_by_object( $level = 0, $object_id = false ) {
45
- if($object_id==false)
46
  return false;
47
 
48
- $level = apply_filters('bp_media_save_privacy', $level);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
 
50
- return update_post_meta($object_id,'bp_media_privacy',$level);
 
 
 
 
 
 
51
 
 
 
52
  }
53
- function check($object_id=false, $object_type='media'){
54
- if($object_id==false)
 
55
  return;
56
- switch ($object_type){
57
- case 'media':
58
- $settings = get_post_meta($object_id,'bp_media_privacy');
59
- break;
60
- case 'profile':
61
- get_user_meta($object_id,'bp_media_privacy',$settings);
62
- return update_user_meta($object_id,'bp_media_privacy',$settings);
63
- break;
64
- case 'activity':
65
- break;
66
- case 'group':
67
- break;
68
 
 
 
 
 
 
 
69
  }
 
 
70
 
 
 
 
71
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  }
73
 
74
- function get_friends(){
 
 
 
 
 
 
 
75
 
 
 
 
 
 
 
 
 
76
  }
77
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
 
79
  }
80
-
81
  ?>
1
  <?php
 
2
  /*
3
  * To change this template, choose Tools | Templates
4
  * and open the template in the editor.
11
  */
12
  class BPMediaPrivacy {
13
 
14
+ var $settings = array( );
15
+ var $messages = array( );
 
 
 
 
 
 
 
16
 
17
  /**
18
  *
19
  */
20
  function __construct() {
21
+ add_action( 'bp_media_after_update_media', array( $this, 'save_privacy' ), 99, 2 );
22
+ add_action( 'bp_media_no_object_after_add_media', array( $this, 'save_privacy' ), 99, 2 );
23
+ add_action( 'wp_ajax_bp_media_privacy_install', 'BPMediaPrivacy::install' );
24
+ add_action( 'wp_ajax_bp_media_privacy_redirect', array( $this, 'set_option_redirect' ) );
25
+ add_action( 'bp_has_activities', array( $this, 'activity' ), 10, 2 );
26
+ if ( BPMediaPrivacy::is_enabled() == false )
27
+ return;
28
+ $this->settings = $this->get_settings();
29
+ add_action( 'bp_media_add_media_fields', array( $this, 'ui' ) );
30
+ }
31
+
32
+ public function set_option_redirect() {
33
+ bp_update_option( 'bp_media_privacy_installed', true );
34
+ do_action('bp_media_after_privacy_install');
35
+ echo true;
36
+ die();
37
+ }
38
 
39
+ static function is_enabled() {
40
+ if ( ! BPMediaPrivacy::is_installed() )
41
+ return false;
42
+ global $bp_media;
43
+ $options = $bp_media->options;
44
+ if ( ! array_key_exists( 'privacy_enabled', $options ) ) {
45
+ return false;
46
+ } else {
47
+ if ( $options[ 'privacy_enabled' ] != true ) {
48
+ return false;
49
+ }
50
+ }
51
+ return true;
52
  }
53
 
54
+ static function is_installed() {
55
+ if ( bp_get_option( 'bp_media_privacy_installed', false ) )
56
+ return true;
57
+
58
+ $settings = new BPMediaPrivacySettings();
59
+ $total = $settings->get_total_count();
60
+ $total = $total[ 0 ]->Total;
61
+ $finished = $settings->get_completed_count();
62
+ $finished = $finished[ 0 ]->Finished;
63
+ if ( $total === $finished )
64
+ $installed = true;
65
+ else
66
+ $installed = false;
67
 
68
+ bp_update_option( 'bp_media_privacy_installed', $installed );
69
+ return $installed;
70
+ }
71
+
72
+ static function get_site_default() {
73
+ global $bp_media;
74
+ $options = $bp_media->options;
75
+ if ( array_key_exists( 'privacy_enabled', $options ) ) {
76
+ if ( array_key_exists( 'default_privacy_level', $options ) ) {
77
+ $site_privacy = $options[ 'default_privacy_level' ];
78
+ }
79
+ }
80
+ return $site_privacy;
81
+ }
82
+
83
+ static function default_privacy() {
84
+ global $bp_media;
85
+ $options = $bp_media->options;
86
+ $default_privacy = false;
87
+ $default_privacy = BPMediaPrivacy::get_site_default();
88
+ if ( array_key_exists( 'privacy_override_enabled', $options ) ) {
89
+ $user_default_privacy = BPMediaPrivacy::get_user_default();
90
+ if ( $user_default_privacy !== false ) {
91
+ $default_privacy = $user_default_privacy;
92
+ }
93
+ }
94
+ return $default_privacy;
95
+ }
96
+
97
+ static function get_settings() {
98
+ return array(
99
+ 6 => array(
100
+ 'private',
101
+ __( '<strong>Private</strong>, Visible only to myself', BP_MEDIA_TXT_DOMAIN )
102
+ ),
103
+ 4 => array(
104
+ 'friends',
105
+ __( '<strong>Friends</strong>, Visible to my friends', BP_MEDIA_TXT_DOMAIN )
106
+ ),
107
+ 2 => array(
108
+ 'users',
109
+ __( '<strong>Users</strong>, Visible to registered users', BP_MEDIA_TXT_DOMAIN )
110
+ ),
111
+ 0 => array(
112
+ 'public',
113
+ __( '<strong>Public</strong>, Visible to the world', BP_MEDIA_TXT_DOMAIN )
114
+ )
115
+ );
116
+ }
117
+
118
+ function ui() {
119
+ if ( BPMediaPrivacy::is_enabled() == false )
120
+ return;
121
+ global $bp_media_current_entry;
122
+ $privacy_level = get_post_meta( $bp_media_current_entry->get_id(), 'bp_media_privacy', TRUE );
123
+ BPMediaPrivacy::ui_html( $privacy_level );
124
+ }
125
+
126
+ static function ui_html( $privacy_level ) {
127
+ ?>
128
+ <div id="bp-media-upload-privacy-wrap">
129
+ <label for="bp-media-upload-set-privacy"><?php _e( 'Set default privacy levels for your media', BP_MEDIA_TXT_DOMAIN ); ?></label>
130
+ <ul id="bp-media-upload-set-privacy">
131
+ <?php
132
+ $settings = BPMediaPrivacy::get_settings();
133
+ foreach ( $settings as $level => &$msg ) {
134
+ ?>
135
+ <li>
136
+ <input type="radio" name="bp_media_privacy" class="set-privacy-radio" id="bp-media-privacy-<?php echo $msg[ 0 ]; ?>" value="<?php echo $level; ?>" <?php checked( $level, $privacy_level, TRUE ); ?> >
137
+ <label class="album-set-privacy-label" for="bp-media-privacy-<?php echo $msg[ 0 ]; ?>"><?php echo $msg[ 1 ]; ?></label>
138
+ </li>
139
+ <?php
140
+ }
141
+ ?>
142
+ </ul>
143
+ </div>
144
+ <?php
145
+ }
146
+
147
+ function save_privacy( $object_id, $type ) {
148
+
149
+ $level = isset( $_POST[ 'bp_media_privacy' ] ) ? $_POST[ 'bp_media_privacy' ] : false;
150
+ if ( ! $level ) {
151
+ $level = BPMediaPrivacy::default_privacy();
152
+ }
153
+ $this->save( $level, $object_id );
154
+ if($type=='album'){
155
+ $args = array(
156
+ 'post_type'=> 'attachment',
157
+ 'post_parent'=> $object_id,
158
+ 'post_status'=> 'any',
159
+ 'posts_per_page'=> -1
160
+ );
161
+
162
+ $child_query = new WP_Query($args);
163
+ $children = $child_query->posts;
164
+ foreach($children as $child){
165
+ $this->save( $level, $child->ID );
166
+ }
167
+ }
168
  }
169
 
170
  function save( $level = 0, $object_id = false ) {
171
 
172
+ if ( ! array_key_exists( $level, $this->settings ) )
173
  return false;
174
 
175
  return $this->save_by_object( $level, $object_id );
176
  }
177
 
178
+ private function save_by_object( $level = 0, $object_id = false ) {
179
+ if ( $object_id == false )
180
  return false;
181
 
182
+ $level = apply_filters( 'bp_media_save_privacy', $level );
183
+
184
+ return update_post_meta( $object_id, 'bp_media_privacy', $level );
185
+ }
186
+
187
+ function activity( $a, $activities ) {
188
+ global $bp_media;
189
+
190
+ foreach ( $activities->activities as $key => $activity ) {
191
+ if ( $activity != null && in_array( $activity->type, $bp_media->activity_types ) ) {
192
+ $has_access = BPMediaPrivacy::has_access($activity->item_id);
193
+ if ( !$has_access ) {
194
+
195
+ unset( $activities->activities[ $key ] );
196
+ $activities->activity_count = $activities->activity_count - 1;
197
+ $activities->total_activity_count = $activities->total_activity_count - 1;
198
+ $activities->pag_num = $activities->pag_num - 1;
199
+ }
200
+ }
201
+ }
202
+ $activities_new = array_values( $activities->activities );
203
+ $activities->activities = $activities_new;
204
+
205
+ return $activities;
206
+ }
207
+
208
+ static function save_user_default( $level = 0, $user_id = false ) {
209
+ if ( $user_id == false ) {
210
+ global $bp;
211
+ $user_id = $bp->loggedin_user->id;
212
+ }
213
+ return update_user_meta( $user_id, 'bp_media_privacy', $level );
214
+ }
215
 
216
+ static function get_user_default( $user_id = false ) {
217
+ if ( $user_id == false ) {
218
+ global $bp;
219
+ $user_id = $bp->loggedin_user->id;
220
+ }
221
+ $user_privacy = get_user_meta( $user_id, 'bp_media_privacy', true );
222
+ if ( $user_privacy === false ) {
223
 
224
+ }
225
+ return $user_privacy;
226
  }
227
+
228
+ static function required_access( $object_id = false ) {
229
+ if ( BPMediaPrivacy::is_enabled() == false )
230
  return;
231
+ if ( $object_id == false )
232
+ return;
233
+ $privacy = get_post_meta( $object_id, 'bp_media_privacy', true );
234
+ $parent = get_post_field( 'post_parent', $object_id, 'raw' );
235
+ $parent_privacy = get_post_meta( $parent, 'bp_media_privacy', true );
 
 
 
 
 
 
 
236
 
237
+ if ( $privacy === false ) {
238
+ if($parent_privacy!==false){
239
+ $privacy = $parent_privacy;
240
+ }else{
241
+ $privacy = BPMediaPrivacy::default_privacy();
242
+ }
243
  }
244
+ return $privacy;
245
+ }
246
 
247
+ static function current_access() {
248
+ global $bp;
249
+ $current_privacy = 0;
250
 
251
+ if ( is_user_logged_in() ) {
252
+ $current_privacy = 2;
253
+ if ( bp_is_my_profile() ) {
254
+ $current_privacy = 6;
255
+ }
256
+ if ( isset( $bp->displayed_user->id ) )
257
+ if ( ! (bp_is_my_profile()) && bp_get_current_group_id() == 0 ) {
258
+ $is_friend = friends_check_friendship_status( $bp->loggedin_user->id, $bp->displayed_user->id );
259
+ if ( $is_friend == 'is_friend' ) {
260
+ $current_privacy = 4;
261
+ }
262
+ }
263
+ }
264
+
265
+ return $current_privacy;
266
  }
267
 
268
+ static function has_access( $object_id = false ) {
269
+ $access = false;
270
+ $current_access = BPMediaPrivacy::current_access();
271
+ $required_access = BPMediaPrivacy::required_access( $object_id );
272
+ if ( $current_access >= $required_access )
273
+ $access = true;
274
+ return $access;
275
+ }
276
 
277
+ static function get_messages( $media_type, $username ) {
278
+ if ( BPMediaPrivacy::is_enabled() == false )
279
+ return;
280
+ return array(
281
+ 6 => sprintf( __( 'This %s is private', BP_MEDIA_TXT_DOMAIN ), $media_type ),
282
+ 4 => sprintf( __( 'This %1s is visible only to %2s&rsquo;s friends', BP_MEDIA_TXT_DOMAIN ), $media_type, $username ),
283
+ 2 => sprintf( __( 'This %s is visible to logged in users, only', BP_MEDIA_TXT_DOMAIN ), $media_type ),
284
+ );
285
  }
286
 
287
+ static function install() {
288
+ $page = $_POST[ 'page' ];
289
+ ($page) ? $page : 1;
290
+ $args = array(
291
+ 'post_type' => array(
292
+ 'attachment',
293
+ 'bp_media_album'
294
+ ),
295
+ 'post_status' => 'any',
296
+ 'posts_per_page' => $_POST[ 'count' ],
297
+ 'meta_query' => array(
298
+ 'relation' => 'AND',
299
+ array(
300
+ 'key' => 'bp-media-key',
301
+ 'compare' => 'EXISTS'
302
+ ),
303
+ array(
304
+ 'key' => 'bp_media_privacy',
305
+ 'compare' => 'NOT EXISTS'
306
+ ),
307
+ ),
308
+ );
309
+ $all_media = new WP_Query( $args );
310
+ foreach ( $all_media->posts as $media ) {
311
+ update_post_meta( $media->ID, 'bp_media_privacy', 0 );
312
+ }
313
+ die( $page );
314
+ }
315
 
316
  }
 
317
  ?>
app/main/privacy/BPMediaPrivacyScreen.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * To change this template, choose Tools | Templates
5
+ * and open the template in the editor.
6
+ */
7
+
8
+ /**
9
+ * Description of BPMediaPrivacyScreen
10
+ *
11
+ * @author saurabh
12
+ * ****
13
+ * ****
14
+ * Need to add required privacy level vs current privacy level
15
+ * Right now there's only required privacy level
16
+ */
17
+ class BPMediaPrivacyScreen {
18
+
19
+ /**
20
+ *
21
+ */
22
+ function __construct() {
23
+ $this->template = new BPMediaTemplate();
24
+ }
25
+
26
+ function ui(){
27
+ global $bp;
28
+ add_action('bp_template_content', array($this, 'screen_content'));
29
+ add_action('bp_template_title', array($this, 'screen_title'));
30
+ $this->template->loader();
31
+ }
32
+
33
+ function screen_content(){
34
+ if ( isset( $_POST['submit'] ) ) {
35
+
36
+ // Nonce check
37
+ check_admin_referer('bpmedia_user_privacy_settings');
38
+ $new_privacy_default = $_POST['bp_media_privacy'];
39
+ BPMediaPrivacy::save_user_default($new_privacy_default);
40
+
41
+ ?>
42
+ <div id="message" class="updated"><p><?php _e('Default privacy level for your media has been updated',BP_MEDIA_TXT_DOMAIN); ?></p></div>
43
+ <?php
44
+ }
45
+ $privacy_level = BPMediaPrivacy::get_user_default();
46
+ if(!$privacy_level)$privacy_level = 0;
47
+
48
+ echo '<form id="bp-media-user-privacy" method="post">';
49
+ BPMediaPrivacy::ui_html($privacy_level);
50
+ wp_nonce_field( 'bpmedia_user_privacy_settings' );
51
+ echo'<div class="submit">'.
52
+ '<input type="submit" name="submit" value="';
53
+ _e( 'Save Changes', 'buddypress' );
54
+ echo '" id="submit" class="auto" /></div>';
55
+ echo '</form>';
56
+ }
57
+
58
+ function screen_title(){
59
+ _e( 'Privacy Settings', BP_MEDIA_TXT_DOMAIN );
60
+ }
61
+
62
+ }
63
+
64
+ ?>
app/main/privacy/BPMediaPrivacySettings.php ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * To change this template, choose Tools | Templates
5
+ * and open the template in the editor.
6
+ */
7
+
8
+ /**
9
+ * Description of BPMediaPrivacySettings
10
+ *
11
+ * @author saurabh
12
+ */
13
+ class BPMediaPrivacySettings {
14
+
15
+ /**
16
+ *
17
+ */
18
+ function __construct() {
19
+ $this->progress = new rtProgress();
20
+
21
+ }
22
+
23
+ function ui($tabs, $tab){
24
+ $idle_class = 'nav-tab';
25
+ $active_class = 'nav-tab nav-tab-active';
26
+ $tabs[] = array(
27
+ 'href' => bp_get_admin_url(add_query_arg(array('page' => 'bp-media-privacy'), 'admin.php')),
28
+ 'title' => __('Update BuddyPress Media Database', BP_MEDIA_TXT_DOMAIN),
29
+ 'name' => __('Update Database', BP_MEDIA_TXT_DOMAIN),
30
+ 'class' => ($tab == 'bp-media-privacy') ? $active_class : $idle_class
31
+ );
32
+ return $tabs;
33
+ }
34
+
35
+ function get_completed_count(){
36
+ global $wpdb;
37
+ $query =
38
+ "SELECT COUNT(*) as Finished
39
+ FROM
40
+ $wpdb->posts RIGHT JOIN $wpdb->postmeta on wp_postmeta.post_id = wp_posts.id
41
+ WHERE
42
+ `meta_key` = 'bp_media_privacy' AND
43
+ ( post_mime_type LIKE 'image%' OR post_mime_type LIKE 'audio%' OR post_mime_type LIKE 'video%' OR post_type LIKE 'bp_media_album')";
44
+ return $result = $wpdb->get_results($query);
45
+ }
46
+
47
+ function get_total_count(){
48
+ global $wpdb;
49
+ $query =
50
+ "SELECT COUNT(*) as Total
51
+ FROM
52
+ $wpdb->posts RIGHT JOIN $wpdb->postmeta on wp_postmeta.post_id = wp_posts.id
53
+ WHERE
54
+ `meta_key` = 'bp-media-key' AND
55
+ ( post_mime_type LIKE 'image%' OR post_mime_type LIKE 'audio%' OR post_mime_type LIKE 'video%' OR post_type LIKE 'bp_media_album')";
56
+ $result = $wpdb->get_results($query);
57
+ return $result;
58
+ }
59
+
60
+ function query(){
61
+
62
+ }
63
+
64
+ function init(){
65
+ $total = $this->get_total_count();
66
+ $total = $total[0];
67
+ $finished = $this->get_completed_count();
68
+ $finished = $finished[0];
69
+
70
+
71
+ echo '<div id="rtprivacyinstaller">';
72
+
73
+ foreach($total as $type=>$count){
74
+ echo '<div class="rtprivacytype" id="'.strtolower($type).'">';
75
+ echo '<strong>';
76
+ echo '<span class="finished">'.$finished->Finished .'</span> / <span class="total">'.$count.'</span>';
77
+ echo '</strong>';
78
+ $progress =100;
79
+ if($count!=0){
80
+ $todo = $count-$finished->Finished;
81
+ $steps = ceil($todo/20);
82
+ $laststep = $todo%20;
83
+ $progress = $this->progress->progress($finished->Finished,$count);
84
+ echo '<input type="hidden" value="'.$finished->Finished.'" name="finished"/>';
85
+ echo '<input type="hidden" value="'.$count.'" name="total"/>';
86
+ echo '<input type="hidden" value="'.$todo.'" name="todo"/>';
87
+ echo '<input type="hidden" value="'.$steps.'" name="steps"/>';
88
+ echo '<input type="hidden" value="'.$laststep.'" name="laststep"/>';
89
+
90
+ }
91
+ $this->progress->progress_ui($progress);
92
+ echo "<br>";
93
+ echo '</div>';
94
+ }
95
+ echo '<button id="rtprivacyinstall" class="button button-primary">';
96
+ _e('Start',BP_MEDIA_TXT_DOMAIN);
97
+ echo '</button>';
98
+ echo '</div>';
99
+ }
100
+ }
101
+
102
+ ?>
app/main/profile/BPMediaAlbum.php CHANGED
@@ -72,11 +72,15 @@ class BPMediaAlbum {
72
  }
73
  if (empty($album->ID))
74
  throw new Exception(__('Sorry, the requested album does not exist.', BP_MEDIA_TXT_DOMAIN));
75
- $this->id = $album->ID;
76
- $this->description = $album->post_content;
77
- $this->name = $album->post_title;
78
- $this->owner = $album->post_author;
79
- $meta_key = get_post_meta($this->id, 'bp-media-key', true);
 
 
 
 
80
  /**
81
  * We use bp-media-key to distinguish if the entry belongs to a group or not
82
  * if the value is less than 0 it means it the group id to which the media belongs
@@ -84,7 +88,17 @@ class BPMediaAlbum {
84
  * But for use in the class, we use group_id as positive integer even though
85
  * we use it as negative value in the bp-media-key meta key
86
  */
87
- $this->group_id = $meta_key < 0 ? -$meta_key : 0;
 
 
 
 
 
 
 
 
 
 
88
  if ($this->group_id > 0) {
89
  $current_group = new BP_Groups_Group($this->group_id);
90
  $group_url = bp_get_group_permalink($current_group);
@@ -103,18 +117,9 @@ class BPMediaAlbum {
103
  'post_parent' => $this->id,
104
  'post_type' => 'attachment'
105
  ));
106
- $attachments_featured = get_children(array(
107
- 'numberposts' => 1,
108
- 'meta_key' => 'featured',
109
- 'orderby' => 'meta_value',
110
- 'post_mime_type' => 'image',
111
- 'post_parent' => $this->id,
112
- 'post_type' => 'attachment',
113
- ));
114
- if ($attachments_featured) {
115
- foreach ($attachments_featured as $attachment) {
116
- $this->thumbnail = '<span><img src="' . wp_get_attachment_thumb_url($attachment->ID) . '"></span>';
117
- }
118
  } elseif ($attachments) {
119
  foreach ($attachments as $attachment) {
120
  $this->thumbnail = '<span><img src="' . wp_get_attachment_thumb_url($attachment->ID) . '"></span>';
@@ -161,8 +166,6 @@ class BPMediaAlbum {
161
  'post_type' => 'bp_media_album',
162
  'post_author' => $author_id
163
  );
164
- BPMediaActions::init_count($author_id);
165
- global $bp_media_count;
166
  $album_id = wp_insert_post($post_vars);
167
  if ($group_id) {
168
  add_post_meta($album_id, 'bp-media-key', (-$group_id));
@@ -170,8 +173,6 @@ class BPMediaAlbum {
170
  add_post_meta($album_id, 'bp-media-key', $author_id);
171
  }
172
  $this->init($album_id);
173
- $bp_media_count['albums'] = intval(isset($bp_media_count['albums']) ? $bp_media_count['albums'] : 0) + 1;
174
- bp_update_user_meta($author_id, 'bp_media_count', $bp_media_count);
175
  do_action('bp_media_after_add_album', $this);
176
  return $album_id;
177
  }
@@ -198,9 +199,6 @@ class BPMediaAlbum {
198
  $author_id = $this->owner;
199
  BPMediaActions::init_count($author_id);
200
  wp_delete_post($this->id, true);
201
- global $bp_media_count;
202
- $bp_media_count['albums'] = intval(isset($bp_media_count['albums']) ? $bp_media_count['albums'] : 0) - 1;
203
- bp_update_user_meta($author_id, 'bp_media_count', $bp_media_count);
204
  do_action('bp_media_after_delete_album', $this);
205
  }
206
 
72
  }
73
  if (empty($album->ID))
74
  throw new Exception(__('Sorry, the requested album does not exist.', BP_MEDIA_TXT_DOMAIN));
75
+
76
+ // $required_access = BPMediaPrivacy::required_access($album_id);
77
+ // $has_access = BPMediaPrivacy::has_access($album_id);
78
+
79
+ global $bp;
80
+ // $messages = BPMediaPrivacy::get_messages( 'album',$bp->displayed_user->fullname );
81
+ $this->id = $album->ID;
82
+
83
+ $meta_key = get_post_meta($this->id, 'bp-media-key', true);
84
  /**
85
  * We use bp-media-key to distinguish if the entry belongs to a group or not
86
  * if the value is less than 0 it means it the group id to which the media belongs
88
  * But for use in the class, we use group_id as positive integer even though
89
  * we use it as negative value in the bp-media-key meta key
90
  */
91
+
92
+ $this->group_id = $meta_key < 0 ? -$meta_key : 0;
93
+ // if($this->group_id<=0){
94
+ // if(!$has_access){
95
+ // throw new Exception($messages[$required_access]);
96
+ // }
97
+ // }
98
+
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);
117
  'post_parent' => $this->id,
118
  'post_type' => 'attachment'
119
  ));
120
+ $thumbnail_id = get_post_thumbnail_id($this->id);
121
+ if ($thumbnail_id) {
122
+ $this->thumbnail = '<span><img src="' . wp_get_attachment_thumb_url($thumbnail_id) . '"></span>';
 
 
 
 
 
 
 
 
 
123
  } elseif ($attachments) {
124
  foreach ($attachments as $attachment) {
125
  $this->thumbnail = '<span><img src="' . wp_get_attachment_thumb_url($attachment->ID) . '"></span>';
166
  'post_type' => 'bp_media_album',
167
  'post_author' => $author_id
168
  );
 
 
169
  $album_id = wp_insert_post($post_vars);
170
  if ($group_id) {
171
  add_post_meta($album_id, 'bp-media-key', (-$group_id));
173
  add_post_meta($album_id, 'bp-media-key', $author_id);
174
  }
175
  $this->init($album_id);
 
 
176
  do_action('bp_media_after_add_album', $this);
177
  return $album_id;
178
  }
199
  $author_id = $this->owner;
200
  BPMediaActions::init_count($author_id);
201
  wp_delete_post($this->id, true);
 
 
 
202
  do_action('bp_media_after_delete_album', $this);
203
  }
204
 
app/main/profile/BPMediaAlbumScreen.php CHANGED
@@ -34,7 +34,7 @@ class BPMediaAlbumScreen extends BPMediaScreen {
34
  case BP_MEDIA_ALBUMS_EDIT_SLUG :
35
  $this->edit_screen();
36
  break;
37
- case BP_MEDIA_ALBUMS_ENTRY_SLUG:
38
  $this->entry_screen();
39
  $this->template_actions('entry_screen');
40
  break;
@@ -90,7 +90,7 @@ class BPMediaAlbumScreen extends BPMediaScreen {
90
  */
91
  function entry_screen() {
92
  global $bp, $bp_media_current_album;
93
- if (!$bp->action_variables[0] == BP_MEDIA_ALBUMS_ENTRY_SLUG)
94
  return false;
95
  try {
96
  $bp_media_current_album = new BPMediaAlbum($bp->action_variables[1]);
@@ -112,18 +112,14 @@ class BPMediaAlbumScreen extends BPMediaScreen {
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_ENTRY_SLUG)
116
  return false;
117
- echo '<div class="bp_media_title">' . $bp_media_current_album->get_title() . '</div>';
118
  if (bp_displayed_user_id() == bp_loggedin_user_id()) {
119
- echo '<div class="activity-meta">';
120
- 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="' . __('Rename Album', BP_MEDIA_TXT_DOMAIN) . '">' . __('Rename', BP_MEDIA_TXT_DOMAIN) . '</a>';
121
  echo '<a href="' . $bp_media_current_album->get_delete_url() . '" class="button item-button bp-secondary-action delete-activity-single confirm" rel="nofollow">' . __("Delete", BP_MEDIA_TXT_DOMAIN) . '</a>';
122
  echo '</div>';
123
  }
124
- $total_post = 10;
125
- $total_post = get_option('posts_per_page');
126
-
127
  $this->inner_query($bp_media_current_album->get_id());
128
  $this->hook_before();
129
  if ($bp_media_current_album && $bp_media_query->have_posts()):
@@ -132,11 +128,9 @@ class BPMediaAlbumScreen extends BPMediaScreen {
132
  echo '<li>';
133
  BPMediaUploadScreen::upload_screen_content();
134
  echo '</li>';
135
- $total_post--;
136
  }
137
- while ($bp_media_query->have_posts() && $total_post>0) : $bp_media_query->the_post();
138
  $this->template->the_content();
139
- $total_post--;
140
  endwhile;
141
  echo '</ul>';
142
  $this->template->show_more();
@@ -150,6 +144,14 @@ class BPMediaAlbumScreen extends BPMediaScreen {
150
  $this->hook_after();
151
  }
152
 
 
 
 
 
 
 
 
 
153
  /**
154
  *
155
  * @global type $bp
@@ -163,28 +165,14 @@ class BPMediaAlbumScreen extends BPMediaScreen {
163
  $paged = 1;
164
  }
165
  if ($bp->current_action == BP_MEDIA_ALBUMS_SLUG) {
166
- $args = array(
167
- 'post_type' => 'bp_media_album',
168
- 'author' => $bp->displayed_user->id,
169
- 'paged' => $paged,
170
- 'meta_key' => 'bp-media-key',
171
- 'meta_value' => $bp->displayed_user->id,
172
- 'meta_compare' => '='
173
- );
174
- $bp_media_albums_query = new WP_Query($args);
175
  }
176
  }
177
 
178
 
179
 
180
- /**
181
- *
182
- * @param type $action
183
- */
184
- function template_actions($action) {
185
- add_action('bp_template_content', array($this, $action . '_content'));
186
- }
187
-
188
  /**
189
  *
190
  * @global type $bp
@@ -204,14 +192,14 @@ class BPMediaAlbumScreen extends BPMediaScreen {
204
  if (!$paged)
205
  $paged = 1;
206
  $this->filter_entries();
207
- $args = array(
208
- 'post_type' => 'attachment',
209
- 'post_status' => 'any',
210
- 'post_parent' => $album_id,
211
- 'paged' => $paged,
212
- 'post_mime_type'=>$this->filters
213
- );
214
- $bp_media_query = new WP_Query($args);
215
  }
216
 
217
  function filter_entries(){
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;
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]);
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()):
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();
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
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
192
  if (!$paged)
193
  $paged = 1;
194
  $this->filter_entries();
195
+ if($bp->current_component=='groups'){
196
+ // do something
197
+ }
198
+ if ($bp->current_action == BP_MEDIA_ALBUMS_SLUG) {
199
+ $query = new BPMediaQuery();
200
+ $args = $query->init(false,$album_id,false,$paged);
201
+ $bp_media_query = new WP_Query($args);
202
+ }
203
  }
204
 
205
  function filter_entries(){
app/main/profile/BPMediaScreen.php CHANGED
@@ -119,8 +119,8 @@ class BPMediaScreen {
119
  *
120
  * @global type $bp_media
121
  */
122
- private function screen_title() {
123
- printf(__('%s List Page', BP_MEDIA_TXT_DOMAIN), $this->slug);
124
  }
125
 
126
  /**
@@ -129,7 +129,7 @@ class BPMediaScreen {
129
  */
130
  public function screen() {
131
  $editslug = 'BP_MEDIA_' . $this->media_const . '_EDIT_SLUG';
132
- $entryslug = 'BP_MEDIA_' . $this->media_const . '_ENTRY_SLUG';
133
 
134
  global $bp;
135
 
@@ -150,11 +150,11 @@ class BPMediaScreen {
150
  break;
151
  default:
152
  $this->set_query();
153
- add_action('bp_template_content', array($this, 'screen_content'));
154
  }
155
  } else {
156
  $this->set_query();
157
- add_action('bp_template_content', array($this, 'screen_content'));
158
  }
159
  $this->template->loader();
160
  }
@@ -172,23 +172,23 @@ class BPMediaScreen {
172
  * @global type $bp_media_albums_query
173
  */
174
  function screen_content() {
175
- global $bp_media_query;
176
- $total_post = 10;
177
- $total_post = get_option('posts_per_page');
178
  $this->set_query();
179
 
 
180
  $this->hook_before();
 
181
  if ($bp_media_query && $bp_media_query->have_posts()):
182
  echo '<ul id="bp-media-list" class="bp-media-gallery item-list">';
183
  if (bp_is_my_profile() || BPMediaGroupLoader::can_upload()) {
184
  echo '<li>';
185
  BPMediaUploadScreen::upload_screen_content();
186
  echo '</li>';
187
- $total_post--;
188
  }
189
- while ($bp_media_query->have_posts() && $total_post>0) : $bp_media_query->the_post();
190
  $this->template->the_content();
191
- $total_post--;
192
  endwhile;
193
  echo '</ul>';
194
  $this->template->show_more();
@@ -211,7 +211,7 @@ class BPMediaScreen {
211
  function entry_screen() {
212
 
213
  global $bp, $bp_media_current_entry;
214
- $entryslug = 'BP_MEDIA_' . $this->media_const . '_ENTRY_SLUG';
215
  if (!$bp->action_variables[0] == constant($entryslug))
216
  return false;
217
  try {
@@ -249,7 +249,7 @@ class BPMediaScreen {
249
  */
250
  function entry_screen_content() {
251
  global $bp, $bp_media_current_entry;
252
- $entryslug = 'BP_MEDIA_' . $this->media_const . '_ENTRY_SLUG';
253
  $this->hook_before();
254
  if (!$bp->action_variables[0] == constant($entryslug))
255
  return false;
@@ -321,16 +321,13 @@ class BPMediaScreen {
321
  <input id="bp-media-upload-input-title" type="text" name="bp_media_title" class="settings-input"
322
  maxlength="<?php echo max(array($bp_media_default_excerpts['single_entry_title'], $bp_media_default_excerpts['activity_entry_title'])) ?>"
323
  value="<?php echo $bp_media_current_entry->get_title(); ?>" />
324
- <?php if ($bp_media_current_entry->get_type() != 'album') { ?>
325
- <label for="bp-media-upload-input-description">
326
- <?php printf(__('%s Description', BP_MEDIA_TXT_DOMAIN), ucfirst($this->media_type)); ?>
327
- </label>
328
- <input id="bp-media-upload-input-description" type="text" name="bp_media_description" class="settings-input"
329
- maxlength="<?php echo max(array($bp_media_default_excerpts['single_entry_description'], $bp_media_default_excerpts['activity_entry_description'])) ?>"
330
- value="<?php echo $bp_media_current_entry->get_content(); ?>" />
331
- <?php }
332
- do_action('bp_media_add_media_fields', $this->media_type);
333
- ?>
334
  <div class="submit">
335
  <input type="submit" class="auto" value="<?php _e('Update', BP_MEDIA_TXT_DOMAIN); ?>" />
336
  <a href="<?php echo $bp_media_current_entry->get_url(); ?>" class="button" title="<?php _e('Back to Media File', BP_MEDIA_TXT_DOMAIN); ?>">
@@ -419,8 +416,16 @@ class BPMediaScreen {
419
  * @global type $bp_media_query
420
  */
421
  public function set_query() {
422
- global $bp, $bp_media_posts_per_page, $bp_media_query;
423
- switch ($bp->current_action) {
 
 
 
 
 
 
 
 
424
  case BP_MEDIA_IMAGES_SLUG:
425
  $type = 'image';
426
  break;
@@ -433,26 +438,10 @@ class BPMediaScreen {
433
  default :
434
  $type = null;
435
  }
436
- 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])) {
437
- $paged = $bp->action_variables[1];
438
- } else {
439
- $paged = 1;
440
- }
441
- if ($type) {
442
- $args = array(
443
- 'post_type' => 'attachment',
444
- 'post_status' => 'any',
445
- 'post_mime_type' => $type,
446
- 'author' => $bp->displayed_user->id,
447
- 'meta_key' => 'bp-media-key',
448
- 'meta_value' => $bp->displayed_user->id,
449
- 'meta_compare' => '=',
450
- 'paged' => $paged,
451
- 'posts_per_page' => $bp_media_posts_per_page
452
- );
453
-
454
- $bp_media_query = new WP_Query($args);
455
- }
456
  }
457
 
458
  }
119
  *
120
  * @global type $bp_media
121
  */
122
+ function screen_title() {
123
+ printf(__('All %s', BP_MEDIA_TXT_DOMAIN), ucfirst($this->slug));
124
  }
125
 
126
  /**
129
  */
130
  public function screen() {
131
  $editslug = 'BP_MEDIA_' . $this->media_const . '_EDIT_SLUG';
132
+ $entryslug = 'BP_MEDIA_' . $this->media_const . '_VIEW_SLUG';
133
 
134
  global $bp;
135
 
150
  break;
151
  default:
152
  $this->set_query();
153
+ $this->template_actions('screen');
154
  }
155
  } else {
156
  $this->set_query();
157
+ $this->template_actions('screen');
158
  }
159
  $this->template->loader();
160
  }
172
  * @global type $bp_media_albums_query
173
  */
174
  function screen_content() {
175
+ global $bp_media_query, $bp_media;
176
+
177
+
178
  $this->set_query();
179
 
180
+
181
  $this->hook_before();
182
+
183
  if ($bp_media_query && $bp_media_query->have_posts()):
184
  echo '<ul id="bp-media-list" class="bp-media-gallery item-list">';
185
  if (bp_is_my_profile() || BPMediaGroupLoader::can_upload()) {
186
  echo '<li>';
187
  BPMediaUploadScreen::upload_screen_content();
188
  echo '</li>';
 
189
  }
190
+ while ($bp_media_query->have_posts() ) : $bp_media_query->the_post();
191
  $this->template->the_content();
 
192
  endwhile;
193
  echo '</ul>';
194
  $this->template->show_more();
211
  function entry_screen() {
212
 
213
  global $bp, $bp_media_current_entry;
214
+ $entryslug = 'BP_MEDIA_' . $this->media_const . '_VIEW_SLUG';
215
  if (!$bp->action_variables[0] == constant($entryslug))
216
  return false;
217
  try {
249
  */
250
  function entry_screen_content() {
251
  global $bp, $bp_media_current_entry;
252
+ $entryslug = 'BP_MEDIA_' . $this->media_const . '_VIEW_SLUG';
253
  $this->hook_before();
254
  if (!$bp->action_variables[0] == constant($entryslug))
255
  return false;
321
  <input id="bp-media-upload-input-title" type="text" name="bp_media_title" class="settings-input"
322
  maxlength="<?php echo max(array($bp_media_default_excerpts['single_entry_title'], $bp_media_default_excerpts['activity_entry_title'])) ?>"
323
  value="<?php echo $bp_media_current_entry->get_title(); ?>" />
324
+ <label for="bp-media-upload-input-description">
325
+ <?php printf(__('%s Description', BP_MEDIA_TXT_DOMAIN), ucfirst($this->media_type)); ?>
326
+ </label>
327
+ <input id="bp-media-upload-input-description" type="text" name="bp_media_description" class="settings-input"
328
+ maxlength="<?php echo max(array($bp_media_default_excerpts['single_entry_description'], $bp_media_default_excerpts['activity_entry_description'])) ?>"
329
+ value="<?php echo $bp_media_current_entry->get_content(); ?>" />
330
+ <?php do_action('bp_media_add_media_fields', $this->media_type); ?>
 
 
 
331
  <div class="submit">
332
  <input type="submit" class="auto" value="<?php _e('Update', BP_MEDIA_TXT_DOMAIN); ?>" />
333
  <a href="<?php echo $bp_media_current_entry->get_url(); ?>" class="button" title="<?php _e('Back to Media File', BP_MEDIA_TXT_DOMAIN); ?>">
416
  * @global type $bp_media_query
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';
431
  break;
438
  default :
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
  }
app/main/profile/BPMediaTemplate.php CHANGED
@@ -12,7 +12,7 @@
12
  class BPMediaTemplate {
13
 
14
  /**
15
- *
16
  * @global type $bp_media_current_album
17
  */
18
  function upload_form_multiple() {
@@ -83,7 +83,7 @@ class BPMediaTemplate {
83
  }
84
 
85
  /**
86
- *
87
  * @param type $id
88
  * @return boolean
89
  */
@@ -98,13 +98,13 @@ class BPMediaTemplate {
98
  return false;
99
  switch (get_post_meta($media->ID, 'bp_media_type', true)) {
100
  case 'video' :
101
- return trailingslashit(bp_displayed_user_domain() . BP_MEDIA_VIDEOS_SLUG . '/' . BP_MEDIA_VIDEOS_ENTRY_SLUG . '/' . $media->ID);
102
  break;
103
  case 'audio' :
104
- return trailingslashit(bp_displayed_user_domain() . BP_MEDIA_AUDIO_SLUG . '/' . BP_MEDIA_AUDIO_ENTRY_SLUG . '/' . $media->ID);
105
  break;
106
  case 'image' :
107
- return trailingslashit(bp_displayed_user_domain() . BP_MEDIA_IMAGES_SLUG . '/' . BP_MEDIA_IMAGES_ENTRY_SLUG . '/' . $media->ID);
108
  break;
109
  default :
110
  return false;
@@ -116,7 +116,7 @@ class BPMediaTemplate {
116
  }
117
 
118
  /**
119
- *
120
  * @param type $id
121
  * @return boolean
122
  */
@@ -138,7 +138,7 @@ class BPMediaTemplate {
138
  }
139
 
140
  /**
141
- *
142
  * @param type $id
143
  * @return boolean
144
  */
@@ -160,32 +160,34 @@ class BPMediaTemplate {
160
  }
161
 
162
  /**
163
- *
164
  * @global type $bp_media_query
165
  * @global type $bp_media_albums_query
166
  * @param type $type
167
  */
168
  function show_more($type = 'media') {
169
  $showmore = false;
 
 
170
  switch ($type) {
171
  case 'media':
172
  global $bp_media_query;
173
  //found_posts
174
  if ( bp_is_my_profile() || BPMediaGroupLoader::can_upload() ) {
175
- if (isset($bp_media_query->found_posts) && $bp_media_query->found_posts > (get_option('posts_per_page')-1) )
176
  $showmore = true;
177
  } else {
178
- if (isset($bp_media_query->found_posts) && $bp_media_query->found_posts > get_option('posts_per_page') )
179
  $showmore = true;
180
  }
181
  break;
182
  case 'albums':
183
  global $bp_media_albums_query;
184
  if ( bp_is_my_profile() || BPMediaGroupLoader::can_upload() ) {
185
- if (isset($bp_media_albums_query->found_posts) && $bp_media_albums_query->found_posts > 9)
186
  $showmore = true;
187
  } else {
188
- if (isset($bp_media_albums_query->found_posts) && $bp_media_albums_query->found_posts > 10)
189
  $showmore = true;
190
  }
191
  break;
@@ -200,7 +202,7 @@ class BPMediaTemplate {
200
  */
201
 
202
  /**
203
- *
204
  * @param type $mediaconst
205
  */
206
  function redirect($mediaconst) {
@@ -212,7 +214,7 @@ class BPMediaTemplate {
212
  }
213
 
214
  /**
215
- *
216
  * @global type $bp
217
  * @global type $bp_media_default_excerpts
218
  * @return type
12
  class BPMediaTemplate {
13
 
14
  /**
15
+ *
16
  * @global type $bp_media_current_album
17
  */
18
  function upload_form_multiple() {
83
  }
84
 
85
  /**
86
+ *
87
  * @param type $id
88
  * @return boolean
89
  */
98
  return false;
99
  switch (get_post_meta($media->ID, 'bp_media_type', true)) {
100
  case 'video' :
101
+ return trailingslashit(bp_displayed_user_domain() . BP_MEDIA_VIDEOS_SLUG . '/' . BP_MEDIA_VIDEOS_VIEW_SLUG . '/' . $media->ID);
102
  break;
103
  case 'audio' :
104
+ return trailingslashit(bp_displayed_user_domain() . BP_MEDIA_AUDIO_SLUG . '/' . BP_MEDIA_AUDIO_VIEW_SLUG . '/' . $media->ID);
105
  break;
106
  case 'image' :
107
+ return trailingslashit(bp_displayed_user_domain() . BP_MEDIA_IMAGES_SLUG . '/' . BP_MEDIA_IMAGES_VIEW_SLUG . '/' . $media->ID);
108
  break;
109
  default :
110
  return false;
116
  }
117
 
118
  /**
119
+ *
120
  * @param type $id
121
  * @return boolean
122
  */
138
  }
139
 
140
  /**
141
+ *
142
  * @param type $id
143
  * @return boolean
144
  */
160
  }
161
 
162
  /**
163
+ *
164
  * @global type $bp_media_query
165
  * @global type $bp_media_albums_query
166
  * @param type $type
167
  */
168
  function show_more($type = 'media') {
169
  $showmore = false;
170
+ global $bp_media;
171
+ $count = $bp_media->default_count();
172
  switch ($type) {
173
  case 'media':
174
  global $bp_media_query;
175
  //found_posts
176
  if ( bp_is_my_profile() || BPMediaGroupLoader::can_upload() ) {
177
+ if (isset($bp_media_query->found_posts) && $bp_media_query->found_posts > ($count-1) )
178
  $showmore = true;
179
  } else {
180
+ if (isset($bp_media_query->found_posts) && $bp_media_query->found_posts > $count )
181
  $showmore = true;
182
  }
183
  break;
184
  case 'albums':
185
  global $bp_media_albums_query;
186
  if ( bp_is_my_profile() || BPMediaGroupLoader::can_upload() ) {
187
+ if (isset($bp_media_albums_query->found_posts) && $bp_media_albums_query->found_posts > ($count-1) )
188
  $showmore = true;
189
  } else {
190
+ if (isset($bp_media_albums_query->found_posts) && $bp_media_albums_query->found_posts > $count )
191
  $showmore = true;
192
  }
193
  break;
202
  */
203
 
204
  /**
205
+ *
206
  * @param type $mediaconst
207
  */
208
  function redirect($mediaconst) {
214
  }
215
 
216
  /**
217
+ *
218
  * @global type $bp
219
  * @global type $bp_media_default_excerpts
220
  * @return type
app/main/query/BPMediaQuery.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * Don't load this file directly!
4
  */
@@ -12,11 +13,164 @@ if ( ! defined( 'ABSPATH' ) )
12
  */
13
  class BPMediaQuery {
14
 
15
- /**
16
- *
17
- */
18
- function __construct() {
19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  }
21
 
22
  }
1
  <?php
2
+
3
  /**
4
  * Don't load this file directly!
5
  */
13
  */
14
  class BPMediaQuery {
15
 
 
 
 
 
16
 
17
+ function init( $type = false, $album_id=false, $count=false, $page=false,$docount = false ) {
18
+ $args = $this->prepare_args( $type,$album_id,$page, $docount,$count );
19
+ return $this->return_result( $args, $docount );
20
+ }
21
+
22
+ function privacy_query( ) {
23
+ $privacy = BPMediaPrivacy::current_access();
24
+ return $meta_query = array(
25
+ 'key' => 'bp_media_privacy',
26
+ 'value' => $privacy,
27
+ 'compare'=>'<=',
28
+ 'type' => 'NUMERIC'
29
+ );
30
+ }
31
+
32
+ function group_query( $group = false ) {
33
+ global $bp;
34
+ $group_id = null;
35
+
36
+ if ( $group == false ) {
37
+ if(isset($bp->displayed_user->id)){
38
+ $group_id = $bp->displayed_user->id;
39
+ }
40
+ } else {
41
+ if ( ! class_exists( 'BPMediaGroupsExtension' ) )
42
+ return array( );
43
+ $group_id = -bp_get_current_group_id();
44
+ }
45
+ return $meta_query = array(
46
+ 'key' => 'bp-media-key',
47
+ 'value' => $group_id,
48
+ );
49
+ }
50
+
51
+ function prepare_meta_query() {
52
+ $group = bp_is_current_component( 'groups' );
53
+ if(!bp_is_groups_component()){
54
+ $meta_query[] = $this->privacy_query();
55
+ }
56
+ $meta_query[] = $this->group_query( $group );
57
+ return $meta_query;
58
+ }
59
+
60
+ function prepare_args( $type = false,$album_id=false, $page=false, $docount = false,$count=false ) {
61
+
62
+ global $bp, $bp_media;
63
+
64
+ $enabled = $bp_media->enabled();
65
+
66
+ unset( $enabled[ 'upload' ] );
67
+
68
+ if ( $type != false ) {
69
+ if ( ! array_key_exists( $type, $enabled ) )
70
+ return;
71
+ }
72
+
73
+
74
+ $post_type = $this->prepare_post_type( $type );
75
+
76
+ $mime_type = $this->prepare_mime_type( $type );
77
+ $args = array(
78
+ 'post_type' => $post_type,
79
+ 'post_status' => 'any',
80
+ 'post_mime_type' => $mime_type,
81
+ 'meta_query' => $this->prepare_meta_query(),
82
+ 'posts_per_page' => -1
83
+ );
84
+ if($album_id){
85
+ $args['post_parent'] = $album_id;
86
+ }
87
+ if(!bp_is_groups_component()){
88
+ if(isset($bp->displayed_user->id)){
89
+ $args['author'] = $bp->displayed_user->id;
90
+ }
91
+ }
92
+
93
+ if ( $docount == false ) {
94
+ if($count==false){
95
+ $count = $bp_media->default_count();
96
+ }
97
+ $limit_offset = $this->get_limit_offset( $count, $this->prepare_pagination($page) );
98
+ $args[ 'posts_per_page' ] = $limit_offset[0];
99
+ $args[ 'offset' ] = $limit_offset[1];
100
+ }
101
+
102
+ return $args;
103
+ }
104
+
105
+
106
+ function get_limit_offset( $limit, $page ) {
107
+ global $bp;
108
+ if ( ( bp_is_my_profile() && bp_get_current_group_id() == 0) || groups_is_user_member( $bp->loggedin_user->id, bp_get_current_group_id() ) ) {
109
+ if($page>1){
110
+ $offset = $limit * ($page - 1) - 1;
111
+ }else{
112
+ $offset = 0;
113
+ $limit = $limit -1;
114
+ }
115
+ } else {
116
+ $offset = $limit * ($page - 1);
117
+ }
118
+ return array($limit,$offset);
119
+ }
120
+
121
+ function prepare_post_type( $type ) {
122
+ $post_type = 'attachment';
123
+ if ( $type == 'album' ) {
124
+ $post_type = 'bp_media_album';
125
+ }
126
+ return $post_type;
127
+ }
128
+
129
+ function prepare_mime_type( $type ) {
130
+ global $bp_media;
131
+ $enabled = $bp_media->enabled();
132
+ if ( $type == '' ) {
133
+ unset( $enabled[ 'album' ] );
134
+ unset( $enabled[ 'upload' ] );
135
+ foreach ( $enabled as $type => $active ) {
136
+ if ( $active ) {
137
+ $mime_type[ ] = $type;
138
+ }
139
+ }
140
+ } elseif ( $type == 'album' ) {
141
+ $mime_type = '';
142
+ } else {
143
+ $mime_type = $type;
144
+ }
145
+ return $mime_type;
146
+ }
147
+
148
+ function prepare_pagination($page) {
149
+ global $bp;
150
+ 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 ] ) ) {
151
+ $paged = $bp->action_variables[ 1 ];
152
+ } else {
153
+ $paged = ($page)?$page:1;
154
+ }
155
+ return $paged;
156
+ }
157
+
158
+ function return_result( $args, $count ) {
159
+ if ( $count == false ) {
160
+ return $args;
161
+ } else {
162
+ return $this->get_count( $args );
163
+ }
164
+ }
165
+
166
+ function query( $args ) {
167
+ $query = new WP_Query( $args );
168
+ return $query;
169
+ }
170
+
171
+ function get_count( $args ) {
172
+ $query = $this->query( $args );
173
+ return $query->found_posts();
174
  }
175
 
176
  }
app/main/widgets/BPMediaWidget.php CHANGED
@@ -30,212 +30,103 @@ if ( ! class_exists( 'BPMediaWidget' ) ) {
30
  function widget( $args, $instance ) {
31
  extract( $args );
32
  $title = apply_filters( 'widget_title', empty( $instance[ 'title' ] ) ? __( 'BuddyPress Media', BP_MEDIA_TXT_DOMAIN ) : $instance[ 'title' ], $instance, $this->id_base );
33
-
34
- if ( empty( $instance[ 'number' ] ) || ! $number = absint( $instance[ 'number' ] ) )
 
35
  $number = 10;
 
36
  $wdType = isset( $instance[ 'wdType' ] ) ? esc_attr( $instance[ 'wdType' ] ) : 'recent';
37
- $allowAudio = isset( $instance[ 'allow_audio' ] ) ? (bool) $instance[ 'allow_audio' ] : true;
38
- $allowVideo = isset( $instance[ 'allow_video' ] ) ? (bool) $instance[ 'allow_video' ] : true;
39
- $allowImage = isset( $instance[ 'allow_image' ] ) ? (bool) $instance[ 'allow_image' ] : true;
40
- $allowAll = isset( $instance[ 'allow_all' ] ) ? (bool) $instance[ 'allow_all' ] : true;
41
- $allowMimeType = array( );
42
- echo $before_widget;
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  echo $before_title . $title . $after_title;
44
  if ( $wdType == "popular" ) {
45
  $orderby = 'comment_count';
46
  } else {
47
  $orderby = 'date';
48
  }
49
- $widgetid = $args[ 'widget_id' ];
50
- if ( ! ($allowAll || $allowAudio || $allowVideo || $allowImage) ) {
51
- ?>
52
- <p><?php printf( __( 'Please configure this widget <a href="%s" target="_blank" title="Configure BuddyPress Media Widget">here</a>.', 'rtPanel' ), admin_url( '/widgets.php' ) ); ?></p><?php } else {
53
- ?>
54
-
55
- <div id="<?php echo $wdType; ?>-media-tabs" class="media-tabs-container media-tabs-container-tabs">
56
- <ul>
57
- <?php if ( $allowAll ) { ?>
58
- <li><a href="#<?php echo $wdType; ?>-media-tabs-all-<?php echo $widgetid; ?>"><?php _e( 'All', BP_MEDIA_TXT_DOMAIN ); ?></a></li>
59
- <?php
60
- }
61
- if ( $allowImage ) {
62
- array_push( $allowMimeType, "image" );
63
- ?>
64
- <li><a href="#<?php echo $wdType; ?>-media-tabs-photos-<?php echo $widgetid; ?>"><?php _e( 'Photos', BP_MEDIA_TXT_DOMAIN ); ?></a></li>
65
- <?php
66
- }
67
- if ( $allowAudio ) {
68
- array_push( $allowMimeType, "audio" );
69
- ?>
70
- <li><a href="#<?php echo $wdType; ?>-media-tabs-music-<?php echo $widgetid; ?>"><?php _e( 'Music', BP_MEDIA_TXT_DOMAIN ); ?></a></li>
71
- <?php
72
- }
73
- if ( $allowVideo ) {
74
- array_push( $allowMimeType, "video" );
75
- ?>
76
- <li><a href="#<?php echo $wdType; ?>-media-tabs-videos-<?php echo $widgetid; ?>"><?php _e( 'Videos', BP_MEDIA_TXT_DOMAIN ); ?></a></li>
77
- <?php }
78
- ?>
79
- </ul>
80
- <?php if ( $allowAll ) { ?>
81
- <div id="<?php echo $wdType; ?>-media-tabs-all-<?php echo $widgetid; ?>" class="bp-media-tab-panel">
82
- <?php
83
- $args = array( 'post_type' => 'attachment',
84
- 'post_status' => 'any',
85
- 'posts_per_page' => $number,
86
- 'meta_key' => 'bp-media-key',
87
- 'meta_value' => 0,
88
- 'meta_compare' => '>',
89
- 'orderby' => $orderby
90
- );
91
-
92
- $bp_media_widget_query = new WP_Query( $args );
93
-
94
- if ( $bp_media_widget_query->have_posts() ) {
95
- ?>
96
 
97
- <ul class="widget-item-listing"><?php
98
- while ( $bp_media_widget_query->have_posts() ) {
99
- $bp_media_widget_query->the_post();
100
-
101
- $entry = new BPMediaHostWordpress( get_the_ID() );
102
- ?>
103
-
104
- <?php echo $entry->get_media_gallery_content(); ?><?php }
105
- ?>
106
-
107
- </ul><?php
108
- }
109
- else
110
- _e( 'No ' . $wdType . ' media found', BP_MEDIA_TXT_DOMAIN );
111
-
112
- wp_reset_query();
113
- ?>
114
-
115
- </div>
116
- <?php
 
 
 
 
 
 
 
 
117
  }
118
- if ( $allowImage ) {
119
- ?>
120
- <div id="<?php echo $wdType; ?>-media-tabs-photos-<?php echo $widgetid; ?>" class="bp-media-tab-panel">
121
- <?php
122
- // photos
123
- $args = array( 'post_type' => 'attachment',
124
- 'post_status' => 'any',
125
- 'post_mime_type' => 'image',
126
- 'posts_per_page' => $number,
127
- 'meta_key' => 'bp-media-key',
128
- 'meta_value' => 0,
129
- 'meta_compare' => '>',
130
- 'orderby' => $orderby );
131
-
132
- $bp_media_widget_query = new WP_Query( $args );
133
-
134
- if ( $bp_media_widget_query->have_posts() ) {
135
- ?>
136
-
137
- <ul class="widget-item-listing"><?php
138
  while ( $bp_media_widget_query->have_posts() ) {
139
  $bp_media_widget_query->the_post();
140
 
141
  $entry = new BPMediaHostWordpress( get_the_ID() );
142
- ?>
143
-
144
- <?php echo $entry->get_media_gallery_content(); ?><?php }
145
- ?>
146
-
147
- </ul><!-- .widget-item-listing --><?php
148
- }
149
- else
150
- _e( 'No ' . $wdType . ' photo found', BP_MEDIA_TXT_DOMAIN );
151
-
152
- wp_reset_query();
153
- ?>
154
-
155
- </div>
156
- <?php
157
- }
158
- if ( $allowAudio ) {
159
- ?>
160
-
161
- <div id="<?php echo $wdType; ?>-media-tabs-music-<?php echo $widgetid; ?>" class="bp-media-tab-panel">
162
- <?php
163
- // Audio
164
- $args = array( 'post_type' => 'attachment',
165
- 'post_status' => 'any',
166
- 'post_mime_type' => 'audio',
167
- 'posts_per_page' => $number,
168
- 'meta_key' => 'bp-media-key',
169
- 'meta_value' => 0,
170
- 'meta_compare' => '>',
171
- 'orderby' => $orderby );
172
- $bp_media_widget_query = new WP_Query( $args );
173
-
174
- if ( $bp_media_widget_query->have_posts() ) {
175
- ?>
176
-
177
- <ul class="widget-item-listing">
178
- <?php
179
- while ( $bp_media_widget_query->have_posts() ) {
180
- $bp_media_widget_query->the_post();
181
 
182
- $entry = new BPMediaHostWordpress( get_the_ID() );
183
- echo $entry->get_media_gallery_content();
184
- }
185
- ?>
186
-
187
- </ul><?php
 
 
 
188
  }
189
- else
190
- _e( 'No ' . $wdType . ' audio found', BP_MEDIA_TXT_DOMAIN );
191
-
192
  wp_reset_query();
193
- ?>
194
-
195
- </div>
196
-
197
- <?php
198
- }
199
- if ( $allowVideo ) {
200
- ?>
201
- <div id="<?php echo $wdType; ?>-media-tabs-videos-<?php echo $widgetid; ?>" class="bp-media-tab-panel">
202
- <?php
203
- //Video
204
- $args = array( 'post_type' => 'attachment',
205
- 'post_status' => 'any',
206
- 'post_mime_type' => 'video',
207
- 'posts_per_page' => $number,
208
- 'meta_key' => 'bp-media-key',
209
- 'meta_value' => 0,
210
- 'meta_compare' => '>',
211
- 'orderby' => $orderby );
212
- $bp_media_widget_query = new WP_Query( $args );
213
-
214
- if ( $bp_media_widget_query->have_posts() ) {
215
- ?>
216
-
217
- <ul class="widget-item-listing"><?php
218
- while ( $bp_media_widget_query->have_posts() ) {
219
- $bp_media_widget_query->the_post();
220
-
221
- $entry = new BPMediaHostWordpress( get_the_ID() );
222
- ?>
223
-
224
- <?php echo $entry->get_media_gallery_content(); ?><?php }
225
- ?>
226
 
227
- </ul><?php
228
- }
229
- else
230
- _e( 'No ' . $wdType . ' video found', BP_MEDIA_TXT_DOMAIN );
231
-
232
- wp_reset_query();
233
- ?>
234
 
235
- </div>
236
- <?php } ?>
237
- </div>
238
- <?php
239
  }
240
  echo $after_widget;
241
  }
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( );
35
+ if ( empty( $instance[ 'number' ] ) || ! $number = absint( $instance[ 'number' ] ) ) {
36
  $number = 10;
37
+ }
38
  $wdType = isset( $instance[ 'wdType' ] ) ? esc_attr( $instance[ 'wdType' ] ) : 'recent';
39
+ if(isset( $instance[ 'allow_all' ] ) && (bool)$instance[ 'allow_all' ]===true)$allow[]='all';
40
+ if(isset( $instance[ 'allow_image' ] ) && (bool)$instance[ 'allow_image' ]===true)$allow[]='image';
41
+ if(isset( $instance[ 'allow_audio' ] ) && (bool)$instance[ 'allow_audio' ]===true)$allow[]='audio';
42
+ if(isset( $instance[ 'allow_video' ] ) && (bool)$instance[ 'allow_video' ]===true)$allow[]='video';
43
+
44
+ global $bp_media;
45
+ $enabled = $bp_media->enabled();
46
+ unset($enabled['album']);unset($enabled['upload']);
47
+ foreach($allow as $type){
48
+
49
+ if($type!='all'){
50
+ echo '<br>';
51
+ if($enabled[$type]){
52
+ $allowed[]= $type;
53
+ }
54
+ }else{
55
+ $allowed[]=$type;
56
+ }
57
+ }
58
  echo $before_title . $title . $after_title;
59
  if ( $wdType == "popular" ) {
60
  $orderby = 'comment_count';
61
  } else {
62
  $orderby = 'date';
63
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
 
65
+ $strings = array(
66
+ 'all' => __( 'All', BP_MEDIA_TXT_DOMAIN ),
67
+ 'audio' => __( 'Music', BP_MEDIA_TXT_DOMAIN ),
68
+ 'video' => __( 'Videos', BP_MEDIA_TXT_DOMAIN ),
69
+ 'image' => __( 'Photos', BP_MEDIA_TXT_DOMAIN )
70
+ );
71
+ $widgetid = $args[ 'widget_id' ];
72
+ if ( ! is_array( $allowed ) || count( $allowed ) < 1 ) {
73
+ echo '<p>';
74
+ printf(
75
+ __(
76
+ 'Please configure this widget
77
+ <a href="%s" target="_blank"
78
+ title="Configure BuddyPress Media Widget">
79
+ here</a>.', 'rtPanel'
80
+ ), admin_url( '/widgets.php' )
81
+ );
82
+ echo '</p>';
83
+ } else {
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' ) {
120
+ $media_string = 'media';
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
  }
index.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: BuddyPress Media
4
  Plugin URI: http://rtcamp.com/buddypress-media/
5
  Description: This plugin adds missing media rich features like photos, videosand audios uploading to BuddyPress which are essential if you are building social network, seriously!
6
- Version: 2.5.5
7
  Author: rtCamp
8
  Text Domain: buddypress-media
9
  Author URI: http://rtcamp.com
@@ -49,6 +49,8 @@ function buddypress_media_autoloader( $class_name ) {
49
  'app/main/activity/' . $class_name . '.php',
50
  'app/main/profile/' . $class_name . '.php',
51
  'app/main/group/' . $class_name . '.php',
 
 
52
  'app/main/group/dummy/' . $class_name . '.php',
53
  'app/main/includes/' . $class_name . '.php',
54
  'app/main/widgets/' . $class_name . '.php',
@@ -74,7 +76,6 @@ spl_autoload_register( 'buddypress_media_autoloader' );
74
  */
75
  global $bp_media;
76
  $bp_media = new BuddyPressMedia();
77
- BuddyPressMedia::get_wall_album();
78
  //add_action('init','BPMediaBPAlbumImporter');
79
 
80
  //BPMediaBPAlbumImporter::bpmedia_ajax_import_callback();
3
  Plugin Name: BuddyPress Media
4
  Plugin URI: http://rtcamp.com/buddypress-media/
5
  Description: This plugin adds missing media rich features like photos, videosand audios uploading to BuddyPress which are essential if you are building social network, seriously!
6
+ Version: 2.6
7
  Author: rtCamp
8
  Text Domain: buddypress-media
9
  Author URI: http://rtcamp.com
49
  'app/main/activity/' . $class_name . '.php',
50
  'app/main/profile/' . $class_name . '.php',
51
  'app/main/group/' . $class_name . '.php',
52
+ 'app/main/query/' . $class_name . '.php',
53
+ 'app/main/privacy/' . $class_name . '.php',
54
  'app/main/group/dummy/' . $class_name . '.php',
55
  'app/main/includes/' . $class_name . '.php',
56
  'app/main/widgets/' . $class_name . '.php',
76
  */
77
  global $bp_media;
78
  $bp_media = new BuddyPressMedia();
 
79
  //add_action('init','BPMediaBPAlbumImporter');
80
 
81
  //BPMediaBPAlbumImporter::bpmedia_ajax_import_callback();
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 ADDED
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-08 11:14+0530\n"
6
- "PO-Revision-Date: 2013-02-08 11:20+0530\n"
7
  "Last-Translator: Saurabh Shukla <saurabh.shukla@rtcamp.com>\n"
8
  "Language-Team: rtCamp <info@rtcamp.com>\n"
9
  "Language: \n"
@@ -24,147 +24,220 @@ msgstr ""
24
  msgid "Posted "
25
  msgstr ""
26
 
27
- #: app/helper/BPMediaSettings.php:28
28
- msgid "BuddyPress Media Settings"
 
 
 
 
 
 
 
 
 
 
 
 
29
  msgstr ""
30
 
31
- #: app/helper/BPMediaSettings.php:29
32
  msgid "Video"
33
  msgstr ""
34
 
35
- #: app/helper/BPMediaSettings.php:32
36
- msgid "Check to enable video upload functionality"
37
  msgstr ""
38
 
39
- #: app/helper/BPMediaSettings.php:34
40
  msgid "Audio"
41
  msgstr ""
42
 
43
- #: app/helper/BPMediaSettings.php:37
44
- msgid "Check to enable audio upload functionality"
45
  msgstr ""
46
 
47
- #: app/helper/BPMediaSettings.php:39
48
  msgid "Images"
49
  msgstr ""
50
 
51
- #: app/helper/BPMediaSettings.php:42
52
- msgid "Check to enable images upload functionality"
53
  msgstr ""
54
 
55
- #: app/helper/BPMediaSettings.php:44
56
- msgid "Download"
57
  msgstr ""
58
 
59
- #: app/helper/BPMediaSettings.php:47
60
- msgid "Check to enable download functionality"
61
  msgstr ""
62
 
63
- #: app/helper/BPMediaSettings.php:49
64
- msgid "Admin bar menu"
65
  msgstr ""
66
 
67
- #: app/helper/BPMediaSettings.php:52
68
- msgid "Check to enable menu in WordPress admin bar"
69
  msgstr ""
70
 
71
- #: app/helper/BPMediaSettings.php:55
72
- #: app/helper/BPMediaSettings.php:56
73
- msgid "Spread the Word"
74
  msgstr ""
75
 
76
- #: app/helper/BPMediaSettings.php:60
77
- msgid "Yes, I support BuddyPress Media"
78
  msgstr ""
79
 
80
- #: app/helper/BPMediaSettings.php:61
81
- msgid "No, I don't want to support BuddyPress Media"
82
  msgstr ""
83
 
84
- #: app/helper/BPMediaSettings.php:64
85
- msgid "BuddyPress Media Other Options"
86
  msgstr ""
87
 
88
- #: app/helper/BPMediaSettings.php:65
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  msgid "Re-Count Media Entries"
90
  msgstr ""
91
 
92
- #: app/helper/BPMediaSettings.php:67
93
  msgid "Re-Count"
94
  msgstr ""
95
 
96
- #: app/helper/BPMediaSettings.php:68
97
  msgid "It will re-count all media entries of all users and correct any discrepancies."
98
  msgstr ""
99
 
100
- #: app/helper/BPMediaSettings.php:73
101
  msgid "BuddyPress Media Addons for Audio/Video Conversion"
102
  msgstr ""
103
 
104
- #: app/helper/BPMediaSettings.php:74
105
  msgid "Submit a request form"
106
  msgstr ""
107
 
108
- #: app/helper/BPMediaSettings.php:75
109
  msgid "Request Type"
110
  msgstr ""
111
 
112
- #: app/helper/BPMediaSettings.php:76
113
  msgid "Select One"
114
  msgstr ""
115
 
116
- #: app/helper/BPMediaSettings.php:77
117
  msgid "Premium Support"
118
  msgstr ""
119
 
120
- #: app/helper/BPMediaSettings.php:78
121
  msgid "Suggest a New Feature"
122
  msgstr ""
123
 
124
- #: app/helper/BPMediaSettings.php:79
125
  msgid "Submit a Bug Report"
126
  msgstr ""
127
 
128
- #: app/helper/BPMediaSettings.php:112
129
- #: app/helper/BPMediaSettings.php:114
 
 
 
 
 
130
  msgid "Recounting of media files done successfully"
131
  msgstr ""
132
 
133
- #: app/helper/BPMediaSettings.php:114
134
  msgid "Recount Success"
135
  msgstr ""
136
 
137
- #: app/helper/BPMediaSettings.php:117
138
- #: app/helper/BPMediaSettings.php:119
139
  msgid "Recounting Failed"
140
  msgstr ""
141
 
142
- #: app/helper/BPMediaSettings.php:119
143
  msgid "Recount Fail"
144
  msgstr ""
145
 
146
- #: app/helper/BPMediaSettings.php:123
 
 
 
 
 
 
 
 
 
147
  msgid "Settings saved."
148
  msgstr ""
149
 
150
- #: app/helper/BPMediaSettings.php:152
151
  msgid "Please provide \"option\" value ( required ) in the argument. Pass argument to add_settings_field in the following format array( 'option' => 'option_name' ) "
152
  msgstr ""
153
 
154
- #: app/helper/BPMediaSettings.php:197
155
- #: app/helper/BPMediaSettings.php:244
156
- #: app/helper/BPMediaSettings.php:288
157
  msgid "Please provide \"option\" value ( required ) in the argument. Pass argument to add_settings_field in the following format array( 'option' => 'option_name' )"
158
  msgstr ""
159
 
160
- #: app/helper/BPMediaSettings.php:199
161
  msgid "Need to specify atleast to radios else use a checkbox instead"
162
  msgstr ""
163
 
164
- #: app/helper/BPMediaSettings.php:290
165
  msgid "Please provide some values to populate the dropdown. Format : array( 'value' => 'option' )"
166
  msgstr ""
167
 
 
 
 
 
168
  #: app/helper/BPMediaAdminWidget.php:29
169
  msgid "Argument missing. id is required."
170
  msgstr ""
@@ -356,324 +429,369 @@ msgstr ""
356
 
357
  #: app/helper/BPMediaUpgrade.php:114
358
  #: app/helper/BPMediaUpgrade.php:172
359
- #: app/main/group/BPMediaGroupAction.php:116
360
  #, php-format
361
  msgid "%1$s added a %2$s"
362
  msgstr ""
363
 
364
- #: app/admin/BPMediaAdmin.php:62
365
  msgid "BuddyPress Media Component"
366
  msgstr ""
367
 
368
- #: app/admin/BPMediaAdmin.php:62
369
- #: app/admin/BPMediaAdmin.php:163
370
- #: app/admin/BPMediaAdmin.php:164
371
  msgid "BuddyPress Media"
372
  msgstr ""
373
 
374
- #: app/admin/BPMediaAdmin.php:63
375
- #: app/admin/BPMediaAdmin.php:191
376
- #: app/main/BuddyPressMedia.php:232
 
 
 
 
 
377
  msgid "Settings"
378
  msgstr ""
379
 
380
- #: app/admin/BPMediaAdmin.php:64
381
- #: app/admin/BPMediaAdmin.php:197
 
 
 
 
382
  msgid "BuddyPress Media Addons"
383
  msgstr ""
384
 
385
- #: app/admin/BPMediaAdmin.php:64
386
- #: app/admin/BPMediaAdmin.php:198
387
  msgid "Addons"
388
  msgstr ""
389
 
390
- #: app/admin/BPMediaAdmin.php:65
391
- #: app/admin/BPMediaAdmin.php:204
392
  msgid "BuddyPress Media Support"
393
  msgstr ""
394
 
395
- #: app/admin/BPMediaAdmin.php:65
396
  msgid "Support "
397
  msgstr ""
398
 
399
- #: app/admin/BPMediaAdmin.php:113
400
- #: app/main/BuddyPressMedia.php:155
401
- #: app/main/BuddyPressMedia.php:158
 
 
 
 
 
 
 
 
 
 
 
 
402
  msgid "Media"
403
  msgstr ""
404
 
405
- #: app/admin/BPMediaAdmin.php:205
406
- msgid "Support"
407
  msgstr ""
408
 
409
- #: app/admin/BPMediaAdmin.php:292
410
  msgid "Empowering The Web With WordPress"
411
  msgstr ""
412
 
413
- #: app/admin/BPMediaAdmin.php:292
414
- msgid "rtCamp"
 
 
 
 
415
  msgstr ""
416
 
417
- #: app/admin/BPMediaAdmin.php:294
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
418
  msgid "Become a fan on Facebook"
419
  msgstr ""
420
 
421
- #: app/admin/BPMediaAdmin.php:294
422
  msgid "Facebook"
423
  msgstr ""
424
 
425
- #: app/admin/BPMediaAdmin.php:295
426
  msgid "Follow us on Twitter"
427
  msgstr ""
428
 
429
- #: app/admin/BPMediaAdmin.php:295
430
  msgid "Twitter"
431
  msgstr ""
432
 
433
- #: app/admin/BPMediaAdmin.php:296
434
  msgid "Subscribe to our feeds"
435
  msgstr ""
436
 
437
- #: app/admin/BPMediaAdmin.php:296
438
  msgid "RSS Feed"
439
  msgstr ""
440
 
441
- #: app/admin/BPMediaAdmin.php:301
442
- msgid "Read FAQ"
443
- msgstr ""
444
-
445
- #: app/admin/BPMediaAdmin.php:302
446
- msgid "Free Support Forum"
447
- msgstr ""
448
-
449
- #: app/admin/BPMediaAdmin.php:303
450
- msgid "Github Issue Tracker"
451
  msgstr ""
452
 
453
- #: app/admin/BPMediaAdmin.php:304
454
- msgid "Hire Us!"
455
  msgstr ""
456
 
457
- #: app/admin/BPMediaAdmin.php:304
458
- msgid "To get professional customisation/setup service."
459
  msgstr ""
460
 
461
- #: app/admin/BPMediaAdmin.php:306
462
- msgid "Need Help?"
 
 
463
  msgstr ""
464
 
465
- #: app/admin/BPMediaAdmin.php:308
466
- msgid "Help the development keep going."
 
 
467
  msgstr ""
468
 
469
- #: app/admin/BPMediaAdmin.php:309
470
- msgid "Help us release more amazing features faster. Consider making a donation to our consistent efforts."
 
 
471
  msgstr ""
472
 
473
- #: app/admin/BPMediaAdmin.php:310
474
- msgid "Donate"
 
 
475
  msgstr ""
476
 
477
- #: app/admin/BPMediaAdmin.php:313
478
- msgid "BuddyPress Media Kaltura"
479
  msgstr ""
480
 
481
- #: app/admin/BPMediaAdmin.php:313
482
- msgid "BPM-Kaltura"
483
  msgstr ""
484
 
485
- #: app/admin/BPMediaAdmin.php:313
486
- msgid "Add support for Kaltura.com/Kaltura-CE based video conversion support"
487
  msgstr ""
488
 
489
- #: app/admin/BPMediaAdmin.php:314
490
- msgid "BuddyPress Media FFMPEG"
491
  msgstr ""
492
 
493
- #: app/admin/BPMediaAdmin.php:314
494
- msgid "BPM-FFMPEG"
495
  msgstr ""
496
 
497
- #: app/admin/BPMediaAdmin.php:314
498
- msgid "Add FFMEG-based audio/video conversion support"
499
  msgstr ""
500
 
501
- #: app/admin/BPMediaAdmin.php:316
502
- msgid "Are you a developer?"
503
  msgstr ""
504
 
505
- #: app/admin/BPMediaAdmin.php:317
506
- #, php-format
507
- msgid "If you are developing a BuddyPress Media addon we would like to include it in above list. We can also help you sell them. <a href=\"%s\">More info!</a>"
508
  msgstr ""
509
 
510
- #: app/admin/BPMediaAdmin.php:318
511
- msgid "Premium Addons"
512
  msgstr ""
513
 
514
- #: app/admin/BPMediaAdmin.php:321
515
- msgid "Latest News"
516
  msgstr ""
517
 
518
- #: app/main/BuddyPressMedia.php:59
519
  msgid "BuddyPress is not installed."
520
  msgstr ""
521
 
522
- #: app/main/BuddyPressMedia.php:60
523
  #, php-format
524
- msgid "To use BuddyPress Media, <a href=\"%s\" target=\"_blank\">BuddyPress</a> must be installed first."
 
 
 
525
  msgstr ""
526
 
527
- #: app/main/BuddyPressMedia.php:161
528
  msgid "Photos"
529
  msgstr ""
530
 
531
- #: app/main/BuddyPressMedia.php:164
532
  msgid "Photo"
533
  msgstr ""
534
 
535
- #: app/main/BuddyPressMedia.php:167
536
  msgid "Videos"
537
  msgstr ""
538
 
539
- #: app/main/BuddyPressMedia.php:173
540
- #: app/main/BuddyPressMedia.php:176
541
  msgid "Music"
542
  msgstr ""
543
 
544
- #: app/main/BuddyPressMedia.php:179
545
- msgid "Albums"
546
- msgstr ""
547
-
548
- #: app/main/BuddyPressMedia.php:182
549
- msgid "Album"
550
- msgstr ""
551
-
552
- #: app/main/BuddyPressMedia.php:185
553
  msgid "Upload"
554
  msgstr ""
555
 
556
- #: app/main/BuddyPressMedia.php:302
557
  #, php-format
558
- msgid "The BuddyPress version installed is an older version and is not supported, please update BuddyPress to use BuddyPress Media Plugin.<a class=\"alignright\" href=\"%1$s\">X</a>"
 
 
 
 
 
559
  msgstr ""
560
 
561
- #: app/main/BuddyPressMedia.php:307
562
  #, php-format
563
- msgid "You have not installed BuddyPress. Please install latest version of BuddyPress to use BuddyPress Media plugin.<a class=\"alignright\" href=\"%1$s\">X</a>"
 
 
 
 
564
  msgstr ""
565
 
566
  #: app/main/profile/BPMediaTemplate.php:24
567
- #: app/main/profile/BPMediaTemplate.php:217
568
- msgid "Select Album"
569
  msgstr ""
570
 
571
- #: app/main/profile/BPMediaTemplate.php:59
572
- msgid "+ Create New Album"
573
  msgstr ""
574
 
575
- #: app/main/profile/BPMediaTemplate.php:65
576
- #: app/main/profile/BPMediaTemplate.php:253
577
- msgid "Create"
578
  msgstr ""
579
 
580
- #: app/main/profile/BPMediaTemplate.php:66
581
- msgid "Cancel"
582
  msgstr ""
583
 
584
- #: app/main/profile/BPMediaTemplate.php:75
585
- msgid "Drop files here"
586
  msgstr ""
587
 
588
- #: app/main/profile/BPMediaTemplate.php:76
589
- msgid " or "
590
  msgstr ""
591
 
592
- #: app/main/profile/BPMediaTemplate.php:77
593
- msgid "Select Files"
594
  msgstr ""
595
 
596
- #: app/main/profile/BPMediaTemplate.php:184
597
- msgid "Show More"
598
  msgstr ""
599
 
600
- #: app/main/profile/BPMediaTemplate.php:218
601
- #: app/main/profile/BPMediaTemplate.php:246
602
  msgid "x"
603
  msgstr ""
604
 
605
- #: app/main/profile/BPMediaTemplate.php:238
606
  msgid "Select"
607
  msgstr ""
608
 
609
- #: app/main/profile/BPMediaTemplate.php:239
610
- #: app/main/profile/BPMediaTemplate.php:245
611
- msgid "Create Album"
612
- msgstr ""
613
-
614
- #: app/main/profile/BPMediaTemplate.php:249
615
  msgid "Album Name"
616
  msgstr ""
617
 
618
- #: app/main/profile/BPMediaTemplate.php:257
619
  msgid "Add Media"
620
  msgstr ""
621
 
622
  #: app/main/profile/BPMediaScreen.php:112
623
- #: app/main/profile/BPMediaScreen.php:363
624
  msgid "The requested url does not exist"
625
  msgstr ""
626
 
627
  #: app/main/profile/BPMediaScreen.php:123
628
  #, php-format
629
- msgid "%s List Page"
630
  msgstr ""
631
 
632
- #: app/main/profile/BPMediaScreen.php:192
633
- #: app/main/profile/BPMediaAlbumScreen.php:78
634
  #, php-format
635
  msgid "Sorry, no %s were found."
636
  msgstr ""
637
 
638
- #: app/main/profile/BPMediaScreen.php:294
639
  #, php-format
640
  msgid "Edit %s"
641
  msgstr ""
642
 
643
- #: app/main/profile/BPMediaScreen.php:315
644
  #, php-format
645
  msgid "%s Title"
646
  msgstr ""
647
 
648
- #: app/main/profile/BPMediaScreen.php:322
649
  #, php-format
650
  msgid "%s Description"
651
  msgstr ""
652
 
653
- #: app/main/profile/BPMediaScreen.php:331
654
  msgid "Update"
655
  msgstr ""
656
 
657
- #: app/main/profile/BPMediaScreen.php:332
658
  msgid "Back to Media File"
659
  msgstr ""
660
 
661
- #: app/main/profile/BPMediaScreen.php:333
662
  msgid "Back to Media"
663
  msgstr ""
664
 
665
- #: app/main/profile/BPMediaScreen.php:356
666
  msgid "You do not have access to this page."
667
  msgstr ""
668
 
669
- #: app/main/profile/BPMediaScreen.php:384
670
  msgid "Media deleted successfully"
671
  msgstr ""
672
 
673
- #: app/main/profile/BPMediaUploadScreen.php:33
674
- msgid "Upload Media"
675
- msgstr ""
676
-
677
  #: app/main/profile/BPMediaUploadScreen.php:75
678
  msgid "You are not allowed to be here"
679
  msgstr ""
@@ -703,23 +821,19 @@ msgstr ""
703
  msgid "You did not specified a file to upload"
704
  msgstr ""
705
 
706
- #: app/main/profile/BPMediaAlbumScreen.php:118
707
- msgid "Rename Album"
708
- msgstr ""
709
-
710
- #: app/main/profile/BPMediaAlbumScreen.php:118
711
- msgid "Rename"
712
  msgstr ""
713
 
714
- #: app/main/profile/BPMediaAlbumScreen.php:119
715
  msgid "Delete"
716
  msgstr ""
717
 
718
- #: app/main/profile/BPMediaAlbumScreen.php:138
719
  msgid "Sorry, no media items were found in this album."
720
  msgstr ""
721
 
722
- #: app/main/profile/BPMediaAlbum.php:73
723
  msgid "Sorry, the requested album does not exist."
724
  msgstr ""
725
 
@@ -727,10 +841,6 @@ msgstr ""
727
  msgid "Sorry, the requested media does not belong to the group"
728
  msgstr ""
729
 
730
- #: app/main/group/BPMediaGroup.php:211
731
- msgid "Media Settings"
732
- msgstr ""
733
-
734
  #: app/main/group/BPMediaGroupsExtension.php:40
735
  #: app/main/group/BPMediaGroupsExtension.php:87
736
  msgid "Album Creation Control"
@@ -757,6 +867,7 @@ msgid "Group Admin only"
757
  msgstr ""
758
 
759
  #: app/main/group/BPMediaGroupsExtension.php:104
 
760
  msgid "Save Changes"
761
  msgstr ""
762
 
@@ -774,135 +885,192 @@ msgid ""
774
  "\t home screen."
775
  msgstr ""
776
 
777
- #: app/main/widgets/BPMediaWidget.php:11
778
- msgid "The most recent/popular media uploaded on your site"
779
  msgstr ""
780
 
781
- #: app/main/widgets/BPMediaWidget.php:12
782
- msgid "BuddyPress Media Widget"
783
  msgstr ""
784
 
785
- #: app/main/widgets/BPMediaWidget.php:42
786
  #, php-format
787
- msgid "Please configure this widget <a href=\"%s\" target=\"_blank\" title=\"Configure BuddyPress Media Widget\">here</a>."
 
 
 
 
788
  msgstr ""
789
 
790
- #: app/main/widgets/BPMediaWidget.php:48
 
 
 
 
791
  msgid "All"
792
  msgstr ""
793
 
794
- #: app/main/widgets/BPMediaWidget.php:101
795
- #: app/main/widgets/BPMediaWidget.php:141
796
- #: app/main/widgets/BPMediaWidget.php:181
797
- #: app/main/widgets/BPMediaWidget.php:221
 
 
 
 
 
 
798
  msgid "No "
799
  msgstr ""
800
 
801
- #: app/main/widgets/BPMediaWidget.php:266
802
  msgid "Widget Type:"
803
  msgstr ""
804
 
805
- #: app/main/widgets/BPMediaWidget.php:268
806
  msgid "Recent Media"
807
  msgstr ""
808
 
809
- #: app/main/widgets/BPMediaWidget.php:269
810
  msgid "Popular Media"
811
  msgstr ""
812
 
813
- #: app/main/widgets/BPMediaWidget.php:272
814
  msgid "Title:"
815
  msgstr ""
816
 
817
- #: app/main/widgets/BPMediaWidget.php:275
818
  msgid "Number of posts to show:"
819
  msgstr ""
820
 
821
- #: app/main/widgets/BPMediaWidget.php:279
822
  msgid "Show All"
823
  msgstr ""
824
 
825
- #: app/main/widgets/BPMediaWidget.php:282
826
  msgid "Show Photos"
827
  msgstr ""
828
 
829
- #: app/main/widgets/BPMediaWidget.php:285
830
  msgid "Show Music"
831
  msgstr ""
832
 
833
- #: app/main/widgets/BPMediaWidget.php:289
834
  msgid "Show Videos"
835
  msgstr ""
836
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
837
  #: app/main/includes/BPMediaHostWordpress.php:59
838
  msgid "Sorry, the requested media does not exist."
839
  msgstr ""
840
 
841
- #: app/main/includes/BPMediaHostWordpress.php:114
842
  msgid "Error Uploading File"
843
  msgstr ""
844
 
845
- #: app/main/includes/BPMediaHostWordpress.php:142
846
  msgid "MP4 file you have uploaded is corrupt."
847
  msgstr ""
848
 
849
- #: app/main/includes/BPMediaHostWordpress.php:149
850
- #: app/main/includes/BPMediaHostWordpress.php:154
851
  msgid "The MP4 file you have uploaded is using an unsupported video codec. Supported video codec is H.264."
852
  msgstr ""
853
 
854
- #: app/main/includes/BPMediaHostWordpress.php:159
855
  msgid "The MP4 file you have uploaded is not a video file."
856
  msgstr ""
857
 
858
- #: app/main/includes/BPMediaHostWordpress.php:171
859
  msgid "MP3 file you have uploaded is currupt."
860
  msgstr ""
861
 
862
- #: app/main/includes/BPMediaHostWordpress.php:178
863
- #: app/main/includes/BPMediaHostWordpress.php:183
864
  msgid "The MP3 file you have uploaded is using an unsupported audio format. Supported audio format is MP3."
865
  msgstr ""
866
 
867
- #: app/main/includes/BPMediaHostWordpress.php:188
868
  msgid "The MP3 file you have uploaded is not an audio file."
869
  msgstr ""
870
 
871
- #: app/main/includes/BPMediaHostWordpress.php:202
872
  msgid "Media File you have tried to upload is not supported. Supported media files are .jpg, .png, .gif, .mp3, .mov and .mp4."
873
  msgstr ""
874
 
875
- #: app/main/includes/BPMediaHostWordpress.php:209
876
  msgid "Error creating attachment for the media file, please try again"
877
  msgstr ""
878
 
879
- #: app/main/includes/BPMediaHostWordpress.php:299
880
  #, php-format
881
  msgid "%s uploaded a media."
882
  msgstr ""
883
 
884
- #: app/main/includes/BPMediaHostWordpress.php:320
885
  msgid "Uploaded by "
886
  msgstr ""
887
 
888
- #: app/main/includes/BPMediaHostWordpress.php:464
889
  #, php-format
890
  msgid "Comment <span>%s</span>"
891
  msgstr ""
892
 
893
- #: app/main/includes/BPMediaHostWordpress.php:468
894
  msgid "Favorite"
895
  msgstr ""
896
 
897
- #: app/main/includes/BPMediaHostWordpress.php:470
898
  msgid "Remove Favorite"
899
  msgstr ""
900
 
901
- #: app/main/includes/BPMediaHostWordpress.php:489
902
  msgid "Post"
903
  msgstr ""
904
 
905
- #: app/main/includes/BPMediaHostWordpress.php:489
906
  msgid "or press esc to cancel."
907
  msgstr ""
908
 
@@ -918,104 +1086,50 @@ msgstr ""
918
  msgid "Select Media File"
919
  msgstr ""
920
 
921
- #: app/main/includes/BPMediaComponent.php:77
922
- msgid "Search Media..."
923
- msgstr ""
924
-
925
- #: app/main/includes/BPMediaComponent.php:333
926
- msgid "Edit Album"
927
- msgstr ""
928
-
929
- #: app/main/includes/BPMediaComponent.php:334
930
- msgid "New Album"
931
- msgstr ""
932
-
933
- #: app/main/includes/BPMediaComponent.php:335
934
- msgid "All Albums"
935
- msgstr ""
936
-
937
- #: app/main/includes/BPMediaComponent.php:336
938
- msgid "View Album"
939
- msgstr ""
940
-
941
- #: app/main/includes/BPMediaComponent.php:337
942
- msgid "Search Albums"
943
- msgstr ""
944
-
945
- #: app/main/includes/BPMediaComponent.php:338
946
- msgid "No album found"
947
- msgstr ""
948
-
949
- #: app/main/includes/BPMediaComponent.php:339
950
- msgid "No album found in Trash"
951
- msgstr ""
952
-
953
- #: app/main/includes/BPMediaComponent.php:363
954
- msgid "Add New Media"
955
- msgstr ""
956
-
957
- #: app/main/includes/BPMediaComponent.php:370
958
- msgid "BuddyPress Media's Media Files"
959
- msgstr ""
960
-
961
- #: app/main/includes/BPMediaFunction.php:243
962
- #, php-format
963
- msgid "%1$s added new media in album %2$s"
964
- msgstr ""
965
-
966
  #: app/main/includes/BPMediaFilters.php:138
967
  #, php-format
968
  msgid "Delete %s"
969
  msgstr ""
970
 
971
- #: app/main/includes/BPMediaFilters.php:374
972
  msgid "Users"
973
  msgstr ""
974
 
975
- #: app/main/includes/BPMediaFilters.php:376
976
  msgid "Total Photos"
977
  msgstr ""
978
 
979
- #: app/main/includes/BPMediaFilters.php:377
980
  msgid "Total Videos"
981
  msgstr ""
982
 
983
- #: app/main/includes/BPMediaFilters.php:378
984
  msgid "Total Audio"
985
  msgstr ""
986
 
987
- #: app/main/includes/BPMediaFilters.php:379
988
  msgid "Total Albums"
989
  msgstr ""
990
 
991
- #: app/main/includes/BPMediaFilters.php:381
992
- msgid "Groups"
993
- msgstr ""
994
-
995
- #: app/main/includes/BPMediaActions.php:164
996
- #: app/main/includes/BPMediaActions.php:316
997
- msgid "Featured"
998
- msgstr ""
999
-
1000
- #: app/main/includes/BPMediaActions.php:165
1001
- #: app/main/includes/BPMediaActions.php:321
1002
- msgid "Remove Featured"
1003
- msgstr ""
1004
-
1005
  #: app/main/includes/BPMediaActions.php:304
1006
  msgid "Edit Media"
1007
  msgstr ""
1008
 
1009
- #: app/main/includes/BPMediaActions.php:304
1010
- msgid "Edit"
 
 
 
 
 
1011
  msgstr ""
1012
 
1013
- #: app/main/includes/BPMediaActions.php:316
1014
- #: app/main/includes/BPMediaActions.php:321
1015
- msgid "Featured Media"
1016
  msgstr ""
1017
 
1018
- #: app/main/includes/BPMediaActions.php:614
1019
  #, php-format
1020
  msgid "%1$s created an album %2$s"
1021
  msgstr ""
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"
24
  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
+
241
  #: app/helper/BPMediaAdminWidget.php:29
242
  msgid "Argument missing. id is required."
243
  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
+
531
+ #: app/admin/BPMediaAdmin.php:334
532
+ msgid "Spread the Word"
533
+ msgstr ""
534
+
535
+ #: app/admin/BPMediaAdmin.php:344
536
+ 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
 
575
+ #: app/main/BPMediaComponent.php:60
576
+ msgid "Search Media..."
577
  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
 
607
+ #: app/main/BPMediaComponent.php:260
608
+ msgid "New Album"
609
  msgstr ""
610
 
611
+ #: app/main/BPMediaComponent.php:261
612
+ msgid "All Albums"
613
  msgstr ""
614
 
615
+ #: app/main/BPMediaComponent.php:262
616
+ msgid "View Album"
617
  msgstr ""
618
 
619
+ #: app/main/BPMediaComponent.php:263
620
+ msgid "Search Albums"
621
  msgstr ""
622
 
623
+ #: app/main/BPMediaComponent.php:264
624
+ msgid "No album found"
625
  msgstr ""
626
 
627
+ #: app/main/BPMediaComponent.php:265
628
+ msgid "No album found in Trash"
629
  msgstr ""
630
 
631
+ #: app/main/BPMediaComponent.php:299
632
+ msgid "Add New Media"
 
633
  msgstr ""
634
 
635
+ #: app/main/BPMediaComponent.php:307
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"
680
+ "\t\t\t\t\t\t\t\t\t\tolder version and is not supported,\n"
681
+ "\t\t\t\t\t\t\t\t\t\tplease update BuddyPress to use\n"
682
+ "\t\t\t\t\t\t\t\t\t\tBuddyPress Media Plugin.\n"
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"
690
+ "\t\t\t\t\t\t\t\t\tPlease install latest version of BuddyPress\n"
691
+ "\t\t\t\t\t\t\t\t\tto use BuddyPress Media plugin.\n"
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
 
750
  #: app/main/profile/BPMediaScreen.php:123
751
  #, php-format
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
 
 
 
 
 
795
  #: app/main/profile/BPMediaUploadScreen.php:75
796
  msgid "You are not allowed to be here"
797
  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
 
836
+ #: app/main/profile/BPMediaAlbum.php:74
837
  msgid "Sorry, the requested album does not exist."
838
  msgstr ""
839
 
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"
867
  msgstr ""
868
 
869
  #: app/main/group/BPMediaGroupsExtension.php:104
870
+ #: app/main/privacy/BPMediaPrivacyScreen.php:53
871
  msgid "Save Changes"
872
  msgstr ""
873
 
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
902
+ msgid "The most recent/popular media uploaded on your site"
903
  msgstr ""
904
 
905
+ #: app/main/widgets/BPMediaWidget.php:21
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"
917
+ "\t\t\t\t\t\t\t\t\t<a href=\"%s\" target=\"_blank\"\n"
918
+ "\t\t\t\t\t\t\t\t\ttitle=\"Configure BuddyPress Media Widget\">\n"
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
 
962
+ #: app/main/privacy/BPMediaPrivacySettings.php:28
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 ""
996
+
997
+ #: app/main/privacy/BPMediaPrivacyScreen.php:42
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
  msgid "Select Media File"
1087
  msgstr ""
1088
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1089
  #: app/main/includes/BPMediaFilters.php:138
1090
  #, php-format
1091
  msgid "Delete %s"
1092
  msgstr ""
1093
 
1094
+ #: app/main/includes/BPMediaFilters.php:388
1095
  msgid "Users"
1096
  msgstr ""
1097
 
1098
+ #: app/main/includes/BPMediaFilters.php:390
1099
  msgid "Total Photos"
1100
  msgstr ""
1101
 
1102
+ #: app/main/includes/BPMediaFilters.php:391
1103
  msgid "Total Videos"
1104
  msgstr ""
1105
 
1106
+ #: app/main/includes/BPMediaFilters.php:392
1107
  msgid "Total Audio"
1108
  msgstr ""
1109
 
1110
+ #: app/main/includes/BPMediaFilters.php:393
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 ""
phpunit.xml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <phpunit
3
+ backupGlobals="false"
4
+ backupStaticAttributes="false"
5
+ colors="true"
6
+ convertErrorsToExceptions="true"
7
+ convertNoticesToExceptions="true"
8
+ convertWarningsToExceptions="true"
9
+ processIsolation="false"
10
+ stopOnFailure="false"
11
+ syntaxCheck="false"
12
+ bootstrap="tests/bootstrap.php"
13
+ >
14
+ <testsuites>
15
+ <testsuite name="BuddyPress Media">
16
+ <directory>./tests/</directory>
17
+ </testsuite>
18
+ </testsuites>
19
+ </phpunit>
readme.txt CHANGED
@@ -6,75 +6,92 @@ License: GPLv2 or later
6
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
7
  Requires at least: 3.5
8
  Tested up to: 3.5
9
- Stable tag: 2.5.5
10
 
11
- Adds Photos, Music, Videos & Albums to your BuddyPress. Supports mobile devices (iPhone/iPad, etc) and automatic audio/video conversion.
12
 
13
  == Description ==
14
 
15
- BuddyPress Media adds Photos, Music, Videos & Albums to your BuddyPress. Supports mobile devices (iPhone/iPad, etc) and automatic audio/video conversion.
16
 
17
- = Important =
 
 
 
18
 
19
- BuddyPress Media is now available in **Brazilian Portuguese**, **Spanish** and **Japanese**. Translations for German, Italian, French and Dutch are in progress. BuddyPress Media includes [full translation support](https://rtcamp.com/tutorials/buddypress-media-translation/). Head over to the [translation project](http://rtcamp.com/translate/projects/buddypress-media/) to contribute your translations. If you don't see the language of your choice, let us know in the support forum, we'll add it.
20
-
21
- = iOS6 Uploads =
22
-
23
- There's a bug in iOS 6, due to which multiple image uploads won't work. It provides all images as image.jpeg which the WordPress uploader (plupload) doesn't like. It assumes that it's got duplicate images and will upload just one.
24
 
25
  = Features =
26
 
27
- * Images, Music, Videos Upload
28
- * User-Albums Support
29
- * Group Media Support
30
- * Multiple files upload with Drag-n-Drop
31
- * Uploading Photos/Videos via mobile (Tested on iPhone running iOS6)
32
- * HTML5 player (with fall back to flash/silverlight player support)
33
- * Automatic conversion of common audio & video formats to mp3/mp4. via [Kaltura Add-On](http://rtcamp.com/store/buddypress-media-kaltura/ "BuddyPress Media Kaltura Addon for Kaltura.com/Kaltura-CE/Kaltura On-Prem version") and [FFMPEG Add-On](http://rtcamp.com/store/buddypress-media-ffmpeg-converter/ "BuddyPress Media FFMPEG Addon")
34
 
35
- = Translations =
36
- * [Brazilian Portuguese](https://rtcamp.com/translate/projects/buddypress-media/pt-br/default) translation by [Jose Fabiosan](http://profiles.wordpress.org/josefabiosan/) and [doutorsocrates](http://profiles.wordpress.org/doutorsocrates/)
37
- * [Spanish](https://rtcamp.com/translate/projects/buddypress-media/es/default) translation by [Andrés Felipe](http://profiles.wordpress.org/naturalworldstm/)
38
- * [Japanese](https://rtcamp.com/translate/projects/buddypress-media/ja/default) translation by [Tetsu Yamaoka](http://twitter.com/ytetsu)
 
 
 
 
 
39
 
40
  = Roadmap =
41
 
42
- * Activity-update form media upload
43
- * Privacy Settings
44
- * Importers for other media plugins
45
- * Paid membership plans, i.e. "Upload Quota" for buddypress members (in planning stage).
46
 
47
- = Demo =
48
- * [BuddyPress-Media Demo](http://demo.rtcamp.com/buddypress-media) (Stand-alone)
49
- * [BuddyPress-Media + Kaltura Add-on](http://demo.rtcamp.com/bpm-kaltura)
50
- * [BuddyPress-Media + FFMPEG Add-on](http://demo.rtcamp.com/bpm-ffmpeg)
 
 
51
 
52
- == Installation ==
53
 
54
- = BuddyPress Media Plugin =
55
 
56
- * Install the plugin from the 'Plugins' section in your dashboard (Go to `Plugins > Add New > Search` and search for BuddyPress Media).
57
- * Alternatively, you can [download](http://downloads.wordpress.org/plugin/buddypress-media.zip "Download BuddyPress Media") the plugin from the repository. Unzip it and upload it to the plugins folder of your WordPress installation (`wp-content/plugins/` directory of your WordPress installation).
58
- * Activate it through the 'Plugins' section.
59
 
60
- = BuddyPress Media Add-ons =
61
 
62
- [**BuddyPress-Media Kaltura addon**](http://rtcamp.com/store/buddypress-media-kaltura/ "BuddyPress Media Kaltura Addon for Kaltura.com/Kaltura-CE/Kaltura On-Prem version")
63
 
64
- * It also supports many video formats including *.avi, *.mkv, *.asf, *.flv, *.wmv, *.rm, *.mpg.
65
- * You can use Kaltura.com/Kaltura On-Prem or self-hosted Kaltura-CE server with this.
66
 
67
- You can purchase it from [here](http://rtcamp.com/store/buddypress-media-kaltura/ "BuddyPress Media Kaltura Addon for Kaltura.com/Kaltura-CE/Kaltura On-Prem version")
68
 
69
- --
70
 
71
- [**BuddyPress-Media FFMPEG addon**](http://rtcamp.com/store/buddypress-media-ffmpeg-converter/ "BuddyPress Media FFMPEG Addon").
 
72
 
73
- * It also supports many video formats including *.avi, *.mkv, *.asf, *.flv, *.wmv, *.rm, *.mpg.
74
- * It also supports many audio formats including *.mp3, *.ogg, *.wav, *.aac, *.m4a, *.wma.
75
 
76
- You can purchase it from [here](http://rtcamp.com/store/buddypress-media-ffmpeg-converter/ "BuddyPress Media FFMPEG Addon").
77
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
 
79
  == Frequently Asked Questions ==
80
 
@@ -82,12 +99,36 @@ Please visit [BuddyPress Media's FAQ page](http://rtcamp.com/buddypress-media/fa
82
 
83
  == Screenshots ==
84
 
85
- Please visit [BuddyPress Media's Features page](http://rtcamp.com/buddypress-media/features/ "Visit BuddyPress Media's Features page").
 
 
 
 
 
 
 
 
 
 
 
 
86
 
87
  == Changelog ==
88
 
89
  Please visit [BuddyPress Media's Roadmap page](http://rtcamp.com/buddypress-media/roadmap/ "Visit BuddyPress Media's Features page") to get some details about future releases.
90
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  = 2.5.5 =
92
  * Fixes thumbnail appearance and height issues with some themes.
93
  * Other minor UI changes
@@ -234,5 +275,5 @@ Please visit [BuddyPress Media's Roadmap page](http://rtcamp.com/buddypress-medi
234
  * HTML5 Video Tag Support (with fallback)
235
 
236
  == Upgrade Notice ==
237
- =2.5.5=
238
- Fixes css breaks on some themes.
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
10
 
11
+ Adds Photos, Music, Videos & Albums to BuddyPress. Supports mobile devices (iPhone/iPad, etc) and automatic audio/video conversion.
12
 
13
  == Description ==
14
 
15
+ BuddyPress Media adds Photos, Music, Videos & Albums to your BuddyPress powered social network. Supports mobile devices (Android/iPhone/iPad, etc) and automatic audio/video conversion.
16
 
17
+ = Demo & Code =
18
+ * [BuddyPress Media **Demo**](http://demo.rtcamp.com/buddypress-media/) (Stand-alone)
19
+ * [BuddyPress Media Kaltura Add-on](http://demo.rtcamp.com/bpm-kaltura)
20
+ * [BuddyPress Media FFMPEG Add-on](http://demo.rtcamp.com/bpm-media)
21
 
22
+ * [Fork BuddyPress Media on **GitHub**](http://github.com/rtCamp/buddypress-media/)
 
 
 
 
23
 
24
  = Features =
25
 
26
+ [BuddyPress Media's Features page](http://rtcamp.com/buddypress-media/#features "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/ "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/ "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
46
+ * **Flagging** and **report abuse**: To auto moderate spam/inappropriate media
47
+ * **Enhanced media management**: including sorting, moving media between albums, etc
48
 
49
+ = Addons (Premium) =
50
 
51
+ [**BuddyPress-Media Kaltura addon**](http://rtcamp.com/store/buddypress-media-kaltura/ "BuddyPress Media Kaltura Addon for Kaltura.com/Kaltura-CE/Kaltura On-Prem version")
52
 
53
+ * Adds support for additional video formats including *.avi, *.mkv, *.asf, *.flv, *.wmv, *.rm, *.mpg.
54
+ * You can use Kaltura.com/Kaltura On-Prem or self-hosted Kaltura-CE server with this.
 
55
 
56
+ Available [here](http://rtcamp.com/store/buddypress-media-kaltura/ "BuddyPress Media Kaltura Addon for Kaltura.com/Kaltura-CE/Kaltura On-Prem version")
57
 
58
+ [**BuddyPress-Media FFMPEG addon**](http://rtcamp.com/store/buddypress-media-ffmpeg-converter/ "BuddyPress Media FFMPEG Addon").
59
 
60
+ * Adds support for additional video formats including *.avi, *.mkv, *.asf, *.flv, *.wmv, *.rm, *.mpg.
61
+ * Adds support for additional audio formats including *.mp3, *.ogg, *.wav, *.aac, *.m4a, *.wma.
62
 
63
+ Available [here](http://rtcamp.com/store/buddypress-media-ffmpeg-converter/ "BuddyPress Media FFMPEG Addon").
64
 
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 =
 
71
 
72
+ **Important:** Please provide a **URL** of the site/web page when requesting support.
73
 
74
+ * If you find something wrong on your site and feel it is due to BuddyPress Media:
75
+ * [**rtCamp** Support Forum](http://rtcamp.com/support/forum/buddypress-media/)
76
+
77
+ * If you are a developer and/or tester or would like to request a new feature:
78
+ * [**GitHub** development issue log](http://github.com/rtCamp/buddypress-media/issues)
79
+
80
+ = Translation =
81
+
82
+ BuddyPress Media is now available in *Brazilian Portuguese*, *Spanish*, *Japanese*, *Polish* and *Serbian*. Translations for German, Italian, French and Dutch are in progress. BuddyPress Media includes [full translation support](https://rtcamp.com/tutorials/buddypress-media-translation/). Head over to the [translation project](http://rtcamp.com/translate/projects/buddypress-media/) to contribute your translations. If you don't see the language of your choice, let us know in the support forum, we'll add it.
83
+
84
+ * [Brazilian Portuguese](https://rtcamp.com/translate/projects/buddypress-media/pt-br/default) translation by [Jose Fabiosan](http://profiles.wordpress.org/josefabiosan/) and [doutorsocrates](http://profiles.wordpress.org/doutorsocrates/)
85
+ * [Spanish](https://rtcamp.com/translate/projects/buddypress-media/es/default) translation by [Andrés Felipe](http://profiles.wordpress.org/naturalworldstm/)
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
+
92
+ * Install the plugin from the 'Plugins' section in your dashboard (Go to `Plugins > Add New > Search` and search for BuddyPress Media).
93
+ * Alternatively, you can [download](http://downloads.wordpress.org/plugin/buddypress-media.zip "Download BuddyPress Media") the plugin from the repository. Unzip it and upload it to the plugins folder of your WordPress installation (`wp-content/plugins/` directory of your WordPress installation).
94
+ * Activate it through the 'Plugins' section.
95
 
96
  == Frequently Asked Questions ==
97
 
99
 
100
  == Screenshots ==
101
 
102
+ Please visit [BuddyPress Media's Features page](http://rtcamp.com/buddypress-media/#features "Visit BuddyPress Media's Features page").
103
+
104
+ 1. Media Settings
105
+ 2. Privacy Settings
106
+ 3. Builtin Support
107
+ 4. Media View
108
+ 5. Album View
109
+ 6. Uploader
110
+ 7. User Privacy Settings
111
+ 8. Single Media View
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/ "Visit BuddyPress Media's Features page") to get some details about future releases.
119
 
120
+ = 2.6 =
121
+ * Added Privacy for Media.
122
+ * Added crude support for activity privacy (due for revision)
123
+ * Revised media count functionality
124
+ * Fixed widget to recognise enabled/disabled media types
125
+ * Renamed 'Featured' to 'Set as Album Cover' in the UI for clarity
126
+ * Fixed featured functionality
127
+ * Fixed download functionality
128
+ * Rewritten query functions
129
+ * Improved css and js
130
+ * Major code refactoring
131
+
132
  = 2.5.5 =
133
  * Fixes thumbnail appearance and height issues with some themes.
134
  * Other minor UI changes
275
  * HTML5 Video Tag Support (with fallback)
276
 
277
  == Upgrade Notice ==
278
+ =2.6=
279
+ Adds privacy support and a couple of other fixes
tests/MyPluginTest.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MyPlugin Tests
4
+ */
5
+ class BuddyPressMediaTest extends WP_UnitTestCase {
6
+ public $plugin_slug = 'buddypress-media';
7
+
8
+ public function setUp() {
9
+ parent::setUp();
10
+ $this->my_plugin = 'buddypress-media';
11
+ }
12
+
13
+ public function testTrueStillEqualsTrue() {
14
+ $this->assertTrue(true);
15
+ }
16
+ }
tests/bootstrap.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Load the test environment
3
+ // https://github.com/nb/wordpress-tests
4
+
5
+ $path = '/usr/share/nginx/www/wordpress-tests/bootstrap.php';
6
+
7
+ if (file_exists($path)) {
8
+ $GLOBALS['wp_tests_options'] = array(
9
+ 'active_plugins' => array('/usr/share/nginx/www/WordPress-Skeleton/content/plugins/buddypress-media/loader.php')
10
+ );
11
+ require_once $path;
12
+ } else {
13
+ exit("Couldn't find wordpress-tests/bootstrap.php\n");
14
+ }