This forum is obsolete

This support forum has been replaced by a news version. You can browse old posts in this forum, but please post your questions to the new forum by clicking on "Support" in the top level menu.

Support Forum
Subject: Sitemap for UVG
Prev Next
You are not authorized to post a reply.

Author Messages
gh bn
Posts:16
Silver Member

11/21/2015 4:19 AM  
Code

using DotNetNuke.Common.Utilities;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Entities.Portals;
using DotNetNuke.Services.Sitemap;
using System;
using System.Collections;
using System.Collections.Generic;

namespace BizModules.UltraVideoGallery
{
public class SiteMapProvider : SitemapProvider
{
private Dictionary<int, float> _modulePriority = new Dictionary<int, float>();
private Dictionary<int, int> _modulePriorityFieldId = new Dictionary<int, int>();
private Dictionary<int, int> _viewpage = new Dictionary<int, int>();

private SitemapUrl GetBlogUrl(int portalId, VideoInfo videoInfo)
{
if (!this._modulePriority.ContainsKey(videoInfo.ItemId))
{
this._modulePriority.Add(videoInfo.ItemId, 0.5f);
this._modulePriorityFieldId.Add(videoInfo.ItemId, -1);
}
float num = this._modulePriority[videoInfo.ItemId]
int objField = this._modulePriorityFieldId[videoInfo.ItemId]
return new SitemapUrl { Url = videoInfo.PlayUrl, Priority = num, LastModified = videoInfo.LastModifiedDate, ChangeFrequency = SitemapChangeFrequency.Weekly };
}

public override List<SitemapUrl> GetUrls(int portalId, PortalSettings ps, string version)
{
List<SitemapUrl> tours = new List<SitemapUrl>();
VideoController videoController = new VideoController();

string name = Enum.GetName(typeof (VideoOrderType), VideoOrderType.AlphabeticalOrder);

foreach (VideoInfo videoInfo in VideoController.SearchPlus(portalId, -1, "", "", name))
{
SitemapUrl blogUrl = this.GetBlogUrl(portalId, videoInfo);
tours.Add(blogUrl);
}
return tours;
}
}



web.config

<add name="UltraVideoGallerySitemapProvider" type="BizModules.UltraVideoGallery.SiteMapProvider, BizModules.UltraVideoGallery" providerPath="~\desktopmodules\UltraVideoGallery\Components\" />
gh bn
Posts:16
Silver Member

11/21/2015 12:46 PM  
For profanity filter in comment system please add this code

var ps = new DotNetNuke.Security.PortalSecurity();
string Comment = ps.Remove(objComment.Comment, DotNetNuke.Security.PortalSecurity.ConfigType.ListController, "ProfanityFilter", DotNetNuke.Security.PortalSecurity.FilterScope.SystemAndPortalList);
gh bn
Posts:16
Silver Member

11/22/2015 1:58 AM  
Video Url for Unicode Titles

http://mysite.com/Player/VideoId/38/-------

SEO-Friendly Site URL

http://mysite.com/Player/VideoId/38/زیبای-نگاه


Url = Url.Replace(' ','-');
Regex regex = new Regex(@"(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?");

Match match = regex.Match(Url);

Url = match.Value;

OR

[!@#$%^&*()}{|\" ?><\[\]\\;',~]

OR


public static string ToUrlSlug(string value){

//First to lower case
value = value.ToLowerInvariant();

//Remove all accents
var bytes = Encoding.GetEncoding("Cyrillic").GetBytes(value);

value = Encoding.ASCII.GetString(bytes);

//Replace spaces
value = Regex.Replace(value, @"\s", "-", RegexOptions.Compiled);

//Remove invalid chars
value = Regex.Replace(value, @"[^\w\s\p{Pd}]", "",RegexOptions.Compiled);

//Trim dashes from end
value = value.Trim('-', '_');

//Replace double occurences of - or \_
value = Regex.Replace(value, @"([-_]){2,}", "$1", RegexOptions.Compiled);

return value ;
}


Pengtsen R
Posts:13551


11/22/2015 8:35 PM  
I integrated your recommendataion for the video name in the URL, it should be included in next minor upgrade.

Pengtsen R
http://www.bizmodules.net
You are not authorized to post a reply.

Copyright © 2005-2013 BizModules Contact us