コード例 #1
0
ファイル: widget-media.php プロジェクト: baden03/mediapress
 public function widget($args, $instance)
 {
     extract($args);
     $defaults = array('type' => false, 'id' => false, 'in' => false, 'exclude' => false, 'slug' => false, 'status' => false, 'component' => false, 'component_id' => false, 'per_page' => false, 'offset' => false, 'page' => false, 'nopaging' => false, 'order' => 'DESC', 'orderby' => 'date', 'user_id' => false, 'include_users' => false, 'exclude_users' => false, 'user_name' => false, 'scope' => false, 'search_terms' => '', 'year' => false, 'month' => false, 'week' => '', 'day' => '', 'hour' => '', 'minute' => '', 'second' => '', 'yearmonth' => false, 'meta_key' => '', 'meta_value' => '', 'fields' => false);
     $instance = (array) $instance;
     echo $before_widget;
     if (!empty($instance['title'])) {
         echo $before_title . $instance['title'] . $after_title;
     }
     unset($instance['title']);
     $playlist = $instance['playlist'];
     unset($instance['playlist']);
     $args = array_merge($defaults, $instance);
     $query = new MPP_Media_Query($args);
     mpp_widget_save_media_data('query', $query);
     $type = $instance['type'];
     $slug = '';
     if ($instance['type'] && $playlist) {
         $slug = "{$type}-playlist";
     } else {
         $slug = $type;
     }
     mpp_get_template_part('widgets/loop', $slug);
     //shortcodes/gallery-entry.php
     mpp_widget_reset_media_data('query');
     echo $after_widget;
 }
コード例 #2
0
ファイル: gallery-list.php プロジェクト: baden03/mediapress
function mpp_gallery_shortcode($atts = null, $content = '')
{
    //allow everything that can be done to be passed via this shortcode
    $defaults = array('type' => false, 'id' => false, 'in' => false, 'exclude' => false, 'slug' => false, 'status' => false, 'component' => false, 'component_id' => false, 'per_page' => false, 'offset' => false, 'page' => false, 'nopaging' => false, 'order' => 'DESC', 'orderby' => 'date', 'user_id' => false, 'include_users' => false, 'exclude_users' => false, 'user_name' => false, 'scope' => false, 'search_terms' => '', 'year' => false, 'month' => false, 'week' => '', 'day' => '', 'hour' => '', 'minute' => '', 'second' => '', 'yearmonth' => false, 'meta_key' => '', 'meta_value' => '', 'fields' => false, 'column' => 4);
    $atts = shortcode_atts($defaults, $atts);
    if (!$atts['meta_key']) {
        unset($atts['meta_key']);
        unset($atts['meta_value']);
    }
    $shortcode_column = $atts['column'];
    mpp_shortcode_save_gallery_data('column', $shortcode_column);
    unset($atts['column']);
    $query = new MPP_Gallery_Query($atts);
    ob_start();
    echo '<div class="mpp-container mpp-shortcode-wrapper mpp-shortcode-gallery-wrapper"><div class="mpp-g mpp-item-list mpp-gallery-list mpp-shortcode-item-list mpp-shortcode-gallery-list"> ';
    while ($query->have_galleries()) {
        $query->the_gallery();
        mpp_get_template_part('shortcodes/gallery', 'entry');
        //shortcodes/gallery-entry.php
    }
    mpp_reset_gallery_data();
    echo '</div></div>';
    $content = ob_get_clean();
    mpp_shortcode_reset_gallery_data('column');
    return $content;
}
コード例 #3
0
ファイル: media-list.php プロジェクト: baden03/mediapress
function mpp_media_shortcode($atts = null, $content = '')
{
    //allow everything that can be done to be passed via this shortcode
    $defaults = array('type' => false, 'id' => false, 'in' => false, 'exclude' => false, 'slug' => false, 'status' => false, 'component' => false, 'component_id' => false, 'gallery_id' => false, 'galleries' => false, 'galleries_exclude' => false, 'per_page' => false, 'offset' => false, 'page' => false, 'nopaging' => false, 'order' => 'DESC', 'orderby' => 'date', 'user_id' => false, 'include_users' => false, 'exclude_users' => false, 'user_name' => false, 'scope' => false, 'search_terms' => '', 'year' => false, 'month' => false, 'week' => '', 'day' => '', 'hour' => '', 'minute' => '', 'second' => '', 'yearmonth' => false, 'meta_key' => '', 'meta_value' => '', 'column' => 4, 'playlist' => 0, 'fields' => false);
    $atts = shortcode_atts($defaults, $atts);
    if (!$atts['meta_key']) {
        unset($atts['meta_key']);
        unset($atts['meta_value']);
    }
    $cols = $atts['column'];
    $playlist = $atts['playlist'];
    $type = $atts['type'];
    unset($atts['column']);
    unset($atts['playlist']);
    $slug = '';
    if ($type && $playlist) {
        $slug = "{$type}-playlist";
    } elseif ($type) {
        $slug = $type;
    }
    mpp_shortcode_save_media_data('column', $cols);
    $query = new MPP_Media_Query($atts);
    mpp_shortcode_save_media_data('query', $query);
    ob_start();
    echo '<div class="mpp-container mpp-shortcode-media-wrapper"><div class="mpp-g mpp-item-list mpp-media-list mpp-media-shortcode-list"> ';
    mpp_get_template_part('shortcodes/loop', $slug);
    //shortcodes/gallery-entry.php
    echo '</div></div>';
    $content = ob_get_clean();
    mpp_shortcode_reset_media_data('query');
    mpp_shortcode_reset_media_data('column');
    return $content;
}
コード例 #4
0
ファイル: hooks.php プロジェクト: baden03/mediapress
/**
 * Show the list of attached media in an activity
 * Should we add a link to view gallery too?
 * 
 * @return type
 */
