rtMedia for WordPress, BuddyPress and bbPress - Version 3.8

Version Description

  • Removed ZURB Foundation
  • Removed FontAwesome fonts and instead used WordPress Dashicons
  • Template updates
  • Admin settings UI changes
  • Media gallery UI changes
  • Direct media upload on file selection
  • Bug fixes
Download this release

Release Info

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

Code changes from version 3.7.44 to 3.8

Files changed (101) hide show
  1. Gruntfile.js +65 -0
  2. app/admin/RTMediaAdmin.php +653 -580
  3. app/admin/RTMediaFormHandler.php +493 -571
  4. app/assets/admin/css/admin-css-migration.md +9 -0
  5. app/assets/admin/css/admin.css +1 -0
  6. app/assets/admin/css/sass/_addons.scss +68 -0
  7. app/assets/admin/css/sass/_components.scss +356 -0
  8. app/assets/admin/css/sass/_layout.scss +73 -0
  9. app/assets/admin/css/sass/_responsive.scss +231 -0
  10. app/assets/admin/css/sass/_rtl.scss +45 -0
  11. app/assets/admin/css/sass/_rtmedia-pro.scss +84 -0
  12. app/assets/admin/css/sass/_sidebar.scss +35 -0
  13. app/assets/admin/css/sass/_support-form.scss +26 -0
  14. app/assets/admin/css/sass/_switch.scss +96 -0
  15. app/assets/admin/css/sass/_tabs.scss +75 -0
  16. app/assets/admin/css/sass/_themes.scss +25 -0
  17. app/assets/admin/css/sass/_tooltip.scss +90 -0
  18. app/assets/admin/css/sass/_utility.scss +85 -0
  19. app/assets/admin/css/sass/_variables.scss +66 -0
  20. app/assets/admin/css/sass/admin.scss +45 -0
  21. app/assets/admin/css/sass/widget.scss +76 -0
  22. app/assets/admin/css/widget.css +1 -0
  23. app/assets/admin/img/audio_thumb.png +0 -0
  24. app/assets/admin/img/boxspinner.gif +0 -0
  25. app/assets/admin/img/image_thumb.png +0 -0
  26. app/assets/admin/img/rtDating.png +0 -0
  27. app/assets/admin/img/rtMedia-pro-ad.png +0 -0
  28. app/assets/admin/img/rtcamp-logo.png +0 -0
  29. app/assets/admin/img/rtmedia-ffmpeg-240x184.png +0 -0
  30. app/assets/admin/img/rtmedia-instagram-240x184.png +0 -0
  31. app/assets/admin/img/rtmedia-kaltura-240x184.png +0 -0
  32. app/assets/admin/img/rtmedia-logo.png +0 -0
  33. app/assets/admin/img/rtmedia-membership-240x184.png +0 -0
  34. app/assets/admin/img/rtmedia-phototagging-240x184.png +0 -0
  35. app/assets/admin/img/rtmedia-social-sync-240x184.png +0 -0
  36. app/assets/admin/img/rtmedia-theme-InspireBook.png +0 -0
  37. app/assets/admin/img/rtmedia-theme-klein.jpg +0 -0
  38. app/assets/admin/img/rtmedia-theme-kleo.png +0 -0
  39. app/assets/admin/img/rtmedia-theme-msocial.jpg +0 -0
  40. app/assets/admin/img/rtmedia-theme-sweetdate.png +0 -0
  41. app/assets/admin/img/rtmedia-watermark-240x184.png +0 -0
  42. app/assets/admin/img/thumb_default.png +0 -0
  43. app/assets/admin/img/video_thumb.png +0 -0
  44. app/assets/admin/js/admin-min.js +4 -0
  45. app/assets/admin/js/admin.js +781 -0
  46. app/assets/admin/js/scripts.js +171 -0
  47. app/assets/admin/js/vendors/tabs.js +129 -0
  48. app/assets/css/main.css +1 -1
  49. app/assets/css/sass/.bowerrc +1 -0
  50. app/assets/css/sass/_activity.scss +109 -0
  51. app/assets/css/sass/_album.scss +21 -0
  52. app/assets/css/sass/_buddypress.scss +47 -0
  53. app/assets/css/sass/_img-edit.scss +702 -0
  54. app/assets/css/sass/_magnific.scss +494 -0
  55. app/assets/css/sass/_media-element.scss +51 -0
  56. app/assets/css/sass/_media-tab.scss +205 -0
  57. app/assets/css/sass/_popup.scss +439 -0
  58. app/assets/css/sass/_responsive.scss +30 -0
  59. app/assets/css/sass/_rtl.scss +141 -0
  60. app/assets/css/sass/_rtmedia.scss +257 -0
  61. app/assets/css/sass/_tabs.scss +67 -0
  62. app/assets/css/sass/_utility.scss +136 -0
  63. app/assets/css/sass/_variables.scss +26 -0
  64. app/assets/css/sass/main.scss +44 -0
  65. app/assets/js/main.js +5 -835
  66. app/assets/js/rtMedia.backbone.js +1119 -1048
  67. app/assets/js/rtMedia.js +556 -587
  68. app/assets/js/vendors/magnific-popup.js +2002 -0
  69. app/helper/RTMediaAddon.php +81 -115
  70. app/helper/RTMediaLicense.php +93 -11
  71. app/helper/RTMediaModel.php +2 -2
  72. app/helper/RTMediaSettings.php +12 -2
  73. app/helper/RTMediaSupport.php +208 -257
  74. app/helper/RTMediaThemes.php +210 -162
  75. app/helper/rtDimensions.php +34 -43
  76. app/helper/rtForm.php +175 -173
  77. app/importers/BPMediaAlbumimporter.php +86 -86
  78. app/main/RTMedia.php +954 -949
  79. app/main/controllers/activity/RTMediaActivity.php +28 -39
  80. app/main/controllers/activity/RTMediaBuddyPressActivity.php +19 -16
  81. app/main/controllers/media/RTMediaFeatured.php +1 -1
  82. app/main/controllers/media/RTMediaGroupFeatured.php +1 -1
  83. app/main/controllers/media/RTMediaLike.php +57 -48
  84. app/main/controllers/privacy/RTMediaPrivacy.php +308 -317
  85. app/main/controllers/shortcodes/RTMediaGalleryShortcode.php +10 -2
  86. app/main/controllers/template/RTMediaTemplate.php +0 -1
  87. app/main/controllers/template/rt-template-functions.php +783 -834
  88. app/main/controllers/upload/RTMediaUploadView.php +99 -100
  89. app/services/RTMediaEncoding.php +74 -56
  90. config.rb +37 -0
  91. index.php +8 -16
  92. package.json +13 -0
  93. readme.txt +13 -4
  94. templates/media/album-gallery-item.php +28 -21
  95. templates/media/album-gallery.php +56 -52
  96. templates/media/album-single-edit.php +112 -106
  97. templates/media/media-gallery-item.php +22 -9
  98. templates/media/media-gallery.php +66 -71
  99. templates/media/media-single-edit.php +51 -52
  100. templates/media/media-single.php +152 -143
  101. templates/upload/uploader.php +114 -89
