/** * 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(); }
/** * @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); }
/** * 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); }
/** * 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) : ''; }