• Share
    • Twitter
    • LinkedIn
    • Facebook
    • Email
  • Feedback
  • Improve this Doc

Class TokenReplace

The TokenReplace class provides the option to replace tokens formatted [object:property] or [object:property|format] or [custom:no] within a string with the appropriate current property/custom values. Example for Newsletter: 'Dear [user:Displayname],' ==> 'Dear Superuser Account,' Supported Token Sources: User, Host, Portal, Tab, Module, Membership, Profile, Row, Date, Ticks, ArrayList (Custom), IDictionary.

Inheritance
System.Object
BaseTokenReplace
BaseCustomTokenReplace
TokenReplace
HtmlTokenReplace
LanguageTokenReplace
Inherited Members
BaseCustomTokenReplace.PropertySource
BaseCustomTokenReplace.TokenContext
BaseCustomTokenReplace.AccessingUser
BaseCustomTokenReplace.DebugMessages
BaseCustomTokenReplace.Language
BaseCustomTokenReplace.Provider
BaseCustomTokenReplace.FormatProvider
BaseCustomTokenReplace.CurrentAccessLevel
BaseCustomTokenReplace.Cacheability(String)
BaseCustomTokenReplace.ContainsTokens(String)
BaseCustomTokenReplace.replacedTokenValue(String, String, String)
BaseTokenReplace.ObjectLessToken
BaseTokenReplace.TokenizerRegex
BaseTokenReplace.UseObjectLessExpression
Namespace: DotNetNuke.Services.Tokens
Assembly: DotNetNuke.dll
Syntax
public class TokenReplace : BaseCustomTokenReplace

Constructors

| Improve this Doc View Source

TokenReplace()

Initializes a new instance of the TokenReplace class. creates a new TokenReplace object for default context.

Declaration
public TokenReplace()
| Improve this Doc View Source

TokenReplace(Scope, Int32)

Initializes a new instance of the TokenReplace class. creates a new TokenReplace object for custom context.

Declaration
public TokenReplace(Scope accessLevel, int moduleID)
Parameters
Type Name Description
Scope accessLevel

Security level granted by the calling object.

System.Int32 moduleID

ID of the current module.

| Improve this Doc View Source

TokenReplace(Scope, String, PortalSettings, UserInfo, Int32)

Initializes a new instance of the TokenReplace class. creates a new TokenReplace object for custom context.

Declaration
public TokenReplace(Scope accessLevel, string language, PortalSettings portalSettings, UserInfo user, int moduleID)
Parameters
Type Name Description
Scope accessLevel

Security level granted by the calling object.

System.String language

Locale to be used for formatting etc.

PortalSettings portalSettings

PortalSettings to be used.

UserInfo user

user, for which the properties shall be returned.

System.Int32 moduleID

ID of the current module.

| Improve this Doc View Source

TokenReplace(Scope, String, PortalSettings, UserInfo)

Initializes a new instance of the TokenReplace class. creates a new TokenReplace object for custom context.

Declaration
public TokenReplace(Scope accessLevel, string language, PortalSettings portalSettings, UserInfo user)
Parameters
Type Name Description
Scope accessLevel

Security level granted by the calling object.

System.String language

Locale to be used for formatting etc.

PortalSettings portalSettings

PortalSettings to be used.

UserInfo user

user, for which the properties shall be returned.

| Improve this Doc View Source

TokenReplace(Scope)

Initializes a new instance of the TokenReplace class. creates a new TokenReplace object for custom context.

Declaration
public TokenReplace(Scope accessLevel)
Parameters
Type Name Description
Scope accessLevel

Security level granted by the calling object.

| Improve this Doc View Source

TokenReplace(Int32)

Initializes a new instance of the TokenReplace class. creates a new TokenReplace object for default context and the current module.

Declaration
public TokenReplace(int moduleID)
Parameters
Type Name Description
System.Int32 moduleID

ID of the current module.

Properties

| Improve this Doc View Source

ModuleId

Gets or sets /sets the current ModuleID to be used for 'User:' token replacement.

Declaration
public int ModuleId { get; set; }
Property Value
Type Description
System.Int32

ModuleID (Integer).

| Improve this Doc View Source

ModuleInfo

Gets or sets the module settings object to use for 'Module:' token replacement.

