![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/magento/module-backend/Controller/Adminhtml/Ajax/ |
<?php /** * * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Backend\Controller\Adminhtml\Ajax; use Magento\Framework\App\Action\HttpPostActionInterface; use Magento\Backend\App\Action; class Translate extends \Magento\Backend\App\Action implements HttpPostActionInterface { /** * @var \Magento\Framework\Translate\Inline\ParserInterface */ protected $inlineParser; /** * @var \Magento\Framework\Controller\Result\JsonFactory */ protected $resultJsonFactory; /** * Authorization level of a basic admin session */ public const ADMIN_RESOURCE = 'Magento_Backend::content_translation'; /** * @param Action\Context $context * @param \Magento\Framework\Translate\Inline\ParserInterface $inlineParser * @param \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory */ public function __construct( Action\Context $context, \Magento\Framework\Translate\Inline\ParserInterface $inlineParser, \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory ) { parent::__construct($context); $this->resultJsonFactory = $resultJsonFactory; $this->inlineParser = $inlineParser; } /** * Ajax action for inline translation * * @return \Magento\Framework\Controller\Result\Json */ public function execute() { $translate = (array)$this->getRequest()->getPost('translate'); /** @var \Magento\Framework\Controller\Result\Json $resultJson */ $resultJson = $this->resultJsonFactory->create(); try { $response = $this->inlineParser->processAjaxPost($translate); } catch (\Exception $e) { $response = ['error' => 'true', 'message' => $e->getMessage()]; } $this->_actionFlag->set('', self::FLAG_NO_POST_DISPATCH, true); return $resultJson->setData($response); } }