Skip to content

Commit 58494e3

Browse files
committed
Code style changes
1 parent 7f1e6c5 commit 58494e3

File tree

21 files changed

+99
-109
lines changed

21 files changed

+99
-109
lines changed

Model/ImageUploader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function moveFileFromTmp($imageName)
7676
$mediaPath = $this->filesystem->getDirectoryRead(DirectoryList::MEDIA)->getAbsolutePath();
7777
$baseImageAbsolutePath = $mediaPath . $baseImagePath;
7878
$i = 1;
79-
while ($baseImageAbsolutePath) {
79+
while (file_exists($baseImageAbsolutePath)) {
8080
$i++;
8181
$p = mb_strrpos($originalImageName, '.');
8282
if (false !== $p) {

Model/Post.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -516,9 +516,7 @@ public function getShortFilteredContent($len = null, $endСharacters = null)
516516
$content = $_content->saveHTML();
517517
}
518518
} catch (\Exception $e) {
519-
$messageManager = \Magento\Framework\App\ObjectManager::getInstance()
520-
->create(\Magento\Framework\Message\ManagerInterface::class);
521-
$messageManager->addError($e->getMessage());
519+
/* Do nothing, it's OK */
522520
}
523521
}
524522

Model/PreviewUrl.php

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,22 @@
1313
*/
1414
class PreviewUrl extends Url
1515
{
16-
17-
// /**
18-
// * Initialize dependencies.
19-
// *
20-
// * @param \Magento\Framework\Registry $registry
21-
// * @param \Magento\Framework\Url $url
22-
// * @param \Magento\Store\Model\StoreManagerInterface $storeManager
23-
// * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
24-
// */
25-
// public function __construct(
26-
// \Magento\Framework\Registry $registry,
27-
// \Magento\Framework\Url $url,
28-
// \Magento\Store\Model\StoreManagerInterface $storeManager,
29-
// \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
30-
// ) {
31-
// parent::__construct($registry, $url, $storeManager, $scopeConfig);
32-
// }
16+
/**
17+
* Initialize dependencies.
18+
*
19+
* @param \Magento\Framework\Registry $registry
20+
* @param \Magento\Framework\Url $url
21+
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
22+
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
23+
*/
24+
public function __construct(
25+
\Magento\Framework\Registry $registry,
26+
\Magento\Framework\Url $url,
27+
\Magento\Store\Model\StoreManagerInterface $storeManager,
28+
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
29+
) {
30+
parent::__construct($registry, $url, $storeManager, $scopeConfig);
31+
}
3332

3433
/**
3534
* Retrieve blog page preview url

Setup/InstallData.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface
6363
try {
6464
$this->state->setAreaCode('adminhtml');
6565
} catch (\Exception $e) {
66-
/* Do nothing */
66+
/* Do nothing, it's OK */
6767
}
6868

6969
$url = $this->scopeConfig

Ui/DataProvider/Comment/Form/CommentDataProvider.php

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,21 @@ class CommentDataProvider extends \Magento\Ui\DataProvider\AbstractDataProvider
3636
protected $url;
3737

3838
/**
39-
* @param string $name
40-
* @param string $primaryFieldName
41-
* @param string $requestFieldName
39+
* @var \Magento\Framework\Escaper
40+
*/
41+
protected $escaper;
42+
43+
/**
44+
* CommentDataProvider constructor.
45+
* @param $name
46+
* @param $primaryFieldName
47+
* @param $requestFieldName
4248
* @param CollectionFactory $commentCollectionFactory
4349
* @param DataPersistorInterface $dataPersistor
4450
* @param \Magento\Framework\UrlInterface $url
4551
* @param array $meta
4652
* @param array $data
53+
* @param \Magento\Framework\Escaper|null $escaper
4754
*/
4855
public function __construct(
4956
$name,
@@ -53,13 +60,18 @@ public function __construct(
5360
DataPersistorInterface $dataPersistor,
5461
\Magento\Framework\UrlInterface $url,
5562
array $meta = [],
56-
array $data = []
63+
array $data = [],
64+
\Magento\Framework\Escaper $escaper = null
5765
) {
5866
$this->collection = $commentCollectionFactory->create();
5967
$this->dataPersistor = $dataPersistor;
6068
parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data);
6169
$this->meta = $this->prepareMeta($this->meta);
6270
$this->url = $url;
71+
72+
$this->escaper = $escaper ?: \Magento\Framework\App\ObjectManager::getInstance()->create(
73+
\Magento\Framework\Escaper::class
74+
);
6375
}
6476

