rtMedia for WordPress, BuddyPress and bbPress - Version 2.4

Version Description

  • Total code overhaul. Fixed a lot of bugs and optimised a lot of other code.
  • Added proper translation support!
  • Removed extra jQuery UI scripts and styles, for speed and optimisation
Download this release

Release Info

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

Code changes from version 2.3.2 to 2.4

Files changed (167) hide show
  1. app/admin/BPMediaAdmin.php +292 -0
  2. includes/css/bp-media-style.css → app/assets/css/main.css +60 -26
  3. app/assets/img/Popup-title-bg.png +0 -0
  4. {includes → app/assets}/img/audio_thumb.png +0 -0
  5. {includes → app/assets}/img/bp_media_social.png +0 -0
  6. {includes → app/assets}/img/bpm-icon-16.png +0 -0
  7. {includes → app/assets}/img/bpm-icon-32.png +0 -0
  8. app/assets/img/coming-soon.png +0 -0
  9. {includes → app/assets}/img/donate.gif +0 -0
  10. {includes → app/assets}/img/donate.png +0 -0
  11. {includes → app/assets}/img/image_thumb.png +0 -0
  12. app/assets/img/loader.gif +0 -0
  13. {includes → app/assets}/img/logo_medibp_32.png +0 -0
  14. {includes → app/assets}/img/rtCamp-bullet.png +0 -0
  15. {includes → app/assets}/img/rtcamp-logo.png +0 -0
  16. {includes → app/assets}/img/video_thumb.png +0 -0
  17. app/assets/js/admin.js +70 -0
  18. app/assets/js/bp-media-uploader.js +128 -0
  19. app/assets/js/main.js +102 -0
  20. app/helper/BPMediaAddon.php +93 -0
  21. app/helper/BPMediaBranding.php +20 -0
  22. app/helper/BPMediaFeed.php +56 -0
  23. app/helper/BPMediaLog.php +19 -0
  24. app/helper/BPMediaSettings.php +200 -0
  25. app/helper/BPMediaSupport.php +186 -0
  26. app/helper/BPMediaUpgrade.php +174 -0
  27. app/helper/BPMediaWidget.php +29 -0
  28. app/main/BPMediaLoader.php +72 -0
  29. app/main/BuddyPressMedia.php +296 -0
  30. app/main/group/BPMediaGroup.php +211 -0
  31. app/main/group/BPMediaGroupAction.php +128 -0
  32. app/main/group/BPMediaGroupElementExtension.php +124 -0
  33. app/main/group/BPMediaGroupsExtension.php +136 -0
  34. app/main/group/dummy/BPMediaGroupAlbum.php +17 -0
  35. app/main/group/dummy/BPMediaGroupImage.php +17 -0
  36. app/main/group/dummy/BPMediaGroupMusic.php +17 -0
  37. app/main/group/dummy/BPMediaGroupVideo.php +17 -0
  38. app/main/includes/BPMediaActions.php +582 -0
  39. app/main/includes/BPMediaComponent.php +366 -0
  40. app/main/includes/BPMediaFilters.php +377 -0
  41. app/main/includes/BPMediaFunction.php +236 -0
  42. includes/bp-media-class-wordpress.php → app/main/includes/BPMediaHostWordpress.php +60 -55
  43. app/main/includes/BPMediaTemplateFunctions.php +283 -0
  44. app/main/includes/BPMediaUpgradeScript.php +125 -0
  45. app/main/includes/BPMediaUtils.php +806 -0
  46. includes/lib/bootstrap.php → app/main/includes/bp-media-upload-handler.php +13 -12
  47. includes/bp-media-class-album.php → app/main/profile/BPMediaAlbum.php +19 -18
  48. app/main/profile/BPMediaAlbumScreen.php +147 -0
  49. app/main/profile/BPMediaScreen.php +411 -0
  50. app/main/profile/BPMediaTemplate.php +214 -0
  51. app/main/profile/BPMediaUploadScreen.php +140 -0
  52. app/main/widgets/BPMediaPopularMedia.php +93 -0
  53. app/main/widgets/BPMediaRecentMedia.php +202 -0
  54. config/index.php +6 -0
  55. includes/bp-media-actions.php +0 -589
  56. includes/bp-media-admin.php +0 -530
  57. includes/bp-media-filters.php +0 -369
  58. includes/bp-media-functions.php +0 -265
  59. includes/bp-media-groups-actions.php +0 -118
  60. includes/bp-media-groups-loader.php +0 -333
  61. includes/bp-media-groups-screens.php +0 -172
  62. includes/bp-media-loader.php +0 -537
  63. includes/bp-media-screens.php +0 -627
  64. includes/bp-media-shortcodes.php +0 -53
  65. includes/bp-media-template-functions.php +0 -282
  66. includes/bp-media-upgrade-script.php +0 -120
  67. includes/bp-media-upload-handler.php +0 -12
  68. includes/bp-media-widgets.php +0 -293
  69. includes/css/bp-media-admin.css +0 -39
  70. includes/css/bp-media-uploader.css +0 -98
  71. includes/js/bp-media-uploader.js +0 -113
  72. includes/js/bp-media.js +0 -109
  73. index.php +69 -0
  74. lang/buddypress-media.po +872 -0
  75. {includes/lib → lib}/getid3/extension.cache.dbm.php +0 -0
  76. {includes/lib → lib}/getid3/extension.cache.mysql.php +0 -0
  77. {includes/lib → lib}/getid3/getid3.lib.php +0 -0
  78. {includes/lib → lib}/getid3/getid3.php +0 -0
  79. {includes/lib → lib}/getid3/module.archive.gzip.php +0 -0
  80. {includes/lib → lib}/getid3/module.archive.rar.php +0 -0
  81. {includes/lib → lib}/getid3/module.archive.szip.php +0 -0
  82. {includes/lib → lib}/getid3/module.archive.tar.php +0 -0
  83. {includes/lib → lib}/getid3/module.archive.zip.php +0 -0
  84. {includes/lib → lib}/getid3/module.audio-video.asf.php +0 -0
  85. {includes/lib → lib}/getid3/module.audio-video.bink.php +0 -0
  86. {includes/lib → lib}/getid3/module.audio-video.flv.php +0 -0
  87. {includes/lib → lib}/getid3/module.audio-video.matroska.php +0 -0
  88. {includes/lib → lib}/getid3/module.audio-video.mpeg.php +0 -0
  89. {includes/lib → lib}/getid3/module.audio-video.nsv.php +0 -0
  90. {includes/lib → lib}/getid3/module.audio-video.quicktime.php +0 -0
  91. {includes/lib → lib}/getid3/module.audio-video.real.php +0 -0
  92. {includes/lib → lib}/getid3/module.audio-video.riff.php +0 -0
  93. {includes/lib → lib}/getid3/module.audio-video.swf.php +0 -0
  94. {includes/lib → lib}/getid3/module.audio.aa.php +0 -0
  95. {includes/lib → lib}/getid3/module.audio.aac.php +0 -0
  96. {includes/lib → lib}/getid3/module.audio.ac3.php +0 -0
  97. {includes/lib → lib}/getid3/module.audio.au.php +0 -0
  98. {includes/lib → lib}/getid3/module.audio.avr.php +0 -0
  99. {includes/lib → lib}/getid3/module.audio.bonk.php +0 -0
  100. {includes/lib → lib}/getid3/module.audio.dss.php +0 -0
  101. {includes/lib → lib}/getid3/module.audio.dts.php +0 -0
  102. {includes/lib → lib}/getid3/module.audio.flac.php +0 -0
  103. {includes/lib → lib}/getid3/module.audio.la.php +0 -0
  104. {includes/lib → lib}/getid3/module.audio.lpac.php +0 -0
  105. {includes/lib → lib}/getid3/module.audio.midi.php +0 -0
  106. {includes/lib → lib}/getid3/module.audio.mod.php +0 -0
  107. {includes/lib → lib}/getid3/module.audio.monkey.php +0 -0
  108. {includes/lib → lib}/getid3/module.audio.mp3.php +0 -0
  109. {includes/lib → lib}/getid3/module.audio.mpc.php +0 -0
  110. {includes/lib → lib}/getid3/module.audio.ogg.php +0 -0
  111. {includes/lib → lib}/getid3/module.audio.optimfrog.php +0 -0
  112. {includes/lib → lib}/getid3/module.audio.rkau.php +0 -0
  113. {includes/lib → lib}/getid3/module.audio.shorten.php +0 -0
  114. {includes/lib → lib}/getid3/module.audio.tta.php +0 -0
  115. {includes/lib → lib}/getid3/module.audio.voc.php +0 -0
  116. {includes/lib → lib}/getid3/module.audio.vqf.php +0 -0
  117. {includes/lib → lib}/getid3/module.audio.wavpack.php +0 -0
  118. {includes/lib → lib}/getid3/module.graphic.bmp.php +0 -0
  119. {includes/lib → lib}/getid3/module.graphic.efax.php +0 -0
  120. {includes/lib → lib}/getid3/module.graphic.gif.php +0 -0
  121. {includes/lib → lib}/getid3/module.graphic.jpg.php +0 -0
  122. {includes/lib → lib}/getid3/module.graphic.pcd.php +0 -0
  123. {includes/lib → lib}/getid3/module.graphic.png.php +0 -0
  124. {includes/lib → lib}/getid3/module.graphic.svg.php +0 -0
  125. {includes/lib → lib}/getid3/module.graphic.tiff.php +0 -0
  126. {includes/lib → lib}/getid3/module.misc.cue.php +0 -0
  127. {includes/lib → lib}/getid3/module.misc.exe.php +0 -0
  128. {includes/lib → lib}/getid3/module.misc.iso.php +0 -0
  129. {includes/lib → lib}/getid3/module.misc.msoffice.php +0 -0
  130. {includes/lib → lib}/getid3/module.misc.par2.php +0 -0
  131. {includes/lib → lib}/getid3/module.misc.pdf.php +0 -0
  132. {includes/lib → lib}/getid3/module.tag.apetag.php +0 -0
  133. {includes/lib → lib}/getid3/module.tag.id3v1.php +0 -0
  134. {includes/lib → lib}/getid3/module.tag.id3v2.php +0 -0
  135. {includes/lib → lib}/getid3/module.tag.lyrics3.php +0 -0
  136. {includes/lib → lib}/getid3/module.tag.xmp.php +0 -0
  137. {includes/lib → lib}/getid3/write.apetag.php +0 -0
  138. {includes/lib → lib}/getid3/write.id3v1.php +0 -0
  139. {includes/lib → lib}/getid3/write.id3v2.php +0 -0
  140. {includes/lib → lib}/getid3/write.lyrics3.php +0 -0
  141. {includes/lib → lib}/getid3/write.metaflac.php +0 -0
  142. {includes/lib → lib}/getid3/write.php +0 -0
  143. {includes/lib → lib}/getid3/write.real.php +0 -0
  144. {includes/lib → lib}/getid3/write.vorbiscomment.php +0 -0
  145. lib/index.php +8 -0
  146. {includes → lib}/media-element/background.png +0 -0
  147. {includes → lib}/media-element/bigplay.png +0 -0
  148. {includes → lib}/media-element/controls-ted.png +0 -0
  149. {includes → lib}/media-element/controls-wmp-bg.png +0 -0
  150. {includes → lib}/media-element/controls-wmp.png +0 -0
  151. {includes → lib}/media-element/controls.png +0 -0
  152. {includes → lib}/media-element/flashmediaelement.swf +0 -0
  153. {includes → lib}/media-element/jquery.js +0 -0
  154. {includes → lib}/media-element/loading.gif +0 -0
  155. {includes → lib}/media-element/mediaelement-and-player.js +0 -0
  156. {includes → lib}/media-element/mediaelement-and-player.min.js +0 -0
  157. {includes → lib}/media-element/mediaelement.js +0 -0
  158. {includes → lib}/media-element/mediaelement.min.js +0 -0
  159. {includes → lib}/media-element/mediaelementplayer.css +0 -0
  160. {includes → lib}/media-element/mediaelementplayer.js +0 -0
  161. {includes → lib}/media-element/mediaelementplayer.min.css +0 -0
  162. {includes → lib}/media-element/mediaelementplayer.min.js +0 -0
  163. {includes → lib}/media-element/mejs-skins.css +0 -0
  164. {includes → lib}/media-element/silverlightmediaelement.xap +0 -0
  165. loader.php +0 -155
  166. log/index.php +9 -0
  167. readme.txt +10 -5
