C# Class Upac.Core.Utilities.XsltExtension

显示文件 Open project: 1508/upac-for-umbraco

Public Methods

Method Description
Clip ( string text, int maxLength, bool ellipsis ) : string

Clips the specified text if the text is bigger than the maxLength provided.

CreateEmptyIterator ( ) : XPathNodeIterator

Creates the empty iterator. Used only internel by this class

CreateForLoop ( int to ) : XPathNodeIterator

Creates XML that can be used as a foor loop. Starting from 1 and to the provided to parameter.

CreateForLoop ( int from, int to ) : XPathNodeIterator

Creates XML that can be used as a foor loop. Starting from parameter from and to the provided to parameter.

CreateRfc822Date ( string isodate ) : string

Returns the RFC822 datetime format for the specified isodate. RFC822 should be used when generating rss feeds etc

FetchFeedAndNormaliseToAtom ( string url ) : XPathNodeIterator

Fetches a external rss/atom feed and normalise it to atom schema.

FormatIsoDate ( string isodate, string fieldNameInSettings ) : string

Formats the iso date.

FormatIsoDateLong ( string isodate ) : string

Formats the iso date long.

FormatIsoDateShort ( string isodate ) : string

Formats the iso date short.

FormatIsoDateTime ( string isodate ) : string

Formats the iso to date and time.

FormatIsoTime ( string isodate ) : string

Formats the iso to time.

GetCurrentCultureName ( ) : string

Gets the name of the current culture.

GetDescendantsViaXPath ( XPathNodeIterator from, string xpath ) : XPathNodeIterator
GetDictionaryItem ( string key ) : string

Gets a dictionary item from Umbraco. If querystring parameter debug exists a debug span is also provided.

GetFileExtension ( string filename ) : string

Gets the file extension.

GetHomeNode ( ) : XPathNodeIterator

Gets the home node.

GetImageTag ( string imagePathOrMediaId ) : string

Gets an xhtml image tag via the provided media id or image path.

GetImageTag ( string imagePathOrMediaId, int maxWidth ) : string

Gets an xhtml image tag via the provided media id or image path

GetImageTag ( string imagePathOrMediaId, int maxWidth, int maxHeight ) : string
GetImageTag ( string imagePathOrMediaId, int maxWidth, int maxHeight, bool constrain ) : string
GetLinkTag ( string nodeId ) : string

Get a link tag

Gets a link tag where the href points to the node and text will come from GetMenuTitle

GetLinkTag ( string nodeId, string linkText ) : string

Get a link tag with overload for the link text

Gets a link tag where the href points to the node and you have provided the link text

GetLinkTag ( string nodeId, string linkText, string cssClass ) : string

Get a link tag with overload for the link text and a css class to add to the a tag.

Gets a link tag where the href points to the node and you can add a css class

GetMediaPath ( int mediaId ) : string

Gets the media path via a media id

GetOEmbedHtml ( string url, string maxWidth, string maxHeight ) : string

Gets the OEmbed HTML.

GetReadableFileSizeViaBytes ( string bytes ) : string

Gets the readable file size via bytes.

GetTemplateIdFromAlias ( string templateAlias ) : int
GetThumbnailUrl ( string imagePathOrMediaId, int width ) : string
GetThumbnailUrl ( string imagePathOrMediaId, int width, int height ) : string
GetThumbnailUrl ( string imagePathOrMediaId, int width, int height, bool constrain ) : string
IsInUpacDebug ( ) : bool
IsoDateNow ( ) : string
MenuInclude ( XPathNodeIterator ni ) : bool

A simple method which returns true if the node should be included in navigations. The following things must be true 1. The node must not have set the property hideFromNavigation true. 2. The node must have a template associated

MenuTitle ( XPathNodeIterator ni ) : string
ToBool ( string input ) : bool

Converts a string to a bool. If the input string is equal 1 true is returned otherwise false.

ToNumber ( string input, int defaultNumber ) : int

Converts a string to a number. If the input string is empty or can not be converted, the defaultNumber is returned instead.

UrlViaNodeId ( string nodeId ) : string

Get the url to a node via node id.

This method also handles redirect nodes which can point to internal or external pages.

UrlViaNodeId ( string nodeId, string alternateTemplate ) : string

