Version Description
- Improved template system
- Fixed bug with audio/video uploads
- Fixed bug with featured media
- Fixed activity duplication issue
- Other minor bug fixes
Download this release
Release Info
Developer | saurabhshukla |
Plugin | rtMedia for WordPress, BuddyPress and bbPress |
Version | 3.0.3 |
Comparing to | |
See all releases |
Code changes from version 3.0.2 to 3.0.3
- CONTRIBUTING.md +19 -0
- app/admin/RTMediaAdmin.php +454 -428
- app/assets/js/admin.js +10 -5
- app/assets/js/rtMedia.backbone.js +2 -1
- app/importers/RTMediaMigration.php +2 -1
- app/main/controllers/media/RTMediaUserInteraction.php +4 -4
- app/main/controllers/shortcodes/RTMediaGalleryShortcode.php +8 -1
- app/main/controllers/template/RTMediaTemplate.php +98 -79
- app/main/controllers/template/rt-template-functions.php +8 -2
- app/main/controllers/upload/RTMediaUploadEndpoint.php +15 -2
- app/main/controllers/upload/RTMediaUploadView.php +5 -5
- app/main/routers/query/RTMediaQuery.php +6 -2
- index.php +1 -1
- readme.txt +10 -3
- templates/main.php +168 -0
- templates/media/album-gallery.php +18 -6
CONTRIBUTING.md
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Contribute to rtMedia
|
2 |
+
|
3 |
+
This guide details how to use issues and pull requests to improve rtMedia.
|
4 |
+
|
5 |
+
## Closing policy for issues
|
6 |
+
|
7 |
+
Github issue-tracker is used **only** for developer & contributor discussion.
|
8 |
+
|
9 |
+
For support-request/feature-request, please use - http://rtcamp.com/rtmedia/support/
|
10 |
+
|
11 |
+
## Translation
|
12 |
+
|
13 |
+
Please do NOT send pull-request for translations.
|
14 |
+
|
15 |
+
You can contribute transaltions using web-interface here - http://rtcamp.com/translate/projects/rtmedia
|
16 |
+
|
17 |
+
## Pull Requests
|
18 |
+
|
19 |
+
Please inclued your wordpress.org username while sending pull-request so that we can add you to contributors list.
|
app/admin/RTMediaAdmin.php
CHANGED
@@ -17,13 +17,14 @@ if (!class_exists('RTMediaAdmin')) {
|
|
17 |
public $rtmedia_feed;
|
18 |
|
19 |
public function __construct() {
|
|
|
20 |
add_action('init', array($this, 'video_transcoding_survey_response'));
|
21 |
if (is_multisite()) {
|
22 |
add_action('network_admin_notices', array($this, 'upload_filetypes_error'));
|
23 |
add_action('admin_notices', array($this, 'upload_filetypes_error'));
|
24 |
}
|
25 |
$rtmedia_feed = new RTMediaFeed();
|
26 |
-
add_filter(
|
27 |
add_action('wp_ajax_rtmedia_fetch_feed', array($rtmedia_feed, 'fetch_feed'), 1);
|
28 |
$this->rtmedia_support = new RTMediaSupport();
|
29 |
add_action('wp_ajax_rtmedia_select_request', array($this->rtmedia_support, 'get_form'), 1);
|
@@ -39,18 +40,19 @@ if (!class_exists('RTMediaAdmin')) {
|
|
39 |
add_action('wp_ajax_rtmedia_convert_videos_form', array($this, 'convert_videos_mailchimp_send'), 1);
|
40 |
add_action('wp_ajax_rtmedia_correct_upload_filetypes', array($this, 'correct_upload_filetypes'), 1);
|
41 |
add_filter('plugin_row_meta', array($this, 'plugin_meta_premium_addon_link'), 1, 4);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
if (is_admin()) {
|
43 |
add_action('admin_enqueue_scripts', array($this, 'ui'));
|
44 |
//bp_core_admin_hook();
|
45 |
-
add_action('admin_menu', array($this, 'menu'),1);
|
46 |
-
|
47 |
-
if (isset($_POST["rtmedia-options"])){
|
48 |
-
if(isset($_POST["rtmedia-options"]["general_showAdminMenu"]) && $_POST["rtmedia-options"]["general_showAdminMenu"] == "1")
|
49 |
-
add_action('admin_bar_menu', array($this, 'admin_bar_menu'),100,1);
|
50 |
-
}else if(intval($rtmedia->options["general_showAdminMenu"]) == 1){
|
51 |
-
add_action('admin_bar_menu', array($this, 'admin_bar_menu'),100,1);
|
52 |
-
}
|
53 |
-
|
54 |
if (current_user_can('manage_options'))
|
55 |
add_action('bp_admin_tabs', array($this, 'tab'));
|
56 |
if (is_multisite())
|
@@ -59,101 +61,124 @@ if (!class_exists('RTMediaAdmin')) {
|
|
59 |
$this->rtmedia_settings = new RTMediaSettings();
|
60 |
$this->rtmedia_encoding = new RTMediaEncoding();
|
61 |
}
|
62 |
-
|
|
|
63 |
$settings_link = '<a href="' . admin_url('admin.php?page=rtmedia-settings') . '">Settings</a>';
|
64 |
-
array_push(
|
65 |
$settings_link = '<a href="' . admin_url('admin.php?page=rtmedia-support') . '">Support</a>';
|
66 |
-
array_push(
|
67 |
return $links;
|
68 |
}
|
69 |
|
|
|
|
|
|
|
70 |
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
'title' => __('rtMedia'),
|
78 |
-
),
|
79 |
-
));
|
80 |
-
$admin_bar->add_menu( array(
|
81 |
-
'id' => 'rt-media-dashborad',
|
82 |
-
'parent' => 'rtMedia',
|
83 |
-
'title' => __('Settings',"rtmedia"),
|
84 |
-
'href' => admin_url('admin.php?page=rtmedia-settings'),
|
85 |
-
'meta' => array(
|
86 |
-
'title' => __('Settings'),
|
87 |
-
'target' => '_self',
|
88 |
),
|
89 |
-
|
90 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
}
|
|
|
92 |
/**
|
93 |
* Generates the Admin UI.
|
94 |
*
|
95 |
* @param string $hook
|
96 |
*/
|
97 |
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
add_menu_page('rtMedia', 'rtMedia', 'manage_options', 'rtmedia-settings', array($this, 'settings_page'));
|
158 |
add_submenu_page('rtmedia-settings', __('Settings', 'rtmedia'), __('Settings', 'rtmedia'), 'manage_options', 'rtmedia-settings', array($this, 'settings_page'));
|
159 |
add_submenu_page('rtmedia-settings', __('Addons', 'rtmedia'), __('Addons', 'rtmedia'), 'manage_options', 'rtmedia-addons', array($this, 'addons_page'));
|
@@ -162,7 +187,7 @@ if (!class_exists('RTMediaAdmin')) {
|
|
162 |
// if (!BPMediaPrivacy::is_installed()) {
|
163 |
// add_submenu_page('rtmedia-settings', __('rtMedia Database Update', 'rtmedia'), __('Update Database', 'rtmedia'), 'manage_options', 'rtmedia-db-update', array($this, 'privacy_page'));
|
164 |
// }
|
165 |
-
|
166 |
|
167 |
/**
|
168 |
* Render the BuddyPress Media Settings page
|
@@ -219,241 +244,242 @@ if (!class_exists('RTMediaAdmin')) {
|
|
219 |
public function render_page($page, $option_group = NULL) {
|
220 |
?>
|
221 |
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
|
|
291 |
|
292 |
// Check to see which tab we are on
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
// array(
|
333 |
// 'href' => get_admin_url(null, add_query_arg(array('page' => 'rtmedia-importer'), 'admin.php')),
|
334 |
// 'name' => __('Importer', 'rtmedia'),
|
335 |
// 'slug' => 'rtmedia-importer'
|
336 |
// )
|
337 |
-
|
338 |
|
339 |
-
|
340 |
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
|
348 |
-
|
349 |
-
|
350 |
|
351 |
// // Do other fun things
|
352 |
// do_action('bp_media_admin_tabs');
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
p.post_author,pmp.meta_value,
|
458 |
SUM(CASE WHEN post_mime_type LIKE 'image%' THEN 1 ELSE 0 END) as Images,
|
459 |
SUM(CASE WHEN post_mime_type LIKE 'music%' THEN 1 ELSE 0 END) as Music,
|
@@ -467,66 +493,66 @@ if (!class_exists('RTMediaAdmin')) {
|
|
467 |
pmp.meta_key = 'bp_media_privacy' AND
|
468 |
( post_mime_type LIKE 'image%' OR post_mime_type LIKE 'music%' OR post_mime_type LIKE 'video%' OR post_type LIKE 'bp_media_album')
|
469 |
GROUP BY p.post_author,pmp.meta_value order by p.post_author";
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
488 |
|
489 |
-
|
490 |
-
|
491 |
-
/**
|
492 |
-
*
|
493 |
-
* @global type $bp_media_admin
|
494 |
-
*/
|
495 |
-
public function save_multisite_options() {
|
496 |
-
global $rtmedia_admin;
|
497 |
-
if (isset($_POST['refresh-count'])) {
|
498 |
-
$rtmedia_admin->update_count();
|
499 |
-
}
|
500 |
-
do_action('rtmedia_sanitize_settings', $_POST);
|
501 |
-
|
502 |
-
if (isset($_POST['rtmedia_options'])) {
|
503 |
-
update_site_option('rtmedia_options', $_POST['rtmedia_options']);
|
504 |
//
|
505 |
// // redirect to settings page in network
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
|
515 |
-
|
516 |
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
// echo '<p><a target="_blank" href="http://rtcamp.com/news/buddypress-media-review-contest/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media"><img src="' . RTMEDIA_URL . 'app/assets/img/bpm-contest-banner.jpg" alt="BuddyPress Media Review Contest" /></a></p>';
|
525 |
// $contest = '<a target="_blank" href="http://rtcamp.com/news/buddypress-media-review-contest/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media"><img src="'.RTMEDIA_URL.'app/assets/img/bpm-contest-banner.jpg" alt="BuddyPress Media Review Contest" /></a>';
|
526 |
// new BPMediaAdminWidget('bpm-contest', __('', 'rtmedia'), $contest);
|
527 |
|
528 |
-
|
529 |
-
|
530 |
<label class="columns large-6 large-offset-3" for="bp-media-add-linkback"><input' . checked(get_site_option('rtmedia-add-linkback', false), true, false) . ' type="checkbox" name="bp-media-add-linkback" value="1" id="bp-media-add-linkback"/> ' . __('Add link to footer', 'rtmedia') . '</label>
|
531 |
<div class="row">
|
532 |
<div class="columns large-6"><iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Frtcamp.com%2Fbuddypress-media%2F&send=false&layout=button_count&width=72&show_faces=false&font&colorscheme=light&action=like&height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:80px; height:21px; margin-top: 5px;" allowTransparency="true"></iframe></div>
|
@@ -537,9 +563,9 @@ if (!class_exists('RTMediaAdmin')) {
|
|
537 |
<div class="columns large-6"><a href="' . sprintf('%s', 'http://feeds.feedburner.com/rtcamp/') . '" title="' . __('Subscribe to our feeds', 'rtmedia') . '" class="button" target="_blank"><i class="bp-media-rss icon-rss"></i> ' . __('Feeds', 'rtmedia') . '</a></div>
|
538 |
</div>
|
539 |
</div>';
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
|
544 |
// $donate = '<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
|
545 |
// <!-- Identify your business so that you can collect the payments. -->
|
@@ -563,7 +589,7 @@ if (!class_exists('RTMediaAdmin')) {
|
|
563 |
// ;
|
564 |
// new BPMediaAdminWidget('donate', __('Donate', 'rtmedia'), $donate);
|
565 |
|
566 |
-
|
567 |
<div class="mc-field-group">
|
568 |
<input type="email" value="' . $current_user->user_email . '" name="EMAIL" placeholder="Email" class="required email" id="mce-EMAIL">
|
569 |
<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">
|
@@ -571,86 +597,86 @@ if (!class_exists('RTMediaAdmin')) {
|
|
571 |
<div class="response" id="mce-error-response" style="display:none"></div>
|
572 |
<div class="response" id="mce-success-response" style="display:none"></div>
|
573 |
</div>
|
574 |
-
<input type="submit" value="'.__('Subscribe','rtmedia').'" name="subscribe" id="mc-embedded-subscribe" class="button">
|
575 |
</div>
|
576 |
</form>';
|
577 |
-
|
578 |
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
<p>
|
625 |
' . sprintf(__('You have images enabled on rtMedia but your network allowed filetypes does not allow uploading of %s. Click <a href="%s">here</a> to change your settings manually.', 'rtmedia'), implode(', ', $not_supported_image), network_admin_url('settings.php#upload_filetypes')) . '
|
626 |
<br /><strong>' . __('Recommended', 'rtmedia') . ':</strong> <input type="button" class="button update-network-settings-upload-filetypes" class="button" value="' . __('Update Network Settings Automatically', 'rtmedia') . '"> <img style="display:none;" src="' . admin_url('images/wpspin_light.gif') . '" />
|
627 |
</p>
|
628 |
</div>';
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
<p>
|
636 |
' . sprintf(__('You have video enabled on BuddyPress Media but your network allowed filetypes does not allow uploading of mp4. Click <a href="%s">here</a> to change your settings manually.', 'rtmedia'), network_admin_url('settings.php#upload_filetypes')) . '
|
637 |
<br /><strong>' . __('Recommended', 'rtmedia') . ':</strong> <input type="button" class="button update-network-settings-upload-filetypes" class="button" value="' . __('Update Network Settings Automatically', 'rtmedia') . '"> <img style="display:none;" src="' . admin_url('images/wpspin_light.gif') . '" />
|
638 |
</p>
|
639 |
</div>';
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
<br /><strong>' . __('Recommended', 'rtmedia') . ':</strong> <input type="button" class="button update-network-settings-upload-filetypes" class="button" value="' . __('Update Network Settings Automatically', 'rtmedia') . '"> <img style="display:none;" src="' . admin_url('images/wpspin_light.gif') . '" />
|
647 |
</p>
|
648 |
</div>';
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
<script type="text/javascript">
|
655 |
jQuery('.upload-filetype-network-settings-error').on('click','.update-network-settings-upload-filetypes', function(){
|
656 |
jQuery('.update-network-settings-upload-filetypes').siblings('img').show();
|
@@ -702,4 +728,4 @@ if (!class_exists('RTMediaAdmin')) {
|
|
702 |
}
|
703 |
|
704 |
}
|
705 |
-
|
17 |
public $rtmedia_feed;
|
18 |
|
19 |
public function __construct() {
|
20 |
+
global $rtmedia;
|
21 |
add_action('init', array($this, 'video_transcoding_survey_response'));
|
22 |
if (is_multisite()) {
|
23 |
add_action('network_admin_notices', array($this, 'upload_filetypes_error'));
|
24 |
add_action('admin_notices', array($this, 'upload_filetypes_error'));
|
25 |
}
|
26 |
$rtmedia_feed = new RTMediaFeed();
|
27 |
+
add_filter("plugin_action_links_" . RTMEDIA_BASE_NAME, array(&$this, 'plugin_add_settings_link'));
|
28 |
add_action('wp_ajax_rtmedia_fetch_feed', array($rtmedia_feed, 'fetch_feed'), 1);
|
29 |
$this->rtmedia_support = new RTMediaSupport();
|
30 |
add_action('wp_ajax_rtmedia_select_request', array($this->rtmedia_support, 'get_form'), 1);
|
40 |
add_action('wp_ajax_rtmedia_convert_videos_form', array($this, 'convert_videos_mailchimp_send'), 1);
|
41 |
add_action('wp_ajax_rtmedia_correct_upload_filetypes', array($this, 'correct_upload_filetypes'), 1);
|
42 |
add_filter('plugin_row_meta', array($this, 'plugin_meta_premium_addon_link'), 1, 4);
|
43 |
+
|
44 |
+
if (isset($_POST["rtmedia-options"])) {
|
45 |
+
if (isset($_POST["rtmedia-options"]["general_showAdminMenu"]) && $_POST["rtmedia-options"]["general_showAdminMenu"] == "1")
|
46 |
+
add_action('admin_bar_menu', array($this, 'admin_bar_menu'), 100, 1);
|
47 |
+
}else if (intval($rtmedia->options["general_showAdminMenu"]) == 1) {
|
48 |
+
add_action('admin_bar_menu', array($this, 'admin_bar_menu'), 100, 1);
|
49 |
+
}
|
50 |
+
|
51 |
if (is_admin()) {
|
52 |
add_action('admin_enqueue_scripts', array($this, 'ui'));
|
53 |
//bp_core_admin_hook();
|
54 |
+
add_action('admin_menu', array($this, 'menu'), 1);
|
55 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
if (current_user_can('manage_options'))
|
57 |
add_action('bp_admin_tabs', array($this, 'tab'));
|
58 |
if (is_multisite())
|
61 |
$this->rtmedia_settings = new RTMediaSettings();
|
62 |
$this->rtmedia_encoding = new RTMediaEncoding();
|
63 |
}
|
64 |
+
|
65 |
+
function plugin_add_settings_link($links) {
|
66 |
$settings_link = '<a href="' . admin_url('admin.php?page=rtmedia-settings') . '">Settings</a>';
|
67 |
+
array_push($links, $settings_link);
|
68 |
$settings_link = '<a href="' . admin_url('admin.php?page=rtmedia-support') . '">Support</a>';
|
69 |
+
array_push($links, $settings_link);
|
70 |
return $links;
|
71 |
}
|
72 |
|
73 |
+
function admin_bar_menu($admin_bar) {
|
74 |
+
if (!current_user_can('manage_options'))
|
75 |
+
return;
|
76 |
|
77 |
+
$admin_bar->add_menu(array(
|
78 |
+
'id' => 'rtMedia',
|
79 |
+
'title' => 'rtMedia',
|
80 |
+
'href' => admin_url('admin.php?page=rtmedia-settings'),
|
81 |
+
'meta' => array(
|
82 |
+
'title' => __('rtMedia'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
),
|
84 |
+
));
|
85 |
+
$admin_bar->add_menu(array(
|
86 |
+
'id' => 'rt-media-dashborad',
|
87 |
+
'parent' => 'rtMedia',
|
88 |
+
'title' => __('Settings', "rtmedia"),
|
89 |
+
'href' => admin_url('admin.php?page=rtmedia-settings'),
|
90 |
+
'meta' => array(
|
91 |
+
'title' => __('Settings'),
|
92 |
+
'target' => '_self',
|
93 |
+
),
|
94 |
+
));
|
95 |
+
$admin_bar->add_menu(array(
|
96 |
+
'id' => 'rt-media-addons',
|
97 |
+
'parent' => 'rtMedia',
|
98 |
+
'title' => __('Addons', "rtmedia"),
|
99 |
+
'href' => admin_url('admin.php?page=rtmedia-addons'),
|
100 |
+
'meta' => array(
|
101 |
+
'title' => __('Addons'),
|
102 |
+
'target' => '_self',
|
103 |
+
),
|
104 |
+
));
|
105 |
+
$admin_bar->add_menu(array(
|
106 |
+
'id' => 'rt-media-support',
|
107 |
+
'parent' => 'rtMedia',
|
108 |
+
'title' => __('Support', "rtmedia"),
|
109 |
+
'href' => admin_url('admin.php?page=rtmedia-support'),
|
110 |
+
'meta' => array(
|
111 |
+
'title' => __('Support'),
|
112 |
+
'target' => '_self',
|
113 |
+
),
|
114 |
+
));
|
115 |
}
|
116 |
+
|
117 |
/**
|
118 |
* Generates the Admin UI.
|
119 |
*
|
120 |
* @param string $hook
|
121 |
*/
|
122 |
|
123 |
+
/**
|
124 |
+
*
|
125 |
+
* @param type $hook
|
126 |
+
*/
|
127 |
+
public function ui($hook) {
|
128 |
+
$admin_pages = array(
|
129 |
+
'rtmedia_page_rtmedia-migration',
|
130 |
+
'rtmedia_page_rtmedia-kaltura-settings',
|
131 |
+
'rtmedia_page_rtmedia-ffmpeg-settings',
|
132 |
+
'toplevel_page_rtmedia-settings',
|
133 |
+
'rtmedia_page_rtmedia-addons',
|
134 |
+
'rtmedia_page_rtmedia-support',
|
135 |
+
'rtmedia_page_rtmedia-importer'
|
136 |
+
);
|
137 |
+
$admin_pages = apply_filters('rtmedia_filter_admin_pages_array', $admin_pages);
|
138 |
+
|
139 |
+
if (in_array($hook, $admin_pages)) {
|
140 |
+
$admin_ajax = admin_url('admin-ajax.php');
|
141 |
+
|
142 |
+
wp_enqueue_script('bootstrap-switch', RTMEDIA_URL . 'app/assets/js/bootstrap-switch.js', array('jquery'), RTMEDIA_VERSION);
|
143 |
+
wp_enqueue_script('slider-tabs', RTMEDIA_URL . 'app/assets/js/jquery.sliderTabs.min.js', array('jquery', 'jquery-effects-core'), RTMEDIA_VERSION);
|
144 |
+
wp_enqueue_script('power-tip', RTMEDIA_URL . 'app/assets/js/jquery.powertip.min.js', array('jquery'), RTMEDIA_VERSION);
|
145 |
+
wp_enqueue_script('observe-hashchange', RTMEDIA_URL . 'app/assets/js/jquery.observehashchange.pack.js', array('jquery'), RTMEDIA_VERSION);
|
146 |
+
wp_enqueue_script('rtmedia-admin', RTMEDIA_URL . 'app/assets/js/admin.js', array('jquery-ui-dialog'), RTMEDIA_VERSION);
|
147 |
+
wp_localize_script('rtmedia-admin', 'rtmedia_on_label', __('ON', 'rtmedia'));
|
148 |
+
wp_localize_script('rtmedia-admin', 'rtmedia_off_label', __('OFF', 'rtmedia'));
|
149 |
+
wp_localize_script('rtmedia-admin', 'rtmedia_admin_ajax', $admin_ajax);
|
150 |
+
wp_localize_script('rtmedia-admin', 'rtmedia_admin_url', admin_url());
|
151 |
+
wp_localize_script('rtmedia-admin', 'rtmedia_admin_url', admin_url());
|
152 |
+
$rtmedia_admin_strings = array(
|
153 |
+
'no_refresh' => __('Please do not refresh this page.', 'rtmedia'),
|
154 |
+
'something_went_wrong' => __('Something went wronng. Please <a href onclick="location.reload();">refresh</a> page.', 'rtmedia'),
|
155 |
+
'are_you_sure' => __('This will subscribe you to the free plan.', 'rtmedia'),
|
156 |
+
'disable_encoding' => __('Are you sure you want to disable the encoding service? Make sure you note your api key before disabling it incase you want to activate it in future.', 'rtmedia')
|
157 |
+
);
|
158 |
+
wp_localize_script('rtmedia-admin', 'rtmedia_admin_strings', $rtmedia_admin_strings);
|
159 |
+
wp_localize_script('rtmedia-admin', 'settings_url', add_query_arg(
|
160 |
+
array('page' => 'rtmedia-settings'), (is_multisite() ? network_admin_url('admin.php') : admin_url('admin.php'))
|
161 |
+
) . '#privacy_enabled');
|
162 |
+
wp_localize_script('rtmedia-admin', 'settings_rt_album_import_url', add_query_arg(
|
163 |
+
array('page' => 'rtmedia-settings'), (is_multisite() ? network_admin_url('admin.php') : admin_url('admin.php'))
|
164 |
+
));
|
165 |
+
wp_enqueue_style('font-awesome', RTMEDIA_URL . 'app/assets/css/font-awesome.min.css', '', RTMEDIA_VERSION);
|
166 |
+
wp_enqueue_style('bootstrap-switch', RTMEDIA_URL . 'app/assets/css/bootstrap-switch.css', '', RTMEDIA_VERSION);
|
167 |
+
wp_enqueue_style('slider-tabs', RTMEDIA_URL . 'app/assets/css/jquery.sliderTabs.min.css', '', RTMEDIA_VERSION);
|
168 |
+
wp_enqueue_style('power-tip', RTMEDIA_URL . 'app/assets/css/jquery.powertip.min.css', '', RTMEDIA_VERSION);
|
169 |
+
wp_enqueue_style('grid-foundation', RTMEDIA_URL . 'app/assets/css/grid-foundation.css', '', RTMEDIA_VERSION);
|
170 |
+
wp_enqueue_style('rtmedia-main', RTMEDIA_URL . 'app/assets/css/main.css', '', RTMEDIA_VERSION);
|
171 |
+
wp_enqueue_style('rtmedia-admin', RTMEDIA_URL . 'app/assets/css/admin.css', '', RTMEDIA_VERSION);
|
172 |
+
wp_enqueue_style('wp-jquery-ui-dialog');
|
173 |
+
}
|
174 |
+
}
|
175 |
+
|
176 |
+
/**
|
177 |
+
* Admin Menu
|
178 |
+
*
|
179 |
+
* @global string 'rtmedia'
|
180 |
+
*/
|
181 |
+
public function menu() {
|
182 |
add_menu_page('rtMedia', 'rtMedia', 'manage_options', 'rtmedia-settings', array($this, 'settings_page'));
|
183 |
add_submenu_page('rtmedia-settings', __('Settings', 'rtmedia'), __('Settings', 'rtmedia'), 'manage_options', 'rtmedia-settings', array($this, 'settings_page'));
|
184 |
add_submenu_page('rtmedia-settings', __('Addons', 'rtmedia'), __('Addons', 'rtmedia'), 'manage_options', 'rtmedia-addons', array($this, 'addons_page'));
|
187 |
// if (!BPMediaPrivacy::is_installed()) {
|
188 |
// add_submenu_page('rtmedia-settings', __('rtMedia Database Update', 'rtmedia'), __('Update Database', 'rtmedia'), 'manage_options', 'rtmedia-db-update', array($this, 'privacy_page'));
|
189 |
// }
|
190 |
+
}
|
191 |
|
192 |
/**
|
193 |
* Render the BuddyPress Media Settings page
|
244 |
public function render_page($page, $option_group = NULL) {
|
245 |
?>
|
246 |
|
247 |
+
<div class="wrap bp-media-admin <?php echo $this->get_current_tab(); ?>">
|
248 |
+
<div id="icon-buddypress-media" class="icon32"><br></div>
|
249 |
+
<h2 class="nav-tab-wrapper"><?php $this->rtmedia_tabs(); ?></h2>
|
250 |
+
<?php settings_errors(); ?>
|
251 |
+
<div class="row">
|
252 |
+
<div id="bp-media-settings-boxes" class="columns large-7">
|
253 |
+
<?php
|
254 |
+
$settings_url = ( is_multisite() ) ? network_admin_url('edit.php?action=' . $option_group) : 'options.php';
|
255 |
+
?>
|
256 |
+
<?php if ($option_group) { //$option_group if ($page == "bp-media-settings") action="<?php echo $settings_url; ?>
|
257 |
+
<form id="bp_media_settings_form" name="bp_media_settings_form" method="post" enctype="multipart/form-data">
|
258 |
+
<div class="bp-media-metabox-holder"><?php
|
259 |
+
settings_fields($option_group);
|
260 |
+
if ($page == "rtmedia-settings") {
|
261 |
+
|
262 |
+
|
263 |
+
echo '<div id="bpm-settings-tabs">';
|
264 |
+
$sub_tabs = $this->settings_sub_tabs();
|
265 |
+
RTMediaFormHandler::rtForm_settings_tabs_content($page, $sub_tabs);
|
266 |
+
echo '</div>';
|
267 |
+
} else {
|
268 |
+
do_settings_sections($page);
|
269 |
+
}
|
270 |
+
?>
|
271 |
+
<div class="clearfix"> </div>
|
272 |
+
<div class="row">
|
273 |
+
<input type="hidden" name="rtmedia-options-save" value="true">
|
274 |
+
<input type="submit" id="rtmedia-settings-submit" class="rtmedia-settings-submit button" value="<?php echo __("Save Settings", "rtmedia"); ?>">
|
275 |
+
</div>
|
276 |
+
<div class="rt-link alignright"><?php _e('By', 'rtmedia'); ?> <a href="http://rtcamp.com/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media" title="<?php _e('Empowering The Web With WordPress', 'rtmedia'); ?>"><img src="<?php echo RTMEDIA_URL; ?>app/assets/img/rtcamp-logo.png"></a></div>
|
277 |
+
</div>
|
278 |
+
</form><?php } else {
|
279 |
+
?>
|
280 |
+
<div class="bp-media-metabox-holder">
|
281 |
+
|
282 |
+
<?php
|
283 |
+
if ($page == 'rtmedia-addons')
|
284 |
+
RTMediaAddon::render_addons($page);
|
285 |
+
else
|
286 |
+
do_settings_sections($page);
|
287 |
+
?>
|
288 |
+
<?php
|
289 |
+
do_action('rtmedia_admin_page_insert', $page);
|
290 |
+
?>
|
291 |
+
<div class="rt-link alignright"><?php _e('By', 'rtmedia'); ?> <a href="http://rtcamp.com/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media" title="<?php _e('Empowering The Web With WordPress', 'rtmedia'); ?>"><img src="<?php echo RTMEDIA_URL; ?>app/assets/img/rtcamp-logo.png"></a></div>
|
292 |
+
</div><?php
|
293 |
+
do_action('rtmedia_admin_page_append', $page);
|
294 |
+
}
|
295 |
+
?>
|
296 |
+
|
297 |
+
|
298 |
+
</div><!-- .bp-media-settings-boxes -->
|
299 |
+
<div class="metabox-holder bp-media-metabox-holder columns large-3">
|
300 |
+
<?php $this->admin_sidebar(); ?>
|
301 |
+
</div>
|
302 |
+
</div><!-- .metabox-holder -->
|
303 |
+
</div><!-- .bp-media-admin --><?php
|
304 |
+
}
|
305 |
+
|
306 |
+
/**
|
307 |
+
* Adds a tab for Media settings in the BuddyPress settings page
|
308 |
+
*
|
309 |
+
* @global type $bp_media
|
310 |
+
*/
|
311 |
+
public function tab() {
|
312 |
+
|
313 |
+
$tabs_html = '';
|
314 |
+
$idle_class = 'nav-tab';
|
315 |
+
$active_class = 'nav-tab nav-tab-active';
|
316 |
+
$tabs = array();
|
317 |
|
318 |
// Check to see which tab we are on
|
319 |
+
$tab = $this->get_current_tab();
|
320 |
+
/* rtMedia */
|
321 |
+
$tabs[] = array(
|
322 |
+
'href' => get_admin_url(null, add_query_arg(array('page' => 'rtmedia-settings'), 'admin.php')),
|
323 |
+
'title' => __('rtMedia', 'rtmedia'),
|
324 |
+
'name' => __('rtMedia', 'rtmedia'),
|
325 |
+
'class' => ($tab == 'rtmedia-settings' || $tab == 'rtmedia-addons' || $tab == 'rtmedia-support' || $tab == 'rtmedia-importer') ? $active_class : $idle_class
|
326 |
+
);
|
327 |
+
|
328 |
+
|
329 |
+
foreach ($tabs as $tab) {
|
330 |
+
$tabs_html.= '<a id="bp-media" title= "' . $tab['title'] . '" href="' . $tab['href'] . '" class="' . $tab['class'] . '">' . $tab['name'] . '</a>';
|
331 |
+
}
|
332 |
+
echo $tabs_html;
|
333 |
+
}
|
334 |
|
335 |
+
public function rtmedia_tabs($active_tab = '') {
|
336 |
+
// Declare local variables
|
337 |
+
$tabs_html = '';
|
338 |
+
$idle_class = 'nav-tab';
|
339 |
+
$active_class = 'nav-tab nav-tab-active';
|
340 |
+
|
341 |
+
// Setup core admin tabs
|
342 |
+
$tabs = array(
|
343 |
+
array(
|
344 |
+
'href' => get_admin_url(null, add_query_arg(array('page' => 'rtmedia-settings'), 'admin.php')),
|
345 |
+
'name' => __('Settings', 'rtmedia'),
|
346 |
+
'slug' => 'rtmedia-settings'
|
347 |
+
),
|
348 |
+
array(
|
349 |
+
'href' => get_admin_url(null, add_query_arg(array('page' => 'rtmedia-addons'), 'admin.php')),
|
350 |
+
'name' => __('Addons', 'rtmedia'),
|
351 |
+
'slug' => 'rtmedia-addons'
|
352 |
+
),
|
353 |
+
array(
|
354 |
+
'href' => get_admin_url(null, add_query_arg(array('page' => 'rtmedia-support'), 'admin.php')),
|
355 |
+
'name' => __('Support', 'rtmedia'),
|
356 |
+
'slug' => 'rtmedia-support'
|
357 |
+
)//,
|
358 |
// array(
|
359 |
// 'href' => get_admin_url(null, add_query_arg(array('page' => 'rtmedia-importer'), 'admin.php')),
|
360 |
// 'name' => __('Importer', 'rtmedia'),
|
361 |
// 'slug' => 'rtmedia-importer'
|
362 |
// )
|
363 |
+
);
|
364 |
|
365 |
+
$tabs = apply_filters('media_add_tabs', $tabs);
|
366 |
|
367 |
+
// Loop through tabs and build navigation
|
368 |
+
foreach (array_values($tabs) as $tab_data) {
|
369 |
+
$is_current = (bool) ( $tab_data['slug'] == $this->get_current_tab() );
|
370 |
+
$tab_class = $is_current ? $active_class : $idle_class;
|
371 |
+
$tabs_html .= '<a href="' . $tab_data['href'] . '" class="' . $tab_class . '">' . $tab_data['name'] . '</a>';
|
372 |
+
}
|
373 |
|
374 |
+
// Output the tabs
|
375 |
+
echo $tabs_html;
|
376 |
|
377 |
// // Do other fun things
|
378 |
// do_action('bp_media_admin_tabs');
|
379 |
+
}
|
380 |
+
|
381 |
+
public function settings_content_tabs($page) {
|
382 |
+
global $wp_settings_sections, $wp_settings_fields;
|
383 |
+
|
384 |
+
if (!isset($wp_settings_sections) || !isset($wp_settings_sections[$page]))
|
385 |
+
return;
|
386 |
+
|
387 |
+
foreach ((array) $wp_settings_sections[$page] as $section) {
|
388 |
+
if ($section['title'])
|
389 |
+
echo "<h3>{$section['title']}</h3>\n";
|
390 |
+
|
391 |
+
if ($section['callback'])
|
392 |
+
call_user_func($section['callback'], $section);
|
393 |
+
|
394 |
+
if (!isset($wp_settings_fields) || !isset($wp_settings_fields[$page]) || !isset($wp_settings_fields[$page][$section['id']]))
|
395 |
+
continue;
|
396 |
+
echo '<table class="form-table">';
|
397 |
+
do_settings_fields($page, $section['id']);
|
398 |
+
echo '</table>';
|
399 |
+
}
|
400 |
+
}
|
401 |
+
|
402 |
+
/**
|
403 |
+
* Adds a sub tabs to the BuddyPress Media settings page
|
404 |
+
*
|
405 |
+
* @global type $bp_media
|
406 |
+
*/
|
407 |
+
public function settings_sub_tabs() {
|
408 |
+
$tabs_html = '';
|
409 |
+
$tabs = array();
|
410 |
+
|
411 |
+
// Check to see which tab we are on
|
412 |
+
$tab = $this->get_current_tab();
|
413 |
+
/* rtMedia */
|
414 |
+
$tabs[] = array(
|
415 |
+
'href' => '#rtmedia-general',
|
416 |
+
'icon' => 'icon-cogs',
|
417 |
+
'title' => __('rtMedia General', 'rtmedia'),
|
418 |
+
'name' => __('General', 'rtmedia'),
|
419 |
+
'callback' => array('RTMediaFormHandler', 'general_content')
|
420 |
+
);
|
421 |
+
$tabs[] = array(
|
422 |
+
'href' => '#rtmedia-types',
|
423 |
+
'icon' => 'icon-film',
|
424 |
+
'title' => __('rtMedia Types', 'rtmedia'),
|
425 |
+
'name' => __('Types', 'rtmedia'),
|
426 |
+
'callback' => array('RTMediaFormHandler', 'types_content')
|
427 |
+
);
|
428 |
+
|
429 |
+
$tabs[] = array(
|
430 |
+
'href' => '#rtmedia-sizes',
|
431 |
+
'icon' => 'icon-resize-full',
|
432 |
+
'title' => __('rtMedia Sizes', 'rtmedia'),
|
433 |
+
'name' => __('Sizes', 'rtmedia'),
|
434 |
+
'callback' => array('RTMediaFormHandler', 'sizes_content')
|
435 |
+
);
|
436 |
+
|
437 |
+
$tabs[] = array(
|
438 |
+
'href' => '#rtmedia-privacy',
|
439 |
+
'icon' => 'icon-lock',
|
440 |
+
'title' => __('rtMedia Privacy', 'rtmedia'),
|
441 |
+
'name' => __('Privacy', 'rtmedia'),
|
442 |
+
'callback' => array('RTMediaFormHandler', 'privacy_content')
|
443 |
+
);
|
444 |
+
|
445 |
+
$tabs[] = array(
|
446 |
+
'href' => '#rtmedia-bp',
|
447 |
+
'icon' => 'icon-group',
|
448 |
+
'title' => __('rtMedia BuddyPress', 'rtmedia'),
|
449 |
+
'name' => __('BuddyPress', 'rtmedia'),
|
450 |
+
'callback' => array('RTMediaFormHandler', 'buddypress_content') //change it to BuddyPress Content
|
451 |
+
);
|
452 |
+
|
453 |
+
$tabs = apply_filters('rtmedia_add_settings_sub_tabs', $tabs, $tab);
|
454 |
+
$tabs_html .= '<ul>';
|
455 |
+
foreach ($tabs as $tab) {
|
456 |
+
|
457 |
+
$icon = '';
|
458 |
+
if (isset($tab['icon']) && !empty($tab['icon']))
|
459 |
+
$icon = '<i class="' . $tab['icon'] . '"></i>';
|
460 |
+
|
461 |
+
$tabs_html.= '<li><a id="tab-' . substr($tab['href'], 1) . '" title="' . $tab['title'] . '" href="' . $tab['href'] . '" class="rtmedia-tab-title ' . sanitize_title($tab['name']) . '">' . $icon . ' ' . $tab['name'] . '</a></li>';
|
462 |
+
}
|
463 |
+
$tabs_html .= '</ul>';
|
464 |
+
|
465 |
+
echo $tabs_html;
|
466 |
+
return $tabs;
|
467 |
+
}
|
468 |
+
|
469 |
+
/*
|
470 |
+
* Updates the media count of all users.
|
471 |
+
*/
|
472 |
+
|
473 |
+
/**
|
474 |
+
*
|
475 |
+
* @global type $wpdb
|
476 |
+
* @return boolean
|
477 |
+
*/
|
478 |
+
public function update_count() {
|
479 |
+
global $wpdb;
|
480 |
+
|
481 |
+
$query =
|
482 |
+
"SELECT
|
483 |
p.post_author,pmp.meta_value,
|
484 |
SUM(CASE WHEN post_mime_type LIKE 'image%' THEN 1 ELSE 0 END) as Images,
|
485 |
SUM(CASE WHEN post_mime_type LIKE 'music%' THEN 1 ELSE 0 END) as Music,
|
493 |
pmp.meta_key = 'bp_media_privacy' AND
|
494 |
( post_mime_type LIKE 'image%' OR post_mime_type LIKE 'music%' OR post_mime_type LIKE 'video%' OR post_type LIKE 'bp_media_album')
|
495 |
GROUP BY p.post_author,pmp.meta_value order by p.post_author";
|
496 |
+
$result = $wpdb->get_results($query);
|
497 |
+
if (!is_array($result))
|
498 |
+
return false;
|
499 |
+
$formatted = array();
|
500 |
+
foreach ($result as $obj) {
|
501 |
+
$formatted[$obj->post_author][$obj->meta_value] = array(
|
502 |
+
'image' => $obj->Images,
|
503 |
+
'video' => $obj->Videos,
|
504 |
+
'music' => $obj->Music,
|
505 |
+
'album' => $obj->Albums,
|
506 |
+
);
|
507 |
+
}
|
508 |
+
|
509 |
+
foreach ($formatted as $user => $obj) {
|
510 |
+
update_user_meta($user, 'rtmedia_count', $obj);
|
511 |
+
}
|
512 |
+
return true;
|
513 |
+
}
|
514 |
+
|
515 |
+
/* Multisite Save Options - http://wordpress.stackexchange.com/questions/64968/settings-api-in-multisite-missing-update-message#answer-72503 */
|
516 |
+
|
517 |
+
/**
|
518 |
+
*
|
519 |
+
* @global type $bp_media_admin
|
520 |
+
*/
|
521 |
+
public function save_multisite_options() {
|
522 |
+
global $rtmedia_admin;
|
523 |
+
if (isset($_POST['refresh-count'])) {
|
524 |
+
$rtmedia_admin->update_count();
|
525 |
+
}
|
526 |
+
do_action('rtmedia_sanitize_settings', $_POST);
|
527 |
|
528 |
+
if (isset($_POST['rtmedia_options'])) {
|
529 |
+
update_site_option('rtmedia_options', $_POST['rtmedia_options']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
530 |
//
|
531 |
// // redirect to settings page in network
|
532 |
+
wp_redirect(
|
533 |
+
add_query_arg(
|
534 |
+
array('page' => 'rtmedia-settings', 'updated' => 'true'), (is_multisite() ? network_admin_url('admin.php') : admin_url('admin.php'))
|
535 |
+
)
|
536 |
+
);
|
537 |
+
exit;
|
538 |
+
}
|
539 |
+
}
|
540 |
|
541 |
+
/* Admin Sidebar */
|
542 |
|
543 |
+
/**
|
544 |
+
*
|
545 |
+
* @global type $bp_media
|
546 |
+
*/
|
547 |
+
public function admin_sidebar() {
|
548 |
+
do_action('rtmedia_before_default_admin_widgets');
|
549 |
+
$current_user = wp_get_current_user();
|
550 |
// echo '<p><a target="_blank" href="http://rtcamp.com/news/buddypress-media-review-contest/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media"><img src="' . RTMEDIA_URL . 'app/assets/img/bpm-contest-banner.jpg" alt="BuddyPress Media Review Contest" /></a></p>';
|
551 |
// $contest = '<a target="_blank" href="http://rtcamp.com/news/buddypress-media-review-contest/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media"><img src="'.RTMEDIA_URL.'app/assets/img/bpm-contest-banner.jpg" alt="BuddyPress Media Review Contest" /></a>';
|
552 |
// new BPMediaAdminWidget('bpm-contest', __('', 'rtmedia'), $contest);
|
553 |
|
554 |
+
$message = sprintf(__('I use @buddypressmedia http://goo.gl/8Upmv on %s', 'rtmedia'), home_url());
|
555 |
+
$addons = '<div id="social" class="row">
|
556 |
<label class="columns large-6 large-offset-3" for="bp-media-add-linkback"><input' . checked(get_site_option('rtmedia-add-linkback', false), true, false) . ' type="checkbox" name="bp-media-add-linkback" value="1" id="bp-media-add-linkback"/> ' . __('Add link to footer', 'rtmedia') . '</label>
|
557 |
<div class="row">
|
558 |
<div class="columns large-6"><iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Frtcamp.com%2Fbuddypress-media%2F&send=false&layout=button_count&width=72&show_faces=false&font&colorscheme=light&action=like&height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:80px; height:21px; margin-top: 5px;" allowTransparency="true"></iframe></div>
|
563 |
<div class="columns large-6"><a href="' . sprintf('%s', 'http://feeds.feedburner.com/rtcamp/') . '" title="' . __('Subscribe to our feeds', 'rtmedia') . '" class="button" target="_blank"><i class="bp-media-rss icon-rss"></i> ' . __('Feeds', 'rtmedia') . '</a></div>
|
564 |
</div>
|
565 |
</div>';
|
566 |
+
//<li><a href="' . sprintf('%s', 'http://www.facebook.com/rtCamp.solutions/') . '" title="' . __('Become a fan on Facebook', 'rtmedia') . '" class="bp-media-facebook bp-media-social">' . __('Facebook', 'rtmedia') . '</a></li>
|
567 |
+
//<li><a href="' . sprintf('%s', 'https://twitter.com/rtcamp/') . '" title="' . __('Follow us on Twitter', 'rtmedia') . '" class="bp-media-twitter bp-media-social">' . __('Twitter', 'rtmedia') . '</a></li> ;
|
568 |
+
new RTMediaAdminWidget('spread-the-word', __('Spread the Word', 'rtmedia'), $addons);
|
569 |
|
570 |
// $donate = '<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
|
571 |
// <!-- Identify your business so that you can collect the payments. -->
|
589 |
// ;
|
590 |
// new BPMediaAdminWidget('donate', __('Donate', 'rtmedia'), $donate);
|
591 |
|
592 |
+
$branding = '<form action="http://rtcamp.us1.list-manage1.com/subscribe/post?u=85b65c9c71e2ba3fab8cb1950&id=9e8ded4470" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
|
593 |
<div class="mc-field-group">
|
594 |
<input type="email" value="' . $current_user->user_email . '" name="EMAIL" placeholder="Email" class="required email" id="mce-EMAIL">
|
595 |
<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">
|
597 |
<div class="response" id="mce-error-response" style="display:none"></div>
|
598 |
<div class="response" id="mce-success-response" style="display:none"></div>
|
599 |
</div>
|
600 |
+
<input type="submit" value="' . __('Subscribe', 'rtmedia') . '" name="subscribe" id="mc-embedded-subscribe" class="button">
|
601 |
</div>
|
602 |
</form>';
|
603 |
+
new RTMediaAdminWidget('branding', __('Subscribe', 'rtmedia'), $branding);
|
604 |
|
605 |
+
$news = '<img src ="' . admin_url('/images/wpspin_light.gif') . '" /> Loading...';
|
606 |
+
new RTMediaAdminWidget('latest-news', __('Latest News', 'rtmedia'), $news);
|
607 |
+
do_action('rtmedia_after_default_admin_widgets');
|
608 |
+
}
|
609 |
|
610 |
+
public function linkback() {
|
611 |
+
if (isset($_POST['linkback']) && $_POST['linkback']) {
|
612 |
+
return update_site_option('rtmedia-add-linkback', true);
|
613 |
+
} else {
|
614 |
+
return update_site_option('rtmedia-add-linkback', false);
|
615 |
+
}
|
616 |
+
die;
|
617 |
+
}
|
618 |
|
619 |
+
public function convert_videos_mailchimp_send() {
|
620 |
+
if ($_POST['interested'] == 'Yes' && !empty($_POST['choice'])) {
|
621 |
+
wp_remote_get(add_query_arg(array('rtmedia-convert-videos-form' => 1, 'choice' => $_POST['choice'], 'url' => urlencode($_POST['url']), 'email' => $_POST['email']), 'http://rtcamp.com/'));
|
622 |
+
} else {
|
623 |
+
update_site_option('rtmedia-survey', 0);
|
624 |
+
}
|
625 |
+
echo 'Thank you for your time.';
|
626 |
+
die;
|
627 |
+
}
|
628 |
|
629 |
+
public function video_transcoding_survey_response() {
|
630 |
+
if (isset($_GET['survey-done']) && ($_GET['survey-done'] == md5('survey-done'))) {
|
631 |
+
update_site_option('rtmedia-survey', 0);
|
632 |
+
}
|
633 |
+
}
|
634 |
|
635 |
+
public function plugin_meta_premium_addon_link($plugin_meta, $plugin_file, $plugin_data, $status) {
|
636 |
+
if (plugin_basename(RTMEDIA_PATH . 'index.php') == $plugin_file)
|
637 |
+
$plugin_meta[] = '<a href="https://rtcamp.com/store/product-category/buddypress/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media" title="Premium Add-ons">Premium Add-ons</a>';
|
638 |
+
return $plugin_meta;
|
639 |
+
}
|
640 |
|
641 |
+
public function upload_filetypes_error() {
|
642 |
+
global $rtmedia;
|
643 |
+
$upload_filetypes = get_site_option('upload_filetypes', 'jpg jpeg png gif');
|
644 |
+
$upload_filetypes = explode(' ', $upload_filetypes);
|
645 |
+
$flag = false;
|
646 |
+
if (isset($rtmedia->options['images_enabled']) && $rtmedia->options['images_enabled']) {
|
647 |
+
$not_supported_image = array_diff(array('jpg', 'jpeg', 'png', 'gif'), $upload_filetypes);
|
648 |
+
if (!empty($not_supported_image)) {
|
649 |
+
echo '<div class="error upload-filetype-network-settings-error">
|
650 |
<p>
|
651 |
' . sprintf(__('You have images enabled on rtMedia but your network allowed filetypes does not allow uploading of %s. Click <a href="%s">here</a> to change your settings manually.', 'rtmedia'), implode(', ', $not_supported_image), network_admin_url('settings.php#upload_filetypes')) . '
|
652 |
<br /><strong>' . __('Recommended', 'rtmedia') . ':</strong> <input type="button" class="button update-network-settings-upload-filetypes" class="button" value="' . __('Update Network Settings Automatically', 'rtmedia') . '"> <img style="display:none;" src="' . admin_url('images/wpspin_light.gif') . '" />
|
653 |
</p>
|
654 |
</div>';
|
655 |
+
$flag = true;
|
656 |
+
}
|
657 |
+
}
|
658 |
+
if (isset($rtmedia->options['videos_enabled']) && $rtmedia->options['videos_enabled']) {
|
659 |
+
if (!in_array('mp4', $upload_filetypes)) {
|
660 |
+
echo '<div class="error upload-filetype-network-settings-error">
|
661 |
<p>
|
662 |
' . sprintf(__('You have video enabled on BuddyPress Media but your network allowed filetypes does not allow uploading of mp4. Click <a href="%s">here</a> to change your settings manually.', 'rtmedia'), network_admin_url('settings.php#upload_filetypes')) . '
|
663 |
<br /><strong>' . __('Recommended', 'rtmedia') . ':</strong> <input type="button" class="button update-network-settings-upload-filetypes" class="button" value="' . __('Update Network Settings Automatically', 'rtmedia') . '"> <img style="display:none;" src="' . admin_url('images/wpspin_light.gif') . '" />
|
664 |
</p>
|
665 |
</div>';
|
666 |
+
$flag = true;
|
667 |
+
}
|
668 |
+
}
|
669 |
+
if (isset($rtmedia->options['audio_enabled']) && $rtmedia->options['audio_enabled']) {
|
670 |
+
if (!in_array('mp3', $upload_filetypes)) {
|
671 |
+
echo '<div class="error upload-filetype-network-settings-error"><p>' . sprintf(__('You have audio enabled on BuddyPress Media but your network allowed filetypes does not allow uploading of mp3. Click <a href="%s">here</a> to change your settings manually.', 'rtmedia'), network_admin_url('settings.php#upload_filetypes')) . '
|
672 |
<br /><strong>' . __('Recommended', 'rtmedia') . ':</strong> <input type="button" class="button update-network-settings-upload-filetypes" class="button" value="' . __('Update Network Settings Automatically', 'rtmedia') . '"> <img style="display:none;" src="' . admin_url('images/wpspin_light.gif') . '" />
|
673 |
</p>
|
674 |
</div>';
|
675 |
+
$flag = true;
|
676 |
+
}
|
677 |
+
}
|
678 |
+
if ($flag) {
|
679 |
+
?>
|
680 |
<script type="text/javascript">
|
681 |
jQuery('.upload-filetype-network-settings-error').on('click','.update-network-settings-upload-filetypes', function(){
|
682 |
jQuery('.update-network-settings-upload-filetypes').siblings('img').show();
|
728 |
}
|
729 |
|
730 |
}
|
731 |
+
?>
|
app/assets/js/admin.js
CHANGED
@@ -82,7 +82,10 @@ jQuery(document).ready(function($){
|
|
82 |
// since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
|
83 |
jQuery.getJSON(ajaxurl, data, function(response) {
|
84 |
if(response.error===undefined && response.apikey){
|
85 |
-
|
|
|
|
|
|
|
86 |
}else{
|
87 |
jQuery('.encoding-try-now').next().remove();
|
88 |
jQuery('#settings-error-encoding-error').remove();
|
@@ -103,12 +106,14 @@ jQuery(document).ready(function($){
|
|
103 |
// since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
|
104 |
jQuery.getJSON(ajaxurl, data, function(response) {
|
105 |
if(response.error===undefined && response.apikey){
|
106 |
-
var tempUrl =
|
107 |
-
|
|
|
|
|
108 |
tempUrl += '&apikey='+response.apikey;
|
109 |
-
if(
|
110 |
tempUrl += '&update=true';
|
111 |
-
document.location.href = tempUrl;
|
112 |
|
113 |
}else{
|
114 |
jQuery('#settings-error-api-key-error').remove();
|
82 |
// since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
|
83 |
jQuery.getJSON(ajaxurl, data, function(response) {
|
84 |
if(response.error===undefined && response.apikey){
|
85 |
+
var tempUrl = window.location.href;
|
86 |
+
var hash = window.location.hash;
|
87 |
+
tempUrl = tempUrl.replace(hash, '');
|
88 |
+
document.location.href = tempUrl+'&apikey='+response.apikey+hash;
|
89 |
}else{
|
90 |
jQuery('.encoding-try-now').next().remove();
|
91 |
jQuery('#settings-error-encoding-error').remove();
|
106 |
// since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
|
107 |
jQuery.getJSON(ajaxurl, data, function(response) {
|
108 |
if(response.error===undefined && response.apikey){
|
109 |
+
var tempUrl = window.location.href;
|
110 |
+
var hash = window.location.hash;
|
111 |
+
tempUrl = tempUrl.replace(hash, '');
|
112 |
+
if(tempUrl.toString().indexOf('&apikey='+response.apikey) == -1)
|
113 |
tempUrl += '&apikey='+response.apikey;
|
114 |
+
if(tempUrl.toString().indexOf('&update=true') == -1)
|
115 |
tempUrl += '&update=true';
|
116 |
+
document.location.href = tempUrl+hash;
|
117 |
|
118 |
}else{
|
119 |
jQuery('#settings-error-api-key-error').remove();
|
app/assets/js/rtMedia.backbone.js
CHANGED
@@ -309,7 +309,8 @@ jQuery(function($) {
|
|
309 |
try {
|
310 |
var rtnObj;
|
311 |
rtnObj = JSON.parse(res.response);
|
312 |
-
activity_id = rtnObj.activity_id;
|
|
|
313 |
} catch (e) {
|
314 |
console.log('Invalid Activity ID');
|
315 |
}
|
309 |
try {
|
310 |
var rtnObj;
|
311 |
rtnObj = JSON.parse(res.response);
|
312 |
+
uploaderObj.uploader.settings.multipart_params.activity_id = rtnObj.activity_id;
|
313 |
+
activity_id= rtnObj.activity_id;
|
314 |
} catch (e) {
|
315 |
console.log('Invalid Activity ID');
|
316 |
}
|
app/importers/RTMediaMigration.php
CHANGED
@@ -35,7 +35,8 @@ class RTMediaMigration {
|
|
35 |
}
|
36 |
|
37 |
function add_migration_notice() {
|
38 |
-
|
|
|
39 |
}
|
40 |
|
41 |
function create_notice($message, $type = "error") {
|
35 |
}
|
36 |
|
37 |
function add_migration_notice() {
|
38 |
+
if (current_user_can( 'manage_options' ) )
|
39 |
+
$this->create_notice("<p><strong>rtMedia</strong> : Please Migrate your Database <a href='" . admin_url("admin.php?page=rtmedia-migration&force=true") . "'>Click Here</a>. </p>");
|
40 |
}
|
41 |
|
42 |
function create_notice($message, $type = "error") {
|
app/main/controllers/media/RTMediaUserInteraction.php
CHANGED
@@ -78,7 +78,7 @@ class RTMediaUserInteraction {
|
|
78 |
|
79 |
$this->init();
|
80 |
|
81 |
-
|
82 |
|
83 |
// filter the default actions with this new one
|
84 |
add_filter( 'rtmedia_query_actions', array( $this, 'register' ) );
|
@@ -89,11 +89,11 @@ class RTMediaUserInteraction {
|
|
89 |
|
90 |
|
91 |
function init(){
|
92 |
-
|
|
|
93 |
if(!isset($rtmedia_query->action_query)) return;
|
94 |
if(!isset($rtmedia_query->action_query->id)) return;
|
95 |
-
|
96 |
-
$this->model = new RTMediaModel();
|
97 |
$this->set_label();
|
98 |
$this->set_plural();
|
99 |
$this->set_media();
|
78 |
|
79 |
$this->init();
|
80 |
|
81 |
+
|
82 |
|
83 |
// filter the default actions with this new one
|
84 |
add_filter( 'rtmedia_query_actions', array( $this, 'register' ) );
|
89 |
|
90 |
|
91 |
function init(){
|
92 |
+
$this->model = new RTMediaModel();
|
93 |
+
global $rtmedia_query;
|
94 |
if(!isset($rtmedia_query->action_query)) return;
|
95 |
if(!isset($rtmedia_query->action_query->id)) return;
|
96 |
+
|
|
|
97 |
$this->set_label();
|
98 |
$this->set_plural();
|
99 |
$this->set_media();
|
app/main/controllers/shortcodes/RTMediaGalleryShortcode.php
CHANGED
@@ -32,9 +32,16 @@ class RTMediaGalleryShortcode {
|
|
32 |
wp_localize_script('rtmedia-backbone', 'template_url', RTMEDIA_URL . 'templates/media');
|
33 |
$url = $_SERVER["REQUEST_URI"];
|
34 |
$url = trailingslashit($url);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
$params = array(
|
37 |
-
'url' =>
|
38 |
'runtimes' => 'gears,html5,flash,silverlight,browserplus',
|
39 |
'browse_button' => 'rtMedia-upload-button',
|
40 |
'container' => 'rtmedia-upload-container',
|
32 |
wp_localize_script('rtmedia-backbone', 'template_url', RTMEDIA_URL . 'templates/media');
|
33 |
$url = $_SERVER["REQUEST_URI"];
|
34 |
$url = trailingslashit($url);
|
35 |
+
|
36 |
+
if(strpos($url,"/media") !==false){
|
37 |
+
$url_array= split("/media", $url);
|
38 |
+
$url = trailingslashit($url_array[0]) ."upload/";
|
39 |
+
}else{
|
40 |
+
$url = trailingslashit($url) ."upload/";
|
41 |
+
}
|
42 |
|
43 |
$params = array(
|
44 |
+
'url' => $url,
|
45 |
'runtimes' => 'gears,html5,flash,silverlight,browserplus',
|
46 |
'browse_button' => 'rtMedia-upload-button',
|
47 |
'container' => 'rtmedia-upload-container',
|
app/main/controllers/template/RTMediaTemplate.php
CHANGED
@@ -13,12 +13,11 @@ class RTMediaTemplate {
|
|
13 |
public $media_args;
|
14 |
|
15 |
function __construct() {
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
}
|
23 |
|
24 |
/**
|
@@ -26,10 +25,10 @@ class RTMediaTemplate {
|
|
26 |
*/
|
27 |
function enqueue_scripts() {
|
28 |
wp_enqueue_script( 'rtmedia-backbone' );
|
29 |
-
|
30 |
-
$is_edit_allowed = is_rtmedia_edit_allowed() ? true: false;
|
31 |
-
wp_localize_script('rtmedia-backbone', 'is_album', array($is_album));
|
32 |
-
wp_localize_script('rtmedia-backbone', 'is_edit_allowed', array($is_edit_allowed));
|
33 |
}
|
34 |
|
35 |
function enqueue_image_editor_scripts() {
|
@@ -37,8 +36,7 @@ class RTMediaTemplate {
|
|
37 |
wp_enqueue_script( 'wp-ajax-response' );
|
38 |
wp_enqueue_script( 'rtmedia-image-edit', admin_url( "js/image-edit$suffix.js" ), array( 'jquery', 'json2', 'imgareaselect' ), false, 1 );
|
39 |
wp_enqueue_style( 'rtmedia-image-edit', RTMEDIA_URL . 'app/assets/css/image-edit.css' );
|
40 |
-
wp_enqueue_style( 'rtmedia-image-area-select', includes_url('/js/imgareaselect/imgareaselect.css') );
|
41 |
-
|
42 |
}
|
43 |
|
44 |
/**
|
@@ -61,10 +59,10 @@ class RTMediaTemplate {
|
|
61 |
|
62 |
//print_r($rtmedia_query);
|
63 |
|
64 |
-
if(isset($rtmedia_query->action_query->action)){
|
65 |
//echo $rtmedia_query->action_query->action;
|
66 |
do_action( 'rtmedia_pre_action_' . $rtmedia_query->action_query->action );
|
67 |
-
}else{
|
68 |
do_action( 'rtmedia_pre_action_default' );
|
69 |
}
|
70 |
|
@@ -84,8 +82,7 @@ class RTMediaTemplate {
|
|
84 |
$this->check_return_comments();
|
85 |
|
86 |
return $this->get_default_template();
|
87 |
-
|
88 |
-
} else if ( ! $shortcode_attr ){
|
89 |
return $this->get_default_template();
|
90 |
} else if ( $shortcode_attr[ 'name' ] == 'gallery' ) {
|
91 |
$valid = $this->sanitize_gallery_attributes( $shortcode_attr[ 'attr' ] );
|
@@ -95,12 +92,12 @@ class RTMediaTemplate {
|
|
95 |
$this->update_global_query( $shortcode_attr[ 'attr' ] );
|
96 |
include $this->locate_template( $template );
|
97 |
} else {
|
98 |
-
echo __('Invalid attribute passed for rtmedia_gallery shortcode.','rtmedia');
|
99 |
return false;
|
100 |
}
|
101 |
}
|
102 |
}
|
103 |
-
|
104 |
function check_return_json() {
|
105 |
global $rtmedia_query;
|
106 |
if ( $rtmedia_query->format == 'json' ) {
|
@@ -110,11 +107,12 @@ class RTMediaTemplate {
|
|
110 |
}
|
111 |
}
|
112 |
|
113 |
-
function check_return_upload(){
|
114 |
global $rtmedia_query;
|
115 |
-
|
116 |
-
|
117 |
-
|
|
|
118 |
}
|
119 |
|
120 |
function json_output() {
|
@@ -124,10 +122,10 @@ class RTMediaTemplate {
|
|
124 |
foreach ( $rtmedia_query->media as $key => $media ) {
|
125 |
$media_array[ $key ] = $media;
|
126 |
list($src, $width, $height) = wp_get_attachment_image_src( $media->media_id, 'thumbnail' );
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
$media_array[ $key ]->guid = $src;
|
132 |
$media_array[ $key ]->rt_permalink = get_rtmedia_permalink( $media->id );
|
133 |
}
|
@@ -161,13 +159,12 @@ class RTMediaTemplate {
|
|
161 |
|
162 |
// do_action('rtmedia_before_update_media',$rtmedia_query->action_query->id);
|
163 |
|
164 |
-
$data = rtmedia_sanitize_object($_POST, array('media_title','description','privacy'));
|
165 |
$media = new RTMediaMedia();
|
166 |
$media->update( $rtmedia_query->action_query->id, $data, $rtmedia_query->media[ 0 ]->media_id );
|
167 |
$rtmedia_query->query( false );
|
168 |
|
169 |
// do_action('rtmedia_after_update_media',$rtmedia_query->action_query->id);
|
170 |
-
|
171 |
} else {
|
172 |
echo __( "Ooops !!! Invalid access. No nonce was found !!", "rtmedia" );
|
173 |
}
|
@@ -315,52 +312,47 @@ class RTMediaTemplate {
|
|
315 |
exit;
|
316 |
}
|
317 |
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
function check_return_comments(){
|
323 |
global $rtmedia_query;
|
324 |
|
325 |
-
if ( $rtmedia_query->action_query->action != 'comment' )
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
}
|
352 |
-
if(isset($_POST["rtajax"])){
|
353 |
-
global $wpdb;
|
354 |
-
$comments = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_ID = %d",$id), ARRAY_A);
|
355 |
-
echo rmedia_single_comment($comments);
|
356 |
-
exit;
|
357 |
-
}
|
358 |
-
}
|
359 |
-
else {
|
360 |
-
echo "Ooops !!! Invalid access. No nonce was found !!";
|
361 |
}
|
362 |
}
|
363 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
364 |
}
|
365 |
|
366 |
/**
|
@@ -418,7 +410,6 @@ class RTMediaTemplate {
|
|
418 |
global $rtmedia_query;
|
419 |
|
420 |
$rtmedia_query->query( $attr );
|
421 |
-
|
422 |
}
|
423 |
|
424 |
/**
|
@@ -428,7 +419,7 @@ class RTMediaTemplate {
|
|
428 |
*/
|
429 |
function get_default_template() {
|
430 |
|
431 |
-
return apply_filters( 'rtmedia_media_template_include',
|
432 |
}
|
433 |
|
434 |
/**
|
@@ -437,18 +428,46 @@ class RTMediaTemplate {
|
|
437 |
* @param type $template
|
438 |
* @return string
|
439 |
*/
|
440 |
-
static function locate_template( $template, $context = false ) {
|
441 |
$located = '';
|
442 |
-
if ( ! $template )
|
443 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
444 |
|
445 |
$template_name = $template . '.php';
|
446 |
|
447 |
-
if (
|
448 |
-
$context = '
|
|
|
|
|
|
|
|
|
|
|
449 |
|
450 |
-
$path = '/' . $context
|
451 |
-
$ogpath = 'templates/
|
452 |
|
453 |
|
454 |
if ( file_exists( STYLESHEETPATH . $path . $template_name ) ) {
|
13 |
public $media_args;
|
14 |
|
15 |
function __construct() {
|
16 |
+
global $rtmedia_query;
|
17 |
+
if ( $rtmedia_query ) {
|
18 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
19 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_image_editor_scripts' ) );
|
20 |
+
}
|
|
|
21 |
}
|
22 |
|
23 |
/**
|
25 |
*/
|
26 |
function enqueue_scripts() {
|
27 |
wp_enqueue_script( 'rtmedia-backbone' );
|
28 |
+
$is_album = is_rtmedia_album() ? true : false;
|
29 |
+
$is_edit_allowed = is_rtmedia_edit_allowed() ? true : false;
|
30 |
+
wp_localize_script( 'rtmedia-backbone', 'is_album', array( $is_album ) );
|
31 |
+
wp_localize_script( 'rtmedia-backbone', 'is_edit_allowed', array( $is_edit_allowed ) );
|
32 |
}
|
33 |
|
34 |
function enqueue_image_editor_scripts() {
|
36 |
wp_enqueue_script( 'wp-ajax-response' );
|
37 |
wp_enqueue_script( 'rtmedia-image-edit', admin_url( "js/image-edit$suffix.js" ), array( 'jquery', 'json2', 'imgareaselect' ), false, 1 );
|
38 |
wp_enqueue_style( 'rtmedia-image-edit', RTMEDIA_URL . 'app/assets/css/image-edit.css' );
|
39 |
+
wp_enqueue_style( 'rtmedia-image-area-select', includes_url( '/js/imgareaselect/imgareaselect.css' ) );
|
|
|
40 |
}
|
41 |
|
42 |
/**
|
59 |
|
60 |
//print_r($rtmedia_query);
|
61 |
|
62 |
+
if ( isset( $rtmedia_query->action_query->action ) ) {
|
63 |
//echo $rtmedia_query->action_query->action;
|
64 |
do_action( 'rtmedia_pre_action_' . $rtmedia_query->action_query->action );
|
65 |
+
} else {
|
66 |
do_action( 'rtmedia_pre_action_default' );
|
67 |
}
|
68 |
|
82 |
$this->check_return_comments();
|
83 |
|
84 |
return $this->get_default_template();
|
85 |
+
} else if ( ! $shortcode_attr ) {
|
|
|
86 |
return $this->get_default_template();
|
87 |
} else if ( $shortcode_attr[ 'name' ] == 'gallery' ) {
|
88 |
$valid = $this->sanitize_gallery_attributes( $shortcode_attr[ 'attr' ] );
|
92 |
$this->update_global_query( $shortcode_attr[ 'attr' ] );
|
93 |
include $this->locate_template( $template );
|
94 |
} else {
|
95 |
+
echo __( 'Invalid attribute passed for rtmedia_gallery shortcode.', 'rtmedia' );
|
96 |
return false;
|
97 |
}
|
98 |
}
|
99 |
}
|
100 |
+
|
101 |
function check_return_json() {
|
102 |
global $rtmedia_query;
|
103 |
if ( $rtmedia_query->format == 'json' ) {
|
107 |
}
|
108 |
}
|
109 |
|
110 |
+
function check_return_upload() {
|
111 |
global $rtmedia_query;
|
112 |
+
if ( $rtmedia_query->action_query->action != 'upload' )
|
113 |
+
return;
|
114 |
+
$upload = new RTMediaUploadEndpoint();
|
115 |
+
$upload->template_redirect();
|
116 |
}
|
117 |
|
118 |
function json_output() {
|
122 |
foreach ( $rtmedia_query->media as $key => $media ) {
|
123 |
$media_array[ $key ] = $media;
|
124 |
list($src, $width, $height) = wp_get_attachment_image_src( $media->media_id, 'thumbnail' );
|
125 |
+
if ( ! $src ) {
|
126 |
+
global $rtmedia;
|
127 |
+
$src = $rtmedia->allowed_types[ $media->media_type ][ "thumbnail" ];
|
128 |
+
}
|
129 |
$media_array[ $key ]->guid = $src;
|
130 |
$media_array[ $key ]->rt_permalink = get_rtmedia_permalink( $media->id );
|
131 |
}
|
159 |
|
160 |
// do_action('rtmedia_before_update_media',$rtmedia_query->action_query->id);
|
161 |
|
162 |
+
$data = rtmedia_sanitize_object( $_POST, array( 'media_title', 'description', 'privacy' ) );
|
163 |
$media = new RTMediaMedia();
|
164 |
$media->update( $rtmedia_query->action_query->id, $data, $rtmedia_query->media[ 0 ]->media_id );
|
165 |
$rtmedia_query->query( false );
|
166 |
|
167 |
// do_action('rtmedia_after_update_media',$rtmedia_query->action_query->id);
|
|
|
168 |
} else {
|
169 |
echo __( "Ooops !!! Invalid access. No nonce was found !!", "rtmedia" );
|
170 |
}
|
312 |
exit;
|
313 |
}
|
314 |
|
315 |
+
function check_return_comments() {
|
|
|
|
|
|
|
|
|
316 |
global $rtmedia_query;
|
317 |
|
318 |
+
if ( $rtmedia_query->action_query->action != 'comment' )
|
319 |
+
return;
|
320 |
+
if ( isset( $rtmedia_query->action_query->id ) && count( $_POST ) ) {
|
321 |
+
/**
|
322 |
+
* /media/comments [POST]
|
323 |
+
* Post a comment to the album by post id
|
324 |
+
*/
|
325 |
+
$nonce = $_REQUEST[ 'rtmedia_comment_nonce' ];
|
326 |
+
if ( wp_verify_nonce( $nonce, 'rtmedia_comment_nonce' ) ) {
|
327 |
+
if ( empty( $_POST[ 'comment_content' ] ) ) {
|
328 |
+
return false;
|
329 |
+
}
|
330 |
+
$comment = new RTMediaComment();
|
331 |
+
$attr = $_POST;
|
332 |
+
if ( ! isset( $attr[ 'comment_post_ID' ] ) )
|
333 |
+
$attr[ 'comment_post_ID' ] = $rtmedia_query->action_query->id;
|
334 |
+
$id = $comment->add( $attr );
|
335 |
+
|
336 |
+
$mediaModel = new RTMediaModel();
|
337 |
+
$result = $mediaModel->get( array( 'id' => $rtmedia_query->action_query->id ) );
|
338 |
+
|
339 |
+
if ( $result[ 0 ]->activity_id != NULL ) {
|
340 |
+
global $rtmedia_buddypress_activity;
|
341 |
+
remove_action( "bp_activity_comment_posted", array( $rtmedia_buddypress_activity, "comment_sync" ), 10, 2 );
|
342 |
+
if ( function_exists( 'bp_activity_new_comment' ) ) {
|
343 |
+
bp_activity_new_comment( array( 'content' => $_POST[ 'comment_content' ], 'activity_id' => $result[ 0 ]->activity_id ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
344 |
}
|
345 |
}
|
346 |
+
if ( isset( $_POST[ "rtajax" ] ) ) {
|
347 |
+
global $wpdb;
|
348 |
+
$comments = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->comments WHERE comment_ID = %d", $id ), ARRAY_A );
|
349 |
+
echo rmedia_single_comment( $comments );
|
350 |
+
exit;
|
351 |
+
}
|
352 |
+
} else {
|
353 |
+
echo "Ooops !!! Invalid access. No nonce was found !!";
|
354 |
+
}
|
355 |
+
}
|
356 |
}
|
357 |
|
358 |
/**
|
410 |
global $rtmedia_query;
|
411 |
|
412 |
$rtmedia_query->query( $attr );
|
|
|
413 |
}
|
414 |
|
415 |
/**
|
419 |
*/
|
420 |
function get_default_template() {
|
421 |
|
422 |
+
return apply_filters( 'rtmedia_media_template_include', self::locate_template('main','') );
|
423 |
}
|
424 |
|
425 |
/**
|
428 |
* @param type $template
|
429 |
* @return string
|
430 |
*/
|
431 |
+
static function locate_template( $template=false, $context = false ) {
|
432 |
$located = '';
|
433 |
+
if ( ! $template ) {
|
434 |
+
global $rtmedia_query;
|
435 |
+
|
436 |
+
if ( is_rtmedia_album_gallery() ) {
|
437 |
+
$template = 'album-gallery';
|
438 |
+
} elseif ( is_rtmedia_album() || is_rtmedia_gallery() ) {
|
439 |
+
$template = 'media-gallery';
|
440 |
+
if (
|
441 |
+
is_rtmedia_album() &&
|
442 |
+
isset( $rtmedia_query->media_query ) &&
|
443 |
+
$rtmedia_query->action_query->action == 'edit'
|
444 |
+
) {
|
445 |
+
if ( isset( $rtmedia_query->media_query[ 'media_author' ] ) && (get_current_user_id() == $rtmedia_query->media_query[ 'media_author' ]) ) {
|
446 |
+
$template = 'album-single-edit';
|
447 |
+
}
|
448 |
+
}
|
449 |
+
} else if ( is_rtmedia_single() ) {
|
450 |
+
$template = 'media-single';
|
451 |
+
if ( $rtmedia_query->action_query->action == 'edit' )
|
452 |
+
$template = 'media-single-edit';
|
453 |
+
}else{
|
454 |
+
return;
|
455 |
+
}
|
456 |
+
}
|
457 |
+
|
458 |
|
459 |
$template_name = $template . '.php';
|
460 |
|
461 |
+
if ( $context===false ){
|
462 |
+
$context = 'media/';
|
463 |
+
}
|
464 |
+
if(!$context===''){
|
465 |
+
$context .='/';
|
466 |
+
}
|
467 |
+
|
468 |
|
469 |
+
$path = 'rtmedia/' . $context ;
|
470 |
+
$ogpath = 'templates/' . $context ;
|
471 |
|
472 |
|
473 |
if ( file_exists( STYLESHEETPATH . $path . $template_name ) ) {
|
app/main/controllers/template/rt-template-functions.php
CHANGED
@@ -476,6 +476,9 @@ function rtmedia_pagination_next_link() {
|
|
476 |
$link .= $site_url . $post->post_name . '/';
|
477 |
}
|
478 |
$link .= 'media/';
|
|
|
|
|
|
|
479 |
if (isset($rtmedia_query->action_query->media_type)) {
|
480 |
if (in_array($rtmedia_query->action_query->media_type, array("photo", "music", "video", "album")))
|
481 |
$link .= $rtmedia_query->action_query->media_type . '/';
|
@@ -775,7 +778,7 @@ function rtmedia_album_edit() {
|
|
775 |
<?php wp_nonce_field('rtmedia_delete_album_' . $rtmedia_query->media_query['album_id'], 'rtmedia_delete_album_nonce'); ?>
|
776 |
<input type="submit" name="album-delete" value="<?php _e('Delete', 'rtmedia'); ?>" />
|
777 |
</form>
|
778 |
-
<?php
|
779 |
if( $album_list = rtmedia_user_album_list()){ ?>
|
780 |
<input type="button" class="button rtmedia-merge" value="<?php _e('Merge', 'rtmedia'); ?>" />
|
781 |
<div class="rtmedia-merge-container">
|
@@ -824,4 +827,7 @@ function is_rtmedia_album_enable(){
|
|
824 |
}
|
825 |
return false;
|
826 |
}
|
827 |
-
|
|
|
|
|
|
476 |
$link .= $site_url . $post->post_name . '/';
|
477 |
}
|
478 |
$link .= 'media/';
|
479 |
+
if(isset($rtmedia_query->media_query["album_id"]) && intval($rtmedia_query->media_query["album_id"]) > 0){
|
480 |
+
$link .= $rtmedia_query->media_query["album_id"] . "/";
|
481 |
+
}
|
482 |
if (isset($rtmedia_query->action_query->media_type)) {
|
483 |
if (in_array($rtmedia_query->action_query->media_type, array("photo", "music", "video", "album")))
|
484 |
$link .= $rtmedia_query->action_query->media_type . '/';
|
778 |
<?php wp_nonce_field('rtmedia_delete_album_' . $rtmedia_query->media_query['album_id'], 'rtmedia_delete_album_nonce'); ?>
|
779 |
<input type="submit" name="album-delete" value="<?php _e('Delete', 'rtmedia'); ?>" />
|
780 |
</form>
|
781 |
+
<?php
|
782 |
if( $album_list = rtmedia_user_album_list()){ ?>
|
783 |
<input type="button" class="button rtmedia-merge" value="<?php _e('Merge', 'rtmedia'); ?>" />
|
784 |
<div class="rtmedia-merge-container">
|
827 |
}
|
828 |
return false;
|
829 |
}
|
830 |
+
|
831 |
+
function rtmedia_load_template(){
|
832 |
+
include(RTMediaTemplate::locate_template());
|
833 |
+
}
|
app/main/controllers/upload/RTMediaUploadEndpoint.php
CHANGED
@@ -27,7 +27,7 @@ class RTMediaUploadEndpoint {
|
|
27 |
$nonce = $_REQUEST['rtmedia_upload_nonce'];
|
28 |
$mode = $_REQUEST['mode'];
|
29 |
$rtupload =false;
|
30 |
-
|
31 |
if (wp_verify_nonce($nonce, 'rtmedia_upload_nonce')) {
|
32 |
$model = new RTMediaUploadModel();
|
33 |
$this->upload = $model->set_post_object();
|
@@ -38,10 +38,23 @@ class RTMediaUploadEndpoint {
|
|
38 |
$rtupload = new RTMediaUpload($this->upload);
|
39 |
$mediaObj = new RTMediaMedia();
|
40 |
$media = $mediaObj->model->get(array('id'=>$rtupload->media_ids[0]));
|
41 |
-
if($activity_id==-1) {
|
42 |
$activity_id = $mediaObj->insert_activity($rtupload->media_ids[0], $media[0]);
|
43 |
} else {
|
44 |
$mediaObj->model->update(array( 'activity_id' => $activity_id ), array( 'id' => $rtupload->media_ids[0] ));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
}
|
46 |
}
|
47 |
if(isset($_POST["redirect"]) && $_POST["redirect"]=="no" ){
|
27 |
$nonce = $_REQUEST['rtmedia_upload_nonce'];
|
28 |
$mode = $_REQUEST['mode'];
|
29 |
$rtupload =false;
|
30 |
+
$activity_id = -1;
|
31 |
if (wp_verify_nonce($nonce, 'rtmedia_upload_nonce')) {
|
32 |
$model = new RTMediaUploadModel();
|
33 |
$this->upload = $model->set_post_object();
|
38 |
$rtupload = new RTMediaUpload($this->upload);
|
39 |
$mediaObj = new RTMediaMedia();
|
40 |
$media = $mediaObj->model->get(array('id'=>$rtupload->media_ids[0]));
|
41 |
+
if($activity_id==-1 && (!(isset($_POST["rtmedia_update"]) && $_POST["rtmedia_update"]=="true"))) {
|
42 |
$activity_id = $mediaObj->insert_activity($rtupload->media_ids[0], $media[0]);
|
43 |
} else {
|
44 |
$mediaObj->model->update(array( 'activity_id' => $activity_id ), array( 'id' => $rtupload->media_ids[0] ));
|
45 |
+
$same_medias = $mediaObj->model->get(array('activity_id'=>$activity_id));
|
46 |
+
|
47 |
+
$update_activity_media = Array();
|
48 |
+
foreach($same_medias as $a_media){
|
49 |
+
$update_activity_media[] = $a_media->id;
|
50 |
+
}
|
51 |
+
$privacy = 0;
|
52 |
+
if(isset($_POST["privacy"])){
|
53 |
+
$privacy = $_POST["privacy"];
|
54 |
+
}
|
55 |
+
$objActivity = new RTMediaActivity($update_activity_media, $privacy, false);
|
56 |
+
global $wpdb, $bp;
|
57 |
+
$wpdb->update($bp->activity->table_name, array("type" => "rtmedia_update", "content" => $objActivity->create_activity_html()), array("id" => $activity_id));
|
58 |
}
|
59 |
}
|
60 |
if(isset($_POST["redirect"]) && $_POST["redirect"]=="no" ){
|
app/main/controllers/upload/RTMediaUploadView.php
CHANGED
@@ -46,7 +46,7 @@ class RTMediaUploadView {
|
|
46 |
if ( $rtmedia_query && is_rtmedia_album()){
|
47 |
$album = '<input class="rtmedia-current-album" type="hidden" name="rtmedia-current-album" value="'.$rtmedia_query->media_query['album_id'].'" />';
|
48 |
}elseif (is_rtmedia_album_enable () && $rtmedia_query && is_rtmedia_gallery() ){
|
49 |
-
|
50 |
if($rtmedia_query->query['context']=='profile'){
|
51 |
$album = '<select name="album" class="rtmedia-user-album-list">'.rtmedia_user_album_list().'</select>';
|
52 |
}
|
@@ -90,10 +90,10 @@ class RTMediaUploadView {
|
|
90 |
|
91 |
if (!$template_name)
|
92 |
$located = false;
|
93 |
-
if (file_exists(STYLESHEETPATH . '/rtmedia/' . $template_name)) {
|
94 |
-
$located = STYLESHEETPATH . '/rtmedia/' . $template_name;
|
95 |
-
} else if (file_exists(TEMPLATEPATH . '/rtmedia/' . $template_name)) {
|
96 |
-
$located = TEMPLATEPATH . '/rtmedia/' . $template_name;
|
97 |
} else {
|
98 |
$located = RTMEDIA_PATH . 'templates/upload/' . $template_name;
|
99 |
}
|
46 |
if ( $rtmedia_query && is_rtmedia_album()){
|
47 |
$album = '<input class="rtmedia-current-album" type="hidden" name="rtmedia-current-album" value="'.$rtmedia_query->media_query['album_id'].'" />';
|
48 |
}elseif (is_rtmedia_album_enable () && $rtmedia_query && is_rtmedia_gallery() ){
|
49 |
+
|
50 |
if($rtmedia_query->query['context']=='profile'){
|
51 |
$album = '<select name="album" class="rtmedia-user-album-list">'.rtmedia_user_album_list().'</select>';
|
52 |
}
|
90 |
|
91 |
if (!$template_name)
|
92 |
$located = false;
|
93 |
+
if (file_exists(STYLESHEETPATH . '/rtmedia/upload/' . $template_name)) {
|
94 |
+
$located = STYLESHEETPATH . '/rtmedia/upload/' . $template_name;
|
95 |
+
} else if (file_exists(TEMPLATEPATH . '/rtmedia/upload/' . $template_name)) {
|
96 |
+
$located = TEMPLATEPATH . '/rtmedia/upload/' . $template_name;
|
97 |
} else {
|
98 |
$located = RTMEDIA_PATH . 'templates/upload/' . $template_name;
|
99 |
}
|
app/main/routers/query/RTMediaQuery.php
CHANGED
@@ -256,10 +256,14 @@ class RTMediaQuery {
|
|
256 |
case 'id':
|
257 |
|
258 |
// /media/23/edit/ | media/23/delete/ | /media/23/like/
|
259 |
-
|
260 |
|
261 |
$action = $second_modifier;
|
262 |
-
|
|
|
|
|
|
|
|
|
263 |
break;
|
264 |
|
265 |
case 'pg':
|
256 |
case 'id':
|
257 |
|
258 |
// /media/23/edit/ | media/23/delete/ | /media/23/like/
|
259 |
+
if ( array_key_exists( $second_modifier, $this->actions ) ) {
|
260 |
|
261 |
$action = $second_modifier;
|
262 |
+
}else if($second_modifier == "pg"){
|
263 |
+
if(isset($raw_query[ 2 ]) && is_numeric($raw_query[ 2 ])){
|
264 |
+
$pageno = $raw_query[ 2 ];
|
265 |
+
}
|
266 |
+
}
|
267 |
break;
|
268 |
|
269 |
case 'pg':
|
index.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: rtMedia for WordPress, BuddyPress and bbPress
|
4 |
Plugin URI: http://rtcamp.com/buddypress-media/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media
|
5 |
Description: This plugin adds missing media rich features like photos, videos and audio uploading to BuddyPress which are essential if you are building social network, seriously!
|
6 |
-
Version: 3.0.
|
7 |
Author: rtCamp
|
8 |
Text Domain: rtmedia
|
9 |
Author URI: http://rtcamp.com/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media
|
3 |
Plugin Name: rtMedia for WordPress, BuddyPress and bbPress
|
4 |
Plugin URI: http://rtcamp.com/buddypress-media/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media
|
5 |
Description: This plugin adds missing media rich features like photos, videos and audio uploading to BuddyPress which are essential if you are building social network, seriously!
|
6 |
+
Version: 3.0.3
|
7 |
Author: rtCamp
|
8 |
Text Domain: rtmedia
|
9 |
Author URI: http://rtcamp.com/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media
|
readme.txt
CHANGED
@@ -6,7 +6,7 @@ License: GPLv2 or later
|
|
6 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
7 |
Requires at least: WordPress 3.5
|
8 |
Tested up to: WordPress 3.5.2 + BuddyPress 1.7
|
9 |
-
Stable tag: 3.0.
|
10 |
|
11 |
rtMedia adds albums, audio/video encoding, privacy/sharing, front-end uploads & more. All this works nicely on mobile/tablets devices.
|
12 |
|
@@ -160,6 +160,13 @@ Please visit [rtMedia's Features page](http://rtcamp.com/buddypress-media/?utm_s
|
|
160 |
|
161 |
Please visit [rtMedia's Roadmap page](http://rtcamp.com/buddypress-media/roadmap/?utm_source=readme&utm_medium=plugin&utm_campaign=buddypress-media "Visit rtMedia's Features page") to get some details about future releases.
|
162 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
= 3.0.2 =
|
164 |
* Legacy code added for Addon Updates
|
165 |
* Added album enable /disable option
|
@@ -469,8 +476,8 @@ Please visit [rtMedia's Roadmap page](http://rtcamp.com/buddypress-media/roadmap
|
|
469 |
|
470 |
== Upgrade Notice ==
|
471 |
|
472 |
-
= 3.0.
|
473 |
-
|
474 |
|
475 |
== Sponsors ==
|
476 |
|
6 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
7 |
Requires at least: WordPress 3.5
|
8 |
Tested up to: WordPress 3.5.2 + BuddyPress 1.7
|
9 |
+
Stable tag: 3.0.3
|
10 |
|
11 |
rtMedia adds albums, audio/video encoding, privacy/sharing, front-end uploads & more. All this works nicely on mobile/tablets devices.
|
12 |
|
160 |
|
161 |
Please visit [rtMedia's Roadmap page](http://rtcamp.com/buddypress-media/roadmap/?utm_source=readme&utm_medium=plugin&utm_campaign=buddypress-media "Visit rtMedia's Features page") to get some details about future releases.
|
162 |
|
163 |
+
= 3.0.3 =
|
164 |
+
* Improved template system
|
165 |
+
* Fixed bug with audio/video uploads
|
166 |
+
* Fixed bug with featured media
|
167 |
+
* Fixed activity duplication issue
|
168 |
+
* Other minor bug fixes
|
169 |
+
|
170 |
= 3.0.2 =
|
171 |
* Legacy code added for Addon Updates
|
172 |
* Added album enable /disable option
|
476 |
|
477 |
== Upgrade Notice ==
|
478 |
|
479 |
+
= 3.0.3 =
|
480 |
+
Fixed bugs. Improved template system.
|
481 |
|
482 |
== Sponsors ==
|
483 |
|
templates/main.php
ADDED
@@ -0,0 +1,168 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/****************************************
|
4 |
+
* Main.php
|
5 |
+
*
|
6 |
+
* The main template file, that loads the header, footer and sidebar
|
7 |
+
* apart from loading the appropriate rtMedia template
|
8 |
+
*****************************************/
|
9 |
+
// by default it is not an ajax request
|
10 |
+
|
11 |
+
$ajax = false;
|
12 |
+
|
13 |
+
// check if it is an ajax request
|
14 |
+
if (
|
15 |
+
! empty( $_SERVER[ 'HTTP_X_REQUESTED_WITH' ] ) &&
|
16 |
+
strtolower( $_SERVER[ 'HTTP_X_REQUESTED_WITH' ] ) == 'xmlhttprequest'
|
17 |
+
){
|
18 |
+
$ajax = true;
|
19 |
+
}
|
20 |
+
|
21 |
+
|
22 |
+
//if it's not an ajax request, load headers
|
23 |
+
if ( ! $ajax ) {
|
24 |
+
|
25 |
+
// if this is a BuddyPress page, set template type to
|
26 |
+
// buddypress to load appropriate headers
|
27 |
+
if ( class_exists( 'BuddyPress' ) && ! bp_is_blog_page() ) {
|
28 |
+
$template_type = 'buddypress';
|
29 |
+
} else {
|
30 |
+
$template_type = '';
|
31 |
+
}
|
32 |
+
|
33 |
+
get_header( $template_type );
|
34 |
+
|
35 |
+
// the markup for the template starts
|
36 |
+
?>
|
37 |
+
|
38 |
+
|
39 |
+
<div id="primary" class="site-content">
|
40 |
+
|
41 |
+
|
42 |
+
<?php
|
43 |
+
if ( $template_type == 'buddypress' ) {
|
44 |
+
//load buddypress markup
|
45 |
+
?>
|
46 |
+
<div id ="content">
|
47 |
+
<div id="buddypress" class="padder">
|
48 |
+
|
49 |
+
<?php
|
50 |
+
|
51 |
+
if ( bp_displayed_user_id() ) {
|
52 |
+
|
53 |
+
//if it is a buddypress member profile
|
54 |
+
|
55 |
+
?>
|
56 |
+
<div id="item-header">
|
57 |
+
|
58 |
+
<?php bp_get_template_part( 'members/single/member-header' ) ?>
|
59 |
+
|
60 |
+
</div><!--#item-header-->
|
61 |
+
|
62 |
+
<div id="item-nav">
|
63 |
+
<div class="item-list-tabs no-ajax" id="object-nav" role="navigation">
|
64 |
+
<ul>
|
65 |
+
|
66 |
+
<?php bp_get_displayed_user_nav(); ?>
|
67 |
+
|
68 |
+
<?php do_action( 'bp_member_options_nav' ); ?>
|
69 |
+
|
70 |
+
</ul>
|
71 |
+
</div>
|
72 |
+
</div><!--#item-nav-->
|
73 |
+
|
74 |
+
<div id="item-body">
|
75 |
+
|
76 |
+
<?php do_action( 'bp_before_member_body' ); ?>
|
77 |
+
<?php do_action( 'bp_before_member_media' ); ?>
|
78 |
+
<div class="item-list-tabs no-ajax" id="subnav">
|
79 |
+
<ul>
|
80 |
+
|
81 |
+
<?php rtmedia_sub_nav(); ?>
|
82 |
+
|
83 |
+
<?php do_action( 'rtmedia_sub_nav' ); ?>
|
84 |
+
|
85 |
+
</ul>
|
86 |
+
</div><!-- .item-list-tabs -->
|
87 |
+
|
88 |
+
<?php
|
89 |
+
} else if ( bp_is_group() ) {
|
90 |
+
|
91 |
+
//not a member profile, but a group
|
92 |
+
?>
|
93 |
+
|
94 |
+
<?php
|
95 |
+
if ( bp_has_groups() ) : while ( bp_groups() ) : bp_the_group();
|
96 |
+
?>
|
97 |
+
<div id="item-header">
|
98 |
+
|
99 |
+
<?php bp_get_template_part( 'groups/single/group-header' ); ?>
|
100 |
+
|
101 |
+
</div><!--#item-header-->
|
102 |
+
|
103 |
+
<div id="item-nav">
|
104 |
+
<div class="item-list-tabs no-ajax" id="object-nav" role="navigation">
|
105 |
+
<ul>
|
106 |
+
|
107 |
+
<?php bp_get_options_nav(); ?>
|
108 |
+
|
109 |
+
<?php do_action( 'bp_group_options_nav' ); ?>
|
110 |
+
|
111 |
+
</ul>
|
112 |
+
</div>
|
113 |
+
</div><!-- #item-nav -->
|
114 |
+
|
115 |
+
|
116 |
+
<div id="item-body">
|
117 |
+
|
118 |
+
<?php do_action( 'bp_before_group_body' ); ?>
|
119 |
+
<?php do_action( 'bp_before_group_media' ); ?>
|
120 |
+
<div class="item-list-tabs no-ajax" id="subnav">
|
121 |
+
<ul>
|
122 |
+
|
123 |
+
<?php rtmedia_sub_nav(); ?>
|
124 |
+
|
125 |
+
<?php do_action( 'rtmedia_sub_nav' ); ?>
|
126 |
+
|
127 |
+
</ul>
|
128 |
+
</div><!-- .item-list-tabs -->
|
129 |
+
<?php
|
130 |
+
endwhile;
|
131 |
+
endif;
|
132 |
+
} // group/profile if/else
|
133 |
+
} //if BuddyPress
|
134 |
+
} // if ajax
|
135 |
+
|
136 |
+
|
137 |
+
// include the right rtMedia template
|
138 |
+
rtmedia_load_template();
|
139 |
+
|
140 |
+
|
141 |
+
|
142 |
+
|
143 |
+
if ( ! $ajax ) {
|
144 |
+
if ( $template_type == 'buddypress' && (bp_displayed_user_id() || bp_is_group()) ) {
|
145 |
+
|
146 |
+
if ( bp_is_group() ) {
|
147 |
+
do_action( 'bp_after_group_media' );
|
148 |
+
do_action( 'bp_after_group_body' );
|
149 |
+
}
|
150 |
+
if ( bp_displayed_user_id() ) {
|
151 |
+
do_action( 'bp_after_member_media' );
|
152 |
+
do_action( 'bp_after_member_body' );
|
153 |
+
}
|
154 |
+
//close all markup
|
155 |
+
?>
|
156 |
+
|
157 |
+
</div><!--#item-body-->
|
158 |
+
</div><!--#buddypress-->
|
159 |
+
</div><!--#content-->
|
160 |
+
</div><!--#site-content-->
|
161 |
+
|
162 |
+
<?php
|
163 |
+
get_sidebar( $template_type );
|
164 |
+
|
165 |
+
get_footer( $template_type );
|
166 |
+
} //if Buddypress
|
167 |
+
} // if ajax
|
168 |
+
?>
|
templates/media/album-gallery.php
CHANGED
@@ -19,12 +19,24 @@
|
|
19 |
|
20 |
<!-- these links will be handled by backbone later
|
21 |
-- get request parameters will be removed -->
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
<?php } else { ?>
|
30 |
<p><?php echo __("Oops !! There's no media found for the request !!","rtmedia"); ?></p>
|
19 |
|
20 |
<!-- these links will be handled by backbone later
|
21 |
-- get request parameters will be removed -->
|
22 |
+
<?php
|
23 |
+
$display = '';
|
24 |
+
if (rtmedia_offset() != 0)
|
25 |
+
$display = 'style="display:block;"';
|
26 |
+
else
|
27 |
+
$display = 'style="display:none;"';
|
28 |
+
?>
|
29 |
+
<a id="rtMedia-galary-prev" <?php echo $display; ?> href="<?php echo rtmedia_pagination_prev_link(); ?>"><?php echo __('Prev','rtmedia'); ?></a>
|
30 |
+
|
31 |
+
<?php
|
32 |
+
$display = '';
|
33 |
+
if (rtmedia_offset() + rtmedia_per_page_media() < rtmedia_count())
|
34 |
+
$display = 'style="display:block;"';
|
35 |
+
else
|
36 |
+
$display = 'style="display:none;"';
|
37 |
+
?>
|
38 |
+
<a id="rtMedia-galary-next" <?php echo $display; ?> href="<?php echo rtmedia_pagination_next_link(); ?>"><?php echo __('Next','rtmedia'); ?></a>
|
39 |
+
|
40 |
|
41 |
<?php } else { ?>
|
42 |
<p><?php echo __("Oops !! There's no media found for the request !!","rtmedia"); ?></p>
|