当前位置: 首页>>代码示例>>PHP>>正文


PHP Settings::isOutputEscapingEnabled方法代码示例

本文整理汇总了PHP中PhpOffice\PhpWord\Settings::isOutputEscapingEnabled方法的典型用法代码示例。如果您正苦于以下问题:PHP Settings::isOutputEscapingEnabled方法的具体用法?PHP Settings::isOutputEscapingEnabled怎么用?PHP Settings::isOutputEscapingEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PhpOffice\PhpWord\Settings的用法示例。


在下文中一共展示了Settings::isOutputEscapingEnabled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: write

 /**
  * Write link element.
  *
  * @return void
  */
 public function write()
 {
     $xmlWriter = $this->getXmlWriter();
     $element = $this->getElement();
     if (!$element instanceof \PhpOffice\PhpWord\Element\Link) {
         return;
     }
     $rId = $element->getRelationId() + ($element->isInSection() ? 6 : 0);
     $this->startElementP();
     $xmlWriter->startElement('w:hyperlink');
     if ($element->isInternal()) {
         $xmlWriter->writeAttribute('w:anchor', $element->getSource());
     } else {
         $xmlWriter->writeAttribute('r:id', 'rId' . $rId);
     }
     $xmlWriter->writeAttribute('w:history', '1');
     $xmlWriter->startElement('w:r');
     $this->writeFontStyle();
     $xmlWriter->startElement('w:t');
     $xmlWriter->writeAttribute('xml:space', 'preserve');
     if (Settings::isOutputEscapingEnabled()) {
         $xmlWriter->text($element->getText());
     } else {
         $xmlWriter->writeRaw($element->getText());
     }
     $xmlWriter->endElement();
     // w:t
     $xmlWriter->endElement();
     // w:r
     $xmlWriter->endElement();
     // w:hyperlink
     $this->endElementP();
     // w:p
 }
开发者ID:matiasvillanueva,项目名称:laravel5-CRUD-LOGIN,代码行数:39,代码来源:Link.php

示例2: write

 /**
  * Write element
  */
 public function write()
 {
     $xmlWriter = $this->getXmlWriter();
     $element = $this->getElement();
     if (!$element instanceof \PhpOffice\PhpWord\Element\Link) {
         return;
     }
     if (!$this->withoutP) {
         $xmlWriter->startElement('text:p');
         // text:p
     }
     $xmlWriter->startElement('text:a');
     $xmlWriter->writeAttribute('xlink:type', 'simple');
     $xmlWriter->writeAttribute('xlink:href', $element->getSource());
     if (Settings::isOutputEscapingEnabled()) {
         $xmlWriter->text($element->getText());
     } else {
         $xmlWriter->writeRaw($element->getText());
     }
     $xmlWriter->endElement();
     // text:a
     if (!$this->withoutP) {
         $xmlWriter->endElement();
         // text:p
     }
 }
开发者ID:matiasvillanueva,项目名称:laravel5-CRUD-LOGIN,代码行数:29,代码来源:Link.php

示例3: write

 /**
  * Write preserve text element.
  *
  * @return void
  */
 public function write()
 {
     $xmlWriter = $this->getXmlWriter();
     $element = $this->getElement();
     if (!$element instanceof \PhpOffice\PhpWord\Element\PreserveText) {
         return;
     }
     $texts = $element->getText();
     if (!is_array($texts)) {
         $texts = array($texts);
     }
     $this->startElementP();
     foreach ($texts as $text) {
         if (substr($text, 0, 1) == '{') {
             $text = substr($text, 1, -1);
             $xmlWriter->startElement('w:r');
             $xmlWriter->startElement('w:fldChar');
             $xmlWriter->writeAttribute('w:fldCharType', 'begin');
             $xmlWriter->endElement();
             $xmlWriter->endElement();
             $xmlWriter->startElement('w:r');
             $this->writeFontStyle();
             $xmlWriter->startElement('w:instrText');
             $xmlWriter->writeAttribute('xml:space', 'preserve');
             if (Settings::isOutputEscapingEnabled()) {
                 $xmlWriter->text($text);
             } else {
                 $xmlWriter->writeRaw($text);
             }
             $xmlWriter->endElement();
             $xmlWriter->endElement();
             $xmlWriter->startElement('w:r');
             $xmlWriter->startElement('w:fldChar');
             $xmlWriter->writeAttribute('w:fldCharType', 'separate');
             $xmlWriter->endElement();
             $xmlWriter->endElement();
             $xmlWriter->startElement('w:r');
             $xmlWriter->startElement('w:fldChar');
             $xmlWriter->writeAttribute('w:fldCharType', 'end');
             $xmlWriter->endElement();
             $xmlWriter->endElement();
         } else {
             $xmlWriter->startElement('w:r');
             $this->writeFontStyle();
             $xmlWriter->startElement('w:t');
             $xmlWriter->writeAttribute('xml:space', 'preserve');
             if (Settings::isOutputEscapingEnabled()) {
                 $xmlWriter->text($this->getText($text));
             } else {
                 $xmlWriter->writeRaw($this->getText($text));
             }
             $xmlWriter->endElement();
             $xmlWriter->endElement();
         }
     }
     $this->endElementP();
     // w:p
 }
