예제 #1
0
function mpp_setup_gallery_nav()
{
    //only add on single gallery
    if (!mpp_is_single_gallery()) {
        return;
    }
    $gallery = mpp_get_current_gallery();
    $url = '';
    if ($gallery) {
        $url = mpp_get_gallery_permalink($gallery);
    }
    //only add view/edit/dele links on the single mgallery view
    mpp_add_gallery_nav_item(array('label' => __('View', 'mediapress'), 'url' => $url, 'action' => 'view', 'slug' => 'view'));
    $user_id = get_current_user_id();
    if (mpp_user_can_edit_gallery($gallery->id, $user_id)) {
        mpp_add_gallery_nav_item(array('label' => __('Edit Media', 'mediapress'), 'url' => mpp_get_gallery_edit_media_url($gallery), 'action' => 'edit', 'slug' => 'edit'));
    }
    if (mpp_user_can_upload($gallery->component, $gallery->component_id)) {
        mpp_add_gallery_nav_item(array('label' => __('Add Media', 'mediapress'), 'url' => mpp_get_gallery_add_media_url($gallery), 'action' => 'add', 'slug' => 'add'));
    }
    if (mpp_user_can_edit_gallery($gallery->id, $user_id)) {
        mpp_add_gallery_nav_item(array('label' => __('Reorder', 'mediapress'), 'url' => mpp_get_gallery_reorder_media_url($gallery), 'action' => 'reorder', 'slug' => 'reorder'));
        mpp_add_gallery_nav_item(array('label' => __('Edit Details', 'mediapress'), 'url' => mpp_get_gallery_settings_url($gallery), 'action' => 'settings', 'slug' => 'settings'));
    }
    if (mpp_user_can_delete_gallery($gallery->id)) {
        mpp_add_gallery_nav_item(array('label' => __('Delete', 'mediapress'), 'url' => mpp_get_gallery_delete_url($gallery), 'action' => 'delete', 'slug' => 'delete'));
    }
}
예제 #2
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;
}
예제 #3
0
파일: single.php 프로젝트: markc/mediapress
 * Before loading this file, MediaPress will search for 
 * single-{type}-{status}.php
 * single-{type}.php
 * and then fallback to
 * single.php
 * Where type=photo|video|audio|any active type
 *		 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()) {
            ?>
예제 #4
0
<?php

// Exit if the file is accessed directly over web
if (!defined('ABSPATH')) {
    exit;
}
/**
 * This template loads appropriate template file for the current Edit gallery or Edit media action
 * 
 */
?>

<div class="mpp-menu mpp-menu-open  mpp-menu-horizontal mpp-gallery-admin-menu">
	<?php 
mpp_gallery_admin_menu(mpp_get_current_gallery(), mpp_get_current_edit_action());
?>
</div>
<hr />

<?php 
if (mpp_is_gallery_add_media()) {
    $template = 'gallery/single/manage/add-media.php';
} elseif (mpp_is_gallery_edit_media()) {
    $template = 'gallery/single/manage/edit-media.php';
} elseif (mpp_is_gallery_reorder_media()) {
    $template = 'gallery/single/manage/reorder-media.php';
} elseif (mpp_is_gallery_settings()) {
    $template = 'gallery/single/manage/settings.php';
} elseif (mpp_is_gallery_delete()) {
    $template = 'gallery/single/manage/delete.php';
}
예제 #5
0
function mpp_get_single_gallery_template($component = false)
{
    $templates = array();
    $gallery = mpp_get_current_gallery();
    $loader = mpp_get_component_template_loader($gallery->component);
    $path = $loader->get_path();
    $type = $gallery->type;
    $status = $gallery->status;
    $slug = 'gallery/single';
    $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;
}
 public function context_menu_edit()
 {
     if (!mpp_is_single_gallery()) {
         return;
     }
     if (mpp_is_gallery_management() || mpp_is_media_management()) {
         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;
 }
예제 #7
0
 public function add_js_data()
 {
     $settings = array('enable_activity_lightbox' => mpp_get_option('enable_activity_lightbox'));
     $active_types = mpp_get_active_types();
     $extensions = $type_erros = array();
     foreach ($active_types as $type => $object) {
         $type_extensions = mpp_get_allowed_file_extensions_as_string($type, ',');
         $extensions[$type] = array('title' => sprintf('Select %s', ucwords($type)), 'extensions' => $type_extensions);
         $readable_extensions = mpp_get_allowed_file_extensions_as_string($type, ', ');
         $type_erros[$type] = sprintf(_x('This file type is not allowed. Allowed file types are: %s', 'type error message', 'mediapress'), $readable_extensions);
         $allowed_type_messages[$type] = sprintf(_x(' Please only select : %s', 'type error message', 'mediapress'), $readable_extensions);
     }
     $settings['types'] = $extensions;
     $settings['type_errors'] = $type_erros;
     $settings['allowed_type_messages'] = $allowed_type_messages;
     if (mpp_is_single_gallery()) {
         $settings['current_type'] = mpp_get_current_gallery()->type;
     }
     $settings['loader_src'] = mpp_get_asset_url('assets/images/loader.gif', 'mpp-loader');
     $settings = apply_filters('mpp_localizable_data', $settings);
     wp_localize_script('mpp_core', '_mppData', $settings);
     //_mppData
 }
예제 #8
0
파일: home.php 프로젝트: markc/mediapress
mpp_gallery_breadcrumb();
?>
</div>
	<?php 
if (is_super_admin()) {
    mpp_display_space_usage();
}
//main file loaded by MediaPress
//it loads the requested file
if (mpp_is_gallery_create()) {
    $template = 'gallery/create.php';
} elseif (mpp_is_gallery_management()) {
    $template = 'sitewide/gallery/manage.php';
} elseif (mpp_is_media_management()) {
    $template = 'sitewide/media/manage.php';
} elseif (mpp_is_single_media()) {
    $template = 'sitewide/media/single.php';
} elseif (mpp_is_single_gallery()) {
    $template = 'sitewide/gallery/single.php';
} elseif (mpp_is_gallery_home()) {
    $template = 'gallery/loop-gallery.php';
} else {
    $template = 'gallery/404.php';
    //not found
}
$template = apply_filters('mpp_get_sitewide_gallery_template', $template);
mpp_get_template($template);
setup_postdata(mpp_get_current_gallery());
?>
 
</div>  <!-- end of mpp-container -->
예제 #9
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'));
 }
/**
 * 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);
}