* @copyright 2004 by http://wombat.exit0.net * @package wombatSite * @subpackage contentFetcher */ /** * content fetcher: Link * * @version 1.0.0 * @package wombatSite * @subpackage contentFetcher */ class wbContentFetcher_Link { /** * fetch content * * Parameter: * -protocol * -url (/ are replaced with |) * -title * * @access public * @param string $param parameter * @return boolean $result true on success */ function fetchHtml( $param ) { list( $protocol, $url, $title ) = explode( '/', $param ); $url = str_replace( '|', '/', $url ); $format = '%s'; $target = ''; $titleAtt = $title; switch( $protocol ) { case 'page'; $titleAtt = sprintf( _( 'Jump to page "%s"' ), $title ); $sess =& wbFactory::singleton( 'patSession' ); $self = $_SERVER['PHP_SELF'] . '?' . $sess->getQueryString(); $url = $self . '&page=' . $url; break; case 'path'; $titleAtt = sprintf( _( 'Jump to page "%s"' ), $title ); $sess =& wbFactory::singleton( 'patSession' ); $self = $_SERVER['PHP_SELF'] . '?' . $sess->getQueryString(); $url = $self . '&path=' . $url; break; case 'wikipedia'; $url = 'http://' . $url; $target = 'target="_blank"'; $titleAtt = sprintf( _( '"%s" at Wikipedia' ), $title ); break; default: $titleAtt = sprintf( _( 'Visit "%s"' ), $url ); $url = $protocol . '://' . $url; $target = 'target="_blank"'; break; } $html = sprintf( $format, $url, $target, $titleAtt, $title ); return $html; } } ?>