Get the url to a node via node id and appending the provided alternate template

UrlViaNodeId ( string nodeId, string alternateTemplate, bool includeDomain ) : string

Get the url to a node via node id and appending the provided alternate template and can include the domain incl. http://

Private Methods

Method Description
GetImageTag ( string imagePath, string altText ) : string

Method Details

Clip() public static method

Clips the specified text if the text is bigger than the maxLength provided.
public static Clip ( string text, int maxLength, bool ellipsis ) : string
text string The text to be clipped.
maxLength int Max length of the returned string.
ellipsis bool if set to true show ellipsis (...)
return string

CreateEmptyIterator() public static method

Creates the empty iterator. Used only internel by this class
public static CreateEmptyIterator ( ) : XPathNodeIterator
return System.Xml.XPath.XPathNodeIterator

CreateForLoop() public static method

Creates XML that can be used as a foor loop. Starting from 1 and to the provided to parameter.
public static CreateForLoop ( int to ) : XPathNodeIterator
to int ending point
return System.Xml.XPath.XPathNodeIterator

CreateForLoop() public static method

Creates XML that can be used as a foor loop. Starting from parameter from and to the provided to parameter.
public static CreateForLoop ( int from, int to ) : XPathNodeIterator
from int Start int
to int End int
return System.Xml.XPath.XPathNodeIterator

CreateRfc822Date() public static method

Returns the RFC822 datetime format for the specified isodate. RFC822 should be used when generating rss feeds etc
public static CreateRfc822Date ( string isodate ) : string
isodate string
return string

FetchFeedAndNormaliseToAtom() public static method

Fetches a external rss/atom feed and normalise it to atom schema.
public static FetchFeedAndNormaliseToAtom ( string url ) : XPathNodeIterator
url string The external URL for the feed to fetch.
return System.Xml.XPath.XPathNodeIterator

FormatIsoDate() public static method

Formats the iso date.
public static FormatIsoDate ( string isodate, string fieldNameInSettings ) : string
isodate string The isodate.
fieldNameInSettings string The field name in settings.
return string

FormatIsoDateLong() public static method

Formats the iso date long.
public static FormatIsoDateLong ( string isodate ) : string
isodate string The isodate.
return string

FormatIsoDateShort() public static method

Formats the iso date short.
public static FormatIsoDateShort ( string isodate ) : string
isodate string The isodate.
return string

FormatIsoDateTime() public static method

Formats the iso to date and time.
public static FormatIsoDateTime ( string isodate ) : string
isodate string The isodate.
return string

FormatIsoTime() public static method

Formats the iso to time.
public static FormatIsoTime ( string isodate ) : string
isodate string The isodate.
return string

GetCurrentCultureName() public static method

Gets the name of the current culture.
public static GetCurrentCultureName ( ) : string
return string

GetDescendantsViaXPath() public static method

public static GetDescendantsViaXPath ( XPathNodeIterator from, string xpath ) : XPathNodeIterator
from System.Xml.XPath.XPathNodeIterator
xpath string
return System.Xml.XPath.XPathNodeIterator

GetDictionaryItem() public static method

Gets a dictionary item from Umbraco. If querystring parameter debug exists a debug span is also provided.
public static GetDictionaryItem ( string key ) : string
key string The dictionary key
return string

GetFileExtension() public static method

Gets the file extension.
public static GetFileExtension ( string filename ) : string
filename string The filename.
return string

GetHomeNode() public static method

Gets the home node.
public static GetHomeNode ( ) : XPathNodeIterator
return System.Xml.XPath.XPathNodeIterator

GetImageTag() public static method

Gets an xhtml image tag via the provided media id or image path.
public static GetImageTag ( string imagePathOrMediaId ) : string
imagePathOrMediaId string The image path or media id.
return string

GetImageTag() public static method

Gets an xhtml image tag via the provided media id or image path
public static GetImageTag ( string imagePathOrMediaId, int maxWidth ) : string
imagePathOrMediaId string The image path or media id.
maxWidth int Max width.
return string

GetImageTag() public static method

public static GetImageTag ( string imagePathOrMediaId, int maxWidth, int maxHeight ) : string
imagePathOrMediaId string
maxWidth int
maxHeight int
return string

