Nucleus .Net Core CMS

SiteExtensions Class

Namespace: Nucleus.Extensions
Assembly: Nucleus.Extensions.dll
Extension methods to transform Models.SiteSiteSettings from name/value pairs to strongly-typed classes and back again.
AbsoluteUri (Site site, Boolean useSSL)
Return the absolute Uri for the specified site.
Parameters
Name Type
site Nucleus.Abstractions.Models.Site
useSSL Boolean
AbsoluteUri (Site site, Page page, Boolean useSSL)
Return the absolute Uri for the specified site and page.
AbsoluteUri (Site site, String relativeUrl, Boolean useSSL)
Return the absolute Uri for the specified site and relative url.
Parameters
Name Type
site Nucleus.Abstractions.Models.Site
relativeUrl String
useSSL Boolean
AbsoluteUri (Site site, Page page, String relativeUrl, Boolean useSSL)
Return the absolute Uri for the specified site and page and relative url.
Parameters
Name Type
site Nucleus.Abstractions.Models.Site
page Nucleus.Abstractions.Models.Page
relativeUrl String
useSSL Boolean
AbsoluteUrl (Site site, Boolean useSSL)
Return the absolute Uri for the specified site as a string.
Parameters
Name Type
site Nucleus.Abstractions.Models.Site
useSSL Boolean
AbsoluteUrl (Site site, Page page, Boolean useSSL)
Return the absolute Uri for the specified site and page as a string.
AbsoluteUrl (Site site, String relativeUrl, Boolean useSSL)
Return the absolute Uri for the specified site and relative url as a string.
Parameters
Name Type
site Nucleus.Abstractions.Models.Site
relativeUrl String
useSSL Boolean
AbsoluteUrl (Site site, Page page, String relativeUrl, Boolean useSSL)
Return the absolute Uri for the specified site and page and relative url as a string.
Parameters
Name Type
site Nucleus.Abstractions.Models.Site
page Nucleus.Abstractions.Models.Page
relativeUrl String
useSSL Boolean
GetCssFilePath (Site site, IFileSystemManager fileSystemManager)
Return the relative path to the site's icon image file.
GetDirectFilePath (Site site, Guid fileId, IFileSystemManager fileSystemManager)
Return a direct file path, if the file system provider supports it.
Remarks
Return a direct link if the file system provider supports it (because it is faster than returning a redirect to Azure Blob Storage). This "skips" the Nucleus permissions check, but the performance difference is > 200ms. This function should only be used for cases where it is ok to skip the permission check, like site logo/css/favicon.

If the file system provider does not support a direct link, a link to the FileController with an encoded file id parameter is returned, with a ~/ prefix. Callers must call IUrlHelper.Content on the result of this function.
GetIconPath (Site site, IFileSystemManager fileSystemManager)
Return the relative path to the site's icon image file.
GetMailClientType (Site site)
Return the site's selected mail client.
Parameters
Name Type
site Nucleus.Abstractions.Models.Site
Returns
The type name of the site's selected mail client, or null if no mail client is selected.
GetSiteTemplateSelections (Site site)
Parameters
Name Type
site Nucleus.Abstractions.Models.Site
HasProperty (Site site, String typeUri)
Returns a value which specifies whether the site's user profile values contains a property with the specified typeUri.
Parameters
Name Type
site Nucleus.Abstractions.Models.Site
typeUri String
SetMailClientType (Site site, String mailClientType)
Set the site's selected mail client.
Parameters
Name Type
site Nucleus.Abstractions.Models.Site
mailClientType String

The .NET type name (class and and assembly) of the mail client.

SetSiteMailTemplates (Site site, SiteTemplateSelections siteTemplateSelections)
ValidateHomeDirectory (Site site, String key)
Validate the site home directory.
Parameters
Name Type
site Nucleus.Abstractions.Models.Site
key String
Remarks
The home directory is validated using using Azure/S3 rules for container names, since that's mostly what the site home directory will be. This prevents some valid folder names for local storage from being used, but the more strict validation will allow users to migrate to Azure/S3 later if required, and still have a valid home directory setting.