开发者ID:matiasvillanueva,项目名称:laravel5-CRUD-LOGIN,代码行数:63,代码来源:PreserveText.php

示例4: write

 /**
  * Write element
  */
 public function write()
 {
     $xmlWriter = $this->getXmlWriter();
     $element = $this->getElement();
     if (!$element instanceof \PhpOffice\PhpWord\Element\Text) {
         return;
     }
     $fontStyle = $element->getFontStyle();
     $paragraphStyle = $element->getParagraphStyle();
     // @todo Commented for TextRun. Should really checkout this value
     // $fStyleIsObject = ($fontStyle instanceof Font) ? true : false;
     $fStyleIsObject = false;
     if ($fStyleIsObject) {
         // Don't never be the case, because I browse all sections for cleaning all styles not declared
         throw new Exception('PhpWord : $fStyleIsObject wouldn\'t be an object');
     } else {
         if (!$this->withoutP) {
             $xmlWriter->startElement('text:p');
             // text:p
         }
         if (empty($fontStyle)) {
             if (empty($paragraphStyle)) {
                 $xmlWriter->writeAttribute('text:style-name', 'P1');
             } elseif (is_string($paragraphStyle)) {
                 $xmlWriter->writeAttribute('text:style-name', $paragraphStyle);
             }
             if (Settings::isOutputEscapingEnabled()) {
                 $xmlWriter->text($element->getText());
             } else {
                 $xmlWriter->writeRaw($element->getText());
             }
         } else {
             if (empty($paragraphStyle)) {
                 $xmlWriter->writeAttribute('text:style-name', 'Standard');
             } elseif (is_string($paragraphStyle)) {
                 $xmlWriter->writeAttribute('text:style-name', $paragraphStyle);
             }
             // text:span
             $xmlWriter->startElement('text:span');
             if (is_string($fontStyle)) {
                 $xmlWriter->writeAttribute('text:style-name', $fontStyle);
             }
             if (Settings::isOutputEscapingEnabled()) {
                 $xmlWriter->text($element->getText());
             } else {
                 $xmlWriter->writeRaw($element->getText());
             }
             $xmlWriter->endElement();
         }
         if (!$this->withoutP) {
             $xmlWriter->endElement();
             // text:p
         }
     }
 }
开发者ID:matiasvillanueva,项目名称:laravel5-CRUD-LOGIN,代码行数:58,代码来源:Text.php

示例5: write

 /**
  * Write list item
  *
  * @return string
  */
 public function write()
 {
     if (!$this->element instanceof \PhpOffice\PhpWord\Element\ListItem) {
         return '';
     }
     if (Settings::isOutputEscapingEnabled()) {
         $content = '<p>' . $this->escaper->escapeHtml($this->element->getTextObject()->getText()) . '</p>' . PHP_EOL;
     } else {
         $content = '<p>' . $this->element->getTextObject()->getText() . '</p>' . PHP_EOL;
     }
     return $content;
 }
开发者ID:matiasvillanueva,项目名称:laravel5-CRUD-LOGIN,代码行数:17,代码来源:ListItem.php

