<?php
/**
* Landofcoder
*
* NOTICE OF LICENSE
*
* This source file is subject to the Landofcoder.com license that is
* available through the world-wide-web at this URL:
* https://landofcoder.com/license-agreement.html
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this extension to newer
* version in the future.
*
* @category Landofcoder
* @package Lofmp_Blog
* @copyright Copyright (c) 2016 Landofcoder (https://landofcoder.com/)
* @license https://landofcoder.com/LICENSE-1.0.html
*/
namespace Lofmp\Blog\Controller\Adminhtml\Import;
use Magento\Backend\App\Action\Context;
class Run extends \Magento\Backend\App\Action
{
/**
* Core registry
*
* @var \Magento\Framework\Registry
*/
protected $_coreRegistry = null;
/**
* @var \Magento\Framework\View\Result\PageFactory
*/
protected $resultPageFactory;
/**
* @param Context
* @param \Magento\Framework\View\Result\PageFactory
* @param \Magento\Framework\Registry
*/
public function __construct(
Context $context,
\Magento\Framework\View\Result\PageFactory $resultPageFactory,
\Lofmp\Blog\Model\Import\Wordpress $wordpress,
\Magento\Framework\Registry $registry
) {
$this->_wordpress = $wordpress;
$this->resultPageFactory = $resultPageFactory;
$this->_coreRegistry = $registry;
parent::__construct($context);
}
/**
* Check the permission to run it
*
* @return bool
*/
protected function _isAllowed()
{
return $this->_authorization->isAllowed('Lofmp_Blog::import');
}
public function execute()
{
$resultRedirect = $this->resultRedirectFactory->create();
$data = $this->getRequest()->getPostValue();
$this->_wordpress->setData($data)->execute();
return $resultRedirect->setPath('*/*/index');
}
} |