function mpp_activity_inject_attached_media_html()
{
    $media_list = mpp_activity_get_attached_media_ids(bp_get_activity_id());
    if (empty($media_list)) {
        return;
    }
    $activity_id = bp_get_activity_id();
    $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);
    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-loop-audio/media-loop-video,media-loop-photo, media-loop
    mpp_get_template_part('gallery/activity/loop', $slug);
}
コード例 #5
0
 /**
  * Posts new Activity comments received via a POST request.
  *
  * @global BP_Activity_Template $activities_template
  * @return string HTML
  * @since BuddyPress (1.2)
  */
 public function post_reply()
 {
     global $activities_template;
     $bp = buddypress();
     // Bail if not a POST action
     if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) {
         return;
     }
     // Check the nonce
     check_admin_referer('new_activity_comment', '_wpnonce_new_activity_comment');
     if (!is_user_logged_in()) {
         exit('-1');
     }
     $feedback = __('There was an error posting your reply. Please try again.', 'mediapress');
     if (empty($_POST['content'])) {
         exit('-1<div id="message" class="error bp-ajax-message"><p>' . esc_html__('Please do not leave the comment area blank.', 'mediapress') . '</p></div>');
     }
     if (empty($_POST['form_id']) || empty($_POST['comment_id']) || !is_numeric($_POST['form_id']) || !is_numeric($_POST['comment_id'])) {
         exit('-1<div id="message" class="error bp-ajax-message"><p>' . esc_html($feedback) . '</p></div>');
     }
     $comment_id = bp_activity_new_comment(array('activity_id' => $_POST['form_id'], 'content' => $_POST['content'], 'parent_id' => $_POST['comment_id']));
     if (!$comment_id) {
         if (!empty($bp->activity->errors['new_comment']) && is_wp_error($bp->activity->errors['new_comment'])) {
             $feedback = $bp->activity->errors['new_comment']->get_error_message();
             unset($bp->activity->errors['new_comment']);
         }
         exit('-1<div id="message" class="error bp-ajax-message"><p>' . esc_html($feedback) . '</p></div>');
     }
     // Load the new activity item into the $activities_template global
     bp_has_activities('display_comments=stream&hide_spam=false&show_hidden=true&include=' . $comment_id);
     // Swap the current comment with the activity item we just loaded
     if (isset($activities_template->activities[0])) {
         $activities_template->activity = new stdClass();
         $activities_template->activity->id = $activities_template->activities[0]->item_id;
         $activities_template->activity->current_comment = $activities_template->activities[0];
         // Because the whole tree has not been loaded, we manually
         // determine depth
         $depth = 1;
         $parent_id = (int) $activities_template->activities[0]->secondary_item_id;
         while ($parent_id !== (int) $activities_template->activities[0]->item_id) {
             $depth++;
             $p_obj = new BP_Activity_Activity($parent_id);
             $parent_id = (int) $p_obj->secondary_item_id;
         }
         $activities_template->activity->current_comment->depth = $depth;
     }
     // get activity comment template part
     mpp_get_template_part('activity/comment');
     unset($activities_template);
     exit;
 }
コード例 #6
0
ファイル: default.php プロジェクト: baden03/mediapress
        ?>
		
		<?php 
        $type = mpp_get_gallery_type();
        ?>

		<div class='mpp-g mpp-item-list mpp-media-list mpp-<?php 
        echo $type;
        ?>
-list mpp-single-gallery-media-list mpp-single-gallery-<?php 
        echo $type;
        ?>
-list'>
			
			<?php 
        mpp_get_template_part('gallery/media/loop', mpp_get_media_loop_template_slug(mpp_get_gallery()));
        ?>
			
		</div>

		<?php 
        do_action('mpp_after_single_gallery');
        ?>

        <?php 
        mpp_media_pagination();
        ?>

		<?php 
        do_action('mpp_after_single_gallery_pagination');
        ?>
コード例 #7
0
 private function get_media_lightbox_entry()
 {
     ob_start();
     mpp_get_template_part('gallery/media/views/lightbox-comment');
     return ob_get_clean();
 }
コード例 #8
0
function mpp_activity_inject_media_in_comment_replies()
{
    $activity_id = bp_get_activity_id();
    $media_id = mpp_activity_get_media_id($activity_id);
    if (empty($media_id)) {
        return;
    }
    $media = mpp_get_media($media_id);
    if (!$media) {
        return;
    }
    //	$gallery_id	= mpp_activity_get_gallery_id( $activity_id );
    //
    //	$gallery	= mpp_get_gallery( $gallery_id );
    //
    //	if( ! $gallery ) {
    //		return ;
    //	}
    $slug = $media->type;
    //media-loop-audio/media-loop-video,media-loop-photo, media-loop
    mpp_get_template_part('buddypress/activity/entry-comment', $slug);
}
コード例 #9
0
ファイル: ajax.php プロジェクト: baden03/mediapress
 private function get_activity_media_lightbox_entry()
 {
     ob_start();
     mpp_get_template_part('gallery/media/single/lightbox', 'entry');
     return ob_get_clean();
 }