Skip to content

Commit

Permalink
5152-Code-Quality-Check
Browse files Browse the repository at this point in the history
  • Loading branch information
KozakSerhii committed May 28, 2021
1 parent 87d9999 commit 9745b7e
Show file tree
Hide file tree
Showing 33 changed files with 88 additions and 89 deletions.
8 changes: 4 additions & 4 deletions Block/Adminhtml/Import/Form/Form.php
Expand Up @@ -82,9 +82,9 @@ protected function _prepareForm()
[
'label' => __('NOTICE'),
'name' => 'prefix',
'after_element_html' => 'When the import is completed successfully,
please copy image files from the old blog to Magento
<strong style="color:#105610;">pub/media/magefan_blog</strong>
'after_element_html' => 'When the import is completed successfully,
please copy image files from the old blog to Magento
<strong style="color:#105610;">pub/media/magefan_blog</strong>
directory.',
]
);
Expand Down Expand Up @@ -188,7 +188,7 @@ protected function _prepareForm()

$this->_eventManager->dispatch('magefan_blog_import_' . $type . '_prepare_form', ['form' => $form]);

/*
/*
if (empty($data['prefix'])) {
$data['prefix'] = 'wp_';
}
Expand Down
2 changes: 1 addition & 1 deletion Block/Adminhtml/Post/Tag/Autocomplete.php
Expand Up @@ -28,7 +28,7 @@ class Autocomplete extends Template
* @param array $data
* @param Registry $registry
*/
public function __construct(Context $context, array $data = [], Registry $registry)
public function __construct(Context $context, Registry $registry, array $data = [])
{
parent::__construct($context, $data);
$this->registry = $registry;
Expand Down
3 changes: 1 addition & 2 deletions Block/Index.php
Expand Up @@ -68,7 +68,6 @@ public function getToolbarBlock()
return $toolBarBlock;
}


/**
* Prepare posts collection
*
Expand Down Expand Up @@ -218,7 +217,7 @@ protected function _toHtml()

/**
* Retrieve identities
*git add
* git add
* @return array
*/
public function getIdentities()
Expand Down
8 changes: 4 additions & 4 deletions Block/Post/AbstractPost.php
Expand Up @@ -200,9 +200,9 @@ public function authorPageEnabled()
public function magefanCommentsEnabled()
{
return $this->_scopeConfig->getValue(
'mfblog/post_view/comments/type',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
) == \Magefan\Blog\Model\Config\Source\CommetType::MAGEFAN;
'mfblog/post_view/comments/type',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
) == \Magefan\Blog\Model\Config\Source\CommetType::MAGEFAN;
}

/**
Expand All @@ -225,7 +225,7 @@ public function getStyleViewModel()
if (!$viewModel) {
$viewModel = \Magento\Framework\App\ObjectManager::getInstance()
->get(\Magefan\Blog\ViewModel\Style::class);
$this->setData('style_view_model', $viewModel );
$this->setData('style_view_model', $viewModel);
}

return $viewModel;
Expand Down
1 change: 0 additions & 1 deletion Block/Post/PostList.php
Expand Up @@ -80,7 +80,6 @@ protected function getPostTemplateType()
);
}


/**
* Retrieve Toolbar Block
* @return \Magefan\Blog\Block\Post\PostList\Toolbar
Expand Down
10 changes: 5 additions & 5 deletions Block/Post/PostList/AbstractList.php
Expand Up @@ -195,7 +195,7 @@ public function getCacheKeyInfo()
);
}

/**
/**
* Retrieve 1 if display author information is enabled
* @return int
*/
Expand Down Expand Up @@ -226,9 +226,9 @@ public function authorPageEnabled()
public function magefanCommentsEnabled()
{
return $this->_scopeConfig->getValue(
'mfblog/post_view/comments/type',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
) == \Magefan\Blog\Model\Config\Source\CommetType::MAGEFAN;
'mfblog/post_view/comments/type',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
) == \Magefan\Blog\Model\Config\Source\CommetType::MAGEFAN;
}

/**
Expand All @@ -251,7 +251,7 @@ public function getStyleViewModel()
if (!$viewModel) {
$viewModel = \Magento\Framework\App\ObjectManager::getInstance()
->get(\Magefan\Blog\ViewModel\Style::class);
$this->setData('style_view_model', $viewModel );
$this->setData('style_view_model', $viewModel);
}

return $viewModel;
Expand Down
2 changes: 1 addition & 1 deletion Block/Post/View/Comments/HeadFbApi.php
Expand Up @@ -8,7 +8,7 @@
namespace Magefan\Blog\Block\Post\View\Comments;

/**
* Class HeadFbApi
* Class HeadFbApi class
*/
class HeadFbApi extends \Magento\Framework\View\Element\AbstractBlock
{
Expand Down
1 change: 0 additions & 1 deletion Block/Post/View/NextPrev.php
Expand Up @@ -180,7 +180,6 @@ public function getNextPost()
return $this->_nextPost;
}


