rtMedia for WordPress, BuddyPress and bbPress - Version 4.1.6

Version Description

Requires BuddyPress 1.7 or higher, if using BuddyPress. Added filters to alter the image/video URLS in activity. Fixed broken UI when image information is edited/updated also fixed issue related to media sorting and playlist settings not getting saved in groups.

=

Download this release

Release Info

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

Code changes from version 4.1.5 to 4.1.6

app/admin/RTMediaAdmin.php CHANGED
@@ -918,7 +918,7 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
918
 
919
  $rtmedia_admin_strings = array(
920
  'no_refresh' => esc_html__( 'Please do not refresh this page.', 'buddypress-media' ),
921
- 'something_went_wrong' => esc_html__( 'Something went wrong. Please ', 'buddypress-media' ) . '<a href onclick="location.reload();">' . esc_html__( 'refresh', 'buddypress-media' ) . '</a>' . esc_html__( ' page.', 'buddypress-media' ),
922
  'are_you_sure' => esc_html__( 'This will subscribe you to the free plan.', 'buddypress-media' ),
923
  'disable_encoding' => esc_html__( 'Are you sure you want to disable the encoding service?', 'buddypress-media' ),
924
  'enable_encoding' => esc_html__( 'Are you sure you want to enable the encoding service?', 'buddypress-media' ),
@@ -1216,9 +1216,9 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
1216
 
1217
  <div class="rtm-button-container bottom">
1218
  <div class="rtm-social-links alignleft">
1219
- <a href="http://twitter.com/rtcamp" class="twitter" target="_blank"><span
1220
  class="dashicons dashicons-twitter"></span></a>
1221
- <a href="https://www.facebook.com/rtCamp.solutions" class="facebook"
1222
  target="_blank"><span class="dashicons dashicons-facebook"></span></a>
1223
  <a href="http://profiles.wordpress.org/rtcamp" class="wordpress"
1224
  target="_blank"><span class="dashicons dashicons-wordpress"></span></a>
@@ -1718,7 +1718,7 @@ if ( ! class_exists( 'RTMediaAdmin' ) ) {
1718
  if ( ! $site_option || 'hide' !== $site_option ) {
1719
  rtmedia_update_site_option( 'rtmedia-update-template-notice-v3_9_4', 'show' );
1720
  if ( is_dir( get_template_directory() . '/rtmedia' ) ) {
1721
- echo '<div class="error rtmedia-update-template-notice"><p>' . esc_html__( '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(\''.esc_js( wp_create_nonce( 'rtmedia_template_notice' ) ).'\')" style="float:right">' . esc_html__( 'Hide', 'buddypress-media' ) . '</a></p></div>';
1722
  ?>
1723
  <script type="text/javascript">
1724
  function rtmedia_hide_template_override_notice( rtmedia_template_notice_nonce ) {
918
 
919
  $rtmedia_admin_strings = array(
920
  'no_refresh' => esc_html__( 'Please do not refresh this page.', 'buddypress-media' ),
921
+ 'something_went_wrong' => esc_html__( 'Something went wrong. Please ', 'buddypress-media' ) . '<a href onclick="location.reload();">' . esc_html__( 'refresh', 'buddypress-media' ) . '</a>' . esc_html__( ' page.', 'buddypress-media' ),
922
  'are_you_sure' => esc_html__( 'This will subscribe you to the free plan.', 'buddypress-media' ),
923
  'disable_encoding' => esc_html__( 'Are you sure you want to disable the encoding service?', 'buddypress-media' ),
924
  'enable_encoding' => esc_html__( 'Are you sure you want to enable the encoding service?', 'buddypress-media' ),
1216
 
1217
  <div class="rtm-button-container bottom">
1218
  <div class="rtm-social-links alignleft">
1219
+ <a href="http://twitter.com/rtMediaWP" class="twitter" target="_blank"><span
1220
  class="dashicons dashicons-twitter"></span></a>
1221
+ <a href="https://www.facebook.com/rtmediawp" class="facebook"
1222
  target="_blank"><span class="dashicons dashicons-facebook"></span></a>
1223
  <a href="http://profiles.wordpress.org/rtcamp" class="wordpress"
1224
  target="_blank"><span class="dashicons dashicons-wordpress"></span></a>
1718
  if ( ! $site_option || 'hide' !== $site_option ) {
1719
  rtmedia_update_site_option( 'rtmedia-update-template-notice-v3_9_4', 'show' );
1720
  if ( is_dir( get_template_directory() . '/rtmedia' ) ) {
1721
+ echo '<div class="error rtmedia-update-template-notice"><p>' . esc_html__( '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(\'' . esc_js( wp_create_nonce( 'rtmedia_template_notice' ) ) . '\')" style="float:right">' . esc_html__( 'Hide', 'buddypress-media' ) . '</a></p></div>';
1722
  ?>
1723
  <script type="text/javascript">
1724
  function rtmedia_hide_template_override_notice( rtmedia_template_notice_nonce ) {
app/assets/css/rtmedia.css CHANGED
@@ -128,6 +128,10 @@
128
  margin-bottom: 10px;
129
  }
130
 
 
 
 
 
131
  .rtmedia-container {
132
  box-sizing: border-box;
133
  }
@@ -191,6 +195,10 @@
191
  #rtmedia-uploader-form .rtm-plupload-list .rtm-upload-edit-title-wrapper label, #rtmedia-uploader-form .rtm-plupload-list .rtm-upload-edit-desc-wrapper label, #rtmedia_uploader_filelist .rtm-upload-edit-title-wrapper label, #rtmedia_uploader_filelist .rtm-upload-edit-desc-wrapper label {
192
  display: block;
193
  }
 
 
 
 
194
 
195
  .rtm-plupload-list:empty {
196
  display: none;
@@ -227,7 +235,7 @@ button#rtmedia-add-media-button-post-update .dashicons {
227
  background: #EEEEEE;
228
  position: absolute;
229
  height: 18px;
230
- right: 0;
231
  top: 0;
232
  width: 18px;
233
  z-index: 10;
@@ -242,7 +250,7 @@ button#rtmedia-add-media-button-post-update .dashicons {
242
  }
243
 
244
  .plupload_file_status {
245
- height: 8px;
246
  overflow: hidden;
247
  position: relative;
248
  }
128
  margin-bottom: 10px;
129
  }
130
 
131
+ body.media.buddypress {
132
+ overflow-y: auto;
133
+ }
134
+
135
  .rtmedia-container {
136
  box-sizing: border-box;
137
  }
195
  #rtmedia-uploader-form .rtm-plupload-list .rtm-upload-edit-title-wrapper label, #rtmedia-uploader-form .rtm-plupload-list .rtm-upload-edit-desc-wrapper label, #rtmedia_uploader_filelist .rtm-upload-edit-title-wrapper label, #rtmedia_uploader_filelist .rtm-upload-edit-desc-wrapper label {
196
  display: block;
197
  }
198
+ #rtmedia-uploader-form .rtm-plupload-list .rtm-upload-edit-title-wrapper input.rtm-upload-edit-title, #rtmedia-uploader-form .rtm-plupload-list .rtm-upload-edit-desc-wrapper input.rtm-upload-edit-title, #rtmedia_uploader_filelist .rtm-upload-edit-title-wrapper input.rtm-upload-edit-title, #rtmedia_uploader_filelist .rtm-upload-edit-desc-wrapper input.rtm-upload-edit-title {
199
+ min-width: 100%;
200
+ margin-top: 1px;
201
+ }
202
 
203
  .rtm-plupload-list:empty {
204
  display: none;
235
  background: #EEEEEE;
236
  position: absolute;
237
  height: 18px;
238
+ right: 4px;
239
  top: 0;
240
  width: 18px;
241
  z-index: 10;
250
  }
251
 
252
  .plupload_file_status {
253
+ height: 18px;
254
  overflow: hidden;
255
  position: relative;
256
  }
app/assets/css/rtmedia.min.css CHANGED
@@ -1 +1 @@
1
- .alignleft{float:left}.alignright{float:right}.aligncenter{display:block;margin-left:auto;margin-right:auto;text-align:center}.clear-both{clear:both}.clear-none{clear:none}.clear-left{clear:left}.clear-right{clear:right}.rtm-inline-block{display:inline-block}.rtm-text-left{text-align:left}.rtm-text-right{text-align:right}.rtm-text-center{text-align:center}.rtm-border-0{border:0 !important}.hide{display:none}.rtmedia-success,.rtmedia-warning{margin:10px 0;padding:8px 14px 8px 14px;text-shadow:0 1px 0 rgba(255,255,255,0.5);border-bottom:1px solid #e7e7e7;cursor:pointer}.rtmedia-success{background-color:#dff0d8;color:#468847}.rtmedia-warning{background-color:#F0D8DD;color:#884646}.clearfix:after{content:"";display:table;clear:both}#buddypress form#whats-new-form textarea{box-sizing:border-box;min-height:70px;width:100%}#buddypress #whats-new-options{height:auto !important;overflow:hidden}#buddypress form#whats-new-form p.activity-greeting{line-height:1}#buddypress form#whats-new-form #whats-new-options select{border:1px solid #ccc;font-size:13px;margin-top:0;padding:3px 2px}#whats-new-submit #aw-whats-new-submit{font-size:12px;line-height:18px;padding:4px 6px}#whats-new-post-in-box{float:left;font-size:13px}#buddypress form#whats-new-form #whats-new-submit{margin-top:0}#whats-new-textarea{margin-bottom:10px}.rtmedia-container{box-sizing:border-box}.rtmedia-container *,.rtmedia-container *:before,.rtmedia-container *:after{box-sizing:inherit}.rtmedia-list.rtmedia-list{list-style:none;margin:0;padding:0}.rtmedia-list-item>a{border:0;display:inline-block;text-decoration:none}.rtmedia-list-item>a:focus{outline:0}.rtmedia-list-item>a+p{display:none}.rtmedia-list-item>a .rtmedia-item-thumbnail img{display:inline-block}#rtmedia-uploader-form .rtm-plupload-list,#rtmedia_uploader_filelist{list-style:none;margin-left:-4px;margin-right:-4px;padding-left:0;padding-top:10px}#rtmedia-uploader-form .rtm-plupload-list li,#rtmedia_uploader_filelist li{background:#eee;float:left;margin:4px;max-width:110px;padding:5px;position:relative}#rtmedia-uploader-form .rtm-plupload-list li.upload-error,#rtmedia_uploader_filelist li.upload-error{border:1px solid red}#rtmedia-uploader-form .rtm-plupload-list img,#rtmedia_uploader_filelist img{max-width:100%}#rtmedia-uploader-form .rtm-plupload-list canvas,#rtmedia_uploader_filelist canvas{display:block;max-width:100%}#rtmedia-uploader-form .rtm-plupload-list .rtm-upload-edit-title,#rtmedia_uploader_filelist .rtm-upload-edit-title{font-size:12px}#rtmedia-uploader-form .rtm-plupload-list .rtm-upload-edit-desc,#rtmedia_uploader_filelist .rtm-upload-edit-desc{font-size:12px;display:block}#rtmedia-uploader-form .rtm-plupload-list .rtm-upload-edit-title-wrapper label,#rtmedia-uploader-form .rtm-plupload-list .rtm-upload-edit-desc-wrapper label,#rtmedia_uploader_filelist .rtm-upload-edit-title-wrapper label,#rtmedia_uploader_filelist .rtm-upload-edit-desc-wrapper label{display:block}.rtm-plupload-list:empty{display:none}.rtmedia-uploader-div,.rtmedia-uploader{clear:both}button#rtmedia-add-media-button-post-update{padding:3px 6px}button#rtmedia-add-media-button-post-update .dashicons{font-size:18px;line-height:20px}.plupload_file_name{font-size:11px;font-weight:bold;line-height:1.2;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.plupload_file_size{color:#666;font-size:10px}.plupload_file_action{background:#eee;position:absolute;height:18px;right:0;top:0;width:18px;z-index:10}.plupload_file_action .dashicons{color:#DD3D36;cursor:pointer;font-size:16px;height:18px;padding:2px 1px;width:18px}.plupload_file_status{height:8px;overflow:hidden;position:relative}.plupload_file_progress{background:#7AD03A;height:4px;position:absolute;top:0}.rtm-form .rtm-field-wrap{margin-bottom:20px}.rtmedia_next_prev{padding:0 10px}.rtm-page-number{float:left}.rtm-page-number .rtm-label{line-height:30px}.rtm-page-number .rtm-label,.rtm-page-number .rtm-go-to-num,.rtm-page-number .rtmedia-page-link{float:left}.rtm-pagination{background:transparent;border:none;color:#888;font-size:small;margin:0;position:relative;display:block;float:left;width:100%;padding:10px 0}.rtm-pagination .rtm-paginate{float:right;font-size:15px}.rtm-pagination .rtm-paginate a,.rtm-pagination .rtm-paginate span{display:inline-block;line-height:1;margin:0 2px;padding:8px;text-decoration:none}.rtm-pagination .rtm-paginate a.rtmedia-page-link{padding:8px}.rtm-pagination .dashicons{font-size:14px;height:auto;line-height:1.2;margin:0;padding:0;width:auto}#rtmedia_go_to_num{font-size:16px;margin:0 5px;padding:4px 5px;width:80px}.rtmedia-upload-not-allowed{background-color:#fcf8e3;border-bottom:1px solid #EEE;color:#c09853;margin-bottom:20px;padding:10px 15px}.plupload_file_name{position:relative}.plupload_file_name .dashicons{background:#eee;color:#DD3D36;cursor:pointer;font-size:14px;height:auto;padding:0 2px 0 5px;position:absolute;right:0;top:0;width:auto}.plupload_file_name .dashicons-yes{color:#7AD03A}.rtmedia-gallery-item-actions{background-color:rgba(0,0,0,0.6);opacity:0;position:absolute;text-align:center;-webkit-transition:all ease-in-out 0.4s;transition:all ease-in-out 0.4s;width:100%;z-index:9}.rtmedia-gallery-item-actions a{border:0;box-shadow:0 0 0;color:#fff;display:inline-block;font-size:12px;outline:none;padding:4px;text-align:left;text-decoration:none;text-transform:uppercase}.rtmedia-gallery-item-actions .dashicons{font-size:17px;margin-right:2px;position:relative;top:1px}.rtmedia-gallery-item-actions .dashicons-trash{font-size:15px}.rtm-pro-allow-action .rtmedia-list-item:hover .rtmedia-gallery-item-actions{opacity:1}.rtm-pro-allow-action .rtmedia-list-item:hover .rtmedia-bulk-edit-item-wrap+.rtmedia-gallery-item-actions{opacity:0}.rtmedia-footer-link{clear:both;overflow:hidden;padding:16px 0;position:relative;text-align:center}.rtmedia-text-link-decoration,table.rtmedia-edit-media-list tr td.rtm-edit-media-list-edit a,table.rtmedia-edit-media-list tr td.rtm-edit-media-list-edit span,table.rtmedia-edit-media-list tr td.rtm-edit-media-list-delete a,table.rtmedia-edit-media-list tr td.rtm-edit-media-list-delete span,table.rtmedia-edit-media-list tr td.rtm-edit-media-list-title a,table.rtmedia-edit-media-list tr td.rtm-edit-media-list-title span{text-decoration:none}.rtmedia-text-link-decoration:hover,table.rtmedia-edit-media-list tr td.rtm-edit-media-list-edit a:hover,table.rtmedia-edit-media-list tr td.rtm-edit-media-list-edit span:hover,table.rtmedia-edit-media-list tr td.rtm-edit-media-list-delete a:hover,table.rtmedia-edit-media-list tr td.rtm-edit-media-list-delete span:hover,table.rtmedia-edit-media-list tr td.rtm-edit-media-list-title a:hover,table.rtmedia-edit-media-list tr td.rtm-edit-media-list-title span:hover{text-decoration:underline}.rtmedia-container .rtmedia-edit-list-media-table{max-height:300px;overflow-y:auto}.rtmedia-container .rtmedia-edit-list-media-table thead tr{background-color:#50A1D7}.rtmedia-container .rtmedia-edit-list-media-table thead th{text-align:center;color:#FFF}.rtmedia-container .rtmedia-edit-list-media-table tbody tr:nth-child(odd){background:#FFF}.rtmedia-container .rtmedia-edit-list-media-table tbody tr:nth-child(even){background:#DCDCDC}table.rtmedia-edit-media-list tr{line-height:30px}table.rtmedia-edit-media-list tr th{color:#333;padding:4px 10px;line-height:20px}table.rtmedia-edit-media-list tr .rtm-edit-media-list-heading{width:44%}table.rtmedia-edit-media-list tr .rtm-edit-media-list-title-heading{width:56%}table.rtmedia-edit-media-list tr td.rtm-edit-media-list-edit,table.rtmedia-edit-media-list tr td.rtm-edit-media-list-delete,table.rtmedia-edit-media-list tr td.rtm-edit-media-list-title{padding:4px;font-size:14px;line-height:24px}table.rtmedia-edit-media-list tr td.rtm-edit-media-list-title a{text-decoration:none;color:#333}table.rtmedia-edit-media-list tr td.rtm-edit-media-list-edit{text-align:center}table.rtmedia-edit-media-list tr td.rtm-edit-media-list-edit a{color:#333;font-size:13px}table.rtmedia-edit-media-list tr td.rtm-edit-media-list-delete{text-align:center}table.rtmedia-edit-media-list tr td.rtm-edit-media-list-delete span{color:#FF0000;cursor:pointer;font-size:13px}.rtm-hide{display:none}.rtm-tabs.rtm-tabs{border-bottom:1px solid #eee;list-style:none;margin:0 0 20px;padding:0}.rtm-tabs li{border:1px solid #eee;border-bottom:0;float:left;margin:0 5px;padding:0}.rtm-tabs a{border:0;display:block;padding:5px 15px;text-decoration:none}.rtm-tabs a:focus{background:transparent;box-shadow:0 0 0}.rtm-tabs .active{position:relative}.rtm-tabs .active:after{background:#fff;bottom:-1px;content:' ';height:1px;left:0;position:absolute;width:100%}.rtm-tabs .dashicons{font-size:16px;height:auto;line-height:20px;margin-right:8px;width:auto}.rtmedia-edit-media-tabs .rtm-tabs a{border-bottom:0 none}.mfp-bg{top:0;left:0;width:100%;height:100%;z-index:104211;overflow:hidden;position:fixed;background:rgba(0,0,0,0.9)}.mfp-wrap{top:0;left:0;width:100%;height:100%;z-index:104311;position:fixed;outline:none !important;-webkit-backface-visibility:hidden}.mfp-container{text-align:center;position:absolute;width:100%;max-width:84%;margin:0 auto;right:0;height:100%;left:0;top:0;padding:0 8px;box-sizing:border-box}.mfp-container:before{content:' ';display:inline-block;height:100%;vertical-align:middle}.mfp-align-top .mfp-container:before{display:none}.mfp-content{position:relative;display:inline-block;vertical-align:middle;margin:0 auto;text-align:left;z-index:1045}.mfp-inline-holder .mfp-content,.mfp-ajax-holder .mfp-content{width:100%;cursor:auto}.mfp-ajax-cur{cursor:progress}.mfp-zoom-out-cur,.mfp-zoom-out-cur .mfp-image-holder .mfp-close{cursor:zoom-out}.mfp-zoom{cursor:pointer;cursor:zoom-in}.mfp-auto-cursor .mfp-content{cursor:auto}.mfp-close,.mfp-arrow,.mfp-preloader,.mfp-counter{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.mfp-loading.mfp-figure{display:none}.mfp-hide{display:none !important}.mfp-s-ready .mfp-preloader{display:none}.mfp-s-error .mfp-content{display:none}button.mfp-close,button.mfp-arrow{overflow:visible;cursor:pointer;background:transparent;border:0;-webkit-appearance:none;display:block;outline:none;padding:0;z-index:1046;box-shadow:none}button::-moz-focus-inner{padding:0;border:0}.mfp-close{background:#fff;color:#999;cursor:pointer;font-size:24px;font-style:normal;height:30px;line-height:30px;padding:0;position:absolute;right:1px;text-align:center;text-decoration:none;text-indent:2px;top:0;width:32px;z-index:12}.mfp-close:hover,.mfp-close:focus{opacity:1;filter:alpha(opacity=100)}.mfp-close:active{top:1px}.mfp-image-holder .mfp-close,.mfp-iframe-holder .mfp-close{color:#FFF;right:-6px;text-align:right;padding-right:6px;width:100%}.mfp-counter{position:absolute;top:0;right:0;color:#CCC;font-size:12px;line-height:18px;white-space:nowrap}.mfp-arrow{cursor:pointer;position:absolute;opacity:0.65;filter:alpha(opacity=65);margin:0;top:50%;margin-top:-55px;padding:0;width:90px;height:110px;-webkit-tap-highlight-color:transparent;opacity:0;z-index:10;-webkit-transition:all 300ms ease-out;transition:all 300ms ease-out}.rtm-single-media:hover .mfp-arrow{opacity:1}@media (max-device-width: 640px){.mfp-arrow{display:none}.rtm-single-media:hover .mfp-arrow{display:none}}.mfp-arrow:active{margin-top:-54px}.mfp-arrow:hover,.mfp-arrow:focus{opacity:1;filter:alpha(opacity=100)}.mfp-arrow:before,.mfp-arrow:after,.mfp-arrow .mfp-b,.mfp-arrow .mfp-a{content:'';display:block;width:0;height:0;position:absolute;left:0;top:0;margin-top:35px;margin-left:35px;border:medium inset transparent}.mfp-arrow:after,.mfp-arrow .mfp-a{border-top-width:13px;border-bottom-width:13px;top:8px}.mfp-arrow:before,.mfp-arrow .mfp-b{border-top-width:21px;border-bottom-width:21px;opacity:0.7}.mfp-arrow-left{left:0}.mfp-arrow-left:after,.mfp-arrow-left .mfp-a{border-right:17px solid #FFF;margin-left:31px}.mfp-arrow-left:before,.mfp-arrow-left .mfp-b{margin-left:25px;border-right:27px solid #3F3F3F}.mfp-arrow-right{right:0}.mfp-arrow-right:after,.mfp-arrow-right .mfp-a{border-left:17px solid #FFF;margin-left:39px}.mfp-arrow-right:before,.mfp-arrow-right .mfp-b{border-left:27px solid #3F3F3F}.mfp-iframe-holder{padding-top:40px;padding-bottom:40px}.mfp-iframe-holder .mfp-content{line-height:0;width:100%;max-width:900px}.mfp-iframe-holder .mfp-close{top:-40px}.mfp-iframe-scaler{width:100%;height:0;overflow:hidden;padding-top:56.25%}.mfp-iframe-scaler iframe{position:absolute;display:block;top:0;left:0;width:100%;height:100%;box-shadow:0 0 8px rgba(0,0,0,0.6);background:#000}img.mfp-img{width:auto;max-width:100%;height:auto;display:block;line-height:0;box-sizing:border-box;padding:40px 0 40px;margin:0 auto}.mfp-figure{line-height:0}.mfp-figure:after{content:'';position:absolute;left:0;top:40px;bottom:40px;display:block;right:0;width:auto;height:auto;z-index:-1;box-shadow:0 0 8px rgba(0,0,0,0.6);background:#444}.mfp-figure small{color:#BDBDBD;display:block;font-size:12px;line-height:14px}.mfp-figure figure{margin:0}.mfp-bottom-bar{margin-top:-36px;position:absolute;top:100%;left:0;width:100%;cursor:auto}.mfp-title{text-align:left;line-height:18px;color:#F3F3F3;word-wrap:break-word;padding-right:36px}.mfp-image-holder .mfp-content{max-width:100%}.mfp-gallery .mfp-image-holder .mfp-figure{cursor:pointer}.mfp-preloader{position:absolute;top:50%;left:0;right:0;margin-top:-36px;z-index:1044;font-size:0;width:36px;height:36px;margin-left:auto;margin-right:auto}.mfp-preloader:before{content:'Loading…';position:absolute;width:30px;height:30px}.mfp-preloader:not(:required):before{content:'';border-radius:50%;border:3px solid rgba(255,255,255,0.27);border-top-color:rgba(255,255,255,0.9);animation:spinner .6s linear infinite;-webkit-animation:spinner .6s linear infinite}@keyframes spinner{to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@-webkit-keyframes spinner{to{-webkit-transform:rotate(360deg)}}@media screen and (max-width: 800px) and (orientation: landscape), screen and (max-height: 300px){.mfp-img-mobile .mfp-image-holder{padding-left:0;padding-right:0}.mfp-img-mobile img.mfp-img{padding:0}.mfp-img-mobile .mfp-figure:after{top:0;bottom:0}.mfp-img-mobile .mfp-figure small{display:inline;margin-left:5px}.mfp-img-mobile .mfp-bottom-bar{background:rgba(0,0,0,0.6);bottom:0;margin:0;top:auto;padding:3px 5px;position:fixed;box-sizing:border-box}.mfp-img-mobile .mfp-bottom-bar:empty{padding:0}.mfp-img-mobile .mfp-counter{right:5px;top:3px}.mfp-img-mobile .mfp-close{top:0;right:0;width:35px;height:35px;line-height:35px;background:rgba(0,0,0,0.6);position:fixed;text-align:center;padding:0}}@media all and (max-width: 900px){.mfp-arrow{-webkit-transform:scale(0.75);-ms-transform:scale(0.75);transform:scale(0.75)}.mfp-arrow-left{-webkit-transform-origin:0;-ms-transform-origin:0;transform-origin:0}.mfp-arrow-right{-webkit-transform-origin:100%;-ms-transform-origin:100%;transform-origin:100%}.mfp-container{padding-left:6px;padding-right:6px}}.mfp-content .rtm-lightbox-container{background:#000;margin:0 auto;position:relative}.mfp-content .rtm-lightbox-container .rtmedia-media-description .allcontent{max-height:200px;overflow-y:auto;margin:5px 0}.mfp-content .rtm-single-meta{background:#fff;overflow:hidden;padding:20px 20px 110px;position:relative;vertical-align:top}.rtm-single-media{overflow:hidden;position:relative;text-align:center;vertical-align:middle}.rtm-single-media .mejs-container{margin:0 auto;max-width:inherit}.rtm-single-media .rtmedia-message-container{position:absolute;top:45%;left:0;right:0;margin-left:auto;margin-right:auto}@media (max-device-width: 640px){.rtm-single-media .rtmedia-message-container{top:25%}}.rtm-ltb-action-container{background-color:rgba(0,0,0,0.6);bottom:0;color:#fff;line-height:38px;opacity:0;padding:0 10px;position:absolute;width:100%;-webkit-transition:all 300ms ease-out;transition:all 300ms ease-out}.rtm-single-media:hover .rtm-ltb-action-container{opacity:1}@media (max-device-width: 640px){.rtm-ltb-action-container{clear:both;position:relative;opacity:1}.rtm-single-media:hover .rtm-ltb-action-container{opacity:1}}#buddypress #rtmedia-single-media-container.rtmedia-single-media .button{background:transparent;border:0 none;border-radius:2px;color:rgba(255,255,255,0.5);display:block;font-family:inherit;font-weight:normal;line-height:24px;margin:0;padding:0 6px;text-shadow:0 0 0;text-transform:none}#buddypress #rtmedia-single-media-container.rtmedia-single-media .button:hover{background:rgba(255,255,255,0.2);color:rgba(255,255,255,0.8)}#buddypress #rtmedia-single-media-container.rtmedia-single-media .rtm-options .button{color:#333;margin:0 auto;padding:0 4px 0 0}#buddypress #rtm-media-options-list .rtm-options .button{background:transparent;border:0 none;border-radius:2px;color:rgba(255,255,255,0.5);float:left;font-family:inherit;font-weight:normal;line-height:24px;padding:0 6px;text-shadow:0 0 0;text-transform:none}#buddypress #rtm-media-options-list .rtm-options .rtmedia-delete-favlist{color:#fff;padding:0}.rtm-options.rtm-options{background:#666;color:#fff;display:none;font-size:14px;list-style:none;margin:0;padding:8px 10px;position:absolute;left:0;top:38px;width:190px;z-index:10}.rtm-options li{margin:0;overflow:hidden;padding:2px 0}.rtm-media-options .rtm-options:after{bottom:100%;left:20px;border:solid transparent;content:' ';height:0;width:0;position:absolute;pointer-events:none;border-color:rgba(255,255,255,0);border-bottom-color:#666;border-width:6px;margin-left:-6px}.mfp-content .rtm-options{background:#fff;color:#333;bottom:38px;right:0;left:auto;top:auto}.mfp-content .rtm-options:after{top:100%;right:22px;border:solid transparent;content:' ';height:0;width:0;position:absolute;pointer-events:none;border-color:rgba(255,255,255,0);border-top-color:#fff;border-width:6px;margin-left:-6px}.rtm-options .dashicons{font-size:14px;line-height:24px;margin-right:2px}.rtm-media-options .rtm-options a{border:0;color:#fff;display:block;text-decoration:none}.rtm-ltb-title{color:rgba(255,255,255,0.7);float:left;font-size:13px}.rtm-ltb-title a{color:inherit}.rtm-ltb-title a:hover{border-bottom:1px dotted;color:#fff}.rtm-item-actions{float:right}.rtm-item-actions>div,.rtm-item-actions>form{float:left;margin:0 2px;padding:7px 0;position:relative}.rtmedia-media img{display:inline-block;max-height:inherit;height:auto;max-width:100%;width:auto}@media only screen and (max-device-width: 1024px){.rtmedia-media{margin:40px 0}}.rtm-user-meta-details .username{font-size:16px;line-height:1;margin-bottom:6px}.userprofile{float:left;margin:0 16px 16px 0;max-width:54px}.userprofile a{display:block}.userprofile img{height:auto;max-width:100%}.rtm-time-privacy{color:#999;font-size:12px}.rtm-time-privacy .dashicons{font-size:14px;line-height:1.5}.rtmedia-actions-before-comments>span{float:left;margin-right:10px}.rtmedia-actions-before-comments .rtmedia-comment-link,#buddypress .rtmedia-actions-before-comments .rtmedia-like{border:0;font-size:13px;font-weight:normal;line-height:2;padding:0;text-transform:none}.rtmedia-actions-before-comments .rtmedia-comment-link:hover,#buddypress .rtmedia-actions-before-comments .rtmedia-like:hover{background:transparent}.rtmedia-comment-user-pic{float:left;margin-right:10px;max-width:36px}.rtmedia-comment-user-pic img{height:auto;max-width:100%}.rtm-like-comments-info{position:relative}.rtm-like-comments-info:after{bottom:100%;left:15px;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none;border-color:rgba(237,239,244,0);border-bottom-color:#edeff4;border-width:4px;margin-left:-4px}.rtm-comment-list.rtm-comment-list{list-style:none;margin:0;padding:0}.rtm-comment-list li{background:#edeff4;font-size:12px;margin-bottom:1px;padding:10px;position:relative}.rtm-comment-list li:hover .rtmedia-delete-comment{opacity:1}.rtm-comment-list .rtmedia-no-comments{margin:0;padding:5px 10px}.rtmedia-like-info{background:#edeff4;font-size:12px;margin-bottom:1px;padding:5px 10px;position:relative}.rtm-comment-wrap{overflow:hidden}.rtm-comment-wrap .rtmedia-comment-author{font-weight:700}.rtm-comment-wrap .rtmedia-comment-date{color:#999;font-size:11px}.rtmedia-comment-content{margin-top:2px}.rtmedia-delete-comment{color:#999;cursor:pointer;font-size:16px;opacity:0;position:absolute;right:5px;top:5px}.rtmedia-comment-content p{margin:0}.rtmedia-comment-details{line-height:1.5;margin-top:-3px}.rtmedia-item-comments textarea{font-size:14px;padding:4px}.rtm-media-single-comments{background-color:#edeff4;bottom:20px;padding:10px;position:absolute;width:-webkit-calc(100% - 40px);width:calc(100% - 40px)}.rtm-media-single-comments textarea{font-size:12px;line-height:14px;max-height:40px;min-height:30px;padding:4px}.rtmedia-popup{background:#fff;margin:20px auto;max-width:600px;padding:20px;position:relative;width:auto}.rtmedia-popup .rtm-modal-title{font-size:24px;margin-bottom:20px;margin-top:0}.rtmedia-popup label{display:block;margin-bottom:5px}#rtm-modal-container p{margin-bottom:10px}#rtm-mejs-video-container{margin:0 auto}.rtmedia-media-name{float:left;max-width:140px;overflow:hidden;text-align:left;text-overflow:ellipsis;white-space:nowrap}.rtm-single-media.rtm-media-type-video{padding-bottom:40px;padding-top:40px}.rtmedia-gallery-alert-container{position:fixed;top:0;left:0;height:100%;width:100%;background-color:rgba(0,0,0,0.6);z-index:999997}.rtmedia-gallery-message-box{position:fixed;top:40%;left:50%;margin-left:auto;margin-right:auto;z-index:999999}.rtmedia-gallery-message-box span{position:relative;left:-50%}.rtmedia-activity-container{box-sizing:border-box}.rtmedia-activity-container *,.rtmedia-activity-container *:before,.rtmedia-activity-container *:after{box-sizing:inherit}#buddypress ul.rtmedia-list li{border-bottom:0;padding-bottom:0}.rtmedia-activity-container .rtmedia-item-actions{display:none}.rtmedia-activity-container .rtmedia-item-title,.rtmedia-activity-container .rtmedia-item-title a{border:0;color:#666;font-size:13px;margin:5px 0 0;overflow:hidden;text-align:center;text-overflow:ellipsis;white-space:nowrap}#rtmedia-whts-new-upload-container div{left:0 !important;position:absolute;top:0 !important}#aw-whats-new-submit,.rtmedia-add-media-button{display:block}.rtm-drag-drop-active{border:4px dashed green !important;display:block;height:100%;opacity:0.5;z-index:9999}#rtm-drop-files-title{background:rgba(0,0,0,0.2);display:none;font-size:14px;height:100%;padding:20px;position:absolute;top:0;width:100%}#rtSelectPrivacy{float:right}.rtmedia-plupload-container{position:relative;float:left}.rtm-upload-button-wrapper{float:left;margin-right:5px}#rtmedia-action-update{margin-right:10px}.rtmedia-list-item.media-type-document,.rtmedia-list-item.media-type-music,.rtmedia-list-item.media-type-video{display:inline-block}.media-type-music .mejs-container{margin-bottom:10px}.rtmedia-album-edit .rtm-checkbox-wrap{background:rgba(255,255,255,0.9);height:30px;line-height:1;padding:10px;position:absolute;z-index:10}.rtmedia-album-edit .rtmedia-item-selector{position:relative;top:-7px}.rtmedia-album-edit .rtmedia-move-container{display:none}.rtm-single-actions.rtm-item-actions{float:none}.media-item .describe{border-collapse:collapse;width:100%;border-top-style:solid;border-top-width:1px;clear:both;cursor:default}.media-item.media-blank .describe{border:0}.media-item .describe th{vertical-align:top;text-align:left;padding:5px 10px 10px;width:140px}.media-item .describe .align th{padding-top:0}.media-item .media-item-info tr{background-color:transparent}.media-item .describe td{padding:0 8px 8px 0;vertical-align:top}.media-item thead.media-item-info td{padding:4px 10px 0}.media-item .media-item-info .A1B1{padding:0 0 0 10px}.media-item td.savesend{padding-bottom:15px}.media-item .thumbnail{max-height:128px;max-width:128px}#wpbody-content #async-upload-wrap a{display:none}.media-upload-form{margin-top:20px}.media-upload-form td label{margin-right:6px;margin-left:2px}.media-upload-form .align .field label{display:inline;padding:0 0 0 23px;margin:0 1em 0 3px;font-weight:bold}.media-upload-form tr.image-size label{margin:0 0 0 5px;font-weight:bold}.media-upload-form th.label label{font-weight:bold;margin:0.5em;font-size:13px}.media-upload-form th.label label span{padding:0 5px}abbr.required{border:medium none;text-decoration:none}.media-item .describe input[type="text"],.media-item .describe textarea{width:460px}.media-item .describe p.help{margin:0;padding:0 0 0 5px}.media-item .edit-attachment,.describe-toggle-on,.describe-toggle-off{display:block;line-height:36px;float:right;margin-right:15px}.media-item .describe-toggle-off,.media-item.open .describe-toggle-on{display:none}.media-item.open .describe-toggle-off{display:block}#media-items .media-item{border-style:solid;border-width:1px;min-height:36px;position:relative;margin-top:-1px;width:100%}#media-items{width:623px}.media-new-php #media-items{margin:1em 0}#media-items:empty{border:0 none}.media-item .filename{line-height:36px;overflow:hidden;padding:0 10px}.media-item .error-div{padding-left:10px}.media-item .pinkynail{float:left;margin:2px 2px 0;max-width:40px;max-height:32px}.media-item .startopen,.media-item .startclosed{display:none}.media-item .original{position:relative;height:34px}.media-item .progress{float:right;height:22px;margin:6px 10px 0 0;width:200px;line-height:2em;padding:0;overflow:hidden;margin-bottom:2px;border:1px solid #d1d1d1;background:#f7f7f7;background-image:-webkit-gradient(linear, left bottom, left top, from(#fff), to(#f7f7f7));background-image:-webkit-linear-gradient(bottom, #fff, #f7f7f7);background-image:linear-gradient(to top, #fff, #f7f7f7);border-radius:3px;box-shadow:inset 0 0 3px rgba(0,0,0,0.1)}.media-item .bar{z-index:9;width:0;height:100%;margin-top:-24px;background-color:#8cc1e9;background-image:-webkit-gradient(linear, left bottom, left top, from(#72a7cf), to(#8cc1e9));background-image:-webkit-linear-gradient(bottom, #72a7cf, #8cc1e9);background-image:linear-gradient(to top, #72a7cf, #8cc1e9);border-radius:3px;box-shadow:0 0 3px rgba(0,0,0,0.3)}.media-item .progress .percent{z-index:10;position:relative;width:200px;padding:0 8px;text-shadow:0 1px 0 rgba(255,255,255,0.4);color:rgba(0,0,0,0.6)}.upload-php .fixed .column-parent{width:15%}.js .html-uploader #plupload-upload-ui{display:none}.js .html-uploader #html-upload-ui{display:block}.media-upload-form .media-item.error{margin:0;padding:0}.media-upload-form .media-item.error p,.media-item .error-div{line-height:16px;margin:5px 10px;padding:0}.media-item .error-div a.dismiss{display:block;float:right;margin:5px 4px 0 15px}.find-box{width:600px;height:300px;overflow:hidden;padding:33px 0 51px;position:absolute;z-index:1000}.find-box-head{cursor:move;font-weight:bold;height:2em;line-height:2em;padding:1px 12px;position:absolute;top:5px;width:100%}.find-box-inside{overflow:auto;padding:6px;height:100%}.find-box-search{overflow:hidden;padding:9px;position:relative}.find-box-search .spinner{float:none;left:125px;position:absolute;top:9px}#find-posts-input{float:left;width:140px;height:24px}#find-posts-search{float:left;margin:1px 4px 0 3px}#find-posts-response{margin:8px 0;padding:0 1px 6px}#find-posts-response table{width:100%}#find-posts-response .found-radio{padding:3px 0 0 8px;width:15px}.find-box-buttons{padding:8px;overflow:hidden}.find-box #resize-se{position:absolute;right:1px;bottom:1px}.ui-find-overlay{position:absolute;top:0;left:0;background-color:#000;opacity:0.6;filter:alpha(opacity=60)}ul#dismissed-updates{display:none}form.upgrade{margin-top:8px}form.upgrade .hint{font-style:italic;font-size:85%;margin:-0.5em 0 2em 0}#poststuff .inside .the-tagcloud{margin:5px 0 10px;padding:8px;border-width:1px;border-style:solid;line-height:1.8em;word-spacing:3px;border-radius:6px}.drag-drop #drag-drop-area{border:4px dashed #DDDDDD;height:200px}.drag-drop .drag-drop-inside{margin:70px auto 0;width:250px}.drag-drop-inside p{color:#aaa;font-size:14px;margin:5px 0;display:none}.drag-drop .drag-drop-inside p{text-align:center}.drag-drop-inside p.drag-drop-info{font-size:20px}.drag-drop .drag-drop-inside p,.drag-drop-inside p.drag-drop-buttons{display:block}.drag-drop.drag-over #drag-drop-area{border-color:#83b4d8}#plupload-upload-ui{position:relative}.describe .image-editor{vertical-align:top}.imgedit-wrap{position:relative}.imgedit-settings p{margin:8px 0}.post-php .imgedit-wrap table{width:100%}.describe .imgedit-wrap table td,.wp_attachment_holder .imgedit-wrap table td{vertical-align:top;padding-top:0}.describe .imgedit-wrap table td.imgedit-settings{padding:0 5px}.wp_attachment_holder .imgedit-wrap table td.imgedit-settings{width:250px}td.imgedit-settings input{margin-top:0;vertical-align:middle}.imgedit-wait{position:absolute;top:0;background:#fff url(../../../../../../wp-admin/images/wpspin_light.gif) no-repeat scroll 22px 10px;background-size:16px 16px;opacity:0.7;filter:alpha(opacity=70);width:100%;height:500px;display:none}.spinner{background:url(../../../../../../wp-admin/images/wpspin_light.gif) no-repeat;background-size:16px 16px;display:none;float:right;opacity:0.7;filter:alpha(opacity=70);width:16px;height:16px;margin:5px 5px 0}.no-float{float:none}.media-disabled,.imgedit-settings .disabled{color:grey}.wp_attachment_image,.A1B1{overflow:hidden}.wp_attachment_image .button,.A1B1 .button{float:left}.no-js .wp_attachment_image .button{display:none}.wp_attachment_image .spinner,.A1B1 .spinner{float:left;padding:0 4px 4px;vertical-align:bottom}.imgedit-menu{margin:0 0 12px;min-width:300px}.imgedit-menu div{float:left;width:32px;height:32px}.imgedit-crop-wrap{position:relative}.imgedit-crop{background:transparent url("../../../../../../wp-admin/images/imgedit-icons.png") no-repeat scroll -9px -31px;margin:0 8px 0 0}.imgedit-crop.disabled:hover{background-position:-9px -31px}.imgedit-crop:hover{background-position:-9px -1px}.imgedit-rleft{background:transparent url("../../../../../../wp-admin/images/imgedit-icons.png") no-repeat scroll -46px -31px;margin:0 3px}.imgedit-rleft.disabled:hover{background-position:-46px -31px}.imgedit-rleft:hover{background-position:-46px -1px}.imgedit-rright{background:transparent url("../../../../../../wp-admin/images/imgedit-icons.png") no-repeat scroll -77px -31px;margin:0 8px 0 3px}.imgedit-rright.disabled:hover{background-position:-77px -31px}.imgedit-rright:hover{background-position:-77px -1px}.imgedit-flipv{background:transparent url("../../../../../../wp-admin/images/imgedit-icons.png") no-repeat scroll -115px -31px;margin:0 3px}.imgedit-flipv.disabled:hover{background-position:-115px -31px}.imgedit-flipv:hover{background-position:-115px -1px}.imgedit-fliph{background:transparent url("../../../../../../wp-admin/images/imgedit-icons.png") no-repeat scroll -147px -31px;margin:0 8px 0 3px}.imgedit-fliph.disabled:hover{background-position:-147px -31px}.imgedit-fliph:hover{background-position:-147px -1px}.imgedit-undo{background:transparent url("../../../../../../wp-admin/images/imgedit-icons.png") no-repeat scroll -184px -31px;margin:0 3px}.imgedit-undo.disabled:hover{background-position:-184px -31px}.imgedit-undo:hover{background-position:-184px -1px}.imgedit-redo{background:transparent url("../../../../../../wp-admin/images/imgedit-icons.png") no-repeat scroll -215px -31px;margin:0 8px 0 3px}.imgedit-redo.disabled:hover{background-position:-215px -31px}.imgedit-redo:hover{background-position:-215px -1px}.imgedit-applyto img{margin:0 8px 0 0}.imgedit-group h3{font-size:18px}.imgedit-group .dashicons{border:0;line-height:1.2}.imgedit-group-top{margin:5px 0}.imgedit-applyto .imgedit-label{padding:2px 0 0;display:block}.imgedit-help{display:none;font-style:italic;margin-bottom:8px}a.imgedit-help-toggle{text-decoration:none}.form-table td.imgedit-response{padding:0}.imgedit-submit{margin:8px 0}.imgedit-submit-btn{margin-left:20px}.imgedit-wrap .nowrap{white-space:nowrap}span.imgedit-scale-warn{color:red;font-size:20px;font-style:normal;visibility:hidden;vertical-align:middle}.wp_attachment_details{margin-bottom:20px}.imgedit-menu div{border-color:#d5d5d5;background-color:#f1f1f1}.imgedit-menu div:hover{border-color:#c1c1c1;background-color:#eaeaea}.imgedit-menu div.disabled{border-color:#ccc;background-color:#ddd;filter:alpha(opacity=50);opacity:0.5}.bp-media-image-editor-cotnainer{margin-top:35px}.wp_attachment_image .bp-media-image-edit{float:left}.wp_attachment_image .spinner{display:none}.bp-media-image-editor-cotnainer .hidden{display:none}.bp-media-image-editor-cotnainer div.updated{margin:5px 0 15px;background-color:#ffffe0;border-color:#e6db55;padding:0 .6em;border-radius:3px;border-width:1px;border-style:solid}.bp-media-image-editor-cotnainer div.updated p{margin:.5em 0;padding:2px}body article.bp_members.bp_member .entry-content,body div.bp_members.bp_member .entry-content{width:100%}.rtm-media-gallery-uploader{display:none}.rtmedia-uploader .drag-drop{border:4px dashed #DDD;text-align:center;background:#fafafa;overflow:hidden;color:#AAAAAA;margin-top:20px;padding:25px 0}.rtmedia-uploader .drag-drop.dragover{border-color:#83b4d8}.rtmedia-uploader .drag-drop .drag-drop-info{font-size:20px;line-height:24px}.rtmedia-uploader .drag-drop .rtm-select-files span{vertical-align:middle}.rtmedia-uploader .drag-drop .rtm-seperator{margin:0px 20px}.rtmedia-uploader .drag-drop .start-media-upload{display:none;margin-top:20px}.rtmedia-uploader .drag-drop .rtm-file-size-limit{vertical-align:middle;font-size:16px;line-height:24px}.rtm-uploader-main-wrapper .rtm-uploader-tabs{margin-bottom:10px;text-align:left}.rtm-uploader-main-wrapper ul{border-bottom:1px solid #CCC}.rtm-uploader-main-wrapper li{margin:0 0 -1px 10px;display:inline-block;padding:5px 10px;line-height:25px;background-color:#e4e4e4;border:1px solid #CCC}.rtm-uploader-main-wrapper li.active{background:transparent;border-left:1px solid #CCC;border-top:1px solid #CCC;border-right:1px solid #CCC;border-bottom:1px solid #fafafa}.rtm-uploader-main-wrapper li:hover{cursor:pointer}.rtmedia-container .rtmedia-list{margin:10px -5px}.rtmedia-container .rtmedia-list .rtmedia-list-item{float:left;margin:5px;position:relative}.rtmedia-container .rtmedia-list .rtmedia-list-item>a{display:block}.rtmedia-container .rtmedia-list .rtmedia_time{background-color:#000;color:#fff;display:inline-block;font-size:11px;font-weight:bold;line-height:14px;opacity:0.75;padding:0 4px;position:absolute;right:2px;top:2px}.rtmedia-container .rtmedia-list img{vertical-align:top}.rtmedia-container .rtmedia-list .rtmedia-item-title h4{color:#666;font-size:12px;font-weight:normal;margin:5px 0 0;overflow:hidden;text-align:center;text-overflow:ellipsis;white-space:nowrap}.rtm-load-more{background:#eee;text-align:center}.rtmedia-container .rtm-load-more a{border:0;padding:10px 0}.rtm-load-more .rtm-media-loading{padding:10px 0}.rtm-media-options{line-height:1.4;margin-bottom:10px}.rtm-media-options>div{display:inline-block;cursor:pointer}.rtm-media-options .rtm-media-options-list{margin-right:5px;padding-right:10px;position:relative}.rtm-media-options>*{border-right:1px solid #999}.rtm-media-options>*:last-child{border-right:none}.rtm-media-options .dashicons{font-size:inherit;line-height:1.4}.rtmedia-upload-media-link{cursor:pointer}a.rtmedia-upload-media-link{border:none}.rtm-album-privacy span{font-size:16px;display:inline-block;margin:0 20px 20px 20px;vertical-align:top}.rtm-album-privacy label{margin-right:8px}.rtm-album-privacy .dashicons{font-size:16px;line-height:1.6;margin-right:5px}#rtm-media-options-list .rtmedia-delete-album{background:transparent;border:0;color:#fff;font-family:inherit;font-size:inherit;font-weight:inherit;padding:0;text-transform:inherit}#rtm-media-options-list .rtmedia-delete-album:hover{background:transparent;border:0;color:#fff}.rtmedia-single-container button.rtmedia-like{background-color:transparent;color:inherit}#buddypress .mejs-controls button{padding:4px 8px;border:none;background:transparent url("../../../lib/media-element/controls.png") no-repeat}#buddypress .mejs-controls .mejs-play button{background-position:0 0}#buddypress .mejs-controls .mejs-pause button{background-position:0 -16px}#buddypress .mejs-controls .mejs-unmute button{background-position:-16px 0}#buddypress .mejs-controls .mejs-mute button{background-position:-16px -16px}#buddypress .mejs-controls .mejs-fullscreen-button button{background-position:-32px 0}#buddypress .mejs-controls .mejs-unfullscreen button{background-position:-32px -16px}.mejs-container .mejs-controls .mejs-time{padding:10px 3px 0;content:''}.rtmedia-activity-container .mejs-playpause-button.mejs-play button:before,.rtmedia-activity-container .mejs-playpause-button.mejs-pause button:before,.rtmedia-activity-container .mejs-volume-button.mejs-mute button:before,.rtmedia-activity-container .mejs-fullscreen-button button:before,.rtmedia-media .mejs-playpause-button.mejs-play button:before,.rtmedia-media .mejs-playpause-button.mejs-pause button:before,.rtmedia-media .mejs-volume-button.mejs-mute button:before,.rtmedia-media .mejs-fullscreen-button button:before{content:''}@media only screen and (min-width: 1025px){.mfp-content .rtm-lightbox-container{display:table;table-layout:fixed;width:100%}.mfp-content .rtm-single-media{display:table-cell;width:66.6667%}.mfp-content .rtm-single-meta{display:table-cell;width:33.3333%}.mfp-content .rtmedia-item-comments{max-height:330px;overflow-x:hidden;overflow-y:auto}}.rtl #rtSelectPrivacy{float:left}.rtl .rtmedia-plupload-container{float:right}.rtl .rtm-upload-button-wrapper{float:right}.rtl #whats-new-post-in-box{float:right}.rtl .describe-toggle-off{float:left}.rtl .media-item .pinkynail{float:right}.rtl .media-item .progress{float:left}.rtl .media-item .error-div a.dismiss{float:left}.rtl #find-posts-input{float:right}.rtl #find-posts-search{float:right}.rtl .spinner{float:left}.rtl .wp_attachment_image .button,.rtl .A1B1 .button{float:right}.rtl .wp_attachment_image .spinner,.rtl .A1B1 .spinner{float:right}.rtl .imgedit-menu div{float:right}.rtl .wp_attachment_image .bp-media-image-edit{float:right}.rtl .rtmedia-container .rtmedia-list .rtmedia-list-item{float:right}.rtl #buddypress #rtm-media-options-list .rtm-options .button{float:right}.rtl .rtm-ltb-title{float:right}.rtl .rtm-item-actions{float:left}.rtl .rtm-item-actions>div,.rtl .rtm-item-actions>form{float:right}.rtl .userprofile{float:right}.rtl .rtmedia-actions-before-comments>span{float:right}.rtl .rtmedia-comment-user-pic{float:right}.rtl .rtmedia-media-name{float:right}.rtl #rtmedia-uploader-form .rtm-plupload-list li,.rtl #rtmedia_uploader_filelist li{float:right}.rtl .rtm-page-number{float:right}.rtl .rtm-page-number .rtmedia-page-link{float:right}.rtl .rtm-pagination{float:right}.rtl .rtm-pagination .rtm-paginate{float:left}.rtl .rtm-tabs li{float:right}.rtl .alignleft{float:right}.rtl .alignright{float:left}
1
+ .alignleft{float:left}.alignright{float:right}.aligncenter{display:block;margin-left:auto;margin-right:auto;text-align:center}.clear-both{clear:both}.clear-none{clear:none}.clear-left{clear:left}.clear-right{clear:right}.rtm-inline-block{display:inline-block}.rtm-text-left{text-align:left}.rtm-text-right{text-align:right}.rtm-text-center{text-align:center}.rtm-border-0{border:0 !important}.hide{display:none}.rtmedia-success,.rtmedia-warning{margin:10px 0;padding:8px 14px 8px 14px;text-shadow:0 1px 0 rgba(255,255,255,0.5);border-bottom:1px solid #e7e7e7;cursor:pointer}.rtmedia-success{background-color:#dff0d8;color:#468847}.rtmedia-warning{background-color:#F0D8DD;color:#884646}.clearfix:after{content:"";display:table;clear:both}#buddypress form#whats-new-form textarea{box-sizing:border-box;min-height:70px;width:100%}#buddypress #whats-new-options{height:auto !important;overflow:hidden}#buddypress form#whats-new-form p.activity-greeting{line-height:1}#buddypress form#whats-new-form #whats-new-options select{border:1px solid #ccc;font-size:13px;margin-top:0;padding:3px 2px}#whats-new-submit #aw-whats-new-submit{font-size:12px;line-height:18px;padding:4px 6px}#whats-new-post-in-box{float:left;font-size:13px}#buddypress form#whats-new-form #whats-new-submit{margin-top:0}#whats-new-textarea{margin-bottom:10px}body.media.buddypress{overflow-y:auto}.rtmedia-container{box-sizing:border-box}.rtmedia-container *,.rtmedia-container *:before,.rtmedia-container *:after{box-sizing:inherit}.rtmedia-list.rtmedia-list{list-style:none;margin:0;padding:0}.rtmedia-list-item>a{border:0;display:inline-block;text-decoration:none}.rtmedia-list-item>a:focus{outline:0}.rtmedia-list-item>a+p{display:none}.rtmedia-list-item>a .rtmedia-item-thumbnail img{display:inline-block}#rtmedia-uploader-form .rtm-plupload-list,#rtmedia_uploader_filelist{list-style:none;margin-left:-4px;margin-right:-4px;padding-left:0;padding-top:10px}#rtmedia-uploader-form .rtm-plupload-list li,#rtmedia_uploader_filelist li{background:#eee;float:left;margin:4px;max-width:110px;padding:5px;position:relative}#rtmedia-uploader-form .rtm-plupload-list li.upload-error,#rtmedia_uploader_filelist li.upload-error{border:1px solid red}#rtmedia-uploader-form .rtm-plupload-list img,#rtmedia_uploader_filelist img{max-width:100%}#rtmedia-uploader-form .rtm-plupload-list canvas,#rtmedia_uploader_filelist canvas{display:block;max-width:100%}#rtmedia-uploader-form .rtm-plupload-list .rtm-upload-edit-title,#rtmedia_uploader_filelist .rtm-upload-edit-title{font-size:12px}#rtmedia-uploader-form .rtm-plupload-list .rtm-upload-edit-desc,#rtmedia_uploader_filelist .rtm-upload-edit-desc{font-size:12px;display:block}#rtmedia-uploader-form .rtm-plupload-list .rtm-upload-edit-title-wrapper label,#rtmedia-uploader-form .rtm-plupload-list .rtm-upload-edit-desc-wrapper label,#rtmedia_uploader_filelist .rtm-upload-edit-title-wrapper label,#rtmedia_uploader_filelist .rtm-upload-edit-desc-wrapper label{display:block}#rtmedia-uploader-form .rtm-plupload-list .rtm-upload-edit-title-wrapper input.rtm-upload-edit-title,#rtmedia-uploader-form .rtm-plupload-list .rtm-upload-edit-desc-wrapper input.rtm-upload-edit-title,#rtmedia_uploader_filelist .rtm-upload-edit-title-wrapper input.rtm-upload-edit-title,#rtmedia_uploader_filelist .rtm-upload-edit-desc-wrapper input.rtm-upload-edit-title{min-width:100%;margin-top:1px}.rtm-plupload-list:empty{display:none}.rtmedia-uploader-div,.rtmedia-uploader{clear:both}button#rtmedia-add-media-button-post-update{padding:3px 6px}button#rtmedia-add-media-button-post-update .dashicons{font-size:18px;line-height:20px}.plupload_file_name{font-size:11px;font-weight:bold;line-height:1.2;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.plupload_file_size{color:#666;font-size:10px}.plupload_file_action{background:#eee;position:absolute;height:18px;right:4px;top:0;width:18px;z-index:10}.plupload_file_action .dashicons{color:#DD3D36;cursor:pointer;font-size:16px;height:18px;padding:2px 1px;width:18px}.plupload_file_status{height:18px;overflow:hidden;position:relative}.plupload_file_progress{background:#7AD03A;height:4px;position:absolute;top:0}.rtm-form .rtm-field-wrap{margin-bottom:20px}.rtmedia_next_prev{padding:0 10px}.rtm-page-number{float:left}.rtm-page-number .rtm-label{line-height:30px}.rtm-page-number .rtm-label,.rtm-page-number .rtm-go-to-num,.rtm-page-number .rtmedia-page-link{float:left}.rtm-pagination{background:transparent;border:none;color:#888;font-size:small;margin:0;position:relative;display:block;float:left;width:100%;padding:10px 0}.rtm-pagination .rtm-paginate{float:right;font-size:15px}.rtm-pagination .rtm-paginate a,.rtm-pagination .rtm-paginate span{display:inline-block;line-height:1;margin:0 2px;padding:8px;text-decoration:none}.rtm-pagination .rtm-paginate a.rtmedia-page-link{padding:8px}.rtm-pagination .dashicons{font-size:14px;height:auto;line-height:1.2;margin:0;padding:0;width:auto}#rtmedia_go_to_num{font-size:16px;margin:0 5px;padding:4px 5px;width:80px}.rtmedia-upload-not-allowed{background-color:#fcf8e3;border-bottom:1px solid #EEE;color:#c09853;margin-bottom:20px;padding:10px 15px}.plupload_file_name{position:relative}.plupload_file_name .dashicons{background:#eee;color:#DD3D36;cursor:pointer;font-size:14px;height:auto;padding:0 2px 0 5px;position:absolute;right:0;top:0;width:auto}.plupload_file_name .dashicons-yes{color:#7AD03A}.rtmedia-gallery-item-actions{background-color:rgba(0,0,0,0.6);opacity:0;position:absolute;text-align:center;-webkit-transition:all ease-in-out 0.4s;transition:all ease-in-out 0.4s;width:100%;z-index:9}.rtmedia-gallery-item-actions a{border:0;box-shadow:0 0 0;color:#fff;display:inline-block;font-size:12px;outline:none;padding:4px;text-align:left;text-decoration:none;text-transform:uppercase}.rtmedia-gallery-item-actions .dashicons{font-size:17px;margin-right:2px;position:relative;top:1px}.rtmedia-gallery-item-actions .dashicons-trash{font-size:15px}.rtm-pro-allow-action .rtmedia-list-item:hover .rtmedia-gallery-item-actions{opacity:1}.rtm-pro-allow-action .rtmedia-list-item:hover .rtmedia-bulk-edit-item-wrap+.rtmedia-gallery-item-actions{opacity:0}.rtmedia-footer-link{clear:both;overflow:hidden;padding:16px 0;position:relative;text-align:center}.rtmedia-text-link-decoration,table.rtmedia-edit-media-list tr td.rtm-edit-media-list-edit a,table.rtmedia-edit-media-list tr td.rtm-edit-media-list-edit span,table.rtmedia-edit-media-list tr td.rtm-edit-media-list-delete a,table.rtmedia-edit-media-list tr td.rtm-edit-media-list-delete span,table.rtmedia-edit-media-list tr td.rtm-edit-media-list-title a,table.rtmedia-edit-media-list tr td.rtm-edit-media-list-title span{text-decoration:none}.rtmedia-text-link-decoration:hover,table.rtmedia-edit-media-list tr td.rtm-edit-media-list-edit a:hover,table.rtmedia-edit-media-list tr td.rtm-edit-media-list-edit span:hover,table.rtmedia-edit-media-list tr td.rtm-edit-media-list-delete a:hover,table.rtmedia-edit-media-list tr td.rtm-edit-media-list-delete span:hover,table.rtmedia-edit-media-list tr td.rtm-edit-media-list-title a:hover,table.rtmedia-edit-media-list tr td.rtm-edit-media-list-title span:hover{text-decoration:underline}.rtmedia-container .rtmedia-edit-list-media-table{max-height:300px;overflow-y:auto}.rtmedia-container .rtmedia-edit-list-media-table thead tr{background-color:#50A1D7}.rtmedia-container .rtmedia-edit-list-media-table thead th{text-align:center;color:#FFF}.rtmedia-container .rtmedia-edit-list-media-table tbody tr:nth-child(odd){background:#FFF}.rtmedia-container .rtmedia-edit-list-media-table tbody tr:nth-child(even){background:#DCDCDC}table.rtmedia-edit-media-list tr{line-height:30px}table.rtmedia-edit-media-list tr th{color:#333;padding:4px 10px;line-height:20px}table.rtmedia-edit-media-list tr .rtm-edit-media-list-heading{width:44%}table.rtmedia-edit-media-list tr .rtm-edit-media-list-title-heading{width:56%}table.rtmedia-edit-media-list tr td.rtm-edit-media-list-edit,table.rtmedia-edit-media-list tr td.rtm-edit-media-list-delete,table.rtmedia-edit-media-list tr td.rtm-edit-media-list-title{padding:4px;font-size:14px;line-height:24px}table.rtmedia-edit-media-list tr td.rtm-edit-media-list-title a{text-decoration:none;color:#333}table.rtmedia-edit-media-list tr td.rtm-edit-media-list-edit{text-align:center}table.rtmedia-edit-media-list tr td.rtm-edit-media-list-edit a{color:#333;font-size:13px}table.rtmedia-edit-media-list tr td.rtm-edit-media-list-delete{text-align:center}table.rtmedia-edit-media-list tr td.rtm-edit-media-list-delete span{color:#FF0000;cursor:pointer;font-size:13px}.rtm-hide{display:none}.rtm-tabs.rtm-tabs{border-bottom:1px solid #eee;list-style:none;margin:0 0 20px;padding:0}.rtm-tabs li{border:1px solid #eee;border-bottom:0;float:left;margin:0 5px;padding:0}.rtm-tabs a{border:0;display:block;padding:5px 15px;text-decoration:none}.rtm-tabs a:focus{background:transparent;box-shadow:0 0 0}.rtm-tabs .active{position:relative}.rtm-tabs .active:after{background:#fff;bottom:-1px;content:' ';height:1px;left:0;position:absolute;width:100%}.rtm-tabs .dashicons{font-size:16px;height:auto;line-height:20px;margin-right:8px;width:auto}.rtmedia-edit-media-tabs .rtm-tabs a{border-bottom:0 none}.mfp-bg{top:0;left:0;width:100%;height:100%;z-index:104211;overflow:hidden;position:fixed;background:rgba(0,0,0,0.9)}.mfp-wrap{top:0;left:0;width:100%;height:100%;z-index:104311;position:fixed;outline:none !important;-webkit-backface-visibility:hidden}.mfp-container{text-align:center;position:absolute;width:100%;max-width:84%;margin:0 auto;right:0;height:100%;left:0;top:0;padding:0 8px;box-sizing:border-box}.mfp-container:before{content:' ';display:inline-block;height:100%;vertical-align:middle}.mfp-align-top .mfp-container:before{display:none}.mfp-content{position:relative;display:inline-block;vertical-align:middle;margin:0 auto;text-align:left;z-index:1045}.mfp-inline-holder .mfp-content,.mfp-ajax-holder .mfp-content{width:100%;cursor:auto}.mfp-ajax-cur{cursor:progress}.mfp-zoom-out-cur,.mfp-zoom-out-cur .mfp-image-holder .mfp-close{cursor:zoom-out}.mfp-zoom{cursor:pointer;cursor:zoom-in}.mfp-auto-cursor .mfp-content{cursor:auto}.mfp-close,.mfp-arrow,.mfp-preloader,.mfp-counter{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.mfp-loading.mfp-figure{display:none}.mfp-hide{display:none !important}.mfp-s-ready .mfp-preloader{display:none}.mfp-s-error .mfp-content{display:none}button.mfp-close,button.mfp-arrow{overflow:visible;cursor:pointer;background:transparent;border:0;-webkit-appearance:none;display:block;outline:none;padding:0;z-index:1046;box-shadow:none}button::-moz-focus-inner{padding:0;border:0}.mfp-close{background:#fff;color:#999;cursor:pointer;font-size:24px;font-style:normal;height:30px;line-height:30px;padding:0;position:absolute;right:1px;text-align:center;text-decoration:none;text-indent:2px;top:0;width:32px;z-index:12}.mfp-close:hover,.mfp-close:focus{opacity:1;filter:alpha(opacity=100)}.mfp-close:active{top:1px}.mfp-image-holder .mfp-close,.mfp-iframe-holder .mfp-close{color:#FFF;right:-6px;text-align:right;padding-right:6px;width:100%}.mfp-counter{position:absolute;top:0;right:0;color:#CCC;font-size:12px;line-height:18px;white-space:nowrap}.mfp-arrow{cursor:pointer;position:absolute;opacity:0.65;filter:alpha(opacity=65);margin:0;top:50%;margin-top:-55px;padding:0;width:90px;height:110px;-webkit-tap-highlight-color:transparent;opacity:0;z-index:10;-webkit-transition:all 300ms ease-out;transition:all 300ms ease-out}.rtm-single-media:hover .mfp-arrow{opacity:1}@media (max-device-width: 640px){.mfp-arrow{display:none}.rtm-single-media:hover .mfp-arrow{display:none}}.mfp-arrow:active{margin-top:-54px}.mfp-arrow:hover,.mfp-arrow:focus{opacity:1;filter:alpha(opacity=100)}.mfp-arrow:before,.mfp-arrow:after,.mfp-arrow .mfp-b,.mfp-arrow .mfp-a{content:'';display:block;width:0;height:0;position:absolute;left:0;top:0;margin-top:35px;margin-left:35px;border:medium inset transparent}.mfp-arrow:after,.mfp-arrow .mfp-a{border-top-width:13px;border-bottom-width:13px;top:8px}.mfp-arrow:before,.mfp-arrow .mfp-b{border-top-width:21px;border-bottom-width:21px;opacity:0.7}.mfp-arrow-left{left:0}.mfp-arrow-left:after,.mfp-arrow-left .mfp-a{border-right:17px solid #FFF;margin-left:31px}.mfp-arrow-left:before,.mfp-arrow-left .mfp-b{margin-left:25px;border-right:27px solid #3F3F3F}.mfp-arrow-right{right:0}.mfp-arrow-right:after,.mfp-arrow-right .mfp-a{border-left:17px solid #FFF;margin-left:39px}.mfp-arrow-right:before,.mfp-arrow-right .mfp-b{border-left:27px solid #3F3F3F}.mfp-iframe-holder{padding-top:40px;padding-bottom:40px}.mfp-iframe-holder .mfp-content{line-height:0;width:100%;max-width:900px}.mfp-iframe-holder .mfp-close{top:-40px}.mfp-iframe-scaler{width:100%;height:0;overflow:hidden;padding-top:56.25%}.mfp-iframe-scaler iframe{position:absolute;display:block;top:0;left:0;width:100%;height:100%;box-shadow:0 0 8px rgba(0,0,0,0.6);background:#000}img.mfp-img{width:auto;max-width:100%;height:auto;display:block;line-height:0;box-sizing:border-box;padding:40px 0 40px;margin:0 auto}.mfp-figure{line-height:0}.mfp-figure:after{content:'';position:absolute;left:0;top:40px;bottom:40px;display:block;right:0;width:auto;height:auto;z-index:-1;box-shadow:0 0 8px rgba(0,0,0,0.6);background:#444}.mfp-figure small{color:#BDBDBD;display:block;font-size:12px;line-height:14px}.mfp-figure figure{margin:0}.mfp-bottom-bar{margin-top:-36px;position:absolute;top:100%;left:0;width:100%;cursor:auto}.mfp-title{text-align:left;line-height:18px;color:#F3F3F3;word-wrap:break-word;padding-right:36px}.mfp-image-holder .mfp-content{max-width:100%}.mfp-gallery .mfp-image-holder .mfp-figure{cursor:pointer}.mfp-preloader{position:absolute;top:50%;left:0;right:0;margin-top:-36px;z-index:1044;font-size:0;width:36px;height:36px;margin-left:auto;margin-right:auto}.mfp-preloader:before{content:'Loading…';position:absolute;width:30px;height:30px}.mfp-preloader:not(:required):before{content:'';border-radius:50%;border:3px solid rgba(255,255,255,0.27);border-top-color:rgba(255,255,255,0.9);animation:spinner .6s linear infinite;-webkit-animation:spinner .6s linear infinite}@keyframes spinner{to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@-webkit-keyframes spinner{to{-webkit-transform:rotate(360deg)}}@media screen and (max-width: 800px) and (orientation: landscape), screen and (max-height: 300px){.mfp-img-mobile .mfp-image-holder{padding-left:0;padding-right:0}.mfp-img-mobile img.mfp-img{padding:0}.mfp-img-mobile .mfp-figure:after{top:0;bottom:0}.mfp-img-mobile .mfp-figure small{display:inline;margin-left:5px}.mfp-img-mobile .mfp-bottom-bar{background:rgba(0,0,0,0.6);bottom:0;margin:0;top:auto;padding:3px 5px;position:fixed;box-sizing:border-box}.mfp-img-mobile .mfp-bottom-bar:empty{padding:0}.mfp-img-mobile .mfp-counter{right:5px;top:3px}.mfp-img-mobile .mfp-close{top:0;right:0;width:35px;height:35px;line-height:35px;background:rgba(0,0,0,0.6);position:fixed;text-align:center;padding:0}}@media all and (max-width: 900px){.mfp-arrow{-webkit-transform:scale(0.75);-ms-transform:scale(0.75);transform:scale(0.75)}.mfp-arrow-left{-webkit-transform-origin:0;-ms-transform-origin:0;transform-origin:0}.mfp-arrow-right{-webkit-transform-origin:100%;-ms-transform-origin:100%;transform-origin:100%}.mfp-container{padding-left:6px;padding-right:6px}}.mfp-content .rtm-lightbox-container{background:#000;margin:0 auto;position:relative}.mfp-content .rtm-lightbox-container .rtmedia-media-description .allcontent{max-height:200px;overflow-y:auto;margin:5px 0}.mfp-content .rtm-single-meta{background:#fff;overflow:hidden;padding:20px 20px 110px;position:relative;vertical-align:top}.rtm-single-media{overflow:hidden;position:relative;text-align:center;vertical-align:middle}.rtm-single-media .mejs-container{margin:0 auto;max-width:inherit}.rtm-single-media .rtmedia-message-container{position:absolute;top:45%;left:0;right:0;margin-left:auto;margin-right:auto}@media (max-device-width: 640px){.rtm-single-media .rtmedia-message-container{top:25%}}.rtm-ltb-action-container{background-color:rgba(0,0,0,0.6);bottom:0;color:#fff;line-height:38px;opacity:0;padding:0 10px;position:absolute;width:100%;-webkit-transition:all 300ms ease-out;transition:all 300ms ease-out}.rtm-single-media:hover .rtm-ltb-action-container{opacity:1}@media (max-device-width: 640px){.rtm-ltb-action-container{clear:both;position:relative;opacity:1}.rtm-single-media:hover .rtm-ltb-action-container{opacity:1}}#buddypress #rtmedia-single-media-container.rtmedia-single-media .button{background:transparent;border:0 none;border-radius:2px;color:rgba(255,255,255,0.5);display:block;font-family:inherit;font-weight:normal;line-height:24px;margin:0;padding:0 6px;text-shadow:0 0 0;text-transform:none}#buddypress #rtmedia-single-media-container.rtmedia-single-media .button:hover{background:rgba(255,255,255,0.2);color:rgba(255,255,255,0.8)}#buddypress #rtmedia-single-media-container.rtmedia-single-media .rtm-options .button{color:#333;margin:0 auto;padding:0 4px 0 0}#buddypress #rtm-media-options-list .rtm-options .button{background:transparent;border:0 none;border-radius:2px;color:rgba(255,255,255,0.5);float:left;font-family:inherit;font-weight:normal;line-height:24px;padding:0 6px;text-shadow:0 0 0;text-transform:none}#buddypress #rtm-media-options-list .rtm-options .rtmedia-delete-favlist{color:#fff;padding:0}.rtm-options.rtm-options{background:#666;color:#fff;display:none;font-size:14px;list-style:none;margin:0;padding:8px 10px;position:absolute;left:0;top:38px;width:190px;z-index:10}.rtm-options li{margin:0;overflow:hidden;padding:2px 0}.rtm-media-options .rtm-options:after{bottom:100%;left:20px;border:solid transparent;content:' ';height:0;width:0;position:absolute;pointer-events:none;border-color:rgba(255,255,255,0);border-bottom-color:#666;border-width:6px;margin-left:-6px}.mfp-content .rtm-options{background:#fff;color:#333;bottom:38px;right:0;left:auto;top:auto}.mfp-content .rtm-options:after{top:100%;right:22px;border:solid transparent;content:' ';height:0;width:0;position:absolute;pointer-events:none;border-color:rgba(255,255,255,0);border-top-color:#fff;border-width:6px;margin-left:-6px}.rtm-options .dashicons{font-size:14px;line-height:24px;margin-right:2px}.rtm-media-options .rtm-options a{border:0;color:#fff;display:block;text-decoration:none}.rtm-ltb-title{color:rgba(255,255,255,0.7);float:left;font-size:13px}.rtm-ltb-title a{color:inherit}.rtm-ltb-title a:hover{border-bottom:1px dotted;color:#fff}.rtm-item-actions{float:right}.rtm-item-actions>div,.rtm-item-actions>form{float:left;margin:0 2px;padding:7px 0;position:relative}.rtmedia-media img{display:inline-block;max-height:inherit;height:auto;max-width:100%;width:auto}@media only screen and (max-device-width: 1024px){.rtmedia-media{margin:40px 0}}.rtm-user-meta-details .username{font-size:16px;line-height:1;margin-bottom:6px}.userprofile{float:left;margin:0 16px 16px 0;max-width:54px}.userprofile a{display:block}.userprofile img{height:auto;max-width:100%}.rtm-time-privacy{color:#999;font-size:12px}.rtm-time-privacy .dashicons{font-size:14px;line-height:1.5}.rtmedia-actions-before-comments>span{float:left;margin-right:10px}.rtmedia-actions-before-comments .rtmedia-comment-link,#buddypress .rtmedia-actions-before-comments .rtmedia-like{border:0;font-size:13px;font-weight:normal;line-height:2;padding:0;text-transform:none}.rtmedia-actions-before-comments .rtmedia-comment-link:hover,#buddypress .rtmedia-actions-before-comments .rtmedia-like:hover{background:transparent}.rtmedia-comment-user-pic{float:left;margin-right:10px;max-width:36px}.rtmedia-comment-user-pic img{height:auto;max-width:100%}.rtm-like-comments-info{position:relative}.rtm-like-comments-info:after{bottom:100%;left:15px;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none;border-color:rgba(237,239,244,0);border-bottom-color:#edeff4;border-width:4px;margin-left:-4px}.rtm-comment-list.rtm-comment-list{list-style:none;margin:0;padding:0}.rtm-comment-list li{background:#edeff4;font-size:12px;margin-bottom:1px;padding:10px;position:relative}.rtm-comment-list li:hover .rtmedia-delete-comment{opacity:1}.rtm-comment-list .rtmedia-no-comments{margin:0;padding:5px 10px}.rtmedia-like-info{background:#edeff4;font-size:12px;margin-bottom:1px;padding:5px 10px;position:relative}.rtm-comment-wrap{overflow:hidden}.rtm-comment-wrap .rtmedia-comment-author{font-weight:700}.rtm-comment-wrap .rtmedia-comment-date{color:#999;font-size:11px}.rtmedia-comment-content{margin-top:2px}.rtmedia-delete-comment{color:#999;cursor:pointer;font-size:16px;opacity:0;position:absolute;right:5px;top:5px}.rtmedia-comment-content p{margin:0}.rtmedia-comment-details{line-height:1.5;margin-top:-3px}.rtmedia-item-comments textarea{font-size:14px;padding:4px}.rtm-media-single-comments{background-color:#edeff4;bottom:20px;padding:10px;position:absolute;width:-webkit-calc(100% - 40px);width:calc(100% - 40px)}.rtm-media-single-comments textarea{font-size:12px;line-height:14px;max-height:40px;min-height:30px;padding:4px}.rtmedia-popup{background:#fff;margin:20px auto;max-width:600px;padding:20px;position:relative;width:auto}.rtmedia-popup .rtm-modal-title{font-size:24px;margin-bottom:20px;margin-top:0}.rtmedia-popup label{display:block;margin-bottom:5px}#rtm-modal-container p{margin-bottom:10px}#rtm-mejs-video-container{margin:0 auto}.rtmedia-media-name{float:left;max-width:140px;overflow:hidden;text-align:left;text-overflow:ellipsis;white-space:nowrap}.rtm-single-media.rtm-media-type-video{padding-bottom:40px;padding-top:40px}.rtmedia-gallery-alert-container{position:fixed;top:0;left:0;height:100%;width:100%;background-color:rgba(0,0,0,0.6);z-index:999997}.rtmedia-gallery-message-box{position:fixed;top:40%;left:50%;margin-left:auto;margin-right:auto;z-index:999999}.rtmedia-gallery-message-box span{position:relative;left:-50%}.rtmedia-activity-container{box-sizing:border-box}.rtmedia-activity-container *,.rtmedia-activity-container *:before,.rtmedia-activity-container *:after{box-sizing:inherit}#buddypress ul.rtmedia-list li{border-bottom:0;padding-bottom:0}.rtmedia-activity-container .rtmedia-item-actions{display:none}.rtmedia-activity-container .rtmedia-item-title,.rtmedia-activity-container .rtmedia-item-title a{border:0;color:#666;font-size:13px;margin:5px 0 0;overflow:hidden;text-align:center;text-overflow:ellipsis;white-space:nowrap}#rtmedia-whts-new-upload-container div{left:0 !important;position:absolute;top:0 !important}#aw-whats-new-submit,.rtmedia-add-media-button{display:block}.rtm-drag-drop-active{border:4px dashed green !important;display:block;height:100%;opacity:0.5;z-index:9999}#rtm-drop-files-title{background:rgba(0,0,0,0.2);display:none;font-size:14px;height:100%;padding:20px;position:absolute;top:0;width:100%}#rtSelectPrivacy{float:right}.rtmedia-plupload-container{position:relative;float:left}.rtm-upload-button-wrapper{float:left;margin-right:5px}#rtmedia-action-update{margin-right:10px}.rtmedia-list-item.media-type-document,.rtmedia-list-item.media-type-music,.rtmedia-list-item.media-type-video{display:inline-block}.media-type-music .mejs-container{margin-bottom:10px}.rtmedia-album-edit .rtm-checkbox-wrap{background:rgba(255,255,255,0.9);height:30px;line-height:1;padding:10px;position:absolute;z-index:10}.rtmedia-album-edit .rtmedia-item-selector{position:relative;top:-7px}.rtmedia-album-edit .rtmedia-move-container{display:none}.rtm-single-actions.rtm-item-actions{float:none}.media-item .describe{border-collapse:collapse;width:100%;border-top-style:solid;border-top-width:1px;clear:both;cursor:default}.media-item.media-blank .describe{border:0}.media-item .describe th{vertical-align:top;text-align:left;padding:5px 10px 10px;width:140px}.media-item .describe .align th{padding-top:0}.media-item .media-item-info tr{background-color:transparent}.media-item .describe td{padding:0 8px 8px 0;vertical-align:top}.media-item thead.media-item-info td{padding:4px 10px 0}.media-item .media-item-info .A1B1{padding:0 0 0 10px}.media-item td.savesend{padding-bottom:15px}.media-item .thumbnail{max-height:128px;max-width:128px}#wpbody-content #async-upload-wrap a{display:none}.media-upload-form{margin-top:20px}.media-upload-form td label{margin-right:6px;margin-left:2px}.media-upload-form .align .field label{display:inline;padding:0 0 0 23px;margin:0 1em 0 3px;font-weight:bold}.media-upload-form tr.image-size label{margin:0 0 0 5px;font-weight:bold}.media-upload-form th.label label{font-weight:bold;margin:0.5em;font-size:13px}.media-upload-form th.label label span{padding:0 5px}abbr.required{border:medium none;text-decoration:none}.media-item .describe input[type="text"],.media-item .describe textarea{width:460px}.media-item .describe p.help{margin:0;padding:0 0 0 5px}.media-item .edit-attachment,.describe-toggle-on,.describe-toggle-off{display:block;line-height:36px;float:right;margin-right:15px}.media-item .describe-toggle-off,.media-item.open .describe-toggle-on{display:none}.media-item.open .describe-toggle-off{display:block}#media-items .media-item{border-style:solid;border-width:1px;min-height:36px;position:relative;margin-top:-1px;width:100%}#media-items{width:623px}.media-new-php #media-items{margin:1em 0}#media-items:empty{border:0 none}.media-item .filename{line-height:36px;overflow:hidden;padding:0 10px}.media-item .error-div{padding-left:10px}.media-item .pinkynail{float:left;margin:2px 2px 0;max-width:40px;max-height:32px}.media-item .startopen,.media-item .startclosed{display:none}.media-item .original{position:relative;height:34px}.media-item .progress{float:right;height:22px;margin:6px 10px 0 0;width:200px;line-height:2em;padding:0;overflow:hidden;margin-bottom:2px;border:1px solid #d1d1d1;background:#f7f7f7;background-image:-webkit-gradient(linear, left bottom, left top, from(#fff), to(#f7f7f7));background-image:-webkit-linear-gradient(bottom, #fff, #f7f7f7);background-image:linear-gradient(to top, #fff, #f7f7f7);border-radius:3px;box-shadow:inset 0 0 3px rgba(0,0,0,0.1)}.media-item .bar{z-index:9;width:0;height:100%;margin-top:-24px;background-color:#8cc1e9;background-image:-webkit-gradient(linear, left bottom, left top, from(#72a7cf), to(#8cc1e9));background-image:-webkit-linear-gradient(bottom, #72a7cf, #8cc1e9);background-image:linear-gradient(to top, #72a7cf, #8cc1e9);border-radius:3px;box-shadow:0 0 3px rgba(0,0,0,0.3)}.media-item .progress .percent{z-index:10;position:relative;width:200px;padding:0 8px;text-shadow:0 1px 0 rgba(255,255,255,0.4);color:rgba(0,0,0,0.6)}.upload-php .fixed .column-parent{width:15%}.js .html-uploader #plupload-upload-ui{display:none}.js .html-uploader #html-upload-ui{display:block}.media-upload-form .media-item.error{margin:0;padding:0}.media-upload-form .media-item.error p,.media-item .error-div{line-height:16px;margin:5px 10px;padding:0}.media-item .error-div a.dismiss{display:block;float:right;margin:5px 4px 0 15px}.find-box{width:600px;height:300px;overflow:hidden;padding:33px 0 51px;position:absolute;z-index:1000}.find-box-head{cursor:move;font-weight:bold;height:2em;line-height:2em;padding:1px 12px;position:absolute;top:5px;width:100%}.find-box-inside{overflow:auto;padding:6px;height:100%}.find-box-search{overflow:hidden;padding:9px;position:relative}.find-box-search .spinner{float:none;left:125px;position:absolute;top:9px}#find-posts-input{float:left;width:140px;height:24px}#find-posts-search{float:left;margin:1px 4px 0 3px}#find-posts-response{margin:8px 0;padding:0 1px 6px}#find-posts-response table{width:100%}#find-posts-response .found-radio{padding:3px 0 0 8px;width:15px}.find-box-buttons{padding:8px;overflow:hidden}.find-box #resize-se{position:absolute;right:1px;bottom:1px}.ui-find-overlay{position:absolute;top:0;left:0;background-color:#000;opacity:0.6;filter:alpha(opacity=60)}ul#dismissed-updates{display:none}form.upgrade{margin-top:8px}form.upgrade .hint{font-style:italic;font-size:85%;margin:-0.5em 0 2em 0}#poststuff .inside .the-tagcloud{margin:5px 0 10px;padding:8px;border-width:1px;border-style:solid;line-height:1.8em;word-spacing:3px;border-radius:6px}.drag-drop #drag-drop-area{border:4px dashed #DDDDDD;height:200px}.drag-drop .drag-drop-inside{margin:70px auto 0;width:250px}.drag-drop-inside p{color:#aaa;font-size:14px;margin:5px 0;display:none}.drag-drop .drag-drop-inside p{text-align:center}.drag-drop-inside p.drag-drop-info{font-size:20px}.drag-drop .drag-drop-inside p,.drag-drop-inside p.drag-drop-buttons{display:block}.drag-drop.drag-over #drag-drop-area{border-color:#83b4d8}#plupload-upload-ui{position:relative}.describe .image-editor{vertical-align:top}.imgedit-wrap{position:relative}.imgedit-settings p{margin:8px 0}.post-php .imgedit-wrap table{width:100%}.describe .imgedit-wrap table td,.wp_attachment_holder .imgedit-wrap table td{vertical-align:top;padding-top:0}.describe .imgedit-wrap table td.imgedit-settings{padding:0 5px}.wp_attachment_holder .imgedit-wrap table td.imgedit-settings{width:250px}td.imgedit-settings input{margin-top:0;vertical-align:middle}.imgedit-wait{position:absolute;top:0;background:#fff url(../../../../../../wp-admin/images/wpspin_light.gif) no-repeat scroll 22px 10px;background-size:16px 16px;opacity:0.7;filter:alpha(opacity=70);width:100%;height:500px;display:none}.spinner{background:url(../../../../../../wp-admin/images/wpspin_light.gif) no-repeat;background-size:16px 16px;display:none;float:right;opacity:0.7;filter:alpha(opacity=70);width:16px;height:16px;margin:5px 5px 0}.no-float{float:none}.media-disabled,.imgedit-settings .disabled{color:grey}.wp_attachment_image,.A1B1{overflow:hidden}.wp_attachment_image .button,.A1B1 .button{float:left}.no-js .wp_attachment_image .button{display:none}.wp_attachment_image .spinner,.A1B1 .spinner{float:left;padding:0 4px 4px;vertical-align:bottom}.imgedit-menu{margin:0 0 12px;min-width:300px}.imgedit-menu div{float:left;width:32px;height:32px}.imgedit-crop-wrap{position:relative}.imgedit-crop{background:transparent url("../../../../../../wp-admin/images/imgedit-icons.png") no-repeat scroll -9px -31px;margin:0 8px 0 0}.imgedit-crop.disabled:hover{background-position:-9px -31px}.imgedit-crop:hover{background-position:-9px -1px}.imgedit-rleft{background:transparent url("../../../../../../wp-admin/images/imgedit-icons.png") no-repeat scroll -46px -31px;margin:0 3px}.imgedit-rleft.disabled:hover{background-position:-46px -31px}.imgedit-rleft:hover{background-position:-46px -1px}.imgedit-rright{background:transparent url("../../../../../../wp-admin/images/imgedit-icons.png") no-repeat scroll -77px -31px;margin:0 8px 0 3px}.imgedit-rright.disabled:hover{background-position:-77px -31px}.imgedit-rright:hover{background-position:-77px -1px}.imgedit-flipv{background:transparent url("../../../../../../wp-admin/images/imgedit-icons.png") no-repeat scroll -115px -31px;margin:0 3px}.imgedit-flipv.disabled:hover{background-position:-115px -31px}.imgedit-flipv:hover{background-position:-115px -1px}.imgedit-fliph{background:transparent url("../../../../../../wp-admin/images/imgedit-icons.png") no-repeat scroll -147px -31px;margin:0 8px 0 3px}.imgedit-fliph.disabled:hover{background-position:-147px -31px}.imgedit-fliph:hover{background-position:-147px -1px}.imgedit-undo{background:transparent url("../../../../../../wp-admin/images/imgedit-icons.png") no-repeat scroll -184px -31px;margin:0 3px}.imgedit-undo.disabled:hover{background-position:-184px -31px}.imgedit-undo:hover{background-position:-184px -1px}.imgedit-redo{background:transparent url("../../../../../../wp-admin/images/imgedit-icons.png") no-repeat scroll -215px -31px;margin:0 8px 0 3px}.imgedit-redo.disabled:hover{background-position:-215px -31px}.imgedit-redo:hover{background-position:-215px -1px}.imgedit-applyto img{margin:0 8px 0 0}.imgedit-group h3{font-size:18px}.imgedit-group .dashicons{border:0;line-height:1.2}.imgedit-group-top{margin:5px 0}.imgedit-applyto .imgedit-label{padding:2px 0 0;display:block}.imgedit-help{display:none;font-style:italic;margin-bottom:8px}a.imgedit-help-toggle{text-decoration:none}.form-table td.imgedit-response{padding:0}.imgedit-submit{margin:8px 0}.imgedit-submit-btn{margin-left:20px}.imgedit-wrap .nowrap{white-space:nowrap}span.imgedit-scale-warn{color:red;font-size:20px;font-style:normal;visibility:hidden;vertical-align:middle}.wp_attachment_details{margin-bottom:20px}.imgedit-menu div{border-color:#d5d5d5;background-color:#f1f1f1}.imgedit-menu div:hover{border-color:#c1c1c1;background-color:#eaeaea}.imgedit-menu div.disabled{border-color:#ccc;background-color:#ddd;filter:alpha(opacity=50);opacity:0.5}.bp-media-image-editor-cotnainer{margin-top:35px}.wp_attachment_image .bp-media-image-edit{float:left}.wp_attachment_image .spinner{display:none}.bp-media-image-editor-cotnainer .hidden{display:none}.bp-media-image-editor-cotnainer div.updated{margin:5px 0 15px;background-color:#ffffe0;border-color:#e6db55;padding:0 .6em;border-radius:3px;border-width:1px;border-style:solid}.bp-media-image-editor-cotnainer div.updated p{margin:.5em 0;padding:2px}body article.bp_members.bp_member .entry-content,body div.bp_members.bp_member .entry-content{width:100%}.rtm-media-gallery-uploader{display:none}.rtmedia-uploader .drag-drop{border:4px dashed #DDD;text-align:center;background:#fafafa;overflow:hidden;color:#AAAAAA;margin-top:20px;padding:25px 0}.rtmedia-uploader .drag-drop.dragover{border-color:#83b4d8}.rtmedia-uploader .drag-drop .drag-drop-info{font-size:20px;line-height:24px}.rtmedia-uploader .drag-drop .rtm-select-files span{vertical-align:middle}.rtmedia-uploader .drag-drop .rtm-seperator{margin:0px 20px}.rtmedia-uploader .drag-drop .start-media-upload{display:none;margin-top:20px}.rtmedia-uploader .drag-drop .rtm-file-size-limit{vertical-align:middle;font-size:16px;line-height:24px}.rtm-uploader-main-wrapper .rtm-uploader-tabs{margin-bottom:10px;text-align:left}.rtm-uploader-main-wrapper ul{border-bottom:1px solid #CCC}.rtm-uploader-main-wrapper li{margin:0 0 -1px 10px;display:inline-block;padding:5px 10px;line-height:25px;background-color:#e4e4e4;border:1px solid #CCC}.rtm-uploader-main-wrapper li.active{background:transparent;border-left:1px solid #CCC;border-top:1px solid #CCC;border-right:1px solid #CCC;border-bottom:1px solid #fafafa}.rtm-uploader-main-wrapper li:hover{cursor:pointer}.rtmedia-container .rtmedia-list{margin:10px -5px}.rtmedia-container .rtmedia-list .rtmedia-list-item{float:left;margin:5px;position:relative}.rtmedia-container .rtmedia-list .rtmedia-list-item>a{display:block}.rtmedia-container .rtmedia-list .rtmedia_time{background-color:#000;color:#fff;display:inline-block;font-size:11px;font-weight:bold;line-height:14px;opacity:0.75;padding:0 4px;position:absolute;right:2px;top:2px}.rtmedia-container .rtmedia-list img{vertical-align:top}.rtmedia-container .rtmedia-list .rtmedia-item-title h4{color:#666;font-size:12px;font-weight:normal;margin:5px 0 0;overflow:hidden;text-align:center;text-overflow:ellipsis;white-space:nowrap}.rtm-load-more{background:#eee;text-align:center}.rtmedia-container .rtm-load-more a{border:0;padding:10px 0}.rtm-load-more .rtm-media-loading{padding:10px 0}.rtm-media-options{line-height:1.4;margin-bottom:10px}.rtm-media-options>div{display:inline-block;cursor:pointer}.rtm-media-options .rtm-media-options-list{margin-right:5px;padding-right:10px;position:relative}.rtm-media-options>*{border-right:1px solid #999}.rtm-media-options>*:last-child{border-right:none}.rtm-media-options .dashicons{font-size:inherit;line-height:1.4}.rtmedia-upload-media-link{cursor:pointer}a.rtmedia-upload-media-link{border:none}.rtm-album-privacy span{font-size:16px;display:inline-block;margin:0 20px 20px 20px;vertical-align:top}.rtm-album-privacy label{margin-right:8px}.rtm-album-privacy .dashicons{font-size:16px;line-height:1.6;margin-right:5px}#rtm-media-options-list .rtmedia-delete-album{background:transparent;border:0;color:#fff;font-family:inherit;font-size:inherit;font-weight:inherit;padding:0;text-transform:inherit}#rtm-media-options-list .rtmedia-delete-album:hover{background:transparent;border:0;color:#fff}.rtmedia-single-container button.rtmedia-like{background-color:transparent;color:inherit}#buddypress .mejs-controls button{padding:4px 8px;border:none;background:transparent url("../../../lib/media-element/controls.png") no-repeat}#buddypress .mejs-controls .mejs-play button{background-position:0 0}#buddypress .mejs-controls .mejs-pause button{background-position:0 -16px}#buddypress .mejs-controls .mejs-unmute button{background-position:-16px 0}#buddypress .mejs-controls .mejs-mute button{background-position:-16px -16px}#buddypress .mejs-controls .mejs-fullscreen-button button{background-position:-32px 0}#buddypress .mejs-controls .mejs-unfullscreen button{background-position:-32px -16px}.mejs-container .mejs-controls .mejs-time{padding:10px 3px 0;content:''}.rtmedia-activity-container .mejs-playpause-button.mejs-play button:before,.rtmedia-activity-container .mejs-playpause-button.mejs-pause button:before,.rtmedia-activity-container .mejs-volume-button.mejs-mute button:before,.rtmedia-activity-container .mejs-fullscreen-button button:before,.rtmedia-media .mejs-playpause-button.mejs-play button:before,.rtmedia-media .mejs-playpause-button.mejs-pause button:before,.rtmedia-media .mejs-volume-button.mejs-mute button:before,.rtmedia-media .mejs-fullscreen-button button:before{content:''}@media only screen and (min-width: 1025px){.mfp-content .rtm-lightbox-container{display:table;table-layout:fixed;width:100%}.mfp-content .rtm-single-media{display:table-cell;width:66.6667%}.mfp-content .rtm-single-meta{display:table-cell;width:33.3333%}.mfp-content .rtmedia-item-comments{max-height:330px;overflow-x:hidden;overflow-y:auto}}.rtl #rtSelectPrivacy{float:left}.rtl .rtmedia-plupload-container{float:right}.rtl .rtm-upload-button-wrapper{float:right}.rtl #whats-new-post-in-box{float:right}.rtl .describe-toggle-off{float:left}.rtl .media-item .pinkynail{float:right}.rtl .media-item .progress{float:left}.rtl .media-item .error-div a.dismiss{float:left}.rtl #find-posts-input{float:right}.rtl #find-posts-search{float:right}.rtl .spinner{float:left}.rtl .wp_attachment_image .button,.rtl .A1B1 .button{float:right}.rtl .wp_attachment_image .spinner,.rtl .A1B1 .spinner{float:right}.rtl .imgedit-menu div{float:right}.rtl .wp_attachment_image .bp-media-image-edit{float:right}.rtl .rtmedia-container .rtmedia-list .rtmedia-list-item{float:right}.rtl #buddypress #rtm-media-options-list .rtm-options .button{float:right}.rtl .rtm-ltb-title{float:right}.rtl .rtm-item-actions{float:left}.rtl .rtm-item-actions>div,.rtl .rtm-item-actions>form{float:right}.rtl .userprofile{float:right}.rtl .rtmedia-actions-before-comments>span{float:right}.rtl .rtmedia-comment-user-pic{float:right}.rtl .rtmedia-media-name{float:right}.rtl #rtmedia-uploader-form .rtm-plupload-list li,.rtl #rtmedia_uploader_filelist li{float:right}.rtl .rtm-page-number{float:right}.rtl .rtm-page-number .rtmedia-page-link{float:right}.rtl .rtm-pagination{float:right}.rtl .rtm-pagination .rtm-paginate{float:left}.rtl .rtm-tabs li{float:right}.rtl .alignleft{float:right}.rtl .alignright{float:left}
app/assets/css/sass/_buddypress.scss CHANGED
@@ -1,19 +1,17 @@
1
  // BuddyPress Overwites
2
 
3
  #buddypress form#whats-new-form textarea {
4
-
5
  // Fixed for 2012
6
  -webkit-box-sizing: border-box;
7
  -moz-box-sizing: border-box;
8
  box-sizing: border-box;
9
-
10
  min-height: 70px;
11
  width: 100%;
12
  }
13
 
14
  #buddypress #whats-new-options {
15
- height: auto !important;
16
- overflow: hidden;
17
  }
18
 
19
  #buddypress form#whats-new-form p.activity-greeting {
@@ -21,9 +19,9 @@
21
  }
22
 
23
  #buddypress form#whats-new-form #whats-new-options select {
24
- border: 1px solid #ccc;
25
- font-size: 13px;
26
- margin-top: 0;
27
  padding: 3px 2px;
28
  }
29
 
@@ -44,4 +42,9 @@
44
 
45
  #whats-new-textarea {
46
  margin-bottom: 10px;
47
- }
 
 
 
 
 
1
  // BuddyPress Overwites
2
 
3
  #buddypress form#whats-new-form textarea {
 
4
  // Fixed for 2012
5
  -webkit-box-sizing: border-box;
6
  -moz-box-sizing: border-box;
7
  box-sizing: border-box;
 
8
  min-height: 70px;
9
  width: 100%;
10
  }
11
 
12
  #buddypress #whats-new-options {
13
+ height: auto !important;
14
+ overflow: hidden;
15
  }
16
 
17
  #buddypress form#whats-new-form p.activity-greeting {
19
  }
20
 
21
  #buddypress form#whats-new-form #whats-new-options select {
22
+ border: 1px solid #ccc;
23
+ font-size: 13px;
24
+ margin-top: 0;
25
  padding: 3px 2px;
26
  }
27
 
42
 
43
  #whats-new-textarea {
44
  margin-bottom: 10px;
45
+ }
46
+
47
+ // Fix for bootstrap selector conflicts
48
+ body.media.buddypress {
49
+ overflow-y: auto;
50
+ }
app/assets/css/sass/_rtm.scss CHANGED
@@ -8,33 +8,40 @@
8
  * {
9
  &,
10
  &:before,
11
- &:after {
12
  -webkit-box-sizing: inherit;
13
  -moz-box-sizing: inherit;
14
  box-sizing: inherit;
15
  }
16
-
17
  }
18
  }
19
 
20
-
21
  .rtmedia-list {
22
-
23
  // Increased specificity with double class to overwrite defualt styles. 2012
24
  &.rtmedia-list {
25
  list-style: none;
26
- margin: 0; // theme 2015/2014
27
- padding: 0; // theme 2013
 
 
 
 
 
28
  }
29
  }
30
 
31
  .rtmedia-list-item > a {
32
- border: 0;
33
- display: inline-block;
34
- text-decoration: none; // 2012
 
 
35
 
36
  &:focus {
37
- outline: 0; // theme 2015
 
 
 
38
  }
39
 
40
  & + p {
@@ -43,7 +50,10 @@
43
 
44
  .rtmedia-item-thumbnail {
45
  img {
46
- display: inline-block; // Remove extra white space below image.
 
 
 
47
  }
48
  }
49
  }
@@ -64,14 +74,14 @@
64
  padding: 5px;
65
  position: relative;
66
 
67
- &.upload-error {
68
- border: 1px solid red;
69
- }
 
 
 
 
70
  }
71
-
72
- img {
73
- max-width: 100%;
74
- }
75
 
76
  canvas {
77
  display: block;
@@ -81,15 +91,22 @@
81
  .rtm-upload-edit-title {
82
  font-size: 12px;
83
  }
 
84
  .rtm-upload-edit-desc {
85
  font-size: 12px;
86
  display: block;
87
  }
 
88
  .rtm-upload-edit-title-wrapper, .rtm-upload-edit-desc-wrapper {
89
  label {
90
  display: block;
91
  }
92
- }
 
 
 
 
 
93
  }
94
 
95
  .rtm-plupload-list {
@@ -128,12 +145,12 @@ button#rtmedia-add-media-button-post-update {
128
 
129
  .plupload_file_action {
130
  background: $light;
131
- position: absolute;
132
  height: 18px;
133
- right: 0;
134
- top: 0;
135
  width: 18px;
136
- z-index: 10;
137
 
138
  .dashicons {
139
  color: $error;
@@ -146,16 +163,16 @@ button#rtmedia-add-media-button-post-update {
146
  }
147
 
148
  .plupload_file_status {
149
- height: 8px;
150
- overflow: hidden;
151
- position: relative;
152
  }
153
 
154
  .plupload_file_progress {
155
  background: $success;
156
  height: 4px;
157
- position: absolute;
158
- top: 0;
159
  }
160
 
161
  .rtm-form {
@@ -184,20 +201,18 @@ button#rtmedia-add-media-button-post-update {
184
  }
185
 
186
  .rtm-pagination {
187
-
188
- background: transparent;
189
- border: none;
190
- color: #888;
191
- font-size: small;
192
- margin: 0;
193
- position: relative;
194
- display: block;
195
- float: left;
196
- width: 100%;
197
- padding: 10px 0;
198
 
199
  .rtm-paginate {
200
-
201
  float: right;
202
  font-size: 15px;
203
 
@@ -206,7 +221,10 @@ button#rtmedia-add-media-button-post-update {
206
  line-height: 1;
207
  margin: 0 2px;
208
  padding: 8px;
209
- text-decoration: none; //2012
 
 
 
210
  }
211
 
212
  a.rtmedia-page-link {
@@ -233,10 +251,10 @@ button#rtmedia-add-media-button-post-update {
233
 
234
  .rtmedia-upload-not-allowed {
235
  background-color: #fcf8e3;
236
- border-bottom: 1px solid #EEE;
237
- color: #c09853;
238
  margin-bottom: 20px;
239
- padding: 10px 15px;
240
  }
241
 
242
  .plupload_file_name {
@@ -295,12 +313,11 @@ button#rtmedia-add-media-button-post-update {
295
  .dashicons-trash {
296
  font-size: 15px;
297
  }
298
-
299
  }
300
 
301
  // Hover actions
302
  .rtm-pro-allow-action {
303
- .rtmedia-list-item:hover {
304
  .rtmedia-gallery-item-actions {
305
  opacity: 1;
306
  }
@@ -323,98 +340,101 @@ button#rtmedia-add-media-button-post-update {
323
  //table form Media list edit tab
324
 
325
  .rtmedia-text-link-decoration {
326
- text-decoration: none;
327
- &:hover {
328
- text-decoration: underline;
329
- }
 
330
  }
331
 
332
  .rtmedia-container .rtmedia-edit-list-media-table {
333
- max-height: 300px;
334
- overflow-y: auto;
335
-
336
- thead {
337
- tr {
338
- background-color: #50A1D7;
339
- }
340
-
341
- th {
342
- text-align: center;
343
- color: #FFF;
344
- }
345
- }
346
-
347
- tbody {
348
- tr {
349
- &:nth-child(odd) {
350
- background: #FFF;
351
- }
352
- }
353
-
354
- tr {
355
- &:nth-child(even) {
356
- background: #DCDCDC;
357
- }
358
- }
359
- }
360
  }
361
 
362
  table.rtmedia-edit-media-list {
363
- tr {
364
- line-height: 30px;
365
- th {
366
- color: #333;
367
- padding: 4px 10px;
368
- line-height: 20px;
369
- }
370
- .rtm-edit-media-list-heading {
371
- width: 44%;
372
- }
373
- .rtm-edit-media-list-title-heading {
374
- width: 56%;
375
- }
376
-
377
- td.rtm-edit-media-list-edit,
378
- td.rtm-edit-media-list-delete,
379
- td.rtm-edit-media-list-title {
380
- padding: 4px;
381
- font-size: 14px;
382
- line-height: 24px;
383
-
384
- a,span {
385
- @extend .rtmedia-text-link-decoration;
386
- }
387
- }
388
-
389
- td.rtm-edit-media-list-title {
390
-
391
- a {
392
- text-decoration: none;
393
- color: #333;
394
- }
395
- }
396
-
397
- td.rtm-edit-media-list-edit {
398
- text-align: center;
399
-
400
- a {
401
- color: #333;
402
- font-size: 13px;
403
- }
404
- }
405
-
406
- td.rtm-edit-media-list-delete {
407
- text-align: center;
408
-
409
- span {
410
- color: #FF0000;
411
- cursor: pointer;
412
- font-size: 13px;
413
- }
414
- }
415
- }
 
 
416
  }
417
 
418
- .rtm-hide{
419
  display: none;
420
  }
8
  * {
9
  &,
10
  &:before,
11
+ &:after {
12
  -webkit-box-sizing: inherit;
13
  -moz-box-sizing: inherit;
14
  box-sizing: inherit;
15
  }
 
16
  }
17
  }
18
 
 
19
  .rtmedia-list {
 
20
  // Increased specificity with double class to overwrite defualt styles. 2012
21
  &.rtmedia-list {
22
  list-style: none;
23
+ margin: 0;
24
+
25
+ // theme 2015/2014
26
+ padding: 0;
27
+
28
+ // theme 2013
29
+
30
  }
31
  }
32
 
33
  .rtmedia-list-item > a {
34
+ border: 0;
35
+ display: inline-block;
36
+ text-decoration: none;
37
+
38
+ // 2012
39
 
40
  &:focus {
41
+ outline: 0;
42
+
43
+ // theme 2015
44
+
45
  }
46
 
47
  & + p {
50
 
51
  .rtmedia-item-thumbnail {
52
  img {
53
+ display: inline-block;
54
+
55
+ // Remove extra white space below image.
56
+
57
  }
58
  }
59
  }
74
  padding: 5px;
75
  position: relative;
76
 
77
+ &.upload-error {
78
+ border: 1px solid red;
79
+ }
80
+ }
81
+
82
+ img {
83
+ max-width: 100%;
84
  }
 
 
 
 
85
 
86
  canvas {
87
  display: block;
91
  .rtm-upload-edit-title {
92
  font-size: 12px;
93
  }
94
+
95
  .rtm-upload-edit-desc {
96
  font-size: 12px;
97
  display: block;
98
  }
99
+
100
  .rtm-upload-edit-title-wrapper, .rtm-upload-edit-desc-wrapper {
101
  label {
102
  display: block;
103
  }
104
+
105
+ input.rtm-upload-edit-title {
106
+ min-width: 100%;
107
+ margin-top: 1px;
108
+ }
109
+ }
110
  }
111
 
112
  .rtm-plupload-list {
145
 
146
  .plupload_file_action {
147
  background: $light;
148
+ position: absolute;
149
  height: 18px;
150
+ right: 4px;
151
+ top: 0;
152
  width: 18px;
153
+ z-index: 10;
154
 
155
  .dashicons {
156
  color: $error;
163
  }
164
 
165
  .plupload_file_status {
166
+ height: 18px;
167
+ overflow: hidden;
168
+ position: relative;
169
  }
170
 
171
  .plupload_file_progress {
172
  background: $success;
173
  height: 4px;
174
+ position: absolute;
175
+ top: 0;
176
  }
177
 
178
  .rtm-form {
201
  }
202
 
203
  .rtm-pagination {
204
+ background: transparent;
205
+ border: none;
206
+ color: #888;
207
+ font-size: small;
208
+ margin: 0;
209
+ position: relative;
210
+ display: block;
211
+ float: left;
212
+ width: 100%;
213
+ padding: 10px 0;
 
214
 
215
  .rtm-paginate {
 
216
  float: right;
217
  font-size: 15px;
218
 
221
  line-height: 1;
222
  margin: 0 2px;
223
  padding: 8px;
224
+ text-decoration: none;
225
+
226
+ //2012
227
+
228
  }
229
 
230
  a.rtmedia-page-link {
251
 
252
  .rtmedia-upload-not-allowed {
253
  background-color: #fcf8e3;
254
+ border-bottom: 1px solid #EEE;
255
+ color: #c09853;
256
  margin-bottom: 20px;
257
+ padding: 10px 15px;
258
  }
259
 
260
  .plupload_file_name {
313
  .dashicons-trash {
314
  font-size: 15px;
315
  }
 
316
  }
317
 
318
  // Hover actions
319
  .rtm-pro-allow-action {
320
+ .rtmedia-list-item:hover {
321
  .rtmedia-gallery-item-actions {
322
  opacity: 1;
323
  }
340
  //table form Media list edit tab
341
 
342
  .rtmedia-text-link-decoration {
343
+ text-decoration: none;
344
+
345
+ &:hover {
346
+ text-decoration: underline;
347
+ }
348
  }
349
 
350
  .rtmedia-container .rtmedia-edit-list-media-table {
351
+ max-height: 300px;
352
+ overflow-y: auto;
353
+
354
+ thead {
355
+ tr {
356
+ background-color: #50A1D7;
357
+ }
358
+
359
+ th {
360
+ text-align: center;
361
+ color: #FFF;
362
+ }
363
+ }
364
+
365
+ tbody {
366
+ tr {
367
+ &:nth-child(odd) {
368
+ background: #FFF;
369
+ }
370
+ }
371
+
372
+ tr {
373
+ &:nth-child(even) {
374
+ background: #DCDCDC;
375
+ }
376
+ }
377
+ }
378
  }
379
 
380
  table.rtmedia-edit-media-list {
381
+ tr {
382
+ line-height: 30px;
383
+
384
+ th {
385
+ color: #333;
386
+ padding: 4px 10px;
387
+ line-height: 20px;
388
+ }
389
+
390
+ .rtm-edit-media-list-heading {
391
+ width: 44%;
392
+ }
393
+
394
+ .rtm-edit-media-list-title-heading {
395
+ width: 56%;
396
+ }
397
+
398
+ td.rtm-edit-media-list-edit,
399
+ td.rtm-edit-media-list-delete,
400
+ td.rtm-edit-media-list-title {
401
+ padding: 4px;
402
+ font-size: 14px;
403
+ line-height: 24px;
404
+
405
+ a, span {
406
+ @extend .rtmedia-text-link-decoration;
407
+ }
408
+ }
409
+
410
+ td.rtm-edit-media-list-title {
411
+ a {
412
+ text-decoration: none;
413
+ color: #333;
414
+ }
415
+ }
416
+
417
+ td.rtm-edit-media-list-edit {
418
+ text-align: center;
419
+
420
+ a {
421
+ color: #333;
422
+ font-size: 13px;
423
+ }
424
+ }
425
+
426
+ td.rtm-edit-media-list-delete {
427
+ text-align: center;
428
+
429
+ span {
430
+ color: #FF0000;
431
+ cursor: pointer;
432
+ font-size: 13px;
433
+ }
434
+ }
435
+ }
436
  }
437
 
438
+ .rtm-hide {
439
  display: none;
440
  }
app/assets/js/rtMedia.js CHANGED
@@ -173,7 +173,7 @@ jQuery( 'document' ).ready( function ( $ ) {
173
  })
174
  //rtmedia_lightbox_enabled from setting
175
  if (typeof(rtmedia_lightbox_enabled) != 'undefined' && rtmedia_lightbox_enabled == "1") {
176
- apply_rtMagnificPopup( '.rtmedia-list-media, .rtmedia-activity-container ul.rtmedia-list, #bp-media-list,.bp-media-sc-list, li.media.album_updated ul,ul.bp-media-list-media, li.activity-item div.activity-content div.activity-inner div.bp_media_content, .rtm-bbp-container, ul.rtm-comment-container' );
177
  }
178
 
179
  jQuery.ajaxPrefilter(function(options, originalOptions, jqXHR) {
173
  })
174
  //rtmedia_lightbox_enabled from setting
175
  if (typeof(rtmedia_lightbox_enabled) != 'undefined' && rtmedia_lightbox_enabled == "1") {
176
+ apply_rtMagnificPopup( '.rtmedia-list-media.rtm-gallery-list, .rtmedia-activity-container ul.rtmedia-list, #bp-media-list,.bp-media-sc-list, li.media.album_updated ul,ul.bp-media-list-media, li.activity-item div.activity-content div.activity-inner div.bp_media_content, .rtm-bbp-container, ul.rtm-comment-container' );
177
  }
178
 
179
  jQuery.ajaxPrefilter(function(options, originalOptions, jqXHR) {
app/assets/js/rtmedia.min.js CHANGED
@@ -2,5 +2,5 @@
2
  * rtMedia JavaScript Library
3
  * @package rtMedia
4
  */
5
- function apply_rtMagnificPopup(a){jQuery("document").ready(function(b){var c="";c="undefined"==typeof rtmedia_load_more?"Loading media":rtmedia_load_more,"undefined"!=typeof rtmedia_lightbox_enabled&&"1"==rtmedia_lightbox_enabled&&(b(".activity-item .rtmedia-activity-container .rtmedia-list-item > a").siblings("p").children("a").length>0&&b(".activity-item .rtmedia-activity-container .rtmedia-list-item > a").siblings("p").children("a").addClass("no-popup"),rtMagnificPopup=jQuery(a).magnificPopup({delegate:"a:not(.no-popup, .mejs-time-slider, .mejs-volume-slider, .mejs-horizontal-volume-slider)",type:"ajax",tLoading:c+" #%curr%...",mainClass:"mfp-img-mobile",preload:[1,3],closeOnBgClick:!0,gallery:{enabled:!0,navigateByImgClick:!0,arrowMarkup:"",preload:[0,1]},image:{tError:'<a href="%url%">The image #%curr%</a> could not be loaded.',titleSrc:function(a){return a.el.attr("title")+"<small>by Marsel Van Oosten</small>"}},callbacks:{ajaxContentAdded:function(){a=jQuery.magnificPopup.instance,1===jQuery(a.items).size()&&jQuery(".mfp-arrow").remove();var a=jQuery.magnificPopup.instance,c=a.currItem.el,d=c.parent();if(d.is("li")||(d=d.parent()),d.is(":nth-last-child(2)")||d.is(":last-child")){d.next();"block"==jQuery("#rtMedia-galary-next").css("display")&&jQuery("#rtMedia-galary-next").click()}var e=a.items.length;if(a.index==e-1&&!d.is(":last-child"))return void c.click();var f={};"undefined"!=typeof _wpmejsSettings&&(f.pluginPath=_wpmejsSettings.pluginPath),b(".mfp-content .wp-audio-shortcode,.mfp-content .wp-video-shortcode,.mfp-content .bp_media_content video").mediaelementplayer({defaultVideoWidth:480,defaultVideoHeight:270,success:function(a,b){a.play()}}),b(".mfp-content .mejs-audio .mejs-controls").css("position","relative"),rtMediaHook.call("rtmedia_js_popup_after_content_added",[])},close:function(a){rtmedia_init_action_dropdown()},BeforeChange:function(a){}}}))})}function rtmedia_init_action_dropdown(){var a,b;jQuery(".click-nav > span, .click-nav > div").toggleClass("no-js js"),jQuery(".click-nav .js ul").hide(),jQuery(".click-nav .clicker").click(function(c){a=jQuery("#rtm-media-options .click-nav .clicker").next("ul"),b=jQuery(this).next("ul"),jQuery.each(a,function(a,c){jQuery(c).html()!=b.html()&&jQuery(c).hide()}),jQuery(b).toggle(),c.stopPropagation()})}function bp_media_create_element(a){return!1}function rtmedia_version_compare(a,b){if(typeof a+typeof b!="stringstring")return!1;for(var c=a.split("."),d=b.split("."),e=0,f=Math.max(c.length,d.length);e<f;e++){if(c[e]&&!d[e]&&parseInt(c[e])>0||parseInt(c[e])>parseInt(d[e]))return!0;if(d[e]&&!c[e]&&parseInt(d[e])>0||parseInt(c[e])<parseInt(d[e]))return!1}return!0}function rtm_is_element_exist(a){return jQuery(a).length>0}function rtm_masonry_reload(a){setTimeout(function(){a.masonry("reload")},250)}function rtmediaGetParameterByName(a){a=a.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var b=new RegExp("[\\?&]"+a+"=([^&#]*)"),c=b.exec(location.search);return null==c?"":decodeURIComponent(c[1].replace(/\+/g," "))}function rtmedia_single_media_alert_message(a,b){var c="rtmedia-success";"warning"==b&&(c="rtmedia-warning"),jQuery(".rtmedia-single-media .rtmedia-media").css("opacity","0.2"),jQuery(".rtmedia-single-media .rtmedia-media").after("<div class='rtmedia-message-container'><span class='"+c+"'>"+a+" </span></div>"),setTimeout(function(){jQuery(".rtmedia-single-media .rtmedia-media").css("opacity","1"),jQuery(".rtmedia-message-container").remove()},3e3),jQuery(".rtmedia-message-container").click(function(){jQuery(".rtmedia-single-media .rtmedia-media").css("opacity","1"),jQuery(".rtmedia-message-container").remove()})}function rtmedia_gallery_action_alert_message(a,b){var c="rtmedia-success";"warning"==b&&(c="rtmedia-warning");var d='<div class="rtmedia-gallery-alert-container"> </div>';jQuery("body").append(d),jQuery(".rtmedia-gallery-alert-container").append("<div class='rtmedia-gallery-message-box'><span class='"+c+"'>"+a+" </span></div>"),setTimeout(function(){jQuery(".rtmedia-gallery-alert-container").remove()},3e3),jQuery(".rtmedia-gallery-message-box").click(function(){jQuery(".rtmedia-gallery-alert-container").remove()})}!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):window.jQuery||window.Zepto)}(function(a){var b,c,d,e,f,g,h="Close",i="BeforeClose",j="AfterClose",k="BeforeAppend",l="MarkupParse",m="Open",n="Change",o="mfp",p="."+o,q="mfp-ready",r="mfp-removing",s="mfp-prevent-close",t=function(){},u=!!window.jQuery,v=a(window),w=function(a,c){b.ev.on(o+a+p,c)},x=function(b,c,d,e){var f=document.createElement("div");return f.className="mfp-"+b,d&&(f.innerHTML=d),e?c&&c.appendChild(f):(f=a(f),c&&f.appendTo(c)),f},y=function(c,d){b.ev.triggerHandler(o+c,d),b.st.callbacks&&(c=c.charAt(0).toLowerCase()+c.slice(1),b.st.callbacks[c]&&b.st.callbacks[c].apply(b,a.isArray(d)?d:[d]))},z=function(c){return c===g&&b.currTemplate.closeBtn||(b.currTemplate.closeBtn=a(b.st.closeMarkup.replace("%title%",b.st.tClose)),g=c),b.currTemplate.closeBtn},A=function(){a.magnificPopup.instance||(b=new t,b.init(),a.magnificPopup.instance=b)},B=function(){var a=document.createElement("p").style,b=["ms","O","Moz","Webkit"];if(void 0!==a.transition)return!0;for(;b.length;)if(b.pop()+"Transition"in a)return!0;return!1};t.prototype={constructor:t,init:function(){var c=navigator.appVersion;b.isIE7=c.indexOf("MSIE 7.")!==-1,b.isIE8=c.indexOf("MSIE 8.")!==-1,b.isLowIE=b.isIE7||b.isIE8,b.isAndroid=/android/gi.test(c),b.isIOS=/iphone|ipad|ipod/gi.test(c),b.supportsTransition=B(),b.probablyMobile=b.isAndroid||b.isIOS||/(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent),d=a(document),b.popupsCache={}},open:function(c){var e;if(c.isObj===!1){b.items=c.items.toArray(),b.index=0;var g,h=c.items;for(e=0;e<h.length;e++)if(g=h[e],g.parsed&&(g=g.el[0]),g===c.el[0]){b.index=e;break}}else b.items=a.isArray(c.items)?c.items:[c.items],b.index=c.index||0;if(b.isOpen)return void b.updateItemHTML();b.types=[],f="",c.mainEl&&c.mainEl.length?b.ev=c.mainEl.eq(0):b.ev=d,c.key?(b.popupsCache[c.key]||(b.popupsCache[c.key]={}),b.currTemplate=b.popupsCache[c.key]):b.currTemplate={},b.st=a.extend(!0,{},a.magnificPopup.defaults,c),b.fixedContentPos="auto"===b.st.fixedContentPos?!b.probablyMobile:b.st.fixedContentPos,b.st.modal&&(b.st.closeOnContentClick=!1,b.st.closeOnBgClick=!1,b.st.showCloseBtn=!1,b.st.enableEscapeKey=!1),b.bgOverlay||(b.bgOverlay=x("bg").on("click"+p,function(){b.close()}),b.wrap=x("wrap").attr("tabindex",-1).on("click"+p,function(a){b._checkIfClose(a.target)&&b.close()}),b.container=x("container",b.wrap)),b.contentContainer=x("content"),b.st.preloader&&(b.preloader=x("preloader",b.container,b.st.tLoading));var i=a.magnificPopup.modules;for(e=0;e<i.length;e++){var j=i[e];j=j.charAt(0).toUpperCase()+j.slice(1),b["init"+j].call(b)}y("BeforeOpen"),b.st.showCloseBtn&&(b.st.closeBtnInside?(w(l,function(a,b,c,d){c.close_replaceWith=z(d.type)}),f+=" mfp-close-btn-in"):b.wrap.append(z())),b.st.alignTop&&(f+=" mfp-align-top"),b.fixedContentPos?b.wrap.css({overflow:b.st.overflowY,overflowX:"hidden",overflowY:b.st.overflowY}):b.wrap.css({top:v.scrollTop(),position:"absolute"}),(b.st.fixedBgPos===!1||"auto"===b.st.fixedBgPos&&!b.fixedContentPos)&&b.bgOverlay.css({height:d.height(),position:"absolute"}),b.st.enableEscapeKey&&d.on("keyup"+p,function(a){27===a.keyCode&&b.close()}),v.on("resize"+p,function(){b.updateSize()}),b.st.closeOnContentClick||(f+=" mfp-auto-cursor"),f&&b.wrap.addClass(f);var k=b.wH=v.height(),n={};if(b.fixedContentPos&&b._hasScrollBar(k)){var o=b._getScrollbarSize();o&&(n.marginRight=o)}b.fixedContentPos&&(b.isIE7?a("body, html").css("overflow","hidden"):n.overflow="hidden");var r=b.st.mainClass;return b.isIE7&&(r+=" mfp-ie7"),r&&b._addClassToMFP(r),b.updateItemHTML(),y("BuildControls"),a("html").css(n),b.bgOverlay.add(b.wrap).prependTo(b.st.prependTo||a(document.body)),b._lastFocusedEl=document.activeElement,setTimeout(function(){b.content?(b._addClassToMFP(q),b._setFocus()):b.bgOverlay.addClass(q),d.on("focusin"+p,b._onFocusIn)},16),b.isOpen=!0,b.updateSize(k),y(m),c},close:function(){b.isOpen&&(y(i),b.isOpen=!1,b.st.removalDelay&&!b.isLowIE&&b.supportsTransition?(b._addClassToMFP(r),setTimeout(function(){b._close()},b.st.removalDelay)):b._close())},_close:function(){y(h);var c=r+" "+q+" ";if(b.bgOverlay.detach(),b.wrap.detach(),b.container.empty(),b.st.mainClass&&(c+=b.st.mainClass+" "),b._removeClassFromMFP(c),b.fixedContentPos){var e={marginRight:""};b.isIE7?a("body, html").css("overflow",""):e.overflow="",a("html").css(e)}d.off("keyup"+p+" focusin"+p),b.ev.off(p),b.wrap.attr("class","mfp-wrap").removeAttr("style"),b.bgOverlay.attr("class","mfp-bg"),b.container.attr("class","mfp-container"),!b.st.showCloseBtn||b.st.closeBtnInside&&b.currTemplate[b.currItem.type]!==!0||b.currTemplate.closeBtn&&b.currTemplate.closeBtn.detach(),b._lastFocusedEl&&a(b._lastFocusedEl).focus(),b.currItem=null,b.content=null,b.currTemplate=null,b.prevHeight=0,y(j)},updateSize:function(a){if(b.isIOS){var c=document.documentElement.clientWidth/window.innerWidth,d=window.innerHeight*c;b.wrap.css("height",d),b.wH=d}else b.wH=a||v.height();b.fixedContentPos||b.wrap.css("height",b.wH),y("Resize")},updateItemHTML:function(){var c=b.items[b.index];b.contentContainer.detach(),b.content&&b.content.detach(),c.parsed||(c=b.parseEl(b.index));var d=c.type;if(y("BeforeChange",[b.currItem?b.currItem.type:"",d]),b.currItem=c,!b.currTemplate[d]){var f=!!b.st[d]&&b.st[d].markup;y("FirstMarkupParse",f),f?b.currTemplate[d]=a(f):b.currTemplate[d]=!0}e&&e!==c.type&&b.container.removeClass("mfp-"+e+"-holder");var g=b["get"+d.charAt(0).toUpperCase()+d.slice(1)](c,b.currTemplate[d]);b.appendContent(g,d),c.preloaded=!0,y(n,c),e=c.type,b.container.prepend(b.contentContainer),y("AfterChange")},appendContent:function(a,c){b.content=a,a?b.st.showCloseBtn&&b.st.closeBtnInside&&b.currTemplate[c]===!0?b.content.find(".mfp-close").length||b.content.append(z()):b.content=a:b.content="",y(k),b.container.addClass("mfp-"+c+"-holder"),b.contentContainer.append(b.content)},parseEl:function(c){var d,e=b.items[c];if(e.tagName?e={el:a(e)}:(d=e.type,e={data:e,src:e.src}),e.el){for(var f=b.types,g=0;g<f.length;g++)if(e.el.hasClass("mfp-"+f[g])){d=f[g];break}e.src=e.el.attr("data-mfp-src"),e.src||(e.src=e.el.attr("href"))}return e.type=d||b.st.type||"inline",e.index=c,e.parsed=!0,b.items[c]=e,y("ElementParse",e),b.items[c]},addGroup:function(a,c){var d=function(d){d.mfpEl=this,b._openClick(d,a,c)};c||(c={});var e="click.magnificPopup";c.mainEl=a,c.items?(c.isObj=!0,a.off(e).on(e,d)):(c.isObj=!1,c.delegate?a.off(e).on(e,c.delegate,d):(c.items=a,a.off(e).on(e,d)))},_openClick:function(c,d,e){var f=void 0!==e.midClick?e.midClick:a.magnificPopup.defaults.midClick;if(f||2!==c.which&&!c.ctrlKey&&!c.metaKey){var g=void 0!==e.disableOn?e.disableOn:a.magnificPopup.defaults.disableOn;if(g)if(a.isFunction(g)){if(!g.call(b))return!0}else if(v.width()<g)return!0;c.type&&(c.preventDefault(),b.isOpen&&c.stopPropagation()),e.el=a(c.mfpEl),e.delegate&&(e.items=d.find(e.delegate)),b.open(e)}},updateStatus:function(a,d){if(b.preloader){c!==a&&b.container.removeClass("mfp-s-"+c),d||"loading"!==a||(d=b.st.tLoading);var e={status:a,text:d};y("UpdateStatus",e),a=e.status,d=e.text,b.preloader.html(d),b.preloader.find("a").on("click",function(a){a.stopImmediatePropagation()}),b.container.addClass("mfp-s-"+a),c=a}},_checkIfClose:function(c){if(!a(c).hasClass(s)){var d=b.st.closeOnContentClick,e=b.st.closeOnBgClick;if(d&&e)return!0;if(!b.content||a(c).hasClass("mfp-close")||b.preloader&&c===b.preloader[0])return!0;if(c===b.content[0]||a.contains(b.content[0],c)){if(d)return!0}else if(e&&a.contains(document,c))return!0;return!1}},_addClassToMFP:function(a){b.bgOverlay.addClass(a),b.wrap.addClass(a)},_removeClassFromMFP:function(a){this.bgOverlay.removeClass(a),b.wrap.removeClass(a)},_hasScrollBar:function(a){return(b.isIE7?d.height():document.body.scrollHeight)>(a||v.height())},_setFocus:function(){(b.st.focus?b.content.find(b.st.focus).eq(0):b.wrap).focus()},_onFocusIn:function(c){if(c.target!==b.wrap[0]&&!a.contains(b.wrap[0],c.target))return b._setFocus(),!1},_parseMarkup:function(b,c,d){var e;d.data&&(c=a.extend(d.data,c)),y(l,[b,c,d]),a.each(c,function(a,c){if(void 0===c||c===!1)return!0;if(e=a.split("_"),e.length>1){var d=b.find(p+"-"+e[0]);if(d.length>0){var f=e[1];"replaceWith"===f?d[0]!==c[0]&&d.replaceWith(c):"img"===f?d.is("img")?d.attr("src",c):d.replaceWith('<img src="'+c+'" class="'+d.attr("class")+'" />'):d.attr(e[1],c)}}else b.find(p+"-"+a).html(c)})},_getScrollbarSize:function(){if(void 0===b.scrollbarSize){var a=document.createElement("div");a.style.cssText="width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;",document.body.appendChild(a),b.scrollbarSize=a.offsetWidth-a.clientWidth,document.body.removeChild(a)}return b.scrollbarSize}},a.magnificPopup={instance:null,proto:t.prototype,modules:[],open:function(b,c){return A(),b=b?a.extend(!0,{},b):{},b.isObj=!0,b.index=c||0,this.instance.open(b)},close:function(){return a.magnificPopup.instance&&a.magnificPopup.instance.close()},registerModule:function(b,c){c.options&&(a.magnificPopup.defaults[b]=c.options),a.extend(this.proto,c.proto),this.modules.push(b)},defaults:{disableOn:0,key:null,midClick:!1,mainClass:"",preloader:!0,focus:"",closeOnContentClick:!1,closeOnBgClick:!0,closeBtnInside:!0,showCloseBtn:!0,enableEscapeKey:!0,modal:!1,alignTop:!1,removalDelay:0,prependTo:null,fixedContentPos:"auto",fixedBgPos:"auto",overflowY:"auto",closeMarkup:'<button title="%title%" type="button" class="mfp-close">&times;</button>',tClose:"Close (Esc)",tLoading:"Loading..."}},a.fn.magnificPopup=function(c){A();var d=a(this);if("string"==typeof c)if("open"===c){var e,f=u?d.data("magnificPopup"):d[0].magnificPopup,g=parseInt(arguments[1],10)||0;f.items?e=f.items[g]:(e=d,f.delegate&&(e=e.find(f.delegate)),e=e.eq(g)),b._openClick({mfpEl:e},d,f)}else b.isOpen&&b[c].apply(b,Array.prototype.slice.call(arguments,1));else c=a.extend(!0,{},c),u?d.data("magnificPopup",c):d[0].magnificPopup=c,b.addGroup(d,c);return d};var C,D,E,F="inline",G=function(){E&&(D.after(E.addClass(C)).detach(),E=null)};a.magnificPopup.registerModule(F,{options:{hiddenClass:"hide",markup:"",tNotFound:"Content not found"},proto:{initInline:function(){b.types.push(F),w(h+"."+F,function(){G()})},getInline:function(c,d){if(G(),c.src){var e=b.st.inline,f=a(c.src);if(f.length){var g=f[0].parentNode;g&&g.tagName&&(D||(C=e.hiddenClass,D=x(C),C="mfp-"+C),E=f.after(D).detach().removeClass(C)),b.updateStatus("ready")}else b.updateStatus("error",e.tNotFound),f=a("<div>");return c.inlineElement=f,f}return b.updateStatus("ready"),b._parseMarkup(d,{},c),d}}});var H,I="ajax",J=function(){H&&a(document.body).removeClass(H)},K=function(){J(),b.req&&b.req.abort()};a.magnificPopup.registerModule(I,{options:{settings:null,cursor:"mfp-ajax-cur",tError:'<a href="%url%">The content</a> could not be loaded.'},proto:{initAjax:function(){b.types.push(I),H=b.st.ajax.cursor,w(h+"."+I,K),w("BeforeChange."+I,K)},getAjax:function(c){H&&a(document.body).addClass(H),b.updateStatus("loading");var d=a.extend({url:c.src,success:function(d,e,f){var g={data:d,xhr:f};y("ParseAjax",g),b.appendContent(a(g.data),I),c.finished=!0,J(),b._setFocus(),setTimeout(function(){b.wrap.addClass(q)},16),b.updateStatus("ready"),y("AjaxContentAdded")},error:function(){J(),c.finished=c.loadError=!0,b.updateStatus("error",b.st.ajax.tError.replace("%url%",c.src))}},b.st.ajax.settings);return b.req=a.ajax(d),""}}});var L,M=function(c){if(c.data&&void 0!==c.data.title)return c.data.title;var d=b.st.image.titleSrc;if(d){if(a.isFunction(d))return d.call(b,c);if(c.el)return c.el.attr(d)||""}return""};a.magnificPopup.registerModule("image",{options:{markup:'<div class="mfp-figure"><div class="mfp-close"></div><figure><div class="mfp-img"></div><figcaption><div class="mfp-bottom-bar"><div class="mfp-title"></div><div class="mfp-counter"></div></div></figcaption></figure></div>',cursor:"mfp-zoom-out-cur",titleSrc:"title",verticalFit:!0,tError:'<a href="%url%">The image</a> could not be loaded.'},proto:{initImage:function(){var c=b.st.image,d=".image";b.types.push("image"),w(m+d,function(){"image"===b.currItem.type&&c.cursor&&a(document.body).addClass(c.cursor)}),w(h+d,function(){c.cursor&&a(document.body).removeClass(c.cursor),v.off("resize"+p)}),w("Resize"+d,b.resizeImage),b.isLowIE&&w("AfterChange",b.resizeImage)},resizeImage:function(){var a=b.currItem;if(a&&a.img&&b.st.image.verticalFit){var c=0;b.isLowIE&&(c=parseInt(a.img.css("padding-top"),10)+parseInt(a.img.css("padding-bottom"),10)),a.img.css("max-height",b.wH-c)}},_onImageHasSize:function(a){a.img&&(a.hasSize=!0,L&&clearInterval(L),a.isCheckingImgSize=!1,y("ImageHasSize",a),a.imgHidden&&(b.content&&b.content.removeClass("mfp-loading"),a.imgHidden=!1))},findImageSize:function(a){var c=0,d=a.img[0],e=function(f){L&&clearInterval(L),L=setInterval(function(){return d.naturalWidth>0?void b._onImageHasSize(a):(c>200&&clearInterval(L),c++,void(3===c?e(10):40===c?e(50):100===c&&e(500)))},f)};e(1)},getImage:function(c,d){var e=0,f=function(){c&&(c.img[0].complete?(c.img.off(".mfploader"),c===b.currItem&&(b._onImageHasSize(c),b.updateStatus("ready")),c.hasSize=!0,c.loaded=!0,y("ImageLoadComplete")):(e++,e<200?setTimeout(f,100):g()))},g=function(){c&&(c.img.off(".mfploader"),c===b.currItem&&(b._onImageHasSize(c),b.updateStatus("error",h.tError.replace("%url%",c.src))),c.hasSize=!0,c.loaded=!0,c.loadError=!0)},h=b.st.image,i=d.find(".mfp-img");if(i.length){var j=document.createElement("img");j.className="mfp-img",c.el&&c.el.find("img").length&&(j.alt=c.el.find("img").attr("alt")),c.img=a(j).on("load.mfploader",f).on("error.mfploader",g),j.src=c.src,i.is("img")&&(c.img=c.img.clone()),j=c.img[0],j.naturalWidth>0?c.hasSize=!0:j.width||(c.hasSize=!1)}return b._parseMarkup(d,{title:M(c),img_replaceWith:c.img},c),b.resizeImage(),c.hasSize?(L&&clearInterval(L),c.loadError?(d.addClass("mfp-loading"),b.updateStatus("error",h.tError.replace("%url%",c.src))):(d.removeClass("mfp-loading"),b.updateStatus("ready")),d):(b.updateStatus("loading"),c.loading=!0,c.hasSize||(c.imgHidden=!0,d.addClass("mfp-loading"),b.findImageSize(c)),d)}}});var N,O=function(){return void 0===N&&(N=void 0!==document.createElement("p").style.MozTransform),N};a.magnificPopup.registerModule("zoom",{options:{enabled:!1,easing:"ease-in-out",duration:300,opener:function(a){return a.is("img")?a:a.find("img")}},proto:{initZoom:function(){var a,c=b.st.zoom,d=".zoom";if(c.enabled&&b.supportsTransition){var e,f,g=c.duration,j=function(a){var b=a.clone().removeAttr("style").removeAttr("class").addClass("mfp-animated-image"),d="all "+c.duration/1e3+"s "+c.easing,e={position:"fixed",zIndex:9999,left:0,top:0,"-webkit-backface-visibility":"hidden"},f="transition";return e["-webkit-"+f]=e["-moz-"+f]=e["-o-"+f]=e[f]=d,b.css(e),b},k=function(){b.content.css("visibility","visible")};w("BuildControls"+d,function(){if(b._allowZoom()){if(clearTimeout(e),b.content.css("visibility","hidden"),a=b._getItemToZoom(),!a)return void k();f=j(a),f.css(b._getOffset()),b.wrap.append(f),e=setTimeout(function(){f.css(b._getOffset(!0)),e=setTimeout(function(){k(),setTimeout(function(){f.remove(),a=f=null,y("ZoomAnimationEnded")},16)},g)},16)}}),w(i+d,function(){if(b._allowZoom()){if(clearTimeout(e),b.st.removalDelay=g,!a){if(a=b._getItemToZoom(),!a)return;f=j(a)}f.css(b._getOffset(!0)),b.wrap.append(f),b.content.css("visibility","hidden"),setTimeout(function(){f.css(b._getOffset())},16)}}),w(h+d,function(){b._allowZoom()&&(k(),f&&f.remove(),a=null)})}},_allowZoom:function(){return"image"===b.currItem.type},_getItemToZoom:function(){return!!b.currItem.hasSize&&b.currItem.img},_getOffset:function(c){var d;d=c?b.currItem.img:b.st.zoom.opener(b.currItem.el||b.currItem);var e=d.offset(),f=parseInt(d.css("padding-top"),10),g=parseInt(d.css("padding-bottom"),10);e.top-=a(window).scrollTop()-f;var h={width:d.width(),height:(u?d.innerHeight():d[0].offsetHeight)-g-f};return O()?h["-moz-transform"]=h.transform="translate("+e.left+"px,"+e.top+"px)":(h.left=e.left,h.top=e.top),h}}});var P="iframe",Q="//about:blank",R=function(a){if(b.currTemplate[P]){var c=b.currTemplate[P].find("iframe");c.length&&(a||(c[0].src=Q),b.isIE8&&c.css("display",a?"block":"none"))}};a.magnificPopup.registerModule(P,{options:{markup:'<div class="mfp-iframe-scaler"><div class="mfp-close"></div><iframe class="mfp-iframe" src="//about:blank" frameborder="0" allowfullscreen></iframe></div>',srcAction:"iframe_src",patterns:{youtube:{index:"youtube.com",id:"v=",src:"//www.youtube.com/embed/%id%?autoplay=1"},vimeo:{index:"vimeo.com/",id:"/",src:"//player.vimeo.com/video/%id%?autoplay=1"},gmaps:{index:"//maps.google.",src:"%id%&output=embed"}}},proto:{initIframe:function(){b.types.push(P),w("BeforeChange",function(a,b,c){b!==c&&(b===P?R():c===P&&R(!0))}),w(h+"."+P,function(){R()})},getIframe:function(c,d){var e=c.src,f=b.st.iframe;a.each(f.patterns,function(){if(e.indexOf(this.index)>-1)return this.id&&(e="string"==typeof this.id?e.substr(e.lastIndexOf(this.id)+this.id.length,e.length):this.id.call(this,e)),e=this.src.replace("%id%",e),!1});var g={};return f.srcAction&&(g[f.srcAction]=e),b._parseMarkup(d,g,c),b.updateStatus("ready"),d}}});var S=function(a){var c=b.items.length;return a>c-1?a-c:a<0?c+a:a},T=function(a,b,c){return a.replace(/%curr%/gi,b+1).replace(/%total%/gi,c)};a.magnificPopup.registerModule("gallery",{options:{enabled:!1,arrowMarkup:'<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>',preload:[0,2],navigateByImgClick:!0,arrows:!0,tPrev:"Previous (Left arrow key)",tNext:"Next (Right arrow key)",tCounter:"%curr% of %total%"},proto:{initGallery:function(){var c=b.st.gallery,e=".mfp-gallery",g=Boolean(a.fn.mfpFastClick);return b.direction=!0,!(!c||!c.enabled)&&(f+=" mfp-gallery",w(m+e,function(){c.navigateByImgClick&&b.wrap.on("click"+e,".mfp-img",function(){if(b.items.length>1)return b.next(),!1}),d.on("keydown"+e,function(a){37===a.keyCode?b.prev():39===a.keyCode&&b.next()})}),w("UpdateStatus"+e,function(a,c){c.text&&(c.text=T(c.text,b.currItem.index,b.items.length))}),w(l+e,function(a,d,e,f){var g=b.items.length;e.counter=g>1?T(c.tCounter,f.index,g):""}),w("BuildControls"+e,function(){if(b.items.length>1&&c.arrows&&!b.arrowLeft){var d=c.arrowMarkup,e=b.arrowLeft=a(d.replace(/%title%/gi,c.tPrev).replace(/%dir%/gi,"left")).addClass(s),f=b.arrowRight=a(d.replace(/%title%/gi,c.tNext).replace(/%dir%/gi,"right")).addClass(s),h=g?"mfpFastClick":"click";e[h](function(){b.prev()}),f[h](function(){b.next()}),b.isIE7&&(x("b",e[0],!1,!0),x("a",e[0],!1,!0),x("b",f[0],!1,!0),x("a",f[0],!1,!0)),b.container.append(e.add(f))}}),w(n+e,function(){b._preloadTimeout&&clearTimeout(b._preloadTimeout),b._preloadTimeout=setTimeout(function(){b.preloadNearbyImages(),b._preloadTimeout=null},16)}),void w(h+e,function(){d.off(e),b.wrap.off("click"+e),b.arrowLeft&&g&&b.arrowLeft.add(b.arrowRight).destroyMfpFastClick(),b.arrowRight=b.arrowLeft=null}))},next:function(){b.direction=!0,b.index=S(b.index+1),b.updateItemHTML()},prev:function(){b.direction=!1,b.index=S(b.index-1),b.updateItemHTML()},goTo:function(a){b.direction=a>=b.index,b.index=a,b.updateItemHTML()},preloadNearbyImages:function(){var a,c=b.st.gallery.preload,d=Math.min(c[0],b.items.length),e=Math.min(c[1],b.items.length);for(a=1;a<=(b.direction?e:d);a++)b._preloadItem(b.index+a);for(a=1;a<=(b.direction?d:e);a++)b._preloadItem(b.index-a)},_preloadItem:function(c){if(c=S(c),!b.items[c].preloaded){var d=b.items[c];d.parsed||(d=b.parseEl(c)),y("LazyLoad",d),"image"===d.type&&(d.img=a('<img class="mfp-img" />').on("load.mfploader",function(){d.hasSize=!0}).on("error.mfploader",function(){d.hasSize=!0,d.loadError=!0,y("LazyLoadError",d)}).attr("src",d.src)),d.preloaded=!0}}}});var U="retina";a.magnificPopup.registerModule(U,{options:{replaceSrc:function(a){return a.src.replace(/\.\w+$/,function(a){return"@2x"+a})},ratio:1},proto:{initRetina:function(){if(window.devicePixelRatio>1){var a=b.st.retina,c=a.ratio;c=isNaN(c)?c():c,c>1&&(w("ImageHasSize."+U,function(a,b){b.img.css({"max-width":b.img[0].naturalWidth/c,width:"100%"})}),w("ElementParse."+U,function(b,d){d.src=a.replaceSrc(d,c)}))}}}}),function(){var b=1e3,c="ontouchstart"in window,d=function(){v.off("touchmove"+f+" touchend"+f)},e="mfpFastClick",f="."+e;a.fn.mfpFastClick=function(e){return a(this).each(function(){var g,h=a(this);if(c){var i,j,k,l,m,n;h.on("touchstart"+f,function(a){l=!1,n=1,m=a.originalEvent?a.originalEvent.touches[0]:a.touches[0],j=m.clientX,k=m.clientY,v.on("touchmove"+f,function(a){m=a.originalEvent?a.originalEvent.touches:a.touches,n=m.length,m=m[0],(Math.abs(m.clientX-j)>10||Math.abs(m.clientY-k)>10)&&(l=!0,d())}).on("touchend"+f,function(a){d(),l||n>1||(g=!0,a.preventDefault(),clearTimeout(i),i=setTimeout(function(){g=!1},b),e())})})}h.on("click"+f,function(){g||e()})})},a.fn.destroyMfpFastClick=function(){a(this).off("touchstart"+f+" click"+f),c&&v.off("touchmove"+f+" touchend"+f)}}(),A()}),"function"!=typeof Object.create&&(Object.create=function(a){function b(){}return b.prototype=a,new b}),function(a,b,c,d){var e={init:function(b,c){var d=this;d.elem=c,d.$elem=a(c),d.options=a.extend({},a.fn.rtTab.options,b),d.rtTabs()},rtTabs:function(){var c=this,d=c.options.activeTab;c.$elem.find("li:nth-child("+d+")").addClass("active"),c.rtTabContent(activeTabContent="yes"),c.rtClick();var e="false"!==c.$elem.attr("data-hash");if(e===!0){var f=b.location.hash;f&&c.$elem.find("li").find('a[href="'+f+'"]').trigger("click"),a(b).on("hashchange",function(){var a=b.location.hash;c.$elem.find("li").find('a[href="'+a+'"]').trigger("click")})}},rtClick:function(){var c=this,d=c.$elem.find("li"),e=d.find("a");e.on("click",function(e){e.preventDefault(),d.removeClass("active"),c.rtTabContent(),a(this).parent().addClass("active");var f=a(this).attr("href");a(f).removeClass("hide");var g="false"!==c.$elem.attr("data-hash");if(g===!0){var h=a(b).scrollTop();location.hash=a(this).attr("href"),a(b).scrollTop(h)}"function"==typeof c.options.onComplete&&c.options.onComplete.apply(c.elem,arguments)})},rtTabContent:function(b){var c=this,d=c.$elem.find("li"),e=d.find("a");e.each(function(){var c=a(this),d=c.attr("href");"yes"===b?c.parent().hasClass("active")||a(d).addClass("hide"):a(d).addClass("hide")})}};a.fn.rtTab=function(b){return this.each(function(){var c=Object.create(e);c.init(b,this),a.data(this,"rtTab",c)})},a.fn.rtTab.options={activeTab:1,onComplete:null}}(jQuery,window,document);var rtMagnificPopup,rtm_masonry_container,rtMediaHook={hooks:[],is_break:!1,register:function(a,b){"undefined"==typeof rtMediaHook.hooks[a]&&(rtMediaHook.hooks[a]=[]),rtMediaHook.hooks[a].push(b)},call:function(a,arguments){if("undefined"!=typeof rtMediaHook.hooks[a])for(i=0;i<rtMediaHook.hooks[a].length;++i)if(1!=rtMediaHook.hooks[a][i](arguments))return rtMediaHook.is_break=!0,!1;return!0}};jQuery("document").ready(function(a){function b(){if(jQuery("#rtmedia-media-view-form").length>0){var a=jQuery("#rtmedia-media-view-form").attr("action");jQuery.post(a,{},function(a){})}}function c(){var a=jQuery.magnificPopup.instance;jQuery(".mfp-arrow-right").on("click",function(b){a.next()}),jQuery(".mfp-arrow-left").on("click",function(b){a.prev()}),jQuery(".mfp-content .rtmedia-media").swipe({swipeLeft:function(b,c,d,e,f){a.next()},swipeRight:function(b,c,d,e,f){a.prev()},threshold:0})}function d(){jQuery(document).on("focusin","#comment_content",function(){jQuery(document).unbind("keydown")}),jQuery(document).on("focusout","#comment_content",function(){var a=jQuery.magnificPopup.instance;jQuery(document).on("keydown",function(b){37===b.keyCode?a.prev():39===b.keyCode&&a.next()})})}function e(){jQuery(".rtmedia-container").on("click",".rtmedia-delete-media",function(a){a.preventDefault(),confirm(rtmedia_media_delete_confirmation)&&jQuery(this).closest("form").submit()})}"undefined"!=typeof a.fn.rtTab&&a(".rtm-tabs").rtTab(),jQuery(".rtmedia-modal-link").length>0&&a(".rtmedia-modal-link").magnificPopup({type:"inline",midClick:!0,closeBtnInside:!0}),a("#rt_media_comment_form").submit(function(b){return""!=a.trim(a("#comment_content").val())||(0==jQuery("#rtmedia-single-media-container").length?rtmedia_gallery_action_alert_message(rtmedia_empty_comment_msg,"warning"):rtmedia_single_media_alert_message(rtmedia_empty_comment_msg,"warning"),!1)}),a("li.rtmedia-list-item p a").each(function(b){a(this).addClass("no-popup")}),a("li.rtmedia-list-item p a").each(function(b){a(this).addClass("no-popup")}),"undefined"!=typeof rtmedia_lightbox_enabled&&"1"==rtmedia_lightbox_enabled&&apply_rtMagnificPopup(".rtmedia-list-media, .rtmedia-activity-container ul.rtmedia-list, #bp-media-list,.bp-media-sc-list, li.media.album_updated ul,ul.bp-media-list-media, li.activity-item div.activity-content div.activity-inner div.bp_media_content, .rtm-bbp-container, ul.rtm-comment-container"),jQuery.ajaxPrefilter(function(a,b,c){try{if(null==b.data||"undefined"==typeof b.data||"undefined"==typeof b.data.action)return!0}catch(d){return!0}if("activity_get_older_updates"==b.data.action){var e=b.success;a.success=function(a){e(a),apply_rtMagnificPopup(".rtmedia-activity-container ul.rtmedia-list, #bp-media-list, .bp-media-sc-list, li.media.album_updated ul,ul.bp-media-list-media, li.activity-item div.activity-content div.activity-inner div.bp_media_content"),rtMediaHook.call("rtmedia_js_after_activity_added",[])}}else if("get_single_activity_content"==b.data.action){var e=b.success;a.success=function(a){e(a),setTimeout(function(){apply_rtMagnificPopup(".rtmedia-activity-container ul.rtmedia-list, #bp-media-list, .bp-media-sc-list, li.media.album_updated ul,ul.bp-media-list-media, li.activity-item div.activity-content div.activity-inner div.bp_media_content"),jQuery("ul.activity-list li.rtmedia_update:first-child .wp-audio-shortcode, ul.activity-list li.rtmedia_update:first-child .wp-video-shortcode").mediaelementplayer({defaultVideoWidth:480,defaultVideoHeight:270})},900)}}}),jQuery.ajaxPrefilter(function(a,b,c){try{if(null==b.data||"undefined"==typeof b.data||"undefined"==typeof b.data.action)return!0}catch(d){return!0}if("activity_get_older_updates"==b.data.action){var e=b.success;a.success=function(a){e(a),apply_rtMagnificPopup(".rtmedia-activity-container ul.rtmedia-list, #bp-media-list, .bp-media-sc-list, li.media.album_updated ul,ul.bp-media-list-media, li.activity-item div.activity-content div.activity-inner div.bp_media_content"),jQuery("ul.activity-list li.rtmedia_update div.rtmedia-item-thumbnail > audio.wp-audio-shortcode, ul.activity-list li.rtmedia_update div.rtmedia-item-thumbnail > video.wp-video-shortcode").mediaelementplayer({defaultVideoWidth:480,defaultVideoHeight:270}),rtMediaHook.call("rtmedia_js_after_activity_added",[])}}}),jQuery(".rtmedia-container").on("click",".select-all",function(a){jQuery(this).toggleClass("unselect-all").toggleClass("select-all"),jQuery(this).attr("title",rtmedia_unselect_all_visible),jQuery(".rtmedia-list input").each(function(){jQuery(this).prop("checked",!0)}),jQuery(".rtmedia-list-item").addClass("bulk-selected")}),jQuery(".rtmedia-container").on("click",".unselect-all",function(a){jQuery(this).toggleClass("select-all").toggleClass("unselect-all"),jQuery(this).attr("title",rtmedia_select_all_visible),jQuery(".rtmedia-list input").each(function(){jQuery(this).prop("checked",!1)}),jQuery(".rtmedia-list-item").removeClass("bulk-selected")}),jQuery(".rtmedia-container").on("click",".rtmedia-move",function(a){jQuery(".rtmedia-delete-container").slideUp(),jQuery(".rtmedia-move-container").slideToggle()}),jQuery("#rtmedia-create-album-modal").on("click","#rtmedia_create_new_album",function(b){if($albumname=jQuery("<span/>").text(jQuery.trim(jQuery("#rtmedia_album_name").val())).html(),$context=jQuery.trim(jQuery("#rtmedia_album_context").val()),
6
- $context_id=jQuery.trim(jQuery("#rtmedia_album_context_id").val()),$privacy=jQuery.trim(jQuery("#rtmedia_select_album_privacy").val()),$create_album_nonce=jQuery.trim(jQuery("#rtmedia_create_album_nonce").val()),""!=$albumname){var c={action:"rtmedia_create_album",name:$albumname,context:$context,context_id:$context_id,create_album_nonce:$create_album_nonce};""!==$privacy&&(c.privacy=$privacy),a("#rtmedia_create_new_album").attr("disabled","disabled");var d=a("#rtmedia_create_new_album").html();a("#rtmedia_create_new_album").prepend("<img src='"+rMedia_loading_file+"' />"),jQuery.post(rtmedia_ajax_url,c,function(b){if("undefined"!=typeof b.album){b=jQuery.trim(b.album);var c=!0;jQuery(".rtmedia-user-album-list").each(function(){if(jQuery(this).children("optgroup").each(function(){if(jQuery(this).attr("value")===$context)return c=!1,void jQuery(this).append('<option value="'+b+'">'+$albumname+"</option>")}),c){var a=$context.charAt(0).toUpperCase()+$context.slice(1)+" "+rtmedia_main_js_strings.rtmedia_albums,d='<optgroup value="'+$context+'" label="'+a+'"><option value="'+b+'">'+$albumname+"</option></optgroup>";jQuery(this).append(d)}}),jQuery('select.rtmedia-user-album-list option[value="'+b+'"]').prop("selected",!0),jQuery(".rtmedia-create-new-album-container").slideToggle(),jQuery("#rtmedia_album_name").val(""),jQuery("#rtmedia-create-album-modal").append("<div class='rtmedia-success rtmedia-create-album-alert'><b>"+$albumname+"</b>"+rtmedia_album_created_msg+"</div>"),setTimeout(function(){jQuery(".rtmedia-create-album-alert").remove()},4e3),setTimeout(function(){galleryObj.reloadView(),jQuery(".close-reveal-modal").click()},2e3)}else"undefined"!=typeof b.error?rtmedia_gallery_action_alert_message(b.error,"warning"):rtmedia_gallery_action_alert_message(rtmedia_something_wrong_msg,"warning");a("#rtmedia_create_new_album").removeAttr("disabled"),a("#rtmedia_create_new_album").html(d)})}else rtmedia_gallery_action_alert_message(rtmedia_empty_album_name_msg,"warning")}),jQuery(".rtmedia-container").on("click",".rtmedia-delete-selected",function(a){jQuery(".rtmedia-list :checkbox:checked").length>0?confirm(rtmedia_selected_media_delete_confirmation)&&jQuery(this).closest("form").attr("action","../../../"+rtmedia_media_slug+"/delete").submit():rtmedia_gallery_action_alert_message(rtmedia_no_media_selected,"warning")}),jQuery(".rtmedia-container").on("click",".rtmedia-move-selected",function(a){jQuery(".rtmedia-list :checkbox:checked").length>0?confirm(rtmedia_selected_media_move_confirmation)&&jQuery(this).closest("form").attr("action","").submit():rtmedia_gallery_action_alert_message(rtmedia_no_media_selected,"warning")}),jQuery("#buddypress").on("change",".rtm-activity-privacy-opt",function(){var a=jQuery(this).attr("id");a=a.split("-"),a=a[a.length-1];var b=this;data={activity_id:a,privacy:jQuery(this).val(),nonce:jQuery("#rtmedia_activity_privacy_nonce").val(),action:"rtm_change_activity_privacy"},jQuery.post(ajaxurl,data,function(a){var c="",d="";"true"==a?(c=rtmedia_main_js_strings.privacy_update_success,d="success"):(c=rtmedia_main_js_strings.privacy_update_error,d="fail"),jQuery(b).after('<p class="rtm-ac-privacy-updated '+d+'">'+c+"</p>"),setTimeout(function(){jQuery(b).siblings(".rtm-ac-privacy-updated").remove()},2e3)})}),b(),rtMediaHook.register("rtmedia_js_popup_after_content_added",function(){b(),e(),mfp=jQuery.magnificPopup.instance,jQuery(mfp.items).size()>1&&c(),d();var f=a(window).height();jQuery(".rtm-lightbox-container .mejs-video").css({height:.8*f,"over-flow":"hidden"}),jQuery(".mfp-content .rtmedia-media").css({"max-height":.87*f,"over-flow":"hidden"}),rtmedia_init_action_dropdown(),jQuery(".rtmedia-comment-link").on("click",function(a){a.preventDefault(),jQuery("#comment_content").focus()}),jQuery(".rtm-more").shorten({showChars:130});var g=a(".rtm-gallery-title"),h="";h=a.isEmptyObject(g)?a("#subnav.item-list-tabs li.selected ").html():g.html(),""!=h&&a(".rtm-ltb-gallery-title .ltb-title").html(h);var i=a("#subnav.item-list-tabs li.selected span").html();return a("li.total").html(i),!0});var f=jQuery("#drag-drop-area"),g=jQuery("#whats-new");f.html();jQuery("#rtmedia-upload-container").after("<div id='rtm-drop-files-title'>"+rtmedia_drop_media_msg+"</div>"),"undefined"!=typeof rtmedia_bp_enable_activity&&"1"==rtmedia_bp_enable_activity&&jQuery("#whats-new-textarea").append("<div id='rtm-drop-files-title'>"+rtmedia_drop_media_msg+"</div>"),jQuery(document).on("dragover",function(a){jQuery("#rtm-media-gallery-uploader").show(),"undefined"!=typeof rtmedia_bp_enable_activity&&"1"==rtmedia_bp_enable_activity&&g.addClass("rtm-drag-drop-active"),f.addClass("rtm-drag-drop-active"),jQuery("#rtm-drop-files-title").show()}).on("dragleave",function(a){a.preventDefault(),"undefined"!=typeof rtmedia_bp_enable_activity&&"1"==rtmedia_bp_enable_activity&&(g.removeClass("rtm-drag-drop-active"),g.removeAttr("style")),f.removeClass("rtm-drag-drop-active"),jQuery("#rtm-drop-files-title").hide()}).on("drop",function(a){a.preventDefault(),"undefined"!=typeof rtmedia_bp_enable_activity&&"1"==rtmedia_bp_enable_activity&&(g.removeClass("rtm-drag-drop-active"),g.removeAttr("style")),f.removeClass("rtm-drag-drop-active"),jQuery("#rtm-drop-files-title").hide()}),jQuery(".rtmedia-container").on("click",".rtmedia-delete-album",function(a){a.preventDefault(),confirm(rtmedia_album_delete_confirmation)&&jQuery(this).closest("form").submit()}),jQuery(".rtmedia-container").on("click",".rtmedia-delete-media",function(a){a.preventDefault(),confirm(rtmedia_media_delete_confirmation)&&jQuery(this).closest("form").submit()}),rtmedia_init_action_dropdown(),a(document).click(function(){a(".click-nav ul").is(":visible")&&a(".click-nav ul",this).hide()}),jQuery(".rtmedia-comment-link").on("click",function(a){a.preventDefault(),jQuery("#comment_content").focus()}),jQuery(".rtm-more").length>0&&a(".rtm-more").shorten({showChars:200}),"undefined"!=typeof rtmedia_masonry_layout&&"true"==rtmedia_masonry_layout&&0==jQuery(".rtmedia-container .rtmedia-list.rtm-no-masonry").length&&(rtm_masonry_container=jQuery(".rtmedia-container .rtmedia-list"),rtm_masonry_container.masonry({itemSelector:".rtmedia-list-item"}),setInterval(function(){jQuery.each(jQuery(".rtmedia-list.masonry .rtmedia-item-title"),function(a,b){jQuery(b).width(jQuery(b).siblings(".rtmedia-item-thumbnail").children("img").width())}),rtm_masonry_reload(rtm_masonry_container)},1e3),jQuery.each(jQuery(".rtmedia-list.masonry .rtmedia-item-title"),function(a,b){jQuery(b).width(jQuery(b).siblings(".rtmedia-item-thumbnail").children("img").width())})),jQuery(".rtm-uploader-tabs").length>0&&jQuery(".rtm-uploader-tabs li").click(function(a){jQuery(this).hasClass("active")||(jQuery(this).siblings().removeClass("active"),jQuery(this).parents(".rtm-uploader-tabs").siblings().hide(),class_name=jQuery(this).attr("class"),jQuery(this).parents(".rtm-uploader-tabs").siblings('[data-id="'+class_name+'"]').show(),jQuery(this).addClass("active"),"rtm-upload-tab"!=class_name?jQuery("div.moxie-shim").children("input[type=file]").hide():jQuery("div.moxie-shim").children("input[type=file]").show())}),jQuery(".rtmedia-container").on("click",".rtm-delete-media",function(a){a.preventDefault();var b="Are you sure you want to delete this media?";if("undefined"!=typeof rtmedia_media_delete_confirmation&&(b=rtmedia_media_delete_confirmation),confirm(b)){var c=jQuery(this).closest("li"),d=jQuery("#rtmedia_media_delete_nonce").val(),e={action:"delete_uploaded_media",nonce:d,media_id:c.attr("id")};jQuery.ajax({url:ajaxurl,type:"post",data:e,success:function(a){"1"==a?(rtmedia_gallery_action_alert_message(rtmedia_main_js_strings.file_delete_success,"success"),c.remove(),"undefined"!=typeof rtmedia_masonry_layout&&"true"==rtmedia_masonry_layout&&0==jQuery(".rtmedia-container .rtmedia-list.rtm-no-masonry").length&&rtm_masonry_reload(rtm_masonry_container)):rtmedia_gallery_action_alert_message(rtmedia_file_not_deleted,"warning")}})}})}),function(a){a.fn.shorten=function(b){"use strict";var c={showChars:100,minHideChars:10,ellipsesText:"...",moreText:"Read more",lessText:"Show less",onLess:function(){},onMore:function(){},errMsg:null,force:!1};return b&&a.extend(c,b),!(a(this).data("jquery.shorten")&&!c.force)&&(a(this).data("jquery.shorten",!0),a(document).off("click",".morelink"),a(document).on({click:function(){var b=a(this);return b.hasClass("less")?(b.removeClass("less"),b.html(c.moreText),b.parent().prev().hide(0,function(){b.parent().prev().prev().show()}).hide(0,function(){c.onLess()})):(b.addClass("less"),b.html(c.lessText),b.parent().prev().show(0,function(){b.parent().prev().prev().hide()}).show(0,function(){c.onMore()})),!1}},".morelink"),this.each(function(){var b=a(this),d=b.html(),e=b.text().length;if(e>c.showChars+c.minHideChars){var f=d.substr(0,c.showChars);if(f.indexOf("<")>=0){for(var g=!1,h="",i=0,k=[],l=null,m=0,n=0;n<=c.showChars;m++)if("<"!=d[m]||g||(g=!0,l=d.substring(m+1,d.indexOf(">",m)),"/"==l[0]?l!="/"+k[0]?c.errMsg="ERROR en HTML: the top of the stack should be the tag that closes":k.shift():"br"!=l.toLowerCase()&&k.unshift(l)),g&&">"==d[m]&&(g=!1),g)h+=d.charAt(m);else if(n++,i<=c.showChars)h+=d.charAt(m),i++;else if(k.length>0){for(j=0;j<k.length;j++)h+="</"+k[j]+">";break}f=a("<div/>").html(h+'<span class="ellip">'+c.ellipsesText+"</span>").html()}else f+=c.ellipsesText;var o='<div class="shortcontent">'+f+'</div><div class="allcontent">'+d+'</div><span><a href="javascript://nop/" class="morelink">'+c.moreText+"</a></span>";b.html(o),b.find(".allcontent").hide(),a(".shortcontent p:last",b).css("margin-bottom",0)}}))}}(jQuery),window.onload=function(){"undefined"!=typeof rtmedia_masonry_layout&&"true"==rtmedia_masonry_layout&&0==jQuery(".rtmedia-container .rtmedia-list.rtm-no-masonry").length&&rtm_masonry_reload(rtm_masonry_container)};
2
  * rtMedia JavaScript Library
3
  * @package rtMedia
4
  */
5
+ function apply_rtMagnificPopup(a){jQuery("document").ready(function(b){var c="";c="undefined"==typeof rtmedia_load_more?"Loading media":rtmedia_load_more,"undefined"!=typeof rtmedia_lightbox_enabled&&"1"==rtmedia_lightbox_enabled&&(b(".activity-item .rtmedia-activity-container .rtmedia-list-item > a").siblings("p").children("a").length>0&&b(".activity-item .rtmedia-activity-container .rtmedia-list-item > a").siblings("p").children("a").addClass("no-popup"),rtMagnificPopup=jQuery(a).magnificPopup({delegate:"a:not(.no-popup, .mejs-time-slider, .mejs-volume-slider, .mejs-horizontal-volume-slider)",type:"ajax",tLoading:c+" #%curr%...",mainClass:"mfp-img-mobile",preload:[1,3],closeOnBgClick:!0,gallery:{enabled:!0,navigateByImgClick:!0,arrowMarkup:"",preload:[0,1]},image:{tError:'<a href="%url%">The image #%curr%</a> could not be loaded.',titleSrc:function(a){return a.el.attr("title")+"<small>by Marsel Van Oosten</small>"}},callbacks:{ajaxContentAdded:function(){a=jQuery.magnificPopup.instance,1===jQuery(a.items).size()&&jQuery(".mfp-arrow").remove();var a=jQuery.magnificPopup.instance,c=a.currItem.el,d=c.parent();if(d.is("li")||(d=d.parent()),d.is(":nth-last-child(2)")||d.is(":last-child")){d.next();"block"==jQuery("#rtMedia-galary-next").css("display")&&jQuery("#rtMedia-galary-next").click()}var e=a.items.length;if(a.index==e-1&&!d.is(":last-child"))return void c.click();var f={};"undefined"!=typeof _wpmejsSettings&&(f.pluginPath=_wpmejsSettings.pluginPath),b(".mfp-content .wp-audio-shortcode,.mfp-content .wp-video-shortcode,.mfp-content .bp_media_content video").mediaelementplayer({defaultVideoWidth:480,defaultVideoHeight:270,success:function(a,b){a.play()}}),b(".mfp-content .mejs-audio .mejs-controls").css("position","relative"),rtMediaHook.call("rtmedia_js_popup_after_content_added",[])},close:function(a){rtmedia_init_action_dropdown()},BeforeChange:function(a){}}}))})}function rtmedia_init_action_dropdown(){var a,b;jQuery(".click-nav > span, .click-nav > div").toggleClass("no-js js"),jQuery(".click-nav .js ul").hide(),jQuery(".click-nav .clicker").click(function(c){a=jQuery("#rtm-media-options .click-nav .clicker").next("ul"),b=jQuery(this).next("ul"),jQuery.each(a,function(a,c){jQuery(c).html()!=b.html()&&jQuery(c).hide()}),jQuery(b).toggle(),c.stopPropagation()})}function bp_media_create_element(a){return!1}function rtmedia_version_compare(a,b){if(typeof a+typeof b!="stringstring")return!1;for(var c=a.split("."),d=b.split("."),e=0,f=Math.max(c.length,d.length);e<f;e++){if(c[e]&&!d[e]&&parseInt(c[e])>0||parseInt(c[e])>parseInt(d[e]))return!0;if(d[e]&&!c[e]&&parseInt(d[e])>0||parseInt(c[e])<parseInt(d[e]))return!1}return!0}function rtm_is_element_exist(a){return jQuery(a).length>0}function rtm_masonry_reload(a){setTimeout(function(){a.masonry("reload")},250)}function rtmediaGetParameterByName(a){a=a.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var b=new RegExp("[\\?&]"+a+"=([^&#]*)"),c=b.exec(location.search);return null==c?"":decodeURIComponent(c[1].replace(/\+/g," "))}function rtmedia_single_media_alert_message(a,b){var c="rtmedia-success";"warning"==b&&(c="rtmedia-warning"),jQuery(".rtmedia-single-media .rtmedia-media").css("opacity","0.2"),jQuery(".rtmedia-single-media .rtmedia-media").after("<div class='rtmedia-message-container'><span class='"+c+"'>"+a+" </span></div>"),setTimeout(function(){jQuery(".rtmedia-single-media .rtmedia-media").css("opacity","1"),jQuery(".rtmedia-message-container").remove()},3e3),jQuery(".rtmedia-message-container").click(function(){jQuery(".rtmedia-single-media .rtmedia-media").css("opacity","1"),jQuery(".rtmedia-message-container").remove()})}function rtmedia_gallery_action_alert_message(a,b){var c="rtmedia-success";"warning"==b&&(c="rtmedia-warning");var d='<div class="rtmedia-gallery-alert-container"> </div>';jQuery("body").append(d),jQuery(".rtmedia-gallery-alert-container").append("<div class='rtmedia-gallery-message-box'><span class='"+c+"'>"+a+" </span></div>"),setTimeout(function(){jQuery(".rtmedia-gallery-alert-container").remove()},3e3),jQuery(".rtmedia-gallery-message-box").click(function(){jQuery(".rtmedia-gallery-alert-container").remove()})}!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):window.jQuery||window.Zepto)}(function(a){var b,c,d,e,f,g,h="Close",i="BeforeClose",j="AfterClose",k="BeforeAppend",l="MarkupParse",m="Open",n="Change",o="mfp",p="."+o,q="mfp-ready",r="mfp-removing",s="mfp-prevent-close",t=function(){},u=!!window.jQuery,v=a(window),w=function(a,c){b.ev.on(o+a+p,c)},x=function(b,c,d,e){var f=document.createElement("div");return f.className="mfp-"+b,d&&(f.innerHTML=d),e?c&&c.appendChild(f):(f=a(f),c&&f.appendTo(c)),f},y=function(c,d){b.ev.triggerHandler(o+c,d),b.st.callbacks&&(c=c.charAt(0).toLowerCase()+c.slice(1),b.st.callbacks[c]&&b.st.callbacks[c].apply(b,a.isArray(d)?d:[d]))},z=function(c){return c===g&&b.currTemplate.closeBtn||(b.currTemplate.closeBtn=a(b.st.closeMarkup.replace("%title%",b.st.tClose)),g=c),b.currTemplate.closeBtn},A=function(){a.magnificPopup.instance||(b=new t,b.init(),a.magnificPopup.instance=b)},B=function(){var a=document.createElement("p").style,b=["ms","O","Moz","Webkit"];if(void 0!==a.transition)return!0;for(;b.length;)if(b.pop()+"Transition"in a)return!0;return!1};t.prototype={constructor:t,init:function(){var c=navigator.appVersion;b.isIE7=c.indexOf("MSIE 7.")!==-1,b.isIE8=c.indexOf("MSIE 8.")!==-1,b.isLowIE=b.isIE7||b.isIE8,b.isAndroid=/android/gi.test(c),b.isIOS=/iphone|ipad|ipod/gi.test(c),b.supportsTransition=B(),b.probablyMobile=b.isAndroid||b.isIOS||/(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent),d=a(document),b.popupsCache={}},open:function(c){var e;if(c.isObj===!1){b.items=c.items.toArray(),b.index=0;var g,h=c.items;for(e=0;e<h.length;e++)if(g=h[e],g.parsed&&(g=g.el[0]),g===c.el[0]){b.index=e;break}}else b.items=a.isArray(c.items)?c.items:[c.items],b.index=c.index||0;if(b.isOpen)return void b.updateItemHTML();b.types=[],f="",c.mainEl&&c.mainEl.length?b.ev=c.mainEl.eq(0):b.ev=d,c.key?(b.popupsCache[c.key]||(b.popupsCache[c.key]={}),b.currTemplate=b.popupsCache[c.key]):b.currTemplate={},b.st=a.extend(!0,{},a.magnificPopup.defaults,c),b.fixedContentPos="auto"===b.st.fixedContentPos?!b.probablyMobile:b.st.fixedContentPos,b.st.modal&&(b.st.closeOnContentClick=!1,b.st.closeOnBgClick=!1,b.st.showCloseBtn=!1,b.st.enableEscapeKey=!1),b.bgOverlay||(b.bgOverlay=x("bg").on("click"+p,function(){b.close()}),b.wrap=x("wrap").attr("tabindex",-1).on("click"+p,function(a){b._checkIfClose(a.target)&&b.close()}),b.container=x("container",b.wrap)),b.contentContainer=x("content"),b.st.preloader&&(b.preloader=x("preloader",b.container,b.st.tLoading));var i=a.magnificPopup.modules;for(e=0;e<i.length;e++){var j=i[e];j=j.charAt(0).toUpperCase()+j.slice(1),b["init"+j].call(b)}y("BeforeOpen"),b.st.showCloseBtn&&(b.st.closeBtnInside?(w(l,function(a,b,c,d){c.close_replaceWith=z(d.type)}),f+=" mfp-close-btn-in"):b.wrap.append(z())),b.st.alignTop&&(f+=" mfp-align-top"),b.fixedContentPos?b.wrap.css({overflow:b.st.overflowY,overflowX:"hidden",overflowY:b.st.overflowY}):b.wrap.css({top:v.scrollTop(),position:"absolute"}),(b.st.fixedBgPos===!1||"auto"===b.st.fixedBgPos&&!b.fixedContentPos)&&b.bgOverlay.css({height:d.height(),position:"absolute"}),b.st.enableEscapeKey&&d.on("keyup"+p,function(a){27===a.keyCode&&b.close()}),v.on("resize"+p,function(){b.updateSize()}),b.st.closeOnContentClick||(f+=" mfp-auto-cursor"),f&&b.wrap.addClass(f);var k=b.wH=v.height(),n={};if(b.fixedContentPos&&b._hasScrollBar(k)){var o=b._getScrollbarSize();o&&(n.marginRight=o)}b.fixedContentPos&&(b.isIE7?a("body, html").css("overflow","hidden"):n.overflow="hidden");var r=b.st.mainClass;return b.isIE7&&(r+=" mfp-ie7"),r&&b._addClassToMFP(r),b.updateItemHTML(),y("BuildControls"),a("html").css(n),b.bgOverlay.add(b.wrap).prependTo(b.st.prependTo||a(document.body)),b._lastFocusedEl=document.activeElement,setTimeout(function(){b.content?(b._addClassToMFP(q),b._setFocus()):b.bgOverlay.addClass(q),d.on("focusin"+p,b._onFocusIn)},16),b.isOpen=!0,b.updateSize(k),y(m),c},close:function(){b.isOpen&&(y(i),b.isOpen=!1,b.st.removalDelay&&!b.isLowIE&&b.supportsTransition?(b._addClassToMFP(r),setTimeout(function(){b._close()},b.st.removalDelay)):b._close())},_close:function(){y(h);var c=r+" "+q+" ";if(b.bgOverlay.detach(),b.wrap.detach(),b.container.empty(),b.st.mainClass&&(c+=b.st.mainClass+" "),b._removeClassFromMFP(c),b.fixedContentPos){var e={marginRight:""};b.isIE7?a("body, html").css("overflow",""):e.overflow="",a("html").css(e)}d.off("keyup"+p+" focusin"+p),b.ev.off(p),b.wrap.attr("class","mfp-wrap").removeAttr("style"),b.bgOverlay.attr("class","mfp-bg"),b.container.attr("class","mfp-container"),!b.st.showCloseBtn||b.st.closeBtnInside&&b.currTemplate[b.currItem.type]!==!0||b.currTemplate.closeBtn&&b.currTemplate.closeBtn.detach(),b._lastFocusedEl&&a(b._lastFocusedEl).focus(),b.currItem=null,b.content=null,b.currTemplate=null,b.prevHeight=0,y(j)},updateSize:function(a){if(b.isIOS){var c=document.documentElement.clientWidth/window.innerWidth,d=window.innerHeight*c;b.wrap.css("height",d),b.wH=d}else b.wH=a||v.height();b.fixedContentPos||b.wrap.css("height",b.wH),y("Resize")},updateItemHTML:function(){var c=b.items[b.index];b.contentContainer.detach(),b.content&&b.content.detach(),c.parsed||(c=b.parseEl(b.index));var d=c.type;if(y("BeforeChange",[b.currItem?b.currItem.type:"",d]),b.currItem=c,!b.currTemplate[d]){var f=!!b.st[d]&&b.st[d].markup;y("FirstMarkupParse",f),f?b.currTemplate[d]=a(f):b.currTemplate[d]=!0}e&&e!==c.type&&b.container.removeClass("mfp-"+e+"-holder");var g=b["get"+d.charAt(0).toUpperCase()+d.slice(1)](c,b.currTemplate[d]);b.appendContent(g,d),c.preloaded=!0,y(n,c),e=c.type,b.container.prepend(b.contentContainer),y("AfterChange")},appendContent:function(a,c){b.content=a,a?b.st.showCloseBtn&&b.st.closeBtnInside&&b.currTemplate[c]===!0?b.content.find(".mfp-close").length||b.content.append(z()):b.content=a:b.content="",y(k),b.container.addClass("mfp-"+c+"-holder"),b.contentContainer.append(b.content)},parseEl:function(c){var d,e=b.items[c];if(e.tagName?e={el:a(e)}:(d=e.type,e={data:e,src:e.src}),e.el){for(var f=b.types,g=0;g<f.length;g++)if(e.el.hasClass("mfp-"+f[g])){d=f[g];break}e.src=e.el.attr("data-mfp-src"),e.src||(e.src=e.el.attr("href"))}return e.type=d||b.st.type||"inline",e.index=c,e.parsed=!0,b.items[c]=e,y("ElementParse",e),b.items[c]},addGroup:function(a,c){var d=function(d){d.mfpEl=this,b._openClick(d,a,c)};c||(c={});var e="click.magnificPopup";c.mainEl=a,c.items?(c.isObj=!0,a.off(e).on(e,d)):(c.isObj=!1,c.delegate?a.off(e).on(e,c.delegate,d):(c.items=a,a.off(e).on(e,d)))},_openClick:function(c,d,e){var f=void 0!==e.midClick?e.midClick:a.magnificPopup.defaults.midClick;if(f||2!==c.which&&!c.ctrlKey&&!c.metaKey){var g=void 0!==e.disableOn?e.disableOn:a.magnificPopup.defaults.disableOn;if(g)if(a.isFunction(g)){if(!g.call(b))return!0}else if(v.width()<g)return!0;c.type&&(c.preventDefault(),b.isOpen&&c.stopPropagation()),e.el=a(c.mfpEl),e.delegate&&(e.items=d.find(e.delegate)),b.open(e)}},updateStatus:function(a,d){if(b.preloader){c!==a&&b.container.removeClass("mfp-s-"+c),d||"loading"!==a||(d=b.st.tLoading);var e={status:a,text:d};y("UpdateStatus",e),a=e.status,d=e.text,b.preloader.html(d),b.preloader.find("a").on("click",function(a){a.stopImmediatePropagation()}),b.container.addClass("mfp-s-"+a),c=a}},_checkIfClose:function(c){if(!a(c).hasClass(s)){var d=b.st.closeOnContentClick,e=b.st.closeOnBgClick;if(d&&e)return!0;if(!b.content||a(c).hasClass("mfp-close")||b.preloader&&c===b.preloader[0])return!0;if(c===b.content[0]||a.contains(b.content[0],c)){if(d)return!0}else if(e&&a.contains(document,c))return!0;return!1}},_addClassToMFP:function(a){b.bgOverlay.addClass(a),b.wrap.addClass(a)},_removeClassFromMFP:function(a){this.bgOverlay.removeClass(a),b.wrap.removeClass(a)},_hasScrollBar:function(a){return(b.isIE7?d.height():document.body.scrollHeight)>(a||v.height())},_setFocus:function(){(b.st.focus?b.content.find(b.st.focus).eq(0):b.wrap).focus()},_onFocusIn:function(c){if(c.target!==b.wrap[0]&&!a.contains(b.wrap[0],c.target))return b._setFocus(),!1},_parseMarkup:function(b,c,d){var e;d.data&&(c=a.extend(d.data,c)),y(l,[b,c,d]),a.each(c,function(a,c){if(void 0===c||c===!1)return!0;if(e=a.split("_"),e.length>1){var d=b.find(p+"-"+e[0]);if(d.length>0){var f=e[1];"replaceWith"===f?d[0]!==c[0]&&d.replaceWith(c):"img"===f?d.is("img")?d.attr("src",c):d.replaceWith('<img src="'+c+'" class="'+d.attr("class")+'" />'):d.attr(e[1],c)}}else b.find(p+"-"+a).html(c)})},_getScrollbarSize:function(){if(void 0===b.scrollbarSize){var a=document.createElement("div");a.style.cssText="width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;",document.body.appendChild(a),b.scrollbarSize=a.offsetWidth-a.clientWidth,document.body.removeChild(a)}return b.scrollbarSize}},a.magnificPopup={instance:null,proto:t.prototype,modules:[],open:function(b,c){return A(),b=b?a.extend(!0,{},b):{},b.isObj=!0,b.index=c||0,this.instance.open(b)},close:function(){return a.magnificPopup.instance&&a.magnificPopup.instance.close()},registerModule:function(b,c){c.options&&(a.magnificPopup.defaults[b]=c.options),a.extend(this.proto,c.proto),this.modules.push(b)},defaults:{disableOn:0,key:null,midClick:!1,mainClass:"",preloader:!0,focus:"",closeOnContentClick:!1,closeOnBgClick:!0,closeBtnInside:!0,showCloseBtn:!0,enableEscapeKey:!0,modal:!1,alignTop:!1,removalDelay:0,prependTo:null,fixedContentPos:"auto",fixedBgPos:"auto",overflowY:"auto",closeMarkup:'<button title="%title%" type="button" class="mfp-close">&times;</button>',tClose:"Close (Esc)",tLoading:"Loading..."}},a.fn.magnificPopup=function(c){A();var d=a(this);if("string"==typeof c)if("open"===c){var e,f=u?d.data("magnificPopup"):d[0].magnificPopup,g=parseInt(arguments[1],10)||0;f.items?e=f.items[g]:(e=d,f.delegate&&(e=e.find(f.delegate)),e=e.eq(g)),b._openClick({mfpEl:e},d,f)}else b.isOpen&&b[c].apply(b,Array.prototype.slice.call(arguments,1));else c=a.extend(!0,{},c),u?d.data("magnificPopup",c):d[0].magnificPopup=c,b.addGroup(d,c);return d};var C,D,E,F="inline",G=function(){E&&(D.after(E.addClass(C)).detach(),E=null)};a.magnificPopup.registerModule(F,{options:{hiddenClass:"hide",markup:"",tNotFound:"Content not found"},proto:{initInline:function(){b.types.push(F),w(h+"."+F,function(){G()})},getInline:function(c,d){if(G(),c.src){var e=b.st.inline,f=a(c.src);if(f.length){var g=f[0].parentNode;g&&g.tagName&&(D||(C=e.hiddenClass,D=x(C),C="mfp-"+C),E=f.after(D).detach().removeClass(C)),b.updateStatus("ready")}else b.updateStatus("error",e.tNotFound),f=a("<div>");return c.inlineElement=f,f}return b.updateStatus("ready"),b._parseMarkup(d,{},c),d}}});var H,I="ajax",J=function(){H&&a(document.body).removeClass(H)},K=function(){J(),b.req&&b.req.abort()};a.magnificPopup.registerModule(I,{options:{settings:null,cursor:"mfp-ajax-cur",tError:'<a href="%url%">The content</a> could not be loaded.'},proto:{initAjax:function(){b.types.push(I),H=b.st.ajax.cursor,w(h+"."+I,K),w("BeforeChange."+I,K)},getAjax:function(c){H&&a(document.body).addClass(H),b.updateStatus("loading");var d=a.extend({url:c.src,success:function(d,e,f){var g={data:d,xhr:f};y("ParseAjax",g),b.appendContent(a(g.data),I),c.finished=!0,J(),b._setFocus(),setTimeout(function(){b.wrap.addClass(q)},16),b.updateStatus("ready"),y("AjaxContentAdded")},error:function(){J(),c.finished=c.loadError=!0,b.updateStatus("error",b.st.ajax.tError.replace("%url%",c.src))}},b.st.ajax.settings);return b.req=a.ajax(d),""}}});var L,M=function(c){if(c.data&&void 0!==c.data.title)return c.data.title;var d=b.st.image.titleSrc;if(d){if(a.isFunction(d))return d.call(b,c);if(c.el)return c.el.attr(d)||""}return""};a.magnificPopup.registerModule("image",{options:{markup:'<div class="mfp-figure"><div class="mfp-close"></div><figure><div class="mfp-img"></div><figcaption><div class="mfp-bottom-bar"><div class="mfp-title"></div><div class="mfp-counter"></div></div></figcaption></figure></div>',cursor:"mfp-zoom-out-cur",titleSrc:"title",verticalFit:!0,tError:'<a href="%url%">The image</a> could not be loaded.'},proto:{initImage:function(){var c=b.st.image,d=".image";b.types.push("image"),w(m+d,function(){"image"===b.currItem.type&&c.cursor&&a(document.body).addClass(c.cursor)}),w(h+d,function(){c.cursor&&a(document.body).removeClass(c.cursor),v.off("resize"+p)}),w("Resize"+d,b.resizeImage),b.isLowIE&&w("AfterChange",b.resizeImage)},resizeImage:function(){var a=b.currItem;if(a&&a.img&&b.st.image.verticalFit){var c=0;b.isLowIE&&(c=parseInt(a.img.css("padding-top"),10)+parseInt(a.img.css("padding-bottom"),10)),a.img.css("max-height",b.wH-c)}},_onImageHasSize:function(a){a.img&&(a.hasSize=!0,L&&clearInterval(L),a.isCheckingImgSize=!1,y("ImageHasSize",a),a.imgHidden&&(b.content&&b.content.removeClass("mfp-loading"),a.imgHidden=!1))},findImageSize:function(a){var c=0,d=a.img[0],e=function(f){L&&clearInterval(L),L=setInterval(function(){return d.naturalWidth>0?void b._onImageHasSize(a):(c>200&&clearInterval(L),c++,void(3===c?e(10):40===c?e(50):100===c&&e(500)))},f)};e(1)},getImage:function(c,d){var e=0,f=function(){c&&(c.img[0].complete?(c.img.off(".mfploader"),c===b.currItem&&(b._onImageHasSize(c),b.updateStatus("ready")),c.hasSize=!0,c.loaded=!0,y("ImageLoadComplete")):(e++,e<200?setTimeout(f,100):g()))},g=function(){c&&(c.img.off(".mfploader"),c===b.currItem&&(b._onImageHasSize(c),b.updateStatus("error",h.tError.replace("%url%",c.src))),c.hasSize=!0,c.loaded=!0,c.loadError=!0)},h=b.st.image,i=d.find(".mfp-img");if(i.length){var j=document.createElement("img");j.className="mfp-img",c.el&&c.el.find("img").length&&(j.alt=c.el.find("img").attr("alt")),c.img=a(j).on("load.mfploader",f).on("error.mfploader",g),j.src=c.src,i.is("img")&&(c.img=c.img.clone()),j=c.img[0],j.naturalWidth>0?c.hasSize=!0:j.width||(c.hasSize=!1)}return b._parseMarkup(d,{title:M(c),img_replaceWith:c.img},c),b.resizeImage(),c.hasSize?(L&&clearInterval(L),c.loadError?(d.addClass("mfp-loading"),b.updateStatus("error",h.tError.replace("%url%",c.src))):(d.removeClass("mfp-loading"),b.updateStatus("ready")),d):(b.updateStatus("loading"),c.loading=!0,c.hasSize||(c.imgHidden=!0,d.addClass("mfp-loading"),b.findImageSize(c)),d)}}});var N,O=function(){return void 0===N&&(N=void 0!==document.createElement("p").style.MozTransform),N};a.magnificPopup.registerModule("zoom",{options:{enabled:!1,easing:"ease-in-out",duration:300,opener:function(a){return a.is("img")?a:a.find("img")}},proto:{initZoom:function(){var a,c=b.st.zoom,d=".zoom";if(c.enabled&&b.supportsTransition){var e,f,g=c.duration,j=function(a){var b=a.clone().removeAttr("style").removeAttr("class").addClass("mfp-animated-image"),d="all "+c.duration/1e3+"s "+c.easing,e={position:"fixed",zIndex:9999,left:0,top:0,"-webkit-backface-visibility":"hidden"},f="transition";return e["-webkit-"+f]=e["-moz-"+f]=e["-o-"+f]=e[f]=d,b.css(e),b},k=function(){b.content.css("visibility","visible")};w("BuildControls"+d,function(){if(b._allowZoom()){if(clearTimeout(e),b.content.css("visibility","hidden"),a=b._getItemToZoom(),!a)return void k();f=j(a),f.css(b._getOffset()),b.wrap.append(f),e=setTimeout(function(){f.css(b._getOffset(!0)),e=setTimeout(function(){k(),setTimeout(function(){f.remove(),a=f=null,y("ZoomAnimationEnded")},16)},g)},16)}}),w(i+d,function(){if(b._allowZoom()){if(clearTimeout(e),b.st.removalDelay=g,!a){if(a=b._getItemToZoom(),!a)return;f=j(a)}f.css(b._getOffset(!0)),b.wrap.append(f),b.content.css("visibility","hidden"),setTimeout(function(){f.css(b._getOffset())},16)}}),w(h+d,function(){b._allowZoom()&&(k(),f&&f.remove(),a=null)})}},_allowZoom:function(){return"image"===b.currItem.type},_getItemToZoom:function(){return!!b.currItem.hasSize&&b.currItem.img},_getOffset:function(c){var d;d=c?b.currItem.img:b.st.zoom.opener(b.currItem.el||b.currItem);var e=d.offset(),f=parseInt(d.css("padding-top"),10),g=parseInt(d.css("padding-bottom"),10);e.top-=a(window).scrollTop()-f;var h={width:d.width(),height:(u?d.innerHeight():d[0].offsetHeight)-g-f};return O()?h["-moz-transform"]=h.transform="translate("+e.left+"px,"+e.top+"px)":(h.left=e.left,h.top=e.top),h}}});var P="iframe",Q="//about:blank",R=function(a){if(b.currTemplate[P]){var c=b.currTemplate[P].find("iframe");c.length&&(a||(c[0].src=Q),b.isIE8&&c.css("display",a?"block":"none"))}};a.magnificPopup.registerModule(P,{options:{markup:'<div class="mfp-iframe-scaler"><div class="mfp-close"></div><iframe class="mfp-iframe" src="//about:blank" frameborder="0" allowfullscreen></iframe></div>',srcAction:"iframe_src",patterns:{youtube:{index:"youtube.com",id:"v=",src:"//www.youtube.com/embed/%id%?autoplay=1"},vimeo:{index:"vimeo.com/",id:"/",src:"//player.vimeo.com/video/%id%?autoplay=1"},gmaps:{index:"//maps.google.",src:"%id%&output=embed"}}},proto:{initIframe:function(){b.types.push(P),w("BeforeChange",function(a,b,c){b!==c&&(b===P?R():c===P&&R(!0))}),w(h+"."+P,function(){R()})},getIframe:function(c,d){var e=c.src,f=b.st.iframe;a.each(f.patterns,function(){if(e.indexOf(this.index)>-1)return this.id&&(e="string"==typeof this.id?e.substr(e.lastIndexOf(this.id)+this.id.length,e.length):this.id.call(this,e)),e=this.src.replace("%id%",e),!1});var g={};return f.srcAction&&(g[f.srcAction]=e),b._parseMarkup(d,g,c),b.updateStatus("ready"),d}}});var S=function(a){var c=b.items.length;return a>c-1?a-c:a<0?c+a:a},T=function(a,b,c){return a.replace(/%curr%/gi,b+1).replace(/%total%/gi,c)};a.magnificPopup.registerModule("gallery",{options:{enabled:!1,arrowMarkup:'<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>',preload:[0,2],navigateByImgClick:!0,arrows:!0,tPrev:"Previous (Left arrow key)",tNext:"Next (Right arrow key)",tCounter:"%curr% of %total%"},proto:{initGallery:function(){var c=b.st.gallery,e=".mfp-gallery",g=Boolean(a.fn.mfpFastClick);return b.direction=!0,!(!c||!c.enabled)&&(f+=" mfp-gallery",w(m+e,function(){c.navigateByImgClick&&b.wrap.on("click"+e,".mfp-img",function(){if(b.items.length>1)return b.next(),!1}),d.on("keydown"+e,function(a){37===a.keyCode?b.prev():39===a.keyCode&&b.next()})}),w("UpdateStatus"+e,function(a,c){c.text&&(c.text=T(c.text,b.currItem.index,b.items.length))}),w(l+e,function(a,d,e,f){var g=b.items.length;e.counter=g>1?T(c.tCounter,f.index,g):""}),w("BuildControls"+e,function(){if(b.items.length>1&&c.arrows&&!b.arrowLeft){var d=c.arrowMarkup,e=b.arrowLeft=a(d.replace(/%title%/gi,c.tPrev).replace(/%dir%/gi,"left")).addClass(s),f=b.arrowRight=a(d.replace(/%title%/gi,c.tNext).replace(/%dir%/gi,"right")).addClass(s),h=g?"mfpFastClick":"click";e[h](function(){b.prev()}),f[h](function(){b.next()}),b.isIE7&&(x("b",e[0],!1,!0),x("a",e[0],!1,!0),x("b",f[0],!1,!0),x("a",f[0],!1,!0)),b.container.append(e.add(f))}}),w(n+e,function(){b._preloadTimeout&&clearTimeout(b._preloadTimeout),b._preloadTimeout=setTimeout(function(){b.preloadNearbyImages(),b._preloadTimeout=null},16)}),void w(h+e,function(){d.off(e),b.wrap.off("click"+e),b.arrowLeft&&g&&b.arrowLeft.add(b.arrowRight).destroyMfpFastClick(),b.arrowRight=b.arrowLeft=null}))},next:function(){b.direction=!0,b.index=S(b.index+1),b.updateItemHTML()},prev:function(){b.direction=!1,b.index=S(b.index-1),b.updateItemHTML()},goTo:function(a){b.direction=a>=b.index,b.index=a,b.updateItemHTML()},preloadNearbyImages:function(){var a,c=b.st.gallery.preload,d=Math.min(c[0],b.items.length),e=Math.min(c[1],b.items.length);for(a=1;a<=(b.direction?e:d);a++)b._preloadItem(b.index+a);for(a=1;a<=(b.direction?d:e);a++)b._preloadItem(b.index-a)},_preloadItem:function(c){if(c=S(c),!b.items[c].preloaded){var d=b.items[c];d.parsed||(d=b.parseEl(c)),y("LazyLoad",d),"image"===d.type&&(d.img=a('<img class="mfp-img" />').on("load.mfploader",function(){d.hasSize=!0}).on("error.mfploader",function(){d.hasSize=!0,d.loadError=!0,y("LazyLoadError",d)}).attr("src",d.src)),d.preloaded=!0}}}});var U="retina";a.magnificPopup.registerModule(U,{options:{replaceSrc:function(a){return a.src.replace(/\.\w+$/,function(a){return"@2x"+a})},ratio:1},proto:{initRetina:function(){if(window.devicePixelRatio>1){var a=b.st.retina,c=a.ratio;c=isNaN(c)?c():c,c>1&&(w("ImageHasSize."+U,function(a,b){b.img.css({"max-width":b.img[0].naturalWidth/c,width:"100%"})}),w("ElementParse."+U,function(b,d){d.src=a.replaceSrc(d,c)}))}}}}),function(){var b=1e3,c="ontouchstart"in window,d=function(){v.off("touchmove"+f+" touchend"+f)},e="mfpFastClick",f="."+e;a.fn.mfpFastClick=function(e){return a(this).each(function(){var g,h=a(this);if(c){var i,j,k,l,m,n;h.on("touchstart"+f,function(a){l=!1,n=1,m=a.originalEvent?a.originalEvent.touches[0]:a.touches[0],j=m.clientX,k=m.clientY,v.on("touchmove"+f,function(a){m=a.originalEvent?a.originalEvent.touches:a.touches,n=m.length,m=m[0],(Math.abs(m.clientX-j)>10||Math.abs(m.clientY-k)>10)&&(l=!0,d())}).on("touchend"+f,function(a){d(),l||n>1||(g=!0,a.preventDefault(),clearTimeout(i),i=setTimeout(function(){g=!1},b),e())})})}h.on("click"+f,function(){g||e()})})},a.fn.destroyMfpFastClick=function(){a(this).off("touchstart"+f+" click"+f),c&&v.off("touchmove"+f+" touchend"+f)}}(),A()}),"function"!=typeof Object.create&&(Object.create=function(a){function b(){}return b.prototype=a,new b}),function(a,b,c,d){var e={init:function(b,c){var d=this;d.elem=c,d.$elem=a(c),d.options=a.extend({},a.fn.rtTab.options,b),d.rtTabs()},rtTabs:function(){var c=this,d=c.options.activeTab;c.$elem.find("li:nth-child("+d+")").addClass("active"),c.rtTabContent(activeTabContent="yes"),c.rtClick();var e="false"!==c.$elem.attr("data-hash");if(e===!0){var f=b.location.hash;f&&c.$elem.find("li").find('a[href="'+f+'"]').trigger("click"),a(b).on("hashchange",function(){var a=b.location.hash;c.$elem.find("li").find('a[href="'+a+'"]').trigger("click")})}},rtClick:function(){var c=this,d=c.$elem.find("li"),e=d.find("a");e.on("click",function(e){e.preventDefault(),d.removeClass("active"),c.rtTabContent(),a(this).parent().addClass("active");var f=a(this).attr("href");a(f).removeClass("hide");var g="false"!==c.$elem.attr("data-hash");if(g===!0){var h=a(b).scrollTop();location.hash=a(this).attr("href"),a(b).scrollTop(h)}"function"==typeof c.options.onComplete&&c.options.onComplete.apply(c.elem,arguments)})},rtTabContent:function(b){var c=this,d=c.$elem.find("li"),e=d.find("a");e.each(function(){var c=a(this),d=c.attr("href");"yes"===b?c.parent().hasClass("active")||a(d).addClass("hide"):a(d).addClass("hide")})}};a.fn.rtTab=function(b){return this.each(function(){var c=Object.create(e);c.init(b,this),a.data(this,"rtTab",c)})},a.fn.rtTab.options={activeTab:1,onComplete:null}}(jQuery,window,document);var rtMagnificPopup,rtm_masonry_container,rtMediaHook={hooks:[],is_break:!1,register:function(a,b){"undefined"==typeof rtMediaHook.hooks[a]&&(rtMediaHook.hooks[a]=[]),rtMediaHook.hooks[a].push(b)},call:function(a,arguments){if("undefined"!=typeof rtMediaHook.hooks[a])for(i=0;i<rtMediaHook.hooks[a].length;++i)if(1!=rtMediaHook.hooks[a][i](arguments))return rtMediaHook.is_break=!0,!1;return!0}};jQuery("document").ready(function(a){function b(){if(jQuery("#rtmedia-media-view-form").length>0){var a=jQuery("#rtmedia-media-view-form").attr("action");jQuery.post(a,{},function(a){})}}function c(){var a=jQuery.magnificPopup.instance;jQuery(".mfp-arrow-right").on("click",function(b){a.next()}),jQuery(".mfp-arrow-left").on("click",function(b){a.prev()}),jQuery(".mfp-content .rtmedia-media").swipe({swipeLeft:function(b,c,d,e,f){a.next()},swipeRight:function(b,c,d,e,f){a.prev()},threshold:0})}function d(){jQuery(document).on("focusin","#comment_content",function(){jQuery(document).unbind("keydown")}),jQuery(document).on("focusout","#comment_content",function(){var a=jQuery.magnificPopup.instance;jQuery(document).on("keydown",function(b){37===b.keyCode?a.prev():39===b.keyCode&&a.next()})})}function e(){jQuery(".rtmedia-container").on("click",".rtmedia-delete-media",function(a){a.preventDefault(),confirm(rtmedia_media_delete_confirmation)&&jQuery(this).closest("form").submit()})}"undefined"!=typeof a.fn.rtTab&&a(".rtm-tabs").rtTab(),jQuery(".rtmedia-modal-link").length>0&&a(".rtmedia-modal-link").magnificPopup({type:"inline",midClick:!0,closeBtnInside:!0}),a("#rt_media_comment_form").submit(function(b){return""!=a.trim(a("#comment_content").val())||(0==jQuery("#rtmedia-single-media-container").length?rtmedia_gallery_action_alert_message(rtmedia_empty_comment_msg,"warning"):rtmedia_single_media_alert_message(rtmedia_empty_comment_msg,"warning"),!1)}),a("li.rtmedia-list-item p a").each(function(b){a(this).addClass("no-popup")}),a("li.rtmedia-list-item p a").each(function(b){a(this).addClass("no-popup")}),"undefined"!=typeof rtmedia_lightbox_enabled&&"1"==rtmedia_lightbox_enabled&&apply_rtMagnificPopup(".rtmedia-list-media.rtm-gallery-list, .rtmedia-activity-container ul.rtmedia-list, #bp-media-list,.bp-media-sc-list, li.media.album_updated ul,ul.bp-media-list-media, li.activity-item div.activity-content div.activity-inner div.bp_media_content, .rtm-bbp-container, ul.rtm-comment-container"),jQuery.ajaxPrefilter(function(a,b,c){try{if(null==b.data||"undefined"==typeof b.data||"undefined"==typeof b.data.action)return!0}catch(a){return!0}if("activity_get_older_updates"==b.data.action){var d=b.success;a.success=function(a){d(a),apply_rtMagnificPopup(".rtmedia-activity-container ul.rtmedia-list, #bp-media-list, .bp-media-sc-list, li.media.album_updated ul,ul.bp-media-list-media, li.activity-item div.activity-content div.activity-inner div.bp_media_content"),rtMediaHook.call("rtmedia_js_after_activity_added",[])}}else if("get_single_activity_content"==b.data.action){var d=b.success;a.success=function(a){d(a),setTimeout(function(){apply_rtMagnificPopup(".rtmedia-activity-container ul.rtmedia-list, #bp-media-list, .bp-media-sc-list, li.media.album_updated ul,ul.bp-media-list-media, li.activity-item div.activity-content div.activity-inner div.bp_media_content"),jQuery("ul.activity-list li.rtmedia_update:first-child .wp-audio-shortcode, ul.activity-list li.rtmedia_update:first-child .wp-video-shortcode").mediaelementplayer({defaultVideoWidth:480,defaultVideoHeight:270})},900)}}}),jQuery.ajaxPrefilter(function(a,b,c){try{if(null==b.data||"undefined"==typeof b.data||"undefined"==typeof b.data.action)return!0}catch(a){return!0}if("activity_get_older_updates"==b.data.action){var d=b.success;a.success=function(a){d(a),apply_rtMagnificPopup(".rtmedia-activity-container ul.rtmedia-list, #bp-media-list, .bp-media-sc-list, li.media.album_updated ul,ul.bp-media-list-media, li.activity-item div.activity-content div.activity-inner div.bp_media_content"),jQuery("ul.activity-list li.rtmedia_update div.rtmedia-item-thumbnail > audio.wp-audio-shortcode, ul.activity-list li.rtmedia_update div.rtmedia-item-thumbnail > video.wp-video-shortcode").mediaelementplayer({defaultVideoWidth:480,defaultVideoHeight:270}),rtMediaHook.call("rtmedia_js_after_activity_added",[])}}}),jQuery(".rtmedia-container").on("click",".select-all",function(a){jQuery(this).toggleClass("unselect-all").toggleClass("select-all"),jQuery(this).attr("title",rtmedia_unselect_all_visible),jQuery(".rtmedia-list input").each(function(){jQuery(this).prop("checked",!0)}),jQuery(".rtmedia-list-item").addClass("bulk-selected")}),jQuery(".rtmedia-container").on("click",".unselect-all",function(a){jQuery(this).toggleClass("select-all").toggleClass("unselect-all"),jQuery(this).attr("title",rtmedia_select_all_visible),jQuery(".rtmedia-list input").each(function(){jQuery(this).prop("checked",!1)}),jQuery(".rtmedia-list-item").removeClass("bulk-selected")}),jQuery(".rtmedia-container").on("click",".rtmedia-move",function(a){jQuery(".rtmedia-delete-container").slideUp(),jQuery(".rtmedia-move-container").slideToggle()}),jQuery("#rtmedia-create-album-modal").on("click","#rtmedia_create_new_album",function(b){if($albumname=jQuery("<span/>").text(jQuery.trim(jQuery("#rtmedia_album_name").val())).html(),
6
+ $context=jQuery.trim(jQuery("#rtmedia_album_context").val()),$context_id=jQuery.trim(jQuery("#rtmedia_album_context_id").val()),$privacy=jQuery.trim(jQuery("#rtmedia_select_album_privacy").val()),$create_album_nonce=jQuery.trim(jQuery("#rtmedia_create_album_nonce").val()),""!=$albumname){var c={action:"rtmedia_create_album",name:$albumname,context:$context,context_id:$context_id,create_album_nonce:$create_album_nonce};""!==$privacy&&(c.privacy=$privacy),a("#rtmedia_create_new_album").attr("disabled","disabled");var d=a("#rtmedia_create_new_album").html();a("#rtmedia_create_new_album").prepend("<img src='"+rMedia_loading_file+"' />"),jQuery.post(rtmedia_ajax_url,c,function(b){if("undefined"!=typeof b.album){b=jQuery.trim(b.album);var c=!0;jQuery(".rtmedia-user-album-list").each(function(){if(jQuery(this).children("optgroup").each(function(){if(jQuery(this).attr("value")===$context)return c=!1,void jQuery(this).append('<option value="'+b+'">'+$albumname+"</option>")}),c){var a=$context.charAt(0).toUpperCase()+$context.slice(1)+" "+rtmedia_main_js_strings.rtmedia_albums,d='<optgroup value="'+$context+'" label="'+a+'"><option value="'+b+'">'+$albumname+"</option></optgroup>";jQuery(this).append(d)}}),jQuery('select.rtmedia-user-album-list option[value="'+b+'"]').prop("selected",!0),jQuery(".rtmedia-create-new-album-container").slideToggle(),jQuery("#rtmedia_album_name").val(""),jQuery("#rtmedia-create-album-modal").append("<div class='rtmedia-success rtmedia-create-album-alert'><b>"+$albumname+"</b>"+rtmedia_album_created_msg+"</div>"),setTimeout(function(){jQuery(".rtmedia-create-album-alert").remove()},4e3),setTimeout(function(){galleryObj.reloadView(),jQuery(".close-reveal-modal").click()},2e3)}else"undefined"!=typeof b.error?rtmedia_gallery_action_alert_message(b.error,"warning"):rtmedia_gallery_action_alert_message(rtmedia_something_wrong_msg,"warning");a("#rtmedia_create_new_album").removeAttr("disabled"),a("#rtmedia_create_new_album").html(d)})}else rtmedia_gallery_action_alert_message(rtmedia_empty_album_name_msg,"warning")}),jQuery(".rtmedia-container").on("click",".rtmedia-delete-selected",function(a){jQuery(".rtmedia-list :checkbox:checked").length>0?confirm(rtmedia_selected_media_delete_confirmation)&&jQuery(this).closest("form").attr("action","../../../"+rtmedia_media_slug+"/delete").submit():rtmedia_gallery_action_alert_message(rtmedia_no_media_selected,"warning")}),jQuery(".rtmedia-container").on("click",".rtmedia-move-selected",function(a){jQuery(".rtmedia-list :checkbox:checked").length>0?confirm(rtmedia_selected_media_move_confirmation)&&jQuery(this).closest("form").attr("action","").submit():rtmedia_gallery_action_alert_message(rtmedia_no_media_selected,"warning")}),jQuery("#buddypress").on("change",".rtm-activity-privacy-opt",function(){var a=jQuery(this).attr("id");a=a.split("-"),a=a[a.length-1];var b=this;data={activity_id:a,privacy:jQuery(this).val(),nonce:jQuery("#rtmedia_activity_privacy_nonce").val(),action:"rtm_change_activity_privacy"},jQuery.post(ajaxurl,data,function(a){var c="",d="";"true"==a?(c=rtmedia_main_js_strings.privacy_update_success,d="success"):(c=rtmedia_main_js_strings.privacy_update_error,d="fail"),jQuery(b).after('<p class="rtm-ac-privacy-updated '+d+'">'+c+"</p>"),setTimeout(function(){jQuery(b).siblings(".rtm-ac-privacy-updated").remove()},2e3)})}),b(),rtMediaHook.register("rtmedia_js_popup_after_content_added",function(){b(),e(),mfp=jQuery.magnificPopup.instance,jQuery(mfp.items).size()>1&&c(),d();var f=a(window).height();jQuery(".rtm-lightbox-container .mejs-video").css({height:.8*f,"over-flow":"hidden"}),jQuery(".mfp-content .rtmedia-media").css({"max-height":.87*f,"over-flow":"hidden"}),rtmedia_init_action_dropdown(),jQuery(".rtmedia-comment-link").on("click",function(a){a.preventDefault(),jQuery("#comment_content").focus()}),jQuery(".rtm-more").shorten({showChars:130});var g=a(".rtm-gallery-title"),h="";h=a.isEmptyObject(g)?a("#subnav.item-list-tabs li.selected ").html():g.html(),""!=h&&a(".rtm-ltb-gallery-title .ltb-title").html(h);var i=a("#subnav.item-list-tabs li.selected span").html();return a("li.total").html(i),!0});var f=jQuery("#drag-drop-area"),g=jQuery("#whats-new");f.html();jQuery("#rtmedia-upload-container").after("<div id='rtm-drop-files-title'>"+rtmedia_drop_media_msg+"</div>"),"undefined"!=typeof rtmedia_bp_enable_activity&&"1"==rtmedia_bp_enable_activity&&jQuery("#whats-new-textarea").append("<div id='rtm-drop-files-title'>"+rtmedia_drop_media_msg+"</div>"),jQuery(document).on("dragover",function(a){jQuery("#rtm-media-gallery-uploader").show(),"undefined"!=typeof rtmedia_bp_enable_activity&&"1"==rtmedia_bp_enable_activity&&g.addClass("rtm-drag-drop-active"),f.addClass("rtm-drag-drop-active"),jQuery("#rtm-drop-files-title").show()}).on("dragleave",function(a){a.preventDefault(),"undefined"!=typeof rtmedia_bp_enable_activity&&"1"==rtmedia_bp_enable_activity&&(g.removeClass("rtm-drag-drop-active"),g.removeAttr("style")),f.removeClass("rtm-drag-drop-active"),jQuery("#rtm-drop-files-title").hide()}).on("drop",function(a){a.preventDefault(),"undefined"!=typeof rtmedia_bp_enable_activity&&"1"==rtmedia_bp_enable_activity&&(g.removeClass("rtm-drag-drop-active"),g.removeAttr("style")),f.removeClass("rtm-drag-drop-active"),jQuery("#rtm-drop-files-title").hide()}),jQuery(".rtmedia-container").on("click",".rtmedia-delete-album",function(a){a.preventDefault(),confirm(rtmedia_album_delete_confirmation)&&jQuery(this).closest("form").submit()}),jQuery(".rtmedia-container").on("click",".rtmedia-delete-media",function(a){a.preventDefault(),confirm(rtmedia_media_delete_confirmation)&&jQuery(this).closest("form").submit()}),rtmedia_init_action_dropdown(),a(document).click(function(){a(".click-nav ul").is(":visible")&&a(".click-nav ul",this).hide()}),jQuery(".rtmedia-comment-link").on("click",function(a){a.preventDefault(),jQuery("#comment_content").focus()}),jQuery(".rtm-more").length>0&&a(".rtm-more").shorten({showChars:200}),"undefined"!=typeof rtmedia_masonry_layout&&"true"==rtmedia_masonry_layout&&0==jQuery(".rtmedia-container .rtmedia-list.rtm-no-masonry").length&&(rtm_masonry_container=jQuery(".rtmedia-container .rtmedia-list"),rtm_masonry_container.masonry({itemSelector:".rtmedia-list-item"}),setInterval(function(){jQuery.each(jQuery(".rtmedia-list.masonry .rtmedia-item-title"),function(a,b){jQuery(b).width(jQuery(b).siblings(".rtmedia-item-thumbnail").children("img").width())}),rtm_masonry_reload(rtm_masonry_container)},1e3),jQuery.each(jQuery(".rtmedia-list.masonry .rtmedia-item-title"),function(a,b){jQuery(b).width(jQuery(b).siblings(".rtmedia-item-thumbnail").children("img").width())})),jQuery(".rtm-uploader-tabs").length>0&&jQuery(".rtm-uploader-tabs li").click(function(a){jQuery(this).hasClass("active")||(jQuery(this).siblings().removeClass("active"),jQuery(this).parents(".rtm-uploader-tabs").siblings().hide(),class_name=jQuery(this).attr("class"),jQuery(this).parents(".rtm-uploader-tabs").siblings('[data-id="'+class_name+'"]').show(),jQuery(this).addClass("active"),"rtm-upload-tab"!=class_name?jQuery("div.moxie-shim").children("input[type=file]").hide():jQuery("div.moxie-shim").children("input[type=file]").show())}),jQuery(".rtmedia-container").on("click",".rtm-delete-media",function(a){a.preventDefault();var b="Are you sure you want to delete this media?";if("undefined"!=typeof rtmedia_media_delete_confirmation&&(b=rtmedia_media_delete_confirmation),confirm(b)){var c=jQuery(this).closest("li"),d=jQuery("#rtmedia_media_delete_nonce").val(),e={action:"delete_uploaded_media",nonce:d,media_id:c.attr("id")};jQuery.ajax({url:ajaxurl,type:"post",data:e,success:function(a){"1"==a?(rtmedia_gallery_action_alert_message(rtmedia_main_js_strings.file_delete_success,"success"),c.remove(),"undefined"!=typeof rtmedia_masonry_layout&&"true"==rtmedia_masonry_layout&&0==jQuery(".rtmedia-container .rtmedia-list.rtm-no-masonry").length&&rtm_masonry_reload(rtm_masonry_container)):rtmedia_gallery_action_alert_message(rtmedia_file_not_deleted,"warning")}})}})}),function(a){a.fn.shorten=function(b){"use strict";var c={showChars:100,minHideChars:10,ellipsesText:"...",moreText:"Read more",lessText:"Show less",onLess:function(){},onMore:function(){},errMsg:null,force:!1};return b&&a.extend(c,b),!(a(this).data("jquery.shorten")&&!c.force)&&(a(this).data("jquery.shorten",!0),a(document).off("click",".morelink"),a(document).on({click:function(){var b=a(this);return b.hasClass("less")?(b.removeClass("less"),b.html(c.moreText),b.parent().prev().hide(0,function(){b.parent().prev().prev().show()}).hide(0,function(){c.onLess()})):(b.addClass("less"),b.html(c.lessText),b.parent().prev().show(0,function(){b.parent().prev().prev().hide()}).show(0,function(){c.onMore()})),!1}},".morelink"),this.each(function(){var b=a(this),d=b.html(),e=b.text().length;if(e>c.showChars+c.minHideChars){var f=d.substr(0,c.showChars);if(f.indexOf("<")>=0){for(var g=!1,h="",i=0,k=[],l=null,m=0,n=0;n<=c.showChars;m++)if("<"!=d[m]||g||(g=!0,l=d.substring(m+1,d.indexOf(">",m)),"/"==l[0]?l!="/"+k[0]?c.errMsg="ERROR en HTML: the top of the stack should be the tag that closes":k.shift():"br"!=l.toLowerCase()&&k.unshift(l)),g&&">"==d[m]&&(g=!1),g)h+=d.charAt(m);else if(n++,i<=c.showChars)h+=d.charAt(m),i++;else if(k.length>0){for(j=0;j<k.length;j++)h+="</"+k[j]+">";break}f=a("<div/>").html(h+'<span class="ellip">'+c.ellipsesText+"</span>").html()}else f+=c.ellipsesText;var o='<div class="shortcontent">'+f+'</div><div class="allcontent">'+d+'</div><span><a href="javascript://nop/" class="morelink">'+c.moreText+"</a></span>";b.html(o),b.find(".allcontent").hide(),a(".shortcontent p:last",b).css("margin-bottom",0)}}))}}(jQuery),window.onload=function(){"undefined"!=typeof rtmedia_masonry_layout&&"true"==rtmedia_masonry_layout&&0==jQuery(".rtmedia-container .rtmedia-list.rtm-no-masonry").length&&rtm_masonry_reload(rtm_masonry_container)};
app/main/RTMedia.php CHANGED
@@ -89,7 +89,13 @@ class RTMedia {
89
  add_action( 'plugins_loaded', array( $this, 'init' ), 20 );
90
  add_action( 'wp_enqueue_scripts', array( 'RTMediaGalleryShortcode', 'register_scripts' ) );
91
  add_action( 'wp_enqueue_scripts', array( &$this, 'enqueue_scripts_styles' ), 999 );
92
- include( RTMEDIA_PATH . 'app/main/controllers/template/rt-template-functions.php' );
 
 
 
 
 
 
93
  add_filter( 'intermediate_image_sizes_advanced', array( $this, 'filter_image_sizes_details' ) );
94
  add_filter( 'intermediate_image_sizes', array( $this, 'filter_image_sizes' ) );
95
  add_filter( 'site_option_upload_filetypes', array( &$this, 'filter_allow_mime_type_mu' ), 1, 1 );
89
  add_action( 'plugins_loaded', array( $this, 'init' ), 20 );
90
  add_action( 'wp_enqueue_scripts', array( 'RTMediaGalleryShortcode', 'register_scripts' ) );
91
  add_action( 'wp_enqueue_scripts', array( &$this, 'enqueue_scripts_styles' ), 999 );
92
+
93
+ // Including core functions, actions & filters
94
+ include( RTMEDIA_PATH . 'app/main/controllers/template/rtmedia-functions.php' );
95
+ include( RTMEDIA_PATH . 'app/main/controllers/template/rtmedia-actions.php' );
96
+ include( RTMEDIA_PATH . 'app/main/controllers/template/rtmedia-ajax-actions.php' );
97
+ include( RTMEDIA_PATH . 'app/main/controllers/template/rtmedia-filters.php' );
98
+
99
  add_filter( 'intermediate_image_sizes_advanced', array( $this, 'filter_image_sizes_details' ) );
100
  add_filter( 'intermediate_image_sizes', array( $this, 'filter_image_sizes' ) );
101
  add_filter( 'site_option_upload_filetypes', array( &$this, 'filter_allow_mime_type_mu' ), 1, 1 );
app/main/controllers/group/RTMediaGroupExtension.php CHANGED
@@ -24,31 +24,31 @@ if ( class_exists( 'BP_Group_Extension' ) ) :// Recommended, to prevent problems
24
 
25
  global $rtmedia;
26
  $options = $rtmedia->options; ?>
27
- <div class='rtmedia-group-media-settings'>
28
- <?php if ( isset( $options['general_enableAlbums'] ) && 1 === intval( $options['general_enableAlbums'] ) ) { // album is enabled ?>
29
-
30
- <h4><?php esc_html_e( 'Album Creation Control', 'buddypress-media' ); ?></h4>
31
- <p><?php esc_html_e( 'Who can create Albums in this group?', 'buddypress-media' ); ?></p>
32
- <div class="radio">
33
- <label>
34
- <input name="rt_album_creation_control" type="radio" id="rt_media_group_level_all" checked="checked" value="all">
35
- <strong><?php esc_html_e( 'All Group Members', 'buddypress-media' ); ?></strong>
36
- </label>
37
- <label>
38
- <input name="rt_album_creation_control" type="radio" id="rt_media_group_level_moderators" value="moderators">
39
- <strong><?php esc_html_e( 'Group Admins and Mods only', 'buddypress-media' ); ?></strong>
40
- </label>
41
- <label>
42
- <input name="rt_album_creation_control" type="radio" id="rt_media_group_level_admin" value="admin">
43
- <strong><?php esc_html_e( 'Group Admin only', 'buddypress-media' ); ?></strong>
44
- </label>
45
- </div>
46
-
47
- <?php } ?>
48
-
49
- <?php do_action( 'rtmedia_playlist_creation_settings_create_group' ); ?>
50
- </div>
51
- <?php
52
  wp_nonce_field( 'groups_create_save_' . $this->slug );
53
  }
54
 
@@ -61,11 +61,20 @@ if ( class_exists( 'BP_Group_Extension' ) ) :// Recommended, to prevent problems
61
 
62
  check_admin_referer( 'groups_create_save_' . $this->slug );
63
 
 
 
 
64
  $rt_album_creation_control = filter_input( INPUT_POST, 'rt_album_creation_control', FILTER_SANITIZE_STRING );
 
 
 
 
 
 
 
 
 
65
 
66
- /* Save any details submitted here */
67
- if ( ! empty( $rt_album_creation_control ) ) {
68
- groups_update_groupmeta( $bp->groups->new_group_id, 'rt_media_group_control_level', $rt_album_creation_control ); }
69
  do_action( 'rtmedia_create_save_group_media_settings' , $_POST );
70
  }
71
 
@@ -86,36 +95,36 @@ if ( class_exists( 'BP_Group_Extension' ) ) :// Recommended, to prevent problems
86
  // HOOK to add PER GROUP MEDIA enable/diable option in rtMedia PRO
87
  do_action( 'rtmedia_group_media_control_edit' ); ?>
88
 
89
- <div class='rtmedia-group-media-settings'>
90
-
91
- <?php global $rtmedia;
92
- $options = $rtmedia->options;
93
- if ( isset( $options['general_enableAlbums'] ) && 1 === intval( $options['general_enableAlbums'] ) ) { // album is enabled ?>
94
-
95
- <h4><?php esc_html_e( 'Album Creation Control', 'buddypress-media' ); ?></h4>
96
- <p><?php esc_html_e( 'Who can create Albums in this group?', 'buddypress-media' ); ?></p>
97
- <div class="radio">
98
- <label>
99
- <input name="rt_album_creation_control" type="radio" id="rt_media_group_level_moderators" value="all"<?php checked( $current_level, 'all', true ) ?>>
100
- <strong><?php esc_html_e( 'All Group Members', 'buddypress-media' ); ?></strong>
101
- </label>
102
- <label>
103
- <input name="rt_album_creation_control" type="radio" id="rt_media_group_level_moderators" value="moderators" <?php checked( $current_level, 'moderators', true ) ?>>
104
- <strong><?php esc_html_e( 'Group Admins and Mods only', 'buddypress-media' ); ?></strong>
105
- </label>
106
- <label>
107
- <input name="rt_album_creation_control" type="radio" id="rt_media_group_level_admin" value="admin" <?php checked( $current_level, 'admin', true ) ?>>
108
- <strong><?php esc_html_e( 'Group Admin only', 'buddypress-media' ); ?></strong>
109
- </label>
110
- </div>
111
- <hr>
112
- <?php } ?>
113
-
114
- <?php do_action( 'rtmedia_playlist_creation_settings_groups_edit' ); ?>
115
- </div>
116
- <input type="submit" name="save" value="<?php esc_attr_e( 'Save Changes', 'buddypress-media' ); ?>" />
117
- <?php
118
- wp_nonce_field( 'groups_edit_save_' . $this->slug );
119
  }
120
 
121
  /**
@@ -128,28 +137,43 @@ if ( class_exists( 'BP_Group_Extension' ) ) :// Recommended, to prevent problems
128
  global $bp;
129
 
130
  $is_save = filter_input( INPUT_POST, 'save', FILTER_SANITIZE_STRING, FILTER_FLAG_EMPTY_STRING_NULL );
131
- if ( ! empty( $is_save ) ) {
132
- return false; }
133
- $rt_album_creation_control = filter_input( 'INPUT_POST', 'rt_album_creation_control', FILTER_SANITIZE_STRING );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134
 
135
  check_admin_referer( 'groups_edit_save_' . $this->slug );
136
 
137
- if ( ! empty( $rt_album_creation_control ) ) {
138
  $success = groups_update_groupmeta( bp_get_current_group_id(), 'rt_media_group_control_level', $rt_album_creation_control );
 
139
  do_action( 'rtmedia_edit_save_group_media_settings' , $_POST );
140
  $success = true;
141
  } else {
142
  $success = false;
143
  }
144
 
145
- /* To post an error/success message to the screen, use the following */
146
  if ( ! $success ) {
147
  bp_core_add_message( esc_html__( 'There was an error saving, please try again', 'buddypress-media' ), 'error' );
148
  } else {
149
  bp_core_add_message( esc_html__( 'Settings saved successfully', 'buddypress-media' ) );
150
  }
151
 
152
- bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) . '/admin/' . $this->slug );
153
  }
154
 
155
  /**
@@ -164,14 +188,14 @@ if ( class_exists( 'BP_Group_Extension' ) ) :// Recommended, to prevent problems
164
  */
165
  function widget_display() {
166
  ?>
167
- <div class="info-group" >
168
- <h4><?php echo esc_html( $this->name ) ?></h4>
169
- <p>
170
- <?php esc_html_e( 'You could display a small snippet of information from your group extension here. It will show on the group
171
  home screen.', 'buddypress-media' ); ?>
172
- </p>
173
- </div>
174
- <?php
175
  }
176
  }
177
 
24
 
25
  global $rtmedia;
26
  $options = $rtmedia->options; ?>
27
+ <div class='rtmedia-group-media-settings'>
28
+ <?php if ( isset( $options['general_enableAlbums'] ) && 1 === intval( $options['general_enableAlbums'] ) ) { // album is enabled ?>
29
+
30
+ <h4><?php esc_html_e( 'Album Creation Control', 'buddypress-media' ); ?></h4>
31
+ <p><?php esc_html_e( 'Who can create Albums in this group?', 'buddypress-media' ); ?></p>
32
+ <div class="radio">
33
+ <label>
34
+ <input name="rt_album_creation_control" type="radio" id="rt_media_group_level_all" checked="checked" value="all">
35
+ <strong><?php esc_html_e( 'All Group Members', 'buddypress-media' ); ?></strong>
36
+ </label>
37
+ <label>
38
+ <input name="rt_album_creation_control" type="radio" id="rt_media_group_level_moderators" value="moderators">
39
+ <strong><?php esc_html_e( 'Group Admins and Mods only', 'buddypress-media' ); ?></strong>
40
+ </label>
41
+ <label>
42
+ <input name="rt_album_creation_control" type="radio" id="rt_media_group_level_admin" value="admin">
43
+ <strong><?php esc_html_e( 'Group Admin only', 'buddypress-media' ); ?></strong>
44
+ </label>
45
+ </div>
46
+
47
+ <?php } ?>
48
+
49
+ <?php do_action( 'rtmedia_playlist_creation_settings_create_group' ); ?>
50
+ </div>
51
+ <?php
52
  wp_nonce_field( 'groups_create_save_' . $this->slug );
53
  }
54
 
61
 
62
  check_admin_referer( 'groups_create_save_' . $this->slug );
63
 
64
+ /**
65
+ * add playlist Save functionality
66
+ */
67
  $rt_album_creation_control = filter_input( INPUT_POST, 'rt_album_creation_control', FILTER_SANITIZE_STRING );
68
+ $rtmp_playlist_creation_control = filter_input( INPUT_POST, 'rtmp_playlist_creation_control', FILTER_SANITIZE_STRING );
69
+
70
+ /**
71
+ * Save any details submitted here
72
+ */
73
+ if ( ! empty( $rt_album_creation_control ) && ! empty( $rtmp_playlist_creation_control ) ) {
74
+ groups_update_groupmeta( $bp->groups->new_group_id, 'rt_media_group_control_level', $rt_album_creation_control );
75
+ groups_update_groupmeta( $bp->groups->new_group_id, 'rtmp_create_playlist_control_level', $rtmp_playlist_creation_control );
76
+ }
77
 
 
 
 
78
  do_action( 'rtmedia_create_save_group_media_settings' , $_POST );
79
  }
80
 
95
  // HOOK to add PER GROUP MEDIA enable/diable option in rtMedia PRO
96
  do_action( 'rtmedia_group_media_control_edit' ); ?>
97
 
98
+ <div class='rtmedia-group-media-settings'>
99
+
100
+ <?php global $rtmedia;
101
+ $options = $rtmedia->options;
102
+ if ( isset( $options['general_enableAlbums'] ) && 1 === intval( $options['general_enableAlbums'] ) ) { // album is enabled ?>
103
+
104
+ <h4><?php esc_html_e( 'Album Creation Control', 'buddypress-media' ); ?></h4>
105
+ <p><?php esc_html_e( 'Who can create Albums in this group?', 'buddypress-media' ); ?></p>
106
+ <div class="radio">
107
+ <label>
108
+ <input name="rt_album_creation_control" type="radio" id="rt_media_group_level_moderators" value="all"<?php checked( $current_level, 'all', true ) ?>>
109
+ <strong><?php esc_html_e( 'All Group Members', 'buddypress-media' ); ?></strong>
110
+ </label>
111
+ <label>
112
+ <input name="rt_album_creation_control" type="radio" id="rt_media_group_level_moderators" value="moderators" <?php checked( $current_level, 'moderators', true ) ?>>
113
+ <strong><?php esc_html_e( 'Group Admins and Mods only', 'buddypress-media' ); ?></strong>
114
+ </label>
115
+ <label>
116
+ <input name="rt_album_creation_control" type="radio" id="rt_media_group_level_admin" value="admin" <?php checked( $current_level, 'admin', true ) ?>>
117
+ <strong><?php esc_html_e( 'Group Admin only', 'buddypress-media' ); ?></strong>
118
+ </label>
119
+ </div>
120
+ <hr>
121
+ <?php } ?>
122
+
123
+ <?php do_action( 'rtmedia_playlist_creation_settings_groups_edit' ); ?>
124
+ </div>
125
+ <input type="submit" name="save" value="<?php esc_attr_e( 'Save Changes', 'buddypress-media' ); ?>" />
126
+ <?php
127
+ wp_nonce_field( 'groups_edit_save_' . $this->slug );
128
  }
129
 
130
  /**
137
  global $bp;
138
 
139
  $is_save = filter_input( INPUT_POST, 'save', FILTER_SANITIZE_STRING, FILTER_FLAG_EMPTY_STRING_NULL );
140
+
141
+ /**
142
+ * updated the following condition
143
+ * if ( ! empty( $is_save ) ) {
144
+ * it was returning false even when $is_save variable was not empty
145
+ * remove this comment after sometime
146
+ */
147
+ if ( empty( $is_save ) ) {
148
+ return false;
149
+ }
150
+
151
+ /**
152
+ * remove the ' ' [ syntax mistake ]
153
+ * add PLAYLIST CREATION CONTROL save functionality
154
+ */
155
+ $rt_album_creation_control = filter_input( INPUT_POST, 'rt_album_creation_control', FILTER_SANITIZE_STRING );
156
+ $rtmp_playlist_creation_control = filter_input( INPUT_POST, 'rtmp_playlist_creation_control', FILTER_SANITIZE_STRING );
157
 
158
  check_admin_referer( 'groups_edit_save_' . $this->slug );
159
 
160
+ if ( ! empty( $rt_album_creation_control ) && ! empty( $rtmp_playlist_creation_control ) ) {
161
  $success = groups_update_groupmeta( bp_get_current_group_id(), 'rt_media_group_control_level', $rt_album_creation_control );
162
+ $success = groups_update_groupmeta( bp_get_current_group_id(), 'rtmp_create_playlist_control_level', $rtmp_playlist_creation_control );
163
  do_action( 'rtmedia_edit_save_group_media_settings' , $_POST );
164
  $success = true;
165
  } else {
166
  $success = false;
167
  }
168
 
169
+ /* To post an error/success message to the screen, use the following */
170
  if ( ! $success ) {
171
  bp_core_add_message( esc_html__( 'There was an error saving, please try again', 'buddypress-media' ), 'error' );
172
  } else {
173
  bp_core_add_message( esc_html__( 'Settings saved successfully', 'buddypress-media' ) );
174
  }
175
 
176
+ bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) . '/admin/' . $this->slug );
177
  }
178
 
179
  /**
188
  */
189
  function widget_display() {
190
  ?>
191
+ <div class="info-group" >
192
+ <h4><?php echo esc_html( $this->name ) ?></h4>
193
+ <p>
194
+ <?php esc_html_e( 'You could display a small snippet of information from your group extension here. It will show on the group
195
  home screen.', 'buddypress-media' ); ?>
196
+ </p>
197
+ </div>
198
+ <?php
199
  }
200
  }
201
 
app/main/controllers/template/RTMediaTemplate.php CHANGED
@@ -314,7 +314,11 @@ class RTMediaTemplate {
314
  }
315
  }
316
 
317
- $rtmedia_query->query( false );
 
 
 
 
318
 
319
  global $rtmedia_points_media_id;
320
 
314
  }
315
  }
316
 
317
+ if ( isset( $rtmedia_query->query ) ) {
318
+ $rtmedia_query->query( $rtmedia_query->query );
319
+ } else {
320
+ $rtmedia_query->query( false );
321
+ }
322
 
323
  global $rtmedia_points_media_id;
324
 
app/main/controllers/template/rtmedia-actions.php ADDED
@@ -0,0 +1,568 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * List of user actions
5
+ */
6
+ function rtmedia_author_actions() {
7
+
8
+ $options_start = $options_end = $option_buttons = $output = '';
9
+ $options = array();
10
+ $options = apply_filters( 'rtmedia_author_media_options', $options );
11
+
12
+ if ( ! empty( $options ) ) {
13
+ $options_start .= '<div class="click-nav rtm-media-options-list" id="rtm-media-options-list">
14
+ <div class="no-js">
15
+ <button class="clicker rtmedia-media-options rtmedia-action-buttons button">' . esc_html__( 'Options', 'buddypress-media' ) . '</button>
16
+ <ul class="rtm-options">';
17
+
18
+ foreach ( $options as $action ) {
19
+ if ( ! empty( $action ) ) {
20
+ $option_buttons .= '<li>' . $action . '</li>';
21
+ }
22
+ }
23
+
24
+ $options_end = '</ul></div></div>';
25
+
26
+ if ( ! empty( $option_buttons ) ) {
27
+ $output = $options_start . $option_buttons . $options_end;
28
+ }
29
+
30
+ if ( ! empty( $output ) ) {
31
+ echo $output; // @codingStandardsIgnoreLine
32
+ }
33
+ }
34
+
35
+ }
36
+
37
+ add_action( 'after_rtmedia_action_buttons', 'rtmedia_author_actions' );
38
+
39
+ /**
40
+ * Adding media edit tab
41
+ *
42
+ * @global RTMediaQuery $rtmedia_query
43
+ *
44
+ * @param string $type
45
+ */
46
+ function rtmedia_image_editor_title( $type = 'photo' ) {
47
+
48
+ global $rtmedia_query;
49
+
50
+ if ( isset( $rtmedia_query->media[0]->media_type ) && 'photo' === $rtmedia_query->media[0]->media_type && 'photo' === $type ) {
51
+ echo '<li><a href="#panel2" class="rtmedia-modify-image"><i class="dashicons dashicons-format-image rtmicon"></i>' . esc_html__( 'Image', 'buddypress-media' ) . '</a></li>';
52
+ }
53
+
54
+ }
55
+
56
+ add_action( 'rtmedia_add_edit_tab_title', 'rtmedia_image_editor_title', 12, 1 );
57
+
58
+ /**
59
+ * Add the content for the image editor tab
60
+ *
61
+ * @global RTMediaQuery $rtmedia_query
62
+ *
63
+ * @param string $type
64
+ */
65
+ function rtmedia_image_editor_content( $type = 'photo' ) {
66
+
67
+ global $rtmedia_query;
68
+
69
+ if ( isset( $rtmedia_query->media ) && is_array( $rtmedia_query->media ) && isset( $rtmedia_query->media[0]->media_type ) && 'photo' === $rtmedia_query->media[0]->media_type && 'photo' === $type ) {
70
+ $media_id = $rtmedia_query->media[0]->media_id;
71
+ $id = $rtmedia_query->media[0]->id;
72
+ $modify_button = $nonce = '';
73
+
74
+ if ( current_user_can( 'edit_posts' ) ) {
75
+ include_once( ABSPATH . 'wp-admin/includes/image-edit.php' );
76
+
77
+ $nonce = wp_create_nonce( "image_editor-$media_id" );
78
+ $modify_button = '<p><input type="button" class="button rtmedia-image-edit" id="imgedit-open-btn-' . esc_attr( $media_id ) . '" onclick="imageEdit.open( \'' . esc_attr( $media_id ) . '\', \'' . esc_attr( $nonce ) . '\' )" value="' . esc_attr__( 'Modify Image', 'buddypress-media' ) . '"> <span class="spinner"></span></p>';
79
+ }
80
+
81
+ $image_path = rtmedia_image( 'rt_media_activity_image', $id, false );
82
+
83
+ echo '<div class="content" id="panel2">';
84
+ echo '<div class="rtmedia-image-editor-cotnainer" id="rtmedia-image-editor-cotnainer" >';
85
+ echo '<input type="hidden" id="rtmedia-filepath-old" name="rtmedia-filepath-old" value="' . esc_url( $image_path ) . '" />';
86
+ echo '<div class="rtmedia-image-editor" id="image-editor-' . esc_attr( $media_id ) . '"></div>';
87
+
88
+ $thumb_url = wp_get_attachment_image_src( $media_id, 'thumbnail', true );
89
+
90
+ echo '<div id="imgedit-response-' . esc_attr( $media_id ) . '"></div>';
91
+ echo '<div class="wp_attachment_image" id="media-head-' . esc_attr( $media_id ) . '">' . '<p id="thumbnail-head-' . esc_attr( $id ) . '"><img class="thumbnail" src="' . esc_url( set_url_scheme( $thumb_url[0] ) ) . '" alt="" /></p>' . $modify_button . '</div>'; // @codingStandardsIgnoreLine
92
+ echo '</div>';
93
+ echo '</div>';
94
+ }
95
+
96
+ }
97
+
98
+ add_action( 'rtmedia_add_edit_tab_content', 'rtmedia_image_editor_content', 12, 1 );
99
+
100
+ /**
101
+ * Provide drop-down to user to change the album of the media in media edit screen
102
+ *
103
+ * @global RTMediaQuery $rtmedia_query
104
+ *
105
+ * @param string $media_type
106
+ */
107
+ function rtmedia_add_album_selection_field( $media_type ) {
108
+
109
+ if ( is_rtmedia_album_enable() && isset( $media_type ) && 'album' != $media_type && apply_filters( 'rtmedia_edit_media_album_select', true ) ) {
110
+ global $rtmedia_query;
111
+
112
+ $curr_album_id = '';
113
+
114
+ if ( isset( $rtmedia_query->media[0] ) && isset( $rtmedia_query->media[0]->album_id ) && ! empty( $rtmedia_query->media[0]->album_id ) ) {
115
+ $curr_album_id = $rtmedia_query->media[0]->album_id;
116
+ }
117
+ ?>
118
+ <div class="rtmedia-edit-change-album rtm-field-wrap">
119
+ <label for=""><?php esc_html_e( 'Album', 'buddypress-media' ); ?> : </label>
120
+ <?php
121
+ if ( isset( $rtmedia_query->query['context'] ) && 'group' === $rtmedia_query->query['context'] ) {
122
+ //show group album list.
123
+ $album_list = rtmedia_group_album_list( $selected_album_id = $curr_album_id );
124
+ } else {
125
+ //show profile album list
126
+ $album_list = rtmedia_user_album_list( $get_all = false, $selected_album_id = $curr_album_id );
127
+ } ?>
128
+ <select name="album_id" class="rtmedia-merge-user-album-list"><?php echo $album_list; // @codingStandardsIgnoreLine?></select>
129
+ </div>
130
+ <?php
131
+ }
132
+
133
+ }
134
+
135
+ add_action( 'rtmedia_add_edit_fields', 'rtmedia_add_album_selection_field', 14, 1 );
136
+
137
+ /**
138
+ * Rendering gallery options
139
+ */
140
+ function rtmedia_gallery_options() {
141
+
142
+ $options_start = $options_end = $option_buttons = $output = '';
143
+ $options = array();
144
+ $options = apply_filters( 'rtmedia_gallery_actions', $options );
145
+
146
+ if ( ! empty( $options ) ) {
147
+ $options_start .= '<div class="click-nav rtm-media-options-list" id="rtm-media-options-list">
148
+ <div class="no-js">
149
+ <div class="clicker rtmedia-action-buttons"><i class="dashicons dashicons-admin-generic rtmicon"></i>' . esc_html__( 'Options', 'buddypress-media' ) . '</div>
150
+ <ul class="rtm-options">';
151
+
152
+ foreach ( $options as $action ) {
153
+ if ( ! empty( $action ) ) {
154
+ $option_buttons .= '<li>' . $action . '</li>';
155
+ }
156
+ }
157
+
158
+ $options_end = '</ul></div></div>';
159
+
160
+ if ( ! empty( $option_buttons ) ) {
161
+ $output = $options_start . $option_buttons . $options_end;
162
+ }
163
+
164
+ if ( ! empty( $output ) ) {
165
+ echo $output; // @codingStandardsIgnoreLine
166
+ }
167
+ }
168
+
169
+ }
170
+
171
+ add_action( 'rtmedia_media_gallery_actions', 'rtmedia_gallery_options', 80 );
172
+ add_action( 'rtmedia_album_gallery_actions', 'rtmedia_gallery_options', 80 );
173
+
174
+ /**
175
+ * Rendering create an album markup
176
+ *
177
+ * @global RTMediaQuery $rtmedia_query
178
+ */
179
+ function rtmedia_create_album_modal() {
180
+
181
+ global $rtmedia_query;
182
+
183
+ if ( is_rtmedia_album_enable() && isset( $rtmedia_query->query['context_id'] ) && isset( $rtmedia_query->query['context'] ) && ( ! ( isset( $rtmedia_query->is_gallery_shortcode ) && true === $rtmedia_query->is_gallery_shortcode ) ) || apply_filters( 'rtmedia_load_add_album_modal', false ) ) {
184
+ ?>
185
+ <div class="mfp-hide rtmedia-popup" id="rtmedia-create-album-modal">
186
+ <div id="rtm-modal-container">
187
+ <?php do_action( 'rtmedia_before_create_album_modal' ); ?>
188
+ <h2 class="rtm-modal-title"><?php esc_html_e( 'Create an Album', 'buddypress-media' ); ?></h2>
189
+ <p>
190
+ <label class="rtm-modal-grid-title-column" for="rtmedia_album_name"><?php esc_html_e( 'Album Title : ', 'buddypress-media' ); ?></label>
191
+ <input type="text" id="rtmedia_album_name" value="" class="rtm-input-medium" />
192
+ </p>
193
+ <?php do_action( 'rtmedia_add_album_privacy' ); ?>
194
+ <input type="hidden" id="rtmedia_album_context" value="<?php echo esc_attr( $rtmedia_query->query['context'] ); ?>">
195
+ <input type="hidden" id="rtmedia_album_context_id" value="<?php echo esc_attr( $rtmedia_query->query['context_id'] ); ?>">
196
+ <?php wp_nonce_field( 'rtmedia_create_album_nonce', 'rtmedia_create_album_nonce' ); ?>
197
+ <p>
198
+ <button type="button" id="rtmedia_create_new_album"><?php esc_html_e( 'Create Album', 'buddypress-media' ); ?></button>
199
+ </p>
200
+ <?php do_action( 'rtmedia_after_create_album_modal' ); ?>
201
+ </div>
202
+ </div>
203
+ <?php
204
+ }
205
+
206
+ }
207
+
208
+ add_action( 'rtmedia_before_media_gallery', 'rtmedia_create_album_modal' );
209
+ add_action( 'rtmedia_before_album_gallery', 'rtmedia_create_album_modal' );
210
+
211
+ /**
212
+ * Rendering merge album markup
213
+ *
214
+ * @global RTMediaQuery $rtmedia_query
215
+ */
216
+ function rtmedia_merge_album_modal() {
217
+
218
+ if ( ! is_rtmedia_album() || ! is_user_logged_in() ) {
219
+ return;
220
+ }
221
+
222
+ if ( ! is_rtmedia_album_enable() ) {
223
+ return;
224
+ }
225
+
226
+ global $rtmedia_query;
227
+
228
+ if ( is_rtmedia_group_album() ) {
229
+ $album_list = rtmedia_group_album_list();
230
+ } else {
231
+ $album_list = rtmedia_user_album_list();
232
+ }
233
+
234
+ if ( $album_list && ! empty( $rtmedia_query->media_query['album_id'] ) ) {
235
+ ?>
236
+ <div class="rtmedia-merge-container rtmedia-popup mfp-hide" id="rtmedia-merge">
237
+ <div id="rtm-modal-container">
238
+ <h2 class="rtm-modal-title"><?php esc_html_e( 'Merge Album', 'buddypress-media' ); ?></h2>
239
+ <form method="post" class="album-merge-form" action="merge/">
240
+ <p>
241
+ <span><?php esc_html_e( 'Select Album to merge with : ', 'buddypress-media' ); ?></span>
242
+ <?php echo '<select name="album" class="rtmedia-merge-user-album-list">' . $album_list . '</select>';// @codingStandardsIgnoreLine ?>
243
+ </p>
244
+ <?php wp_nonce_field( 'rtmedia_merge_album_' . $rtmedia_query->media_query['album_id'], 'rtmedia_merge_album_nonce' ); ?>
245
+ <input type="submit" class="rtmedia-merge-selected" name="merge-album" value="<?php esc_html_e( 'Merge Album', 'buddypress-media' ); ?>"/>
246
+ </form>
247
+ </div>
248
+ </div>
249
+ <?php
250
+ }
251
+
252
+ }
253
+
254
+ add_action( 'rtmedia_before_media_gallery', 'rtmedia_merge_album_modal' );
255
+ add_action( 'rtmedia_before_album_gallery', 'rtmedia_merge_album_modal' );
256
+
257
+ /**
258
+ * Rendering checkboxes to select media
259
+ *
260
+ * @global RTMediaQuery $rtmedia_query
261
+ * @global array $rtmedia_backbone
262
+ */
263
+ function rtmedia_item_select() {
264
+
265
+ global $rtmedia_query, $rtmedia_backbone;
266
+
267
+ if ( $rtmedia_backbone['backbone'] ) {
268
+ if ( isset( $rtmedia_backbone['is_album'] ) && $rtmedia_backbone['is_album'] && isset( $rtmedia_backbone['is_edit_allowed'] ) && $rtmedia_backbone['is_edit_allowed'] ) {
269
+ echo '<span class="rtm-checkbox-wrap"><input type="checkbox" name="move[]" class="rtmedia-item-selector" value="<%= id %>" /></span>';
270
+ }
271
+ } else {
272
+ if ( is_rtmedia_album() && isset( $rtmedia_query->media_query ) && 'edit' === $rtmedia_query->action_query->action ) {
273
+ if ( isset( $rtmedia_query->media_query['media_author'] ) && get_current_user_id() === intval( $rtmedia_query->media_query['media_author'] ) ) {
274
+ echo '<span class="rtm-checkbox-wrap"><input type="checkbox" class="rtmedia-item-selector" name="selected[]" value="' . esc_attr( rtmedia_id() ) . '" /></span>';
275
+ }
276
+ }
277
+ }
278
+
279
+ }
280
+
281
+ add_action( 'rtmedia_before_item', 'rtmedia_item_select' );
282
+
283
+ /**
284
+ * Album merge action
285
+ *
286
+ * @param array $actions
287
+ *
288
+ * @return array
289
+ */
290
+ function rtmedia_album_merge_action( $actions ) {
291
+
292
+ $actions['merge'] = esc_html__( 'Merge', 'buddypress-media' );
293
+
294
+ return $actions;
295
+
296
+ }
297
+
298
+ add_action( 'rtmedia_query_actions', 'rtmedia_album_merge_action' );
299
+
300
+ /**
301
+ * Add upload button
302
+ */
303
+ function add_upload_button() {
304
+
305
+ if ( function_exists( 'bp_is_blog_page' ) && ! bp_is_blog_page() ) {
306
+ if ( function_exists( 'bp_is_user' ) && bp_is_user() && function_exists( 'bp_displayed_user_id' ) && bp_displayed_user_id() === get_current_user_id() ) {
307
+ echo '<span class="primary rtmedia-upload-media-link" id="rtm_show_upload_ui" title="' . esc_attr__( 'Upload Media', 'buddypress-media' ) . '"><i class="dashicons dashicons-upload rtmicon"></i>' . esc_html__( 'Upload', 'buddypress-media' ) . '</span>';
308
+ } else {
309
+ if ( function_exists( 'bp_is_group' ) && bp_is_group() ) {
310
+ if ( can_user_upload_in_group() ) {
311
+ echo '<span class="rtmedia-upload-media-link primary" id="rtm_show_upload_ui" title="' . esc_attr__( 'Upload Media', 'buddypress-media' ) . '"><i class="dashicons dashicons-upload rtmicon"></i>' . esc_html__( 'Upload', 'buddypress-media' ) . '</span>';
312
+ }
313
+ }
314
+ }
315
+ }
316
+
317
+ }
318
+
319
+ add_action( 'rtmedia_media_gallery_actions', 'add_upload_button', 99 );
320
+ add_action( 'rtmedia_album_gallery_actions', 'add_upload_button', 99 );
321
+
322
+ /**
323
+ * Add music cover art
324
+ *
325
+ * @param array $file_object
326
+ * @param object $upload_obj
327
+ */
328
+ function add_music_cover_art( $file_object, $upload_obj ) {
329
+
330
+ $media_obj = new RTMediaMedia();
331
+ $media = $media_obj->model->get( array(
332
+ 'id' => $upload_obj->media_ids[0]
333
+ ) );
334
+
335
+ }
336
+
337
+ // add_action("rtemdia_after_file_upload_before_activity","add_music_cover_art" ,20 ,2);
338
+
339
+ /**
340
+ * rtmedia link
341
+ *
342
+ * @global RTMedia $rtmedia
343
+ */
344
+ function rtmedia_link_in_footer() {
345
+
346
+ global $rtmedia;
347
+
348
+ $option = $rtmedia->options;
349
+ $link = ( isset( $option['rtmedia_add_linkback'] ) ) ? $option['rtmedia_add_linkback'] : false;
350
+
351
+ if ( $link ) {
352
+ $aff_id = ( '' != $option['rtmedia_affiliate_id'] ) ? '&ref=' . $option['rtmedia_affiliate_id'] : '';
353
+ $href = 'https://rtmedia.io/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media' . $aff_id;
354
+ ?>
355
+ <div class='rtmedia-footer-link'>
356
+ <?php esc_html_e( 'Empowering your community with ', 'buddypress-media' ); ?>
357
+ <a href='<?php echo esc_url( $href ) ?>' title='<?php esc_attr_e( 'The only complete media solution for WordPress, BuddyPress and bbPress', 'buddypress-media' ); ?> '>rtMedia</a>
358
+ </div>
359
+ <?php
360
+ }
361
+
362
+ }
363
+
364
+ add_action( 'wp_footer', 'rtmedia_link_in_footer' );
365
+
366
+ /**
367
+ * Add content before the media in single media page
368
+ *
369
+ * @global bool $rt_ajax_request
370
+ */
371
+ function rtmedia_content_before_media() {
372
+
373
+ global $rt_ajax_request;
374
+
375
+ if ( $rt_ajax_request ) {
376
+ ?>
377
+ <span class="rtm-mfp-close mfp-close dashicons dashicons-no-alt" title="<?php esc_attr_e( 'Close (Esc)', 'buddypress-media' ); ?>"></span>
378
+ <?php
379
+ }
380
+
381
+ }
382
+
383
+ add_action( 'rtmedia_before_media', 'rtmedia_content_before_media', 10 );
384
+
385
+ /**
386
+ * Rendering custom CSS
387
+ *
388
+ * @global RTMedia $rtmedia
389
+ */
390
+ function rtmedia_custom_css() {
391
+
392
+ global $rtmedia;
393
+
394
+ $options = $rtmedia->options;
395
+
396
+ if ( ! empty( $options['styles_custom'] ) ) {
397
+ echo "<style type='text/css'> " . stripslashes( $options['styles_custom'] ) . ' </style>'; // @codingStandardsIgnoreLine
398
+ }
399
+
400
+ }
401
+
402
+ add_action( 'wp_head', 'rtmedia_custom_css' );
403
+
404
+ /**
405
+ * Update the group media privacy according to the group privacy settings when group settings are changed
406
+ *
407
+ * @global wpdb $wpdb
408
+ *
409
+ * @param int $group_id
410
+ */
411
+ function update_group_media_privacy( $group_id ) {
412
+
413
+ if ( ! empty( $group_id ) && function_exists( 'groups_get_group' ) ) {
414
+ //get the buddybress group
415
+ $group = groups_get_group( array(
416
+ 'group_id' => $group_id
417
+ ) );
418
+
419
+ if ( isset( $group->status ) ) {
420
+ global $wpdb;
421
+
422
+ $model = new RTMediaModel();
423
+
424
+ if ( 'public' !== $group->status ) {
425
+ // when group settings are updated and is private/hidden, set media privacy to 20
426
+ $update_sql = $wpdb->prepare( "UPDATE {$model->table_name} SET privacy = '20' where context='group' AND context_id=%d AND privacy <> 80 ", $group_id ); // @codingStandardsIgnoreLine
427
+ } else {
428
+ // when group settings are updated and is private/hidden, set media privacy to 0
429
+ $update_sql = $wpdb->prepare( "UPDATE {$model->table_name} SET privacy = '0' where context='group' AND context_id=%d AND privacy <> 80 ", $group_id ); // @codingStandardsIgnoreLine
430
+ }
431
+
432
+ //update the medias
433
+ $wpdb->query( $update_sql ); // @codingStandardsIgnoreLine
434
+ }
435
+ }
436
+
437
+ }
438
+
439
+ add_action( 'groups_settings_updated', 'update_group_media_privacy', 99, 1 );
440
+
441
+ /**
442
+ * Function for no-popup class for rtmedia media gallery
443
+ *
444
+ * @param string $class
445
+ *
446
+ * @return string
447
+ */
448
+ function rtmedia_add_no_popup_class( $class = '' ) {
449
+
450
+ return $class .= ' no-popup';
451
+
452
+ }
453
+
454
+ /**
455
+ * This function is used in RTMediaQuery.php file for show title filter
456
+ *
457
+ * @param bool $flag
458
+ *
459
+ * @return bool
460
+ */
461
+ function rtmedia_gallery_do_not_show_media_title( $flag ) {
462
+
463
+ return false;
464
+
465
+ }
466
+
467
+ /**
468
+ * Remove all the shortcode related hooks that we had added in RTMediaQuery.php file after gallery is loaded
469
+ */
470
+ function rtmedia_remove_media_query_hooks_after_gallery() {
471
+
472
+ remove_filter( 'rtmedia_gallery_list_item_a_class', 'rtmedia_add_no_popup_class', 10, 1 );
473
+ remove_filter( 'rtmedia_media_gallery_show_media_title', 'rtmedia_gallery_do_not_show_media_title', 10, 1 );
474
+
475
+ }
476
+
477
+ add_action( 'rtmedia_after_media_gallery', 'rtmedia_remove_media_query_hooks_after_gallery' );
478
+
479
+ /**
480
+ * Sanitize media file name before uploading
481
+ *
482
+ * @param string $filename
483
+ *
484
+ * @return string
485
+ */
486
+ function sanitize_filename_before_upload( $filename ) {
487
+
488
+ $info = pathinfo( $filename );
489
+ $ext = empty( $info['extension'] ) ? '' : '.' . $info['extension'];
490
+ $name = basename( $filename, $ext );
491
+ $final_file_name = $name;
492
+ $special_chars = array( '?', '[', ']', '/', '\\', '=', '<', '>', ':', ';', ',', "'", '"', '&', '$', '#', '*', '(', ')', '|', '~', '`', '!', '{', '}', chr( 0 ) );
493
+ $special_chars = apply_filters( 'sanitize_file_name_chars', $special_chars, $final_file_name );
494
+ $string = str_replace( $special_chars, '-', $final_file_name );
495
+ $string = preg_replace( '/\+/', '', $string );
496
+
497
+ return remove_accents( $string ) . $ext;
498
+
499
+ }
500
+
501
+ /**
502
+ * Removing special characters and replacing accent characters with ASCII characters in filename before upload to server
503
+ */
504
+ function rtmedia_upload_sanitize_filename_before_upload() {
505
+
506
+ add_action( 'sanitize_file_name', 'sanitize_filename_before_upload', 10, 1 );
507
+
508
+ }
509
+
510
+ add_action( 'rtmedia_upload_set_post_object', 'rtmedia_upload_sanitize_filename_before_upload', 10 );
511
+
512
+ /**
513
+ * Admin pages content
514
+ *
515
+ * @param string $page
516
+ */
517
+ function rtmedia_admin_pages_content( $page ) {
518
+
519
+ if ( 'rtmedia-hire-us' === $page ) {
520
+ ?>
521
+ <div class="rtm-hire-us-container rtm-page-container">
522
+ <h3 class="rtm-setting-title rtm-show"><?php esc_html_e( 'You can consider rtMedia Team for following :', 'buddypress-media' ); ?></h3>
523
+ <ol class="rtm-hire-points">
524
+ <li><?php esc_html_e( 'rtMedia Customization ( in Upgrade Safe manner )', 'buddypress-media' ); ?></li>
525
+ <li><?php esc_html_e( 'WordPress/BuddyPress Theme Design and Development', 'buddypress-media' ); ?></li>
526
+ <li><?php esc_html_e( 'WordPress/BuddyPress Plugin Development', 'buddypress-media' ); ?></li>
527
+ </ol>
528
+ <div class="clearfix">
529
+ <a href="https://rtmedia.io/contact" class="rtm-button rtm-success" target="_blank"><?php esc_html_e( 'Contact Us', 'buddypress-media' ); ?></a>
530
+ </div>
531
+ </div>
532
+ <?php
533
+ }
534
+
535
+ }
536
+
537
+ add_action( 'rtmedia_admin_page_insert', 'rtmedia_admin_pages_content', 99, 1 );
538
+
539
+ /**
540
+ * Adds delete nonce for all template file before tempalte load
541
+ */
542
+ function rtmedia_add_media_delete_nonce() {
543
+
544
+ wp_nonce_field( 'rtmedia_' . get_current_user_id(), 'rtmedia_media_delete_nonce' );
545
+
546
+ }
547
+
548
+ add_action( 'rtmedia_before_template_load', 'rtmedia_add_media_delete_nonce' );
549
+
550
+ /**
551
+ * 'rtmedia_before_template_load' will not fire for gallery shortcode
552
+ * To add delete nonce in gallery shortcode use rtmedia_pre_template hook
553
+ *
554
+ * Adds delete nonce for gallery shortcode
555
+ *
556
+ * @global RTMediaQuery $rtmedia_query
557
+ */
558
+ function rtmedia_add_media_delete_nonce_shortcode() {
559
+
560
+ global $rtmedia_query;
561
+
562
+ if ( isset( $rtmedia_query->is_gallery_shortcode ) && true === $rtmedia_query->is_gallery_shortcode ) {
563
+ wp_nonce_field( 'rtmedia_' . get_current_user_id(), 'rtmedia_media_delete_nonce' );
564
+ }
565
+
566
+ }
567
+
568
+ add_action( 'rtmedia_pre_template', 'rtmedia_add_media_delete_nonce_shortcode' );
app/main/controllers/template/rtmedia-ajax-actions.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Delete uploaded media
5
+ */
6
+ function rtmedia_delete_uploaded_media() {
7
+
8
+ $action = filter_input( INPUT_POST, 'action', FILTER_SANITIZE_STRING );
9
+ $nonce = filter_input( INPUT_POST, 'nonce', FILTER_SANITIZE_STRING );
10
+ $media_id = filter_input( INPUT_POST, 'media_id', FILTER_SANITIZE_NUMBER_INT );
11
+
12
+ if ( ! empty( $action ) && 'delete_uploaded_media' === $action && ! empty( $media_id ) ) {
13
+ if ( wp_verify_nonce( $nonce, 'rtmedia_' . get_current_user_id() ) ) {
14
+ $media = new RTMediaMedia();
15
+ $delete = $media->delete( $media_id );
16
+
17
+ echo '1';
18
+
19
+ wp_die();
20
+ }
21
+ }
22
+
23
+ echo '0';
24
+
25
+ wp_die();
26
+
27
+ }
28
+
29
+ add_action( 'wp_ajax_delete_uploaded_media', 'rtmedia_delete_uploaded_media' );
app/main/controllers/template/rtmedia-filters.php ADDED
@@ -0,0 +1,479 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Creating an album
5
+ *
6
+ * @global RTMediaQuery $rtmedia_query
7
+ *
8
+ * @param array $options
9
+ *
10
+ * @return array|void
11
+ */
12
+ function rtmedia_create_album( $options ) {
13
+
14
+ if ( ! is_rtmedia_album_enable() ) {
15
+ return;
16
+ }
17
+
18
+ if ( ! rtm_is_album_create_allowed() ) {
19
+ return;
20
+ }
21
+
22
+ global $rtmedia_query;
23
+
24
+ $user_id = get_current_user_id();
25
+ $display = false;
26
+ $context_type_array = array( 'profile', 'group' );
27
+
28
+ if ( isset( $rtmedia_query->query['context'] ) && in_array( $rtmedia_query->query['context'], $context_type_array, true ) && 0 !== $user_id ) {
29
+ switch ( $rtmedia_query->query['context'] ) {
30
+ case 'profile':
31
+ if ( $rtmedia_query->query['context_id'] === $user_id ) {
32
+ $display = rtm_is_user_allowed_to_create_album();
33
+ }
34
+
35
+ break;
36
+ case 'group':
37
+ $group_id = $rtmedia_query->query['context_id'];
38
+
39
+ if ( can_user_create_album_in_group( $group_id ) ) {
40
+ $display = true;
41
+ }
42
+
43
+ break;
44
+ }
45
+ }
46
+
47
+ if ( true === $display ) {
48
+ add_action( 'rtmedia_before_media_gallery', 'rtmedia_create_album_modal' );
49
+
50
+ $options[] = "<a href='#rtmedia-create-album-modal' class='rtmedia-reveal-modal rtmedia-modal-link' title='" . esc_attr__( 'Create New Album', 'buddypress-media' ) . "'><i class='dashicons dashicons-plus-alt rtmicon'></i>" . esc_html__( 'Add Album', 'buddypress-media' ) . '</a>';
51
+ }
52
+
53
+ return $options;
54
+
55
+ }
56
+
57
+ add_filter( 'rtmedia_gallery_actions', 'rtmedia_create_album', 12 );
58
+
59
+ /**
60
+ * Edit album option
61
+ *
62
+ * @global RTMediaQuery $rtmedia_query
63
+ *
64
+ * @param array $options
65
+ *
66
+ * @return array|void
67
+ */
68
+ function rtmedia_album_edit( $options ) {
69
+
70
+ if ( ! is_rtmedia_album() || ! is_user_logged_in() ) {
71
+ return;
72
+ }
73
+
74
+ if ( ! is_rtmedia_album_enable() ) {
75
+ return;
76
+ }
77
+
78
+ global $rtmedia_query;
79
+
80
+ if ( isset( $rtmedia_query->media_query ) && isset( $rtmedia_query->media_query['album_id'] ) && ! in_array( intval( $rtmedia_query->media_query['album_id'] ), array_map( 'intval', rtmedia_get_site_option( 'rtmedia-global-albums' ) ), true ) ) {
81
+ if ( rtmedia_is_album_editable() || is_rt_admin() ) {
82
+ $options[] = "<a href='edit/' class='rtmedia-edit' title='" . esc_attr__( 'Edit Album', 'buddypress-media' ) . "' ><i class='rtmicon dashicons dashicons-edit'></i>" . esc_html__( 'Edit Album', 'buddypress-media' ) . '</a>';
83
+ $options[] = '<form method="post" class="album-delete-form rtmedia-inline" action="delete/">' . wp_nonce_field( 'rtmedia_delete_album_' . $rtmedia_query->media_query['album_id'], 'rtmedia_delete_album_nonce' ) . '<button type="submit" name="album-delete" class="rtmedia-delete-album" title="' . esc_attr__( 'Delete Album', 'buddypress-media' ) . '"><i class="dashicons dashicons-trash rtmicon"></i>' . esc_html__( 'Delete Album', 'buddypress-media' ) . '</button></form>';
84
+
85
+ if ( is_rtmedia_group_album() ) {
86
+ $album_list = rtmedia_group_album_list();
87
+ } else {
88
+ $album_list = rtmedia_user_album_list();
89
+ }
90
+
91
+ if ( $album_list ) {
92
+ $options[] = '<a href="#rtmedia-merge" class="rtmedia-reveal-modal rtmedia-modal-link" title="' . esc_attr__( 'Merge Album', 'buddypress-media' ) . '"><i class="dashicons dashicons-randomize"></i>' . esc_html__( 'Merge Album', 'buddypress-media' ) . '</a>';
93
+ }
94
+ }
95
+ }
96
+
97
+ return $options;
98
+
99
+ }
100
+
101
+ add_filter( 'rtmedia_gallery_actions', 'rtmedia_album_edit', 11 );
102
+
103
+ /**
104
+ * Add activity type
105
+ *
106
+ * @param array $actions
107
+ *
108
+ * @return array
109
+ */
110
+ function rtmedia_bp_activity_get_types( $actions ) {
111
+
112
+ $actions['rtmedia_update'] = 'rtMedia update';
113
+
114
+ return $actions;
115
+
116
+ }
117
+
118
+ add_filter( 'bp_activity_get_types', 'rtmedia_bp_activity_get_types', 10, 1 );
119
+
120
+ /**
121
+ * Checking if BuddyPress enable
122
+ *
123
+ * @global RTMediaQuery $rtmedia_query
124
+ *
125
+ * @param bool $flag
126
+ *
127
+ * @return bool
128
+ */
129
+ function rtm_is_buddypress_enable( $flag ) {
130
+
131
+ global $rtmedia_query;
132
+
133
+ if ( isset( $rtmedia_query->query ) && isset( $rtmedia_query->query['context'] ) && 'group' === $rtmedia_query->query['context'] && is_rtmedia_group_media_enable() ) {
134
+ return $flag;
135
+ } else if ( isset( $rtmedia_query->query ) && isset( $rtmedia_query->query['context'] ) && 'profile' === $rtmedia_query->query['context'] && is_rtmedia_profile_media_enable() ) {
136
+ return $flag;
137
+ }
138
+
139
+ return false;
140
+
141
+ }
142
+
143
+ add_filter( 'rtm_main_template_buddypress_enable', 'rtm_is_buddypress_enable', 10, 1 );
144
+
145
+ /**
146
+ * we need to use show title filter when there is a request for template from rtMedia.backbone.js
147
+ *
148
+ * @param bool $flag
149
+ *
150
+ * @return bool
151
+ */
152
+ function rtmedia_media_gallery_show_title_template_request( $flag ) {
153
+
154
+ if ( isset( $_REQUEST['media_title'] ) && 'false' === $_REQUEST['media_title'] ) {
155
+ return false;
156
+ }
157
+
158
+ return $flag;
159
+
160
+ }
161
+
162
+ add_filter( 'rtmedia_media_gallery_show_media_title', 'rtmedia_media_gallery_show_title_template_request', 10, 1 );
163
+
164
+ /**
165
+ * we need to use lightbox filter when there is a request for template from rtMedia.backbone.js
166
+ *
167
+ * @param string $class
168
+ *
169
+ * @return string
170
+ */
171
+ function rtmedia_media_gallery_lightbox_template_request( $class ) {
172
+
173
+ if ( isset( $_REQUEST['lightbox'] ) && 'false' === $_REQUEST['lightbox'] ) {
174
+ return $class .= ' no-popup';
175
+ }
176
+
177
+ return $class;
178
+
179
+ }
180
+
181
+ add_filter( 'rtmedia_gallery_list_item_a_class', 'rtmedia_media_gallery_lightbox_template_request', 10, 1 );
182
+
183
+ /**
184
+ * Fix for BuddyPress multilingual plugin on activity pages
185
+ *
186
+ * @param array $params
187
+ *
188
+ * @return array
189
+ */
190
+ function rtmedia_modify_activity_upload_url( $params ) {
191
+
192
+ // return original params if BuddyPress multilingual plugin is not active
193
+ include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
194
+
195
+ if ( function_exists( 'is_plugin_active' ) && is_plugin_active( 'buddypress-multilingual/sitepress-bp.php' ) ) {
196
+ if ( class_exists( 'BuddyPress' ) ) {
197
+ // change upload url only if it's activity page and if it's group page than it shouldn't group media page
198
+ if ( bp_is_activity_component() || ( bp_is_groups_component() && ! is_rtmedia_page() ) ) {
199
+ if ( function_exists( 'bp_get_activity_directory_permalink' ) ) {
200
+ $params['url'] = bp_get_activity_directory_permalink() . 'upload/';
201
+ }
202
+ }
203
+ }
204
+ }
205
+
206
+ return $params;
207
+
208
+ }
209
+
210
+ add_filter( 'rtmedia_modify_upload_params', 'rtmedia_modify_activity_upload_url', 999, 1 );
211
+
212
+ /**
213
+ * WordPress filter to change browser title if theme has title-tag support
214
+ *
215
+ * @global RTMediaQuery $rtmedia_query
216
+ *
217
+ * @param array $title
218
+ *
219
+ * @return array
220
+ */
221
+ function rtm_modify_document_title_parts( $title = array() ) {
222
+
223
+ if ( is_rtmedia_page() ) {
224
+ global $rtmedia_query;
225
+
226
+ if ( isset( $rtmedia_query->action_query->media_type ) ) {
227
+ ( ! class_exists( 'BuddyPress' ) ) ? array_unshift( $title, ucfirst( $rtmedia_query->action_query->media_type ), RTMEDIA_MEDIA_LABEL ) : array_unshift( $title, ucfirst( $rtmedia_query->action_query->media_type ) );
228
+ } else {
229
+ ( ! class_exists( 'BuddyPress' ) ) ? array_unshift( $title, RTMEDIA_MEDIA_LABEL ) : '';
230
+ }
231
+ }
232
+
233
+ return $title;
234
+
235
+ }
236
+
237
+ add_filter( 'document_title_parts', 'rtm_modify_document_title_parts', 30, 1 );
238
+
239
+ /**
240
+ * Replace original src with the transcoded media src
241
+ *
242
+ * @param string $html
243
+ * @param object $rtmedia_media
244
+ *
245
+ * @return string
246
+ */
247
+ function replace_src_with_transcoded_file_url( $html, $rtmedia_media ) {
248
+
249
+ if ( empty( $rtmedia_media->media_id ) ) {
250
+ return $html;
251
+ }
252
+
253
+ $media_type = '';
254
+ $attachment_id = $rtmedia_media->media_id;
255
+
256
+ if ( 'video' === $rtmedia_media->media_type ) {
257
+ $media_type = 'mp4';
258
+ } elseif ( 'music' === $rtmedia_media->media_type ) {
259
+ $media_type = 'mp3';
260
+ } else {
261
+ return $html;
262
+ }
263
+
264
+ $medias = get_post_meta( $attachment_id, '_rt_media_transcoded_files', true );
265
+
266
+ if ( $file_url = rtt_is_video_exists( $medias, $media_type ) ) {
267
+ /* for WordPress backward compatibility */
268
+ if ( function_exists( 'wp_get_upload_dir' ) ) {
269
+ $uploads = wp_get_upload_dir();
270
+ } else {
271
+ $uploads = wp_upload_dir();
272
+ }
273
+
274
+ if ( 0 === strpos( $file_url, $uploads['baseurl'] ) ) {
275
+ $final_file_url = $file_url;
276
+ } else {
277
+ $final_file_url = $uploads['baseurl'] . '/' . $file_url;
278
+ }
279
+
280
+ $final_file_url = apply_filters( 'transcoded_file_url', $final_file_url, $attachment_id );
281
+ } else {
282
+ $final_file_url = wp_get_attachment_url( $attachment_id );
283
+ }
284
+
285
+ return preg_replace( "/src=[\"]([^\"]+)[\"]/", "src=\"$final_file_url\"", $html );
286
+
287
+ }
288
+
289
+ add_filter( 'rtmedia_single_content_filter', 'replace_src_with_transcoded_file_url', 100, 2 );
290
+
291
+ /**
292
+ * Replace aws url of image with the wordpress attachment url in buddypress activity
293
+ * @param string $html
294
+ * @param object $rtmedia_media
295
+ *
296
+ * @return string
297
+ */
298
+ function replace_aws_img_urls_from_activity( $html, $rtmedia_media ) {
299
+ if ( empty( $rtmedia_media ) ) {
300
+ return $html;
301
+ }
302
+ /**
303
+ * Allow users/plugins to prevent replacing of URL from activty
304
+ *
305
+ * @var boolean Boolean false is passed as a parameter.
306
+ * @var object $rtmedia_media Object of rtmedia containing media_id, media_type etc.
307
+ */
308
+ if ( apply_filters( 'replace_aws_img_urls_from_activity', false, $rtmedia_media ) ) {
309
+ return $html;
310
+ }
311
+
312
+ if ( empty( $rtmedia_media->media_id ) || empty( $rtmedia_media->media_type ) ) {
313
+ return $html;
314
+ }
315
+
316
+ $media_type = $rtmedia_media->media_type;
317
+
318
+ if ( 'imgae' === $media_type ) {
319
+ /**
320
+ * Fix for rtAmazon S3 addon
321
+ * When rtAmazon S3 is disabled we need to restore/replace the attachment URLS with the
322
+ * original WordPress URL structure
323
+ */
324
+ if ( ! class_exists( 'RTAWSS3_Class' ) && ! class_exists( 'AS3CF_Utils' ) ) {
325
+ /* for WordPress backward compatibility */
326
+ if ( function_exists( 'wp_get_upload_dir' ) ) {
327
+ $uploads = wp_get_upload_dir();
328
+ } else {
329
+ $uploads = wp_upload_dir();
330
+ }
331
+
332
+ $baseurl = $uploads['baseurl'];
333
+
334
+ $search = '/^(http|https)(.*)([wp\-content])(\/uploads\/)/i';
335
+ $replace = $baseurl . '/';
336
+
337
+ $thumbnail_url = preg_replace( $search, $replace, $thumbnail_id );
338
+ if ( ! empty( $thumbnail_url ) ) {
339
+ $html = preg_replace( "/src=[\"]([^\"]+)[\"]/", "src=\"$thumbnail_url\"", $html );
340
+ }
341
+ }
342
+ }
343
+ return $html;
344
+ }
345
+
346
+ add_filter( 'rtmedia_single_content_filter', 'replace_aws_img_urls_from_activity', 100, 2 );
347
+
348
+ /**
349
+ * Add the notice when file is sent for the transcoding and adds the poster thumbnail if poster tag is empty
350
+ *
351
+ * @since 1.0.1
352
+ *
353
+ * @param string $content HTML contents of the activity
354
+ * @param object $activity Activity object
355
+ *
356
+ * @return string
357
+ */
358
+ function replace_aws_img_urls_from_activities( $content, $activity = '' ) {
359
+
360
+ if ( empty( $content ) || empty( $activity ) ) {
361
+ return $content;
362
+ }
363
+
364
+ /**
365
+ * Allow users/plugins to prevent replacing of URL from activty
366
+ *
367
+ * @var boolean Boolean false is passed as a parameter.
368
+ * @var object $activity Object of activity.
369
+ */
370
+ if ( apply_filters( 'replace_aws_img_urls_from_activity', false, $activity ) ) {
371
+ return $content;
372
+ }
373
+
374
+ $rt_model = new RTMediaModel();
375
+ $all_media = $rt_model->get( array( 'activity_id' => $activity->id ) );
376
+
377
+ $is_img = false;
378
+ $url = '';
379
+ $is_img = strpos( $content , '<img ' );
380
+
381
+ $search = "/<img.+src=[\"]([^\"]+)[\"]/";
382
+ preg_match_all( $search , $content, $url );
383
+
384
+ if ( ! empty( $is_img ) && ! empty( $url ) && ! empty( $url[1] ) ) {
385
+ /**
386
+ * Fix for rtAmazon S3 addon
387
+ * When rtAmazon S3 is disabled we need to restore/replace the attachment URLS with the
388
+ * original WordPress URL structure
389
+ */
390
+ foreach ( $url[1] as $key => $url ) {
391
+ if ( ! class_exists( 'RTAWSS3_Class' ) && ! class_exists( 'AS3CF_Utils' ) ) {
392
+ /* for WordPress backward compatibility */
393
+ if ( function_exists( 'wp_get_upload_dir' ) ) {
394
+ $uploads = wp_get_upload_dir();
395
+ } else {
396
+ $uploads = wp_upload_dir();
397
+ }
398
+
399
+ $baseurl = $uploads['baseurl'];
400
+
401
+ $search = "/^(http|https)(.*)([wp\-content])(\/uploads\/)/i";
402
+ $replace = $baseurl . '/';
403
+
404
+ $thumbnail_url = preg_replace( $search, $replace, $url );
405
+ if ( ! empty( $thumbnail_url ) ) {
406
+ $content = str_replace( $url, $thumbnail_url, $content );
407
+ }
408
+ } else {
409
+ /**
410
+ * Sometimes there's no attachment ID for the URL assigned, so we pass MD5 hash of the URL as a attachment ID
411
+ */
412
+ $attachment_id = md5( $url );
413
+ if ( ! empty( $all_media ) && ! empty( $all_media[0]->media_id ) ) {
414
+ $attachment_id = $all_media[0]->media_id;
415
+ }
416
+ $image_url = apply_filters( 'rtmedia_filtered_photo_url', $url, $attachment_id );
417
+ $content = str_replace( $url, $image_url, $content );
418
+ }
419
+ }
420
+
421
+ }
422
+ return $content;
423
+ }
424
+
425
+ add_filter( 'bp_get_activity_content_body', 'replace_aws_img_urls_from_activities', 99, 2 );
426
+
427
+
428
+ /**
429
+ * Gives the WordPress's default attachment URL if the base URL of the attachment is
430
+ * different than the WordPress's default base URL. e.g following URL
431
+ * https://s3.amazonaws.com/bucket-name/wp-content/uploads/2016/09/attachment.jpg
432
+ * will get replaced with
433
+ * http://www.wordpress-base.url/wp-content/uploads/2016/09/1473432502-small-10-1-16_1.jpg
434
+ *
435
+ * @param int $thumbnail_id It can be attachment URL or attachment ID
436
+ * @param string $media_type Media type
437
+ * @param int $media_id Attachment ID
438
+ *
439
+ * @return string Attachment URL if attachment URL is provided in the argument
440
+ */
441
+ function rtt_restore_og_wp_image_url( $thumbnail_id, $media_type, $media_id ) {
442
+
443
+ if ( is_numeric( $thumbnail_id ) ) {
444
+ return $thumbnail_id;
445
+ }
446
+
447
+ /**
448
+ * Fix for rtAmazon S3 addon
449
+ * When rtAmazon S3 is disabled we need to restore/replace the attachment URLS with the
450
+ * original WordPress URL structure
451
+ */
452
+ if ( ! class_exists( 'RTAWSS3_Class' ) && ! class_exists( 'AS3CF_Utils' ) ) {
453
+ /* for WordPress backward compatibility */
454
+ if ( function_exists( 'wp_get_upload_dir' ) ) {
455
+ $uploads = wp_get_upload_dir();
456
+ } else {
457
+ $uploads = wp_upload_dir();
458
+ }
459
+
460
+ $baseurl = $uploads['baseurl'];
461
+ $search = '/^(http|https)(.*)([wp\-content])(\/)(uploads\/)/i';
462
+ $replace = $baseurl . '/';
463
+ $thumbnail_url = preg_replace( $search, $replace, $thumbnail_id );
464
+
465
+ if ( ! empty( $thumbnail_url ) ) {
466
+ $thumbnail_id = $thumbnail_url;
467
+ }
468
+ }
469
+
470
+ /**
471
+ * Apply filter to get amazon s3 URL
472
+ */
473
+ $final_file_url = apply_filters( 'transcoded_file_url', $thumbnail_id, $media_id );
474
+
475
+ return $final_file_url;
476
+
477
+ }
478
+
479
+ add_filter( 'show_custom_album_cover', 'rtt_restore_og_wp_image_url', 100, 3 );
app/main/controllers/template/{rt-template-functions.php → rtmedia-functions.php} RENAMED
@@ -3,49 +3,60 @@
3
  /**
4
  * Checks at any point of time any media is left to be processed in the db pool
5
  *
6
- * @global type $rtmedia_query
7
- * @return type
 
8
  */
9
  function have_rtmedia() {
 
10
  global $rtmedia_query;
11
 
12
  return $rtmedia_query->have_media();
 
13
  }
14
 
15
  /**
16
- * Rewinds the db pool of media album and resets it to begining
 
 
17
  *
18
- * @global type $rtmedia_query
19
- * @return type
20
  */
21
  function rewind_rtmedia() {
22
 
23
  global $rtmedia_query;
24
 
25
  return $rtmedia_query->rewind_media();
 
26
  }
27
 
28
  /**
29
  * moves ahead in the loop of media within the album
30
  *
31
- * @global type $rtmedia_query
32
- * @return type
 
33
  */
34
  function rtmedia() {
 
35
  global $rtmedia_query;
36
 
37
  return $rtmedia_query->rtmedia();
 
38
  }
39
 
40
  /**
41
  * echo the title of the media
42
  *
43
- * @global type $rtmedia_media
44
- * @return string
 
 
45
  */
46
  function rtmedia_title() {
47
 
48
  global $rtmedia_backbone;
 
49
  if ( $rtmedia_backbone['backbone'] ) {
50
  echo '<%= media_title %>';
51
  } else {
@@ -53,16 +64,20 @@ function rtmedia_title() {
53
 
54
  return stripslashes( esc_html( $rtmedia_media->media_title ) );
55
  }
 
56
  }
57
 
58
  /**
59
  * echo the album name of the media
60
  *
61
- * @global type $rtmedia_media
62
- * @return bool/string
 
63
  */
64
  function rtmedia_album_name() {
 
65
  global $rtmedia_media;
 
66
  if ( $rtmedia_media->album_id ) {
67
  if ( 'album' === rtmedia_type( $rtmedia_media->album_id ) ) {
68
  return get_rtmedia_title( $rtmedia_media->album_id );
@@ -72,39 +87,80 @@ function rtmedia_album_name() {
72
  } else {
73
  return false;
74
  }
 
75
  }
76
 
 
 
 
 
 
 
 
 
77
  function get_rtmedia_gallery_title() {
 
78
  global $rtmedia_query, $rtmedia;
 
79
  $title = false;
 
80
  if ( isset( $rtmedia_query->query['media_type'] ) && 'album' === $rtmedia_query->query['media_type'] && isset( $rtmedia_query->media_query['album_id'] ) && '' !== $rtmedia_query->media_query['album_id'] ) {
81
  $id = $rtmedia_query->media_query['album_id'];
82
  $title = get_rtmedia_title( $id );
83
  } elseif ( isset( $rtmedia_query->media_query['media_type'] ) && ! is_array( $rtmedia_query->media_query['media_type'] ) && '' !== $rtmedia_query->media_query['media_type'] ) {
84
  $current_media_type = $rtmedia_query->media_query['media_type'];
 
85
  if ( ! empty( $current_media_type ) && is_array( $rtmedia->allowed_types ) && isset( $rtmedia->allowed_types[ $current_media_type ] ) && is_array( $rtmedia->allowed_types[ $current_media_type ] ) && isset( $rtmedia->allowed_types[ $current_media_type ]['plural_label'] ) ) {
86
  $title = sprintf( '%s %s', esc_html__( 'All', 'buddypress-media' ), $rtmedia->allowed_types[ $current_media_type ]['plural_label'] );
87
  }
88
  }
 
89
  $title = apply_filters( 'rtmedia_gallery_title', $title );
90
 
91
  return $title;
 
92
  }
93
 
 
 
 
 
 
 
 
94
  function get_rtmedia_title( $id ) {
 
95
  $rtmedia_model = new RTMediaModel();
96
- $title = $rtmedia_model->get( array( 'id' => $id ) );
 
 
97
 
98
  return $title[0]->media_title;
 
99
  }
100
 
 
 
 
 
 
 
 
 
 
 
 
 
101
  function rtmedia_author_profile_pic( $show_link = true, $echo = true, $author_id = false ) {
 
102
  global $rtmedia_backbone;
 
103
  if ( $rtmedia_backbone['backbone'] ) {
104
  echo '';
105
  } else {
106
  if ( empty( $author_id ) ) {
107
  global $rtmedia_media;
 
108
  $author_id = $rtmedia_media->media_author;
109
  }
110
 
@@ -114,14 +170,16 @@ function rtmedia_author_profile_pic( $show_link = true, $echo = true, $author_id
114
  if ( $show_link ) {
115
  $profile_pic .= "<a href='" . esc_url( get_rtmedia_user_link( $author_id ) ) . "' title='" . esc_attr( rtmedia_get_author_name( $author_id ) ) . "'>";
116
  }
 
117
  $size = apply_filters( 'rtmedia_single_media_profile_picture_size', 90 );
 
118
  if ( function_exists( 'bp_get_user_has_avatar' ) ) {
119
  if ( bp_core_fetch_avatar( array(
120
  'item_id' => $author_id,
121
  'object' => 'user',
122
  'no_grav' => false,
123
  'html' => false,
124
- ) ) !== bp_core_avatar_default()
125
  ) {
126
  $profile_pic .= bp_core_fetch_avatar( array(
127
  'item_id' => $author_id,
@@ -132,11 +190,12 @@ function rtmedia_author_profile_pic( $show_link = true, $echo = true, $author_id
132
  'height' => $size,
133
  ) );
134
  } else {
135
- $profile_pic .= "<img src='" . esc_url( bp_core_avatar_default() ) . "' width='" . esc_attr( $size ) . "' height='" . esc_attr( $size ) . "'/>";
136
  }
137
  } else {
138
  $profile_pic .= get_avatar( $author_id, $size );
139
  }
 
140
  if ( $show_link ) {
141
  $profile_pic .= '</a>';
142
  }
@@ -147,40 +206,72 @@ function rtmedia_author_profile_pic( $show_link = true, $echo = true, $author_id
147
  return $profile_pic;
148
  }
149
  }
 
150
  }
151
 
 
 
 
 
 
 
 
 
152
  function rtmedia_author_name( $show_link = true ) {
153
 
154
  global $rtmedia_backbone;
 
155
  if ( $rtmedia_backbone['backbone'] ) {
156
  echo apply_filters( 'rtmedia_media_author_backbone', '', $show_link ); // @codingStandardsIgnoreLine
157
  } else {
158
  global $rtmedia_media;
 
159
  $show_link = apply_filters( 'rtmedia_single_media_show_profile_name_link', $show_link );
 
160
  if ( $show_link ) {
161
  echo "<a href='" . esc_url( get_rtmedia_user_link( $rtmedia_media->media_author ) ) . "' title='" . esc_attr( rtmedia_get_author_name( $rtmedia_media->media_author ) ) . "'>";
162
  }
 
163
  echo esc_html( rtmedia_get_author_name( $rtmedia_media->media_author ) );
 
164
  if ( $show_link ) {
165
  echo '</a>';
166
  }
167
  }
 
168
  }
169
 
 
 
 
 
 
 
 
170
  function rtmedia_get_author_name( $user_id ) {
171
  if ( function_exists( 'bp_core_get_user_displayname' ) ) {
172
  return bp_core_get_user_displayname( $user_id );
173
  } else {
174
  $user = get_userdata( $user_id );
 
175
  if ( $user ) {
176
  return $user->display_name;
177
  }
178
  }
 
179
  }
180
 
 
 
 
 
 
181
  function rtmedia_media_gallery_class() {
 
182
  global $rtmedia_query;
 
183
  $classes = '';
 
184
  if ( isset( $rtmedia_query->media_query ) && isset( $rtmedia_query->media_query['context_id'] ) ) {
185
  $classes = 'context-id-' . esc_attr( $rtmedia_query->media_query['context_id'] );
186
  }
@@ -188,7 +279,18 @@ function rtmedia_media_gallery_class() {
188
  echo esc_attr( apply_filters( 'rtmedia_gallery_class_filter', $classes ) );
189
  }
190
 
 
 
 
 
 
 
 
 
 
 
191
  function rtmedia_id( $media_id = false ) {
 
192
  global $rtmedia_backbone;
193
 
194
  if ( $rtmedia_backbone['backbone'] ) {
@@ -197,7 +299,10 @@ function rtmedia_id( $media_id = false ) {
197
 
198
  if ( $media_id ) {
199
  $model = new RTMediaModel();
200
- $media = $model->get_media( array( 'media_id' => $media_id ), 0, 1 );
 
 
 
201
  if ( isset( $media ) && count( $media ) > 0 ) {
202
  return $media[0]->id;
203
  }
@@ -208,12 +313,25 @@ function rtmedia_id( $media_id = false ) {
208
 
209
  return $rtmedia_media->id;
210
  }
 
211
  }
212
 
 
 
 
 
 
 
 
 
 
213
  function rtmedia_media_id( $id = false ) {
 
214
  if ( $id ) {
215
  $model = new RTMediaModel();
216
- $media = $model->get_media( array( 'id' => $id ), 0, 1 );
 
 
217
 
218
  return $media[0]->media_id;
219
  } else {
@@ -221,12 +339,26 @@ function rtmedia_media_id( $id = false ) {
221
 
222
  return $rtmedia_media->media_id;
223
  }
 
224
  }
225
 
 
 
 
 
 
 
 
 
 
226
  function rtmedia_media_ext( $id = false ) {
 
227
  if ( $id ) {
228
  $model = new RTMediaModel();
229
- $media = $model->get_media( array( 'id' => $id ), 0, 1 );
 
 
 
230
  if ( isset( $media[0] ) ) {
231
  $filepath = get_attached_file( $media[0]->media_id );
232
  $filetype = wp_check_filetype( $filepath );
@@ -241,12 +373,25 @@ function rtmedia_media_ext( $id = false ) {
241
 
242
  return $filetype['ext'];
243
  }
 
244
  }
245
 
 
 
 
 
 
 
 
 
 
246
  function rtmedia_activity_id( $id = false ) {
 
247
  if ( $id ) {
248
  $model = new RTMediaModel();
249
- $media = $model->get_media( array( 'id' => $id ), 0, 1 );
 
 
250
 
251
  return $media[0]->activity_id;
252
  } else {
@@ -254,12 +399,26 @@ function rtmedia_activity_id( $id = false ) {
254
 
255
  return $rtmedia_media->activity_id;
256
  }
 
257
  }
258
 
 
 
 
 
 
 
 
 
 
259
  function rtmedia_type( $id = false ) {
 
260
  if ( $id ) {
261
  $model = new RTMediaModel();
262
- $media = $model->get_media( array( 'id' => $id ), 0, 1 );
 
 
 
263
  if ( isset( $media[0] ) && isset( $media[0]->media_type ) ) {
264
  return $media[0]->media_type;
265
  } else {
@@ -270,12 +429,25 @@ function rtmedia_type( $id = false ) {
270
 
271
  return $rtmedia_media->media_type;
272
  }
 
273
  }
274
 
 
 
 
 
 
 
 
 
 
275
  function rtmedia_cover_art( $id = false ) {
 
276
  if ( $id ) {
277
  $model = new RTMediaModel();
278
- $media = $model->get_media( array( 'id' => $id ), 0, 1 );
 
 
279
 
280
  return $media[0]->cover_art;
281
  } else {
@@ -283,12 +455,15 @@ function rtmedia_cover_art( $id = false ) {
283
 
284
  return $rtmedia_media->cover_art;
285
  }
 
286
  }
287
 
288
  /**
289
  * echo parmalink of the media
290
  *
291
- * @global type $rtmedia_media
 
 
292
  */
293
  function rtmedia_permalink( $media_id = false ) {
294
 
@@ -299,21 +474,40 @@ function rtmedia_permalink( $media_id = false ) {
299
  } else {
300
  echo esc_url( get_rtmedia_permalink( rtmedia_id( $media_id ) ) );
301
  }
 
302
  }
303
 
304
  /**
305
  * echo parmalink of the album
306
  *
307
- * @global type $rtmedia_media
308
  */
309
  function rtmedia_album_permalink() {
 
310
  global $rtmedia_media;
 
311
  echo esc_url( get_rtmedia_permalink( $rtmedia_media->album_id ) );
 
312
  }
313
 
 
 
 
 
 
 
 
 
 
 
 
 
314
  function rtmedia_media( $size_flag = true, $echo = true, $media_size = 'rt_media_single_image' ) {
 
315
  $size_flag = true;
 
316
  global $rtmedia_media, $rtmedia;
 
317
  if ( isset( $rtmedia_media->media_type ) ) {
318
  if ( 'photo' === $rtmedia_media->media_type ) {
319
  $src = wp_get_attachment_image_src( $rtmedia_media->media_id, $media_size );
@@ -323,15 +517,17 @@ function rtmedia_media( $size_flag = true, $echo = true, $media_size = 'rt_media
323
  $height = ( $height * 75 ) / 640;
324
  $size = ' width="' . esc_attr( $rtmedia->options['defaultSizes_video_singlePlayer_width'] ) . '" height="' . esc_attr( $height ) . '%" ';
325
  $html = "<div id='rtm-mejs-video-container' style='width:" . esc_attr( $rtmedia->options['defaultSizes_video_singlePlayer_width'] ) . 'px;height:' . esc_attr( $height ) . "%; max-width:96%;max-height:80%;'>";
326
- $html .= '<video poster="" src="' . esc_url( wp_get_attachment_url( $rtmedia_media->media_id ) ) . '" ' . esc_attr( $size ) . ' type="video/mp4" class="wp-video-shortcode" id="bp_media_video_' . esc_attr( $rtmedia_media->id ) . '" controls="controls" preload="true"></video>';
327
- $html .= '</div>';
328
  } elseif ( 'music' === $rtmedia_media->media_type ) {
329
  $width = $rtmedia->options['defaultSizes_music_singlePlayer_width'];
330
  $width = ( $width * 75 ) / 640;
331
  $size = ' width= ' . esc_attr( $width ) . '% height=30 ';
 
332
  if ( ! $size_flag ) {
333
  $size = '';
334
  }
 
335
  $html = '<audio src="' . esc_url( wp_get_attachment_url( $rtmedia_media->media_id ) ) . '" ' . esc_attr( $size ) . ' type="audio/mp3" class="wp-audio-shortcode" id="bp_media_audio_' . esc_attr( $rtmedia_media->id ) . '" controls="controls" preload="none"></audio>';
336
  } else {
337
  $html = false;
@@ -349,13 +545,24 @@ function rtmedia_media( $size_flag = true, $echo = true, $media_size = 'rt_media
349
  } else {
350
  return $html;
351
  }
 
352
  }
353
 
354
- /*
355
- * echo http url of the media
 
 
 
 
 
 
 
 
 
 
356
  */
357
-
358
  function rtmedia_image( $size = 'rt_media_thumbnail', $id = false, $recho = true ) {
 
359
  global $rtmedia_backbone;
360
 
361
  if ( $rtmedia_backbone['backbone'] ) {
@@ -366,7 +573,10 @@ function rtmedia_image( $size = 'rt_media_thumbnail', $id = false, $recho = true
366
 
367
  if ( $id ) {
368
  $model = new RTMediaModel();
369
- $media = $model->get_media( array( 'id' => $id ), false, false );
 
 
 
370
  if ( isset( $media[0] ) ) {
371
  $media_object = $media[0];
372
  } else {
@@ -374,39 +584,40 @@ function rtmedia_image( $size = 'rt_media_thumbnail', $id = false, $recho = true
374
  }
375
  } else {
376
  global $rtmedia_media;
 
377
  $media_object = $rtmedia_media;
378
  }
379
 
380
  $thumbnail_id = 0;
 
381
  if ( isset( $media_object->media_type ) ) {
382
  if ( 'album' === $media_object->media_type || 'photo' !== $media_object->media_type || 'video' === $media_object->media_type ) {
383
  $thumbnail_id = ( isset( $media_object->cover_art )
384
- && (
385
- ( false !== filter_var( $media_object->cover_art, FILTER_VALIDATE_URL ) ) // Cover art might be an absolute URL
386
- ||
387
- ( 0 !== intval( $media_object->cover_art ) ) // Cover art might be a media ID
388
- )
389
- ) ? $media_object->cover_art : false;
390
  $thumbnail_id = apply_filters( 'show_custom_album_cover', $thumbnail_id, $media_object->media_type, $media_object->id ); // for rtMedia pro users
391
  } elseif ( 'photo' === $media_object->media_type ) {
392
  $thumbnail_id = $media_object->media_id;
393
  } else {
394
  $thumbnail_id = false;
395
  }
 
396
  if ( 'music' === $media_object->media_type && empty( $thumbnail_id ) ) {
397
  $thumbnail_id = rtm_get_music_cover_art( $media_object );
398
  }
399
- if ( 'music' === $media_object->media_type && - 1 === intval( $thumbnail_id ) ) {
 
400
  $thumbnail_id = false;
401
  }
402
- } else {
403
- $src = false;
404
  }
405
 
406
  if ( ! $thumbnail_id ) {
407
  global $rtmedia;
 
408
  // Getting the extension of the uploaded file
409
  $extension = rtmedia_get_extension();
 
410
  // Checking if custom thumbnail for this file extension is set or not
411
  if ( isset( $rtmedia->allowed_types[ $media_object->media_type ] ) && isset( $rtmedia->allowed_types[ $media_object->media_type ]['ext_thumb'] ) && isset( $rtmedia->allowed_types[ $media_object->media_type ]['ext_thumb'][ $extension ] ) ) {
412
  $src = $rtmedia->allowed_types[ $media_object->media_type ]['ext_thumb'][ $extension ];
@@ -426,25 +637,41 @@ function rtmedia_image( $size = 'rt_media_thumbnail', $id = false, $recho = true
426
  }
427
 
428
  $src = apply_filters( 'rtmedia_media_thumb', $src, $media_object->id, $media_object->media_type );
 
429
  if ( true === $recho ) {
430
  echo esc_url( $src );
431
  } else {
432
  return $src;
433
  }
 
434
  }
435
 
 
 
 
 
 
 
 
 
 
 
436
  function rtmedia_image_alt( $id = false, $echo = true ) {
437
- global $rtmedia_media;
438
- $model = new RTMediaModel();
439
  if ( $id ) {
440
  $model = new RTMediaModel();
441
- $media = $model->get_media( array( 'id' => $id ), false, false );
 
 
 
442
  if ( isset( $media[0] ) ) {
443
  $media_object = $media[0];
444
  } else {
445
  return false;
446
  }
 
447
  $post_object = get_post( $media_object->media_id );
 
448
  if ( isset( $post_object->post_name ) ) {
449
  $img_alt = $post_object->post_name;
450
  } else {
@@ -452,27 +679,44 @@ function rtmedia_image_alt( $id = false, $echo = true ) {
452
  }
453
  } else {
454
  global $rtmedia_media;
455
- $media_object = $rtmedia_media;
456
- if ( isset( $media_object->post_name ) ) {
457
- $img_alt = $media_object->post_name;
458
  } else {
459
  $img_alt = ' ';
460
  }
461
  }
 
462
  if ( $echo ) {
463
  echo esc_attr( $img_alt );
464
  } else {
465
  return $img_alt;
466
  }
 
467
  }
468
 
 
 
 
 
 
 
 
 
 
 
 
 
469
  function rtmedia_album_image( $size = 'thumbnail', $id = false ) {
470
- global $rtmedia_media;
471
- $model = new RTMediaModel();
 
472
  if ( false === $id ) {
473
  $id = $rtmedia_media->id;
474
  }
475
- global $rtmedia_query;
 
 
476
  if ( isset( $rtmedia_query->query['context_id'] ) && isset( $rtmedia_query->query['context'] ) && 'group' !== $rtmedia_query->query['context'] ) {
477
  if ( 'profile' === $rtmedia_query->query['context'] ) {
478
  $media = $model->get_media( array(
@@ -497,7 +741,10 @@ function rtmedia_album_image( $size = 'thumbnail', $id = false ) {
497
  'context_id' => $rtmedia_query->query['context_id'],
498
  ), 0, 1 );
499
  } else {
500
- $media = $model->get_media( array( 'album_id' => $id, 'media_type' => 'photo' ), 0, 1 );
 
 
 
501
  }
502
  }
503
 
@@ -505,15 +752,28 @@ function rtmedia_album_image( $size = 'thumbnail', $id = false ) {
505
  $src = rtmedia_image( $size, $media[0]->id, false );
506
  } else {
507
  global $rtmedia;
 
508
  $src = $rtmedia->allowed_types['photo']['thumbnail'];
509
  }
510
 
511
  return $src;
 
512
  }
513
 
 
 
 
 
 
 
 
 
 
 
514
  function rtmedia_duration( $id = false ) {
515
 
516
  global $rtmedia_backbone;
 
517
  if ( $rtmedia_backbone['backbone'] ) {
518
  echo '<%= duration %>';
519
 
@@ -522,7 +782,10 @@ function rtmedia_duration( $id = false ) {
522
 
523
  if ( $id ) {
524
  $model = new RTMediaModel();
525
- $media = $model->get_media( array( 'id' => $id ), false, false );
 
 
 
526
  if ( isset( $media[0] ) ) {
527
  $media_object = $media[0];
528
  } else {
@@ -530,28 +793,43 @@ function rtmedia_duration( $id = false ) {
530
  }
531
  } else {
532
  global $rtmedia_media;
 
533
  $media_object = $rtmedia_media;
534
  }
535
 
536
  $duration = '';
 
537
  if ( ( 'video' === $media_object->media_type ) || ( 'music' === $media_object->media_type ) ) {
538
  $media_time = get_rtmedia_meta( $media_object->id, 'duration_time' );
 
539
  if ( false === $media_time || empty( $media_time ) ) {
540
  $filepath = get_attached_file( $media_object->media_id );
541
  $media_tags = new RTMediaTags( $filepath );
542
  $duration = $media_tags->duration;
 
543
  add_rtmedia_meta( $media_object->id, 'duration_time', $duration );
544
  } else {
545
  $duration = $media_time;
546
  }
 
547
  $duration = str_replace( '-:--', '', $duration );
548
  $duration = '<span class="rtmedia_time" >' . esc_attr( $duration ) . '</span>';
549
  }
550
 
551
  return $duration;
 
552
  }
553
 
 
 
 
 
 
 
 
 
554
  function rtmedia_sanitize_object( $data, $exceptions = array() ) {
 
555
  foreach ( $data as $key => $value ) {
556
  if ( ! in_array( $key, array_merge( RTMediaMedia::$default_object, $exceptions ), true ) ) {
557
  unset( $data[ $key ] );
@@ -559,9 +837,18 @@ function rtmedia_sanitize_object( $data, $exceptions = array() ) {
559
  }
560
 
561
  return $data;
 
562
  }
563
 
 
 
 
 
 
 
 
564
  function rtmedia_delete_allowed() {
 
565
  global $rtmedia_media;
566
 
567
  $flag = intval( $rtmedia_media->media_author ) === get_current_user_id();
@@ -577,8 +864,16 @@ function rtmedia_delete_allowed() {
577
  $flag = apply_filters( 'rtmedia_media_delete_priv', $flag );
578
 
579
  return $flag;
 
580
  }
581
 
 
 
 
 
 
 
 
582
  function rtmedia_edit_allowed() {
583
 
584
  global $rtmedia_media;
@@ -592,21 +887,36 @@ function rtmedia_edit_allowed() {
592
  $flag = apply_filters( 'rtmedia_media_edit_priv', $flag );
593
 
594
  return $flag;
 
595
  }
596
 
 
 
 
 
 
 
 
597
  function rtmedia_request_action() {
 
598
  global $rtmedia_query;
599
 
600
  return $rtmedia_query->action_query->action;
 
601
  }
602
 
 
 
 
 
 
603
  function rtmedia_title_input() {
 
604
  global $rtmedia_media;
605
 
606
  $name = 'media_title';
607
  $value = stripslashes( esc_html( $rtmedia_media->media_title ) );
608
-
609
- $html = '';
610
 
611
  if ( 'edit' === rtmedia_request_action() ) {
612
  $html .= '<input type="text" class="rtmedia-title-editor" name="' . esc_attr( $name ) . '" id="' . esc_attr( $name ) . '" value="' . esc_attr( $value ) . '">';
@@ -617,12 +927,25 @@ function rtmedia_title_input() {
617
  $html .= '';
618
 
619
  echo $html; // @codingStandardsIgnoreLine
 
620
  }
621
 
 
 
 
 
 
 
 
 
 
 
622
  function rtmedia_description_input( $editor = true, $echo = false ) {
 
623
  global $rtmedia_media;
624
 
625
  $name = 'description';
 
626
  if ( isset( $rtmedia_media->post_content ) ) {
627
  $value = $rtmedia_media->post_content;
628
  } else {
@@ -631,6 +954,7 @@ function rtmedia_description_input( $editor = true, $echo = false ) {
631
  }
632
 
633
  $html = '';
 
634
  if ( $editor ) {
635
  if ( 'edit' === rtmedia_request_action() ) {
636
  ob_start();
@@ -639,6 +963,7 @@ function rtmedia_description_input( $editor = true, $echo = false ) {
639
  'textarea_rows' => 2,
640
  'quicktags' => false,
641
  ) );
 
642
  $html .= ob_get_clean();
643
  } else {
644
  $html .= '<div name="' . esc_attr( $name ) . '" id="' . esc_attr( $name ) . '">' . wp_kses_post( $value ) . '</div>';
@@ -646,179 +971,177 @@ function rtmedia_description_input( $editor = true, $echo = false ) {
646
  } else {
647
  $html .= "<textarea name='" . esc_attr( $name ) . "' id='" . esc_attr( $name ) . "' class='rtmedia-desc-textarea'>" . esc_textarea( $value ) . '</textarea>';
648
  }
 
649
  $html .= '';
 
650
  if ( $echo ) {
651
  echo $html; // @codingStandardsIgnoreLine
652
  } else {
653
  return $html;
654
  }
 
655
  }
656
 
657
  /**
658
  * echo media description
659
  *
660
- * @param bool $echo
661
  *
662
- * @return string /void
663
- * @global type $rtmedia_media
664
  */
665
  function rtmedia_description( $echo = true ) {
 
666
  if ( $echo ) {
667
  // escape description for any html tags and reformat using `wpautop`
668
  echo rtmedia_get_media_description();
669
  } else {
670
  return rtmedia_get_media_description();
671
  }
 
672
  }
673
 
674
- /*
675
- * return media description
 
 
 
 
 
 
676
  */
677
  function rtmedia_get_media_description( $id = false ) {
 
678
  if ( $id ) {
679
  $media_post_id = rtmedia_media_id( $id );
680
  } else {
681
  global $rtmedia_media;
 
682
  $media_post_id = $rtmedia_media->media_id;
683
  }
684
 
685
  /**
686
  * This function will mostly be used in single media page.
687
  * We are showing single media page using `the_content` filter and uses dummy post.
688
- * If we use `the_content` filter again than media description won't work as this is already singe media request
689
- * and hence using `wpautop` instead.
690
  */
691
  return wpautop( get_post_field( 'post_content', $media_post_id ) );
 
692
  }
693
 
694
  /**
695
- * returns total media count in the album
 
 
696
  *
697
- * @global type $rtmedia_query
698
- * @return type
699
  */
700
  function rtmedia_count() {
 
701
  global $rtmedia_query;
702
 
703
  return $rtmedia_query->media_count;
 
704
  }
705
 
706
  /**
707
- * returns the page offset for the media pool
708
  *
709
- * @global type $rtmedia_query
710
- * @return type
 
711
  */
712
  function rtmedia_offset() {
 
713
  global $rtmedia_query;
714
 
715
  return ( $rtmedia_query->action_query->page - 1 ) * $rtmedia_query->action_query->per_page_media;
 
716
  }
717
 
718
  /**
719
- * returns number of media per page to be displayed
 
 
720
  *
721
- * @global type $rtmedia_query
722
- * @return type
723
  */
724
  function rtmedia_per_page_media() {
 
725
  global $rtmedia_query;
726
 
727
  return $rtmedia_query->action_query->per_page_media;
 
728
  }
729
 
730
  /**
731
- * returns the page number of media album in the pagination
732
  *
733
- * @global type $rtmedia_query
734
- * @return type
 
735
  */
736
  function rtmedia_page() {
 
737
  global $rtmedia_query;
738
 
739
  return $rtmedia_query->action_query->page;
 
740
  }
741
 
742
  /**
743
- * returns the current media number in the album pool
 
 
744
  *
745
- * @global type $rtmedia_query
746
- * @return type
747
  */
748
  function rtmedia_current_media() {
 
749
  global $rtmedia_query;
750
 
751
  return $rtmedia_query->current_media;
752
- }
753
 
754
- //rtmedia media_author actions
755
- add_action( 'after_rtmedia_action_buttons', 'rtmedia_author_actions' );
756
-
757
- function rtmedia_author_actions() {
758
-
759
- $options_start = $options_end = $option_buttons = $output = '';
760
- $options = array();
761
- $options = apply_filters( 'rtmedia_author_media_options', $options );
762
-
763
- if ( ! empty( $options ) ) {
764
-
765
- $options_start = '<div class="click-nav rtm-media-options-list" id="rtm-media-options-list">
766
- <div class="no-js">
767
- <button class="clicker rtmedia-media-options rtmedia-action-buttons button">' . esc_html__( 'Options', 'buddypress-media' ) . '</button>
768
- <ul class="rtm-options">';
769
- foreach ( $options as $action ) {
770
- if ( ! empty( $action ) ) {
771
- $option_buttons .= '<li>' . $action . '</li>';
772
- }
773
- }
774
-
775
- $options_end = '</ul></div></div>';
776
-
777
- if ( ! empty( $option_buttons ) ) {
778
- $output = $options_start . $option_buttons . $options_end;
779
- }
780
-
781
- if ( ! empty( $output ) ) {
782
- echo $output; // @codingStandardsIgnoreLine
783
- }
784
- }
785
- }
786
 
 
 
 
 
 
787
  function rtmedia_edit_form() {
788
 
789
  if ( is_user_logged_in() && rtmedia_edit_allowed() ) {
790
-
791
  $edit_button = '<button type="submit" class="rtmedia-edit rtmedia-action-buttons" >' . esc_html__( 'Edit', 'buddypress-media' ) . '</button>';
792
-
793
  $edit_button = apply_filters( 'rtmedia_edit_button_filter', $edit_button );
794
-
795
- $button = '<form action="' . esc_url( get_rtmedia_permalink( rtmedia_id() ) ) . 'edit/">' . $edit_button . '</form>';
796
 
797
  return $button;
798
  }
799
 
800
  return false;
 
801
  }
802
 
803
  /**
804
- *
805
  */
806
  function rtmedia_actions() {
807
 
808
  $actions = array();
809
 
810
  if ( is_user_logged_in() && rtmedia_edit_allowed() ) {
811
-
812
  $edit_button = '<button type="submit" class="rtmedia-edit rtmedia-action-buttons button" >' . esc_html__( 'Edit', 'buddypress-media' ) . '</button>';
813
-
814
  $edit_button = apply_filters( 'rtmedia_edit_button_filter', $edit_button );
815
-
816
- $actions[] = '<form action="' . esc_url( get_rtmedia_permalink( rtmedia_id() ) ) . 'edit/">' . $edit_button . '</form>';
817
  }
 
818
  $actions = apply_filters( 'rtmedia_action_buttons_before_delete', $actions );
 
819
  foreach ( $actions as $action ) {
820
  echo $action; // @codingStandardsIgnoreLine
821
  }
 
822
  $actions = array();
823
 
824
  if ( rtmedia_delete_allowed() ) {
@@ -830,21 +1153,31 @@ function rtmedia_actions() {
830
  foreach ( $actions as $action ) {
831
  echo $action; // @codingStandardsIgnoreLine
832
  }
 
833
  do_action( 'after_rtmedia_action_buttons' );
 
834
  }
835
 
836
  /**
837
- * rendering comments section
 
 
 
 
 
 
838
  */
839
  function rtmedia_comments( $echo = true ) {
840
 
841
- $html = '<ul id="rtmedia_comment_ul" class="rtm-comment-list" data-action="' . esc_url( get_rtmedia_permalink( rtmedia_id() ) ) . 'delete-comment/">';
842
-
843
- global $wpdb, $rtmedia_media;
844
-
845
- $comments = get_comments( array( 'post_id' => $rtmedia_media->media_id, 'order' => 'ASC' ) );
846
 
 
 
 
 
 
847
  $comment_list = '';
 
848
  foreach ( $comments as $comment ) {
849
  $comment_list .= rmedia_single_comment( (array) $comment );
850
  }
@@ -862,12 +1195,26 @@ function rtmedia_comments( $echo = true ) {
862
  } else {
863
  return $html;
864
  }
 
865
  }
866
 
 
 
 
 
 
 
 
 
 
 
867
  function rmedia_single_comment( $comment ) {
868
- global $allowedtags;
 
 
869
  $html = '';
870
  $html .= '<li class="rtmedia-comment">';
 
871
  if ( $comment['user_id'] ) {
872
  $user_link = "<a href='" . esc_url( get_rtmedia_user_link( $comment['user_id'] ) ) . "' title='" . esc_attr( rtmedia_get_author_name( $comment['user_id'] ) ) . "'>" . esc_html( rtmedia_get_author_name( $comment['user_id'] ) ) . '</a>';
873
  $user_name = apply_filters( 'rtmedia_comment_author_name', $user_link, $comment );
@@ -876,17 +1223,19 @@ function rmedia_single_comment( $comment ) {
876
  $user_name = 'Annonymous';
877
  $profile_pic = '';
878
  }
 
879
  if ( ! empty( $profile_pic ) ) {
880
  $html .= "<div class='rtmedia-comment-user-pic cleafix'>" . $profile_pic . '</div>';
881
  }
 
882
  $html .= "<div class='rtm-comment-wrap'><div class='rtmedia-comment-details'>";
883
- $html .= '<span class ="rtmedia-comment-author">' . '' . $user_name . '</span>';
884
  $html .= '<span class ="rtmedia-comment-date"> ' . apply_filters( 'rtmedia_comment_date_format', rtmedia_convert_date( $comment['comment_date_gmt'] ), $comment ) . '</span>';
885
 
886
  $comment_string = wp_kses( $comment['comment_content'], $allowedtags );
 
887
  $html .= '<div class="rtmedia-comment-content">' . wpautop( make_clickable( apply_filters( 'bp_get_activity_content', $comment_string ) ) ) . '</div>';
888
 
889
- global $rtmedia_media;
890
  if ( is_rt_admin() || ( isset( $comment['user_id'] ) && ( get_current_user_id() === intval( $comment['user_id'] ) || intval( $rtmedia_media->media_author ) === get_current_user_id() ) ) || apply_filters( 'rtmedia_allow_comment_delete', false ) ) { // show delete button for comment author and admins
891
  $html .= '<i data-id="' . esc_attr( $comment['comment_ID'] ) . '" class = "rtmedia-delete-comment dashicons dashicons-no-alt rtmicon" title="' . esc_attr__( 'Delete Comment', 'buddypress-media' ) . '"></i>';
892
  }
@@ -894,27 +1243,51 @@ function rmedia_single_comment( $comment ) {
894
  $html .= '<div class="clear"></div></div></div></li>';
895
 
896
  return apply_filters( 'rtmedia_single_comment', $html, $comment );
 
897
  }
898
 
 
 
 
 
 
 
 
 
 
 
899
  function rtmedia_get_media_comment_count( $media_id = false ) {
 
900
  global $wpdb, $rtmedia_media;
 
901
  if ( ! $media_id ) {
902
  $post_id = $rtmedia_media->media_id;
903
  } else {
904
  $post_id = rtmedia_media_id( $media_id );
905
  }
 
906
  $query = $wpdb->prepare( "SELECT count(*) FROM $wpdb->comments WHERE comment_post_ID = %d", $post_id );
907
  $comment_count = $wpdb->get_results( $query, ARRAY_N ); // @codingStandardsIgnoreLine
 
908
  if ( is_array( $comment_count ) && is_array( $comment_count[0] ) && isset( $comment_count[0][0] ) ) {
909
  return $comment_count[0][0];
910
  } else {
911
  return 0;
912
  }
 
913
  }
914
 
 
 
 
 
 
 
 
 
915
  function rtmedia_pagination_prev_link() {
916
 
917
- global $rtmedia_media, $rtmedia_interaction, $rtmedia_query;
918
 
919
  $page_url = ( ( rtmedia_page() - 1 ) === 1 ) ? '' : 'pg/' . ( rtmedia_page() - 1 );
920
  $site_url = ( is_multisite() ) ? trailingslashit( get_site_url( get_current_blog_id() ) ) : trailingslashit( get_site_url() );
@@ -941,23 +1314,28 @@ function rtmedia_pagination_prev_link() {
941
  $link .= RTMEDIA_MEDIA_SLUG . '/';
942
 
943
  if ( isset( $rtmedia_query->action_query->media_type ) ) {
944
- if ( in_array( $rtmedia_query->action_query->media_type, array(
945
- 'photo',
946
- 'music',
947
- 'video',
948
- 'album',
949
- 'playlist',
950
- ), true ) ) {
951
  $link .= $rtmedia_query->action_query->media_type . '/';
952
  }
953
  }
954
 
955
  return apply_filters( 'rtmedia_pagination_prev_link', $link . $page_url, $link, $page_url );
 
956
  }
957
 
 
 
 
 
 
 
 
 
958
  function rtmedia_pagination_next_link() {
959
 
960
- global $rtmedia_media, $rtmedia_interaction, $rtmedia_query;
961
 
962
  $page_url = 'pg/' . ( rtmedia_page() + 1 );
963
  $site_url = ( is_multisite() ) ? trailingslashit( get_site_url( get_current_blog_id() ) ) : trailingslashit( get_site_url() );
@@ -973,6 +1351,7 @@ function rtmedia_pagination_next_link() {
973
  } else {
974
  $user_id = bp_displayed_user_id();
975
  }
 
976
  $link .= trailingslashit( bp_core_get_user_domain( $user_id ) );
977
  } else {
978
  $link .= $site_url . 'author/' . $author_name . '/';
@@ -991,28 +1370,38 @@ function rtmedia_pagination_next_link() {
991
  $link .= $site_url . $post->post_name . '/';
992
  }
993
  }
 
994
  $link .= RTMEDIA_MEDIA_SLUG . '/';
 
995
  if ( isset( $rtmedia_query->media_query['album_id'] ) && intval( $rtmedia_query->media_query['album_id'] ) > 0 ) {
996
  $link .= $rtmedia_query->media_query['album_id'] . '/';
997
  }
 
998
  if ( isset( $rtmedia_query->action_query->media_type ) ) {
999
- if ( in_array( $rtmedia_query->action_query->media_type, array(
1000
- 'photo',
1001
- 'music',
1002
- 'video',
1003
- 'album',
1004
- 'playlist',
1005
- ), true ) ) {
1006
  $link .= $rtmedia_query->action_query->media_type . '/';
1007
  }
1008
  }
1009
 
1010
  return apply_filters( 'rtmedia_pagination_next_link', $link . $page_url, $link, $page_url );
 
1011
  }
1012
 
 
 
 
 
 
 
 
 
 
 
1013
  function rtmedia_pagination_page_link( $page_no = '' ) {
1014
 
1015
- global $rtmedia_media, $rtmedia_interaction, $rtmedia_query;
1016
 
1017
  $page_url = 'pg/' . $page_no;
1018
  $site_url = ( is_multisite() ) ? trailingslashit( get_site_url( get_current_blog_id() ) ) : trailingslashit( get_site_url() );
@@ -1036,54 +1425,67 @@ function rtmedia_pagination_page_link( $page_no = '' ) {
1036
  $link .= $site_url . $post->post_name . '/';
1037
  }
1038
  }
 
1039
  $link .= RTMEDIA_MEDIA_SLUG . '/';
 
1040
  if ( isset( $rtmedia_query->media_query['album_id'] ) && intval( $rtmedia_query->media_query['album_id'] ) > 0 ) {
1041
  $link .= $rtmedia_query->media_query['album_id'] . '/';
1042
  }
 
1043
  if ( isset( $rtmedia_query->action_query->media_type ) ) {
1044
- if ( in_array( $rtmedia_query->action_query->media_type, array(
1045
- 'photo',
1046
- 'music',
1047
- 'video',
1048
- 'album',
1049
- 'playlist',
1050
- ), true ) ) {
1051
  $link .= $rtmedia_query->action_query->media_type . '/';
1052
  }
1053
  }
1054
 
1055
  return apply_filters( 'rtmedia_pagination_page_link', $link . $page_url, $link, $page_url );
 
1056
  }
1057
 
1058
- // Function for pagination
 
 
 
 
1059
  function rtmedia_media_pagination() {
1060
- global $rtmedia, $rtmedia_backbone;
 
 
1061
  if ( $rtmedia_backbone['backbone'] ) {
1062
  echo '<%= pagination %>';
1063
  } else {
1064
  echo rtmedia_get_pagination_values(); // @codingStandardsIgnoreLine
1065
  }
 
1066
  }
1067
 
 
 
 
 
 
 
 
 
 
1068
  function rtmedia_get_pagination_values() {
1069
- global $rtmedia, $rtmedia_query;
1070
 
1071
- $general_options = $rtmedia->options;
1072
 
1073
- $per_page = $general_options['general_perPageMedia'];
 
1074
 
1075
  if ( isset( $rtmedia_query->query['per_page'] ) ) {
1076
  $per_page = $rtmedia_query->query['per_page'];
1077
  }
1078
- $per_page = intval( $per_page );
1079
-
1080
- $range = 1;
1081
 
 
 
1082
  $showitems = ( $range * 2 ) + 1;
1083
  $rtmedia_media_pages = '';
1084
 
1085
- global $paged;
1086
-
1087
  if ( 0 === intval( rtmedia_offset() ) ) {
1088
  $paged = 1; // @codingStandardsIgnoreLine
1089
  } else if ( intval( rtmedia_offset() ) === $per_page ) {
@@ -1093,14 +1495,15 @@ function rtmedia_get_pagination_values() {
1093
  }
1094
 
1095
  $pages = ceil( rtmedia_count() / $per_page );
 
1096
  if ( ! $pages ) {
1097
  $pages = 1;
1098
  }
 
1099
  $page_base_url = rtmedia_pagination_page_link();
1100
 
1101
  if ( 1 !== intval( $pages ) ) {
1102
  $rtmedia_media_pages .= "<div class='rtm-pagination clearfix'>";
1103
-
1104
  $rtmedia_media_pages .= "<div class='rtmedia-page-no rtm-page-number'>";
1105
  $rtmedia_media_pages .= "<span class='rtm-label'>";
1106
  $rtmedia_media_pages .= esc_html( apply_filters( 'rtmedia_goto_page_label', esc_html__( 'Go to page no : ', 'buddypress-media' ) ) );
@@ -1110,30 +1513,36 @@ function rtmedia_get_pagination_values() {
1110
  $rtmedia_media_pages .= "<input type='number' value='" . esc_attr( $paged ) . "' min='1' max='" . esc_attr( $pages ) . "' class='rtm-go-to-num' id='rtmedia_go_to_num' />";
1111
  $rtmedia_media_pages .= "<a class='rtmedia-page-link button' data-page-type='num' data-page-base-url='" . $page_base_url . "' href='#'>" . esc_html__( 'Go', 'buddypress-media' ) . '</a>';
1112
  $rtmedia_media_pages .= "</div><div class='rtm-paginate'>";
 
1113
  if ( $paged > 1 && $showitems < $pages ) {
1114
  $page_url = ( ( rtmedia_page() - 1 ) == 1 ) ? '' : $page_base_url . ( rtmedia_page() - 1 );
 
1115
  $rtmedia_media_pages .= "<a class='rtmedia-page-link' data-page-type='prev' href='" . esc_url( $page_url ) . "'><i class='dashicons dashicons-arrow-left-alt2'></i></a>";
1116
  }
1117
 
1118
  if ( $paged > 2 && $paged > $range + 1 && $showitems < $pages ) {
1119
  $page_url = $page_base_url . '1';
 
1120
  $rtmedia_media_pages .= "<a class='rtmedia-page-link' data-page-type='page' data-page='1' href='" . esc_url( $page_url ) . "'>1</a><span>...</span>";
1121
  }
1122
 
1123
  for ( $i = 1; $i <= $pages; $i ++ ) {
1124
  if ( 1 != $pages && ( ! ( $i >= $paged + $range + 1 || $i <= $paged - $range - 1 ) || $pages <= $showitems ) ) {
1125
  $page_url = $page_base_url . $i;
 
1126
  $rtmedia_media_pages .= ( $paged == $i ) ? "<span class='current'>" . esc_html( $i ) . '</span>' : "<a class='rtmedia-page-link' data-page-type='page' data-page='" . esc_attr( $i ) . "' href='" . esc_url( $page_url ) . "' class='inactive' >" . esc_html( $i ) . '</a>';
1127
  }
1128
  }
1129
 
1130
  if ( $paged < $pages - 1 && $paged + $range - 1 < $pages && $showitems < $pages ) {
1131
  $page_url = $page_base_url . $pages;
 
1132
  $rtmedia_media_pages .= "<span>...</span><a class='rtmedia-page-link' data-page-type='page' data-page='" . esc_attr( $pages ) . "' href='" . esc_url( $page_url ) . "'>" . esc_html( $pages ) . '</a>';
1133
  }
1134
 
1135
  if ( $paged < $pages && $showitems < $pages ) {
1136
  $page_url = $page_base_url . ( rtmedia_page() + 1 );
 
1137
  $rtmedia_media_pages .= "<a class='rtmedia-page-link' data-page-type='next' href='" . esc_url( $page_url ) . "'><i class='dashicons dashicons-arrow-right-alt2'></i></a>";
1138
  }
1139
 
@@ -1141,90 +1550,145 @@ function rtmedia_get_pagination_values() {
1141
  }
1142
 
1143
  return $rtmedia_media_pages;
 
1144
  }
1145
 
 
 
 
 
 
 
 
1146
  function rtmedia_comments_enabled() {
 
1147
  global $rtmedia;
1148
 
1149
  return $rtmedia->options['general_enableComments'];
 
1150
  }
1151
 
1152
  /**
 
 
 
1153
  *
1154
- * @return boolean
1155
  */
1156
  function is_rtmedia_gallery() {
 
1157
  global $rtmedia_query;
 
1158
  if ( $rtmedia_query ) {
1159
  return $rtmedia_query->is_gallery();
1160
  } else {
1161
  return false;
1162
  }
 
1163
  }
1164
 
1165
  /**
 
 
 
1166
  *
1167
- * @return boolean
1168
  */
1169
  function is_rtmedia_album_gallery() {
 
1170
  global $rtmedia_query;
 
1171
  if ( $rtmedia_query ) {
1172
  return $rtmedia_query->is_album_gallery();
1173
  } else {
1174
  return false;
1175
  }
 
1176
  }
1177
 
1178
  /**
 
 
 
1179
  *
1180
- * @return boolean
1181
  */
1182
  function is_rtmedia_single() {
 
1183
  global $rtmedia_query;
 
1184
  if ( $rtmedia_query ) {
1185
  return $rtmedia_query->is_single();
1186
  } else {
1187
  return false;
1188
  }
 
1189
  }
1190
 
1191
  /**
 
 
 
1192
  *
1193
- * @return boolean
 
 
1194
  */
1195
  function is_rtmedia_album( $album_id = false ) {
 
1196
  if ( $album_id ) {
1197
  $rtmedia_model = new RTMediaModel();
1198
- $media = $rtmedia_model->get( array( 'id' => $album_id ) );
 
 
 
1199
  if ( is_array( $media ) && isset( $media[0] ) && isset( $media[0]->media_type ) && 'album' === $media[0]->media_type ) {
1200
  return true;
1201
  }
1202
 
1203
  return false;
1204
  }
 
1205
  global $rtmedia_query;
 
1206
  if ( $rtmedia_query ) {
1207
  return $rtmedia_query->is_album();
1208
  } else {
1209
  return false;
1210
  }
 
1211
  }
1212
 
 
 
 
 
 
 
 
1213
  function is_rtmedia_group_album() {
 
1214
  global $rtmedia_query;
 
1215
  if ( $rtmedia_query ) {
1216
  return $rtmedia_query->is_group_album();
1217
  } else {
1218
  return false;
1219
  }
 
1220
  }
1221
 
1222
  /**
 
 
 
1223
  *
1224
- * @return boolean
1225
  */
1226
  function is_rtmedia_edit_allowed() {
 
1227
  global $rtmedia_query;
 
1228
  if ( $rtmedia_query ) {
1229
  if ( isset( $rtmedia_query->media_query['media_author'] ) && get_current_user_id() === intval( $rtmedia_query->media_query['media_author'] ) && 'edit' === $rtmedia_query->action_query->action ) {
1230
  return true;
@@ -1234,119 +1698,87 @@ function is_rtmedia_edit_allowed() {
1234
  } else {
1235
  return false;
1236
  }
 
1237
  }
1238
 
 
 
 
 
 
 
 
 
1239
  function update_activity_after_thumb_set( $id ) {
1240
  $model = new RTMediaModel();
1241
  $media_obj = new RTMediaMedia();
1242
- $media = $model->get( array( 'id' => $id ) );
 
 
1243
  $privacy = $media[0]->privacy;
1244
  $activity_id = rtmedia_activity_id( $id );
 
1245
  if ( ! empty( $activity_id ) ) {
1246
- $same_medias = $media_obj->model->get( array( 'activity_id' => $activity_id ) );
 
 
1247
  $update_activity_media = array();
 
1248
  foreach ( $same_medias as $a_media ) {
1249
  $update_activity_media[] = $a_media->id;
1250
  }
 
1251
  $obj_activity = new RTMediaActivity( $update_activity_media, $privacy, false );
 
1252
  global $wpdb, $bp;
 
1253
  $activity_old_content = bp_activity_get_meta( $activity_id, 'bp_old_activity_content' );
1254
- $activity_text = bp_activity_get_meta( $activity_id, 'bp_activity_text' );
1255
  if ( ! empty( $activity_old_content ) ) {
1256
  // get old activity content and save in activity meta
1257
- $activity_get = bp_activity_get_specific( array( 'activity_ids' => $activity_id ) );
 
 
1258
  $activity = $activity_get['activities'][0];
1259
  $activity_body = $activity->content;
 
1260
  bp_activity_update_meta( $activity_id, 'bp_old_activity_content', $activity_body );
 
1261
  //extract activity text from old content
1262
  $activity_text = strip_tags( $activity_body, '<span>' );
1263
  $activity_text = explode( '</span>', $activity_text );
1264
  $activity_text = strip_tags( $activity_text[0] );
 
1265
  bp_activity_update_meta( $activity_id, 'bp_activity_text', $activity_text );
1266
  }
 
1267
  $activity_text = bp_activity_get_meta( $activity_id, 'bp_activity_text' );
1268
  $obj_activity->activity_text = $activity_text;
 
1269
  $wpdb->update( $bp->activity->table_name, array(
1270
  'type' => 'rtmedia_update',
1271
  'content' => $obj_activity->create_activity_html(),
1272
- ), array( 'id' => $activity_id ) );
1273
- }
1274
- }
1275
-
1276
-
1277
- add_action( 'rtmedia_add_edit_tab_title', 'rtmedia_image_editor_title', 12, 1 );
1278
-
1279
- //add the tab title media on media edit screen
1280
- function rtmedia_image_editor_title( $type = 'photo' ) {
1281
- global $rtmedia_query;
1282
- if ( isset( $rtmedia_query->media[0]->media_type ) && 'photo' === $rtmedia_query->media[0]->media_type && 'photo' === $type ) {
1283
- echo '<li><a href="#panel2" class="rtmedia-modify-image"><i class="dashicons dashicons-format-image rtmicon"></i>' . esc_html__( 'Image', 'buddypress-media' ) . '</a></li>';
1284
- }
1285
- }
1286
-
1287
- // add the content for the image editor tab
1288
- add_action( 'rtmedia_add_edit_tab_content', 'rtmedia_image_editor_content', 12, 1 );
1289
-
1290
- function rtmedia_image_editor_content( $type = 'photo' ) {
1291
- global $rtmedia_query;
1292
- if ( isset( $rtmedia_query->media ) && is_array( $rtmedia_query->media ) && isset( $rtmedia_query->media[0]->media_type ) && 'photo' === $rtmedia_query->media[0]->media_type && 'photo' === $type ) {
1293
- $media_id = $rtmedia_query->media[0]->media_id;
1294
- $id = $rtmedia_query->media[0]->id;
1295
-
1296
- $modify_button = $nonce = '';
1297
- if ( current_user_can( 'edit_posts' ) ) {
1298
- include_once( ABSPATH . 'wp-admin/includes/image-edit.php' );
1299
- $nonce = wp_create_nonce( "image_editor-$media_id" );
1300
- $modify_button = '<p><input type="button" class="button rtmedia-image-edit" id="imgedit-open-btn-' . esc_attr( $media_id ) . '" onclick="imageEdit.open( \'' . esc_attr( $media_id ) . '\', \'' . esc_attr( $nonce ) . '\' )" value="' . esc_attr__( 'Modify Image', 'buddypress-media' ) . '"> <span class="spinner"></span></p>';
1301
- }
1302
- $image_path = rtmedia_image( 'rt_media_activity_image', $id, false );
1303
- echo '<div class="content" id="panel2">';
1304
- //<div class="tab-content" data-section-content>';
1305
- echo '<div class="rtmedia-image-editor-cotnainer" id="rtmedia-image-editor-cotnainer" >';
1306
- echo '<input type="hidden" id="rtmedia-filepath-old" name="rtmedia-filepath-old" value="' . esc_url( $image_path ) . '" />';
1307
- echo '<div class="rtmedia-image-editor" id="image-editor-' . esc_attr( $media_id ) . '"></div>';
1308
- $thumb_url = wp_get_attachment_image_src( $media_id, 'thumbnail', true );
1309
-
1310
- echo '<div id="imgedit-response-' . esc_attr( $media_id ) . '"></div>';
1311
- echo '<div class="wp_attachment_image" id="media-head-' . esc_attr( $media_id ) . '">' . '<p id="thumbnail-head-' . esc_attr( $id ) . '"><img class="thumbnail" src="' . esc_url( set_url_scheme( $thumb_url[0] ) ) . '" alt="" /></p>' . $modify_button . '</div>'; // @codingStandardsIgnoreLine
1312
- echo '</div>';
1313
- echo '</div>';
1314
  }
1315
- }
1316
-
1317
- // provide dropdown to user to change the album of the media in media edit screen.
1318
- add_action( 'rtmedia_add_edit_fields', 'rtmedia_add_album_selection_field', 14, 1 );
1319
-
1320
- function rtmedia_add_album_selection_field( $media_type ) {
1321
 
1322
- if ( is_rtmedia_album_enable() && isset( $media_type ) && 'album' != $media_type && apply_filters( 'rtmedia_edit_media_album_select', true ) ) {
1323
-
1324
- global $rtmedia_query;
1325
- $album_list = '';
1326
- $curr_album_id = '';
1327
- if ( isset( $rtmedia_query->media[0] ) && isset( $rtmedia_query->media[0]->album_id ) && ! empty( $rtmedia_query->media[0]->album_id ) ) {
1328
- $curr_album_id = $rtmedia_query->media[0]->album_id;
1329
- }
1330
- ?>
1331
- <div class="rtmedia-edit-change-album rtm-field-wrap">
1332
- <label for=""><?php esc_html_e( 'Album', 'buddypress-media' ); ?> : </label>
1333
- <?php
1334
- if ( isset( $rtmedia_query->query['context'] ) && 'group' === $rtmedia_query->query['context'] ) {
1335
- //show group album list.
1336
- $album_list = rtmedia_group_album_list( $selected_album_id = $curr_album_id );
1337
- } else {
1338
- //show profile album list
1339
- $album_list = rtmedia_user_album_list( $get_all = false, $selected_album_id = $curr_album_id );
1340
- } ?>
1341
- <select name="album_id" class="rtmedia-merge-user-album-list"><?php echo $album_list; // @codingStandardsIgnoreLine?> </select>
1342
- </div>
1343
- <?php
1344
- }
1345
  }
1346
 
 
 
 
 
 
 
 
 
 
1347
  function update_video_poster( $html, $media, $activity = false ) {
 
1348
  if ( 'video' === $media->media_type ) {
1349
  $thumbnail_id = $media->cover_art;
 
1350
  if ( $thumbnail_id ) {
1351
  $thumbnail_info = wp_get_attachment_image_src( $thumbnail_id, 'full' );
1352
  $html = str_replace( '<video ', '<video poster="' . esc_url( $thumbnail_info[0] ) . '" ', $html );
@@ -1354,38 +1786,61 @@ function update_video_poster( $html, $media, $activity = false ) {
1354
  }
1355
 
1356
  return $html;
 
1357
  }
1358
 
 
 
 
 
 
 
 
1359
  function get_video_without_thumbs() {
1360
- $rtmedia_model = new RTMediaModel();
1361
  global $wpdb;
 
 
 
1362
  $sql = $wpdb->prepare( "select media_id from {$rtmedia_model->table_name} where media_type = %s and blog_id = %d and cover_art is null", 'video', get_current_blog_id() ); // @codingStandardsIgnoreLine
1363
  $results = $wpdb->get_col( $sql ); // @codingStandardsIgnoreLine
1364
 
1365
  return $results;
 
1366
  }
1367
 
 
 
 
1368
  function rtmedia_comment_form() {
 
1369
  if ( is_user_logged_in() ) {
1370
  ?>
1371
- <form method="post" id="rt_media_comment_form" class="rt_media_comment_form"
1372
- action="<?php echo esc_url( get_rtmedia_permalink( rtmedia_id() ) ); ?>comment/">
1373
-
1374
- <textarea style="width:100%" placeholder="<?php esc_attr_e( 'Type Comment...', 'buddypress-media' ); ?>"
1375
- name="comment_content" id="comment_content"></textarea>
1376
- <input type="submit" id="rt_media_comment_submit" class="rt_media_comment_submit"
1377
- value="<?php esc_attr_e( 'Comment', 'buddypress-media' ); ?>">
1378
-
1379
  <?php RTMediaComment::comment_nonce_generator(); ?>
1380
  </form>
1381
  <?php
1382
  }
 
1383
  }
1384
 
 
 
 
 
 
 
 
1385
  function rtmedia_get_cover_art_src( $id ) {
 
1386
  $model = new RTMediaModel();
1387
- $media = $model->get( array( 'id' => $id ) );
 
 
1388
  $cover_art = $media[0]->cover_art;
 
1389
  if ( ! empty( $cover_art ) ) {
1390
  if ( is_numeric( $cover_art ) ) {
1391
  $thumbnail_info = wp_get_attachment_image_src( $cover_art, 'full' );
@@ -1397,26 +1852,39 @@ function rtmedia_get_cover_art_src( $id ) {
1397
  } else {
1398
  return false;
1399
  }
 
1400
  }
1401
 
 
 
 
 
 
 
 
1402
  function rtmedia_delete_form( $echo = true ) {
1403
 
1404
  if ( rtmedia_delete_allowed() ) {
1405
-
1406
  $html = '<form method="post" action="' . esc_url( get_rtmedia_permalink( rtmedia_id() ) ) . 'delete/">';
1407
  $html .= '<input type="hidden" name="id" id="id" value="' . esc_attr( rtmedia_id() ) . '">';
1408
  $html .= '<input type="hidden" name="request_action" id="request_action" value="delete">';
 
1409
  if ( $echo ) {
1410
  echo $html; // @codingStandardsIgnoreLine
 
1411
  RTMediaMedia::media_nonce_generator( rtmedia_id(), true );
 
1412
  do_action( 'rtmedia_media_single_delete_form' );
 
1413
  echo '<button type="submit" title="' . esc_attr__( 'Delete Media', 'buddypress-media' ) . '" class="rtmedia-delete-media rtmedia-action-buttons button">' . esc_html__( 'Delete', 'buddypress-media' ) . '</button></form>';
1414
  } else {
1415
  $output = $html;
1416
  $rtm_nonce = RTMediaMedia::media_nonce_generator( rtmedia_id(), false );
1417
  $rtm_nonce = json_decode( $rtm_nonce );
1418
  $rtm_nonce_field = wp_nonce_field( 'rtmedia_' . rtmedia_id(), $rtm_nonce->action, true, false );
 
1419
  do_action( 'rtmedia_media_single_delete_form' );
 
1420
  $output .= $rtm_nonce_field . '<button type="submit" title="' . esc_attr__( 'Delete Media', 'buddypress-media' ) . '" class="rtmedia-delete-media rtmedia-action-buttons button">' . esc_html__( 'Delete', 'buddypress-media' ) . '</button></form>';
1421
 
1422
  return $output;
@@ -1424,13 +1892,16 @@ function rtmedia_delete_form( $echo = true ) {
1424
  }
1425
 
1426
  return false;
 
1427
  }
1428
 
1429
  /**
 
1430
  *
1431
- * @param type $attr
1432
  */
1433
  function rtmedia_uploader( $attr = '' ) {
 
1434
  if ( rtmedia_is_uploader_view_allowed( true, 'media_gallery' ) ) {
1435
  if ( function_exists( 'bp_is_blog_page' ) && ! bp_is_blog_page() ) {
1436
  if ( function_exists( 'bp_is_user' ) && bp_is_user() && function_exists( 'bp_displayed_user_id' ) && bp_displayed_user_id() === get_current_user_id() ) {
@@ -1446,13 +1917,30 @@ function rtmedia_uploader( $attr = '' ) {
1446
  } else {
1447
  echo "<div class='rtmedia-upload-not-allowed'>" . wp_kses( apply_filters( 'rtmedia_upload_not_allowed_message', esc_html__( 'You are not allowed to upload/attach media.', 'buddypress-media' ), 'media_gallery' ), RTMediaUpload::$wp_kses_allowed_tags ) . '</div>';
1448
  }
 
1449
  }
1450
 
 
 
 
 
 
1451
  function rtmedia_gallery( $attr = '' ) {
 
1452
  echo RTMediaGalleryShortcode::render( $attr ); // @codingStandardsIgnoreLine
 
1453
  }
1454
 
 
 
 
 
 
 
 
 
1455
  function get_rtmedia_meta( $id = false, $key = false ) {
 
1456
  if ( apply_filters( 'rtmedia_use_legacy_meta_function', false ) ) {
1457
  $rtmediameta = new RTMediaMeta();
1458
 
@@ -1463,14 +1951,28 @@ function get_rtmedia_meta( $id = false, $key = false ) {
1463
 
1464
  // use WP's default get_metadata function replace column name from "media_id" to "id" in query
1465
  add_filter( 'query', 'rtm_filter_metaid_column_name' );
 
1466
  $meta = get_metadata( 'media', $id, $key, $single );
 
1467
  remove_filter( 'query', 'rtm_filter_metaid_column_name' );
1468
 
1469
  return $meta;
1470
  }
 
1471
  }
1472
 
 
 
 
 
 
 
 
 
 
 
1473
  function add_rtmedia_meta( $id = false, $key = false, $value = false, $duplicate = false ) {
 
1474
  if ( apply_filters( 'rtmedia_use_legacy_meta_function', false ) ) {
1475
  $rtmediameta = new RTMediaMeta( $id, $key, $value, $duplicate );
1476
 
@@ -1478,29 +1980,55 @@ function add_rtmedia_meta( $id = false, $key = false, $value = false, $duplicate
1478
  } else {
1479
  // use WP's default get_metadata function replace column name from "media_id" to "id" in query
1480
  add_filter( 'query', 'rtm_filter_metaid_column_name' );
 
1481
  $meta = add_metadata( 'media', $id, $key, $value, ! $duplicate );
 
1482
  remove_filter( 'query', 'rtm_filter_metaid_column_name' );
1483
 
1484
  return $meta;
1485
  }
 
1486
  }
1487
 
1488
- function update_rtmedia_meta( $id = false, $key = false, $value = false, $duplicate = false ) {
1489
- if ( apply_filters( 'rtmedia_use_legacy_meta_function', false ) ) {
1490
- $rtmediameta = new RTMediaMeta();
 
 
 
 
 
 
 
 
 
 
 
1491
 
1492
  return $rtmediameta->update_meta( $id, $key, $value, $duplicate );
1493
  } else {
1494
  // use WP's default get_metadata function replace column name from "media_id" to "id" in query
1495
  add_filter( 'query', 'rtm_filter_metaid_column_name' );
 
1496
  $meta = update_metadata( 'media', $id, $key, $value, $duplicate );
 
1497
  remove_filter( 'query', 'rtm_filter_metaid_column_name' );
1498
 
1499
  return $meta;
1500
  }
 
1501
  }
1502
 
 
 
 
 
 
 
 
 
1503
  function delete_rtmedia_meta( $id = false, $key = false ) {
 
1504
  if ( apply_filters( 'rtmedia_use_legacy_meta_function', false ) ) {
1505
  $rtmediameta = new RTMediaMeta();
1506
 
@@ -1508,19 +2036,35 @@ function delete_rtmedia_meta( $id = false, $key = false ) {
1508
  } else {
1509
  // use WP's default get_metadata function replace column name from "media_id" to "id" in query
1510
  add_filter( 'query', 'rtm_filter_metaid_column_name' );
 
1511
  $meta = delete_metadata( 'media', $id, $key );
 
1512
  remove_filter( 'query', 'rtm_filter_metaid_column_name' );
1513
 
1514
  return $meta;
1515
  }
1516
  }
1517
 
 
 
 
 
 
1518
  function rtmedia_global_albums() {
 
1519
  return RTMediaAlbum::get_globals();
 
1520
  }
1521
 
 
 
 
 
 
 
 
1522
  function rtmedia_global_album_list( $selected_album_id = false ) {
1523
- global $rtmedia_query;
1524
  $model = new RTMediaModel();
1525
  $global_albums = rtmedia_global_albums();
1526
 
@@ -1528,75 +2072,103 @@ function rtmedia_global_album_list( $selected_album_id = false ) {
1528
  $selected_album_id = $global_albums[0];
1529
  }
1530
 
1531
- $option = null;
1532
-
1533
- $album_objects = $model->get_media( array( 'id' => ( $global_albums ) ), false, false );
 
1534
 
1535
  if ( $album_objects ) {
1536
  foreach ( $album_objects as $album ) {
1537
  //if selected_album_id is provided, keep that album_id selected by default
1538
  $selected = '';
 
1539
  if ( ! empty( $selected_album_id ) && $selected_album_id === $album->id ) {
1540
  $selected = 'selected="selected"';
1541
  }
 
1542
  $option .= '<option value="' . esc_attr( $album->id ) . '" ' . $selected . '>' . esc_html( $album->media_title ) . '</option>';
1543
  }
1544
  }
1545
 
1546
  return $option;
 
1547
  }
1548
 
 
 
 
 
 
 
 
 
 
 
1549
  function rtmedia_user_album_list( $get_all = false, $selected_album_id = false ) {
 
1550
  global $rtmedia_query;
1551
- $model = new RTMediaModel();
1552
- $global_option = rtmedia_global_album_list( $selected_album_id );
1553
- $global_albums = rtmedia_global_albums();
1554
 
1555
- $global_album = rtmedia_get_site_option( 'rtmedia-global-albums' );
 
 
1556
  $album_objects = $model->get_media( array(
1557
  'media_author' => get_current_user_id(),
1558
  'media_type' => 'album',
1559
  ), false, 'context' );
1560
  $option_group = '';
1561
  $profile_option = '';
 
1562
  if ( $album_objects ) {
1563
  foreach ( $album_objects as $album ) {
1564
- if ( ! in_array( $album->id, array_map( 'intval', $global_albums ), true ) && ( ( isset( $rtmedia_query->media_query['album_id'] ) && ( $album->id !== $rtmedia_query->media_query['album_id'] || $get_all ) ) || ! isset( $rtmedia_query->media_query['album_id'] ) )
1565
- ) {
1566
  if ( 'profile' === $album->context ) {
1567
  $profile_option .= '<option value="' . esc_attr( $album->id ) . '" ' . selected( $selected_album_id, $album->id, false ) . '>' . esc_html( $album->media_title ) . '</option>';
1568
  }
1569
  }
1570
  }
1571
  }
 
1572
  $option = apply_filters( 'rtmedia_global_albums_in_uploader', "$global_option" );
 
1573
  if ( '' != $profile_option ) {
1574
  $option .= "<optgroup label='" . esc_attr__( 'Profile Albums', 'buddypress-media' ) . " ' value = 'profile'>$profile_option</optgroup>";
1575
  }
 
1576
  if ( '' != $option_group && class_exists( 'BuddyPress' ) ) {
1577
  $option .= "<optgroup label='" . esc_attr__( 'Group Albums', 'buddypress-media' ) . "' value = 'group'>$option_group</optgroup>";
1578
  }
 
1579
  if ( $option ) {
1580
  return $option;
1581
  } else {
1582
  return false;
1583
  }
 
1584
  }
1585
 
 
 
 
 
 
 
 
 
 
1586
  function rtmedia_group_album_list( $selected_album_id = false ) {
1587
  //by default, first album in list will be selected
1588
  global $rtmedia_query;
1589
- $model = new RTMediaModel();
1590
 
 
1591
  $global_option = rtmedia_global_album_list( $selected_album_id );
1592
  $global_albums = rtmedia_global_albums();
1593
-
1594
  $album_objects = $model->get_media( array(
1595
  'context' => $rtmedia_query->media_query['context'],
1596
  'context_id' => $rtmedia_query->media_query['context_id'],
1597
  'media_type' => 'album',
1598
  ), false, false );
1599
  $option_group = '';
 
1600
  if ( $album_objects ) {
1601
  foreach ( $album_objects as $album ) {
1602
  if ( ! in_array( $album->id, $global_albums ) && ( ( isset( $rtmedia_query->media_query['album_id'] ) && ( $album->id != $rtmedia_query->media_query['album_id'] ) ) || ! isset( $rtmedia_query->media_query['album_id'] ) ) ) {
@@ -1604,179 +2176,66 @@ function rtmedia_group_album_list( $selected_album_id = false ) {
1604
  }
1605
  }
1606
  }
 
1607
  $option = $global_option;
 
1608
  if ( ! empty( $option_group ) ) {
1609
  $option .= "<optgroup label='" . esc_attr__( 'Group Albums', 'buddypress-media' ) . "' value = 'group'>$option_group</optgroup>";
1610
  }
 
1611
  if ( $option ) {
1612
  return $option;
1613
  } else {
1614
  return false;
1615
  }
1616
- }
1617
 
1618
- add_action( 'rtmedia_media_gallery_actions', 'rtmedia_gallery_options', 80 );
1619
- add_action( 'rtmedia_album_gallery_actions', 'rtmedia_gallery_options', 80 );
1620
-
1621
- function rtmedia_gallery_options() {
1622
-
1623
- $options_start = $options_end = $option_buttons = $output = '';
1624
- $options = array();
1625
- $options = apply_filters( 'rtmedia_gallery_actions', $options );
1626
- if ( ! empty( $options ) ) {
1627
-
1628
- $options_start = '<div class="click-nav rtm-media-options-list" id="rtm-media-options-list">
1629
- <div class="no-js">
1630
- <div class="clicker rtmedia-action-buttons"><i class="dashicons dashicons-admin-generic rtmicon"></i>' . esc_html__( 'Options', 'buddypress-media' ) . '</div>
1631
- <ul class="rtm-options">';
1632
- foreach ( $options as $action ) {
1633
- if ( ! empty( $action ) ) {
1634
- $option_buttons .= '<li>' . $action . '</li>';
1635
- }
1636
- }
1637
-
1638
- $options_end = '</ul></div></div>';
1639
-
1640
- if ( ! empty( $option_buttons ) ) {
1641
- $output = $options_start . $option_buttons . $options_end;
1642
- }
1643
-
1644
- if ( ! empty( $output ) ) {
1645
- echo $output; // @codingStandardsIgnoreLine
1646
- }
1647
- }
1648
  }
1649
 
 
 
 
 
 
1650
  function rtm_is_album_create_allowed() {
 
1651
  return apply_filters( 'rtm_is_album_create_enable', true );
 
1652
  }
1653
 
 
 
 
 
 
 
 
1654
  function rtm_is_user_allowed_to_create_album( $user_id = false ) {
 
1655
  if ( ! $user_id ) {
1656
  $user_id = get_current_user_id();
1657
  }
1658
 
1659
  return apply_filters( 'rtm_display_create_album_button', true, $user_id );
1660
- }
1661
-
1662
- add_filter( 'rtmedia_gallery_actions', 'rtmedia_create_album', 12 );
1663
-
1664
- function rtmedia_create_album( $options ) {
1665
- if ( ! is_rtmedia_album_enable() ) {
1666
- return;
1667
- }
1668
- if ( ! rtm_is_album_create_allowed() ) {
1669
- return;
1670
- }
1671
- global $rtmedia_query;
1672
- $user_id = get_current_user_id();
1673
- $display = false;
1674
- if ( isset( $rtmedia_query->query['context'] ) && in_array( $rtmedia_query->query['context'], array(
1675
- 'profile',
1676
- 'group',
1677
- ), true ) && 0 !== $user_id
1678
- ) {
1679
- switch ( $rtmedia_query->query['context'] ) {
1680
- case 'profile':
1681
- if ( $rtmedia_query->query['context_id'] === $user_id ) {
1682
- $display = rtm_is_user_allowed_to_create_album();
1683
- }
1684
- break;
1685
- case 'group':
1686
- $group_id = $rtmedia_query->query['context_id'];
1687
- if ( can_user_create_album_in_group( $group_id ) ) {
1688
- $display = true;
1689
- }
1690
- break;
1691
- }
1692
- }
1693
- if ( true === $display ) {
1694
- add_action( 'rtmedia_before_media_gallery', 'rtmedia_create_album_modal' );
1695
- $options[] = "<a href='#rtmedia-create-album-modal' class='rtmedia-reveal-modal rtmedia-modal-link' title='" . esc_attr__( 'Create New Album', 'buddypress-media' ) . "'><i class='dashicons dashicons-plus-alt rtmicon'></i>" . esc_html__( 'Add Album', 'buddypress-media' ) . '</a>';
1696
- }
1697
 
1698
- return $options;
1699
  }
1700
 
1701
- add_action( 'rtmedia_before_media_gallery', 'rtmedia_create_album_modal' );
1702
- add_action( 'rtmedia_before_album_gallery', 'rtmedia_create_album_modal' );
1703
-
1704
- function rtmedia_create_album_modal() {
1705
- global $rtmedia_query;
1706
- if ( is_rtmedia_album_enable() && isset( $rtmedia_query->query['context_id'] ) && isset( $rtmedia_query->query['context'] ) && ( ! ( isset( $rtmedia_query->is_gallery_shortcode ) && true === $rtmedia_query->is_gallery_shortcode ) ) || apply_filters( 'rtmedia_load_add_album_modal', false ) ) {
1707
- ?>
1708
- <div class="mfp-hide rtmedia-popup" id="rtmedia-create-album-modal">
1709
- <div id="rtm-modal-container">
1710
- <?php do_action( 'rtmedia_before_create_album_modal' ); ?>
1711
- <h2 class="rtm-modal-title"><?php esc_html_e( 'Create an Album', 'buddypress-media' ); ?></h2>
1712
- <p>
1713
- <label class="rtm-modal-grid-title-column"
1714
- for="rtmedia_album_name"><?php esc_html_e( 'Album Title : ', 'buddypress-media' ); ?></label>
1715
- <input type="text" id="rtmedia_album_name" value="" class="rtm-input-medium"/>
1716
- </p>
1717
- <?php do_action( 'rtmedia_add_album_privacy' ); ?>
1718
- <input type="hidden" id="rtmedia_album_context"
1719
- value="<?php echo esc_attr( $rtmedia_query->query['context'] ); ?>">
1720
- <input type="hidden" id="rtmedia_album_context_id"
1721
- value="<?php echo esc_attr( $rtmedia_query->query['context_id'] ); ?>">
1722
- <?php wp_nonce_field( 'rtmedia_create_album_nonce', 'rtmedia_create_album_nonce' ); ?>
1723
- <p>
1724
- <button type="button"
1725
- id="rtmedia_create_new_album"><?php esc_html_e( 'Create Album', 'buddypress-media' ); ?></button>
1726
- </p>
1727
- <?php do_action( 'rtmedia_after_create_album_modal' ); ?>
1728
- </div>
1729
- </div>
1730
- <?php
1731
- }
1732
- }
1733
-
1734
- add_action( 'rtmedia_before_media_gallery', 'rtmedia_merge_album_modal' );
1735
- add_action( 'rtmedia_before_album_gallery', 'rtmedia_merge_album_modal' );
1736
-
1737
- function rtmedia_merge_album_modal() {
1738
 
1739
- if ( ! is_rtmedia_album() || ! is_user_logged_in() ) {
1740
- return;
1741
- }
1742
- if ( ! is_rtmedia_album_enable() ) {
1743
- return;
1744
- }
1745
  global $rtmedia_query;
1746
 
1747
- if ( is_rtmedia_group_album() ) {
1748
- $album_list = rtmedia_group_album_list();
1749
- } else {
1750
- $album_list = rtmedia_user_album_list();
1751
- }
1752
- if ( $album_list && ! empty( $rtmedia_query->media_query['album_id'] ) ) {
1753
- ?>
1754
- <div class="rtmedia-merge-container rtmedia-popup mfp-hide" id="rtmedia-merge">
1755
- <div id="rtm-modal-container">
1756
- <h2 class="rtm-modal-title"><?php esc_html_e( 'Merge Album', 'buddypress-media' ); ?></h2>
1757
-
1758
- <form method="post" class="album-merge-form" action="merge/">
1759
- <p><span><?php esc_html_e( 'Select Album to merge with : ', 'buddypress-media' ); ?></span>
1760
- <?php echo '<select name="album" class="rtmedia-merge-user-album-list">' . $album_list . '</select>';// @codingStandardsIgnoreLine ?>
1761
- </p>
1762
- <?php wp_nonce_field( 'rtmedia_merge_album_' . $rtmedia_query->media_query['album_id'], 'rtmedia_merge_album_nonce' ); ?>
1763
- <input type="submit" class="rtmedia-merge-selected" name="merge-album"
1764
- value="<?php esc_html_e( 'Merge Album', 'buddypress-media' ); ?>"/>
1765
- </form>
1766
- </div>
1767
- </div>
1768
-
1769
- <?php
1770
- }
1771
- }
1772
-
1773
- function rtmedia_is_album_editable() {
1774
- global $rtmedia_query;
1775
  if ( isset( $rtmedia_query->query['context'] ) && 'profile' === $rtmedia_query->query['context'] ) {
1776
  if ( isset( $rtmedia_query->media_query['media_author'] ) && get_current_user_id() === intval( $rtmedia_query->media_query['media_author'] ) ) {
1777
  return true;
1778
  }
1779
  }
 
1780
  if ( isset( $rtmedia_query->query['context'] ) && 'group' === $rtmedia_query->query['context'] ) {
1781
  if ( isset( $rtmedia_query->album[0]->media_author ) && get_current_user_id() === intval( $rtmedia_query->album[0]->media_author ) ) {
1782
  return true;
@@ -1784,88 +2243,63 @@ function rtmedia_is_album_editable() {
1784
  }
1785
 
1786
  return false;
1787
- }
1788
-
1789
- add_filter( 'rtmedia_gallery_actions', 'rtmedia_album_edit', 11 );
1790
-
1791
- function rtmedia_album_edit( $options ) {
1792
-
1793
- if ( ! is_rtmedia_album() || ! is_user_logged_in() ) {
1794
- return;
1795
- }
1796
- if ( ! is_rtmedia_album_enable() ) {
1797
- return;
1798
- }
1799
- global $rtmedia_query;
1800
- ?>
1801
-
1802
- <?php
1803
- if ( isset( $rtmedia_query->media_query ) && isset( $rtmedia_query->media_query['album_id'] ) && ! in_array( intval( $rtmedia_query->media_query['album_id'] ), array_map( 'intval', rtmedia_get_site_option( 'rtmedia-global-albums' ) ), true ) ) {
1804
- if ( rtmedia_is_album_editable() || is_rt_admin() ) {
1805
- $options[] = "<a href='edit/' class='rtmedia-edit' title='" . esc_attr__( 'Edit Album', 'buddypress-media' ) . "' ><i class='rtmicon dashicons dashicons-edit'></i>" . esc_html__( 'Edit Album', 'buddypress-media' ) . '</a>';
1806
- $options[] = '<form method="post" class="album-delete-form rtmedia-inline" action="delete/">' . wp_nonce_field( 'rtmedia_delete_album_' . $rtmedia_query->media_query['album_id'], 'rtmedia_delete_album_nonce' ) . '<button type="submit" name="album-delete" class="rtmedia-delete-album" title="' . esc_attr__( 'Delete Album', 'buddypress-media' ) . '"><i class="dashicons dashicons-trash rtmicon"></i>' . esc_html__( 'Delete Album', 'buddypress-media' ) . '</button></form>';
1807
-
1808
- if ( is_rtmedia_group_album() ) {
1809
- $album_list = rtmedia_group_album_list();
1810
- } else {
1811
- $album_list = rtmedia_user_album_list();
1812
- }
1813
- if ( $album_list ) {
1814
-
1815
- $options[] = '<a href="#rtmedia-merge" class="rtmedia-reveal-modal rtmedia-modal-link" title="' . esc_attr__( 'Merge Album', 'buddypress-media' ) . '"><i class="dashicons dashicons-randomize"></i>' . esc_html__( 'Merge Album', 'buddypress-media' ) . '</a>';
1816
- }
1817
- }
1818
- }
1819
-
1820
- return $options;
1821
- }
1822
 
1823
- add_action( 'rtmedia_before_item', 'rtmedia_item_select' );
1824
-
1825
- function rtmedia_item_select() {
1826
- global $rtmedia_query, $rtmedia_backbone;
1827
- if ( $rtmedia_backbone['backbone'] ) {
1828
- if ( isset( $rtmedia_backbone['is_album'] ) && $rtmedia_backbone['is_album'] && isset( $rtmedia_backbone['is_edit_allowed'] ) && $rtmedia_backbone['is_edit_allowed'] ) {
1829
- echo '<span class="rtm-checkbox-wrap"><input type="checkbox" name="move[]" class="rtmedia-item-selector" value="<%= id %>" /></span>';
1830
- }
1831
- } else {
1832
- if ( is_rtmedia_album() && isset( $rtmedia_query->media_query ) && 'edit' === $rtmedia_query->action_query->action ) {
1833
- if ( isset( $rtmedia_query->media_query['media_author'] ) && get_current_user_id() === intval( $rtmedia_query->media_query['media_author'] ) ) {
1834
- echo '<span class="rtm-checkbox-wrap"><input type="checkbox" class="rtmedia-item-selector" name="selected[]" value="' . esc_attr( rtmedia_id() ) . '" /></span>';
1835
- }
1836
- }
1837
- }
1838
- }
1839
-
1840
- add_action( 'rtmedia_query_actions', 'rtmedia_album_merge_action' );
1841
-
1842
- function rtmedia_album_merge_action( $actions ) {
1843
- $actions['merge'] = esc_html__( 'Merge', 'buddypress-media' );
1844
-
1845
- return $actions;
1846
  }
1847
 
 
 
 
 
 
1848
  function rtmedia_sub_nav() {
 
1849
  global $rtMediaNav;
 
1850
  $rtMediaNav = new RTMediaNav();
 
1851
  $rtMediaNav->sub_nav();
 
1852
  }
1853
 
 
 
 
 
 
 
 
1854
  function is_rtmedia_album_enable() {
 
1855
  global $rtmedia;
 
1856
  if ( isset( $rtmedia->options['general_enableAlbums'] ) && 0 !== intval( $rtmedia->options['general_enableAlbums'] ) ) {
1857
  return true;
1858
  }
1859
 
1860
  return false;
 
1861
  }
1862
 
 
 
 
1863
  function rtmedia_load_template() {
 
1864
  do_action( 'rtmedia_before_template_load' );
 
1865
  include( RTMediaTemplate::locate_template() );
 
1866
  do_action( 'rtmedia_after_template_load' );
 
1867
  }
1868
 
 
 
 
 
 
 
 
1869
  function is_rtmedia_privacy_enable() {
1870
 
1871
  global $rtmedia;
@@ -1878,6 +2312,13 @@ function is_rtmedia_privacy_enable() {
1878
 
1879
  }
1880
 
 
 
 
 
 
 
 
1881
  function is_rtmedia_privacy_user_overide() {
1882
 
1883
  global $rtmedia;
@@ -1890,31 +2331,61 @@ function is_rtmedia_privacy_user_overide() {
1890
 
1891
  }
1892
 
 
 
 
 
 
 
 
1893
  function rtmedia_edit_media_privacy_ui() {
 
1894
  global $rtmedia_query;
 
1895
  if ( isset( $rtmedia_query->query['context'] ) && 'group' === $rtmedia_query->query['context'] ) {
1896
  //if context is group i.e editing a group media, dont show the privacy dropdown
1897
  return false;
1898
  }
 
1899
  $privacymodel = new RTMediaPrivacy( false );
1900
  $privacy = $privacymodel->select_privacy_ui( $echo = false );
 
1901
  if ( $privacy ) {
1902
  return "<div class='rtmedia-edit-privacy rtm-field-wrap'><label for='privacy'>" . esc_html__( 'Privacy : ', 'buddypress-media' ) . '</label>' . $privacy . '</div>';
1903
  }
 
1904
  }
1905
 
 
 
 
 
 
 
 
1906
  function get_rtmedia_default_privacy() {
1907
 
1908
  global $rtmedia;
 
1909
  if ( isset( $rtmedia->options['privacy_default'] ) ) {
1910
  return $rtmedia->options['privacy_default'];
1911
  }
1912
 
1913
  return 0;
 
1914
  }
1915
 
 
 
 
 
 
 
 
1916
  function is_rtmedia_group_media_enable() {
 
1917
  global $rtmedia;
 
1918
  if ( isset( $rtmedia->options['buddypress_enableOnGroup'] ) && 0 !== intval( $rtmedia->options['buddypress_enableOnGroup'] ) ) {
1919
  return true;
1920
  }
@@ -1922,70 +2393,112 @@ function is_rtmedia_group_media_enable() {
1922
  return false;
1923
  }
1924
 
1925
- // check if media is enabled in profile
 
 
 
 
 
 
1926
  function is_rtmedia_profile_media_enable() {
 
1927
  global $rtmedia;
 
1928
  if ( isset( $rtmedia->options['buddypress_enableOnProfile'] ) && 0 !== intval( $rtmedia->options['buddypress_enableOnProfile'] ) ) {
1929
  return true;
1930
  }
1931
 
1932
  return false;
 
1933
  }
1934
 
1935
- //function to check if user is on bp group
 
 
 
 
 
 
1936
  function is_rtmedia_bp_group() {
 
1937
  global $rtmedia_query;
 
1938
  if ( isset( $rtmedia_query->query['context'] ) && 'group' === $rtmedia_query->query['context'] ) {
1939
  return true;
1940
  }
1941
 
1942
  return false;
 
1943
  }
1944
 
1945
- //function to check if user is on bp group
 
 
 
 
 
 
1946
  function is_rtmedia_bp_profile() {
 
1947
  global $rtmedia_query;
 
1948
  if ( isset( $rtmedia_query->query['context'] ) && 'profile' == $rtmedia_query->query['context'] ) {
1949
  return true;
1950
  }
1951
 
1952
  return false;
 
1953
  }
1954
 
 
 
 
 
 
1955
  function can_user_upload_in_group() {
 
1956
  $group = groups_get_current_group();
1957
- $upload_level = groups_get_groupmeta( $group->id, 'rt_upload_media_control_level' );
1958
  $user_id = get_current_user_id();
1959
  $display_flag = false;
 
1960
  if ( groups_is_user_member( $user_id, $group->id ) ) {
1961
  $display_flag = true;
1962
  }
 
1963
  $display_flag = apply_filters( 'rtm_can_user_upload_in_group', $display_flag );
1964
 
1965
  return $display_flag;
 
1966
  }
1967
 
1968
  /**
 
1969
  *
1970
- * @param bool|type $group_id
1971
- * @param bool|type $user_id
1972
  *
1973
- * @return bool
1974
  */
1975
  function can_user_create_album_in_group( $group_id = false, $user_id = false ) {
 
1976
  if ( false == $group_id ) {
1977
  $group = groups_get_current_group();
1978
  $group_id = $group->id;
1979
  }
 
1980
  $upload_level = groups_get_groupmeta( $group_id, 'rt_media_group_control_level' );
 
1981
  if ( empty( $upload_level ) ) {
1982
  $upload_level = groups_get_groupmeta( $group_id, 'bp_media_group_control_level' );
 
1983
  if ( empty( $upload_level ) ) {
1984
  $upload_level = 'all';
1985
  }
1986
  }
 
1987
  $user_id = get_current_user_id();
1988
  $display_flag = false;
 
1989
  if ( groups_is_user_member( $user_id, $group_id ) ) {
1990
  if ( 'admin' === $upload_level ) {
1991
  if ( groups_is_user_admin( $user_id, $group_id ) > 0 ) {
@@ -2001,13 +2514,24 @@ function can_user_create_album_in_group( $group_id = false, $user_id = false ) {
2001
  }
2002
  }
2003
  }
 
2004
  $display_flag = apply_filters( 'can_user_create_album_in_group', $display_flag );
2005
 
2006
  return $display_flag;
 
2007
  }
2008
 
 
 
 
 
 
 
 
2009
  function is_rtmedia_upload_video_enabled() {
 
2010
  global $rtmedia;
 
2011
  if ( isset( $rtmedia->options['allowedTypes_video_enabled'] ) && 0 !== intval( $rtmedia->options['allowedTypes_video_enabled'] ) ) {
2012
  return true;
2013
  }
@@ -2015,48 +2539,96 @@ function is_rtmedia_upload_video_enabled() {
2015
  return false;
2016
  }
2017
 
 
 
 
 
 
 
 
2018
  function is_rtmedia_upload_photo_enabled() {
 
2019
  global $rtmedia;
 
2020
  if ( isset( $rtmedia->options['allowedTypes_photo_enabled'] ) && 0 !== intval( $rtmedia->options['allowedTypes_photo_enabled'] ) ) {
2021
  return true;
2022
  }
2023
 
2024
  return false;
 
2025
  }
2026
 
 
 
 
 
 
 
 
2027
  function is_rtmedia_upload_music_enabled() {
 
2028
  global $rtmedia;
 
2029
  if ( isset( $rtmedia->options['allowedTypes_music_enabled'] ) && 0 !== intval( $rtmedia->options['allowedTypes_music_enabled'] ) ) {
2030
  return true;
2031
  }
2032
 
2033
  return false;
 
2034
  }
2035
 
 
 
 
 
 
 
 
2036
  function get_rtmedia_allowed_upload_type() {
 
2037
  global $rtmedia;
 
2038
  $allow_type_str = '';
2039
  $sep = '';
2040
- foreach ( $rtmedia->allowed_types as $type ) {
2041
 
 
2042
  if ( function_exists( 'is_rtmedia_upload_' . $type['name'] . '_enabled' ) && call_user_func( 'is_rtmedia_upload_' . $type['name'] . '_enabled' ) ) {
2043
  foreach ( $type['extn'] as $extn ) {
2044
  $allow_type_str .= $sep . $extn;
 
2045
  $sep = ',';
2046
  }
2047
  }
2048
  }
2049
 
2050
  return $allow_type_str;
 
2051
  }
2052
 
 
 
 
 
 
2053
  function is_rt_admin() {
 
2054
  return current_user_can( 'list_users' );
 
2055
  }
2056
 
 
 
 
 
 
 
 
2057
  function get_rtmedia_like( $media_id = false ) {
 
2058
  $mediamodel = new RTMediaModel();
2059
- $actions = $mediamodel->get( array( 'id' => rtmedia_id( $media_id ) ) );
 
 
2060
 
2061
  if ( isset( $actions[0]->likes ) ) {
2062
  $actions = intval( $actions[0]->likes );
@@ -2065,142 +2637,122 @@ function get_rtmedia_like( $media_id = false ) {
2065
  }
2066
 
2067
  return $actions;
 
2068
  }
2069
 
 
 
 
 
 
2070
  function show_rtmedia_like_counts() {
 
2071
  global $rtmedia;
 
2072
  $options = $rtmedia->options;
2073
  $count = get_rtmedia_like();
 
2074
  if ( ! ( isset( $options['general_enableLikes'] ) && 0 === intval( $options['general_enableLikes'] ) ) ) {
2075
- ?>
2076
- <div class='rtmedia-like-info<?php
2077
  if ( ! intval( $count ) ) {
2078
- echo ' hide';
2079
  }
2080
- ?>'><i class="rtmicon-thumbs-up rtmicon-fw"></i> <span
2081
- class="rtmedia-like-counter-wrap"><span
2082
- class="rtmedia-like-counter"><?php echo esc_html( $count ); ?></span> <?php esc_html_e( 'people like this', 'buddypress-media' ); ?></span>
2083
  </div>
2084
  <?php
2085
  }
2086
- }
2087
-
2088
- add_action( 'rtmedia_media_gallery_actions', 'add_upload_button', 99 );
2089
- add_action( 'rtmedia_album_gallery_actions', 'add_upload_button', 99 );
2090
 
2091
- function add_upload_button() {
2092
- if ( function_exists( 'bp_is_blog_page' ) && ! bp_is_blog_page() ) {
2093
- if ( function_exists( 'bp_is_user' ) && bp_is_user() && function_exists( 'bp_displayed_user_id' ) && bp_displayed_user_id() === get_current_user_id() ) {
2094
- echo '<span class="primary rtmedia-upload-media-link" id="rtm_show_upload_ui" title="' . esc_attr__( 'Upload Media', 'buddypress-media' ) . '"><i class="dashicons dashicons-upload rtmicon"></i>' . esc_html__( 'Upload', 'buddypress-media' ) . '</span>';
2095
- } else {
2096
- if ( function_exists( 'bp_is_group' ) && bp_is_group() ) {
2097
- if ( can_user_upload_in_group() ) {
2098
- echo '<span class="rtmedia-upload-media-link primary" id="rtm_show_upload_ui" title="' . esc_attr__( 'Upload Media', 'buddypress-media' ) . '"><i class="dashicons dashicons-upload rtmicon"></i>' . esc_html__( 'Upload', 'buddypress-media' ) . '</span>';
2099
- }
2100
- }
2101
- }
2102
- }
2103
- }
2104
-
2105
- //add_action("rtemdia_after_file_upload_before_activity","add_music_cover_art" ,20 ,2);
2106
- function add_music_cover_art( $file_object, $upload_obj ) {
2107
- $media_obj = new RTMediaMedia();
2108
- $media = $media_obj->model->get( array( 'id' => $upload_obj->media_ids[0] ) );
2109
  }
2110
 
 
 
 
 
 
 
 
2111
  function rtm_get_music_cover_art( $media_object ) {
 
2112
  // return URL if cover_art already set.
2113
  $url = $media_object->cover_art;
 
2114
  if ( ! empty( $url ) && ! is_numeric( $url ) ) {
2115
  return $url;
2116
  }
2117
 
2118
  // return false if covert_art is already analyzed earlier
2119
- if ( - 1 === intval( $url ) ) {
2120
  return false;
2121
  }
2122
 
2123
  // Analyze media for the first time and set cover_art into database.
2124
- $file = get_attached_file( $media_object->media_id );
2125
- $media_obj = new RTMediaMedia();
2126
-
2127
  $media_tags = new RTMediaTags( $file );
2128
  $title_info = $media_tags->title;
2129
  $image_info = $media_tags->image;
2130
  $image_mime = $image_info['mime'];
2131
  $mime = explode( '/', $image_mime );
2132
  $id = $media_object->id;
2133
- if ( ! empty( $image_info['data'] ) ) {
2134
 
 
2135
  $thumb_upload_info = wp_upload_bits( $title_info . '.' . $mime[ count( $mime ) - 1 ], null, $image_info['data'] );
 
2136
  if ( is_array( $thumb_upload_info ) && ! empty( $thumb_upload_info['url'] ) ) {
2137
- $media_obj->model->update( array( 'cover_art' => $thumb_upload_info['url'] ), array( 'id' => $id ) );
 
 
 
 
 
2138
  return $thumb_upload_info['url'];
2139
  }
2140
  }
2141
 
2142
- $media_obj->model->update( array( 'cover_art' => '-1' ), array( 'id' => $id ) );
 
 
 
 
2143
 
2144
  return false;
 
2145
  }
2146
 
2147
  /**
2148
  * "get_music_cover_art" is too generic function name. It shouldn't added in very first place.
2149
  * It is renamed as "rtm_get_music_cover_art"
 
 
2150
  */
2151
- if ( ! function_exists( 'get_music_cover_art' ) ) {
2152
- function get_music_cover_art( $file, $id ) {
2153
- return false;
2154
- }
2155
- }
2156
-
2157
- function rtmedia_bp_activity_get_types( $actions ) {
2158
- $actions['rtmedia_update'] = 'rtMedia update';
2159
-
2160
- return $actions;
2161
- }
2162
-
2163
- add_filter( 'bp_activity_get_types', 'rtmedia_bp_activity_get_types', 10, 1 );
2164
-
2165
- add_action( 'wp_footer', 'rtmedia_link_in_footer' );
2166
-
2167
- function rtmedia_link_in_footer() {
2168
- global $rtmedia;
2169
- $option = $rtmedia->options;
2170
- $link = ( isset( $option['rtmedia_add_linkback'] ) ) ? $option['rtmedia_add_linkback'] : false;
2171
- if ( $link ) {
2172
- $aff_id = ( '' != $option['rtmedia_affiliate_id'] ) ? '&ref=' . $option['rtmedia_affiliate_id'] : '';
2173
- $href = 'https://rtmedia.io/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media' . $aff_id;
2174
- ?>
2175
-
2176
- <div class='rtmedia-footer-link'>
2177
- <?php esc_html_e( 'Empowering your community with ', 'buddypress-media' ); ?>
2178
- <a href='<?php echo esc_url( $href ) ?>'
2179
- title='<?php esc_attr_e( 'The only complete media solution for WordPress, BuddyPress and bbPress', 'buddypress-media' ); ?> '>
2180
- rtMedia</a>
2181
- </div>
2182
- <?php
2183
- }
2184
- }
2185
 
2186
- //add content before the media in single media page
2187
- add_action( 'rtmedia_before_media', 'rtmedia_content_before_media', 10 );
2188
 
2189
- function rtmedia_content_before_media() {
2190
- global $rt_ajax_request;
2191
 
2192
- if ( $rt_ajax_request ) {
2193
- ?>
2194
- <span class="rtm-mfp-close mfp-close dashicons dashicons-no-alt"
2195
- title="<?php esc_attr_e( 'Close (Esc)', 'buddypress-media' ); ?>"></span><?php
2196
  }
 
2197
  }
2198
 
2199
- //get the mediaprivacy symbol
 
 
 
 
 
 
2200
  function get_rtmedia_privacy_symbol( $rtmedia_id = false ) {
 
2201
  $mediamodel = new RTMediaModel();
2202
- $actions = $mediamodel->get( array( 'id' => rtmedia_id( $rtmedia_id ) ) );
 
 
2203
  $privacy = '';
 
2204
  if ( intval( $actions[0]->privacy ) >= 0 ) {
2205
  $title = $icon = '';
2206
 
@@ -2208,34 +2760,48 @@ function get_rtmedia_privacy_symbol( $rtmedia_id = false ) {
2208
  case 0: // public
2209
  $title = esc_html__( 'Public', 'buddypress-media' );
2210
  $icon = 'dashicons dashicons-admin-site rtmicon';
 
2211
  break;
2212
  case 20: // users
2213
  $title = esc_html__( 'All members', 'buddypress-media' );
2214
  $icon = 'dashicons dashicons-groups rtmicon';
 
2215
  break;
2216
  case 40: // friends
2217
  $title = esc_html__( 'Your friends', 'buddypress-media' );
2218
  $icon = 'dashicons dashicons-networking rtmicon';
 
2219
  break;
2220
  case 60: // private
2221
  $title = esc_html__( 'Only you', 'buddypress-media' );
2222
  $icon = 'dashicons dashicons-lock rtmicon';
 
2223
  break;
2224
  case 80: // private
2225
  $title = esc_html__( 'Blocked temporarily', 'buddypress-media' );
2226
  $icon = 'dashicons dashicons-dismiss rtmicon';
 
2227
  break;
2228
  }
 
2229
  if ( ! empty( $title ) && ! empty( $icon ) ) {
2230
  $privacy = "<i class='" . esc_attr( $icon ) . "' title='" . esc_attr( $title ) . "'></i>";
2231
  }
2232
  }
2233
 
2234
  return $privacy;
 
2235
  }
2236
 
2237
- //
 
 
 
 
 
 
2238
  function get_rtmedia_date_gmt( $rtmedia_id = false ) {
 
2239
  $media = get_post( rtmedia_media_id( rtmedia_id( $rtmedia_id ) ) );
2240
  $date_time = '';
2241
 
@@ -2246,43 +2812,55 @@ function get_rtmedia_date_gmt( $rtmedia_id = false ) {
2246
  $date_time = apply_filters( 'rtmedia_comment_date_format', $date_time, null );
2247
 
2248
  return '<span>' . $date_time . '</span>';
 
2249
  }
2250
 
2251
- //function to convert comment datetime to "time ago" format.
 
 
 
 
 
 
2252
  function rtmedia_convert_date( $_date ) {
 
2253
  $stf = 0;
2254
  $date = new DateTime( $_date );
2255
  $date = $date->format( 'U' );
2256
  $cur_time = time();
2257
  $diff = $cur_time - $date;
2258
  $time_unit = array( 'second', 'minute', 'hour' );
2259
-
2260
- $length = array( 1, 60, 3600, 86400 );
2261
- $ago_text = esc_html__( '%s ago ', 'buddypress-media' );
2262
 
2263
  for ( $i = sizeof( $length ) - 1; ( $i >= 0 ) && ( ( $no = $diff / $length[ $i ] ) <= 1 ); $i -- );
2264
 
2265
  if ( $i < 0 ) {
2266
  $i = 0;
2267
  }
 
2268
  if ( $i <= 2 ) { //if posted in last 24 hours
2269
  $_time = $cur_time - ( $diff % $length[ $i ] );
 
2270
 
2271
- $no = floor( $no );
2272
  switch ( $time_unit[ $i ] ) {
2273
  case 'second':
2274
  $time_unit_phrase = _n( '1 second', '%s seconds', $no, 'buddypress-media' );
 
2275
  break;
2276
  case 'minute':
2277
  $time_unit_phrase = _n( '1 minute', '%s minutes', $no, 'buddypress-media' );
 
2278
  break;
2279
  case 'hour':
2280
  $time_unit_phrase = _n( '1 hour', '%s hours', $no, 'buddypress-media' );
 
2281
  break;
2282
  default:
2283
  // should not happen
2284
  $time_unit_phrase = '%s unknown';
2285
  }
 
2286
  $value = sprintf( $time_unit_phrase . ' ', $no );
2287
 
2288
  if ( ( 1 === $stf ) && ( $i >= 1 ) && ( ( $cur_time - $_time ) > 0 ) ) {
@@ -2294,12 +2872,22 @@ function rtmedia_convert_date( $_date ) {
2294
  /* translators: date format, see http://php.net/date */
2295
  return date_i18n( 'd F Y ', strtotime( $_date ), true );
2296
  }
 
2297
  }
2298
 
2299
- //function to get media counts
 
 
 
 
 
 
2300
  function get_media_counts() {
 
2301
  global $rtmedia_query;
 
2302
  $user_id = false;
 
2303
  if ( function_exists( 'bp_displayed_user_id' ) ) {
2304
  $user_id = bp_displayed_user_id();
2305
  } else {
@@ -2307,50 +2895,32 @@ function get_media_counts() {
2307
  $user_id = $rtmedia_query->query['context_id'];
2308
  }
2309
  }
2310
- $media_nav = new RTMediaNav( false );
2311
- $user_media_counts = $media_nav->get_counts( $user_id );
2312
 
2313
- $temp = $media_nav->actual_counts( $user_id );
 
2314
 
2315
  return $temp;
2316
- }
2317
-
2318
- add_action( 'wp_head', 'rtmedia_custom_css' );
2319
-
2320
- function rtmedia_custom_css() {
2321
- global $rtmedia;
2322
- $options = $rtmedia->options;
2323
- if ( ! empty( $options['styles_custom'] ) ) {
2324
- echo "<style type='text/css'> " . stripslashes( $options['styles_custom'] ) . ' </style>'; // @codingStandardsIgnoreLine
2325
- }
2326
- }
2327
-
2328
- add_action( 'wp_ajax_delete_uploaded_media', 'rtmedia_delete_uploaded_media' );
2329
-
2330
- function rtmedia_delete_uploaded_media() {
2331
 
2332
- $action = filter_input( INPUT_POST, 'action', FILTER_SANITIZE_STRING );
2333
- $nonce = filter_input( INPUT_POST, 'nonce', FILTER_SANITIZE_STRING );
2334
- $media_id = filter_input( INPUT_POST, 'media_id', FILTER_SANITIZE_NUMBER_INT );
2335
- if ( ! empty( $action ) && 'delete_uploaded_media' === $action && ! empty( $media_id ) ) {
2336
- if ( wp_verify_nonce( $nonce, 'rtmedia_' . get_current_user_id() ) ) {
2337
- $media = new RTMediaMedia();
2338
- $delete = $media->delete( $media_id );
2339
- echo '1';
2340
- wp_die();
2341
- }
2342
- }
2343
-
2344
- echo '0';
2345
- wp_die();
2346
  }
2347
 
 
 
 
 
 
 
 
 
 
2348
  function rtmedia_is_edit_page( $new_edit = null ) {
 
2349
  global $pagenow;
 
2350
  //make sure we are on the backend
2351
  if ( ! is_admin() ) {
2352
  return false;
2353
  }
 
2354
  if ( 'edit' === $new_edit ) {
2355
  return in_array( $pagenow, array( 'post.php' ), true );
2356
  } elseif ( 'new' === $new_edit ) { //check for new post page
@@ -2358,35 +2928,18 @@ function rtmedia_is_edit_page( $new_edit = null ) {
2358
  } else { //check for either new or edit
2359
  return in_array( $pagenow, array( 'post.php', 'post-new.php' ), true );
2360
  }
2361
- }
2362
 
2363
- //update the group media privacy according to the group privacy settings when group settings are changed
2364
- add_action( 'groups_settings_updated', 'update_group_media_privacy', 99, 1 );
2365
-
2366
- function update_group_media_privacy( $group_id ) {
2367
- if ( ! empty( $group_id ) && function_exists( 'groups_get_group' ) ) {
2368
- //get the buddybress group
2369
- $group = groups_get_group( array( 'group_id' => $group_id ) );
2370
- if ( isset( $group->status ) ) {
2371
- $update_sql = '';
2372
- $model = new RTMediaModel();
2373
- global $wpdb;
2374
- if ( 'public' !== $group->status ) {
2375
- // when group settings are updated and is private/hidden, set media privacy to 20
2376
- $update_sql = $wpdb->prepare( "UPDATE {$model->table_name} SET privacy = '20' where context='group' AND context_id=%d AND privacy <> 80 ", $group_id ); // @codingStandardsIgnoreLine
2377
- } else {
2378
- // when group settings are updated and is private/hidden, set media privacy to 0
2379
- $update_sql = $wpdb->prepare( "UPDATE {$model->table_name} SET privacy = '0' where context='group' AND context_id=%d AND privacy <> 80 ", $group_id ); // @codingStandardsIgnoreLine
2380
- }
2381
- //update the medias
2382
- $wpdb->query( $update_sql ); // @codingStandardsIgnoreLine
2383
- }
2384
- }
2385
  }
2386
 
2387
- /* check if rtMedia page */
2388
-
 
 
 
 
 
2389
  function is_rtmedia_page() {
 
2390
  if ( ! defined( 'RTMEDIA_MEDIA_SLUG' ) ) {
2391
  return false;
2392
  }
@@ -2402,9 +2955,16 @@ function is_rtmedia_page() {
2402
  }
2403
 
2404
  return $rtmedia_interaction->routes[ RTMEDIA_MEDIA_SLUG ]->is_template();
 
2405
  }
2406
 
2407
- // formatseconds function to be used in migration in importing
 
 
 
 
 
 
2408
  function rtmedia_migrate_formatseconds( $seconds_left ) {
2409
 
2410
  $minute_in_seconds = 60;
@@ -2418,7 +2978,6 @@ function rtmedia_migrate_formatseconds( $seconds_left ) {
2418
  $seconds_left = $seconds_left % $hour_in_seconds;
2419
 
2420
  $minutes = floor( $seconds_left / $minute_in_seconds );
2421
-
2422
  $seconds = $seconds_left % $minute_in_seconds;
2423
 
2424
  $time_components = array();
@@ -2438,6 +2997,7 @@ function rtmedia_migrate_formatseconds( $seconds_left ) {
2438
  if ( $seconds > 0 ) {
2439
  $time_components[] = $seconds . ' second' . ( $seconds > 1 ? 's' : '' );
2440
  }
 
2441
  if ( count( $time_components ) > 0 ) {
2442
  $formatted_time_remaining = implode( ', ', $time_components );
2443
  $formatted_time_remaining = trim( $formatted_time_remaining );
@@ -2446,36 +3006,50 @@ function rtmedia_migrate_formatseconds( $seconds_left ) {
2446
  }
2447
 
2448
  return $formatted_time_remaining;
 
2449
  }
2450
 
2451
  /**
2452
  * echo the size of the media file
2453
  *
2454
- * @global type $rtmedia_media
2455
- * @return int
 
 
2456
  */
2457
  function rtmedia_file_size() {
2458
 
2459
  global $rtmedia_backbone;
 
2460
  if ( $rtmedia_backbone['backbone'] ) {
2461
  echo '<%= file_size %>';
2462
  } else {
2463
  global $rtmedia_media;
 
2464
  if ( isset( $rtmedia_media->file_size ) ) {
2465
  return $rtmedia_media->file_size;
2466
  } else {
2467
  return filesize( get_attached_file( $rtmedia_media->media_id ) );
2468
  }
2469
  }
 
2470
  }
2471
 
2472
- /*
2473
- * get rtmedia media type from file extension
 
 
 
 
 
 
2474
  */
2475
-
2476
  function rtmedia_get_media_type_from_extn( $extn ) {
 
2477
  global $rtmedia;
 
2478
  $allowed_type = $rtmedia->allowed_types;
 
2479
  foreach ( $allowed_type as $type => $param ) {
2480
  if ( isset( $param['extn'] ) && is_array( $param['extn'] ) && in_array( $extn, $param['extn'], true ) ) {
2481
  return $type;
@@ -2483,29 +3057,23 @@ function rtmedia_get_media_type_from_extn( $extn ) {
2483
  }
2484
 
2485
  return false;
2486
- }
2487
 
2488
- add_filter( 'rtm_main_template_buddypress_enable', 'rtm_is_buddypress_enable', 10, 1 );
2489
-
2490
- function rtm_is_buddypress_enable( $flag ) {
2491
- global $rtmedia_query;
2492
- if ( isset( $rtmedia_query->query ) && isset( $rtmedia_query->query['context'] ) && 'group' === $rtmedia_query->query['context'] && is_rtmedia_group_media_enable() ) {
2493
- return $flag;
2494
- } else if ( isset( $rtmedia_query->query ) && isset( $rtmedia_query->query['context'] ) && 'profile' === $rtmedia_query->query['context'] && is_rtmedia_profile_media_enable() ) {
2495
- return $flag;
2496
- }
2497
-
2498
- return false;
2499
  }
2500
 
2501
- /*
2502
- * Function for getting extension from media id
 
 
 
 
 
 
2503
  */
2504
-
2505
  function rtmedia_get_extension( $media_id = false ) {
2506
  // If media_id is false then use global media_id
2507
  if ( ! $media_id ) {
2508
  global $rtmedia_media;
 
2509
  if ( isset( $rtmedia_media->media_id ) ) {
2510
  $media_id = $rtmedia_media->media_id;
2511
  } else {
@@ -2521,107 +3089,33 @@ function rtmedia_get_extension( $media_id = false ) {
2521
 
2522
  // return the extension of the filename
2523
  return $file_type['ext'];
2524
- }
2525
-
2526
- /*
2527
- * Function for no-popup class for rtmedia media gallery
2528
- */
2529
-
2530
- function rtmedia_add_no_popup_class( $class = '' ) {
2531
- return $class .= ' no-popup';
2532
- }
2533
-
2534
- // remove all the shortcode related hooks that we had added in RTMediaQuery.php file after gallery is loaded.
2535
- add_action( 'rtmedia_after_media_gallery', 'rtmedia_remove_media_query_hooks_after_gallery' );
2536
-
2537
- function rtmedia_remove_media_query_hooks_after_gallery() {
2538
- remove_filter( 'rtmedia_gallery_list_item_a_class', 'rtmedia_add_no_popup_class', 10, 1 );
2539
- remove_filter( 'rtmedia_media_gallery_show_media_title', 'rtmedia_gallery_do_not_show_media_title', 10, 1 );
2540
- }
2541
-
2542
- // this function is used in RTMediaQuery.php file for show title filter
2543
- function rtmedia_gallery_do_not_show_media_title( $flag ) {
2544
- return false;
2545
- }
2546
-
2547
- // we need to use show title filter when there is a request for template from rtMedia.backbone.js
2548
- add_filter( 'rtmedia_media_gallery_show_media_title', 'rtmedia_media_gallery_show_title_template_request', 10, 1 );
2549
-
2550
- function rtmedia_media_gallery_show_title_template_request( $flag ) {
2551
- if ( isset( $_REQUEST['media_title'] ) && 'false' === $_REQUEST['media_title'] ) {
2552
- return false;
2553
- }
2554
-
2555
- return $flag;
2556
- }
2557
-
2558
- // we need to use lightbox filter when there is a request for template from rtMedia.backbone.js
2559
- add_filter( 'rtmedia_gallery_list_item_a_class', 'rtmedia_media_gallery_lightbox_template_request', 10, 1 );
2560
-
2561
- function rtmedia_media_gallery_lightbox_template_request( $class ) {
2562
- if ( isset( $_REQUEST['lightbox'] ) && 'false' === $_REQUEST['lightbox'] ) {
2563
- return $class .= ' no-popup';
2564
- }
2565
 
2566
- return $class;
2567
  }
2568
 
2569
- // Function to get permalink for current blog
 
 
 
 
 
 
2570
  function rtmedia_get_current_blog_url( $domain ) {
 
2571
  $domain = get_home_url( get_current_blog_id() );
2572
 
2573
  return $domain;
2574
- }
2575
 
2576
- //Removing special characters and replacing accent characters with ASCII characters in filename before upload to server
2577
- add_action( 'rtmedia_upload_set_post_object', 'rtmedia_upload_sanitize_filename_before_upload', 10 );
2578
-
2579
- function rtmedia_upload_sanitize_filename_before_upload() {
2580
- add_action( 'sanitize_file_name', 'sanitize_filename_before_upload', 10, 1 );
2581
- }
2582
-
2583
- function sanitize_filename_before_upload( $filename ) {
2584
- $info = pathinfo( $filename );
2585
- $ext = empty( $info['extension'] ) ? '' : '.' . $info['extension'];
2586
- $name = basename( $filename, $ext );
2587
- $final_file_name = $name;
2588
-
2589
- $special_chars = array(
2590
- '?',
2591
- '[',
2592
- ']',
2593
- '/',
2594
- '\\',
2595
- '=',
2596
- '<',
2597
- '>',
2598
- ':',
2599
- ';',
2600
- ',',
2601
- "'",
2602
- '"',
2603
- '&',
2604
- '$',
2605
- '#',
2606
- '*',
2607
- '(',
2608
- ')',
2609
- '|',
2610
- '~',
2611
- '`',
2612
- '!',
2613
- '{',
2614
- '}',
2615
- chr( 0 ),
2616
- );
2617
- $special_chars = apply_filters( 'sanitize_file_name_chars', $special_chars, $final_file_name );
2618
- $string = str_replace( $special_chars, '-', $final_file_name );
2619
- $string = preg_replace( '/\+/', '', $string );
2620
-
2621
- return remove_accents( $string ) . $ext;
2622
  }
2623
 
 
 
 
 
 
 
 
2624
  function rtmedia_is_global_album( $album_id ) {
 
2625
  $rtmedia_global_albums = rtmedia_global_albums();
2626
 
2627
  if ( ! in_array( intval( $album_id ), $rtmedia_global_albums, true ) ) {
@@ -2629,80 +3123,57 @@ function rtmedia_is_global_album( $album_id ) {
2629
  } else {
2630
  return false;
2631
  }
2632
- }
2633
-
2634
- function rtmedia_is_uploader_view_allowed( $allow, $section = 'media_gallery' ) {
2635
- return apply_filters( 'rtmedia_allow_uploader_view', $allow, $section );
2636
- }
2637
-
2638
- function rtmedia_modify_activity_upload_url( $params ) {
2639
- // return original params if BuddyPress multilingual plugin is not active
2640
- include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
2641
- if ( function_exists( 'is_plugin_active' ) && is_plugin_active( 'buddypress-multilingual/sitepress-bp.php' ) ) {
2642
- if ( class_exists( 'BuddyPress' ) ) {
2643
- // change upload url only if it's activity page and if it's group page than it shouldn't group media page
2644
- if ( bp_is_activity_component() || ( bp_is_groups_component() && ! is_rtmedia_page() ) ) {
2645
- if ( function_exists( 'bp_get_activity_directory_permalink' ) ) {
2646
- $params['url'] = bp_get_activity_directory_permalink() . 'upload/';
2647
- }
2648
- }
2649
- }
2650
- }
2651
 
2652
- return $params;
2653
  }
2654
 
2655
- // Fix for BuddyPress multilingual plugin on activity pages
2656
- add_filter( 'rtmedia_modify_upload_params', 'rtmedia_modify_activity_upload_url', 999, 1 );
 
 
 
 
 
 
 
2657
 
2658
- add_action( 'rtmedia_admin_page_insert', 'rtmedia_admin_pages_content', 99, 1 );
2659
 
2660
- function rtmedia_admin_pages_content( $page ) {
2661
- if ( 'rtmedia-hire-us' === $page ) {
2662
- $url = admin_url() . 'admin.php?page=rtmedia-premium';
2663
- ?>
2664
- <div class="rtm-hire-us-container rtm-page-container">
2665
- <h3 class="rtm-setting-title rtm-show"><?php esc_html_e( 'You can consider rtMedia Team for following :', 'buddypress-media' ); ?></h3>
2666
-
2667
- <ol class="rtm-hire-points">
2668
- <li><?php esc_html_e( 'rtMedia Customization ( in Upgrade Safe manner )', 'buddypress-media' ); ?></li>
2669
- <li><?php esc_html_e( 'WordPress/BuddyPress Theme Design and Development', 'buddypress-media' ); ?></li>
2670
- <li><?php esc_html_e( 'WordPress/BuddyPress Plugin Development', 'buddypress-media' ); ?></li>
2671
- </ol>
2672
-
2673
- <div class="clearfix">
2674
- <a href="https://rtmedia.io/contact" class="rtm-button rtm-success"
2675
- target="_blank"><?php esc_html_e( 'Contact Us', 'buddypress-media' ); ?></a>
2676
- </div>
2677
- </div>
2678
- <?php
2679
- }
2680
  }
2681
 
2682
-
2683
- // Get rtMedia Encoding API Key
 
 
 
2684
  function get_rtmedia_encoding_api_key() {
 
2685
  return get_site_option( 'rtmedia-encoding-api-key' );
 
2686
  }
2687
 
2688
- /*
2689
  * Filter SQL query strings to swap out the 'meta_id' column.
2690
  *
2691
  * WordPress uses the meta_id column for commentmeta and postmeta, and so
2692
  * hardcodes the column name into its *_metadata() functions. rtMedia
2693
  * uses 'id' for the primary column. To make WP's functions usable for rtMedia,
2694
  * we use this filter on 'query' to swap all 'meta_id' with 'id.
 
 
 
 
2695
  */
2696
-
2697
  function rtm_filter_metaid_column_name( $q ) {
 
2698
  /*
2699
  * Replace quoted content with __QUOTE__ to avoid false positives.
2700
  * This regular expression will match nested quotes.
2701
  */
2702
  $quoted_regex = "/'[^'\\\\]*(?:\\\\.[^'\\\\]*)*'/s";
 
2703
  preg_match_all( $quoted_regex, $q, $quoted_matches );
2704
- $q = preg_replace( $quoted_regex, '__QUOTE__', $q );
2705
 
 
2706
  $q = str_replace( 'meta_id', 'id', $q );
2707
 
2708
  // Put quoted content back into the string.
@@ -2714,65 +3185,53 @@ function rtm_filter_metaid_column_name( $q ) {
2714
  }
2715
 
2716
  return $q;
 
2717
  }
2718
 
2719
- /*
2720
  * Checking if SCRIPT_DEBUG constant is defined or not
 
 
2721
  */
2722
  function rtm_get_script_style_suffix() {
 
2723
  $suffix = ( defined( 'SCRIPT_DEBUG' ) && constant( 'SCRIPT_DEBUG' ) === true ) ? '' : '.min';
2724
 
2725
  return $suffix;
2726
- }
2727
-
2728
- /**
2729
- * Adds delete nonce for all template file before tempalte load
2730
- */
2731
- add_action( 'rtmedia_before_template_load', 'rtmedia_add_media_delete_nonce' );
2732
- function rtmedia_add_media_delete_nonce() {
2733
- wp_nonce_field( 'rtmedia_' . get_current_user_id(), 'rtmedia_media_delete_nonce' );
2734
- }
2735
-
2736
-
2737
- /**
2738
- * 'rtmedia_before_template_load' will not fire for gallery shortcode
2739
- * To add delete nonce in gallery shortcode use rtmedia_pre_template hook
2740
- */
2741
- add_action( 'rtmedia_pre_template', 'rtmedia_add_media_delete_nonce_shortcode' );
2742
- //Adds delete nonce for gallery shortcode
2743
- function rtmedia_add_media_delete_nonce_shortcode() {
2744
- global $rtmedia_query;
2745
 
2746
- if ( isset( $rtmedia_query->is_gallery_shortcode ) && true === $rtmedia_query->is_gallery_shortcode ) {
2747
- wp_nonce_field( 'rtmedia_' . get_current_user_id(), 'rtmedia_media_delete_nonce' );
2748
- }
2749
  }
2750
 
2751
  /**
2752
  * To get list of allowed types in rtMedia
2753
- * @since 3.8.16
2754
  *
2755
- * @return array gives array of allowed types
 
 
 
 
2756
  */
2757
  function rtmedia_get_allowed_types() {
 
2758
  global $rtmedia;
2759
 
2760
  $allowed_media_type = $rtmedia->allowed_types;
2761
  $allowed_media_type = apply_filters( 'rtmedia_allowed_types', $allowed_media_type );
2762
 
2763
  return $allowed_media_type;
2764
- }
2765
 
 
2766
 
2767
  /**
2768
  * To get list of allowed upload types in rtMedia
2769
- * @since 3.8.16
2770
  *
2771
- * @return gives array of allowed upload types
 
 
2772
  */
2773
  function rtmedia_get_allowed_upload_types() {
2774
 
2775
  $allowed_types = rtmedia_get_allowed_types();
 
2776
  foreach ( $allowed_types as $type => $type_detail ) {
2777
  if ( ! ( function_exists( 'is_rtmedia_upload_' . $type . '_enabled' ) && call_user_func( 'is_rtmedia_upload_' . $type . '_enabled' ) ) ) {
2778
  unset( $allowed_types[ $type ] );
@@ -2780,28 +3239,31 @@ function rtmedia_get_allowed_upload_types() {
2780
  }
2781
 
2782
  return $allowed_types;
 
2783
  }
2784
 
2785
  /**
2786
  * To get list of allowed upload type name in rtMedia
2787
- * @since 3.8.16
2788
  *
2789
- * @return gives array of name of allowed upload media type
 
 
2790
  */
2791
  function rtmedia_get_allowed_upload_types_array() {
 
2792
  $allowed_types = rtmedia_get_allowed_upload_types();
2793
  $types = array_keys( $allowed_types );
2794
 
2795
  return $types;
 
2796
  }
2797
 
2798
  /**
2799
- *
2800
  * Upload and add media
2801
  *
2802
- * @param array $upload_params
2803
  *
2804
- * @return mixed $media_id
2805
  */
2806
  function rtmedia_add_media( $upload_params = array() ) {
2807
 
@@ -2816,60 +3278,40 @@ function rtmedia_add_media( $upload_params = array() ) {
2816
  $media_id = isset( $rtupload->media_ids[0] ) ? $rtupload->media_ids[0] : false;
2817
 
2818
  return $media_id;
 
2819
  }
2820
 
2821
  /**
2822
- *
2823
  * Add multiple meta key and value for media.
2824
  *
2825
- * @param $media_id
2826
- * @param $meta_key_val
2827
  *
2828
- * @return array
2829
  */
2830
  function rtmedia_add_multiple_meta( $media_id, $meta_key_val ) {
 
2831
  $meta_ids = array();
 
2832
  if ( ! empty( $media_id ) && ! empty( $meta_key_val ) ) {
2833
  $media_meta = new RTMediaMeta();
 
2834
  foreach ( $meta_key_val as $meta_key => $meta_val ) {
2835
  $meta_ids[] = $media_meta->add_meta( $media_id, $meta_key, $meta_val );
2836
- ;
2837
  }
2838
  }
2839
 
2840
  return $meta_ids;
2841
- }
2842
-
2843
- /**
2844
- * WordPress filter to change browser title if theme has title-tag support
2845
- *
2846
- * @param array $title
2847
- *
2848
- * @return array
2849
- */
2850
- function rtm_modify_document_title_parts( $title = array() ) {
2851
- if ( is_rtmedia_page() ) {
2852
- global $rtmedia_query;
2853
-
2854
- if ( isset( $rtmedia_query->action_query->media_type ) ) {
2855
- ( ! class_exists( 'BuddyPress' ) ) ? array_unshift( $title, ucfirst( $rtmedia_query->action_query->media_type ), RTMEDIA_MEDIA_LABEL ) : array_unshift( $title, ucfirst( $rtmedia_query->action_query->media_type ) );
2856
- } else {
2857
- ( ! class_exists( 'BuddyPress' ) ) ? array_unshift( $title, RTMEDIA_MEDIA_LABEL ) : '';
2858
- }
2859
- }
2860
 
2861
- return $title;
2862
  }
2863
 
2864
- add_filter( 'document_title_parts', 'rtm_modify_document_title_parts', 30, 1 );
2865
-
2866
  /**
2867
  * To get server variable
2868
  *
2869
- * @param $server_key string
2870
- * @param $filter_type string
2871
  *
2872
- * @return mixed
2873
  */
2874
  function rtm_get_server_var( $server_key, $filter_type = 'FILTER_SANITIZE_STRING' ) {
2875
 
@@ -2885,116 +3327,21 @@ function rtm_get_server_var( $server_key, $filter_type = 'FILTER_SANITIZE_STRING
2885
 
2886
  }
2887
 
2888
- /**
2889
- * Replace original src with the transcoded media src
2890
- * @param string $html
2891
- * @param object $rtmedia_media
2892
- *
2893
- * @return string
2894
- */
2895
- function replace_src_with_transcoded_file_url( $html, $rtmedia_media ) {
2896
-
2897
- if ( empty( $rtmedia_media->media_id ) ) {
2898
- return $html;
2899
- }
2900
-
2901
- $media_type = '';
2902
- $attachment_id = $rtmedia_media->media_id;
2903
-
2904
- if ( 'video' === $rtmedia_media->media_type ) {
2905
- $media_type = 'mp4';
2906
- } elseif ( 'music' === $rtmedia_media->media_type ) {
2907
- $media_type = 'mp3';
2908
- } else {
2909
- return $html;
2910
- }
2911
-
2912
- $medias = get_post_meta( $attachment_id, '_rt_media_transcoded_files', true );
2913
- if ( $file_url = rtt_is_video_exists( $medias, $media_type ) ) {
2914
- /* for WordPress backward compatibility */
2915
- if ( function_exists( 'wp_get_upload_dir' ) ) {
2916
- $uploads = wp_get_upload_dir();
2917
- } else {
2918
- $uploads = wp_upload_dir();
2919
- }
2920
- if ( 0 === strpos( $file_url, $uploads['baseurl'] ) ) {
2921
- $final_file_url = $file_url;
2922
- } else {
2923
- $final_file_url = $uploads['baseurl'] . '/' . $file_url;
2924
- }
2925
- $final_file_url = apply_filters( 'transcoded_file_url', $final_file_url, $attachment_id );
2926
- } else {
2927
- $final_file_url = wp_get_attachment_url( $attachment_id );
2928
- }
2929
- return preg_replace( "/src=[\"]([^\"]+)[\"]/", "src=\"$final_file_url\"", $html );
2930
-
2931
- }
2932
-
2933
- add_filter( 'rtmedia_single_content_filter', 'replace_src_with_transcoded_file_url', 100, 2 );
2934
-
2935
  /**
2936
  * Check if URL exists of a given media type (i.e mp4, ogg, wmv)
2937
  *
2938
- * @param array $medias
2939
- * @param string $media_type
2940
  *
2941
- * @return boolen|string
2942
  */
2943
  function rtt_is_video_exists( $medias, $media_type = 'mp4' ) {
 
2944
  if ( empty( $medias ) || empty( $media_type ) ) {
2945
  return false;
2946
  }
 
2947
  if ( isset( $medias[ $media_type ] ) && is_array( $medias[ $media_type ] ) && ! empty( $medias[ $media_type ][0] ) ) {
2948
  return $medias[ $media_type ][0];
2949
  }
2950
  }
2951
-
2952
- /**
2953
- * Gives the WordPress's default attachment URL if the base URL of the attachment is
2954
- * different than the WordPress's default base URL. e.g following URL
2955
- * https://s3.amazonaws.com/bucket-name/wp-content/uploads/2016/09/attachment.jpg
2956
- * will get replaced with
2957
- * http://www.wordpress-base.url/wp-content/uploads/2016/09/1473432502-small-10-1-16_1.jpg
2958
- *
2959
- * @param mixed $thumbnail_id It can be attachment URL or attachment ID
2960
- * @param string $media_type Media type
2961
- * @param int $media_id Attachment ID
2962
- *
2963
- * @return string Attachment URL if attachment URL is provided in the argument
2964
- */
2965
- function rtt_restore_og_wp_image_url( $thumbnail_id, $media_type, $media_id ) {
2966
- if ( is_numeric( $thumbnail_id ) ) {
2967
- return $thumbnail_id;
2968
- }
2969
- /**
2970
- * Fix for rtAmazon S3 addon
2971
- * When rtAmazon S3 is disabled we need to restore/replace the attachment URLS with the
2972
- * original WordPress URL structure
2973
- */
2974
- if ( ! class_exists( 'RTAWSS3_Class' ) && ! class_exists( 'AS3CF_Utils' ) ) {
2975
- /* for WordPress backward compatibility */
2976
- if ( function_exists( 'wp_get_upload_dir' ) ) {
2977
- $uploads = wp_get_upload_dir();
2978
- } else {
2979
- $uploads = wp_upload_dir();
2980
- }
2981
-
2982
- $baseurl = $uploads['baseurl'];
2983
-
2984
- $search = '/^(http|https)(.*)([wp\-content])(\/uploads\/)/i';
2985
- $replace = $baseurl . '/';
2986
-
2987
- $thumbnail_url = preg_replace( $search, $replace, $thumbnail_id );
2988
- if ( ! empty( $thumbnail_url ) ) {
2989
- $thumbnail_id = $thumbnail_url;
2990
- }
2991
- }
2992
- /**
2993
- * Apply filter to get amazon s3 URL
2994
- *
2995
- */
2996
- $final_file_url = apply_filters( 'transcoded_file_url', $thumbnail_id, $media_id );
2997
-
2998
- return $final_file_url;
2999
- }
3000
- add_filter( 'show_custom_album_cover', 'rtt_restore_og_wp_image_url', 100, 3 );
3
  /**
4
  * Checks at any point of time any media is left to be processed in the db pool
5
  *
6
+ * @global RTMediaQuery $rtmedia_query
7
+ *
8
+ * @return bool
9
  */
10
  function have_rtmedia() {
11
+
12
  global $rtmedia_query;
13
 
14
  return $rtmedia_query->have_media();
15
+
16
  }
17
 
18
  /**
19
+ * Rewinds the db pool of media album and resets it to beginning
20
+ *
21
+ * @global RTMediaQuery $rtmedia_query
22
  *
23
+ * @return bool
 
24
  */
25
  function rewind_rtmedia() {
26
 
27
  global $rtmedia_query;
28
 
29
  return $rtmedia_query->rewind_media();
30
+
31
  }
32
 
33
  /**
34
  * moves ahead in the loop of media within the album
35
  *
36
+ * @global RTMediaQuery $rtmedia_query
37
+ *
38
+ * @return object
39
  */
40
  function rtmedia() {
41
+
42
  global $rtmedia_query;
43
 
44
  return $rtmedia_query->rtmedia();
45
+
46
  }
47
 
48
  /**
49
  * echo the title of the media
50
  *
51
+ * @global array $rtmedia_backbone
52
+ * @global object $rtmedia_media
53
+ *
54
+ * @return string
55
  */
56
  function rtmedia_title() {
57
 
58
  global $rtmedia_backbone;
59
+
60
  if ( $rtmedia_backbone['backbone'] ) {
61
  echo '<%= media_title %>';
62
  } else {
64
 
65
  return stripslashes( esc_html( $rtmedia_media->media_title ) );
66
  }
67
+
68
  }
69
 
70
  /**
71
  * echo the album name of the media
72
  *
73
+ * @global object $rtmedia_media
74
+ *
75
+ * @return bool/string
76
  */
77
  function rtmedia_album_name() {
78
+
79
  global $rtmedia_media;
80
+
81
  if ( $rtmedia_media->album_id ) {
82
  if ( 'album' === rtmedia_type( $rtmedia_media->album_id ) ) {
83
  return get_rtmedia_title( $rtmedia_media->album_id );
87
  } else {
88
  return false;
89
  }
90
+
91
  }
92
 
93
+ /**
94
+ * Get Title for RTMedia Gallery
95
+ *
96
+ * @global RTMediaQuery $rtmedia_query
97
+ * @global RTMedia $rtmedia
98
+ *
99
+ * @return bool|string
100
+ */
101
  function get_rtmedia_gallery_title() {
102
+
103
  global $rtmedia_query, $rtmedia;
104
+
105
  $title = false;
106
+
107
  if ( isset( $rtmedia_query->query['media_type'] ) && 'album' === $rtmedia_query->query['media_type'] && isset( $rtmedia_query->media_query['album_id'] ) && '' !== $rtmedia_query->media_query['album_id'] ) {
108
  $id = $rtmedia_query->media_query['album_id'];
109
  $title = get_rtmedia_title( $id );
110
  } elseif ( isset( $rtmedia_query->media_query['media_type'] ) && ! is_array( $rtmedia_query->media_query['media_type'] ) && '' !== $rtmedia_query->media_query['media_type'] ) {
111
  $current_media_type = $rtmedia_query->media_query['media_type'];
112
+
113
  if ( ! empty( $current_media_type ) && is_array( $rtmedia->allowed_types ) && isset( $rtmedia->allowed_types[ $current_media_type ] ) && is_array( $rtmedia->allowed_types[ $current_media_type ] ) && isset( $rtmedia->allowed_types[ $current_media_type ]['plural_label'] ) ) {
114
  $title = sprintf( '%s %s', esc_html__( 'All', 'buddypress-media' ), $rtmedia->allowed_types[ $current_media_type ]['plural_label'] );
115
  }
116
  }
117
+
118
  $title = apply_filters( 'rtmedia_gallery_title', $title );
119
 
120
  return $title;
121
+
122
  }
123
 
124
+ /**
125
+ * Get media title using media ID
126
+ *
127
+ * @param int $id media id
128
+ *
129
+ * @return string
130
+ */
131
  function get_rtmedia_title( $id ) {
132
+
133
  $rtmedia_model = new RTMediaModel();
134
+ $title = $rtmedia_model->get( array(
135
+ 'id' => $id
136
+ ) );
137
 
138
  return $title[0]->media_title;
139
+
140
  }
141
 
142
+ /**
143
+ * Media author's profile pic
144
+ *
145
+ * @global array $rtmedia_backbone
146
+ * @global object $rtmedia_media
147
+ *
148
+ * @param bool $show_link
149
+ * @param bool $echo
150
+ * @param bool $author_id
151
+ *
152
+ * @return string
153
+ */
154
  function rtmedia_author_profile_pic( $show_link = true, $echo = true, $author_id = false ) {
155
+
156
  global $rtmedia_backbone;
157
+
158
  if ( $rtmedia_backbone['backbone'] ) {
159
  echo '';
160
  } else {
161
  if ( empty( $author_id ) ) {
162
  global $rtmedia_media;
163
+
164
  $author_id = $rtmedia_media->media_author;
165
  }
166
 
170
  if ( $show_link ) {
171
  $profile_pic .= "<a href='" . esc_url( get_rtmedia_user_link( $author_id ) ) . "' title='" . esc_attr( rtmedia_get_author_name( $author_id ) ) . "'>";
172
  }
173
+
174
  $size = apply_filters( 'rtmedia_single_media_profile_picture_size', 90 );
175
+
176
  if ( function_exists( 'bp_get_user_has_avatar' ) ) {
177
  if ( bp_core_fetch_avatar( array(
178
  'item_id' => $author_id,
179
  'object' => 'user',
180
  'no_grav' => false,
181
  'html' => false,
182
+ ) ) !== bp_core_avatar_default()
183
  ) {
184
  $profile_pic .= bp_core_fetch_avatar( array(
185
  'item_id' => $author_id,
190
  'height' => $size,
191
  ) );
192
  } else {
193
+ $profile_pic .= "<img src='" . esc_url( bp_core_avatar_default() ) . "' width='" . esc_attr( $size ) . "' height='" . esc_attr( $size ) . "' />";
194
  }
195
  } else {
196
  $profile_pic .= get_avatar( $author_id, $size );
197
  }
198
+
199
  if ( $show_link ) {
200
  $profile_pic .= '</a>';
201
  }
206
  return $profile_pic;
207
  }
208
  }
209
+
210
  }
211
 
212
+ /**
213
+ * Media's author link
214
+ *
215
+ * @global array $rtmedia_backbone
216
+ * @global object $rtmedia_media
217
+ *
218
+ * @param bool $show_link
219
+ */
220
  function rtmedia_author_name( $show_link = true ) {
221
 
222
  global $rtmedia_backbone;
223
+
224
  if ( $rtmedia_backbone['backbone'] ) {
225
  echo apply_filters( 'rtmedia_media_author_backbone', '', $show_link ); // @codingStandardsIgnoreLine
226
  } else {
227
  global $rtmedia_media;
228
+
229
  $show_link = apply_filters( 'rtmedia_single_media_show_profile_name_link', $show_link );
230
+
231
  if ( $show_link ) {
232
  echo "<a href='" . esc_url( get_rtmedia_user_link( $rtmedia_media->media_author ) ) . "' title='" . esc_attr( rtmedia_get_author_name( $rtmedia_media->media_author ) ) . "'>";
233
  }
234
+
235
  echo esc_html( rtmedia_get_author_name( $rtmedia_media->media_author ) );
236
+
237
  if ( $show_link ) {
238
  echo '</a>';
239
  }
240
  }
241
+
242
  }
243
 
244
+ /**
245
+ * Get media author name using user ID
246
+ *
247
+ * @param $user_id
248
+ *
249
+ * @return string
250
+ */
251
  function rtmedia_get_author_name( $user_id ) {
252
  if ( function_exists( 'bp_core_get_user_displayname' ) ) {
253
  return bp_core_get_user_displayname( $user_id );
254
  } else {
255
  $user = get_userdata( $user_id );
256
+
257
  if ( $user ) {
258
  return $user->display_name;
259
  }
260
  }
261
+
262
  }
263
 
264
+ /**
265
+ * Media Gallery CSS classes
266
+ *
267
+ * @global RTMediaQuery $rtmedia_query
268
+ */
269
  function rtmedia_media_gallery_class() {
270
+
271
  global $rtmedia_query;
272
+
273
  $classes = '';
274
+
275
  if ( isset( $rtmedia_query->media_query ) && isset( $rtmedia_query->media_query['context_id'] ) ) {
276
  $classes = 'context-id-' . esc_attr( $rtmedia_query->media_query['context_id'] );
277
  }
279
  echo esc_attr( apply_filters( 'rtmedia_gallery_class_filter', $classes ) );
280
  }
281
 
282
+ /**
283
+ * Get RTMedia ID using Post(Media) ID
284
+ *
285
+ * @global array $rtmedia_backbone
286
+ * @global object $rtmedia_media
287
+ *
288
+ * @param bool|int $media_id
289
+ *
290
+ * @return bool|string
291
+ */
292
  function rtmedia_id( $media_id = false ) {
293
+
294
  global $rtmedia_backbone;
295
 
296
  if ( $rtmedia_backbone['backbone'] ) {
299
 
300
  if ( $media_id ) {
301
  $model = new RTMediaModel();
302
+ $media = $model->get_media( array(
303
+ 'media_id' => $media_id
304
+ ), 0, 1 );
305
+
306
  if ( isset( $media ) && count( $media ) > 0 ) {
307
  return $media[0]->id;
308
  }
313
 
314
  return $rtmedia_media->id;
315
  }
316
+
317
  }
318
 
319
+ /**
320
+ * Get Post(Media) ID using RTMedia ID
321
+ *
322
+ * @global object $rtmedia_media
323
+ *
324
+ * @param bool|int $id
325
+ *
326
+ * @return int
327
+ */
328
  function rtmedia_media_id( $id = false ) {
329
+
330
  if ( $id ) {
331
  $model = new RTMediaModel();
332
+ $media = $model->get_media( array(
333
+ 'id' => $id
334
+ ), 0, 1 );
335
 
336
  return $media[0]->media_id;
337
  } else {
339
 
340
  return $rtmedia_media->media_id;
341
  }
342
+
343
  }
344
 
345
+ /**
346
+ * Get Media extension using ID
347
+ *
348
+ * @global object $rtmedia_media
349
+ *
350
+ * @param bool|int $id
351
+ *
352
+ * @return string
353
+ */
354
  function rtmedia_media_ext( $id = false ) {
355
+
356
  if ( $id ) {
357
  $model = new RTMediaModel();
358
+ $media = $model->get_media( array(
359
+ 'id' => $id
360
+ ), 0, 1 );
361
+
362
  if ( isset( $media[0] ) ) {
363
  $filepath = get_attached_file( $media[0]->media_id );
364
  $filetype = wp_check_filetype( $filepath );
373
 
374
  return $filetype['ext'];
375
  }
376
+
377
  }
378
 
379
+ /**
380
+ * Get Activity ID using Media ID
381
+ *
382
+ * @global object $rtmedia_media
383
+ *
384
+ * @param bool|int $id
385
+ *
386
+ * @return int
387
+ */
388
  function rtmedia_activity_id( $id = false ) {
389
+
390
  if ( $id ) {
391
  $model = new RTMediaModel();
392
+ $media = $model->get_media( array(
393
+ 'id' => $id
394
+ ), 0, 1 );
395
 
396
  return $media[0]->activity_id;
397
  } else {
399
 
400
  return $rtmedia_media->activity_id;
401
  }
402
+
403
  }
404
 
405
+ /**
406
+ * Get Media type using Media ID
407
+ *
408
+ * @global object $rtmedia_media
409
+ *
410
+ * @param bool|int $id
411
+ *
412
+ * @return bool|string
413
+ */
414
  function rtmedia_type( $id = false ) {
415
+
416
  if ( $id ) {
417
  $model = new RTMediaModel();
418
+ $media = $model->get_media( array(
419
+ 'id' => $id
420
+ ), 0, 1 );
421
+
422
  if ( isset( $media[0] ) && isset( $media[0]->media_type ) ) {
423
  return $media[0]->media_type;
424
  } else {
429
 
430
  return $rtmedia_media->media_type;
431
  }
432
+
433
  }
434
 
435
+ /**
436
+ * Get cover art using Media ID
437
+ *
438
+ * @global object $rtmedia_media
439
+ *
440
+ * @param bool|int $id
441
+ *
442
+ * @return string
443
+ */
444
  function rtmedia_cover_art( $id = false ) {
445
+
446
  if ( $id ) {
447
  $model = new RTMediaModel();
448
+ $media = $model->get_media( array(
449
+ 'id' => $id
450
+ ), 0, 1 );
451
 
452
  return $media[0]->cover_art;
453
  } else {
455
 
456
  return $rtmedia_media->cover_art;
457
  }
458
+
459
  }
460
 
461
  /**
462
  * echo parmalink of the media
463
  *
464
+ * @global array $rtmedia_backbone
465
+ *
466
+ * @param bool|int $media_id
467
  */
468
  function rtmedia_permalink( $media_id = false ) {
469
 
474
  } else {
475
  echo esc_url( get_rtmedia_permalink( rtmedia_id( $media_id ) ) );
476
  }
477
+
478
  }
479
 
480
  /**
481
  * echo parmalink of the album
482
  *
483
+ * @global object $rtmedia_media
484
  */
485
  function rtmedia_album_permalink() {
486
+
487
  global $rtmedia_media;
488
+
489
  echo esc_url( get_rtmedia_permalink( $rtmedia_media->album_id ) );
490
+
491
  }
492
 
493
+ /**
494
+ * Get media
495
+ *
496
+ * @global object $rtmedia_media
497
+ * @global RTMedia $rtmedia
498
+ *
499
+ * @param bool $size_flag
500
+ * @param bool $echo
501
+ * @param string $media_size
502
+ *
503
+ * @return bool|string
504
+ */
505
  function rtmedia_media( $size_flag = true, $echo = true, $media_size = 'rt_media_single_image' ) {
506
+
507
  $size_flag = true;
508
+
509
  global $rtmedia_media, $rtmedia;
510
+
511
  if ( isset( $rtmedia_media->media_type ) ) {
512
  if ( 'photo' === $rtmedia_media->media_type ) {
513
  $src = wp_get_attachment_image_src( $rtmedia_media->media_id, $media_size );
517
  $height = ( $height * 75 ) / 640;
518
  $size = ' width="' . esc_attr( $rtmedia->options['defaultSizes_video_singlePlayer_width'] ) . '" height="' . esc_attr( $height ) . '%" ';
519
  $html = "<div id='rtm-mejs-video-container' style='width:" . esc_attr( $rtmedia->options['defaultSizes_video_singlePlayer_width'] ) . 'px;height:' . esc_attr( $height ) . "%; max-width:96%;max-height:80%;'>";
520
+ $html .= '<video poster="" src="' . esc_url( wp_get_attachment_url( $rtmedia_media->media_id ) ) . '" ' . esc_attr( $size ) . ' type="video/mp4" class="wp-video-shortcode" id="bp_media_video_' . esc_attr( $rtmedia_media->id ) . '" controls="controls" preload="true"></video>';
521
+ $html .= '</div>';
522
  } elseif ( 'music' === $rtmedia_media->media_type ) {
523
  $width = $rtmedia->options['defaultSizes_music_singlePlayer_width'];
524
  $width = ( $width * 75 ) / 640;
525
  $size = ' width= ' . esc_attr( $width ) . '% height=30 ';
526
+
527
  if ( ! $size_flag ) {
528
  $size = '';
529
  }
530
+
531
  $html = '<audio src="' . esc_url( wp_get_attachment_url( $rtmedia_media->media_id ) ) . '" ' . esc_attr( $size ) . ' type="audio/mp3" class="wp-audio-shortcode" id="bp_media_audio_' . esc_attr( $rtmedia_media->id ) . '" controls="controls" preload="none"></audio>';
532
  } else {
533
  $html = false;
545
  } else {
546
  return $html;
547
  }
548
+
549
  }
550
 
551
+ /**
552
+ * Get media src
553
+ *
554
+ * @global array $rtmedia_backbone
555
+ * @global object $rtmedia_media
556
+ * @global RTMedia $rtmedia
557
+ *
558
+ * @param string $size
559
+ * @param bool|int $id
560
+ * @param bool $recho
561
+ *
562
+ * @return bool|int|string|void
563
  */
 
564
  function rtmedia_image( $size = 'rt_media_thumbnail', $id = false, $recho = true ) {
565
+
566
  global $rtmedia_backbone;
567
 
568
  if ( $rtmedia_backbone['backbone'] ) {
573
 
574
  if ( $id ) {
575
  $model = new RTMediaModel();
576
+ $media = $model->get_media( array(
577
+ 'id' => $id
578
+ ), false, false );
579
+
580
  if ( isset( $media[0] ) ) {
581
  $media_object = $media[0];
582
  } else {
584
  }
585
  } else {
586
  global $rtmedia_media;
587
+
588
  $media_object = $rtmedia_media;
589
  }
590
 
591
  $thumbnail_id = 0;
592
+
593
  if ( isset( $media_object->media_type ) ) {
594
  if ( 'album' === $media_object->media_type || 'photo' !== $media_object->media_type || 'video' === $media_object->media_type ) {
595
  $thumbnail_id = ( isset( $media_object->cover_art )
596
+ && ( ( false !== filter_var( $media_object->cover_art, FILTER_VALIDATE_URL ) ) // Cover art might be an absolute URL
597
+ || ( 0 !== intval( $media_object->cover_art ) ) // Cover art might be a media ID
598
+ ) ) ? $media_object->cover_art : false;
 
 
 
599
  $thumbnail_id = apply_filters( 'show_custom_album_cover', $thumbnail_id, $media_object->media_type, $media_object->id ); // for rtMedia pro users
600
  } elseif ( 'photo' === $media_object->media_type ) {
601
  $thumbnail_id = $media_object->media_id;
602
  } else {
603
  $thumbnail_id = false;
604
  }
605
+
606
  if ( 'music' === $media_object->media_type && empty( $thumbnail_id ) ) {
607
  $thumbnail_id = rtm_get_music_cover_art( $media_object );
608
  }
609
+
610
+ if ( 'music' === $media_object->media_type && -1 === intval( $thumbnail_id ) ) {
611
  $thumbnail_id = false;
612
  }
 
 
613
  }
614
 
615
  if ( ! $thumbnail_id ) {
616
  global $rtmedia;
617
+
618
  // Getting the extension of the uploaded file
619
  $extension = rtmedia_get_extension();
620
+
621
  // Checking if custom thumbnail for this file extension is set or not
622
  if ( isset( $rtmedia->allowed_types[ $media_object->media_type ] ) && isset( $rtmedia->allowed_types[ $media_object->media_type ]['ext_thumb'] ) && isset( $rtmedia->allowed_types[ $media_object->media_type ]['ext_thumb'][ $extension ] ) ) {
623
  $src = $rtmedia->allowed_types[ $media_object->media_type ]['ext_thumb'][ $extension ];
637
  }
638
 
639
  $src = apply_filters( 'rtmedia_media_thumb', $src, $media_object->id, $media_object->media_type );
640
+
641
  if ( true === $recho ) {
642
  echo esc_url( $src );
643
  } else {
644
  return $src;
645
  }
646
+
647
  }
648
 
649
+ /**
650
+ * Get media alt
651
+ *
652
+ * @global object $rtmedia_media
653
+ *
654
+ * @param bool|int $id
655
+ * @param bool $echo
656
+ *
657
+ * @return string
658
+ */
659
  function rtmedia_image_alt( $id = false, $echo = true ) {
660
+
 
661
  if ( $id ) {
662
  $model = new RTMediaModel();
663
+ $media = $model->get_media( array(
664
+ 'id' => $id
665
+ ), false, false );
666
+
667
  if ( isset( $media[0] ) ) {
668
  $media_object = $media[0];
669
  } else {
670
  return false;
671
  }
672
+
673
  $post_object = get_post( $media_object->media_id );
674
+
675
  if ( isset( $post_object->post_name ) ) {
676
  $img_alt = $post_object->post_name;
677
  } else {
679
  }
680
  } else {
681
  global $rtmedia_media;
682
+
683
+ if ( isset( $rtmedia_media->post_name ) ) {
684
+ $img_alt = $rtmedia_media->post_name;
685
  } else {
686
  $img_alt = ' ';
687
  }
688
  }
689
+
690
  if ( $echo ) {
691
  echo esc_attr( $img_alt );
692
  } else {
693
  return $img_alt;
694
  }
695
+
696
  }
697
 
698
+ /**
699
+ * Get album image
700
+ *
701
+ * @global object $rtmedia_media
702
+ * @global RTMediaQuery $rtmedia_query
703
+ * @global RTMedia $rtmedia
704
+ *
705
+ * @param string $size
706
+ * @param bool|int $id
707
+ *
708
+ * @return string
709
+ */
710
  function rtmedia_album_image( $size = 'thumbnail', $id = false ) {
711
+
712
+ global $rtmedia_media, $rtmedia_query;
713
+
714
  if ( false === $id ) {
715
  $id = $rtmedia_media->id;
716
  }
717
+
718
+ $model = new RTMediaModel();
719
+
720
  if ( isset( $rtmedia_query->query['context_id'] ) && isset( $rtmedia_query->query['context'] ) && 'group' !== $rtmedia_query->query['context'] ) {
721
  if ( 'profile' === $rtmedia_query->query['context'] ) {
722
  $media = $model->get_media( array(
741
  'context_id' => $rtmedia_query->query['context_id'],
742
  ), 0, 1 );
743
  } else {
744
+ $media = $model->get_media( array(
745
+ 'album_id' => $id,
746
+ 'media_type' => 'photo'
747
+ ), 0, 1 );
748
  }
749
  }
750
 
752
  $src = rtmedia_image( $size, $media[0]->id, false );
753
  } else {
754
  global $rtmedia;
755
+
756
  $src = $rtmedia->allowed_types['photo']['thumbnail'];
757
  }
758
 
759
  return $src;
760
+
761
  }
762
 
763
+ /**
764
+ * Get duration for media
765
+ *
766
+ * @global array $rtmedia_backbone
767
+ * @global object $rtmedia_media
768
+ *
769
+ * @param bool|int $id
770
+ *
771
+ * @return array|bool|mixed|null|string|void
772
+ */
773
  function rtmedia_duration( $id = false ) {
774
 
775
  global $rtmedia_backbone;
776
+
777
  if ( $rtmedia_backbone['backbone'] ) {
778
  echo '<%= duration %>';
779
 
782
 
783
  if ( $id ) {
784
  $model = new RTMediaModel();
785
+ $media = $model->get_media( array(
786
+ 'id' => $id
787
+ ), false, false );
788
+
789
  if ( isset( $media[0] ) ) {
790
  $media_object = $media[0];
791
  } else {
793
  }
794
  } else {
795
  global $rtmedia_media;
796
+
797
  $media_object = $rtmedia_media;
798
  }
799
 
800
  $duration = '';
801
+
802
  if ( ( 'video' === $media_object->media_type ) || ( 'music' === $media_object->media_type ) ) {
803
  $media_time = get_rtmedia_meta( $media_object->id, 'duration_time' );
804
+
805
  if ( false === $media_time || empty( $media_time ) ) {
806
  $filepath = get_attached_file( $media_object->media_id );
807
  $media_tags = new RTMediaTags( $filepath );
808
  $duration = $media_tags->duration;
809
+
810
  add_rtmedia_meta( $media_object->id, 'duration_time', $duration );
811
  } else {
812
  $duration = $media_time;
813
  }
814
+
815
  $duration = str_replace( '-:--', '', $duration );
816
  $duration = '<span class="rtmedia_time" >' . esc_attr( $duration ) . '</span>';
817
  }
818
 
819
  return $duration;
820
+
821
  }
822
 
823
+ /**
824
+ * Sanitizing object
825
+ *
826
+ * @param array $data
827
+ * @param array $exceptions
828
+ *
829
+ * @return array
830
+ */
831
  function rtmedia_sanitize_object( $data, $exceptions = array() ) {
832
+
833
  foreach ( $data as $key => $value ) {
834
  if ( ! in_array( $key, array_merge( RTMediaMedia::$default_object, $exceptions ), true ) ) {
835
  unset( $data[ $key ] );
837
  }
838
 
839
  return $data;
840
+
841
  }
842
 
843
+ /**
844
+ * Checking if delete media is allowed
845
+ *
846
+ * @global object $rtmedia_media
847
+ *
848
+ * @return bool
849
+ */
850
  function rtmedia_delete_allowed() {
851
+
852
  global $rtmedia_media;
853
 
854
  $flag = intval( $rtmedia_media->media_author ) === get_current_user_id();
864
  $flag = apply_filters( 'rtmedia_media_delete_priv', $flag );
865
 
866
  return $flag;
867
+
868
  }
869
 
870
+ /**
871
+ * Checking if edit media is allowed
872
+ *
873
+ * @global object $rtmedia_media
874
+ *
875
+ * @return bool
876
+ */
877
  function rtmedia_edit_allowed() {
878
 
879
  global $rtmedia_media;
887
  $flag = apply_filters( 'rtmedia_media_edit_priv', $flag );
888
 
889
  return $flag;
890
+
891
  }
892
 
893
+ /**
894
+ * Get media action like edit, delete
895
+ *
896
+ * @global RTMediaQuery $rtmedia_query
897
+ *
898
+ * @return string
899
+ */
900
  function rtmedia_request_action() {
901
+
902
  global $rtmedia_query;
903
 
904
  return $rtmedia_query->action_query->action;
905
+
906
  }
907
 
908
+ /**
909
+ * Get text-box for editing media title
910
+ *
911
+ * @global object $rtmedia_media
912
+ */
913
  function rtmedia_title_input() {
914
+
915
  global $rtmedia_media;
916
 
917
  $name = 'media_title';
918
  $value = stripslashes( esc_html( $rtmedia_media->media_title ) );
919
+ $html = '';
 
920
 
921
  if ( 'edit' === rtmedia_request_action() ) {
922
  $html .= '<input type="text" class="rtmedia-title-editor" name="' . esc_attr( $name ) . '" id="' . esc_attr( $name ) . '" value="' . esc_attr( $value ) . '">';
927
  $html .= '';
928
 
929
  echo $html; // @codingStandardsIgnoreLine
930
+
931
  }
932
 
933
+ /**
934
+ * Get text-area when editing media
935
+ *
936
+ * @global object $rtmedia_media
937
+ *
938
+ * @param bool $editor
939
+ * @param bool $echo
940
+ *
941
+ * @return string
942
+ */
943
  function rtmedia_description_input( $editor = true, $echo = false ) {
944
+
945
  global $rtmedia_media;
946
 
947
  $name = 'description';
948
+
949
  if ( isset( $rtmedia_media->post_content ) ) {
950
  $value = $rtmedia_media->post_content;
951
  } else {
954
  }
955
 
956
  $html = '';
957
+
958
  if ( $editor ) {
959
  if ( 'edit' === rtmedia_request_action() ) {
960
  ob_start();
963
  'textarea_rows' => 2,
964
  'quicktags' => false,
965
  ) );
966
+
967
  $html .= ob_get_clean();
968
  } else {
969
  $html .= '<div name="' . esc_attr( $name ) . '" id="' . esc_attr( $name ) . '">' . wp_kses_post( $value ) . '</div>';
971
  } else {
972
  $html .= "<textarea name='" . esc_attr( $name ) . "' id='" . esc_attr( $name ) . "' class='rtmedia-desc-textarea'>" . esc_textarea( $value ) . '</textarea>';
973
  }
974
+
975
  $html .= '';
976
+
977
  if ( $echo ) {
978
  echo $html; // @codingStandardsIgnoreLine
979
  } else {
980
  return $html;
981
  }
982
+
983
  }
984
 
985
  /**
986
  * echo media description
987
  *
988
+ * @param bool $echo
989
  *
990
+ * @return string
 
991
  */
992
  function rtmedia_description( $echo = true ) {
993
+
994
  if ( $echo ) {
995
  // escape description for any html tags and reformat using `wpautop`
996
  echo rtmedia_get_media_description();
997
  } else {
998
  return rtmedia_get_media_description();
999
  }
1000
+
1001
  }
1002
 
1003
+ /**
1004
+ * Get media description
1005
+ *
1006
+ * @global object $rtmedia_media
1007
+ *
1008
+ * @param bool $id
1009
+ *
1010
+ * @return string
1011
  */
1012
  function rtmedia_get_media_description( $id = false ) {
1013
+
1014
  if ( $id ) {
1015
  $media_post_id = rtmedia_media_id( $id );
1016
  } else {
1017
  global $rtmedia_media;
1018
+
1019
  $media_post_id = $rtmedia_media->media_id;
1020
  }
1021
 
1022
  /**
1023
  * This function will mostly be used in single media page.
1024
  * We are showing single media page using `the_content` filter and uses dummy post.
1025
+ * If we use `the_content` filter again than media description won't work as
1026
+ * this is already singe media request and hence using `wpautop` instead.
1027
  */
1028
  return wpautop( get_post_field( 'post_content', $media_post_id ) );
1029
+
1030
  }
1031
 
1032
  /**
1033
+ * Get total media count in the album
1034
+ *
1035
+ * @global RTMediaQuery $rtmedia_query
1036
  *
1037
+ * @return int
 
1038
  */
1039
  function rtmedia_count() {
1040
+
1041
  global $rtmedia_query;
1042
 
1043
  return $rtmedia_query->media_count;
1044
+
1045
  }
1046
 
1047
  /**
1048
+ * Get the page offset for the media pool
1049
  *
1050
+ * @global RTMediaQuery $rtmedia_query
1051
+ *
1052
+ * @return int
1053
  */
1054
  function rtmedia_offset() {
1055
+
1056
  global $rtmedia_query;
1057
 
1058
  return ( $rtmedia_query->action_query->page - 1 ) * $rtmedia_query->action_query->per_page_media;
1059
+
1060
  }
1061
 
1062
  /**
1063
+ * Get number of media per page to be displayed
1064
+ *
1065
+ * @global RTMediaQuery $rtmedia_query
1066
  *
1067
+ * @return int
 
1068
  */
1069
  function rtmedia_per_page_media() {
1070
+
1071
  global $rtmedia_query;
1072
 
1073
  return $rtmedia_query->action_query->per_page_media;
1074
+
1075
  }
1076
 
1077
  /**
1078
+ * Get the page number of media album in the pagination
1079
  *
1080
+ * @global RTMediaQuery $rtmedia_query
1081
+ *
1082
+ * @return int
1083
  */
1084
  function rtmedia_page() {
1085
+
1086
  global $rtmedia_query;
1087
 
1088
  return $rtmedia_query->action_query->page;
1089
+
1090
  }
1091
 
1092
  /**
1093
+ * Get the current media number in the album pool
1094
+ *
1095
+ * @global RTMediaQuery $rtmedia_query
1096
  *
1097
+ * @return string
 
1098
  */
1099
  function rtmedia_current_media() {
1100
+
1101
  global $rtmedia_query;
1102
 
1103
  return $rtmedia_query->current_media;
 
1104
 
1105
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1106
 
1107
+ /**
1108
+ * rtMedia edit form
1109
+ *
1110
+ * @return bool|string
1111
+ */
1112
  function rtmedia_edit_form() {
1113
 
1114
  if ( is_user_logged_in() && rtmedia_edit_allowed() ) {
 
1115
  $edit_button = '<button type="submit" class="rtmedia-edit rtmedia-action-buttons" >' . esc_html__( 'Edit', 'buddypress-media' ) . '</button>';
 
1116
  $edit_button = apply_filters( 'rtmedia_edit_button_filter', $edit_button );
1117
+ $button = '<form action="' . esc_url( get_rtmedia_permalink( rtmedia_id() ) ) . 'edit/">' . $edit_button . '</form>';
 
1118
 
1119
  return $button;
1120
  }
1121
 
1122
  return false;
1123
+
1124
  }
1125
 
1126
  /**
1127
+ * list of actions might be performed on media
1128
  */
1129
  function rtmedia_actions() {
1130
 
1131
  $actions = array();
1132
 
1133
  if ( is_user_logged_in() && rtmedia_edit_allowed() ) {
 
1134
  $edit_button = '<button type="submit" class="rtmedia-edit rtmedia-action-buttons button" >' . esc_html__( 'Edit', 'buddypress-media' ) . '</button>';
 
1135
  $edit_button = apply_filters( 'rtmedia_edit_button_filter', $edit_button );
1136
+ $actions[] = '<form action="' . esc_url( get_rtmedia_permalink( rtmedia_id() ) ) . 'edit/">' . $edit_button . '</form>';
 
1137
  }
1138
+
1139
  $actions = apply_filters( 'rtmedia_action_buttons_before_delete', $actions );
1140
+
1141
  foreach ( $actions as $action ) {
1142
  echo $action; // @codingStandardsIgnoreLine
1143
  }
1144
+
1145
  $actions = array();
1146
 
1147
  if ( rtmedia_delete_allowed() ) {
1153
  foreach ( $actions as $action ) {
1154
  echo $action; // @codingStandardsIgnoreLine
1155
  }
1156
+
1157
  do_action( 'after_rtmedia_action_buttons' );
1158
+
1159
  }
1160
 
1161
  /**
1162
+ * Rendering comments section
1163
+ *
1164
+ * @global object $rtmedia_media
1165
+ *
1166
+ * @param bool $echo
1167
+ *
1168
+ * @return string
1169
  */
1170
  function rtmedia_comments( $echo = true ) {
1171
 
1172
+ global $rtmedia_media;
 
 
 
 
1173
 
1174
+ $html = '<ul id="rtmedia_comment_ul" class="rtm-comment-list" data-action="' . esc_url( get_rtmedia_permalink( rtmedia_id() ) ) . 'delete-comment/">';
1175
+ $comments = get_comments( array(
1176
+ 'post_id' => $rtmedia_media->media_id,
1177
+ 'order' => 'ASC'
1178
+ ) );
1179
  $comment_list = '';
1180
+
1181
  foreach ( $comments as $comment ) {
1182
  $comment_list .= rmedia_single_comment( (array) $comment );
1183
  }
1195
  } else {
1196
  return $html;
1197
  }
1198
+
1199
  }
1200
 
1201
+ /**
1202
+ * Render single comment
1203
+ *
1204
+ * @global array $allowedtags
1205
+ * @global object $rtmedia_media
1206
+ *
1207
+ * @param array $comment
1208
+ *
1209
+ * @return string
1210
+ */
1211
  function rmedia_single_comment( $comment ) {
1212
+
1213
+ global $allowedtags, $rtmedia_media;
1214
+
1215
  $html = '';
1216
  $html .= '<li class="rtmedia-comment">';
1217
+
1218
  if ( $comment['user_id'] ) {
1219
  $user_link = "<a href='" . esc_url( get_rtmedia_user_link( $comment['user_id'] ) ) . "' title='" . esc_attr( rtmedia_get_author_name( $comment['user_id'] ) ) . "'>" . esc_html( rtmedia_get_author_name( $comment['user_id'] ) ) . '</a>';
1220
  $user_name = apply_filters( 'rtmedia_comment_author_name', $user_link, $comment );
1223
  $user_name = 'Annonymous';
1224
  $profile_pic = '';
1225
  }
1226
+
1227
  if ( ! empty( $profile_pic ) ) {
1228
  $html .= "<div class='rtmedia-comment-user-pic cleafix'>" . $profile_pic . '</div>';
1229
  }
1230
+
1231
  $html .= "<div class='rtm-comment-wrap'><div class='rtmedia-comment-details'>";
1232
+ $html .= '<span class ="rtmedia-comment-author">' . $user_name . '</span>';
1233
  $html .= '<span class ="rtmedia-comment-date"> ' . apply_filters( 'rtmedia_comment_date_format', rtmedia_convert_date( $comment['comment_date_gmt'] ), $comment ) . '</span>';
1234
 
1235
  $comment_string = wp_kses( $comment['comment_content'], $allowedtags );
1236
+
1237
  $html .= '<div class="rtmedia-comment-content">' . wpautop( make_clickable( apply_filters( 'bp_get_activity_content', $comment_string ) ) ) . '</div>';
1238
 
 
1239
  if ( is_rt_admin() || ( isset( $comment['user_id'] ) && ( get_current_user_id() === intval( $comment['user_id'] ) || intval( $rtmedia_media->media_author ) === get_current_user_id() ) ) || apply_filters( 'rtmedia_allow_comment_delete', false ) ) { // show delete button for comment author and admins
1240
  $html .= '<i data-id="' . esc_attr( $comment['comment_ID'] ) . '" class = "rtmedia-delete-comment dashicons dashicons-no-alt rtmicon" title="' . esc_attr__( 'Delete Comment', 'buddypress-media' ) . '"></i>';
1241
  }
1243
  $html .= '<div class="clear"></div></div></div></li>';
1244
 
1245
  return apply_filters( 'rtmedia_single_comment', $html, $comment );
1246
+
1247
  }
1248
 
1249
+ /**
1250
+ * Get media comment count using media ID
1251
+ *
1252
+ * @global wpdb $wpdb
1253
+ * @global object $rtmedia_media
1254
+ *
1255
+ * @param bool|int $media_id
1256
+ *
1257
+ * @return int
1258
+ */
1259
  function rtmedia_get_media_comment_count( $media_id = false ) {
1260
+
1261
  global $wpdb, $rtmedia_media;
1262
+
1263
  if ( ! $media_id ) {
1264
  $post_id = $rtmedia_media->media_id;
1265
  } else {
1266
  $post_id = rtmedia_media_id( $media_id );
1267
  }
1268
+
1269
  $query = $wpdb->prepare( "SELECT count(*) FROM $wpdb->comments WHERE comment_post_ID = %d", $post_id );
1270
  $comment_count = $wpdb->get_results( $query, ARRAY_N ); // @codingStandardsIgnoreLine
1271
+
1272
  if ( is_array( $comment_count ) && is_array( $comment_count[0] ) && isset( $comment_count[0][0] ) ) {
1273
  return $comment_count[0][0];
1274
  } else {
1275
  return 0;
1276
  }
1277
+
1278
  }
1279
 
1280
+ /**
1281
+ * Get previous media link
1282
+ *
1283
+ * @global object $rtmedia_interaction
1284
+ * @global RTMediaQuery $rtmedia_query
1285
+ *
1286
+ * @return string
1287
+ */
1288
  function rtmedia_pagination_prev_link() {
1289
 
1290
+ global $rtmedia_interaction, $rtmedia_query;
1291
 
1292
  $page_url = ( ( rtmedia_page() - 1 ) === 1 ) ? '' : 'pg/' . ( rtmedia_page() - 1 );
1293
  $site_url = ( is_multisite() ) ? trailingslashit( get_site_url( get_current_blog_id() ) ) : trailingslashit( get_site_url() );
1314
  $link .= RTMEDIA_MEDIA_SLUG . '/';
1315
 
1316
  if ( isset( $rtmedia_query->action_query->media_type ) ) {
1317
+ $media_type_array = array( 'photo', 'music', 'video', 'album', 'playlist' );
1318
+
1319
+ if ( in_array( $rtmedia_query->action_query->media_type, $media_type_array, true ) ) {
 
 
 
 
1320
  $link .= $rtmedia_query->action_query->media_type . '/';
1321
  }
1322
  }
1323
 
1324
  return apply_filters( 'rtmedia_pagination_prev_link', $link . $page_url, $link, $page_url );
1325
+
1326
  }
1327
 
1328
+ /**
1329
+ * Get next media link
1330
+ *
1331
+ * @global object $rtmedia_interaction
1332
+ * @global RTMediaQuery $rtmedia_query
1333
+ *
1334
+ * @return string
1335
+ */
1336
  function rtmedia_pagination_next_link() {
1337
 
1338
+ global $rtmedia_interaction, $rtmedia_query;
1339
 
1340
  $page_url = 'pg/' . ( rtmedia_page() + 1 );
1341
  $site_url = ( is_multisite() ) ? trailingslashit( get_site_url( get_current_blog_id() ) ) : trailingslashit( get_site_url() );
1351
  } else {
1352
  $user_id = bp_displayed_user_id();
1353
  }
1354
+
1355
  $link .= trailingslashit( bp_core_get_user_domain( $user_id ) );
1356
  } else {
1357
  $link .= $site_url . 'author/' . $author_name . '/';
1370
  $link .= $site_url . $post->post_name . '/';
1371
  }
1372
  }
1373
+
1374
  $link .= RTMEDIA_MEDIA_SLUG . '/';
1375
+
1376
  if ( isset( $rtmedia_query->media_query['album_id'] ) && intval( $rtmedia_query->media_query['album_id'] ) > 0 ) {
1377
  $link .= $rtmedia_query->media_query['album_id'] . '/';
1378
  }
1379
+
1380
  if ( isset( $rtmedia_query->action_query->media_type ) ) {
1381
+ $media_type_array = array( 'photo', 'music', 'video', 'album', 'playlist' );
1382
+
1383
+ if ( in_array( $rtmedia_query->action_query->media_type, $media_type_array, true ) ) {
 
 
 
 
1384
  $link .= $rtmedia_query->action_query->media_type . '/';
1385
  }
1386
  }
1387
 
1388
  return apply_filters( 'rtmedia_pagination_next_link', $link . $page_url, $link, $page_url );
1389
+
1390
  }
1391
 
1392
+ /**
1393
+ * get media page link
1394
+ *
1395
+ * @global object $rtmedia_interaction
1396
+ * @global RTMediaQuery $rtmedia_query
1397
+ *
1398
+ * @param string $page_no
1399
+ *
1400
+ * @return string
1401
+ */
1402
  function rtmedia_pagination_page_link( $page_no = '' ) {
1403
 
1404
+ global $rtmedia_interaction, $rtmedia_query;
1405
 
1406
  $page_url = 'pg/' . $page_no;
1407
  $site_url = ( is_multisite() ) ? trailingslashit( get_site_url( get_current_blog_id() ) ) : trailingslashit( get_site_url() );
1425
  $link .= $site_url . $post->post_name . '/';
1426
  }
1427
  }
1428
+
1429
  $link .= RTMEDIA_MEDIA_SLUG . '/';
1430
+
1431
  if ( isset( $rtmedia_query->media_query['album_id'] ) && intval( $rtmedia_query->media_query['album_id'] ) > 0 ) {
1432
  $link .= $rtmedia_query->media_query['album_id'] . '/';
1433
  }
1434
+
1435
  if ( isset( $rtmedia_query->action_query->media_type ) ) {
1436
+ $media_type_array = array( 'photo', 'music', 'video', 'album', 'playlist' );
1437
+
1438
+ if ( in_array( $rtmedia_query->action_query->media_type, $media_type_array, true ) ) {
 
 
 
 
1439
  $link .= $rtmedia_query->action_query->media_type . '/';
1440
  }
1441
  }
1442
 
1443
  return apply_filters( 'rtmedia_pagination_page_link', $link . $page_url, $link, $page_url );
1444
+
1445
  }
1446
 
1447
+ /**
1448
+ * Media pagination
1449
+ *
1450
+ * @global array $rtmedia_backbone
1451
+ */
1452
  function rtmedia_media_pagination() {
1453
+
1454
+ global $rtmedia_backbone;
1455
+
1456
  if ( $rtmedia_backbone['backbone'] ) {
1457
  echo '<%= pagination %>';
1458
  } else {
1459
  echo rtmedia_get_pagination_values(); // @codingStandardsIgnoreLine
1460
  }
1461
+
1462
  }
1463
 
1464
+ /**
1465
+ * Render pagination UI
1466
+ *
1467
+ * @global RTMedia $rtmedia
1468
+ * @global RTMediaQuery $rtmedia_query
1469
+ * @global int $paged
1470
+ *
1471
+ * @return string
1472
+ */
1473
  function rtmedia_get_pagination_values() {
 
1474
 
1475
+ global $rtmedia, $rtmedia_query, $paged;
1476
 
1477
+ $general_options = $rtmedia->options;
1478
+ $per_page = $general_options['general_perPageMedia'];
1479
 
1480
  if ( isset( $rtmedia_query->query['per_page'] ) ) {
1481
  $per_page = $rtmedia_query->query['per_page'];
1482
  }
 
 
 
1483
 
1484
+ $per_page = intval( $per_page );
1485
+ $range = 1;
1486
  $showitems = ( $range * 2 ) + 1;
1487
  $rtmedia_media_pages = '';
1488
 
 
 
1489
  if ( 0 === intval( rtmedia_offset() ) ) {
1490
  $paged = 1; // @codingStandardsIgnoreLine
1491
  } else if ( intval( rtmedia_offset() ) === $per_page ) {
1495
  }
1496
 
1497
  $pages = ceil( rtmedia_count() / $per_page );
1498
+
1499
  if ( ! $pages ) {
1500
  $pages = 1;
1501
  }
1502
+
1503
  $page_base_url = rtmedia_pagination_page_link();
1504
 
1505
  if ( 1 !== intval( $pages ) ) {
1506
  $rtmedia_media_pages .= "<div class='rtm-pagination clearfix'>";
 
1507
  $rtmedia_media_pages .= "<div class='rtmedia-page-no rtm-page-number'>";
1508
  $rtmedia_media_pages .= "<span class='rtm-label'>";
1509
  $rtmedia_media_pages .= esc_html( apply_filters( 'rtmedia_goto_page_label', esc_html__( 'Go to page no : ', 'buddypress-media' ) ) );
1513
  $rtmedia_media_pages .= "<input type='number' value='" . esc_attr( $paged ) . "' min='1' max='" . esc_attr( $pages ) . "' class='rtm-go-to-num' id='rtmedia_go_to_num' />";
1514
  $rtmedia_media_pages .= "<a class='rtmedia-page-link button' data-page-type='num' data-page-base-url='" . $page_base_url . "' href='#'>" . esc_html__( 'Go', 'buddypress-media' ) . '</a>';
1515
  $rtmedia_media_pages .= "</div><div class='rtm-paginate'>";
1516
+
1517
  if ( $paged > 1 && $showitems < $pages ) {
1518
  $page_url = ( ( rtmedia_page() - 1 ) == 1 ) ? '' : $page_base_url . ( rtmedia_page() - 1 );
1519
+
1520
  $rtmedia_media_pages .= "<a class='rtmedia-page-link' data-page-type='prev' href='" . esc_url( $page_url ) . "'><i class='dashicons dashicons-arrow-left-alt2'></i></a>";
1521
  }
1522
 
1523
  if ( $paged > 2 && $paged > $range + 1 && $showitems < $pages ) {
1524
  $page_url = $page_base_url . '1';
1525
+
1526
  $rtmedia_media_pages .= "<a class='rtmedia-page-link' data-page-type='page' data-page='1' href='" . esc_url( $page_url ) . "'>1</a><span>...</span>";
1527
  }
1528
 
1529
  for ( $i = 1; $i <= $pages; $i ++ ) {
1530
  if ( 1 != $pages && ( ! ( $i >= $paged + $range + 1 || $i <= $paged - $range - 1 ) || $pages <= $showitems ) ) {
1531
  $page_url = $page_base_url . $i;
1532
+
1533
  $rtmedia_media_pages .= ( $paged == $i ) ? "<span class='current'>" . esc_html( $i ) . '</span>' : "<a class='rtmedia-page-link' data-page-type='page' data-page='" . esc_attr( $i ) . "' href='" . esc_url( $page_url ) . "' class='inactive' >" . esc_html( $i ) . '</a>';
1534
  }
1535
  }
1536
 
1537
  if ( $paged < $pages - 1 && $paged + $range - 1 < $pages && $showitems < $pages ) {
1538
  $page_url = $page_base_url . $pages;
1539
+
1540
  $rtmedia_media_pages .= "<span>...</span><a class='rtmedia-page-link' data-page-type='page' data-page='" . esc_attr( $pages ) . "' href='" . esc_url( $page_url ) . "'>" . esc_html( $pages ) . '</a>';
1541
  }
1542
 
1543
  if ( $paged < $pages && $showitems < $pages ) {
1544
  $page_url = $page_base_url . ( rtmedia_page() + 1 );
1545
+
1546
  $rtmedia_media_pages .= "<a class='rtmedia-page-link' data-page-type='next' href='" . esc_url( $page_url ) . "'><i class='dashicons dashicons-arrow-right-alt2'></i></a>";
1547
  }
1548
 
1550
  }
1551
 
1552
  return $rtmedia_media_pages;
1553
+
1554
  }
1555
 
1556
+ /**
1557
+ * Checking if comments are enabled
1558
+ *
1559
+ * @global RTMedia $rtmedia
1560
+ *
1561
+ * @return bool
1562
+ */
1563
  function rtmedia_comments_enabled() {
1564
+
1565
  global $rtmedia;
1566
 
1567
  return $rtmedia->options['general_enableComments'];
1568
+
1569
  }
1570
 
1571
  /**
1572
+ * Checking if it's a rtmedia gallery
1573
+ *
1574
+ * @global RTMediaQuery $rtmedia_query
1575
  *
1576
+ * @return bool
1577
  */
1578
  function is_rtmedia_gallery() {
1579
+
1580
  global $rtmedia_query;
1581
+
1582
  if ( $rtmedia_query ) {
1583
  return $rtmedia_query->is_gallery();
1584
  } else {
1585
  return false;
1586
  }
1587
+
1588
  }
1589
 
1590
  /**
1591
+ * Checking if it's a album gallery
1592
+ *
1593
+ * @global RTMediaQuery $rtmedia_query
1594
  *
1595
+ * @return bool
1596
  */
1597
  function is_rtmedia_album_gallery() {
1598
+
1599
  global $rtmedia_query;
1600
+
1601
  if ( $rtmedia_query ) {
1602
  return $rtmedia_query->is_album_gallery();
1603
  } else {
1604
  return false;
1605
  }
1606
+
1607
  }
1608
 
1609
  /**
1610
+ * Checking if it's a single media
1611
+ *
1612
+ * @global RTMediaQuery $rtmedia_query
1613
  *
1614
+ * @return bool
1615
  */
1616
  function is_rtmedia_single() {
1617
+
1618
  global $rtmedia_query;
1619
+
1620
  if ( $rtmedia_query ) {
1621
  return $rtmedia_query->is_single();
1622
  } else {
1623
  return false;
1624
  }
1625
+
1626
  }
1627
 
1628
  /**
1629
+ * Checking if it's an album
1630
+ *
1631
+ * @global RTMediaQuery $rtmedia_query
1632
  *
1633
+ * @param bool|int $album_id
1634
+ *
1635
+ * @return bool
1636
  */
1637
  function is_rtmedia_album( $album_id = false ) {
1638
+
1639
  if ( $album_id ) {
1640
  $rtmedia_model = new RTMediaModel();
1641
+ $media = $rtmedia_model->get( array(
1642
+ 'id' => $album_id
1643
+ ) );
1644
+
1645
  if ( is_array( $media ) && isset( $media[0] ) && isset( $media[0]->media_type ) && 'album' === $media[0]->media_type ) {
1646
  return true;
1647
  }
1648
 
1649
  return false;
1650
  }
1651
+
1652
  global $rtmedia_query;
1653
+
1654
  if ( $rtmedia_query ) {
1655
  return $rtmedia_query->is_album();
1656
  } else {
1657
  return false;
1658
  }
1659
+
1660
  }
1661
 
1662
+ /**
1663
+ * Checking if it's a group album
1664
+ *
1665
+ * @global RTMediaQuery $rtmedia_query
1666
+ *
1667
+ * @return bool
1668
+ */
1669
  function is_rtmedia_group_album() {
1670
+
1671
  global $rtmedia_query;
1672
+
1673
  if ( $rtmedia_query ) {
1674
  return $rtmedia_query->is_group_album();
1675
  } else {
1676
  return false;
1677
  }
1678
+
1679
  }
1680
 
1681
  /**
1682
+ * Checking if edit is allowed
1683
+ *
1684
+ * @global RTMediaQuery $rtmedia_query
1685
  *
1686
+ * @return bool
1687
  */
1688
  function is_rtmedia_edit_allowed() {
1689
+
1690
  global $rtmedia_query;
1691
+
1692
  if ( $rtmedia_query ) {
1693
  if ( isset( $rtmedia_query->media_query['media_author'] ) && get_current_user_id() === intval( $rtmedia_query->media_query['media_author'] ) && 'edit' === $rtmedia_query->action_query->action ) {
1694
  return true;
1698
  } else {
1699
  return false;
1700
  }
1701
+
1702
  }
1703
 
1704
+ /**
1705
+ * Updating activity after thumbnail set
1706
+ *
1707
+ * @global wpdb $wpdb
1708
+ * @global BuddyPress $bp
1709
+ *
1710
+ * @param int $id
1711
+ */
1712
  function update_activity_after_thumb_set( $id ) {
1713
  $model = new RTMediaModel();
1714
  $media_obj = new RTMediaMedia();
1715
+ $media = $model->get( array(
1716
+ 'id' => $id
1717
+ ) );
1718
  $privacy = $media[0]->privacy;
1719
  $activity_id = rtmedia_activity_id( $id );
1720
+
1721
  if ( ! empty( $activity_id ) ) {
1722
+ $same_medias = $media_obj->model->get( array(
1723
+ 'activity_id' => $activity_id
1724
+ ) );
1725
  $update_activity_media = array();
1726
+
1727
  foreach ( $same_medias as $a_media ) {
1728
  $update_activity_media[] = $a_media->id;
1729
  }
1730
+
1731
  $obj_activity = new RTMediaActivity( $update_activity_media, $privacy, false );
1732
+
1733
  global $wpdb, $bp;
1734
+
1735
  $activity_old_content = bp_activity_get_meta( $activity_id, 'bp_old_activity_content' );
1736
+
1737
  if ( ! empty( $activity_old_content ) ) {
1738
  // get old activity content and save in activity meta
1739
+ $activity_get = bp_activity_get_specific( array(
1740
+ 'activity_ids' => $activity_id
1741
+ ) );
1742
  $activity = $activity_get['activities'][0];
1743
  $activity_body = $activity->content;
1744
+
1745
  bp_activity_update_meta( $activity_id, 'bp_old_activity_content', $activity_body );
1746
+
1747
  //extract activity text from old content
1748
  $activity_text = strip_tags( $activity_body, '<span>' );
1749
  $activity_text = explode( '</span>', $activity_text );
1750
  $activity_text = strip_tags( $activity_text[0] );
1751
+
1752
  bp_activity_update_meta( $activity_id, 'bp_activity_text', $activity_text );
1753
  }
1754
+
1755
  $activity_text = bp_activity_get_meta( $activity_id, 'bp_activity_text' );
1756
  $obj_activity->activity_text = $activity_text;
1757
+
1758
  $wpdb->update( $bp->activity->table_name, array(
1759
  'type' => 'rtmedia_update',
1760
  'content' => $obj_activity->create_activity_html(),
1761
+ ), array(
1762
+ 'id' => $activity_id
1763
+ ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1764
  }
 
 
 
 
 
 
1765
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1766
  }
1767
 
1768
+ /**
1769
+ * Updating video poster
1770
+ *
1771
+ * @param string $html
1772
+ * @param object $media
1773
+ * @param bool $activity
1774
+ *
1775
+ * @return string
1776
+ */
1777
  function update_video_poster( $html, $media, $activity = false ) {
1778
+
1779
  if ( 'video' === $media->media_type ) {
1780
  $thumbnail_id = $media->cover_art;
1781
+
1782
  if ( $thumbnail_id ) {
1783
  $thumbnail_info = wp_get_attachment_image_src( $thumbnail_id, 'full' );
1784
  $html = str_replace( '<video ', '<video poster="' . esc_url( $thumbnail_info[0] ) . '" ', $html );
1786
  }
1787
 
1788
  return $html;
1789
+
1790
  }
1791
 
1792
+ /**
1793
+ * Get video without thumbnail
1794
+ *
1795
+ * @global wpdb $wpdb
1796
+ *
1797
+ * @return string
1798
+ */
1799
  function get_video_without_thumbs() {
1800
+
1801
  global $wpdb;
1802
+
1803
+ $rtmedia_model = new RTMediaModel();
1804
+
1805
  $sql = $wpdb->prepare( "select media_id from {$rtmedia_model->table_name} where media_type = %s and blog_id = %d and cover_art is null", 'video', get_current_blog_id() ); // @codingStandardsIgnoreLine
1806
  $results = $wpdb->get_col( $sql ); // @codingStandardsIgnoreLine
1807
 
1808
  return $results;
1809
+
1810
  }
1811
 
1812
+ /**
1813
+ * Rendering single media comment form
1814
+ */
1815
  function rtmedia_comment_form() {
1816
+
1817
  if ( is_user_logged_in() ) {
1818
  ?>
1819
+ <form method="post" id="rt_media_comment_form" class="rt_media_comment_form" action="<?php echo esc_url( get_rtmedia_permalink( rtmedia_id() ) ); ?>comment/">
1820
+ <textarea style="width:100%" placeholder="<?php esc_attr_e( 'Type Comment...', 'buddypress-media' ); ?>" name="comment_content" id="comment_content"></textarea>
1821
+ <input type="submit" id="rt_media_comment_submit" class="rt_media_comment_submit" value="<?php esc_attr_e( 'Comment', 'buddypress-media' ); ?>">
 
 
 
 
 
1822
  <?php RTMediaComment::comment_nonce_generator(); ?>
1823
  </form>
1824
  <?php
1825
  }
1826
+
1827
  }
1828
 
1829
+ /**
1830
+ * Get cover srt using media ID
1831
+ *
1832
+ * @param int $id
1833
+ *
1834
+ * @return bool|string
1835
+ */
1836
  function rtmedia_get_cover_art_src( $id ) {
1837
+
1838
  $model = new RTMediaModel();
1839
+ $media = $model->get( array(
1840
+ 'id' => $id
1841
+ ) );
1842
  $cover_art = $media[0]->cover_art;
1843
+
1844
  if ( ! empty( $cover_art ) ) {
1845
  if ( is_numeric( $cover_art ) ) {
1846
  $thumbnail_info = wp_get_attachment_image_src( $cover_art, 'full' );
1852
  } else {
1853
  return false;
1854
  }
1855
+
1856
  }
1857
 
1858
+ /**
1859
+ * Rendering media delete form
1860
+ *
1861
+ * @param bool $echo
1862
+ *
1863
+ * @return bool|string
1864
+ */
1865
  function rtmedia_delete_form( $echo = true ) {
1866
 
1867
  if ( rtmedia_delete_allowed() ) {
 
1868
  $html = '<form method="post" action="' . esc_url( get_rtmedia_permalink( rtmedia_id() ) ) . 'delete/">';
1869
  $html .= '<input type="hidden" name="id" id="id" value="' . esc_attr( rtmedia_id() ) . '">';
1870
  $html .= '<input type="hidden" name="request_action" id="request_action" value="delete">';
1871
+
1872
  if ( $echo ) {
1873
  echo $html; // @codingStandardsIgnoreLine
1874
+
1875
  RTMediaMedia::media_nonce_generator( rtmedia_id(), true );
1876
+
1877
  do_action( 'rtmedia_media_single_delete_form' );
1878
+
1879
  echo '<button type="submit" title="' . esc_attr__( 'Delete Media', 'buddypress-media' ) . '" class="rtmedia-delete-media rtmedia-action-buttons button">' . esc_html__( 'Delete', 'buddypress-media' ) . '</button></form>';
1880
  } else {
1881
  $output = $html;
1882
  $rtm_nonce = RTMediaMedia::media_nonce_generator( rtmedia_id(), false );
1883
  $rtm_nonce = json_decode( $rtm_nonce );
1884
  $rtm_nonce_field = wp_nonce_field( 'rtmedia_' . rtmedia_id(), $rtm_nonce->action, true, false );
1885
+
1886
  do_action( 'rtmedia_media_single_delete_form' );
1887
+
1888
  $output .= $rtm_nonce_field . '<button type="submit" title="' . esc_attr__( 'Delete Media', 'buddypress-media' ) . '" class="rtmedia-delete-media rtmedia-action-buttons button">' . esc_html__( 'Delete', 'buddypress-media' ) . '</button></form>';
1889
 
1890
  return $output;
1892
  }
1893
 
1894
  return false;
1895
+
1896
  }
1897
 
1898
  /**
1899
+ * Rendering RTMedia Uploader
1900
  *
1901
+ * @param array|string $attr
1902
  */
1903
  function rtmedia_uploader( $attr = '' ) {
1904
+
1905
  if ( rtmedia_is_uploader_view_allowed( true, 'media_gallery' ) ) {
1906
  if ( function_exists( 'bp_is_blog_page' ) && ! bp_is_blog_page() ) {
1907
  if ( function_exists( 'bp_is_user' ) && bp_is_user() && function_exists( 'bp_displayed_user_id' ) && bp_displayed_user_id() === get_current_user_id() ) {
1917
  } else {
1918
  echo "<div class='rtmedia-upload-not-allowed'>" . wp_kses( apply_filters( 'rtmedia_upload_not_allowed_message', esc_html__( 'You are not allowed to upload/attach media.', 'buddypress-media' ), 'media_gallery' ), RTMediaUpload::$wp_kses_allowed_tags ) . '</div>';
1919
  }
1920
+
1921
  }
1922
 
1923
+ /**
1924
+ * Rendering RTMedia Gallery
1925
+ *
1926
+ * @param array|string $attr
1927
+ */
1928
  function rtmedia_gallery( $attr = '' ) {
1929
+
1930
  echo RTMediaGalleryShortcode::render( $attr ); // @codingStandardsIgnoreLine
1931
+
1932
  }
1933
 
1934
+ /**
1935
+ * Get meta data of media
1936
+ *
1937
+ * @param bool|int $id
1938
+ * @param bool|string $key
1939
+ *
1940
+ * @return bool
1941
+ */
1942
  function get_rtmedia_meta( $id = false, $key = false ) {
1943
+
1944
  if ( apply_filters( 'rtmedia_use_legacy_meta_function', false ) ) {
1945
  $rtmediameta = new RTMediaMeta();
1946
 
1951
 
1952
  // use WP's default get_metadata function replace column name from "media_id" to "id" in query
1953
  add_filter( 'query', 'rtm_filter_metaid_column_name' );
1954
+
1955
  $meta = get_metadata( 'media', $id, $key, $single );
1956
+
1957
  remove_filter( 'query', 'rtm_filter_metaid_column_name' );
1958
 
1959
  return $meta;
1960
  }
1961
+
1962
  }
1963
 
1964
+ /**
1965
+ * Add media meta
1966
+ *
1967
+ * @param bool|int $id
1968
+ * @param bool|string $key
1969
+ * @param bool|string $value
1970
+ * @param bool $duplicate
1971
+ *
1972
+ * @return bool|string
1973
+ */
1974
  function add_rtmedia_meta( $id = false, $key = false, $value = false, $duplicate = false ) {
1975
+
1976
  if ( apply_filters( 'rtmedia_use_legacy_meta_function', false ) ) {
1977
  $rtmediameta = new RTMediaMeta( $id, $key, $value, $duplicate );
1978
 
1980
  } else {
1981
  // use WP's default get_metadata function replace column name from "media_id" to "id" in query
1982
  add_filter( 'query', 'rtm_filter_metaid_column_name' );
1983
+
1984
  $meta = add_metadata( 'media', $id, $key, $value, ! $duplicate );
1985
+
1986
  remove_filter( 'query', 'rtm_filter_metaid_column_name' );
1987
 
1988
  return $meta;
1989
  }
1990
+
1991
  }
1992
 
1993
+ /**
1994
+ * Update media meta
1995
+ *
1996
+ * @param bool|int $id
1997
+ * @param bool|string $key
1998
+ * @param bool|string $value
1999
+ * @param bool $duplicate
2000
+ *
2001
+ * @return bool|string
2002
+ */
2003
+ function update_rtmedia_meta( $id = false, $key = false, $value = false, $duplicate = false ) {
2004
+
2005
+ if ( apply_filters( 'rtmedia_use_legacy_meta_function', false ) ) {
2006
+ $rtmediameta = new RTMediaMeta();
2007
 
2008
  return $rtmediameta->update_meta( $id, $key, $value, $duplicate );
2009
  } else {
2010
  // use WP's default get_metadata function replace column name from "media_id" to "id" in query
2011
  add_filter( 'query', 'rtm_filter_metaid_column_name' );
2012
+
2013
  $meta = update_metadata( 'media', $id, $key, $value, $duplicate );
2014
+
2015
  remove_filter( 'query', 'rtm_filter_metaid_column_name' );
2016
 
2017
  return $meta;
2018
  }
2019
+
2020
  }
2021
 
2022
+ /**
2023
+ * Delete media meta
2024
+ *
2025
+ * @param bool|int $id
2026
+ * @param bool|string $key
2027
+ *
2028
+ * @return array|bool
2029
+ */
2030
  function delete_rtmedia_meta( $id = false, $key = false ) {
2031
+
2032
  if ( apply_filters( 'rtmedia_use_legacy_meta_function', false ) ) {
2033
  $rtmediameta = new RTMediaMeta();
2034
 
2036
  } else {
2037
  // use WP's default get_metadata function replace column name from "media_id" to "id" in query
2038
  add_filter( 'query', 'rtm_filter_metaid_column_name' );
2039
+
2040
  $meta = delete_metadata( 'media', $id, $key );
2041
+
2042
  remove_filter( 'query', 'rtm_filter_metaid_column_name' );
2043
 
2044
  return $meta;
2045
  }
2046
  }
2047
 
2048
+ /**
2049
+ * Get global albums
2050
+ *
2051
+ * @return array
2052
+ */
2053
  function rtmedia_global_albums() {
2054
+
2055
  return RTMediaAlbum::get_globals();
2056
+
2057
  }
2058
 
2059
+ /**
2060
+ * Get global album list
2061
+ *
2062
+ * @param bool|int $selected_album_id
2063
+ *
2064
+ * @return null|string
2065
+ */
2066
  function rtmedia_global_album_list( $selected_album_id = false ) {
2067
+
2068
  $model = new RTMediaModel();
2069
  $global_albums = rtmedia_global_albums();
2070
 
2072
  $selected_album_id = $global_albums[0];
2073
  }
2074
 
2075
+ $option = null;
2076
+ $album_objects = $model->get_media( array(
2077
+ 'id' => $global_albums
2078
+ ), false, false );
2079
 
2080
  if ( $album_objects ) {
2081
  foreach ( $album_objects as $album ) {
2082
  //if selected_album_id is provided, keep that album_id selected by default
2083
  $selected = '';
2084
+
2085
  if ( ! empty( $selected_album_id ) && $selected_album_id === $album->id ) {
2086
  $selected = 'selected="selected"';
2087
  }
2088
+
2089
  $option .= '<option value="' . esc_attr( $album->id ) . '" ' . $selected . '>' . esc_html( $album->media_title ) . '</option>';
2090
  }
2091
  }
2092
 
2093
  return $option;
2094
+
2095
  }
2096
 
2097
+ /**
2098
+ * Get user's album list
2099
+ *
2100
+ * @global RTMediaQuery $rtmedia_query
2101
+ *
2102
+ * @param bool $get_all
2103
+ * @param bool|int $selected_album_id
2104
+ *
2105
+ * @return bool|string
2106
+ */
2107
  function rtmedia_user_album_list( $get_all = false, $selected_album_id = false ) {
2108
+
2109
  global $rtmedia_query;
 
 
 
2110
 
2111
+ $model = new RTMediaModel();
2112
+ $global_option = rtmedia_global_album_list( $selected_album_id );
2113
+ $global_albums = rtmedia_global_albums();
2114
  $album_objects = $model->get_media( array(
2115
  'media_author' => get_current_user_id(),
2116
  'media_type' => 'album',
2117
  ), false, 'context' );
2118
  $option_group = '';
2119
  $profile_option = '';
2120
+
2121
  if ( $album_objects ) {
2122
  foreach ( $album_objects as $album ) {
2123
+ if ( ! in_array( $album->id, array_map( 'intval', $global_albums ), true ) && ( ( isset( $rtmedia_query->media_query['album_id'] ) && ( $album->id !== $rtmedia_query->media_query['album_id'] || $get_all ) ) || ! isset( $rtmedia_query->media_query['album_id'] ) ) ) {
 
2124
  if ( 'profile' === $album->context ) {
2125
  $profile_option .= '<option value="' . esc_attr( $album->id ) . '" ' . selected( $selected_album_id, $album->id, false ) . '>' . esc_html( $album->media_title ) . '</option>';
2126
  }
2127
  }
2128
  }
2129
  }
2130
+
2131
  $option = apply_filters( 'rtmedia_global_albums_in_uploader', "$global_option" );
2132
+
2133
  if ( '' != $profile_option ) {
2134
  $option .= "<optgroup label='" . esc_attr__( 'Profile Albums', 'buddypress-media' ) . " ' value = 'profile'>$profile_option</optgroup>";
2135
  }
2136
+
2137
  if ( '' != $option_group && class_exists( 'BuddyPress' ) ) {
2138
  $option .= "<optgroup label='" . esc_attr__( 'Group Albums', 'buddypress-media' ) . "' value = 'group'>$option_group</optgroup>";
2139
  }
2140
+
2141
  if ( $option ) {
2142
  return $option;
2143
  } else {
2144
  return false;
2145
  }
2146
+
2147
  }
2148
 
2149
+ /**
2150
+ * Get group's album list
2151
+ *
2152
+ * @global RTMediaQuery $rtmedia_query
2153
+ *
2154
+ * @param bool|int $selected_album_id
2155
+ *
2156
+ * @return bool|null|string
2157
+ */
2158
  function rtmedia_group_album_list( $selected_album_id = false ) {
2159
  //by default, first album in list will be selected
2160
  global $rtmedia_query;
 
2161
 
2162
+ $model = new RTMediaModel();
2163
  $global_option = rtmedia_global_album_list( $selected_album_id );
2164
  $global_albums = rtmedia_global_albums();
 
2165
  $album_objects = $model->get_media( array(
2166
  'context' => $rtmedia_query->media_query['context'],
2167
  'context_id' => $rtmedia_query->media_query['context_id'],
2168
  'media_type' => 'album',
2169
  ), false, false );
2170
  $option_group = '';
2171
+
2172
  if ( $album_objects ) {
2173
  foreach ( $album_objects as $album ) {
2174
  if ( ! in_array( $album->id, $global_albums ) && ( ( isset( $rtmedia_query->media_query['album_id'] ) && ( $album->id != $rtmedia_query->media_query['album_id'] ) ) || ! isset( $rtmedia_query->media_query['album_id'] ) ) ) {
2176
  }
2177
  }
2178
  }
2179
+
2180
  $option = $global_option;
2181
+
2182
  if ( ! empty( $option_group ) ) {
2183
  $option .= "<optgroup label='" . esc_attr__( 'Group Albums', 'buddypress-media' ) . "' value = 'group'>$option_group</optgroup>";
2184
  }
2185
+
2186
  if ( $option ) {
2187
  return $option;
2188
  } else {
2189
  return false;
2190
  }
 
2191
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2192
  }
2193
 
2194
+ /**
2195
+ * Checking if album creation is allowed
2196
+ *
2197
+ * @return bool
2198
+ */
2199
  function rtm_is_album_create_allowed() {
2200
+
2201
  return apply_filters( 'rtm_is_album_create_enable', true );
2202
+
2203
  }
2204
 
2205
+ /**
2206
+ * Checking if user has an access to create an album
2207
+ *
2208
+ * @param bool|int $user_id
2209
+ *
2210
+ * @return bool
2211
+ */
2212
  function rtm_is_user_allowed_to_create_album( $user_id = false ) {
2213
+
2214
  if ( ! $user_id ) {
2215
  $user_id = get_current_user_id();
2216
  }
2217
 
2218
  return apply_filters( 'rtm_display_create_album_button', true, $user_id );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2219
 
 
2220
  }
2221
 
2222
+ /**
2223
+ * Checking if album is editable
2224
+ *
2225
+ * @global RTMediaQuery $rtmedia_query
2226
+ *
2227
+ * @return bool
2228
+ */
2229
+ function rtmedia_is_album_editable() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2230
 
 
 
 
 
 
 
2231
  global $rtmedia_query;
2232
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2233
  if ( isset( $rtmedia_query->query['context'] ) && 'profile' === $rtmedia_query->query['context'] ) {
2234
  if ( isset( $rtmedia_query->media_query['media_author'] ) && get_current_user_id() === intval( $rtmedia_query->media_query['media_author'] ) ) {
2235
  return true;
2236
  }
2237
  }
2238
+
2239
  if ( isset( $rtmedia_query->query['context'] ) && 'group' === $rtmedia_query->query['context'] ) {
2240
  if ( isset( $rtmedia_query->album[0]->media_author ) && get_current_user_id() === intval( $rtmedia_query->album[0]->media_author ) ) {
2241
  return true;
2243
  }
2244
 
2245
  return false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2246
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2247
  }
2248
 
2249
+ /**
2250
+ * Rendering sub nav
2251
+ *
2252
+ * @global RTMediaNav $rtMediaNav
2253
+ */
2254
  function rtmedia_sub_nav() {
2255
+
2256
  global $rtMediaNav;
2257
+
2258
  $rtMediaNav = new RTMediaNav();
2259
+
2260
  $rtMediaNav->sub_nav();
2261
+
2262
  }
2263
 
2264
+ /**
2265
+ * Checking if album is enable
2266
+ *
2267
+ * @global RTMedia $rtmedia
2268
+ *
2269
+ * @return bool
2270
+ */
2271
  function is_rtmedia_album_enable() {
2272
+
2273
  global $rtmedia;
2274
+
2275
  if ( isset( $rtmedia->options['general_enableAlbums'] ) && 0 !== intval( $rtmedia->options['general_enableAlbums'] ) ) {
2276
  return true;
2277
  }
2278
 
2279
  return false;
2280
+
2281
  }
2282
 
2283
+ /**
2284
+ * Loading right media template
2285
+ */
2286
  function rtmedia_load_template() {
2287
+
2288
  do_action( 'rtmedia_before_template_load' );
2289
+
2290
  include( RTMediaTemplate::locate_template() );
2291
+
2292
  do_action( 'rtmedia_after_template_load' );
2293
+
2294
  }
2295
 
2296
+ /**
2297
+ * Checking if privacy is enabled
2298
+ *
2299
+ * @global RTMedia $rtmedia
2300
+ *
2301
+ * @return bool
2302
+ */
2303
  function is_rtmedia_privacy_enable() {
2304
 
2305
  global $rtmedia;
2312
 
2313
  }
2314
 
2315
+ /**
2316
+ * Checking if user can override the existing privacy
2317
+ *
2318
+ * @global RTMedia $rtmedia
2319
+ *
2320
+ * @return bool
2321
+ */
2322
  function is_rtmedia_privacy_user_overide() {
2323
 
2324
  global $rtmedia;
2331
 
2332
  }
2333
 
2334
+ /**
2335
+ * Rendering privacy UI
2336
+ *
2337
+ * @global RTMediaQuery $rtmedia_query
2338
+ *
2339
+ * @return bool|string
2340
+ */
2341
  function rtmedia_edit_media_privacy_ui() {
2342
+
2343
  global $rtmedia_query;
2344
+
2345
  if ( isset( $rtmedia_query->query['context'] ) && 'group' === $rtmedia_query->query['context'] ) {
2346
  //if context is group i.e editing a group media, dont show the privacy dropdown
2347
  return false;
2348
  }
2349
+
2350
  $privacymodel = new RTMediaPrivacy( false );
2351
  $privacy = $privacymodel->select_privacy_ui( $echo = false );
2352
+
2353
  if ( $privacy ) {
2354
  return "<div class='rtmedia-edit-privacy rtm-field-wrap'><label for='privacy'>" . esc_html__( 'Privacy : ', 'buddypress-media' ) . '</label>' . $privacy . '</div>';
2355
  }
2356
+
2357
  }
2358
 
2359
+ /**
2360
+ * Get default privacy
2361
+ *
2362
+ * @global RTMedia $rtmedia
2363
+ *
2364
+ * @return int
2365
+ */
2366
  function get_rtmedia_default_privacy() {
2367
 
2368
  global $rtmedia;
2369
+
2370
  if ( isset( $rtmedia->options['privacy_default'] ) ) {
2371
  return $rtmedia->options['privacy_default'];
2372
  }
2373
 
2374
  return 0;
2375
+
2376
  }
2377
 
2378
+ /**
2379
+ * Checking if media is enabled in BuddyPress group
2380
+ *
2381
+ * @global RTMedia $rtmedia
2382
+ *
2383
+ * @return bool
2384
+ */
2385
  function is_rtmedia_group_media_enable() {
2386
+
2387
  global $rtmedia;
2388
+
2389
  if ( isset( $rtmedia->options['buddypress_enableOnGroup'] ) && 0 !== intval( $rtmedia->options['buddypress_enableOnGroup'] ) ) {
2390
  return true;
2391
  }
2393
  return false;
2394
  }
2395
 
2396
+ /**
2397
+ * Checking if media is enabled in BuddyPress Member's profile
2398
+ *
2399
+ * @global RTMedia $rtmedia
2400
+ *
2401
+ * @return bool
2402
+ */
2403
  function is_rtmedia_profile_media_enable() {
2404
+
2405
  global $rtmedia;
2406
+
2407
  if ( isset( $rtmedia->options['buddypress_enableOnProfile'] ) && 0 !== intval( $rtmedia->options['buddypress_enableOnProfile'] ) ) {
2408
  return true;
2409
  }
2410
 
2411
  return false;
2412
+
2413
  }
2414
 
2415
+ /**
2416
+ * Checking if user in group component
2417
+ *
2418
+ * @global RTMediaQuery $rtmedia_query
2419
+ *
2420
+ * @return bool
2421
+ */
2422
  function is_rtmedia_bp_group() {
2423
+
2424
  global $rtmedia_query;
2425
+
2426
  if ( isset( $rtmedia_query->query['context'] ) && 'group' === $rtmedia_query->query['context'] ) {
2427
  return true;
2428
  }
2429
 
2430
  return false;
2431
+
2432
  }
2433
 
2434
+ /**
2435
+ * Checking if user in profile component
2436
+ *
2437
+ * @global RTMediaQuery $rtmedia_query
2438
+ *
2439
+ * @return bool
2440
+ */
2441
  function is_rtmedia_bp_profile() {
2442
+
2443
  global $rtmedia_query;
2444
+
2445
  if ( isset( $rtmedia_query->query['context'] ) && 'profile' == $rtmedia_query->query['context'] ) {
2446
  return true;
2447
  }
2448
 
2449
  return false;
2450
+
2451
  }
2452
 
2453
+ /**
2454
+ * Checking if user can upload in BuddyPress group
2455
+ *
2456
+ * @return bool
2457
+ */
2458
  function can_user_upload_in_group() {
2459
+
2460
  $group = groups_get_current_group();
 
2461
  $user_id = get_current_user_id();
2462
  $display_flag = false;
2463
+
2464
  if ( groups_is_user_member( $user_id, $group->id ) ) {
2465
  $display_flag = true;
2466
  }
2467
+
2468
  $display_flag = apply_filters( 'rtm_can_user_upload_in_group', $display_flag );
2469
 
2470
  return $display_flag;
2471
+
2472
  }
2473
 
2474
  /**
2475
+ * Checking if user can create an album in BuddyPress group
2476
  *
2477
+ * @param bool|int $group_id
2478
+ * @param bool|int $user_id
2479
  *
2480
+ * @return bool
2481
  */
2482
  function can_user_create_album_in_group( $group_id = false, $user_id = false ) {
2483
+
2484
  if ( false == $group_id ) {
2485
  $group = groups_get_current_group();
2486
  $group_id = $group->id;
2487
  }
2488
+
2489
  $upload_level = groups_get_groupmeta( $group_id, 'rt_media_group_control_level' );
2490
+
2491
  if ( empty( $upload_level ) ) {
2492
  $upload_level = groups_get_groupmeta( $group_id, 'bp_media_group_control_level' );
2493
+
2494
  if ( empty( $upload_level ) ) {
2495
  $upload_level = 'all';
2496
  }
2497
  }
2498
+
2499
  $user_id = get_current_user_id();
2500
  $display_flag = false;
2501
+
2502
  if ( groups_is_user_member( $user_id, $group_id ) ) {
2503
  if ( 'admin' === $upload_level ) {
2504
  if ( groups_is_user_admin( $user_id, $group_id ) > 0 ) {
2514
  }
2515
  }
2516
  }
2517
+
2518
  $display_flag = apply_filters( 'can_user_create_album_in_group', $display_flag );
2519
 
2520
  return $display_flag;
2521
+
2522
  }
2523
 
2524
+ /**
2525
+ * Checking if video upload is allowed
2526
+ *
2527
+ * @global RTMedia $rtmedia
2528
+ *
2529
+ * @return bool
2530
+ */
2531
  function is_rtmedia_upload_video_enabled() {
2532
+
2533
  global $rtmedia;
2534
+
2535
  if ( isset( $rtmedia->options['allowedTypes_video_enabled'] ) && 0 !== intval( $rtmedia->options['allowedTypes_video_enabled'] ) ) {
2536
  return true;
2537
  }
2539
  return false;
2540
  }
2541
 
2542
+ /**
2543
+ * Checking if photo upload is allowed
2544
+ *
2545
+ * @global RTMedia $rtmedia
2546
+ *
2547
+ * @return bool
2548
+ */
2549
  function is_rtmedia_upload_photo_enabled() {
2550
+
2551
  global $rtmedia;
2552
+
2553
  if ( isset( $rtmedia->options['allowedTypes_photo_enabled'] ) && 0 !== intval( $rtmedia->options['allowedTypes_photo_enabled'] ) ) {
2554
  return true;
2555
  }
2556
 
2557
  return false;
2558
+
2559
  }
2560
 
2561
+ /**
2562
+ * Checking if music upload is allowed
2563
+ *
2564
+ * @global RTMedia $rtmedia
2565
+ *
2566
+ * @return bool
2567
+ */
2568
  function is_rtmedia_upload_music_enabled() {
2569
+
2570
  global $rtmedia;
2571
+
2572
  if ( isset( $rtmedia->options['allowedTypes_music_enabled'] ) && 0 !== intval( $rtmedia->options['allowedTypes_music_enabled'] ) ) {
2573
  return true;
2574
  }
2575
 
2576
  return false;
2577
+
2578
  }
2579
 
2580
+ /**
2581
+ * Get allowed media upload type
2582
+ *
2583
+ * @global RTMedia $rtmedia
2584
+ *
2585
+ * @return string
2586
+ */
2587
  function get_rtmedia_allowed_upload_type() {
2588
+
2589
  global $rtmedia;
2590
+
2591
  $allow_type_str = '';
2592
  $sep = '';
 
2593
 
2594
+ foreach ( $rtmedia->allowed_types as $type ) {
2595
  if ( function_exists( 'is_rtmedia_upload_' . $type['name'] . '_enabled' ) && call_user_func( 'is_rtmedia_upload_' . $type['name'] . '_enabled' ) ) {
2596
  foreach ( $type['extn'] as $extn ) {
2597
  $allow_type_str .= $sep . $extn;
2598
+
2599
  $sep = ',';
2600
  }
2601
  }
2602
  }
2603
 
2604
  return $allow_type_str;
2605
+
2606
  }
2607
 
2608
+ /**
2609
+ * Checking if is admin
2610
+ *
2611
+ * @return bool
2612
+ */
2613
  function is_rt_admin() {
2614
+
2615
  return current_user_can( 'list_users' );
2616
+
2617
  }
2618
 
2619
+ /**
2620
+ * Get media like count
2621
+ *
2622
+ * @param bool|int $media_id
2623
+ *
2624
+ * @return array|int
2625
+ */
2626
  function get_rtmedia_like( $media_id = false ) {
2627
+
2628
  $mediamodel = new RTMediaModel();
2629
+ $actions = $mediamodel->get( array(
2630
+ 'id' => rtmedia_id( $media_id )
2631
+ ) );
2632
 
2633
  if ( isset( $actions[0]->likes ) ) {
2634
  $actions = intval( $actions[0]->likes );
2637
  }
2638
 
2639
  return $actions;
2640
+
2641
  }
2642
 
2643
+ /**
2644
+ * Show media like count
2645
+ *
2646
+ * @global RTMedia $rtmedia
2647
+ */
2648
  function show_rtmedia_like_counts() {
2649
+
2650
  global $rtmedia;
2651
+
2652
  $options = $rtmedia->options;
2653
  $count = get_rtmedia_like();
2654
+
2655
  if ( ! ( isset( $options['general_enableLikes'] ) && 0 === intval( $options['general_enableLikes'] ) ) ) {
2656
+ $class = '';
2657
+
2658
  if ( ! intval( $count ) ) {
2659
+ $class = 'hide';
2660
  }
2661
+ ?>
2662
+ <div class='rtmedia-like-info <?php echo $class; ?>'>
2663
+ <i class="rtmicon-thumbs-up rtmicon-fw"></i> <span class="rtmedia-like-counter-wrap"><span class="rtmedia-like-counter"><?php echo esc_html( $count ); ?></span> <?php esc_html_e( 'people like this', 'buddypress-media' ); ?></span>
2664
  </div>
2665
  <?php
2666
  }
 
 
 
 
2667
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2668
  }
2669
 
2670
+ /**
2671
+ * Get music cover art
2672
+ *
2673
+ * @param object $media_object
2674
+ *
2675
+ * @return bool|string
2676
+ */
2677
  function rtm_get_music_cover_art( $media_object ) {
2678
+
2679
  // return URL if cover_art already set.
2680
  $url = $media_object->cover_art;
2681
+
2682
  if ( ! empty( $url ) && ! is_numeric( $url ) ) {
2683
  return $url;
2684
  }
2685
 
2686
  // return false if covert_art is already analyzed earlier
2687
+ if ( -1 === intval( $url ) ) {
2688
  return false;
2689
  }
2690
 
2691
  // Analyze media for the first time and set cover_art into database.
2692
+ $file = get_attached_file( $media_object->media_id );
2693
+ $media_obj = new RTMediaMedia();
 
2694
  $media_tags = new RTMediaTags( $file );
2695
  $title_info = $media_tags->title;
2696
  $image_info = $media_tags->image;
2697
  $image_mime = $image_info['mime'];
2698
  $mime = explode( '/', $image_mime );
2699
  $id = $media_object->id;
 
2700
 
2701
+ if ( ! empty( $image_info['data'] ) ) {
2702
  $thumb_upload_info = wp_upload_bits( $title_info . '.' . $mime[ count( $mime ) - 1 ], null, $image_info['data'] );
2703
+
2704
  if ( is_array( $thumb_upload_info ) && ! empty( $thumb_upload_info['url'] ) ) {
2705
+ $media_obj->model->update( array(
2706
+ 'cover_art' => $thumb_upload_info['url']
2707
+ ), array(
2708
+ 'id' => $id
2709
+ ) );
2710
+
2711
  return $thumb_upload_info['url'];
2712
  }
2713
  }
2714
 
2715
+ $media_obj->model->update( array(
2716
+ 'cover_art' => '-1'
2717
+ ), array(
2718
+ 'id' => $id
2719
+ ) );
2720
 
2721
  return false;
2722
+
2723
  }
2724
 
2725
  /**
2726
  * "get_music_cover_art" is too generic function name. It shouldn't added in very first place.
2727
  * It is renamed as "rtm_get_music_cover_art"
2728
+ *
2729
+ * @return bool
2730
  */
2731
+ if ( ! function_exists( 'get_music_cover_art' ) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2732
 
2733
+ function get_music_cover_art( $file, $id ) {
 
2734
 
2735
+ return false;
 
2736
 
 
 
 
 
2737
  }
2738
+
2739
  }
2740
 
2741
+ /**
2742
+ * Get the media privacy symbol
2743
+ *
2744
+ * @param bool|int $rtmedia_id
2745
+ *
2746
+ * @return string
2747
+ */
2748
  function get_rtmedia_privacy_symbol( $rtmedia_id = false ) {
2749
+
2750
  $mediamodel = new RTMediaModel();
2751
+ $actions = $mediamodel->get( array(
2752
+ 'id' => rtmedia_id( $rtmedia_id )
2753
+ ) );
2754
  $privacy = '';
2755
+
2756
  if ( intval( $actions[0]->privacy ) >= 0 ) {
2757
  $title = $icon = '';
2758
 
2760
  case 0: // public
2761
  $title = esc_html__( 'Public', 'buddypress-media' );
2762
  $icon = 'dashicons dashicons-admin-site rtmicon';
2763
+
2764
  break;
2765
  case 20: // users
2766
  $title = esc_html__( 'All members', 'buddypress-media' );
2767
  $icon = 'dashicons dashicons-groups rtmicon';
2768
+
2769
  break;
2770
  case 40: // friends
2771
  $title = esc_html__( 'Your friends', 'buddypress-media' );
2772
  $icon = 'dashicons dashicons-networking rtmicon';
2773
+
2774
  break;
2775
  case 60: // private
2776
  $title = esc_html__( 'Only you', 'buddypress-media' );
2777
  $icon = 'dashicons dashicons-lock rtmicon';
2778
+
2779
  break;
2780
  case 80: // private
2781
  $title = esc_html__( 'Blocked temporarily', 'buddypress-media' );
2782
  $icon = 'dashicons dashicons-dismiss rtmicon';
2783
+
2784
  break;
2785
  }
2786
+
2787
  if ( ! empty( $title ) && ! empty( $icon ) ) {
2788
  $privacy = "<i class='" . esc_attr( $icon ) . "' title='" . esc_attr( $title ) . "'></i>";
2789
  }
2790
  }
2791
 
2792
  return $privacy;
2793
+
2794
  }
2795
 
2796
+ /**
2797
+ * Get media uploaded gmt date
2798
+ *
2799
+ * @param bool|int $rtmedia_id
2800
+ *
2801
+ * @return string
2802
+ */
2803
  function get_rtmedia_date_gmt( $rtmedia_id = false ) {
2804
+
2805
  $media = get_post( rtmedia_media_id( rtmedia_id( $rtmedia_id ) ) );
2806
  $date_time = '';
2807
 
2812
  $date_time = apply_filters( 'rtmedia_comment_date_format', $date_time, null );
2813
 
2814
  return '<span>' . $date_time . '</span>';
2815
+
2816
  }
2817
 
2818
+ /**
2819
+ * Convert comment datetime to "time ago" format
2820
+ *
2821
+ * @param string $_date
2822
+ *
2823
+ * @return string
2824
+ */
2825
  function rtmedia_convert_date( $_date ) {
2826
+
2827
  $stf = 0;
2828
  $date = new DateTime( $_date );
2829
  $date = $date->format( 'U' );
2830
  $cur_time = time();
2831
  $diff = $cur_time - $date;
2832
  $time_unit = array( 'second', 'minute', 'hour' );
2833
+ $length = array( 1, 60, 3600, 86400 );
2834
+ $ago_text = esc_html__( '%s ago ', 'buddypress-media' );
 
2835
 
2836
  for ( $i = sizeof( $length ) - 1; ( $i >= 0 ) && ( ( $no = $diff / $length[ $i ] ) <= 1 ); $i -- );
2837
 
2838
  if ( $i < 0 ) {
2839
  $i = 0;
2840
  }
2841
+
2842
  if ( $i <= 2 ) { //if posted in last 24 hours
2843
  $_time = $cur_time - ( $diff % $length[ $i ] );
2844
+ $no = floor( $no );
2845
 
 
2846
  switch ( $time_unit[ $i ] ) {
2847
  case 'second':
2848
  $time_unit_phrase = _n( '1 second', '%s seconds', $no, 'buddypress-media' );
2849
+
2850
  break;
2851
  case 'minute':
2852
  $time_unit_phrase = _n( '1 minute', '%s minutes', $no, 'buddypress-media' );
2853
+
2854
  break;
2855
  case 'hour':
2856
  $time_unit_phrase = _n( '1 hour', '%s hours', $no, 'buddypress-media' );
2857
+
2858
  break;
2859
  default:
2860
  // should not happen
2861
  $time_unit_phrase = '%s unknown';
2862
  }
2863
+
2864
  $value = sprintf( $time_unit_phrase . ' ', $no );
2865
 
2866
  if ( ( 1 === $stf ) && ( $i >= 1 ) && ( ( $cur_time - $_time ) > 0 ) ) {
2872
  /* translators: date format, see http://php.net/date */
2873
  return date_i18n( 'd F Y ', strtotime( $_date ), true );
2874
  }
2875
+
2876
  }
2877
 
2878
+ /**
2879
+ * Get media counts
2880
+ *
2881
+ * @global RTMediaQuery $rtmedia_query
2882
+ *
2883
+ * @return array|void
2884
+ */
2885
  function get_media_counts() {
2886
+
2887
  global $rtmedia_query;
2888
+
2889
  $user_id = false;
2890
+
2891
  if ( function_exists( 'bp_displayed_user_id' ) ) {
2892
  $user_id = bp_displayed_user_id();
2893
  } else {
2895
  $user_id = $rtmedia_query->query['context_id'];
2896
  }
2897
  }
 
 
2898
 
2899
+ $media_nav = new RTMediaNav( false );
2900
+ $temp = $media_nav->actual_counts( $user_id );
2901
 
2902
  return $temp;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2903
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2904
  }
2905
 
2906
+ /**
2907
+ * Checking if it is rtmedia's edit page
2908
+ *
2909
+ * @global string $pagenow
2910
+ *
2911
+ * @param null $new_edit
2912
+ *
2913
+ * @return bool
2914
+ */
2915
  function rtmedia_is_edit_page( $new_edit = null ) {
2916
+
2917
  global $pagenow;
2918
+
2919
  //make sure we are on the backend
2920
  if ( ! is_admin() ) {
2921
  return false;
2922
  }
2923
+
2924
  if ( 'edit' === $new_edit ) {
2925
  return in_array( $pagenow, array( 'post.php' ), true );
2926
  } elseif ( 'new' === $new_edit ) { //check for new post page
2928
  } else { //check for either new or edit
2929
  return in_array( $pagenow, array( 'post.php', 'post-new.php' ), true );
2930
  }
 
2931
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2932
  }
2933
 
2934
+ /**
2935
+ * Checking if it's a rtmedia page
2936
+ *
2937
+ * @global object $rtmedia_interaction
2938
+ *
2939
+ * @return bool
2940
+ */
2941
  function is_rtmedia_page() {
2942
+
2943
  if ( ! defined( 'RTMEDIA_MEDIA_SLUG' ) ) {
2944
  return false;
2945
  }
2955
  }
2956
 
2957
  return $rtmedia_interaction->routes[ RTMEDIA_MEDIA_SLUG ]->is_template();
2958
+
2959
  }
2960
 
2961
+ /**
2962
+ * To be used in migration in importing
2963
+ *
2964
+ * @param int $seconds_left
2965
+ *
2966
+ * @return string
2967
+ */
2968
  function rtmedia_migrate_formatseconds( $seconds_left ) {
2969
 
2970
  $minute_in_seconds = 60;
2978
  $seconds_left = $seconds_left % $hour_in_seconds;
2979
 
2980
  $minutes = floor( $seconds_left / $minute_in_seconds );
 
2981
  $seconds = $seconds_left % $minute_in_seconds;
2982
 
2983
  $time_components = array();
2997
  if ( $seconds > 0 ) {
2998
  $time_components[] = $seconds . ' second' . ( $seconds > 1 ? 's' : '' );
2999
  }
3000
+
3001
  if ( count( $time_components ) > 0 ) {
3002
  $formatted_time_remaining = implode( ', ', $time_components );
3003
  $formatted_time_remaining = trim( $formatted_time_remaining );
3006
  }
3007
 
3008
  return $formatted_time_remaining;
3009
+
3010
  }
3011
 
3012
  /**
3013
  * echo the size of the media file
3014
  *
3015
+ * @global array $rtmedia_backbone
3016
+ * @global object $rtmedia_media
3017
+ *
3018
+ * @return int
3019
  */
3020
  function rtmedia_file_size() {
3021
 
3022
  global $rtmedia_backbone;
3023
+
3024
  if ( $rtmedia_backbone['backbone'] ) {
3025
  echo '<%= file_size %>';
3026
  } else {
3027
  global $rtmedia_media;
3028
+
3029
  if ( isset( $rtmedia_media->file_size ) ) {
3030
  return $rtmedia_media->file_size;
3031
  } else {
3032
  return filesize( get_attached_file( $rtmedia_media->media_id ) );
3033
  }
3034
  }
3035
+
3036
  }
3037
 
3038
+ /**
3039
+ * Get rtmedia media type from file extension
3040
+ *
3041
+ * @global RTMedia $rtmedia
3042
+ *
3043
+ * @param string $extn
3044
+ *
3045
+ * @return bool|int|string
3046
  */
 
3047
  function rtmedia_get_media_type_from_extn( $extn ) {
3048
+
3049
  global $rtmedia;
3050
+
3051
  $allowed_type = $rtmedia->allowed_types;
3052
+
3053
  foreach ( $allowed_type as $type => $param ) {
3054
  if ( isset( $param['extn'] ) && is_array( $param['extn'] ) && in_array( $extn, $param['extn'], true ) ) {
3055
  return $type;
3057
  }
3058
 
3059
  return false;
 
3060
 
 
 
 
 
 
 
 
 
 
 
 
3061
  }
3062
 
3063
+ /**
3064
+ * Get extension from media id
3065
+ *
3066
+ * @global object $rtmedia_media
3067
+ *
3068
+ * @param bool|int $media_id
3069
+ *
3070
+ * @return bool
3071
  */
 
3072
  function rtmedia_get_extension( $media_id = false ) {
3073
  // If media_id is false then use global media_id
3074
  if ( ! $media_id ) {
3075
  global $rtmedia_media;
3076
+
3077
  if ( isset( $rtmedia_media->media_id ) ) {
3078
  $media_id = $rtmedia_media->media_id;
3079
  } else {
3089
 
3090
  // return the extension of the filename
3091
  return $file_type['ext'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3092
 
 
3093
  }
3094
 
3095
+ /**
3096
+ * Function to get permalink for current blog
3097
+ *
3098
+ * @param string $domain
3099
+ *
3100
+ * @return string
3101
+ */
3102
  function rtmedia_get_current_blog_url( $domain ) {
3103
+
3104
  $domain = get_home_url( get_current_blog_id() );
3105
 
3106
  return $domain;
 
3107
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3108
  }
3109
 
3110
+ /**
3111
+ * Checking if album is global
3112
+ *
3113
+ * @param int $album_id
3114
+ *
3115
+ * @return bool
3116
+ */
3117
  function rtmedia_is_global_album( $album_id ) {
3118
+
3119
  $rtmedia_global_albums = rtmedia_global_albums();
3120
 
3121
  if ( ! in_array( intval( $album_id ), $rtmedia_global_albums, true ) ) {
3123
  } else {
3124
  return false;
3125
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3126
 
 
3127
  }
3128
 
3129
+ /**
3130
+ * Checking if uploader view is allowed
3131
+ *
3132
+ * @param bool $allow
3133
+ * @param string $section
3134
+ *
3135
+ * @return bool
3136
+ */
3137
+ function rtmedia_is_uploader_view_allowed( $allow, $section = 'media_gallery' ) {
3138
 
3139
+ return apply_filters( 'rtmedia_allow_uploader_view', $allow, $section );
3140
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3141
  }
3142
 
3143
+ /**
3144
+ * Get rtMedia Encoding API Key
3145
+ *
3146
+ * @return string
3147
+ */
3148
  function get_rtmedia_encoding_api_key() {
3149
+
3150
  return get_site_option( 'rtmedia-encoding-api-key' );
3151
+
3152
  }
3153
 
3154
+ /**
3155
  * Filter SQL query strings to swap out the 'meta_id' column.
3156
  *
3157
  * WordPress uses the meta_id column for commentmeta and postmeta, and so
3158
  * hardcodes the column name into its *_metadata() functions. rtMedia
3159
  * uses 'id' for the primary column. To make WP's functions usable for rtMedia,
3160
  * we use this filter on 'query' to swap all 'meta_id' with 'id.
3161
+ *
3162
+ * @param string $q
3163
+ *
3164
+ * @return string
3165
  */
 
3166
  function rtm_filter_metaid_column_name( $q ) {
3167
+
3168
  /*
3169
  * Replace quoted content with __QUOTE__ to avoid false positives.
3170
  * This regular expression will match nested quotes.
3171
  */
3172
  $quoted_regex = "/'[^'\\\\]*(?:\\\\.[^'\\\\]*)*'/s";
3173
+
3174
  preg_match_all( $quoted_regex, $q, $quoted_matches );
 
3175
 
3176
+ $q = preg_replace( $quoted_regex, '__QUOTE__', $q );
3177
  $q = str_replace( 'meta_id', 'id', $q );
3178
 
3179
  // Put quoted content back into the string.
3185
  }
3186
 
3187
  return $q;
3188
+
3189
  }
3190
 
3191
+ /**
3192
  * Checking if SCRIPT_DEBUG constant is defined or not
3193
+ *
3194
+ * @return string
3195
  */
3196
  function rtm_get_script_style_suffix() {
3197
+
3198
  $suffix = ( defined( 'SCRIPT_DEBUG' ) && constant( 'SCRIPT_DEBUG' ) === true ) ? '' : '.min';
3199
 
3200
  return $suffix;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3201
 
 
 
 
3202
  }
3203
 
3204
  /**
3205
  * To get list of allowed types in rtMedia
 
3206
  *
3207
+ * @since 3.8.16
3208
+ *
3209
+ * @global RTMedia $rtmedia
3210
+ *
3211
+ * @return array
3212
  */
3213
  function rtmedia_get_allowed_types() {
3214
+
3215
  global $rtmedia;
3216
 
3217
  $allowed_media_type = $rtmedia->allowed_types;
3218
  $allowed_media_type = apply_filters( 'rtmedia_allowed_types', $allowed_media_type );
3219
 
3220
  return $allowed_media_type;
 
3221
 
3222
+ }
3223
 
3224
  /**
3225
  * To get list of allowed upload types in rtMedia
 
3226
  *
3227
+ * @since 3.8.16
3228
+ *
3229
+ * @return array
3230
  */
3231
  function rtmedia_get_allowed_upload_types() {
3232
 
3233
  $allowed_types = rtmedia_get_allowed_types();
3234
+
3235
  foreach ( $allowed_types as $type => $type_detail ) {
3236
  if ( ! ( function_exists( 'is_rtmedia_upload_' . $type . '_enabled' ) && call_user_func( 'is_rtmedia_upload_' . $type . '_enabled' ) ) ) {
3237
  unset( $allowed_types[ $type ] );
3239
  }
3240
 
3241
  return $allowed_types;
3242
+
3243
  }
3244
 
3245
  /**
3246
  * To get list of allowed upload type name in rtMedia
 
3247
  *
3248
+ * @since 3.8.16
3249
+ *
3250
+ * @return array
3251
  */
3252
  function rtmedia_get_allowed_upload_types_array() {
3253
+
3254
  $allowed_types = rtmedia_get_allowed_upload_types();
3255
  $types = array_keys( $allowed_types );
3256
 
3257
  return $types;
3258
+
3259
  }
3260
 
3261
  /**
 
3262
  * Upload and add media
3263
  *
3264
+ * @param array $upload_params
3265
  *
3266
+ * @return bool|int
3267
  */
3268
  function rtmedia_add_media( $upload_params = array() ) {
3269
 
3278
  $media_id = isset( $rtupload->media_ids[0] ) ? $rtupload->media_ids[0] : false;
3279
 
3280
  return $media_id;
3281
+
3282
  }
3283
 
3284
  /**
 
3285
  * Add multiple meta key and value for media.
3286
  *
3287
+ * @param int $media_id
3288
+ * @param string $meta_key_val
3289
  *
3290
+ * @return array
3291
  */
3292
  function rtmedia_add_multiple_meta( $media_id, $meta_key_val ) {
3293
+
3294
  $meta_ids = array();
3295
+
3296
  if ( ! empty( $media_id ) && ! empty( $meta_key_val ) ) {
3297
  $media_meta = new RTMediaMeta();
3298
+
3299
  foreach ( $meta_key_val as $meta_key => $meta_val ) {
3300
  $meta_ids[] = $media_meta->add_meta( $media_id, $meta_key, $meta_val );
 
3301
  }
3302
  }
3303
 
3304
  return $meta_ids;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3305
 
 
3306
  }
3307
 
 
 
3308
  /**
3309
  * To get server variable
3310
  *
3311
+ * @param string $server_key
3312
+ * @param string $filter_type
3313
  *
3314
+ * @return string
3315
  */
3316
  function rtm_get_server_var( $server_key, $filter_type = 'FILTER_SANITIZE_STRING' ) {
3317
 
3327
 
3328
  }
3329
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3330
  /**
3331
  * Check if URL exists of a given media type (i.e mp4, ogg, wmv)
3332
  *
3333
+ * @param array $medias
3334
+ * @param string $media_type
3335
  *
3336
+ * @return bool
3337
  */
3338
  function rtt_is_video_exists( $medias, $media_type = 'mp4' ) {
3339
+
3340
  if ( empty( $medias ) || empty( $media_type ) ) {
3341
  return false;
3342
  }
3343
+
3344
  if ( isset( $medias[ $media_type ] ) && is_array( $medias[ $media_type ] ) && ! empty( $medias[ $media_type ][0] ) ) {
3345
  return $medias[ $media_type ][0];
3346
  }
3347
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/main/routers/query/RTMediaQuery.php CHANGED
@@ -438,7 +438,7 @@ class RTMediaQuery {
438
  *
439
  * Later on, renmove this comment and below commented code.
440
  */
441
- // $this->query = wp_parse_args( $query, $this->query );
442
 
443
  $this->query = $query;
444
 
@@ -467,16 +467,8 @@ class RTMediaQuery {
467
  unset( $query_data[ $key ] );
468
  }
469
  }
470
- /*
471
- * @chandra commented this code. here we are merging new query vars and previous query vars
472
- * which is cause an issue. For example, First time query vars contain media_type and second time query vars not contain media_type
473
- * then media not listed properly.
474
- *
475
- * Later on, renmove this comment and below commented code.
476
- */
477
- // $this->query = wp_parse_args( $query, $this->query );
478
 
479
- $this->query = $query_data;
480
 
481
  } else {
482
  if ( isset( $this->is_gallery_shortcode ) && true === $this->is_gallery_shortcode ) {
438
  *
439
  * Later on, renmove this comment and below commented code.
440
  */
441
+ // $this->query = wp_parse_args( $query, $this->query );
442
 
443
  $this->query = $query;
444
 
467
  unset( $query_data[ $key ] );
468
  }
469
  }
 
 
 
 
 
 
 
 
470
 
471
+ $this->query = wp_parse_args( $query_data, $this->query );
472
 
473
  } else {
474
  if ( isset( $this->is_gallery_shortcode ) && true === $this->is_gallery_shortcode ) {
index.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: rtMedia for WordPress, BuddyPress and bbPress
5
  Plugin URI: https://rtmedia.io/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media
6
  Description: This plugin adds missing media rich features like photos, videos and audio uploading to BuddyPress which are essential if you are building social network, seriously!
7
- Version: 4.1.5
8
  Author: rtCamp
9
  Text Domain: buddypress-media
10
  Author URI: http://rtcamp.com/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media
4
  Plugin Name: rtMedia for WordPress, BuddyPress and bbPress
5
  Plugin URI: https://rtmedia.io/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media
6
  Description: This plugin adds missing media rich features like photos, videos and audio uploading to BuddyPress which are essential if you are building social network, seriously!
7
+ Version: 4.1.6
8
  Author: rtCamp
9
  Text Domain: buddypress-media
10
  Author URI: http://rtcamp.com/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media
languages/buddypress-media.po CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the same license as the rtMedia for WordPress, BuddyPress and bbPress package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: rtMedia for WordPress, BuddyPress and bbPress 4.1.3\n"
6
  "Report-Msgid-Bugs-To: http://community.rtcamp.com/c/rtmedia/\n"
7
- "POT-Creation-Date: 2016-09-13 08:29:35+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -166,7 +166,7 @@ msgstr ""
166
 
167
  #: app/admin/RTMediaAdmin.php:790 app/admin/RTMediaAdmin.php:1294
168
  #: app/admin/RTMediaAdmin.php:1295 app/importers/RTMediaActivityUpgrade.php:116
169
- #: app/importers/RTMediaMigration.php:68 app/main/RTMedia.php:908
170
  msgid "rtMedia"
171
  msgstr ""
172
 
@@ -468,7 +468,7 @@ msgstr ""
468
  msgid "Need to specify atleast two radios, else use a checkbox instead"
469
  msgstr ""
470
 
471
- #: app/admin/RTMediaFormHandler.php:278 templates/media/album-gallery.php:57
472
  #: templates/media/media-gallery.php:68
473
  msgid "Load More"
474
  msgstr ""
@@ -1787,7 +1787,7 @@ msgstr ""
1787
  msgid "Users"
1788
  msgstr ""
1789
 
1790
- #: app/importers/BPMediaAlbumimporter.php:89 app/main/RTMedia.php:597
1791
  msgid "Media"
1792
  msgstr ""
1793
 
@@ -1999,244 +1999,244 @@ msgstr ""
1999
  msgid "No time remaining."
2000
  msgstr ""
2001
 
2002
- #: app/main/RTMedia.php:328
2003
  msgid "Photo"
2004
  msgstr ""
2005
 
2006
- #: app/main/RTMedia.php:329
2007
  msgid "Photos"
2008
  msgstr ""
2009
 
2010
- #: app/main/RTMedia.php:337
2011
  msgid "Video"
2012
  msgstr ""
2013
 
2014
- #: app/main/RTMedia.php:338
2015
  msgid "Videos"
2016
  msgstr ""
2017
 
2018
- #: app/main/RTMedia.php:346 app/main/RTMedia.php:347
2019
  msgid "Music"
2020
  msgstr ""
2021
 
2022
- #: app/main/RTMedia.php:438
2023
  msgid "Private - Visible only to the user"
2024
  msgstr ""
2025
 
2026
- #: app/main/RTMedia.php:439
2027
  msgid "Friends - Visible to user's friends"
2028
  msgstr ""
2029
 
2030
- #: app/main/RTMedia.php:440
2031
  msgid "Logged in Users - Visible to registered users"
2032
  msgstr ""
2033
 
2034
- #: app/main/RTMedia.php:441
2035
  msgid "Public - Visible to the world"
2036
  msgstr ""
2037
 
2038
- #: app/main/RTMedia.php:605 app/main/controllers/template/RTMediaNav.php:206
2039
- #: app/main/controllers/template/rt-template-functions.php:86
2040
  msgid "All"
2041
  msgstr ""
2042
 
2043
- #: app/main/RTMedia.php:617 app/main/controllers/media/RTMediaAlbum.php:54
2044
- #: app/main/controllers/template/rt-template-functions.php:1332
2045
  #: app/main/controllers/upload/RTMediaUploadView.php:52
2046
  #: app/main/controllers/upload/RTMediaUploadView.php:55
2047
  msgid "Album"
2048
  msgstr ""
2049
 
2050
- #: app/main/RTMedia.php:621 app/main/RTMedia.php:1017
2051
  #: app/main/controllers/media/RTMediaAlbum.php:53
2052
  #: app/main/controllers/media/RTMediaAlbum.php:65
2053
  msgid "Albums"
2054
  msgstr ""
2055
 
2056
- #: app/main/RTMedia.php:631 app/main/controllers/media/RTMediaLoginPopup.php:38
2057
- #: app/main/controllers/template/rt-template-functions.php:2094
2058
- #: app/main/controllers/template/rt-template-functions.php:2098
2059
  msgid "Upload"
2060
  msgstr ""
2061
 
2062
- #: app/main/RTMedia.php:636
2063
  msgid "Wall Post"
2064
  msgstr ""
2065
 
2066
- #: app/main/RTMedia.php:855 app/main/RTMedia.php:864
2067
  msgid "Wall Posts"
2068
  msgstr ""
2069
 
2070
- #: app/main/RTMedia.php:908
2071
  msgid ": Can't Create Database table. Please check create table permission."
2072
  msgstr ""
2073
 
2074
- #: app/main/RTMedia.php:963
2075
  msgid "Loading media"
2076
  msgstr ""
2077
 
2078
- #: app/main/RTMedia.php:964
2079
  msgid "Please enter some content to post."
2080
  msgstr ""
2081
 
2082
- #: app/main/RTMedia.php:965
2083
  msgid "Empty Comment is not allowed."
2084
  msgstr ""
2085
 
2086
- #: app/main/RTMedia.php:966
2087
  msgid "Are you sure you want to delete this media?"
2088
  msgstr ""
2089
 
2090
- #: app/main/RTMedia.php:967
2091
  msgid "Are you sure you want to delete this comment?"
2092
  msgstr ""
2093
 
2094
- #: app/main/RTMedia.php:968
2095
  msgid "Are you sure you want to delete this Album?"
2096
  msgstr ""
2097
 
2098
- #: app/main/RTMedia.php:969
2099
  msgid "Drop files here"
2100
  msgstr ""
2101
 
2102
- #: app/main/RTMedia.php:970
2103
  msgid "album created successfully."
2104
  msgstr ""
2105
 
2106
- #: app/main/RTMedia.php:971
2107
  msgid "Something went wrong. Please try again."
2108
  msgstr ""
2109
 
2110
- #: app/main/RTMedia.php:972
2111
  msgid "Enter an album name."
2112
  msgstr ""
2113
 
2114
- #: app/main/RTMedia.php:973
2115
  msgid "Max file Size Limit : "
2116
  msgstr ""
2117
 
2118
- #: app/main/RTMedia.php:974
2119
  msgid "Allowed File Formats"
2120
  msgstr ""
2121
 
2122
- #: app/main/RTMedia.php:975 templates/media/album-single-edit.php:73
2123
  msgid "Select All Visible"
2124
  msgstr ""
2125
 
2126
- #: app/main/RTMedia.php:976
2127
  msgid "Unselect All Visible"
2128
  msgstr ""
2129
 
2130
- #: app/main/RTMedia.php:977
2131
  msgid "Please select some media."
2132
  msgstr ""
2133
 
2134
- #: app/main/RTMedia.php:978
2135
  msgid "Are you sure you want to delete the selected media?"
2136
  msgstr ""
2137
 
2138
- #: app/main/RTMedia.php:979
2139
  msgid "Are you sure you want to move the selected media?"
2140
  msgstr ""
2141
 
2142
- #: app/main/RTMedia.php:980
2143
  msgid "Waiting"
2144
  msgstr ""
2145
 
2146
- #: app/main/RTMedia.php:981
2147
  msgid "Uploaded"
2148
  msgstr ""
2149
 
2150
- #: app/main/RTMedia.php:982
2151
  msgid "Uploading"
2152
  msgstr ""
2153
 
2154
- #: app/main/RTMedia.php:983
2155
  msgid "Failed"
2156
  msgstr ""
2157
 
2158
- #: app/main/RTMedia.php:984
2159
  msgid "Close"
2160
  msgstr ""
2161
 
2162
- #: app/main/RTMedia.php:985
2163
  #: app/main/controllers/media/RTMediaGalleryItemAction.php:63
2164
  #: app/main/controllers/media/RTMediaGalleryItemAction.php:80
2165
- #: app/main/controllers/template/rt-template-functions.php:791
2166
- #: app/main/controllers/template/rt-template-functions.php:812
2167
  msgid "Edit"
2168
  msgstr ""
2169
 
2170
- #: app/main/RTMedia.php:986
2171
  #: app/main/controllers/media/RTMediaGalleryItemAction.php:67
2172
  #: app/main/controllers/media/RTMediaGalleryItemAction.php:80
2173
- #: app/main/controllers/template/rt-template-functions.php:1413
2174
- #: app/main/controllers/template/rt-template-functions.php:1420
2175
  #: templates/media/album-single-edit.php:78
2176
  msgid "Delete"
2177
  msgstr ""
2178
 
2179
- #: app/main/RTMedia.php:987 templates/media/media-single-edit.php:8
2180
  msgid "Edit Media"
2181
  msgstr ""
2182
 
2183
- #: app/main/RTMedia.php:988
2184
  msgid "Remove from queue"
2185
  msgstr ""
2186
 
2187
- #: app/main/RTMedia.php:989
2188
  msgid "Add more files"
2189
  msgstr ""
2190
 
2191
- #: app/main/RTMedia.php:990
2192
  msgid "File not supported"
2193
  msgstr ""
2194
 
2195
- #: app/main/RTMedia.php:991
2196
  msgid "more"
2197
  msgstr ""
2198
 
2199
- #: app/main/RTMedia.php:992
2200
  msgid "less"
2201
  msgstr ""
2202
 
2203
- #: app/main/RTMedia.php:993
2204
  msgid "This media is uploaded. Are you sure you want to delete this media?"
2205
  msgstr ""
2206
 
2207
- #: app/main/RTMedia.php:1001
2208
  msgid "Featured media set successfully."
2209
  msgstr ""
2210
 
2211
- #: app/main/RTMedia.php:1002
2212
  msgid "Featured media removed successfully."
2213
  msgstr ""
2214
 
2215
- #: app/main/RTMedia.php:1004
2216
  msgid "Title:"
2217
  msgstr ""
2218
 
2219
- #: app/main/RTMedia.php:1005
2220
  msgid "Description:"
2221
  msgstr ""
2222
 
2223
- #: app/main/RTMedia.php:1010
2224
  msgid "Edit File Name"
2225
  msgstr ""
2226
 
2227
- #: app/main/RTMedia.php:1018
2228
  msgid "Privacy updated successfully."
2229
  msgstr ""
2230
 
2231
- #: app/main/RTMedia.php:1019
2232
  msgid "Couldn't change privacy, please try again."
2233
  msgstr ""
2234
 
2235
- #: app/main/RTMedia.php:1020
2236
  msgid "file deleted successfully."
2237
  msgstr ""
2238
 
2239
- #: app/main/RTMedia.php:1052
2240
  msgid "There are some uploads in progress. Do you want to cancel them?"
2241
  msgstr ""
2242
 
@@ -2246,7 +2246,7 @@ msgstr ""
2246
 
2247
  #: app/main/controllers/activity/RTMediaBuddyPressActivity.php:323
2248
  #: app/main/controllers/shortcodes/RTMediaUploadShortcode.php:100
2249
- #: app/main/controllers/template/rt-template-functions.php:1447
2250
  msgid "You are not allowed to upload/attach media."
2251
  msgstr ""
2252
 
@@ -2501,45 +2501,45 @@ msgid "single media"
2501
  msgstr ""
2502
 
2503
  #: app/main/controllers/group/RTMediaGroupExtension.php:30
2504
- #: app/main/controllers/group/RTMediaGroupExtension.php:95
2505
  msgid "Album Creation Control"
2506
  msgstr ""
2507
 
2508
  #: app/main/controllers/group/RTMediaGroupExtension.php:31
2509
- #: app/main/controllers/group/RTMediaGroupExtension.php:96
2510
  msgid "Who can create Albums in this group?"
2511
  msgstr ""
2512
 
2513
  #: app/main/controllers/group/RTMediaGroupExtension.php:35
2514
- #: app/main/controllers/group/RTMediaGroupExtension.php:100
2515
  msgid "All Group Members"
2516
  msgstr ""
2517
 
2518
  #: app/main/controllers/group/RTMediaGroupExtension.php:39
2519
- #: app/main/controllers/group/RTMediaGroupExtension.php:104
2520
  msgid "Group Admins and Mods only"
2521
  msgstr ""
2522
 
2523
  #: app/main/controllers/group/RTMediaGroupExtension.php:43
2524
- #: app/main/controllers/group/RTMediaGroupExtension.php:108
2525
  msgid "Group Admin only"
2526
  msgstr ""
2527
 
2528
- #: app/main/controllers/group/RTMediaGroupExtension.php:116
2529
  #: app/main/controllers/privacy/RTMediaPrivacy.php:409
2530
  #: templates/media/album-single-edit.php:55
2531
  msgid "Save Changes"
2532
  msgstr ""
2533
 
2534
- #: app/main/controllers/group/RTMediaGroupExtension.php:147
2535
  msgid "There was an error saving, please try again"
2536
  msgstr ""
2537
 
2538
- #: app/main/controllers/group/RTMediaGroupExtension.php:149
2539
  msgid "Settings saved successfully"
2540
  msgstr ""
2541
 
2542
- #: app/main/controllers/group/RTMediaGroupExtension.php:170
2543
  msgid ""
2544
  "You could display a small snippet of information from your group extension "
2545
  "here. It will show on the group\n"
@@ -2557,12 +2557,12 @@ msgid "Create"
2557
  msgstr ""
2558
 
2559
  #: app/main/controllers/media/RTMediaAlbum.php:56
2560
- #: app/main/controllers/template/rt-template-functions.php:1725
2561
  msgid "Create Album"
2562
  msgstr ""
2563
 
2564
  #: app/main/controllers/media/RTMediaAlbum.php:57
2565
- #: app/main/controllers/template/rt-template-functions.php:1805
2566
  msgid "Edit Album"
2567
  msgstr ""
2568
 
@@ -2632,8 +2632,8 @@ msgid "Unlike"
2632
  msgstr ""
2633
 
2634
  #: app/main/controllers/media/RTMediaLoginPopup.php:38
2635
- #: app/main/controllers/template/rt-template-functions.php:2094
2636
- #: app/main/controllers/template/rt-template-functions.php:2098
2637
  msgid "Upload Media"
2638
  msgstr ""
2639
 
@@ -2725,175 +2725,174 @@ msgstr ""
2725
  msgid "Error in updating Media"
2726
  msgstr ""
2727
 
2728
- #: app/main/controllers/template/rt-template-functions.php:767
2729
- #: app/main/controllers/template/rt-template-functions.php:1630
2730
  msgid "Options"
2731
  msgstr ""
2732
 
2733
- #: app/main/controllers/template/rt-template-functions.php:855
2734
- msgid "There are no comments on this media yet."
2735
  msgstr ""
2736
 
2737
- #: app/main/controllers/template/rt-template-functions.php:891
2738
- msgid "Delete Comment"
2739
  msgstr ""
2740
 
2741
- #: app/main/controllers/template/rt-template-functions.php:1106
2742
- msgid "Go to page no : "
2743
  msgstr ""
2744
 
2745
- #: app/main/controllers/template/rt-template-functions.php:1111
2746
- msgid "Go"
2747
  msgstr ""
2748
 
2749
- #: app/main/controllers/template/rt-template-functions.php:1283
2750
- msgid "Image"
 
 
2751
  msgstr ""
2752
 
2753
- #: app/main/controllers/template/rt-template-functions.php:1300
2754
- msgid "Modify Image"
2755
  msgstr ""
2756
 
2757
- #: app/main/controllers/template/rt-template-functions.php:1374
2758
- msgid "Type Comment..."
2759
  msgstr ""
2760
 
2761
- #: app/main/controllers/template/rt-template-functions.php:1377
2762
- #: templates/media/media-single.php:98 templates/media/media-single.php:141
2763
- msgid "Comment"
2764
  msgstr ""
2765
 
2766
- #: app/main/controllers/template/rt-template-functions.php:1413
2767
- #: app/main/controllers/template/rt-template-functions.php:1420
2768
- msgid "Delete Media"
2769
  msgstr ""
2770
 
2771
- #: app/main/controllers/template/rt-template-functions.php:1574
2772
- msgid "Profile Albums"
2773
  msgstr ""
2774
 
2775
- #: app/main/controllers/template/rt-template-functions.php:1577
2776
- #: app/main/controllers/template/rt-template-functions.php:1609
2777
- msgid "Group Albums"
2778
  msgstr ""
2779
 
2780
- #: app/main/controllers/template/rt-template-functions.php:1695
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2781
  msgid "Create New Album"
2782
  msgstr ""
2783
 
2784
- #: app/main/controllers/template/rt-template-functions.php:1695
2785
  msgid "Add Album"
2786
  msgstr ""
2787
 
2788
- #: app/main/controllers/template/rt-template-functions.php:1711
2789
- msgid "Create an Album"
2790
  msgstr ""
2791
 
2792
- #: app/main/controllers/template/rt-template-functions.php:1714
2793
- msgid "Album Title : "
2794
  msgstr ""
2795
 
2796
- #: app/main/controllers/template/rt-template-functions.php:1756
2797
- #: app/main/controllers/template/rt-template-functions.php:1764
2798
- #: app/main/controllers/template/rt-template-functions.php:1815
2799
- msgid "Merge Album"
2800
  msgstr ""
2801
 
2802
- #: app/main/controllers/template/rt-template-functions.php:1759
2803
- msgid "Select Album to merge with : "
2804
  msgstr ""
2805
 
2806
- #: app/main/controllers/template/rt-template-functions.php:1806
2807
- msgid "Delete Album"
2808
  msgstr ""
2809
 
2810
- #: app/main/controllers/template/rt-template-functions.php:1843
2811
- msgid "Merge"
2812
  msgstr ""
2813
 
2814
- #: app/main/controllers/template/rt-template-functions.php:1902
2815
- msgid "Privacy : "
 
2816
  msgstr ""
2817
 
2818
- #: app/main/controllers/template/rt-template-functions.php:2082
2819
- msgid "people like this"
 
2820
  msgstr ""
2821
 
2822
- #: app/main/controllers/template/rt-template-functions.php:2177
2823
- msgid "Empowering your community with "
2824
  msgstr ""
2825
 
2826
- #: app/main/controllers/template/rt-template-functions.php:2179
2827
- msgid "The only complete media solution for WordPress, BuddyPress and bbPress"
 
2828
  msgstr ""
2829
 
2830
- #: app/main/controllers/template/rt-template-functions.php:2195
2831
- msgid "Close (Esc)"
 
 
 
 
2832
  msgstr ""
2833
 
2834
- #: app/main/controllers/template/rt-template-functions.php:2209
2835
  msgid "Public"
2836
  msgstr ""
2837
 
2838
- #: app/main/controllers/template/rt-template-functions.php:2213
2839
  msgid "All members"
2840
  msgstr ""
2841
 
2842
- #: app/main/controllers/template/rt-template-functions.php:2217
2843
  msgid "Your friends"
2844
  msgstr ""
2845
 
2846
- #: app/main/controllers/template/rt-template-functions.php:2221
2847
  msgid "Only you"
2848
  msgstr ""
2849
 
2850
- #: app/main/controllers/template/rt-template-functions.php:2225
2851
  msgid "Blocked temporarily"
2852
  msgstr ""
2853
 
2854
- #: app/main/controllers/template/rt-template-functions.php:2261
2855
  msgid "%s ago "
2856
  msgstr ""
2857
 
2858
- #: app/main/controllers/template/rt-template-functions.php:2274
2859
  msgid "1 second"
2860
  msgid_plural "%s seconds"
2861
  msgstr[0] ""
2862
  msgstr[1] ""
2863
 
2864
- #: app/main/controllers/template/rt-template-functions.php:2277
2865
  msgid "1 minute"
2866
  msgid_plural "%s minutes"
2867
  msgstr[0] ""
2868
  msgstr[1] ""
2869
 
2870
- #: app/main/controllers/template/rt-template-functions.php:2280
2871
  msgid "1 hour"
2872
  msgid_plural "%s hours"
2873
  msgstr[0] ""
2874
  msgstr[1] ""
2875
 
2876
- #: app/main/controllers/template/rt-template-functions.php:2665
2877
- #. translators: date format, see http:php.net/date
2878
- msgid "You can consider rtMedia Team for following :"
2879
- msgstr ""
2880
-
2881
- #: app/main/controllers/template/rt-template-functions.php:2668
2882
- msgid "rtMedia Customization ( in Upgrade Safe manner )"
2883
- msgstr ""
2884
-
2885
- #: app/main/controllers/template/rt-template-functions.php:2669
2886
- msgid "WordPress/BuddyPress Theme Design and Development"
2887
- msgstr ""
2888
-
2889
- #: app/main/controllers/template/rt-template-functions.php:2670
2890
- msgid "WordPress/BuddyPress Plugin Development"
2891
- msgstr ""
2892
-
2893
- #: app/main/controllers/template/rt-template-functions.php:2675
2894
- msgid "Contact Us"
2895
- msgstr ""
2896
-
2897
  #: app/main/controllers/upload/RTMediaUploadView.php:79
2898
  msgid "Privacy: "
2899
  msgstr ""
2
  # This file is distributed under the same license as the rtMedia for WordPress, BuddyPress and bbPress package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: rtMedia for WordPress, BuddyPress and bbPress 4.1.5\n"
6
  "Report-Msgid-Bugs-To: http://community.rtcamp.com/c/rtmedia/\n"
7
+ "POT-Creation-Date: 2016-09-26 08:36:32+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
166
 
167
  #: app/admin/RTMediaAdmin.php:790 app/admin/RTMediaAdmin.php:1294
168
  #: app/admin/RTMediaAdmin.php:1295 app/importers/RTMediaActivityUpgrade.php:116
169
+ #: app/importers/RTMediaMigration.php:68 app/main/RTMedia.php:914
170
  msgid "rtMedia"
171
  msgstr ""
172
 
468
  msgid "Need to specify atleast two radios, else use a checkbox instead"
469
  msgstr ""
470
 
471
+ #: app/admin/RTMediaFormHandler.php:278 templates/media/album-gallery.php:60
472
  #: templates/media/media-gallery.php:68
473
  msgid "Load More"
474
  msgstr ""
1787
  msgid "Users"
1788
  msgstr ""
1789
 
1790
+ #: app/importers/BPMediaAlbumimporter.php:89 app/main/RTMedia.php:603
1791
  msgid "Media"
1792
  msgstr ""
1793
 
1999
  msgid "No time remaining."
2000
  msgstr ""
2001
 
2002
+ #: app/main/RTMedia.php:334
2003
  msgid "Photo"
2004
  msgstr ""
2005
 
2006
+ #: app/main/RTMedia.php:335
2007
  msgid "Photos"
2008
  msgstr ""
2009
 
2010
+ #: app/main/RTMedia.php:343
2011
  msgid "Video"
2012
  msgstr ""
2013
 
2014
+ #: app/main/RTMedia.php:344
2015
  msgid "Videos"
2016
  msgstr ""
2017
 
2018
+ #: app/main/RTMedia.php:352 app/main/RTMedia.php:353
2019
  msgid "Music"
2020
  msgstr ""
2021
 
2022
+ #: app/main/RTMedia.php:444
2023
  msgid "Private - Visible only to the user"
2024
  msgstr ""
2025
 
2026
+ #: app/main/RTMedia.php:445
2027
  msgid "Friends - Visible to user's friends"
2028
  msgstr ""
2029
 
2030
+ #: app/main/RTMedia.php:446
2031
  msgid "Logged in Users - Visible to registered users"
2032
  msgstr ""
2033
 
2034
+ #: app/main/RTMedia.php:447
2035
  msgid "Public - Visible to the world"
2036
  msgstr ""
2037
 
2038
+ #: app/main/RTMedia.php:611 app/main/controllers/template/RTMediaNav.php:206
2039
+ #: app/main/controllers/template/rtmedia-functions.php:114
2040
  msgid "All"
2041
  msgstr ""
2042
 
2043
+ #: app/main/RTMedia.php:623 app/main/controllers/media/RTMediaAlbum.php:54
2044
+ #: app/main/controllers/template/rtmedia-actions.php:119
2045
  #: app/main/controllers/upload/RTMediaUploadView.php:52
2046
  #: app/main/controllers/upload/RTMediaUploadView.php:55
2047
  msgid "Album"
2048
  msgstr ""
2049
 
2050
+ #: app/main/RTMedia.php:627 app/main/RTMedia.php:1023
2051
  #: app/main/controllers/media/RTMediaAlbum.php:53
2052
  #: app/main/controllers/media/RTMediaAlbum.php:65
2053
  msgid "Albums"
2054
  msgstr ""
2055
 
2056
+ #: app/main/RTMedia.php:637 app/main/controllers/media/RTMediaLoginPopup.php:38
2057
+ #: app/main/controllers/template/rtmedia-actions.php:307
2058
+ #: app/main/controllers/template/rtmedia-actions.php:311
2059
  msgid "Upload"
2060
  msgstr ""
2061
 
2062
+ #: app/main/RTMedia.php:642
2063
  msgid "Wall Post"
2064
  msgstr ""
2065
 
2066
+ #: app/main/RTMedia.php:861 app/main/RTMedia.php:870
2067
  msgid "Wall Posts"
2068
  msgstr ""
2069
 
2070
+ #: app/main/RTMedia.php:914
2071
  msgid ": Can't Create Database table. Please check create table permission."
2072
  msgstr ""
2073
 
2074
+ #: app/main/RTMedia.php:969
2075
  msgid "Loading media"
2076
  msgstr ""
2077
 
2078
+ #: app/main/RTMedia.php:970
2079
  msgid "Please enter some content to post."
2080
  msgstr ""
2081
 
2082
+ #: app/main/RTMedia.php:971
2083
  msgid "Empty Comment is not allowed."
2084
  msgstr ""
2085
 
2086
+ #: app/main/RTMedia.php:972
2087
  msgid "Are you sure you want to delete this media?"
2088
  msgstr ""
2089
 
2090
+ #: app/main/RTMedia.php:973
2091
  msgid "Are you sure you want to delete this comment?"
2092
  msgstr ""
2093
 
2094
+ #: app/main/RTMedia.php:974
2095
  msgid "Are you sure you want to delete this Album?"
2096
  msgstr ""
2097
 
2098
+ #: app/main/RTMedia.php:975
2099
  msgid "Drop files here"
2100
  msgstr ""
2101
 
2102
+ #: app/main/RTMedia.php:976
2103
  msgid "album created successfully."
2104
  msgstr ""
2105
 
2106
+ #: app/main/RTMedia.php:977
2107
  msgid "Something went wrong. Please try again."
2108
  msgstr ""
2109
 
2110
+ #: app/main/RTMedia.php:978
2111
  msgid "Enter an album name."
2112
  msgstr ""
2113
 
2114
+ #: app/main/RTMedia.php:979
2115
  msgid "Max file Size Limit : "
2116
  msgstr ""
2117
 
2118
+ #: app/main/RTMedia.php:980
2119
  msgid "Allowed File Formats"
2120
  msgstr ""
2121
 
2122
+ #: app/main/RTMedia.php:981 templates/media/album-single-edit.php:73
2123
  msgid "Select All Visible"
2124
  msgstr ""
2125
 
2126
+ #: app/main/RTMedia.php:982
2127
  msgid "Unselect All Visible"
2128
  msgstr ""
2129
 
2130
+ #: app/main/RTMedia.php:983
2131
  msgid "Please select some media."
2132
  msgstr ""
2133
 
2134
+ #: app/main/RTMedia.php:984
2135
  msgid "Are you sure you want to delete the selected media?"
2136
  msgstr ""
2137
 
2138
+ #: app/main/RTMedia.php:985
2139
  msgid "Are you sure you want to move the selected media?"
2140
  msgstr ""
2141
 
2142
+ #: app/main/RTMedia.php:986
2143
  msgid "Waiting"
2144
  msgstr ""
2145
 
2146
+ #: app/main/RTMedia.php:987
2147
  msgid "Uploaded"
2148
  msgstr ""
2149
 
2150
+ #: app/main/RTMedia.php:988
2151
  msgid "Uploading"
2152
  msgstr ""
2153
 
2154
+ #: app/main/RTMedia.php:989
2155
  msgid "Failed"
2156
  msgstr ""
2157
 
2158
+ #: app/main/RTMedia.php:990
2159
  msgid "Close"
2160
  msgstr ""
2161
 
2162
+ #: app/main/RTMedia.php:991
2163
  #: app/main/controllers/media/RTMediaGalleryItemAction.php:63
2164
  #: app/main/controllers/media/RTMediaGalleryItemAction.php:80
2165
+ #: app/main/controllers/template/rtmedia-functions.php:1115
2166
+ #: app/main/controllers/template/rtmedia-functions.php:1134
2167
  msgid "Edit"
2168
  msgstr ""
2169
 
2170
+ #: app/main/RTMedia.php:992
2171
  #: app/main/controllers/media/RTMediaGalleryItemAction.php:67
2172
  #: app/main/controllers/media/RTMediaGalleryItemAction.php:80
2173
+ #: app/main/controllers/template/rtmedia-functions.php:1879
2174
+ #: app/main/controllers/template/rtmedia-functions.php:1888
2175
  #: templates/media/album-single-edit.php:78
2176
  msgid "Delete"
2177
  msgstr ""
2178
 
2179
+ #: app/main/RTMedia.php:993 templates/media/media-single-edit.php:8
2180
  msgid "Edit Media"
2181
  msgstr ""
2182
 
2183
+ #: app/main/RTMedia.php:994
2184
  msgid "Remove from queue"
2185
  msgstr ""
2186
 
2187
+ #: app/main/RTMedia.php:995
2188
  msgid "Add more files"
2189
  msgstr ""
2190
 
2191
+ #: app/main/RTMedia.php:996
2192
  msgid "File not supported"
2193
  msgstr ""
2194
 
2195
+ #: app/main/RTMedia.php:997
2196
  msgid "more"
2197
  msgstr ""
2198
 
2199
+ #: app/main/RTMedia.php:998
2200
  msgid "less"
2201
  msgstr ""
2202
 
2203
+ #: app/main/RTMedia.php:999
2204
  msgid "This media is uploaded. Are you sure you want to delete this media?"
2205
  msgstr ""
2206
 
2207
+ #: app/main/RTMedia.php:1007
2208
  msgid "Featured media set successfully."
2209
  msgstr ""
2210
 
2211
+ #: app/main/RTMedia.php:1008
2212
  msgid "Featured media removed successfully."
2213
  msgstr ""
2214
 
2215
+ #: app/main/RTMedia.php:1010
2216
  msgid "Title:"
2217
  msgstr ""
2218
 
2219
+ #: app/main/RTMedia.php:1011
2220
  msgid "Description:"
2221
  msgstr ""
2222
 
2223
+ #: app/main/RTMedia.php:1016
2224
  msgid "Edit File Name"
2225
  msgstr ""
2226
 
2227
+ #: app/main/RTMedia.php:1024
2228
  msgid "Privacy updated successfully."
2229
  msgstr ""
2230
 
2231
+ #: app/main/RTMedia.php:1025
2232
  msgid "Couldn't change privacy, please try again."
2233
  msgstr ""
2234
 
2235
+ #: app/main/RTMedia.php:1026
2236
  msgid "file deleted successfully."
2237
  msgstr ""
2238
 
2239
+ #: app/main/RTMedia.php:1058
2240
  msgid "There are some uploads in progress. Do you want to cancel them?"
2241
  msgstr ""
2242
 
2246
 
2247
  #: app/main/controllers/activity/RTMediaBuddyPressActivity.php:323
2248
  #: app/main/controllers/shortcodes/RTMediaUploadShortcode.php:100
2249
+ #: app/main/controllers/template/rtmedia-functions.php:1918
2250
  msgid "You are not allowed to upload/attach media."
2251
  msgstr ""
2252
 
2501
  msgstr ""
2502
 
2503
  #: app/main/controllers/group/RTMediaGroupExtension.php:30
2504
+ #: app/main/controllers/group/RTMediaGroupExtension.php:104
2505
  msgid "Album Creation Control"
2506
  msgstr ""
2507
 
2508
  #: app/main/controllers/group/RTMediaGroupExtension.php:31
2509
+ #: app/main/controllers/group/RTMediaGroupExtension.php:105
2510
  msgid "Who can create Albums in this group?"
2511
  msgstr ""
2512
 
2513
  #: app/main/controllers/group/RTMediaGroupExtension.php:35
2514
+ #: app/main/controllers/group/RTMediaGroupExtension.php:109
2515
  msgid "All Group Members"
2516
  msgstr ""
2517
 
2518
  #: app/main/controllers/group/RTMediaGroupExtension.php:39
2519
+ #: app/main/controllers/group/RTMediaGroupExtension.php:113
2520
  msgid "Group Admins and Mods only"
2521
  msgstr ""
2522
 
2523
  #: app/main/controllers/group/RTMediaGroupExtension.php:43
2524
+ #: app/main/controllers/group/RTMediaGroupExtension.php:117
2525
  msgid "Group Admin only"
2526
  msgstr ""
2527
 
2528
+ #: app/main/controllers/group/RTMediaGroupExtension.php:125
2529
  #: app/main/controllers/privacy/RTMediaPrivacy.php:409
2530
  #: templates/media/album-single-edit.php:55
2531
  msgid "Save Changes"
2532
  msgstr ""
2533
 
2534
+ #: app/main/controllers/group/RTMediaGroupExtension.php:171
2535
  msgid "There was an error saving, please try again"
2536
  msgstr ""
2537
 
2538
+ #: app/main/controllers/group/RTMediaGroupExtension.php:173
2539
  msgid "Settings saved successfully"
2540
  msgstr ""
2541
 
2542
+ #: app/main/controllers/group/RTMediaGroupExtension.php:194
2543
  msgid ""
2544
  "You could display a small snippet of information from your group extension "
2545
  "here. It will show on the group\n"
2557
  msgstr ""
2558
 
2559
  #: app/main/controllers/media/RTMediaAlbum.php:56
2560
+ #: app/main/controllers/template/rtmedia-actions.php:198
2561
  msgid "Create Album"
2562
  msgstr ""
2563
 
2564
  #: app/main/controllers/media/RTMediaAlbum.php:57
2565
+ #: app/main/controllers/template/rtmedia-filters.php:82
2566
  msgid "Edit Album"
2567
  msgstr ""
2568
 
2632
  msgstr ""
2633
 
2634
  #: app/main/controllers/media/RTMediaLoginPopup.php:38
2635
+ #: app/main/controllers/template/rtmedia-actions.php:307
2636
+ #: app/main/controllers/template/rtmedia-actions.php:311
2637
  msgid "Upload Media"
2638
  msgstr ""
2639
 
2725
  msgid "Error in updating Media"
2726
  msgstr ""
2727
 
2728
+ #: app/main/controllers/template/rtmedia-actions.php:15
2729
+ #: app/main/controllers/template/rtmedia-actions.php:149
2730
  msgid "Options"
2731
  msgstr ""
2732
 
2733
+ #: app/main/controllers/template/rtmedia-actions.php:51
2734
+ msgid "Image"
2735
  msgstr ""
2736
 
2737
+ #: app/main/controllers/template/rtmedia-actions.php:78
2738
+ msgid "Modify Image"
2739
  msgstr ""
2740
 
2741
+ #: app/main/controllers/template/rtmedia-actions.php:188
2742
+ msgid "Create an Album"
2743
  msgstr ""
2744
 
2745
+ #: app/main/controllers/template/rtmedia-actions.php:190
2746
+ msgid "Album Title : "
2747
  msgstr ""
2748
 
2749
+ #: app/main/controllers/template/rtmedia-actions.php:238
2750
+ #: app/main/controllers/template/rtmedia-actions.php:245
2751
+ #: app/main/controllers/template/rtmedia-filters.php:92
2752
+ msgid "Merge Album"
2753
  msgstr ""
2754
 
2755
+ #: app/main/controllers/template/rtmedia-actions.php:241
2756
+ msgid "Select Album to merge with : "
2757
  msgstr ""
2758
 
2759
+ #: app/main/controllers/template/rtmedia-actions.php:292
2760
+ msgid "Merge"
2761
  msgstr ""
2762
 
2763
+ #: app/main/controllers/template/rtmedia-actions.php:356
2764
+ msgid "Empowering your community with "
 
2765
  msgstr ""
2766
 
2767
+ #: app/main/controllers/template/rtmedia-actions.php:357
2768
+ msgid "The only complete media solution for WordPress, BuddyPress and bbPress"
 
2769
  msgstr ""
2770
 
2771
+ #: app/main/controllers/template/rtmedia-actions.php:377
2772
+ msgid "Close (Esc)"
2773
  msgstr ""
2774
 
2775
+ #: app/main/controllers/template/rtmedia-actions.php:522
2776
+ msgid "You can consider rtMedia Team for following :"
 
2777
  msgstr ""
2778
 
2779
+ #: app/main/controllers/template/rtmedia-actions.php:524
2780
+ msgid "rtMedia Customization ( in Upgrade Safe manner )"
2781
+ msgstr ""
2782
+
2783
+ #: app/main/controllers/template/rtmedia-actions.php:525
2784
+ msgid "WordPress/BuddyPress Theme Design and Development"
2785
+ msgstr ""
2786
+
2787
+ #: app/main/controllers/template/rtmedia-actions.php:526
2788
+ msgid "WordPress/BuddyPress Plugin Development"
2789
+ msgstr ""
2790
+
2791
+ #: app/main/controllers/template/rtmedia-actions.php:529
2792
+ msgid "Contact Us"
2793
+ msgstr ""
2794
+
2795
+ #: app/main/controllers/template/rtmedia-filters.php:50
2796
  msgid "Create New Album"
2797
  msgstr ""
2798
 
2799
+ #: app/main/controllers/template/rtmedia-filters.php:50
2800
  msgid "Add Album"
2801
  msgstr ""
2802
 
2803
+ #: app/main/controllers/template/rtmedia-filters.php:83
2804
+ msgid "Delete Album"
2805
  msgstr ""
2806
 
2807
+ #: app/main/controllers/template/rtmedia-functions.php:1188
2808
+ msgid "There are no comments on this media yet."
2809
  msgstr ""
2810
 
2811
+ #: app/main/controllers/template/rtmedia-functions.php:1240
2812
+ msgid "Delete Comment"
 
 
2813
  msgstr ""
2814
 
2815
+ #: app/main/controllers/template/rtmedia-functions.php:1509
2816
+ msgid "Go to page no : "
2817
  msgstr ""
2818
 
2819
+ #: app/main/controllers/template/rtmedia-functions.php:1514
2820
+ msgid "Go"
2821
  msgstr ""
2822
 
2823
+ #: app/main/controllers/template/rtmedia-functions.php:1820
2824
+ msgid "Type Comment..."
2825
  msgstr ""
2826
 
2827
+ #: app/main/controllers/template/rtmedia-functions.php:1821
2828
+ #: templates/media/media-single.php:98 templates/media/media-single.php:141
2829
+ msgid "Comment"
2830
  msgstr ""
2831
 
2832
+ #: app/main/controllers/template/rtmedia-functions.php:1879
2833
+ #: app/main/controllers/template/rtmedia-functions.php:1888
2834
+ msgid "Delete Media"
2835
  msgstr ""
2836
 
2837
+ #: app/main/controllers/template/rtmedia-functions.php:2134
2838
+ msgid "Profile Albums"
2839
  msgstr ""
2840
 
2841
+ #: app/main/controllers/template/rtmedia-functions.php:2138
2842
+ #: app/main/controllers/template/rtmedia-functions.php:2183
2843
+ msgid "Group Albums"
2844
  msgstr ""
2845
 
2846
+ #: app/main/controllers/template/rtmedia-functions.php:2354
2847
+ msgid "Privacy : "
2848
+ msgstr ""
2849
+
2850
+ #: app/main/controllers/template/rtmedia-functions.php:2663
2851
+ msgid "people like this"
2852
  msgstr ""
2853
 
2854
+ #: app/main/controllers/template/rtmedia-functions.php:2761
2855
  msgid "Public"
2856
  msgstr ""
2857
 
2858
+ #: app/main/controllers/template/rtmedia-functions.php:2766
2859
  msgid "All members"
2860
  msgstr ""
2861
 
2862
+ #: app/main/controllers/template/rtmedia-functions.php:2771
2863
  msgid "Your friends"
2864
  msgstr ""
2865
 
2866
+ #: app/main/controllers/template/rtmedia-functions.php:2776
2867
  msgid "Only you"
2868
  msgstr ""
2869
 
2870
+ #: app/main/controllers/template/rtmedia-functions.php:2781
2871
  msgid "Blocked temporarily"
2872
  msgstr ""
2873
 
2874
+ #: app/main/controllers/template/rtmedia-functions.php:2834
2875
  msgid "%s ago "
2876
  msgstr ""
2877
 
2878
+ #: app/main/controllers/template/rtmedia-functions.php:2848
2879
  msgid "1 second"
2880
  msgid_plural "%s seconds"
2881
  msgstr[0] ""
2882
  msgstr[1] ""
2883
 
2884
+ #: app/main/controllers/template/rtmedia-functions.php:2852
2885
  msgid "1 minute"
2886
  msgid_plural "%s minutes"
2887
  msgstr[0] ""
2888
  msgstr[1] ""
2889
 
2890
+ #: app/main/controllers/template/rtmedia-functions.php:2856
2891
  msgid "1 hour"
2892
  msgid_plural "%s hours"
2893
  msgstr[0] ""
2894
  msgstr[1] ""
2895
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2896
  #: app/main/controllers/upload/RTMediaUploadView.php:79
2897
  msgid "Privacy: "
2898
  msgstr ""
readme.txt CHANGED
@@ -1,12 +1,12 @@
1
  === rtMedia for WordPress, BuddyPress and bbPress ===
2
- Contributors: rtcamp, sanket.parmar, pranalipatel, jignesh.nakrani, mangeshp, manishsongirkar36, kiranpotphode, rittesh.patel, sagarjadhav, pushpak.pop, faishal, desaiuditd, rahul286, JoshuaAbenazer, gagan0123, saurabhshukla, nitun.lanjewar, umesh.nevase, suhasgirgaonkar, neerukoul, hrishiv90, kanakiyajay, jarretc, tobiaskluge, rafaelfunchal, UmeshSingla, mehulkaklotar, tannermirabel, kishores, chandrapatel
3
  Donate link: http://rtcamp.com/donate/
4
  Tags: BuddyPress, media, multimedia, album, audio, songs, music, video, photo, image, upload, share, MediaElement.js, ffmpeg, kaltura, media-node, rtMedia, WordPress, bbPress, masonry
5
  License: GPLv2 or later
6
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
7
  Requires at least: WordPress 4.1
8
  Tested up to: 4.6.1
9
- Stable tag: 4.1.5
10
 
11
  Add albums, photo, audio/video upload, privacy, sharing, front-end uploads & more. All this works on mobile/tablets devices.
12
 
@@ -95,7 +95,7 @@ rtMedia has 3 premium solutions to take care of audio/video conversion.
95
  * [Documentation](https://rtmedia.io/docs/?utm_source=readme&utm_medium=plugin&utm_campaign=buddypress-media "Visit rtMedia's Documentation page")
96
  * [FAQ](https://rtmedia.io/faq/?utm_source=readme&utm_medium=plugin&utm_campaign=buddypress-media "Visit rtMedia's FAQ page")
97
  * [Support](http://community.rtcamp.com/c/rtmedia/?utm_source=readme&utm_medium=plugin&utm_campaign=buddypress-media "Visit rtMedia's support page")
98
- * [GitHub](http://github.com/rtCamp/rtMedia/) - Please mention your wordpress.org username when sending pull requests.
99
  * [Translations](https://rtmedia.io/translate/projects/rtmedia?utm_source=readme&utm_medium=plugin&utm_campaign=buddypress-media) - Please do NOT use Github for translations. Instead Use [this GlotPress project](https://rtmedia.io/translate/projects/rtmedia?utm_source=readme&utm_medium=plugin&utm_campaign=buddypress-media)
100
 
101
  == Installation ==
@@ -135,6 +135,14 @@ http://www.youtube.com/watch?v=dJrykKQGDcs
135
 
136
  == Changelog ==
137
 
 
 
 
 
 
 
 
 
138
  = 4.1.5 [Sep 15, 2016] =
139
  * Fix issue where multiple gallery shortcode not working together
140
  * Add filter to change 'under' album text
@@ -1223,8 +1231,9 @@ http://www.youtube.com/watch?v=dJrykKQGDcs
1223
 
1224
  == Upgrade Notice ==
1225
 
1226
- = 4.1.5 =
1227
- Requires BuddyPress 1.7 or higher, if using BuddyPress. Fix issue where multiple gallery shortcode not working together and added filter to change 'under' album text.
 
1228
 
1229
  == Sponsors ==
1230
 
1
  === rtMedia for WordPress, BuddyPress and bbPress ===
2
+ Contributors: rtcamp, sanket.parmar, pranalipatel, jignesh.nakrani, mangeshp, manishsongirkar36, kiranpotphode, yahil, rittesh.patel, sagarjadhav, pushpak.pop, faishal, desaiuditd, rahul286, JoshuaAbenazer, gagan0123, saurabhshukla, nitun.lanjewar, umesh.nevase, suhasgirgaonkar, neerukoul, hrishiv90, kanakiyajay, jarretc, tobiaskluge, rafaelfunchal, UmeshSingla, mehulkaklotar, tannermirabel, kishores, chandrapatel
3
  Donate link: http://rtcamp.com/donate/
4
  Tags: BuddyPress, media, multimedia, album, audio, songs, music, video, photo, image, upload, share, MediaElement.js, ffmpeg, kaltura, media-node, rtMedia, WordPress, bbPress, masonry
5
  License: GPLv2 or later
6
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
7
  Requires at least: WordPress 4.1
8
  Tested up to: 4.6.1
9
+ Stable tag: 4.1.6
10
 
11
  Add albums, photo, audio/video upload, privacy, sharing, front-end uploads & more. All this works on mobile/tablets devices.
12
 
95
  * [Documentation](https://rtmedia.io/docs/?utm_source=readme&utm_medium=plugin&utm_campaign=buddypress-media "Visit rtMedia's Documentation page")
96
  * [FAQ](https://rtmedia.io/faq/?utm_source=readme&utm_medium=plugin&utm_campaign=buddypress-media "Visit rtMedia's FAQ page")
97
  * [Support](http://community.rtcamp.com/c/rtmedia/?utm_source=readme&utm_medium=plugin&utm_campaign=buddypress-media "Visit rtMedia's support page")
98
+ * [GitHub](https://github.com/rtmediawp/rtMedia/) - Please mention your wordpress.org username when sending pull requests.
99
  * [Translations](https://rtmedia.io/translate/projects/rtmedia?utm_source=readme&utm_medium=plugin&utm_campaign=buddypress-media) - Please do NOT use Github for translations. Instead Use [this GlotPress project](https://rtmedia.io/translate/projects/rtmedia?utm_source=readme&utm_medium=plugin&utm_campaign=buddypress-media)
100
 
101
  == Installation ==
135
 
136
  == Changelog ==
137
 
138
+ = 4.1.6 [Sep 26, 2016] =
139
+ * Fix broken UI when image information is edited/updated
140
+ * Fix issue related to media sorting
141
+ * Divide rt-template-functions.php into four files (core functions, actions & filters)
142
+ * Fix playlist settings not getting saved in groups
143
+ * Add filters to alter the image/video URLS in activity
144
+ * Fix bootstrap css selector conflict
145
+
146
  = 4.1.5 [Sep 15, 2016] =
147
  * Fix issue where multiple gallery shortcode not working together
148
  * Add filter to change 'under' album text
1231
 
1232
  == Upgrade Notice ==
1233
 
1234
+ = 4.1.6 =
1235
+ Requires BuddyPress 1.7 or higher, if using BuddyPress. Added filters to alter the image/video URLS in activity. Fixed broken UI when image information is edited/updated also fixed issue related to media sorting
1236
+ and playlist settings not getting saved in groups.
1237
 
1238
  == Sponsors ==
1239
 
templates/media/album-gallery-item.php CHANGED
@@ -21,7 +21,7 @@ if ( isset( $is_edit_allowed[0] ) ) {
21
  $rtmedia_backbone['is_edit_allowed'] = $is_edit_allowed[0];
22
  }
23
  ?>
24
-
25
  <li class="rtmedia-list-item">
26
 
27
  <a href="<?php rtmedia_permalink(); ?>" title="<?php echo esc_attr( rtmedia_title() ); ?>">
21
  $rtmedia_backbone['is_edit_allowed'] = $is_edit_allowed[0];
22
  }
23
  ?>
24
+ <!-- addClass if not default album -->
25
  <li class="rtmedia-list-item">
26
 
27
  <a href="<?php rtmedia_permalink(); ?>" title="<?php echo esc_attr( rtmedia_title() ); ?>">
templates/media/album-gallery.php CHANGED
@@ -27,12 +27,15 @@
27
  <?php rtmedia_uploader( array( 'is_up_shortcode' => false ) ); ?>
28
  </div>
29
 
30
- <?php if ( have_rtmedia() ) { ?>
 
 
31
 
32
- <ul class="rtmedia-list rtmedia-album-list clearfix">
 
33
  <?php while ( have_rtmedia() ) : rtmedia(); ?>
34
- <?php include( 'album-gallery-item.php' ); ?>
35
- <?php endwhile; ?>
36
  </ul>
37
 
38
  <div class="rtmedia_next_prev rtm-load-more clearfix">
@@ -68,6 +71,7 @@
68
  <?php } ?>
69
 
70
  <?php do_action( 'rtmedia_after_album_gallery' ); ?>
 
71
  </div>
72
 
73
  <!-- template for single media in gallery -->
27
  <?php rtmedia_uploader( array( 'is_up_shortcode' => false ) ); ?>
28
  </div>
29
 
30
+ <?php
31
+ do_action( 'rtmedia_after_media_gallery_title' );
32
+ if ( have_rtmedia() ) { ?>
33
 
34
+ <!-- addClass 'rtmedia-list-media' for work properly selectbox -->
35
+ <ul class="rtmedia-list-media rtmedia-list rtmedia-album-list clearfix">
36
  <?php while ( have_rtmedia() ) : rtmedia(); ?>
37
+ <?php include( 'album-gallery-item.php' ); ?>
38
+ <?php endwhile; ?>
39
  </ul>
40
 
41
  <div class="rtmedia_next_prev rtm-load-more clearfix">
71
  <?php } ?>
72
 
73
  <?php do_action( 'rtmedia_after_album_gallery' ); ?>
74
+ <?php do_action( 'rtmedia_after_media_gallery' ); ?>
75
  </div>
76
 
77
  <!-- template for single media in gallery -->