rtMedia for WordPress, BuddyPress and bbPress - Version 3.10.9

Version Description

Requires BuddyPress 1.7 or higher, if using BuddyPress. WordPress VIP compatibility added

=

Download this release

Release Info

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

Code changes from version 3.10.8 to 3.10.9

Files changed (104) hide show
  1. CONTRIBUTING.md +1 -1
  2. Gruntfile.js +134 -134
  3. app/admin/RTMediaAdmin.php +823 -728
  4. app/admin/RTMediaFormHandler.php +441 -389
  5. app/admin/templates/tmpl-rtm-album-favourites-importer.php +9 -0
  6. app/admin/templates/tmpl-rtm-image.php +5 -0
  7. app/admin/templates/tmpl-rtm-map-mapping-failure.php +1 -0
  8. app/admin/templates/tmpl-rtm-msg-div.php +3 -0
  9. app/admin/templates/tmpl-rtm-p-tag.php +5 -0
  10. app/admin/templates/tmpl-rtm-theme-overlay.php +4 -0
  11. app/assets/admin/css/admin.css +5 -1
  12. app/assets/admin/css/admin.min.css +1 -1
  13. app/assets/admin/css/sass/_addons.scss +5 -1
  14. app/assets/admin/js/admin.min.js +1 -1
  15. app/assets/admin/js/scripts.js +11 -2
  16. app/assets/admin/js/settings.js +185 -88
  17. app/assets/js/rtMedia.backbone.js +514 -509
  18. app/assets/js/rtMedia.js +195 -207
  19. app/assets/js/rtmedia.min.js +1 -1
  20. app/helper/BPMediaBranding.php +6 -7
  21. app/helper/RTMediaActivityModel.php +8 -6
  22. app/helper/RTMediaAddon.php +369 -364
  23. app/helper/RTMediaAdminWidget.php +13 -14
  24. app/helper/RTMediaCommentModel.php +7 -2
  25. app/helper/RTMediaCommentNotification.php +120 -111
  26. app/helper/RTMediaFeed.php +15 -19
  27. app/helper/RTMediaInteractionModel.php +16 -16
  28. app/helper/RTMediaLicense.php +45 -43
  29. app/helper/RTMediaLikeNotification.php +137 -128
  30. app/helper/RTMediaModel.php +115 -113
  31. app/helper/RTMediaNotification.php +68 -65
  32. app/helper/RTMediaSettings.php +151 -154
  33. app/helper/RTMediaSupport.php +258 -208
  34. app/helper/RTMediaThemes.php +169 -133
  35. app/helper/RTMediaUploadException.php +9 -9
  36. app/helper/db/RTDBModel.php +50 -51
  37. app/helper/db/RTDBUpdate.php +25 -27
  38. app/helper/db/rt_plugin_info.php +19 -14
  39. app/helper/rtDimensions.php +52 -30
  40. app/helper/rtForm.php +229 -202
  41. app/helper/rtFormInvalidArgumentsException.php +6 -5
  42. app/helper/rtPluginUpdateChecker.php +1 -1
  43. app/helper/rtProgress.php +12 -9
  44. app/importers/BPMediaAlbumimporter.php +136 -108
  45. app/importers/BPMediaBPActivityPlusImporter.php +0 -1
  46. app/importers/BPMediaImporter.php +28 -34
  47. app/importers/RTMediaActivityUpgrade.php +123 -103
  48. app/importers/RTMediaMediaSizeImporter.php +123 -110
  49. app/importers/RTMediaMigration.php +307 -290
  50. app/main/RTMedia.php +479 -408
  51. app/main/contexts/RTMediaContext.php +19 -20
  52. app/main/controllers/activity/RTMediaActivity.php +30 -32
  53. app/main/controllers/activity/RTMediaBuddyPressActivity.php +327 -282
  54. app/main/controllers/api/RTMediaApiLogin.php +6 -6
  55. app/main/controllers/api/RTMediaJsonApi.php +1201 -1190
  56. app/main/controllers/api/RTMediaJsonApiFunctions.php +325 -266
  57. app/main/controllers/group/RTMediaGroup.php +6 -8
  58. app/main/controllers/group/RTMediaGroupExtension.php +125 -120
  59. app/main/controllers/media/RTMediaAlbum.php +119 -158
  60. app/main/controllers/media/RTMediaComment.php +48 -51
  61. app/main/controllers/media/RTMediaFeatured.php +71 -67
  62. app/main/controllers/media/RTMediaGalleryItemAction.php +31 -30
  63. app/main/controllers/media/RTMediaGroupFeatured.php +57 -55
  64. app/main/controllers/media/RTMediaLike.php +67 -63
  65. app/main/controllers/media/RTMediaLoginPopup.php +47 -44
  66. app/main/controllers/media/RTMediaMedia.php +679 -614
  67. app/main/controllers/media/RTMediaMeta.php +15 -16
  68. app/main/controllers/media/RTMediaTags.php +57 -39
  69. app/main/controllers/media/RTMediaUserInteraction.php +19 -21
  70. app/main/controllers/media/RTMediaViewCount.php +22 -14
  71. app/main/controllers/privacy/RTMediaFriends.php +1 -2
  72. app/main/controllers/privacy/RTMediaPrivacy.php +149 -140
  73. app/main/controllers/shortcodes/RTMediaGalleryShortcode.php +210 -183
  74. app/main/controllers/shortcodes/RTMediaUploadShortcode.php +83 -87
  75. app/main/controllers/template/RTMediaAJAX.php +40 -33
  76. app/main/controllers/template/RTMediaNav.php +383 -364
  77. app/main/controllers/template/RTMediaTemplate.php +881 -838
  78. app/main/controllers/template/RTMediaUploadTemplate.php +58 -44
  79. app/main/controllers/template/rt-template-functions.php +760 -670
  80. app/main/controllers/upload/RTMediaUpload.php +21 -9
  81. app/main/controllers/upload/RTMediaUploadEndpoint.php +105 -80
  82. app/main/controllers/upload/RTMediaUploadHelper.php +1 -1
  83. app/main/controllers/upload/RTMediaUploadModel.php +181 -170
  84. app/main/controllers/upload/RTMediaUploadView.php +99 -90
  85. app/main/controllers/upload/processors/RTMediaUploadFile.php +129 -113
  86. app/main/controllers/upload/processors/RTMediaUploadUrl.php +2 -2
  87. app/main/deprecated/RTMediaDeprecated.php +5 -5
  88. app/main/interactions/RTMediaInteraction.php +259 -258
  89. app/main/routers/RTMediaRouter.php +326 -326
  90. app/main/routers/query/RTMediaQuery.php +194 -146
  91. app/services/RTMediaEncoding.php +394 -365
  92. index.php +5 -9
  93. languages/buddypress-media-de_DE.mo +0 -0
  94. languages/buddypress-media.po +1014 -830
  95. readme.txt +9 -6
  96. templates/main.php +86 -81
  97. templates/media/album-gallery-item.php +15 -14
  98. templates/media/album-gallery.php +31 -32
  99. templates/media/album-single-edit.php +58 -40
  100. templates/media/media-gallery-item.php +19 -17
  101. templates/media/media-gallery.php +18 -16
  102. templates/media/media-single-edit.php +15 -15
  103. templates/media/media-single.php +37 -19
  104. templates/upload/uploader.php +69 -68
