Methods summary
final public
QHtml
|
#
__construct( )
This faux constructor method throws a caller exception.
The Css object should never be instantiated, and this constructor
override simply guarantees it.
This faux constructor method throws a caller exception.
The Css object should never be instantiated, and this constructor
override simply guarantees it.
Returns
Throws
|
public static
string
|
#
RenderTag( string $strTag, null|mixed $mixAttributes, null|string $strInnerHtml = null, boolean $blnIsVoidElement = false, boolean $blnNoSpace = false )
Renders an html tag with the given attributes and inner html.
Renders an html tag with the given attributes and inner html.
If the innerHtml is detected as being wrapped in an html tag of some sort, it will attempt to format the code so that
it has a structured view in a browser, with the inner html indented and on a new line in between the tags. You
can turn this off by setting MINIMIZE, or by passing in true to $blnNoSpace.
There area a few special cases to consider:
- Void elements will not be formatted to avoid adding unnecessary white space since these are generally inline elements
- Non-void elements always use internal newlines, even in MINIMIZE mode. This is to prevent different behavior from appearing in MINIMIZE mode on inline elements, because inline elements with internal space will render with space to separate from surrounding elements. Usually, this is not an issue, but in the special situations where you really need inline elements to be right up against its siblings, set $blnNoSpace to true.
Parameters
- $strTag
- The tag name
- $mixAttributes
- String of attribute values or array of attribute values.
- $strInnerHtml
- The html to print between the opening and closing tags. This will NOT be escaped.
- $blnIsVoidElement
- True to print as a tag with no closing tag.
- $blnNoSpace
- Renders with no white-space. Useful in special inline situations.
Returns
string The rendered html tag
|
public static
string
|
#
RenderLabeledInput( $strLabel, $blnTextLeft, $strAttributes, $strLabelAttributes, $blnWrapped )
Renders an input element with a label tag. Uses separate styling for the label and the input object.
In particular, this gives you the option of wrapping the input with a label (which is what Bootstrap
expects on checkboxes) or putting the label next to the object (which is what jQueryUI expects).
Renders an input element with a label tag. Uses separate styling for the label and the input object.
In particular, this gives you the option of wrapping the input with a label (which is what Bootstrap
expects on checkboxes) or putting the label next to the object (which is what jQueryUI expects).
Note that if you are not setting $blnWrapped, it is up to you to insert the "for" attribute into
the label attributes.
Parameters
- $strLabel
- $blnTextLeft
- $strAttributes
- $strLabelAttributes
- $blnWrapped
Returns
string
|
final public static
string
|
#
FormatLength( string $strValue )
Returns the formatted value of type .
See http://www.w3.org/TR/CSS1/#units for more info.
Returns the formatted value of type .
See http://www.w3.org/TR/CSS1/#units for more info.
Parameters
- $strValue
- The number or string to be formatted to the compatible value.
Returns
string the formatted value of type .
|
public static
boolean
|
#
SetLength( string & $strOldLength, string $newLength )
Sets the given length string to the new length value.
If the new length is preceded by a math operator (+-/*), then arithmetic is performed on the previous
value. Returns true if the length changed.
Sets the given length string to the new length value.
If the new length is preceded by a math operator (+-/*), then arithmetic is performed on the previous
value. Returns true if the length changed.
Parameters
Returns
boolean true if the length was changed
|
public static
boolean
|
#
AddClass( string & $strClassList, string $strNewClasses )
Helper to add a class or classes to a pre-existing space-separated list of classes. Checks to make sure the
class isn't already in the list. Returns true to indicate a change in the list.
Helper to add a class or classes to a pre-existing space-separated list of classes. Checks to make sure the
class isn't already in the list. Returns true to indicate a change in the list.
Parameters
- $strClassList
- Current list of classes separated by a space
- $strNewClasses
- New class to add. Could be a list separated by spaces.
Returns
boolean true if the class list was changed.
|
public static
boolean
|
#
RemoveClass( string & $strClassList, string $strCssNamesToRemove )
Helper to remove a class or classes from a list of space-separated classes.
Helper to remove a class or classes from a list of space-separated classes.
Parameters
- $strClassList
- class list string to search
- $strCssNamesToRemove
- space separated list of names to remove
Returns
boolean true if the class list was changed
|
public static
boolean
|
#
RemoveClassesByPrefix( & $strClassList, $strPrefix )
Many CSS frameworks use families of classes, which are built up from a base family name. For example,
Bootstrap uses 'col-lg-6' to represent a column that is 6 units wide on large screens and Foundation
uses 'large-6' to do the same thing. This utility removes classes that start with a particular prefix
to remove whatever sizing class was specified.
Many CSS frameworks use families of classes, which are built up from a base family name. For example,
Bootstrap uses 'col-lg-6' to represent a column that is 6 units wide on large screens and Foundation
uses 'large-6' to do the same thing. This utility removes classes that start with a particular prefix
to remove whatever sizing class was specified.
Parameters
Returns
boolean true if the class list changed
|
public static
string
|
#
RenderHtmlAttributes( array|null $attributes )
Render the given attribute array for html output. Escapes html entities enclosed in values. Uses
double-quotes to surround the value. Precedes the resulting text with a space character.
Render the given attribute array for html output. Escapes html entities enclosed in values. Uses
double-quotes to surround the value. Precedes the resulting text with a space character.
Parameters
Returns
string
|
public static
string
|
#
RenderStyles( array $styles )
Render the given array as a css style string. It will NOT be escaped.
Render the given array as a css style string. It will NOT be escaped.
Parameters
- $styles
- key/value array representing the styles.
Returns
string a string suitable for including in a css 'style' property
|
public static
string
|
#
MakeUrl( string $strLocation, array|null $queryParams = null, string|null $strAnchor = null, string|null $strProtocol = null, string|null $strServer = null, string|null $strUser = null, string|null $strPassword = null, string|null $intPort = null )
Generate a URL from components. This URL can be used in the QApplication::Redirect function, or applied to
an anchor tag by setting the href attribute.
Generate a URL from components. This URL can be used in the QApplication::Redirect function, or applied to
an anchor tag by setting the href attribute.
Parameters
- $strLocation
- absolute or relative path to resource, depending on your protocol. If not needed, enter an empty string.
- $queryParams
- key->value array of query parameters to add to the location.
- $strAnchor
- anchor to add to the url
- $strProtocol
- protocol if specifying a resource outside of the current server
- $strServer
- server that the resource is on. Required if specifying a protocol.
- $strUser
- user name if needed. Some protocols like mailto and ftp need this
- $strPassword
- password if needed. Note that password is sent in the clear.
- $intPort
- port if different from default
Returns
string
|
public static
string
|
#
MailToUrl( $strUser, $strServer, null $queryParams = null )
Returns a MailTo url.
Parameters
- $strUser
- $strServer
- $queryParams
Returns
string
|
public static
|
#
RenderLink( string $strUrl, string $strText, array $attributes = null, boolean $blnHtmlEntities = true )
Utility function to create a link, i.e. an "a" tag.
Utility function to create a link, i.e. an "a" tag.
Parameters
- $strUrl
- URL to link to. Use MakeUrl or MailToUrl to create the URL.
- $strText
- The inner text. This WILL be escaped.
- $attributes
- Other html attributes to include in the tag
- $blnHtmlEntities
- False to prevent encoding
|
public static
|
#
RenderString( $strText )
Renders a PHP string as HTML text. Makes sure special characters are encoded, and tags are substituted
for newlines.
Renders a PHP string as HTML text. Makes sure special characters are encoded, and tags are substituted
for newlines.
Parameters
|