app/admin/BPMediaAdmin.php ADDED
@@ -0,0 +1,292 @@
1
+ <?php
2
+ /**
3
+ * Description of BPMediaAdmin
4
+ *
5
+ * @author Gagandeep Singh <gagandeep.singh@rtcamp.com>
6
+ * @author Joshua Abenazer <joshua.abenazer@rtcamp.com>
7
+ */
8
+ if (!class_exists('BPMediaAdmin')) {
9
+
10
+ class BPMediaAdmin {
11
+
12
+ public $bp_media_upgrade;
13
+ public $bp_media_settings;
14
+ public $bp_media_feed;
15
+
16
+ public function __construct() {
17
+ $bp_media_feed = new BPMediaFeed();
18
+ add_action('wp_ajax_bp_media_fetch_feed', array($bp_media_feed, 'fetch_feed'), 1);
19
+ $bp_media_support = new BPMediaSupport();
20
+ add_action('wp_ajax_bp_media_select_request', array($bp_media_support, 'get_form'), 1);
21
+ add_action('wp_ajax_cancel_request', create_function('', 'do_settings_sections("bp-media-support"); die();'), 1);
22
+ add_action('wp_ajax_bp_media_submit_request', array($bp_media_support, 'submit_request'), 1);
23
+ add_action('wp_ajax_bp_media_fetch_feed', array($bp_media_feed, 'fetch_feed'), 1);
24
+ if (is_admin()) {
25
+ add_action('admin_enqueue_scripts', array($this, 'ui'));
26
+ add_action(bp_core_admin_hook(), array($this, 'menu'));
27
+ if (current_user_can('manage_options'))
28
+ add_action('bp_admin_tabs', array($this, 'tab'));
29
+ if (is_multisite())
30
+ add_action('network_admin_edit_bp_media_options', array($this, 'save_multisite_options'));
31
+ }
32
+ $this->bp_media_upgrade = new BPMediaUpgrade();
33
+ $this->bp_media_settings = new BPMediaSettings();
34
+ }
35
+
36
+ /**
37
+ * Generates the Admin UI
38
+ *
39
+ * @param string $hook
40
+ */
41
+ public function ui($hook) {
42
+ $admin_ajax = admin_url('admin-ajax.php');
43
+ wp_enqueue_script('bp-media-admin', BP_MEDIA_URL . 'app/assets/js/admin.js');
44
+ wp_localize_script('bp-media-admin', 'bp_media_admin_ajax', $admin_ajax);
45
+ wp_enqueue_style('bp-media-admin', BP_MEDIA_URL . 'app/assets/css/main.css');
46
+ }
47
+
48
+ /**
49
+ * Admin Menu
50
+ *
51
+ * @global string BP_MEDIA_TXT_DOMAIN
52
+ */
53
+ public function menu() {
54
+ 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'));
55
+ 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'));
56
+ 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'));
57
+ 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'));
58
+ }
59
+
60
+ /**
61
+ * Render the BuddyPress Media Settings page
62
+ */
63
+ public function settings_page() {
64
+ $this->render_page('bp-media-settings', true);
65
+ }
66
+
67
+ /**
68
+ * Render the BuddyPress Media Addons page
69
+ */
70
+ public function addons_page() {
71
+ $this->render_page('bp-media-addons');
72
+ }
73
+
74
+ /**
75
+ * Render the BuddyPress Media Support page
76
+ */
77
+ public function support_page() {
78
+ $this->render_page('bp-media-support');
79
+ }
80
+
81
+ static function get_current_tab() {
82
+ return isset($_GET['page']) ? $_GET['page'] : "bp-media-settings";
83
+ }
84
+
85
+ /**
86
+ * Render BPMedia Settings
87
+ *
88
+ * @global string BP_MEDIA_TXT_DOMAIN
89
+ */
90
+ public function render_page($page, $is_settings = false) {
91
+ ?>
92
+
93
+ <div class="wrap bp-media-admin <?php echo $this->get_current_tab(); ?>">
94
+ <div id="icon-buddypress" class="icon32"><br></div>
95
+ <h2 class="nav-tab-wrapper"><?php bp_core_admin_tabs(__('Media', BP_MEDIA_TXT_DOMAIN)); ?></h2>
96
+ <?php settings_errors(); ?>
97
+ <div class="columns-2">
98
+ <h3 class="bp-media-settings-tabs"><?php
99
+ $this->sub_tabs();
100
+ ?>
101
+ </h3>
102
+
103
+ <div id="bp-media-settings-boxes">
104
+ <?php
105
+ $settings_url = ( is_multisite() ) ? network_admin_url('network/edit.php?action=bp_media_options') : 'options.php';
106
+ ?>
107
+ <form id="bp_media_settings_form" name="bp_media_settings_form" action="<?php echo $settings_url; ?>" method="post" enctype="multipart/form-data">
108
+ <div class="bp-media-metabox-holder"><?php
109
+ // if (isset($_REQUEST['request_type'])) {
110
+ // bp_media_bug_report_form($_REQUEST['request_type']);
111
+ // } else {
112
+ if ($is_settings) {
113
+ settings_fields('bp_media');
114
+ do_settings_sections($page);
115
+ submit_button();
116
+ } else {
117
+ do_settings_sections($page);
118
+ }
119
+ ?>
120
+ </div>
121
+
122
+ </form>
123
+ </div><!-- .bp-media-settings-boxes -->
124
+ <div class="metabox-fixed metabox-holder alignright bp-media-metabox-holder">
125
+ <?php $this->admin_sidebar(); ?>
126
+ </div>
127
+ </div><!-- .metabox-holder -->
128
+ </div><!-- .bp-media-admin --><?php
129
+ }
130
+
131
+ /**
132
+ * Adds a tab for Media settings in the BuddyPress settings page
133
+ *
134
+ * @global type $bp_media
135
+ */
136
+ public function tab() {
137
+
138
+ $tabs_html = '';
139
+ $idle_class = 'nav-tab';
140
+ $active_class = 'nav-tab nav-tab-active';
141
+ $tabs = array();
142
+
143
+ // Check to see which tab we are on
144
+ $tab = $this->get_current_tab();
145
+ /* BuddyPress Media */
146
+ $tabs[] = array(
147
+ 'href' => bp_get_admin_url(add_query_arg(array('page' => 'bp-media-settings'), 'admin.php')),
148
+ 'title' => __('Buddypress Media', BP_MEDIA_TXT_DOMAIN),
149
+ 'name' => __('Buddypress Media', BP_MEDIA_TXT_DOMAIN),
150
+ 'class' => ($tab == 'bp-media-settings' || $tab == 'bp-media-addons' || $tab == 'bp-media-support') ? $active_class : $idle_class
151
+ );
152
+
153
+ foreach ($tabs as $tab) {
154
+ $tabs_html.= '<a id="bp-media" title= "' . $tab['title'] . '" href="' . $tab['href'] . '" class="' . $tab['class'] . '">' . $tab['name'] . '</a>';
155
+ }
156
+ echo $tabs_html;
157
+ }
158
+
159
+ /**
160
+ * Adds a sub tabs to the BuddyPress Media settings page
161
+ *
162
+ * @global type $bp_media
163
+ */
164
+ public function sub_tabs() {
165
+ $tabs_html = '';
166
+ $idle_class = 'nav-tab';
167
+ $active_class = 'nav-tab nav-tab-active';
168
+ $tabs = array();
169
+
170
+ // Check to see which tab we are on
171
+ $tab = $this->get_current_tab();
172
+ /* BuddyPress Media */
173
+ $tabs[] = array(
174
+ 'href' => bp_get_admin_url(add_query_arg(array('page' => 'bp-media-settings'), 'admin.php')),
175
+ 'title' => __('Buddypress Media Settings', BP_MEDIA_TXT_DOMAIN),
176
+ 'name' => __('Settings', BP_MEDIA_TXT_DOMAIN),
177
+ 'class' => ($tab == 'bp-media-settings') ? $active_class : $idle_class . ' first_tab'
178
+ );
179
+
180
+ $tabs[] = array(
181
+ 'href' => bp_get_admin_url(add_query_arg(array('page' => 'bp-media-addons'), 'admin.php')),
182
+ 'title' => __('Buddypress Media Addons', BP_MEDIA_TXT_DOMAIN),
183
+ 'name' => __('Addons', BP_MEDIA_TXT_DOMAIN),
184
+ 'class' => ($tab == 'bp-media-addons') ? $active_class : $idle_class
185
+ );
186
+
187
+ $tabs[] = array(
188
+ 'href' => bp_get_admin_url(add_query_arg(array('page' => 'bp-media-support'), 'admin.php')),
189
+ 'title' => __('Buddypress Media Support', BP_MEDIA_TXT_DOMAIN),
190
+ 'name' => __('Support', BP_MEDIA_TXT_DOMAIN),
191
+ 'class' => ($tab == 'bp-media-support') ? $active_class : $idle_class . ' last_tab'
192
+ );
193
+
194
+ $i = '1';
195
+ foreach ($tabs as $tab) {
196
+ $tabs_html.= '<a title="' . $tab['title'] . '" href="' . $tab['href'] . '" class="' . $tab['class'] . '">' . $tab['name'] . '</a>';
197
+ $i++;
198
+ }
199
+ echo $tabs_html;
200
+ }
201
+
202
+ /*
203
+ * Updates the media count of all users.
204
+ */
205
+
206
+ public function update_count() {
207
+ global $wpdb;
208
+ $query =
209
+ "SELECT
210
+ post_author,
211
+ SUM(CASE WHEN post_mime_type LIKE 'image%' THEN 1 ELSE 0 END) as Images,
212
+ SUM(CASE WHEN post_mime_type LIKE 'audio%' THEN 1 ELSE 0 END) as Audio,
213
+ SUM(CASE WHEN post_mime_type LIKE 'video%' THEN 1 ELSE 0 END) as Videos,
214
+ SUM(CASE WHEN post_type LIKE 'bp_media_album' THEN 1 ELSE 0 END) as Albums,
215
+ COUNT(*) as Total
216
+ FROM
217
+ $wpdb->posts RIGHT JOIN $wpdb->postmeta on wp_postmeta.post_id = wp_posts.id
218
+ WHERE
219
+ `meta_key` = 'bp-media-key' AND
220
+ `meta_value` > 0 AND
221
+ ( post_mime_type LIKE 'image%' OR post_mime_type LIKE 'audio%' OR post_mime_type LIKE 'video%' OR post_type LIKE 'bp_media_album')
222
+ GROUP BY post_author";
223
+ $result = $wpdb->get_results($query);
224
+ if (!is_array($result))
225
+ return false;
226
+
227
+ foreach ($result as $obj) {
228
+
229
+ $count = array(
230
+ 'images' => isset($obj->Images) ? $obj->Images : 0,
231
+ 'videos' => isset($obj->Videos) ? $obj->Videos : 0,
232
+ 'audio' => isset($obj->Audio) ? $obj->Audio : 0,
233
+ 'albums' => isset($obj->Albums) ? $obj->Albums : 0
234
+ );
235
+ bp_update_user_meta($obj->post_author, 'bp_media_count', $count);
236
+ }
237
+ return true;
238
+ }
239
+
240
+ /* Multisite Save Options - http://wordpress.stackexchange.com/questions/64968/settings-api-in-multisite-missing-update-message#answer-72503 */
241
+
242
+ public function save_multisite_options() {
243
+ update_site_option('bp_media_options', $_POST['bp_media_options']);
244
+ // redirect to settings page in network
245
+ wp_redirect(
246
+ add_query_arg(
247
+ array('page' => 'bp-media-settings', 'updated' => 'true'), (is_multisite() ? network_admin_url('admin.php') : admin_url('admin.php'))
248
+ )
249
+ );
250
+ exit;
251
+ }
252
+
253
+ /* Admin Sidebar */
254
+
255
+ public function admin_sidebar() {
256
+ global $bp_media;
257
+ $branding = '<a href="http://rtcamp.com" title="' . __('Empowering The Web With WordPress', BP_MEDIA_TXT_DOMAIN) . '" id="logo"><img src="' . BP_MEDIA_URL . 'app/assets/img/rtcamp-logo.png" alt="' . __('rtCamp', BP_MEDIA_TXT_DOMAIN) . '" /></a>
258
+ <ul id="social">
259
+ <li><a href="' . sprintf('%s', 'http://www.facebook.com/rtCamp.solutions/') . '" title="' . __('Become a fan on Facebook', BP_MEDIA_TXT_DOMAIN) . '" class="bp-media-facebook bp-media-social">' . __('Facebook', BP_MEDIA_TXT_DOMAIN) . '</a></li>
260
+ <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>
261
+ <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>
262
+ </ul>';
263
+ new BPMediaWidget('branding', '', $branding);
264
+
265
+ $support = '<p><ul>
266
+ <li>' . sprintf('<a href="%s">' . __("Read FAQ", BP_MEDIA_TXT_DOMAIN) . '</a>', 'http://rtcamp.com/buddypress-media/faq/') . '</li>
267
+ <li>' . sprintf('<a href="%s">' . __("Free Support Forum", BP_MEDIA_TXT_DOMAIN) . '</a>', $bp_media->support_url) . '</li>
268
+ <li>' . sprintf('<a href="%s">' . __("Github Issue Tracker", BP_MEDIA_TXT_DOMAIN) . '</a>', 'https://github.com/rtCamp/buddypress-media/issues/') . '</li>
269
+ <li>' . sprintf('<a href="%s">' . __("Hire us!", BP_MEDIA_TXT_DOMAIN) . '</a> ' . __("To get professional customisation/setup service.", BP_MEDIA_TXT_DOMAIN), 'http://rtcamp.com/buddypress-media/hire/') . '</li>
270
+ </ul></p>';
271
+ new BPMediaWidget('support', __('Need Help?', BP_MEDIA_TXT_DOMAIN), $support);
272
+
273
+ $donate = '<span><a href="http://rtcamp.com/donate/" title="' . __('Help the development keep going.', BP_MEDIA_TXT_DOMAIN) . '"><img class="bp-media-donation-image" src ="' . BP_MEDIA_URL . 'app/assets/img/donate.gif" /></a></span>
274
+ <p>' . sprintf(__('Help us release more amazing features faster. Consider making a donation to our consistent efforts.', BP_MEDIA_TXT_DOMAIN)) . '</p>';
275
+ new BPMediaWidget('donate', __('Donate', BP_MEDIA_TXT_DOMAIN), $donate);
276
+
277
+ $addons = '<ul>
278
+ <li><a href="http://rtcamp.com/store/buddypress-media-kaltura/" title="' . __('BuddyPress Media Kaltura', BP_MEDIA_TXT_DOMAIN) . '">' . __('BPM-Kaltura', BP_MEDIA_TXT_DOMAIN) . '</a> - ' . __('Add support for Kaltura.com/Kaltura-CE based video conversion support', BP_MEDIA_TXT_DOMAIN) . '</li>
279
+ <li><a href="http://rtcamp.com/store/buddy-press-media-ffmpeg/" title="' . __('BuddyPress Media FFMPEG', BP_MEDIA_TXT_DOMAIN) . '">' . __('BPM-FFMPEG', BP_MEDIA_TXT_DOMAIN) . '</a> - ' . __('Add FFMEG-based audio/video conversion support', BP_MEDIA_TXT_DOMAIN) . '</li>
280
+ </ul>
281
+ <h4>' . sprintf(__('Are you a developer?', BP_MEDIA_TXT_DOMAIN)) . '</h4>
282
+ <p>' . sprintf(__('If you are developing a BuddyPress Media addon we would like to include it in above list. We can also help you sell them. <a href="%s">More info!</a>', BP_MEDIA_TXT_DOMAIN), 'http://rtcamp.com/contact/') . '</p></h4>';
283
+ new BPMediaWidget('premium-addons', __('Premium Addons', BP_MEDIA_TXT_DOMAIN), $addons);
284
+
285
+ $news = '<img src ="' . admin_url('/images/wpspin_light.gif') . '" /> Loading...';
286
+ new BPMediaWidget('latest-news', __('Latest News', BP_MEDIA_TXT_DOMAIN), $news);
287
+ }
288
+
289
+ }
290
+
291
+ }
292
+ ?>
includes/css/bp-media-style.css → app/assets/css/main.css RENAMED
@@ -17,9 +17,9 @@ ul.bp-media-gallery li span img{height: 150px;}
17
li.media div.activity-content div.activity-inner p{display:none;}
18
div.bp_media_title{margin-bottom:10px;}
19
#bp-media-footer {color: #4D4D4D;text-align: center;text-shadow: #FAFAFA 1px 1px 0;}
20
- #wpbody-content div.metabox-fixed{width: 280px;margin-right: -300px;float: right;}
21
#wpbody-content div.wrap.bp-media-admin .columns-2{margin-right:300px;padding-top: 0;margin-top: 15px;width: 600px}
22
- #wpbody-content .bp-media-settings-tabs{margin-bottom: 15px}
23
#wpbody-content .bp-media-settings-tabs .media-nav-tab{margin: 0 10px; text-decoration: underline; text-transform: capitalize}
24
#wpbody-content .bp-media-settings-tabs .media-nav-tab.media-nav-tab-active{font-weight: bold}
25
@@ -72,10 +72,10 @@ div.bp_media_title{margin-bottom:10px;}
72
#adminmenu li.toplevel_page_bp-media-settings:hover .wp-menu-image a,
73
#adminmenu li.current.toplevel_page_bp-media-settings .wp-menu-image a{background-position: center 1px;}
74
#adminmenu li.toplevel_page_bp-media-settings .wp-menu-image a img{display:none;}
75
- #bp-media-settings-boxes{overflow: hidden;width: 100%;float: left;}
76
.nav-tab-wrapper a#bp-media{background:url('../img/bpm-icon-32.png') transparent no-repeat; padding-left:32px;}
77
.nav-tab-wrapper a#bp-media:hover,.nav-tab-wrapper a#bp-media.nav-tab-active{background-position:left -32px;}
78
- .metabox-holder .postbox#bp_media_latest_news .inside ul li{background: transparent url('../img/rtCamp-bullet.png') left top no-repeat; padding-left: 19px;}
79
#branding #logo{text-align:center;padding: 10px 0;display:block;}
80
ul#social{display:block;text-align:center;margin:0;}
81
ul#social li{display:inline;}
@@ -89,17 +89,21 @@ ul#activity-stream li.media.album_updated ul li{float: left;margin-right:2%}
89
#bp-media-addons-list_metabox {background: #ffffff}
90
.products ul:after, ul.products:after {clear: both;content: "";display: block;}
91
.products ul, ul.products {clear: both;list-style: none outside none;margin: 0 0 14px;padding: 0;}
92
- .products {margin: 0;}
93
- ul.products li.product.first { }
94
- ul.products li.product {margin: 20px 10px 30px;padding: 0;position: relative;overflow: hidden}
95
- ul.products li.product h4 {background: none repeat scroll 0 0 transparent;border: 0 none;color: #006999;cursor: pointer;font-family: "HelveticaNeue-Light","Helvetica Neue Light","Helvetica Neue",sans-serif;font-size: 20px;font-weight: normal;line-height: 26px;margin: 0 0 10px;}
96
- ul.products li.product a {text-decoration: none;}
97
- ul.products li.product a img, div.product div.images img {box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.4);}
98
- ul.products li.product a img {box-shadow: 0 0 2px 0 rgba(0, 0, 0, 0.3);display: block;height: auto;margin: 5px 15px 5px 5px;transition: all 0.2s ease-in-out 0s;float: left; width: 200px}
99
-
100
- ul.products li.product .price, ul.products li.product .price .amount, ul.products li.product .price ins {color: #85AD74;font-size: 25px;font-weight: bold;}
101
- ul.products li.product .price {line-height: 1.4em;color: #85AD74;display: block;font-weight: normal;margin-bottom: 0.5em;}
102
- /*ul.products li.product .add_to_cart_button{background-image: linear-gradient(bottom, #F7F6F7 47%, #DFDBDF 74%);
103
background-image: -o-linear-gradient(bottom, #F7F6F7 0%, #DFDBDF 100%);
104
background-image: -moz-linear-gradient(bottom, #F7F6F7 0%, #DFDBDF 100%);
105
background-image: -webkit-linear-gradient(bottom, #F7F6F7 0%, #DFDBDF 100%);
@@ -107,31 +111,61 @@ background-image: -ms-linear-gradient(bottom, #F7F6F7 0%, #DFDBDF 100%);
107
background-image: -webkit-gradient(linear,left bottom,left top,color-stop(0, #F7F6F7),color-stop(1, #DFDBDF));
108
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;}
109
110
- ul.products li.product .add_to_cart_button:hover{background-image: linear-gradient(bottom, #F7F6F7 47%, #DFDBDF 74%);
111
background-image: -o-linear-gradient(bottom, #F7F6F7 0%, #D3CED3 100%);
112
background-image: -moz-linear-gradient(bottom, #F7F6F7 0%, #D3CED3 100%);
113
background-image: -webkit-linear-gradient(bottom, #F7F6F7 0%, #D3CED3 100%);
114
background-image: -ms-linear-gradient(bottom, #F7F6F7 0%, #D3CED3 100%);
115
background-image: -webkit-gradient(linear,left bottom,left top,color-stop(1, #F7F6F7),color-stop(1, #D3CED3));}
116
*/
117
- ul.products li.product .product_footer{margin: 20px 0 0;overflow: hidden;}
118
- ul.products li.product .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)}
119
- ul.products li.product .product_footer .product_demo_link{font-size: 16px;margin: 8px 20px; font-weight: bold}
120
121
- ul.products li.product .add_to_cart_button:hover{background: none repeat scroll 0 0 #D75A00;
122
- box-shadow: 0 1px rgba(0, 0, 0, 0.2), 0 0 1px rgba(0, 0, 0, 0.4) inset;
123
- color: #FFFFFF;}
124
125
/* Admin bar Menu */
126
#wpadminbar .bp-media-settings-menu > .ab-item .ab-icon{background: url("../img/bpm-icon-16.png") no-repeat scroll -8px -7px transparent}
127
#wpadminbar .bp-media-settings-menu:hover .ab-icon{background-position: -8px -41px}
128
129
-
130
.bp-media-form li{margin-bottom: 10px}
131
- .bp-media-form .bp-media-label{ display: inline-block;margin-right: 10px;width: 150px;vertical-align: top}
132
.bp-media-form .bp-media-input{background-color: #FFFFFF;border: 1px solid #DFDFDF;border-radius: 3px 3px 3px 3px;color: #333333;line-height: 16px;padding: 5px;width: 220px;}
133
- .bp-media-form .bp-media-textarea{background-color: #FFFFFF;border: 1px solid #DFDFDF;border-radius: 3px 3px 3px 3px;color: #333333;line-height: 16px;padding: 5px;width: 220px;}
134
#normal-sortables .postbox .bp-media-form .submit{float: none; margin-left: 150px}
135
.rt-success{background-color: #E1FFDF;border-color: #2ACF2A;}
136
.rt-update{background-color: #FFEAA6;border-color:#E1CA82;}
137
- img.bp-media-donation-image{display:block;margin: 10px auto;}
17
li.media div.activity-content div.activity-inner p{display:none;}
18
div.bp_media_title{margin-bottom:10px;}
19
#bp-media-footer {color: #4D4D4D;text-align: center;text-shadow: #FAFAFA 1px 1px 0;}
20
+ #wpbody-content div.metabox-fixed{width: 280px;margin-right: -300px;float: right;}
21
#wpbody-content div.wrap.bp-media-admin .columns-2{margin-right:300px;padding-top: 0;margin-top: 15px;width: 600px}
22
+ #wpbody-content .bp-media-settings-tabs{margin-bottom: 0; }
23
#wpbody-content .bp-media-settings-tabs .media-nav-tab{margin: 0 10px; text-decoration: underline; text-transform: capitalize}
24
#wpbody-content .bp-media-settings-tabs .media-nav-tab.media-nav-tab-active{font-weight: bold}
25
72
#adminmenu li.toplevel_page_bp-media-settings:hover .wp-menu-image a,
73
#adminmenu li.current.toplevel_page_bp-media-settings .wp-menu-image a{background-position: center 1px;}
74
#adminmenu li.toplevel_page_bp-media-settings .wp-menu-image a img{display:none;}
75
+ #bp-media-settings-boxes{border:1px solid #CCC; overflow: hidden; padding: 10px; -webkit-border-bottom-left-radius:3px;border-bottom-left-radius:3px;-webkit-border-top-right-radius:3px;border-top-right-radius:3px;-webkit-border-bottom-right-radius:3px;border-bottom-right-radius:3px; float: left; width: 98%;}
76
.nav-tab-wrapper a#bp-media{background:url('../img/bpm-icon-32.png') transparent no-repeat; padding-left:32px;}
77
.nav-tab-wrapper a#bp-media:hover,.nav-tab-wrapper a#bp-media.nav-tab-active{background-position:left -32px;}
78
+ .metabox-holder .postbox#latest-news .inside ul li{background: transparent url('../img/rtCamp-bullet.png') left top no-repeat; padding-left: 19px;}
79
#branding #logo{text-align:center;padding: 10px 0;display:block;}
80
ul#social{display:block;text-align:center;margin:0;}
81
ul#social li{display:inline;}
89
#bp-media-addons-list_metabox {background: #ffffff}
90
.products ul:after, ul.products:after {clear: both;content: "";display: block;}
91
.products ul, ul.products {clear: both;list-style: none outside none;margin: 0 0 14px;padding: 0;}
92
+ .bp-media-addon {margin: 0;}
93
+ .bp-media-addon.first { }
94
+ .bp-media-addon {margin: 20px 10px 30px;padding: 5px;position: relative;border: 1px solid #ccc;}
95
+ .bp-media-addon h4 {background: none repeat scroll 0 0 transparent;border: 0 none;color: #006999;cursor: pointer;font-family: "HelveticaNeue-Light","Helvetica Neue Light","Helvetica Neue",sans-serif;font-size: 20px;font-weight: normal;line-height: 26px;margin: 0 0 10px;}
96
+ .bp-media-addon a {text-decoration: none;}
97
+ .bp-media-addon a img, div.product div.images img {box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.4);}
98
+ .bp-media-addon a img {display: block;height: auto;margin: 5px 15px 5px 5px;transition: all 0.2s ease-in-out 0s;float: left; width: 200px}
99
+
100
+ .bp-media-addon .price, .bp-media-addon .price .amount, .bp-media-addon .price ins {color: #85AD74;font-size: 25px;font-weight: bold;}
101
+ .bp-media-addon .price {line-height: 1.4em;color: #85AD74;display: block;font-weight: normal;margin-bottom: 0.5em;}
102
+ .coming-soon { background: url("../img/coming-soon.png"); z-index: 5; position:absolute;height:191px; opacity:0.9;}
103
+ .coming-soon.coming-soon-l { background-position: 0 0; width:250px; top:-12px; left:-18px;}
104
+ .coming-soon.coming-soon-r { background-position: 347px 0; width:174px; bottom:-14px; right:-12px;}
105
+ .coming-soon.coming-soon-r:hover{background-position: 175px 0;}
106
+ /*.bp-media-addon .add_to_cart_button{background-image: linear-gradient(bottom, #F7F6F7 47%, #DFDBDF 74%);
107
background-image: -o-linear-gradient(bottom, #F7F6F7 0%, #DFDBDF 100%);
108
background-image: -moz-linear-gradient(bottom, #F7F6F7 0%, #DFDBDF 100%);
109
background-image: -webkit-linear-gradient(bottom, #F7F6F7 0%, #DFDBDF 100%);
111
background-image: -webkit-gradient(linear,left bottom,left top,color-stop(0, #F7F6F7),color-stop(1, #DFDBDF));
112
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;}
113
114
+ .bp-media-addon .add_to_cart_button:hover{background-image: linear-gradient(bottom, #F7F6F7 47%, #DFDBDF 74%);
115
background-image: -o-linear-gradient(bottom, #F7F6F7 0%, #D3CED3 100%);
116
background-image: -moz-linear-gradient(bottom, #F7F6F7 0%, #D3CED3 100%);
117
background-image: -webkit-linear-gradient(bottom, #F7F6F7 0%, #D3CED3 100%);
118
background-image: -ms-linear-gradient(bottom, #F7F6F7 0%, #D3CED3 100%);
119
background-image: -webkit-gradient(linear,left bottom,left top,color-stop(1, #F7F6F7),color-stop(1, #D3CED3));}
120
*/
121
+ .bp-media-addon .product_footer{margin: 20px 0 0;overflow: hidden;}
122
+ .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)}
123
+ .bp-media-addon .product_footer .product_demo_link{font-size: 16px;margin: 8px 20px; font-weight: bold}
124
125
+ .bp-media-addon .add_to_cart_button:hover{background: none repeat scroll 0 0 #D75A00;
126
+ box-shadow: 0 1px rgba(0, 0, 0, 0.2), 0 0 1px rgba(0, 0, 0, 0.4) inset;
127
+ color: #FFFFFF;}
128
129
/* Admin bar Menu */
130
#wpadminbar .bp-media-settings-menu > .ab-item .ab-icon{background: url("../img/bpm-icon-16.png") no-repeat scroll -8px -7px transparent}
131
#wpadminbar .bp-media-settings-menu:hover .ab-icon{background-position: -8px -41px}
132
133
+ /* Buddypress media admin support form styling */
134
+ .bp-media-updated, .bp-media-error{border-radius: 3px; padding: 0 7px; margin: 5px 0 15px; border: 1px solid}
135
+ .bp-media-updated p, .bp-media-error p{margin: 0.5em 0;padding: 2px;}
136
+ .bp-media-updated{background-color: #FFFFE0;border-color: #E6DB55;}
137
+ .bp-media-error{background-color: #FFEBE8;border-color: #CC0000;}
138
.bp-media-form li{margin-bottom: 10px}
139
+ .bp-media-form .bp-media-label{display: inline-block;margin-right: 10px;width: 150px;vertical-align: top; }
140
.bp-media-form .bp-media-input{background-color: #FFFFFF;border: 1px solid #DFDFDF;border-radius: 3px 3px 3px 3px;color: #333333;line-height: 16px;padding: 5px;width: 220px;}
141
+ .bp-media-form .bp-media-checkbox{margin-right: 10px; margin-left: 160px}
142
+ .bp-media-form .bp-media-textarea{background-color: #FFFFFF;border: 1px solid #DFDFDF;border-radius: 3px 3px 3px 3px;color: #333333;height: 175px;line-height: 16px;padding: 5px;width: 400px;}
143
+ .bp-media-form .bp-media-select{margin: 0;max-width: 400px;}
144
+ .bp-media-support-attachment label{float: left}
145
+ .bp-media-support-attachment .more-attachment{margin-left: 160px; margin-top: 10px}
146
+ .bp-media-support-attachment .more-attachment:first-child{margin-top: 0px}
147
+ .bp-media-support-attachment .add-more-attachment-btn{clear: both;display: inline-block;margin-left: 160px;margin-top: 10px;}
148
+ .template_select_label{float: left}
149
+ .template_select_container{overflow-x:scroll; width:405px;float: left}
150
+ #bp_media_settings_form .support_form_laoder{height: 100px; width: 200px; background: url("../img/loader.gif") no-repeat }
151
+ /* Miscellinus */
152
#normal-sortables .postbox .bp-media-form .submit{float: none; margin-left: 150px}
153
.rt-success{background-color: #E1FFDF;border-color: #2ACF2A;}
154
.rt-update{background-color: #FFEAA6;border-color:#E1CA82;}
155
+ img.bp-media-donation-image{display:block;margin: 10px auto;}
156
+
157
+ /* Buddypress Media Image Uploader album selection */
158
+ #bp-media-album-prompt, #bp-media-album-new { background: none repeat scroll 0 0 #FFFFFF;border: 1px solid #AAAAAA;border-radius: 5px 5px 5px 5px;display: none;padding: 3px;z-index: 110000;left: 40%;position: fixed;top: 35%;width: 300px; }
159
+ #bp-media-album-new { z-index: 120000; }
160
+ .bp-media-album-title { background: url("../img/Popup-title-bg.png") repeat-x scroll 50% 50% #CCCCCC;border: 1px solid #AAAAAA;border-radius: 5px 5px 5px 5px;color: #222222;display: block;font-weight: bold;padding: 0;margin-bottom: 10px; }
161
+ .bp-media-album-title span { background: none repeat scroll 0 0 transparent;display: block;font-size: 16px;padding: 10px; }
162
+ #bp-media-create-album-close, #bp-media-create-album-close:active, #bp-media-close, #bp-media-close:active { border-radius: 3px 3px 3px 3px;cursor: pointer;display: block;padding: 0 7px 2px;position: absolute;right: 8px;top: 11px;z-index: 10; }
163
+ #bp-media-create-album-close:hover, #bp-media-create-album-close:focus, #bp-media-close:hover, #bp-media-close:focus { background: none repeat scroll 0 0 #545454;color: #CFCFCF; }
164
+ .bp-media-album-content { display: block;padding: 5px; }
165
+ .bp-media-album-content label { display: block;font-size: 14px;margin: 0 0 0 3px; }
166
+ #bp-media-album-prompt select { min-width: 140px; }
167
+ .select-btn-div { border-top: 1px solid #AAAAAA;margin: 15px 0 0;padding: 5px 5px 5px 30px;text-align: right; }
168
+ .select-btn-div .btn { float: right;font-size: 14px;margin: 5px;padding: 10px 25px; }
169
+ #bp-media-album-new > label { font-size: 14px; }
170
+ #bp-media-album-new input[type="text"] { width: 98%; }
171
+ #custom-overlay { background: none repeat scroll 0 0 #000000;bottom: 0;left: 0;min-height: 360px;opacity: 0.7;position: fixed;right: 0;top: 0;z-index: 105000; }
app/assets/img/Popup-title-bg.png ADDED
Binary file
{includes → app/assets}/img/audio_thumb.png RENAMED
File without changes
{includes → app/assets}/img/bp_media_social.png RENAMED
File without changes
{includes → app/assets}/img/bpm-icon-16.png RENAMED
File without changes
{includes → app/assets}/img/bpm-icon-32.png RENAMED
File without changes
app/assets/img/coming-soon.png ADDED
Binary file
{includes → app/assets}/img/donate.gif RENAMED
File without changes
{includes → app/assets}/img/donate.png RENAMED
File without changes
{includes → app/assets}/img/image_thumb.png RENAMED
File without changes
app/assets/img/loader.gif ADDED
Binary file
{includes → app/assets}/img/logo_medibp_32.png RENAMED
File without changes
{includes → app/assets}/img/rtCamp-bullet.png RENAMED
File without changes
{includes → app/assets}/img/rtcamp-logo.png RENAMED
File without changes
{includes → app/assets}/img/video_thumb.png RENAMED
File without changes
app/assets/js/admin.js ADDED
@@ -0,0 +1,70 @@
1
+ jQuery(document).ready(function(){
2
+
3
+ /* Fetch Feed */
4
+ var bp_media_news_section = jQuery('#latest-news');
5
+ if(bp_media_news_section.length>0){
6
+ var data = {
7
+ action: 'bp_media_fetch_feed'
8
+ };
9
+ jQuery.post(bp_media_admin_ajax,data,function(response){
10
+ bp_media_news_section.find('.inside').html(response);
11
+ });
12
+ }
13
+
14
+ // /* Add more attachment link */
15
+ // jQuery( '.add-more-attachment-btn' ).live('click', function(event){
16
+ // event.preventDefault();
17
+ // jQuery(this).prev().after('<div class="more-attachment"><input class="bp-media-input" type="file" name="attachment[]" /></div>');
18
+ // });
19
+
20
+ /* Select Request */
21
+ jQuery('#bp-media-settings-boxes').on('change', '#select-request', function(){
22
+ if(jQuery(this).val()){
23
+ jQuery('#bp_media_settings_form .bp-media-metabox-holder').html()
24
+ jQuery('#bp_media_settings_form .bp-media-metabox-holder').html('<div class="support_form_laoder"></div>');
25
+ var data = {
26
+ action: 'bp_media_select_request',
27
+ form: jQuery(this).val()
28
+ };
29
+
30
+ // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
31
+ jQuery.post(ajaxurl, data, function(response) {
32
+ jQuery('#bp_media_settings_form .bp-media-metabox-holder').html()
33
+ jQuery('#bp_media_settings_form .bp-media-metabox-holder').html(response).fadeIn('slow');
34
+ });
35
+ }
36
+ });
37
+
38
+ /* Cancel Request */
39
+ jQuery('#bp-media-settings-boxes').on('click', '#cancel-request', function(){
40
+ if(jQuery(this).val()){
41
+ jQuery('#bp_media_settings_form .bp-media-metabox-holder').html()
42
+ jQuery('#bp_media_settings_form .bp-media-metabox-holder').html('<div class="support_form_laoder"></div>');
43
+ var data = {
44
+ action: 'bp_media_cancel_request'
45
+ };
46
+
47
+ // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
48
+ jQuery.post(ajaxurl, data, function(response) {
49
+ jQuery('#bp_media_settings_form .bp-media-metabox-holder').html()
50
+ jQuery('#bp_media_settings_form .bp-media-metabox-holder').html(response).fadeIn('slow');
51
+ });
52
+ }
53
+ });
54
+
55
+ /* Submit Request */
56
+ jQuery('.bp-media-support').on('submit', '#bp_media_settings_form', function(e){
57
+ e.preventDefault();
58
+ var data = {
59
+ action: 'bp_media_submit_request',
60
+ form_data: jQuery('form').serialize()
61
+ };
62
+
63
+ // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
64
+ jQuery.post(ajaxurl, data, function(response) {
65
+ jQuery('#bp_media_settings_form .bp-media-metabox-holder').html()
66
+ jQuery('#bp_media_settings_form .bp-media-metabox-holder').html(response).fadeIn('slow');
67
+ });
68
+ });
69
+
70
+ });
app/assets/js/bp-media-uploader.js ADDED
@@ -0,0 +1,128 @@
1
+ /*
2
+ * To change this template, choose Tools | Templates
3
+ * and open the template in the editor.
4
+ */
5
+
6
+ jQuery(document).ready(function(){
7
+ jQuery('body').append('<div id="custom-overlay"></div>');
8
+ jQuery('#custom-overlay').hide();
9
+ jQuery('#bp-media-close').click(function(){
10
+ jQuery('#bp-media-album-prompt').hide();
11
+ jQuery('#custom-overlay').hide();
12
+ jQuery('#bp-media-uploaded-files div').remove();
13
+ });
14
+ jQuery('#selected-btn').click(function() {
15
+ bp_media_album_selected = jQuery('#bp-media-selected-album').val();
16
+ jQuery('#bp-media-album-prompt').hide();
17
+ jQuery('#custom-overlay').hide();
18
+ bp_media_uploader.start();
19
+ });
20
+ jQuery('#create-btn').click(function() {
21
+ jQuery('#custom-overlay').css('z-index', 115000);
22
+ jQuery('#bp-media-album-new').show();
23
+ jQuery('#bp-media-album-new').css({
24
+ left: ((jQuery(window).width()-jQuery('#bp-media-album-new').width())/2),
25
+ top: ((jQuery(window).height()-jQuery('#bp-media-album-new').height())/2)
26
+ });
27
+ });
28
+ jQuery('#bp-media-create-album-close').click(function() {
29
+ jQuery('#bp-media-album-new').hide();
30
+ jQuery('#custom-overlay').css('z-index', 105000);
31
+ });
32
+ jQuery(window).resize(function(){
33
+ jQuery('#bp-media-album-prompt').css({
34
+ left: ((jQuery(window).width()-jQuery('#bp-media-album-prompt').width())/2),
35
+ top: ((jQuery(window).height()-jQuery('#bp-media-album-prompt').height())/2)
36
+ });
37
+ jQuery('#bp-media-album-new').css({
38
+ left: ((jQuery(window).width()-jQuery('#bp-media-album-new').width())/2),
39
+ top: ((jQuery(window).height()-jQuery('#bp-media-album-new').height())/2)
40
+ });
41
+ });
42
+ jQuery('#create-album').click(function() {
43
+ var album_name = jQuery('#bp_media_album_name').val();
44
+ if(album_name.length==0){
45
+ alert('You have not filled the album name');
46
+ return false;
47
+ }
48
+ var data = {
49
+ action: 'bp_media_add_album',
50
+ bp_media_album_name : album_name,
51
+ bp_media_group_id : bp_media_uploader_params.multipart_params.bp_media_group_id
52
+ };
53
+ jQuery.post(bp_media_vars.ajaxurl,data,function(response){
54
+ var album = parseInt(response);
55
+ if(album == 0){
56
+ alert('Sorry you cannot create albums in this group');
57
+ }
58
+ else{
59
+ jQuery('#bp-media-selected-album').append('<option value='+album+' selected="selected">'+jQuery('#bp_media_album_name').val()+'</option>')
60
+ jQuery('#bp-media-album-new').hide();
61
+ bp_media_album_selected = jQuery('#bp-media-selected-album').val();
62
+ jQuery('#bp-media-album-prompt').hide();
63
+ jQuery('#custom-overlay').hide();
64
+ bp_media_uploader.start();
65
+ }
66
+ });
67
+ });
68
+
69
+ var bp_media_is_multiple_upload = false;
70
+ if(jQuery('#'+bp_media_uploader_params.container).length==0)
71
+ return false;
72
+ var bp_media_uploader=new plupload.Uploader(bp_media_uploader_params);
73
+ var bp_media_album_selected = false;
74
+ bp_media_uploader.init();
75
+ bp_media_uploader.bind('FilesAdded', function(up, files) {
76
+ //bp_media_is_multiple_upload = files.length==1&&jQuery('.bp-media-progressbar').length==0?false:true;
77
+ bp_media_is_multiple_upload = files.length>1;
78
+ jQuery.each(files, function(i, file) {
79
+ jQuery('#bp-media-uploaded-files').append(
80
+ '<div id="bp-media-progress-'+file.id+'" class="bp-media-progressbar"><div class="bp-media-progress-text">' +
81
+ file.name + ' (' + plupload.formatSize(file.size) + ')(<b></b>)</div><div class="bp-media-progress-completed"></div></div>');
82
+ });
83
+ if(bp_media_album_selected == false){
84
+ jQuery('#bp-media-album-prompt').css({
85
+ left: ((jQuery(window).width()-jQuery('#bp-media-album-prompt').width())/2),
86
+ top: ((jQuery(window).height()-jQuery('#bp-media-album-prompt').height())/2)
87
+ });
88
+ jQuery('#custom-overlay').show();
89
+ jQuery('#bp-media-album-prompt').show();
90
+ } else {
91
+ bp_media_album_selected = jQuery('#bp-media-selected-album').val();
92
+ bp_media_uploader.start();
93
+ }
94
+ up.refresh(); // Reposition Flash/Silverlight
95
+ });
96
+ bp_media_uploader.bind('UploadProgress', function(up, file) {
97
+ jQuery('#bp-media-progress-'+file.id+' .bp-media-progress-completed').width(file.percent+'%');
98
+ jQuery('#bp-media-progress-'+file.id+' .bp-media-progress-text b').html(file.percent+'%');
99
+ });
100
+
101
+ bp_media_uploader.bind('Error', function(up, err) {
102
+ jQuery('#bp-media-uploaded-files').html('<div class="error"><p>Error: ' + err.code +
103
+ ', Message: ' + err.message +
104
+ (err.file ? ', File: ' + err.file.name : '') +
105
+ '</p></div>'
106
+ );
107
+ up.refresh();
108
+ });
109
+
110
+ bp_media_uploader.bind('FileUploaded', function(up, file) {
111
+ jQuery('#bp-media-progress-'+file.id+' .bp-media-progress-text b').html("100%");
112
+ });
113
+ bp_media_uploader.bind('BeforeUpload',function(up){
114
+ up.settings.multipart_params.is_multiple_upload = bp_media_is_multiple_upload;
115
+ up.settings.multipart_params.bp_media_album_id = bp_media_album_selected;
116
+ });
117
+ bp_media_uploader.bind('UploadComplete',function(){
118
+ var new_location = window.location.href;
119
+ if(new_location.search('/media/')>0){
120
+ new_location = new_location.replace('/media/','/albums/');
121
+ if(bp_media_album_selected>0)
122
+ new_location = new_location.concat(bp_media_album_selected);
123
+ else
124
+ new_location = new_location.concat('0/');
125
+ window.location.replace(new_location);
126
+ }
127
+ });
128
+ });
app/assets/js/main.js ADDED
@@ -0,0 +1,102 @@
1
+ /*
2
+ * BuddyPress Media Default JS
3
+ */
4
+
5
+ function bp_media_create_element(id){
6
+ jQuery('#'+id).mediaelementplayer({
7
+ enableKeyboard: false,
8
+ startVolume: 1,
9
+ success: function(mediaElement,domElement){
10
+ var $thisMediaElement = (mediaElement.id) ? jQuery("#"+mediaElement.id) : jQuery(mediaElement);
11
+ $thisMediaElement.parents('.mejs-container').find(".mejs-volume-current").css("top","8px");
12
+ $thisMediaElement.parents('.mejs-container').find(".mejs-volume-handle").css("top","5px");
13
+ }
14
+ });
15
+ }
16
+
17
+ jQuery(document).ready(function(){
18
+
19
+ var bp_media_recent_tabs = jQuery('#recent-media-tabs');
20
+ if(bp_media_recent_tabs.length>0){
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
+
32
+ var thisHeight = jQuery(this).height();
33
+ if(thisHeight > tallest) {
34
+ tallest = thisHeight;
35
+ }
36
+ }).height(tallest);
37
+
38
+
39
+ jQuery('#bp-media-show-more').click(function(e){
40
+ e.preventDefault();
41
+ var data = {
42
+ action: 'bp_media_load_more',
43
+ page:++bp_media_vars.page,
44
+ current_action : bp_media_vars.current_action,
45
+ action_variables : bp_media_vars.action_variables,
46
+ displayed_user : bp_media_vars.displayed_user,
47
+ loggedin_user : bp_media_vars.loggedin_user,
48
+ current_group : bp_media_vars.current_group
49
+ };
50
+
51
+ // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
52
+ jQuery.post(bp_media_vars.ajaxurl, data, function(response) {
53
+ if(response.length==0)
54
+ jQuery('#bp-media-show-more').parent().remove();
55
+ else
56
+ jQuery('#bp-media-list').append(response);
57
+ });
58
+ });
59
+ setTimeout(function(){
60
+ jQuery('.media album_updated .delete-activity,.media_upload .delete-activity').unbind('click').click(function(e){
61
+ if(confirm('Are you sure you want to delete this activity and associated media?')){
62
+ return true;
63
+ }
64
+ else{
65
+ return false;
66
+ }
67
+ });
68
+
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 date = post_date.getFullYear()+'-'+(post_date.getMonth() + 1) +'-'+post_date.getDate()+' '+ post_date.getHours()+':'+(post_date.getMinutes() + 1)+':'+(post_date.getSeconds()+1);
78
+ // var post_date = d.getTime();
79
+ var curr_obj = jQuery(this);
80
+ var remove_featured = 0;
81
+ if(jQuery(this).attr('data-remove-featured')){
82
+ remove_featured = jQuery(this).attr('data-remove-featured');
83
+ }
84
+ jQuery.ajax({
85
+ url:"/wp-admin/admin-ajax.php",
86
+ type:'POST',
87
+ data:'action=my_featured_action&post_id='+post_id+'&remove_featured='+remove_featured+'&post_date='+date,
88
+ success:function( results )
89
+ {
90
+ if(remove_featured == 1){
91
+ curr_obj.text('Featured');
92
+ curr_obj.attr('data-remove-featured','0');
93
+ } else {
94
+ curr_obj.text('Remove Featured');
95
+ curr_obj.attr('data-remove-featured','1');
96
+ }
97
+
98
+ }
99
+ });
100
+ });
101
+
102
+ });
app/helper/BPMediaAddon.php ADDED
@@ -0,0 +1,93 @@
1
+ <?php
2
+
3
+ /**
4
+ * Description of BPMediaAddon
5
+ *
6
+ * @author Gagandeep Singh <gagandeep.singh@rtcamp.com>
7
+ * @author Joshua Abenazer <joshua.abenazer@rtcamp.com>
8
+ */
9
+ if ( ! class_exists( 'BPMediaAddon' ) ) {
10
+
11
+ class BPMediaAddon {
12
+
13
+ public $enquiry_link = 'http://rtcamp.com/contact';
14
+
15
+ public function coming_soon_div(){
16
+ return
17
+ '<div class="coming-soon coming-soon-l"></div>
18
+ <a class="coming-soon coming-soon-r" href="'.$this->enquiry_link.'" target="_blank">'
19
+ //<a></a>
20
+ .'</a>';
21
+ }
22
+
23
+ public function get_addons() {
24
+ $addons = array(
25
+ array(
26
+ 'title' => __( 'BuddyPress-Media FFMPEG Add-on', BP_MEDIA_TXT_DOMAIN ),
27
+ 'img_src' => 'http://cdn.rtcamp.com/files/2012/09/ffmpeg-logo-240x184.png',
28
+ 'product_link' => 'http://rtcamp.com/store/buddypress-media-ffmpeg-converter/',
29
+ 'desc' => '<p>' . __( 'Add supports for more audio & video formats using open-source media-node.', BP_MEDIA_TXT_DOMAIN ) . '</p>
30
+ <p>' . __( 'Media node comes with automated setup script for Ubuntu/Debian.', BP_MEDIA_TXT_DOMAIN ) . '</p>',
31
+ 'price' => '$49',
32
+ 'demo_link' => 'http://demo.rtcamp.com/bpm-media',
33
+ 'buy_now' => 'http://rtcamp.com/store/?add-to-cart=13677'
34
+ ),
35
+ array(
36
+ 'title' => __( 'BuddyPress-Media Kaltura Add-on', BP_MEDIA_TXT_DOMAIN ),
37
+ 'img_src' => 'http://cdn.rtcamp.com/files/2012/10/new-buddypress-media-kaltura-logo-240x184.png',
38
+ 'product_link' => 'http://rtcamp.com/store/buddypress-media-kaltura/',
39
+ 'desc' => '<p>' . __( 'Add support for more video formats using Kaltura video solution.', BP_MEDIA_TXT_DOMAIN ) . '</p>
40
+ <p>' . __( 'Works with Kaltura.com, self-hosted Kaltura-CE and Kaltura-on-premise.', BP_MEDIA_TXT_DOMAIN ) . '</p>',
41
+ 'price' => '$99',
42
+ 'demo_link' => 'http://demo.rtcamp.com/bpm-kaltura/',
43
+ 'buy_now' => 'http://rtcamp.com/store/?add-to-cart=15446',
44
+ 'coming_soon' => true
45
+ )
46
+ );
47
+ $addons = apply_filters('bp_media_addons',$addons);
48
+ foreach ( $addons as $addon ) {
49
+ $this->addon( $addon );
50
+ }
51
+ }
52
+
53
+ public function addon( $args ) {
54
+ global $bp_media;
55
+
56
+ $defaults = array(
57
+ 'title' => '',
58
+ 'img_src' => '',
59
+ 'product_link' => '',
60
+ 'desc' => '',
61
+ 'price' => '',
62
+ 'demo_link' => '',
63
+ 'buy_now' => '',
64
+ 'coming_soon' => false,
65
+ );
66
+ $args = wp_parse_args( $args, $defaults );
67
+ extract( $args );
68
+
69
+ $coming_soon ? ' coming-soon' : '';
70
+
71
+ $coming_soon_div = ($coming_soon) ? $this->coming_soon_div() : '';
72
+ $addon = '<div class="bp-media-addon">
73
+ <a href="' . $product_link . '" title="' . $title . '" target="_blank">
74
+ <img width="240" height="184" title="' . $title . '" alt="' . $title . '" src="' . $img_src . '">
75
+ </a>
76
+ <h4><a href="' . $product_link . '" title="' . $title . '" target="_blank">' . $title . '</a></h4>
77
+ <div class="product_desc">
78
+ ' . $desc . '
79
+ </div>
80
+ <div class="product_footer">
81
+ <span class="price alignleft"><span class="amount">' . $price . '</span></span>
82
+ <a class="add_to_cart_button alignright product_type_simple" href="' . $buy_now . '" target="_blank">' . __( 'Buy Now', BP_MEDIA_TXT_DOMAIN ) . '</a>
83
+ <a class="alignleft product_demo_link" href="' . $demo_link . '" title="' . $title . '" target="_blank">' . __( 'Live Demo', BP_MEDIA_TXT_DOMAIN ) . '</a>
84
+ </div>'
85
+ . $coming_soon_div .
86
+ '</div>';
87
+ echo $addon;
88
+ }
89
+
90
+ }
91
+
92
+ }
93
+ ?>
app/helper/BPMediaBranding.php ADDED
@@ -0,0 +1,20 @@
1
+ <?php
2
+
3
+ /**
4
+ * Description of BPMediaBranding
5
+ *
6
+ * @author Gagandeep Singh <gagandeep.singh@rtcamp.com>
7
+ * @author Joshua Abenazer <joshua.abenazer@rtcamp.com>
8
+ */
9
+ if (!class_exists('BPMediaBranding')) {
10
+
11
+ class BPMediaBranding {
12
+
13
+ public function __construct() {
14
+ ;
15
+ }
16
+
17
+ }
18
+
19
+ }
20
+ ?>
app/helper/BPMediaFeed.php ADDED
@@ -0,0 +1,56 @@
1
+ <?php
2
+
3
+ /**
4
+ * Description of BPMediaFeed
5
+ *
6
+ * @author Gagandeep Singh <gagandeep.singh@rtcamp.com>
7
+ * @author Joshua Abenazer <joshua.abenazer@rtcamp.com>
8
+ */
9
+ class BPMediaFeed {
10
+
11
+ public $feed_url = 'http://rtcamp.com/tag/buddypress/feed/';
12
+
13
+ public function __construct($feed_url = '') {
14
+ if ($feed_url)
15
+ $this->feed_url = $feed_url;
16
+ }
17
+
18
+ /**
19
+ * Get BuddyPress Media Feed from rtCamp.com
20
+ */
21
+ public function fetch_feed() {
22
+ global $bp_media;
23
+ // Get RSS Feed(s)
24
+ require_once( ABSPATH . WPINC . '/feed.php' );
25
+ $maxitems = 0;
26
+ // Get a SimplePie feed object from the specified feed source.
27
+ $rss = fetch_feed($this->feed_url);
28
+ if (!is_wp_error($rss)) { // Checks that the object is created correctly
29
+ // Figure out how many total items there are, but limit it to 5.
30
+ $maxitems = $rss->get_item_quantity(5);
31
+
32
+ // Build an array of all the items, starting with element 0 (first element).
33
+ $rss_items = $rss->get_items(0, $maxitems);
34
+ }
35
+ ?>
36
+ <ul><?php
37
+ if ($maxitems == 0) {
38
+ echo '<li>' . __('No items', BP_MEDIA_TXT_DOMAIN) . '.</li>';
39
+ } else {
40
+ // Loop through each feed item and display each item as a hyperlink.
41
+ foreach ($rss_items as $item) {
42
+ ?>
43
+ <li>
44
+ <a href='<?php echo $item->get_permalink(); ?>' title='<?php echo __('Posted ', BP_MEDIA_TXT_DOMAIN) . $item->get_date('j F Y | g:i a'); ?>'><?php echo $item->get_title(); ?></a>
45
+ </li><?php
46
+ }
47
+ }
48
+ ?>
49
+ </ul><?php
50
+ if (DOING_AJAX) {
51
+ die();
52
+ }
53
+ }
54
+
55
+ }
56
+ ?>
app/helper/BPMediaLog.php ADDED
@@ -0,0 +1,19 @@
1
+ <?php
2
+
3
+ /**
4
+ * Description of BPMediaLog
5
+ *
6
+ * @author Joshua Abenazer <joshua.abenazer@rtcamp.com>
7
+ */
8
+ if (!class_exists('BPMediaLog')) {
9
+
10
+ class BPMediaLog {
11
+
12
+ public function __construct() {
13
+ ;
14
+ }
15
+
16
+ }
17
+
18
+ }
19
+ ?>
app/helper/BPMediaSettings.php ADDED
@@ -0,0 +1,200 @@
1
+ <?php
2
+ /**
3
+ * Description of BPMediaSettings
4
+ *
5
+ * @author Gagandeep Singh <gagandeep.singh@rtcamp.com>
6
+ * @author Joshua Abenazer <joshua.abenazer@rtcamp.com>
7
+ */
8
+ if (!class_exists('BPMediaSettings')) {
9
+
10
+ class BPMediaSettings {
11
+
12
+ public function __construct() {
13
+ add_action('admin_init', array($this, 'settings'));
14
+ }
15
+
16
+ /**
17
+ * Register Settings
18
+ *
19
+ * @global string BP_MEDIA_TXT_DOMAIN
20
+ */
21
+ public function settings() {
22
+ global $bp_media_addon;
23
+ add_settings_section('bpm-settings', __('BuddyPress Media Settings', BP_MEDIA_TXT_DOMAIN), '', 'bp-media-settings');
24
+ add_settings_field('bpm-video', __('Video', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-settings', array(
25
+ 'option' => 'videos_enabled',
26
+ 'desc' => __('Check to enable video upload functionality', BP_MEDIA_TXT_DOMAIN)
27
+ ));
28
+ add_settings_field('bpm-audio', __('Audio', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-settings', array(
29
+ 'option' => 'audio_enabled',
30
+ 'desc' => __('Check to enable audio upload functionality', BP_MEDIA_TXT_DOMAIN)
31
+ ));
32
+ add_settings_field('bpm-image', __('Images', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-settings', array(
33
+ 'option' => 'images_enabled',
34
+ 'desc' => __('Check to enable images upload functionality', BP_MEDIA_TXT_DOMAIN)
35
+ ));
36
+ add_settings_field('bpm-download', __('Download', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-settings', array(
37
+ 'option' => 'download_enabled',
38
+ 'desc' => __('Check to enable download functionality', BP_MEDIA_TXT_DOMAIN)
39
+ ));
40
+ add_settings_section('bpm-spread-the-word', __('Spread the Word', BP_MEDIA_TXT_DOMAIN), '', 'bp-media-settings');
41
+ add_settings_field('bpm-spread-the-word-settings', __('Spread the Word', BP_MEDIA_TXT_DOMAIN), array($this, 'radio'), 'bp-media-settings', 'bpm-spread-the-word', array(
42
+ 'option' => 'remove_linkback',
43
+ 'radios' => array(
44
+ 2 => __('Yes, I support BuddyPress Media', BP_MEDIA_TXT_DOMAIN),
45
+ 1 => __('No, I don\'t want to support BuddyPress Media', BP_MEDIA_TXT_DOMAIN)),
46
+ 'default' => 2)
47
+ );
48
+ add_settings_section('bpm-other', __('BuddyPress Media Other Options', BP_MEDIA_TXT_DOMAIN), '', 'bp-media-settings');
49
+ add_settings_field('bpm-other-settings', __('Re-Count Media Entries', BP_MEDIA_TXT_DOMAIN), array($this, 'button'), 'bp-media-settings', 'bpm-other', array(
50
+ 'option' => 'refresh-count',
51
+ 'name' => 'Re-Count',
52
+ 'desc' => __('It will re-count all media entries of all users and correct any discrepancies.', BP_MEDIA_TXT_DOMAIN)
53
+ ));
54
+ $bp_media_addon = new BPMediaAddon();
55
+ add_settings_section('bpm-addons', __('BuddyPress Media Addons for Audio/Video Conversion', BP_MEDIA_TXT_DOMAIN), array($bp_media_addon, 'get_addons'), 'bp-media-addons');
56
+ add_settings_section('bpm-support', __('Submit a request form', BP_MEDIA_TXT_DOMAIN), '', 'bp-media-support');
57
+ add_settings_field('bpm-request', __('Request Type', BP_MEDIA_TXT_DOMAIN), array($this, 'dropdown'), 'bp-media-support', 'bpm-support', array('option' => 'select-request', 'none' => false, 'values' => array(
58
+ '' => '--Select One--',
59
+ 'premium_support' => 'Premium Support',
60
+ 'new_feature' => 'Suggest a New Feature',
61
+ 'bug_report' => 'Submit a Bug Report')
62
+ ));
63
+ register_setting('bp_media', 'bp_media_options', array($this, 'sanitize'));
64
+ }
65
+
66
+ /**
67
+ * Sanitizes the settings
68
+ */
69
+ public function sanitize($input) {
70
+ global $bp_media_admin;
71
+ if (isset($_POST['refresh-count'])) {
72
+ if ($bp_media_admin->update_count())
73
+ add_settings_error('Recount Success', 'recount-success', __('Recounting of media files done successfully', BP_MEDIA_TXT_DOMAIN), 'updated');
74
+ else
75
+ add_settings_error('Recount Fail', 'recount-fail', __('Recounting Failed', BP_MEDIA_TXT_DOMAIN));
76
+ }
77
+ return $input;
78
+ }
79
+
80
+ /**
81
+ * Output a checkbox
82
+ *
83
+ * @global type $bp_media
84
+ * @param array $args
85
+ */
86
+ public function checkbox($args) {
87
+ global $bp_media;
88
+ $options = $bp_media->options;
89
+ $defaults = array(
90
+ 'option' => '',
91
+ 'desc' => '',
92
+ );
93
+ $args = wp_parse_args($args, $defaults);
94
+ extract($args);
95
+ if (empty($option)) {
96
+ trigger_error(__('Please provide "option" value ( required ) in the argument. Pass argument to add_settings_field in the following format array( \'option\' => \'option_name\' ) ', BP_MEDIA_TXT_DOMAIN));
97
+ return;
98
+ }
99
+ if (!isset($options[$option]))
100
+ $options[$option] = '';
101
+ ?>
102
+ <label for="<?php echo $option; ?>">
103
+ <input<?php checked($options[$option]); ?> name="bp_media_options[<?php echo $option; ?>]" id="<?php echo $option; ?>" value="1" type="checkbox" />
104
+ <?php echo $desc; ?>
105
+ </label><?php
106
+ }
107
+
108
+ /**
109
+ * Outputs Radio Buttons
110
+ *
111
+ * @global type $bp_media
112
+ * @param array $args
113
+ */
114
+ public function radio($args) {
115
+ global $bp_media;
116
+ $options = $bp_media->options;
117
+ $defaults = array(
118
+ 'option' => '',
119
+ 'radios' => array(),
120
+ 'default' => '',
121
+ );
122
+ $args = wp_parse_args($args, $defaults);
123
+ extract($args);
124
+ if (empty($option) || ( 2 > count($radios) )) {
125
+ if (empty($option))
126
+ trigger_error(__('Please provide "option" value ( required ) in the argument. Pass argument to add_settings_field in the following format array( \'option\' => \'option_name\' )', BP_MEDIA_TXT_DOMAIN));
127
+ if (2 > count($radios))
128
+ trigger_error(__('Need to specify atleast to radios else use a checkbox instead', BP_MEDIA_TXT_DOMAIN));
129
+ return;
130
+ }
131
+ if (empty($options[$option])) {
132
+ $options[$option] = $defaults;
133
+ }
134
+ foreach ($radios as $value => $desc) {
135
+ ?>
136
+ <label for="<?php echo sanitize_title($desc); ?>"><input<?php checked($options[$option], $value); ?> value='<?php echo $value; ?>' name='bp_media_options[<?php echo $option; ?>]' id="<?php echo sanitize_title($desc); ?>" type='radio' /><?php echo $desc; ?></label><br /><?php
137
+ }
138
+ }
139
+
140
+ /**
141
+ * Outputs Dropdown
142
+ *
143
+ * @global type $bp_media
144
+ * @param array $args
145
+ */
146
+ public function dropdown($args) {
147
+ $defaults = array(
148
+ 'option' => '',
149
+ 'none' => true,
150
+ 'values' => ''
151
+ );
152
+ $args = wp_parse_args($args, $defaults);
153
+ extract($args);
154
+ if (empty($option) || empty($values)) {
155
+ if (empty($option))
156
+ trigger_error(__('Please provide "option" value ( required ) in the argument. Pass argument to add_settings_field in the following format array( \'option\' => \'option_name\' )', BP_MEDIA_TXT_DOMAIN));
157
+ if (empty($values))
158
+ trigger_error(__('Please provide some values to populate the dropdown. Format : array( \'value\' => \'option\' )', BP_MEDIA_TXT_DOMAIN));
159
+ return;
160
+ }
161
+ ?>
162
+ <select name="<?php echo $option; ?>" id="<?php echo $option; ?>"><?php if ($none) { ?>
163
+ <option><?php __e('None', BP_MEDIA_TXT_DOMAIN); ?></option><?php
164
+ }
165
+ foreach ($values as $value => $text) {
166
+ ?>
167
+ <option value="<?php echo $value; ?>"><?php echo $text; ?></option><?php }
168
+ ?>
169
+ </select><?php
170
+ }
171
+
172
+ /**
173
+ * Outputs a Button
174
+ *
175
+ * @global type $bp_media
176
+ * @param array $args
177
+ */
178
+ public function button($args) {
179
+ $defaults = array(
180
+ 'option' => '',
181
+ 'name' => 'Save Changes',
182
+ 'desc' => '',
183
+ );
184
+ $args = wp_parse_args($args, $defaults);
185
+ extract($args);
186
+ if (empty($option)) {
187
+ trigger_error('Please provide "option" value ( Required ) in the argument. Pass argument to add_settings_field in the following format array( \'option\' => \'option_name\', \'link\' => \'linkurl\' )');
188
+ return;
189
+ }
190
+ submit_button($name, '', $option, false);
191
+ if (!empty($desc)) {
192
+ ?>
193
+ <span class="description"><?php echo $desc; ?></a><?php
194
+ }
195
+ }
196
+
197
+ }
198
+
199
+ }
200
+ ?>
app/helper/BPMediaSupport.php ADDED
@@ -0,0 +1,186 @@
1
+ <?php
2
+ /**
3
+ * Description of BPMediaSupport
4
+ *
5
+ * @author Gagandeep Singh <gagandeep.singh@rtcamp.com>
6
+ * @author Joshua Abenazer <joshua.abenazer@rtcamp.com>
7
+ */
8
+ if (!class_exists('BPMediaSupport')) {
9
+
10
+ class BPMediaSupport {
11
+
12
+ public function __construct() {
13
+ ;
14
+ }
15
+
16
+ public function get_form($form) {
17
+ if (empty($form))
18
+ $form = (isset($_POST['form'])) ? $_POST['form'] : '';
19
+
20
+ global $current_user;
21
+ switch ($form) {
22
+ case "bug_report":
23
+ $meta_title = __('Submit a Bug Report', BP_MEDIA_TXT_DOMAIN);
24
+ break;
25
+ case "new_feature":
26
+ $meta_title = __('Submit a New Feature Request', BP_MEDIA_TXT_DOMAIN);
27
+ break;
28
+ case "premium_support":
29
+ $meta_title = __('Submit a Premium Support Request', BP_MEDIA_TXT_DOMAIN);
30
+ break;
31
+ }
32
+ ?>
33
+ <h3><?php echo $meta_title; ?></h3>
34
+ <div id="support-form" class="bp-media-form">
35
+ <ul>
36
+ <li>
37
+ <label class="bp-media-label" for="name"><?php _e('Name', BP_MEDIA_TXT_DOMAIN); ?>:</label><input class="bp-media-input" id="name" type="text" name="name" value="<?php echo (isset($_REQUEST['name'])) ? esc_attr(stripslashes(trim($_REQUEST['name']))) : $current_user->display_name; ?>" required />
38
+ </li>
39
+ <li>
40
+ <label class="bp-media-label" for="email"><?php _e('Email', BP_MEDIA_TXT_DOMAIN); ?>:</label><input id="email" class="bp-media-input" type="text" name="email" value="<?php echo (isset($_REQUEST['email'])) ? esc_attr(stripslashes(trim($_REQUEST['email']))) : get_option('admin_email'); ?>" required />
41
+ </li>
42
+ <li>
43
+ <label class="bp-media-label" for="website"><?php _e('Website', BP_MEDIA_TXT_DOMAIN); ?>:</label><input id="website" class="bp-media-input" type="text" name="website" value="<?php echo (isset($_REQUEST['website'])) ? esc_attr(stripslashes(trim($_REQUEST['website']))) : get_bloginfo('url'); ?>" required />
44
+ </li>
45
+ <li>
46
+ <label class="bp-media-label" for="phone"><?php _e('Phone', BP_MEDIA_TXT_DOMAIN); ?>:</label><input class="bp-media-input" id="phone" type="text" name="phone" value="<?php echo (isset($_REQUEST['phone'])) ? esc_attr(stripslashes(trim($_REQUEST['phone']))) : ''; ?>"/>
47
+ </li>
48
+ <li>
49
+ <label class="bp-media-label" for="subject"><?php _e('Subject', BP_MEDIA_TXT_DOMAIN); ?>:</label><input id="subject" class="bp-media-input" type="text" name="subject" value="<?php echo (isset($_REQUEST['subject'])) ? esc_attr(stripslashes(trim($_REQUEST['subject']))) : ''; ?>" required />
50
+ </li>
51
+ <li>
52
+ <label class="bp-media-label" for="details"><?php _e('Details', BP_MEDIA_TXT_DOMAIN); ?>:</label><textarea id="details" class="bp-media-textarea" type="text" name="details" required/><?php echo (isset($_REQUEST['details'])) ? esc_textarea(stripslashes(trim($_REQUEST['details']))) : ''; ?></textarea>
53
+ </li>
54
+ <input type="hidden" name="request_type" value="<?php echo $form; ?>"/>
55
+ <input type="hidden" name="request_id" value="<?php echo wp_create_nonce(date('YmdHis')); ?>"/>
56
+ <input type="hidden" name="server_address" value="<?php echo $_SERVER['SERVER_ADDR']; ?>"/>
57
+ <input type="hidden" name="ip_address" value="<?php echo $_SERVER['REMOTE_ADDR']; ?>"/>
58
+ <input type="hidden" name="server_type" value="<?php echo $_SERVER['SERVER_SOFTWARE']; ?>"/>
59
+ <input type="hidden" name="user_agent" value="<?php echo $_SERVER['HTTP_USER_AGENT']; ?>"/>
60
+
61
+ </ul>
62
+ </div><!-- .submit-bug-box --><?php if ($form == 'bug_report') { ?>
63
+ <h3>Additional Information</h3>
64
+ <div id="support-form" class="bp-media-form">
65
+ <ul>
66
+
67
+ <li>
68
+ <label class="bp-media-label" for="wp_admin_username"><?php _e('Your WP Admin Login:', BP_MEDIA_TXT_DOMAIN); ?></label><input class="bp-media-input" id="wp_admin_username" type="text" name="wp_admin_username" value="<?php echo (isset($_REQUEST['wp_admin_username'])) ? esc_attr(stripslashes(trim($_REQUEST['wp_admin_username']))) : $current_user->user_login; ?>"/>
69
+ </li>
70
+ <li>
71
+ <label class="bp-media-label" for="wp_admin_pwd"><?php _e('Your WP Admin password:', BP_MEDIA_TXT_DOMAIN); ?></label><input class="bp-media-input" id="wp_admin_pwd" type="password" name="wp_admin_pwd" value="<?php echo (isset($_REQUEST['wp_admin_pwd'])) ? esc_attr(stripslashes(trim($_REQUEST['wp_admin_pwd']))) : ''; ?>"/>
72
+ </li>
73
+ <li>
74
+ <label class="bp-media-label" for="ssh_ftp_host"><?php _e('Your SSH / FTP host:', BP_MEDIA_TXT_DOMAIN); ?></label><input class="bp-media-input" id="ssh_ftp_host" type="text" name="ssh_ftp_host" value="<?php echo (isset($_REQUEST['ssh_ftp_host'])) ? esc_attr(stripslashes(trim($_REQUEST['ssh_ftp_host']))) : ''; ?>"/>
75
+ </li>
76
+ <li>
77
+ <label class="bp-media-label" for="ssh_ftp_username"><?php _e('Your SSH / FTP login:', BP_MEDIA_TXT_DOMAIN); ?></label><input class="bp-media-input" id="ssh_ftp_username" type="text" name="ssh_ftp_username" value="<?php echo (isset($_REQUEST['ssh_ftp_username'])) ? esc_attr(stripslashes(trim($_REQUEST['ssh_ftp_username']))) : ''; ?>"/>
78
+ </li>
79
+ <li>
80
+ <label class="bp-media-label" for="ssh_ftp_pwd"><?php _e('Your SSH / FTP password:', BP_MEDIA_TXT_DOMAIN); ?></label><input class="bp-media-input" id="ssh_ftp_pwd" type="password" name="ssh_ftp_pwd" value="<?php echo (isset($_REQUEST['ssh_ftp_pwd'])) ? esc_attr(stripslashes(trim($_REQUEST['ssh_ftp_pwd']))) : ''; ?>"/>
81
+ </li>
82
+ </ul>
83
+ </div><!-- .submit-bug-box --><?php } ?>
84
+
85
+ <?php submit_button('Submit', 'primary', 'submit-request', false); ?>
86
+ <?php submit_button('Cancel', 'secondary', 'cancel-request', false); ?>
87
+
88
+ <?php
89
+ if (DOING_AJAX) {
90
+ die();
91
+ }
92
+ }
93
+
94
+ public function submit_request() {
95
+ global $bp_media;
96
+ $form_data = wp_parse_args($_POST['form_data']);
97
+ if ($form_data['request_type'] == 'premium_support') {
98
+ $title = __('BuddyPress Media Premium Support Request from', BP_MEDIA_TXT_DOMAIN);
99
+ } elseif ($form_data['request_type'] == 'new_feature') {
100
+ $title = __('BuddyPress Media New Feature Request from', BP_MEDIA_TXT_DOMAIN);
101
+ } elseif ($form_data['request_type'] == 'bug_report') {
102
+ $title = __('BuddyPress Media Bug Report from', BP_MEDIA_TXT_DOMAIN);
103
+ } else {
104
+ $title = __('BuddyPress Media Contact from', BP_MEDIA_TXT_DOMAIN);
105
+ }
106
+ $message = '<html>
107
+ <head>
108
+ <title>' . $title . get_bloginfo('name') . '</title>
109
+ </head>
110
+ <body>
111
+ <table>
112
+ <tr>
113
+ <td>' . __("Name", BP_MEDIA_TXT_DOMAIN) . '</td><td>' . strip_tags($form_data['name']) . '</td>
114
+ </tr>
115
+ <tr>
116
+ <td>' . __("Email", BP_MEDIA_TXT_DOMAIN) . '</td><td>' . strip_tags($form_data['email']) . '</td>
117
+ </tr>
118
+ <tr>
119
+ <td>' . __("Website", BP_MEDIA_TXT_DOMAIN) . '</td><td>' . strip_tags($form_data['website']) . '</td>
120
+ </tr>
121
+ <tr>
122
+ <td>' . __("Phone", BP_MEDIA_TXT_DOMAIN) . '</td><td>' . strip_tags($form_data['phone']) . '</td>
123
+ </tr>
124
+ <tr>
125
+ <td>' . __("Subject", BP_MEDIA_TXT_DOMAIN) . '</td><td>' . strip_tags($form_data['subject']) . '</td>
126
+ </tr>
127
+ <tr>
128
+ <td>' . __("Details", BP_MEDIA_TXT_DOMAIN) . '</td><td>' . strip_tags($form_data['details']) . '</td>
129
+ </tr>
130
+ <tr>
131
+ <td>' . __("Request ID", BP_MEDIA_TXT_DOMAIN) . '</td><td>' . strip_tags($form_data['request_id']) . '</td>
132
+ </tr>
133
+ <tr>
134
+ <td>' . __("Server Address", BP_MEDIA_TXT_DOMAIN) . '</td><td>' . strip_tags($form_data['server_address']) . '</td>
135
+ </tr>
136
+ <tr>
137
+ <td>' . __("IP Address", BP_MEDIA_TXT_DOMAIN) . '</td><td>' . strip_tags($form_data['ip_address']) . '</td>
138
+ </tr>
139
+ <tr>
140
+ <td>' . __("Server Type", BP_MEDIA_TXT_DOMAIN) . '</td><td>' . strip_tags($form_data['server_type']) . '</td>
141
+ </tr>
142
+ <tr>
143
+ <td>' . __("User Agent", BP_MEDIA_TXT_DOMAIN) . '</td><td>' . strip_tags($form_data['user_agent']) . '</td>
144
+ </tr>';
145
+ if ($form_data['request_type'] == 'bug_report') {
146
+ $message .= '<tr>
147
+ <td>' . __("WordPress Admin Username", BP_MEDIA_TXT_DOMAIN) . '</td><td>' . strip_tags($form_data['wp_admin_username']) . '</td>
148
+ </tr>
149
+ <tr>
150
+ <td>' . __("WordPress Admin Password", BP_MEDIA_TXT_DOMAIN) . '</td><td>' . strip_tags($form_data['wp_admin_pwd']) . '</td>
151
+ </tr>
152
+ <tr>
153
+ <td>' . __("SSH FTP Host", BP_MEDIA_TXT_DOMAIN) . '</td><td>' . strip_tags($form_data['ssh_ftp_host']) . '</td>
154
+ </tr>
155
+ <tr>
156
+ <td>' . __("SSH FTP Username", BP_MEDIA_TXT_DOMAIN) . '</td><td>' . strip_tags($form_data['ssh_ftp_username']) . '</td>
157
+ </tr>
158
+ <tr>
159
+ <td>' . __("SSH FTP Password", BP_MEDIA_TXT_DOMAIN) . '</td><td>' . strip_tags($form_data['ssh_ftp_pwd']) . '</td>
160
+ </tr>
161
+ ';
162
+ }
163
+ $message .= '</table>
164
+ </body>
165
+ </html>';
166
+ add_filter('wp_mail_content_type', create_function('', 'return "text/html";'));
167
+ $headers = 'From: ' . $form_data['name'] . ' <' . $form_data['email'] . '>' . "\r\n";
168
+ if (wp_mail($bp_media->support_email, '[buddypress-media] Bug Report | Premium Support from '.str_replace( array('http://', 'https://'), '', $form_data['website']), $message, $headers)) {
169
+ if ($form_data['request_type'] == 'new_feature') {
170
+ echo '<p>' . __('Thank you for your Feedback/Suggestion.', BP_MEDIA_TXT_DOMAIN) . '</p>';
171
+ } else {
172
+ echo '<p>' . __('Thank you for posting your support request.', BP_MEDIA_TXT_DOMAIN) . '</p>';
173
+ echo '<p>' . __('We will get back to you shortly.', BP_MEDIA_TXT_DOMAIN) . '</p>';
174
+ }
175
+ } else {
176
+ echo '<p>' . __('Your server failed to send an email.', BP_MEDIA_TXT_DOMAIN) . '</p>';
177
+ echo '<p>' . __('Kindly contact your server support to fix this.', BP_MEDIA_TXT_DOMAIN) . '</p>';
178
+ echo '<p>' . sprintf(__('You can alternatively create a support request <a href="%s">here</a>', BP_MEDIA_TXT_DOMAIN), $bp_media->support_url) . '</p>';
179
+ }
180
+ die();
181
+ }
182
+
183
+ }
184
+
185
+ }
186
+ ?>
app/helper/BPMediaUpgrade.php ADDED
@@ -0,0 +1,174 @@
1
+ <?php
2
+ /**
3
+ * Description of BPMediaUpgrade
4
+ *
5
+ * @author Gagandeep Singh <gagandeep.singh@rtcamp.com>
6
+ * @author Joshua Abenazer <joshua.abenazer@rtcamp.com>
7
+ */
8
+ if (!class_exists('BPMediaUpgrade')) {
9
+
10
+ class BPMediaUpgrade {
11
+
12
+ public function __construct() {
13
+ if (is_admin()) {
14
+ if (version_compare(BP_MEDIA_DB_VERSION, get_site_option('bp_media_db_version', '1.0'), '>')) {
15
+ add_action('admin_notices', array($this, 'upgrade_db'));
16
+ }
17
+ add_action('wp_loaded', array($this, 'upgrade'));
18
+ }
19
+ }
20
+
21
+ /**
22
+ * Displays admin notice to upgrade BuddyPress Media Database
23
+ *
24
+ * @global string BP_MEDIA_TXT_DOMAIN
25
+ */
26
+ public function upgrade_db() {
27
+ global $bp_media;
28
+ ?>
29
+ <div class="error"><p><?php
30
+ printf(__('Please click upgrade to upgrade the database of BuddyPress Media <a class="button" id="refresh_media_count" href ="%s" class="button" title="It will migrate your BuddyPress Media\'s earlier database to new database.">Upgrade</a>', BP_MEDIA_TXT_DOMAIN), bp_media_get_admin_url(add_query_arg(array('page' => 'bp-media-settings', 'bp_media_upgrade_db' => 1, 'wp_nonce' => wp_create_nonce('bp_media_upgrade_db')), 'admin.php')))
31
+ ?>
32
+ </p></div>
33
+ <?php
34
+ }
35
+
36
+ /**
37
+ * Upgrade Script
38
+ */
39
+ public function upgrade() {
40
+ if (isset($_GET['bp_media_upgrade_db']) && empty($_REQUEST['settings-updated'])) {
41
+ check_admin_referer('bp_media_upgrade_db', 'wp_nonce');
42
+ require_once('bp-media-upgrade-script.php');
43
+ $current_version = get_site_option('bp_media_db_version', '1.0');
44
+ if ($current_version == '2.0')
45
+ $this->upgrade_2_0_to_2_1();
46
+ else
47
+ $this->upgrade_1_0_to_2_1();
48
+ remove_action('admin_notices', 'upgrade_db');
49
+ }
50
+ }
51
+
52
+ /**
53
+ * Upgrade from BuddyPress Media 1.0 to 2.1
54
+ * @global wpdb $wpdb
55
+ * @global string BP_MEDIA_TXT_DOMAIN
56
+ */
57
+ public function upgrade_1_0_to_2_1() {
58
+ global $wpdb, $bp_media;
59
+ remove_filter('bp_activity_get_user_join_filter', 'activity_query_filter', 10);
60
+ /* @var $wpdb wpdb */
61
+ $wall_posts_album_ids = array();
62
+ do {
63
+ $media_files = new WP_Query(array(
64
+ 'post_type' => 'bp_media',
65
+ 'posts_per_page' => 10
66
+ ));
67
+ $media_files = isset($media_files->posts) ? $media_files->posts : null;
68
+ if (is_array($media_files) && count($media_files)) {
69
+ foreach ($media_files as $media_file) {
70
+ $attachment_id = get_post_meta($media_file->ID, 'bp_media_child_attachment', true);
71
+ $child_activity = get_post_meta($media_file->ID, 'bp_media_child_activity', true);
72
+ update_post_meta($attachment_id, 'bp_media_child_activity', $child_activity);
73
+ $attachment = get_post($attachment_id, ARRAY_A);
74
+ if (isset($wall_posts_album_ids[$media_file->post_author])) {
75
+ $wall_posts_id = $wall_posts_album_ids[$media_file->post_author];
76
+ } else {
77
+ $wall_posts_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = 'Wall Posts' AND post_author = '" . $media_file->post_author . "' AND post_type='bp_media_album'");
78
+ if ($wall_posts_id == null) {
79
+ $album = new BPMediaAlbum();
80
+ $album->add_album('Wall Posts', $media_file->post_author);
81
+ $wall_posts_id = $album->get_id();
82
+ }
83
+ if (!$wall_posts_id) {
84
+ continue; //This condition should never be encountered
85
+ }
86
+ $wall_posts_album_ids[$media_file->post_author] = $wall_posts_id;
87
+ }
88
+ $attachment['post_parent'] = $wall_posts_id;
89
+ wp_update_post($attachment);
90
+ update_post_meta($attachment_id, 'bp-media-key', $media_file->post_author);
91
+ $activity = bp_activity_get(array('in' => intval($child_activity)));
92
+ if (isset($activity['activities'][0]->id))
93
+ $activity = $activity['activities'][0];
94
+ try {
95
+ $bp_media = new BPMediaHostWordpress($attachment_id);
96
+ } catch (exception $e) {
97
+ continue;
98
+ }
99
+ $args = array(
100
+ 'content' => $bp_media->get_media_activity_content(),
101
+ 'id' => $child_activity,
102
+ 'type' => 'media_upload',
103
+ 'action' => apply_filters('bp_media_added_media', sprintf(__('%1$s added a %2$s', BP_MEDIA_TXT_DOMAIN), bp_core_get_userlink($media_file->post_author), '<a href="' . $bp_media->get_url() . '">' . $bp_media->get_media_activity_type() . '</a>')),
104
+ 'primary_link' => $bp_media->get_url(),
105
+ 'item_id' => $attachment_id,
106
+ 'recorded_time' => $activity->date_recorded,
107
+ 'user_id' => $bp_media->get_author()
108
+ );
109
+ $act_id = BPMediaFunction::record_activity($args);
110
+ bp_activity_delete_meta($child_activity, 'bp_media_parent_post');
111
+ wp_delete_post($media_file->ID);
112
+ }
113
+ } else {
114
+ break;
115
+ }
116
+ } while (1);
117
+ update_site_option('bp_media_db_version', BP_MEDIA_DB_VERSION);
118
+ add_action('admin_notices', 'BPMediaUpgradeScript::database_updated_notice');
119
+ wp_cache_flush();
120
+ }
121
+
122
+ /**
123
+ * Upgrade from BuddyPress Media 2.0 to 2.1
124
+ *
125
+ * @global string BP_MEDIA_TXT_DOMAIN
126
+ */
127
+ public function upgrade_2_0_to_2_1() {
128
+ global $bp_media;
129
+ $page = 0;
130
+ while ($media_entries = BPMediaUpgradeScript::return_query_posts(array(
131
+ 'post_type' => 'attachment',
132
+ 'post_status' => 'any',
133
+ 'meta_key' => 'bp-media-key',
134
+ 'meta_value' => 0,
135
+ 'meta_compare' => '>',
136
+ 'paged' => ++$page,
137
+ 'postsperpage' => 10
138
+ ))) {
139
+ foreach ($media_entries as $media) {
140
+ try {
141
+ $bp_media = new BPMediaHostWordpress($media->ID);
142
+ } catch (exception $e) {
143
+ continue;
144
+ }
145
+ $child_activity = get_post_meta($media->ID, 'bp_media_child_activity', true);
146
+ if ($child_activity) {
147
+ $activity = bp_activity_get(array('in' => intval($child_activity)));
148
+ if (isset($activity['activities'][0]->id))
149
+ $activity = $activity['activities'][0];
150
+ else
151
+ continue;
152
+ $args = array(
153
+ 'content' => $bp_media->get_media_activity_content(),
154
+ 'id' => $child_activity,
155
+ 'type' => 'media_upload',
156
+ 'action' => apply_filters('bp_media_added_media', sprintf(__('%1$s added a %2$s', BP_MEDIA_TXT_DOMAIN), bp_core_get_userlink($bp_media->get_author()), '<a href="' . $bp_media->get_url() . '">' . $bp_media->get_media_activity_type() . '</a>')),
157
+ 'primary_link' => $bp_media->get_url(),
158
+ 'item_id' => $activity->item_id,
159
+ 'recorded_time' => $activity->date_recorded,
160
+ 'user_id' => $bp_media->get_author()
161
+ );
162
+ BPMediaFunction::record_activity($args);
163
+ }
164
+ }
165
+ }
166
+ update_site_option('bp_media_db_version', BP_MEDIA_DB_VERSION);
167
+ add_action('admin_notices', 'BPMediaUpgradeScript::database_updated_notice');
168
+ wp_cache_flush();
169
+ }
170
+
171
+ }
172
+
173
+ }
174
+ ?>
app/helper/BPMediaWidget.php ADDED
@@ -0,0 +1,29 @@
1
+ <?php
2
+ /**
3
+ * Description of BPMediaWidget
4
+ *
5
+ * @author Gagandeep Singh <gagandeep.singh@rtcamp.com>
6
+ * @author Joshua Abenazer <joshua.abenazer@rtcamp.com>
7
+ */
8
+ if (!class_exists('BPMediaWidget')) {
9
+
10
+ class BPMediaWidget {
11
+
12
+ public function __construct($id = NULL, $title = NULL, $content = NULL) {
13
+ global $bp_media;
14
+ if ($id) {
15
+ ?>
16
+ <div class="postbox" id="<?php echo $id; ?>"><?php if ($title) { ?>
17
+ <h3 class="hndle"><span><?php echo $title; ?></span></h3><?php }
18
+ ?>
19
+ <div class="inside"><?php echo $content; ?></div>
20
+ </div><?php
21
+ } else {
22
+ trigger_error(__('Argument missing. id is required.', BP_MEDIA_TXT_DOMAIN));
23
+ }
24
+ }
25
+
26
+ }
27
+
28
+ }
29
+ ?>
app/main/BPMediaLoader.php ADDED
@@ -0,0 +1,72 @@
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) )
4
+ exit;
5
+
6
+ /**
7
+ * Description of BPMediaLoader
8
+ *
9
+ * @author Saurabh Shukla <saurabh.shukla@rtcamp.com>
10
+ * @author Gagandeep Singh <gagandeep.singh@rtcamp.com>
11
+ */
12
+ class BPMediaLoader {
13
+
14
+ public function __construct() {
15
+ add_action( 'bp_loaded', array( $this, 'load_component' ) );
16
+ add_action( 'bp_setup_nav', array( $this, 'custom_nav' ), 999 );
17
+ add_action( 'after_setup_theme', array( $this, 'thumbnail' ) );
18
+ }
19
+
20
+ public function load_component() {
21
+ global $bp;
22
+ $bp->{BP_MEDIA_SLUG} = new BPMediaComponent();
23
+ }
24
+
25
+ public function custom_nav() {
26
+ global $bp;
27
+ foreach ( $bp->bp_nav as $key => $nav_item ) {
28
+ switch ( $nav_item[ 'slug' ] ) {
29
+ case BP_MEDIA_IMAGES_SLUG:
30
+ case BP_MEDIA_VIDEOS_SLUG:
31
+ case BP_MEDIA_AUDIO_SLUG:
32
+ case BP_MEDIA_ALBUMS_SLUG:
33
+ $bp->bp_options_nav[ BP_MEDIA_SLUG ][ ] = array(
34
+ 'name' => $nav_item[ 'name' ],
35
+ 'link' => (isset( $bp->displayed_user->domain ) ? $bp->displayed_user->domain : (isset( $bp->loggedin_user->domain ) ? $bp->loggedin_user->domain : '')) . $nav_item[ 'slug' ] . '/',
36
+ 'slug' => $nav_item[ 'slug' ],
37
+ 'css_id' => $nav_item[ 'css_id' ],
38
+ 'position' => $nav_item[ 'position' ],
39
+ 'screen_function' => $nav_item[ 'screen_function' ],
40
+ 'user_has_access' => true,
41
+ 'parent_url' => trailingslashit( bp_displayed_user_domain() )
42
+ );
43
+ unset( $bp->bp_nav[ $key ] );
44
+ }
45
+ switch ( $bp->current_component ) {
46
+ case BP_MEDIA_IMAGES_SLUG:
47
+ case BP_MEDIA_VIDEOS_SLUG:
48
+ case BP_MEDIA_AUDIO_SLUG:
49
+ case BP_MEDIA_ALBUMS_SLUG:
50
+ $count = count( $bp->action_variables );
51
+ for ( $i = $count; $i > 0; $i -- ) {
52
+ $bp->action_variables[ $i ] = $bp->action_variables[ $i - 1 ];
53
+ }
54
+ $bp->action_variables[ 0 ] = $bp->current_action;
55
+ $bp->current_action = $bp->current_component;
56
+ $bp->current_component = BP_MEDIA_SLUG;
57
+ }
58
+ }
59
+ }
60
+
61
+ public function thumbnail() {
62
+ global $bp_media;
63
+
64
+ $default_sizes = $bp_media->media_sizes();
65
+
66
+ add_image_size( 'bp_media_activity_image', $default_sizes[ 'activity_image' ][ 'width' ], $default_sizes[ 'activity_image' ][ 'height' ], true );
67
+ add_image_size( 'bp_media_single_image', $default_sizes[ 'single_image' ][ 'width' ], $default_sizes[ 'single_image' ][ 'height' ], true );
68
+ }
69
+
70
+ }
71
+
72
+ ?>
app/main/BuddyPressMedia.php ADDED
<
@@ -0,0 +1,296 @@