CONTRIBUTING.md CHANGED
@@ -12,7 +12,7 @@ For support-request/feature-request, please use - http://community.rtcamp.com/c/
12
13
Please do NOT send pull-request for translations.
14
15
- You can contribute translations using web-interface here - http://rtcamp.com/translate/projects/rtmedia
16
17
## Pull Requests
18
12
13
Please do NOT send pull-request for translations.
14
15
+ You can contribute translations using web-interface here - https://rtmedia.io/translate/projects/rtmedia
16
17
## Pull Requests
18
Gruntfile.js CHANGED
@@ -1,89 +1,89 @@
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
- // watch for changes and trigger sass, jshint, uglify and livereload
10
- watch: {
11
- sass: {
12
- files: [ 'app/assets/admin/css/sass/**/*.{scss,sass}', 'app/assets/css/sass/**/*.{scss,sass}' ],
13
- tasks: [ 'sass' ]
14
- },
15
- autoprefixer: {
16
- files: [ 'app/assets/admin/css/*.css', 'app/assets/css/*css' ],
17
- tasks: [ 'autoprefixer' ]
18
- },
19
- js: {
20
- files: [ '<%= uglify.frontend.src %>', '<%= uglify.backend.src %>' ],
21
- tasks: [ 'uglify' ]
22
- },
23
- livereload: {
24
- // Here we watch the files the sass task will compile to
25
- // These files are sent to the live reload server after sass compiles to them
26
- options: { livereload: true },
27
- files: [ '*.php', '*.css' ]
28
- }
29
- },
30
- // sass
31
- sass: {
32
- dist: {
33
- options: {
34
- style: 'expanded',
35
- sourcemap: 'none'
36
- },
37
- files: {
38
- 'app/assets/admin/css/admin.css': 'app/assets/admin/css/sass/admin.scss',
39
- 'app/assets/admin/css/widget.css': 'app/assets/admin/css/sass/widget.scss',
40
- 'app/assets/css/rtmedia.css': 'app/assets/css/sass/rtmedia.scss',
41
- }
42
- },
43
- minify: {
44
- options: {
45
- style: 'compressed',
46
- sourcemap: 'none'
47
- },
48
- files: {
49
- 'app/assets/admin/css/admin.min.css': 'app/assets/admin/css/sass/admin.scss',
50
- 'app/assets/admin/css/widget.min.css': 'app/assets/admin/css/sass/widget.scss',
51
- 'app/assets/css/rtmedia.min.css': 'app/assets/css/sass/rtmedia.scss'
52
- }
53
- }
54
- },
55
- // autoprefixer
56
- autoprefixer: {
57
- dist: {
58
- options: {
59
- browsers: [ 'last 2 versions', 'ie 9', 'ios 6', 'android 4' ],
60
- expand: true,
61
- flatten: true
62
- },
63
- files: {
64
- 'app/assets/admin/css/admin.css': 'app/assets/admin/css/admin.css',
65
- 'app/assets/admin/css/admin.min.css': 'app/assets/admin/css/admin.min.css',
66
- 'app/assets/admin/css/widget.css': 'app/assets/admin/css/widget.css',
67
- 'app/assets/admin/css/widget.min.css': 'app/assets/admin/css/widget.min.css',
68
- 'app/assets/css/rtmedia.css': 'app/assets/css/rtmedia.css',
69
- 'app/assets/css/rtmedia.min.css': 'app/assets/css/rtmedia.min.css'
70
- }
71
- }
72
- },
73
- // Uglify Ref. https://npmjs.org/package/grunt-contrib-uglify
74
- uglify: {
75
- options: {
76
- banner: '/*! \n * rtMedia JavaScript Library \n * @package rtMedia \n */\n',
77
- },
78
- frontend: {
79
- src: [
80
'app/assets/js/vendors/magnific-popup.js',
81
'app/assets/admin/js/vendors/tabs.js',
82
'app/assets/js/rtMedia.js'
83
- ],
84
dest: 'app/assets/js/rtmedia.min.js'
85
- },
86
- backend: {
87
src: [
88
'app/assets/admin/js/vendors/tabs.js',
89
'app/assets/admin/js/scripts.js',
@@ -91,61 +91,61 @@ module.exports = function ( grunt ) {
91
],
92
dest: 'app/assets/admin/js/admin.min.js'
93
}
94
- },
95
- checktextdomain: {
96
- options: {
97
- text_domain: 'buddypress-media', //Specify allowed domain(s)
98
- keywords: [ //List keyword specifications
99
- '__:1,2d',
100
- '_e:1,2d',
101
- '_x:1,2c,3d',
102
- 'esc_html__:1,2d',
103
- 'esc_html_e:1,2d',
104
- 'esc_html_x:1,2c,3d',
105
- 'esc_attr__:1,2d',
106
- 'esc_attr_e:1,2d',
107
- 'esc_attr_x:1,2c,3d',
108
- '_ex:1,2c,3d',
109
- '_n:1,2,4d',
110
- '_nx:1,2,4c,5d',
111
- '_n_noop:1,2,3d',
112
- '_nx_noop:1,2,3c,4d'
113
- ]
114
- },
115
- target: {
116
- files: [ {
117
- src: [
118
- '*.php',
119
- '**/*.php',
120
- '!node_modules/**',
121
- '!tests/**'
122
- ], //all php
123
- expand: true
124
- } ]
125
- }
126
- },
127
- makepot: {
128
- target: {
129
- options: {
130
- cwd: '.', // Directory of files to internationalize.
131
- domainPath: 'languages/', // Where to save the POT file.
132
- exclude: [ 'node_modules/*' ], // List of files or directories to ignore.
133
- mainFile: 'index.php', // Main project file.
134
- potFilename: 'buddypress-media.po', // Name of the POT file.
135
- potHeaders: { // Headers to add to the generated POT file.
136
- poedit: true, // Includes common Poedit headers.
137
- 'Last-Translator': 'rtMedia <rtmedia@rtcamp.com>',
138
- 'Language-Team': 'rtMedia <rtmedia@rtcamp.com>',
139
- 'report-msgid-bugs-to': 'http://community.rtcamp.com/c/rtmedia/',
140
- 'x-poedit-keywordslist': true // Include a list of all possible gettext functions.
141
- },
142
- type: 'wp-plugin', // Type of project (wp-plugin or wp-theme).
143
- updateTimestamp: true // Whether the POT-Creation-Date should be updated without other changes.
144
- }
145
- }
146
- }
147
148
- } );
149
- // register task
150
- grunt.registerTask( 'default', [ 'sass', 'autoprefixer', 'uglify', 'checktextdomain', 'makepot', 'watch' ] );
151
};
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
+ // watch for changes and trigger sass, jshint, uglify and livereload
10
+ watch: {
11
+ sass: {
12
+ files: [ 'app/assets/admin/css/sass/**/*.{scss,sass}', 'app/assets/css/sass/**/*.{scss,sass}' ],
13
+ tasks: [ 'sass' ]
14
+ },
15
+ autoprefixer: {
16
+ files: [ 'app/assets/admin/css/*.css', 'app/assets/css/*css' ],
17
+ tasks: [ 'autoprefixer' ]
18
+ },
19
+ js: {
20
+ files: [ '<%= uglify.frontend.src %>', '<%= uglify.backend.src %>' ],
21
+ tasks: [ 'uglify' ]
22
+ },
23
+ livereload: {
24
+ // Here we watch the files the sass task will compile to
25
+ // These files are sent to the live reload server after sass compiles to them
26
+ options: { livereload: true },
27
+ files: [ '*.php', '*.css' ]
28
+ }
29
+ },
30
+ // sass
31
+ sass: {
32
+ dist: {
33
+ options: {
34
+ style: 'expanded',
35
+ sourcemap: 'none'
36
+ },
37
+ files: {
38
+ 'app/assets/admin/css/admin.css': 'app/assets/admin/css/sass/admin.scss',
39
+ 'app/assets/admin/css/widget.css': 'app/assets/admin/css/sass/widget.scss',
40
+ 'app/assets/css/rtmedia.css': 'app/assets/css/sass/rtmedia.scss',
41
+ }
42
+ },
43
+ minify: {
44
+ options: {
45
+ style: 'compressed',
46
+ sourcemap: 'none'
47
+ },
48
+ files: {
49
+ 'app/assets/admin/css/admin.min.css': 'app/assets/admin/css/sass/admin.scss',
50
+ 'app/assets/admin/css/widget.min.css': 'app/assets/admin/css/sass/widget.scss',
51
+ 'app/assets/css/rtmedia.min.css': 'app/assets/css/sass/rtmedia.scss'
52
+ }
53
+ }
54
+ },
55
+ // autoprefixer
56
+ autoprefixer: {
57
+ dist: {
58
+ options: {
59
+ browsers: [ 'last 2 versions', 'ie 9', 'ios 6', 'android 4' ],
60
+ expand: true,
61
+ flatten: true
62
+ },
63
+ files: {
64
+ 'app/assets/admin/css/admin.css': 'app/assets/admin/css/admin.css',
65
+ 'app/assets/admin/css/admin.min.css': 'app/assets/admin/css/admin.min.css',
66
+ 'app/assets/admin/css/widget.css': 'app/assets/admin/css/widget.css',
67
+ 'app/assets/admin/css/widget.min.css': 'app/assets/admin/css/widget.min.css',
68
+ 'app/assets/css/rtmedia.css': 'app/assets/css/rtmedia.css',
69
+ 'app/assets/css/rtmedia.min.css': 'app/assets/css/rtmedia.min.css'
70
+ }
71
+ }
72
+ },
73
+ // Uglify Ref. https://npmjs.org/package/grunt-contrib-uglify
74
+ uglify: {
75
+ options: {
76
+ banner: '/*! \n * rtMedia JavaScript Library \n * @package rtMedia \n */\n',
77
+ },
78
+ frontend: {
79
+ src: [
80
'app/assets/js/vendors/magnific-popup.js',
81
'app/assets/admin/js/vendors/tabs.js',
82
'app/assets/js/rtMedia.js'
83
+ ],
84
dest: 'app/assets/js/rtmedia.min.js'
85
+ },
86
+ backend: {
87
src: [
88
'app/assets/admin/js/vendors/tabs.js',
89
'app/assets/admin/js/scripts.js',
91
],
92
dest: 'app/assets/admin/js/admin.min.js'
93
}
94
+ },
95
+ checktextdomain: {
96
+ options: {
97
+ text_domain: 'buddypress-media', //Specify allowed domain(s)
98
+ keywords: [ //List keyword specifications
99
+ '__:1,2d',
100
+ '_e:1,2d',
101
+ '_x:1,2c,3d',
102
+ 'esc_html__:1,2d',
103
+ 'esc_html_e:1,2d',
104
+ 'esc_html_x:1,2c,3d',
105
+ 'esc_attr__:1,2d',
106
+ 'esc_attr_e:1,2d',
107
+ 'esc_attr_x:1,2c,3d',
108
+ '_ex:1,2c,3d',
109
+ '_n:1,2,4d',
110
+ '_nx:1,2,4c,5d',
111
+ '_n_noop:1,2,3d',
112
+ '_nx_noop:1,2,3c,4d'
113
+ ]
114
+ },
115
+ target: {
116
+ files: [ {
117
+ src: [
118
+ '*.php',
119
+ '**/*.php',
120
+ '!node_modules/**',
121
+ '!tests/**'
122
+ ], //all php
123
+ expand: true
124
+ } ]
125
+ }
126
+ },
127
+ makepot: {
128
+ target: {
129
+ options: {
130
+ cwd: '.', // Directory of files to internationalize.
131
+ domainPath: 'languages/', // Where to save the POT file.
132
+ exclude: [ 'node_modules/*' ], // List of files or directories to ignore.
133
+ mainFile: 'index.php', // Main project file.
134
+ potFilename: 'buddypress-media.po', // Name of the POT file.
135
+ potHeaders: { // Headers to add to the generated POT file.
136
+ poedit: true, // Includes common Poedit headers.
137
+ 'Last-Translator': 'rtMedia <rtmedia@rtcamp.com>',
138
+ 'Language-Team': 'rtMedia <rtmedia@rtcamp.com>',
139
+ 'report-msgid-bugs-to': 'http://community.rtcamp.com/c/rtmedia/',
140
+ 'x-poedit-keywordslist': true // Include a list of all possible gettext functions.
141
+ },
142
+ type: 'wp-plugin', // Type of project (wp-plugin or wp-theme).
143
+ updateTimestamp: true // Whether the POT-Creation-Date should be updated without other changes.
144
+ }
145
+ }
146
+ }
147
148
+ } );
149
+ // register task
150
+ grunt.registerTask( 'default', [ 'sass', 'autoprefixer', 'uglify', 'checktextdomain', 'makepot', 'watch' ] );
151
};
app/admin/RTMediaAdmin.php CHANGED
@@ -1,4 +1,5 @@
1
<?php
2
/**
3
* Description of RTMediaAdmin
4
*
@@ -23,37 +24,43 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
23
* Constructor - get the plugin hooked in and ready
24
*
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 );
37
$this->rtmedia_support = new RTMediaSupport();
38
add_action( 'wp_ajax_rtmedia_select_request', array( $this->rtmedia_support, 'get_form' ), 1 );
39
- add_action( 'wp_ajax_rtmedia_cancel_request', create_function( '', 'do_settings_sections("rtmedia-support"); die();' ), 1 );
40
add_action( 'wp_ajax_rtmedia_submit_request', array( $this->rtmedia_support, 'submit_request' ), 1 );
41
- //add_action ( 'wp_ajax_rtmedia_fetch_feed', array( $rtmedia_feed, 'fetch_feed' ), 1 );
42
- add_action( 'wp_ajax_rtmedia_linkback', array( $this, 'linkback' ), 1 );
43
add_action( 'wp_ajax_rtmedia_rt_album_deactivate', 'BPMediaAlbumimporter::bp_album_deactivate', 1 );
44
add_action( 'wp_ajax_rtmedia_rt_album_import', 'BPMediaAlbumimporter::bpmedia_ajax_import_callback', 1 );
45
add_action( 'wp_ajax_rtmedia_rt_album_import_favorites', 'BPMediaAlbumimporter::bpmedia_ajax_import_favorites', 1 );
46
add_action( 'wp_ajax_rtmedia_rt_album_import_step_favorites', 'BPMediaAlbumimporter::bpmedia_ajax_import_step_favorites', 1 );
47
add_action( 'wp_ajax_rtmedia_rt_album_cleanup', 'BPMediaAlbumimporter::cleanup_after_install' );
48
- add_action( 'wp_ajax_rtmedia_convert_videos_form', array( $this, 'convert_videos_mailchimp_send' ), 1 );
49
add_action( 'wp_ajax_rtmedia_correct_upload_filetypes', array( $this, 'correct_upload_filetypes' ), 1 );
50
- add_filter( 'plugin_row_meta', array( $this, 'plugin_meta_premium_addon_link' ), 1, 4 );
51
- add_action( 'wp_dashboard_setup', array( &$this, 'add_dashboard_widgets' ), 0 );
52
add_filter( 'attachment_fields_to_edit', array( $this, 'edit_video_thumbnail' ), null, 2 );
53
- add_filter( 'attachment_fields_to_save', array( $this, 'save_video_thumbnail' ), null, 2 );
54
- add_action( 'wp_ajax_rtmedia_hide_video_thumb_admin_notice', array( $this, 'rtmedia_hide_video_thumb_admin_notice' ), 1 );
55
- add_action( 'wp_ajax_rtmedia_hide_addon_update_notice', array( $this, 'rtmedia_hide_addon_update_notice' ), 1 );
56
- add_filter( 'media_row_actions', array( $this, 'modify_medialibrary_permalink' ), 10, 3 );
57
58
$obj_encoding = new RTMediaEncoding( true );
59
@@ -71,19 +78,19 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
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
@@ -94,44 +101,64 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
94
95
$this->rtmedia_settings = new RTMediaSettings();
96
$this->rtmedia_encoding = new RTMediaEncoding();
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
104
- add_action( 'wp_ajax_rtmedia_hide_template_override_notice', array( $this, 'rtmedia_hide_template_override_notice' ), 1 );
105
add_action( 'admin_init', array( $this, 'rtmedia_bp_add_update_type' ) );
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
- add_action( 'wp_ajax_rtmedia_hide_pro_split_notice', array( $this, 'rtmedia_hide_pro_split_notice' ), 1 );
109
- $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
110
if ( class_exists( 'BuddyPress' ) ) {
111
- $rtmedia_activity_upgrade = new RTMediaActivityUpgrade();
112
}
113
add_action( 'admin_notices', array( $this, 'rtmedia_admin_notices' ) );
114
add_action( 'network_admin_notices', array( $this, 'rtmedia_network_admin_notices' ) );
115
add_action( 'admin_init', array( $this, 'rtmedia_addon_license_save_hook' ) );
116
add_action( 'admin_init', array( $this, 'rtmedia_migration' ) );
117
118
- add_filter( 'removable_query_args', array( $this, 'removable_query_args'), 10, 1 );
119
- }
120
-
121
- function modify_medialibrary_permalink( $action, $post, $detached ) {
122
- $rtm_id = rtmedia_id( $post->ID );
123
-
124
- if ( $rtm_id ) {
125
- $link = get_rtmedia_permalink( $rtm_id );
126
- $title =_draft_or_post_title( $post->post_parent );
127
- $action[ 'view' ] = '<a href="' . $link . '" title="' . esc_attr( sprintf( __( 'View &#8220;%s&#8221;', 'buddypress-media' ), $title ) ) . '" rel="permalink">' . __( 'View', 'buddypress-media' ) . '</a>';
128
- }
129
-
130
- return $action;
131
- }
132
133
function rtmedia_migration() {
134
- $rtMigration = new RTMediaMigration();
135
}
136
137
function rtmedia_addon_license_save_hook() {
@@ -168,53 +195,61 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
168
$this->rtmedia_regenerate_thumbnail_notice();
169
$this->rtmedia_addon_update_notice();
170
$this->rtmedia_update_template_notice();
171
- $this->rtmedia_inspirebook_release_notice();
172
- $this->rtmedia_social_sync_release_notice();
173
-
174
- if( !defined( 'RTMEDIA_PRO_PATH' ) ) {
175
- $this->rtmedia_pro_split_release_notice();
176
- }
177
- }
178
- }
179
-
180
- /*
181
- * rtMedia Pro split release admin notice
182
- */
183
- public function rtmedia_pro_split_release_notice() {
184
- $site_option = rtmedia_get_site_option( 'rtmedia_pro_split_release_notice' );
185
-
186
- if( ( !$site_option || 'hide' != $site_option ) ) {
187
rtmedia_update_site_option( 'rtmedia_pro_split_release_notice', 'show' );
188
?>
189
<div class="updated rtmedia-pro-split-notice">
190
<p>
191
<span>
192
- <b>rtMedia: </b>We have released 30+ premium add-ons for rtMedia plugin. Read more about it <a href="https://rtmedia.io/blog/rtmedia-pro-splitting-major-change/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media" target="_blank">here</a>.
193
</span>
194
- <a href="#" onclick="rtmedia_hide_pro_split_notice();" style="float:right">Dismiss</a>
195
</p>
196
</div>
197
<script type="text/javascript">
198
- function rtmedia_hide_pro_split_notice() {
199
- var data = { action: 'rtmedia_hide_pro_split_notice' };
200
- jQuery.post( ajaxurl, data, function ( response ) {
201
response = response.trim();
202
-
203
- if( response === "1" )
204
- jQuery( '.rtmedia-pro-split-notice' ).remove();
205
- } );
206
}
207
</script>
208
<?php
209
}
210
- }
211
-
212
- /*
213
* Hide pro split release notice
214
*/
215
216
function rtmedia_hide_pro_split_notice() {
217
- if ( rtmedia_update_site_option( 'rtmedia_pro_split_release_notice', 'hide' ) ) {
218
echo '1';
219
} else {
220
echo '0';
@@ -227,31 +262,36 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
227
*/
228
229
function rtmedia_social_sync_release_notice() {
230
- $site_option = rtmedia_get_site_option( 'rtmedia_social_sync_release_notice' );
231
$check_rtmedia_social_sync_installed = file_exists( trailingslashit( WP_PLUGIN_DIR ) . 'rtmedia-social-sync/index.php' );
232
233
- if ( ( ! $site_option || 'hide' != $site_option ) && ! $check_rtmedia_social_sync_installed ) {
234
rtmedia_update_site_option( 'rtmedia_social_sync_release_notice', 'show' );
235
?>
236
<div class="updated rtmedia-social-sync-notice">
237
<p>
238
<span>
239
- <b>rtMedia: </b> Meet
240
- <a href="https://rtmedia.io/products/rtmedia-social-sync/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media" target="_blank">
241
- <b>rtMedia Social Sync</b>
242
- </a> which allows you to import media from your Facebook account.
243
</span>
244
- <a href="#" onclick="rtmedia_hide_social_sync_notice()" style="float:right">Dismiss</a>
245
</p>
246
</div>
247
<script type="text/javascript">
248
- function rtmedia_hide_social_sync_notice() {
249
- var data = { action: 'rtmedia_hide_social_sync_notice' };
250
- jQuery.post( ajaxurl, data, function ( response ) {
251
response = response.trim();
252
- if ( response === "1" )
253
- jQuery( '.rtmedia-social-sync-notice' ).remove();
254
- } );
255
}
256
</script>
257
<?php
@@ -263,7 +303,7 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
263
*/
264
265
function rtmedia_hide_social_sync_notice() {
266
- if ( rtmedia_update_site_option( 'rtmedia_social_sync_release_notice', 'hide' ) ) {
267
echo '1';
268
} else {
269
echo '0';
@@ -282,24 +322,33 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
282
*/
283
public function rtmedia_inspirebook_release_notice() {
284
$site_option = rtmedia_get_site_option( 'rtmedia_inspirebook_release_notice' );
285
- if ( ( ! $site_option || 'hide' != $site_option ) && ( 'inspirebook' != get_stylesheet() ) ) {
286
rtmedia_update_site_option( 'rtmedia_inspirebook_release_notice', 'show' );
287
?>
288
<div class="updated rtmedia-inspire-book-notice">
289
<p>
290
- <span><a href="https://rtmedia.io/products/inspirebook/" target="_blank"><b>Meet
291
- InspireBook</b></a> - First official rtMedia premium theme.</span>
292
<a href="#" onclick="rtmedia_hide_inspirebook_notice()" style="float:right">Dismiss</a>
293
</p>
294
</div>
295
<script type="text/javascript">
296
function rtmedia_hide_inspirebook_notice() {
297
- var data = { action: 'rtmedia_hide_inspirebook_release_notice' };
298
- jQuery.post( ajaxurl, data, function ( response ) {
299
response = response.trim();
300
- if ( response === "1" )
301
- jQuery( '.rtmedia-inspire-book-notice' ).remove();
302
- } );
303
}
304
</script>
305
<?php
@@ -316,7 +365,8 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
316
* @return void
317
*/
318
public function rtmedia_hide_inspirebook_release_notice() {
319
- if ( rtmedia_update_site_option( 'rtmedia_inspirebook_release_notice', 'hide' ) ) {
320
echo '1';
321
} else {
322
echo '0';
@@ -366,7 +416,7 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
366
*/
367
public function rtmedia_permalink_notice() {
368
echo '<div class="error rtmedia-permalink-change-notice">
369
- <p> <b>rtMedia:</b> ' . __( ' You must', 'buddypress-media' ) . ' <a href="' . admin_url( 'options-permalink.php' ) . '">' . __( 'update permalink structure', 'buddypress-media' ) . '</a> ' . __( 'to something other than the default for it to work.', 'buddypress-media' ) . ' </p>
370
</div>';
371
}
372
@@ -382,32 +432,38 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
382
public function rtmedia_addon_update_notice() {
383
384
$site_option = rtmedia_get_site_option( 'rtmedia-addon-update-notice-3_8' );
385
- if( is_rt_admin()
386
- && ( ! $site_option || 'hide' != $site_option ) ){
387
388
if ( ! $this->check_for_addon_update_notice() ) {
389
return;
390
}
391
rtmedia_update_site_option( 'rtmedia-addon-update-notice-3_8', 'show' );
392
- ?>
393
<div class="error rtmedia-addon-upate-notice">
394
<p>
395
- <strong><?php _e( 'rtMedia:', 'buddypress-media' ) ?></strong> <?php _e( 'Please update all premium add-ons that you have purchased from rtMedia from', 'buddypress-media' ) ?> <a href="https://rtmedia.io/my-account/" target="_blank"><?php _e( 'your account', 'buddypress-media' ) ?></a>. <a href="#" onclick="rtmedia_hide_addon_update_notice()" style="float:right"><?php _e( 'Dismiss', 'buddypress-media' ) ?></a>
396
</p>
397
</div>
398
<script type="text/javascript">
399
function rtmedia_hide_addon_update_notice() {
400
var data = {
401
- action: 'rtmedia_hide_addon_update_notice'
402
- };
403
- jQuery.post( ajaxurl, data, function ( response ) {
404
response = response.trim();
405
- if ( response === "1" )
406
- jQuery( '.rtmedia-addon-upate-notice' ).remove();
407
- } );
408
}
409
</script>
410
- <?php
411
}
412
}
413
@@ -426,49 +482,49 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
426
// check for rtMedia Instagram version
427
if ( defined( 'RTMEDIA_INSTAGRAM_PATH' ) ) {
428
$plugin_info = get_plugin_data( RTMEDIA_INSTAGRAM_PATH . 'index.php' );
429
- if ( isset( $plugin_info[ 'Version' ] ) && ( -1 === version_compare( $plugin_info[ 'Version' ], '2.1.14' ) ) ) {
430
$return_falg = true;
431
}
432
- } elseif( defined( 'RTMEDIA_PHOTO_TAGGING_PATH' ) ){
433
// check for rtMedia Photo Tagging version
434
$plugin_info = get_plugin_data( RTMEDIA_PHOTO_TAGGING_PATH . 'index.php' );
435
- if ( isset( $plugin_info[ 'Version' ] ) && ( -1 === version_compare( $plugin_info[ 'Version' ], '2.2.14' ) ) ) {
436
$return_falg = true;
437
}
438
- } elseif( defined( 'RTMEDIA_FFMPEG_PATH' ) ){
439
// check for rtMedia FFPMEG version
440
$plugin_info = get_plugin_data( RTMEDIA_FFMPEG_PATH . 'index.php' );
441
- if ( isset( $plugin_info[ 'Version' ] ) && ( -1 === version_compare( $plugin_info[ 'Version' ], '2.1.14' ) ) ) {
442
$return_falg = true;
443
}
444
- } elseif( defined( 'RTMEDIA_KALTURA_PATH' ) ){
445
// check for rtMedia Kaltura version
446
$plugin_info = get_plugin_data( RTMEDIA_KALTURA_PATH . 'index.php' );
447
- if ( isset( $plugin_info[ 'Version' ] ) && ( -1 === version_compare( $plugin_info[ 'Version' ], '3.0.16' ) ) ) {
448
$return_falg = true;
449
}
450
- } elseif( defined( 'RTMEDIA_PRO_PATH' ) ){
451
// check for rtMedia Pro version
452
$plugin_info = get_plugin_data( RTMEDIA_PRO_PATH . 'index.php' );
453
- if ( isset( $plugin_info[ 'Version' ] ) && ( -1 === version_compare( $plugin_info[ 'Version' ], '2.6' ) ) ) {
454
$return_falg = true;
455
}
456
- } elseif( defined( 'RTMEDIA_SOCIAL_SYNC_PATH' ) ){
457
// check for rtMedia Social Sync version
458
$plugin_info = get_plugin_data( RTMEDIA_SOCIAL_SYNC_PATH . 'index.php' );
459
- if ( isset( $plugin_info[ 'Version' ] ) && ( -1 === version_compare( $plugin_info[ 'Version' ], '1.3.1' ) ) ) {
460
$return_falg = true;
461
}
462
- } elseif( defined( 'RTMEDIA_MEMBERSHIP_PATH' ) ){
463
// check for rtMedia Membership version
464
$plugin_info = get_plugin_data( RTMEDIA_MEMBERSHIP_PATH . 'index.php' );
465
- if ( isset( $plugin_info[ 'Version' ] ) && ( -1 === version_compare( $plugin_info[ 'Version' ], '2.1.5' ) ) ) {
466
$return_falg = true;
467
}
468
- } elseif( defined( 'RTMEDIA_WATERMARK_PATH' ) ){
469
// check for rtMedia Photo Watermak version
470
$plugin_info = get_plugin_data( RTMEDIA_WATERMARK_PATH . 'index.php' );
471
- if ( isset( $plugin_info[ 'Version' ] ) && ( -1 === version_compare( $plugin_info[ 'Version' ], '1.1.8' ) ) ) {
472
$return_falg = true;
473
}
474
}
@@ -505,7 +561,7 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
505
?>
506
<div class='rtmedia-admin-ad'>
507
<a href='https://rtmedia.io/products/rtmedia-pro/' target='_blank' title='rtMedia Pro'>
508
- <img src='<?php echo $src; ?>' alt="<?php _e( 'rtMedia Pro is released', 'buddypress-media' ); ?>"/>
509
</a>
510
</div>
511
<?php
@@ -526,69 +582,83 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
526
<div class="clearfix">
527
528
<div class="rtm-column alignleft">
529
- <h4 class="sub"><?php _e( 'Media Stats', 'buddypress-media' ); ?></h4>
530
531
<table>
532
<tbody>
533
- <?php
534
- $rtMedia_model = new RTMediaModel();
535
- $sql = "select media_type, count(id) as count from {$rtMedia_model->table_name} where blog_id='" . get_current_blog_id() . "' group by media_type";
536
- global $wpdb;
537
- $results = $wpdb->get_results( $sql );
538
- if ( $results ) {
539
- foreach ( $results as $media ) {
540
- if ( defined( strtoupper( 'RTMEDIA_' . $media->media_type . '_PLURAL_LABEL' ) ) ) {
541
- ?>
542
- <tr>
543
- <td class="b"> <?php echo $media->count; ?> </td>
544
- <td class="t"><?php echo constant( strtoupper( 'RTMEDIA_' . $media->media_type . '_PLURAL_LABEL' ) ); ?></td>
545
- </tr>
546
- <?php
547
- }
548
}
549
}
550
- ?>
551
</tbody>
552
</table>
553
</div>
554
555
<div class="rtm-column alignright">
556
- <h4 class="sub"><?php _e( 'Usage Stats', 'buddypress-media' ); ?></h4>
557
558
<table>
559
<tbody> <?php
560
- $sql = "select count(*) from {$wpdb->users}";
561
- $results = $wpdb->get_var( $sql );
562
- ?>
563
- <tr>
564
- <td class="b"> <?php echo $results; ?> </td>
565
- <td class="t"><?php _e( 'Total ', 'buddypress-media' ) ?></td>
566
- </tr>
567
- <?php
568
- $sql = "select count(distinct media_author) from {$rtMedia_model->table_name}";
569
- $results = $wpdb->get_var( $sql );
570
- ?>
571
- <tr>
572
- <td class="b"> <?php echo $results; ?> </td>
573
- <td class="t"><?php _e( 'With Media', 'buddypress-media' ) ?></td>
574
- </tr>
575
- <?php
576
- $sql = "select count(*) from $wpdb->comments where comment_post_ID in (select media_id from {$rtMedia_model->table_name})";
577
- $results = $wpdb->get_var( $sql );
578
- ?>
579
- <tr>
580
- <td class="b"> <?php echo $results; ?> </td>
581
- <td class="t"><?php _e( 'Comments ', 'buddypress-media' ) ?></td>
582
- </tr>
583
- <?php
584
- $sql = "select sum(likes) from {$rtMedia_model->table_name}";
585
- $results = $wpdb->get_var( $sql );
586
- ?>
587
- <tr>
588
- <td class="b"> <?php echo $results; ?> </td>
589
- <td class="t"><?php _e( 'Likes', 'buddypress-media' ) ?></td>
590
- </tr>
591
-
592
</tbody>
593
</table>
594
</div>
@@ -597,10 +667,14 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
597
598
<div class="rtm-meta-container">
599
<ul class="rtm-meta-links">
600
- <li><b><?php _e( 'rtMedia Links:', 'buddypress-media' ); ?></b></li>
601
- <li><a href="https://rtmedia.io/"><?php _e( 'Homepage', 'buddypress-media' ); ?></a></li>
602
- <li><a href="admin.php?page=rtmedia-support#rtmedia-general"><?php _e( 'Free Support', 'buddypress-media' ); ?></a></li>
603
- <li><a href="https://rtmedia.io/products/category/rtmedia/"><?php _e( 'Premium Addons', 'buddypress-media' ); ?></a></li>
604
</ul>
605
</div>
606
<?php
@@ -616,18 +690,21 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
616
* @return void
617
*/
618
public function add_dashboard_widgets() {
619
- wp_add_dashboard_widget( 'rtmedia_dashboard_widget', __( 'Right Now in rtMedia', 'buddypress-media' ), array( &$this, 'rtmedia_dashboard_widget_function' ) );
620
global $wp_meta_boxes;
621
622
// Get the regular dashboard widgets array
623
// (which has our new widget already but at the end)
624
625
- $normal_dashboard = $wp_meta_boxes[ 'dashboard' ][ 'normal' ][ 'core' ];
626
627
// Backup and delete our new dashboard widget from the end of the array
628
629
- $example_widget_backup = array( 'rtmedia_dashboard_widget' => $normal_dashboard[ 'rtmedia_dashboard_widget' ] );
630
- unset( $normal_dashboard[ 'rtmedia_dashboard_widget' ] );
631
632
// Merge the two arrays together so our widget is at the beginning
633
@@ -635,7 +712,7 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
635
636
// Save the sorted array back into the original metaboxes
637
638
- $wp_meta_boxes[ 'dashboard' ][ 'normal' ][ 'core' ] = $sorted_dashboard;
639
}
640
641
/**
@@ -648,9 +725,9 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
648
* @return array $links
649
*/
650
public function plugin_add_settings_link( $links ) {
651
- $settings_link = '<a href="' . admin_url( 'admin.php?page=rtmedia-settings' ) . '">Settings</a>';
652
array_push( $links, $settings_link );
653
- $settings_link = '<a href="' . admin_url( 'admin.php?page=rtmedia-support' ) . '">Support</a>';
654
array_push( $links, $settings_link );
655
656
return $links;
@@ -661,7 +738,7 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
661
*
662
* @access public
663
*
664
- * @param array $actions
665
* @param object $post
666
*
667
* @return array $actions
@@ -669,8 +746,8 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
669
public function add_reencode_link( $actions, $post ) {
670
671
$mime_type_array = explode( '/', $post->post_mime_type );
672
- if ( is_array( $mime_type_array ) && '' != $mime_type_array && 'video' == $mime_type_array[ 0 ] ) {
673
- $actions[ 'reencode' ] = '<a class="submitdelete" onclick="return rtmedia_regenerate_thumbs(' . $post->ID . ')" href="#">' . __( 'Regenerate Thumbnail', 'buddypress-media' ) . '</a>';
674
}
675
676
return $actions;
@@ -686,8 +763,10 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
686
* @return void
687
*/
688
public function bulk_action_handler() {
689
- if ( 'bulk_video_regenerate_thumbnails' == $_REQUEST[ 'action' ] && '' != $_REQUEST[ 'media' ] ) {
690
- wp_safe_redirect( esc_url_raw( add_query_arg( array( 'media_ids' => urlencode( implode( ',', $_REQUEST[ 'media' ] ) ) ), admin_url( 'admin.php?page=rtmedia-regenerate' ) ) ) );
691
exit;
692
}
693
}
@@ -697,7 +776,7 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
697
*
698
* @access public
699
*
700
- * @param type $admin_bar
701
*
702
* @return void
703
*/
@@ -707,80 +786,86 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
707
}
708
709
$admin_bar->add_menu( array(
710
- 'id' => 'rtMedia',
711
- 'title' => 'rtMedia',
712
- 'href' => admin_url( 'admin.php?page=rtmedia-settings' ),
713
- 'meta' => array(
714
- 'title' => __( 'rtMedia', 'buddypress-media' ),
715
- ),
716
- )
717
);
718
$admin_bar->add_menu( array(
719
- 'id' => 'rt-media-dashborad',
720
- 'parent' => 'rtMedia',
721
- 'title' => __( 'Settings', 'buddypress-media' ),
722
- 'href' => admin_url( 'admin.php?page=rtmedia-settings' ),
723
- 'meta' => array(
724
- 'title' => __( 'Settings', 'buddypress-media' ),
725
- 'target' => '_self',
726
- ),
727
- )
728
);
729
- $admin_bar->add_menu( array(
730
- 'id' => 'rt-media-addons',
731
- 'parent' => 'rtMedia',
732
- 'title' => __( 'Addons', 'buddypress-media' ),
733
- 'href' => admin_url( 'admin.php?page=rtmedia-addons' ),
734
- 'meta' => array(
735
- 'title' => __( 'Addons', 'buddypress-media' ),
736
- 'target' => '_self',
737
- ),
738
)
739
- );
740
$admin_bar->add_menu( array(
741
- 'id' => 'rt-media-support',
742
- 'parent' => 'rtMedia',
743
- 'title' => __( 'Support', 'buddypress-media' ),
744
- 'href' => admin_url( 'admin.php?page=rtmedia-support' ),
745
- 'meta' => array(
746
- 'title' => __( 'Support', 'buddypress-media' ),
747
- 'target' => '_self',
748
- ),
749
- )
750
);
751
- $admin_bar->add_menu( array(
752
- 'id' => 'rt-media-themes',
753
- 'parent' => 'rtMedia',
754
- 'title' => __( 'Themes', 'buddypress-media' ),
755
- 'href' => admin_url( 'admin.php?page=rtmedia-themes' ),
756
- 'meta' => array(
757
- 'title' => __( 'Themes', 'buddypress-media' ),
758
- 'target' => '_self',
759
- ),
760
)
761
- );
762
- $admin_bar->add_menu( array(
763
- 'id' => 'rt-media-hire-us',
764
- 'parent' => 'rtMedia',
765
- 'title' => __( 'Hire Us', 'buddypress-media' ),
766
- 'href' => admin_url( 'admin.php?page=rtmedia-hire-us' ),
767
- 'meta' => array(
768
- 'title' => __( 'Hire Us', 'buddypress-media' ),
769
- 'target' => '_self',
770
- ),
771
)
772
- );
773
if ( has_filter( 'rtmedia_license_tabs' ) || has_action( 'rtmedia_addon_license_details' ) ) {
774
$admin_bar->add_menu( array(
775
- 'id' => 'rt-media-license',
776
- 'parent' => 'rtMedia',
777
- 'title' => __( 'Licenses', 'buddypress-media' ),
778
- 'href' => admin_url( 'admin.php?page=rtmedia-license' ),
779
- 'meta' => array(
780
- 'title' => __( 'Licenses', 'buddypress-media' ),
781
- 'target' => '_self',
782
- ),
783
- )
784
);
785
}
786
}
@@ -813,33 +898,33 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
813
}
814
815
$admin_pages = apply_filters( 'rtmedia_filter_admin_pages_array', $admin_pages );
816
- $suffix = ( function_exists( 'rtm_get_script_style_suffix' ) ) ? rtm_get_script_style_suffix() : '.min';
817
818
- if ( in_array( $hook, $admin_pages ) || strpos( $hook, 'rtmedia-migration' ) ) {
819
820
$admin_ajax = admin_url( 'admin-ajax.php' );
821
822
/* Only one JS file should enqueue */
823
- if( $suffix === '' ) {
824
wp_enqueue_script( 'rtmedia-admin-tabs', RTMEDIA_URL . 'app/assets/admin/js/vendors/tabs.js', array( 'backbone' ), RTMEDIA_VERSION );
825
wp_enqueue_script( 'rtmedia-admin-scripts', RTMEDIA_URL . 'app/assets/admin/js/scripts.js', array( 'backbone' ), RTMEDIA_VERSION );
826
- wp_enqueue_script( 'rtmedia-admin', RTMEDIA_URL . 'app/assets/admin/js/settings.js', array( 'backbone' ), RTMEDIA_VERSION );
827
} else {
828
- wp_enqueue_script( 'rtmedia-admin', RTMEDIA_URL . 'app/assets/admin/js/admin.min.js', array( 'backbone' ), RTMEDIA_VERSION );
829
}
830
831
- wp_localize_script( 'rtmedia-admin', 'rtmedia_on_label', __( 'ON', 'buddypress-media' ) );
832
- wp_localize_script( 'rtmedia-admin', 'rtmedia_off_label', __( 'OFF', 'buddypress-media' ) );
833
wp_localize_script( 'rtmedia-admin', 'rtmedia_admin_ajax', $admin_ajax );
834
wp_localize_script( 'rtmedia-admin', 'rtmedia_admin_url', admin_url() );
835
wp_localize_script( 'rtmedia-admin', 'rtmedia_admin_url', admin_url() );
836
837
$rtmedia_admin_strings = array(
838
- 'no_refresh' => __( 'Please do not refresh this page.', 'buddypress-media' ),
839
- 'something_went_wrong' => __( 'Something went wrong. Please <a href onclick="location.reload();">refresh</a> page.', 'buddypress-media' ),
840
- 'are_you_sure' => __( 'This will subscribe you to the free plan.', 'buddypress-media' ),
841
- 'disable_encoding' => __( 'Are you sure you want to disable the encoding service?', 'buddypress-media' ),
842
- 'enable_encoding' => __( 'Are you sure you want to enable the encoding service?', 'buddypress-media' ),
843
);
844
845
wp_localize_script( 'rtmedia-admin', 'rtmedia_admin_strings', $rtmedia_admin_strings );
@@ -866,20 +951,53 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
866
* @return void
867
*/
868
public function menu() {
869
- add_menu_page( 'rtMedia', 'rtMedia', 'manage_options', 'rtmedia-settings', array( $this, 'settings_page' ), RTMEDIA_URL . 'app/assets/admin/img/rtmedia-logo.png', '40.1111' );
870
- add_submenu_page( 'rtmedia-settings', __( 'Settings', 'buddypress-media' ), __( 'Settings', 'buddypress-media' ), 'manage_options', 'rtmedia-settings', array( $this, 'settings_page' ) );
871
- add_submenu_page( 'rtmedia-settings', __( 'Addons', 'buddypress-media' ), __( 'Addons', 'buddypress-media' ), 'manage_options', 'rtmedia-addons', array( $this, 'addons_page' ) );
872
- add_submenu_page( 'rtmedia-settings', __( 'Support', 'buddypress-media' ), __( 'Support', 'buddypress-media' ), 'manage_options', 'rtmedia-support', array( $this, 'support_page' ) );
873
- add_submenu_page( 'rtmedia-settings', __( 'Themes', 'buddypress-media' ), __( 'Themes', 'buddypress-media' ), 'manage_options', 'rtmedia-themes', array( $this, 'theme_page' ) );
874
- add_submenu_page( 'rtmedia-settings', __( 'Hire Us', 'buddypress-media' ), __( 'Hire Us', 'buddypress-media' ), 'manage_options', 'rtmedia-hire-us', array( $this, 'hire_us_page' ) );
875
if ( has_filter( 'rtmedia_license_tabs' ) || has_action( 'rtmedia_addon_license_details' ) ) {
876
- add_submenu_page( 'rtmedia-settings', __( 'Licenses', 'buddypress-media' ), __( 'Licenses', 'buddypress-media' ), 'manage_options', 'rtmedia-license', array( $this, 'license_page' ) );
877
}
878
879
$obj_encoding = new RTMediaEncoding( true );
880
881
if ( $obj_encoding->api_key ) {
882
- add_submenu_page( 'rtmedia-settings', __( 'Regenerate Thumbnail', 'buddypress-media' ), __( 'Regen. Thumbnail ', 'buddypress-media' ), 'manage_options', 'rtmedia-regenerate', array( $this, 'rt_regenerate_thumbnail' ) );
883
}
884
}
885
@@ -894,28 +1012,53 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
894
*/
895
public function rt_regenerate_thumbnail() {
896
$prog = new rtProgress();
897
- $done = 0;
898
?>
899
<div class="wrap">
900
- <h2> rtMedia: <?php _e( 'Regenerate Video Thumbnails', 'buddypress-media' ); ?> </h2>
901
<?php
902
- if ( isset( $_REQUEST[ 'media_ids' ] ) && trim( $_REQUEST[ 'media_ids' ] ) != '' ) {
903
$requested = false;
904
- $media_ids = explode( ',', $_REQUEST[ 'media_ids' ] );
905
- $total = count( $media_ids );
906
} else {
907
- $media_ids = $this->get_video_without_thumbs();
908
- $total = count( $media_ids );
909
}
910
?>
911
<script>
912
- var rt_thumb_all_media = <?php echo json_encode( $media_ids ); ?>;
913
</script>
914
<?php
915
if ( ! isset( $requested ) ) {
916
?>
917
<br/>
918
- <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://rtmedia.io/audio-video-encoding-service/" 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', 'buddypress-media' ) . ' (' . $total . ')'; ?>"/> </p>
919
<?php
920
}
921
?>
@@ -925,65 +1068,70 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
925
$temp = $prog->progress( $done, $total );
926
$prog->progress_ui( $temp, true );
927
?>
928
- <p> <?php _e( 'Total Videos', 'buddypress-media' ) ?> : <span class='rt-total'><?php echo $total; ?></span>
929
</p>
930
931
- <p> <?php _e( 'Sent of regenerate thumbails', 'buddypress-media' ) ?> : <span class='rt-done'>0</span></p>
932
933
- <p> <?php _e( 'Fail to regenerate thumbails', 'buddypress-media' ) ?> : <span class='rt-fail'>0</span></p>
934
935
</div>
936
<script>
937
938
var db_done = 0;
939
var db_fail = 0;
940
- var db_total = <?php echo $total; ?>;
941
var indx = 0;
942
function db_start_regenrate() {
943
- if ( indx < db_total ) {
944
- jQuery.ajax( {
945
url: rtmedia_admin_ajax,
946
type: 'post',
947
data: {
948
"action": "rt_media_regeneration",
949
- "media_id": rt_thumb_all_media[indx ++]
950
},
951
- success: function ( data ) {
952
- data = JSON.parse( data );
953
954
- if ( data.status == false ) {
955
handle_regenrate_fail();
956
} else {
957
- db_done ++;
958
- var progw = Math.ceil( ( db_done / db_total ) * 100 );
959
- if ( progw > 100 ) {
960
progw = 100;
961
}
962
- jQuery( '#rtprogressbar>div' ).css( 'width', progw + '%' );
963
- jQuery( 'span.rt-done' ).html( db_done );
964
db_start_regenrate();
965
}
966
},
967
error: function () {
968
handle_regenrate_fail();
969
}
970
- } );
971
} else {
972
- alert( "<?php _e( 'Regenerate Video Thumbnails Done', 'buddypress-media' ); ?>" );
973
}
974
}
975
function handle_regenrate_fail() {
976
- db_fail ++;
977
- jQuery( 'span.rt-fail' ).html( db_fail );
978
db_start_regenrate();
979
}
980
- if ( jQuery( "#rt-start-media-regenerate" ).length > 0 ) {
981
- jQuery( "#rt-migration-progress" ).hide()
982
- jQuery( "#rt-start-media-regenerate" ).click( function () {
983
- jQuery( this ).hide();
984
- jQuery( "#rt-migration-progress" ).show()
985
db_start_regenrate();
986
- } )
987
} else {
988
db_start_regenrate();
989
}
@@ -1007,24 +1155,28 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
1007
$obj_encoding = new RTMediaEncoding( true );
1008
if ( $obj_encoding->api_key ) {
1009
$site_option = rtmedia_get_site_option( 'rtmedia-video-thumb-notice' );
1010
- if ( ! $site_option || 'hide' != $site_option ) {
1011
rtmedia_update_site_option( 'rtmedia-video-thumb-notice', 'show' );
1012
$videos_without_thumbs = get_video_without_thumbs();
1013
- if ( isset( $videos_without_thumbs ) && is_array( $videos_without_thumbs ) && sizeof( $videos_without_thumbs ) > 0 ) {
1014
- echo '<div class="error rtmedia-regenerate-video-thumb-error">
1015
- <p>
1016
- ' . 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>", 'buddypress-media' ), sizeof( $videos_without_thumbs ), admin_url( 'admin.php?page=rtmedia-regenerate' ) ) . '
1017
- </p>
1018
- </div>';
1019
?>
1020
<script type="text/javascript">
1021
function rtmedia_hide_video_thumb_notice() {
1022
- var data = { action: 'rtmedia_hide_video_thumb_admin_notice' };
1023
- jQuery.post( ajaxurl, data, function ( response ) {
1024
response = response.trim();
1025
- if ( response === "1" )
1026
- jQuery( '.rtmedia-regenerate-video-thumb-error' ).remove();
1027
- } );
1028
}
1029
</script>
1030
<?php
@@ -1043,7 +1195,7 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
1043
* @return void
1044
*/
1045
public function rtmedia_hide_video_thumb_admin_notice() {
1046
- if ( rtmedia_update_site_option( 'rtmedia-video-thumb-notice', 'hide' ) ) {
1047
echo '1';
1048
} else {
1049
echo '0';
@@ -1061,7 +1213,7 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
1061
* @return void
1062
*/
1063
public function rtmedia_hide_addon_update_notice() {
1064
- if ( rtmedia_update_site_option( 'rtmedia-addon-update-notice-3_8', 'hide' ) ) {
1065
echo '1';
1066
} else {
1067
echo '0';
@@ -1079,43 +1231,29 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
1079
* @return void
1080
*/
1081
public function rt_media_regeneration() {
1082
- if ( isset( $_POST[ 'media_id' ] ) ) {
1083
- $model = new RTMediaModel();
1084
- $media = $model->get_media( array( 'media_id' => $_POST[ 'media_id' ] ), 0, 1 );
1085
- $media_type = $media[ 0 ]->media_type;
1086
- $response = array();
1087
- if ( 'video' == $media_type ) {
1088
- $objRTMediaEncoding = new RTMediaEncoding( true );
1089
- $autoformat = 'thumbnails';
1090
- $objRTMediaEncoding->reencoding( intval( $_POST[ 'media_id' ] ), $autoformat );
1091
- $response[ 'status' ] = true;
1092
} else {
1093
- $response[ 'status' ] = false;
1094
- $response[ 'message' ] = __( 'not a video ...', 'buddypress-media' );
1095
}
1096
- echo json_encode( $response );
1097
die();
1098
}
1099
}
1100
1101
- /**
1102
- * Get video without thumbs.
1103
- *
1104
- * @access public
1105
- *
1106
- * @param void
1107
- *
1108
- * @return object $results
1109
- */
1110
- public function get_video_without_thumbs() {
1111
- $rtmedia_model = new RTMediaModel();
1112
- $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";
1113
- global $wpdb;
1114
- $results = $wpdb->get_col( $sql );
1115
-
1116
- return $results;
1117
- }
1118
-
1119
/**
1120
* Render the BuddyPress Media Settings page.
1121
*
@@ -1231,10 +1369,11 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
1231
*
1232
* @param void
1233
*
1234
- * @return type
1235
*/
1236
static function get_current_tab() {
1237
- return isset( $_GET[ 'page' ] ) ? $_GET[ 'page' ] : 'rtmedia-settings';
1238
}
1239
1240
/**
@@ -1243,21 +1382,24 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
1243
* @access public
1244
* @global string 'buddypress-media'
1245
*
1246
- * @param type $page
1247
- * @param type $option_group
1248
*
1249
* @return void
1250
*/
1251
public function render_page( $page, $option_group = null ) {
1252
?>
1253
1254
- <div class="wrap bp-media-admin <?php echo $this->get_current_tab(); ?>">
1255
<div id="icon-buddypress-media" class="icon32"><br></div>
1256
<div>
1257
<h2 class="nav-tab-wrapper"><?php $this->rtmedia_tabs(); ?>
1258
<span class="alignright by">
1259
- <a class="rt-link" href="https://rtmedia.io/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media" target="_blank" title="<?php _e( 'rtMedia for WordPress, BuddyPress and bbPress', 'buddypress-media' ); ?>">
1260
- <img src="<?php echo RTMEDIA_URL; ?>app/assets/admin/img/rtcamp-logo.png" alt="rtMedia for WordPress, BuddyPress and bbPress" />
1261
</a>
1262
</span>
1263
</h2>
@@ -1268,57 +1410,67 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
1268
<div id="bp-media-settings-boxes" class="bp-media-settings-boxes-container rtm-setting-container">
1269
1270
<?php
1271
- $settings_url = ( is_multisite() ) ? network_admin_url( 'edit.php?action=' . $option_group ) : 'options.php';
1272
- if ( $page == 'rtmedia-settings' ) {
1273
?>
1274
<form id="bp_media_settings_form" name="bp_media_settings_form" method="post"
1275
- enctype="multipart/form-data">
1276
- <div class="bp-media-metabox-holder">
1277
- <div class="rtm-button-container top">
1278
- <?php if ( isset( $_GET[ 'settings-saved' ] ) && $_GET[ 'settings-saved' ] ) { ?>
1279
- <div class="rtm-success rtm-fly-warning rtm-save-settings-msg"><?php _e( 'Settings saved successfully!', 'buddypress-media' ); ?></div>
1280
- <?php } ?>
1281
- <input type="hidden" name="rtmedia-options-save" value="true">
1282
- <input type="submit" class="rtmedia-settings-submit button button-primary button-big" value="<?php _e( 'Save Settings', 'buddypress-media' ); ?>">
1283
- </div>
1284
- <?php
1285
- settings_fields( $option_group );
1286
- if ( 'rtmedia-settings' == $page ) {
1287
- echo '<div id="rtm-settings-tabs">';
1288
- $sub_tabs = $this->settings_sub_tabs();
1289
- RTMediaFormHandler::rtForm_settings_tabs_content( $page, $sub_tabs );
1290
- echo '</div>';
1291
- } else {
1292
- do_settings_sections( $page );
1293
- }
1294
- ?>
1295
-
1296
- <div class="rtm-button-container bottom">
1297
- <div class="rtm-social-links alignleft">
1298
- <a href="http://twitter.com/rtMediaWP" class="twitter" target= "_blank"><span class="dashicons dashicons-twitter"></span></a>
1299
- <a href="https://www.facebook.com/rtmediawp" class="facebook" target="_blank"><span class="dashicons dashicons-facebook"></span></a>
1300
- <a href="http://profiles.wordpress.org/rtcamp" class="wordpress" target= "_blank"><span class="dashicons dashicons-wordpress"></span></a>
1301
- <a href="https://rtmedia.io/feed/" class="rss" target="_blank"><span class="dashicons dashicons-rss"></span></a>
1302
</div>
1303
1304
- <input type="hidden" name="rtmedia-options-save" value="true">
1305
- <input type="submit" class="rtmedia-settings-submit button button-primary button-big" value="<?php _e( 'Save Settings', 'buddypress-media' ); ?>">
1306
</div>
1307
</div>
1308
</form><?php
1309
} else {
1310
?>
1311
<div class="bp-media-metabox-holder">
1312
<?php
1313
- if ( 'rtmedia-addons' == $page ) {
1314
RTMediaAddon::render_addons( $page );
1315
- } else if ( 'rtmedia-support' == $page ) {
1316
$rtmedia_support = new RTMediaSupport( false );
1317
$rtmedia_support->render_support( $page );
1318
- } else if ( 'rtmedia-themes' == $page ) {
1319
RTMediaThemes::render_themes( $page );
1320
} else {
1321
- if ( 'rtmedia-license' == $page ) {
1322
RTMediaLicense::render_license( $page );
1323
} else {
1324
do_settings_sections( $page );
@@ -1346,34 +1498,32 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
1346
* Adds a tab for Media settings in the BuddyPress settings page
1347
*
1348
* @access public
1349
- * @global type $bp_media
1350
*
1351
* @param void
1352
* @param void
1353
*
1354
- * @return type $tabs_html
1355
*/
1356
public function tab() {
1357
1358
- $tabs_html = '';
1359
- $idle_class = 'nav-tab';
1360
$active_class = 'nav-tab nav-tab-active';
1361
- $tabs = array();
1362
1363
// Check to see which tab we are on
1364
$tab = $this->get_current_tab();
1365
/* rtMedia */
1366
$tabs[] = array(
1367
- 'href' => get_admin_url( null, esc_url( add_query_arg( array( 'page' => 'rtmedia-settings' ), 'admin.php' ) ) ),
1368
- 'title' => __( 'rtMedia', 'buddypress-media' ),
1369
- 'name' => __( 'rtMedia', 'buddypress-media' ),
1370
- 'class' => ( $tab == 'rtmedia-settings' || $tab == 'rtmedia-addons' || $tab == 'rtmedia-support' || $tab == 'rtmedia-importer' ) ? $active_class : $idle_class,
1371
);
1372
1373
foreach ( $tabs as $tab ) {
1374
- $tabs_html .= '<a id="bp-media" title= "' . $tab[ 'title' ] . '" href="' . $tab[ 'href' ] . '" class="' . $tab[ 'class' ] . '">' . $tab[ 'name' ] . '</a>';
1375
}
1376
- echo $tabs_html;
1377
}
1378
1379
/**
@@ -1381,45 +1531,53 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
1381
*
1382
* @access public
1383
*
1384
- * @param type $active_tab
1385
*
1386
* @return void
1387
*/
1388
- public function rtmedia_tabs( $active_tab = '' ) {
1389
// Declare local variables
1390
- $tabs_html = '';
1391
- $idle_class = 'nav-tab';
1392
$active_class = 'nav-tab nav-tab-active';
1393
1394
// Setup core admin tabs
1395
$tabs = array(
1396
array(
1397
'href' => get_admin_url( null, esc_url( add_query_arg( array( 'page' => 'rtmedia-settings' ), 'admin.php' ) ) ),
1398
- 'name' => __( 'Settings', 'buddypress-media' ),
1399
'slug' => 'rtmedia-settings',
1400
- ), array(
1401
'href' => get_admin_url( null, esc_url( add_query_arg( array( 'page' => 'rtmedia-addons' ), 'admin.php' ) ) ),
1402
- 'name' => __( 'Addons', 'buddypress-media' ),
1403
'slug' => 'rtmedia-addons',
1404
- ), array(
1405
'href' => get_admin_url( null, esc_url( add_query_arg( array( 'page' => 'rtmedia-themes' ), 'admin.php' ) ) ),
1406
- 'name' => __( 'Themes', 'buddypress-media' ),
1407
'slug' => 'rtmedia-themes',
1408
- ), array(
1409
'href' => get_admin_url( null, esc_url( add_query_arg( array( 'page' => 'rtmedia-hire-us' ), 'admin.php' ) ) ),
1410
- 'name' => __( 'Hire Us', 'buddypress-media' ),
1411
'slug' => 'rtmedia-hire-us',
1412
- ), array(
1413
- 'href' => get_admin_url( null, esc_url( add_query_arg( array( 'page' => 'rtmedia-support' ), 'admin.php' ) ) ),
1414
- 'name' => __( 'Support', 'buddypress-media' ),
1415
- 'slug' => 'rtmedia-support',
1416
- ),
1417
);
1418
1419
if ( has_filter( 'rtmedia_license_tabs' ) || has_action( 'rtmedia_addon_license_details' ) ) {
1420
$tabs[] = array(
1421
'href' => get_admin_url( null, esc_url( add_query_arg( array( 'page' => 'rtmedia-license' ), 'admin.php' ) ) ),
1422
- 'name' => __( 'Licenses', 'buddypress-media' ),
1423
'slug' => 'rtmedia-license',
1424
);
1425
}
@@ -1428,21 +1586,15 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
1428
1429
// Loop through tabs and build navigation
1430
foreach ( array_values( $tabs ) as $tab_data ) {
1431
- $is_current = ( bool ) ( $tab_data[ 'slug' ] == $this->get_current_tab() );
1432
- $tab_class = $is_current ? $active_class : $idle_class;
1433
1434
- if ( isset( $tab_data[ 'class' ] ) && is_array( $tab_data[ 'class' ] ) ) {
1435
- $tab_class .= ' ' . implode( ' ', $tab_data[ 'class' ] );
1436
}
1437
1438
- $tabs_html .= '<a href="' . $tab_data[ 'href' ] . '" class="' . $tab_class . '">' . $tab_data[ 'name' ] . '</a>';
1439
}
1440
-
1441
- // Output the tabs
1442
- echo $tabs_html;
1443
-
1444
- // // Do other fun things
1445
- // do_action('bp_media_admin_tabs');
1446
}
1447
1448
/**
@@ -1450,7 +1602,7 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
1450
*
1451
* @access public
1452
*
1453
- * @param type $page
1454
*
1455
* @return void
1456
*/
@@ -1461,21 +1613,21 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
1461
return;
1462
}
1463
1464
- foreach ( ( array ) $wp_settings_sections[ $page ] as $section ) {
1465
- if ( $section[ 'title' ] ) {
1466
- echo "<h3>{$section[ 'title' ]}</h3>\n";
1467
}
1468
1469
- if ( $section[ 'callback' ] ) {
1470
- call_user_func( $section[ 'callback' ], $section );
1471
}
1472
1473
- if ( ! isset( $wp_settings_fields ) || ! isset( $wp_settings_fields[ $page ] ) || ! isset( $wp_settings_fields[ $page ][ $section[ 'id' ] ] ) ) {
1474
continue;
1475
}
1476
1477
echo '<table class="form-table">';
1478
- do_settings_fields( $page, $section[ 'id' ] );
1479
echo '</table>';
1480
}
1481
}
@@ -1484,131 +1636,80 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
1484
* Adds a sub tabs to the BuddyPress Media settings page
1485
*
1486
* @access public
1487
- * @global type $bp_media
1488
*
1489
* @param void
1490
*
1491
* @return array $tabs
1492
*/
1493
public function settings_sub_tabs() {
1494
- $tabs_html = '';
1495
- $tabs = array();
1496
1497
// Check to see which tab we are on
1498
$tab = $this->get_current_tab();
1499
/* rtMedia */
1500
1501
- $tabs[ 7 ] = array(
1502
- 'href' => '#rtmedia-display',
1503
- 'icon' => 'dashicons-desktop',
1504
- 'title' => __( 'Display', 'buddypress-media' ),
1505
- 'name' => __( 'Display', 'buddypress-media' ),
1506
- 'callback' => array( 'RTMediaFormHandler', 'display_content' )
1507
);
1508
1509
if ( class_exists( 'BuddyPress' ) ) {
1510
- $tabs[ 20 ] = array(
1511
- 'href' => '#rtmedia-bp',
1512
- 'icon' => 'dashicons-groups',
1513
- 'title' => __( 'rtMedia BuddyPress', 'buddypress-media' ),
1514
- 'name' => __( 'BuddyPress', 'buddypress-media' ),
1515
- 'callback' => array( 'RTMediaFormHandler', 'buddypress_content' ) //change it to BuddyPress Content
1516
);
1517
}
1518
1519
- $tabs[ 30 ] = array(
1520
- 'href' => '#rtmedia-types',
1521
- 'icon' => 'dashicons-editor-video',
1522
- 'title' => __( 'rtMedia Types', 'buddypress-media' ),
1523
- 'name' => __( 'Types', 'buddypress-media' ),
1524
- 'callback' => array( 'RTMediaFormHandler', 'types_content' )
1525
);
1526
1527
- $tabs[ 40 ] = array(
1528
- 'href' => '#rtmedia-sizes',
1529
- 'icon' => 'dashicons-editor-expand',
1530
- 'title' => __( 'rtMedia Sizes', 'buddypress-media' ),
1531
- 'name' => __( 'Media Sizes', 'buddypress-media' ),
1532
- 'callback' => array( 'RTMediaFormHandler', 'sizes_content' )
1533
);
1534
1535
- $tabs[ 50 ] = array(
1536
- 'href' => '#rtmedia-privacy',
1537
- 'icon' => 'dashicons-lock',
1538
- 'title' => __( 'rtMedia Privacy', 'buddypress-media' ),
1539
- 'name' => __( 'Privacy', 'buddypress-media' ),
1540
- 'callback' => array( 'RTMediaFormHandler', 'privacy_content' )
1541
);
1542
- $tabs[ 60 ] = array(
1543
- 'href' => '#rtmedia-custom-css-settings',
1544
- 'icon' => 'dashicons-clipboard',
1545
- 'title' => __( 'rtMedia Custom CSS', 'buddypress-media' ),
1546
- 'name' => __( 'Custom CSS', 'buddypress-media' ),
1547
- 'callback' => array( 'RTMediaFormHandler', 'custom_css_content' )
1548
);
1549
1550
$tabs = apply_filters( 'rtmedia_add_settings_sub_tabs', $tabs, $tab );
1551
1552
$tabs[] = array(
1553
- 'href' => '#rtmedia-general',
1554
- 'icon' => 'dashicons-admin-tools',
1555
- 'title' => __( 'Other Settings', 'buddypress-media' ),
1556
- 'name' => __( 'Other Settings', 'buddypress-media' ),
1557
- 'callback' => array( 'RTMediaFormHandler', 'general_content' )
1558
);
1559
1560
return $tabs;
1561
}
1562
1563
- /**
1564
- * Updates the media count of all users.
1565
- *
1566
- * @access public
1567
- * @global type $wpdb
1568
- *
1569
- * @param void
1570
- *
1571
- * @return boolean
1572
- */
1573
- public function update_count() {
1574
- global $wpdb;
1575
-
1576
- $query = "SELECT
1577
- p.post_author,pmp.meta_value,
1578
- SUM(CASE WHEN post_mime_type LIKE 'image%' THEN 1 ELSE 0 END) as Images,
1579
- SUM(CASE WHEN post_mime_type LIKE 'music%' THEN 1 ELSE 0 END) as Music,
1580
- SUM(CASE WHEN post_mime_type LIKE 'video%' THEN 1 ELSE 0 END) as Videos,
1581
- SUM(CASE WHEN post_type LIKE 'bp_media_album' THEN 1 ELSE 0 END) as Albums
1582
- FROM
1583
- $wpdb->posts p inner join $wpdb->postmeta pm on pm.post_id = p.id INNER JOIN $wpdb->postmeta pmp
1584
- on pmp.post_id = p.id WHERE
1585
- pm.meta_key = 'bp-media-key' AND
1586
- pm.meta_value > 0 AND
1587
- pmp.meta_key = 'bp_media_privacy' AND
1588
- ( post_mime_type LIKE 'image%' OR post_mime_type LIKE 'music%' OR post_mime_type LIKE 'video%' OR post_type LIKE 'bp_media_album')
1589
- GROUP BY p.post_author,pmp.meta_value order by p.post_author";
1590
-
1591
- $result = $wpdb->get_results( $query );
1592
-
1593
- if ( ! is_array( $result ) ) {
1594
- return false;
1595
- }
1596
-
1597
- $formatted = array();
1598
-
1599
- foreach ( $result as $obj ) {
1600
- $formatted[ $obj->post_author ][ $obj->meta_value ] = array(
1601
- 'image' => $obj->Images, 'video' => $obj->Videos, 'music' => $obj->Music, 'album' => $obj->Albums,
1602
- );
1603
- }
1604
-
1605
- foreach ( $formatted as $user => $obj ) {
1606
- update_user_meta( $user, 'rtmedia_count', $obj );
1607
- }
1608
-
1609
- return true;
1610
- }
1611
-
1612
/**
1613
* Multisite Save Options - http://wordpress.stackexchange.com/questions/64968/settings-api-in-multisite-missing-update-message#answer-72503
1614
*
@@ -1621,16 +1722,18 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
1621
*/
1622
public function save_multisite_options() {
1623
global $rtmedia_admin;
1624
- if ( isset( $_POST[ 'refresh-count' ] ) ) {
1625
- $rtmedia_admin->update_count();
1626
- }
1627
- do_action( 'rtmedia_sanitize_settings', $_POST );
1628
1629
- if ( isset( $_POST[ 'rtmedia_options' ] ) ) {
1630
- rtmedia_update_site_option( 'rtmedia_options', $_POST[ 'rtmedia_options' ] );
1631
//
1632
// redirect to settings page in network
1633
- 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' ) ) ) ) );
1634
exit;
1635
}
1636
}
@@ -1639,7 +1742,6 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
1639
* Admin Sidebar
1640
*
1641
* @access public
1642
- * @global type $bp_media
1643
*
1644
* @param void
1645
*
@@ -1648,62 +1750,72 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
1648
public function admin_sidebar() {
1649
do_action( 'rtmedia_before_default_admin_widgets' );
1650
$current_user = wp_get_current_user();
1651
- $message = sprintf( __( 'I use @rtMediaWP http://rt.cx/rtmedia on %s', 'buddypress-media' ), home_url() );
1652
- $addons = '<div id="social" class="rtm-social-share">
1653
- <p><a href="http://twitter.com/home/?status=' . $message . '" class="button twitter" target= "_blank" title="' . __( 'Post to Twitter Now', 'buddypress-media' ) . '">' . __( 'Post to Twitter', 'buddypress-media' ) . '<span class="dashicons dashicons-twitter"></span></a></p>
1654
- <p><a href="https://www.facebook.com/sharer/sharer.php?u=https://rtmedia.io/" class="button facebook" target="_blank" title="' . __( 'Share on Facebook Now', 'buddypress-media' ) . '">' . __( 'Share on Facebook', 'buddypress-media' ) . '<span class="dashicons dashicons-facebook"></span></a></p>
1655
- <p><a href="http://wordpress.org/support/view/plugin-reviews/buddypress-media?rate=5#postform" class="button wordpress" target= "_blank" title="' . __( 'Rate rtMedia on Wordpress.org', 'buddypress-media' ) . '">' . __( 'Rate on Wordpress.org', 'buddypress-media' ) . '<span class="dashicons dashicons-wordpress"></span></a></p>
1656
- <p><a href="' . sprintf( '%s', 'https://rtmedia.io/feed/' ) . '" class="button rss" target="_blank" title="' . __( 'Subscribe to our Feeds', 'buddypress-media' ) . '">' . __( 'Subscribe to our Feeds', 'buddypress-media' ) . '<span class="dashicons dashicons-rss"></span></a></p>
1657
- </div>';
1658
1659
- new RTMediaAdminWidget( 'spread-the-word', __( 'Spread the Word', 'buddypress-media' ), $addons );
1660
1661
$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>
1662
- <div class="mc-field-group">
1663
- <input type="email" value="' . $current_user->user_email . '" name="EMAIL" placeholder="Email" class="required email" id="mce-EMAIL">
1664
- <input style="display:none;" type="checkbox" checked="checked" value="1" name="group[1721][1]" id="mce-group[1721]-1721-0">
1665
- <input type="submit" value="' . __( 'Subscribe', 'buddypress-media' ) . '" name="subscribe" id="mc-embedded-subscribe" class="button">
1666
- <div id="mce-responses" class="clear">
1667
- <div class="response" id="mce-error-response" style="display:none"></div>
1668
- <div class="response" id="mce-success-response" style="display:none"></div>
1669
- </div>
1670
- </div>
1671
- </form>';
1672
- new RTMediaAdminWidget( 'branding', __( 'Subscribe', 'buddypress-media' ), $branding );
1673
-
1674
- $news = '<img src ="' . admin_url( '/images/wpspin_light.gif' ) . '" /> Loading...';
1675
- //new RTMediaAdminWidget ( 'latest-news', __( 'Latest News', 'buddypress-media' ), $news );
1676
do_action( 'rtmedia_after_default_admin_widgets' );
1677
}
1678
1679
public function linkback() {
1680
- if ( isset( $_POST[ 'linkback' ] ) && $_POST[ 'linkback' ] ) {
1681
return rtmedia_update_site_option( 'rtmedia-add-linkback', true );
1682
} else {
1683
return rtmedia_update_site_option( 'rtmedia-add-linkback', false );
1684
}
1685
- die;
1686
}
1687
1688
public function convert_videos_mailchimp_send() {
1689
- if ( 'Yes' == $_POST[ 'interested' ] && ! empty( $_POST[ 'choice' ] ) ) {
1690
- 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' ] ), 'https://rtmedia.io/' ) ) );
1691
} else {
1692
rtmedia_update_site_option( 'rtmedia-survey', 0 );
1693
}
1694
- _e( 'Thank you for your time.', 'buddypress-media' );
1695
- die;
1696
}
1697
1698
public function video_transcoding_survey_response() {
1699
- if ( isset( $_GET[ 'survey-done' ] ) && ( $_GET[ 'survey-done' ] == md5( 'survey-done' ) ) ) {
1700
rtmedia_update_site_option( 'rtmedia-survey', 0 );
1701
}
1702
}
1703
1704
- public function plugin_meta_premium_addon_link( $plugin_meta, $plugin_file, $plugin_data, $status ) {
1705
- if ( plugin_basename( RTMEDIA_PATH . 'index.php' ) == $plugin_file ) {
1706
- $plugin_meta[] = '<a href="https://rtmedia.io/products/?utm_source=dashboard&#038;utm_medium=plugin&#038;utm_campaign=buddypress-media" title="' . __( 'Premium Add-ons', 'buddypress-media' ) . '">' . __( 'Premium Add-ons', 'buddypress-media' ) . '</a>';
1707
}
1708
1709
return $plugin_meta;
@@ -1713,63 +1825,90 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
1713
global $rtmedia;
1714
$upload_filetypes = rtmedia_get_site_option( 'upload_filetypes', 'jpg jpeg png gif' );
1715
$upload_filetypes = explode( ' ', $upload_filetypes );
1716
- $flag = false;
1717
- if ( isset( $rtmedia->options[ 'images_enabled' ] ) && $rtmedia->options[ 'images_enabled' ] ) {
1718
$not_supported_image = array_diff( array( 'jpg', 'jpeg', 'png', 'gif' ), $upload_filetypes );
1719
if ( ! empty( $not_supported_image ) ) {
1720
- echo '<div class="error upload-filetype-network-settings-error">
1721
- <p>
1722
- ' . 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.', 'buddypress-media' ), implode( ', ', $not_supported_image ), network_admin_url( 'settings.php#upload_filetypes' ) ) . '
1723
- <br /><strong>' . __( 'Recommended', 'buddypress-media' ) . ':</strong> <input type="button" class="button update-network-settings-upload-filetypes" class="button" value="' . __( 'Update Network Settings Automatically', 'buddypress-media' ) . '"> <img style="display:none;" src="' . admin_url( 'images/wpspin_light.gif' ) . '" />
1724
- </p>
1725
- </div>';
1726
$flag = true;
1727
}
1728
}
1729
- if ( isset( $rtmedia->options[ 'videos_enabled' ] ) && $rtmedia->options[ 'videos_enabled' ] ) {
1730
- if ( ! in_array( 'mp4', $upload_filetypes ) ) {
1731
- echo '<div class="error upload-filetype-network-settings-error">
1732
- <p>
1733
- ' . 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.', 'buddypress-media' ), network_admin_url( 'settings.php#upload_filetypes' ) ) . '
1734
- <br /><strong>' . __( 'Recommended', 'buddypress-media' ) . ':</strong> <input type="button" class="button update-network-settings-upload-filetypes" class="button" value="' . __( 'Update Network Settings Automatically', 'buddypress-media' ) . '"> <img style="display:none;" src="' . admin_url( 'images/wpspin_light.gif' ) . '" />
1735
- </p>
1736
- </div>';
1737
$flag = true;
1738
}
1739
}
1740
- if ( isset( $rtmedia->options[ 'audio_enabled' ] ) && $rtmedia->options[ 'audio_enabled' ] ) {
1741
- if ( ! in_array( 'mp3', $upload_filetypes ) ) {
1742
- 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.', 'buddypress-media' ), network_admin_url( 'settings.php#upload_filetypes' ) ) . '
1743
- <br /><strong>' . __( 'Recommended', 'buddypress-media' ) . ':</strong> <input type="button" class="button update-network-settings-upload-filetypes" class="button" value="' . __( 'Update Network Settings Automatically', 'buddypress-media' ) . '"> <img style="display:none;" src="' . admin_url( 'images/wpspin_light.gif' ) . '" />
1744
- </p>
1745
- </div>';
1746
$flag = true;
1747
}
1748
}
1749
if ( $flag ) {
1750
?>
1751
<script type="text/javascript">
1752
- jQuery( '.upload-filetype-network-settings-error' ).on( 'click', '.update-network-settings-upload-filetypes', function () {
1753
- jQuery( '.update-network-settings-upload-filetypes' ).siblings( 'img' ).show();
1754
- jQuery( '.update-network-settings-upload-filetypes' ).prop( 'disabled', true );
1755
- jQuery.post( ajaxurl, { action: 'rtmedia_correct_upload_filetypes' }, function ( response ) {
1756
- if ( response ) {
1757
- 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.', 'buddypress-media' ); ?></p></div>' )
1758
- jQuery( '.upload-filetype-network-settings-error' ).remove();
1759
- jQuery( '.bp-media-network-settings-updated-successfully' ).show();
1760
}
1761
- } );
1762
- } );
1763
</script>
1764
<?php
1765
}
1766
}
1767
1768
public function correct_upload_filetypes() {
1769
global $rtmedia;
1770
$upload_filetypes_orig = $upload_filetypes = rtmedia_get_site_option( 'upload_filetypes', 'jpg jpeg png gif' );
1771
- $upload_filetypes = explode( ' ', $upload_filetypes );
1772
- if ( isset( $rtmedia->options[ 'images_enabled' ] ) && $rtmedia->options[ 'images_enabled' ] ) {
1773
$not_supported_image = array_diff( array( 'jpg', 'jpeg', 'png', 'gif' ), $upload_filetypes );
1774
if ( ! empty( $not_supported_image ) ) {
1775
$update_image_support = null;
@@ -1782,48 +1921,49 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
1782
}
1783
}
1784
}
1785
- if ( isset( $rtmedia->options[ 'videos_enabled' ] ) && $rtmedia->options[ 'videos_enabled' ] ) {
1786
- if ( ! in_array( 'mp4', $upload_filetypes ) ) {
1787
$upload_filetypes_orig .= ' mp4';
1788
rtmedia_update_site_option( 'upload_filetypes', $upload_filetypes_orig );
1789
}
1790
}
1791
- if ( isset( $rtmedia->options[ 'audio_enabled' ] ) && $rtmedia->options[ 'audio_enabled' ] ) {
1792
- if ( ! in_array( 'mp3', $upload_filetypes ) ) {
1793
$upload_filetypes_orig .= ' mp3';
1794
rtmedia_update_site_option( 'upload_filetypes', $upload_filetypes_orig );
1795
}
1796
}
1797
echo true;
1798
- die();
1799
}
1800
1801
function edit_video_thumbnail( $form_fields, $post ) {
1802
if ( isset( $post->post_mime_type ) ) {
1803
$media_type = explode( '/', $post->post_mime_type );
1804
- if ( is_array( $media_type ) && 'video' == $media_type[ 0 ] ) {
1805
- $media_id = $post->ID;
1806
- $thumbnail_array = get_post_meta( $media_id, 'rtmedia_media_thumbnails', true );
1807
- $rtmedia_model = new RTMediaModel();
1808
- $rtmedia_media = $rtmedia_model->get( array( 'media_id' => $media_id ) );
1809
$video_thumb_html = '';
1810
if ( is_array( $thumbnail_array ) ) {
1811
$video_thumb_html .= '<ul> ';
1812
1813
foreach ( $thumbnail_array as $key => $thumbnail_src ) {
1814
- $checked = checked( $thumbnail_src, $rtmedia_media[ 0 ]->cover_art, false );
1815
- $count = $key + 1;
1816
$video_thumb_html .= '<li style="width: 150px;display: inline-block;">
1817
- <label for="rtmedia-upload-select-thumbnail-' . $count . '">
1818
- <input type="radio" ' . $checked . ' id="rtmedia-upload-select-thumbnail-' . $count . '" value="' . $thumbnail_src . '" name="rtmedia-thumbnail" />
1819
- <img src=" ' . $thumbnail_src . '" style="max-height: 120px;max-width: 120px; vertical-align: middle;" />
1820
- </label>
1821
- </li> ';
1822
}
1823
1824
$video_thumb_html .= ' </ul>';
1825
- $form_fields[ 'rtmedia_video_thumbnail' ] = array(
1826
- 'label' => 'Video Thumbnails', 'input' => 'html', 'html' => $video_thumb_html,
1827
);
1828
}
1829
}
@@ -1832,13 +1972,15 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
1832
return $form_fields;
1833
}
1834
1835
- function save_video_thumbnail( $post, $attachment ) {
1836
- if ( isset( $post[ 'rtmedia-thumbnail' ] ) ) {
1837
$rtmedia_model = new RTMediaModel();
1838
- $model = new RTMediaModel();
1839
- $media = $model->get( array( 'media_id' => $post[ 'ID' ] ) );
1840
- $media_id = $media[ 0 ]->id;
1841
- $rtmedia_model->update( array( 'cover_art' => $post[ 'rtmedia-thumbnail' ] ), array( 'media_id' => $post[ 'ID' ] ) );
1842
update_activity_after_thumb_set( $media_id );
1843
}
1844
@@ -1848,23 +1990,23 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
1848
function rtmedia_regenerate_thumb_js() {
1849
global $pagenow;
1850
1851
- if ( 'upload.php' == $pagenow ) {
1852
?>
1853
<script type="text/javascript">
1854
- function rtmedia_regenerate_thumbs( post_id ) {
1855
- if ( post_id != "" ) {
1856
var data = {
1857
action: 'rt_media_regeneration',
1858
media_id: post_id
1859
};
1860
- jQuery.post( ajaxurl, data, function ( data ) {
1861
- data = JSON.parse( data );
1862
- if ( data.status === true ) {
1863
- alert( "<?php _e( 'Video is sent to generate thumbnails.', 'buddypress-media' ) ?>" );
1864
} else {
1865
- alert( "<?php _e( 'Video cannot be sent to generate thumbnails.', 'buddypress-media' ) ?>" );
1866
}
1867
- } );
1868
}
1869
}
1870
</script>
@@ -1875,82 +2017,29 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
1875
function add_bulk_actions_regenerate() {
1876
?>
1877
<script type="text/javascript">
1878
- jQuery( document ).ready( function ( $ ) {
1879
- $( 'select[name^="action"] option:last-child' ).before( '<option value="bulk_video_regenerate_thumbnails"><?php esc_attr_e( 'Regenerate Video Thumbnails', 'buddypress-media' ); ?></option>' );
1880
- } );
1881
</script>
1882
<?php
1883
}
1884
1885
- function presstrends_plugin() {
1886
- global $rtmedia;
1887
- $option = $rtmedia->options;
1888
- if ( ! isset( $option[ 'general_AllowUserData' ] ) ) {
1889
- return;
1890
- }
1891
- if ( '0' == $option[ 'general_AllowUserData' ] ) {
1892
- return;
1893
- }
1894
- // PressTrends Account API Key
1895
- $api_key = 'djbzu1no2tdz4qq4u2fpgaemuup2zzmtjulb';
1896
- $auth = 'o3w063qppl7ha022jyc3bjpi7usrmczho';
1897
- // Start of Metrics
1898
- global $wpdb;
1899
- $data = get_transient( 'presstrends_cache_data' );
1900
-
1901
- if ( ! $data || $data == '' ) {
1902
- $api_base = 'http://api.presstrends.io/index.php/api/pluginsites/update?auth=';
1903
- $url = $api_base . $auth . '&api=' . $api_key . '';
1904
- $count_posts = wp_count_posts();
1905
- $count_pages = wp_count_posts( 'page' );
1906
- $comments_count = wp_count_comments();
1907
-
1908
- if ( function_exists( 'wp_get_theme' ) ) {
1909
- $theme_data = wp_get_theme();
1910
- $theme_name = urlencode( $theme_data->Name );
1911
- } else {
1912
- $theme_data = get_theme_data( get_stylesheet_directory() . '/style.css' );
1913
- $theme_name = $theme_data[ 'Name' ];
1914
- }
1915
-
1916
- $plugin_name = '&';
1917
-
1918
- foreach ( get_plugins() as $plugin_info ) {
1919
- $plugin_name .= $plugin_info[ 'Name' ] . '&';
1920
- }
1921
-
1922
- // CHANGE __FILE__ PATH IF LOCATED OUTSIDE MAIN PLUGIN FILE
1923
- $plugin_data = get_plugin_data( __FILE__ );
1924
- $posts_with_comments = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts WHERE post_type='post' AND comment_count > 0" );
1925
- $data = array(
1926
- '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' ),
1927
- );
1928
-
1929
- foreach ( $data as $k => $v ) {
1930
- $url .= '&' . $k . '=' . $v . '';
1931
- }
1932
-
1933
- wp_remote_get( $url );
1934
- set_transient( 'presstrends_cache_data', $data, 60 * 60 * 24 );
1935
- }
1936
- }
1937
-
1938
function rtmedia_update_template_notice() {
1939
$site_option = rtmedia_get_site_option( 'rtmedia-update-template-notice-v3_9_4' );
1940
1941
- if ( ! $site_option || 'hide' != $site_option ) {
1942
rtmedia_update_site_option( 'rtmedia-update-template-notice-v3_9_4', 'show' );
1943
if ( is_dir( get_template_directory() . '/rtmedia' ) ) {
1944
- 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.', 'buddypress-media' ) . '<a href="#" onclick="rtmedia_hide_template_override_notice()" style="float:right">' . __( 'Hide', 'buddypress-media' ) . '</a>' . ' </p></div>';
1945
?>
1946
<script type="text/javascript">
1947
function rtmedia_hide_template_override_notice() {
1948
- var data = { action: 'rtmedia_hide_template_override_notice' };
1949
- jQuery.post( ajaxurl, data, function ( response ) {
1950
response = response.trim();
1951
- if ( '1' === response )
1952
- jQuery( '.rtmedia-update-template-notice' ).remove();
1953
- } );
1954
}
1955
</script>
1956
<?php
@@ -1960,7 +2049,7 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
1960
1961
function rtmedia_hide_template_override_notice() {
1962
1963
- if ( rtmedia_update_site_option( 'rtmedia-update-template-notice-v3_9_4', 'hide' ) ) {
1964
echo '1';
1965
} else {
1966
echo '0';
@@ -1972,22 +2061,23 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
1972
1973
// wrapper class
1974
$wrapper_class = '';
1975
- if ( ! empty( $args[ 'wrapper_class' ] ) && is_array( $args[ 'wrapper_class' ] ) ) {
1976
- $wrapper_class = implode( ' ', $args[ 'wrapper_class' ] );
1977
}
1978
1979
// tabs
1980
- if ( $page == 'rtmedia-settings' ) {
1981
$sub_tabs = apply_filters( 'rtmedia_pro_settings_tabs_content', $sub_tabs );
1982
ksort( $sub_tabs );
1983
}
1984
$tab_position_class = 'rtm-vertical-tabs';
1985
- if( $page == 'rtmedia-addons' ){
1986
$tab_position_class = 'rtm-horizotanl-tabs';
1987
}
1988
?>
1989
1990
- <div class="clearfix <?php echo $tab_position_class; ?> rtm-admin-tab-container <?php echo $wrapper_class; ?>">
1991
<ul class="rtm-tabs">
1992
<?php
1993
$i = 1;
@@ -1995,19 +2085,21 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
1995
1996
// tab status
1997
$active_class = '';
1998
- if ( 1 == $i ) {
1999
$active_class = 'active';
2000
}
2001
2002
// tab icon
2003
$icon = '';
2004
- if ( isset( $tab[ 'icon' ] ) && ! empty( $tab[ 'icon' ] ) ) {
2005
- $icon = '<i class="' . $tab[ 'icon' ] . ' dashicons rtmicon"></i>';
2006
}
2007
?>
2008
- <li class="<?php echo $active_class ?>">
2009
- <a id="tab-<?php echo substr( $tab[ 'href' ], 1 ) ?>" title="<?php echo $tab[ 'title' ] ?>" href="<?php echo $tab[ 'href' ] ?>" class="rtmedia-tab-title <?php echo sanitize_title( $tab[ 'name' ] ) ?>">
2010
- <?php echo $icon ?><span><?php echo $tab[ 'name' ] ?></span>
2011
</a>
2012
</li>
2013
<?php
@@ -2021,20 +2113,20 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
2021
$k = 1;
2022
foreach ( $sub_tabs as $tab ) {
2023
$active_class = '';
2024
- if ( 1 == $k ) {
2025
$active_class = ' active';
2026
}
2027
$k ++;
2028
- if ( isset( $tab[ 'icon' ] ) && ! empty( $tab[ 'icon' ] ) ) {
2029
- $icon = '<i class="' . $tab[ 'icon' ] . '"></i>';
2030
}
2031
- $tab_without_hash = explode( '#', $tab[ 'href' ] );
2032
- $tab_without_hash = $tab_without_hash[ 1 ];
2033
- echo '<div class="rtm-content' . $active_class . '" id="' . $tab_without_hash . '">';
2034
- if ( isset( $tab[ 'args' ] ) ) {
2035
- call_user_func( $tab[ 'callback' ], $page, $tab[ 'args' ] );
2036
} else {
2037
- call_user_func( $tab[ 'callback' ], $page );
2038
}
2039
echo '</div>';
2040
}
@@ -2048,16 +2140,19 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
2048
/**
2049
* To remove setting saved parameter from url once satting saved
2050
* Add parameter to this array WP will remove variable from Query string
2051
* @param $removable_query_args
2052
* @return array $removable_query_args
2053
*/
2054
function removable_query_args( $removable_query_args ) {
2055
- if ( isset( $_GET['page'] ) && $_GET['page'] == 'rtmedia-settings' ) {
2056
$removable_query_args[] = 'settings-saved';
2057
}
2058
return $removable_query_args;
2059
}
2060
-
2061
}
2062
2063
}
1
<?php
2
+
3
/**
4
* Description of RTMediaAdmin
5
*
24
* Constructor - get the plugin hooked in and ready
25
*
26
* @access public
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_filter( 'plugin_action_links_' . RTMEDIA_BASE_NAME, array( &$this, 'plugin_add_settings_link' ) );
34
+
35
$this->rtmedia_support = new RTMediaSupport();
36
add_action( 'wp_ajax_rtmedia_select_request', array( $this->rtmedia_support, 'get_form' ), 1 );
37
+ add_action( 'wp_ajax_rtmedia_cancel_request', function () {
38
+ do_settings_sections( 'rtmedia-support' );
39
+ die();
40
+ }, 1 );
41
add_action( 'wp_ajax_rtmedia_submit_request', array( $this->rtmedia_support, 'submit_request' ), 1 );
42
+
43
+ add_action( 'wp_ajax_rtmedia_linkback', array( $this, 'linkback' ), 1 ); //fixme : is it being used ?
44
add_action( 'wp_ajax_rtmedia_rt_album_deactivate', 'BPMediaAlbumimporter::bp_album_deactivate', 1 );
45
add_action( 'wp_ajax_rtmedia_rt_album_import', 'BPMediaAlbumimporter::bpmedia_ajax_import_callback', 1 );
46
add_action( 'wp_ajax_rtmedia_rt_album_import_favorites', 'BPMediaAlbumimporter::bpmedia_ajax_import_favorites', 1 );
47
add_action( 'wp_ajax_rtmedia_rt_album_import_step_favorites', 'BPMediaAlbumimporter::bpmedia_ajax_import_step_favorites', 1 );
48
add_action( 'wp_ajax_rtmedia_rt_album_cleanup', 'BPMediaAlbumimporter::cleanup_after_install' );
49
+ add_action( 'wp_ajax_rtmedia_convert_videos_form', array( $this, 'convert_videos_mailchimp_send' ), 1 ); //fixme : is it being used ?
50
add_action( 'wp_ajax_rtmedia_correct_upload_filetypes', array( $this, 'correct_upload_filetypes' ), 1 );
51
+ add_filter( 'plugin_row_meta', array( $this, 'plugin_meta_premium_addon_link' ), 1, 2 );
52
+ add_action( 'wp_dashboard_setup', array( $this, 'add_dashboard_widgets' ), 0 );
53
add_filter( 'attachment_fields_to_edit', array( $this, 'edit_video_thumbnail' ), null, 2 );
54
+ add_filter( 'attachment_fields_to_save', array( $this, 'save_video_thumbnail' ), null, 1 );
55
+ add_action( 'wp_ajax_rtmedia_hide_video_thumb_admin_notice', array(
56
+ $this,
57
+ 'rtmedia_hide_video_thumb_admin_notice',
58
+ ), 1 );
59
+ add_action( 'wp_ajax_rtmedia_hide_addon_update_notice', array(
60
+ $this,
61
+ 'rtmedia_hide_addon_update_notice',
62
+ ), 1 );
63
+ add_filter( 'media_row_actions', array( $this, 'modify_medialibrary_permalink' ), 10, 2 );
64
65
$obj_encoding = new RTMediaEncoding( true );
66
78
$rtmedia->options = rtmedia_get_site_option( 'rtmedia-options' );
79
}
80
81
+ $rtmedia_option = filter_input( INPUT_POST, 'rtmedia-options', FILTER_DEFAULT, FILTER_SANITIZE_NUMBER_INT );
82
+ if ( isset( $rtmedia_option ) ) {
83
+ if ( isset( $rtmedia_option['general_showAdminMenu'] ) && 1 === intval( $rtmedia_option['general_showAdminMenu'] ) ) {
84
add_action( 'admin_bar_menu', array( $this, 'admin_bar_menu' ), 100, 1 );
85
}
86
} else {
87
+ if ( 1 === intval( $rtmedia->options['general_showAdminMenu'] ) ) {
88
add_action( 'admin_bar_menu', array( $this, 'admin_bar_menu' ), 100, 1 );
89
}
90
}
91
92
if ( is_admin() ) {
93
add_action( 'admin_enqueue_scripts', array( $this, 'ui' ) );
94
add_action( 'admin_menu', array( $this, 'menu' ), 1 );
95
add_action( 'init', array( $this, 'bp_admin_tabs' ) );
96
101
102
$this->rtmedia_settings = new RTMediaSettings();
103
$this->rtmedia_encoding = new RTMediaEncoding();
104
+
105
if ( ! class_exists( 'BuddyPress' ) ) {
106
add_action( 'admin_init', array( $this, 'check_permalink_admin_notice' ) );
107
}
108
109
+ add_action( 'wp_ajax_rtmedia_hide_template_override_notice', array(
110
+ $this,
111
+ 'rtmedia_hide_template_override_notice',
112
+ ), 1 );
113
add_action( 'admin_init', array( $this, 'rtmedia_bp_add_update_type' ) );
114
+ add_action( 'wp_ajax_rtmedia_hide_inspirebook_release_notice', array(
115
+ $this,
116
+ 'rtmedia_hide_inspirebook_release_notice',
117
+ ), 1 );
118
+ add_action( 'wp_ajax_rtmedia_hide_social_sync_notice', array(
119
+ $this,
120
+ 'rtmedia_hide_social_sync_notice',
121
+ ), 1 );
122
+ add_action( 'wp_ajax_rtmedia_hide_pro_split_notice', array( $this, 'rtmedia_hide_pro_split_notice' ), 1 );
123
+
124
+ new RTMediaMediaSizeImporter(); // do not delete this line. We only need to create object of this class if we are in admin section
125
if ( class_exists( 'BuddyPress' ) ) {
126
+ new RTMediaActivityUpgrade();
127
}
128
add_action( 'admin_notices', array( $this, 'rtmedia_admin_notices' ) );
129
add_action( 'network_admin_notices', array( $this, 'rtmedia_network_admin_notices' ) );
130
add_action( 'admin_init', array( $this, 'rtmedia_addon_license_save_hook' ) );
131
add_action( 'admin_init', array( $this, 'rtmedia_migration' ) );
132
133
+ add_filter( 'removable_query_args', array( $this, 'removable_query_args' ), 10, 1 );
134
+
135
+ add_action( 'admin_footer', array( $this, 'rtm_admin_templates' ) );
136
+ }
137
+
138
+ function rtm_admin_templates() {
139
+ foreach ( glob( RTMEDIA_PATH . 'app/admin/templates/*.php' ) as $filename ) {
140
+ $slug = rtrim( basename( $filename ), '.php' );
141
+
142
+ echo '<script type="text/html" id="' . esc_attr( $slug ) . '">';
143
+ include $filename;
144
+ echo '</script>';
145
+ }
146
+ }
147
+
148
+ function modify_medialibrary_permalink( $action, $post ) {
149
+ $rtm_id = rtmedia_id( $post->ID );
150
+
151
+ if ( $rtm_id ) {
152
+ $link = get_rtmedia_permalink( $rtm_id );
153
+ $title = _draft_or_post_title( $post->post_parent );
154
+ $action['view'] = '<a href="' . esc_url( $link ) . '" title="' . esc_attr( sprintf( esc_html__( 'View &#8220;%s&#8221;', 'buddypress-media' ), $title ) ) . '" rel="permalink">' . esc_html__( 'View', 'buddypress-media' ) . '</a>';
155
+ }
156
+
157
+ return $action;
158
+ }
159
160
function rtmedia_migration() {
161
+ new RTMediaMigration();
162
}
163
164
function rtmedia_addon_license_save_hook() {
195
$this->rtmedia_regenerate_thumbnail_notice();
196
$this->rtmedia_addon_update_notice();
197
$this->rtmedia_update_template_notice();
198
+
199
+ if ( ! is_rtmedia_vip_plugin() ) {
200
+ $this->rtmedia_inspirebook_release_notice();
201
+ $this->rtmedia_social_sync_release_notice();
202
+
203
+ if ( ! defined( 'RTMEDIA_PRO_PATH' ) ) {
204
+ $this->rtmedia_pro_split_release_notice();
205
+ }
206
+ }
207
+ }
208
+ }
209
+
210
+ /*
211
+ * rtMedia Pro split release admin notice
212
+ */
213
+ public function rtmedia_pro_split_release_notice() {
214
+ $site_option = rtmedia_get_site_option( 'rtmedia_pro_split_release_notice' );
215
+
216
+ if ( ( ! $site_option || 'hide' !== $site_option ) ) {
217
rtmedia_update_site_option( 'rtmedia_pro_split_release_notice', 'show' );
218
?>
219
<div class="updated rtmedia-pro-split-notice">
220
<p>
221
<span>
222
+ <b><?php esc_html_e( 'rtMedia: ', 'buddypress-media' ); ?></b>
223
+ <?php esc_html_e( 'We have released 30+ premium add-ons for rtMedia plugin. Read more about it ', 'buddypress-media' ); ?>
224
+ <a href="https://rtmedia.io/blog/rtmedia-pro-splitting-major-change/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media"
225
+ target="_blank"><?php esc_html_e( 'here', 'buddypress-media' ) ?></a>.
226
</span>
227
+ <a href="#"
228
+ onclick="rtmedia_hide_pro_split_notice('<?php echo esc_js( wp_create_nonce( 'rtcamp_pro_split' ) ); ?>');"
229
+ style="float:right">Dismiss</a>
230
</p>
231
</div>
232
<script type="text/javascript">
233
+ function rtmedia_hide_pro_split_notice(nonce) {
234
+ var data = {action: 'rtmedia_hide_pro_split_notice', _rtm_nonce: nonce };
235
+ jQuery.post(ajaxurl, data, function (response) {
236
response = response.trim();
237
+
238
+ if (response === "1")
239
+ jQuery('.rtmedia-pro-split-notice').remove();
240
+ });
241
}
242
</script>
243
<?php
244
}
245
+ }
246
+
247
+ /*
248
* Hide pro split release notice
249
*/
250
251
function rtmedia_hide_pro_split_notice() {
252
+ if ( check_ajax_referer( 'rtcamp_pro_split', '_rtm_nonce' ) && rtmedia_update_site_option( 'rtmedia_pro_split_release_notice', 'hide' ) ) {
253
echo '1';
254
} else {
255
echo '0';
262
*/
263
264
function rtmedia_social_sync_release_notice() {
265
+ $site_option = rtmedia_get_site_option( 'rtmedia_social_sync_release_notice' );
266
$check_rtmedia_social_sync_installed = file_exists( trailingslashit( WP_PLUGIN_DIR ) . 'rtmedia-social-sync/index.php' );
267
268
+ if ( ( ! $site_option || 'hide' !== $site_option ) && ! $check_rtmedia_social_sync_installed ) {
269
rtmedia_update_site_option( 'rtmedia_social_sync_release_notice', 'show' );
270
?>
271
<div class="updated rtmedia-social-sync-notice">
272
<p>
273
<span>
274
+ <b><?php esc_html_e( 'rtMedia: ', 'buddypress-media' ); ?></b>
275
+ <?php esc_html_e( 'Meet ', 'buddypress-media' ); ?>
276
+ <a href="https://rtmedia.io/products/rtmedia-social-sync/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media"
277
+ target="_blank">
278
+ <b><?php esc_html_e( 'rtMedia Social Sync', 'buddypress-media' ) ?></b>
279
+ </a>
280
+ <?php esc_html_e( ' which allows you to import media from your Facebook account.', 'buddypress-media' ); ?>
281
</span>
282
+ <a href="#"
283
+ onclick="rtmedia_hide_social_sync_notice('<?php echo esc_js( wp_create_nonce( 'social_sync' ) ); ?>')"
284
+ style="float:right">Dismiss</a>
285
</p>
286
</div>
287
<script type="text/javascript">
288
+ function rtmedia_hide_social_sync_notice(nonce) {
289
+ var data = {action: 'rtmedia_hide_social_sync_notice', _rtm_nonce: nonce};
290
+ jQuery.post(ajaxurl, data, function (response) {
291
response = response.trim();
292
+ if (response === "1")
293
+ jQuery('.rtmedia-social-sync-notice').remove();
294
+ });
295
}
296
</script>
297
<?php
303
*/
304
305
function rtmedia_hide_social_sync_notice() {
306
+ if ( check_ajax_referer( 'social_sync', '_rtm_nonce' ) && rtmedia_update_site_option( 'rtmedia_social_sync_release_notice', 'hide' ) ) {
307
echo '1';
308
} else {
309
echo '0';
322
*/
323
public function rtmedia_inspirebook_release_notice() {
324
$site_option = rtmedia_get_site_option( 'rtmedia_inspirebook_release_notice' );
325
+ if ( ( ! $site_option || 'hide' !== $site_option ) && ( 'inspirebook' !== get_stylesheet() ) ) {
326
rtmedia_update_site_option( 'rtmedia_inspirebook_release_notice', 'show' );
327
?>
328
<div class="updated rtmedia-inspire-book-notice">
329
<p>
330
+ <span>
331
+ <a href="https://rtmedia.io/products/inspirebook/"
332
+ target="_blank">
333
+ <b><?php esc_html_e( 'Meet InspireBook', 'buddypress-media' ) ?></b>
334
+ </a>
335
+ <?php esc_html_e( ' - First official rtMedia premium theme.', 'buddypress-media' ); ?>
336
+ </span>
337
<a href="#" onclick="rtmedia_hide_inspirebook_notice()" style="float:right">Dismiss</a>
338
+ <?php wp_nonce_field( '_rtmedia_hide_inspirebook_notice_','rtmedia_hide_inspirebook_nonce' ); ?>
339
</p>
340
</div>
341
<script type="text/javascript">
342
function rtmedia_hide_inspirebook_notice() {
343
+ var data = {
344
+ action: 'rtmedia_hide_inspirebook_release_notice',
345
+ _rtm_nonce: jQuery('#rtmedia_hide_inspirebook_nonce').val()
346
+ };
347
+ jQuery.post(ajaxurl, data, function (response) {
348
response = response.trim();
349
+ if (response === "1")
350
+ jQuery('.rtmedia-inspire-book-notice').remove();
351
+ });
352
}
353
</script>
354
<?php
365
* @return void
366
*/
367
public function rtmedia_hide_inspirebook_release_notice() {
368
+
369
+ if ( check_ajax_referer( '_rtmedia_hide_inspirebook_notice_', '_rtm_nonce' ) && rtmedia_update_site_option( 'rtmedia_inspirebook_release_notice', 'hide' ) ) {
370
echo '1';
371
} else {
372
echo '0';
416
*/
417
public function rtmedia_permalink_notice() {
418
echo '<div class="error rtmedia-permalink-change-notice">
419
+ <p> <b>' . esc_html__( 'rtMedia:', 'buddypress-media' ) . '</b> ' . esc_html__( ' You must', 'buddypress-media' ) . ' <a href="' . esc_url( admin_url( 'options-permalink.php' ) ) . '">' . esc_html__( 'update permalink structure', 'buddypress-media' ) . '</a> ' . esc_html__( 'to something other than the default for it to work.', 'buddypress-media' ) . ' </p>
420
</div>';
421
}
422
432
public function rtmedia_addon_update_notice() {
433
434
$site_option = rtmedia_get_site_option( 'rtmedia-addon-update-notice-3_8' );
435
+ if ( is_rt_admin() && ( ! $site_option || 'hide' !== $site_option ) ) {
436
437
if ( ! $this->check_for_addon_update_notice() ) {
438
return;
439
}
440
rtmedia_update_site_option( 'rtmedia-addon-update-notice-3_8', 'show' );
441
+ ?>
442
<div class="error rtmedia-addon-upate-notice">
443
<p>
444
+ <strong><?php esc_html_e( 'rtMedia:', 'buddypress-media' ) ?></strong>
445
+ <?php esc_html_e( 'Please update all premium add-ons that you have purchased from rtCamp from', 'buddypress-media' ) ?>
446
+ <a href="https://rtmedia.io/my-account/"
447
+ target="_blank"><?php esc_html_e( 'your account', 'buddypress-media' ) ?></a>.
448
+ <a href="#" onclick="rtmedia_hide_addon_update_notice()"
449
+ style="float:right"><?php esc_html_e( 'Dismiss', 'buddypress-media' ) ?></a>
450
+ <?php wp_nonce_field( 'rtmedia-addon-update-notice-3_8', 'rtmedia-addon-notice' ); ?>
451
</p>
452
</div>
453
<script type="text/javascript">
454
function rtmedia_hide_addon_update_notice() {
455
var data = {
456
+ action: 'rtmedia_hide_addon_update_notice',
457
+ _rtm_nonce: jQuery('#rtmedia-addon-notice').val();
458
+ };
459
+ jQuery.post(ajaxurl, data, function (response) {
460
response = response.trim();
461
+ if (response === "1")
462
+ jQuery('.rtmedia-addon-upate-notice').remove();
463
+ });
464
}
465
</script>
466
+ <?php
467
}
468
}
469
482
// check for rtMedia Instagram version
483
if ( defined( 'RTMEDIA_INSTAGRAM_PATH' ) ) {
484
$plugin_info = get_plugin_data( RTMEDIA_INSTAGRAM_PATH . 'index.php' );
485
+ if ( isset( $plugin_info['Version'] ) && ( - 1 === version_compare( $plugin_info['Version'], '2.1.14' ) ) ) {
486
$return_falg = true;
487
}
488
+ } elseif ( defined( 'RTMEDIA_PHOTO_TAGGING_PATH' ) ) {
489
// check for rtMedia Photo Tagging version
490
$plugin_info = get_plugin_data( RTMEDIA_PHOTO_TAGGING_PATH . 'index.php' );
491
+ if ( isset( $plugin_info['Version'] ) && ( - 1 === version_compare( $plugin_info['Version'], '2.2.14' ) ) ) {
492
$return_falg = true;
493
}
494
+ } elseif ( defined( 'RTMEDIA_FFMPEG_PATH' ) ) {
495
// check for rtMedia FFPMEG version
496
$plugin_info = get_plugin_data( RTMEDIA_FFMPEG_PATH . 'index.php' );
497
+ if ( isset( $plugin_info['Version'] ) && ( - 1 === version_compare( $plugin_info['Version'], '2.1.14' ) ) ) {
498
$return_falg = true;
499
}
500
+ } elseif ( defined( 'RTMEDIA_KALTURA_PATH' ) ) {
501
// check for rtMedia Kaltura version
502
$plugin_info = get_plugin_data( RTMEDIA_KALTURA_PATH . 'index.php' );
503
+ if ( isset( $plugin_info['Version'] ) && ( - 1 === version_compare( $plugin_info['Version'], '3.0.16' ) ) ) {
504
$return_falg = true;
505
}
506
+ } elseif ( defined( 'RTMEDIA_PRO_PATH' ) ) {
507
// check for rtMedia Pro version
508
$plugin_info = get_plugin_data( RTMEDIA_PRO_PATH . 'index.php' );
509
+ if ( isset( $plugin_info['Version'] ) && ( - 1 === version_compare( $plugin_info['Version'], '2.6' ) ) ) {
510
$return_falg = true;
511
}
512
+ } elseif ( defined( 'RTMEDIA_SOCIAL_SYNC_PATH' ) ) {
513
// check for rtMedia Social Sync version
514
$plugin_info = get_plugin_data( RTMEDIA_SOCIAL_SYNC_PATH . 'index.php' );
515
+ if ( isset( $plugin_info['Version'] ) && ( - 1 === version_compare( $plugin_info['Version'], '1.3.1' ) ) ) {
516
$return_falg = true;
517
}
518
+ } elseif ( defined( 'RTMEDIA_MEMBERSHIP_PATH' ) ) {
519
// check for rtMedia Membership version
520
$plugin_info = get_plugin_data( RTMEDIA_MEMBERSHIP_PATH . 'index.php' );
521
+ if ( isset( $plugin_info['Version'] ) && ( - 1 === version_compare( $plugin_info['Version'], '2.1.5' ) ) ) {
522
$return_falg = true;
523
}
524
+ } elseif ( defined( 'RTMEDIA_WATERMARK_PATH' ) ) {
525
// check for rtMedia Photo Watermak version
526
$plugin_info = get_plugin_data( RTMEDIA_WATERMARK_PATH . 'index.php' );
527
+ if ( isset( $plugin_info['Version'] ) && ( - 1 === version_compare( $plugin_info['Version'], '1.1.8' ) ) ) {
528
$return_falg = true;
529
}
530
}
561
?>
562
<div class='rtmedia-admin-ad'>
563
<a href='https://rtmedia.io/products/rtmedia-pro/' target='_blank' title='rtMedia Pro'>
564
+ <img src='<?php echo esc_url( $src ); ?>' alt="<?php esc_attr_e( 'rtMedia Pro is released', 'buddypress-media' ); ?>"/>
565
</a>
566
</div>
567
<?php
582
<div class="clearfix">
583
584
<div class="rtm-column alignleft">
585
+ <h4 class="sub"><?php esc_html_e( 'Media Stats', 'buddypress-media' ); ?></h4>
586
587
<table>
588
<tbody>
589
+ <?php
590
+ $rtmedia_model = new RTMediaModel();
591
+ global $wpdb;
592
+ $results = wp_cache_get( 'rt-stats', 'rt-dashboard' );
593
+ if ( false === $results ) {
594
+ $results = $wpdb->get_results( $wpdb->prepare( "select media_type, count(id) as count from {$rtmedia_model->table_name} where blog_id=%d group by media_type", get_current_blog_id() ) ); // @codingStandardsIgnoreLine
595
+ wp_cache_set( 'stats', $results, 'rt-dashboard', HOUR_IN_SECONDS );
596
+ }
597
+ if ( $results ) {
598
+ foreach ( $results as $media ) {
599
+ if ( defined( strtoupper( 'RTMEDIA_' . $media->media_type . '_PLURAL_LABEL' ) ) ) {
600
+ ?>
601
+ <tr>
602
+ <td class="b"> <?php echo esc_html( $media->count ); ?> </td>
603
+ <td class="t"><?php echo esc_html( constant( strtoupper( 'RTMEDIA_' . $media->media_type . '_PLURAL_LABEL' ) ) ); ?></td>
604
+ </tr>
605
+ <?php
606
}
607
}
608
+ }
609
+ ?>
610
</tbody>
611
</table>
612
</div>
613
614
<div class="rtm-column alignright">
615
+ <h4 class="sub"><?php esc_html_e( 'Usage Stats', 'buddypress-media' ); ?></h4>
616
617
<table>
618
<tbody> <?php
619
+ $total_count = wp_cache_get( 'total_count', 'rt-dashboard' );
620
+ if ( false === $total_count ) {
621
+ $total_count = $wpdb->get_var( "select count(*) from {$wpdb->users}" );
622
+ wp_cache_set( 'total_count', $total_count, 'rt-dashboard', HOUR_IN_SECONDS );
623
+ }
624
+ ?>
625
+ <tr>
626
+ <td class="b"> <?php echo esc_html( $total_count ); ?> </td>
627
+ <td class="t"><?php esc_html_e( 'Total ', 'buddypress-media' ) ?></td>
628
+ </tr>
629
+ <?php
630
+ $with_media_count = wp_cache_get( 'with_media', 'rt-dashboard' );
631
+ if ( false === $with_media_count ) {
632
+ $with_media_count = $wpdb->get_var( "select count(distinct media_author) from {$rtmedia_model->table_name}" ); // @codingStandardsIgnoreLine
633
+ wp_cache_set( 'with_media', $with_media_count, 'rt-dashboard', HOUR_IN_SECONDS );
634
+ }
635
+ ?>
636
+ <tr>
637
+ <td class="b"> <?php echo esc_html( $with_media_count ); ?> </td>
638
+ <td class="t"><?php esc_html_e( 'With Media', 'buddypress-media' ) ?></td>
639
+ </tr>
640
+ <?php
641
+ $comments = wp_cache_get( 'comments', 'rt-dashboard' );
642
+ if ( false === $comments ) {
643
+ $comments = $wpdb->get_var( "select count(*) from {$wpdb->comments} where comment_post_ID in ( select media_id from {$rtmedia_model->table_name} )" ); // @codingStandardsIgnoreLine
644
+ wp_cache_set( 'comments', $comments, 'rt-dashboard', HOUR_IN_SECONDS );
645
+ }
646
+ ?>
647
+ <tr>
648
+ <td class="b"> <?php echo esc_html( $comments ); ?> </td>
649
+ <td class="t"><?php esc_html_e( 'Comments ', 'buddypress-media' ) ?></td>
650
+ </tr>
651
+ <?php
652
+ $likes = wp_cache_get( 'likes', 'rt-dashboard' );
653
+ if ( false === $likes ) {
654
+ $likes = $wpdb->get_var( "select sum(likes) from {$rtmedia_model->table_name}" ); // @codingStandardsIgnoreLine
655
+ wp_cache_set( 'likes', $likes, 'rt-dashboard', HOUR_IN_SECONDS );
656
+ }
657
+ ?>
658
+ <tr>
659
+ <td class="b"> <?php echo esc_html( $likes ); ?> </td>
660
+ <td class="t"><?php esc_html_e( 'Likes', 'buddypress-media' ) ?></td>
661
+ </tr>
662
</tbody>
663
</table>
664
</div>
667
668
<div class="rtm-meta-container">
669
<ul class="rtm-meta-links">
670
+ <li><b><?php esc_html_e( 'rtMedia Links:', 'buddypress-media' ); ?></b></li>
671
+ <li><a href="https://rtmedia.io/"><?php esc_html_e( 'Homepage', 'buddypress-media' ); ?></a></li>
672
+ <li>
673
+ <a href="<?php echo esc_url( admin_url( 'admin.php?page=rtmedia-support#rtmedia-general' ) ); ?>"><?php esc_html_e( 'Free Support', 'buddypress-media' ); ?></a>
674
+ </li>
675
+ <li>
676
+ <a href="https://rtmedia.io/products/category/rtmedia/"><?php esc_html_e( 'Premium Addons', 'buddypress-media' ); ?></a>
677
+ </li>
678
</ul>
679
</div>
680
<?php
690
* @return void
691
*/
692
public function add_dashboard_widgets() {
693
+ wp_add_dashboard_widget( 'rtmedia_dashboard_widget', esc_html__( 'Right Now in rtMedia', 'buddypress-media' ), array(
694
+ &$this,
695
+ 'rtmedia_dashboard_widget_function',
696
+ ) );
697
global $wp_meta_boxes;
698
699
// Get the regular dashboard widgets array
700
// (which has our new widget already but at the end)
701
702
+ $normal_dashboard = $wp_meta_boxes['dashboard']['normal']['core'];
703
704
// Backup and delete our new dashboard widget from the end of the array
705
706
+ $example_widget_backup = array( 'rtmedia_dashboard_widget' => $normal_dashboard['rtmedia_dashboard_widget'] );
707
+ unset( $normal_dashboard['rtmedia_dashboard_widget'] );
708
709
// Merge the two arrays together so our widget is at the beginning
710
712
713
// Save the sorted array back into the original metaboxes
714
715
+ $wp_meta_boxes['dashboard']['normal']['core'] = $sorted_dashboard;
716
}
717
718
/**
725
* @return array $links
726
*/
727
public function plugin_add_settings_link( $links ) {
728
+ $settings_link = '<a href="' . esc_url( admin_url( 'admin.php?page=rtmedia-settings' ) ) . '">' . esc_html__( 'Settings', 'buddypress-media' ) . '</a>';
729
array_push( $links, $settings_link );
730
+ $settings_link = '<a href="' . esc_url( admin_url( 'admin.php?page=rtmedia-support' ) ) . '">' . esc_html__( 'Support', 'buddypress-media' ) . '</a>';
731
array_push( $links, $settings_link );
732
733
return $links;
738
*
739
* @access public
740
*
741
+ * @param array $actions
742
* @param object $post
743
*
744
* @return array $actions
746
public function add_reencode_link( $actions, $post ) {
747
748
$mime_type_array = explode( '/', $post->post_mime_type );
749
+ if ( is_array( $mime_type_array ) && '' !== $mime_type_array && 'video' === $mime_type_array[0] ) {
750
+ $actions['reencode'] = '<a class="submitdelete" onclick="return rtmedia_regenerate_thumbs(' . esc_attr( $post->ID ) . ')" href="#">' . esc_html_e( 'Regenerate Thumbnail', 'buddypress-media' ) . '</a>';
751
}
752
753
return $actions;
763
* @return void
764
*/
765
public function bulk_action_handler() {
766
+ $action = filter_input( INPUT_GET, 'action', FILTER_SANITIZE_STRING );
767
+ $request_media = filter_input( INPUT_GET, 'media', FILTER_DEFAULT, FILTER_SANITIZE_NUMBER_INT );
768
+ if ( 'bulk_video_regenerate_thumbnails' === $action && '' !== $request_media ) {
769
+ wp_safe_redirect( esc_url_raw( add_query_arg( array( 'media_ids' => urlencode( implode( ',', $request_media ) ) ), admin_url( 'admin.php?page=rtmedia-regenerate' ) ) ) );
770
exit;
771
}
772
}
776
*
777
* @access public
778
*
779
+ * @param object $admin_bar
780
*
781
* @return void
782
*/
786
}
787
788
$admin_bar->add_menu( array(
789
+ 'id' => 'rtMedia',
790
+ 'title' => 'rtMedia',
791
+ 'href' => admin_url( 'admin.php?page=rtmedia-settings' ),
792
+ 'meta' => array(
793
+ 'title' => esc_html__( 'rtMedia', 'buddypress-media' ),
794
+ ),
795
+ )
796
);
797
$admin_bar->add_menu( array(
798
+ 'id' => 'rt-media-dashborad',
799
+ 'parent' => 'rtMedia',
800
+ 'title' => esc_html__( 'Settings', 'buddypress-media' ),
801
+ 'href' => admin_url( 'admin.php?page=rtmedia-settings' ),
802
+ 'meta' => array(
803
+ 'title' => esc_html__( 'Settings', 'buddypress-media' ),
804
+ 'target' => '_self',
805
+ ),
806
+ )
807
);
808
+ if ( ! is_rtmedia_vip_plugin() ) {
809
+ $admin_bar->add_menu( array(
810
+ 'id' => 'rt-media-addons',
811
+ 'parent' => 'rtMedia',
812
+ 'title' => esc_html__( 'Addons', 'buddypress-media' ),
813
+ 'href' => admin_url( 'admin.php?page=rtmedia-addons' ),
814
+ 'meta' => array(
815
+ 'title' => esc_html__( 'Addons', 'buddypress-media' ),
816
+ 'target' => '_self',
817
+ ),
818
)
819
+ );
820
+ }
821
$admin_bar->add_menu( array(
822
+ 'id' => 'rt-media-support',
823
+ 'parent' => 'rtMedia',
824
+ 'title' => esc_html__( 'Support', 'buddypress-media' ),
825
+ 'href' => admin_url( 'admin.php?page=rtmedia-support' ),
826
+ 'meta' => array(
827
+ 'title' => esc_html__( 'Support', 'buddypress-media' ),
828
+ 'target' => '_self',
829
+ ),
830
+ )
831
);
832
+ if ( ! is_rtmedia_vip_plugin() ) {
833
+ $admin_bar->add_menu( array(
834
+ 'id' => 'rt-media-themes',
835
+ 'parent' => 'rtMedia',
836
+ 'title' => esc_html__( 'Themes', 'buddypress-media' ),
837
+ 'href' => admin_url( 'admin.php?page=rtmedia-themes' ),
838
+ 'meta' => array(
839
+ 'title' => esc_html__( 'Themes', 'buddypress-media' ),
840
+ 'target' => '_self',
841
+ ),
842
)
843
+ );
844
+ }
845
+ if ( ! is_rtmedia_vip_plugin() ) {
846
+ $admin_bar->add_menu( array(