GetImageTag() public static method

public static GetImageTag ( string imagePathOrMediaId, int maxWidth, int maxHeight, bool constrain ) : string
imagePathOrMediaId string
maxWidth int
maxHeight int
constrain bool
return string

GetLinkTag() public static method

Get a link tag
Gets a link tag where the href points to the node and text will come from GetMenuTitle
public static GetLinkTag ( string nodeId ) : string
nodeId string The node id.
return string

GetLinkTag() public static method

Get a link tag with overload for the link text
Gets a link tag where the href points to the node and you have provided the link text
public static GetLinkTag ( string nodeId, string linkText ) : string
nodeId string The node id.
linkText string The link text.
return string

GetLinkTag() public static method

Get a link tag with overload for the link text and a css class to add to the a tag.
Gets a link tag where the href points to the node and you can add a css class
public static GetLinkTag ( string nodeId, string linkText, string cssClass ) : string
nodeId string The node id.
linkText string The link text.
cssClass string Css class
return string

GetMediaPath() public static method

Gets the media path via a media id
public static GetMediaPath ( int mediaId ) : string
mediaId int The media id.
return string

GetOEmbedHtml() public static method

Gets the OEmbed HTML.
public static GetOEmbedHtml ( string url, string maxWidth, string maxHeight ) : string
url string The OEmbed URL/Source.
maxWidth string Width of the max.
maxHeight string Height of the max.
return string

GetReadableFileSizeViaBytes() public static method

Gets the readable file size via bytes.
public static GetReadableFileSizeViaBytes ( string bytes ) : string
bytes string The bytes.
return string

GetTemplateIdFromAlias() public static method

public static GetTemplateIdFromAlias ( string templateAlias ) : int
templateAlias string
return int

GetThumbnailUrl() public static method

public static GetThumbnailUrl ( string imagePathOrMediaId, int width ) : string
imagePathOrMediaId string
width int
return string

GetThumbnailUrl() public static method

public static GetThumbnailUrl ( string imagePathOrMediaId, int width, int height ) : string
imagePathOrMediaId string
width int
height int
return string

GetThumbnailUrl() public static method

public static GetThumbnailUrl ( string imagePathOrMediaId, int width, int height, bool constrain ) : string
imagePathOrMediaId string
width int
height int
constrain bool
return string

IsInUpacDebug() public static method

public static IsInUpacDebug ( ) : bool
return bool

IsoDateNow() public static method

public static IsoDateNow ( ) : string
return string

MenuInclude() public static method

A simple method which returns true if the node should be included in navigations. The following things must be true 1. The node must not have set the property hideFromNavigation true. 2. The node must have a template associated
public static MenuInclude ( XPathNodeIterator ni ) : bool
ni System.Xml.XPath.XPathNodeIterator The node to check.
return bool

MenuTitle() public static method

public static MenuTitle ( XPathNodeIterator ni ) : string
ni System.Xml.XPath.XPathNodeIterator
return string

ToBool() public static method

Converts a string to a bool. If the input string is equal 1 true is returned otherwise false.
public static ToBool ( string input ) : bool
input string The input to be converted
return bool

ToNumber() public static method

Converts a string to a number. If the input string is empty or can not be converted, the defaultNumber is returned instead.
public static ToNumber ( string input, int defaultNumber ) : int
input string The input to be converted
defaultNumber int The default number to return if the input can not be converted.
return int

UrlViaNodeId() public static method

Get the url to a node via node id.
This method also handles redirect nodes which can point to internal or external pages.
public static UrlViaNodeId ( string nodeId ) : string
nodeId string The node id.
return string

UrlViaNodeId() public static method

Get the url to a node via node id and appending the provided alternate template
public static UrlViaNodeId ( string nodeId, string alternateTemplate ) : string
nodeId string The node id.
alternateTemplate string The alternate template.
return string

UrlViaNodeId() public static method

Get the url to a node via node id and appending the provided alternate template and can include the domain incl. http://
public static UrlViaNodeId ( string nodeId, string alternateTemplate, bool includeDomain ) : string
nodeId string The node id.
alternateTemplate string The alternate template. May be empty.
includeDomain bool if set to true include domain and http.
return string