C# Class Rock.Lava.RockFilters

Mostra file Open project: SparkDevNetwork/Rock

Public Methods

Method Description
AddLinkTagToHead ( string input, string attributeName, string attributeValue ) : string

adds a link tag to the head of the document

AddMetaTagToHead ( string input, string attributeName, string attributeValue ) : string

adds a meta tag to the head of the document

Address ( DotLiquid context, object input, string addressType, string qualifier = "" ) : string

Gets an address for a person object

Append ( object input, string @string ) : string

Appends the specified input.

Attribute ( DotLiquid context, object input, string attributeKey, string qualifier = "" ) : object

DotLiquid Attribute Filter

Campus ( DotLiquid context, object input, object option = null ) : object

Returns the Campus (or Campuses) that the Person belongs to

Ceiling ( object input ) : object

Ceilings the specified input.

Children ( DotLiquid context, object input ) : List

Gets the children of the person

Date ( object input, string format ) : string

Formats a date using a .NET date format string

DateAdd ( object input, int amount, string interval = "d" ) : DateTime?

Adds a time interval to a date

DateDiff ( object sStartDate, object sEndDate, string unit ) : Int64?

takes two datetimes and returns the difference in the unit you provide

DatesFromICal ( object input, object option = null ) : List

Dateses from i cal.

DaysFromNow ( object input ) : string

Dayses from now.

Default ( object input, string defaultString ) : string

Returns the passed default value if the value is undefined or empty, otherwise the value of the variable

DividedBy ( object input, object operand, int precision = 2 ) : object

Divideds the by.

EscapeDataString ( string input ) : string

Converts a string to its escaped representation using Uri.EscapeDataString

Floor ( object input ) : object

Floors the specified input.

Format ( object input, string format ) : string

Formats the specified input.

FormatAsCurrency ( object input ) : string

Formats the specified input as currency using the CurrencySymbol from Global Attributes

FromJSON ( object input ) : object

Returns a dynamic object from a JSON string

FromMarkdown ( string input ) : string

Converts Markdown to HTML

GeofencingGroupMembers ( DotLiquid context, object input, string groupTypeId, string groupTypeRoleId ) : List

Gets the groups of selected type that geofence the selected person

GeofencingGroups ( DotLiquid context, object input, string groupTypeId ) : List

Gets the groups of selected type that geofence the selected person

Group ( DotLiquid context, object input, string groupId, string status = "Active" ) : List

Groups the specified context.

Groups ( DotLiquid context, object input, string groupTypeId, string status = "Active" ) : List

Gets the groups of selected type that person is a member of

GroupsAttended ( DotLiquid context, object input, string groupTypeId ) : List

Gets the groups of selected type that person is a member of which they have attended at least once

HasRightsTo ( DotLiquid context, object input, string verb, string typeName = "" ) : bool

Determines whether [has rights to] [the specified context].

HtmlDecode ( string input ) : string

Decodes an HTML string.

Humanize ( string input ) : string

takes computer-readible-formats and makes them human readable

HumanizeDateTime ( object input, object compareDate = null ) : string

takes a date time and compares it to RockDateTime.Now and returns a human friendly string like 'yesterday' or '2 hours ago'

HumanizeTimeSpan ( object sStartDate, object sEndDate, object precision ) : string

takes two datetimes and humanizes the difference like '1 day'. Supports 'Now' as end date

HumanizeTimeSpan ( object sStartDate, object sEndDate, string unit = "Day", string direction = "min" ) : string

Humanizes the time span.

LastAttendedGroupOfType ( DotLiquid context, object input, string groupTypeId ) : Attendance

Gets the last attendance item for a given person in a group of type provided

Minus ( object input, object operand ) : object

Minus - Overriding this to change the logic. This one does the math if the input can be parsed as a int

NearestGroup ( DotLiquid context, object input, string groupTypeId ) : Rock.Model.Group

Returnes the nearest group of a specific type.

NumberToOrdinal ( string input ) : string

takes 1, 2 and returns 1st, 2nd

NumberToOrdinalWords ( string input ) : string

