Beispiel #1
0
 function testToHtml()
 {
     $href = new Href(['/foo/bar', 'foo/bar', 'http://example.org/bar']);
     $html = new HtmlOutputHelper('/base/', []);
     $expected = '<a href="/foo/bar">/foo/bar</a><br />' . '<a href="/base/foo/bar">/base/foo/bar</a><br />' . '<a href="http://example.org/bar">http://example.org/bar</a>';
     $this->assertEquals($expected, $href->toHtml($html));
 }
Beispiel #2
0
 /**
  * Generate html representation for this value.
  *
  * The html output is 100% trusted, and no effort is being made to sanitize
  * it. It's up to the implementor to sanitize user provided values.
  *
  * The output must be in UTF-8.
  *
  * The baseUri parameter is a url to the root of the application, and can
  * be used to construct local links.
  *
  * @param HtmlOutputHelper $html
  * @return string
  */
 function toHtml(HtmlOutputHelper $html)
 {
     switch ($this->type) {
         case self::UNAUTHENTICATED:
             return '<em>unauthenticated</em>';
         case self::AUTHENTICATED:
             return '<em>authenticated</em>';
         case self::HREF:
             return parent::toHtml($html);
         case self::ALL:
             return '<em>all</em>';
     }
 }
Beispiel #3
0
 /**
  * Constructor
  *
  * You must either pass a string for a single href, or an array of hrefs.
  *
  * If auto-prefix is set to false, the hrefs will be treated as absolute
  * and not relative to the servers base uri.
  *
  * @param string|string[] $href
  */
 function __construct($hrefs)
 {
     parent::__construct(array_map(function ($href) {
         return \Sabre\HTTP\encodePath($href);
     }, (array) $hrefs));
 }