/**
  * 
  * @return MPP_Local_Storage
  */
 public static function get_instance()
 {
     if (!isset(self::$instance)) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Beispiel #2
0
/**
 * Register various core features
 * Registers statuses
 * Registers types(media type)
 * Also registers Component types
 */
function mpp_init()
{
    //register privacies
    //private
    mpp_register_status(array('key' => 'public', 'label' => __('Public', 'mediapress'), 'labels' => array('singular_name' => __('Public', 'mediapress'), 'plural_name' => __('Public', 'mediapress')), 'description' => __('Public Gallery Privacy Type'), 'callback' => 'mpp_check_public_access'));
    mpp_register_status(array('key' => 'private', 'label' => __('Private', 'mediapress'), 'labels' => array('singular_name' => __('Private', 'mediapress'), 'plural_name' => __('Private', 'mediapress')), 'description' => __('Private Privacy Type' . 'mediapress'), 'callback' => 'mpp_check_private_access'));
    //if friends component is active, only then
    mpp_register_status(array('key' => 'friendsonly', 'label' => __('Friends Only', 'mediapress'), 'labels' => array('singular_name' => __('Friends Only', 'mediapress'), 'plural_name' => __('Friends Only', 'mediapress')), 'description' => __('Friends Only Privacy Type', 'mediapress'), 'callback' => 'mpp_check_friends_access'));
    mpp_register_status(array('key' => 'loggedin', 'label' => __('Logged In Users Only', 'mediapress'), 'labels' => array('singular_name' => __('Logged In Users Only', 'mediapress'), 'plural_name' => __('Logged In Users Only', 'mediapress')), 'description' => __('Logged In Users Only Privacy Type', 'mediapress'), 'callback' => 'mpp_check_loggedin_access'));
    //if followers component is active only then
    if (function_exists('bp_follow_is_following')) {
        mpp_register_status(array('key' => 'followersonly', 'label' => __('Followers Only', 'mediapress'), 'labels' => array('singular_name' => __('Followers Only', 'mediapress'), 'plural_name' => __('Followers Only', 'mediapress')), 'description' => __('Followers Only Privacy Type', 'mediapress'), 'callback' => 'mpp_check_followers_access'));
        mpp_register_status(array('key' => 'followingonly', 'label' => __('Persons I Follow', 'mediapress'), 'labels' => array('singular_name' => __('Persons I Follow', 'mediapress'), 'plural_name' => __('Persons I Follow', 'mediapress')), 'description' => __('Following Only Privacy Type', 'mediapress'), 'callback' => 'mpp_check_following_access'));
    }
    //register types
    //photo
    mpp_register_type(array('key' => 'photo', 'label' => __('Photo', 'mediapress'), 'description' => __('taxonomy for image media type', 'mediapress'), 'labels' => array('singular_name' => __('Photo', 'mediapress'), 'plural_name' => __('Photos', 'mediapress')), 'extensions' => array('jpeg', 'jpg', 'gif', 'png')));
    //video
    mpp_register_type(array('key' => 'video', 'label' => __('Video', 'mediapress'), 'labels' => array('singular_name' => __('Video', 'mediapress'), 'plural_name' => __('Videos', 'mediapress')), 'description' => __('Video media type taxonomy', 'mediapress'), 'extensions' => array('mp4', 'flv', 'mpeg')));
    mpp_register_type(array('key' => 'audio', 'label' => __('Audio', 'mediapress'), 'labels' => array('singular_name' => __('Audio', 'mediapress'), 'plural_name' => __('Audios', 'mediapress')), 'description' => __('Audio Media type taxonomy', 'mediapress'), 'extensions' => array('mp3', 'wmv', 'midi')));
    mpp_register_type(array('key' => 'doc', 'label' => __('Documents', 'mediapress'), 'labels' => array('singular_name' => __('Document', 'mediapress'), 'plural_name' => __('Documents', 'mediapress')), 'description' => __('This is documents gallery', 'mediapress'), 'extensions' => array('zip', 'gz', 'doc', 'pdf', 'docx', 'xls')));
    mpp_register_component(array('key' => 'members', 'label' => __('User', 'mediapress'), 'labels' => array('singular_name' => __('User', 'mediapress'), 'plural_name' => __('Users', 'mediapress')), 'description' => __('User Galleries', 'mediapress')));
    //add support
    mpp_component_register_status('members', 'public');
    mpp_component_register_status('members', 'private');
    mpp_component_register_status('members', 'loggedin');
    if (bp_is_active('friends')) {
        mpp_component_register_status('members', 'friendsonly');
    }
    //allow members component to support the followers privacy
    if (function_exists('bp_follow_is_following')) {
        mpp_component_register_status('members', 'followersonly');
        mpp_component_register_status('members', 'followingonly');
    }
    //register type support
    mpp_component_register_type('members', 'photo');
    mpp_component_register_type('members', 'audio');
    mpp_component_register_type('members', 'video');
    mpp_component_register_type('members', 'doc');
    mpp_register_component(array('key' => 'groups', 'label' => __('Groups', 'mediapress'), 'labels' => array('singular_name' => __('Group', 'mediapress'), 'plural_name' => __('Groups', 'mediapress')), 'description' => __('Groups Galleries', 'mediapress')));
    mpp_component_register_status('groups', 'public');
    mpp_component_register_status('groups', 'private');
    mpp_component_register_status('groups', 'loggedin');
    mpp_component_register_status('groups', 'groupsonly');
    //register media sizes
    mpp_component_register_type('groups', 'photo');
    mpp_component_register_type('groups', 'audio');
    mpp_component_register_type('groups', 'video');
    mpp_component_register_type('groups', 'doc');
    mpp_register_media_size(array('name' => 'thumbnail', 'height' => 200, 'width' => 200, 'crop' => true, 'type' => 'default'));
    mpp_register_media_size(array('name' => 'mid', 'height' => 300, 'width' => 500, 'crop' => true, 'type' => 'default'));
    mpp_register_media_size(array('name' => 'large', 'height' => 800, 'width' => 600, 'crop' => false, 'type' => 'default'));
    //register storage managers here
    //local storage manager
    mpp_register_storage_manager('local', MPP_Local_Storage::get_instance());
    //mpp_register_storage_manager( 'aws', MPP_Local_Storage::get_instance() );
    //register default viewer
    //please note, google doc viewer will not work for local files
    //files must be somewhere accessible from the web
    mpp_register_media_view('doc', 'default', new MPP_Media_View_Docs());
    //we are registering for video so we can replace it in future for flexible video views
    mpp_register_media_view('video', 'default', new MPP_Media_View_Video());
    //audio
    mpp_register_media_view('audio', 'default', new MPP_Media_View_Audio());
    //should we register a photo viewer too? may be for the sake of simplicity?
    //setup the tabs
    mediapress()->add_menu('gallery', new MPP_Gallery_Menu());
    mediapress()->add_menu('media', new MPP_Media_Menu());
}
Beispiel #3
0
/**
 * Register various core features
 * Registers statuses
 * Registers types(media type)
 * Also registers Component types
 */
function mpp_setup_core()
{
    //if the 'gallery' slug is not set , set it to mediapress?
    if (!defined('MPP_GALLERY_SLUG')) {
        define('MPP_GALLERY_SLUG', 'mediapress');
    }
    //register privacies
    //private
    mpp_register_status(array('key' => 'public', 'label' => __('Public', 'mediapress'), 'labels' => array('singular_name' => __('Public', 'mediapress'), 'plural_name' => __('Public', 'mediapress')), 'description' => __('Public Gallery Privacy Type', 'mediapress'), 'callback' => 'mpp_check_public_access', 'activity_privacy' => 'public'));
    mpp_register_status(array('key' => 'private', 'label' => __('Private', 'mediapress'), 'labels' => array('singular_name' => __('Private', 'mediapress'), 'plural_name' => __('Private', 'mediapress')), 'description' => __('Private Privacy Type' . 'mediapress'), 'callback' => 'mpp_check_private_access', 'activity_privacy' => 'onlyme'));
    mpp_register_status(array('key' => 'loggedin', 'label' => __('Logged In Users Only', 'mediapress'), 'labels' => array('singular_name' => __('Logged In Users Only', 'mediapress'), 'plural_name' => __('Logged In Users Only', 'mediapress')), 'description' => __('Logged In Users Only Privacy Type', 'mediapress'), 'callback' => 'mpp_check_loggedin_access', 'activity_privacy' => 'loggedin'));
    //For BuddyPress specific status, please check modules/buddypress/loader.php
    //Register sitewide gallery component
    mpp_register_component(array('key' => 'sitewide', 'label' => __('Sitewide Galleries', 'mediapress'), 'labels' => array('singular_name' => __('Sitewide Gallery', 'mediapress'), 'plural_name' => __('Sitewide Galleries', 'mediapress')), 'description' => __('Sitewide Galleries', 'mediapress')));
    //register types
    //photo
    mpp_register_type(array('key' => 'photo', 'label' => __('Photo', 'mediapress'), 'description' => __('taxonomy for image media type', 'mediapress'), 'labels' => array('singular_name' => __('Photo', 'mediapress'), 'plural_name' => __('Photos', 'mediapress')), 'extensions' => array('jpeg', 'jpg', 'gif', 'png')));
    //video
    mpp_register_type(array('key' => 'video', 'label' => __('Video', 'mediapress'), 'labels' => array('singular_name' => __('Video', 'mediapress'), 'plural_name' => __('Videos', 'mediapress')), 'description' => __('Video media type taxonomy', 'mediapress'), 'extensions' => array('mp4', 'flv', 'mpeg')));
    mpp_register_type(array('key' => 'audio', 'label' => __('Audio', 'mediapress'), 'labels' => array('singular_name' => __('Audio', 'mediapress'), 'plural_name' => __('Audios', 'mediapress')), 'description' => __('Audio Media type taxonomy', 'mediapress'), 'extensions' => array('mp3', 'wmv', 'midi')));
    mpp_register_type(array('key' => 'doc', 'label' => __('Documents', 'mediapress'), 'labels' => array('singular_name' => __('Document', 'mediapress'), 'plural_name' => __('Documents', 'mediapress')), 'description' => __('This is documents gallery', 'mediapress'), 'extensions' => array('zip', 'gz', 'doc', 'pdf', 'docx', 'xls')));
    //Register media sizes
    mpp_register_media_size(array('name' => 'thumbnail', 'height' => 200, 'width' => 200, 'crop' => true, 'type' => 'default'));
    mpp_register_media_size(array('name' => 'mid', 'height' => 300, 'width' => 500, 'crop' => true, 'type' => 'default'));
    mpp_register_media_size(array('name' => 'large', 'height' => 800, 'width' => 600, 'crop' => false, 'type' => 'default'));
    //register status support
    mpp_component_add_status_support('sitewide', 'public');
    mpp_component_add_status_support('sitewide', 'private');
    mpp_component_add_status_support('sitewide', 'loggedin');
    //register type support
    mpp_component_init_type_support('sitewide');
    //register storage managers here
    //local storage manager
    mpp_register_storage_manager('local', MPP_Local_Storage::get_instance());
    //mpp_register_storage_manager( 'aws', MPP_Local_Storage::get_instance() );
    //register default viewer
    $default_view = MPP_Gallery_View_Default::get_instance();
    mpp_register_gallery_view('photo', $default_view);
    mpp_register_gallery_view('video', $default_view);
    mpp_register_gallery_view('audio', $default_view);
    mpp_register_gallery_view('doc', $default_view);
    $list_view = MPP_Gallery_View_List::get_instance();
    mpp_register_gallery_view('photo', $list_view);
    mpp_register_gallery_view('video', $list_view);
    mpp_register_gallery_view('audio', $list_view);
    mpp_register_gallery_view('doc', $list_view);
    //video playlist
    mpp_register_gallery_view('video', MPP_Gallery_View_Video_Playlist::get_instance());
    //audio playlist
    mpp_register_gallery_view('audio', MPP_Gallery_View_Audio_Playlist::get_instance());
    //please note, google doc viewer will not work for local files
    //files must be somewhere accessible from the web
    mpp_register_media_view('photo', 'default', new MPP_Media_View_Photo());
    mpp_register_media_view('doc', 'default', new MPP_Media_View_Docs());
    //we are registering for video so we can replace it in future for flexible video views
    mpp_register_media_view('video', 'default', new MPP_Media_View_Video());
    //audio
    mpp_register_media_view('audio', 'default', new MPP_Media_View_Audio());
    //should we register a photo viewer too? may be for the sake of simplicity?
    //setup the tabs
    mediapress()->add_menu('gallery', new MPP_Gallery_Menu());
    mediapress()->add_menu('media', new MPP_Media_Menu());
    do_action('mpp_setup_core');
}