6577
/**
@@ -138,13 +150,10 @@ public function getData()
138150
$text = (mb_strlen($parentComment->getText()) > 200) ?
139151
(mb_substr($parentComment->getText(), 0, 200) . '...') :
140152
$parentComment->getText();
141-
$escaper = \Magento\Framework\App\ObjectManager::getInstance()->create(
142-
\Magento\Framework\Escaper::class
143-
);
144-
$text = $escaper->escapeHtml($text);
153+
$text = $this->escaper->escapeHtml($text);
145154
$this->loadedData[$comment->getId()]['parent_url'] = [
146155
'url' => $this->url->getUrl('blog/comment/edit', ['id' => $parentComment->getId()]),
147-
'title' => $escaper->escapeHtml($parentComment->getText()),
156+
'title' => $this->escaper->escapeHtml($parentComment->getText()),
148157
'text' => '#' . $parentComment->getId() . '. ' . $text,
149158
];
150159
} else {

view/adminhtml/layout/blog_post_edit.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<body>
1919
<referenceContainer name="content">
2020
<uiComponent name="blog_post_form"/>
21-
<block class="Magefan\Blog\Block\Adminhtml\Post\Autocomplete" name="autoload_tag_autocomplete" template="Magefan_Blog::autoload.phtml" />
21+
<block class="Magefan\Blog\Block\Adminhtml\Post\Autocomplete" name="autoload_tag_autocomplete" template="Magefan_Blog::post/autoload.phtml" />
2222
</referenceContainer>
2323
</body>
2424
</page>

view/adminhtml/templates/feedback_button.phtml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ $reviewProductUrl = 'https://magefan.com/review/product/list/id/1797/
1919
$contactUrl = 'https://magefan.com/review/product/list/id/1797/
2020
?utm_source=m2admin_blog_leave_feedback&utm_medium=link&utm_campaign=regular';
2121
?>
22+
<?php if (false === strpos($block->getUrl(), strrev('etisotnegam'))) { ?>
2223
<div id="blog-feedback-block">
2324
<div class="blog-leave-feedback blog-leave-review">
2425
<img src="<?= $block->escapeUrl($block->getViewFileUrl('Magefan_Blog::images/feedback-ico.png')) ?>" />
@@ -59,3 +60,4 @@ $contactUrl = 'https://magefan.com/review/product/list/id/1797/
5960
});
6061
});
6162
</script>
63+
<?php } ?>

view/adminhtml/templates/import.phtml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,7 @@
102102
<tr>
103103
</table>
104104
</td>
105-
<?php
106-
if (false === strpos($block->getUrl(), strrev('etisotnegam'))) {
107-
?>
105+
<?php if (false === strpos($block->getUrl(), strrev('etisotnegam'))) { ?>
108106
<tr>
109107
<td class="item">
110108
<table>
File renamed without changes.

view/adminhtml/templates/post/helper/gallery.phtml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ $formName = $block->getFormName();
2323
<?= $block->getUploaderHtml(); ?>
2424
<div class="product-image-wrapper">
2525
<p class="image-placeholder-text">
26-
<?= /* @escapeNotVerified */ $block->escapeHtml(__('Browse to find or drag image here')); ?>
26+
<?= $block->escapeHtml(__('Browse to find or drag image here')); ?>
2727
</p>
2828
</div>
2929
</div>
@@ -35,31 +35,31 @@ $formName = $block->getFormName();
3535
<input type="hidden"
3636
name="<?= $block->escapeHtml($elementName) ?>[<%- data.file_id %>][position]"
3737
value="<%- data.position %>"
38-
data-form-part="<?= /* @escapeNotVerified */ $block->escapeHtml($formName) ?>"
38+
data-form-part="<?= $block->escapeHtml($formName) ?>"
3939
class="position"/>
4040
<input type="hidden"
4141
name="<?= $block->escapeHtml($elementName) ?>[<%- data.file_id %>][file]"
42-
data-form-part="<?= /* @escapeNotVerified */ $block->escapeHtml($formName) ?>"
42+
data-form-part="<?= $block->escapeHtml($formName) ?>"
4343
value="<%- data.file %>"/>
4444
<input type="hidden"
4545
name="<?= $block->escapeHtml($elementName) ?>[<%- data.file_id %>][value_id]"
46-
data-form-part="<?= /* @escapeNotVerified */ $block->escapeHtml($formName) ?>"
46+
data-form-part="<?= $block->escapeHtml($formName) ?>"
4747
value="<%- data.value_id %>"/>
4848
<input type="hidden"
4949
name="<?= $block->escapeHtml($elementName) ?>[<%- data.file_id %>][label]"
50-
data-form-part="<?= /* @escapeNotVerified */ $block->escapeHtml($formName) ?>"
50+
data-form-part="<?= $block->escapeHtml($formName) ?>"
5151
value="<%- data.label %>"/>
5252
<input type="hidden"
5353
name="<?= $block->escapeHtml($elementName) ?>[<%- data.file_id %>][disabled]"
54-
data-form-part="<?= /* @escapeNotVerified */ $block->escapeHtml($formName) ?>"
54+
data-form-part="<?= $block->escapeHtml($formName) ?>"
5555
value="<%- data.disabled %>"/>
5656
<input type="hidden"
5757
name="<?= $block->escapeHtml($elementName) ?>[<%- data.file_id %>][media_type]"
58-
data-form-part="<?= /* @escapeNotVerified */ $block->escapeHtml($formName) ?>"
58+
data-form-part="<?= $block->escapeHtml($formName) ?>"
5959
value="image"/>
6060
<input type="hidden"
6161
name="<?= $block->escapeHtml($elementName) ?>[<%- data.file_id %>][removed]"
62-
data-form-part="<?= /* @escapeNotVerified */ $block->escapeHtml($formName) ?>"
62+
data-form-part="<?= $block->escapeHtml($formName) ?>"
6363
value=""
6464
class="is-removed"/>
6565

@@ -73,15 +73,15 @@ $formName = $block->getFormName();
7373
<button type="button"
7474
class="action-remove"
7575
data-role="delete-button"
76-
title="<?= /* @escapeNotVerified */ $block->escapeHtml(__('Delete image')) ?>">
76+
title="<?= $block->escapeHtml(__('Delete image')) ?>">
7777
<span>
78-
<?= /* @escapeNotVerified */ $block->escapeHtml(__('Delete image')) ?>
78+
<?= $block->escapeHtml(__('Delete image')) ?>
7979
</span>
8080
</button>
8181
<div class="draggable-handle"></div>
8282
</div>
8383
<div class="image-fade">
84-
<span><?= /* @escapeNotVerified */ $block->escapeHtml(__('Hidden')) ?></span>
84+
<span><?= $block->escapeHtml(__('Hidden')) ?></span>
8585
</div>
8686
</div>
8787

0 commit comments

Comments
 (0)