示例6: write

 /**
  * Write heading
  *
  * @return string
  */
 public function write()
 {
     if (!$this->element instanceof \PhpOffice\PhpWord\Element\Title) {
         return '';
     }
     $tag = 'h' . $this->element->getDepth();
     if (Settings::isOutputEscapingEnabled()) {
         $text = $this->escaper->escapeHtml($this->element->getText());
     } else {
         $text = $this->element->getText();
     }
     $content = "<{$tag}>{$text}</{$tag}>" . PHP_EOL;
     return $content;
 }
开发者ID:matiasvillanueva,项目名称:laravel5-CRUD-LOGIN,代码行数:19,代码来源:Title.php

示例7: write

 /**
  * Write link
  *
  * @return string
  */
 public function write()
 {
     if (!$this->element instanceof \PhpOffice\PhpWord\Element\Link) {
         return '';
     }
     $content = '';
     $content .= $this->writeOpening();
     if (Settings::isOutputEscapingEnabled()) {
         $content .= "<a href=\"{$this->escaper->escapeHtmlAttr($this->element->getSource())}\">{$this->escaper->escapeHtml($this->element->getText())}</a>";
     } else {
         $content .= "<a href=\"{$this->element->getSource()}\">{$this->element->getText()}</a>";
     }
     $content .= $this->writeClosing();
     return $content;
 }
开发者ID:matiasvillanueva,项目名称:laravel5-CRUD-LOGIN,代码行数:20,代码来源:Link.php

示例8: write

 /**
  * Write element
  */
 public function write()
 {
     $xmlWriter = $this->getXmlWriter();
     $element = $this->getElement();
     if (!$element instanceof \PhpOffice\PhpWord\Element\Title) {
         return;
     }
     $xmlWriter->startElement('text:h');
     $xmlWriter->writeAttribute('text:outline-level', $element->getDepth());
     if (Settings::isOutputEscapingEnabled()) {
         $xmlWriter->text($element->getText());
     } else {
         $xmlWriter->writeRaw($element->getText());
     }
     $xmlWriter->endElement();
     // text:h
 }
开发者ID:matiasvillanueva,项目名称:laravel5-CRUD-LOGIN,代码行数:20,代码来源:Title.php

示例9: write

 /**
  * Write part
  *
  * @return string
  */
 public function write()
 {
     $docProps = $this->getParentWriter()->getPhpWord()->getDocInfo();
     $propertiesMapping = array('creator' => 'author', 'title' => '', 'description' => '', 'subject' => '', 'keywords' => '', 'category' => '', 'company' => '', 'manager' => '');
     $title = $docProps->getTitle();
     $title = $title != '' ? $title : 'PHPWord';
     $content = '';
     $content .= '<head>' . PHP_EOL;
     $content .= '<meta charset="UTF-8" />' . PHP_EOL;
     $content .= '<title>' . $title . '</title>' . PHP_EOL;
     foreach ($propertiesMapping as $key => $value) {
         $value = $value == '' ? $key : $value;
         $method = "get" . $key;
         if ($docProps->{$method}() != '') {
             $content .= '<meta name="' . $value . '"' . ' content="' . (Settings::isOutputEscapingEnabled() ? $this->escaper->escapeHtmlAttr($docProps->{$method}()) : $docProps->{$method}()) . '"' . ' />' . PHP_EOL;
         }
     }
     $content .= $this->writeStyles();
     $content .= '</head>' . PHP_EOL;
     return $content;
 }
开发者ID:matiasvillanueva,项目名称:laravel5-CRUD-LOGIN,代码行数:26,代码来源:Head.php

