Texy\Texy::setOutputMode PHP Method

setOutputMode() public method

Set HTML/XHTML output mode (overwrites self::$allowedTags)
public setOutputMode ( $mode ) : void
return void
    public function setOutputMode($mode)
    {
        if (!in_array($mode, [self::HTML4_TRANSITIONAL, self::HTML4_STRICT, self::HTML5, self::XHTML1_TRANSITIONAL, self::XHTML1_STRICT, self::XHTML5], TRUE)) {
            throw new \InvalidArgumentException('Invalid mode.');
        }
        if (!isset(self::$dtdCache[$mode])) {
            self::$dtdCache[$mode] = (require __DIR__ . '/DTD.php');
        }
        $this->mode = $mode;
        $this->dtd = self::$dtdCache[$mode];
        HtmlElement::$xhtml = (bool) ($mode & self::XML);
        // TODO: remove?
        // accept all valid HTML tags and attributes by default
        $this->allowedTags = [];
        foreach ($this->dtd as $tag => $dtd) {
            $this->allowedTags[$tag] = self::ALL;
        }
    }

Usage Example

示例#1
0
 public function beforeRender()
 {
     //nastaveni spravne cesty k obrazkum pro Texy
     $this->texy->imageModule->root = $this->template->basePath . '/images/';
     $this->texy->setOutputMode(\Texy\Texy::HTML5);
     $this->texy->figureModule->leftClass = 'pull-left';
     $this->texy->figureModule->rightClass = 'pull-right';
     $this->texy->imageModule->leftClass = 'pull-left';
     $this->texy->imageModule->rightClass = 'pull-right';
     $this->template->today = new \Nette\Utils\DateTime();
 }
All Usage Examples Of Texy\Texy::setOutputMode