takes 1,2 and returns first, second

NumberToRomanNumerals ( string input ) : string

takes 1,2 and returns I, II, IV

NumberToWords ( string input ) : string

takes 1,2 and returns one, two

ObfuscateEmail ( string input ) : string

obfuscate a given email

Page ( string input, string parm ) : object

Pages the specified input.

PageRedirect ( string input ) : string

Redirects the specified input.

Parents ( DotLiquid context, object input ) : List

Gets the parents of the person

PersonByAliasId ( DotLiquid context, object input ) : Person

Persons the by alias identifier.

PersonByGuid ( DotLiquid context, object input ) : Person

Persons the by unique identifier.

PersonById ( DotLiquid context, object input ) : Person

Persons the by identifier.

PhoneNumber ( DotLiquid context, object input, string phoneType = "Home", bool countryCode = false ) : string

Gets an number for a person object

Pluralize ( string input ) : string

pluralizes string

PluralizeForQuantity ( string input, object quantity ) : string

pluralizes string based on the value for quantity

Plus ( object input, object operand ) : object

Addition - Overriding this to change the logic. The default filter will concat if the type is string. This one does the math if the input can be parsed as a int

Possessive ( string input ) : string

Possessives the specified input.

Postback ( object input, string command ) : string

creates a postback javascript function

Prepend ( object input, string @string ) : string

Prepend a string to another - this is a Rock version on this filter which takes any object

Property ( DotLiquid context, object input, string propertyKey, string qualifier = "" ) : object

Properties the specified context.

PropertyToKeyValue ( object input ) : object>.Dictionary

Converts a lava property to a key value pair

RegExMatch ( string input, string expression ) : bool

Tests if the inputted string matches the regex

Remove ( object input, string @string ) : string

Remove a substring - this is a Rock version on this filter which takes any object

RemoveFirst ( object input, string @string ) : string

Remove the first occurrence of a substring - this is a Rock version on this filter which takes any object

Replace ( object input, object @string, object replacement = null ) : string

Replace occurrences of a string with another - this is a Rock version on this filter which takes any object

ReplaceFirst ( object input, string @string, string replacement = "" ) : string

Replace the first occurrence of a string with another - this is a Rock version on this filter which takes any object

ReplaceLast ( object input, string search, string replacement = "" ) : string

Replace the last occurrence of a string with another - this is a Rock version on this filter which takes any object

Select ( object input, string selectKey ) : object

Selects the specified input.

SentenceCase ( string input ) : string

returns sentence in 'Sentence case'

SetPageTitle ( string input ) : string

adds a link tag to the head of the document

Shuffle ( object input ) : object

Rearranges an array in a random order

Singularize ( string input ) : string

singularize string

Slice ( string input, int start, int length = 1 ) : String

The slice filter returns a substring, starting at the specified index.

SortByAttribute ( DotLiquid context, object input, string attributeKey ) : object

Sorts the list of items by the specified attribute's value

SundayDate ( object input ) : string

Sundays the date.

Times ( object input, object operand ) : object

Times - Overriding this to change the logic. This one does the math if the input can be parsed as a int

TitleCase ( string input ) : string

returns sentence in 'Title Case'

ToCssClass ( string input ) : string

returns sentence in 'PascalCase'

ToJSON ( object input ) : string

To the json.

ToPascal ( string input ) : string

returns sentence in 'PascalCase'

ToQuantity ( string input, object quantity ) : string

formats string to be appropriate for a quantity

ToString ( int input ) : string

convert a integer to a string

Trim ( object input ) : string

Trims the specified input.

Where ( object input, string filterKey, object filterValue ) : object

Wheres the specified input.

WithFallback ( object input, string successText, string fallbackText ) : string

Withes the fallback.

ZebraPhoto ( DotLiquid context, object input, string size ) : string

Gets the profile photo for a person object in a string that zebra printers can use. If the person has no photo, a default silhouette photo (adult/child, male/female) photo is used. See http://www.rockrms.com/lava/person#ZebraPhoto for details.

ZebraPhoto ( DotLiquid context, object input, string size, double brightness = 1.0, double contrast = 1.0 ) : string

