* shaved off the HTML output as well.
*
* @param string $element The element's name, e.g., 'a'
- * @param array $attribs Associative array of attributes, e.g., array(
+ * @param array $attribs Associative array of attributes, e.g., array(
* 'href' => 'http://www.mediawiki.org/' ). See expandAttributes() for
* further documentation.
* @param string $contents The raw HTML contents of the element: *not*
* Identical to rawElement(), but HTML-escapes $contents (like
* Xml::element()).
*
- * @param $element string
- * @param $attribs array
- * @param $contents string
+ * @param string $element
+ * @param array $attribs
+ * @param string $contents
*
* @return string
*/
* Identical to rawElement(), but has no third parameter and omits the end
* tag (and the self-closing '/' in XML mode for empty elements).
*
- * @param $element string
- * @param $attribs array
+ * @param string $element
+ * @param array $attribs
*
* @return string
*/
* to the input array (currently per the HTML 5 draft as of 2009-09-06).
*
* @param string $element Name of the element, e.g., 'a'
- * @param array $attribs Associative array of attributes, e.g., array(
+ * @param array $attribs Associative array of attributes, e.g., array(
* 'href' => 'http://www.mediawiki.org/' ). See expandAttributes() for
* further documentation.
* @return array An array of attributes functionally identical to $attribs
* For instance, it will omit quotation marks if $wgWellFormedXml is false,
* and will treat boolean attributes specially.
*
- * Attributes that should contain space-separated lists (such as 'class') array
+ * Attributes that can contain space-separated lists ('class', 'accesskey' and 'rel') array
* values are allowed as well, which will automagically be normalized
* and converted to a space-separated string. In addition to a numerical
* array, the attribute value may also be an associative array. See the
* A value of false means to omit the attribute. For boolean attributes,
* you can omit the key, e.g., array( 'checked' ) instead of
* array( 'checked' => 'checked' ) or such.
+ *
+ * @throws MWException If an attribute that doesn't allow lists is set to an array
* @return string HTML fragment that goes between element name and '>'
* (starting with a space if at least one attribute is output)
*/
// Remove duplicates and create the string
$value = implode( ' ', array_unique( $value ) );
+ } elseif ( is_array( $value ) ) {
+ throw new MWException( "HTML attribute $key can not contain a list of values" );
}
// See the "Attributes" section in the HTML syntax part of HTML5,
* Output a "<script>" tag linking to the given URL, e.g.,
* "<script src=foo.js></script>".
*
- * @param $url string
+ * @param string $url
* @return string Raw HTML
*/
public static function linkedScript( $url ) {
* contains literal "</style>" (admittedly unlikely).
*
* @param string $contents CSS
- * @param $media mixed A media type string, like 'screen'
+ * @param string $media A media type string, like 'screen'
* @return string Raw HTML
*/
public static function inlineStyle( $contents, $media = 'all' ) {
* Output a "<link rel=stylesheet>" linking to the given URL for the given
* media type (if any).
*
- * @param $url string
- * @param $media mixed A media type string, like 'screen'
+ * @param string $url
+ * @param string $media A media type string, like 'screen'
* @return string Raw HTML
*/
public static function linkedStyle( $url, $media = 'all' ) {
* Convenience function to produce an "<input>" element. This supports the
* new HTML5 input types and attributes.
*
- * @param $name string name attribute
- * @param $value mixed value attribute
- * @param $type string type attribute
- * @param array $attribs Associative array of miscellaneous extra
+ * @param string $name Name attribute
+ * @param array $value Value attribute
+ * @param string $type Type attribute
+ * @param array $attribs Associative array of miscellaneous extra
* attributes, passed to Html::element()
* @return string Raw HTML
*/
/**
* Convenience function to produce an input element with type=hidden
*
- * @param $name string name attribute
- * @param $value string value attribute
- * @param array $attribs Associative array of miscellaneous extra
+ * @param string $name Name attribute
+ * @param string $value Value attribute
+ * @param array $attribs Associative array of miscellaneous extra
* attributes, passed to Html::element()
* @return string Raw HTML
*/
* This supports leaving out the cols= and rows= which Xml requires and are
* required by HTML4/XHTML but not required by HTML5.
*
- * @param $name string name attribute
- * @param $value string value attribute
- * @param array $attribs Associative array of miscellaneous extra
+ * @param string $name Name attribute
+ * @param string $value Value attribute
+ * @param array $attribs Associative array of miscellaneous extra
* attributes, passed to Html::element()
* @return string Raw HTML
*/
}
return self::element( 'textarea', $attribs, $spacedValue );
}
+
/**
* Build a drop-down box for selecting a namespace
*
- * @param $params array:
+ * @param array $params Params to set.
* - selected: [optional] Id of namespace which should be pre-selected
- * - all: [optional] Value of item for "all namespaces". If null or unset, no "<option>" is generated to select all namespaces
- * - label: text for label to add before the field
- * - exclude: [optional] Array of namespace ids to exclude
- * - disable: [optional] Array of namespace ids for which the option should be disabled in the selector
+ * - all: [optional] Value of item for "all namespaces". If null or unset,
+ * no "<option>" is generated to select all namespaces.
+ * - label: text for label to add before the field.
+ * - exclude: [optional] Array of namespace ids to exclude.
+ * - disable: [optional] Array of namespace ids for which the option should
+ * be disabled in the selector.
* @param array $selectAttribs HTML attributes for the generated select element.
- * - id: [optional], default: 'namespace'
- * - name: [optional], default: 'namespace'
+ * - id: [optional], default: 'namespace'.
+ * - name: [optional], default: 'namespace'.
* @return string HTML code to select a namespace.
*/
- public static function namespaceSelector( array $params = array(), array $selectAttribs = array() ) {
+ public static function namespaceSelector( array $params = array(),
+ array $selectAttribs = array()
+ ) {
global $wgContLang;
ksort( $selectAttribs );
* Constructs the opening html-tag with necessary doctypes depending on
* global variables.
*
- * @param array $attribs Associative array of miscellaneous extra
+ * @param array $attribs Associative array of miscellaneous extra
* attributes, passed to Html::element() of html tag.
- * @return string Raw HTML
+ * @return string Raw HTML
*/
public static function htmlHeader( $attribs = array() ) {
$ret = '';
/**
* Determines if the given mime type is xml.
*
- * @param $mimetype string MimeType
- * @return Boolean
+ * @param string $mimetype MimeType
+ * @return bool
*/
public static function isXmlMimeType( $mimetype ) {
# http://www.whatwg.org/html/infrastructure.html#xml-mime-type
/**
* Get HTML for an info box with an icon.
*
- * @param string $text wikitext, get this with wfMessage()->plain()
- * @param string $icon icon name, file in skins/common/images
- * @param string $alt alternate text for the icon
- * @param string $class additional class name to add to the wrapper div
- * @param $useStylePath
+ * @param string $text Wikitext, get this with wfMessage()->plain()
+ * @param string $icon Icon name, file in skins/common/images
+ * @param string $alt Alternate text for the icon
+ * @param string $class Additional class name to add to the wrapper div
+ * @param bool $useStylePath
*
* @return string
*/