/** * a wrapper for bp_has_activity * Chck if the activities for a media exist * * @param type $args * @return type */ function mpp_media_has_activity($args = null) { $default = array('media_id' => mpp_get_current_media_id()); $args = wp_parse_args($args, $default); extract($args); $args = array('meta_query' => array(array('key' => '_mpp_media_id', 'value' => $media_id)), 'type' => 'mpp_media_upload'); return bp_has_activities($args); }
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; }
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); }
function mpp_get_adjacent_media_link($format, $link, $media_id = null, $previous = false) { if (!$media_id) { $media_id = mpp_get_current_media_id(); } if (!$previous) { $next_media_id = mpp_get_next_media_id($media_id); } else { $next_media_id = mpp_get_previous_media_id($media_id); } if (!$next_media_id) { return; } $media = mpp_get_media($next_media_id); if (empty($media)) { return; } $title = mpp_get_media_title($media); $css_class = $previous ? 'mpp-previous' : 'mpp-next'; //css class if (empty($title)) { $title = $previous ? __('Previous', 'mediapress') : __('Next', 'mediapress'); } $date = mysql2date(get_option('date_format'), $media->date_created); $rel = $previous ? 'prev' : 'next'; $string = '<a href="' . mpp_get_media_permalink($media) . '" rel="' . $rel . '" class="' . $css_class . '">'; $inlink = str_replace('%title', $title, $link); $inlink = str_replace('%date', $date, $inlink); $inlink = $string . $inlink . '</a>'; $output = str_replace('%link', $inlink, $format); return $output; }
* * @package mediapress */ if (!mpp_get_option('enable_media_comment')) { return; } ?> <?php do_action('mpp_before_activity_loop'); ?> <div class="mpp-activity mpp-media-activity " id="mpp-media-activity-list"> <?php if (is_user_logged_in() && mpp_media_user_can_comment(mpp_get_current_media_id())) { ?> <?php mpp_locate_template(array('activity/post-form.php'), true); ?> <?php } ?> <?php if (mpp_media_has_activity(array('media_id' => mpp_get_media_id()))) { ?> <?php
<div class="mpp-u-1 mpp-media-description"> <label form="mpp-media-description"><?php _e('Description', 'mediapress'); ?> </label> <textarea name='mpp-media-description' rows="5" class='mpp-input-1'><?php echo esc_textarea($media->description); ?> </textarea> </div> <?php do_action('mpp_after_edit_media_form_fields'); ?> <input type='hidden' name="mpp-action" value='edit-media' /> <input type="hidden" name='mpp-media-id' value="<?php echo mpp_get_current_media_id(); ?> " /> <?php wp_nonce_field('mpp-edit-media', '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> </div><!-- end of .mpp-g -->