Gets the profile photo for a person object in a string that zebra printers can use. If the person has no photo, a default silhouette photo (adult/child, male/female) photo is used. See http://www.rockrms.com/lava/person#ZebraPhoto for details.

Private Methods

Method Description
GetCurrentPerson ( DotLiquid context ) : Person

Gets the current person.

GetDateFromObject ( object date ) : System.DateTime

Gets the date from object.

GetMonthsBetween ( System.DateTime from, System.DateTime to ) : int
GetOccurrenceDates ( string iCalString, int returnCount ) : List

Gets the occurrence dates.

GetPerson ( object input ) : Person

Gets the person.

GetRockContext ( DotLiquid context ) : RockContext

Gets the rock context.

ImageAdjust ( Bitmap originalImage, float brightness = 1.0f, float contrast = 1.0f, float gamma = 1.0f ) : Bitmap

Adjust the brightness, contrast or gamma of the given image.

Method Details

AddLinkTagToHead() public static method

adds a link tag to the head of the document
public static AddLinkTagToHead ( string input, string attributeName, string attributeValue ) : string
input string The input to use for the href of the tag.
attributeName string Name of the attribute.
attributeValue string The attribute value.
return string

AddMetaTagToHead() public static method

adds a meta tag to the head of the document
public static AddMetaTagToHead ( string input, string attributeName, string attributeValue ) : string
input string The input to use for the content attribute of the tag.
attributeName string Name of the attribute.
attributeValue string The attribute value.
return string

Address() public static method

Gets an address for a person object
public static Address ( DotLiquid context, object input, string addressType, string qualifier = "" ) : string
context DotLiquid The context.
input object The input.
addressType string Type of the address.
qualifier string The qualifier.
return string

Append() public static method

Appends the specified input.
public static Append ( object input, string @string ) : string
input object The input.
@string string
return string

Attribute() public static method

DotLiquid Attribute Filter
public static Attribute ( DotLiquid context, object input, string attributeKey, string qualifier = "" ) : object
context DotLiquid The context.
input object The input.
attributeKey string The attribute key.
qualifier string The qualifier.
return object

Campus() public static method

Returns the Campus (or Campuses) that the Person belongs to
public static Campus ( DotLiquid context, object input, object option = null ) : object
context DotLiquid The context.
input object The input.
option object The option.
return object

Ceiling() public static method

Ceilings the specified input.
public static Ceiling ( object input ) : object
input object The input.
return object

Children() public static method

Gets the children of the person
public static Children ( DotLiquid context, object input ) : List
context DotLiquid The context.
input object The input.
return List

Date() public static method

Formats a date using a .NET date format string
public static Date ( object input, string format ) : string
input object
format string
return string

DateAdd() public static method

Adds a time interval to a date
public static DateAdd ( object input, int amount, string interval = "d" ) : DateTime?
input object The input.
amount int The amount.
interval string The interval.
return DateTime?

DateDiff() public static method

takes two datetimes and returns the difference in the unit you provide
public static DateDiff ( object sStartDate, object sEndDate, string unit ) : Int64?
sStartDate object The s start date.
sEndDate object The s end date.
unit string The unit.
return Int64?

DatesFromICal() public static method

Dateses from i cal.
public static DatesFromICal ( object input, object option = null ) : List
input object The input.
option object The option.
return List

DaysFromNow() public static method

Dayses from now.
public static DaysFromNow ( object input ) : string
input object The input.
return string

Default() public static method

Returns the passed default value if the value is undefined or empty, otherwise the value of the variable
public static Default ( object input, string defaultString ) : string
input object The input.
defaultString string The default string.
return string

DividedBy() public static method

Divideds the by.
public static DividedBy ( object input, object operand, int precision = 2 ) : object
input object The input.
operand object The operand.
precision int The precision.
return object

EscapeDataString() public static method

Converts a string to its escaped representation using Uri.EscapeDataString
public static EscapeDataString ( string input ) : string
input string The input.
return string

Floor() public static method

Floors the specified input.
public static Floor ( object input ) : object
input object The input.
return object