/**
* Retrieve post collection with frontend filters and order
* @return bool
Expand Down
1 change: 0 additions & 1 deletion Block/Rss/Feed.php
Expand Up @@ -74,7 +74,6 @@ public function getPostContent($post)

return $content;
}


/**
* Prepare posts collection
Expand Down
5 changes: 2 additions & 3 deletions Block/Widget/Recent.php
Expand Up @@ -16,7 +16,7 @@ class Recent extends \Magefan\Blog\Block\Post\PostList\AbstractList implements \
/**
* @var array
*/
static $processedIds = [];
public static $processedIds = [];

/**
* @var \Magefan\Blog\Model\CategoryFactory
Expand Down Expand Up @@ -128,10 +128,9 @@ protected function _preparePostCollection()
}

$enableNoRepeat = $this->getData('no_repeat_posts_enable');
if ($enableNoRepeat && self::$processedIds){
if ($enableNoRepeat && self::$processedIds) {
$this->_postCollection->addFieldToFilter('post_id', ['nin' => self::$processedIds]);
}

}

/**
Expand Down
2 changes: 1 addition & 1 deletion Controller/Adminhtml/Import/Form.php
Expand Up @@ -9,6 +9,7 @@
namespace Magefan\Blog\Controller\Adminhtml\Import;

use Magento\Framework\Exception\LocalizedException;

/**
* Blog prepare import controller
*/
Expand Down Expand Up @@ -70,7 +71,6 @@ protected function _isAllowed()
return $this->_authorization->isAllowed('Magefan_Blog::import');
}


/**
* Retrieve store config value
*
Expand Down
5 changes: 2 additions & 3 deletions Helper/Image.php
Expand Up @@ -172,9 +172,8 @@ public function __toString()
{
$url = "";
if ($this->_baseFile) {
$url = $this->_storeManager->getStore()->getBaseUrl(
\Magento\Framework\UrlInterface::URL_TYPE_MEDIA
) . $this->_newFile;
$url = $this->_storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA) .
$this->_newFile;
}
return $url;
}
Expand Down
6 changes: 1 addition & 5 deletions Model/CategoryManagement.php
Expand Up @@ -90,11 +90,7 @@ protected function getDynamicData($item)
];

foreach ($keys as $key) {
$method = 'get' . str_replace(
'_',
'',
ucwords($key, '_')
);
$method = 'get' . str_replace('_', '', ucwords($key, '_'));
$data[$key] = $item->$method();
}

Expand Down
2 changes: 1 addition & 1 deletion Model/Config/Source/Template.php
Expand Up @@ -60,4 +60,4 @@ public function toOptionArray():array
}
return $this->options[$this->templateType];
}
}
}
15 changes: 7 additions & 8 deletions Model/Import/Wordpress.php
Expand Up @@ -325,13 +325,13 @@ public function execute()
$post->setData($data)->save();

/* find post comment s*/
$sql = 'SELECT
*
FROM
'.$_pref.'comments
WHERE
`comment_approved`=1
AND
$sql = 'SELECT
*
FROM
'.$_pref.'comments
WHERE
`comment_approved`=1
AND
`comment_post_ID` = ' . $wordpressPostId;
$resultComments = $adapter->query($sql)->execute();
$commentParents = [];
Expand Down Expand Up @@ -579,7 +579,6 @@ protected function wordpressOutoutWrap($pee, $br = true)
}
}


$divElement = str_replace('[video', '<video controls ', $divElement);
$divElement = str_replace('align="', 'class="wp-caption ', $divElement);
$divElement = str_replace(']', '>', $divElement);
Expand Down
4 changes: 1 addition & 3 deletions Model/Post.php
Expand Up @@ -546,7 +546,6 @@ public function getShortFilteredContent($len = null, $endСharacters = null)
foreach (explode(' ', $stcc) as $s) {
$str .= ($str ? ' ' : '') . $s;


$pos = mb_strpos($content, $str);
if (false !== $pos) {
$start = $pos;
Expand All @@ -565,7 +564,7 @@ public function getShortFilteredContent($len = null, $endСharacters = null)

/* Do not cut words */
while ($len < strlen($content)
&& !in_array($content[$len], [' ', '<', "\t", "\r", "\n"]) ) {
&& !in_array($content[$len], [' ', '<', "\t", "\r", "\n"])) {
$len++;
}

Expand Down Expand Up @@ -950,7 +949,6 @@ public function isPublishDateEnabled()
'mfblog/design/publication_date',
ScopeInterface::SCOPE_STORE
);
return true;
}