示例10: write

 /**
  * Write title element.
  *
  * @return void
  */
 public function write()
 {
     $xmlWriter = $this->getXmlWriter();
     $element = $this->getElement();
     if (!$element instanceof \PhpOffice\PhpWord\Element\Title) {
         return;
     }
     $style = $element->getStyle();
     $xmlWriter->startElement('w:p');
     if (!empty($style)) {
         $xmlWriter->startElement('w:pPr');
         $xmlWriter->startElement('w:pStyle');
         $xmlWriter->writeAttribute('w:val', $style);
         $xmlWriter->endElement();
         $xmlWriter->endElement();
     }
     $rId = $element->getRelationId();
     $bookmarkRId = $element->getPhpWord()->addBookmark();
     // Bookmark start for TOC
     $xmlWriter->startElement('w:bookmarkStart');
     $xmlWriter->writeAttribute('w:id', $bookmarkRId);
     $xmlWriter->writeAttribute('w:name', "_Toc{$rId}");
     $xmlWriter->endElement();
     // Actual text
     $xmlWriter->startElement('w:r');
     if (Settings::isOutputEscapingEnabled()) {
         $xmlWriter->writeElement('w:t', $this->getText($element->getText()));
     } else {
         $xmlWriter->startElement('w:t');
         $xmlWriter->writeRaw($this->getText($element->getText()));
         $xmlWriter->endElement();
     }
     $xmlWriter->endElement();
     // Bookmark end
     $xmlWriter->startElement('w:bookmarkEnd');
     $xmlWriter->writeAttribute('w:id', $bookmarkRId);
     $xmlWriter->endElement();
     $xmlWriter->endElement();
 }
开发者ID:matiasvillanueva,项目名称:laravel5-CRUD-LOGIN,代码行数:44,代码来源:Title.php

示例11: writeInfo

 /**
  * Write document information
  *
  * @return string
  */
 private function writeInfo()
 {
     $docProps = $this->getParentWriter()->getPhpWord()->getDocInfo();
     $properties = array('title', 'subject', 'category', 'keywords', 'comment', 'author', 'operator', 'creatim', 'revtim', 'company', 'manager');
     $mapping = array('comment' => 'description', 'author' => 'creator', 'operator' => 'lastModifiedBy', 'creatim' => 'created', 'revtim' => 'modified');
     $dateFields = array('creatim', 'revtim');
     $content = '';
     $content .= '{';
     $content .= '\\info';
     foreach ($properties as $property) {
         $method = 'get' . (isset($mapping[$property]) ? $mapping[$property] : $property);
         if (!in_array($property, $dateFields) && Settings::isOutputEscapingEnabled()) {
             $value = $this->escaper->escape($docProps->{$method}());
         } else {
             $value = $docProps->{$method}();
         }
         $value = in_array($property, $dateFields) ? $this->getDateValue($value) : $value;
         $content .= "{\\{$property} {$value}}";
     }
     $content .= '}';
     $content .= PHP_EOL;
     return $content;
 }
开发者ID:matiasvillanueva,项目名称:laravel5-CRUD-LOGIN,代码行数:28,代码来源:Document.php

示例12: write

 /**
  * Write text element.
  *
  * @return void
  */
 public function write()
 {
     $xmlWriter = $this->getXmlWriter();
     $element = $this->getElement();
     if (!$element instanceof \PhpOffice\PhpWord\Element\Text) {
         return;
     }
     $this->startElementP();
     $xmlWriter->startElement('w:r');
     $this->writeFontStyle();
     $xmlWriter->startElement('w:t');
     $xmlWriter->writeAttribute('xml:space', 'preserve');
     if (Settings::isOutputEscapingEnabled()) {
         $xmlWriter->text($this->getText($element->getText()));
     } else {
         $xmlWriter->writeRaw($this->getText($element->getText()));
     }
     $xmlWriter->endElement();
     $xmlWriter->endElement();
     // w:r
     $this->endElementP();
     // w:p
 }
开发者ID:matiasvillanueva,项目名称:laravel5-CRUD-LOGIN,代码行数:28,代码来源:Text.php

