?> <div class="mpp-notice mpp-gallery-prohibited"> <p><?php printf(__('The privacy policy does not allow you to view this.', 'mediapress')); ?> </p> </div> <?php } ?> <?php mpp_reset_media_data(); ?> <?php } else { ?> <?php //we should seriously think about adding create gallery button here ?> <?php if (mpp_user_can_upload(mpp_get_current_component(), mpp_get_current_component_id())) { ?> <?php mpp_get_template('gallery/manage/add-media.php'); ?>
public function fetch_gallery_media() { //do we need nonce validation for this request too? no $items = array(); $gallery_id = absint($_POST['gallery_id']); $gallery = mpp_get_gallery($gallery_id); if (!$gallery_id || empty($gallery)) { exit(0); } $statuses = mpp_get_accessible_statuses($gallery->component, $gallery->component_id, get_current_user_id()); $media_query = new MPP_Media_Query(array('gallery_id' => $gallery_id, 'posts_per_page' => -1, 'status' => $statuses)); if ($media_query->have_media()) { ?> <?php while ($media_query->have_media()) { $media_query->the_media(); ?> <?php $items[] = array('src' => $this->get_media_lightbox_entry()); ?> <?php } ?> <?php } ?> <?php mpp_reset_media_data(); ?> <?php wp_send_json(array('items' => $items)); exit(0); }
public function fetch_activity_media() { //do we need nonce validation for this request too? no $items = array(); $activity_id = $_POST['activity_id']; if (!$activity_id) { exit(0); } $media_ids = mpp_activity_get_attached_media_ids($activity_id); if (empty($media_ids)) { array_push($items, __('Sorry, Nothing found!', 'mediapress')); wp_send_json(array('items' => $items)); exit(0); } $gallery_id = mpp_activity_get_gallery_id($activity_id); $gallery = mpp_get_gallery($gallery_id); if ($gallery->component == 'groups' && function_exists('bp_is_active') && bp_is_active('groups')) { //if( empty( buddypress()->groups)) } $media_query = new MPP_Media_Query(array('in' => $media_ids)); if ($media_query->have_media()) { ?> <?php while ($media_query->have_media()) { $media_query->the_media(); ?> <?php $items[] = array('src' => $this->get_activity_media_lightbox_entry()); ?> <?php } ?> <?php } ?> <?php mpp_reset_media_data(); ?> <?php wp_send_json(array('items' => $items)); exit(0); }
public function fetch_activity_media() { //do we need nonce validation for this request too? no $items = array(); $activity_id = $_POST['activity_id']; if (!$activity_id) { exit(0); } $media_ids = mpp_activity_get_attached_media_ids($activity_id); if (empty($media_ids)) { array_push($items, __('Sorry, Nothing found!', 'mediapress')); wp_send_json(array('items' => $items)); exit(0); } $gallery_id = mpp_activity_get_gallery_id($activity_id); $gallery = mpp_get_gallery($gallery_id); //in case we are using oembed or other storage method $storage_method = mpp_get_media_meta($gallery->id, '_mpp_storage_method', true); //should we check for 'local' instead of default? if ($storage_method == mpp_get_default_storage_method()) { $storage_method = ''; } $slug = $gallery->type; if (!empty($storage_method)) { $slug = $slug . '-' . $storage_method; //eg. video-oembed } $media_query = new MPP_Media_Query(array('in' => $media_ids)); if ($media_query->have_media()) { ?> <?php while ($media_query->have_media()) { $media_query->the_media(); ?> <?php $items[] = array('src' => $this->get_activity_media_lightbox_entry()); ?> <?php } ?> <?php } ?> <?php mpp_reset_media_data(); ?> <?php //media-loop-audio/media-loop-video,media-loop-photo, media-loop //mpp_get_template_part( 'gallery/activity/loop', $slug ); wp_send_json(array('items' => $items)); exit(0); }
public function generate_upload_meta_box($post) { ?> <!-- append uploaded media here --> <div id="mpp-gallery-media-admin-list" class="mpp-uploading-media-list"> <ul> <?php $gallery_id = $post->ID; $mppq = new MPP_Media_Query(array('gallery_id' => $gallery_id, 'per_page' => -1, 'nopaging' => true)); ?> <?php while ($mppq->have_media()) { $mppq->the_media(); ?> <li id="mpp-uploaded-media-item-<?php mpp_media_id(); ?> " class="<?php mpp_media_class('mpp-uploaded-media-item'); ?> "> <img src="<?php mpp_media_src('thumbnail'); ?> "> </li> <?php } ?> <?php mpp_reset_media_data(); ?> </ul> </div> <!-- drop files here for uploading --> <div id="mpp-gallery-admin-dropzone" class="mpp-dropzone"> <button id="mpp-add-gallery-admin-media">Add media</button> </div> <!-- show any feedback here --> <div id="mpp-gallery-upload-admin-feedback" class="mpp-feedback"> <ul> </ul> </div> <?php }