X-Git-Url: https://git.llucax.com/mecon/meconlib.git/blobdiff_plain/7bf8c6564e60cc22ab1d2bd0ff46b26e2f26bbd8..eab50f4456ebf26581c97fd799b23edb95a1ac7e:/lib/MECON/HTML/Link.php diff --git a/lib/MECON/HTML/Link.php b/lib/MECON/HTML/Link.php index ae2458b..dc86a68 100644 --- a/lib/MECON/HTML/Link.php +++ b/lib/MECON/HTML/Link.php @@ -107,7 +107,7 @@ class MECON_HTML_Link extends HTML_Common { * @return string * @access public */ - function toHtml() // ~X2C + function toHtml() { $attrs = ''; foreach ($this->getAttributes() as $key => $val) { @@ -116,10 +116,16 @@ class MECON_HTML_Link extends HTML_Common { foreach ($this->_getVars as $var => $v) { if (is_object($v) and method_exists($v, 'tostring')) { $v = $v->tostring(); - } elseif (is_object($v) or is_array($v)) { + } elseif (is_object($v)) { $v = serialize($v); } - $vars[] = urlencode($var) . '=' . urlencode($v); + if (is_array($v)) { + foreach ($v as $i) { + $vars[] = urlencode($var) . '[]=' . urlencode($i); + } + } else { + $vars[] = urlencode($var) . '=' . urlencode($v); + } } if ($vars) { $val .= '?' . join('&', $vars); @@ -138,7 +144,7 @@ class MECON_HTML_Link extends HTML_Common { * @return string * @access public */ - function getHref() // ~X2C + function getHref() { return $this->getAttribute('href'); } @@ -151,7 +157,7 @@ class MECON_HTML_Link extends HTML_Common { * @return void * @access public */ - function setHref($href) // ~X2C + function setHref($href) { $this->updateAttributes(array('href' => $href)); } @@ -165,7 +171,7 @@ class MECON_HTML_Link extends HTML_Common { * @return void * @access public */ - function setGetVar($key, $value) // ~X2C + function setGetVar($key, $value) { $this->_getVars[$key] = $value; } @@ -179,7 +185,7 @@ If they doesn't exists, they are added, if they exists, they are updated. * @return void * @access public */ - function updateGetVars($vars) // ~X2C + function updateGetVars($vars) { $this->_getVars += $vars; } @@ -192,7 +198,7 @@ If they doesn't exists, they are added, if they exists, they are updated. * @return void * @access public */ - function unsetGetVars($key) // ~X2C + function unsetGetVars($key) { $keys = func_get_args(); foreach ($keys as $key) { @@ -208,7 +214,7 @@ If they doesn't exists, they are added, if they exists, they are updated. * @return void * @access public */ - function addContents($contents) // ~X2C + function addContents($contents) { $this->_contents[] = $contents; } @@ -217,7 +223,7 @@ If they doesn't exists, they are added, if they exists, they are updated. * @return string * @access public */ - function getContents() // ~X2C + function getContents() { $html = ''; foreach ($this->_contents as $c) { @@ -236,7 +242,7 @@ If they doesn't exists, they are added, if they exists, they are updated. * @return void * @access public */ - function setContents($contents) // ~X2C + function setContents($contents) { $this->_contents = array($contents); }