Exemplo n.º 1
1
/**
 * A wrapper for bp_has_activity
 * checks if the gallery has associated activity
 * 
 * @param type $args
 * @return type
 */
function mpp_gallery_has_activity($args = null)
{
    $default = array('gallery_id' => mpp_get_current_gallery_id());
    $args = wp_parse_args($args, $default);
    extract($args);
    $args = array('meta_query' => array(array('key' => '_mpp_gallery_id', 'value' => $gallery_id), array('key' => '_mpp_context', 'value' => 'gallery', 'compare' => '=')), 'type' => 'mpp_media_upload');
    return bp_has_activities($args);
}
Exemplo n.º 2
0
function mpp_gallery_show_publish_gallery_activity_button()
{
    if (!mediapress()->is_bp_active()) {
        return;
    }
    $gallery_id = mpp_get_current_gallery_id();
    //if not a valid gallery id or no unpublished media exists, just don't show it
    if (!$gallery_id || !mpp_gallery_has_unpublished_media($gallery_id)) {
        return;
    }
    $gallery = mpp_get_gallery($gallery_id);
    $unpublished_media = mpp_gallery_get_unpublished_media($gallery_id);
    //unpublished media count
    $unpublished_media_count = count($unpublished_media);
    $type = $gallery->type;
    $type_name = _n($type, $type . 's', $unpublished_media_count);
    //if we are here, there are unpublished media
    ?>
	<div id="mpp-unpublished-media-info">
		<p> <?php 
    printf(__('You have %d %s not published to actvity.', 'mediapress'), $unpublished_media_count, $type_name);
    ?>
			<span class="mpp-gallery-publish-activity"><?php 
    mpp_gallery_publish_activity_link($gallery_id);
    ?>
</span>
			<span class="mpp-gallery-unpublish-activity"><?php 
    mpp_gallery_unpublished_media_delete_link($gallery_id);
    ?>
</span>
		</p>
	</div>

	<?php 
}
Exemplo n.º 3
0
function mpp_get_all_media_ids($args = null)
{
    $component = mpp_get_current_component();
    $component_id = mpp_get_current_component_id();
    $default = array('gallery_id' => mpp_get_current_gallery_id(), 'component' => $component, 'component_id' => $component_id, 'per_page' => -1, 'status' => mpp_get_accessible_statuses($component, $component_id, get_current_user_id()), 'nopaging' => true, 'fields' => 'ids');
    $args = wp_parse_args($args, $default);
    $ids = new MPP_Media_Query($args);
    return $ids->get_ids();
}
Exemplo n.º 4
0
function mpp_modify_page_title($complete_title, $title, $sep, $seplocation)
{
    $sub_title = array();
    if (!mpp_is_component_gallery() && !mpp_is_gallery_component()) {
        return $complete_title;
    }
    if (mpp_is_single_gallery()) {
        $sub_title[] = get_the_title(mpp_get_current_gallery_id());
    }
    if (mpp_is_single_media()) {
        $sub_title[] = get_the_title(mpp_get_current_media_id());
    }
    if (mpp_is_gallery_management() || mpp_is_media_management()) {
        $sub_title[] = ucwords(mediapress()->get_action());
        $sub_title[] = ucwords(mediapress()->get_edit_action());
    }
    $sub_title = array_filter($sub_title);
    if (!empty($sub_title)) {
        $complete_title = $complete_title . join(' | ', $sub_title) . ' | ';
    }
    return $complete_title;
}
Exemplo n.º 5
0
 *		 status =public|private|friendsonly|groupsonly|any registered status
 *  	
 * 
 * Please create your template if you need specific templates for photo, video etc
 * 
 * 
 *	
 * Fallback single Gallery View
 */
