Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php /** * Copyright Magento, Inc. All rights reserved. * See COPYING.txt for license ..
Decoded Output download
<?php
/**
* Copyright Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Backend\Block\Widget\Grid\Column\Renderer;
/**
* Grid column widget for rendering grid cells that contains mapped values
*
* @api
* @deprecated 100.2.0 in favour of UI component implementation
* @since 100.0.2
*/
class Options extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Text
{
/**
* Get options from column
*
* @return array
*/
protected function _getOptions()
{
return $this->getColumn()->getOptions();
}
/**
* Render a grid cell as options
*
* @param \Magento\Framework\DataObject $row
* @return string|void
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function render(\Magento\Framework\DataObject $row)
{
$options = $this->_getOptions();
$showMissingOptionValues = (bool)$this->getColumn()->getShowMissingOptionValues();
if (!empty($options) && is_array($options)) {
//transform option format
$output = [];
foreach ($options as $option) {
$output[$option['value']] = $option['label'];
}
$value = $row->getData($this->getColumn()->getIndex());
if (is_array($value)) {
$res = [];
foreach ($value as $item) {
if (isset($output[$item])) {
$res[] = $this->escapeHtml($output[$item]);
} elseif ($showMissingOptionValues) {
$res[] = $this->escapeHtml($item);
}
}
return implode(', ', $res);
} elseif (isset($output[$value])) {
return $this->escapeHtml($output[$value]);
} elseif (in_array($value, $output)) {
return $this->escapeHtml($value);
}
}
}
}
?>
Did this file decode correctly?
Original Code
<?php
/**
* Copyright Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Backend\Block\Widget\Grid\Column\Renderer;
/**
* Grid column widget for rendering grid cells that contains mapped values
*
* @api
* @deprecated 100.2.0 in favour of UI component implementation
* @since 100.0.2
*/
class Options extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Text
{
/**
* Get options from column
*
* @return array
*/
protected function _getOptions()
{
return $this->getColumn()->getOptions();
}
/**
* Render a grid cell as options
*
* @param \Magento\Framework\DataObject $row
* @return string|void
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function render(\Magento\Framework\DataObject $row)
{
$options = $this->_getOptions();
$showMissingOptionValues = (bool)$this->getColumn()->getShowMissingOptionValues();
if (!empty($options) && is_array($options)) {
//transform option format
$output = [];
foreach ($options as $option) {
$output[$option['value']] = $option['label'];
}
$value = $row->getData($this->getColumn()->getIndex());
if (is_array($value)) {
$res = [];
foreach ($value as $item) {
if (isset($output[$item])) {
$res[] = $this->escapeHtml($output[$item]);
} elseif ($showMissingOptionValues) {
$res[] = $this->escapeHtml($item);
}
}
return implode(', ', $res);
} elseif (isset($output[$value])) {
return $this->escapeHtml($output[$value]);
} elseif (in_array($value, $output)) {
return $this->escapeHtml($value);
}
}
}
}
Function Calls
| None |
Stats
| MD5 | 44f4a9431e47f17a553fb816b5bc25d0 |
| Eval Count | 0 |
| Decode Time | 98 ms |