示例13: write

 /**
  * Write element.
  *
  * @return void
  */
 public function write()
 {
     $xmlWriter = $this->getXmlWriter();
     $element = $this->getElement();
     if (!$element instanceof FormFieldElement) {
         return;
     }
     $type = $element->getType();
     $instructions = array('textinput' => 'FORMTEXT', 'checkbox' => 'FORMCHECKBOX', 'dropdown' => 'FORMDROPDOWN');
     $instruction = $instructions[$type];
     $writeFormField = "write{$type}";
     $name = $element->getName();
     if ($name === null) {
         $name = $type . $element->getElementId();
     }
     $value = $element->getValue();
     if ($value === null) {
         $value = str_repeat(' ', self::FILLER_LENGTH);
     }
     $this->startElementP();
     $xmlWriter->startElement('w:r');
     $xmlWriter->startElement('w:fldChar');
     $xmlWriter->writeAttribute('w:fldCharType', 'begin');
     $xmlWriter->startElement('w:ffData');
     $xmlWriter->writeElementBlock('w:enabled', 'w:val', 1);
     $xmlWriter->writeElementBlock('w:name', 'w:val', $name);
     $xmlWriter->writeElementBlock('w:calcOnExit', 'w:val', 0);
     $this->{$writeFormField}($xmlWriter, $element);
     $xmlWriter->endElement();
     // w:ffData
     $xmlWriter->endElement();
     // w:fldChar
     $xmlWriter->endElement();
     // w:r
     $xmlWriter->startElement('w:r');
     $this->writeFontStyle();
     $xmlWriter->startElement('w:instrText');
     $xmlWriter->writeAttribute('xml:space', 'preserve');
     $xmlWriter->text("{$instruction}");
     $xmlWriter->endElement();
     // w:instrText
     $xmlWriter->endElement();
     // w:r
     $xmlWriter->startElement('w:r');
     $this->writeFontStyle();
     $xmlWriter->writeElementBlock('w:fldChar', 'w:fldCharType', 'separate');
     $xmlWriter->endElement();
     // w:r
     $xmlWriter->startElement('w:r');
     $this->writeFontStyle();
     $xmlWriter->startElement('w:t');
     $xmlWriter->writeAttribute('xml:space', 'preserve');
     if (Settings::isOutputEscapingEnabled()) {
         $xmlWriter->text($value);
     } else {
         $xmlWriter->writeRaw($value);
     }
     $xmlWriter->endElement();
     // w:t
     $xmlWriter->endElement();
     // w:r
     $xmlWriter->startElement('w:r');
     $this->writeFontStyle();
     $xmlWriter->writeElementBlock('w:fldChar', 'w:fldCharType', 'end');
     $xmlWriter->endElement();
     // w:r
     $this->endElementP();
     // w:p
 }
开发者ID:matiasvillanueva,项目名称:laravel5-CRUD-LOGIN,代码行数:74,代码来源:FormField.php

示例14: writeTitle

 /**
  * Write title
  *
  * @param \PhpOffice\Common\XMLWriter $xmlWriter
  * @param \PhpOffice\PhpWord\Element\TOC $element
  * @param \PhpOffice\PhpWord\Element\Title $title
  * @param bool $writeFieldMark
  * @return void
  */
 private function writeTitle(XMLWriter $xmlWriter, TOCElement $element, $title, $writeFieldMark)
 {
     $tocStyle = $element->getStyleTOC();
     $fontStyle = $element->getStyleFont();
     $isObject = $fontStyle instanceof Font ? true : false;
     $rId = $title->getRelationId();
     $indent = ($title->getDepth() - 1) * $tocStyle->getIndent();
     $xmlWriter->startElement('w:p');
     // Write style and field mark
     $this->writeStyle($xmlWriter, $element, $indent);
     if ($writeFieldMark) {
         $this->writeFieldMark($xmlWriter, $element);
     }
     // Hyperlink
     $xmlWriter->startElement('w:hyperlink');
     $xmlWriter->writeAttribute('w:anchor', "_Toc{$rId}");
     $xmlWriter->writeAttribute('w:history', '1');
     // Title text
     $xmlWriter->startElement('w:r');
     if ($isObject) {
         $styleWriter = new FontStyleWriter($xmlWriter, $fontStyle);
         $styleWriter->write();
     }
     if (Settings::isOutputEscapingEnabled()) {
         $xmlWriter->writeElement('w:t', $title->getText());
     } else {
         $xmlWriter->startElement('w:t');
         $xmlWriter->writeRaw($title->getText());
         $xmlWriter->endElement();
     }
     $xmlWriter->endElement();
     // w:r
     $xmlWriter->startElement('w:r');
     $xmlWriter->writeElement('w:tab', null);
     $xmlWriter->endElement();
     $xmlWriter->startElement('w:r');
     $xmlWriter->startElement('w:fldChar');
     $xmlWriter->writeAttribute('w:fldCharType', 'begin');
     $xmlWriter->endElement();
     $xmlWriter->endElement();
     $xmlWriter->startElement('w:r');
     $xmlWriter->startElement('w:instrText');
     $xmlWriter->writeAttribute('xml:space', 'preserve');
     $xmlWriter->text("PAGEREF _Toc{$rId} \\h");
     $xmlWriter->endElement();
     $xmlWriter->endElement();
     $xmlWriter->startElement('w:r');
     $xmlWriter->startElement('w:fldChar');
     $xmlWriter->writeAttribute('w:fldCharType', 'end');
     $xmlWriter->endElement();
     $xmlWriter->endElement();
     $xmlWriter->endElement();
     // w:hyperlink
     $xmlWriter->endElement();
     // w:p
 }