Format() public static method

Formats the specified input.
public static Format ( object input, string format ) : string
input object The input.
format string The format.
return string

FormatAsCurrency() public static method

Formats the specified input as currency using the CurrencySymbol from Global Attributes
public static FormatAsCurrency ( object input ) : string
input object The input.
return string

FromJSON() public static method

Returns a dynamic object from a JSON string
public static FromJSON ( object input ) : object
input object The input.
return object

FromMarkdown() public static method

Converts Markdown to HTML
public static FromMarkdown ( string input ) : string
input string The input.
return string

GeofencingGroupMembers() public static method

Gets the groups of selected type that geofence the selected person
public static GeofencingGroupMembers ( DotLiquid context, object input, string groupTypeId, string groupTypeRoleId ) : List
context DotLiquid The context.
input object The input.
groupTypeId string The group type identifier.
groupTypeRoleId string The group type role identifier.
return List

GeofencingGroups() public static method

Gets the groups of selected type that geofence the selected person
public static GeofencingGroups ( DotLiquid context, object input, string groupTypeId ) : List
context DotLiquid The context.
input object The input.
groupTypeId string The group type identifier.
return List

Group() public static method

Groups the specified context.
public static Group ( DotLiquid context, object input, string groupId, string status = "Active" ) : List
context DotLiquid The context.
input object The input.
groupId string The group identifier.
status string The status.
return List

Groups() public static method

Gets the groups of selected type that person is a member of
public static Groups ( DotLiquid context, object input, string groupTypeId, string status = "Active" ) : List
context DotLiquid The context.
input object The input.
groupTypeId string The group type identifier.
status string The status.
return List

GroupsAttended() public static method

Gets the groups of selected type that person is a member of which they have attended at least once
public static GroupsAttended ( DotLiquid context, object input, string groupTypeId ) : List
context DotLiquid The context.
input object The input.
groupTypeId string The group type identifier.
return List

HasRightsTo() public static method

Determines whether [has rights to] [the specified context].
Could not determine type for the input provided. Consider passing it in (e.g. 'Rock.Model.Person')
public static HasRightsTo ( DotLiquid context, object input, string verb, string typeName = "" ) : bool
context DotLiquid The context.
input object The input.
verb string The verb.
typeName string Name of the type.
return bool

HtmlDecode() public static method

Decodes an HTML string.
public static HtmlDecode ( string input ) : string
input string The input.
return string

Humanize() public static method

takes computer-readible-formats and makes them human readable
public static Humanize ( string input ) : string
input string
return string

HumanizeDateTime() public static method

takes a date time and compares it to RockDateTime.Now and returns a human friendly string like 'yesterday' or '2 hours ago'
public static HumanizeDateTime ( object input, object compareDate = null ) : string
input object The input.
compareDate object The compare date.
return string

HumanizeTimeSpan() public static method

takes two datetimes and humanizes the difference like '1 day'. Supports 'Now' as end date
public static HumanizeTimeSpan ( object sStartDate, object sEndDate, object precision ) : string
sStartDate object The s start date.
sEndDate object The s end date.
precision object The precision.
return string

HumanizeTimeSpan() public static method

Humanizes the time span.
public static HumanizeTimeSpan ( object sStartDate, object sEndDate, string unit = "Day", string direction = "min" ) : string
sStartDate object The s start date.
sEndDate object The s end date.
unit string The minimum unit.
direction string The direction.
return string

LastAttendedGroupOfType() public static method

Gets the last attendance item for a given person in a group of type provided
public static LastAttendedGroupOfType ( DotLiquid context, object input, string groupTypeId ) : Attendance
context DotLiquid The context.
input object The input.
groupTypeId string The group type identifier.
return Attendance

Minus() public static method

Minus - Overriding this to change the logic. This one does the math if the input can be parsed as a int
public static Minus ( object input, object operand ) : object
input object
operand object
return object

NearestGroup() public static method

Returnes the nearest group of a specific type.
public static NearestGroup ( DotLiquid context, object input, string groupTypeId ) : Rock.Model.Group
context DotLiquid The context.
input object The input.
groupTypeId string The group type identifier.
return Rock.Model.Group

