Esempio n. 1
0
/**
 * Load the Page template for MediaPress Single Sitewide Gallery
 * Looks for mediapress/default/single-gallery-$type-$status.php
 *			 mediapress/default/single-gallery-$type.php
 *			 mediapress/default/single-gallery.php
 *			 single-mpp-gallery.php
 *			 singular.php
 *			 index.php
 * in the child theme, then parent theme and finally falls back to check in wp-content/mediapress/template/mediapress/default
 * We don't provide any default copy for this as we are not going to mess with the page layout. Still, a theme developer has the choice to do it their own way
 * 	 
 * Look at template_include hook and 
 * 
 * @see get_single_template()
 * @see get_query_template()
 * 
 * @param string $template absolute path to the template file
 * @return string absolute path to the template file
 */
function mpp_filter_single_template_for_sitewide_gallery($template)
{
    //our sitewide gallery is not enabled or we are not on single sitewide gallery no need to bother
    if (!mpp_is_active_component('sitewide') || !mpp_is_sitewide_gallery_component()) {
        return $template;
    }
    $default_template = 'mediapress/default/sitewide/home.php';
    //modify it to use the current default template
    //load our template
    //should we load separate template for edit actions?
    $gallery = mpp_get_current_gallery();
    $media = mpp_get_current_media();
    $templates = array($default_template);
    /*if( $media ) {
    		
    		$type = $media->type;
    		$status = $media->status;
    		$slug =  'single-media';
    		//this is single media page
    		
    	} elseif( $gallery ) {
    		//single gallery page
    		$slug = 'single-gallery';
    		$type = $gallery->type;
    		$status = $gallery->status;
    		
    	}
    	//look inside theme's mediapress/ directory
    	$templates = $default_template . $slug . '-' . $type . '-' . $status . '.php';//single-gallery-photo-public.php/single-media-photo-public.php 
    	$templates = $default_template . $slug . '-' . $type . '.php'; //single-gallery-photo.php/single-media-photo.php 
    	$templates = $default_template . $slug . '.php'; //single-gallery.php/single-media.php 
    	*/
    //we need to locate the template and if the template is not present in the themes, we need to setup theme compat
    $located = locate_template($templates);
    if ($located) {
        //mediapress()->set_theme_compat( false );
        $template = $located;
    } else {
        //if not found, setup theme compat
        mpp_setup_sitewide_gallery_theme_compat();
    }
    return $template;
}
Esempio n. 2
0
<?php

// Exit if the file is accessed directly over web
if (!defined('ABSPATH')) {
    exit;
}
?>
<div class="mpp-menu mpp-menu-open mpp-menu-horizontal mpp-media-admin-menu">
	
	<?php 
mpp_media_menu(mpp_get_current_media(), mpp_get_current_edit_action());
?>
</div>
<hr />
<?php 
if (mpp_is_media_delete()) {
    $template = 'gallery/media/manage/delete.php';
} elseif (mpp_is_media_management()) {
    $template = 'gallery/media/manage/edit.php';
}
$template = apply_filters('mpp_get_media_management_template', $template);
//load it
mpp_get_template($template);
Esempio n. 3
0
function mpp_get_single_media_template($media = null)
{
    $templates = array();
    if (!$media) {
        $media = mpp_get_current_media();
    }
    $loader = mpp_get_component_template_loader($media->component);
    $path = $loader->get_path();
    $type = $media->type;
    $status = $media->status;
    $slug = 'media/single';
    $templates[] = $path . $slug . '-' . $type . '-' . $status . '.php';
    //single-photo-public.php
    //$templates[] =  $path . $slug . '-' . $type . '-' . $status . '.php'; //single-photo-public.php
    $templates[] = $path . $slug . '-' . $type . '-' . $status . '.php';
    //single-photo-public.php
    $templates[] = $path . $slug . '-' . $type . '.php';
    //single-photo.php
    $templates[] = $path . $slug . '.php';
    //single.php
    return $templates;
}
Esempio n. 4
0
<?php

/**
 * Single audio view
 */
$media = mpp_get_current_media();
if (!$media) {
    return '';
}
$args = array('src' => mpp_get_media_src(), 'loop' => false, 'autoplay' => false);
echo wp_audio_shortcode($args);
/**
 * Generate/Display breadcrumb 
 * @param array $args
 * @return string|null
 */
function mpp_gallery_breadcrumb($args = null)
{
    $default = array('separator' => '/', 'before' => '', 'after' => '', 'show_home' => false);
    $args = wp_parse_args($args, $default);
    extract($args);
    $crumbs = array();
    $component = mpp_get_current_component();
    $component_id = mpp_get_current_component_id();
    if (mediapress()->is_bp_active() && bp_is_active('groups') && bp_is_group()) {
        $name = bp_get_group_name(groups_get_current_group());
    } elseif (mediapress()->is_bp_active() && bp_is_user()) {
        $name = bp_get_displayed_user_fullname();
    } elseif ($component == 'sitewide') {
        $name = '';
    }
    $my_or_his_gallery = '';
    if ($name) {
        $my_or_his_gallery = sprintf(__("%s's gallery", 'mediapress'), $name);
    }
    if (function_exists('bp_is_my_profile') && bp_is_my_profile()) {
        $my_or_his_gallery = __('Your Galleries', 'mediapress');
    }
    if (mpp_is_media_management()) {
        $crumbs[] = ucwords(mediapress()->get_edit_action());
    }
    if (mpp_is_single_media()) {
        $media = mpp_get_current_media();
        if (mpp_is_media_management()) {
            $crumbs[] = sprintf('<a href="%s">%s</a>', mpp_get_media_permalink($media), mpp_get_media_title($media));
        } else {
            $crumbs[] = sprintf('<span>%s</span>', mpp_get_media_title($media));
        }
    }
    if (mpp_is_gallery_management()) {
        $crumbs[] = ucwords(mediapress()->get_edit_action());
    }
    if (mpp_is_single_gallery()) {
        $gallery = mpp_get_current_gallery();
        if (mpp_is_gallery_management() || mpp_is_single_media()) {
            $crumbs[] = sprintf('<a href="%s">%s</a>', mpp_get_gallery_permalink($gallery), mpp_get_gallery_title($gallery));
        } else {
            $crumbs[] = sprintf('<span>%s</span>', mpp_get_gallery_title($gallery));
        }
    }
    if ($my_or_his_gallery) {
        $crumbs[] = sprintf('<a href="%s">%s</a>', mpp_get_gallery_base_url($component, $component_id), $my_or_his_gallery);
    }
    if (count($crumbs) <= 1 && !$show_home) {
        return;
    }
    $crumbs = array_reverse($crumbs);
    echo join($separator, $crumbs);
}