$gallery = mpp_get_current_gallery();
$type = $gallery->type;
if (mpp_have_media()) {
    ?>

    <?php 
    if (mpp_user_can_list_media(mpp_get_current_gallery_id())) {
        ?>

		<?php 
        do_action('mpp_before_single_gallery');
        ?>
		
		<?php 
        if (mpp_show_gallery_description()) {
            ?>

			<div class="mpp-gallery-description mpp-single-gallery-description mpp-<?php 
            echo $type;
            ?>
-gallery-description mpp-clearfix">
				<?php 
function mpp_get_adjacent_gallery_link($format, $link, $gallery_id = null, $previous = false)
{
    if (!$gallery_id) {
        $gallery_id = mpp_get_current_gallery_id();
    }
    if (!$previous) {
        $next_gallery_id = mpp_get_next_gallery_id($gallery_id);
    } else {
        $next_gallery_id = mpp_get_previous_gallery_id($gallery_id);
    }
    if (!$next_gallery_id) {
        return;
    }
    $gallery = mpp_get_gallery($next_gallery_id);
    if (empty($gallery)) {
        return;
    }
    $title = mpp_get_gallery_title($gallery);
    if (empty($title)) {
        $title = $previous ? __('Previous', 'mediapress') : __('Next', 'mediapress');
    }
    $date = mysql2date(get_option('date_format'), $gallery->date_created);
    $rel = $previous ? 'prev' : 'next';
    $string = '<a href="' . mpp_get_gallery_permalink($gallery) . '" rel="' . $rel . '">';
    $inlink = str_replace('%title', $title, $link);
    $inlink = str_replace('%date', $date, $inlink);
    $inlink = $string . $inlink . '</a>';
    $output = str_replace('%link', $inlink, $format);
    return $output;
}
function mpp_list_comments($args, $comments = null)
{
    $post_id = 0;
    if (!isset($args['post_id'])) {
        if (mpp_is_single_media()) {
            $post_id = mpp_get_current_media_id();
        } elseif (mpp_is_single_gallery()) {
            $post_id = mpp_get_current_gallery_id();
        }
    } else {
        $post_id = $args['post_id'];
    }
    if ($post_id) {
        $comments = get_comments(array('post_id' => $post_id));
    }
    wp_list_comments($args, $comments);
}
 /**
  * Setup query for listing Media inside single gallery
  * 
  */
 public function setup_gallery_media_query()
 {
     //since we already know that this is a single gallery, It muist be media list screen
     $args = array('component_id' => $this->component_id, 'component' => $this->component, 'gallery_id' => mpp_get_current_gallery_id(), 'status' => $this->accessible_statuses);
     if ($this->mpage) {
         $args['page'] = absint($this->mpage);
     }
     //let them do the magic if they want to
     $args = apply_filters('mpp_main_media_query_args', $args);
     //remove empty
     $args = array_filter($args);
     //we are on User gallery home page
     //we do need to check for the access level here and pass it to the query
     mediapress()->the_media_query = new MPP_Media_Query($args);
     //set it is the user galleries list view
     //mediapress()->is_gallery_home = true;
 }
Exemplo n.º 9
0
    ?>
</label>
			<textarea name='mpp-gallery-description' rows="5" class='mpp-input-1'><?php 
    echo esc_textarea($gallery->description);
    ?>
</textarea>
		</div>
		<div class="mpp-u-1-1 mpp-clearfix">
			<?php 
    do_action('mpp_after_edit_gallery_form_fields');
    ?>
		</div>	
		
		<input type='hidden' name="mpp-action" value='edit-gallery' />
		<input type="hidden" name='mpp-gallery-id' value="<?php 
    echo mpp_get_current_gallery_id();
    ?>
 " />
		
		<?php 
    wp_nonce_field('mpp-edit-gallery', 'mpp-nonce');
    ?>
		
		<div class="mpp-u-1 mpp-clearfix mpp-submit-button">
			<button type="submit"  class='mpp-button-primary mpp-button-secondary mpp-align-right'> <?php 
    _e('Save', 'mediapress');
    ?>
</button>
		</div>
		
		
Exemplo n.º 10
0
 public function context_menu_edit()
 {
     if (mpp_is_gallery_management() || mpp_is_media_management()) {
         return;
     }
     if (!mpp_is_single_gallery()) {
         return;
     }
     if (!mpp_user_can_edit_gallery(mpp_get_current_gallery_id())) {
         return;
     }
     if (mpp_is_single_media()) {
         $url = mpp_get_media_edit_url();
     } else {
         $url = mpp_get_gallery_edit_media_url(mpp_get_current_gallery());
     }
     //bulk edit media url
     printf('<li><a href="%1$s" title ="%2$s"> %3$s</a></li>', $url, __('Edit', 'mediapress'), __('Edit', 'mediapress'));
 }
Exemplo n.º 11
0
 * Activity Loop to show Single member's gallery Item Activity
 *
 **/
if (!function_exists('bp_is_active') || !bp_is_active('activity')) {
    return;
}
//if gallery comment is not enabled do not load it?
if (!mpp_get_option('enable_gallery_comment')) {
    return;
}
?>

<div class="mpp-activity mpp-media-activity" id="mpp-media-activity-list">
	
	<?php 
if (is_user_logged_in() && mpp_user_can_comment_on_gallery(mpp_get_current_gallery_id())) {
    ?>
		
		<?php 
    mpp_locate_template(array('buddypress/activity/post-form.php'), true);
    ?>

	<?php 
}
?>
	
	<?php 
do_action('mpp_before_activity_loop');
?>
	
	<?php 
Exemplo n.º 12
0
<?php

// Exit if the file is accessed directly over web
if (!defined('ABSPATH')) {
    exit;
}
/**
 * Bulk Edit Media template for single gallery bulk media edit page
 * action:mediapress/gallery/galleryname/manage/edit/
 * 
 */
//fetch all media in the gallery
$items = new MPP_Media_Query(array('gallery_id' => mpp_get_current_gallery_id(), 'per_page' => -1, 'nopaging' => true));
if ($items->have_media()) {
    ?>

	<form action="" method="post" id="mpp-media-bulkedit-form" class="mpp-form mpp-form-stacked mpp-form-bulkedit-media ">
		
		<?php 
    do_action('mpp_before_bulkedit_media_form');
    ?>
		
		<div class="mpp-g mpp-bulk-edit-media-action-row">
			<div class="mpp-u-2-24 mpp-bulk-edit-media-checkbox">
				<?php 
    //allow to check/uncheck
    ?>
				<input type="checkbox" name="mpp-check-all" value="1" id="mpp-check-all" />
			</div>

			<div class="mpp-u-17-24 mpp-bulk-edit-media-action">
Exemplo n.º 13
0
 public function context_menu_edit()
 {
     if (mpp_is_gallery_management() || mpp_is_media_management()) {
         return;
     }
     if (!mpp_is_single_gallery()) {
         return;
     }
     if (!mpp_user_can_edit_gallery(mpp_get_current_gallery_id())) {
         return;
     }
     $links = '';
     if (mpp_is_single_media()) {
         $url = mpp_get_media_edit_url();
         $links .= sprintf('<li><a href="%1$s" title ="%2$s"> %3$s</a></li>', $url, _x('Edit media', 'Profile context menu rel', 'mediapress'), _x('Edit', 'Profile context menu media edit label', 'mediapress'));
     } else {
         $url = mpp_get_gallery_edit_media_url(mpp_get_current_gallery());
         //bulk edit media url
         $links .= sprintf('<li><a href="%1$s" title ="%2$s"> %3$s</a></li>', $url, _x('Edit Gallery', 'Profile context menu rel attribute', 'mediapress'), _x('Edit', 'Profile contextual edit gallery menu label', 'mediapress'));
         $links .= sprintf('<li><a href="%1$s" title ="%2$s"> %3$s</a></li>', mpp_get_gallery_add_media_url(mpp_get_current_gallery()), _x('Add Media', 'Profile context menu rel attribute', 'mediapress'), _x('Add Media', 'Profile contextual add media  menu label', 'mediapress'));
     }
     echo $links;
 }
Exemplo n.º 14
0
}
/**
 * Bulk Edit Media template for single gallery bulk media edit page
 * action:mediapress/gallery/galleryname/manage/edit/
 * 
 */
?>
<a href="#" id = "mpp-reload-bulk-edit-tab" class="mpp-reload" title="<?php 
_e('Reload media edit panel', 'mediapress');
?>
"><span class="dashicons dashicons-update"></span> <?php 
_e('Reload', 'mediapress');
?>
</a>
<?php 
$current_gallery_id = mpp_get_current_gallery_id();
//fetch all media in the gallery
$items = mediapress()->the_media_query;
if ($items->have_media()) {
    ?>
<div class="mpp-container" id="mpp-container">
	<div id="mpp-media-bulkedit-div" class="mpp-form mpp-form-stacked mpp-form-bulkedit-media ">
		
		<?php 
    do_action('mpp_before_bulkedit_media_form');
    ?>
		
		<div class="mpp-g mpp-media-edit-bulk-action-row">
			<div class="mpp-u-2-24">
				<?php 
    //allow to check/uncheck