toString() final public method

Renders element's start tag, content and end tag to internal string representation.
final public toString ( Texy $texy ) : string
$texy Texy
return string
Beispiel #1
0
 /**
  * Callback for: [ref].
  * @return Texy\HtmlElement|string|FALSE
  */
 public function patternReference(LineParser $parser, array $matches)
 {
     list(, $mRef) = $matches;
     // [1] => [ref]
     $texy = $this->texy;
     $name = substr($mRef, 1, -1);
     $link = $this->getReference($name);
     if (!$link) {
         return $texy->invokeAroundHandlers('newReference', $parser, [$name]);
     }
     $link->type = $link::BRACKET;
     if ($link->label != '') {
         // NULL or ''
         // prevent circular references
         if (isset(self::$livelock[$link->name])) {
             $content = $link->label;
         } else {
             self::$livelock[$link->name] = TRUE;
             $el = new Texy\HtmlElement();
             $lineParser = new LineParser($texy, $el);
             $lineParser->parse($link->label);
             $content = $el->toString($texy);
             unset(self::$livelock[$link->name]);
         }
     } else {
         $content = $this->textualUrl($link);
         $content = $this->texy->protect($content, $texy::CONTENT_TEXTUAL);
     }
     return $texy->invokeAroundHandlers('linkReference', $parser, [$link, $content]);
 }