-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
513 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
namespace Cloudinary\Cloudinary\Block; | ||
|
||
use Cloudinary\Cloudinary\Helper\MediaLibraryHelper; | ||
use Magento\Framework\View\Element\Template; | ||
|
||
class Scripts extends Template | ||
{ | ||
|
||
protected $_helper; | ||
|
||
public function __construct( | ||
Template\Context $context, | ||
MediaLibraryHelper $mediaHelper, | ||
array $data = [] | ||
) | ||
{ | ||
parent::__construct($context, $data); | ||
$this->_helper = $mediaHelper; | ||
} | ||
|
||
/** | ||
* @return void | ||
*/ | ||
public function getCname() | ||
{ | ||
return $this->_helper->getCname(); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
|
||
namespace Cloudinary\Cloudinary\Controller\Adminhtml\PageBuilder\MediaGallery; | ||
|
||
use Magento\Backend\App\Action; | ||
use Magento\Framework\App\Action\HttpPostActionInterface; | ||
use Magento\Framework\Controller\ResultFactory; | ||
use Psr\Log\LoggerInterface; | ||
use Magento\Framework\Exception\NoSuchEntityException; | ||
|
||
class Upload extends Action implements HttpPostActionInterface | ||
{ | ||
|
||
private const HTTP_OK = 200; | ||
private const HTTP_INTERNAL_ERROR = 500; | ||
private const HTTP_BAD_REQUEST = 400; | ||
|
||
/** | ||
* @var LoggerInterface | ||
*/ | ||
private $logger; | ||
|
||
/** | ||
* @param Action\Context $context | ||
* @param LoggerInterface $logger | ||
*/ | ||
public function __construct( | ||
Action\Context $context, | ||
LoggerInterface $logger | ||
) { | ||
parent::__construct($context); | ||
$this->logger = $logger; | ||
} | ||
|
||
public function execute() | ||
{ | ||
$resultJson = $this->resultFactory->create(ResultFactory::TYPE_JSON); | ||
try{ | ||
$params = $this->getRequest()->getParams(); | ||
|
||
} catch (NoSuchEntityException $e) { | ||
$responseCode = self::HTTP_OK; | ||
$responseContent = []; | ||
} catch (\Exception $e) { | ||
$responseCode = self::HTTP_INTERNAL_ERROR; | ||
$this->logger->critical($e); | ||
$responseContent = [ | ||
'success' => false, | ||
'message' => __('An error occurred on attempt to retrieve asset information.'), | ||
]; | ||
} | ||
|
||
$resultJson->setHttpResponseCode($responseCode); | ||
$resultJson->setData($responseContent); | ||
|
||
return $resultJson; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.