Extension manager

The SMExtensionManager class contains a set of useful static functions, which are used to fetch information about extensions, to reference and execute extensions, and more. See the class description for further details.


SMExtensionManager class

Function
Return type
Description
::GetExtensions()
String[]
Get a string array containing the names (folder names) of all extensions
::GetExtensionPath($extension:string)
String
Get path to an extension. This is useful for situations where we want to open or reference a file in the extension folder - ie create a reference to an image: <img src="" . SMExtensionManager::
GetExtensionPath("MyExtension") . "/images/test.png" . "" alt="">
::GetExtensionUrl($extension:string)
String
Get URL to extension. Browsing this URL will execution the extension in the content area of the website. This function is commonly used when creating links for extensions in the navigation menu.
::GetExtensionUrlEncoded($extension:string) String See description for GetExtensionUrl($extension:string). URL is encoded, making it suitable for use in HTML. For instance & is encoded as &amp;
::GetExtensionUrl($extension:string, $templateType:SMTemplateType) String
See description for GetExtensionUrl($extension:string). This function allows for the template type to be changed, so that the link generated, will execute the extension using the given template type. The template type can be either SMTemplateType::$Normal (default) or SMTemplateType::$Basic (used for pop-up windows, which are usually excluding elements such as the menu).
::GetExtensionUrlEncoded($extension:string, $templateType:SMTemplateType) String See description for GetExtensionUrl($extension:string, $templateType:SMTemplateType). URL is encoded, making it suitable for use in HTML. For instance & is encoded as &amp;
::GetExtensionUrl($extension:string, $templateType:SMTemplateType, $execMode:SMExecutionMode) String
See description for GetExtensionUrl($extension:string, $templateType:SMTemplateType). This function allows for the execution mode to be set for the link generated. Available options are SMExecutionMode::$Shared (default) and SMExecutionMode::$Dedicated
::GetExtensionUrlEncoded($extension:string, $templateType:SMTemplateType, $execMode:SMExecutionMode) String See description for GetExtensionUrl($extension:string, $templateType:SMTemplateType, $execMode:SMExecutionMode). URL is encoded, making it suitable for use in HTML. For instance & is encoded as &amp;
::ExtensionExists($extension:string)
Boolean
Gets a value indicating whether the given extension exists or not.
::GetExecutingExtension()
String
Get the name of the extension currently executing as the main extension (which is being rendered in the content area of the website)
::GetDefaultExtension()
String
Get the name of the extension executed by default, if no extension is specified in the URL. By default this is SMPages. The default extension is specified in config.xml.php in the root of the Sitemagic CMS installation.
::ExecuteExtension($extension:string)

This function may be used to execute the extension specified. This will cause a redirect, which restarts the system, and takes the user to the specified extension, which is loaded in the content area of the website. The technique behind is simply a redirect - however, do NOT use a normal redirect instead. The ExecutionExtension makes sure all data is properly committed before redirecting.
::ExecuteExtension($extension:string, $args:SMKeyValueCollection)

See description for ExecuteExtension($extension:string). This function allows for additional arguments to be specified in the URL. Each key/value in the key value collection represents an argument that will be rendered in the url as &key=value.
::GetMetaData($extension:string)
SMKeyValueCollection
Get meta data for the specified extension. The array returned contains the following indexes: Title, Description, Author, Company, Website, Email, Version, Dependencies, Notes.


SMExecutionMode enum

Enum value
Description
Shared
Default executiom mode. Extension allows for all other extensions to go through their life cycle (except for the Render function, which is only invoked on the main extension (which is rendered in the content area of the website)).
Dedicated
Extension executes by it self - no other extension is allowed to execute code.