Gruntfile.js ADDED
@@ -0,0 +1,65 @@
1
+ 'use strict';
2
+ module.exports = function ( grunt ) {
3
+
4
+ // load all grunt tasks matching the `grunt-*` pattern
5
+ // Ref. https://npmjs.org/package/load-grunt-tasks
6
+ require( 'load-grunt-tasks' )( grunt );
7
+
8
+ grunt.initConfig( {
9
+ // SCSS and Compass
10
+ // Ref. https://npmjs.org/package/grunt-contrib-compass
11
+ compass: {
12
+ frontend: {
13
+ options: {
14
+ config: 'config.rb',
15
+ force: true
16
+ }
17
+ },
18
+ // Admin Panel CSS
19
+ backend: {
20
+ options: {
21
+ sassDir: 'app/assets/admin/css/sass/',
22
+ cssDir: 'app/assets/admin/css/'
23
+ }
24
+ }
25
+ },
26
+ // Uglify
27
+ // Compress and Minify JS files
28
+ // Ref. https://npmjs.org/package/grunt-contrib-uglify
29
+ uglify: {
30
+ options: {
31
+ banner: '/*! \n * rtMedia JavaScript Library \n * @package rtMedia \n */'
32
+ },
33
+ frontend: {
34
+ src: [
35
+ 'app/assets/js/vendors/magnific-popup.js',
36
+ 'app/assets/admin/js/vendors/tabs.js',
37
+ 'app/assets/js/rtMedia.js'
38
+ ],
39
+ dest: 'app/assets/js/main.js'
40
+ },
41
+ backend: {
42
+ src: [
43
+ 'app/assets/admin/js/vendors/tabs.js',
44
+ 'app/assets/admin/js/scripts.js',
45
+ 'app/assets/admin/js/admin.js'
46
+ ],
47
+ dest: 'app/assets/admin/js/admin-min.js'
48
+ }
49
+ },
50
+ // Watch for hanges and trigger compass and uglify
51
+ // Ref. https://npmjs.org/package/grunt-contrib-watch
52
+ watch: {
53
+ compass: { files: [ '**/*.{scss,sass}' ],
54
+ tasks: [ 'compass' ]
55
+ },
56
+ uglify: {
57
+ files: [ '<%= uglify.frontend.src %>', '<%= uglify.backend.src %>' ],
58
+ tasks: [ 'uglify' ]
59
+ }
60
+ }
61
+ } );
62
+
63
+ // Register Task
64
+ grunt.registerTask( 'default', [ 'watch' ] );
65
+ };
app/admin/RTMediaAdmin.php CHANGED
@@ -6,7 +6,7 @@
6
* @subpackage Admin
7
*
8
*/
9
- if ( ! class_exists( 'RTMediaAdmin' ) ){
10
11
/**
12
* RTMediaAdmin class.
@@ -25,13 +25,12 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
25
* @access public
26
* @return void
27
*/
28
- public function __construct(){
29
global $rtmedia;
30
31
// Actions and filters
32
add_action( 'init', array( $this, 'video_transcoding_survey_response' ) );
33
// add_action( 'admin_init', array( $this, 'presstrends_plugin' ) );
34
-
35
//$rtmedia_feed = new RTMediaFeed();
36
add_filter( 'plugin_action_links_' . RTMEDIA_BASE_NAME, array( &$this, 'plugin_add_settings_link' ) );
37
//add_action ( 'wp_ajax_rtmedia_fetch_feed', array( $rtmedia_feed, 'fetch_feed' ), 1 );
@@ -57,7 +56,7 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
57
58
$obj_encoding = new RTMediaEncoding( true );
59
60
- if ( $obj_encoding->api_key ){
61
add_filter( 'media_row_actions', array( $this, 'add_reencode_link' ), null, 2 );
62
add_action( 'admin_head-upload.php', array( $this, 'add_bulk_actions_regenerate' ) );
63
add_action( 'admin_footer', array( $this, 'rtmedia_regenerate_thumb_js' ) );
@@ -67,27 +66,27 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
67
68
add_action( 'wp_ajax_rt_media_regeneration', array( $this, 'rt_media_regeneration' ), 1 );
69
70
- if ( ! isset( $rtmedia->options ) ){
71
$rtmedia->options = rtmedia_get_site_option( 'rtmedia-options' );
72
}
73
74
- if ( isset( $_POST['rtmedia-options'] ) ){
75
- if ( isset( $_POST['rtmedia-options']['general_showAdminMenu'] ) && '1' == $_POST['rtmedia-options']['general_showAdminMenu'] ){
76
add_action( 'admin_bar_menu', array( $this, 'admin_bar_menu' ), 100, 1 );
77
}
78
} else {
79
- if ( 1 == intval( $rtmedia->options['general_showAdminMenu'] ) ){
80
add_action( 'admin_bar_menu', array( $this, 'admin_bar_menu' ), 100, 1 );
81
}
82
}
83
84
- if ( is_admin() ){
85
add_action( 'admin_enqueue_scripts', array( $this, 'ui' ) );
86
//bp_core_admin_hook();
87
add_action( 'admin_menu', array( $this, 'menu' ), 1 );
88
add_action( 'init', array( $this, 'bp_admin_tabs' ) );
89
90
- if ( is_multisite() ){
91
add_action( 'network_admin_edit_rtmedia', array( $this, 'save_multisite_options' ) );
92
}
93
}
@@ -97,7 +96,7 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
97
// show rtmedia advertisement
98
// if(! defined("RTMEDIA_PRO_VERSION") )
99
// add_action ( 'rtmedia_before_default_admin_widgets', array( $this, 'rtmedia_advertisement' ),1);
100
- if ( ! class_exists( 'BuddyPress' ) ){
101
add_action( 'admin_init', array( $this, 'check_permalink_admin_notice' ) );
102
}
103
@@ -106,7 +105,7 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
106
add_action( 'wp_ajax_rtmedia_hide_inspirebook_release_notice', array( $this, 'rtmedia_hide_inspirebook_release_notice' ), 1 );
107
add_action( 'wp_ajax_rtmedia_hide_social_sync_notice', array( $this, 'rtmedia_hide_social_sync_notice' ), 1 );
108
$rtmedia_media_import = new RTMediaMediaSizeImporter(); // do not delete this line. We only need to create object of this class if we are in admin section
109
- if ( class_exists( 'BuddyPress' ) ){
110
$rtmedia_activity_upgrade = new RTMediaActivityUpgrade();
111
}
112
add_action( 'admin_notices', array( $this, 'rtmedia_admin_notices' ) );
@@ -115,11 +114,11 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
115
add_action( 'admin_init', array( $this, 'rtmedia_migration' ) );
116
}
117
118
- function rtmedia_migration(){
119
$rtMigration = new RTMediaMigration();
120
}
121
122
- function rtmedia_addon_license_save_hook(){
123
do_action( 'rtmedia_addon_license_save_hook' );
124
}
125
@@ -132,8 +131,8 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
132
*
133
* @return void
134
*/
135
- public function rtmedia_network_admin_notices(){
136
- if ( is_multisite() ){
137
$this->upload_filetypes_error();
138
}
139
}
@@ -147,8 +146,8 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
147
*
148
* @return void
149
*/
150
- public function rtmedia_admin_notices(){
151
- if ( current_user_can( 'list_users' ) ){
152
$this->upload_filetypes_error();
153
$this->rtmedia_regenerate_thumbnail_notice();
154
$this->rtmedia_addon_update_notice();
@@ -161,11 +160,12 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
161
/*
162
* Show social sync release notice admin notice.
163
*/
164
- function rtmedia_social_sync_release_notice(){
165
$site_option = rtmedia_get_site_option( 'rtmedia_social_sync_release_notice' );
166
- $check_rtmedia_social_sync_installed = file_exists( trailingslashit( WP_PLUGIN_DIR ) . 'rtmedia-social-sync/index.php' );
167
-
168
- if ( ( ! $site_option || 'hide' != $site_option ) && !$check_rtmedia_social_sync_installed ){
169
rtmedia_update_site_option( 'rtmedia_social_sync_release_notice', 'show' );
170
?>
171
<div class="updated rtmedia-social-sync-notice">
@@ -181,7 +181,7 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
181
</div>
182
<script type="text/javascript">
183
function rtmedia_hide_social_sync_notice() {
184
- var data = {action: 'rtmedia_hide_social_sync_notice'};
185
jQuery.post( ajaxurl, data, function ( response ) {
186
response = response.trim();
187
if ( response === "1" )
@@ -189,15 +189,16 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
189
} );
190
}
191
</script>
192
- <?php
193
}
194
}
195
196
/*
197
* Hide social sync release notice
198
*/
199
- function rtmedia_hide_social_sync_notice(){
200
- if ( rtmedia_update_site_option( 'rtmedia_social_sync_release_notice', 'hide' ) ){
201
echo '1';
202
} else {
203
echo '0';
@@ -214,21 +215,21 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
214
*
215
* @return void
216
*/
217
- public function rtmedia_inspirebook_release_notice(){
218
$site_option = rtmedia_get_site_option( 'rtmedia_inspirebook_release_notice' );
219
- if ( ( ! $site_option || 'hide' != $site_option ) && ( 'inspirebook' != get_stylesheet() ) ){
220
rtmedia_update_site_option( 'rtmedia_inspirebook_release_notice', 'show' );
221
?>
222
<div class="updated rtmedia-inspire-book-notice">
223
<p>
224
- <span><a href="https://rtcamp.com/store/inspirebook/" target="_blank"><b>Meet
225
InspireBook</b></a> - First official rtMedia premium theme.</span>
226
<a href="#" onclick="rtmedia_hide_inspirebook_notice()" style="float:right">Dismiss</a>
227
</p>
228
</div>
229
<script type="text/javascript">
230
function rtmedia_hide_inspirebook_notice() {
231
- var data = {action: 'rtmedia_hide_inspirebook_release_notice'};
232
jQuery.post( ajaxurl, data, function ( response ) {
233
response = response.trim();
234
if ( response === "1" )
@@ -236,7 +237,7 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
236
} );
237
}
238
</script>
239
- <?php
240
}
241
}
242
@@ -249,8 +250,8 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
249
*
250
* @return void
251
*/
252
- public function rtmedia_hide_inspirebook_release_notice(){
253
- if ( rtmedia_update_site_option( 'rtmedia_inspirebook_release_notice', 'hide' ) ){
254
echo '1';
255
} else {
256
echo '0';
@@ -267,8 +268,8 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
267
*
268
* @return void
269
*/
270
- public function rtmedia_bp_add_update_type(){
271
- if ( class_exists( 'BuddyPress' ) && function_exists( 'bp_activity_set_action' ) ){
272
bp_activity_set_action( 'rtmedia_update', 'rtmedia_update', 'rtMedia Update' );
273
}
274
}
@@ -282,9 +283,9 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
282
*
283
* @return void
284
*/
285
- public function check_permalink_admin_notice(){
286
global $wp_rewrite;
287
- if ( empty( $wp_rewrite->permalink_structure ) ){
288
add_action( 'admin_notices', array( $this, 'rtmedia_permalink_notice' ) );
289
}
290
}
@@ -298,7 +299,7 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
298
*
299
* @return void
300
*/
301
- public function rtmedia_permalink_notice(){
302
echo '<div class="error rtmedia-permalink-change-notice">
303
<p> <b>' . __( 'rtMedia:' ) . '</b> ' . __( ' You must ' ) . '<a href="' . admin_url( 'options-permalink.php' ) . '">' . __( 'update permalink structure' ) . '</a>' . __( ' to something other than the default for it to work.', 'rtmedia' ) . ' </p>
304
</div>';
@@ -313,20 +314,22 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
313
*
314
* @return void
315
*/
316
- public function rtmedia_addon_update_notice(){
317
- if ( ! $this->check_for_addon_update_notice() ){
318
- return;
319
- }
320
- if ( is_rt_admin() ){
321
- $site_option = rtmedia_get_site_option( 'rtmedia-addon-update-notice' );
322
- if ( ! $site_option || 'hide' != $site_option ){
323
- rtmedia_update_site_option( 'rtmedia-addon-update-notice', 'show' );
324
- echo '<div class="error rtmedia-addon-upate-notice">
325
- <p> <b>' . __( 'rtMedia:' ) . '</b> ' . __( 'Please update all premium add-ons that you have purchased from rtCamp from your ', 'rtmedia' ) . ' <a href="https://rtcamp.com/my-account/" target="_blank">' . __( 'account', 'rtmedia' ) . '</a>. <a href="#" onclick="rtmedia_hide_addon_update_notice()" style="float:right">Hide</a> </p>
326
- </div>';
327
- }
328
329
- ?>
330
<script type="text/javascript">
331
function rtmedia_hide_addon_update_notice() {
332
var data = {
@@ -352,41 +355,56 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
352
*
353
* @return bool $return_falg
354
*/
355
- public function check_for_addon_update_notice(){
356
$return_falg = false;
357
358
- if ( defined( 'RTMEDIA_INSTAGRAM_PATH' ) ){
359
$plugin_info = get_plugin_data( RTMEDIA_INSTAGRAM_PATH . 'index.php' );
360
- if ( isset( $plugin_info['Version'] ) && $plugin_info['Version'] < '2.1.2' ){
361
$return_falg = true;
362
}
363
- } else {
364
- if ( defined( 'RTMEDIA_PHOTO_TAGGING_PATH' ) ){
365
- $plugin_info = get_plugin_data( RTMEDIA_PHOTO_TAGGING_PATH . 'index.php' );
366
- if ( isset( $plugin_info['Version'] ) && $plugin_info['Version'] < '2.2.1' ){
367
- $return_falg = true;
368
- }
369
- } else {
370
- if ( defined( 'RTMEDIA_PRO_PATH' ) ){
371
- $plugin_info = get_plugin_data( RTMEDIA_PRO_PATH . 'index.php' );
372
- if ( isset( $plugin_info['Version'] ) && $plugin_info['Version'] < '1.8.1' ){
373
- $return_falg = true;
374
- }
375
- } else {
376
- if ( defined( 'RTMEDIA_FFMPEG_PATH' ) ){
377
- $plugin_info = get_plugin_data( RTMEDIA_FFMPEG_PATH . 'index.php' );
378
- if ( isset( $plugin_info['Version'] ) && $plugin_info['Version'] < '2.1.1' ){
379
- $return_falg = true;
380
- }
381
- } else {
382
- if ( defined( 'RTMEDIA_KALTURA_PATH' ) ){
383
- $plugin_info = get_plugin_data( RTMEDIA_KALTURA_PATH . 'index.php' );
384
- if ( isset( $plugin_info['Version'] ) && $plugin_info['Version'] < '3.0.3' ){
385
- $return_falg = true;
386
- }
387
- }
388
- }
389
- }
390
}
391
}
392
@@ -402,8 +420,8 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
402
*
403
* @return void
404
*/
405
- public function bp_admin_tabs(){
406
- if ( current_user_can( 'manage_options' ) ){
407
add_action( 'bp_admin_tabs', array( $this, 'tab' ) );
408
}
409
}
@@ -417,15 +435,15 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
417
*
418
* @return void
419
*/
420
- public function rtmedia_advertisement(){
421
- $src = RTMEDIA_URL . 'app/assets/img/rtMedia-pro-ad.png'
422
?>
423
<div class='rtmedia-admin-ad'>
424
- <a href='http://rtcamp.com/store/rtmedia-pro/' target='_blank' title='rtMedia Pro'>
425
<img src='<?php echo $src; ?>' alt="<?php _e( 'rtMedia Pro is released', 'rtmedia' ); ?>"/>
426
</a>
427
</div>
428
- <?php
429
}
430
431
/**
@@ -437,84 +455,90 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
437
*
438
* @return void
439
*/
440
- public function rtmedia_dashboard_widget_function(){
441
?>
442
443
- <div class="inside">
444
445
- <div class="table table_content">
446
- <p class="sub"><?php _e( 'Media Stats', 'rtmedia' ); ?></p>
447
<table>
448
<tbody>
449
- <?php
450
- $rtMedia_model = new RTMediaModel();
451
- $sql = "select media_type, count(id) as count from {$rtMedia_model->table_name} where blog_id='" . get_current_blog_id() . "' group by media_type";
452
- global $wpdb;
453
- $results = $wpdb->get_results( $sql );
454
- if ( $results ){
455
- foreach ( $results as $media ) {
456
- if ( defined( strtoupper( 'RTMEDIA_' . $media->media_type . '_PLURAL_LABEL' ) ) ){
457
- ?>
458
- <tr>
459
- <td class="b"> <?php echo $media->count; ?> </td>
460
- <td class="t"><?php echo constant( strtoupper( 'RTMEDIA_' . $media->media_type . '_PLURAL_LABEL' ) ); ?></td>
461
- </tr>
462
- <?php
463
- }
464
- }
465
- }
466
- ?>
467
</tbody>
468
</table>
469
</div>
470
- <div class="table table_discussion">
471
- <p class="sub"><?php _e( 'Usage Stats', 'rtmedia' ); ?></p>
472
<table>
473
<tbody> <?php
474
- $sql = "select count(*) from {$wpdb->users}";
475
- $results = $wpdb->get_var( $sql );
476
- ?>
477
- <tr>
478
- <td class="b"> <?php echo $results; ?> </td>
479
- <td class="t"><?php _e( 'Total ', 'rtmedia' ) ?></td>
480
- </tr>
481
- <?php
482
- $sql = "select count(distinct media_author) from {$rtMedia_model->table_name}";
483
- $results = $wpdb->get_var( $sql );
484
- ?>
485
- <tr>
486
- <td class="b"> <?php echo $results; ?> </td>
487
- <td class="t"><?php _e( 'With Media', 'rtmedia' ) ?></td>
488
- </tr>
489
- <?php
490
- $sql = "select count(*) from $wpdb->comments where comment_post_ID in (select media_id from {$rtMedia_model->table_name})";
491
- $results = $wpdb->get_var( $sql );
492
- ?>
493
- <tr>
494
- <td class="b"> <?php echo $results; ?> </td>
495
- <td class="t"><?php _e( 'Comments ', 'rtmedia' ) ?></td>
496
- </tr>
497
- <?php
498
- $sql = "select sum(likes) from {$rtMedia_model->table_name}";
499
- $results = $wpdb->get_var( $sql );
500
- ?>
501
- <tr>
502
- <td class="b"> <?php echo $results; ?> </td>
503
- <td class="t"><?php _e( 'Likes', 'rtmedia' ) ?></td>
504
- </tr>
505
506
</tbody>
507
</table>
508
</div>
509
- <div class="versions">
510
- <p>
511
- <b>rtMedia Links:</b> <a href="http://rtcamp.com"><?php _e( 'Homepage', 'rtmedia' ); ?></a> | <a
512
- href="admin.php?page=rtmedia-support#rtmedia-general"><?php _e( 'Free Support', 'rtmedia' ); ?></a>
513
- | <a href="http://rtcamp.com/rtmedia/addons/"><?php _e( 'Premium Addons', 'rtmedia' ); ?></a>
514
- </p>
515
- </div>
516
</div>
517
- <?php
518
}
519
520
/**
@@ -526,19 +550,19 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
526
*
527
* @return void
528
*/
529
- public function add_dashboard_widgets(){
530
wp_add_dashboard_widget( 'rtmedia_dashboard_widget', __( 'Right Now in rtMedia', 'rtmedia' ), array( &$this, 'rtmedia_dashboard_widget_function' ) );
531
global $wp_meta_boxes;
532
533
// Get the regular dashboard widgets array
534
// (which has our new widget already but at the end)
535
536
- $normal_dashboard = $wp_meta_boxes['dashboard']['normal']['core'];
537
538
// Backup and delete our new dashboard widget from the end of the array
539
540
- $example_widget_backup = array( 'rtmedia_dashboard_widget' => $normal_dashboard['rtmedia_dashboard_widget'] );
541
- unset( $normal_dashboard['rtmedia_dashboard_widget'] );
542
543
// Merge the two arrays together so our widget is at the beginning
544
@@ -546,7 +570,7 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
546
547
// Save the sorted array back into the original metaboxes
548
549
- $wp_meta_boxes['dashboard']['normal']['core'] = $sorted_dashboard;
550
}
551
552
/**
@@ -558,7 +582,7 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
558
*
559
* @return array $links
560
*/
561
- public function plugin_add_settings_link( $links ){
562
$settings_link = '<a href="' . admin_url( 'admin.php?page=rtmedia-settings' ) . '">Settings</a>';
563
array_push( $links, $settings_link );
564
$settings_link = '<a href="' . admin_url( 'admin.php?page=rtmedia-support' ) . '">Support</a>';
@@ -577,11 +601,11 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
577
*
578
* @return array $actions
579
*/
580
- public function add_reencode_link( $actions, $post ){
581
582
$mime_type_array = explode( '/', $post->post_mime_type );
583
- if ( is_array( $mime_type_array ) && '' != $mime_type_array && 'video' == $mime_type_array[0] ){
584
- $actions['reencode'] = '<a class="submitdelete" onclick="return rtmedia_regenerate_thumbs(' . $post->ID . ')" href="#">' . __( 'Regenerate Thumbnail', 'rtmedia' ) . '</a>';
585
}
586
587
return $actions;
@@ -596,9 +620,9 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
596
*
597
* @return void
598
*/
599
- public function bulk_action_handler(){
600
- if ( 'bulk_video_regenerate_thumbnails' == $_REQUEST['action'] && '' != $_REQUEST['media'] ){
601
- wp_safe_redirect( esc_url_raw( add_query_arg( array( 'media_ids' => urlencode( implode( ',', $_REQUEST['media'] ) ) ), admin_url( 'admin.php?page=rtmedia-regenerate' ) ) ) );
602
exit;
603
}
604
}
@@ -612,86 +636,88 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
612
*
613
* @return void
614
*/
615
- public function admin_bar_menu( $admin_bar ){
616
- if ( ! current_user_can( 'manage_options' ) ){
617
return;
618
}
619
620
$admin_bar->add_menu( array(
621
- 'id' => 'rtMedia',
622
- 'title' => 'rtMedia',
623
- 'href' => admin_url( 'admin.php?page=rtmedia-settings' ),
624
- 'meta' => array(
625
- 'title' => __( 'rtMedia', 'rtmedia' ),
626
- ),
627
- )
628
- );
629
- $admin_bar->add_menu( array(
630
- 'id' => 'rt-media-dashborad',
631
- 'parent' => 'rtMedia',
632
- 'title' => __( 'Settings', 'rtmedia' ),
633
- 'href' => admin_url( 'admin.php?page=rtmedia-settings' ),
634
- 'meta' => array(
635
- 'title' => __( 'Settings', 'rtmedia' ),
636
- 'target' => '_self',
637
- ),
638
- )
639
- );
640
$admin_bar->add_menu( array(
641
- 'id' => 'rt-media-addons',
642
- 'parent' => 'rtMedia',
643
- 'title' => __( 'Addons', 'rtmedia' ),
644
- 'href' => admin_url( 'admin.php?page=rtmedia-addons' ),
645
- 'meta' => array(
646
- 'title' => __( 'Addons', 'rtmedia' ),
647
- 'target' => '_self',
648
- ),
649
- )
650
- );
651
$admin_bar->add_menu( array(
652
- 'id' => 'rt-media-support',
653
- 'parent' => 'rtMedia',
654
- 'title' => __( 'Support', 'rtmedia' ),
655
- 'href' => admin_url( 'admin.php?page=rtmedia-support' ),
656
- 'meta' => array(
657
- 'title' => __( 'Support', 'rtmedia' ),
658
- 'target' => '_self',
659
- ),
660
- )
661
- );
662
$admin_bar->add_menu( array(
663
- 'id' => 'rt-media-themes',
664
- 'parent' => 'rtMedia',
665
- 'title' => __( 'Themes', 'rtmedia' ),
666
- 'href' => admin_url( 'admin.php?page=rtmedia-themes' ),
667
- 'meta' => array(
668
- 'title' => __( 'Themes', 'rtmedia' ),
669
- 'target' => '_self',
670
- ),
671
- )
672
- );
673
$admin_bar->add_menu( array(
674
- 'id' => 'rt-media-hire-us',
675
- 'parent' => 'rtMedia',
676
- 'title' => __( 'Hire Us', 'rtmedia' ),
677
- 'href' => admin_url( 'admin.php?page=rtmedia-hire-us' ),
678
- 'meta' => array(
679
- 'title' => __( 'Hire Us', 'rtmedia' ),
680
- 'target' => '_self',
681
- ),
682
- )
683
- );
684
$admin_bar->add_menu( array(
685
- 'id' => 'rt-media-license',
686
- 'parent' => 'rtMedia',
687
- 'title' => __( 'Licenses', 'rtmedia' ),
688
- 'href' => admin_url( 'admin.php?page=rtmedia-license' ),
689
- 'meta' => array(
690
- 'title' => __( 'Licenses', 'rtmedia' ),
691
- 'target' => '_self',
692
- ),
693
- )
694
- );
695
}
696
697
/**
@@ -703,44 +729,40 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
703
*
704
* @return void
705
*/
706
- public function ui( $hook ){
707
$admin_pages = array(
708
- 'rtmedia_page_rtmedia-migration',
709
- 'rtmedia_page_rtmedia-kaltura-settings',
710
- 'rtmedia_page_rtmedia-ffmpeg-settings',
711
- 'toplevel_page_rtmedia-settings',
712
- 'rtmedia_page_rtmedia-addons',
713
- 'rtmedia_page_rtmedia-support',
714
- 'rtmedia_page_rtmedia-themes',
715
- 'rtmedia_page_rtmedia-hire-us',
716
- 'rtmedia_page_rtmedia-importer',
717
- 'rtmedia_page_rtmedia-regenerate',
718
- 'rtmedia_page_rtmedia-premium',
719
- 'rtmedia_page_rtmedia-license',
720
);
721
722
$admin_pages = apply_filters( 'rtmedia_filter_admin_pages_array', $admin_pages );
723
724
- if ( in_array( $hook, $admin_pages ) || strpos( $hook, 'rtmedia-migration' ) ){
725
726
$admin_ajax = admin_url( 'admin-ajax.php' );
727
728
- wp_enqueue_script( 'bootstrap-switch', RTMEDIA_URL . 'app/assets/js/vendor/bootstrap-switch.js', array( 'jquery' ), RTMEDIA_VERSION );
729
- wp_enqueue_script( 'slider-tabs', RTMEDIA_URL . 'app/assets/js/vendor/jquery.sliderTabs.min.js', array( 'jquery', 'jquery-effects-core' ), RTMEDIA_VERSION );
730
- wp_enqueue_script( 'observe-hashchange', RTMEDIA_URL . 'app/assets/js/vendor/jquery.observehashchange.pack.js', array( 'jquery' ), RTMEDIA_VERSION );
731
- wp_enqueue_script( 'rtmedia-admin', RTMEDIA_URL . 'app/assets/js/admin.js', array( 'jquery-ui-dialog' ), RTMEDIA_VERSION );
732
wp_localize_script( 'rtmedia-admin', 'rtmedia_on_label', __( 'ON', 'rtmedia' ) );
733
wp_localize_script( 'rtmedia-admin', 'rtmedia_off_label', __( 'OFF', 'rtmedia' ) );
734
wp_localize_script( 'rtmedia-admin', 'rtmedia_admin_ajax', $admin_ajax );
735
wp_localize_script( 'rtmedia-admin', 'rtmedia_admin_url', admin_url() );
736
wp_localize_script( 'rtmedia-admin', 'rtmedia_admin_url', admin_url() );
737
738
- if ( isset( $_REQUEST['page'] ) && ( in_array( $_REQUEST['page'], array( 'rtmedia-settings', 'rtmedia-addons', 'rtmedia-themes', 'rtmedia-support', 'rtmedia-hire-us', 'rtmedia-license' ) ) ) ){
739
- wp_enqueue_script( 'rtmedia-foundation-modernizr', RTMEDIA_URL . 'lib/foundation/custom.modernizr.js', array( 'jquery' ), RTMEDIA_VERSION );
740
- wp_enqueue_script( 'rtmedia-foundation', RTMEDIA_BOWER_COMPONENTS_URL . 'js/foundation.js', array( 'jquery' ), RTMEDIA_VERSION );
741
- //wp_enqueue_script ( 'rtmedia-foundation-section', RTMEDIA_URL . 'lib/foundation/foundation.section.js', array('jquery'), RTMEDIA_VERSION );
742
- }
743
-
744
$rtmedia_admin_strings = array(
745
'no_refresh' => __( 'Please do not refresh this page.', 'rtmedia' ),
746
'something_went_wrong' => __( 'Something went wrong. Please <a href onclick="location.reload();">refresh</a> page.', 'rtmedia' ),
@@ -752,21 +774,13 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
752
wp_localize_script( 'rtmedia-admin', 'rtmedia_admin_strings', $rtmedia_admin_strings );
753
wp_localize_script( 'rtmedia-admin', 'settings_url', esc_url( add_query_arg( array( 'page' => 'rtmedia-settings' ), ( is_multisite() ? network_admin_url( 'admin.php' ) : admin_url( 'admin.php' ) ) ) ) . '#privacy_enabled' );
754
wp_localize_script( 'rtmedia-admin', 'settings_rt_album_import_url', esc_url( add_query_arg( array( 'page' => 'rtmedia-settings' ), ( is_multisite() ? network_admin_url( 'admin.php' ) : admin_url( 'admin.php' ) ) ) ) );
755
- wp_enqueue_style( 'font-awesome', RTMEDIA_URL . 'app/assets/css/font-awesome.min.css', '', RTMEDIA_VERSION );
756
- wp_enqueue_style( 'bootstrap-switch', RTMEDIA_URL . 'app/assets/css/vendor/bootstrap-switch.css', '', RTMEDIA_VERSION );
757
- wp_enqueue_style( 'slider-tabs', RTMEDIA_URL . 'app/assets/css/vendor/jquery.sliderTabs.min.css', '', RTMEDIA_VERSION );
758
- wp_enqueue_style( 'grid-foundation', RTMEDIA_URL . 'app/assets/css/vendor/grid-foundation.css', '', RTMEDIA_VERSION );
759
- wp_enqueue_style( 'rtmedia-main', RTMEDIA_URL . 'app/assets/css/main.css', '', RTMEDIA_VERSION );
760
- wp_enqueue_style( 'rtmedia-admin', RTMEDIA_URL . 'app/assets/css/admin.css', '', RTMEDIA_VERSION );
761
-
762
- if ( isset( $_REQUEST['page'] ) && ( in_array( $_REQUEST['page'], array( 'rtmedia-settings', 'rtmedia-addons', 'rtmedia-themes', 'rtmedia-support', 'rtmedia-hire-us', 'rtmedia-license' ) ) ) ){
763
- wp_enqueue_style( 'foundation-admin-css', RTMEDIA_URL . 'app/assets/css/settings.css', '', RTMEDIA_VERSION );
764
- }
765
-
766
- wp_enqueue_style( 'wp-jquery-ui-dialog' );
767
768
} else {
769
- wp_enqueue_style( 'rtmedia-widget', RTMEDIA_URL . 'app/assets/css/widget.css', '', RTMEDIA_VERSION );
770
}
771
}
772
@@ -780,29 +794,26 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
780
*
781
* @return void
782
*/
783
- public function menu(){
784
- add_menu_page( 'rtMedia', 'rtMedia', 'manage_options', 'rtmedia-settings', array( $this, 'settings_page' ), RTMEDIA_URL . 'app/assets/img/rtmedia-logo.png', '40.1111' );
785
add_submenu_page( 'rtmedia-settings', __( 'Settings', 'rtmedia' ), __( 'Settings', 'rtmedia' ), 'manage_options', 'rtmedia-settings', array( $this, 'settings_page' ) );
786
add_submenu_page( 'rtmedia-settings', __( 'Addons', 'rtmedia' ), __( 'Addons', 'rtmedia' ), 'manage_options', 'rtmedia-addons', array( $this, 'addons_page' ) );
787
add_submenu_page( 'rtmedia-settings', __( 'Support', 'rtmedia' ), __( 'Support', 'rtmedia' ), 'manage_options', 'rtmedia-support', array( $this, 'support_page' ) );
788
add_submenu_page( 'rtmedia-settings', __( 'Themes', 'rtmedia' ), __( 'Themes', 'rtmedia' ), 'manage_options', 'rtmedia-themes', array( $this, 'theme_page' ) );
789
add_submenu_page( 'rtmedia-settings', __( 'Hire Us', 'rtmedia' ), __( 'Hire Us', 'rtmedia' ), 'manage_options', 'rtmedia-hire-us', array( $this, 'hire_us_page' ) );
790
- add_submenu_page( 'rtmedia-settings', __( 'Licenses', 'rtmedia' ), __( 'Licenses', 'rtmedia' ), 'manage_options', 'rtmedia-license', array( $this, 'license_page' ) );
791
792
- if ( ! defined( 'RTMEDIA_PRO_VERSION' ) ){
793
add_submenu_page( 'rtmedia-settings', __( 'Premium', 'rtmedia' ), __( 'Premium ', 'rtmedia' ), 'manage_options', 'rtmedia-premium', array( $this, 'premium_page' ) );
794
}
795
796
$obj_encoding = new RTMediaEncoding( true );
797
798
- if ( $obj_encoding->api_key ){
799
add_submenu_page( 'rtmedia-settings', __( 'Regenerate Thumbnail', 'rtmedia' ), __( 'Regen. Thumbnail ', 'rtmedia' ), 'manage_options', 'rtmedia-regenerate', array( $this, 'rt_regenerate_thumbnail' ) );
800
}
801
-
802
- // add_submenu_page('rtmedia-settings', __('Importer', 'rtmedia'), __('Importer', 'rtmedia'), 'manage_options', 'rtmedia-importer', array($this, 'rt_importer_page'));
803
- // if (!BPMediaPrivacy::is_installed()) {
804
- // add_submenu_page('rtmedia-settings', __('rtMedia Database Update', 'rtmedia'), __('Update Database', 'rtmedia'), 'manage_options', 'rtmedia-db-update', array($this, 'privacy_page'));
805
- // }
806
}
807
808
/**
@@ -814,33 +825,33 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
814
*
815
* @return void
816
*/
817
- public function rt_regenerate_thumbnail(){
818
$prog = new rtProgress();
819
$done = 0;
820
?>
821
<div class="wrap">
822
<h2> rtMedia: <?php _e( 'Regenerate Video Thumbnails', 'rtmedia' ); ?> </h2>
823
- <?php
824
- if ( isset( $_REQUEST['media_ids'] ) && trim( $_REQUEST['media_ids'] ) != '' ){
825
- $requested = false;
826
- $media_ids = explode( ',', $_REQUEST['media_ids'] );
827
- $total = count( $media_ids );
828
- } else {
829
- $media_ids = $this->get_video_without_thumbs();
830
- $total = count( $media_ids );
831
- }
832
- ?>
833
<script>
834
var rt_thumb_all_media = <?php echo json_encode( $media_ids ); ?>;
835
</script>
836
- <?php
837
- if ( ! isset( $requested ) ){
838
- ?>
839
<br/>
840
<p>You can see this page because you have <a href="<?php echo admin_url( 'admin.php?page=rtmedia-addons' ) ?>">subscribed</a> for <a href="https://rtcamp.com/rtmedia/docs/admin/addons/audio-video-encoding/" target="_blank">rtMedia audio/video encoding service</a>.</p> <p>You can regenerate thumbnails of a specific video by visiting <a href="<?php echo admin_url( 'upload.php?post_mime_type=video' ); ?>">media page</a> and clicking the <b>Regenerate Thumbnail</b> option for that particular video.</p> <p>Click <b>Regenerate Pending Thumbnails</b> to regenerate thumbnails of pending videos.</p> <p><input type="button" class="button button-primary" id="rt-start-media-regenerate" value="<?php echo __( 'Regenerate Pending Thumbnails', 'rtmedia' ) . ' (' . $total . ')'; ?>"/> </p>
841
- <?php
842
}
843
- ?>
844
<div id="rt-migration-progress">
845
<br/> <br/>
846
<?php
@@ -868,7 +879,7 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
868
type: 'post',
869
data: {
870
"action": "rt_media_regeneration",
871
- "media_id": rt_thumb_all_media[indx++]
872
},
873
success: function ( data ) {
874
data = JSON.parse( data );
@@ -876,8 +887,8 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
876
if ( data.status == false ) {
877
handle_regenrate_fail();
878
} else {
879
- db_done++;
880
- var progw = Math.ceil( (db_done / db_total) * 100 );
881
if ( progw > 100 ) {
882
progw = 100;
883
}
@@ -895,7 +906,7 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
895
}
896
}
897
function handle_regenrate_fail() {
898
- db_fail++;
899
jQuery( 'span.rt-fail' ).html( db_fail );
900
db_start_regenrate();
901
}
@@ -925,14 +936,14 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
925
*
926
* @return void
927
*/
928
- public function rtmedia_regenerate_thumbnail_notice(){
929
$obj_encoding = new RTMediaEncoding( true );
930
- if ( $obj_encoding->api_key ){
931
$site_option = rtmedia_get_site_option( 'rtmedia-video-thumb-notice' );
932
- if ( ! $site_option || 'hide' != $site_option ){
933
rtmedia_update_site_option( 'rtmedia-video-thumb-notice', 'show' );
934
$videos_without_thumbs = get_video_without_thumbs();
935
- if ( isset( $videos_without_thumbs ) && is_array( $videos_without_thumbs ) && sizeof( $videos_without_thumbs ) > 0 ){
936
echo '<div class="error rtmedia-regenerate-video-thumb-error">
937
<p>
938
' . sprintf( __( "You have %s videos without thumbnails. Click <a href='%s'> here </a> to generate thumbnails. <a href='#' onclick='rtmedia_hide_video_thumb_notice()' style='float:right'>Hide</a>", 'rtmedia' ), sizeof( $videos_without_thumbs ), admin_url( 'admin.php?page=rtmedia-regenerate' ) ) . '
@@ -941,7 +952,7 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
941
?>
942
<script type="text/javascript">
943
function rtmedia_hide_video_thumb_notice() {
944
- var data = {action: 'rtmedia_hide_video_thumb_admin_notice'};
945
jQuery.post( ajaxurl, data, function ( response ) {
946
response = response.trim();
947
if ( response === "1" )
@@ -949,7 +960,7 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
949
} );
950
}
951
</script>
952
- <?php
953
}
954
}
955
}
@@ -964,8 +975,8 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
964
*
965
* @return void
966
*/
967
- public function rtmedia_hide_video_thumb_admin_notice(){
968
- if ( rtmedia_update_site_option( 'rtmedia-video-thumb-notice', 'hide' ) ){
969
echo '1';
970
} else {
971
echo '0';
@@ -982,8 +993,8 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
982
*
983
* @return void
984
*/
985
- public function rtmedia_hide_addon_update_notice(){
986
- if ( rtmedia_update_site_option( 'rtmedia-addon-update-notice', 'hide' ) ){
987
echo '1';
988
} else {
989
echo '0';
@@ -1000,27 +1011,26 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
1000
*
1001
* @return void
1002
*/
1003
- public function rt_media_regeneration(){
1004
- if ( isset( $_POST['media_id'] ) ){
1005
- $model = new RTMediaModel();
1006
- $media = $model->get_media( array( 'media_id' => $_POST['media_id'] ), 0, 1 );
1007
- $media_type = $media[0]->media_type;
1008
- $response = array();
1009
- if ( 'video' == $media_type ){
1010
$objRTMediaEncoding = new RTMediaEncoding( true );
1011
- $autoformat = 'thumbnails';
1012
- $objRTMediaEncoding->reencoding( intval( $_POST['media_id'] ), $autoformat );
1013
- $response['status'] = true;
1014
} else {
1015
- $response['status'] = false;
1016
- $response['message'] = __( 'not a video ...', 'rtmedia' );
1017
}
1018
echo json_encode( $response );
1019
die();
1020
}
1021
}
1022
1023
-
1024
/**
1025
* Get video without thumbs.
1026
*
@@ -1030,9 +1040,9 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
1030
*
1031
* @return object $results
1032
*/
1033
- public function get_video_without_thumbs(){
1034
$rtmedia_model = new RTMediaModel();
1035
- $sql = "select media_id from {$rtmedia_model->table_name} where media_type = 'video' and blog_id = '" . get_current_blog_id() . "' and cover_art is null";
1036
global $wpdb;
1037
$results = $wpdb->get_col( $sql );
1038
@@ -1048,7 +1058,7 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
1048
*
1049
* @return void
1050
*/
1051
- public function settings_page(){
1052
$this->render_page( 'rtmedia-settings', 'rtmedia' );
1053
}
1054
@@ -1061,7 +1071,7 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
1061
*
1062
* @return void
1063
*/
1064
- public function privacy_page(){
1065
$this->render_page( 'rtmedia-privacy' );
1066
}
1067
@@ -1074,7 +1084,7 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
1074
*
1075
* @return void
1076
*/
1077
- public function rt_importer_page(){
1078
$this->render_page( 'rtmedia-importer' );
1079
}
1080
@@ -1087,7 +1097,7 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
1087
*
1088
* @return void
1089
*/
1090
- public function convert_videos_page(){
1091
$this->render_page( 'rtmedia-convert-videos' );
1092
}
1093
@@ -1100,7 +1110,7 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
1100
*
1101
* @return void
1102
*/
1103
- public function addons_page(){
1104
$this->render_page( 'rtmedia-addons' );
1105
}
1106
@@ -1113,7 +1123,7 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
1113
*
1114
* @return void
1115
*/
1116
- public function support_page(){
1117
$this->render_page( 'rtmedia-support' );
1118
}
1119
@@ -1126,7 +1136,7 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
1126
*
1127
* @return void
1128
*/
1129
- public function premium_page(){
1130
$this->render_page( 'rtmedia-premium' );
1131
}
1132
@@ -1139,7 +1149,7 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
1139
*
1140
* @return void
1141
*/
1142
- public function theme_page(){
1143
$this->render_page( 'rtmedia-themes' );
1144
}
1145
@@ -1152,11 +1162,11 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
1152
*
1153
* @return void
1154
*/
1155
- public function hire_us_page(){
1156
$this->render_page( 'rtmedia-hire-us' );
1157
}
1158
1159
- public function license_page(){
1160
$this->render_page( 'rtmedia-license' );
1161
}
1162
@@ -1169,8 +1179,8 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
1169
*
1170
* @return type
1171
*/
1172
- static function get_current_tab(){
1173
- return isset( $_GET['page'] ) ? $_GET['page'] : 'rtmedia-settings';
1174
}
1175
1176
/**
@@ -1184,7 +1194,7 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
1184
*
1185
* @return void
1186
*/
1187
- public function render_page( $page, $option_group = null ){
1188
?>
1189
1190
<div class="wrap bp-media-admin <?php echo $this->get_current_tab(); ?>">
@@ -1193,72 +1203,88 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
1193
<h2 class="nav-tab-wrapper"><?php $this->rtmedia_tabs(); ?>
1194
<span class="alignright by">
1195
<a class="rt-link" href="http://rtcamp.com/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media" target="_blank" title="rtCamp : <?php _e( 'Empowering The Web With WordPress', 'rtmedia' ); ?>">
1196
- <img src="<?php echo RTMEDIA_URL; ?>app/assets/img/rtcamp-logo.png">
1197
</a>
1198
</span>
1199
</h2>
1200
</div>
1201
1202
- <div class="row bp-media-settings-boxes-container">
1203
- <div id="bp-media-settings-boxes" class="columns large-9">
1204
1205
- <?php
1206
- $settings_url = ( is_multisite() ) ? network_admin_url( 'edit.php?action=' . $option_group ) : 'options.php';
1207
- if ( $option_group ){ //$option_group if ($page == "bp-media-settings") action="<?php echo $settings_url;
1208
- ?>
1209
<form id="bp_media_settings_form" name="bp_media_settings_form" method="post"
1210
enctype="multipart/form-data">
1211
- <div class="bp-media-metabox-holder">
1212
- <?php
1213
- settings_fields( $option_group );
1214
- if ( 'rtmedia-settings' == $page ){
1215
- echo '<div id="rtm-settings-tabs">';
1216
- $sub_tabs = $this->settings_sub_tabs();
1217
- RTMediaFormHandler::rtForm_settings_tabs_content( $page, $sub_tabs );
1218
- echo '</div>';
1219
- } else {
1220
- do_settings_sections( $page );
1221
- }
1222
- ?>
1223
- <div class="clearfix">&nbsp;</div>
1224
- <div class="row">
1225
- <input type="hidden" name="rtmedia-options-save" value="true">
1226
- <input type="submit" id="rtmedia-settings-submit" class="rtmedia-settings-submit button button-primary button-big" value="<?php _e( 'Save Settings', 'rtmedia' ); ?>">
1227
</div>
1228
- </div>
1229
</form><?php
1230
- } else {
1231
- ?>
1232
<div class="bp-media-metabox-holder">
1233
- <?php
1234
- if ( 'rtmedia-addons' == $page ){
1235
- RTMediaAddon::render_addons( $page );
1236
- } else if ( 'rtmedia-support' == $page ){
1237
- $rtmedia_support = new RTMediaSupport( false );
1238
- $rtmedia_support->render_support( $page );
1239
- } else if ( 'rtmedia-themes' == $page ){
1240
- RTMediaThemes::render_themes( $page );
1241
- } else {
1242
- if ( 'rtmedia-license' == $page ){
1243
- RTMediaLicense::render_license( $page );
1244
- } else {
1245
- do_settings_sections( $page );
1246
- }
1247
- }
1248
- do_action( 'rtmedia_admin_page_insert', $page );
1249
- ?>
1250
</div>
1251
- <?php
1252
- do_action( 'rtmedia_admin_page_append', $page );
1253
- }
1254
- ?>
1255
</div>
1256
- <!-- .bp-media-settings-boxes -->
1257
- <div class="metabox-holder bp-media-metabox-holder columns large-3">
1258
<?php $this->admin_sidebar(); ?>
1259
</div>
1260
</div>
1261
- <!-- .metabox-holder -->
1262
</div><!-- .bp-media-admin --><?php
1263
}
1264
@@ -1273,25 +1299,25 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
1273
*
1274
* @return type $tabs_html
1275
*/
1276
- public function tab(){
1277
1278
- $tabs_html = '';
1279
- $idle_class = 'nav-tab';
1280
$active_class = 'nav-tab nav-tab-active';
1281
- $tabs = array();
1282
1283
// Check to see which tab we are on
1284
$tab = $this->get_current_tab();
1285
/* rtMedia */
1286
$tabs[] = array(
1287
- 'href' => get_admin_url( null, esc_url( add_query_arg( array( 'page' => 'rtmedia-settings' ), 'admin.php' ) ) ),
1288
- 'title' => __( 'rtMedia', 'rtmedia' ),
1289
- 'name' => __( 'rtMedia', 'rtmedia' ),
1290
- 'class' => ( $tab == 'rtmedia-settings' || $tab == 'rtmedia-addons' || $tab == 'rtmedia-support' || $tab == 'rtmedia-importer' ) ? $active_class : $idle_class,
1291
);
1292
1293
foreach ( $tabs as $tab ) {
1294
- $tabs_html .= '<a id="bp-media" title= "' . $tab['title'] . '" href="' . $tab['href'] . '" class="' . $tab['class'] . '">' . $tab['name'] . '</a>';
1295
}
1296
echo $tabs_html;
1297
}
@@ -1305,10 +1331,10 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
1305
*
1306
* @return void
1307
*/
1308
- public function rtmedia_tabs( $active_tab = '' ){
1309
// Declare local variables
1310
- $tabs_html = '';
1311
- $idle_class = 'nav-tab';
1312
$active_class = 'nav-tab nav-tab-active';
1313
1314
// Setup core admin tabs
@@ -1333,25 +1359,29 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
1333
'href' => get_admin_url( null, esc_url( add_query_arg( array( 'page' => 'rtmedia-support' ), 'admin.php' ) ) ),
1334
'name' => __( 'Support', 'rtmedia' ),
1335
'slug' => 'rtmedia-support',
1336
- ), array(
1337
'href' => get_admin_url( null, esc_url( add_query_arg( array( 'page' => 'rtmedia-license' ), 'admin.php' ) ) ),
1338
'name' => __( 'Licenses', 'rtmedia' ),
1339
'slug' => 'rtmedia-license',
1340
- ),
1341
- );
1342
1343
$tabs = apply_filters( 'media_add_tabs', $tabs );
1344
1345
// Loop through tabs and build navigation
1346
foreach ( array_values( $tabs ) as $tab_data ) {
1347
- $is_current = (bool) ( $tab_data['slug'] == $this->get_current_tab() );
1348
- $tab_class = $is_current ? $active_class : $idle_class;
1349
1350
- if ( isset( $tab_data['class'] ) && is_array( $tab_data['class'] ) ){
1351
- $tab_class .= ' ' . implode( ' ', $tab_data['class'] );
1352
}
1353
1354
- $tabs_html .= '<a href="' . $tab_data['href'] . '" class="' . $tab_class . '">' . $tab_data['name'] . '</a>';
1355
}
1356
1357
// Output the tabs
@@ -1370,28 +1400,28 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
1370
*
1371
* @return void
1372
*/
1373
- public function settings_content_tabs( $page ){
1374
global $wp_settings_sections, $wp_settings_fields;
1375
1376
- if ( ! isset( $wp_settings_sections ) || ! isset( $wp_settings_sections[ $page ] ) ){
1377
return;
1378
}
1379
1380
- foreach ( (array) $wp_settings_sections[ $page ] as $section ) {
1381
- if ( $section['title'] ){
1382
- echo "<h3>{$section['title']}</h3>\n";
1383
}
1384
1385
- if ( $section['callback'] ){
1386
- call_user_func( $section['callback'], $section );
1387
}
1388
1389
- if ( ! isset( $wp_settings_fields ) || ! isset( $wp_settings_fields[ $page ] ) || ! isset( $wp_settings_fields[ $page ][ $section['id'] ] ) ){
1390
continue;
1391
}
1392
1393
echo '<table class="form-table">';
1394
- do_settings_fields( $page, $section['id'] );
1395
echo '</table>';
1396
}
1397
}
@@ -1406,71 +1436,71 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
1406
*
1407
* @return array $tabs
1408
*/
1409
- public function settings_sub_tabs(){
1410
$tabs_html = '';
1411
- $tabs = array();
1412
1413
// Check to see which tab we are on
1414
$tab = $this->get_current_tab();
1415
/* rtMedia */
1416
1417
- $tabs[7] = array(
1418
- 'href' => '#rtmedia-display',
1419
- 'icon' => 'rtmicon-desktop',
1420
- 'title' => __( 'Display', 'rtmedia' ),
1421
- 'name' => __( 'Display', 'rtmedia' ),
1422
- 'callback' => array( 'RTMediaFormHandler', 'display_content' )
1423
);
1424
1425
- if ( class_exists( 'BuddyPress' ) ){
1426
- $tabs[20] = array(
1427
'href' => '#rtmedia-bp',
1428
- 'icon' => 'rtmicon-group',
1429
'title' => __( 'rtMedia BuddyPress', 'rtmedia' ),
1430
'name' => __( 'BuddyPress', 'rtmedia' ),
1431
'callback' => array( 'RTMediaFormHandler', 'buddypress_content' ) //change it to BuddyPress Content
1432
);
1433
}
1434
1435
- $tabs[30] = array(
1436
- 'href' => '#rtmedia-types',
1437
- 'icon' => 'rtmicon-film',
1438
- 'title' => __( 'rtMedia Types', 'rtmedia' ),
1439
- 'name' => __( 'Types', 'rtmedia' ),
1440
- 'callback' => array( 'RTMediaFormHandler', 'types_content' )
1441
);
1442
1443
- $tabs[40] = array(
1444
- 'href' => '#rtmedia-sizes',
1445
- 'icon' => 'rtmicon-expand',
1446
- 'title' => __( 'rtMedia Sizes', 'rtmedia' ),
1447
- 'name' => __( 'Image Sizes', 'rtmedia' ),
1448
- 'callback' => array( 'RTMediaFormHandler', 'sizes_content' )
1449
);
1450
1451
- $tabs[50] = array(
1452
- 'href' => '#rtmedia-privacy',
1453
- 'icon' => 'rtmicon-lock',
1454
- 'title' => __( 'rtMedia Privacy', 'rtmedia' ),
1455
- 'name' => __( 'Privacy', 'rtmedia' ),
1456
- 'callback' => array( 'RTMediaFormHandler', 'privacy_content' )
1457
);
1458
- $tabs[60] = array(
1459
- 'href' => '#rtmedia-custom-css-settings',
1460
- 'icon' => 'rtmicon-css3',
1461
- 'title' => __( 'rtMedia Custom CSS', 'rtmedia' ),
1462
- 'name' => __( 'Custom CSS', 'rtmedia' ),
1463
- 'callback' => array( 'RTMediaFormHandler', 'custom_css_content' )
1464
);
1465
1466
$tabs = apply_filters( 'rtmedia_add_settings_sub_tabs', $tabs, $tab );
1467
1468
$tabs[] = array(
1469
- 'href' => '#rtmedia-general',
1470
- 'icon' => 'rtmicon-wrench',
1471
- 'title' => __( 'Other Settings', 'rtmedia' ),
1472
- 'name' => __( 'Other Settings', 'rtmedia' ),
1473
- 'callback' => array( 'RTMediaFormHandler', 'general_content' )
1474
);
1475
1476
return $tabs;
@@ -1486,7 +1516,7 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
1486
*
1487
* @return boolean
1488
*/
1489
- public function update_count(){
1490
global $wpdb;
1491
1492
$query = "SELECT
@@ -1506,7 +1536,7 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
1506
1507
$result = $wpdb->get_results( $query );
1508
1509
- if ( ! is_array( $result ) ){
1510
return false;
1511
}
1512
@@ -1535,15 +1565,15 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
1535
*
1536
* @return void
1537
*/
1538
- public function save_multisite_options(){
1539
global $rtmedia_admin;
1540
- if ( isset( $_POST['refresh-count'] ) ){
1541
$rtmedia_admin->update_count();
1542
}
1543
do_action( 'rtmedia_sanitize_settings', $_POST );
1544
1545
- if ( isset( $_POST['rtmedia_options'] ) ){
1546
- rtmedia_update_site_option( 'rtmedia_options', $_POST['rtmedia_options'] );
1547
//
1548
// redirect to settings page in network
1549
wp_redirect( esc_url_raw( add_query_arg( array( 'page' => 'rtmedia-settings', 'updated' => 'true' ), ( is_multisite() ? network_admin_url( 'admin.php' ) : admin_url( 'admin.php' ) ) ) ) );
@@ -1561,60 +1591,28 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
1561
*
1562
* @return void
1563
*/
1564
- public function admin_sidebar(){
1565
do_action( 'rtmedia_before_default_admin_widgets' );
1566
$current_user = wp_get_current_user();
1567
- // echo '<p><a target="_blank" href="http://rtcamp.com/news/buddypress-media-review-contest/?utm_source=dashboard&#038;utm_medium=plugin&#038;utm_campaign=buddypress-media"><img src="' . RTMEDIA_URL . 'app/assets/img/bpm-contest-banner.jpg" alt="BuddyPress Media Review Contest" /></a></p>';
1568
- // $contest = '<a target="_blank" href="http://rtcamp.com/news/buddypress-media-review-contest/?utm_source=dashboard&#038;utm_medium=plugin&#038;utm_campaign=buddypress-media"><img src="'.RTMEDIA_URL.'app/assets/img/bpm-contest-banner.jpg" alt="BuddyPress Media Review Contest" /></a>';
1569
- // new BPMediaAdminWidget('bpm-contest', __('', 'rtmedia'), $contest);
1570
- $setting_page_url = admin_url( 'admin.php?page=rtmedia-settings#rtmedia-general' );
1571
- $message = sprintf( __( 'I use @buddypressmedia http://rt.cx/rtmedia on %s', 'rtmedia' ), home_url() );
1572
- $addons = '<div id="social" class="">
1573
- <div class="row">
1574
- <div class="columns large-11">
1575
- <p><a href="http://twitter.com/home/?status=' . $message . '" class="button" target= "_blank" title="' . __( 'Post to Twitter Now', 'rtmedia' ) . '">' . __( 'Post to Twitter', 'rtmedia' ) . '</a></p>
1576
- <p><a href="https://www.facebook.com/sharer/sharer.php?u=http://rtcamp.com/rtmedia/" class="button" target="_blank" title="' . __( 'Share on Facebook Now', 'rtmedia' ) . '">' . __( 'Share on Facebook', 'rtmedia' ) . '</a></p>
1577
- <p><a href="http://wordpress.org/support/view/plugin-reviews/buddypress-media?rate=5#postform" class="button" target= "_blank" title="' . __( 'Rate rtMedia on Wordpress.org', 'rtmedia' ) . '">' . __( 'Rate on Wordpress.org', 'rtmedia' ) . '</a></p>
1578
- <p><a href="' . sprintf( '%s', 'https://rtcamp.com/feed/' ) . '" title="' . __( 'Subscribe to our feeds', 'rtmedia' ) . '" class="button" target="_blank" title="' . __( 'Subscribe to our Feeds', 'rtmedia' ) . '">' . __( 'Subscribe to our Feeds', 'rtmedia' ) . '</a></p>
1579
- <p><a href="' . $setting_page_url . '" title="' . __( 'Add link to footer', 'rtmedia' ) . '" class="button" title="' . __( 'Add link to footer', 'rtmedia' ) . '">' . __( 'Add link to footer', 'rtmedia' ) . '</a></p>
1580
- </div>
1581
- </div>
1582
</div>';
1583
- //<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>
1584
- //<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> ;
1585
- new RTMediaAdminWidget( 'spread-the-word', __( 'Spread the Word', 'rtmedia' ), $addons );
1586
1587
- // $donate = '<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
1588
- // <!-- Identify your business so that you can collect the payments. -->
1589
- // <input type="hidden" name="business"
1590
- // value="paypal@rtcamp.com">
1591
- // <!-- Specify a Donate button. -->
1592
- // <input type="hidden" name="cmd" value="_donations">
1593
- // <!-- Specify details about the contribution -->
1594
- // <input type="hidden" name="item_name" value="BuddyPress Media">
1595
- // <label><b>' . __('USD', 'rtmedia') . '</b></label>
1596
- // <input type="text" name="amount" size="3">
1597
- // <input type="hidden" name="currency_code" value="USD">
1598
- // <!-- Display the payment button. -->
1599
- // <input type="hidden" name="cpp_header_image" value="' . RTMEDIA_URL . 'app/assets/img/rtcamp-logo.png">
1600
- // <input type="image" id="rt-donate-button" name="submit" border="0"
1601
- // src="' . RTMEDIA_URL . 'app/assets/img/paypal-donate-button.png"
1602
- // alt="PayPal - The safer, easier way to pay online">
1603
- // </form><br />
1604
- // <center><b>' . __('OR', 'rtmedia') . '</b></center><br />
1605
- // <center>' . __('Use <a href="https://rtcamp.com/store/product-category/buddypress/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media">premium add-ons</a> starting from $9', 'rtmedia') . '</center>';
1606
- // ;
1607
- // new BPMediaAdminWidget('donate', __('Donate', 'rtmedia'), $donate);
1608
1609
$branding = '<form action="http://rtcamp.us1.list-manage1.com/subscribe/post?u=85b65c9c71e2ba3fab8cb1950&amp;id=9e8ded4470" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
1610
<div class="mc-field-group">
1611
<input type="email" value="' . $current_user->user_email . '" name="EMAIL" placeholder="Email" class="required email" id="mce-EMAIL">
1612
<input style="display:none;" type="checkbox" checked="checked" value="1" name="group[1721][1]" id="mce-group[1721]-1721-0">
1613
<div id="mce-responses" class="clear">
1614
<div class="response" id="mce-error-response" style="display:none"></div>
1615
<div class="response" id="mce-success-response" style="display:none"></div>
1616
</div>
1617
- <input type="submit" value="' . __( 'Subscribe', 'rtmedia' ) . '" name="subscribe" id="mc-embedded-subscribe" class="button">
1618
</div>
1619
</form>';
1620
new RTMediaAdminWidget( 'branding', __( 'Subscribe', 'rtmedia' ), $branding );
@@ -1624,8 +1622,8 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
1624
do_action( 'rtmedia_after_default_admin_widgets' );
1625
}
1626
1627
- public function linkback(){
1628
- if ( isset( $_POST['linkback'] ) && $_POST['linkback'] ){
1629
return rtmedia_update_site_option( 'rtmedia-add-linkback', true );
1630
} else {
1631
return rtmedia_update_site_option( 'rtmedia-add-linkback', false );
@@ -1633,9 +1631,9 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
1633
die;
1634
}
1635
1636
- public function convert_videos_mailchimp_send(){
1637
- if ( 'Yes' == $_POST['interested'] && ! empty( $_POST['choice'] ) ){
1638
- wp_remote_get( esc_url_raw( add_query_arg( array( 'rtmedia-convert-videos-form' => 1, 'choice' => $_POST['choice'], 'url' => urlencode( $_POST['url'] ), 'email' => $_POST['email'] ), 'http://rtcamp.com/' ) ) );
1639
} else {
1640
rtmedia_update_site_option( 'rtmedia-survey', 0 );
1641
}
@@ -1643,28 +1641,28 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
1643
die;
1644
}
1645
1646
- public function video_transcoding_survey_response(){
1647
- if ( isset( $_GET['survey-done'] ) && ( $_GET['survey-done'] == md5( 'survey-done' ) ) ){
1648
rtmedia_update_site_option( 'rtmedia-survey', 0 );
1649
}
1650
}
1651
1652
- public function plugin_meta_premium_addon_link( $plugin_meta, $plugin_file, $plugin_data, $status ){
1653
- if ( plugin_basename( RTMEDIA_PATH . 'index.php' ) == $plugin_file ){
1654
$plugin_meta[] = '<a href="https://rtcamp.com/rtmedia/addons/?utm_source=dashboard&#038;utm_medium=plugin&#038;utm_campaign=buddypress-media" title="' . __( 'Premium Add-ons', 'rtmedia' ) . '">' . __( 'Premium Add-ons', 'rtmedia' ) . '</a>';
1655
}
1656
1657
return $plugin_meta;
1658
}
1659
1660
- public function upload_filetypes_error(){
1661
global $rtmedia;
1662
$upload_filetypes = rtmedia_get_site_option( 'upload_filetypes', 'jpg jpeg png gif' );
1663
$upload_filetypes = explode( ' ', $upload_filetypes );
1664
- $flag = false;
1665
- if ( isset( $rtmedia->options['images_enabled'] ) && $rtmedia->options['images_enabled'] ){
1666
$not_supported_image = array_diff( array( 'jpg', 'jpeg', 'png', 'gif' ), $upload_filetypes );
1667
- if ( ! empty( $not_supported_image ) ){
1668
echo '<div class="error upload-filetype-network-settings-error">
1669
<p>
1670
' . sprintf( __( 'You have images enabled on rtMedia but your network allowed filetypes do not permit 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' ) ) . '
@@ -1674,8 +1672,8 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
1674
$flag = true;
1675
}
1676
}
1677
- if ( isset( $rtmedia->options['videos_enabled'] ) && $rtmedia->options['videos_enabled'] ){
1678
- if ( ! in_array( 'mp4', $upload_filetypes ) ){
1679
echo '<div class="error upload-filetype-network-settings-error">
1680
<p>
1681
' . sprintf( __( 'You have video enabled on BuddyPress Media but your network allowed filetypes do not permit uploading of mp4. Click <a href="%s">here</a> to change your settings manually.', 'rtmedia' ), network_admin_url( 'settings.php#upload_filetypes' ) ) . '
@@ -1685,8 +1683,8 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
1685
$flag = true;
1686
}
1687
}
1688
- if ( isset( $rtmedia->options['audio_enabled'] ) && $rtmedia->options['audio_enabled'] ){
1689
- if ( ! in_array( 'mp3', $upload_filetypes ) ){
1690
echo '<div class="error upload-filetype-network-settings-error"><p>' . sprintf( __( 'You have audio enabled on BuddyPress Media but your network allowed filetypes do not permit uploading of mp3. Click <a href="%s">here</a> to change your settings manually.', 'rtmedia' ), network_admin_url( 'settings.php#upload_filetypes' ) ) . '
1691
<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' ) . '" />
1692
</p>
@@ -1694,13 +1692,13 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
1694
$flag = true;
1695
}
1696
}
1697
- if ( $flag ){
1698
?>
1699
<script type="text/javascript">
1700
jQuery( '.upload-filetype-network-settings-error' ).on( 'click', '.update-network-settings-upload-filetypes', function () {
1701
jQuery( '.update-network-settings-upload-filetypes' ).siblings( 'img' ).show();
1702
jQuery( '.update-network-settings-upload-filetypes' ).prop( 'disabled', true );
1703
- jQuery.post( ajaxurl, {action: 'rtmedia_correct_upload_filetypes'}, function ( response ) {
1704
if ( response ) {
1705
jQuery( '.upload-filetype-network-settings-error:first' ).after( '<div style="display: none;" class="updated rtmedia-network-settings-updated-successfully"><p><?php _e( 'Network settings updated successfully.', 'rtmedia' ); ?></p></div>' )
1706
jQuery( '.upload-filetype-network-settings-error' ).remove();
@@ -1709,35 +1707,35 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
1709
} );
1710
} );
1711
</script>
1712
- <?php
1713
}
1714
}
1715
1716
- public function correct_upload_filetypes(){
1717
global $rtmedia;
1718
$upload_filetypes_orig = $upload_filetypes = rtmedia_get_site_option( 'upload_filetypes', 'jpg jpeg png gif' );
1719
- $upload_filetypes = explode( ' ', $upload_filetypes );
1720
- if ( isset( $rtmedia->options['images_enabled'] ) && $rtmedia->options['images_enabled'] ){
1721
$not_supported_image = array_diff( array( 'jpg', 'jpeg', 'png', 'gif' ), $upload_filetypes );
1722
- if ( ! empty( $not_supported_image ) ){
1723
$update_image_support = null;
1724
foreach ( $not_supported_image as $ns ) {
1725
$update_image_support .= ' ' . $ns;
1726
}
1727
- if ( $update_image_support ){
1728
$upload_filetypes_orig .= $update_image_support;
1729
rtmedia_update_site_option( 'upload_filetypes', $upload_filetypes_orig );
1730
}
1731
}
1732
}
1733
- if ( isset( $rtmedia->options['videos_enabled'] ) && $rtmedia->options['videos_enabled'] ){
1734
- if ( ! in_array( 'mp4', $upload_filetypes ) ){
1735
$upload_filetypes_orig .= ' mp4';
1736
rtmedia_update_site_option( 'upload_filetypes', $upload_filetypes_orig );
1737
}
1738
}
1739
- if ( isset( $rtmedia->options['audio_enabled'] ) && $rtmedia->options['audio_enabled'] ){
1740
- if ( ! in_array( 'mp3', $upload_filetypes ) ){
1741
$upload_filetypes_orig .= ' mp3';
1742
rtmedia_update_site_option( 'upload_filetypes', $upload_filetypes_orig );
1743
}
@@ -1746,32 +1744,31 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
1746
die();
1747
}
1748
1749
- function edit_video_thumbnail( $form_fields, $post ){
1750
- if ( isset( $post->post_mime_type ) ){
1751
$media_type = explode( '/', $post->post_mime_type );
1752
- if ( is_array( $media_type ) && 'video' == $media_type[0] ){
1753
- $media_id = $post->ID;
1754
- $thumbnail_array = get_post_meta( $media_id, 'rtmedia_media_thumbnails', true );
1755
- $rtmedia_model = new RTMediaModel();
1756
- $rtmedia_media = $rtmedia_model->get( array( 'media_id' => $media_id ) );
1757
$video_thumb_html = '';
1758
- if ( is_array( $thumbnail_array ) ){
1759
$video_thumb_html .= '<ul> ';
1760
1761
foreach ( $thumbnail_array as $key => $thumbnail_src ) {
1762
- $checked = checked( $thumbnail_src, $rtmedia_media[0]->cover_art, false );
1763
- $count = $key + 1;
1764
$video_thumb_html .= '<li style="width: 150px;display: inline-block;">
1765
<label for="rtmedia-upload-select-thumbnail-' . $count . '">
1766
<input type="radio" ' . $checked . ' id="rtmedia-upload-select-thumbnail-' . $count . '" value="' . $thumbnail_src . '" name="rtmedia-thumbnail" />
1767
<img src=" ' . $thumbnail_src . '" style="max-height: 120px;max-width: 120px; vertical-align: middle;" />
1768
</label>
1769
</li> ';
1770
-
1771
}
1772
1773
$video_thumb_html .= ' </ul>';
1774
- $form_fields['rtmedia_video_thumbnail'] = array(
1775
'label' => 'Video Thumbnails', 'input' => 'html', 'html' => $video_thumb_html,
1776
);
1777
}
@@ -1781,23 +1778,23 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
1781
return $form_fields;
1782
}
1783
1784
- function save_video_thumbnail( $post, $attachment ){
1785
- if ( isset( $post['rtmedia-thumbnail'] ) ){
1786
$rtmedia_model = new RTMediaModel();
1787
- $model = new RTMediaModel();
1788
- $media = $model->get( array( 'media_id' => $post['ID'] ) );
1789
- $media_id = $media[0]->id;
1790
- $rtmedia_model->update( array( 'cover_art' => $post['rtmedia-thumbnail'] ), array( 'media_id' => $post['ID'] ) );
1791
update_activity_after_thumb_set( $media_id );
1792
}
1793
1794
return $post;
1795
}
1796
1797
- function rtmedia_regenerate_thumb_js(){
1798
global $pagenow;
1799
1800
- if ( 'upload.php' == $pagenow ){
1801
?>
1802
<script type="text/javascript">
1803
function rtmedia_regenerate_thumbs( post_id ) {
@@ -1817,62 +1814,62 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
1817
}
1818
}
1819
</script>
1820
- <?php
1821
}
1822
}
1823
1824
- function add_bulk_actions_regenerate(){
1825
?>
1826
<script type="text/javascript">
1827
jQuery( document ).ready( function ( $ ) {
1828
$( 'select[name^="action"] option:last-child' ).before( '<option value="bulk_video_regenerate_thumbnails"><?php esc_attr_e( 'Regenerate Video Thumbnails', 'rtmedia' ); ?></option>' );
1829
} );
1830
</script>
1831
- <?php
1832
}
1833
1834
- function presstrends_plugin(){
1835
global $rtmedia;
1836
$option = $rtmedia->options;
1837
- if ( ! isset( $option['general_AllowUserData'] ) ){
1838
return;
1839
}
1840
- if ( '0' == $option['general_AllowUserData'] ){
1841
return;
1842
}
1843
// PressTrends Account API Key
1844
$api_key = 'djbzu1no2tdz4qq4u2fpgaemuup2zzmtjulb';
1845
- $auth = 'o3w063qppl7ha022jyc3bjpi7usrmczho';
1846
// Start of Metrics
1847
global $wpdb;
1848
$data = get_transient( 'presstrends_cache_data' );
1849
1850
- if ( ! $data || $data == '' ){
1851
- $api_base = 'http://api.presstrends.io/index.php/api/pluginsites/update?auth=';
1852
- $url = $api_base . $auth . '&api=' . $api_key . '';
1853
- $count_posts = wp_count_posts();
1854
- $count_pages = wp_count_posts( 'page' );
1855
$comments_count = wp_count_comments();
1856
1857
- if ( function_exists( 'wp_get_theme' ) ){
1858
$theme_data = wp_get_theme();
1859
$theme_name = urlencode( $theme_data->Name );
1860
} else {
1861
$theme_data = get_theme_data( get_stylesheet_directory() . '/style.css' );
1862
- $theme_name = $theme_data['Name'];
1863
}
1864
1865
$plugin_name = '&';
1866
1867
foreach ( get_plugins() as $plugin_info ) {
1868
- $plugin_name .= $plugin_info['Name'] . '&';
1869
}
1870
1871
// CHANGE __FILE__ PATH IF LOCATED OUTSIDE MAIN PLUGIN FILE
1872
- $plugin_data = get_plugin_data( __FILE__ );
1873
$posts_with_comments = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts WHERE post_type='post' AND comment_count > 0" );
1874
- $data = array(
1875
- 'url' => base64_encode( site_url() ), 'posts' => $count_posts->publish, 'pages' => $count_pages->publish, 'comments' => $comments_count->total_comments, 'approved' => $comments_count->approved, 'spam' => $comments_count->spam, 'pingbacks' => $wpdb->get_var( "SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_type = 'pingback'" ), 'post_conversion' => ( $count_posts->publish > 0 && $posts_with_comments > 0 ) ? number_format( ( $posts_with_comments / $count_posts->publish ) * 100, 0, '.', '' ) : 0, 'theme_version' => $plugin_data['Version'], 'theme_name' => $theme_name, 'site_name' => str_replace( ' ', '', get_bloginfo( 'name' ) ), 'plugins' => count( get_option( 'active_plugins' ) ), 'plugin' => urlencode( $plugin_name ), 'wpversion' => get_bloginfo( 'version' ),
1876
);
1877
1878
foreach ( $data as $k => $v ) {
@@ -1884,17 +1881,17 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
1884
}
1885
}
1886
1887
- function rtmedia_update_template_notice(){
1888
- $site_option = rtmedia_get_site_option( 'rtmedia-update-template-notice-v3_7_38' );
1889
1890
- if ( ! $site_option || 'hide' != $site_option ){
1891
- rtmedia_update_site_option( 'rtmedia-update-template-notice-v3_7_38', 'show' );
1892
- if ( is_dir( get_template_directory() . '/rtmedia' ) ){
1893
echo '<div class="error rtmedia-update-template-notice"><p>' . __( 'Please update rtMedia template files if you have overridden the default rtMedia templates in your theme. If not, you can ignore and hide this notice.' ) . '<a href="#" onclick="rtmedia_hide_template_override_notice()" style="float:right">' . __( 'Hide', 'rtmedia' ) . '</a>' . ' </p></div>';
1894
?>
1895
<script type="text/javascript">
1896
function rtmedia_hide_template_override_notice() {
1897
- var data = {action: 'rtmedia_hide_template_override_notice'};
1898
jQuery.post( ajaxurl, data, function ( response ) {
1899
response = response.trim();
1900
if ( '1' === response )
@@ -1902,19 +1899,95 @@ if ( ! class_exists( 'RTMediaAdmin' ) ){
1902
} );
1903
}
1904
</script>
1905
- <?php
1906
}
1907
}
1908
}
1909
1910
- function rtmedia_hide_template_override_notice(){
1911
1912
- if ( rtmedia_update_site_option( 'rtmedia-update-template-notice-v3_7_38', 'hide' ) ){
1913
echo '1';
1914
} else {
1915
echo '0';
1916
}
1917
die();
1918
}
1919
}
1920
}
6
* @subpackage Admin
7
*
8
*/
9
+ if ( ! class_exists( 'RTMediaAdmin' ) ) {
10
11
/**
12
* RTMediaAdmin class.
25
* @access public
26
* @return void
27
*/
28
+ public function __construct() {
29
global $rtmedia;
30
31
// Actions and filters
32
add_action( 'init', array( $this, 'video_transcoding_survey_response' ) );
33
// add_action( 'admin_init', array( $this, 'presstrends_plugin' ) );
34
//$rtmedia_feed = new RTMediaFeed();
35
add_filter( 'plugin_action_links_' . RTMEDIA_BASE_NAME, array( &$this, 'plugin_add_settings_link' ) );
36
//add_action ( 'wp_ajax_rtmedia_fetch_feed', array( $rtmedia_feed, 'fetch_feed' ), 1 );
56
57
$obj_encoding = new RTMediaEncoding( true );
58
59
+ if ( $obj_encoding->api_key ) {
60
add_filter( 'media_row_actions', array( $this, 'add_reencode_link' ), null, 2 );
61
add_action( 'admin_head-upload.php', array( $this, 'add_bulk_actions_regenerate' ) );
62
add_action( 'admin_footer', array( $this, 'rtmedia_regenerate_thumb_js' ) );
66
67
add_action( 'wp_ajax_rt_media_regeneration', array( $this, 'rt_media_regeneration' ), 1 );
68
69
+ if ( ! isset( $rtmedia->options ) ) {
70
$rtmedia->options = rtmedia_get_site_option( 'rtmedia-options' );
71
}
72
73
+ if ( isset( $_POST[ 'rtmedia-options' ] ) ) {
74
+ if ( isset( $_POST[ 'rtmedia-options' ][ 'general_showAdminMenu' ] ) && '1' == $_POST[ 'rtmedia-options' ][ 'general_showAdminMenu' ] ) {
75
add_action( 'admin_bar_menu', array( $this, 'admin_bar_menu' ), 100, 1 );
76
}
77
} else {
78
+ if ( 1 == intval( $rtmedia->options[ 'general_showAdminMenu' ] ) ) {
79
add_action( 'admin_bar_menu', array( $this, 'admin_bar_menu' ), 100, 1 );
80
}
81
}
82
83
+ if ( is_admin() ) {
84
add_action( 'admin_enqueue_scripts', array( $this, 'ui' ) );
85
//bp_core_admin_hook();
86
add_action( 'admin_menu', array( $this, 'menu' ), 1 );
87
add_action( 'init', array( $this, 'bp_admin_tabs' ) );
88
89
+ if ( is_multisite() ) {
90
add_action( 'network_admin_edit_rtmedia', array( $this, 'save_multisite_options' ) );
91
}
92
}
96
// show rtmedia advertisement
97
// if(! defined("RTMEDIA_PRO_VERSION") )
98
// add_action ( 'rtmedia_before_default_admin_widgets', array( $this, 'rtmedia_advertisement' ),1);
99
+ if ( ! class_exists( 'BuddyPress' ) ) {
100
add_action( 'admin_init', array( $this, 'check_permalink_admin_notice' ) );
101
}
102
105
add_action( 'wp_ajax_rtmedia_hide_inspirebook_release_notice', array( $this, 'rtmedia_hide_inspirebook_release_notice' ), 1 );
106
add_action( 'wp_ajax_rtmedia_hide_social_sync_notice', array( $this, 'rtmedia_hide_social_sync_notice' ), 1 );
107
$rtmedia_media_import = new RTMediaMediaSizeImporter(); // do not delete this line. We only need to create object of this class if we are in admin section
108
+ if ( class_exists( 'BuddyPress' ) ) {
109
$rtmedia_activity_upgrade = new RTMediaActivityUpgrade();
110
}
111
add_action( 'admin_notices', array( $this, 'rtmedia_admin_notices' ) );
114
add_action( 'admin_init', array( $this, 'rtmedia_migration' ) );
115
}
116
117
+ function rtmedia_migration() {
118
$rtMigration = new RTMediaMigration();
119
}
120
121
+ function rtmedia_addon_license_save_hook() {
122
do_action( 'rtmedia_addon_license_save_hook' );
123
}
124
131
*
132
* @return void
133
*/
134
+ public function rtmedia_network_admin_notices() {
135
+ if ( is_multisite() ) {
136
$this->upload_filetypes_error();
137
}
138
}
146
*
147
* @return void
148
*/
149
+ public function rtmedia_admin_notices() {
150
+ if ( current_user_can( 'list_users' ) ) {
151
$this->upload_filetypes_error();
152
$this->rtmedia_regenerate_thumbnail_notice();
153
$this->rtmedia_addon_update_notice();
160
/*
161
* Show social sync release notice admin notice.
162
*/
163
+
164
+ function rtmedia_social_sync_release_notice() {
165
$site_option = rtmedia_get_site_option( 'rtmedia_social_sync_release_notice' );
166
+ $check_rtmedia_social_sync_installed = file_exists( trailingslashit( WP_PLUGIN_DIR ) . 'rtmedia-social-sync/index.php' );
167
+
168
+ if ( ( ! $site_option || 'hide' != $site_option ) && ! $check_rtmedia_social_sync_installed ) {
169
rtmedia_update_site_option( 'rtmedia_social_sync_release_notice', 'show' );
170
?>
171
<div class="updated rtmedia-social-sync-notice">
181
</div>
182
<script type="text/javascript">
183
function rtmedia_hide_social_sync_notice() {
184
+ var data = { action: 'rtmedia_hide_social_sync_notice' };
185
jQuery.post( ajaxurl, data, function ( response ) {
186
response = response.trim();
187
if ( response === "1" )
189
} );
190
}
191
</script>
192
+ <?php
193
}
194
}
195
196
/*
197
* Hide social sync release notice
198
*/
199
+
200
+ function rtmedia_hide_social_sync_notice() {
201
+ if ( rtmedia_update_site_option( 'rtmedia_social_sync_release_notice', 'hide' ) ) {
202
echo '1';
203
} else {
204
echo '0';
215
*
216
* @return void
217
*/
218
+ public function rtmedia_inspirebook_release_notice() {
219
$site_option = rtmedia_get_site_option( 'rtmedia_inspirebook_release_notice' );
220
+ if ( ( ! $site_option || 'hide' != $site_option ) && ( 'inspirebook' != get_stylesheet() ) ) {
221
rtmedia_update_site_option( 'rtmedia_inspirebook_release_notice', 'show' );
222
?>
223
<div class="updated rtmedia-inspire-book-notice">
224
<p>
225
+ <span><a href="https://rtcamp.com/products/inspirebook/" target="_blank"><b>Meet
226
InspireBook</b></a> - First official rtMedia premium theme.</span>
227
<a href="#" onclick="rtmedia_hide_inspirebook_notice()" style="float:right">Dismiss</a>
228
</p>
229
</div>
230
<script type="text/javascript">
231
function rtmedia_hide_inspirebook_notice() {
232
+ var data = { action: 'rtmedia_hide_inspirebook_release_notice' };
233
jQuery.post( ajaxurl, data, function ( response ) {
234
response = response.trim();
235
if ( response === "1" )
237
} );
238
}
239
</script>
240
+ <?php
241
}
242
}
243
250
*
251
* @return void
252
*/
253
+ public function rtmedia_hide_inspirebook_release_notice() {
254
+ if ( rtmedia_update_site_option( 'rtmedia_inspirebook_release_notice', 'hide' ) ) {
255
echo '1';
256
} else {
257
echo '0';
268
*
269
* @return void
270
*/
271
+ public function rtmedia_bp_add_update_type() {
272
+ if ( class_exists( 'BuddyPress' ) && function_exists( 'bp_activity_set_action' ) ) {
273
bp_activity_set_action( 'rtmedia_update', 'rtmedia_update', 'rtMedia Update' );
274
}
275
}
283
*
284
* @return void
285
*/
286
+ public function check_permalink_admin_notice() {
287
global $wp_rewrite;
288
+ if ( empty( $wp_rewrite->permalink_structure ) ) {
289
add_action( 'admin_notices', array( $this, 'rtmedia_permalink_notice' ) );
290
}
291
}
299
*
300
* @return void
301
*/
302
+ public function rtmedia_permalink_notice() {
303
echo '<div class="error rtmedia-permalink-change-notice">
304
<p> <b>' . __( 'rtMedia:' ) . '</b> ' . __( ' You must ' ) . '<a href="' . admin_url( 'options-permalink.php' ) . '">' . __( 'update permalink structure' ) . '</a>' . __( ' to something other than the default for it to work.', 'rtmedia' ) . ' </p>
305
</div>';
314
*
315
* @return void
316
*/
317
+ public function rtmedia_addon_update_notice() {
318
319
+ $site_option = rtmedia_get_site_option( 'rtmedia-addon-update-notice-3_8' );
320
+ if( is_rt_admin()
321
+ && ( ! $site_option || 'hide' != $site_option ) ){
322
+
323
+ if ( ! $this->check_for_addon_update_notice() ) {
324
+ return;
325
+ }
326
+ rtmedia_update_site_option( 'rtmedia-addon-update-notice-3_8', 'show' );
327
+ ?>
328
+ <div class="error rtmedia-addon-upate-notice">
329
+ <p>
330
+ <strong><?php _e( 'rtMedia:', 'rtmedia' ) ?></strong> <?php _e( 'Please update all premium add-ons that you have purchased from rtCamp from', 'rtmedia' ) ?> <a href="https://rtcamp.com/my-account/" target="_blank"><?php _e( 'your account', 'rtmedia' ) ?></a>. <a href="#" onclick="rtmedia_hide_addon_update_notice()" style="float:right"><?php _e( 'Dismiss', 'rtmedia' ) ?></a>
331
+ </p>
332
+ </div>
333
<script type="text/javascript">
334
function rtmedia_hide_addon_update_notice() {
335
var data = {
355
*
356
* @return bool $return_falg
357
*/
358
+ public function check_for_addon_update_notice() {
359
$return_falg = false;
360
361
+ // check for rtMedia Instagram version
362
+ if ( defined( 'RTMEDIA_INSTAGRAM_PATH' ) ) {
363
$plugin_info = get_plugin_data( RTMEDIA_INSTAGRAM_PATH . 'index.php' );
364
+ if ( isset( $plugin_info[ 'Version' ] ) && ( -1 === version_compare( $plugin_info[ 'Version' ], '2.1.14' ) ) ) {
365
$return_falg = true;
366
}
367
+ } elseif( defined( 'RTMEDIA_PHOTO_TAGGING_PATH' ) ){
368
+ // check for rtMedia Photo Tagging version
369
+ $plugin_info = get_plugin_data( RTMEDIA_PHOTO_TAGGING_PATH . 'index.php' );
370
+ if ( isset( $plugin_info[ 'Version' ] ) && ( -1 === version_compare( $plugin_info[ 'Version' ], '2.2.14' ) ) ) {
371
+ $return_falg = true;
372
+ }
373
+ } elseif( defined( 'RTMEDIA_FFMPEG_PATH' ) ){
374
+ // check for rtMedia FFPMEG version
375
+ $plugin_info = get_plugin_data( RTMEDIA_FFMPEG_PATH . 'index.php' );
376
+ if ( isset( $plugin_info[ 'Version' ] ) && ( -1 === version_compare( $plugin_info[ 'Version' ], '2.1.14' ) ) ) {
377
+ $return_falg = true;
378
+ }
379
+ } elseif( defined( 'RTMEDIA_KALTURA_PATH' ) ){
380
+ // check for rtMedia Kaltura version
381
+ $plugin_info = get_plugin_data( RTMEDIA_KALTURA_PATH . 'index.php' );
382
+ if ( isset( $plugin_info[ 'Version' ] ) && ( -1 === version_compare( $plugin_info[ 'Version' ], '3.0.16' ) ) ) {
383
+ $return_falg = true;
384
+ }
385
+ } elseif( defined( 'RTMEDIA_PRO_PATH' ) ){
386
+ // check for rtMedia Pro version
387
+ $plugin_info = get_plugin_data( RTMEDIA_PRO_PATH . 'index.php' );
388
+ if ( isset( $plugin_info[ 'Version' ] ) && ( -1 === version_compare( $plugin_info[ 'Version' ], '2.6' ) ) ) {
389
+ $return_falg = true;
390
+ }
391
+ } elseif( defined( 'RTMEDIA_SOCIAL_SYNC_PATH' ) ){
392
+ // check for rtMedia Social Sync version
393
+ $plugin_info = get_plugin_data( RTMEDIA_SOCIAL_SYNC_PATH . 'index.php' );
394
+ if ( isset( $plugin_info[ 'Version' ] ) && ( -1 === version_compare( $plugin_info[ 'Version' ], '1.3.1' ) ) ) {
395
+ $return_falg = true;
396
+ }
397
+ } elseif( defined( 'RTMEDIA_MEMBERSHIP_PATH' ) ){
398
+ // check for rtMedia Membership version
399
+ $plugin_info = get_plugin_data( RTMEDIA_MEMBERSHIP_PATH . 'index.php' );
400
+ if ( isset( $plugin_info[ 'Version' ] ) && ( -1 === version_compare( $plugin_info[ 'Version' ], '2.1.5' ) ) ) {
401
+ $return_falg = true;
402
+ }
403
+ } elseif( defined( 'RTMEDIA_WATERMARK_PATH' ) ){
404
+ // check for rtMedia Photo Watermak version
405
+ $plugin_info = get_plugin_data( RTMEDIA_WATERMARK_PATH . 'index.php' );
406
+ if ( isset( $plugin_info[ 'Version' ] ) && ( -1 === version_compare( $plugin_info[ 'Version' ], '1.1.8' ) ) ) {
407
+ $return_falg = true;
408
}
409
}
410
420
*
421
* @return void
422
*/
423
+ public function bp_admin_tabs() {
424
+ if ( current_user_can( 'manage_options' ) ) {
425
add_action( 'bp_admin_tabs', array( $this, 'tab' ) );
426
}
427
}
435
*
436
* @return void
437
*/
438
+ public function rtmedia_advertisement() {
439
+ $src = RTMEDIA_URL . 'app/assets/admin/img/rtMedia-pro-ad.png'
440
?>
441
<div class='rtmedia-admin-ad'>
442
+ <a href='http://rtcamp.com/products/rtmedia-pro/' target='_blank' title='rtMedia Pro'>
443
<img src='<?php echo $src; ?>' alt="<?php _e( 'rtMedia Pro is released', 'rtmedia' ); ?>"/>
444
</a>
445
</div>
446
+ <?php
447
}
448
449
/**
455
*
456
* @return void
457
*/
458
+ public function rtmedia_dashboard_widget_function() {
459
?>
460
461
+ <div class="clearfix">
462
+
463
+ <div class="rtm-column alignleft">
464
+ <h4 class="sub"><?php _e( 'Media Stats', 'rtmedia' ); ?></h4>
465
466
<table>
467
<tbody>
468
+ <?php
469
+ $rtMedia_model = new RTMediaModel();
470
+ $sql = "select media_type, count(id) as count from {$rtMedia_model->table_name} where blog_id='" . get_current_blog_id() . "' group by media_type";
471
+ global $wpdb;
472
+ $results = $wpdb->get_results( $sql );
473
+ if ( $results ) {
474
+ foreach ( $results as $media ) {
475
+ if ( defined( strtoupper( 'RTMEDIA_' . $media->media_type . '_PLURAL_LABEL' ) ) ) {
476
+ ?>
477
+ <tr>
478
+ <td class="b"> <?php echo $media->count; ?> </td>
479
+ <td class="t"><?php echo constant( strtoupper( 'RTMEDIA_' . $media->media_type . '_PLURAL_LABEL' ) ); ?></td>
480
+ </tr>
481
+ <?php
482
+ }
483
+ }
484
+ }
485
+ ?>
486
</tbody>
487
</table>
488
</div>
489
+
490
+ <div class="rtm-column alignright">
491
+ <h4 class="sub"><?php _e( 'Usage Stats', 'rtmedia' ); ?></h4>
492
+
493
<table>
494
<tbody> <?php
495
+ $sql = "select count(*) from {$wpdb->users}";
496
+ $results = $wpdb->get_var( $sql );
497
+ ?>
498
+ <tr>
499
+ <td class="b"> <?php echo $results; ?> </td>
500
+ <td class="t"><?php _e( 'Total ', 'rtmedia' ) ?></td>
501
+ </tr>
502
+ <?php
503
+ $sql = "select count(distinct media_author) from {$rtMedia_model->table_name}";
504
+ $results = $wpdb->get_var( $sql );
505
+ ?>
506
+ <tr>
507
+ <td class="b"> <?php echo $results; ?> </td>
508
+ <td class="t"><?php _e( 'With Media', 'rtmedia' ) ?></td>
509
+ </tr>
510
+ <?php
511
+ $sql = "select count(*) from $wpdb->comments where comment_post_ID in (select media_id from {$rtMedia_model->table_name})";
512
+ $results = $wpdb->get_var( $sql );
513
+ ?>
514
+ <tr>
515
+ <td class="b"> <?php echo $results; ?> </td>
516
+ <td class="t"><?php _e( 'Comments ', 'rtmedia' ) ?></td>
517
+ </tr>
518
+ <?php
519
+ $sql = "select sum(likes) from {$rtMedia_model->table_name}";
520
+ $results = $wpdb->get_var( $sql );
521
+ ?>
522
+ <tr>
523
+ <td class="b"> <?php echo $results; ?> </td>
524
+ <td class="t"><?php _e( 'Likes', 'rtmedia' ) ?></td>
525
+ </tr>
526
527
</tbody>
528
</table>
529
</div>
530
+
531
</div>
532
+
533
+ <div class="rtm-meta-container">
534
+ <ul class="rtm-meta-links">
535
+ <li><b><?php _e( 'rtMedia Links:', 'rtmedia' ); ?></b></li>
536
+ <li><a href="http://rtcamp.com"><?php _e( 'Homepage', 'rtmedia' ); ?></a></li>
537
+ <li><a href="admin.php?page=rtmedia-support#rtmedia-general"><?php _e( 'Free Support', 'rtmedia' ); ?></a></li>
538
+ <li><a href="http://rtcamp.com/rtmedia/addons/"><?php _e( 'Premium Addons', 'rtmedia' ); ?></a></li>
539
+ </ul>
540
+ </div>
541
+ <?php
542
}
543
544
/**
550
*
551
* @return void
552
*/
553
+ public function add_dashboard_widgets() {
554
wp_add_dashboard_widget( 'rtmedia_dashboard_widget', __( 'Right Now in rtMedia', 'rtmedia' ), array( &$this, 'rtmedia_dashboard_widget_function' ) );
555
global $wp_meta_boxes;
556
557
// Get the regular dashboard widgets array
558
// (which has our new widget already but at the end)
559
560
+ $normal_dashboard = $wp_meta_boxes[ 'dashboard' ][ 'normal' ][ 'core' ];
561
562
// Backup and delete our new dashboard widget from the end of the array
563
564
+ $example_widget_backup = array( 'rtmedia_dashboard_widget' => $normal_dashboard[ 'rtmedia_dashboard_widget' ] );
565
+ unset( $normal_dashboard[ 'rtmedia_dashboard_widget' ] );
566
567
// Merge the two arrays together so our widget is at the beginning
568
570
571
// Save the sorted array back into the original metaboxes
572
573
+ $wp_meta_boxes[ 'dashboard' ][ 'normal' ][ 'core' ] = $sorted_dashboard;
574
}
575
576
/**
582
*
583
* @return array $links
584
*/
585
+ public function plugin_add_settings_link( $links ) {
586
$settings_link = '<a href="' . admin_url( 'admin.php?page=rtmedia-settings' ) . '">Settings</a>';
587
array_push( $links, $settings_link );
588
$settings_link = '<a href="' . admin_url( 'admin.php?page=rtmedia-support' ) . '">Support</a>';
601
*
602
* @return array $actions
603
*/
604
+ public function add_reencode_link( $actions, $post ) {
605
606
$mime_type_array = explode( '/', $post->post_mime_type );
607
+ if ( is_array( $mime_type_array ) && '' != $mime_type_array && 'video' == $mime_type_array[ 0 ] ) {
608
+ $actions[ 'reencode' ] = '<a class="submitdelete" onclick="return rtmedia_regenerate_thumbs(' . $post->ID . ')" href="#">' . __( 'Regenerate Thumbnail', 'rtmedia' ) . '</a>';
609
}
610
611
return $actions;
620
*
621
* @return void
622
*/
623
+ public function bulk_action_handler() {
624
+ if ( 'bulk_video_regenerate_thumbnails' == $_REQUEST[ 'action' ] && '' != $_REQUEST[ 'media' ] ) {
625
+ wp_safe_redirect( esc_url_raw( add_query_arg( array( 'media_ids' => urlencode( implode( ',', $_REQUEST[ 'media' ] ) ) ), admin_url( 'admin.php?page=rtmedia-regenerate' ) ) ) );
626
exit;
627
}
628
}
636
*
637
* @return void
638
*/
639
+ public function admin_bar_menu( $admin_bar ) {
640
+ if ( ! current_user_can( 'manage_options' ) ) {
641
return;
642
}
643
644
$admin_bar->add_menu( array(
645
+ 'id' => 'rtMedia',
646
+ 'title' => 'rtMedia',
647
+ 'href' => admin_url( 'admin.php?page=rtmedia-settings' ),
648
+ 'meta' => array(
649
+ 'title' => __( 'rtMedia', 'rtmedia' ),
650
+ ),
651
+ )
652
+ );
653
$admin_bar->add_menu( array(
654
+ 'id' => 'rt-media-dashborad',
655
+ 'parent' => 'rtMedia',
656
+ 'title' => __( 'Settings', 'rtmedia' ),
657
+ 'href' => admin_url( 'admin.php?page=rtmedia-settings' ),
658
+ 'meta' => array(
659
+ 'title' => __( 'Settings', 'rtmedia' ),
660
+ 'target' => '_self',
661
+ ),
662
+ )
663
+ );
664
$admin_bar->add_menu( array(
665
+ 'id' => 'rt-media-addons',
666
+ 'parent' => 'rtMedia',
667
+ 'title' => __( 'Addons', 'rtmedia' ),
668
+ 'href' => admin_url( 'admin.php?page=rtmedia-addons' ),
669
+ 'meta' => array(
670
+ 'title' => __( 'Addons', 'rtmedia' ),
671
+ 'target' => '_self',
672
+ ),
673
+ )
674
+ );
675
$admin_bar->add_menu( array(
676
+ 'id' => 'rt-media-support',
677
+ 'parent' => 'rtMedia',
678
+ 'title' => __( 'Support', 'rtmedia' ),
679
+ 'href' => admin_url( 'admin.php?page=rtmedia-support' ),
680
+ 'meta' => array(
681
+ 'title' => __( 'Support', 'rtmedia' ),
682
+ 'target' => '_self',
683
+ ),
684
+ )
685
+ );
686
$admin_bar->add_menu( array(
687
+ 'id' => 'rt-media-themes',
688
+ 'parent' => 'rtMedia',
689
+ 'title' => __( 'Themes', 'rtmedia' ),
690
+ 'href' => admin_url( 'admin.php?page=rtmedia-themes' ),
691
+ 'meta' => array(
692
+ 'title' => __( 'Themes', 'rtmedia' ),
693
+ 'target' => '_self',
694
+ ),
695
+ )
696
+ );
697
$admin_bar->add_menu( array(
698
+ 'id' => 'rt-media-hire-us',
699
+ 'parent' => 'rtMedia',
700
+ 'title' => __( 'Hire Us', 'rtmedia' ),
701
+ 'href' => admin_url( 'admin.php?page=rtmedia-hire-us' ),
702
+ 'meta' => array(
703
+ 'title' => __( 'Hire Us', 'rtmedia' ),
704
+ 'target' => '_self',
705
+ ),
706
+ )
707
+ );
708
+ if ( has_filter( 'rtmedia_license_tabs' ) || did_action( 'rtmedia_addon_license_details' ) ) {
709
+ $admin_bar->add_menu( array(
710
+ 'id' => 'rt-media-license',
711
+ 'parent' => 'rtMedia',
712
+ 'title' => __( 'Licenses', 'rtmedia' ),
713
+ 'href' => admin_url( 'admin.php?page=rtmedia-license' ),
714
+ 'meta' => array(
715
+ 'title' => __( 'Licenses', 'rtmedia' ),
716
+ 'target' => '_self',
717
+ ),
718
+ )
719
+ );
720
+ }
721
}
722
723
/**
729
*
730
* @return void
731
*/
732
+ public function ui( $hook ) {
733
$admin_pages = array(
734
+ 'rtmedia_page_rtmedia-migration',
735
+ 'rtmedia_page_rtmedia-kaltura-settings',
736
+ 'rtmedia_page_rtmedia-ffmpeg-settings',
737
+ 'toplevel_page_rtmedia-settings',
738
+ 'rtmedia_page_rtmedia-addons',
739
+ 'rtmedia_page_rtmedia-support',
740
+ 'rtmedia_page_rtmedia-themes',
741
+ 'rtmedia_page_rtmedia-hire-us',
742
+ 'rtmedia_page_rtmedia-importer',
743
+ 'rtmedia_page_rtmedia-regenerate',
744
+ 'rtmedia_page_rtmedia-premium',
745
);
746
747
+ if ( has_filter( 'rtmedia_license_tabs' ) || did_action( 'rtmedia_addon_license_details' ) ) {
748
+ $admin_pages[] = 'rtmedia_page_rtmedia-license';
749
+ }
750
+
751
$admin_pages = apply_filters( 'rtmedia_filter_admin_pages_array', $admin_pages );
752
753
+ if ( in_array( $hook, $admin_pages ) || strpos( $hook, 'rtmedia-migration' ) ) {
754
755
$admin_ajax = admin_url( 'admin-ajax.php' );
756
757
+ /* Only one JS file should enqueue */
758
+ wp_enqueue_script( 'rtmedia-admin', RTMEDIA_URL . 'app/assets/admin/js/admin-min.js', array( 'backbone' ), RTMEDIA_VERSION );
759
+
760
wp_localize_script( 'rtmedia-admin', 'rtmedia_on_label', __( 'ON', 'rtmedia' ) );
761
wp_localize_script( 'rtmedia-admin', 'rtmedia_off_label', __( 'OFF', 'rtmedia' ) );
762
wp_localize_script( 'rtmedia-admin', 'rtmedia_admin_ajax', $admin_ajax );
763
wp_localize_script( 'rtmedia-admin', 'rtmedia_admin_url', admin_url() );
764
wp_localize_script( 'rtmedia-admin', 'rtmedia_admin_url', admin_url() );
765
766
$rtmedia_admin_strings = array(
767
'no_refresh' => __( 'Please do not refresh this page.', 'rtmedia' ),
768
'something_went_wrong' => __( 'Something went wrong. Please <a href onclick="location.reload();">refresh</a> page.', 'rtmedia' ),
774
wp_localize_script( 'rtmedia-admin', 'rtmedia_admin_strings', $rtmedia_admin_strings );
775
wp_localize_script( 'rtmedia-admin', 'settings_url', esc_url( add_query_arg( array( 'page' => 'rtmedia-settings' ), ( is_multisite() ? network_admin_url( 'admin.php' ) : admin_url( 'admin.php' ) ) ) ) . '#privacy_enabled' );
776
wp_localize_script( 'rtmedia-admin', 'settings_rt_album_import_url', esc_url( add_query_arg( array( 'page' => 'rtmedia-settings' ), ( is_multisite() ? network_admin_url( 'admin.php' ) : admin_url( 'admin.php' ) ) ) ) );
777
778
+ /* Only one CSS file should enqueue */
779
+ wp_enqueue_style( 'rtmedia-admin', RTMEDIA_URL . 'app/assets/admin/css/admin.css', '', RTMEDIA_VERSION );
780
} else {
781
+
782
+ /* This CSS is using for "Right Now in rtMedia" Widget section on Dashboard */
783
+ wp_enqueue_style( 'rtmedia-widget', RTMEDIA_URL . 'app/assets/admin/css/widget.css', '', RTMEDIA_VERSION );
784
}
785
}
786
794
*
795
* @return void
796
*/
797
+ public function menu() {
798
+ add_menu_page( 'rtMedia', 'rtMedia', 'manage_options', 'rtmedia-settings', array( $this, 'settings_page' ), RTMEDIA_URL . 'app/assets/admin/img/rtmedia-logo.png', '40.1111' );
799
add_submenu_page( 'rtmedia-settings', __( 'Settings', 'rtmedia' ), __( 'Settings', 'rtmedia' ), 'manage_options', 'rtmedia-settings', array( $this, 'settings_page' ) );
800
add_submenu_page( 'rtmedia-settings', __( 'Addons', 'rtmedia' ), __( 'Addons', 'rtmedia' ), 'manage_options', 'rtmedia-addons', array( $this, 'addons_page' ) );
801
add_submenu_page( 'rtmedia-settings', __( 'Support', 'rtmedia' ), __( 'Support', 'rtmedia' ), 'manage_options', 'rtmedia-support', array( $this, 'support_page' ) );
802
add_submenu_page( 'rtmedia-settings', __( 'Themes', 'rtmedia' ), __( 'Themes', 'rtmedia' ), 'manage_options', 'rtmedia-themes', array( $this, 'theme_page' ) );
803
add_submenu_page( 'rtmedia-settings', __( 'Hire Us', 'rtmedia' ), __( 'Hire Us', 'rtmedia' ), 'manage_options', 'rtmedia-hire-us', array( $this, 'hire_us_page' ) );
804
+ if ( has_filter( 'rtmedia_license_tabs' ) || did_action( 'rtmedia_addon_license_details' ) ) {
805
+ add_submenu_page( 'rtmedia-settings', __( 'Licenses', 'rtmedia' ), __( 'Licenses', 'rtmedia' ), 'manage_options', 'rtmedia-license', array( $this, 'license_page' ) );
806
+ }
807
808
+ if ( ! defined( 'RTMEDIA_PRO_VERSION' ) ) {
809
add_submenu_page( 'rtmedia-settings', __( 'Premium', 'rtmedia' ), __( 'Premium ', 'rtmedia' ), 'manage_options', 'rtmedia-premium', array( $this, 'premium_page' ) );
810
}
811
812
$obj_encoding = new RTMediaEncoding( true );
813
814
+ if ( $obj_encoding->api_key ) {
815
add_submenu_page( 'rtmedia-settings', __( 'Regenerate Thumbnail', 'rtmedia' ), __( 'Regen. Thumbnail ', 'rtmedia' ), 'manage_options', 'rtmedia-regenerate', array( $this, 'rt_regenerate_thumbnail' ) );
816
}
817
}
818
819
/**
825
*
826
* @return void
827
*/
828
+ public function rt_regenerate_thumbnail() {
829
$prog = new rtProgress();
830
$done = 0;
831
?>
832
<div class="wrap">
833
<h2> rtMedia: <?php _e( 'Regenerate Video Thumbnails', 'rtmedia' ); ?> </h2>
834
+ <?php
835
+ if ( isset( $_REQUEST[ 'media_ids' ] ) && trim( $_REQUEST[ 'media_ids' ] ) != '' ) {
836
+ $requested = false;
837
+ $media_ids = explode( ',', $_REQUEST[ 'media_ids' ] );
838
+ $total = count( $media_ids );
839
+ } else {
840
+ $media_ids = $this->get_video_without_thumbs();
841
+ $total = count( $media_ids );
842
+ }
843
+ ?>
844
<script>
845
var rt_thumb_all_media = <?php echo json_encode( $media_ids ); ?>;
846
</script>
847
+ <?php
848
+ if ( ! isset( $requested ) ) {
849
+ ?>
850
<br/>
851
<p>You can see this page because you have <a href="<?php echo admin_url( 'admin.php?page=rtmedia-addons' ) ?>">subscribed</a> for <a href="https://rtcamp.com/rtmedia/docs/admin/addons/audio-video-encoding/" target="_blank">rtMedia audio/video encoding service</a>.</p> <p>You can regenerate thumbnails of a specific video by visiting <a href="<?php echo admin_url( 'upload.php?post_mime_type=video' ); ?>">media page</a> and clicking the <b>Regenerate Thumbnail</b> option for that particular video.</p> <p>Click <b>Regenerate Pending Thumbnails</b> to regenerate thumbnails of pending videos.</p> <p><input type="button" class="button button-primary" id="rt-start-media-regenerate" value="<?php echo __( 'Regenerate Pending Thumbnails', 'rtmedia' ) . ' (' . $total . ')'; ?>"/> </p>
852
+ <?php
853
}
854
+ ?>
855
<div id="rt-migration-progress">
856
<br/> <br/>
857
<?php
879
type: 'post',
880
data: {
881
"action": "rt_media_regeneration",
882
+ "media_id": rt_thumb_all_media[indx ++]
883
},
884
success: function ( data ) {
885
data = JSON.parse( data );
887
if ( data.status == false ) {
888
handle_regenrate_fail();
889
} else {
890
+ db_done ++;
891
+ var progw = Math.ceil( ( db_done / db_total ) * 100 );
892
if ( progw > 100 ) {
893
progw = 100;
894
}
906
}
907
}
908
function handle_regenrate_fail() {
909
+ db_fail ++;
910
jQuery( 'span.rt-fail' ).html( db_fail );
911
db_start_regenrate();
912
}
936
*
937
* @return void
938
*/
939
+ public function rtmedia_regenerate_thumbnail_notice() {
940
$obj_encoding = new RTMediaEncoding( true );
941
+ if ( $obj_encoding->api_key ) {
942
$site_option = rtmedia_get_site_option( 'rtmedia-video-thumb-notice' );
943
+ if ( ! $site_option || 'hide' != $site_option ) {
944
rtmedia_update_site_option( 'rtmedia-video-thumb-notice', 'show' );
945
$videos_without_thumbs = get_video_without_thumbs();
946
+ if ( isset( $videos_without_thumbs ) && is_array( $videos_without_thumbs ) && sizeof( $videos_without_thumbs ) > 0 ) {
947
echo '<div class="error rtmedia-regenerate-video-thumb-error">
948
<p>
949
' . sprintf( __( "You have %s videos without thumbnails. Click <a href='%s'> here </a> to generate thumbnails. <a href='#' onclick='rtmedia_hide_video_thumb_notice()' style='float:right'>Hide</a>", 'rtmedia' ), sizeof( $videos_without_thumbs ), admin_url( 'admin.php?page=rtmedia-regenerate' ) ) . '
952
?>
953
<script type="text/javascript">
954
function rtmedia_hide_video_thumb_notice() {
955
+ var data = { action: 'rtmedia_hide_video_thumb_admin_notice' };
956
jQuery.post( ajaxurl, data, function ( response ) {
957
response = response.trim();
958
if ( response === "1" )
960
} );
961
}
962
</script>
963
+ <?php
964
}
965
}
966
}
975
*
976
* @return void
977
*/
978
+ public function rtmedia_hide_video_thumb_admin_notice() {
979
+ if ( rtmedia_update_site_option( 'rtmedia-video-thumb-notice', 'hide' ) ) {
980
echo '1';
981
} else {
982
echo '0';
993
*
994
* @return void
995
*/
996
+ public function rtmedia_hide_addon_update_notice() {
997
+ if ( rtmedia_update_site_option( 'rtmedia-addon-update-notice-3_8', 'hide' ) ) {
998
echo '1';
999
} else {
1000
echo '0';
1011
*
1012
* @return void
1013
*/
1014
+ public function rt_media_regeneration() {
1015
+ if ( isset( $_POST[ 'media_id' ] ) ) {
1016
+ $model = new RTMediaModel();
1017
+ $media = $model->get_media( array( 'media_id' => $_POST[ 'media_id' ] ), 0, 1 );
1018
+ $media_type = $media[ 0 ]->media_type;
1019
+ $response = array();
1020
+ if ( 'video' == $media_type ) {
1021
$objRTMediaEncoding = new RTMediaEncoding( true );
1022
+ $autoformat = 'thumbnails';
1023
+ $objRTMediaEncoding->reencoding( intval( $_POST[ 'media_id' ] ), $autoformat );
1024
+ $response[ 'status' ] = true;
1025
} else {
1026
+ $response[ 'status' ] = false;
1027
+ $response[ 'message' ] = __( 'not a video ...', 'rtmedia' );
1028
}
1029
echo json_encode( $response );
1030
die();
1031
}
1032
}
1033
1034
/**
1035
* Get video without thumbs.
1036
*
1040
*
1041
* @return object $results
1042
*/
1043
+ public function get_video_without_thumbs() {
1044
$rtmedia_model = new RTMediaModel();
1045
+ $sql = "select media_id from {$rtmedia_model->table_name} where media_type = 'video' and blog_id = '" . get_current_blog_id() . "' and cover_art is null";
1046
global $wpdb;
1047
$results = $wpdb->get_col( $sql );
1048
1058
*
1059
* @return void
1060
*/
1061
+ public function settings_page() {
1062
$this->render_page( 'rtmedia-settings', 'rtmedia' );
1063
}
1064
1071
*
1072
* @return void
1073
*/
1074
+ public function privacy_page() {
1075
$this->render_page( 'rtmedia-privacy' );
1076
}
1077
1084
*
1085
* @return void
1086
*/
1087
+ public function rt_importer_page() {
1088
$this->render_page( 'rtmedia-importer' );
1089
}
1090
1097
*
1098
* @return void
1099
*/
1100
+ public function convert_videos_page() {
1101
$this->render_page( 'rtmedia-convert-videos' );
1102
}
1103
1110
*
1111
* @return void
1112
*/
1113
+ public function addons_page() {
1114
$this->render_page( 'rtmedia-addons' );
1115
}
1116
1123
*
1124
* @return void
1125
*/
1126
+ public function support_page() {
1127
$this->render_page( 'rtmedia-support' );
1128
}
1129
1136
*
1137
* @return void
1138
*/
1139
+ public function premium_page() {
1140
$this->render_page( 'rtmedia-premium' );
1141
}
1142
1149
*
1150
* @return void
1151
*/
1152
+ public function theme_page() {
1153
$this->render_page( 'rtmedia-themes' );
1154
}
1155
1162
*
1163
* @return void
1164
*/
1165
+ public function hire_us_page() {
1166
$this->render_page( 'rtmedia-hire-us' );
1167
}
1168
1169
+ public function license_page() {
1170
$this->render_page( 'rtmedia-license' );
1171
}
1172
1179
*
1180
* @return type
1181
*/
1182
+ static function get_current_tab() {
1183
+ return isset( $_GET[ 'page' ] ) ? $_GET[ 'page' ] : 'rtmedia-settings';
1184
}
1185
1186
/**
1194
*
1195
* @return void
1196
*/
1197
+ public function render_page( $page, $option_group = null ) {
1198
?>
1199
1200
<div class="wrap bp-media-admin <?php echo $this->get_current_tab(); ?>">
1203
<h2 class="nav-tab-wrapper"><?php $this->rtmedia_tabs(); ?>
1204
<span class="alignright by">
1205
<a class="rt-link" href="http://rtcamp.com/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media" target="_blank" title="rtCamp : <?php _e( 'Empowering The Web With WordPress', 'rtmedia' ); ?>">
1206
+ <img src="<?php echo RTMEDIA_URL; ?>app/assets/admin/img/rtcamp-logo.png" alt="rtCamp" />
1207
</a>
1208
</span>
1209
</h2>
1210
</div>
1211
1212
+ <div class="clearfix rtm-row-container">
1213
1214
+ <div id="bp-media-settings-boxes" class="bp-media-settings-boxes-container rtm-setting-container">
1215
+
1216
+ <?php
1217
+ $settings_url = ( is_multisite() ) ? network_admin_url( 'edit.php?action=' . $option_group ) : 'options.php';
1218
+ if ( $page == 'rtmedia-settings' ) {
1219
+ ?>
1220
<form id="bp_media_settings_form" name="bp_media_settings_form" method="post"
1221
enctype="multipart/form-data">
1222
+ <div class="bp-media-metabox-holder">
1223
+ <div class="rtm-button-container top">
1224
+ <?php if ( isset( $_GET[ 'settings-saved' ] ) && $_GET[ 'settings-saved' ] ) { ?>
1225
+ <div class="rtm-success rtm-fly-warning rtm-save-settings-msg"><?php _e( 'Settings saved successfully!', 'rtmedia' ); ?></div>
1226
+ <?php } ?>
1227
+ <input type="hidden" name="rtmedia-options-save" value="true">
1228
+ <input type="submit" class="rtmedia-settings-submit button button-primary button-big" value="<?php _e( 'Save Settings', 'rtmedia' ); ?>">
1229
+ </div>
1230
+ <?php
1231
+ settings_fields( $option_group );
1232
+ if ( 'rtmedia-settings' == $page ) {
1233
+ echo '<div id="rtm-settings-tabs">';
1234
+ $sub_tabs = $this->settings_sub_tabs();
1235
+ RTMediaFormHandler::rtForm_settings_tabs_content( $page, $sub_tabs );
1236
+ echo '</div>';
1237
+ } else {
1238
+ do_settings_sections( $page );
1239
+ }
1240
+ ?>
1241
+
1242
+ <div class="rtm-button-container bottom">
1243
+ <div class="rtm-social-links alignleft">
1244
+ <a href="http://twitter.com/rtcamp" class="twitter" target= "_blank"><span class="dashicons dashicons-twitter"></span></a>
1245
+ <a href="https://www.facebook.com/rtCamp.solutions" class="facebook" target="_blank"><span class="dashicons dashicons-facebook"></span></a>
1246
+ <a href="http://profiles.wordpress.org/rtcamp" class="wordpress" target= "_blank"><span class="dashicons dashicons-wordpress"></span></a>
1247
+ <a href="https://rtcamp.com/feed" class="rss" target="_blank"><span class="dashicons dashicons-rss"></span></a>
1248
+ </div>
1249
+
1250
+ <input type="hidden" name="rtmedia-options-save" value="true">
1251
+ <input type="submit" class="rtmedia-settings-submit button button-primary button-big" value="<?php _e( 'Save Settings', 'rtmedia' ); ?>">
1252
+ </div>
1253
</div>
1254
</form><?php
1255
+ } else {
1256
+ ?>
1257
<div class="bp-media-metabox-holder">
1258
+ <?php
1259
+ if ( 'rtmedia-addons' == $page ) {
1260
+ RTMediaAddon::render_addons( $page );
1261
+ } else if ( 'rtmedia-support' == $page ) {
1262
+ $rtmedia_support = new RTMediaSupport( false );
1263
+ $rtmedia_support->render_support( $page );
1264
+ } else if ( 'rtmedia-themes' == $page ) {
1265
+ RTMediaThemes::render_themes( $page );
1266
+ } else {
1267
+ if ( 'rtmedia-license' == $page ) {
1268
+ RTMediaLicense::render_license( $page );
1269
+ } else {
1270
+ do_settings_sections( $page );
1271
+ }
1272
+ }
1273
+ do_action( 'rtmedia_admin_page_insert', $page );
1274
+ ?>
1275
</div>
1276
+ <?php
1277
+ do_action( 'rtmedia_admin_page_append', $page );
1278
+ }
1279
+ ?>
1280
</div>
1281
+
1282
+ <div class="metabox-holder bp-media-metabox-holder rtm-sidebar">
1283
<?php $this->admin_sidebar(); ?>
1284
</div>
1285
+
1286
</div>
1287
+
1288
</div><!-- .bp-media-admin --><?php
1289
}
1290
1299
*
1300
* @return type $tabs_html
1301
*/
1302
+ public function tab() {
1303
1304
+ $tabs_html = '';
1305
+ $idle_class = 'nav-tab';
1306
$active_class = 'nav-tab nav-tab-active';
1307
+ $tabs = array();
1308
1309
// Check to see which tab we are on
1310
$tab = $this->get_current_tab();
1311
/* rtMedia */
1312
$tabs[] = array(
1313
+ 'href' => get_admin_url( null, esc_url( add_query_arg( array( 'page' => 'rtmedia-settings' ), 'admin.php' ) ) ),
1314
+ 'title' => __( 'rtMedia', 'rtmedia' ),
1315
+ 'name' => __( 'rtMedia', 'rtmedia' ),
1316
+ 'class' => ( $tab == 'rtmedia-settings' || $tab == 'rtmedia-addons' || $tab == 'rtmedia-support' || $tab == 'rtmedia-importer' ) ? $active_class : $idle_class,
1317
);
1318
1319
foreach ( $tabs as $tab ) {
1320
+ $tabs_html .= '<a id="bp-media" title= "' . $tab[ 'title' ] . '" href="' . $tab[ 'href' ] . '" class="' . $tab[ 'class' ] . '">' . $tab[ 'name' ] . '</a>';
1321
}
1322
echo $tabs_html;
1323
}
1331
*
1332
* @return void
1333
*/
1334
+ public function rtmedia_tabs( $active_tab = '' ) {
1335
// Declare local variables
1336
+ $tabs_html = '';
1337
+ $idle_class = 'nav-tab';
1338
$active_class = 'nav-tab nav-tab-active';
1339
1340
// Setup core admin tabs
1359
'href' => get_admin_url( null, esc_url( add_query_arg( array( 'page' => 'rtmedia-support' ), 'admin.php' ) ) ),
1360
'name' => __( 'Support', 'rtmedia' ),
1361
'slug' => 'rtmedia-support',
1362
+ ),
1363
+ );
1364
+
1365
+ if ( has_filter( 'rtmedia_license_tabs' ) || did_action( 'rtmedia_addon_license_details' ) ) {
1366
+ $tabs[] = array(
1367
'href' => get_admin_url( null, esc_url( add_query_arg( array( 'page' => 'rtmedia-license' ), 'admin.php' ) ) ),
1368
'name' => __( 'Licenses', 'rtmedia' ),
1369
'slug' => 'rtmedia-license',
1370
+ );
1371
+ }
1372
1373
$tabs = apply_filters( 'media_add_tabs', $tabs );
1374
1375
// Loop through tabs and build navigation
1376
foreach ( array_values( $tabs ) as $tab_data ) {
1377
+ $is_current = ( bool ) ( $tab_data[ 'slug' ] == $this->get_current_tab() );
1378
+ $tab_class = $is_current ? $active_class : $idle_class;
1379
1380
+ if ( isset( $tab_data[ 'class' ] ) && is_array( $tab_data[ 'class' ] ) ) {
1381
+ $tab_class .= ' ' . implode( ' ', $tab_data[ 'class' ] );
1382
}
1383
1384
+ $tabs_html .= '<a href="' . $tab_data[ 'href' ] . '" class="' . $tab_class . '">' . $tab_data[ 'name' ] . '</a>';
1385
}
1386
1387
// Output the tabs
1400
*
1401
* @return void
1402
*/
1403
+ public function settings_content_tabs( $page ) {
1404
global $wp_settings_sections, $wp_settings_fields;
1405
1406
+ if ( ! isset( $wp_settings_sections ) || ! isset( $wp_settings_sections[ $page ] ) ) {
1407
return;
1408
}
1409
1410
+ foreach ( ( array ) $wp_settings_sections[ $page ] as $section ) {
1411
+ if ( $section[ 'title' ] ) {
1412
+ echo "<h3>{$section[ 'title' ]}</h3>\n";
1413
}
1414
1415
+ if ( $section[ 'callback' ] ) {
1416
+ call_user_func( $section[ 'callback' ], $section );
1417
}
1418
1419
+ if ( ! isset( $wp_settings_fields ) || ! isset( $wp_settings_fields[ $page ] ) || ! isset( $wp_settings_fields[ $page ][ $section[ 'id' ] ] ) ) {
1420
continue;
1421
}
1422
1423
echo '<table class="form-table">';
1424
+ do_settings_fields( $page, $section[ 'id' ] );
1425
echo '</table>';
1426
}
1427
}
1436
*
1437
* @return array $tabs
1438
*/
1439
+ public function settings_sub_tabs() {
1440
$tabs_html = '';
1441
+ $tabs = array();
1442