Framework
This Class will be auto-loaded as the singleton “Core” for the entire application and it’s objective is to provide support for the main features of this framework: MVC, URL-Rewriting, Cache System and XSLT.
Notes
About
Summary
|
|
This Class will be auto-loaded as the singleton “Core” for the entire application and it’s objective is to provide support for the main features of this framework: MVC, URL-Rewriting, Cache System and XSLT.
|
|
|
|
|
|
Initialize the application configuration, setup the (string)controller, (string)action and the (string[])argv sessions which will be used to run the MVC architecture.
|
|
|
Process the controller if it exists.
|
|
|
Compute the requested view with the current data and return it’s source to be used inside the current process.
|
|
|
If no error exists, send the Output.value string to user.
|
|
|
Informs the request page cache index
|
|
|
A shuttle is needed to carry the user Session(“this”) information to the server Session(“this”) in order to the view be a document and not a variable.
|
|
|
Unload a POST string into a scripting dictionary.
|
|
|
For some reason, Microsoft did not include a URL decode function with Active Server Pages.
|
|
|
Just like with the urlDecode function described previously, Microsoft, in it’s infinite wisdom decided not to include an htmlDecode function with their Server component.
|
|
|
Checks if the file exists in the file system.
|
|
|
If the file exists, read it all and return the content.
|
|
|
Create || Overwrite a file in the file system.
|
|
|
Creates a friendly relative link to be used as an URL-Rewrite hyperlink reference.
|
|
|
Creates a XML Document from a string with it’s source code.
|
|
|
Creates a string array with the text of all nodes that match with the XPath.
|
|
|
Applies the xslt transformation AS IT IS, in other words it relies only in the built-in parser to do exactly what your transformation requested.
|
|
|
Since MSXML are very conservative about how much whitespace they put into serialized XSLT results when xsl:output indent=”yes”, we are properly indenting XML, without relying on the processor’s built-in indenting capability.
|
|
|
replaces { chr(60) , chr(62) } with their xhtml respectives.
|
|
|
Adds an error to the errors queue.
|
|
|
Informs if the the (Session)errv queue is empty or not.
|
initialize
Initialize the application configuration, setup the (string)controller, (string)action and the (string[])argv sessions which will be used to run the MVC architecture.
process
Process the controller if it exists.
computeView
|
public function computeView()
|
Compute the requested view with the current data and return it’s source to be used inside the current process.
dispatch
If no error exists, send the Output.value string to user. Otherwise, display the errors.
cacheIndex
|
public function cacheIndex(
|
sController,
|
|
sAction
|
)
|
|
Informs the request page cache index
Parameters
|
(string)sController
|
Controller name
|
|
(string)sAction
|
Action name
|
Returns
|
(integer)
|
(-1) if it’s not in the cache array, array index otherwise
|
See also
<config.xml>
loadShuttle
|
public function loadShuttle(
|
Sd
|
)
|
|
A shuttle is needed to carry the user Session(“this”) information to the server Session(“this”) in order to the view be a document and not a variable. This function loads everything in Session(“this”) into a POST string.
Parameters
|
(scripting dictionary)Sd
|
The dictionary to be encoded
|
Returns
|
(string)
|
Private representation of the dictionary
|
unloadShuttle
|
public function unloadShuttle(
|
s
|
)
|
|
Unload a POST string into a scripting dictionary.
Parameters
|
(string)s
|
Private representation to be decoded
|
Returns
|
(scripting dictionary)
|
The dictionary built with the input string
|
urlDecode
|
public function urlDecode(
|
sEncoded
|
)
|
|
For some reason, Microsoft did not include a URL decode function with Active Server Pages. Most likely, this was because the decoding of querystring variables is done automatically for you when you access the querystring object. For us, it’s vital to load and unload data in the shuttle.
Parameters
|
(string)sEncoded
|
The string to be decoded
|
Returns
|
(string)
|
URL decoded string
|
See also
htmlDecode
htmlDecode
|
function htmlDecode(
|
sEncoded
|
)
|
|
Just like with the urlDecode function described previously, Microsoft, in it’s infinite wisdom decided not to include an htmlDecode function with their Server component.
Parameters
|
(string)sEncoded
|
The string to be decoded
|
Returns
|
(string)
|
HTML decoded string
|
See also
urlDecode
fileExists
|
public function fileExists(
|
sFilePath
|
)
|
|
Checks if the file exists in the file system.
Parameters
|
(string)sFilePath
|
Full path plus file name with extension
|
Returns
|
true
|
if it’s there
|
|
false
|
otherwise
|
loadTextFile
|
public function loadTextFile(
|
sFilePath
|
)
|
|
If the file exists, read it all and return the content.
Parameters
|
(string)sFilePath
|
Full path plus file name with extension
|
Returns
|
(string)
|
The file content
|
createFile
|
public sub createFile(
|
sFilePath,
|
|
sContent
|
)
|
|
Create || Overwrite a file in the file system.
Parameters
|
(string)sFilePath
|
Full path plus file name with extension
|
|
(string)sContent
|
File content
|
createLink
|
public function createLink(
|
sController,
|
|
sAction
|
)
|
|
Creates a friendly relative link to be used as an URL-Rewrite hyperlink reference.
Parameters
|
(string)sController
|
Controller name
|
|
(string)sAction
|
Action name
|
Returns
|
(string)
|
Reference to be used in action or href
|
str2xml
|
public function str2xml(
|
sXml
|
)
|
|
Creates a XML Document from a string with it’s source code.
Parameters
|
(string)sXml
|
The XML source code
|
Returns
getXmlNodeValues
|
public function getXmlNodeValues(
|
Xml,
|
|
sXPath
|
)
|
|
Creates a string array with the text of all nodes that match with the XPath.
Parameters
|
(xml object)Xml
|
The XML
|
|
(string)sXPath
|
The XPath
|
Returns
|
(string[])
|
An array with the XPath Node.text values
|
strictTransform
|
public function strictTransform(
|
Xml,
|
|
Xslt
|
)
|
|
Applies the xslt transformation AS IT IS, in other words it relies only in the built-in parser to do exactly what your transformation requested.
Parameters
|
(xml object)Xml
|
The dataset
|
|
(xml object)Xslt
|
The transformation
|
Returns
|
(string)
|
The evaluated transformation
|
See also
indentedTransform
indentedTransform
|
public function indentedTransform(
|
Xml,
|
|
Xslt,
|
|
sOutput,
|
|
sIndent
|
)
|
|
Since MSXML are very conservative about how much whitespace they put into serialized XSLT results when xsl:output indent=”yes”, we are properly indenting XML, without relying on the processor’s built-in indenting capability. This is useful if you are trying to print nicely indented outputs.
Parameters
|
(xml object)Xml
|
The dataset
|
|
(xml object)Xslt
|
The transformation
|
|
(string)sOutput
|
The xsl:output directive
|
|
(string)sIndent
|
The string which will be used as indentation
|
Returns
|
(string)
|
The evaluated nicely indented transformation
|
See also
strictTransform
Notes
This XSLT is strongly based on Mike J. Brown mi.nosp@m.ke@skew.nosp@m..org ReIndent work: http://skew.org- /xml- /stylesheets- /reindent- /reindent.xsl
printerFriendlyCode
|
public function printerFriendlyCode(
|
sCode
|
)
|
|
replaces { chr(60) , chr(62) } with their xhtml respectives.
Parameters
|
(string)sCode
|
The code to be encoded
|
Returns
addError
|
public sub addError(
|
sError
|
)
|
|
Adds an error to the errors queue.
Parameters
|
(string)sError
|
The error description
|
See also
hasErrors
hasErrors
|
public function hasErrors(
|
saErrors
|
)
|
|
Informs if the the (Session)errv queue is empty or not.
Parameters
|
(string[])saErrors
|
The Errors array
|
Returns
|
true
|
if it’s not empty
|
|
false
|
otherwise
|
See also
addError
|