Exemplo n.º 1
0
function mpp_filter_body_class($classes, $class)
{
    $new_classes = array();
    $component = mpp_get_current_component();
    //if not mediapress pages, return
    if (!mpp_is_gallery_component() && !mpp_is_component_gallery()) {
        return $classes;
    }
    //ok, It must be mpp pages
    $new_classes[] = 'mpp-page';
    //for all mediapress pages
    //if it is a directory page
    if (mpp_is_gallery_directory()) {
        $new_classes[] = 'mpp-page-directory';
    } elseif (mpp_is_gallery_component() || mpp_is_component_gallery()) {
        //we are on user gallery  page or a component gallery page
        //append class mpp-page-members or mpp-page-groups or mpp-page-events etc depending on the current associated component
        $new_classes[] = 'mpp-page-' . $component;
        if (mpp_is_media_management()) {
            //is it edit media?
            $new_classes[] = 'mpp-page-media-management';
            $new_classes[] = 'mpp-page-media-management-' . mpp_get_media_type();
            //mpp-photo-management, mpp-audio-management
            $new_classes[] = 'mpp-page-media-manage-action-' . mediapress()->get_edit_action();
            //mpp-photo-management, mpp-audio-management
        } elseif (mpp_is_single_media()) {
            //is it single media
            $new_classes[] = 'mpp-page-media-single';
            $new_classes[] = 'mpp-page-media-single-' . mpp_get_media_type();
        } elseif (mpp_is_gallery_management()) {
            //id gallery management?
            $new_classes[] = 'mpp-page-gallery-management';
            $new_classes[] = 'mpp-page-gallery-management-' . mpp_get_gallery_type();
            $new_classes[] = 'mpp-page-gallery-manage-action-' . mediapress()->get_edit_action();
        } elseif (mpp_is_single_gallery()) {
            //is singe gallery
            $new_classes[] = 'mpp-page-single-gallery';
            $new_classes[] = 'mpp-page-single-gallery-' . mpp_get_gallery_type();
            $new_classes[] = 'mpp-page-single-gallery-' . mpp_get_gallery_status();
        } else {
            //it is the gallery listing page of the component
            $new_classes[] = 'mpp-page-gallery-list';
            //home could have been a better name
            $new_classes[] = 'mpp-page-gallery-list-' . $component;
            //home could have been a better name
        }
    }
    if (!empty($new_classes)) {
        $classes = array_merge($classes, $new_classes);
    }
    return $classes;
}
Exemplo n.º 2
0
 public function switch_view()
 {
     //single gallery
     //single media
     //edit gallery
     //edit media
     if (!mpp_is_user_gallery_component()) {
         return;
     }
     if (mpp_is_media_management()) {
         $this->manage_media();
     } elseif (mpp_is_single_media()) {
         $this->single_media();
     } elseif (mpp_is_single_gallery()) {
         //mpp single gallery will be true for the single gallery/edit both
         if (mpp_is_gallery_management()) {
             $this->manage_gallery();
         } else {
             $this->single_gallery();
         }
     }
 }
 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;
 }
Exemplo n.º 4
0
}
?>
<div class="mpp-container mpp-clearfix mpp-sitewide-component" id="mpp-container">
	<div class="mpp-breadcrumbs"><?php 
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);
Exemplo n.º 5
0
/**
 * @todo update
 * @return type
 */
function mpp_is_gallery_cover_upload()
{
    return mpp_is_gallery_management() && mediapress()->is_edit_action('cover');
}
Exemplo n.º 6
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);
}
Exemplo n.º 8
0
function mpp_action_hide_unpublished_media()
{
    if (!is_user_logged_in() || !mpp_is_gallery_management() || !bp_is_action_variable('delete-unpublished', 1)) {
        return;
    }
    $gallery_id = absint($_GET['gallery_id']);
    if (!$gallery_id) {
        return;
    }
    //verify nonce
    if (!wp_verify_nonce($_GET['_wpnonce'], 'delete-unpublished')) {
        //should we return or show error?
        return;
    }
    $referrer = mpp_get_gallery_edit_media_url($gallery_id);
    if (!mpp_gallery_has_unpublished_media($gallery_id)) {
        mpp_add_feedback(__('Nothing to hide.', 'mediapress'), 'error');
        bp_core_redirect($referrer);
    }
    //check if user has permission
    if (!mpp_user_can_publish_gallery_activity($gallery_id)) {
        mpp_add_feedback(__("You don't have sufficient permission.", 'mediapress'), 'error');
        bp_core_redirect($referrer);
    }
    mpp_gallery_delete_unpublished_media($gallery_id);
    mpp_add_feedback(__("Successfully hidden!", 'mediapress'));
    bp_core_redirect($referrer);
}