DEBUG: GetLatinName BEFORE , sMonth= " & sMonth & "
" End If sMonth = GetLatinMonthName (sMonth) iMonth = GetMonthNumber(sMonth) if DebugMode Then Response.Write "
DEBUG: GetLatinName call AFTER, sMonth= " & sMonth & "
" End If End If sDate = "#" & sYear & "-" & sMonth & "-" & sDay & " " & sHour & ":" & sMinute & ":" & sSecond & "#" dateRet = CDate(Eval(sDate)) arrRet(0) = DateTemplate ' check if day is 0-9 and add leading zero to output as "04" instead of "4" sDay= Day(dateRet) If AddLeadingZeroToDays Then If Len(sDay)=1 Then sDay = "0" & sDay End If End If arrRet(0) = Replace(arrRet(0), "dd", sDay) Dim sWeekdayName sWeekdayName = WeekdayName(Weekday(dateRet)) If FixCapitalLetters Then sWeekdayName = UCase(Left(sWeekdayName, 1)) + Right(sWeekdayName, Len(sWeekdayName) - 1) End If arrRet(0) = Replace(arrRet(0), "DD", sWeekdayName) ' check if month is 0-9 and add leading zero to output as "04" instead of "4" sMonth= Month(dateRet) If AddLeadingZeroToMonths Then If Len(sMonth)=1 Then sMonth = "0" & sMonth End If End If arrRet(0) = Replace(arrRet(0), "mm", sMonth) arrRet(0) = Replace(arrRet(0), "MMMM", MonthName(Month(dateRet))) ' To display short month names (for example Jan instead of January) uncomment the line below ' arrRet(0) = Replace(arrRet(0), "MMMM", MonthName(Month(dateRet), True)) arrRet(0) = Replace(arrRet(0), "yyyy", Year(dateRet)) arrRet(1) = TimeTemplate Dim sHours sHours = Hour(dateRet) Dim sAMPM If Int(sHours) > 12 Then sAMPM = "PM" Else sAMPM = "AM" End If arrRet(1) = Replace(arrRet(1), "AMPM", sAMPM) Dim h h = Int(sHours) If h > 12 Then h = h - 12 ' check if hours is 0-9 and add leading zero to output as "04" instead of "4" sHour = sHours if AddLeadingZeroToHours Then If Len(sHour)=1 Then sHour = "0" & sHour End If End If arrRet(1) = Replace(arrRet(1), "H", sHour) arrRet(1) = Replace(arrRet(1), "h", h) ' check if minutes is 0-9 and add leading zero to output as "04" instead of "4" sMinute = FormatTime(Minute(dateRet)) If Len(sMinute)=1 Then sMinute = "0" & sMinute End If arrRet(1) = Replace(arrRet(1), "MM", sMinute) ' check if seconds is 0-9 and add leading zero to output as "04" instead of "4" sSecond = FormatTime(Second(dateRet)) If Len(sSecond)=1 Then sSecond = "0" & sSecond End If arrRet(1) = Replace(arrRet(1), "SS", sSecond) arrRet(1) = Replace(arrRet(1), "Offset", sOffset) if DebugMode Then Response.Write "DEBUG: " & arrRet(0) End If FormatAtomDateTime = arrRet End Function Function FormatTime(t) If t = 0 Then t = "00" If Len(t) = 1 Then t = "0" + t FormatTime = t End Function ' ##### Execute filter string, return False If RSSItem does Not satisfy Keywords ######### Function CheckItem(RSSTitle, RSSDescription, RSSCategories, rsKeywordsFilterString, rsCategoriesFilterString) ' check filter by categories Execute rsCategoriesFilterString ' if passed by categories then run filter by keywords (url, title, description) If CheckItem Then Execute rsKeywordsFilterString End If End Function ' ##### Build filter string to check RSS Items ######### Function GetKeywordsFilter() Dim KeywordsString Dim FilterString Dim KeywordsArr If UseParametersFromURL Then If Request.QueryString.Item("Keywords") <> Empty Then KeywordsString = Server.HTMLEncode(Request.QueryString.Item("Keywords")) Else KeywordsString = "" End If Else KeywordsString = Keywords End If ' Search is not case sensitivity KeywordsString = LCase(KeywordsString) KeywordsString = Replace(KeywordsString, "+-", " *") ' means obligatory negative keyword KeywordsString = Replace(KeywordsString, "+", " +") ' means obligatory keyword KeywordsString = Replace(KeywordsString, "&", " +") ' means obligatory keyword KeywordsString = Replace(KeywordsString, "-", " -") ' means non obligatory negative keyword KeywordsArr = Split(KeywordsString, " ") FilterString = "CheckItem = (" For Each str in KeywordsArr MinusSign = False PlusSign = False AsteriskSign = False If Left(str, 1) = "-" Then MinusSign = True str = Mid(str, 2) End If If Left(str, 1) = "+" Then PlusSign = True str = Mid(str, 2) End If If Left(str, 1) = "*" Then AsterikSign = True str = Mid(str, 2) End If If str<>"" Then If FilterString <> "CheckItem = (" Then If PlusSign or AsterikSign Then FilterString = FilterString & " AND (" Else FilterString = FilterString & " OR (" End If End If If MinusSign or AsterikSign Then ConditionsExist = False If FilterByTitle Then FilterString = FilterString & "(InStr(LCase(RSSTitle), """ & str & """) = 0)" ConditionsExist = True End If If FilterByDescription Then If ConditionsExist Then FilterString = FilterString & " AND (InStr(LCase(RSSDescription), """ & str & """) = 0)" Else FilterString = FilterString & "(InStr(LCase(RSSDescription), """ & str & """) = 0)" End If ConditionsExist= True End If If FilterByURL Then If ConditionsExist Then FilterString = FilterString & " AND (InStr(LCase(RSSlink), """ & str & """) = 0)" Else FilterString = FilterString & "(InStr(LCase(RSSlink), """ & str & """) = 0)" End If End If Else ConditionsExist = False If FilterByTitle Then FilterString = FilterString & "(InStr(LCase(RSSTitle), """ & str & """) > 0)" ConditionsExist = True End If If FilterByDescription Then If ConditionsExist Then FilterString = FilterString & " OR (InStr(LCase(RSSDescription), """ & str & """) > 0)" Else FilterString = FilterString & "(InStr(LCase(RSSDescription), """ & str & """) > 0)" End If ConditionsExist = True End If If FilterByURL Then If ConditionsExist Then FilterString = FilterString & " OR (InStr(LCase(RSSlink), """ & str & """) > 0)" Else FilterString = FilterString & "(InStr(LCase(RSSlink), """ & str & """) > 0)" End If End If End If FilterString = FilterString & ") " End If ' If str<>"" condition Next If FilterString = "CheckItem = (" Then FilterString = "CheckItem = True" End If GetKeywordsFilter = FilterString End Function ' ##### Build filter string to check RSS Items by Categories ######### Function GetCategoriesKeywordsFilter() Dim CategoriesKeywordsString Dim FilterString Dim CategoriesKeywordsArr If UseParametersFromURL Then If Request.QueryString.Item("CategoryKeywords") <> Empty Then CategoriesKeywordsString = Server.HTMLEncode(Request.QueryString.Item("CategoryKeywords")) Else CategoriesKeywordsString = "" End If Else CategoriesKeywordsString = CategoryKeywords End If ' Search is not case sensitivity CategoriesKeywordsString = LCase(CategoriesKeywordsString) CategoriesKeywordsString = Replace(CategoriesKeywordsString, "+-", " *") CategoriesKeywordsString = Replace(CategoriesKeywordsString, "+", " +") CategoriesKeywordsString = Replace(CategoriesKeywordsString, "&", " +") CategoriesKeywordsString = Replace(CategoriesKeywordsString, "-", " -") CategoriesKeywordsArr = Split(CategoriesKeywordsString, " ") FilterString = "CheckItem = (" For Each str in CategoriesKeywordsArr MinusSign = False PlusSign = False AsteriskSign = False If Left(str, 1) = "-" Then MinusSign = True str = Mid(str, 2) End If If Left(str, 1) = "+" Then PlusSign = True str = Mid(str, 2) End If If Left(str, 1) = "*" Then AsterikSign = True str = Mid(str, 2) End If If str<>"" Then If FilterString <> "CheckItem = (" Then If PlusSign or AsterikSign Then FilterString = FilterString & " AND (" Else FilterString = FilterString & " OR (" End If End If If MinusSign or AsterikSign Then ConditionsExist = False If FilterByCategory Then If ConditionsExist Then FilterString = FilterString & " AND (InStr(LCase(RSSCategories), """ & str & """) = 0)" Else FilterString = FilterString & "(InStr(LCase(RSSCategories), """ & str & """) = 0)" End If ConditionsExist = True End If Else ConditionsExist = False If FilterByCategory Then If ConditionsExist Then FilterString = FilterString & " OR (InStr(LCase(RSSCategories), """ & str & """) > 0)" Else FilterString = FilterString & "(InStr(LCase(RSSCategories), """ & str & """) > 0)" End If ConditionsExist = True End If End If FilterString = FilterString & ") " End If ' If str<>"" condition Next If FilterString = "CheckItem = (" Then FilterString = "CheckItem = True" End If GetCategoriesKeywordsFilter = FilterString End Function ' ######## get channel information Sub GetChannel(xmlDOM) ChannelTitle = "" ChannelURL = "" ChannelDescription = "" ' get channel title Set tempObj = xmlDOM.getElementsByTagName("title") If Not tempObj is Nothing Then Set tempObj = tempObj.item(0) If Not tempObj is Nothing Then Set tempObj = tempObj.childNodes.item(0) End If If Not tempObj is Nothing Then ChannelTitle = tempObj.text End If End If ' get channel url Set tempObj = xmlDOM.getElementsByTagName("link") If Not tempObj is Nothing Then Set tempObj = tempObj.item(0) If Not tempObj is Nothing Then Set tempObj = tempObj.childNodes.item(0) End If If Not tempObj is Nothing Then ChannelURL = tempObj.text End If End If ' get channel description Set tempObj = xmlDOM.getElementsByTagName("description") If Not tempObj is Nothing Then Set tempObj = tempObj.item(0) If Not tempObj is Nothing Then Set tempObj = tempObj.childNodes.item(0) End If If Not tempObj is Nothing Then ChannelDescription = tempObj.text End If End If If ChannelURL = "" Then ChannelURL = URLToRSS End If If ChannelDescription = "" Then ChannelDescription = ChannelTitle End If End Sub ' ##### Get RSSItems from xmlDOM ######### Function GetRSS(xmlDOM) ' Collect filtered "items" from downloaded RSS Set RSSItems = xmlDOM.getElementsByTagName("item") ' /// If Not
ShowItems() - WARNING - items collection is empty" End If If ShowEmptyFeeds Then bShow = True Else bShow = False End If End If If bShow Then Dim TemplateHeader TemplateHeader = Replace(MainTemplateHeader, "{CHANNELTITLE}", ChannelTitle) TemplateHeader = Replace(TemplateHeader, "{CHANNELURL}", ChannelURL) TemplateHeader = Replace(TemplateHeader, "{CHANNELDESCRIPTION}", ChannelDescription) ' writing Header Response.Write TemplateHeader ' Show RSSItems ShowItems RSSItems ' writing Footer Response.Write MainTemplateFooter Set RSSItems = Nothing ' clear RSS End If End If End Function ' ##### strip HTML tags from description if set ######### Function stripHTML(ByVal sText) stripHTML= "" bFound = False Do While InStr(sText, "<") bFound = True stripHTML= stripHTML& " " & Left(sText, InStr(sText, "<")-1) sText = MID(sText, InStr(sText, ">") + 1) Loop Do While InStr(sText, " ") bFound = True stripHTML= stripHTML& " " & Left(sText, InStr(sText, " ")-1) sText = MID(sText, InStr(sText, " ") + 1) Loop stripHTML= stripHTML& sText If not bFound Then stripHTML= sText End Function ' ##### Entry point to script ######### Sub Main ' this function is intended to be called only when RSS2HTMLPro.asp is used standalone ShowRSS ' Show Error message, If available If Err.Number <> 0 Then Response.Write "Error: " & Err.Description Err.Clear End If ' Response.End ' uncomment this For use in on-the-fly output End Sub If StandaloneScript Then Main() ' calling this only if the script is standalone. Set StandaloneScript variable to FALSE if script is called from MultiRSS2HTML.asp End If %> ' check if day is 0-9 and add leading zero to output as "04" instead of "4" sDay= Day(dateRet) If AddLeadingZeroToDays Then If Len(sDay)=1 Then sDay = "0" & sDay End If End If arrRet(0) = Replace(arrRet(0), "dd", sDay) Dim sWeekdayName sWeekdayName = WeekdayName(Weekday(dateRet)) If FixCapitalLetters Then sWeekdayName = UCase(Left(sWeekdayName, 1)) + Right(sWeekdayName, Len(sWeekdayName) - 1) End If arrRet(0) = Replace(arrRet(0), "DD", sWeekdayName) ' check if month is 0-9 and add leading zero to output as "04" instead of "4" sMonth= Month(dateRet) If AddLeadingZeroToMonths Then If Len(sMonth)=1 Then sMonth = "0" & sMonth End If End If arrRet(0) = Replace(arrRet(0), "mm", sMonth) arrRet(0) = Replace(arrRet(0), "MMMM", MonthName(Month(dateRet))) ' To display short month names (for example Jan instead of January) uncomment the line below ' arrRet(0) = Replace(arrRet(0), "MMMM", MonthName(Month(dateRet), True)) arrRet(0) = Replace(arrRet(0), "yyyy", Year(dateRet)) arrRet(1) = TimeTemplate Dim sHours sHours = Hour(dateRet) Dim sAMPM If Int(sHours) > 12 Then sAMPM = "PM" Else sAMPM = "AM" End If arrRet(1) = Replace(arrRet(1), "AMPM", sAMPM) Dim h h = Int(sHours) If h > 12 Then h = h - 12 ' check if hours is 0-9 and add leading zero to output as "04" instead of "4" sHour = sHours if AddLeadingZeroToHours Then If Len(sHour)=1 Then sHour = "0" & sHour End If End If arrRet(1) = Replace(arrRet(1), "H", sHour) arrRet(1) = Replace(arrRet(1), "h", h) ' check if minutes is 0-9 and add leading zero to output as "04" instead of "4" sMinute = FormatTime(Minute(dateRet)) If Len(sMinute)=1 Then sMinute = "0" & sMinute End If arrRet(1) = Replace(arrRet(1), "MM", sMinute) ' check if seconds is 0-9 and add leading zero to output as "04" instead of "4" sSecond = FormatTime(Second(dateRet)) If Len(sSecond)=1 Then sSecond = "0" & sSecond End If arrRet(1) = Replace(arrRet(1), "SS", sSecond) arrRet(1) = Replace(arrRet(1), "Offset", sOffset) if DebugMode Then Response.Write "DEBUG: " & arrRet(0) End If FormatAtomDateTime = arrRet End Function Function FormatTime(t) If t = 0 Then t = "00" If Len(t) = 1 Then t = "0" + t FormatTime = t End Function ' ##### Execute filter string, return False If RSSItem does Not satisfy Keywords ######### Function CheckItem(RSSTitle, RSSDescription, RSSCategories, rsKeywordsFilterString, rsCategoriesFilterString) ' check filter by categories Execute rsCategoriesFilterString ' if passed by categories then run filter by keywords (url, title, description) If CheckItem Then Execute rsKeywordsFilterString End If End Function ' ##### Build filter string to check RSS Items ######### Function GetKeywordsFilter() Dim KeywordsString Dim FilterString Dim KeywordsArr If UseParametersFromURL Then If Request.QueryString.Item("Keywords") <> Empty Then KeywordsString = Server.HTMLEncode(Request.QueryString.Item("Keywords")) Else KeywordsString = "" End If Else KeywordsString = Keywords End If ' Search is not case sensitivity KeywordsString = LCase(KeywordsString) KeywordsString = Replace(KeywordsString, "+-", " *") ' means obligatory negative keyword KeywordsString = Replace(KeywordsString, "+", " +") ' means obligatory keyword KeywordsString = Replace(KeywordsString, "&", " +") ' means obligatory keyword KeywordsString = Replace(KeywordsString, "-", " -") ' means non obligatory negative keyword KeywordsArr = Split(KeywordsString, " ") FilterString = "CheckItem = (" For Each str in KeywordsArr MinusSign = False PlusSign = False AsteriskSign = False If Left(str, 1) = "-" Then MinusSign = True str = Mid(str, 2) End If If Left(str, 1) = "+" Then PlusSign = True str = Mid(str, 2) End If If Left(str, 1) = "*" Then AsterikSign = True str = Mid(str, 2) End If If str<>"" Then If FilterString <> "CheckItem = (" Then If PlusSign or AsterikSign Then FilterString = FilterString & " AND (" Else FilterString = FilterString & " OR (" End If End If If MinusSign or AsterikSign Then ConditionsExist = False If FilterByTitle Then FilterString = FilterString & "(InStr(LCase(RSSTitle), """ & str & """) = 0)" ConditionsExist = True End If If FilterByDescription Then If ConditionsExist Then FilterString = FilterString & " AND (InStr(LCase(RSSDescription), """ & str & """) = 0)" Else FilterString = FilterString & "(InStr(LCase(RSSDescription), """ & str & """) = 0)" End If ConditionsExist= True End If If FilterByURL Then If ConditionsExist Then FilterString = FilterString & " AND (InStr(LCase(RSSlink), """ & str & """) = 0)" Else FilterString = FilterString & "(InStr(LCase(RSSlink), """ & str & """) = 0)" End If End If Else ConditionsExist = False If FilterByTitle Then FilterString = FilterString & "(InStr(LCase(RSSTitle), """ & str & """) > 0)" ConditionsExist = True End If If FilterByDescription Then If ConditionsExist Then FilterString = FilterString & " OR (InStr(LCase(RSSDescription), """ & str & """) > 0)" Else FilterString = FilterString & "(InStr(LCase(RSSDescription), """ & str & """) > 0)" End If ConditionsExist = True End If If FilterByURL Then If ConditionsExist Then FilterString = FilterString & " OR (InStr(LCase(RSSlink), """ & str & """) > 0)" Else FilterString = FilterString & "(InStr(LCase(RSSlink), """ & str & """) > 0)" End If End If End If FilterString = FilterString & ") " End If ' If str<>"" condition Next If FilterString = "CheckItem = (" Then FilterString = "CheckItem = True" End If GetKeywordsFilter = FilterString End Function ' ##### Build filter string to check RSS Items by Categories ######### Function GetCategoriesKeywordsFilter() Dim CategoriesKeywordsString Dim FilterString Dim CategoriesKeywordsArr If UseParametersFromURL Then If Request.QueryString.Item("CategoryKeywords") <> Empty Then CategoriesKeywordsString = Server.HTMLEncode(Request.QueryString.Item("CategoryKeywords")) Else CategoriesKeywordsString = "" End If Else CategoriesKeywordsString = CategoryKeywords End If ' Search is not case sensitivity CategoriesKeywordsString = LCase(CategoriesKeywordsString) CategoriesKeywordsString = Replace(CategoriesKeywordsString, "+-", " *") CategoriesKeywordsString = Replace(CategoriesKeywordsString, "+", " +") CategoriesKeywordsString = Replace(CategoriesKeywordsString, "&", " +") CategoriesKeywordsString = Replace(CategoriesKeywordsString, "-", " -") CategoriesKeywordsArr = Split(CategoriesKeywordsString, " ") FilterString = "CheckItem = (" For Each str in CategoriesKeywordsArr MinusSign = False PlusSign = False AsteriskSign = False If Left(str, 1) = "-" Then MinusSign = True str = Mid(str, 2) End If If Left(str, 1) = "+" Then PlusSign = True str = Mid(str, 2) End If If Left(str, 1) = "*" Then AsterikSign = True str = Mid(str, 2) End If If str<>"" Then If FilterString <> "CheckItem = (" Then If PlusSign or AsterikSign Then FilterString = FilterString & " AND (" Else FilterString = FilterString & " OR (" End If End If If MinusSign or AsterikSign Then ConditionsExist = False If FilterByCategory Then If ConditionsExist Then FilterString = FilterString & " AND (InStr(LCase(RSSCategories), """ & str & """) = 0)" Else FilterString = FilterString & "(InStr(LCase(RSSCategories), """ & str & """) = 0)" End If ConditionsExist = True End If Else ConditionsExist = False If FilterByCategory Then If ConditionsExist Then FilterString = FilterString & " OR (InStr(LCase(RSSCategories), """ & str & """) > 0)" Else FilterString = FilterString & "(InStr(LCase(RSSCategories), """ & str & """) > 0)" End If ConditionsExist = True End If End If FilterString = FilterString & ") " End If ' If str<>"" condition Next If FilterString = "CheckItem = (" Then FilterString = "CheckItem = True" End If GetCategoriesKeywordsFilter = FilterString End Function ' ######## get channel information Sub GetChannel(xmlDOM) ChannelTitle = "" ChannelURL = "" ChannelDescription = "" ' get channel title Set tempObj = xmlDOM.getElementsByTagName("title") If Not tempObj is Nothing Then Set tempObj = tempObj.item(0) If Not tempObj is Nothing Then Set tempObj = tempObj.childNodes.item(0) End If If Not tempObj is Nothing Then ChannelTitle = tempObj.text End If End If ' get channel url Set tempObj = xmlDOM.getElementsByTagName("link") If Not tempObj is Nothing Then Set tempObj = tempObj.item(0) If Not tempObj is Nothing Then Set tempObj = tempObj.childNodes.item(0) End If If Not tempObj is Nothing Then ChannelURL = tempObj.text End If End If ' get channel description Set tempObj = xmlDOM.getElementsByTagName("description") If Not tempObj is Nothing Then Set tempObj = tempObj.item(0) If Not tempObj is Nothing Then Set tempObj = tempObj.childNodes.item(0) End If If Not tempObj is Nothing Then ChannelDescription = tempObj.text End If End If If ChannelURL = "" Then ChannelURL = URLToRSS End If If ChannelDescription = "" Then ChannelDescription = ChannelTitle End If End Sub ' ##### Get RSSItems from xmlDOM ######### Function GetRSS(xmlDOM) ' Collect filtered "items" from downloaded RSS Set RSSItems = xmlDOM.getElementsByTagName("item") ' /// If Not
ShowItems() - WARNING - items collection is empty" End If If ShowEmptyFeeds Then bShow = True Else bShow = False End If End If If bShow Then Dim TemplateHeader TemplateHeader = Replace(MainTemplateHeader, "{CHANNELTITLE}", ChannelTitle) TemplateHeader = Replace(TemplateHeader, "{CHANNELURL}", ChannelURL) TemplateHeader = Replace(TemplateHeader, "{CHANNELDESCRIPTION}", ChannelDescription) ' writing Header Response.Write TemplateHeader ' Show RSSItems ShowItems RSSItems ' writing Footer Response.Write MainTemplateFooter Set RSSItems = Nothing ' clear RSS End If End If End Function ' ##### strip HTML tags from description if set ######### Function stripHTML(ByVal sText) stripHTML= "" bFound = False Do While InStr(sText, "<") bFound = True stripHTML= stripHTML& " " & Left(sText, InStr(sText, "<")-1) sText = MID(sText, InStr(sText, ">") + 1) Loop Do While InStr(sText, " ") bFound = True stripHTML= stripHTML& " " & Left(sText, InStr(sText, " ")-1) sText = MID(sText, InStr(sText, " ") + 1) Loop stripHTML= stripHTML& sText If not bFound Then stripHTML= sText End Function ' ##### Entry point to script ######### Sub Main ' this function is intended to be called only when RSS2HTMLPro.asp is used standalone ShowRSS ' Show Error message, If available If Err.Number <> 0 Then Response.Write "Error: " & Err.Description Err.Clear End If ' Response.End ' uncomment this For use in on-the-fly output End Sub If StandaloneScript Then Main() ' calling this only if the script is standalone. Set StandaloneScript variable to FALSE if script is called from MultiRSS2HTML.asp End If %>
