Skip to content
Open
9 changes: 2 additions & 7 deletions app/code/Magento/Captcha/Block/Captcha.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,17 @@
* See COPYING.txt for license details.
*/

/**
* Captcha block
*
* @author Magento Core Team <[email protected]>
*/
namespace Magento\Captcha\Block;

/**
* Captcha block
*
* @api
* @since 100.0.2
*/
class Captcha extends \Magento\Framework\View\Element\Template
{
/**
* Captcha data
*
* @var \Magento\Captcha\Helper\Data
*/
protected $_captchaData = null;
Expand Down
2 changes: 0 additions & 2 deletions app/code/Magento/Captcha/Helper/Adminhtml/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

/**
* Captcha helper for adminhtml area
*
* @author Magento Core Team <[email protected]>
*/
namespace Magento\Captcha\Helper\Adminhtml;

Expand Down
4 changes: 0 additions & 4 deletions app/code/Magento/Captcha/Model/Config/Font.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,12 @@

/**
* Captcha image model
*
* @author Magento Core Team <[email protected]>
*/
namespace Magento\Captcha\Model\Config;

class Font implements \Magento\Framework\Option\ArrayInterface
{
/**
* Captcha data
*
* @var \Magento\Captcha\Helper\Data
*/
protected $_captchaData = null;
Expand Down
2 changes: 0 additions & 2 deletions app/code/Magento/Captcha/Model/Config/Form/AbstractForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

/**
* Data source to fill "Forms" field
*
* @author Magento Core Team <[email protected]>
*/
namespace Magento\Captcha\Model\Config\Form;

Expand Down
2 changes: 0 additions & 2 deletions app/code/Magento/Captcha/Model/Config/Form/Backend.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

/**
* Captcha image model
*
* @author Magento Core Team <[email protected]>
*/
namespace Magento\Captcha\Model\Config\Form;

Expand Down
2 changes: 0 additions & 2 deletions app/code/Magento/Captcha/Model/Config/Form/Frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

/**
* Captcha image model
*
* @author Magento Core Team <[email protected]>
*/
namespace Magento\Captcha\Model\Config\Form;

Expand Down
2 changes: 0 additions & 2 deletions app/code/Magento/Captcha/Model/Config/Mode.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

/**
* Captcha image model
*
* @author Magento Core Team <[email protected]>
*/
namespace Magento\Captcha\Model\Config;

Expand Down
8 changes: 2 additions & 6 deletions app/code/Magento/Captcha/Model/ResourceModel/Log.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,20 @@

/**
* Log Attempts resource
*
* @author Magento Core Team <[email protected]>
*/
class Log extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
{
/**
* Remote Address log type
*/
const TYPE_REMOTE_ADDRESS = 1;
public const TYPE_REMOTE_ADDRESS = 1;

/**
* Type User Login Name
*/
const TYPE_LOGIN = 2;
public const TYPE_LOGIN = 2;

/**
* Core Date
*
* @var \Magento\Framework\Stdlib\DateTime\DateTime
*/
protected $_coreDate;
Expand Down
4 changes: 1 addition & 3 deletions app/code/Magento/Cms/Block/Adminhtml/Page/Widget/Chooser.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

/**
* CMS page chooser for Wysiwyg CMS widget
*
* @author Magento Core Team <[email protected]>
*/
class Chooser extends \Magento\Backend\Block\Widget\Grid\Extended
{
Expand Down Expand Up @@ -65,7 +63,7 @@ public function __construct(
protected function _construct()
{
parent::_construct();
//$this->setDefaultSort('name');

$this->setUseAjax(true);
$this->setDefaultFilter(['chooser_is_active' => '1']);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

/**
* New directory block for Wysiwyg Images
*
* @author Magento Core Team <[email protected]>
*/
class Newfolder extends \Magento\Backend\Block\Template
{
Expand Down
34 changes: 13 additions & 21 deletions app/code/Magento/Cms/Block/Widget/Block.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

/**
* Cms Static Block Widget
*
* @author Magento Core Team <[email protected]>
*/
class Block extends \Magento\Framework\View\Element\Template implements BlockInterface, IdentityInterface
{
Expand All @@ -33,8 +31,6 @@ class Block extends \Magento\Framework\View\Element\Template implements BlockInt
protected static $_widgetUsageMap = [];

/**
* Block factory
*
* @var \Magento\Cms\Model\BlockFactory
*/
protected $_blockFactory;
Expand Down Expand Up @@ -77,19 +73,18 @@ protected function _beforeToHtml()
if (isset(self::$_widgetUsageMap[$blockHash])) {
return $this;
}

self::$_widgetUsageMap[$blockHash] = true;

$block = $this->getBlock();

if ($block && $block->isActive()) {
try {
$storeId = $this->getData('store_id') ?? $this->_storeManager->getStore()->getId();
$this->setText(
$this->_filterProvider->getBlockFilter()->setStoreId($storeId)->filter($block->getContent())
);
} catch (NoSuchEntityException $e) {
}
$storeId = $this->getData('store_id') ?? $this->_storeManager->getStore()->getId();
$this->setText(
$this->_filterProvider->getBlockFilter()->setStoreId($storeId)->filter($block->getContent())
);
}

unset(self::$_widgetUsageMap[$blockHash]);
return $this;
}
Expand Down Expand Up @@ -124,16 +119,13 @@ private function getBlock(): ?CmsBlock
$blockId = $this->getData('block_id');

if ($blockId) {
try {
$storeId = $this->_storeManager->getStore()->getId();
/** @var \Magento\Cms\Model\Block $block */
$block = $this->_blockFactory->create();
$block->setStoreId($storeId)->load($blockId);
$this->block = $block;

return $block;
} catch (NoSuchEntityException $e) {
}
$storeId = $this->_storeManager->getStore()->getId();
Copy link

@leonhelmus leonhelmus Mar 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fredden I think this change could have influence on current implementation. Or you are sure that NoSuchEntityException never is thrown? If you are i'll approve it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have restored the existing code here to ensure that this pull request does not inadvertently change behaviour. I initially removed it because the linter detected the empty catch block and complained. I didn't see a good reason at the time to keep the block. I agree that removing it is a behaviour change which is out of scope for this particular pull request. I'll let others fix the code when they are ready to do so. Thanks for highlighting this out-of-scope change.

/** @var \Magento\Cms\Model\Block $block */
$block = $this->_blockFactory->create();
$block->setStoreId($storeId)->load($blockId);
$this->block = $block;

return $block;
}

return null;
Expand Down
6 changes: 1 addition & 5 deletions app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

/**
* Images manage controller for Cms WYSIWYG editor
*
* @author Magento Core Team <[email protected]>
*/
abstract class Images extends \Magento\Backend\App\Action
{
Expand All @@ -17,11 +15,9 @@ abstract class Images extends \Magento\Backend\App\Action
*
* @see _isAllowed()
*/
const ADMIN_RESOURCE = 'Magento_Cms::media_gallery';
public const ADMIN_RESOURCE = 'Magento_Cms::media_gallery';

/**
* Core registry
*
* @var \Magento\Framework\Registry
*/
protected $_coreRegistry = null;
Expand Down