Declaration
public ModuleInfo ModuleInfo { get; set; }
Property Value
Type Description
ModuleInfo
| Improve this Doc View Source

PortalSettings

Gets or sets /sets the portal settings object to use for 'Portal:' token replacement.

Declaration
public PortalSettings PortalSettings { get; set; }
Property Value
Type Description
PortalSettings

PortalSettings oject.

| Improve this Doc View Source

User

Gets or sets /sets the user object to use for 'User:' token replacement.

Declaration
public UserInfo User { get; set; }
Property Value
Type Description
UserInfo

UserInfo oject.

Methods

| Improve this Doc View Source

ReplaceEnvironmentTokens(String, ArrayList, String, DataRow)

Replaces tokens in sourceText parameter with the property values.

Declaration
public string ReplaceEnvironmentTokens(string sourceText, ArrayList custom, string customCaption, DataRow row)
Parameters
Type Name Description
System.String sourceText

String with [Object:Property] tokens.

ArrayList custom

NameValueList for replacing [custom:name] tokens, where 'custom' is specified in next param and name is either thekey or the index number in the string.

System.String customCaption

Token name to be used inside token [custom:name].

DataRow row

DataRow, from which field values shall be used for replacement.

Returns
Type Description
System.String

string containing replaced values.

| Improve this Doc View Source

ReplaceEnvironmentTokens(String, ArrayList, String)

Replaces tokens in sourceText parameter with the property values.

Declaration
public string ReplaceEnvironmentTokens(string sourceText, ArrayList custom, string customCaption)
Parameters
Type Name Description
System.String sourceText

String with [Object:Property] tokens.

ArrayList custom
System.String customCaption
Returns
Type Description
System.String

string containing replaced values.

| Improve this Doc View Source

ReplaceEnvironmentTokens(String, DataRow)

Replaces tokens in sourceText parameter with the property values.

Declaration
public string ReplaceEnvironmentTokens(string sourceText, DataRow row)
Parameters
Type Name Description
System.String sourceText

String with [Object:Property] tokens.

DataRow row
Returns
Type Description
System.String

string containing replaced values.

| Improve this Doc View Source

ReplaceEnvironmentTokens(String, IDictionary, String)

Replaces tokens in sourceText parameter with the property values.

Declaration
public string ReplaceEnvironmentTokens(string sourceText, IDictionary custom, string customCaption)
Parameters
Type Name Description
System.String sourceText

String with [Object:Property] tokens.

IDictionary custom

NameValueList for replacing [custom:name] tokens, where 'custom' is specified in next param and name is either thekey or the index number in the string.

System.String customCaption

Token name to be used inside token [custom:name].

Returns
Type Description
System.String

string containing replaced values.

| Improve this Doc View Source

ReplaceEnvironmentTokens(String, IDictionary, String[])

Replaces tokens in sourceText parameter with the property values.

Declaration
public string ReplaceEnvironmentTokens(string sourceText, IDictionary custom, string[] customCaptions)
Parameters
Type Name Description
System.String sourceText

String with [Object:Property] tokens.

IDictionary custom

NameValueList for replacing [custom:name] tokens, where 'custom' is specified in next param and name is either thekey or the index number in the string.

System.String[] customCaptions

Token names to be used inside token [custom:name], where 'custom' is one of the values in the string array.

Returns
Type Description
System.String

string containing replaced values.

| Improve this Doc View Source

ReplaceEnvironmentTokens(String)

Replaces tokens in sourceText parameter with the property values.

Declaration
public string ReplaceEnvironmentTokens(string sourceText)
Parameters
Type Name Description
System.String sourceText

String with [Object:Property] tokens.

Returns
Type Description
System.String

string containing replaced values.

| Improve this Doc View Source

ReplaceTokens(String)

Replaces tokens in sourceText parameter with the property values, skipping environment objects.

Declaration
protected override string ReplaceTokens(string sourceText)
Parameters
Type Name Description
System.String sourceText

String with [Object:Property] tokens.

Returns
Type Description
System.String

string containing replaced values.

Overrides
BaseCustomTokenReplace.ReplaceTokens(String)

Extension Methods

JsonExtensionsWeb.ToJson(Object)
  • View Source
Back to top by the community, for the community... #DNNCMS