/** * If the target attribute is specified and no onclick attribute is specified the target is removed and * a compatible javascript onclick attribute is created. * * @param array $attribs From this array, each key-value pair is * converted to an attribute name and value. * * @return string The XHTML for the attributes. */ protected function _htmlAttribs($attribs) { if (isset($attribs['target']) && !isset($attribs['onclick'])) { // Assumption that is not tested, but when clicking on a target link, no further bubble is needed. $attribs['onclick'] = "event.cancelBubble = true;"; } return parent::_htmlAttribs($attribs); }
/** * Converts an associative array to a string of tag attributes. * * @access public * * @param array $attribs From this array, each key-value pair is * converted to an attribute name and value. * * @return string The XHTML for the attributes. */ protected function _htmlAttribs($attribs) { if (isset($attribs['src'])) { $filename = \MUtil_Lazy::rise($attribs['src']); if ($dir = self::getImageDir($filename)) { if (!isset($attribs['width'], $attribs['height'])) { try { $info = getimagesize(self::getWebRoot() . $dir . $filename); if (!isset($attribs['width'])) { $attribs['width'] = $info[0]; } if (!isset($attribs['height'])) { $attribs['height'] = $info[1]; } } catch (\Exception $e) { if (\MUtil_Html::$verbose) { \MUtil_Echo::r($e, __CLASS__ . '->' . __FUNCTION__); } } } $attribs['src'] = $this->view->baseUrl() . $dir . $filename; } // \MUtil_Echo::r($attribs['src']); } return parent::_htmlAttribs($attribs); }