开发者ID:matiasvillanueva,项目名称:laravel5-CRUD-LOGIN,代码行数:65,代码来源:TOC.php

示例15: write

 /**
  * Write element.
  *
  * @return void
  */
 public function write()
 {
     $xmlWriter = $this->getXmlWriter();
     $element = $this->getElement();
     if (!$element instanceof \PhpOffice\PhpWord\Element\CheckBox) {
         return;
     }
     $this->startElementP();
     $xmlWriter->startElement('w:r');
     $xmlWriter->startElement('w:fldChar');
     $xmlWriter->writeAttribute('w:fldCharType', 'begin');
     $xmlWriter->startElement('w:ffData');
     $xmlWriter->startElement('w:name');
     $xmlWriter->writeAttribute('w:val', $this->getText($element->getName()));
     $xmlWriter->endElement();
     //w:name
     $xmlWriter->writeAttribute('w:enabled', '');
     $xmlWriter->startElement('w:calcOnExit');
     $xmlWriter->writeAttribute('w:val', '0');
     $xmlWriter->endElement();
     //w:calcOnExit
     $xmlWriter->startElement('w:checkBox');
     $xmlWriter->writeAttribute('w:sizeAuto', '');
     $xmlWriter->startElement('w:default');
     $xmlWriter->writeAttribute('w:val', 0);
     $xmlWriter->endElement();
     //w:default
     $xmlWriter->endElement();
     //w:checkBox
     $xmlWriter->endElement();
     // w:ffData
     $xmlWriter->endElement();
     // w:fldChar
     $xmlWriter->endElement();
     // w:r
     $xmlWriter->startElement('w:r');
     $xmlWriter->startElement('w:instrText');
     $xmlWriter->writeAttribute('xml:space', 'preserve');
     $xmlWriter->text(' FORMCHECKBOX ');
     $xmlWriter->endElement();
     // w:instrText
     $xmlWriter->endElement();
     // w:r
     $xmlWriter->startElement('w:r');
     $xmlWriter->startElement('w:fldChar');
     $xmlWriter->writeAttribute('w:fldCharType', 'separate');
     $xmlWriter->endElement();
     // w:fldChar
     $xmlWriter->endElement();
     // w:r
     $xmlWriter->startElement('w:r');
     $xmlWriter->startElement('w:fldChar');
     $xmlWriter->writeAttribute('w:fldCharType', 'end');
     $xmlWriter->endElement();
     // w:fldChar
     $xmlWriter->endElement();
     // w:r
     $xmlWriter->startElement('w:r');
     $this->writeFontStyle();
     $xmlWriter->startElement('w:t');
     $xmlWriter->writeAttribute('xml:space', 'preserve');
     if (Settings::isOutputEscapingEnabled()) {
         $xmlWriter->text($this->getText($element->getText()));
     } else {
         $xmlWriter->writeRaw($this->getText($element->getText()));
     }
     $xmlWriter->endElement();
     // w:t
     $xmlWriter->endElement();
     // w:r
     $this->endElementP();
     // w:p
 }
开发者ID:matiasvillanueva,项目名称:laravel5-CRUD-LOGIN,代码行数:78,代码来源:CheckBox.php


注:本文中的PhpOffice\PhpWord\Settings::isOutputEscapingEnabled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。