| // +--------------------------------------------------------------------+ // // $Id$ // // +X2C includes require_once 'BIFE/Container.php'; // ~X2C // +X2C Class 110 :Link /** * Link to another page. * * @package BIFE * @access public */ class BIFE_Link extends BIFE_Container { // ~X2C // +X2C Operation 111 /** * Constructor. * * @param array $attrs Attributes. * * @return void * @access public */ function BIFE_Link($attrs) // ~X2C { $this->__construct($attrs); } // -X2C // +X2C Operation 112 /** * Constructor. * * @param array $attrs Attributes. * * @return void * @access public */ function __construct($attrs) // ~X2C { $link_attrs['URL'] = $this->getURL($attrs); $link_attrs['DESC'] = @$attrs['DESC']; $link_attrs['TARGET'] = @$attrs['TARGET']; parent::__construct($link_attrs); } // -X2C // +X2C Operation 142 /** * Gets a URL string based on Link attributes. * * @param array $attrs Link attributes. * * @return string * @access public */ function getURL($attrs) // ~X2C { $url = @$attrs['URL']; unset($attrs['URL']); $query = array(); foreach($attrs as $name => $value) { if (substr($name, 0, 5) === 'DATA-') { if ($name = substr($name, 5)) { $query[] = urlencode($name) . '=' . urlencode($value); } } } if ($query) { $url .= '?' . join('&', $query); } return $url; } // -X2C // +X2C Operation 160 /** * Gets the relative path of the current BIFE file for web (URL) usage. * * @return string * @access public */ function getWebPath() // ~X2C { return (@$_SERVER['PATH_INFO']) ? '../' : './'; } // -X2C // +X2C Operation 161 /** * Gets the relative path of the current BIFE file for filesystem usage. * * @return string * @access public */ function getFsPath() // ~X2C { return dirname('.' . @$_SERVER['PATH_INFO']) . '/'; } // -X2C // +X2C Operation 157 /** * Renders the widget. * * @param HTML_Template_HIT &$template Template to use to render the widget. * * @return string * @access public */ function render(&$template) // ~X2C { $this->attrs['CONTENTS'] = $this->renderContents($template); return $template->parse('bife_link', $this->attrs, '', ''); } // -X2C } // -X2C Class :Link ?>