Beispiel #1
0
/**
 * @todo  update
 * @param type $gallery
 * @return type
 */
function mpp_gallery_has_media($gallery_id)
{
    //check the gallery has media
    return mpp_gallery_get_media_count($gallery_id);
}
/**
 * Change the media count in gallery by the given number
 * 
 * @param type $gallery_id
 * @param type $count
 * @return type
 */
function mpp_gallery_change_media_count($gallery_id, $count = 1)
{
    if (!$gallery_id) {
        return;
    }
    $current_count = absint(mpp_gallery_get_media_count($gallery_id));
    $updated_count = $current_count + $count;
    if ($updated_count < 0) {
        $updated_count = 0;
        //no media
    }
    return mpp_update_gallery_meta($gallery_id, '_mpp_media_count', $updated_count);
}