function rtmedia_is_global_album($album_id)
{
    $rtmedia_global_albums = rtmedia_global_albums();
    if (!in_array($album_id, $rtmedia_global_albums)) {
        return true;
    } else {
        return false;
    }
}
Exemplo n.º 2
0
 function check_global_album()
 {
     $album = new RTMediaAlbum();
     $global_album = $album->get_default();
     //** Hack for plupload default name
     if (isset($_POST["action"]) && isset($_POST["mode"]) && $_POST["mode"] == "file_upload") {
         unset($_POST["name"]);
     }
     //**
     global $rtmedia_error;
     if (isset($rtmedia_error) && $rtmedia_error === true) {
         return false;
     }
     if (!$global_album) {
         $global_album = $album->add_global(__("Wall Posts", 'buddypress-media'));
     }
     // fix multisite global album doesn't exist issue.
     if (is_multisite() && !rtmedia_get_site_option('rtmedia_fix_multisite_global_albums', false)) {
         $model = new RTMediaModel();
         $global_albums = rtmedia_global_albums();
         $album_objects = $model->get_media(array('id' => $global_albums), false, false);
         if (empty($album_objects)) {
             $global_album = $album->add_global(__("Wall Posts", 'buddypress-media'));
         }
         rtmedia_update_site_option('rtmedia_fix_multisite_global_albums', true);
     }
 }
Exemplo n.º 3
0
 function check_global_album()
 {
     //todo: Nonce required
     $album = new RTMediaAlbum();
     $global_album = $album->get_default();
     // @codingStandardsIgnoreStart
     //** Hack for plupload default name
     if (isset($_POST['action']) && isset($_POST['mode']) && 'file_upload' === sanitize_text_field($_POST['mode'])) {
         unset($_POST['name']);
     }
     // @codingStandardsIgnoreEnd
     //**
     global $rtmedia_error;
     if (isset($rtmedia_error) && true === $rtmedia_error) {
         return false;
     }
     if (!$global_album) {
         $global_album = $album->add_global(esc_html__('Wall Posts', 'buddypress-media'));
     }
     // fix multisite global album doesn't exist issue.
     if (is_multisite() && !rtmedia_get_site_option('rtmedia_fix_multisite_global_albums', false)) {
         $model = new RTMediaModel();
         $global_albums = rtmedia_global_albums();
         $album_objects = $model->get_media(array('id' => $global_albums), false, false);
         if (empty($album_objects)) {
             $global_album = $album->add_global(esc_html__('Wall Posts', 'buddypress-media'));
         }
         rtmedia_update_site_option('rtmedia_fix_multisite_global_albums', true);
     }
 }
function rtmedia_group_album_list($selected_album_id = false)
{
    //by default, first album in list will be selected
    global $rtmedia_query;
    $model = new RTMediaModel();
    $global_option = rtmedia_global_album_list($selected_album_id);
    $global_albums = rtmedia_global_albums();
    $album_objects = $model->get_media(array('context' => $rtmedia_query->media_query['context'], 'context_id' => $rtmedia_query->media_query['context_id'], 'media_type' => 'album'), false, false);
    $option_group = "";
    if ($album_objects) {
        foreach ($album_objects as $album) {
            $selected = '';
            if ($selected_album_id != false && $selected_album_id != '' && $selected_album_id == $album->id) {
                $selected = 'selected="selected"';
            }
            if (!in_array($album->id, $global_albums) && (isset($rtmedia_query->media_query['album_id']) && $album->id != $rtmedia_query->media_query['album_id'] || !isset($rtmedia_query->media_query['album_id']))) {
                $option_group .= '<option value="' . $album->id . '" ' . $selected . '>' . $album->media_title . '</option>';
            }
        }
    }
    $option = $global_option;
    if ($option_group != "") {
        $option .= "<optgroup label='" . __("Group Albums", "rtmedia") . "' value = 'group'>{$option_group}</optgroup>";
    }
    if ($option) {
        return $option;
    } else {
        return false;
    }
}