NumberToOrdinal() public static method

takes 1, 2 and returns 1st, 2nd
public static NumberToOrdinal ( string input ) : string
input string
return string

NumberToOrdinalWords() public static method

takes 1,2 and returns first, second
public static NumberToOrdinalWords ( string input ) : string
input string
return string

NumberToRomanNumerals() public static method

takes 1,2 and returns I, II, IV
public static NumberToRomanNumerals ( string input ) : string
input string
return string

NumberToWords() public static method

takes 1,2 and returns one, two
public static NumberToWords ( string input ) : string
input string
return string

ObfuscateEmail() public static method

obfuscate a given email
public static ObfuscateEmail ( string input ) : string
input string
return string

Page() public static method

Pages the specified input.
public static Page ( string input, string parm ) : object
input string The input.
parm string The parm.
return object

PageRedirect() public static method

Redirects the specified input.
public static PageRedirect ( string input ) : string
input string The input.
return string

Parents() public static method

Gets the parents of the person
public static Parents ( DotLiquid context, object input ) : List
context DotLiquid The context.
input object The input.
return List

PersonByAliasId() public static method

Persons the by alias identifier.
public static PersonByAliasId ( DotLiquid context, object input ) : Person
context DotLiquid The context.
input object The input.
return Person

PersonByGuid() public static method

Persons the by unique identifier.
public static PersonByGuid ( DotLiquid context, object input ) : Person
context DotLiquid The context.
input object The input.
return Person

PersonById() public static method

Persons the by identifier.
public static PersonById ( DotLiquid context, object input ) : Person
context DotLiquid The context.
input object The input.
return Person

PhoneNumber() public static method

Gets an number for a person object
public static PhoneNumber ( DotLiquid context, object input, string phoneType = "Home", bool countryCode = false ) : string
context DotLiquid The context.
input object The input.
phoneType string Type of the phone number.
countryCode bool Whether or not there should be a country code returned
return string

Pluralize() public static method

pluralizes string
public static Pluralize ( string input ) : string
input string
return string

PluralizeForQuantity() public static method

pluralizes string based on the value for quantity
public static PluralizeForQuantity ( string input, object quantity ) : string
input string The input.
quantity object The quantity.
return string

Plus() public static method

Addition - Overriding this to change the logic. The default filter will concat if the type is string. This one does the math if the input can be parsed as a int
public static Plus ( object input, object operand ) : object
input object
operand object
return object

Possessive() public static method

Possessives the specified input.
public static Possessive ( string input ) : string
input string The input.
return string

Postback() public static method

creates a postback javascript function
public static Postback ( object input, string command ) : string
input object The input.
command string The command.
return string

Prepend() public static method

Prepend a string to another - this is a Rock version on this filter which takes any object
public static Prepend ( object input, string @string ) : string
input object
@string string
return string

Property() public static method

Properties the specified context.
public static Property ( DotLiquid context, object input, string propertyKey, string qualifier = "" ) : object
context DotLiquid The context.
input object The input.
propertyKey string The property key.
qualifier string The qualifier.
return object

PropertyToKeyValue() public static method

Converts a lava property to a key value pair
public static PropertyToKeyValue ( object input ) : object>.Dictionary
input object The input.
return object>.Dictionary

RegExMatch() public static method

Tests if the inputted string matches the regex
public static RegExMatch ( string input, string expression ) : bool
input string The input.
expression string The regex expression.
return bool

Remove() public static method

Remove a substring - this is a Rock version on this filter which takes any object
public static Remove ( object input, string @string ) : string
input object
@string string
return string

RemoveFirst() public static method

Remove the first occurrence of a substring - this is a Rock version on this filter which takes any object
public static RemoveFirst ( object input, string @string ) : string
input object
@string string
return string

Replace() public static method

Replace occurrences of a string with another - this is a Rock version on this filter which takes any object
public static Replace ( object input, object @string, object replacement = null ) : string
input object
@string object
replacement object
return string

ReplaceFirst() public static method