/**
Expand Down
6 changes: 1 addition & 5 deletions Model/PostManagement.php
Expand Up @@ -126,11 +126,7 @@ protected function getDynamicData($item)
];

foreach ($keys as $key) {
$method = 'get' . str_replace(
'_',
'',
ucwords($key, '_')
);
$method = 'get' . str_replace('_', '', ucwords($key, '_'));
$data[$key] = $item->$method();
}

Expand Down
4 changes: 2 additions & 2 deletions Model/ResourceModel/Post/Collection.php
Expand Up @@ -346,7 +346,7 @@ public function addSearchFilter($term)
);

if ($advancedSortingEnabled) {

if ($tagPostIdsCount > 200) {
$tagPostIds = array_slice($tagPostIds, 0, 200);
}
Expand Down Expand Up @@ -376,7 +376,7 @@ public function addSearchFilter($term)
if ($advancedSortingEnabled) {
$this->addExpressionFieldToSelect(
'search_rate',
'(0 ' .
'(0 ' .
'+ FORMAT(MATCH (title, meta_keywords, meta_description, identifier, content) AGAINST ("{{term}}"), 4))',
[
'term' => $this->getConnection()->quote($term)
Expand Down
2 changes: 1 addition & 1 deletion Model/SlashUrlRedirect.php
Expand Up @@ -79,7 +79,7 @@ public function execute(\Magento\Framework\Event\Observer $observer)
ScopeInterface::SCOPE_STORE
);
if ($controllerSufix) {
if (strpos($result[0], $controllerSufix) == strlen($result[0]) - strlen($controllerSufix) ) {
if (strpos($result[0], $controllerSufix) == strlen($result[0]) - strlen($controllerSufix)) {
return;
}
}
Expand Down
2 changes: 1 addition & 1 deletion Model/TemplatePool.php
Expand Up @@ -63,4 +63,4 @@ public function getTemplate(string $templateType, string $name):string
}
return '';
}
}
}
2 changes: 1 addition & 1 deletion Plugin/Magento/AdminGws/Model/ModelsPlugin.php
Expand Up @@ -9,7 +9,7 @@
namespace Magefan\Blog\Plugin\Magento\AdminGws\Model;

/**
* Class ModelsPlugin
* Class ModelsPlugin class
*/
class ModelsPlugin
{
Expand Down
1 change: 0 additions & 1 deletion Setup/UpgradeData.php
Expand Up @@ -41,7 +41,6 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface
);
$tags = $connection->fetchAll($tagSelect);


$count = count($tags);
if ($count) {
$data = [];
Expand Down
4 changes: 1 addition & 3 deletions Setup/UpgradeSchema.php
Expand Up @@ -737,8 +737,6 @@ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $con
);
}



if (version_compare($version, '2.9.8') < 0) {
/**
* Create table 'magefan_blog_tag_store'
Expand Down Expand Up @@ -805,4 +803,4 @@ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $con

$setup->endSetup();
}
}
}
1 change: 0 additions & 1 deletion Ui/DataProvider/Comment/Form/CommentDataProvider.php
Expand Up @@ -121,7 +121,6 @@ public function getData()
$this->loadedData[$comment->getId()]['author_url'] = $guestData;
break;
case \Magefan\Blog\Model\Config\Source\AuthorType::CUSTOMER:

if ($author->getCustomer()) {
$this->loadedData[$comment->getId()]['author_url'] = [
'url' => $this->url->getUrl(
Expand Down
10 changes: 6 additions & 4 deletions ViewModel/Style.php
Expand Up @@ -31,11 +31,15 @@ class Style implements \Magento\Framework\View\Element\Block\ArgumentInterface
*/
private $done = [];


/**
* Style constructor.
* @param Source $source
* @param AssetRepository $assetRepository
*/
public function __construct(
Source $source,
AssetRepository $assetRepository
) {
) {
$this->source = $source;
$this->assetRepository = $assetRepository;
}
Expand All @@ -50,7 +54,6 @@ public function getStyle($file)
}
$this->done[$file] = true;


if (false === strpos($file, '::')) {
$file = 'Magefan_Blog::css/' . $file;
}
Expand Down Expand Up @@ -92,6 +95,5 @@ public function getStyle($file)
return PHP_EOL . '
<!-- Start CSS ' . $file . ' ' . ((int)(strlen($fileContent) / 1024)) . 'Kb -->
<style>' . $fileContent . '</style>';

}
}
3 changes: 1 addition & 2 deletions view/adminhtml/templates/import/item.phtml
Expand Up @@ -27,8 +27,7 @@
$url = $block->getUrl('blog/import/form', ['type' => $block->getImportType()]);
}
$action = 'window.location=\'' . $block->escapeUrl($url) . '\'';
}
?>
} ?>
onclick="<?= $action ?>">
<img class="img"
src="<?= $block->escapeUrl($block->getViewFileUrl($block->getImage())) ?>" />
Expand Down
3 changes: 2 additions & 1 deletion view/frontend/templates/addthis-js.phtml
Expand Up @@ -16,4 +16,5 @@
}
</script>
<script type="text/javascript" async
src="<?= '/' . '/' ?>s7.addthis.com/js/300/addthis_widget.js#pubid=<?= $block->escapeUrl($block->getAddThisPubId()) ?>"></script>
src="<?= '/' . '/' ?>s7.addthis.com/js/300/addthis_widget.js#pubid=<?= $block->escapeUrl($block->getAddThisPubId()) ?>">
</script>

0 comments on commit 9745b7e

Please sign in to comment.