示例#1
0
文件: Detail.php 项目: nja78/magento2
 /**
  * Render block html
  *
  * @return string
  */
 protected function _toHtml()
 {
     $this->setTxnIdHtml($this->adminHelper->escapeHtmlWithLinks($this->_txn->getHtmlTxnId(), ['a']));
     $this->setParentTxnIdUrlHtml($this->escapeHtml($this->getUrl('sales/transactions/view', ['txn_id' => $this->_txn->getParentId()])));
     $this->setParentTxnIdHtml($this->escapeHtml($this->_txn->getParentTxnId()));
     $this->setOrderIncrementIdHtml($this->escapeHtml($this->_txn->getOrder()->getIncrementId()));
     $this->setTxnTypeHtml($this->escapeHtml($this->_txn->getTxnType()));
     $this->setOrderIdUrlHtml($this->escapeHtml($this->getUrl('sales/order/view', ['order_id' => $this->_txn->getOrderId()])));
     $this->setIsClosedHtml($this->_txn->getIsClosed() ? __('Yes') : __('No'));
     $createdAt = strtotime($this->_txn->getCreatedAt()) ? $this->formatDate($this->_txn->getCreatedAt(), \IntlDateFormatter::MEDIUM, true) : __('N/A');
     $this->setCreatedAtHtml($this->escapeHtml($createdAt));
     return parent::_toHtml();
 }
示例#2
0
 /**
  * @param string $data
  * @param string $expected
  * @param null|array $allowedTags
  * @dataProvider escapeHtmlWithLinksDataProvider
  */
 public function testEscapeHtmlWithLinks($data, $expected, $allowedTags = null)
 {
     $this->escaperMock
         ->expects($this->any())
         ->method('escapeHtml')
         ->will($this->returnValue($expected));
     $actual = $this->adminHelper->escapeHtmlWithLinks($data, $allowedTags);
     $this->assertEquals($expected, $actual);
 }
示例#3
0
 /**
  * Replace links in string
  *
  * @param array|string $data
  * @param null|array $allowedTags
  * @return string
  */
 public function escapeHtml($data, $allowedTags = null)
 {
     return $this->adminHelper->escapeHtmlWithLinks($data, $allowedTags);
 }
示例#4
0
 /**
  * Status history item comment getter
  *
  * @param array $item
  * @return string
  */
 public function getItemComment(array $item)
 {
     $allowedTags = ['b', 'br', 'strong', 'i', 'u', 'a'];
     return isset($item['comment']) ? $this->adminHelper->escapeHtmlWithLinks($item['comment'], $allowedTags) : '';
 }