Replace the first occurrence of a string with another - this is a Rock version on this filter which takes any object
public static ReplaceFirst ( object input, string @string, string replacement = "" ) : string
input object
@string string
replacement string
return string

ReplaceLast() public static method

Replace the last occurrence of a string with another - this is a Rock version on this filter which takes any object
public static ReplaceLast ( object input, string search, string replacement = "" ) : string
input object The input.
search string The search.
replacement string The replacement.
return string

Select() public static method

Selects the specified input.
public static Select ( object input, string selectKey ) : object
input object The input.
selectKey string The select key.
return object

SentenceCase() public static method

returns sentence in 'Sentence case'
public static SentenceCase ( string input ) : string
input string
return string

SetPageTitle() public static method

adds a link tag to the head of the document
public static SetPageTitle ( string input ) : string
input string The input to use for the href of the tag.
return string

Shuffle() public static method

Rearranges an array in a random order
public static Shuffle ( object input ) : object
input object
return object

Singularize() public static method

singularize string
public static Singularize ( string input ) : string
input string
return string

Slice() public static method

The slice filter returns a substring, starting at the specified index.
public static Slice ( string input, int start, int length = 1 ) : String
input string The input string.
start int If the passed index is negative, it is counted from the end of the string.
length int An optional second parameter can be passed to specify the length of the substring. If no second parameter is given, a substring of one character will be returned.
return String

SortByAttribute() public static method

Sorts the list of items by the specified attribute's value
public static SortByAttribute ( DotLiquid context, object input, string attributeKey ) : object
context DotLiquid The context.
input object The input.
attributeKey string The attribute key.
return object

SundayDate() public static method

Sundays the date.
public static SundayDate ( object input ) : string
input object The input.
return string

Times() public static method

Times - Overriding this to change the logic. This one does the math if the input can be parsed as a int
public static Times ( object input, object operand ) : object
input object
operand object
return object

TitleCase() public static method

returns sentence in 'Title Case'
public static TitleCase ( string input ) : string
input string
return string

ToCssClass() public static method

returns sentence in 'PascalCase'
public static ToCssClass ( string input ) : string
input string
return string

ToJSON() public static method

To the json.
public static ToJSON ( object input ) : string
input object The input.
return string

ToPascal() public static method

returns sentence in 'PascalCase'
public static ToPascal ( string input ) : string
input string
return string

ToQuantity() public static method

formats string to be appropriate for a quantity
public static ToQuantity ( string input, object quantity ) : string
input string The input.
quantity object The quantity.
return string

ToString() public static method

convert a integer to a string
public static ToString ( int input ) : string
input int
return string

Trim() public static method

Trims the specified input.
public static Trim ( object input ) : string
input object The input.
return string

Where() public static method

Wheres the specified input.
public static Where ( object input, string filterKey, object filterValue ) : object
input object The input.
filterKey string The filter key.
filterValue object The filter value.
return object

WithFallback() public static method

Withes the fallback.
public static WithFallback ( object input, string successText, string fallbackText ) : string
input object The input.
successText string The success text.
fallbackText string The fallback text.
return string

ZebraPhoto() public static method

Gets the profile photo for a person object in a string that zebra printers can use. If the person has no photo, a default silhouette photo (adult/child, male/female) photo is used. See http://www.rockrms.com/lava/person#ZebraPhoto for details.
public static ZebraPhoto ( DotLiquid context, object input, string size ) : string
context DotLiquid The context.
input object The input, which is the person.
size string The size.
return string

ZebraPhoto() public static method

Gets the profile photo for a person object in a string that zebra printers can use. If the person has no photo, a default silhouette photo (adult/child, male/female) photo is used. See http://www.rockrms.com/lava/person#ZebraPhoto for details.
public static ZebraPhoto ( DotLiquid context, object input, string size, double brightness = 1.0, double contrast = 1.0 ) : string
context DotLiquid The context.
input object The input, which is the person.
size string The size.
brightness double The brightness adjustment (-1.0 to 1.0).
contrast double The contrast adjustment (-1.0 to 1.0).
return string