/**
 * Add various upload icons to activity post form
 * @return type
 */
function mpp_activity_upload_buttons()
{
    if (!mpp_is_activity_upload_enabled(mpp_get_current_component())) {
        return;
    }
    //if we are here, the gallery activity stream upload is enabled,
    //let us see if we are on user profile and gallery is enabled
    if (bp_is_user() && !mpp_is_active_component('members')) {
        return;
    }
    //if we are on group page and either the group component is not enabled or gallery is not enabled for current group, do not show the icons
    if (function_exists('bp_is_group') && bp_is_group() && (!mpp_is_active_component('groups') || !(function_exists('mpp_group_is_gallery_enabled') && mpp_group_is_gallery_enabled()))) {
        return;
    }
    //for now, avoid showing it on single gallery/media activity stream
    if (mpp_is_single_gallery() || mpp_is_single_media()) {
        return;
    }
    $component = mpp_get_current_component();
    ?>
    <div id="mpp-activity-upload-buttons" class="mpp-upload-buttons">
        <?php 
    do_action("mpp_before_activity_upload_buttons");
    //allow to add more type
    ?>
        
    <?php 
    if (mpp_is_active_type('photo') && mpp_component_supports_type($component, 'photo')) {
        ?>
        <a href="#" id="mpp-photo-upload" data-media-type="photo"><img src="<?php 
        echo mediapress()->get_url() . 'assets/images/media-button-image.gif';
        ?>
"/></a>
     <?php 
    }
    ?>
        
    <?php 
    if (mpp_is_active_type('audio') && mpp_component_supports_type($component, 'audio')) {
        ?>
        <a href="#" id="mpp-audio-upload" data-media-type="audio"><img src="<?php 
        echo mediapress()->get_url() . 'assets/images/media-button-music.gif';
        ?>
"/></a>
     <?php 
    }
    ?>

     <?php 
    if (mpp_is_active_type('video') && mpp_component_supports_type($component, 'video')) {
        ?>
        <a href="#" id="mpp-video-upload"  data-media-type="video"><img src="<?php 
        echo mediapress()->get_url() . 'assets/images/media-button-video.gif';
        ?>
"/></a>
    <?php 
    }
    ?>
		
     <?php 
    if (mpp_is_active_type('doc') && mpp_component_supports_type($component, 'doc')) {
        ?>
        <a href="#" id="mpp-doc-upload"  data-media-type="doc"><img src="<?php 
        echo mediapress()->get_url() . 'assets/images/media-button-doc.png';
        ?>
" /></a>
    <?php 
    }
    ?>
		
    <?php 
    //someone please provide me doc icon and some better icons
    ?>
 
    
	<?php 
    do_action('mpp_after_activity_upload_buttons');
    //allow to add more type
    ?>

    </div>
  <?php 
}
function mpp_get_editable_types($type = null, $component = null)
{
    if (!$type || $type == 'active') {
        $types = mpp_get_active_types();
    } else {
        $types = mpp_get_registered_types();
    }
    //if a component is given, filter the status
    if ($component) {
        $all_types = (array) $types;
        $types = array();
        foreach ($all_types as $type_slug => $type_object) {
            if (mpp_component_supports_type($component, $type_slug)) {
                $types[$type_slug] = $type_object;
            }
        }
    }
    return apply_filters('mpp_get_editable_types', $types);
}
Example #3
0
 private function add_gallery_views_panel($panel, $component)
 {
     $active_types = $this->active_types;
     $section = $panel->add_section($component . '-gallery-views', sprintf(_x(' %s Gallery Default Views', 'Gallery view section title', 'mediapress'), ucwords($component)));
     $supported_types = mpp_component_get_supported_types($component);
     foreach ($active_types as $key => $type_object) {
         //if the component does not support type, do not add the settings
         if (!empty($supported_types) && !mpp_component_supports_type($component, $key)) {
             continue;
             //if none of the types are enabled, it means, it is the first time and we need not break here
         }
         $registered_views = mpp_get_registered_gallery_views($key);
         $options = array();
         foreach ($registered_views as $view) {
             if (!$view->supports_component($component)) {
                 continue;
             }
             $options[$view->get_id()] = $view->get_name();
         }
         $section->add_field(array('name' => $component . '_' . $key . '_gallery_default_view', 'label' => sprintf(_x('%s Gallery', 'admin gallery  settings', 'mediapress'), ucwords($key)), 'description' => _x('It will be used as the default view. It can be overridden per gallery', 'admin gallery settings', 'mediapress'), 'default' => 'default', 'type' => 'radio', 'options' => $options));
     }
 }