diff --git a/Api/AuthorRepositoryInterface.php b/Api/AuthorRepositoryInterface.php
index 1a9cfc5..7b63450 100644
--- a/Api/AuthorRepositoryInterface.php
+++ b/Api/AuthorRepositoryInterface.php
@@ -70,7 +70,7 @@ public function delete(
/**
* Delete Author by ID
- * @param string $authord
+ * @param string $authorId
* @return bool true on success
* @throws \Magento\Framework\Exception\NoSuchEntityException
* @throws \Magento\Framework\Exception\LocalizedException
diff --git a/Api/CategoryRepositoryInterface.php b/Api/CategoryRepositoryInterface.php
index 2743545..3bf6427 100644
--- a/Api/CategoryRepositoryInterface.php
+++ b/Api/CategoryRepositoryInterface.php
@@ -71,7 +71,7 @@ public function delete(
/**
* Delete Category by ID
- * @param string $categoryd
+ * @param string $categoryId
* @return bool true on success
* @throws \Magento\Framework\Exception\NoSuchEntityException
* @throws \Magento\Framework\Exception\LocalizedException
diff --git a/Api/CommentRepositoryInterface.php b/Api/CommentRepositoryInterface.php
index fe7b557..4490616 100644
--- a/Api/CommentRepositoryInterface.php
+++ b/Api/CommentRepositoryInterface.php
@@ -74,7 +74,7 @@ public function delete(
/**
* Delete Comment by ID
- * @param string $commentd
+ * @param string $commentId
* @return bool true on success
* @throws \Magento\Framework\Exception\NoSuchEntityException
* @throws \Magento\Framework\Exception\LocalizedException
diff --git a/Api/PostRepositoryInterface.php b/Api/PostRepositoryInterface.php
index de9395b..4d5d836 100644
--- a/Api/PostRepositoryInterface.php
+++ b/Api/PostRepositoryInterface.php
@@ -71,7 +71,7 @@ public function delete(
/**
* Delete Post by ID
- * @param string $postd
+ * @param string $postId
* @return bool true on success
* @throws \Magento\Framework\Exception\NoSuchEntityException
* @throws \Magento\Framework\Exception\LocalizedException
diff --git a/Api/TagRepositoryInterface.php b/Api/TagRepositoryInterface.php
index e236249..2dbe6ca 100644
--- a/Api/TagRepositoryInterface.php
+++ b/Api/TagRepositoryInterface.php
@@ -60,7 +60,7 @@ public function delete(
/**
* Delete Tag by ID
- * @param string $tagd
+ * @param string $tagId
* @return bool true on success
* @throws \Magento\Framework\Exception\NoSuchEntityException
* @throws \Magento\Framework\Exception\LocalizedException
diff --git a/Block/Adminhtml/Author/Edit.php b/Block/Adminhtml/Author/Edit.php
index cebdeae..8f48ec1 100644
--- a/Block/Adminhtml/Author/Edit.php
+++ b/Block/Adminhtml/Author/Edit.php
@@ -1,18 +1,18 @@
_eventManager->dispatch(
- 'ves_check_license',
- ['obj' => $this,'ex'=>'Ves_Blog']
- );
- return parent::_toHtml();
- }
-
/**
* Check permission for passed action
*
@@ -102,4 +94,4 @@ protected function _getSaveAndContinueUrl()
{
return $this->getUrl('cms/*/save', ['_current' => true, 'back' => 'edit', 'active_tab' => '{{tab_id}}']);
}
-}
\ No newline at end of file
+}
diff --git a/Block/Adminhtml/Author/Edit/Tab/Main.php b/Block/Adminhtml/Author/Edit/Tab/Main.php
index a865065..cebe6c0 100644
--- a/Block/Adminhtml/Author/Edit/Tab/Main.php
+++ b/Block/Adminhtml/Author/Edit/Tab/Main.php
@@ -1,18 +1,18 @@
_eventManager->dispatch(
- 'ves_check_license',
- ['obj' => $this,'ex'=>'Ves_Blog']
- );
+
/* @var $model \Magento\Cms\Model\Page */
$model = $this->_coreRegistry->registry('current_author');
@@ -108,11 +105,7 @@ protected function _prepareForm()
$isElementDisabled = true;
}
$wysiwygConfig = $this->_wysiwygConfig->getConfig(['tab_id' => $this->getTabId().time()]);
- if (!$this->getData('is_valid') && !$this->getData('local_valid')) {
- $isElementDisabled = true;
- $wysiwygConfig['enabled'] = $wysiwygConfig['add_variables'] = $wysiwygConfig['add_widgets'] = $wysiwygConfig['add_images'] = 0;
- $wysiwygConfig['plugins'] = [];
- }
+
/** @var \Magento\Framework\Data\Form $form */
$form = $this->_formFactory->create();
@@ -184,7 +177,7 @@ protected function _prepareForm()
'config' => $wysiwygConfig
]
);
-
+
$fieldset = $form->addFieldset('contact_fieldset', ['legend' => __('Contact Info')]);
$fieldset->addField(
diff --git a/Block/Adminhtml/Category/Edit.php b/Block/Adminhtml/Category/Edit.php
index 411eed8..8780ab4 100644
--- a/Block/Adminhtml/Category/Edit.php
+++ b/Block/Adminhtml/Category/Edit.php
@@ -1,18 +1,18 @@
_authorization->isAllowed($resourceId);
}
- protected function _toHtml(){
- $this->_eventManager->dispatch(
- 'ves_check_license',
- ['obj' => $this,'ex'=>'Ves_Blog']
- );
- return parent::_toHtml();
- }
-
/**
* Getter of url for "Save and Continue" button
* tab_id will be replaced by desired by JS later
diff --git a/Block/Adminhtml/Category/Edit/Tab/Design.php b/Block/Adminhtml/Category/Edit/Tab/Design.php
index 73af2b1..c691ca3 100644
--- a/Block/Adminhtml/Category/Edit/Tab/Design.php
+++ b/Block/Adminhtml/Category/Edit/Tab/Design.php
@@ -1,18 +1,18 @@
_eventManager->dispatch(
- 'ves_check_license',
- ['obj' => $this,'ex'=>'Ves_Blog']
- );
-
/*
* Checking if user have permissions to save information
*/
@@ -110,9 +105,6 @@ protected function _prepareForm()
} else {
$isElementDisabled = true;
}
- if (!$this->getData('is_valid') && !$this->getData('local_valid')) {
- $isElementDisabled = true;
- }
/** @var \Magento\Framework\Data\Form $form */
$form = $this->_formFactory->create(['data' => ['html_id_prefix' => 'category_']]);
diff --git a/Block/Adminhtml/Category/Edit/Tab/Main.php b/Block/Adminhtml/Category/Edit/Tab/Main.php
index ce5247a..d2bd0e9 100644
--- a/Block/Adminhtml/Category/Edit/Tab/Main.php
+++ b/Block/Adminhtml/Category/Edit/Tab/Main.php
@@ -1,18 +1,18 @@
_eventManager->dispatch(
- 'ves_check_license',
- ['obj' => $this,'ex'=>'Ves_Blog']
- );
-
/* @var $model \Magento\Cms\Model\Page */
$model = $this->_coreRegistry->registry('blog_category');
@@ -129,11 +123,7 @@ protected function _prepareForm()
$isElementDisabled = true;
}
$wysiwygConfig = $this->_wysiwygConfig->getConfig(['tab_id' => $this->getTabId().time()]);
- if (!$this->getData('is_valid') && !$this->getData('local_valid')) {
- $isElementDisabled = true;
- $wysiwygConfig['enabled'] = $wysiwygConfig['add_variables'] = $wysiwygConfig['add_widgets'] = $wysiwygConfig['add_images'] = 0;
- $wysiwygConfig['plugins'] = [];
- }
+
/** @var \Magento\Framework\Data\Form $form */
$form = $this->_formFactory->create();
diff --git a/Block/Adminhtml/Category/Edit/Tab/Meta.php b/Block/Adminhtml/Category/Edit/Tab/Meta.php
index b726cae..d6ccbf8 100644
--- a/Block/Adminhtml/Category/Edit/Tab/Meta.php
+++ b/Block/Adminhtml/Category/Edit/Tab/Meta.php
@@ -1,18 +1,18 @@
_eventManager->dispatch(
- 'ves_check_license',
- ['obj' => $this,'ex'=>'Ves_Blog']
- );
/*
* Checking if user have permissions to save information
*/
@@ -41,9 +37,7 @@ protected function _prepareForm()
} else {
$isElementDisabled = true;
}
- if (!$this->getData('is_valid') && !$this->getData('local_valid')) {
- $isElementDisabled = true;
- }
+
/** @var \Magento\Framework\Data\Form $form */
$form = $this->_formFactory->create();
diff --git a/Block/Adminhtml/Comment/Edit.php b/Block/Adminhtml/Comment/Edit.php
index d6f1a5b..047eac7 100644
--- a/Block/Adminhtml/Comment/Edit.php
+++ b/Block/Adminhtml/Comment/Edit.php
@@ -1,18 +1,18 @@
getUrl('cms/*/save', ['_current' => true, 'back' => 'edit', 'active_tab' => '{{tab_id}}']);
}
- protected function _toHtml(){
- $this->_eventManager->dispatch(
- 'ves_check_license',
- ['obj' => $this,'ex'=>'Ves_Blog']
- );
- return parent::_toHtml();
- }
-
/**
* Prepare layout
*
@@ -154,4 +146,4 @@ function toggleEditor() {
";
return parent::_prepareLayout();
}
-}
\ No newline at end of file
+}
diff --git a/Block/Adminhtml/Comment/Edit/Tab/Main.php b/Block/Adminhtml/Comment/Edit/Tab/Main.php
index 0af32ef..9f419ca 100644
--- a/Block/Adminhtml/Comment/Edit/Tab/Main.php
+++ b/Block/Adminhtml/Comment/Edit/Tab/Main.php
@@ -1,18 +1,18 @@
_eventManager->dispatch(
- 'ves_check_license',
- ['obj' => $this,'ex'=>'Ves_Blog']
- );
/* @var $model \Magento\Cms\Model\Page */
$model = $this->_coreRegistry->registry('current_comment');
@@ -110,11 +106,6 @@ protected function _prepareForm()
$isElementDisabled = true;
}
$wysiwygConfig = $this->_wysiwygConfig->getConfig(['tab_id' => $this->getTabId().time()]);
- if (!$this->getData('is_valid') && !$this->getData('local_valid')) {
- $isElementDisabled = true;
- $wysiwygConfig['enabled'] = $wysiwygConfig['add_variables'] = $wysiwygConfig['add_widgets'] = $wysiwygConfig['add_images'] = 0;
- $wysiwygConfig['plugins'] = [];
- }
/** @var \Magento\Framework\Data\Form $form */
$form = $this->_formFactory->create();
@@ -184,9 +175,9 @@ protected function _prepareForm()
);
$dateFormat = $this->_localeDate->getDateFormat(\IntlDateFormatter::SHORT);
- $fieldset->addField( 'creation_time',
+ $fieldset->addField( 'creation_time',
'date',
- [
+ [
'label' => __('Created On'),
'title' => __('Created on'),
'name' => 'creation_time',
@@ -195,7 +186,7 @@ protected function _prepareForm()
'disabled' => $isElementDisabled
]
);
-
+
$contentField = $fieldset->addField(
'content',
diff --git a/Block/Adminhtml/Comment/Edit/Tab/Reply.php b/Block/Adminhtml/Comment/Edit/Tab/Reply.php
index fe02fab..e9ef785 100644
--- a/Block/Adminhtml/Comment/Edit/Tab/Reply.php
+++ b/Block/Adminhtml/Comment/Edit/Tab/Reply.php
@@ -1,18 +1,18 @@
_eventManager->dispatch(
- 'ves_check_license',
- ['obj' => $this,'ex'=>'Ves_Blog']
- );
/* @var $model \Magento\Cms\Model\Page */
$model = $this->_coreRegistry->registry('current_comment');
@@ -105,18 +101,13 @@ protected function _prepareForm()
$isElementDisabled = true;
}
$wysiwygConfig = $this->_wysiwygConfig->getConfig(['tab_id' => $this->getTabId().time()]);
- if (!$this->getData('is_valid') && !$this->getData('local_valid')) {
- $isElementDisabled = true;
- $wysiwygConfig['enabled'] = $wysiwygConfig['add_variables'] = $wysiwygConfig['add_widgets'] = $wysiwygConfig['add_images'] = 0;
- $wysiwygConfig['plugins'] = [];
- }
/** @var \Magento\Framework\Data\Form $form */
$form = $this->_formFactory->create();
$form->setHtmlIdPrefix('comment_');
-
+
$fieldset = $form->addFieldset('base_fieldset', ['legend' => __('Reply Comment')]);
$fieldset->addField(
@@ -164,7 +155,7 @@ protected function _prepareForm()
->setPageSize('100')
->setCurPage('1');
-
+
if (count($childCommentCollection) >= 1) {
//load all child reply comments
@@ -206,10 +197,10 @@ protected function _prepareForm()
);
}
-
+
$this->_eventManager->dispatch('adminhtml_blog_comment_edit_tab_reply_prepare_form', ['form' => $form]);
-
+
$adminUser = $this->getCurrentUser();
$user_name = $adminUser->getUsername();
diff --git a/Block/Adminhtml/Feed/Edit.php b/Block/Adminhtml/Feed/Edit.php
index 9f1d166..a1f46ba 100644
--- a/Block/Adminhtml/Feed/Edit.php
+++ b/Block/Adminhtml/Feed/Edit.php
@@ -1,18 +1,18 @@
getUrl('cms/*/save', ['_current' => true, 'back' => 'edit', 'active_tab' => '{{tab_id}}']);
}
- protected function _toHtml(){
- $this->_eventManager->dispatch(
- 'ves_check_license',
- ['obj' => $this,'ex'=>'Ves_Blog']
- );
- return parent::_toHtml();
- }
-
/**
* Prepare layout
*
@@ -162,4 +154,4 @@ function toggleEditor() {
";
return parent::_prepareLayout();
}
-}
\ No newline at end of file
+}
diff --git a/Block/Adminhtml/Import/Edit/Form.php b/Block/Adminhtml/Import/Edit/Form.php
index 76794cc..70146f4 100644
--- a/Block/Adminhtml/Import/Edit/Form.php
+++ b/Block/Adminhtml/Import/Edit/Form.php
@@ -1,18 +1,18 @@
_eventManager->dispatch(
- 'ves_check_license',
- ['obj' => $this,'ex'=>'Ves_Blog']
- );
/**
* Checking if user have permission to save information
*/
@@ -37,10 +33,6 @@ protected function _prepareForm()
}else {
$isElementDisabled = true;
}
- if (!$this->getData('is_valid') && !$this->getData('local_valid')) {
- $isElementDisabled = true;
- }
-
/** @var \Magento\Framework\Data\Form $form */
$form = $this->_formFactory->create(
[
@@ -239,4 +231,4 @@ protected function _isAllowedAction($resourceId)
{
return $this->_authorization->isAllowed($resourceId);
}
-}
\ No newline at end of file
+}
diff --git a/Block/Adminhtml/Import/Wordpress.php b/Block/Adminhtml/Import/Wordpress.php
index d3695db..5be4bce 100644
--- a/Block/Adminhtml/Import/Wordpress.php
+++ b/Block/Adminhtml/Import/Wordpress.php
@@ -1,18 +1,18 @@
buttonList->remove('delete');
}
- protected function _toHtml(){
- $this->_eventManager->dispatch(
- 'ves_check_license',
- ['obj' => $this,'ex'=>'Ves_Blog']
- );
- return parent::_toHtml();
- }
/**
* Check permission for passed action
@@ -77,4 +70,4 @@ public function getSaveUrl()
{
return $this->getUrl('*/*/run', ['_current' => true]);
}
-}
\ No newline at end of file
+}
diff --git a/Block/Adminhtml/Importer/Edit.php b/Block/Adminhtml/Importer/Edit.php
index c885bcc..2d56a55 100644
--- a/Block/Adminhtml/Importer/Edit.php
+++ b/Block/Adminhtml/Importer/Edit.php
@@ -1,18 +1,18 @@
getUrl('vesblog/*/save', ['_current' => true, 'back' => 'edit', 'active_tab' => '{{tab_id}}']);
}
- protected function _toHtml(){
- $this->_eventManager->dispatch(
- 'ves_check_license',
- ['obj' => $this,'ex'=>'Ves_Blog']
- );
- return parent::_toHtml();
- }
-
/**
* Prepare layout
*
@@ -162,4 +154,4 @@ function toggleEditor() {
";
return parent::_prepareLayout();
}
-}
\ No newline at end of file
+}
diff --git a/Block/Adminhtml/Importer/Edit/Tab/Main.php b/Block/Adminhtml/Importer/Edit/Tab/Main.php
index ddfa1c9..f2803e8 100644
--- a/Block/Adminhtml/Importer/Edit/Tab/Main.php
+++ b/Block/Adminhtml/Importer/Edit/Tab/Main.php
@@ -1,18 +1,18 @@
_eventManager->dispatch(
- 'ves_check_license',
- ['obj' => $this,'ex'=>'Ves_Blog']
- );
-
/* @var $model \Magento\Cms\Model\Page */
$model = $this->_coreRegistry->registry('blog_importer');
@@ -89,11 +83,7 @@ protected function _prepareForm()
$isElementDisabled = true;
}
$wysiwygConfig = $this->_wysiwygConfig->getConfig(['tab_id' => $this->getTabId().time()]);
- if (!$this->getData('is_valid') && !$this->getData('local_valid')) {
- $isElementDisabled = true;
- $wysiwygConfig['enabled'] = $wysiwygConfig['add_variables'] = $wysiwygConfig['add_widgets'] = $wysiwygConfig['add_images'] = 0;
- $wysiwygConfig['plugins'] = [];
- }
+
/** @var \Magento\Framework\Data\Form $form */
$form = $this->_formFactory->create();
@@ -216,7 +206,7 @@ protected function _prepareForm()
]
);
-
+
$fieldset->addField(
'prefix',
@@ -362,7 +352,7 @@ protected function _prepareForm()
'disabled' => $isElementDisabled
]
);
-
+
$fieldset->addField(
'import_categories',
'select',
diff --git a/Block/Adminhtml/Post/Edit.php b/Block/Adminhtml/Post/Edit.php
index aa1540f..74adad9 100644
--- a/Block/Adminhtml/Post/Edit.php
+++ b/Block/Adminhtml/Post/Edit.php
@@ -1,18 +1,18 @@
getUrl('cms/*/save', ['_current' => true, 'back' => 'edit', 'active_tab' => '{{tab_id}}']);
}
- protected function _toHtml(){
- $this->_eventManager->dispatch(
- 'ves_check_license',
- ['obj' => $this,'ex'=>'Ves_Blog']
- );
- return parent::_toHtml();
- }
-
/**
* Prepare layout
*
@@ -162,4 +154,4 @@ function toggleEditor() {
";
return parent::_prepareLayout();
}
-}
\ No newline at end of file
+}
diff --git a/Block/Adminhtml/Post/Edit/Tab/Content.php b/Block/Adminhtml/Post/Edit/Tab/Content.php
index 2964e7c..8e83a88 100644
--- a/Block/Adminhtml/Post/Edit/Tab/Content.php
+++ b/Block/Adminhtml/Post/Edit/Tab/Content.php
@@ -1,18 +1,18 @@
_eventManager->dispatch(
- 'ves_check_license',
- ['obj' => $this,'ex'=>'Ves_Blog']
- );
+
/** @var $model \Magento\Cms\Model\Page */
$model = $this->_coreRegistry->registry('current_post');
@@ -69,11 +66,6 @@ protected function _prepareForm()
$isElementDisabled = true;
}
$wysiwygConfig = $this->_wysiwygConfig->getConfig(['tab_id' => $this->getTabId().time()]);
- if (!$this->getData('is_valid') && !$this->getData('local_valid')) {
- $isElementDisabled = true;
- $wysiwygConfig['enabled'] = $wysiwygConfig['add_variables'] = $wysiwygConfig['add_widgets'] = $wysiwygConfig['add_images'] = 0;
- $wysiwygConfig['plugins'] = [];
- }
/** @var \Magento\Framework\Data\Form $form */
$form = $this->_formFactory->create();
@@ -89,8 +81,6 @@ protected function _prepareForm()
]
);
-
-
$contentField = $fieldset->addField(
'short_content',
'editor',
@@ -109,10 +99,10 @@ protected function _prepareForm()
);
$wysiwygConfig = $this->_wysiwygConfig->getConfig(['tab_id' => $this->getTabId().time()]);
- if (!$this->getData('is_valid') && !$this->getData('local_valid')) {
+ /* if (!$this->getData('is_valid') && !$this->getData('local_valid')) {
$wysiwygConfig['enabled'] = $wysiwygConfig['add_variables'] = $wysiwygConfig['add_widgets'] = $wysiwygConfig['add_images'] = 0;
$wysiwygConfig['plugins'] = [];
- }
+ } */
$contentField = $fieldset->addField(
'content',
@@ -191,4 +181,4 @@ protected function _isAllowedAction($resourceId)
{
return $this->_authorization->isAllowed($resourceId);
}
-}
\ No newline at end of file
+}
diff --git a/Block/Adminhtml/Post/Edit/Tab/Design.php b/Block/Adminhtml/Post/Edit/Tab/Design.php
index f813d0c..9d695a9 100644
--- a/Block/Adminhtml/Post/Edit/Tab/Design.php
+++ b/Block/Adminhtml/Post/Edit/Tab/Design.php
@@ -1,18 +1,18 @@
_eventManager->dispatch(
- 'ves_check_license',
- ['obj' => $this,'ex'=>'Ves_Blog']
- );
/*
* Checking if user have permissions to save information
*/
$isElementDisabled = !$this->_isAllowedAction('Ves_Blog::post_edit');
- if (!$this->getData('is_valid') && !$this->getData('local_valid')) {
- $isElementDisabled = true;
- }
-
/** @var \Magento\Framework\Data\Form $form */
$form = $this->_formFactory->create(['data' => ['html_id_prefix' => 'post_']]);
diff --git a/Block/Adminhtml/Post/Edit/Tab/Main.php b/Block/Adminhtml/Post/Edit/Tab/Main.php
index a1d8017..3fe2d76 100644
--- a/Block/Adminhtml/Post/Edit/Tab/Main.php
+++ b/Block/Adminhtml/Post/Edit/Tab/Main.php
@@ -1,18 +1,18 @@
_eventManager->dispatch(
- 'ves_check_license',
- ['obj' => $this,'ex'=>'Ves_Blog']
- );
-
/* @var $model \Magento\Cms\Model\Page */
$model = $this->_coreRegistry->registry('current_post');
@@ -136,10 +131,6 @@ protected function _prepareForm()
} else {
$isElementDisabled = true;
}
- if (!$this->getData('is_valid') && !$this->getData('local_valid')) {
- $isElementDisabled = true;
- }
-
/** @var \Magento\Framework\Data\Form $form */
$form = $this->_formFactory->create();
@@ -256,7 +247,7 @@ protected function _prepareForm()
'disabled' => $isElementDisabled
]
);
-
+
$fieldset->addField(
'real_image_url',
'text',
@@ -441,9 +432,9 @@ protected function _prepareForm()
);
$dateFormat = $this->_localeDate->getDateFormat(\IntlDateFormatter::SHORT);
- $fieldset->addField( 'creation_time',
+ $fieldset->addField( 'creation_time',
'date',
- [
+ [
'label' => __('Published On'),
'title' => __('Published on'),
'name' => 'creation_time',
diff --git a/Block/Adminhtml/Post/Edit/Tab/Meta.php b/Block/Adminhtml/Post/Edit/Tab/Meta.php
index 8f4df6a..c74a5a6 100644
--- a/Block/Adminhtml/Post/Edit/Tab/Meta.php
+++ b/Block/Adminhtml/Post/Edit/Tab/Meta.php
@@ -1,18 +1,18 @@
_eventManager->dispatch(
- 'ves_check_license',
- ['obj' => $this,'ex'=>'Ves_Blog']
- );
/*
* Checking if user have permissions to save information
@@ -43,9 +39,6 @@ protected function _prepareForm()
$isElementDisabled = true;
}
- if (!$this->getData('is_valid') && !$this->getData('local_valid')) {
- $isElementDisabled = true;
- }
/** @var \Magento\Framework\Data\Form $form */
$form = $this->_formFactory->create();
diff --git a/Block/Archive.php b/Block/Archive.php
index 23c5639..cd6a331 100644
--- a/Block/Archive.php
+++ b/Block/Archive.php
@@ -1,18 +1,18 @@
_blogHelper = $blogHelper;
$this->_coreRegistry = $registry;
$this->_postFactory = $postFactory;
@@ -87,7 +87,7 @@ protected function _preparePostCollection()
->addFieldToFilter('is_active',1)
->addStoreFilter($store)
->setCurPage(1);
-
+
$this->_postCollection->getSelect()->group(
'MONTH(main_table.creation_time)',
'DESC'
diff --git a/Block/Archive/View.php b/Block/Archive/View.php
index 4202250..b665d98 100644
--- a/Block/Archive/View.php
+++ b/Block/Archive/View.php
@@ -1,18 +1,18 @@
_blogHelper = $blogHelper;
$this->_coreRegistry = $registry;
$this->_postFactory = $postFactory;
@@ -136,19 +136,19 @@ protected function _addBreadcrumbs()
echo '
';
print_r($time);
echo '';
- //die('test');
-
+ //die('test');
+
echo $this->formatDate($time[0] . '-' . $time[1] . '-01 00:00:00', \IntlDateFormatter::LONG) . '|999';
echo '';
print_r(get_class_methods($this));
echo '';
- die('test');
+ die('test');
*/
if(isset($time[1]) && $time[1]) {
- $month = date("F", mktime(0, 0, 0, $time[1], 1, $time[0]));
+ $month = date("F", mktime(0, 0, 0, $time[1], 1, $time[0]));
}
-
+
$year = $time[0];
$latest_page_title = $this->getConfig('blog_latest_page/page_title');
@@ -188,7 +188,7 @@ protected function _addBreadcrumbs()
]
);
}
-
+
}
}
@@ -214,7 +214,7 @@ public function getCollection(){
* @return $this
*/
protected function _prepareLayout()
- {
+ {
$time = $this->getRequest()->getParam('date');
$time = explode('-', $time);
$month = "";
@@ -228,12 +228,12 @@ protected function _prepareLayout()
} else {
$page_title = __('Yearly Archives: %1', $year);
}
-
+
$this->_addBreadcrumbs();
$this->pageConfig->addBodyClass('vesblog-page');
$this->pageConfig->addBodyClass('ves-archiveblog');
if($page_title){
- $this->pageConfig->getTitle()->set($page_title);
+ $this->pageConfig->getTitle()->set($page_title);
}
return parent::_prepareLayout();
}
@@ -254,12 +254,12 @@ public function getToolbarBlock()
public function getPostsBlock()
{
$collection = $this->getCollection();
- $block = $this->_postsBlock;
+ $block = $this->_postsBlock;
$block->setData($this->getData())->setCollection($collection);
$html = $block->toHtml();
if ($html) {
return $html;
- }
+ }
}
/**
@@ -303,7 +303,7 @@ protected function _beforeToHtml()
if($month) {
$postCollection->getSelect()->where('MONTH(creation_time) = ?', (int)$month);
}
-
+
$postCollection->getSelect()->order("post_id " . $orderby);
$this->setCollection($postCollection);
$toolbar = $this->getToolbarBlock();
@@ -315,4 +315,4 @@ protected function _beforeToHtml()
}
return parent::_beforeToHtml();
}
-}
\ No newline at end of file
+}
diff --git a/Block/Author/View.php b/Block/Author/View.php
index 73e7b5d..6b130d4 100644
--- a/Block/Author/View.php
+++ b/Block/Author/View.php
@@ -1,18 +1,18 @@
_blogHelper = $blogHelper;
$this->_coreRegistry = $registry;
$this->_postFactory = $postFactory;
@@ -159,7 +159,7 @@ protected function _addBreadcrumbs()
* @return $this
*/
protected function _prepareLayout()
- {
+ {
$author = $this->getAuthor();
$page_title = __('Author: ') . $author->getNickName();
$this->_addBreadcrumbs();
@@ -171,13 +171,13 @@ protected function _prepareLayout()
$page_title = $author_page_title?$author_page_title:$page_title;
if($page_title){
- $this->pageConfig->getTitle()->set($page_title);
+ $this->pageConfig->getTitle()->set($page_title);
}
if($meta_keywords){
- $this->pageConfig->setKeywords($meta_keywords);
+ $this->pageConfig->setKeywords($meta_keywords);
}
if($meta_description){
- $this->pageConfig->setDescription($meta_description);
+ $this->pageConfig->setDescription($meta_description);
}
return parent::_prepareLayout();
}
@@ -208,13 +208,13 @@ public function getToolbarBlock()
public function getPostsBlock()
{
$collection = $this->getCollection();
- $block = $this->_postsBlock;
+ $block = $this->_postsBlock;
$block->setData($this->getData())->setCollection($collection);
$html = $block->toHtml();
if ($html) {
return $html;
- }
+ }
}
/**
@@ -230,7 +230,7 @@ protected function _beforeToHtml()
$this->setData('show_toolbartop', $show_toolbartop);
$this->setData('show_toolbarbottom', $show_toolbarbottom);
$this->setData('layout_type', $layout_type);
-
+
$postsStyles = $this->getConfig('blog_page/posts_styles');
$postsStyles = $postsStyles?$postsStyles:'style1';
$postsBlock = $this->getLayout()->getBlock('blog.posts.list');
@@ -263,4 +263,4 @@ protected function _beforeToHtml()
}
return parent::_beforeToHtml();
}
-}
\ No newline at end of file
+}
diff --git a/Block/Authors/View.php b/Block/Authors/View.php
index 60f2ee5..4a9770b 100644
--- a/Block/Authors/View.php
+++ b/Block/Authors/View.php
@@ -1,18 +1,18 @@
_blogHelper = $blogHelper;
$this->_coreRegistry = $registry;
$this->_authorFactory = $authorFactory;
@@ -138,7 +138,7 @@ protected function _addBreadcrumbs()
* @return $this
*/
protected function _prepareLayout()
- {
+ {
$page_title = __('All Blog Authors');
$this->_addBreadcrumbs();
$this->pageConfig->addBodyClass('vesblog-page blogauthor-list');
@@ -147,13 +147,13 @@ protected function _prepareLayout()
$meta_keywords = __("all blog authors");
if($page_title){
- $this->pageConfig->getTitle()->set($page_title);
+ $this->pageConfig->getTitle()->set($page_title);
}
if($meta_keywords){
- $this->pageConfig->setKeywords($meta_keywords);
+ $this->pageConfig->setKeywords($meta_keywords);
}
if($meta_description){
- $this->pageConfig->setDescription($meta_description);
+ $this->pageConfig->setDescription($meta_description);
}
return parent::_prepareLayout();
}
@@ -192,7 +192,7 @@ protected function _beforeToHtml()
$show_toolbarbottom = $this->_blogHelper->getConfig("blog_page/show_toolbartop");
$layout_type = $this->_blogHelper->getConfig("blog_page/layout_type");
$show_posts_count = $this->_blogHelper->getConfig("other_settings/show_posts_count");
-
+
$this->setData('show_toolbartop', $show_toolbartop);
$this->setData('show_toolbarbottom', $show_toolbarbottom);
$this->setData('layout_type', $layout_type);
@@ -224,4 +224,4 @@ protected function _beforeToHtml()
}
return parent::_beforeToHtml();
}
-}
\ No newline at end of file
+}
diff --git a/Block/Category/CategoryList.php b/Block/Category/CategoryList.php
index d38fec2..5025d3e 100644
--- a/Block/Category/CategoryList.php
+++ b/Block/Category/CategoryList.php
@@ -1,18 +1,18 @@
_blogHelper = $blogHelper;
$this->_category = $category;
@@ -65,7 +65,8 @@ public function drawItems($collection, $cat, $level = 0){
return $cat;
}
- public function _toHtml(){
+ public function _toHtml()
+ {
if(!$this->_blogHelper->getConfig('general_settings/enable')) return;
$store = $this->_storeManager->getStore();
$collection = $this->_category->getCollection()
@@ -116,4 +117,4 @@ public function setCollection($collection){
public function getCollection(){
return $this->_collection;
}
-}
\ No newline at end of file
+}
diff --git a/Block/Category/View.php b/Block/Category/View.php
index 485a17e..69275a2 100644
--- a/Block/Category/View.php
+++ b/Block/Category/View.php
@@ -1,18 +1,18 @@
_blogHelper = $blogHelper;
$this->_coreRegistry = $registry;
$this->_postFactory = $postFactory;
@@ -161,7 +161,7 @@ public function getCollection(){
* @return $this
*/
protected function _prepareLayout()
- {
+ {
$category = $this->getCategory();
if($category) {
$page_title = $category->getPageTitle();
@@ -173,13 +173,13 @@ protected function _prepareLayout()
$this->pageConfig->addBodyClass('vesblog-page');
$this->pageConfig->addBodyClass('blog-cat-' . $category->getIdentifier());
if($page_title){
- $this->pageConfig->getTitle()->set($page_title);
+ $this->pageConfig->getTitle()->set($page_title);
}
if($meta_keywords){
- $this->pageConfig->setKeywords($meta_keywords);
+ $this->pageConfig->setKeywords($meta_keywords);
}
if($meta_description){
- $this->pageConfig->setDescription($meta_description);
+ $this->pageConfig->setDescription($meta_description);
}
}
return parent::_prepareLayout();
@@ -211,7 +211,7 @@ public function getPostsBlock()
$html = $block->toHtml();
if ($html) {
return $html;
- }
+ }
}
/**
@@ -236,7 +236,7 @@ protected function _beforeToHtml()
$data = $postsBlock->getData();
unset($data['type']);
$this->addData($data);
-
+
$store = $this->_storeManager->getStore();
$itemsperpage = (int)$category->getData('item_per_page');
$orderby = $category->getOrderby();
@@ -278,4 +278,4 @@ protected function _beforeToHtml()
}
return parent::_beforeToHtml();
}
-}
\ No newline at end of file
+}
diff --git a/Block/Comment/RecentComments.php b/Block/Comment/RecentComments.php
index e871355..2337070 100644
--- a/Block/Comment/RecentComments.php
+++ b/Block/Comment/RecentComments.php
@@ -1,18 +1,18 @@
_blogHelper = $blogHelper;
$this->_comment = $comment;
$this->_post = $post;
}
- public function _toHtml(){
+ public function _toHtml()
+ {
if(!$this->getConfig('general_settings/enable') || !$this->getConfig('sidebar/show_recentcommentsblock')) return;
if($this->getConfig('general_settings/disable_comment')) return;
-
+
$store = $this->_storeManager->getStore();
$itemPerPage = $this->_blogHelper->getConfig('sidebar/comments_per_page');
@@ -103,7 +104,7 @@ public function _toHtml(){
}
$this->setData("posts", $posts);
- $this->setCollection($collection);
+ $this->setCollection($collection);
return parent::_toHtml();
}
@@ -141,4 +142,4 @@ public function getConfig($key, $default = '')
}
return $result;
}
-}
\ No newline at end of file
+}
diff --git a/Block/InitAjaxscroll.php b/Block/InitAjaxscroll.php
index adfd9b5..102ec1e 100644
--- a/Block/InitAjaxscroll.php
+++ b/Block/InitAjaxscroll.php
@@ -1,81 +1,80 @@
-helperData = $helperData;
- $this->coreRegistry = $registry;
- }
-
-
-
- public function isEnable() {
- $fullAction = $this->getRequest()->getFullActionName();
- $enable_latest = $this->helperData->getConfig('ajaxscroll_selectors/enable_latest');
- $enable_category = $this->helperData->getConfig('ajaxscroll_selectors/enable_category');
- $enable_search = $this->helperData->getConfig('ajaxscroll_selectors/enable_search');
- $enable_archive = $this->helperData->getConfig('ajaxscroll_selectors/enable_archive');
- $enable_tag = $this->helperData->getConfig('ajaxscroll_selectors/enable_tag');
- $enable_author = $this->helperData->getConfig('ajaxscroll_selectors/enable_author');
- $enable_comment = $this->helperData->getConfig('ajaxscroll_selectors/enable_comment');
- if (($enable_latest && $fullAction == 'vesblog_latest_view') || ($enable_category && $fullAction == 'vesblog_category_view')|| ($enable_search && $fullAction == 'vesblog_search_result')|| ($enable_archive && $fullAction == 'vesblog_archive_view')|| ($enable_tag && $fullAction == 'vesblog_tag_view')|| ($enable_author && $fullAction == 'vesblog_author_view')|| ($enable_comment && $fullAction == 'vesblog_post_view')) {
- return true;
- }
-
- return false;
- }
-
- /**
- * @return bool|false
- */
- public function getLoaderImage()
- {
-
- $url = $this->helperData->getConfig('ajaxscroll_selectors/loading_image');
- if(!empty($url)) {
- $url = strpos($url, 'http') === 0 ? $url : $this->getViewFileUrl($url);
- }
- return empty($url) ? false : $url;
- }
-}
+helperData = $helperData;
+ $this->coreRegistry = $registry;
+ }
+
+ public function isEnable()
+ {
+ $fullAction = $this->getRequest()->getFullActionName();
+ $enable_latest = $this->helperData->getConfig('ajaxscroll_selectors/enable_latest');
+ $enable_category = $this->helperData->getConfig('ajaxscroll_selectors/enable_category');
+ $enable_search = $this->helperData->getConfig('ajaxscroll_selectors/enable_search');
+ $enable_archive = $this->helperData->getConfig('ajaxscroll_selectors/enable_archive');
+ $enable_tag = $this->helperData->getConfig('ajaxscroll_selectors/enable_tag');
+ $enable_author = $this->helperData->getConfig('ajaxscroll_selectors/enable_author');
+ $enable_comment = $this->helperData->getConfig('ajaxscroll_selectors/enable_comment');
+ if (($enable_latest && $fullAction == 'vesblog_latest_view') || ($enable_category && $fullAction == 'vesblog_category_view')|| ($enable_search && $fullAction == 'vesblog_search_result')|| ($enable_archive && $fullAction == 'vesblog_archive_view')|| ($enable_tag && $fullAction == 'vesblog_tag_view')|| ($enable_author && $fullAction == 'vesblog_author_view')|| ($enable_comment && $fullAction == 'vesblog_post_view')) {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * @return bool|false
+ */
+ public function getLoaderImage()
+ {
+
+ $url = $this->helperData->getConfig('ajaxscroll_selectors/loading_image');
+ if(!empty($url)) {
+ $url = strpos($url, 'http') === 0 ? $url : $this->getViewFileUrl($url);
+ }
+ return empty($url) ? false : $url;
+ }
+}
diff --git a/Block/Latest.php b/Block/Latest.php
index 401ee04..9cf0c68 100644
--- a/Block/Latest.php
+++ b/Block/Latest.php
@@ -1,18 +1,18 @@
_blogHelper = $blogHelper;
$this->_coreRegistry = $registry;
$this->_postFactory = $postFactory;
@@ -169,7 +169,7 @@ public function getCollection(){
* @return $this
*/
protected function _prepareLayout()
- {
+ {
$page_title = $this->getConfig('blog_latest_page/page_title');
$meta_description = $this->getConfig('blog_latest_page/meta_description');
$meta_keywords = $this->getConfig('blog_latest_page/meta_keywords');
@@ -178,13 +178,13 @@ protected function _prepareLayout()
$this->pageConfig->addBodyClass('vesblog-page');
$this->pageConfig->addBodyClass('ves-bloglatest');
if($page_title){
- $this->pageConfig->getTitle()->set($page_title);
+ $this->pageConfig->getTitle()->set($page_title);
}
if($meta_keywords){
- $this->pageConfig->setKeywords($meta_keywords);
+ $this->pageConfig->setKeywords($meta_keywords);
}
if($meta_description){
- $this->pageConfig->setDescription($meta_description);
+ $this->pageConfig->setDescription($meta_description);
}
return parent::_prepareLayout();
}
@@ -205,12 +205,12 @@ public function getToolbarBlock()
public function getPostsBlock()
{
$collection = $this->getCollection();
- $block = $this->_postsBlock;
+ $block = $this->_postsBlock;
$block->setData($this->getData())->setCollection($collection);
$html = $block->toHtml();
if ($html) {
return $html;
- }
+ }
}
/**
@@ -246,7 +246,8 @@ protected function _beforeToHtml()
->setCurPage(1);
$excluedCategories = $this->_blogHelper->getConfig("blog_latest_page/exclued_categories");
- if (trim($excluedCategories)) {
+ $excluedCategories = $excluedCategories ? trim($excluedCategories) : "";
+ if ($excluedCategories) {
$postCollection->getSelect()->joinLeft(
[
'cat' => $this->_resource->getTableName('ves_blog_post_category')],
@@ -258,7 +259,7 @@ protected function _beforeToHtml()
'category_id' => 'category_id'
]
)
- ->where('cat.category_id NOT IN (' . trim($excluedCategories) . ')');
+ ->where('cat.category_id NOT IN (' . $excluedCategories. ')');
}
$postCollection->getSelect()->order("main_table.creation_time " . $orderby);
@@ -272,4 +273,4 @@ protected function _beforeToHtml()
}
return parent::_beforeToHtml();
}
-}
\ No newline at end of file
+}
diff --git a/Block/LatestRssLink.php b/Block/LatestRssLink.php
index fb97593..41ac0ec 100644
--- a/Block/LatestRssLink.php
+++ b/Block/LatestRssLink.php
@@ -1,18 +1,18 @@
_bloghelper->getConfig("general_settings/latestpagerss")) return;
return parent::_toHtml();
}
@@ -88,7 +89,7 @@ protected function getLinkParams()
return [
'type' => 'post_latest'
];
- }
+ }
/**
* @return string
@@ -97,4 +98,4 @@ public function getLink()
{
return $this->getUrl("vesblog/feed/index",$this->getLinkParams());
}
-}
\ No newline at end of file
+}
diff --git a/Block/Post/Comment.php b/Block/Post/Comment.php
index 5feae9d..5f8f0d3 100644
--- a/Block/Post/Comment.php
+++ b/Block/Post/Comment.php
@@ -1,18 +1,18 @@
_blogHelper = $blogHelper;
$this->_coreRegistry = $registry;
$this->_comment = $comment;
@@ -104,7 +104,7 @@ protected function _construct()
public function _toHtml(){
if(!$this->getConfig('general_settings/enable') || !$this->getConfig('post_page/enable_commentblock')) return;
if($this->getConfig('general_settings/disable_comment')) return;
-
+
return parent::_toHtml();
}
@@ -117,7 +117,7 @@ public function getCommentsByParentId($parent_id = 0){
->addFieldToFilter("main_table.parent_id", $parent_id)
->addStoreFilter($store)
->setOrder("main_table.creation_time", "DESC");
-
+
return $collection;
}
protected function _beforeToHtml()
@@ -208,4 +208,4 @@ public function getCustomer()
}
-}
\ No newline at end of file
+}
diff --git a/Block/Post/NextPrevPosts.php b/Block/Post/NextPrevPosts.php
index 4b78c31..170c78d 100644
--- a/Block/Post/NextPrevPosts.php
+++ b/Block/Post/NextPrevPosts.php
@@ -1,18 +1,18 @@
_blogHelper = $blogHelper;
$this->_coreRegistry = $registry;
$this->_postFactory = $postFactory;
@@ -70,7 +70,7 @@ public function __construct(
}
public function getConfig($key, $default = '')
- {
+ {
$c = explode("/", $key);
if(count($c)==2){
if($this->hasData($c[1])){
@@ -154,10 +154,10 @@ protected function _beforeToHtml()
->where('main_table.post_id != ?', $post->getId())
->order($filter_field.' ASC')
->limit(1);
-
-
+
+
$this->setPrevCollection($postPrevCollection);
$this->setNextCollection($postNextCollection);
return parent::_beforeToHtml();
}
-}
\ No newline at end of file
+}
diff --git a/Block/Post/ProductsRelated.php b/Block/Post/ProductsRelated.php
index 983b79a..c7bf131 100644
--- a/Block/Post/ProductsRelated.php
+++ b/Block/Post/ProductsRelated.php
@@ -1,141 +1,141 @@
-_blogHelper = $blogHelper;
- $this->productCollectionFactory = $productCollectionFactory;
- $this->catalogProductVisibility = $catalogProductVisibility;
- parent::__construct($context);
- }
-
- /**
- * Set brand collection
- * @param \Ves\Blog\Model\Post
- */
- public function setCollection($collection)
- {
- $this->_collection = $collection;
- return $this->_collection;
- }
-
- public function getCollection(){
- return $this->_collection;
- }
-
- public function _toHtml(){
- $post = $this->getPost();
- if(!$this->_blogHelper->getConfig('general_settings/enable') || !$post->getIsActive()) return;
- if(!$this->_blogHelper->getConfig('post_page/enable_related_products')) return;
-
- $productsIds = $post->getProducts();
- $collection = $this->productCollectionFactory->create();
- $collection->setVisibility($this->catalogProductVisibility->getVisibleInCatalogIds());
- $collection = $this->_addProductAttributesAndPrices($collection)
- ->addAttributeToFilter('entity_id', ['in' => $productsIds])
- ->setCurPage(1);
- $this->setCollection($collection);
- return parent::_toHtml();
- }
-
- public function getPost(){
- $post = $this->_coreRegistry->registry('current_post');
- return $post;
- }
-
- /**
- * Return HTML block with price
- *
- * @param \Magento\Catalog\Model\Product $product
- * @return string
- */
- public function getVesProductPriceHtml(
- \Magento\Catalog\Model\Product $product,
- $priceType = null,
- $renderZone = \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST,
- array $arguments = []
- ) {
- if (!isset($arguments['zone'])) {
- $arguments['zone'] = $renderZone;
- }
- $arguments['price_id'] = isset($arguments['price_id'])
- ? $arguments['price_id']
- : 'old-price-' . $product->getId() . '-' . $priceType;
- $arguments['include_container'] = isset($arguments['include_container'])
- ? $arguments['include_container']
- : true;
- $arguments['display_minimal_price'] = isset($arguments['display_minimal_price'])
- ? $arguments['display_minimal_price']
- : true;
- $priceRender = $this->getLayout()->getBlock('product.price.render.default');
-
- $price = '';
- if ($priceRender) {
- $price = $priceRender->render(
- \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE,
- $product,
- $arguments
- );
- }
- return $price;
- }
-}
\ No newline at end of file
+_blogHelper = $blogHelper;
+ $this->productCollectionFactory = $productCollectionFactory;
+ $this->catalogProductVisibility = $catalogProductVisibility;
+ parent::__construct($context, $data);
+ }
+
+ /**
+ * Set brand collection
+ * @param \Ves\Blog\Model\Post
+ */
+ public function setCollection($collection)
+ {
+ $this->_collection = $collection;
+ return $this->_collection;
+ }
+
+ public function getCollection(){
+ return $this->_collection;
+ }
+
+ public function _toHtml(){
+ $post = $this->getPost();
+ if(!$this->_blogHelper->getConfig('general_settings/enable') || !$post->getIsActive()) return;
+ if(!$this->_blogHelper->getConfig('post_page/enable_related_products')) return;
+
+ $productsIds = $post->getProducts();
+ $collection = $this->productCollectionFactory->create();
+ $collection->setVisibility($this->catalogProductVisibility->getVisibleInCatalogIds());
+ $collection = $this->_addProductAttributesAndPrices($collection)
+ ->addAttributeToFilter('entity_id', ['in' => $productsIds])
+ ->setCurPage(1);
+ $this->setCollection($collection);
+ return parent::_toHtml();
+ }
+
+ public function getPost(){
+ $post = $this->_coreRegistry->registry('current_post');
+ return $post;
+ }
+
+ /**
+ * Return HTML block with price
+ *
+ * @param \Magento\Catalog\Model\Product $product
+ * @return string
+ */
+ public function getVesProductPriceHtml(
+ \Magento\Catalog\Model\Product $product,
+ $priceType = null,
+ $renderZone = \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST,
+ array $arguments = []
+ ) {
+ if (!isset($arguments['zone'])) {
+ $arguments['zone'] = $renderZone;
+ }
+ $arguments['price_id'] = isset($arguments['price_id'])
+ ? $arguments['price_id']
+ : 'old-price-' . $product->getId() . '-' . $priceType;
+ $arguments['include_container'] = isset($arguments['include_container'])
+ ? $arguments['include_container']
+ : true;
+ $arguments['display_minimal_price'] = isset($arguments['display_minimal_price'])
+ ? $arguments['display_minimal_price']
+ : true;
+ $priceRender = $this->getLayout()->getBlock('product.price.render.default');
+
+ $price = '';
+ if ($priceRender) {
+ $price = $priceRender->render(
+ \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE,
+ $product,
+ $arguments
+ );
+ }
+ return $price;
+ }
+}
diff --git a/Block/Post/RecentPosts.php b/Block/Post/RecentPosts.php
index 8278cb0..c3de4d7 100644
--- a/Block/Post/RecentPosts.php
+++ b/Block/Post/RecentPosts.php
@@ -1,18 +1,18 @@
_blogHelper = $blogHelper;
$this->_post = $post;
@@ -94,7 +94,7 @@ public function getCollection()
}
public function getConfig($key, $default = '')
- {
+ {
$c = explode("/", $key);
if(count($c)==2){
if($this->hasData($c[1])){
@@ -106,4 +106,4 @@ public function getConfig($key, $default = '')
}
return $default;
}
-}
\ No newline at end of file
+}
diff --git a/Block/Post/Related.php b/Block/Post/Related.php
index 39e2161..df2e566 100644
--- a/Block/Post/Related.php
+++ b/Block/Post/Related.php
@@ -1,18 +1,18 @@
_blogHelper = $blogHelper;
$this->_coreRegistry = $registry;
$this->_postFactory = $postFactory;
@@ -70,7 +70,7 @@ public function __construct(
}
public function getConfig($key, $default = '')
- {
+ {
$c = explode("/", $key);
if(count($c)==2){
if($this->hasData($c[1])){
@@ -92,7 +92,7 @@ public function _toHtml(){
$post = $this->getPost();
if(!$this->_blogHelper->getConfig('general_settings/enable') || !$post->getIsActive()) return;
if(!$this->_blogHelper->getConfig('post_page/enable_related')) return;
-
+
return parent::_toHtml();
}
@@ -127,7 +127,7 @@ protected function _beforeToHtml()
if(!$this->_blogHelper->getConfig('general_settings/enable') || !$post->getIsActive()) parent::_beforeToHtml();
if(!$this->_blogHelper->getConfig('post_page/enable_related')) parent::_beforeToHtml();
$store = $this->_storeManager->getStore();
-
+
$postCollection = $this->_postFactory->getCollection()
->addFieldToFilter('is_active',1)
->addStoreFilter($store)
@@ -147,4 +147,4 @@ protected function _beforeToHtml()
$this->setCollection($postCollection);
return parent::_beforeToHtml();
}
-}
\ No newline at end of file
+}
diff --git a/Block/Post/View.php b/Block/Post/View.php
index eb94ea7..468d426 100644
--- a/Block/Post/View.php
+++ b/Block/Post/View.php
@@ -1,18 +1,18 @@
_url = $url;
$this->_blogHelper = $blogHelper;
$this->_coreRegistry = $registry;
@@ -175,7 +175,7 @@ public function getCollection(){
* @return $this
*/
protected function _prepareLayout()
- {
+ {
$post = $this->getPost();
if($post){
$page_title = $post->getPageTitle();
@@ -189,13 +189,13 @@ protected function _prepareLayout()
$this->pageConfig->addBodyClass('vesblog-page');
$this->pageConfig->addBodyClass('blog-post-' . $post->getIdentifier());
if($page_title && $show_title){
- $this->pageConfig->getTitle()->set($page_title);
+ $this->pageConfig->getTitle()->set($page_title);
}
if($meta_keywords){
- $this->pageConfig->setKeywords($meta_keywords);
+ $this->pageConfig->setKeywords($meta_keywords);
}
if($meta_description){
- $this->pageConfig->setDescription($meta_description);
+ $this->pageConfig->setDescription($meta_description);
}
}
return parent::_prepareLayout();
@@ -205,4 +205,4 @@ public function getPost(){
$post = $this->_coreRegistry->registry('current_post');
return $post;
}
-}
\ No newline at end of file
+}
diff --git a/Block/Product/View.php b/Block/Product/View.php
index 2741b34..892310d 100644
--- a/Block/Product/View.php
+++ b/Block/Product/View.php
@@ -1,18 +1,18 @@
_blogHelper = $blogHelper;
$this->_coreRegistry = $registry;
$this->_postFactory = $postFactory;
diff --git a/Block/Search/Result.php b/Block/Search/Result.php
index 4f483a2..9a199d7 100644
--- a/Block/Search/Result.php
+++ b/Block/Search/Result.php
@@ -65,7 +65,7 @@ public function __construct(
\Ves\Blog\Model\Post $postFactory,
\Ves\Blog\Helper\Data $blogHelper,
array $data = []
- ) {
+ ) {
$this->_blogHelper = $blogHelper;
$this->_coreRegistry = $registry;
$this->_postFactory = $postFactory;
diff --git a/Block/Tag/TagList.php b/Block/Tag/TagList.php
index 78fcecf..966de74 100644
--- a/Block/Tag/TagList.php
+++ b/Block/Tag/TagList.php
@@ -1,18 +1,18 @@
_blogHelper = $blogHelper;
$this->_tag = $tag;
}
- public function _toHtml(){
+ public function _toHtml()
+ {
$itemPerPage = $this->_blogHelper->getConfig('sidebar/tags_per_page');
if($this->getConfig('item_per_page')){
$itemPerPage = $this->getConfig('item_per_page');
@@ -86,7 +87,7 @@ public function _toHtml(){
}
public function getConfig($key, $default = '')
- {
+ {
$c = explode("/", $key);
if(count($c)==2){
if($this->hasData($c[1])){
@@ -98,4 +99,4 @@ public function getConfig($key, $default = '')
}
return $default;
}
-}
\ No newline at end of file
+}
diff --git a/Block/Tag/View.php b/Block/Tag/View.php
index 339ece0..207f985 100644
--- a/Block/Tag/View.php
+++ b/Block/Tag/View.php
@@ -1,18 +1,18 @@
_blogHelper = $blogHelper;
$this->_coreRegistry = $registry;
$this->_postFactory = $postFactory;
@@ -191,13 +191,13 @@ public function getToolbarBlock()
public function getPostsBlock()
{
$collection = $this->getCollection();
- $block = $this->_postsBlock;
+ $block = $this->_postsBlock;
$block->setData($this->getData())->setCollection($collection);
$html = $block->toHtml();
if ($html) {
return $html;
- }
+ }
}
/**
@@ -248,4 +248,4 @@ protected function _beforeToHtml()
}
return parent::_beforeToHtml();
}
-}
\ No newline at end of file
+}
diff --git a/Block/Toplinks.php b/Block/Toplinks.php
index ca74277..3abd32b 100644
--- a/Block/Toplinks.php
+++ b/Block/Toplinks.php
@@ -1,18 +1,18 @@
_helper = $helper;
}
@@ -42,11 +42,11 @@ public function __construct(
* @return string
*/
protected function _toHtml()
- {
+ {
if(!$this->_helper->getConfig('general_settings/enable')) return;
$page_title = $this->_helper->getConfig('blog_latest_page/page_title');
$route = $this->_helper->getLatestPageUrl();
$link = ' ' . $page_title . ' ';
return $link;
}
-}
\ No newline at end of file
+}
diff --git a/Block/Widget/Posts.php b/Block/Widget/Posts.php
index 0a4134c..39acf7e 100644
--- a/Block/Widget/Posts.php
+++ b/Block/Widget/Posts.php
@@ -1,18 +1,18 @@
_blogHelper = $blogHelper;
$this->_post = $post;
$this->_cat = $cat;
@@ -109,7 +109,7 @@ public function _toHtml(){
]
)
->where('cat.category_id in (?)', $categories);
- }
+ }
$collection->getSelect()->limit($itemPerPage)
->group('main_table.post_id');
$orderBy = $this->getConfig("orderby");
@@ -176,11 +176,11 @@ public function getBlogTypeCollection($type) {
)
->where('cat.category_id in (?)', $categories);
if($type == 'popular') {
- $typeCollection->getSelect()->order("main_table.hits DESC");
+ $typeCollection->getSelect()->order("main_table.hits DESC");
}elseif($type == 'random') {
$typeCollection->getSelect()->order('RAND()');
}elseif($type == 'recents') {
- $typeCollection->getSelect()->order("main_table.creation_time DESC");
+ $typeCollection->getSelect()->order("main_table.creation_time DESC");
}elseif ($type == 'rate') {
$typeCollection->getSelect()->order("main_table.like DESC");
}
@@ -218,4 +218,4 @@ public function getConfig($key, $default = '')
}
return $default;
}
-}
\ No newline at end of file
+}
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f729724..8207d86 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,2 +1,6 @@
# 1.0.10 - 08/17/2021
-- Release Lof_ElasticsuiteBlog: a Smile_ElasticSuite addon
\ No newline at end of file
+- Release Lof_ElasticsuiteBlog: a Smile_ElasticSuite addon
+
+# 1.0.12 - 01/25/2024
+- Compatible magento 2.4.x, PHP 8.1, PHP 8.2
+- Remove Addthis widget (social share settings)
diff --git a/Controller/Adminhtml/Author/Edit.php b/Controller/Adminhtml/Author/Edit.php
index 715b49e..7e8711b 100644
--- a/Controller/Adminhtml/Author/Edit.php
+++ b/Controller/Adminhtml/Author/Edit.php
@@ -1,128 +1,131 @@
-resultPageFactory = $resultPageFactory;
- $this->authSession = $authSession;
- $this->_coreRegistry = $registry;
- parent::__construct($context);
- }
-
- public function getCurrentUser()
- {
- return $this->authSession->getUser();
- }
-
- /**
- * {@inheritdoc}
- */
- protected function _isAllowed()
- {
- return $this->_authorization->isAllowed('Ves_Blog::author');
- }
-
- /**
- * Init actions
- *
- * @return \Magento\Backend\Model\View\Result\Page
- */
- protected function _initAction()
- {
- // load layout, set active menu and breadcrumbs
- /** @var \Magento\Backend\Model\View\Result\Page $resultPage */
- $resultPage = $this->resultPageFactory->create();
- $resultPage->setActiveMenu('Ves_Blog::blog')
- ->addBreadcrumb(__('Blog'), __('Blog'))
- ->addBreadcrumb(__('My Profile'), __('My Profile'));
- return $resultPage;
- }
-
- /**
- * Edit CMS page
- *
- * @return \Magento\Backend\Model\View\Result\Page|\Magento\Backend\Model\View\Result\Redirect
- * @SuppressWarnings(PHPMD.NPathComplexity)
- */
- public function execute()
- {
- // 1. Get ID and create model
- $author_id = $this->getRequest()->getParam('author_id');
- $id = $this->getCurrentUser()->getUserId();
- $model = $this->_objectManager->create('Ves\Blog\Model\Author');
-
- // 2. Initial checking
- if($author_id) {
- $model->load($author_id);
- }elseif ($id) {
- $model->loadByUserId($id);
- if (!$model->getId()) {
- $data = $this->getCurrentUser()->getData();
- $data['nick_name'] = $data['firstname'] . ' ' . $data['lastname'];
- $model->setData($data)->save();
- }
- }
-
- // 3. Set entered data if was error when we do save
- $data = $this->_objectManager->get('Magento\Backend\Model\Session')->getFormData(true);
- if (!empty($data)) {
- $model->setData($data);
- }
-
- // 4. Register model to use later in blocks
- $this->_coreRegistry->register('current_author', $model);
-
-
- // 5. Build edit form
- /** @var \Magento\Backend\Model\View\Result\Page $resultPage */
- $resultPage = $this->_initAction();
- $resultPage->getConfig()->getTitle()->prepend(__('Author: ' . $model->getNickName()));
-
- return $resultPage;
- }
-}
+resultPageFactory = $resultPageFactory;
+ $this->authSession = $authSession;
+ $this->_coreRegistry = $registry;
+ parent::__construct($context);
+ }
+
+ public function getCurrentUser()
+ {
+ return $this->authSession->getUser();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function _isAllowed()
+ {
+ return $this->_authorization->isAllowed('Ves_Blog::author');
+ }
+
+ /**
+ * Init actions
+ *
+ * @return \Magento\Backend\Model\View\Result\Page
+ */
+ protected function _initAction()
+ {
+ // load layout, set active menu and breadcrumbs
+ /** @var \Magento\Backend\Model\View\Result\Page $resultPage */
+ $resultPage = $this->resultPageFactory->create();
+ $resultPage->setActiveMenu('Ves_Blog::blog')
+ ->addBreadcrumb(__('Blog'), __('Blog'))
+ ->addBreadcrumb(__('My Profile'), __('My Profile'));
+ return $resultPage;
+ }
+
+ /**
+ * Edit CMS page
+ *
+ * @return \Magento\Backend\Model\View\Result\Page|\Magento\Backend\Model\View\Result\Redirect
+ * @SuppressWarnings(PHPMD.NPathComplexity)
+ */
+ public function execute()
+ {
+ // 1. Get ID and create model
+ $author_id = $this->getRequest()->getParam('author_id');
+ $id = $this->getCurrentUser()->getUserId();
+ $model = $this->_objectManager->create('Ves\Blog\Model\Author');
+
+ // 2. Initial checking
+ if($author_id) {
+ $model->load($author_id);
+ }elseif ($id) {
+ $model->loadByUserId($id);
+ if (!$model->getId()) {
+ $data = $this->getCurrentUser()->getData();
+ $data['nick_name'] = $data['firstname'] . ' ' . $data['lastname'];
+ $model->setData($data)->save();
+ }
+ }
+
+ // 3. Set entered data if was error when we do save
+ $data = $this->_objectManager->get('Magento\Backend\Model\Session')->getFormData(true);
+ if (!empty($data)) {
+ $model->setData($data);
+ }
+
+ // 4. Register model to use later in blocks
+ $this->_coreRegistry->register('current_author', $model);
+
+
+ // 5. Build edit form
+ /** @var \Magento\Backend\Model\View\Result\Page $resultPage */
+ $resultPage = $this->_initAction();
+ $resultPage->getConfig()->getTitle()->prepend(__('Author: ' . $model->getNickName()));
+
+ return $resultPage;
+ }
+}
diff --git a/Controller/Adminhtml/Category/Save.php b/Controller/Adminhtml/Category/Save.php
index d1cf083..88a02f0 100644
--- a/Controller/Adminhtml/Category/Save.php
+++ b/Controller/Adminhtml/Category/Save.php
@@ -1,18 +1,18 @@
_fileSystem = $filesystem;
$this->jsHelper = $jsHelper;
parent::__construct($context);
@@ -66,7 +66,7 @@ protected function _isAllowed()
*/
public function execute()
{
- $data = $this->getRequest()->getPostValue();
+ $data = $this->getRequest()->getPostValue();
$links = $this->getRequest()->getPost('links');
$links = is_array($links) ? $links : [];
@@ -101,7 +101,7 @@ public function execute()
unset($data['image']);
}
if($image = $this->uploadImage('image')){
-
+
$data['image'] = $image;
}
}
@@ -111,7 +111,7 @@ public function execute()
$identifier = strtolower($identifier);
$identifier = str_replace(" ","-",$identifier);
$data['identifier'] = $identifier;
-
+
$model->setData($data);
try {
$model->save();
@@ -139,7 +139,7 @@ public function uploadImage($fieldId = 'image')
{
$resultRedirect = $this->resultRedirectFactory->create();
- if (isset($_FILES[$fieldId]) && $_FILES[$fieldId]['name']!='')
+ if (isset($_FILES[$fieldId]) && $_FILES[$fieldId]['name']!='')
{
$uploader = $this->_objectManager->create(
'Magento\Framework\File\Uploader',
@@ -150,7 +150,7 @@ public function uploadImage($fieldId = 'image')
->getDirectoryRead(DirectoryList::MEDIA);
$mediaFolder = 'ves/blog/';
try {
- $uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
+ $uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
$uploader->setAllowRenameFiles(true);
$uploader->setFilesDispersion(false);
$file_name = $uploader->getUploadedFileName();
@@ -167,4 +167,4 @@ public function uploadImage($fieldId = 'image')
return;
}
-}
\ No newline at end of file
+}
diff --git a/Controller/Adminhtml/Comment/Save.php b/Controller/Adminhtml/Comment/Save.php
index d46ad5b..58274b8 100644
--- a/Controller/Adminhtml/Comment/Save.php
+++ b/Controller/Adminhtml/Comment/Save.php
@@ -1,18 +1,18 @@
_fileSystem = $filesystem;
$this->jsHelper = $jsHelper;
$this->authSession = $authSession;
@@ -80,7 +80,7 @@ public function execute()
$links = $this->getRequest()->getPost('links');
$links = is_array($links) ? $links : [];
-
+
if(!empty($links)){
$posts = $this->jsHelper->decodeGridSerializedInput($links['posts']);
$data['posts'] = $posts;
@@ -144,4 +144,4 @@ public function execute()
}
-}
\ No newline at end of file
+}
diff --git a/Controller/Adminhtml/Feed/Save.php b/Controller/Adminhtml/Feed/Save.php
index 0a050a4..8e36f9f 100644
--- a/Controller/Adminhtml/Feed/Save.php
+++ b/Controller/Adminhtml/Feed/Save.php
@@ -1,18 +1,18 @@
_fileSystem = $filesystem;
$this->jsHelper = $jsHelper;
$this->_logger = $logger;
@@ -83,7 +82,7 @@ public function execute()
$productsRelated = $this->jsHelper->decodeGridSerializedInput($links['related']);
$data['products_related'] = $productsRelated;
}
-
+
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
$resultRedirect = $this->resultRedirectFactory->create();
if ($data) {
@@ -206,7 +205,7 @@ public function uploadImage($fieldId = 'image')
{
$resultRedirect = $this->resultRedirectFactory->create();
- if (isset($_FILES[$fieldId]) && $_FILES[$fieldId]['name']!='')
+ if (isset($_FILES[$fieldId]) && $_FILES[$fieldId]['name']!='')
{
$uploader = $this->_objectManager->create(
'Magento\Framework\File\Uploader',
@@ -217,7 +216,7 @@ public function uploadImage($fieldId = 'image')
->getDirectoryRead(DirectoryList::MEDIA);
$mediaFolder = 'ves/blog/';
try {
- $uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
+ $uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
$uploader->setAllowRenameFiles(true);
$uploader->setFilesDispersion(false);
$file_name = $uploader->getUploadedFileName();
diff --git a/Controller/Adminhtml/Import/Run.php b/Controller/Adminhtml/Import/Run.php
index dda0b26..dea50b2 100644
--- a/Controller/Adminhtml/Import/Run.php
+++ b/Controller/Adminhtml/Import/Run.php
@@ -1,18 +1,18 @@
_wordpress = $wordpress;
$this->resultPageFactory = $resultPageFactory;
$this->_coreRegistry = $registry;
@@ -70,5 +72,5 @@ public function execute()
return $resultRedirect->setPath('*/*/index');
}
-
-}
\ No newline at end of file
+
+}
diff --git a/Controller/Adminhtml/Importer/Edit.php b/Controller/Adminhtml/Importer/Edit.php
index c5a56fc..8727f54 100644
--- a/Controller/Adminhtml/Importer/Edit.php
+++ b/Controller/Adminhtml/Importer/Edit.php
@@ -1,18 +1,18 @@
resultPageFactory = $resultPageFactory;
+ $this->importerFactory = $importerFactory;
$this->_coreRegistry = $registry;
parent::__construct($context);
}
@@ -85,7 +92,7 @@ public function execute()
{
// 1. Get ID and create model
$id = $this->getRequest()->getParam('importer_id');
- $model = $this->_objectManager->create('Ves\Blog\Model\Importer');
+ $model = $this->importerFactory->create();
// 2. Initial checking
if ($id) {
diff --git a/Controller/Adminhtml/Post/Builder.php b/Controller/Adminhtml/Post/Builder.php
index d0e4f1f..5df8129 100644
--- a/Controller/Adminhtml/Post/Builder.php
+++ b/Controller/Adminhtml/Post/Builder.php
@@ -1,18 +1,18 @@
postFactory;
$postId = (int)$request->getParam('post_id');
/** @var $product \Magento\Catalog\Model\Product */
diff --git a/Controller/Adminhtml/Post/Save.php b/Controller/Adminhtml/Post/Save.php
index 564a49c..0a726b4 100644
--- a/Controller/Adminhtml/Post/Save.php
+++ b/Controller/Adminhtml/Post/Save.php
@@ -1,18 +1,18 @@
_fileSystem = $filesystem;
$this->jsHelper = $jsHelper;
$this->_logger = $logger;
@@ -83,7 +84,7 @@ public function execute()
$productsRelated = $this->jsHelper->decodeGridSerializedInput($links['related']);
$data['products_related'] = $productsRelated;
}
-
+
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
$resultRedirect = $this->resultRedirectFactory->create();
if ($data) {
@@ -206,7 +207,7 @@ public function uploadImage($fieldId = 'image')
{
$resultRedirect = $this->resultRedirectFactory->create();
- if (isset($_FILES[$fieldId]) && $_FILES[$fieldId]['name']!='')
+ if (isset($_FILES[$fieldId]) && $_FILES[$fieldId]['name']!='')
{
$uploader = $this->_objectManager->create(
'Magento\Framework\File\Uploader',
@@ -217,7 +218,7 @@ public function uploadImage($fieldId = 'image')
->getDirectoryRead(DirectoryList::MEDIA);
$mediaFolder = 'ves/blog/';
try {
- $uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
+ $uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
$uploader->setAllowRenameFiles(true);
$uploader->setFilesDispersion(false);
$file_name = $uploader->getUploadedFileName();
diff --git a/Controller/Archive/View.php b/Controller/Archive/View.php
index 9d9d779..1063db2 100644
--- a/Controller/Archive/View.php
+++ b/Controller/Archive/View.php
@@ -1,18 +1,18 @@
resultForwardFactory->create();
return $resultForward->forward('defaultnoroute');
}
-
+
$date = $this->getRequest()->getParam('date');
$date = explode('-', $date);
$date[2] = '01';
diff --git a/Controller/Author/View.php b/Controller/Author/View.php
index cafbd1d..b897d49 100644
--- a/Controller/Author/View.php
+++ b/Controller/Author/View.php
@@ -1,18 +1,18 @@
resultPageFactory = $resultPageFactory;
$this->_blogHelper = $blogHelper;
$this->resultForwardFactory = $resultForwardFactory;
@@ -97,4 +98,4 @@ public function execute()
}
return $page;
}
-}
\ No newline at end of file
+}
diff --git a/Controller/Category/View.php b/Controller/Category/View.php
index d1f39f2..c3a749b 100644
--- a/Controller/Category/View.php
+++ b/Controller/Category/View.php
@@ -1,18 +1,18 @@
resultPageFactory = $resultPageFactory;
$this->_blogHelper = $blogHelper;
$this->resultForwardFactory = $resultForwardFactory;
@@ -96,4 +96,4 @@ public function execute()
}
return $page;
}
-}
\ No newline at end of file
+}
diff --git a/Controller/Post/View.php b/Controller/Post/View.php
index 1390e34..95a3fea 100644
--- a/Controller/Post/View.php
+++ b/Controller/Post/View.php
@@ -1,18 +1,18 @@
actionFactory = $actionFactory;
- $this->eventManager = $eventManager;
- $this->response = $response;
- $this->storeManager = $storeManager;
- $this->_blogHelper = $blogHelper;
- $this->_category = $category;
- $this->_post = $post;
- $this->_tag = $tag;
- $this->_author = $author;
- $this->_user = $userFactory;
- $this->_coreRegistry = $registry;
- $this->dispatched = false;
- }
-
- function startsWith($haystack, $needle) {
- if($haystack && $needle){
- return $needle === "" || strrpos($haystack, $needle, -strlen($haystack)) !== false;
- }
- return true;
- }
-
- function endsWith($haystack, $needle) {
- if($haystack && $needle){
- return $needle === "" || (($temp = strlen($haystack) - strlen($needle)) >= 0 && strpos($haystack, $needle, $temp) !== false);
- }
- return true;
- }
-
- /**
- * @param RequestInterface $request
- * @return \Magento\Framework\App\ActionInterface
- */
- public function match(RequestInterface $request)
- {
- $_blogHelper = $this->_blogHelper;
- $store = $this->storeManager->getStore();
-
- $enable = $_blogHelper->getConfig('general_settings/enable');
-
- if ($enable) {
-
- if (!$this->dispatched) {
- $urlKey = trim($request->getPathInfo(), '/');
- $origUrlKey = $urlKey;
- /** @var Object $condition */
- $condition = new DataObject(['url_key' => $urlKey, 'continue' => true]);
- $this->eventManager->dispatch(
- 'ves_blog_controller_router_match_before',
- [
- 'router' => $this,
- 'condition' => $condition
- ]
- );
- $urlKey = $condition->getUrlKey();
- if ($condition->getRedirectUrl()) {
- $this->response->setRedirect($condition->getRedirectUrl());
- $request->setDispatched(true);
- return $this->actionFactory->create(
- 'Magento\Framework\App\Action\Redirect',
- ['request' => $request]
- );
- }
-
- if (!$condition->getContinue()) {
- return null;
- }
-
- $urlPrefix = $_blogHelper->getConfig('general_settings/url_prefix');
- $urlSuffix = $_blogHelper->getConfig('general_settings/url_suffix');
- $authorsUrlPrefix = $_blogHelper->getConfig('other_settings/authors_url');
- $categoriesUrls = $_blogHelper->getConfig('general_settings/categories_urls');
- $post_uri_key = "post";
- $urlKeys = explode("/", $urlKey);
- $latestPageRoute = $_blogHelper->getConfig('blog_latest_page/route');
- $urlKeysOrgin = $urlKeys;
- $urlKeysOrgin = str_replace($urlSuffix, "", $urlKeysOrgin);
- $orig_list_authors_url = $urlPrefix."/author/list";
-
- if($urlPrefix == '') {
- $urlKeys[1] = $urlKeysOrgin[0];
- $urlKeys[0] = '';
- }
-
-
- // LATEST PAGE
- if(count($urlKeys) == 1 && $urlPrefix != '' && (str_replace($urlSuffix, "", $urlKeys[0]) == $urlPrefix)){
- $request->setModuleName('vesblog')
- ->setControllerName('latest')
- ->setActionName('view');
- $request->setAlias(\Magento\Framework\Url::REWRITE_REQUEST_PATH_ALIAS, $origUrlKey);
- $request->setDispatched(true);
- $this->dispatched = true;
- return $this->actionFactory->create(
- 'Magento\Framework\App\Action\Forward',
- ['request' => $request]
- );
- }
-
- // CATEGORY PAGE
- if(count($urlKeys)==2 && $urlPrefix == $urlKeys[0] && $urlKeys[1]!='' && $this->endsWith($urlKeys[1], $urlSuffix)){
- $alias = str_replace($urlSuffix, "", $urlKeys[1]);
- $category = $this->_category->getCollection()
- ->addFieldToFilter('identifier', $alias)
- ->addFieldToFilter('is_active', 1)
- ->addStoreFilter($store)
- ->getFirstItem();
- if(isset($urlKeys[1]) && $category->getData()){
- $this->_coreRegistry->register("current_post_category", $category);
- $request->setModuleName('vesblog')
- ->setControllerName('category')
- ->setActionName('view');
- $request->setAlias(\Magento\Framework\Url::REWRITE_REQUEST_PATH_ALIAS, $origUrlKey);
- $request->setDispatched(true);
- $this->dispatched = true;
- return $this->actionFactory->create(
- 'Magento\Framework\App\Action\Forward',
- ['request' => $request]
- );
- }
- }
-
- // AUTHORS PAGE
- if(($orig_list_authors_url == $urlKey) || (count($urlKeys)==2 && $urlPrefix == $urlKeys[0] && $urlKeys[1]!='')){
-
- $authors_route = str_replace($urlSuffix, "", $urlKeys[1]);
- if($authors_route && ($authors_route == $authorsUrlPrefix)){
- $request->setModuleName('vesblog')
- ->setControllerName('authors')
- ->setActionName('view');
- $request->setAlias(\Magento\Framework\Url::REWRITE_REQUEST_PATH_ALIAS, $origUrlKey);
- $request->setDispatched(true);
- $this->dispatched = true;
- return $this->actionFactory->create(
- 'Magento\Framework\App\Action\Forward',
- ['request' => $request]
- );
- }
- }
-
- // ARCHIVE PAGE
- if($urlPrefix == '' && count($urlKeysOrgin)==2) {
- $urlKeys[2] = $urlKeysOrgin[1];
- $urlKeys[1] = $urlKeysOrgin[0];
- $urlKeys[0] = '';
- }
- if(count($urlKeys)==3 && $urlPrefix == $urlKeys[0] && $urlKeys[1]=='archive'){
- $alias = str_replace($urlSuffix, "", $urlKeys[2]);
- $date = explode('-', $alias);
- $date[2] = '01';
- $time = strtotime(implode('-', $date));
- if (!$time || count($date) != 3) {
- return;
- }
- $request->setModuleName('vesblog')
- ->setControllerName('archive')
- ->setActionName('view')
- ->setParam('date', $alias);
- $request->setAlias(\Magento\Framework\Url::REWRITE_REQUEST_PATH_ALIAS, $origUrlKey);
- $request->setDispatched(true);
- $this->dispatched = true;
- return $this->actionFactory->create(
- 'Magento\Framework\App\Action\Forward',
- ['request' => $request]
- );
- }
-
- // TAG PAGE
- if($urlPrefix == '' && count($urlKeysOrgin)==2) {
- $urlKeys[2] = $urlKeysOrgin[1];
- $urlKeys[1] = $urlKeysOrgin[0];
- $urlKeys[0] = '';
- }
- if(count($urlKeys)==3 && $urlPrefix == $urlKeys[0] && $urlKeys[1]=='tag'){
- $alias = str_replace($urlSuffix, "", $urlKeys[2]);
- $tagCollection = $this->_tag->getCollection()
- ->addFieldToFilter("alias", $alias);
- if(!empty($tagCollection)){
-
- $tag = $tagCollection->getFirstItem();
-
- $postIds = [];
- foreach ($tagCollection as $k => $v) {
- $postIds[] = $v['post_id'];
- }
-
- $this->_coreRegistry->register("postIds", $postIds);
- $this->_coreRegistry->register("tag_key", $alias);
- $this->_coreRegistry->register("tag_name", $tag->getName());
- $request->setModuleName('vesblog')
- ->setControllerName('tag')
- ->setActionName('view')
- ->setParam('tag_key', $alias)
- ->setParam('tag_name', $tag->getName())
- ->setParam('is_tag', (!empty($postIds)?true:false) );
- $request->setAlias(\Magento\Framework\Url::REWRITE_REQUEST_PATH_ALIAS, $origUrlKey);
- $request->setDispatched(true);
- $this->dispatched = true;
- return $this->actionFactory->create(
- 'Magento\Framework\App\Action\Forward',
- ['request' => $request]
- );
- }
- }
-
- // AUTHOR PAGE
- if(count($urlKeys)==3 && $urlPrefix == $urlKeys[0] && $urlKeys[1]=='author') {
- $alias = str_replace($urlSuffix, "", $urlKeys[2]);
- $author = $this->_author->loadByUserName($alias);
- $is_view = null;
- if($author) {
- $is_view = $author->getIsView();
- $is_view = is_numeric($is_view)?(int)$is_view:1;
- }
-
- if($author && $is_view){
- $this->_coreRegistry->register("author", $author);
- $request->setModuleName('vesblog')
- ->setControllerName('author')
- ->setActionName('view');
- $request->setAlias(\Magento\Framework\Url::REWRITE_REQUEST_PATH_ALIAS, $origUrlKey);
- $request->setDispatched(true);
- $this->dispatched = true;
- return $this->actionFactory->create(
- 'Magento\Framework\App\Action\Forward',
- ['request' => $request]
- );
- }
- }
-
- // SEARCH PAGE
- if($urlPrefix == '') {
- $urlKeys[1] = $urlKeysOrgin[0];
- $urlKeys[0] = '';
- }
- if(count($urlKeys)==2 && $urlPrefix == $urlKeys[0] && $urlKeys[1]=='search'){
- $request->setModuleName('vesblog')
- ->setControllerName('search')
- ->setActionName('result');
- $request->setAlias(\Magento\Framework\Url::REWRITE_REQUEST_PATH_ALIAS, $origUrlKey);
- $request->setDispatched(true);
- $this->dispatched = true;
- return $this->actionFactory->create(
- 'Magento\Framework\App\Action\Forward',
- ['request' => $request]
- );
- }
- if($urlPrefix == '') $urlKeys = [];
- if(count($urlKeysOrgin) == 3 && $urlPrefix == '' && $categoriesUrls) {
- $urlKeys[0] = '';
- $urlKeys[1] = $urlKeysOrgin[0];
- $urlKeys[2] = $urlKeysOrgin[1];
- }
-
- if(count($urlKeysOrgin) == 2 && $urlPrefix == '' && $categoriesUrls) {
- $urlKeys[0] = '';
- $urlKeys[1] = '';
- $urlKeys[2] = $urlKeysOrgin[1];
- }
-
- if(count($urlKeysOrgin) == 2 && $urlPrefix != '' && !$categoriesUrls) {
- $urlKeys[0] = $urlKeysOrgin[0];
- $urlKeys[1] = '';
- $urlKeys[2] = $urlKeysOrgin[1];
- }
- // POST PAGE directly url as this: blog_router/post_identifier
- if (!$categoriesUrls && count($urlKeysOrgin) == 2) {
- $post = $this->_post->getCollection()
- ->addFieldToFilter("is_active", 1)
- ->addFieldToFilter("identifier", $urlKeysOrgin[1])
- ->addStoreFilter($store)
- ->getFirstItem();
-
- if ($post->getId()) {
- $this->_coreRegistry->register("current_post", $post);
- $request->setModuleName('vesblog')
- ->setControllerName('post')
- ->setActionName('view');
- $request->setAlias(\Magento\Framework\Url::REWRITE_REQUEST_PATH_ALIAS, $origUrlKey);
- $request->setDispatched(true);
- $this->dispatched = true;
- return $this->actionFactory->create(
- 'Magento\Framework\App\Action\Forward',
- ['request' => $request]
- );
- }
- }
-
- // POST PAGE with URI format as this: blog_router/post/post_identifier
- if (count($urlKeys)==3 && $urlPrefix == $urlKeys[0] && $urlKeys[2]!='' && $this->endsWith($urlKeys[2], $urlSuffix)) {
- $is_post_uri = ($urlKeys[1] == $post_uri_key)?true:false;
- if(!$is_post_uri && $categoriesUrls && $urlKeys[1]){
- $category_alias = $urlKeys[1];
- $total_category = $this->_category->getCollection()
- ->addFieldToFilter('identifier', $category_alias)
- ->addFieldToFilter('is_active', 1)
- ->addStoreFilter($store)
- ->getSize();
- if($total_category > 0){
- $is_post_uri = true;
- }
- }
- if($is_post_uri){
- $alias = str_replace($urlSuffix, "", $urlKeys[2]);
- if ($storeCode = $request->getParam(\Magento\Store\Api\StoreResolverInterface::PARAM_NAME)) {
- $store = $this->storeManager->getStore($storeCode);
- if ($store->getId()) {
- $isPost = true;
- }
- }
-
- $post = $this->_post->getCollection()
- ->addFieldToFilter("identifier", $alias)
- ->addStoreFilter($store)
- ->getFirstItem();
-
- $isPost = false;
-
- if(!empty($post->getData()) && $post->getIsActive()) {
- $isPost = true;
- }
-
- if ($storeCode = $request->getParam(\Magento\Store\Api\StoreResolverInterface::PARAM_NAME)) {
- $store = $this->storeManager->getStore($storeCode);
- if ($store->getId()) {
- $isPost = true;
- }
- }
-
- if ($post->getId() && $isPost) {
- $this->_coreRegistry->register("current_post", $post);
- $request->setModuleName('vesblog')
- ->setControllerName('post')
- ->setActionName('view');
- $request->setAlias(\Magento\Framework\Url::REWRITE_REQUEST_PATH_ALIAS, $origUrlKey);
- $request->setDispatched(true);
- $this->dispatched = true;
- return $this->actionFactory->create(
- 'Magento\Framework\App\Action\Forward',
- ['request' => $request]
- );
- }
- }
-
- }
-
- /** ENABLE CATEGORY IN POST URL */
- if ($categoriesUrls && count($urlKeys)==2 && $urlPrefix == $urlKeys[0] && $urlKeys[1]!='' && $this->endsWith($urlKeys[1], $urlSuffix)) {
- $alias = str_replace($urlSuffix, "", $urlKeys[1]);
- $post = $this->_post->getCollection()
- ->addFieldToFilter("is_active", 1)
- ->addFieldToFilter("identifier", $alias)
- ->addStoreFilter($store)
- ->getFirstItem();
-
- if(!empty($post->getData()) && empty($post->getPostCategories())) {
- $this->_coreRegistry->register("current_post", $post);
- $request->setModuleName('vesblog')
- ->setControllerName('post')
- ->setActionName('view');
- $request->setAlias(\Magento\Framework\Url::REWRITE_REQUEST_PATH_ALIAS, $origUrlKey);
- $request->setDispatched(true);
- $this->dispatched = true;
- return $this->actionFactory->create(
- 'Magento\Framework\App\Action\Forward',
- ['request' => $request]
- );
- }
- }
- }
- }
- }
-}
\ No newline at end of file
+actionFactory = $actionFactory;
+ $this->eventManager = $eventManager;
+ $this->response = $response;
+ $this->storeManager = $storeManager;
+ $this->_blogHelper = $blogHelper;
+ $this->_category = $category;
+ $this->_post = $post;
+ $this->_tag = $tag;
+ $this->_author = $author;
+ $this->_user = $userFactory;
+ $this->_coreRegistry = $registry;
+ $this->dispatched = false;
+ }
+
+ function startsWith($haystack, $needle) {
+ if($haystack && $needle){
+ return $needle === "" || strrpos($haystack, $needle, -strlen($haystack)) !== false;
+ }
+ return true;
+ }
+
+ function endsWith($haystack, $needle) {
+ if($haystack && $needle){
+ return $needle === "" || (($temp = strlen($haystack) - strlen($needle)) >= 0 && strpos($haystack, $needle, $temp) !== false);
+ }
+ return true;
+ }
+
+ /**
+ * @param RequestInterface $request
+ * @return \Magento\Framework\App\ActionInterface
+ */
+ public function match(RequestInterface $request)
+ {
+ $_blogHelper = $this->_blogHelper;
+ $store = $this->storeManager->getStore();
+
+ $enable = $_blogHelper->getConfig('general_settings/enable');
+
+ if ($enable) {
+
+ if (!$this->dispatched) {
+ $urlKey = trim($request->getPathInfo(), '/');
+ $origUrlKey = $urlKey;
+ /** @var Object $condition */
+ $condition = new DataObject(['url_key' => $urlKey, 'continue' => true]);
+ $this->eventManager->dispatch(
+ 'ves_blog_controller_router_match_before',
+ [
+ 'router' => $this,
+ 'condition' => $condition
+ ]
+ );
+ $urlKey = $condition->getUrlKey();
+ if ($condition->getRedirectUrl()) {
+ $this->response->setRedirect($condition->getRedirectUrl());
+ $request->setDispatched(true);
+ return $this->actionFactory->create(
+ 'Magento\Framework\App\Action\Redirect',
+ ['request' => $request]
+ );
+ }
+
+ if (!$condition->getContinue()) {
+ return null;
+ }
+
+ $urlPrefix = $_blogHelper->getConfig('general_settings/url_prefix');
+ $urlSuffix = $_blogHelper->getConfig('general_settings/url_suffix');
+ $authorsUrlPrefix = $_blogHelper->getConfig('other_settings/authors_url');
+ $categoriesUrls = $_blogHelper->getConfig('general_settings/categories_urls');
+ $post_uri_key = "post";
+ $urlKeys = explode("/", $urlKey);
+ $latestPageRoute = $_blogHelper->getConfig('blog_latest_page/route');
+ $urlKeysOrgin = $urlKeys;
+ $urlKeysOrgin = $urlSuffix ? str_replace($urlSuffix, "", $urlKeysOrgin) : $urlKeysOrgin;
+ $orig_list_authors_url = $urlPrefix."/author/list";
+
+ if($urlPrefix == '') {
+ $urlKeys[1] = $urlKeysOrgin[0];
+ $urlKeys[0] = '';
+ }
+
+
+ // LATEST PAGE
+ if(count($urlKeys) == 1 && $urlPrefix != '' && (@str_replace($urlSuffix, "", $urlKeys[0]) == $urlPrefix)){
+ $request->setModuleName('vesblog')
+ ->setControllerName('latest')
+ ->setActionName('view');
+ $request->setAlias(\Magento\Framework\Url::REWRITE_REQUEST_PATH_ALIAS, $origUrlKey);
+ $request->setDispatched(true);
+ $this->dispatched = true;
+ return $this->actionFactory->create(
+ 'Magento\Framework\App\Action\Forward',
+ ['request' => $request]
+ );
+ }
+
+ // CATEGORY PAGE
+ if(count($urlKeys)==2 && $urlPrefix == $urlKeys[0] && $urlKeys[1]!='' && $this->endsWith($urlKeys[1], $urlSuffix)){
+ $alias = @str_replace($urlSuffix, "", $urlKeys[1]);
+ $category = $this->_category->getCollection()
+ ->addFieldToFilter('identifier', $alias)
+ ->addFieldToFilter('is_active', 1)
+ ->addStoreFilter($store)
+ ->getFirstItem();
+ if(isset($urlKeys[1]) && $category->getData()){
+ $this->_coreRegistry->register("current_post_category", $category);
+ $request->setModuleName('vesblog')
+ ->setControllerName('category')
+ ->setActionName('view');
+ $request->setAlias(\Magento\Framework\Url::REWRITE_REQUEST_PATH_ALIAS, $origUrlKey);
+ $request->setDispatched(true);
+ $this->dispatched = true;
+ return $this->actionFactory->create(
+ 'Magento\Framework\App\Action\Forward',
+ ['request' => $request]
+ );
+ }
+ }
+
+ // AUTHORS PAGE
+ if(($orig_list_authors_url == $urlKey) || (count($urlKeys)==2 && $urlPrefix == $urlKeys[0] && $urlKeys[1]!='')){
+
+ $authors_route = @str_replace($urlSuffix, "", $urlKeys[1]);
+ if($authors_route && ($authors_route == $authorsUrlPrefix)){
+ $request->setModuleName('vesblog')
+ ->setControllerName('authors')
+ ->setActionName('view');
+ $request->setAlias(\Magento\Framework\Url::REWRITE_REQUEST_PATH_ALIAS, $origUrlKey);
+ $request->setDispatched(true);
+ $this->dispatched = true;
+ return $this->actionFactory->create(
+ 'Magento\Framework\App\Action\Forward',
+ ['request' => $request]
+ );
+ }
+ }
+
+ // ARCHIVE PAGE
+ if($urlPrefix == '' && count($urlKeysOrgin)==2) {
+ $urlKeys[2] = $urlKeysOrgin[1];
+ $urlKeys[1] = $urlKeysOrgin[0];
+ $urlKeys[0] = '';
+ }
+ if(count($urlKeys)==3 && $urlPrefix == $urlKeys[0] && $urlKeys[1]=='archive'){
+ $alias = @str_replace($urlSuffix, "", $urlKeys[2]);
+ $date = explode('-', $alias);
+ $date[2] = '01';
+ $time = strtotime(implode('-', $date));
+ if (!$time || count($date) != 3) {
+ return;
+ }
+ $request->setModuleName('vesblog')
+ ->setControllerName('archive')
+ ->setActionName('view')
+ ->setParam('date', $alias);
+ $request->setAlias(\Magento\Framework\Url::REWRITE_REQUEST_PATH_ALIAS, $origUrlKey);
+ $request->setDispatched(true);
+ $this->dispatched = true;
+ return $this->actionFactory->create(
+ 'Magento\Framework\App\Action\Forward',
+ ['request' => $request]
+ );
+ }
+
+ // TAG PAGE
+ if($urlPrefix == '' && count($urlKeysOrgin)==2) {
+ $urlKeys[2] = $urlKeysOrgin[1];
+ $urlKeys[1] = $urlKeysOrgin[0];
+ $urlKeys[0] = '';
+ }
+ if(count($urlKeys)==3 && $urlPrefix == $urlKeys[0] && $urlKeys[1]=='tag'){
+ $alias = @str_replace($urlSuffix, "", $urlKeys[2]);
+ $tagCollection = $this->_tag->getCollection()
+ ->addFieldToFilter("alias", $alias);
+ if(!empty($tagCollection)){
+
+ $tag = $tagCollection->getFirstItem();
+
+ $postIds = [];
+ foreach ($tagCollection as $k => $v) {
+ $postIds[] = $v['post_id'];
+ }
+
+ $this->_coreRegistry->register("postIds", $postIds);
+ $this->_coreRegistry->register("tag_key", $alias);
+ $this->_coreRegistry->register("tag_name", $tag->getName());
+ $request->setModuleName('vesblog')
+ ->setControllerName('tag')
+ ->setActionName('view')
+ ->setParam('tag_key', $alias)
+ ->setParam('tag_name', $tag->getName())
+ ->setParam('is_tag', (!empty($postIds)?true:false) );
+ $request->setAlias(\Magento\Framework\Url::REWRITE_REQUEST_PATH_ALIAS, $origUrlKey);
+ $request->setDispatched(true);
+ $this->dispatched = true;
+ return $this->actionFactory->create(
+ 'Magento\Framework\App\Action\Forward',
+ ['request' => $request]
+ );
+ }
+ }
+
+ // AUTHOR PAGE
+ if(count($urlKeys)==3 && $urlPrefix == $urlKeys[0] && $urlKeys[1]=='author') {
+ $alias = @str_replace($urlSuffix, "", $urlKeys[2]);
+ $author = $this->_author->loadByUserName($alias);
+ $is_view = null;
+ if($author) {
+ $is_view = $author->getIsView();
+ $is_view = is_numeric($is_view)?(int)$is_view:1;
+ }
+
+ if($author && $is_view){
+ $this->_coreRegistry->register("author", $author);
+ $request->setModuleName('vesblog')
+ ->setControllerName('author')
+ ->setActionName('view');
+ $request->setAlias(\Magento\Framework\Url::REWRITE_REQUEST_PATH_ALIAS, $origUrlKey);
+ $request->setDispatched(true);
+ $this->dispatched = true;
+ return $this->actionFactory->create(
+ 'Magento\Framework\App\Action\Forward',
+ ['request' => $request]
+ );
+ }
+ }
+
+ // SEARCH PAGE
+ if($urlPrefix == '') {
+ $urlKeys[1] = $urlKeysOrgin[0];
+ $urlKeys[0] = '';
+ }
+ if(count($urlKeys)==2 && $urlPrefix == $urlKeys[0] && $urlKeys[1]=='search'){
+ $request->setModuleName('vesblog')
+ ->setControllerName('search')
+ ->setActionName('result');
+ $request->setAlias(\Magento\Framework\Url::REWRITE_REQUEST_PATH_ALIAS, $origUrlKey);
+ $request->setDispatched(true);
+ $this->dispatched = true;
+ return $this->actionFactory->create(
+ 'Magento\Framework\App\Action\Forward',
+ ['request' => $request]
+ );
+ }
+ if($urlPrefix == '') $urlKeys = [];
+ if(count($urlKeysOrgin) == 3 && $urlPrefix == '' && $categoriesUrls) {
+ $urlKeys[0] = '';
+ $urlKeys[1] = $urlKeysOrgin[0];
+ $urlKeys[2] = $urlKeysOrgin[1];
+ }
+
+ if(count($urlKeysOrgin) == 2 && $urlPrefix == '' && $categoriesUrls) {
+ $urlKeys[0] = '';
+ $urlKeys[1] = '';
+ $urlKeys[2] = $urlKeysOrgin[1];
+ }
+
+ if(count($urlKeysOrgin) == 2 && $urlPrefix != '' && !$categoriesUrls) {
+ $urlKeys[0] = $urlKeysOrgin[0];
+ $urlKeys[1] = '';
+ $urlKeys[2] = $urlKeysOrgin[1];
+ }
+ // POST PAGE directly url as this: blog_router/post_identifier
+ if (!$categoriesUrls && count($urlKeysOrgin) == 2) {
+ $post = $this->_post->getCollection()
+ ->addFieldToFilter("is_active", 1)
+ ->addFieldToFilter("identifier", $urlKeysOrgin[1])
+ ->addStoreFilter($store)
+ ->getFirstItem();
+
+ if ($post->getId()) {
+ $this->_coreRegistry->register("current_post", $post);
+ $request->setModuleName('vesblog')
+ ->setControllerName('post')
+ ->setActionName('view');
+ $request->setAlias(\Magento\Framework\Url::REWRITE_REQUEST_PATH_ALIAS, $origUrlKey);
+ $request->setDispatched(true);
+ $this->dispatched = true;
+ return $this->actionFactory->create(
+ 'Magento\Framework\App\Action\Forward',
+ ['request' => $request]
+ );
+ }
+ }
+
+ // POST PAGE with URI format as this: blog_router/post/post_identifier
+ if (count($urlKeys)==3 && $urlPrefix == $urlKeys[0] && $urlKeys[2]!='' && $this->endsWith($urlKeys[2], $urlSuffix)) {
+ $is_post_uri = ($urlKeys[1] == $post_uri_key)?true:false;
+ if(!$is_post_uri && $categoriesUrls && $urlKeys[1]){
+ $category_alias = $urlKeys[1];
+ $total_category = $this->_category->getCollection()
+ ->addFieldToFilter('identifier', $category_alias)
+ ->addFieldToFilter('is_active', 1)
+ ->addStoreFilter($store)
+ ->getSize();
+ if($total_category > 0){
+ $is_post_uri = true;
+ }
+ }
+ if($is_post_uri) {
+ $alias = @str_replace($urlSuffix, "", $urlKeys[2]);
+ if ($storeCode = $request->getParam(\Magento\Store\Api\StoreResolverInterface::PARAM_NAME)) {
+ $store = $this->storeManager->getStore($storeCode);
+ if ($store->getId()) {
+ $isPost = true;
+ }
+ }
+
+ $post = $this->_post->getCollection()
+ ->addFieldToFilter("identifier", $alias)
+ ->addStoreFilter($store)
+ ->getFirstItem();
+
+ $isPost = false;
+
+ if(!empty($post->getData()) && $post->getIsActive()) {
+ $isPost = true;
+ }
+
+ if ($storeCode = $request->getParam(\Magento\Store\Api\StoreResolverInterface::PARAM_NAME)) {
+ $store = $this->storeManager->getStore($storeCode);
+ if ($store->getId()) {
+ $isPost = true;
+ }
+ }
+
+ if ($post->getId() && $isPost) {
+ $this->_coreRegistry->register("current_post", $post);
+ $request->setModuleName('vesblog')
+ ->setControllerName('post')
+ ->setActionName('view');
+ $request->setAlias(\Magento\Framework\Url::REWRITE_REQUEST_PATH_ALIAS, $origUrlKey);
+ $request->setDispatched(true);
+ $this->dispatched = true;
+ return $this->actionFactory->create(
+ 'Magento\Framework\App\Action\Forward',
+ ['request' => $request]
+ );
+ }
+ }
+
+ }
+
+ /** ENABLE CATEGORY IN POST URL */
+ if ($categoriesUrls && count($urlKeys)==2 && $urlPrefix == $urlKeys[0] && $urlKeys[1]!='' && $this->endsWith($urlKeys[1], $urlSuffix)) {
+ $alias = @str_replace($urlSuffix, "", $urlKeys[1]);
+ $post = $this->_post->getCollection()
+ ->addFieldToFilter("is_active", 1)
+ ->addFieldToFilter("identifier", $alias)
+ ->addStoreFilter($store)
+ ->getFirstItem();
+
+ if(!empty($post->getData()) && empty($post->getPostCategories())) {
+ $this->_coreRegistry->register("current_post", $post);
+ $request->setModuleName('vesblog')
+ ->setControllerName('post')
+ ->setActionName('view');
+ $request->setAlias(\Magento\Framework\Url::REWRITE_REQUEST_PATH_ALIAS, $origUrlKey);
+ $request->setDispatched(true);
+ $this->dispatched = true;
+ return $this->actionFactory->create(
+ 'Magento\Framework\App\Action\Forward',
+ ['request' => $request]
+ );
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/Controller/Search/Result.php b/Controller/Search/Result.php
index 67fea4c..6db9282 100644
--- a/Controller/Search/Result.php
+++ b/Controller/Search/Result.php
@@ -1,18 +1,18 @@
resultPageFactory = $resultPageFactory;
$this->_blogHelper = $blogHelper;
$this->resultForwardFactory = $resultForwardFactory;
@@ -103,4 +104,4 @@ public function execute()
return $page;
}
-}
\ No newline at end of file
+}
diff --git a/Controller/Vote/Post.php b/Controller/Vote/Post.php
index b72aec4..0ce3028 100644
--- a/Controller/Vote/Post.php
+++ b/Controller/Vote/Post.php
@@ -1,184 +1,188 @@
-resultPageFactory = $resultPageFactory;
- $this->_blogHelper = $blogHelper;
- $this->_post = $post;
- $this->_vote = $vote;
- $this->resultForwardFactory = $resultForwardFactory;
- $this->_coreRegistry = $registry;
-
- $this->_cacheTypeList = $cacheTypeList;
- $this->_customerSession = $customerSession;
- $this->_request = $context->getRequest();
- parent::__construct($context);
- }
-
- /**
- * Default customer account page
- *
- * @return \Magento\Framework\View\Result\Page
- */
- public function execute()
- {
- $params = $this->_request->getPostValue();
- if(!empty($params)){
- $voteCollection = $this->_vote->getCollection();
- $disllike = $like = 0;
- if($params['like']){
- $like = 1;
- $disllike = 0;
- }else{
- $like = 0;
- $disllike = 1;
- }
- $customer = $this->_customerSession->getCustomer();
- $data = [
- 'ip' => $_SERVER['REMOTE_ADDR'],
- 'customer_email' => $customer->getName(),
- 'customer_name' => $customer->getEmail(),
- 'like' => $like,
- 'disllike' => $disllike,
- 'post_id' => $params['postId']
- ];
- $collection = $voteCollection->addFieldToFilter('ip', $this->getUserIP())
- ->addFieldToFilter('post_id', $params['postId']);
- $vote = $this->_vote->load($this->getUserIP(), 'ip');
- $post = $this->_post->load($params['postId']);
- $postData = $responseData = [];
- if(empty($collection->getData())){
- $like = (int)$post->getLike() + $like;
- $disllike = (int)$post->getDisklike() + $disllike;
- $post->setLike($like);
- $post->setDisklike($disllike);
-
- $responseData['like'] = $like;
- $responseData['disklike'] = $disllike;
- try{
- $message = __('Thanks for your vote!');
- $status = 1;
- $vote->setData($data)->save();
- $post->save();
- //$this->_cacheTypeList->cleanType('full_page');
- }catch(\Exception $e){
- $this->messageManager->addError(
- __('We can\'t process your request right now. Sorry, that\'s all we know.')
- );
- return;
- }
- }else{
- $status = 0;
- $message = __('Already voted!');
- }
- $responseData['message'] = $message;
- $responseData['status'] = $status;
- $this->getResponse()->representJson(
- $this->_objectManager->get('Magento\Framework\Json\Helper\Data')->jsonEncode($responseData)
- );
- return;
- }
- }
-
- public function getUserIP()
- {
- $client = @$_SERVER['HTTP_CLIENT_IP'];
- $forward = @$_SERVER['HTTP_X_FORWARDED_FOR'];
- $remote = $_SERVER['REMOTE_ADDR'];
-
- if(filter_var($client, FILTER_VALIDATE_IP))
- {
- $ip = $client;
- }
- elseif(filter_var($forward, FILTER_VALIDATE_IP))
- {
- $ip = $forward;
- }
- else
- {
- $ip = $remote;
- }
- return $ip;
- }
-
-}
\ No newline at end of file
+resultPageFactory = $resultPageFactory;
+ $this->_blogHelper = $blogHelper;
+ $this->_post = $post;
+ $this->_vote = $vote;
+ $this->resultForwardFactory = $resultForwardFactory;
+ $this->_coreRegistry = $registry;
+ $this->_cacheTypeList = $cacheTypeList;
+ $this->_customerSession = $customerSession;
+ $this->_request = $context->getRequest();
+ parent::__construct($context);
+ }
+
+ /**
+ * Default customer account page
+ *
+ * @return \Magento\Framework\View\Result\Page
+ */
+ public function execute()
+ {
+ $params = $this->_request->getPostValue();
+ if(!empty($params)){
+ $voteCollection = $this->_vote->getCollection();
+ $disllike = $like = 0;
+ if($params['like']){
+ $like = 1;
+ $disllike = 0;
+ }else{
+ $like = 0;
+ $disllike = 1;
+ }
+ $customer = $this->_customerSession->getCustomer();
+ $data = [
+ 'ip' => $_SERVER['REMOTE_ADDR'],
+ 'customer_email' => $customer->getName(),
+ 'customer_name' => $customer->getEmail(),
+ 'like' => $like,
+ 'disllike' => $disllike,
+ 'post_id' => $params['postId']
+ ];
+ $collection = $voteCollection->addFieldToFilter('ip', $this->getUserIP())
+ ->addFieldToFilter('post_id', $params['postId']);
+ $vote = $this->_vote->load($this->getUserIP(), 'ip');
+ $post = $this->_post->load($params['postId']);
+ $postData = $responseData = [];
+ if(empty($collection->getData())){
+ $like = (int)$post->getLike() + $like;
+ $disllike = (int)$post->getDisklike() + $disllike;
+ $post->setLike($like);
+ $post->setDisklike($disllike);
+
+ $responseData['like'] = $like;
+ $responseData['disklike'] = $disllike;
+ try{
+ $message = __('Thanks for your vote!');
+ $status = 1;
+ $vote->setData($data)->save();
+ $post->save();
+ //$this->_cacheTypeList->cleanType('full_page');
+ }catch(\Exception $e){
+ $this->messageManager->addError(
+ __('We can\'t process your request right now. Sorry, that\'s all we know.')
+ );
+ return;
+ }
+ }else{
+ $status = 0;
+ $message = __('Already voted!');
+ }
+ $responseData['message'] = $message;
+ $responseData['status'] = $status;
+ $this->getResponse()->representJson(
+ $this->_objectManager->get('Magento\Framework\Json\Helper\Data')->jsonEncode($responseData)
+ );
+ return;
+ }
+ }
+
+ public function getUserIP()
+ {
+ $client = @$_SERVER['HTTP_CLIENT_IP'];
+ $forward = @$_SERVER['HTTP_X_FORWARDED_FOR'];
+ $remote = $_SERVER['REMOTE_ADDR'];
+
+ if(filter_var($client, FILTER_VALIDATE_IP))
+ {
+ $ip = $client;
+ }
+ elseif(filter_var($forward, FILTER_VALIDATE_IP))
+ {
+ $ip = $forward;
+ }
+ else
+ {
+ $ip = $remote;
+ }
+ return $ip;
+ }
+
+}
diff --git a/Cron/RunImporter.php b/Cron/RunImporter.php
index 6c7e02e..bcb848d 100644
--- a/Cron/RunImporter.php
+++ b/Cron/RunImporter.php
@@ -1,18 +1,18 @@
helper = $helper;
$this->importerCollectionFactory = $importerCollectionFactory;
- $this->_importerLogFactory = $_importerLogFactory;
+ $this->_importerLogFactory = $importerLogFactory;
parent::__construct($context);
}
@@ -83,7 +83,7 @@ public function execute()
$modelLog->setData($data);
$modelLog->save();
}catch (\Exception $e) {
-
+
}
}
}
diff --git a/Helper/Data.php b/Helper/Data.php
index 441892f..c4bdb0f 100644
--- a/Helper/Data.php
+++ b/Helper/Data.php
@@ -60,6 +60,12 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper
protected $_request;
+ protected $_resource;
+
+ protected $_frontendUrlBuilder;
+ protected $_userFactory;
+ protected $_authorFactory;
+
const XML_PATH_AJAXSCROLL_ENABLED = 'ajaxscroll_selectors/enable_ajaxscroll';
const XML_PATH_BLOG_ENABLED = 'general_settings/enable';
@@ -85,7 +91,7 @@ public function __construct(
\Ves\Blog\Model\Post $postFactory,
\Ves\Blog\Model\Author $authorFactory,
\Magento\Framework\Registry $registry
- ) {
+ ) {
parent::__construct($context);
$this->_request = $context->getRequest();
$this->_filterProvider = $filterProvider;
diff --git a/Helper/Image.php b/Helper/Image.php
index b2b3063..1fc7c22 100644
--- a/Helper/Image.php
+++ b/Helper/Image.php
@@ -1,232 +1,236 @@
-_storeManager = $storeManager;
- $this->_filesystem = $filesystem;
- $this->_imageFactory = $imageFactory;
- $this->_imageHelper = $imageHelper;
-
- parent::__construct($context);
- }
-
- public function getBaseMediaDirPath() {
- return $this->_filesystem->getDirectoryRead(DirectoryList::MEDIA)->getAbsolutePath();
- }
-
- public function getBaseMediaUrl()
- {
- return $this->_storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA);
- }
-
- /**
- * @param bool $keep
- * @return $this
- */
- public function setKeepAspectRatio($keep)
- {
- $this->_keepAspectRatio = (bool)$keep;
- return $this;
- }
-
- /**
- * @param bool $keep
- * @return $this
- */
- public function setKeepFrame($keep)
- {
- $this->_keepFrame = (bool)$keep;
- return $this;
- }
-
- /**
- * @param bool $keep
- * @return $this
- */
- public function setKeepTransparency($keep)
- {
- $this->_keepTransparency = (bool)$keep;
- return $this;
- }
-
- /**
- * @param bool $flag
- * @return $this
- */
- public function setConstrainOnly($flag)
- {
- $this->_constrainOnly = (bool)$flag;
- return $this;
- }
-
- /**
- * @param int[] $rgbArray
- * @return $this
- */
- public function setBackgroundColor(array $rgbArray)
- {
- $this->_backgroundColor = $rgbArray;
- return $this;
- }
- /**
- * @return MagentoImage
- */
- public function getImageProcessor($_imageUrl = null, $qualtity = 100, $keep_ratio = true, $keep_frame = false)
- {
- $this->_processor = $this->_imageFactory->create($_imageUrl);
- $this->_processor->keepAspectRatio($keep_ratio);
- $this->_processor->keepFrame($keep_frame);
- $this->_processor->keepTransparency($this->_keepTransparency);
- $this->_processor->constrainOnly($this->_constrainOnly);
- $this->_processor->backgroundColor($this->_backgroundColor);
- $this->_processor->quality($qualtity);
-
- return $this->_processor;
- }
-
- public function resizeImage($image, $width = 100, $height = 0, $qualtity = 100, $keep_ratio = true, $keep_frame = false){
- if($image=='') return;
- $tmp_image = $image;
- $media_base_url = $this->getBaseMediaUrl();
- $image = str_replace($media_base_url, "", $image);
- $media_base_url = str_replace("https://","http://", $media_base_url);
- $image = str_replace($media_base_url, "", $image);
- $parsed = parse_url($image);
- if (!empty($parsed['scheme'])) { //return external image link
- return $tmp_image;
- }
- $_imageUrl = $this->getBaseMediaDirPath().DIRECTORY_SEPARATOR.$image;
- $_imageResized = $this->getBaseMediaDirPath().DIRECTORY_SEPARATOR."resized".DIRECTORY_SEPARATOR.(int)$width."x".(int)$height.DIRECTORY_SEPARATOR.$image;
- if (!file_exists($_imageResized)&&file_exists($_imageUrl)){
- try{
- $imageObj = $this->getImageProcessor($_imageUrl, $qualtity, $keep_ratio, $keep_frame);
- if($height == 0){
- $imageObj->resize($width);
- }else{
- $imageObj->resize($width, $height);
- }
- $imageObj->save($_imageResized);
- } catch(Exception $e) {
-
- }
- }
- if(file_exists($_imageResized)){
- return $this->getBaseMediaUrl()."resized/".(int)$width."x".(int)$height."/".$image;
- } else {
- return $this->getBaseMediaUrl().$image;
- }
-
- }
-
- /**
- * Get image URL of the given product
- *
- * @param \Magento\Catalog\Model\Product $product Product
- * @param int $w Image width
- * @param int $h Image height
- * @param string $imgVersion Image version: image, small_image, thumbnail
- * @param mixed $file Specific file
- * @return string
- */
- public function getImg($product, $w=300, $h, $imgVersion='image', $file=NULL)
- {
- if ($h <= 0){
- $image = $this->_imageHelper
- ->init($product, $imgVersion)
- ->constrainOnly(true)
- ->keepAspectRatio(true)
- ->keepFrame(false);
- if($file){
- $image->setImageFile($file);
- }
- $image->resize($w);
- return $image;
- }else{
- $image = $this->_imageHelper
- ->init($product, $imgVersion);
- if($file){
- $image->setImageFile($file);
- }
- $image->resize($w, $h);
- return $image;
- }
- }
- /**
- * Get alternative image HTML of the given product
- *
- * @param \Magento\Catalog\Model\Product $product Product
- * @param int $w Image width
- * @param int $h Image height
- * @param string $imgVersion Image version: image, small_image, thumbnail
- * @return string
- */
- public function getAltImgHtml($product, $w, $h, $imgVersion='small_image', $column = 'position', $value = 1)
- {
- $product->load('media_gallery');
- if ($images = $product->getMediaGalleryImages())
- {
- $image = $images->getItemByColumnValue($column, $value);
- if(isset($image) && $image->getUrl()){
- $imgAlt = $this->getImg($product, $w, $h, $imgVersion , $image->getFile());
- if(!$imgAlt) return '';
- return $imgAlt;
- }else{
- return '';
- }
- }
- return '';
- }
-
-}
\ No newline at end of file
+_storeManager = $storeManager;
+ $this->_filesystem = $filesystem;
+ $this->_imageFactory = $imageFactory;
+ $this->_imageHelper = $imageHelper;
+
+ parent::__construct($context);
+ }
+
+ public function getBaseMediaDirPath() {
+ return $this->_filesystem->getDirectoryRead(DirectoryList::MEDIA)->getAbsolutePath();
+ }
+
+ public function getBaseMediaUrl()
+ {
+ return $this->_storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA);
+ }
+
+ /**
+ * @param bool $keep
+ * @return $this
+ */
+ public function setKeepAspectRatio($keep)
+ {
+ $this->_keepAspectRatio = (bool)$keep;
+ return $this;
+ }
+
+ /**
+ * @param bool $keep
+ * @return $this
+ */
+ public function setKeepFrame($keep)
+ {
+ $this->_keepFrame = (bool)$keep;
+ return $this;
+ }
+
+ /**
+ * @param bool $keep
+ * @return $this
+ */
+ public function setKeepTransparency($keep)
+ {
+ $this->_keepTransparency = (bool)$keep;
+ return $this;
+ }
+
+ /**
+ * @param bool $flag
+ * @return $this
+ */
+ public function setConstrainOnly($flag)
+ {
+ $this->_constrainOnly = (bool)$flag;
+ return $this;
+ }
+
+ /**
+ * @param int[] $rgbArray
+ * @return $this
+ */
+ public function setBackgroundColor(array $rgbArray)
+ {
+ $this->_backgroundColor = $rgbArray;
+ return $this;
+ }
+ /**
+ * @return MagentoImage
+ */
+ public function getImageProcessor($_imageUrl = null, $qualtity = 100, $keep_ratio = true, $keep_frame = false)
+ {
+ $this->_processor = $this->_imageFactory->create($_imageUrl);
+ $this->_processor->keepAspectRatio($keep_ratio);
+ $this->_processor->keepFrame($keep_frame);
+ $this->_processor->keepTransparency($this->_keepTransparency);
+ $this->_processor->constrainOnly($this->_constrainOnly);
+ $this->_processor->backgroundColor($this->_backgroundColor);
+ $this->_processor->quality($qualtity);
+
+ return $this->_processor;
+ }
+
+ public function resizeImage($image, $width = 100, $height = 0, $qualtity = 100, $keep_ratio = true, $keep_frame = false)
+ {
+ if($image=='') return;
+ $tmp_image = $image;
+ $media_base_url = $this->getBaseMediaUrl();
+ $image = str_replace($media_base_url, "", $image);
+ $media_base_url = str_replace("https://","http://", $media_base_url);
+ $image = str_replace($media_base_url, "", $image);
+ $parsed = parse_url($image);
+ if (!empty($parsed['scheme'])) { //return external image link
+ return $tmp_image;
+ }
+ $_imageUrl = $this->getBaseMediaDirPath().DIRECTORY_SEPARATOR.$image;
+ $_imageResized = $this->getBaseMediaDirPath().DIRECTORY_SEPARATOR."resized".DIRECTORY_SEPARATOR.(int)$width."x".(int)$height.DIRECTORY_SEPARATOR.$image;
+ if (!file_exists($_imageResized)&&file_exists($_imageUrl)){
+ try{
+ $imageObj = $this->getImageProcessor($_imageUrl, $qualtity, $keep_ratio, $keep_frame);
+ if($height == 0){
+ $imageObj->resize($width);
+ }else{
+ $imageObj->resize($width, $height);
+ }
+ $imageObj->save($_imageResized);
+ } catch(\Exception $e) {
+
+ }
+ }
+ if(file_exists($_imageResized)){
+ return $this->getBaseMediaUrl()."resized/".(int)$width."x".(int)$height."/".$image;
+ } else {
+ return $this->getBaseMediaUrl().$image;
+ }
+
+ }
+
+ /**
+ * Get image URL of the given product
+ *
+ * @param \Magento\Catalog\Model\Product $product Product
+ * @param int $w Image width
+ * @param int $h Image height
+ * @param string $imgVersion Image version: image, small_image, thumbnail
+ * @param mixed $file Specific file
+ * @return string
+ */
+ public function getImg($product, $w = 300, $h = 300, $imgVersion='image', $file=NULL)
+ {
+ if ($h <= 0){
+ $image = $this->_imageHelper
+ ->init($product, $imgVersion)
+ ->constrainOnly(true)
+ ->keepAspectRatio(true)
+ ->keepFrame(false);
+ if($file){
+ $image->setImageFile($file);
+ }
+ $image->resize($w);
+ return $image;
+ }else{
+ $image = $this->_imageHelper
+ ->init($product, $imgVersion);
+ if($file){
+ $image->setImageFile($file);
+ }
+ $image->resize($w, $h);
+ return $image;
+ }
+ }
+
+ /**
+ * Get alternative image HTML of the given product
+ *
+ * @param \Magento\Catalog\Model\Product $product Product
+ * @param int $w Image width
+ * @param int $h Image height
+ * @param string $imgVersion Image version: image, small_image, thumbnail
+ * @return string
+ */
+ public function getAltImgHtml($product, $w, $h, $imgVersion='small_image', $column = 'position', $value = 1)
+ {
+ $product->load('media_gallery');
+ if ($images = $product->getMediaGalleryImages())
+ {
+ $image = $images->getItemByColumnValue($column, $value);
+ if(isset($image) && $image->getUrl()){
+ $imgAlt = $this->getImg($product, $w, $h, $imgVersion , $image->getFile());
+ if(!$imgAlt) return '';
+ return $imgAlt;
+ }else{
+ return '';
+ }
+ }
+ return '';
+ }
+
+}
diff --git a/Model/Author.php b/Model/Author.php
index c232125..b69c1ef 100644
--- a/Model/Author.php
+++ b/Model/Author.php
@@ -1,314 +1,315 @@
-authorDataFactory = $authorDataFactory;
- $this->dataObjectHelper = $dataObjectHelper;
- parent::__construct($context, $registry, $resource, $resourceCollection, $data);
- }
- /**
- * Initialize resource model
- *
- * @return void
- */
- protected function _construct()
- {
- $this->_init('Ves\Blog\Model\ResourceModel\Author');
- }
-
- /**
- * Retrieve author model with author data
- * @return AuthorInterface
- */
- public function getDataModel()
- {
- $authorData = $this->getData();
-
- $authorDataObject = $this->authorDataFactory->create();
- $this->dataObjectHelper->populateWithArray(
- $authorDataObject,
- $authorData,
- AuthorInterface::class
- );
-
- return $authorDataObject;
- }
-
- public function loadByUserId($user_id = 0){
- $this->getResource()->load($this, $user_id, 'user_id');
- return $this;
- }
-
- public function loadByUserName($user_name = ""){
- $this->getResource()->load($this, $user_name, 'user_name');
- return $this;
- }
-
- /**
- * Prepare page's statuses.
- * Available event cms_page_get_available_statuses to customize statuses.
- *
- * @return array
- */
- public function getAvailableStatuses()
- {
- return [self::STATUS_ENABLED => __('Enabled'), self::STATUS_DISABLED => __('Disabled')];
- }
-
- /**
- * {@inheritdoc}
- */
- public function getAuthorId(){
- return $this->getData(self::AUTHOR_ID);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setAuthorId($value){
- return $this->setData(self::AUTHOR_ID, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getEmail(){
- return $this->getData(self::EMAIL);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setEmail($value){
- return $this->setData(self::EMAIL, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getUserName(){
- return $this->getData(self::USER_NAME);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setUserName($value){
- return $this->setData(self::USER_NAME, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getDescription(){
- return $this->getData(self::DESCRIPTION);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setDescription($value){
- return $this->setData(self::DESCRIPTION, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getAvatar(){
- return $this->getData(self::AVATAR);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setAvatar($value){
- return $this->setData(self::AVATAR, $value);
- }
-
-
- /**
- * {@inheritdoc}
- */
- public function getNickName(){
- return $this->getData(self::NICK_NAME);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setNickName($value){
- return $this->setData(self::NICK_NAME, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getUserId(){
- return $this->getData(self::USER_ID);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setUserId($value){
- return $this->setData(self::USER_ID, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getPageTitle(){
- return $this->getData(self::PAGE_TITLE);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setPageTitle($value){
- return $this->setData(self::PAGE_TITLE, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getMetaKeywords(){
- return $this->getData(self::META_KEYWORDS);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setMetaKeywords($value){
- return $this->setData(self::META_KEYWORDS, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getMetaDescription(){
- return $this->getData(self::META_DESCRIPTION);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setMetaDescription($value){
- return $this->setData(self::META_DESCRIPTION, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getCreationTime(){
- return $this->getData(self::CREATION_TIME);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setCreationTime($value){
- return $this->setData(self::CREATION_TIME, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getUpdateTime(){
- return $this->getData(self::UPDATE_TIME);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setUpdateTime($value){
- return $this->setData(self::UPDATE_TIME, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getSocialNetworks(){
- return $this->getData(self::SOCIAL_NETWORKS);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setSocialNetworks($value){
- return $this->setData(self::SOCIAL_NETWORKS, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getIsView(){
- return $this->getData(self::IS_VIEW);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setIsView($value){
- return $this->setData(self::IS_VIEW, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getExtensionAttributes()
- {
- return $this->getDataExtensionAttributes();
- }
-
- /**
- * {@inheritdoc}
- */
- public function setExtensionAttributes(
- \Ves\Blog\Api\Data\AuthorExtensionInterface $extensionAttributes
- ) {
- return $this->_setExtensionAttributes($extensionAttributes);
- }
-}
\ No newline at end of file
+authorDataFactory = $authorDataFactory;
+ $this->dataObjectHelper = $dataObjectHelper;
+ parent::__construct($context, $registry, $resource, $resourceCollection, $data);
+ }
+
+ /**
+ * Initialize resource model
+ *
+ * @return void
+ */
+ protected function _construct()
+ {
+ $this->_init(\Ves\Blog\Model\ResourceModel\Author::class);
+ }
+
+ /**
+ * Retrieve author model with author data
+ * @return AuthorInterface
+ */
+ public function getDataModel()
+ {
+ $authorData = $this->getData();
+
+ $authorDataObject = $this->authorDataFactory->create();
+ $this->dataObjectHelper->populateWithArray(
+ $authorDataObject,
+ $authorData,
+ AuthorInterface::class
+ );
+
+ return $authorDataObject;
+ }
+
+ public function loadByUserId($user_id = 0){
+ $this->getResource()->load($this, $user_id, 'user_id');
+ return $this;
+ }
+
+ public function loadByUserName($user_name = ""){
+ $this->getResource()->load($this, $user_name, 'user_name');
+ return $this;
+ }
+
+ /**
+ * Prepare page's statuses.
+ * Available event cms_page_get_available_statuses to customize statuses.
+ *
+ * @return array
+ */
+ public function getAvailableStatuses()
+ {
+ return [self::STATUS_ENABLED => __('Enabled'), self::STATUS_DISABLED => __('Disabled')];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getAuthorId(){
+ return $this->getData(self::AUTHOR_ID);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setAuthorId($value){
+ return $this->setData(self::AUTHOR_ID, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getEmail(){
+ return $this->getData(self::EMAIL);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setEmail($value){
+ return $this->setData(self::EMAIL, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getUserName(){
+ return $this->getData(self::USER_NAME);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setUserName($value){
+ return $this->setData(self::USER_NAME, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getDescription(){
+ return $this->getData(self::DESCRIPTION);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setDescription($value){
+ return $this->setData(self::DESCRIPTION, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getAvatar(){
+ return $this->getData(self::AVATAR);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setAvatar($value){
+ return $this->setData(self::AVATAR, $value);
+ }
+
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getNickName(){
+ return $this->getData(self::NICK_NAME);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setNickName($value){
+ return $this->setData(self::NICK_NAME, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getUserId(){
+ return $this->getData(self::USER_ID);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setUserId($value){
+ return $this->setData(self::USER_ID, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getPageTitle(){
+ return $this->getData(self::PAGE_TITLE);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setPageTitle($value){
+ return $this->setData(self::PAGE_TITLE, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getMetaKeywords(){
+ return $this->getData(self::META_KEYWORDS);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setMetaKeywords($value){
+ return $this->setData(self::META_KEYWORDS, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getMetaDescription(){
+ return $this->getData(self::META_DESCRIPTION);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setMetaDescription($value){
+ return $this->setData(self::META_DESCRIPTION, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getCreationTime(){
+ return $this->getData(self::CREATION_TIME);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setCreationTime($value){
+ return $this->setData(self::CREATION_TIME, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getUpdateTime(){
+ return $this->getData(self::UPDATE_TIME);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setUpdateTime($value){
+ return $this->setData(self::UPDATE_TIME, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getSocialNetworks(){
+ return $this->getData(self::SOCIAL_NETWORKS);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setSocialNetworks($value){
+ return $this->setData(self::SOCIAL_NETWORKS, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getIsView(){
+ return $this->getData(self::IS_VIEW);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setIsView($value){
+ return $this->setData(self::IS_VIEW, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getExtensionAttributes()
+ {
+ return $this->getDataExtensionAttributes();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setExtensionAttributes(
+ \Ves\Blog\Api\Data\AuthorExtensionInterface $extensionAttributes
+ ) {
+ return $this->_setExtensionAttributes($extensionAttributes);
+ }
+}
diff --git a/Model/Category.php b/Model/Category.php
index 81ab182..6db97dd 100644
--- a/Model/Category.php
+++ b/Model/Category.php
@@ -1,687 +1,687 @@
-_storeManager = $storeManager;
- $this->_url = $url;
- $this->categoryDataFactory = $categoryDataFactory;
- $this->dataObjectHelper = $dataObjectHelper;
- parent::__construct($context, $registry, $resource, $resourceCollection, $data);
- //$this->_resource = $resource;
- $this->_blogHelper = $blogHelper;
- }
-
- /**
- * @return void
- */
- protected function _construct()
- {
- $this->_init('Ves\Blog\Model\ResourceModel\Category');
- }
-
- /**
- * Retrieve category model with category data
- * @return CategoryInterface
- */
- public function getDataModel()
- {
- $categoryData = $this->getData();
-
- $categoryDataObject = $this->categoryDataFactory->create();
- $this->dataObjectHelper->populateWithArray(
- $categoryDataObject,
- $categoryData,
- CategoryInterface::class
- );
-
- return $categoryDataObject;
- }
-
- /**
- * Prevent blocks recursion
- *
- * @return \Magento\Framework\Model\AbstractModel
- * @throws \Magento\Framework\Exception\LocalizedException
- */
- public function beforeSave()
- {
- $needle = 'category_id="' . $this->getId() . '"';
- if (false == strstr($this->getContent(), $needle)) {
- return parent::beforeSave();
- }
- throw new \Magento\Framework\Exception\LocalizedException(
- __('Make sure that category content does not reference the block itself.')
- );
- }
-
- /**
- * {@inheritdoc}
- */
- public function getStores()
- {
- return $this->hasData('stores') ? $this->getData('stores') : $this->getData('store_id');
- }
- /**
- * {@inheritdoc}
- */
- public function setStores($value){
- return $this->setData(self::STORES, $value);
- }
-
- /**
- * Prepare page's statuses.
- * Available event cms_page_get_available_statuses to customize statuses.
- *
- * @return array
- */
- public function getAvailableStatuses()
- {
- return [self::STATUS_ENABLED => __('Enabled'), self::STATUS_DISABLED => __('Disabled')];
- }
-
- public function getPostIds(){
- $posts = $this->getData('posts');
- $ids = [];
- foreach ($posts as $k => $v) {
- $ids[] = $v['post_id'];
- }
- return $ids;
- }
-
- public function getUrl($base_url = true)
- {
- if(!$this->hasData('blog_item_url')){
- if($base_url){
- $url = $this->_storeManager->getStore()->getBaseUrl();
- } else {
- $url = "";
- }
- $url_prefix = $this->_blogHelper->getConfig('general_settings/url_prefix');
- $url_suffix = $this->_blogHelper->getConfig('general_settings/url_suffix');
- $urlPrefix = '';
- if($url_prefix){
- $urlPrefix = $url_prefix.'/';
- }
- $item_url = $url . $urlPrefix . $this->getIdentifier() . $url_suffix;
- $this->setData('blog_item_url', $item_url);
- }
- return $this->getData('blog_item_url');
- }
- /**
- * Prepare all additional data
- * @param string $format
- * @return self
- */
- public function initDinamicData()
- {
- $keys = [
- 'meta_description',
- 'meta_title',
- ];
-
- foreach ($keys as $key) {
- $method = 'get' . str_replace(
- '_',
- '',
- ucwords($key, '_')
- );
- $this->$method();
- }
-
- return $this;
- }
- /**
- * Deprecated
- * Retrieve true if post is active
- * @return boolean [description]
- */
- public function isActive()
- {
- return ($this->getIsActive() == self::STATUS_ENABLED);
- }
- /**
- * Retrieve if is visible on store
- * @return bool
- */
- public function isVisibleOnStore($storeId)
- {
- $publishDate = $this->getData('creation_time');
- if($this->hasData('publish_time')){
- $publishDate = $this->getData('publish_time');
- }
-
- return $this->getIsActive()
- && ($publishDate <= $this->getResource()->getDate()->gmtDate())
- && array_intersect([0, $storeId], $this->getStoreIds());
- }
-
- /**
- * Get identities
- *
- * @return array
- */
- public function getIdentities()
- {
- return [self::CACHE_TAG . '_' . $this->getCategoryId()];
- }
-
- /**
- * {@inheritdoc}
- */
- public function getCategoryId(){
- return $this->getData(self::CATEGORY_ID);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setCategoryId($value){
- return $this->setData(self::CATEGORY_ID, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getName(){
- return $this->getData(self::NAME);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setName($value){
- return $this->setData(self::NAME, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getIdentifier(){
- return $this->getData(self::IDENTIFIER);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setIdentifier($value){
- return $this->setData(self::IDENTIFIER, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getDescription(){
- return $this->getData(self::DESCRIPTION);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setDescription($value){
- return $this->setData(self::DESCRIPTION, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getImage(){
- return $this->getData(self::IMAGE);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setImage($value){
- return $this->setData(self::IMAGE, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getLayoutType(){
- return $this->getData(self::LAYOUT_TYPE);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setLayoutType($value){
- $list_layout_types = [
- Layout::TYPE_LIST,
- Layout::TYPE_GRID,
- Layout::TYPE_MASONRY
- ];
- if(in_array($value, $list_layout_types)){
- return $this->setData(self::LAYOUT_TYPE, $value);
- }else {
- return $this;
- }
-
- }
-
- /**
- * {@inheritdoc}
- */
- public function getOrderby(){
- return $this->getData(self::ORDERBY);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setOrderby($value){
- $list_orderby = [
- CatOrderby::NEWEST,
- CatOrderby::OLDER,
- CatOrderby::POSITION_HIGHT_TO_LOW,
- CatOrderby::POSITION_LOW_TO_HIGHT
- ];
- if(in_array($value, $list_orderby)){
- return $this->setData(self::ORDERBY, $value);
- }else {
- return $this;
- }
- }
-
- /**
- * {@inheritdoc}
- */
- public function getComments(){
- return $this->getData(self::COMMENTS);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setComments($value){
- return $this->setData(self::COMMENTS, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getItemPerPage(){
- return $this->getData(self::ITEM_PER_PAGE);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setItemPerPage($value){
- return $this->setData(self::ITEM_PER_PAGE, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getLgColumnItem(){
- return $this->getData(self::LG_COLUMN_ITEM);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setLgColumnItem($value){
- return $this->setData(self::LG_COLUMN_ITEM, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getMdColumnItem(){
- return $this->getData(self::MD_COLUMN_ITEM);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setMdColumnItem($value){
- return $this->setData(self::MD_COLUMN_ITEM, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getSmColumnItem(){
- return $this->getData(self::SM_COLUMN_ITEM);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setSmColumnItem($value){
- return $this->setData(self::SM_COLUMN_ITEM, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getXsColumnItem(){
- return $this->getData(self::XS_COLUMN_ITEM);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setXsColumnItem($value){
- return $this->setData(self::XS_COLUMN_ITEM, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getPageLayout(){
- return $this->getData(self::PAGE_LAYOUT);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setPageLayout($value){
- return $this->setData(self::PAGE_LAYOUT, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getPageTitle(){
- return $this->getData(self::PAGE_TITLE);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setPageTitle($value){
- return $this->setData(self::PAGE_TITLE, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getCanonicalUrl(){
- return $this->getData(self::CANONICAL_URL);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setCanonicalUrl($value){
- return $this->setData(self::CANONICAL_URL, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getLayoutUpdateXml(){
- return $this->getData(self::LAYOUT_UPDATE_XML);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setLayoutUpdateXml($value){
- return $this->setData(self::LAYOUT_UPDATE_XML, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getMetaKeywords(){
- return $this->getData(self::META_KEYWORDS);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setMetaKeywords($value){
- return $this->setData(self::META_KEYWORDS, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getMetaDescription(){
- return $this->getData(self::META_DESCRIPTION);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setMetaDescription($value){
- return $this->setData(self::META_DESCRIPTION, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getCreationTime(){
- return $this->getData(self::CREATION_TIME);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setCreationTime($value){
- return $this->setData(self::CREATION_TIME, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getUpdateTime(){
- return $this->getData(self::UPDATE_TIME);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setUpdateTime($value){
- return $this->setData(self::UPDATE_TIME, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getCatPosition(){
- return $this->getData(self::CAT_POSITION);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setCatPosition($value){
- return $this->setData(self::CAT_POSITION, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getIsActive(){
- return $this->getData(self::IS_ACTIVE);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setIsActive($value){
- return $this->setData(self::IS_ACTIVE, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getParentId(){
- return $this->getData(self::PARENT_ID);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setParentId($value){
- return $this->setData(self::PARENT_ID, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getPostsStyle(){
- return $this->getData(self::POSTS_STYLE);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setPostsStyle($value){
- $list_styles = [
- LatestPostsStyle::STYLE1,
- LatestPostsStyle::STYLE2,
- LatestPostsStyle::STYLE3,
- LatestPostsStyle::STYLE4
- ];
- if(in_array($value, $list_styles)){
- return $this->setData(self::POSTS_STYLE, $value);
- }else {
- return $this;
- }
-
- }
-
- /**
- * {@inheritdoc}
- */
- public function getPostsTemplate(){
- return $this->getData(self::POSTS_TEMPLATE);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setPostsTemplate($value){
- return $this->setData(self::POSTS_TEMPLATE, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getPostTemplate(){
- return $this->getData(self::POST_TEMPLATE);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setPostTemplate($value){
- return $this->setData(self::POST_TEMPLATE, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getExtensionAttributes()
- {
- return $this->getDataExtensionAttributes();
- }
-
- /**
- * {@inheritdoc}
- */
- public function setExtensionAttributes(
- \Ves\Blog\Api\Data\CategoryExtensionInterface $extensionAttributes
- ) {
- return $this->_setExtensionAttributes($extensionAttributes);
- }
-
-}
+_storeManager = $storeManager;
+ $this->_url = $url;
+ $this->categoryDataFactory = $categoryDataFactory;
+ $this->dataObjectHelper = $dataObjectHelper;
+ parent::__construct($context, $registry, $resource, $resourceCollection, $data);
+ //$this->_resource = $resource;
+ $this->_blogHelper = $blogHelper;
+ }
+
+ /**
+ * @return void
+ */
+ protected function _construct()
+ {
+ $this->_init(\Ves\Blog\Model\ResourceModel\Category::class);
+ }
+
+ /**
+ * Retrieve category model with category data
+ * @return CategoryInterface
+ */
+ public function getDataModel()
+ {
+ $categoryData = $this->getData();
+
+ $categoryDataObject = $this->categoryDataFactory->create();
+ $this->dataObjectHelper->populateWithArray(
+ $categoryDataObject,
+ $categoryData,
+ CategoryInterface::class
+ );
+
+ return $categoryDataObject;
+ }
+
+ /**
+ * Prevent blocks recursion
+ *
+ * @return \Magento\Framework\Model\AbstractModel
+ * @throws \Magento\Framework\Exception\LocalizedException
+ */
+ public function beforeSave()
+ {
+ $needle = 'category_id="' . $this->getId() . '"';
+ if (!$this->getDescription() || (false == @strstr($this->getDescription(), $needle))) {
+ return parent::beforeSave();
+ }
+ throw new \Magento\Framework\Exception\LocalizedException(
+ __('Make sure that category content does not reference the block itself.')
+ );
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getStores()
+ {
+ return $this->hasData('stores') ? $this->getData('stores') : $this->getData('store_id');
+ }
+ /**
+ * {@inheritdoc}
+ */
+ public function setStores($value){
+ return $this->setData(self::STORES, $value);
+ }
+
+ /**
+ * Prepare page's statuses.
+ * Available event cms_page_get_available_statuses to customize statuses.
+ *
+ * @return array
+ */
+ public function getAvailableStatuses()
+ {
+ return [self::STATUS_ENABLED => __('Enabled'), self::STATUS_DISABLED => __('Disabled')];
+ }
+
+ public function getPostIds(){
+ $posts = $this->getData('posts');
+ $ids = [];
+ foreach ($posts as $k => $v) {
+ $ids[] = $v['post_id'];
+ }
+ return $ids;
+ }
+
+ public function getUrl($base_url = true)
+ {
+ if(!$this->hasData('blog_item_url')){
+ if($base_url){
+ $url = $this->_storeManager->getStore()->getBaseUrl();
+ } else {
+ $url = "";
+ }
+ $url_prefix = $this->_blogHelper->getConfig('general_settings/url_prefix');
+ $url_suffix = $this->_blogHelper->getConfig('general_settings/url_suffix');
+ $urlPrefix = '';
+ if($url_prefix){
+ $urlPrefix = $url_prefix.'/';
+ }
+ $item_url = $url . $urlPrefix . $this->getIdentifier() . $url_suffix;
+ $this->setData('blog_item_url', $item_url);
+ }
+ return $this->getData('blog_item_url');
+ }
+ /**
+ * Prepare all additional data
+ * @param string $format
+ * @return self
+ */
+ public function initDinamicData()
+ {
+ $keys = [
+ 'meta_description',
+ 'meta_title',
+ ];
+
+ foreach ($keys as $key) {
+ $method = 'get' . str_replace(
+ '_',
+ '',
+ ucwords($key, '_')
+ );
+ $this->$method();
+ }
+
+ return $this;
+ }
+ /**
+ * Deprecated
+ * Retrieve true if post is active
+ * @return boolean [description]
+ */
+ public function isActive()
+ {
+ return ($this->getIsActive() == self::STATUS_ENABLED);
+ }
+ /**
+ * Retrieve if is visible on store
+ * @return bool
+ */
+ public function isVisibleOnStore($storeId)
+ {
+ $publishDate = $this->getData('creation_time');
+ if($this->hasData('publish_time')){
+ $publishDate = $this->getData('publish_time');
+ }
+
+ return $this->getIsActive()
+ && ($publishDate <= $this->getResource()->getDate()->gmtDate())
+ && array_intersect([0, $storeId], $this->getStoreIds());
+ }
+
+ /**
+ * Get identities
+ *
+ * @return array
+ */
+ public function getIdentities()
+ {
+ return [self::CACHE_TAG . '_' . $this->getCategoryId()];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getCategoryId(){
+ return $this->getData(self::CATEGORY_ID);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setCategoryId($value){
+ return $this->setData(self::CATEGORY_ID, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getName(){
+ return $this->getData(self::NAME);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setName($value){
+ return $this->setData(self::NAME, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getIdentifier(){
+ return $this->getData(self::IDENTIFIER);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setIdentifier($value){
+ return $this->setData(self::IDENTIFIER, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getDescription(){
+ return $this->getData(self::DESCRIPTION);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setDescription($value){
+ return $this->setData(self::DESCRIPTION, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getImage(){
+ return $this->getData(self::IMAGE);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setImage($value){
+ return $this->setData(self::IMAGE, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getLayoutType(){
+ return $this->getData(self::LAYOUT_TYPE);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setLayoutType($value){
+ $list_layout_types = [
+ Layout::TYPE_LIST,
+ Layout::TYPE_GRID,
+ Layout::TYPE_MASONRY
+ ];
+ if(in_array($value, $list_layout_types)){
+ return $this->setData(self::LAYOUT_TYPE, $value);
+ }else {
+ return $this;
+ }
+
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getOrderby(){
+ return $this->getData(self::ORDERBY);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setOrderby($value){
+ $list_orderby = [
+ CatOrderby::NEWEST,
+ CatOrderby::OLDER,
+ CatOrderby::POSITION_HIGHT_TO_LOW,
+ CatOrderby::POSITION_LOW_TO_HIGHT
+ ];
+ if(in_array($value, $list_orderby)){
+ return $this->setData(self::ORDERBY, $value);
+ }else {
+ return $this;
+ }
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getComments(){
+ return $this->getData(self::COMMENTS);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setComments($value){
+ return $this->setData(self::COMMENTS, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getItemPerPage(){
+ return $this->getData(self::ITEM_PER_PAGE);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setItemPerPage($value){
+ return $this->setData(self::ITEM_PER_PAGE, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getLgColumnItem(){
+ return $this->getData(self::LG_COLUMN_ITEM);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setLgColumnItem($value){
+ return $this->setData(self::LG_COLUMN_ITEM, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getMdColumnItem(){
+ return $this->getData(self::MD_COLUMN_ITEM);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setMdColumnItem($value){
+ return $this->setData(self::MD_COLUMN_ITEM, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getSmColumnItem(){
+ return $this->getData(self::SM_COLUMN_ITEM);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setSmColumnItem($value){
+ return $this->setData(self::SM_COLUMN_ITEM, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getXsColumnItem(){
+ return $this->getData(self::XS_COLUMN_ITEM);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setXsColumnItem($value){
+ return $this->setData(self::XS_COLUMN_ITEM, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getPageLayout(){
+ return $this->getData(self::PAGE_LAYOUT);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setPageLayout($value){
+ return $this->setData(self::PAGE_LAYOUT, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getPageTitle(){
+ return $this->getData(self::PAGE_TITLE);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setPageTitle($value){
+ return $this->setData(self::PAGE_TITLE, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getCanonicalUrl(){
+ return $this->getData(self::CANONICAL_URL);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setCanonicalUrl($value){
+ return $this->setData(self::CANONICAL_URL, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getLayoutUpdateXml(){
+ return $this->getData(self::LAYOUT_UPDATE_XML);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setLayoutUpdateXml($value){
+ return $this->setData(self::LAYOUT_UPDATE_XML, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getMetaKeywords(){
+ return $this->getData(self::META_KEYWORDS);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setMetaKeywords($value){
+ return $this->setData(self::META_KEYWORDS, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getMetaDescription(){
+ return $this->getData(self::META_DESCRIPTION);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setMetaDescription($value){
+ return $this->setData(self::META_DESCRIPTION, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getCreationTime(){
+ return $this->getData(self::CREATION_TIME);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setCreationTime($value){
+ return $this->setData(self::CREATION_TIME, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getUpdateTime(){
+ return $this->getData(self::UPDATE_TIME);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setUpdateTime($value){
+ return $this->setData(self::UPDATE_TIME, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getCatPosition(){
+ return $this->getData(self::CAT_POSITION);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setCatPosition($value){
+ return $this->setData(self::CAT_POSITION, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getIsActive(){
+ return $this->getData(self::IS_ACTIVE);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setIsActive($value){
+ return $this->setData(self::IS_ACTIVE, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getParentId(){
+ return $this->getData(self::PARENT_ID);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setParentId($value){
+ return $this->setData(self::PARENT_ID, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getPostsStyle(){
+ return $this->getData(self::POSTS_STYLE);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setPostsStyle($value){
+ $list_styles = [
+ LatestPostsStyle::STYLE1,
+ LatestPostsStyle::STYLE2,
+ LatestPostsStyle::STYLE3,
+ LatestPostsStyle::STYLE4
+ ];
+ if(in_array($value, $list_styles)){
+ return $this->setData(self::POSTS_STYLE, $value);
+ }else {
+ return $this;
+ }
+
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getPostsTemplate(){
+ return $this->getData(self::POSTS_TEMPLATE);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setPostsTemplate($value){
+ return $this->setData(self::POSTS_TEMPLATE, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getPostTemplate(){
+ return $this->getData(self::POST_TEMPLATE);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setPostTemplate($value){
+ return $this->setData(self::POST_TEMPLATE, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getExtensionAttributes()
+ {
+ return $this->getDataExtensionAttributes();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setExtensionAttributes(
+ \Ves\Blog\Api\Data\CategoryExtensionInterface $extensionAttributes
+ ) {
+ return $this->_setExtensionAttributes($extensionAttributes);
+ }
+
+}
diff --git a/Model/Comment.php b/Model/Comment.php
index 2c9e840..b6aee9f 100644
--- a/Model/Comment.php
+++ b/Model/Comment.php
@@ -1,257 +1,257 @@
-commentDataFactory = $commentDataFactory;
- $this->dataObjectHelper = $dataObjectHelper;
- parent::__construct($context, $registry, $resource, $resourceCollection, $data);
- }
-
- /**
- * Initialize resource model
- *
- * @return void
- */
- protected function _construct()
- {
- $this->_init('Ves\Blog\Model\ResourceModel\Comment');
- }
-
- /**
- * Retrieve comment model with comment data
- * @return CommentInterface
- */
- public function getDataModel()
- {
- $commentData = $this->getData();
-
- $commentDataObject = $this->commentDataFactory->create();
- $this->dataObjectHelper->populateWithArray(
- $commentDataObject,
- $commentData,
- CommentInterface::class
- );
-
- return $commentDataObject;
- }
-
- /**
- * Prepare page's statuses.
- * Available event cms_page_get_available_statuses to customize statuses.
- *
- * @return array
- */
- public function getAvailableStatuses()
- {
- return [self::STATUS_ENABLED => __('Enabled'), self::STATUS_DISABLED => __('Disabled')];
- }
-
- /**
- * {@inheritdoc}
- */
- public function getCommentId(){
- return $this->getData(self::COMMENT_ID);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setCommentId($value){
- return $this->setData(self::COMMENT_ID, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getPostId(){
- return $this->getData(self::POST_ID);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setPostId($value){
- return $this->setData(self::POST_ID, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getPosition(){
- return $this->getData(self::POSITION);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setPosition($value){
- return $this->setData(self::POSITION, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getContent(){
- return $this->getData(self::CONTENT);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setContent($value){
- return $this->setData(self::CONTENT, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getUserEmail(){
- return $this->getData(self::USER_EMAIL);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setUserEmail($value){
- return $this->setData(self::USER_EMAIL, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getUserName(){
- return $this->getData(self::USER_NAME);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setUserName($value){
- return $this->setData(self::USER_NAME, $value);
- }
-
-
- /**
- * {@inheritdoc}
- */
- public function getCreationTime(){
- return $this->getData(self::CREATION_TIME);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setCreationTime($value){
- return $this->setData(self::CREATION_TIME, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getHasRead(){
- return $this->getData(self::HAS_READ);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setHasRead($value){
- return $this->setData(self::HAS_READ, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getIsActive(){
- return $this->getData(self::IS_ACTIVE);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setIsActive($value){
- return $this->setData(self::IS_ACTIVE, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getParentId(){
- return $this->getData(self::PARENT_ID);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setParentId($value){
- return $this->setData(self::PARENT_ID, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getExtensionAttributes()
- {
- return $this->getDataExtensionAttributes();
- }
-
- /**
- * {@inheritdoc}
- */
- public function setExtensionAttributes(
- \Ves\Blog\Api\Data\CommentExtensionInterface $extensionAttributes
- ) {
- return $this->_setExtensionAttributes($extensionAttributes);
- }
-
-}
\ No newline at end of file
+commentDataFactory = $commentDataFactory;
+ $this->dataObjectHelper = $dataObjectHelper;
+ parent::__construct($context, $registry, $resource, $resourceCollection, $data);
+ }
+
+ /**
+ * Initialize resource model
+ *
+ * @return void
+ */
+ protected function _construct()
+ {
+ $this->_init(\Ves\Blog\Model\ResourceModel\Comment::class);
+ }
+
+ /**
+ * Retrieve comment model with comment data
+ * @return CommentInterface
+ */
+ public function getDataModel()
+ {
+ $commentData = $this->getData();
+
+ $commentDataObject = $this->commentDataFactory->create();
+ $this->dataObjectHelper->populateWithArray(
+ $commentDataObject,
+ $commentData,
+ CommentInterface::class
+ );
+
+ return $commentDataObject;
+ }
+
+ /**
+ * Prepare page's statuses.
+ * Available event cms_page_get_available_statuses to customize statuses.
+ *
+ * @return array
+ */
+ public function getAvailableStatuses()
+ {
+ return [self::STATUS_ENABLED => __('Enabled'), self::STATUS_DISABLED => __('Disabled')];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getCommentId(){
+ return $this->getData(self::COMMENT_ID);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setCommentId($value){
+ return $this->setData(self::COMMENT_ID, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getPostId(){
+ return $this->getData(self::POST_ID);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setPostId($value){
+ return $this->setData(self::POST_ID, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getPosition(){
+ return $this->getData(self::POSITION);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setPosition($value){
+ return $this->setData(self::POSITION, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getContent(){
+ return $this->getData(self::CONTENT);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setContent($value){
+ return $this->setData(self::CONTENT, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getUserEmail(){
+ return $this->getData(self::USER_EMAIL);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setUserEmail($value){
+ return $this->setData(self::USER_EMAIL, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getUserName(){
+ return $this->getData(self::USER_NAME);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setUserName($value){
+ return $this->setData(self::USER_NAME, $value);
+ }
+
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getCreationTime(){
+ return $this->getData(self::CREATION_TIME);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setCreationTime($value){
+ return $this->setData(self::CREATION_TIME, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getHasRead(){
+ return $this->getData(self::HAS_READ);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setHasRead($value){
+ return $this->setData(self::HAS_READ, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getIsActive(){
+ return $this->getData(self::IS_ACTIVE);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setIsActive($value){
+ return $this->setData(self::IS_ACTIVE, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getParentId(){
+ return $this->getData(self::PARENT_ID);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setParentId($value){
+ return $this->setData(self::PARENT_ID, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getExtensionAttributes()
+ {
+ return $this->getDataExtensionAttributes();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setExtensionAttributes(
+ \Ves\Blog\Api\Data\CommentExtensionInterface $extensionAttributes
+ ) {
+ return $this->_setExtensionAttributes($extensionAttributes);
+ }
+
+}
diff --git a/Model/Config/Source/CatOrderby.php b/Model/Config/Source/CatOrderby.php
index 935c5e2..fe9ed75 100644
--- a/Model/Config/Source/CatOrderby.php
+++ b/Model/Config/Source/CatOrderby.php
@@ -1,18 +1,18 @@
_categoryFactory = $categoryFactory;
}
@@ -48,4 +48,4 @@ public function toOptionArray()
}
return $options;
}
-}
\ No newline at end of file
+}
diff --git a/Model/Config/Source/FilterType.php b/Model/Config/Source/FilterType.php
index 159c663..c73c1cf 100644
--- a/Model/Config/Source/FilterType.php
+++ b/Model/Config/Source/FilterType.php
@@ -2,18 +2,18 @@
/**
* Venustheme
- *
+ *
* NOTICE OF LICENSE
- *
+ *
* This source file is subject to the Venustheme.com license that is
* available through the world-wide-web at this URL:
* http://www.venustheme.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 Venustheme
* @package Ves_Blog
* @copyright Copyright (c) 2016 Venustheme (http://www.venustheme.com/)
@@ -30,12 +30,18 @@ class FilterType implements \Magento\Framework\Option\ArrayInterface {
* @param \Ves\Blog\Model\Category
*/
public function __construct(
- \Ves\Blog\Model\Category $categoryFactory
+ \Ves\Blog\Model\Category $categoryFactory
) {
$this->_categoryFactory = $categoryFactory;
}
- public function toOptionArray() {
+ /**
+ * Options getter
+ *
+ * @return array
+ */
+ public function toOptionArray()
+ {
$options = [
[
'value' => 'categories',
diff --git a/Model/Config/Source/LatestPostsStyle.php b/Model/Config/Source/LatestPostsStyle.php
index 6ad7992..730377e 100644
--- a/Model/Config/Source/LatestPostsStyle.php
+++ b/Model/Config/Source/LatestPostsStyle.php
@@ -1,43 +1,44 @@
- self::STYLE1, 'label' => __('Style 1')],
- ['value' => self::STYLE2, 'label' => __('Style 2')],
- ['value' => self::STYLE3, 'label' => __('Style 3')],
- ['value' => self::STYLE4, 'label' => __('Style 4')]
- ];
- }
-}
+ self::STYLE1, 'label' => __('Style 1')],
+ ['value' => self::STYLE2, 'label' => __('Style 2')],
+ ['value' => self::STYLE3, 'label' => __('Style 3')],
+ ['value' => self::STYLE4, 'label' => __('Style 4')]
+ ];
+ }
+}
diff --git a/Model/Config/Source/Layout.php b/Model/Config/Source/Layout.php
index b273e31..c7b927b 100644
--- a/Model/Config/Source/Layout.php
+++ b/Model/Config/Source/Layout.php
@@ -1,18 +1,18 @@
_categoryFactory = $categoryFactory;
}
+ /**
+ * Options getter
+ *
+ * @return array
+ */
public function toOptionArray()
{
$options = [];
@@ -46,4 +51,4 @@ public function toOptionArray()
];
return $options;
}
-}
\ No newline at end of file
+}
diff --git a/Model/Config/Source/PostType.php b/Model/Config/Source/PostType.php
index 5427380..7871e6f 100644
--- a/Model/Config/Source/PostType.php
+++ b/Model/Config/Source/PostType.php
@@ -1,18 +1,18 @@
_categoryFactory = $categoryFactory;
}
@@ -50,4 +50,4 @@ public function toOptionArray()
];
return $options;
}
-}
\ No newline at end of file
+}
diff --git a/Model/Config/Source/Staticblock.php b/Model/Config/Source/Staticblock.php
index 9fa6195..4a0d9d7 100644
--- a/Model/Config/Source/Staticblock.php
+++ b/Model/Config/Source/Staticblock.php
@@ -1,59 +1,59 @@
-_groupModel = $blockModel;
- }
-
- /**
- * Options getter
- *
- * @return array
- */
- public function toOptionArray()
- {
- $collection = $this->_groupModel->getCollection();
- $blocks = array();
- foreach ($collection as $_block) {
- $blocks[] = [
- 'value' => $_block->getId(),
- 'label' => addslashes($_block->getTitle())
- ];
- }
- $blocks[] = [
- 'value' => 'pretext_html',
- 'label' => 'Pretext HTML'];
- array_unshift($blocks, array(
- 'value' => '',
- 'label' => '-- Please Select --',
- ));
- return $blocks;
- }
-}
\ No newline at end of file
+_groupModel = $blockModel;
+ }
+
+ /**
+ * Options getter
+ *
+ * @return array
+ */
+ public function toOptionArray()
+ {
+ $collection = $this->_groupModel->getCollection();
+ $blocks = array();
+ foreach ($collection as $_block) {
+ $blocks[] = [
+ 'value' => $_block->getId(),
+ 'label' => addslashes($_block->getTitle())
+ ];
+ }
+ $blocks[] = [
+ 'value' => 'pretext_html',
+ 'label' => 'Pretext HTML'];
+ array_unshift($blocks, array(
+ 'value' => '',
+ 'label' => '-- Please Select --',
+ ));
+ return $blocks;
+ }
+}
diff --git a/Model/Config/Source/Tab.php b/Model/Config/Source/Tab.php
index b15b343..6fd86ef 100644
--- a/Model/Config/Source/Tab.php
+++ b/Model/Config/Source/Tab.php
@@ -1,56 +1,61 @@
-_categoryFactory = $categoryFactory;
- }
-
- public function toOptionArray()
- {
- $options = [];
- $collection = $this->_categoryFactory->getCollection();
- foreach ($collection as $_cat) {
- $options[] = [
- 'label' => $_cat->getName(),
- 'value' => $_cat->getCategoryId()
- ];
- }
- $options[] = ['value' => 'popular', 'label' => __('Popular')];
- $options[] = ['value' => 'recents', 'label' => __('Recents')];
- $options[] = ['value' => 'random', 'label' => __('Random')];
- $options[] = ['value' => 'rate', 'label' => __('Rate')];
-
- return $options;
- }
-}
\ No newline at end of file
+_categoryFactory = $categoryFactory;
+ }
+
+ /**
+ * Options getter
+ *
+ * @return array
+ */
+ public function toOptionArray()
+ {
+ $options = [];
+ $collection = $this->_categoryFactory->getCollection();
+ foreach ($collection as $_cat) {
+ $options[] = [
+ 'label' => $_cat->getName(),
+ 'value' => $_cat->getCategoryId()
+ ];
+ }
+ $options[] = ['value' => 'popular', 'label' => __('Popular')];
+ $options[] = ['value' => 'recents', 'label' => __('Recents')];
+ $options[] = ['value' => 'random', 'label' => __('Random')];
+ $options[] = ['value' => 'rate', 'label' => __('Rate')];
+
+ return $options;
+ }
+}
diff --git a/Model/Config/Source/ThumbnailType.php b/Model/Config/Source/ThumbnailType.php
index a00d658..0a5aa08 100644
--- a/Model/Config/Source/ThumbnailType.php
+++ b/Model/Config/Source/ThumbnailType.php
@@ -1,35 +1,40 @@
- __('Image'),
- 2 => __('Video'),
- ];
- return $options;
- }
-}
\ No newline at end of file
+ __('Image'),
+ 2 => __('Video'),
+ ];
+ return $options;
+ }
+}
diff --git a/Model/Config/Source/User.php b/Model/Config/Source/User.php
index 3d56588..3a14467 100644
--- a/Model/Config/Source/User.php
+++ b/Model/Config/Source/User.php
@@ -1,18 +1,18 @@
_userFactory = $userFactory;
$this->_authorFactory = $authorFactory;
}
+ /**
+ * @inheritdoc
+ */
public function toOptionArray()
{
$collection = $this->_authorFactory->getCollection();
$options = [];
$options[0] = __(' ');
-
+
if($collection->count()){
$collection = $this->_authorFactory->getCollection();
foreach ($collection as $_author) {
@@ -63,4 +71,4 @@ public function toOptionArray()
}
return $options;
}
-}
\ No newline at end of file
+}
diff --git a/Model/Config/Source/VideoType.php b/Model/Config/Source/VideoType.php
index 0af3491..72b1cb7 100644
--- a/Model/Config/Source/VideoType.php
+++ b/Model/Config/Source/VideoType.php
@@ -1,35 +1,38 @@
- __('Youtube'),
- 2 => __('Vimeo'),
- ];
- return $options;
- }
-}
\ No newline at end of file
+ __('Youtube'),
+ 2 => __('Vimeo'),
+ ];
+ return $options;
+ }
+}
diff --git a/Model/Config/Source/WidgetStyle.php b/Model/Config/Source/WidgetStyle.php
index 604a09b..917b422 100644
--- a/Model/Config/Source/WidgetStyle.php
+++ b/Model/Config/Source/WidgetStyle.php
@@ -1,18 +1,18 @@
_categoryFactory = $categoryFactory;
- }
-
public function toOptionArray()
{
$options = [];
@@ -66,4 +58,4 @@ public function toOptionArray()
];
return $options;
}
-}
\ No newline at end of file
+}
diff --git a/Model/Feed.php b/Model/Feed.php
index f08a997..33ab031 100644
--- a/Model/Feed.php
+++ b/Model/Feed.php
@@ -1,18 +1,18 @@
_storeManager = $storeManager;
$this->_url = $url;
parent::__construct($context, $registry, $resource, $resourceCollection, $data);
@@ -71,7 +71,7 @@ public function __construct(
*/
protected function _construct()
{
- $this->_init('Ves\Blog\Model\ResourceModel\Feed');
+ $this->_init(\Ves\Blog\Model\ResourceModel\Feed::class);
}
-}
\ No newline at end of file
+}
diff --git a/Model/Import/AbstractImport.php b/Model/Import/AbstractImport.php
index 31f4147..3059336 100644
--- a/Model/Import/AbstractImport.php
+++ b/Model/Import/AbstractImport.php
@@ -1,18 +1,18 @@
_postFactory = $postFactory;
$this->_categoryFactory = $categoryFactory;
$this->_commentFactory = $commentFactory;
@@ -99,6 +101,9 @@ public function __construct(
parent::__construct($context, $registry, $resource, $resourceCollection, $data);
}
+ /**
+ * @inheritdoc
+ */
protected function _connect()
{
$con = '';
@@ -109,7 +114,7 @@ protected function _connect()
$dbhost = $this->getData('dbhost');
$charset = $this->getData('connect_charset');
$charset = $charset?$charset:'utf8mb4';
-
+
if($dbname=='' || $uname=='' || $pwd=='' || $dbhost==''){
throw new \Exception(__("Some fields are required"));
}
@@ -118,7 +123,7 @@ protected function _connect()
'dbname' => $dbname,
'username' => $uname,
'password' => $pwd,
- 'active' => '1',
+ 'active' => '1',
));
$con->query("SET character_set_results = '".$charset."', character_set_client = '".$charset."', character_set_connection = '".$charset."', character_set_database = '".$charset."', character_set_server = '".$charset."'");
} catch (\Exception $e) {
@@ -138,7 +143,8 @@ protected function getImageImportFolder($path)
return $images . '/';
}
- public function getConnection(){
+ public function getConnection()
+ {
if(!$this->_connect){
$this->_connect();
}
diff --git a/Model/Import/Wordpress.php b/Model/Import/Wordpress.php
index f782d32..78ee88a 100644
--- a/Model/Import/Wordpress.php
+++ b/Model/Import/Wordpress.php
@@ -1,18 +1,18 @@
getData('import_posts');
@@ -65,7 +68,7 @@ public function execute()
$data[$i]['name'] = $cat['name'];
$data[$i]['parent_id'] = $cat['parent'];
$data[$i]['stores'] = [$this->_storeManager->getDefaultStoreView()->getStoreId()];
- $i++;
+ $i++;
}
}
if($data){
@@ -79,7 +82,7 @@ public function execute()
$_cat['category_id'] = $category->getId();
$_cat['image'] = $_cat['layout_type'] = $_cat['orderby'] = $_cat['comments'] = $_cat['item_per_page'] = $_cat['lg_column_item'] = $_cat['md_column_item'] = $_cat['sm_column_item'] = $_cat['xs_column_item'] = $_cat['page_layout'] = $_cat['page_title'] = $_cat['canonical_url'] = $_cat['layout_update_xml'] = $_cat['meta_keywords'] = $_cat['meta_description'] = $_cat['posts_style'] = $_cat['posts_template'] = $_cat['post_template'] = '';
}
- $_cat['importing'] = true;
+ $_cat['importing'] = true;
$category->setData($_cat)->save();
$cats[] = $this->drawItems($data, $_cat, 0, $category->getId());
$oldCategories = $this->_oldCategories;
@@ -126,12 +129,12 @@ public function execute()
// Image
$image = '';
$real_image_url = '';
- $sql = "SELECT ( SELECT guid FROM " . $prefix . "posts WHERE id = m.meta_value ) AS url
+ $sql = "SELECT ( SELECT guid FROM " . $prefix . "posts WHERE id = m.meta_value ) AS url
FROM " . $prefix . "posts p, " . $prefix . "postmeta m
WHERE p.post_type = 'post'
AND p.post_status = 'publish'
AND p.id = m.post_id
- AND m.meta_key = '_thumbnail_id'
+ AND m.meta_key = '_thumbnail_id'
AND p.id = '" . $data['ID'] . "'" ;
$result3 = $this->_mysqliQuery($sql);
if($result3){
@@ -146,8 +149,8 @@ public function execute()
}
}
}
-
-
+
+
// Tags
$postTags = [];
if($importTags){
@@ -257,7 +260,11 @@ public function execute()
}
}
- public function decodeImg($str){
+ public function decodeImg($str)
+ {
+ if (!$str) {
+ return $str;
+ }
$count = substr_count($str, "
_categoryFactory->create();
return $category->load((int)$cat_id);
}
- public function drawItems($collection, $cat, $level = 0, $parentId = ''){
+ public function drawItems($collection, $cat, $level = 0, $parentId = '')
+ {
$overwrite = $this->getData('overwrite');
$oldCategories = $this->_oldCategories;
foreach ($collection as $_cat) {
@@ -312,4 +321,4 @@ public function drawItems($collection, $cat, $level = 0, $parentId = ''){
return $cat;
}
-}
\ No newline at end of file
+}
diff --git a/Model/Importer.php b/Model/Importer.php
index 91fe814..1756fb8 100644
--- a/Model/Importer.php
+++ b/Model/Importer.php
@@ -1,18 +1,18 @@
_storeManager = $storeManager;
$this->_url = $url;
$this->_wordpress = $wordpress;
@@ -75,18 +75,24 @@ public function __construct(
*/
protected function _construct()
{
- $this->_init('Ves\Blog\Model\ResourceModel\Importer');
+ $this->_init(\Ves\Blog\Model\ResourceModel\Importer::class);
}
- public function runImport(){
+ /**
+ * run import
+ *
+ * @return bool
+ */
+ public function runImport()
+ {
if($this->getId()){
$data = $this->getData();
$this->_wordpress->setData($data)->execute();
$current_datetime = date("Y-m-d H:i:s");
- try{
+ try {
$this->setData("last_import_time", $current_datetime);
$this->save();
- }catch (\Exception $e) {
+ } catch (\Exception $e) {
throw new \Exception("Can not update importer.");
}
return true;
@@ -94,4 +100,4 @@ public function runImport(){
return false;
}
-}
\ No newline at end of file
+}
diff --git a/Model/ImporterLog.php b/Model/ImporterLog.php
index 32c53ed..2eba7cc 100644
--- a/Model/ImporterLog.php
+++ b/Model/ImporterLog.php
@@ -1,18 +1,18 @@
_storeManager = $storeManager;
$this->_url = $url;
$this->_wordpress = $wordpress;
@@ -72,4 +72,4 @@ protected function _construct()
$this->_init('Ves\Blog\Model\ResourceModel\ImporterLog');
}
-}
\ No newline at end of file
+}
diff --git a/Model/Post.php b/Model/Post.php
index 4b6570e..7ff9750 100644
--- a/Model/Post.php
+++ b/Model/Post.php
@@ -109,8 +109,6 @@ class Post extends \Magento\Framework\Model\AbstractModel implements PostInterfa
* Post constructor.
* @param \Magento\Framework\Model\Context $context
* @param \Magento\Framework\Registry $registry
- * @param ResourceModel\Post|null $resource
- * @param ResourceModel\Post\Collection|null $resourceCollection
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
* @param \Magento\Framework\UrlInterface $url
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
@@ -118,13 +116,14 @@ class Post extends \Magento\Framework\Model\AbstractModel implements PostInterfa
* @param PostInterfaceFactory $postDataFactory
* @param DataObjectHelper $dataObjectHelper
* @param CollectionFactory $collectionFactory
+ * @param ResourceModel\Post|null $resource
+ * @param ResourceModel\Post\Collection|null $resourceCollection
* @param array $data
*/
public function __construct(
\Magento\Framework\Model\Context $context,
\Magento\Framework\Registry $registry,
- \Ves\Blog\Model\ResourceModel\Post $resource = null,
- \Ves\Blog\Model\ResourceModel\Post\Collection $resourceCollection = null,
+
\Magento\Store\Model\StoreManagerInterface $storeManager,
\Magento\Framework\UrlInterface $url,
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
@@ -132,8 +131,10 @@ public function __construct(
PostInterfaceFactory $postDataFactory,
DataObjectHelper $dataObjectHelper,
CollectionFactory $collectionFactory,
+ \Ves\Blog\Model\ResourceModel\Post $resource = null,
+ \Ves\Blog\Model\ResourceModel\Post\Collection $resourceCollection = null,
array $data = []
- ) {
+ ) {
$this->_storeManager = $storeManager;
$this->_url = $url;
$this->filterProvider = $filterProvider;
diff --git a/Model/ResourceModel/Author.php b/Model/ResourceModel/Author.php
index a64aefe..c281570 100644
--- a/Model/ResourceModel/Author.php
+++ b/Model/ResourceModel/Author.php
@@ -1,104 +1,100 @@
-_storeManager = $storeManager;
- $this->_date = $date;
- }
-
- /**
- * Initialize resource model
- *
- * @return void
- */
- protected function _construct()
- {
- $this->_init('ves_blog_post_author', 'author_id');
- }
- /*
- public function load(AbstractModel $object, $value, $field = null)
- {
- $field = 'user_id';
- if (!is_numeric($value)) {
- $field = 'user_name';
- }
- return parent::load($object, $value, $field);
- }
- */
- public function getIsUniqueIdentifier(AbstractModel $object)
- {
- $select = $this->getConnection()->select()->from(
- ['lga' => $this->getMainTable()]
- )->where(
- 'lga.user_name = ?',
- $object->getData('user_name')
- );
- if ($object->getId()) {
- $select->where('lga.author_id <> ?', $object->getId());
- }
- if ($this->getConnection()->fetchRow($select)) {
- return false;
- }
-
- return true;
- }
-
- protected function _beforeSave(AbstractModel $object)
- {
- if (!$this->getIsUniqueIdentifier($object)) {
- throw new \Magento\Framework\Exception\LocalizedException(
- __('A author identifier with the same properties already exists.')
- );
- }
- return $this;
- }
- public function getDate(){
- return $this->_date;
- }
-}
\ No newline at end of file
+_storeManager = $storeManager;
+ $this->_date = $date;
+ }
+
+ /**
+ * Initialize resource model
+ *
+ * @return void
+ */
+ protected function _construct()
+ {
+ $this->_init('ves_blog_post_author', 'author_id');
+ }
+
+ public function getIsUniqueIdentifier(AbstractModel $object)
+ {
+ $select = $this->getConnection()->select()->from(
+ ['lga' => $this->getMainTable()]
+ )->where(
+ 'lga.user_name = ?',
+ $object->getData('user_name')
+ );
+ if ($object->getId()) {
+ $select->where('lga.author_id <> ?', $object->getId());
+ }
+ if ($this->getConnection()->fetchRow($select)) {
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ protected function _beforeSave(AbstractModel $object)
+ {
+ if (!$this->getIsUniqueIdentifier($object)) {
+ throw new \Magento\Framework\Exception\LocalizedException(
+ __('A author identifier with the same properties already exists.')
+ );
+ }
+ return $this;
+ }
+
+ public function getDate()
+ {
+ return $this->_date;
+ }
+}
diff --git a/Model/ResourceModel/Category.php b/Model/ResourceModel/Category.php
index f379c7e..4dee662 100644
--- a/Model/ResourceModel/Category.php
+++ b/Model/ResourceModel/Category.php
@@ -1,299 +1,301 @@
-_storeManager = $storeManager;
- $this->_date = $date;
- }
-
- /**
- * Initialize resource model
- *
- * @return void
- */
- protected function _construct()
- {
- $this->_init('ves_blog_category', 'category_id');
- }
-
- /**
- * Process block data before deleting
- *
- * @param \Magento\Framework\Model\AbstractModel $object
- * @return \Magento\Cms\Model\ResourceModel\Page
- */
- protected function _beforeDelete(\Magento\Framework\Model\AbstractModel $object)
- {
- $condition = ['category_id = ?' => (int)$object->getId()];
-
- $this->getConnection()->delete($this->getTable('ves_blog_category_store'), $condition);
-
- return parent::_beforeDelete($object);
- }
-
- /**
- * Perform operations before object save
- *
- * @param \Magento\Framework\Model\AbstractModel $object
- * @return $this
- * @throws \Magento\Framework\Exception\LocalizedException
- */
- protected function _beforeSave(\Magento\Framework\Model\AbstractModel $object)
- {
- if (!$this->getIsUniqueBlockToStores($object) && !$object->getData('importing')) {
- throw new \Magento\Framework\Exception\LocalizedException(
- __('A category identifier with the same properties already exists in the selected store.')
- );
- }
- if($object->getData('importing') && !$this->getIsUniqueBlockToStores($object) && !$object->getData('overwrite')){
- $data = $object->getData();
- $data['identifier'] = $data['identifier'] . time();
- $object->setData($data);
- }
- return $this;
- }
-
- /**
- * Perform operations after object save
- *
- * @param \Magento\Framework\Model\AbstractModel $object
- * @return $this
- */
- protected function _afterSave(\Magento\Framework\Model\AbstractModel $object)
- {
- $catData = $object->getData();
- if(isset($catData['stores']) || isset($catData['store_ids'])){
- if(isset($catData['stores'])){
- $stores = $object->getStores();
- }elseif(isset($catData['store_ids'])){
- $stores = $object->getStoreIds();
- }
- $table = $this->getTable('ves_blog_category_store');
- $where = ['category_id = ?' => (int)$object->getId()];
- $this->getConnection()->delete($table, $where);
- if (!empty($stores)) {
- $data = [];
- foreach ($stores as $storeId) {
- $data[] = ['category_id' => (int)$object->getId(), 'store_id' => (int)$storeId];
- }
- try{
- $this->getConnection()->insertMultiple($table, $data);
- }catch(\Exception $e){
- die($e->getMessage());
- }
- }
- }
-
- // Category posts
- if(isset($catData['posts'])){
- $posts = $object->getData('posts');
- $data = [];
- $table = $this->getTable('ves_blog_post_category');
- $where = ['category_id = ?' => (int)$object->getId()];
- $this->getConnection()->delete($table, $where);
- if(!empty($posts)){
- foreach ($posts as $k => $_post) {
- $data[] = [
- 'post_id' => $k,
- 'category_id' => (int)$object->getId(),
- 'position' => $_post['position']
- ];
- }
- try{
- $this->getConnection()->insertMultiple($table, $data);
- }catch(\Exception $e){
- die($e->getMessage());
- }
- }
- }
-
- return parent::_afterSave($object);
- }
-
- /**
- * Load an object using 'identifier' field if there's no field specified and value is not numeric
- *
- * @param \Magento\Framework\Model\AbstractModel $object
- * @param mixed $value
- * @param string $field
- * @return $this
- */
- public function load(\Magento\Framework\Model\AbstractModel $object, $value, $field = null)
- {
- if (!is_numeric($value) && $field === null) {
- $field = 'identifier';
- }
-
- return parent::load($object, $value, $field);
- }
-
- /**
- * Perform operations after object load
- *
- * @param \Magento\Framework\Model\AbstractModel $object
- * @return $this
- */
- protected function _afterLoad(\Magento\Framework\Model\AbstractModel $object)
- {
- if ($object->getId()) {
- $stores = $this->lookupStoreIds($object->getId());
- $object->setData('store_id', $stores);
- $object->setData('stores', $stores);
- $object->setData('store_ids', $stores);
- }
- if ($id = $object->getId()) {
- $connection = $this->getConnection();
- $select = $connection->select()
- ->from($this->getTable('ves_blog_post_category'))
- ->where(
- 'category_id = '.(int)$id
- );
- $posts = $connection->fetchAll($select);
- $object->setData('posts', $posts);
- }
- return parent::_afterLoad($object);
- }
-
- /**
- * Retrieve select object for load object data
- *
- * @param string $field
- * @param mixed $value
- * @param \Magento\Cms\Model\Block $object
- * @return \Magento\Framework\DB\Select
- */
- protected function _getLoadSelect($field, $value, $object)
- {
- $select = parent::_getLoadSelect($field, $value, $object);
-
- if ($object->getStoreId()) {
- $stores = [(int)$object->getStoreId(), \Magento\Store\Model\Store::DEFAULT_STORE_ID];
-
- $select->join(
- ['cbs' => $this->getTable('ves_blog_category_store')],
- $this->getMainTable() . '.category_id = cbs.category_id',
- ['store_id']
- )->where(
- 'is_active = ?',
- 1
- )->where(
- 'cbs.store_id in (?)',
- $stores
- )->order(
- 'store_id DESC'
- )->limit(
- 1
- );
- }
-
- return $select;
- }
-
- /**
- * Check for unique of identifier of block to selected store(s).
- *
- * @param \Magento\Framework\Model\AbstractModel $object
- * @return bool
- * @SuppressWarnings(PHPMD.BooleanGetMethodName)
- */
- public function getIsUniqueBlockToStores(\Magento\Framework\Model\AbstractModel $object)
- {
- if ($this->_storeManager->hasSingleStore()) {
- $stores = [\Magento\Store\Model\Store::DEFAULT_STORE_ID];
- } else {
- $stores = (array)$object->getData('stores');
- }
-
- $select = $this->getConnection()->select()->from(
- ['cb' => $this->getMainTable()]
- )->join(
- ['cbs' => $this->getTable('ves_blog_category_store')],
- 'cb.category_id = cbs.category_id',
- []
- )->where(
- 'cb.identifier = ?',
- $object->getData('identifier')
- )->where(
- 'cbs.store_id IN (?)',
- $stores
- );
-
- if ($object->getId()) {
- $select->where('cb.category_id <> ?', $object->getId());
- }
-
- if ($this->getConnection()->fetchRow($select)) {
- return false;
- }
-
- return true;
- }
-
- /**
- * Get store ids to which specified item is assigned
- *
- * @param int $id
- * @return array
- */
- public function lookupStoreIds($id)
- {
- $connection = $this->getConnection();
-
- $select = $connection->select()->from(
- $this->getTable('ves_blog_category_store'),
- 'store_id'
- )->where(
- 'category_id = :category_id'
- );
-
- $binds = [':category_id' => (int)$id];
-
- return $connection->fetchCol($select, $binds);
- }
- public function getDate(){
- return $this->_date;
- }
-}
+_storeManager = $storeManager;
+ $this->_date = $date;
+ }
+
+ /**
+ * Initialize resource model
+ *
+ * @return void
+ */
+ protected function _construct()
+ {
+ $this->_init('ves_blog_category', 'category_id');
+ }
+
+ /**
+ * Process block data before deleting
+ *
+ * @param \Magento\Framework\Model\AbstractModel $object
+ * @return \Magento\Cms\Model\ResourceModel\Page
+ */
+ protected function _beforeDelete(\Magento\Framework\Model\AbstractModel $object)
+ {
+ $condition = ['category_id = ?' => (int)$object->getId()];
+
+ $this->getConnection()->delete($this->getTable('ves_blog_category_store'), $condition);
+
+ return parent::_beforeDelete($object);
+ }
+
+ /**
+ * Perform operations before object save
+ *
+ * @param \Magento\Framework\Model\AbstractModel $object
+ * @return $this
+ * @throws \Magento\Framework\Exception\LocalizedException
+ */
+ protected function _beforeSave(\Magento\Framework\Model\AbstractModel $object)
+ {
+ if (!$this->getIsUniqueBlockToStores($object) && !$object->getData('importing')) {
+ throw new \Magento\Framework\Exception\LocalizedException(
+ __('A category identifier with the same properties already exists in the selected store.')
+ );
+ }
+ if($object->getData('importing') && !$this->getIsUniqueBlockToStores($object) && !$object->getData('overwrite')){
+ $data = $object->getData();
+ $data['identifier'] = $data['identifier'] . time();
+ $object->setData($data);
+ }
+ return $this;
+ }
+
+ /**
+ * Perform operations after object save
+ *
+ * @param \Magento\Framework\Model\AbstractModel $object
+ * @return $this
+ */
+ protected function _afterSave(\Magento\Framework\Model\AbstractModel $object)
+ {
+ $catData = $object->getData();
+ if(isset($catData['stores']) || isset($catData['store_ids'])){
+ if(isset($catData['stores'])){
+ $stores = $object->getStores();
+ }elseif(isset($catData['store_ids'])){
+ $stores = $object->getStoreIds();
+ }
+ $table = $this->getTable('ves_blog_category_store');
+ $where = ['category_id = ?' => (int)$object->getId()];
+ $this->getConnection()->delete($table, $where);
+ if (!empty($stores)) {
+ $data = [];
+ foreach ($stores as $storeId) {
+ $data[] = ['category_id' => (int)$object->getId(), 'store_id' => (int)$storeId];
+ }
+ try{
+ $this->getConnection()->insertMultiple($table, $data);
+ }catch(\Exception $e){
+ die($e->getMessage());
+ }
+ }
+ }
+
+ // Category posts
+ if(isset($catData['posts'])){
+ $posts = $object->getData('posts');
+ $data = [];
+ $table = $this->getTable('ves_blog_post_category');
+ $where = ['category_id = ?' => (int)$object->getId()];
+ $this->getConnection()->delete($table, $where);
+ if(!empty($posts)){
+ foreach ($posts as $k => $_post) {
+ $data[] = [
+ 'post_id' => $k,
+ 'category_id' => (int)$object->getId(),
+ 'position' => $_post['position']
+ ];
+ }
+ try{
+ $this->getConnection()->insertMultiple($table, $data);
+ }catch(\Exception $e){
+ die($e->getMessage());
+ }
+ }
+ }
+
+ return parent::_afterSave($object);
+ }
+
+ /**
+ * Load an object using 'identifier' field if there's no field specified and value is not numeric
+ *
+ * @param \Magento\Framework\Model\AbstractModel $object
+ * @param mixed $value
+ * @param string $field
+ * @return $this
+ */
+ public function load(\Magento\Framework\Model\AbstractModel $object, $value, $field = null)
+ {
+ if (!is_numeric($value) && $field === null) {
+ $field = 'identifier';
+ }
+
+ return parent::load($object, $value, $field);
+ }
+
+ /**
+ * Perform operations after object load
+ *
+ * @param \Magento\Framework\Model\AbstractModel $object
+ * @return $this
+ */
+ protected function _afterLoad(\Magento\Framework\Model\AbstractModel $object)
+ {
+ if ($object->getId()) {
+ $stores = $this->lookupStoreIds($object->getId());
+ $object->setData('store_id', $stores);
+ $object->setData('stores', $stores);
+ $object->setData('store_ids', $stores);
+ }
+ if ($id = $object->getId()) {
+ $connection = $this->getConnection();
+ $select = $connection->select()
+ ->from($this->getTable('ves_blog_post_category'))
+ ->where(
+ 'category_id = '.(int)$id
+ );
+ $posts = $connection->fetchAll($select);
+ $object->setData('posts', $posts);
+ }
+ return parent::_afterLoad($object);
+ }
+
+ /**
+ * Retrieve select object for load object data
+ *
+ * @param string $field
+ * @param mixed $value
+ * @param \Magento\Cms\Model\Block $object
+ * @return \Magento\Framework\DB\Select
+ */
+ protected function _getLoadSelect($field, $value, $object)
+ {
+ $select = parent::_getLoadSelect($field, $value, $object);
+
+ if ($object->getStoreId()) {
+ $stores = [(int)$object->getStoreId(), \Magento\Store\Model\Store::DEFAULT_STORE_ID];
+
+ $select->join(
+ ['cbs' => $this->getTable('ves_blog_category_store')],
+ $this->getMainTable() . '.category_id = cbs.category_id',
+ ['store_id']
+ )->where(
+ 'is_active = ?',
+ 1
+ )->where(
+ 'cbs.store_id in (?)',
+ $stores
+ )->order(
+ 'store_id DESC'
+ )->limit(
+ 1
+ );
+ }
+
+ return $select;
+ }
+
+ /**
+ * Check for unique of identifier of block to selected store(s).
+ *
+ * @param \Magento\Framework\Model\AbstractModel $object
+ * @return bool
+ * @SuppressWarnings(PHPMD.BooleanGetMethodName)
+ */
+ public function getIsUniqueBlockToStores(\Magento\Framework\Model\AbstractModel $object)
+ {
+ if ($this->_storeManager->hasSingleStore()) {
+ $stores = [\Magento\Store\Model\Store::DEFAULT_STORE_ID];
+ } else {
+ $stores = (array)$object->getData('stores');
+ }
+
+ $select = $this->getConnection()->select()->from(
+ ['cb' => $this->getMainTable()]
+ )->join(
+ ['cbs' => $this->getTable('ves_blog_category_store')],
+ 'cb.category_id = cbs.category_id',
+ []
+ )->where(
+ 'cb.identifier = ?',
+ $object->getData('identifier')
+ )->where(
+ 'cbs.store_id IN (?)',
+ $stores
+ );
+
+ if ($object->getId()) {
+ $select->where('cb.category_id <> ?', $object->getId());
+ }
+
+ if ($this->getConnection()->fetchRow($select)) {
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Get store ids to which specified item is assigned
+ *
+ * @param int $id
+ * @return array
+ */
+ public function lookupStoreIds($id)
+ {
+ $connection = $this->getConnection();
+
+ $select = $connection->select()->from(
+ $this->getTable('ves_blog_category_store'),
+ 'store_id'
+ )->where(
+ 'category_id = :category_id'
+ );
+
+ $binds = [':category_id' => (int)$id];
+
+ return $connection->fetchCol($select, $binds);
+ }
+
+ public function getDate()
+ {
+ return $this->_date;
+ }
+}
diff --git a/Model/ResourceModel/Category/Collection.php b/Model/ResourceModel/Category/Collection.php
index dac092c..8450d3f 100644
--- a/Model/ResourceModel/Category/Collection.php
+++ b/Model/ResourceModel/Category/Collection.php
@@ -1,18 +1,18 @@
joinStoreRelationTable('ves_blog_category_store', 'category_id');
}
-
+
public function addActiveFilter(){
return $this
->addFieldToFilter('is_active', 1);
diff --git a/Model/ResourceModel/Comment.php b/Model/ResourceModel/Comment.php
index 2dca87a..b2374df 100644
--- a/Model/ResourceModel/Comment.php
+++ b/Model/ResourceModel/Comment.php
@@ -1,244 +1,244 @@
-_storeManager = $storeManager;
- $this->_date;
- }
-
- /**
- * Initialize resource model
- *
- * @return void
- */
- protected function _construct()
- {
- $this->_init('ves_blog_comment', 'comment_id');
- }
-
- /**
- * Process block data before deleting
- *
- * @param \Magento\Framework\Model\AbstractModel $object
- * @return \Magento\Cms\Model\ResourceModel\Page
- */
- protected function _beforeDelete(\Magento\Framework\Model\AbstractModel $object)
- {
- $condition = ['comment_id = ?' => (int)$object->getId()];
-
- $this->getConnection()->delete($this->getTable('ves_blog_comment_store'), $condition);
-
- return parent::_beforeDelete($object);
- }
-
- /**
- * Perform operations before object save
- *
- * @param \Magento\Framework\Model\AbstractModel $object
- * @return $this
- * @throws \Magento\Framework\Exception\LocalizedException
- */
- protected function _beforeSave(\Magento\Framework\Model\AbstractModel $object)
- {
- return $this;
- }
-
- /**
- * Perform operations after object save
- *
- * @param \Magento\Framework\Model\AbstractModel $object
- * @return $this
- */
- protected function _afterSave(\Magento\Framework\Model\AbstractModel $object)
- {
- // STORE
- $oldStores = $this->lookupStoreIds($object->getId());
- $newStores = (array)$object->getStores();
-
- if($newStores) {
- $table = $this->getTable('ves_blog_comment_store');
- $insert = array_diff($newStores, $oldStores);
- $delete = array_diff($oldStores, $newStores);
-
- if ($delete) {
- $where = ['comment_id = ?' => (int)$object->getId(), 'store_id IN (?)' => $delete];
-
- $this->getConnection()->delete($table, $where);
- }
-
- if ($insert) {
- $data = [];
-
- foreach ($insert as $storeId) {
- $data[] = ['comment_id' => (int)$object->getId(), 'store_id' => (int)$storeId];
- }
-
- $this->getConnection()->insertMultiple($table, $data);
- }
- }
-
- return parent::_afterSave($object);
- }
-
- /**
- * Perform operations after object load
- *
- * @param \Magento\Framework\Model\AbstractModel $object
- * @return $this
- */
- protected function _afterLoad(\Magento\Framework\Model\AbstractModel $object)
- {
- if ($object->getId()) {
- $stores = $this->lookupStoreIds($object->getId());
- $object->setData('store_id', $stores);
- $object->setData('stores', $stores);
-
- $connection = $this->getConnection();
- $select = $connection->select()->from($this->getTable('ves_blog_comment'))
- ->where('comment_id = ' . $object->getId());
- $comments = $connection->fetchAll($select);
- $object->setData("comments", $comments);
- }
- return parent::_afterLoad($object);
- }
-
- /**
- * Retrieve select object for load object data
- *
- * @param string $field
- * @param mixed $value
- * @param \Magento\Cms\Model\Block $object
- * @return \Magento\Framework\DB\Select
- */
- protected function _getLoadSelect($field, $value, $object)
- {
- $select = parent::_getLoadSelect($field, $value, $object);
-
- if ($object->getStoreId()) {
- $stores = [(int)$object->getStoreId(), \Magento\Store\Model\Store::DEFAULT_STORE_ID];
-
- $select->join(
- ['cbs' => $this->getTable('ves_blog_comment_store')],
- $this->getMainTable() . '.comment_id = cbs.comment_id',
- ['store_id']
- )->where(
- 'is_active = ?',
- 1
- )->where(
- 'cbs.store_id in (?)',
- $stores
- )->order(
- 'store_id DESC'
- )->limit(
- 1
- );
- }
-
- return $select;
- }
-
- /**
- * Check for unique of identifier of block to selected store(s).
- *
- * @param \Magento\Framework\Model\AbstractModel $object
- * @return bool
- * @SuppressWarnings(PHPMD.BooleanGetMethodName)
- */
- public function getIsUniqueBlockToStores(\Magento\Framework\Model\AbstractModel $object)
- {
- if ($this->_storeManager->hasSingleStore()) {
- $stores = [\Magento\Store\Model\Store::DEFAULT_STORE_ID];
- } else {
- $stores = (array)$object->getData('stores');
- }
-
- $select = $this->getConnection()->select()->from(
- ['cb' => $this->getMainTable()]
- )->join(
- ['cbs' => $this->getTable('ves_blog_comment_store')],
- 'cb.comment_id = cbs.comment_id',
- []
- )->where(
- 'cbs.store_id IN (?)',
- $stores
- );
-
- if ($object->getId()) {
- $select->where('cb.comment_id <> ?', $object->getId());
- }
-
- if ($this->getConnection()->fetchRow($select)) {
- return false;
- }
-
- return true;
- }
-
- /**
- * Get store ids to which specified item is assigned
- *
- * @param int $id
- * @return array
- */
- public function lookupStoreIds($id)
- {
- $connection = $this->getConnection();
-
- $select = $connection->select()->from(
- $this->getTable('ves_blog_comment_store'),
- 'store_id'
- )->where(
- 'comment_id = :comment_id'
- );
-
- $binds = [':comment_id' => (int)$id];
-
- return $connection->fetchCol($select, $binds);
- }
- public function getDate(){
- return $this->_date;
- }
-}
+_storeManager = $storeManager;
+ $this->_date = $date;
+ }
+
+ /**
+ * Initialize resource model
+ *
+ * @return void
+ */
+ protected function _construct()
+ {
+ $this->_init('ves_blog_comment', 'comment_id');
+ }
+
+ /**
+ * Process block data before deleting
+ *
+ * @param \Magento\Framework\Model\AbstractModel $object
+ * @return \Magento\Cms\Model\ResourceModel\Page
+ */
+ protected function _beforeDelete(\Magento\Framework\Model\AbstractModel $object)
+ {
+ $condition = ['comment_id = ?' => (int)$object->getId()];
+
+ $this->getConnection()->delete($this->getTable('ves_blog_comment_store'), $condition);
+
+ return parent::_beforeDelete($object);
+ }
+
+ /**
+ * Perform operations before object save
+ *
+ * @param \Magento\Framework\Model\AbstractModel $object
+ * @return $this
+ * @throws \Magento\Framework\Exception\LocalizedException
+ */
+ protected function _beforeSave(\Magento\Framework\Model\AbstractModel $object)
+ {
+ return $this;
+ }
+
+ /**
+ * Perform operations after object save
+ *
+ * @param \Magento\Framework\Model\AbstractModel $object
+ * @return $this
+ */
+ protected function _afterSave(\Magento\Framework\Model\AbstractModel $object)
+ {
+ // STORE
+ $oldStores = $this->lookupStoreIds($object->getId());
+ $newStores = (array)$object->getStores();
+
+ if($newStores) {
+ $table = $this->getTable('ves_blog_comment_store');
+ $insert = array_diff($newStores, $oldStores);
+ $delete = array_diff($oldStores, $newStores);
+
+ if ($delete) {
+ $where = ['comment_id = ?' => (int)$object->getId(), 'store_id IN (?)' => $delete];
+
+ $this->getConnection()->delete($table, $where);
+ }
+
+ if ($insert) {
+ $data = [];
+
+ foreach ($insert as $storeId) {
+ $data[] = ['comment_id' => (int)$object->getId(), 'store_id' => (int)$storeId];
+ }
+
+ $this->getConnection()->insertMultiple($table, $data);
+ }
+ }
+
+ return parent::_afterSave($object);
+ }
+
+ /**
+ * Perform operations after object load
+ *
+ * @param \Magento\Framework\Model\AbstractModel $object
+ * @return $this
+ */
+ protected function _afterLoad(\Magento\Framework\Model\AbstractModel $object)
+ {
+ if ($object->getId()) {
+ $stores = $this->lookupStoreIds($object->getId());
+ $object->setData('store_id', $stores);
+ $object->setData('stores', $stores);
+
+ $connection = $this->getConnection();
+ $select = $connection->select()->from($this->getTable('ves_blog_comment'))
+ ->where('comment_id = ' . $object->getId());
+ $comments = $connection->fetchAll($select);
+ $object->setData("comments", $comments);
+ }
+ return parent::_afterLoad($object);
+ }
+
+ /**
+ * Retrieve select object for load object data
+ *
+ * @param string $field
+ * @param mixed $value
+ * @param \Magento\Cms\Model\Block $object
+ * @return \Magento\Framework\DB\Select
+ */
+ protected function _getLoadSelect($field, $value, $object)
+ {
+ $select = parent::_getLoadSelect($field, $value, $object);
+
+ if ($object->getStoreId()) {
+ $stores = [(int)$object->getStoreId(), \Magento\Store\Model\Store::DEFAULT_STORE_ID];
+
+ $select->join(
+ ['cbs' => $this->getTable('ves_blog_comment_store')],
+ $this->getMainTable() . '.comment_id = cbs.comment_id',
+ ['store_id']
+ )->where(
+ 'is_active = ?',
+ 1
+ )->where(
+ 'cbs.store_id in (?)',
+ $stores
+ )->order(
+ 'store_id DESC'
+ )->limit(
+ 1
+ );
+ }
+
+ return $select;
+ }
+
+ /**
+ * Check for unique of identifier of block to selected store(s).
+ *
+ * @param \Magento\Framework\Model\AbstractModel $object
+ * @return bool
+ * @SuppressWarnings(PHPMD.BooleanGetMethodName)
+ */
+ public function getIsUniqueBlockToStores(\Magento\Framework\Model\AbstractModel $object)
+ {
+ if ($this->_storeManager->hasSingleStore()) {
+ $stores = [\Magento\Store\Model\Store::DEFAULT_STORE_ID];
+ } else {
+ $stores = (array)$object->getData('stores');
+ }
+
+ $select = $this->getConnection()->select()->from(
+ ['cb' => $this->getMainTable()]
+ )->join(
+ ['cbs' => $this->getTable('ves_blog_comment_store')],
+ 'cb.comment_id = cbs.comment_id',
+ []
+ )->where(
+ 'cbs.store_id IN (?)',
+ $stores
+ );
+
+ if ($object->getId()) {
+ $select->where('cb.comment_id <> ?', $object->getId());
+ }
+
+ if ($this->getConnection()->fetchRow($select)) {
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Get store ids to which specified item is assigned
+ *
+ * @param int $id
+ * @return array
+ */
+ public function lookupStoreIds($id)
+ {
+ $connection = $this->getConnection();
+
+ $select = $connection->select()->from(
+ $this->getTable('ves_blog_comment_store'),
+ 'store_id'
+ )->where(
+ 'comment_id = :comment_id'
+ );
+
+ $binds = [':comment_id' => (int)$id];
+
+ return $connection->fetchCol($select, $binds);
+ }
+ public function getDate(){
+ return $this->_date;
+ }
+}
diff --git a/Model/ResourceModel/Feed.php b/Model/ResourceModel/Feed.php
index 9a55a04..e5839e7 100644
--- a/Model/ResourceModel/Feed.php
+++ b/Model/ResourceModel/Feed.php
@@ -1,18 +1,18 @@
_storeManager = $storeManager;
$this->_date = $date;
@@ -58,7 +58,9 @@ protected function _construct()
{
$this->_init('ves_blog_feed', 'entity_id');
}
- public function getDate(){
+
+ public function getDate()
+ {
return $this->_date;
}
-}
\ No newline at end of file
+}
diff --git a/Model/ResourceModel/Importer.php b/Model/ResourceModel/Importer.php
index 65d95b8..9053879 100644
--- a/Model/ResourceModel/Importer.php
+++ b/Model/ResourceModel/Importer.php
@@ -1,18 +1,18 @@
_storeManager = $storeManager;
$this->_date = $date;
@@ -58,7 +58,9 @@ protected function _construct()
{
$this->_init('ves_blog_importer', 'entity_id');
}
- public function getDate(){
+
+ public function getDate()
+ {
return $this->_date;
}
-}
\ No newline at end of file
+}
diff --git a/Model/ResourceModel/ImporterLog.php b/Model/ResourceModel/ImporterLog.php
index aac130b..b725567 100644
--- a/Model/ResourceModel/ImporterLog.php
+++ b/Model/ResourceModel/ImporterLog.php
@@ -1,18 +1,18 @@
_storeManager = $storeManager;
$this->_date = $date;
@@ -58,7 +58,9 @@ protected function _construct()
{
$this->_init('ves_blog_importer_log', 'entity_id');
}
- public function getDate(){
+
+ public function getDate()
+ {
return $this->_date;
}
-}
\ No newline at end of file
+}
diff --git a/Model/ResourceModel/Post.php b/Model/ResourceModel/Post.php
index 80c4d9f..abf1623 100644
--- a/Model/ResourceModel/Post.php
+++ b/Model/ResourceModel/Post.php
@@ -44,7 +44,7 @@ public function __construct(
\Magento\Store\Model\StoreManagerInterface $storeManager,
\Magento\Framework\Stdlib\DateTime\DateTime $date,
$connectionName = null
- ) {
+ ) {
parent::__construct($context, $connectionName);
$this->_storeManager = $storeManager;
$this->_date = $date;
@@ -480,11 +480,14 @@ public function lookupCategoryIds($id)
return $connection->fetchCol($select, $binds);
}
- public function getDate(){
+
+ public function getDate()
+ {
return $this->_date;
}
- public function getPostTags($post_id) {
+ public function getPostTags($post_id)
+ {
$select = $this->getConnection()->select()->from(
['tag' => $this->getTable('ves_blog_post_tag')]
)->where(
@@ -494,7 +497,8 @@ public function getPostTags($post_id) {
return $this->getConnection()->fetchAll($select);
}
- public function getPostCategories($post_id) {
+ public function getPostCategories($post_id)
+ {
$select = $this->getConnection()->select()->from(
['cat' => $this->getTable('ves_blog_category')]
)->join(
diff --git a/Model/ResourceModel/Tag.php b/Model/ResourceModel/Tag.php
index 0582456..d280469 100644
--- a/Model/ResourceModel/Tag.php
+++ b/Model/ResourceModel/Tag.php
@@ -1,64 +1,66 @@
-_storeManager = $storeManager;
- $this->_date = $date;
- }
-
- /**
- * Initialize resource model
- *
- * @return void
- */
- protected function _construct()
- {
- $this->_init('ves_blog_post_tag', 'tag_id');
- }
- public function getDate(){
- return $this->_date;
- }
-}
\ No newline at end of file
+_storeManager = $storeManager;
+ $this->_date = $date;
+ }
+
+ /**
+ * Initialize resource model
+ *
+ * @return void
+ */
+ protected function _construct()
+ {
+ $this->_init('ves_blog_post_tag', 'tag_id');
+ }
+
+ public function getDate()
+ {
+ return $this->_date;
+ }
+}
diff --git a/Model/ResourceModel/Vote.php b/Model/ResourceModel/Vote.php
index 47555e1..1048b0a 100644
--- a/Model/ResourceModel/Vote.php
+++ b/Model/ResourceModel/Vote.php
@@ -1,64 +1,66 @@
-_storeManager = $storeManager;
- $this->_date = $date;
- }
-
- /**
- * Initialize resource model
- *
- * @return void
- */
- protected function _construct()
- {
- $this->_init('ves_blog_post_vote', 'vote_id');
- }
- public function getDate(){
- return $this->_date;
- }
-}
\ No newline at end of file
+_storeManager = $storeManager;
+ $this->_date = $date;
+ }
+
+ /**
+ * Initialize resource model
+ *
+ * @return void
+ */
+ protected function _construct()
+ {
+ $this->_init('ves_blog_post_vote', 'vote_id');
+ }
+
+ public function getDate()
+ {
+ return $this->_date;
+ }
+}
diff --git a/Model/Tag.php b/Model/Tag.php
index d85a596..2115f62 100644
--- a/Model/Tag.php
+++ b/Model/Tag.php
@@ -1,226 +1,233 @@
-_storeManager = $storeManager;
- $this->_url = $url;
- $this->tagDataFactory = $tagDataFactory;
- $this->dataObjectHelper = $dataObjectHelper;
- parent::__construct($context, $registry, $resource, $resourceCollection, $data);
- }
-
- /**
- * Initialize resource model
- *
- * @return void
- */
- protected function _construct()
- {
- $this->_init('Ves\Blog\Model\ResourceModel\Tag');
- }
-
- /**
- * Prepare page's statuses.
- * Available event cms_page_get_available_statuses to customize statuses.
- *
- * @return array
- */
- public function getAvailableStatuses()
- {
- return [self::STATUS_ENABLED => __('Enabled'), self::STATUS_DISABLED => __('Disabled')];
- }
-
- public function getUrl($base_url = true){
- if(!$this->hasData('blog_item_url')){
- if($base_url){
- $url = $this->_storeManager->getStore()->getBaseUrl();
- } else {
- $url = "";
- }
-
- $url_prefix = $this->getConfig('general_settings/url_prefix');
- $url_suffix = $this->getConfig('general_settings/url_suffix');
- $urlPrefix = '';
- if($url_prefix){
- $urlPrefix = $url_prefix.'/';
- }
- $item_url = $url . $urlPrefix . 'tag/' . $this->getAlias();
- $this->setData('blog_item_url', $item_url);
- }
- return $this->getData('blog_item_url');
- }
-
- /**
- * Retrieve tag model with tag data
- * @return TagInterface
- */
- public function getDataModel()
- {
- $tagData = $this->getData();
-
- $tagDataObject = $this->tagDataFactory->create();
- $this->dataObjectHelper->populateWithArray(
- $tagDataObject,
- $tagData,
- TagInterface::class
- );
-
- return $tagDataObject;
- }
-
- /**
- * {@inheritdoc}
- */
- public function getTagId(){
- return $this->getData(self::TAG_ID);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setTagId($value){
- return $this->setData(self::TAG_ID, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getPostId(){
- return $this->getData(self::POST_ID);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setPostId($value){
- return $this->setData(self::POST_ID, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getName(){
- return $this->getData(self::NAME);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setName($value){
- return $this->setData(self::NAME, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getAlias(){
- return $this->getData(self::ALIAS);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setAlias($value){
- return $this->setData(self::ALIAS, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getMetaRobots(){
- return $this->getData(self::META_ROBOTS);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setMetaRobots($value){
- return $this->setData(self::META_ROBOTS, $value);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getExtensionAttributes()
- {
- return $this->getDataExtensionAttributes();
- }
-
- /**
- * {@inheritdoc}
- */
- public function setExtensionAttributes(
- \Ves\Blog\Api\Data\TagExtensionInterface $extensionAttributes
- ) {
- return $this->_setExtensionAttributes($extensionAttributes);
- }
-}
\ No newline at end of file
+_storeManager = $storeManager;
+ $this->_url = $url;
+ $this->tagDataFactory = $tagDataFactory;
+ $this->dataObjectHelper = $dataObjectHelper;
+ parent::__construct($context, $registry, $resource, $resourceCollection, $data);
+ }
+
+ /**
+ * Initialize resource model
+ *
+ * @return void
+ */
+ protected function _construct()
+ {
+ $this->_init(\Ves\Blog\Model\ResourceModel\Tag::class);
+ }
+
+ /**
+ * Prepare page's statuses.
+ * Available event cms_page_get_available_statuses to customize statuses.
+ *
+ * @return array
+ */
+ public function getAvailableStatuses()
+ {
+ return [self::STATUS_ENABLED => __('Enabled'), self::STATUS_DISABLED => __('Disabled')];
+ }
+
+ /**
+ * get url
+ *
+ * @param bool $base_url
+ * @return string
+ */
+ public function getUrl($base_url = true)
+ {
+ if(!$this->hasData('blog_item_url')){
+ if($base_url){
+ $url = $this->_storeManager->getStore()->getBaseUrl();
+ } else {
+ $url = "";
+ }
+
+ $url_prefix = $this->getConfig('general_settings/url_prefix');
+ //$url_suffix = $this->getConfig('general_settings/url_suffix');
+ $urlPrefix = '';
+ if($url_prefix){
+ $urlPrefix = $url_prefix.'/';
+ }
+ $item_url = $url . $urlPrefix . 'tag/' . $this->getAlias();
+ $this->setData('blog_item_url', $item_url);
+ }
+ return $this->getData('blog_item_url');
+ }
+
+ /**
+ * Retrieve tag model with tag data
+ * @return TagInterface
+ */
+ public function getDataModel()
+ {
+ $tagData = $this->getData();
+
+ $tagDataObject = $this->tagDataFactory->create();
+ $this->dataObjectHelper->populateWithArray(
+ $tagDataObject,
+ $tagData,
+ TagInterface::class
+ );
+
+ return $tagDataObject;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getTagId(){
+ return $this->getData(self::TAG_ID);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setTagId($value){
+ return $this->setData(self::TAG_ID, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getPostId(){
+ return $this->getData(self::POST_ID);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setPostId($value){
+ return $this->setData(self::POST_ID, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getName(){
+ return $this->getData(self::NAME);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setName($value){
+ return $this->setData(self::NAME, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getAlias(){
+ return $this->getData(self::ALIAS);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setAlias($value){
+ return $this->setData(self::ALIAS, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getMetaRobots(){
+ return $this->getData(self::META_ROBOTS);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setMetaRobots($value){
+ return $this->setData(self::META_ROBOTS, $value);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getExtensionAttributes()
+ {
+ return $this->getDataExtensionAttributes();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setExtensionAttributes(
+ \Ves\Blog\Api\Data\TagExtensionInterface $extensionAttributes
+ ) {
+ return $this->_setExtensionAttributes($extensionAttributes);
+ }
+}
diff --git a/Model/Url.php b/Model/Url.php
index 2b78640..df0734f 100644
--- a/Model/Url.php
+++ b/Model/Url.php
@@ -1,18 +1,18 @@
_scopeConfig->getValue(
- 'mfblog/permalink/'.$key,
+ 'vesblog/permalink/'.$key,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE,
$this->storeId
);
diff --git a/Model/Vote.php b/Model/Vote.php
index e6f07bc..8694b62 100644
--- a/Model/Vote.php
+++ b/Model/Vote.php
@@ -1,37 +1,37 @@
-_init('Ves\Blog\Model\ResourceModel\Vote');
- }
-}
\ No newline at end of file
+_init(\Ves\Blog\Model\ResourceModel\Vote::class);
+ }
+}
diff --git a/Observer/PostCollectionLoadAfter.php b/Observer/PostCollectionLoadAfter.php
index 2b89187..3fda882 100644
--- a/Observer/PostCollectionLoadAfter.php
+++ b/Observer/PostCollectionLoadAfter.php
@@ -1,18 +1,18 @@
authFactory = $authFactory;
}
+
+ /**
+ * @inheritdoc
+ */
public function execute(\Magento\Framework\Event\Observer $observer)
{
$collection = $observer->getPostCollection();
$collection->getSelect()->where('main_table.creation_time <= NOW()');
}
-}
\ No newline at end of file
+}
diff --git a/Observer/Topmenu.php b/Observer/Topmenu.php
index 5693faf..e9e0dfd 100644
--- a/Observer/Topmenu.php
+++ b/Observer/Topmenu.php
@@ -1,18 +1,18 @@
_helper = $helper;
$this->_url = $url;
}
@@ -65,4 +64,4 @@ public function execute(EventObserver $observer)
}
return $this;
}
-}
\ No newline at end of file
+}
diff --git a/Plugin/Magento/Sitemap/SitemapPlugin.php b/Plugin/Magento/Sitemap/SitemapPlugin.php
index 6d02b03..53c5a43 100644
--- a/Plugin/Magento/Sitemap/SitemapPlugin.php
+++ b/Plugin/Magento/Sitemap/SitemapPlugin.php
@@ -1,18 +1,18 @@
postFactory = $postFactory;
$this->categoryFactory = $categoryFactory;
$this->sitemapFactory = $sitemapFactory;
-
$this->config = $config ?$config: \Magento\Framework\App\ObjectManager::getInstance()
->get(\Ves\Blog\Helper\Data::class);
}
diff --git a/README.md b/README.md
index a64914f..6727a5e 100644
--- a/README.md
+++ b/README.md
@@ -28,3 +28,7 @@ Moreover, you can also improve your marketing efforts and smoothly transfer prom
- [New] Compatible with elasticsearch
## Require Extensions
- venustheme/module-all
+
+## PWA Studio Support
+- Blog GraphQl Module: https://github.com/landofcoder/module-blog-graph-ql
+- PWA Blog Add-on: https://github.com/landofcoder/blog-pwa-addon
diff --git a/composer.json b/composer.json
index f7162dd..af913d1 100644
--- a/composer.json
+++ b/composer.json
@@ -5,7 +5,7 @@
"venustheme/module-all":"1.0.*"
},
"type": "magento2-module",
- "version": "1.0.11",
+ "version": "1.0.12",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml
index 6128876..a48fe19 100644
--- a/etc/adminhtml/system.xml
+++ b/etc/adminhtml/system.xml
@@ -1,1089 +1,1081 @@
-
-
-
-
-
- separator-top
-
- vesalltab
- Ves_Blog::config_blog
-
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- validate-identifier
-
-
-
-
-
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
-
- Ves\Blog\Model\Config\Source\DateFormat
- LONG: January 12, 1952 or 3:30:32pm
MEDIUM: Jan 12, 1952
SHORT: 12/13/52 or 3:30pm]]>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Ves\Blog\Block\Adminhtml\System\Config\Form\Field\Heading
-
-
-
-
-
-
-
-
-
-
-
-
- Ves\Blog\Block\Adminhtml\System\Config\Form\Field\Heading
-
-
-
- Ves\Blog\Model\Config\Source\LatestPostsStyle
-
-
-
-
-
-
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- Ves\Blog\Block\Adminhtml\System\Config\Form\Field\Heading
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- validate-number
- 1
-
-
-
- validate-number
- 1
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
-
- validate-number
- 1
-
-
-
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- Ves\Blog\Block\Adminhtml\System\Config\Form\Field\Heading
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- validate-number
- 1
-
-
-
- validate-number
- 1
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
-
-
-
-
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
-
-
-
-
-
-
- Magento\Config\Model\Config\Source\Yesno
- http://www.google.com/recaptcha]]>
-
-
-
-
-
-
-
-
-
-
-
-
- Send notify email to admin user when a guest submit a comment on the blog post
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- validate-email
- 1
-
-
-
- Magento\Config\Model\Config\Source\Email\Identity
- 1
-
-
-
- Email template chosen based on theme fallback when "Default" option is selected.
- Magento\Config\Model\Config\Source\Email\Template
- 1
-
-
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
-
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
-
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
-
- Input interger number. Default: 60
- 1
-
-
-
- Input interger number. Default: 60
- 1
-
-
-
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
-
- Ves\Blog\Block\Adminhtml\System\Config\Form\Field\Heading
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- Ves\Blog\Model\Config\Source\Relatedlayout
-
-
-
- Show number items when screen size bellow 480px
- validate-number
- owl_carousel
-
-
-
- Show number items when screen size between 641px and 480px
- validate-number
- owl_carousel
-
-
-
- Show number items when screen size between 768px and 641px
- validate-number
- owl_carousel
-
-
-
- Show number items when screen size between 979px and 769px
- validate-number
- owl_carousel
-
-
-
- Show number items when screen size between 1199px and 980px
- validate-number
- owl_carousel
-
-
-
- Show number items when screen size 1200px and up
- validate-number
- owl_carousel
-
-
-
- Magento\Config\Model\Config\Source\Yesno
- owl_carousel
-
-
-
- Autoplay interval timeout.
- Magento\Config\Model\Config\Source\Yesno
- owl_carousel
-
-
-
- Magento\Config\Model\Config\Source\Yesno
- owl_carousel
-
-
-
- Magento\Config\Model\Config\Source\Yesno
- owl_carousel
-
-
-
- 1
-
-
-
- 1
-
-
-
-
- Ves\Blog\Block\Adminhtml\System\Config\Form\Field\Heading
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- Ves\Blog\Model\Config\Source\Relatedlayout
-
-
-
- Show number items when screen size bellow 480px
- validate-number
- owl_carousel
-
-
-
- Show number items when screen size between 641px and 480px
- validate-number
- owl_carousel
-
-
-
- Show number items when screen size between 768px and 641px
- validate-number
- owl_carousel
-
-
-
- Show number items when screen size between 979px and 769px
- validate-number
- owl_carousel
-
-
-
- Show number items when screen size between 1199px and 980px
- validate-number
- owl_carousel
-
-
-
- Show number items when screen size 1200px and up
- validate-number
- owl_carousel
-
-
-
- Magento\Config\Model\Config\Source\Yesno
- owl_carousel
-
-
-
- Autoplay interval timeout.
- Magento\Config\Model\Config\Source\Yesno
- owl_carousel
-
-
-
- Magento\Config\Model\Config\Source\Yesno
- owl_carousel
-
-
-
- Magento\Config\Model\Config\Source\Yesno
- owl_carousel
-
-
-
- 1
-
-
-
- 1
-
-
-
-
-
-
- Ves\Blog\Block\Adminhtml\System\Config\Form\Field\Heading
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- validate-number
- 1
-
-
-
- validate-number
- 1
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
-
- validate-number
- 1
-
-
-
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- Ves\Blog\Block\Adminhtml\System\Config\Form\Field\Heading
-
-
-
- validate-number
-
-
-
- validate-number
-
-
-
- Show number items when screen size between 1199px and 980px
- validate-number
-
-
-
- Show number items when screen size 1200px and up
- validate-number
-
-
-
- Show number items when screen size between 979px and 769px
- validate-number
-
-
-
- Show number items when screen size between 768px and 641px
- validate-number
-
-
-
- Show number items when screen size between 641px and 480px
- validate-number
-
-
-
- Show number items when screen size bellow 480px
- validate-number
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- Autoplay interval timeout.
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- 1
-
-
-
- 1
-
-
-
-
-
-
-
- Ves\Blog\Model\Config\Source\Layout
-
-
-
- Ves\Blog\Model\Config\Source\LatestPostsStyle
-
-
-
- Ves\Blog\Model\Config\Source\PageLayout
-
-
-
- Ves\Blog\Model\Config\Source\Orderby
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- Empty to show all item
- validate-number
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- Ves\Blog\Block\Adminhtml\System\Config\Form\Field\Heading
-
-
-
-
- Ves\Blog\Model\Config\Source\Gridcolumns
-
-
-
-
- Ves\Blog\Model\Config\Source\Gridcolumns
-
-
-
- Ves\Blog\Model\Config\Source\Gridcolumns
-
-
-
-
- Ves\Blog\Model\Config\Source\Gridcolumns
-
-
-
-
- Ves\Blog\Block\Adminhtml\System\Config\Form\Field\Heading
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- validate-number
- 1
-
-
-
- validate-number
- 1
-
-
-
- Magento\Config\Model\Config\Source\Yesno
- If the "keepAspectRatio" parameter is set to true, in this case the proportions of the image will not be modified.
-
-
-
- Magento\Config\Model\Config\Source\Yesno
- The "keepFrame" parameter guarantees that the image will be not cropped. When "keepAspectRatio" is false the "keepFrame" will not work.
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
-
- validate-number
- 1
-
-
-
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
-
- Magento\Config\Model\Config\Source\Yesno
- Content).]]>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
-
- 1
-
-
-
- Magento\Config\Model\Config\Source\Yesno
- 1
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
- Ves\Blog\Model\Config\Source\LinkType
- Use when allow use custom post link
- 1
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
-
-
-
- Magento\Config\Model\Config\Source\Yesno
-
-
-
-
-
\ No newline at end of file
+
+
+
+
+
+ separator-top
+
+ vesalltab
+ Ves_Blog::config_blog
+
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ validate-identifier
+
+
+
+
+
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+
+ Ves\Blog\Model\Config\Source\DateFormat
+ LONG: January 12, 1952 or 3:30:32pm
MEDIUM: Jan 12, 1952
SHORT: 12/13/52 or 3:30pm]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Ves\Blog\Block\Adminhtml\System\Config\Form\Field\Heading
+
+
+
+
+
+
+
+
+
+
+
+
+ Ves\Blog\Block\Adminhtml\System\Config\Form\Field\Heading
+
+
+
+ Ves\Blog\Model\Config\Source\LatestPostsStyle
+
+
+
+
+
+
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ Ves\Blog\Block\Adminhtml\System\Config\Form\Field\Heading
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ validate-number
+ 1
+
+
+
+ validate-number
+ 1
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+
+ validate-number
+ 1
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+ 1
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ Ves\Blog\Block\Adminhtml\System\Config\Form\Field\Heading
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ validate-number
+ 1
+
+
+
+ validate-number
+ 1
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+
+
+
+
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+
+
+
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+ http://www.google.com/recaptcha]]>
+
+
+
+
+
+
+
+
+
+
+
+
+ Send notify email to admin user when a guest submit a comment on the blog post
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ validate-email
+ 1
+
+
+
+ Magento\Config\Model\Config\Source\Email\Identity
+ 1
+
+
+
+ Email template chosen based on theme fallback when "Default" option is selected.
+ Magento\Config\Model\Config\Source\Email\Template
+ 1
+
+
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+ 1
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+ 1
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+ 1
+
+
+
+ Input interger number. Default: 60
+ 1
+
+
+
+ Input interger number. Default: 60
+ 1
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+ 1
+
+
+
+ Ves\Blog\Block\Adminhtml\System\Config\Form\Field\Heading
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ Ves\Blog\Model\Config\Source\Relatedlayout
+
+
+
+ Show number items when screen size bellow 480px
+ validate-number
+ owl_carousel
+
+
+
+ Show number items when screen size between 641px and 480px
+ validate-number
+ owl_carousel
+
+
+
+ Show number items when screen size between 768px and 641px
+ validate-number
+ owl_carousel
+
+
+
+ Show number items when screen size between 979px and 769px
+ validate-number
+ owl_carousel
+
+
+
+ Show number items when screen size between 1199px and 980px
+ validate-number
+ owl_carousel
+
+
+
+ Show number items when screen size 1200px and up
+ validate-number
+ owl_carousel
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+ owl_carousel
+
+
+
+ Autoplay interval timeout.
+ Magento\Config\Model\Config\Source\Yesno
+ owl_carousel
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+ owl_carousel
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+ owl_carousel
+
+
+
+ 1
+
+
+
+ 1
+
+
+
+
+ Ves\Blog\Block\Adminhtml\System\Config\Form\Field\Heading
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ Ves\Blog\Model\Config\Source\Relatedlayout
+
+
+
+ Show number items when screen size bellow 480px
+ validate-number
+ owl_carousel
+
+
+
+ Show number items when screen size between 641px and 480px
+ validate-number
+ owl_carousel
+
+
+
+ Show number items when screen size between 768px and 641px
+ validate-number
+ owl_carousel
+
+
+
+ Show number items when screen size between 979px and 769px
+ validate-number
+ owl_carousel
+
+
+
+ Show number items when screen size between 1199px and 980px
+ validate-number
+ owl_carousel
+
+
+
+ Show number items when screen size 1200px and up
+ validate-number
+ owl_carousel
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+ owl_carousel
+
+
+
+ Autoplay interval timeout.
+ Magento\Config\Model\Config\Source\Yesno
+ owl_carousel
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+ owl_carousel
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+ owl_carousel
+
+
+
+ 1
+
+
+
+ 1
+
+
+
+
+
+
+ Ves\Blog\Block\Adminhtml\System\Config\Form\Field\Heading
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ validate-number
+ 1
+
+
+
+ validate-number
+ 1
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+
+ validate-number
+ 1
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+ 1
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ Ves\Blog\Block\Adminhtml\System\Config\Form\Field\Heading
+
+
+
+ validate-number
+
+
+
+ validate-number
+
+
+
+ Show number items when screen size between 1199px and 980px
+ validate-number
+
+
+
+ Show number items when screen size 1200px and up
+ validate-number
+
+
+
+ Show number items when screen size between 979px and 769px
+ validate-number
+
+
+
+ Show number items when screen size between 768px and 641px
+ validate-number
+
+
+
+ Show number items when screen size between 641px and 480px
+ validate-number
+
+
+
+ Show number items when screen size bellow 480px
+ validate-number
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ Autoplay interval timeout.
+ Magento\Config\Model\Config\Source\Yesno
+ 1
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ 1
+
+
+
+ 1
+
+
+
+
+
+
+
+ Ves\Blog\Model\Config\Source\Layout
+
+
+
+ Ves\Blog\Model\Config\Source\LatestPostsStyle
+
+
+
+ Ves\Blog\Model\Config\Source\PageLayout
+
+
+
+ Ves\Blog\Model\Config\Source\Orderby
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ Empty to show all item
+ validate-number
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ Ves\Blog\Block\Adminhtml\System\Config\Form\Field\Heading
+
+
+
+
+ Ves\Blog\Model\Config\Source\Gridcolumns
+
+
+
+
+ Ves\Blog\Model\Config\Source\Gridcolumns
+
+
+
+ Ves\Blog\Model\Config\Source\Gridcolumns
+
+
+
+
+ Ves\Blog\Model\Config\Source\Gridcolumns
+
+
+
+
+ Ves\Blog\Block\Adminhtml\System\Config\Form\Field\Heading
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ validate-number
+ 1
+
+
+
+ validate-number
+ 1
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+ If the "keepAspectRatio" parameter is set to true, in this case the proportions of the image will not be modified.
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+ The "keepFrame" parameter guarantees that the image will be not cropped. When "keepAspectRatio" is false the "keepFrame" will not work.
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+
+ validate-number
+ 1
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+ 1
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+ Content).]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+
+ 1
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+ 1
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ Ves\Blog\Model\Config\Source\LinkType
+ Use when allow use custom post link
+ 1
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+
+
diff --git a/etc/config.xml b/etc/config.xml
index c5d591a..220c381 100644
--- a/etc/config.xml
+++ b/etc/config.xml
@@ -2,18 +2,18 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- - Ves\Blog\Model\ResourceModel\Category\Grid\Collection
- - Ves\Blog\Model\ResourceModel\Post\Grid\Collection
- - Ves\Blog\Model\ResourceModel\Comment\Grid\Collection
- - Ves\Blog\Model\ResourceModel\Tag\Grid\Collection
- - Ves\Blog\Model\ResourceModel\Author\Grid\Collection
- - Ves\Blog\Model\ResourceModel\Feed\Grid\Collection
- - Ves\Blog\Model\ResourceModel\Importer\Grid\Collection
- - Ves\Blog\Model\ResourceModel\ImporterLog\Grid\Collection
-
-
-
-
-
- ves_blog_category
- blog_category_grid_collection
- category_grid_collection
- Ves\Blog\Model\ResourceModel\Category
-
-
-
-
- ves_blog_post
- blog_post_grid_collection
- post_grid_collection
- Ves\Blog\Model\ResourceModel\Post
-
-
-
-
- ves_blog_comment
- blog_comment_grid_collection
- comment_grid_collection
- Ves\Blog\Model\ResourceModel\Comment
-
-
-
-
- ves_blog_post_author
- blog_author_grid_collection
- author_grid_collection
- Ves\Blog\Model\ResourceModel\Author
-
-
-
-
- ves_blog_post_tag
- blog_tag_grid_collection
- tag_grid_collection
- Ves\Blog\Model\ResourceModel\Tag
-
-
-
-
- ves_blog_feed
- blog_feed_grid_collection
- feed_grid_collection
- Ves\Blog\Model\ResourceModel\Feed
-
-
-
-
- ves_blog_importer
- blog_importer_grid_collection
- importer_grid_collection
- Ves\Blog\Model\ResourceModel\Importer
-
-
-
-
- ves_blog_importer_log
- blog_importer_log_grid_collection
- importer_log_grid_collection
- Ves\Blog\Model\ResourceModel\ImporterLog
-
-
-
-
-
- - Magento\Framework\View\Element\UiComponent\DataProvider\RegularFilter
- - Magento\Framework\View\Element\UiComponent\DataProvider\FulltextFilter
-
-
-
-
-
- Ves\Blog\Model\ResourceModel\Category\Collection
- BlogGridFilterPool
-
-
-
-
- Ves\Blog\Model\ResourceModel\Importer\Collection
- BlogGridFilterPool
-
-
-
-
- Ves\Blog\Model\ResourceModel\ImporterLog\Collection
- BlogGridFilterPool
-
-
-
-
- Ves\Blog\Model\ResourceModel\Post\Collection
- BlogGridFilterPool
-
-
-
-
- Ves\Blog\Model\ResourceModel\Feed\Collection
- BlogGridFilterPool
-
-
-
-
- Ves\Blog\Model\ResourceModel\Comment\Collection
- BlogGridFilterPool
-
-
-
-
- Ves\Blog\Model\ResourceModel\Author\Collection
- BlogGridFilterPool
-
-
-
-
- Ves\Blog\Model\ResourceModel\Tag\Collection
- BlogGridFilterPool
-
-
-
-
-
- - Ves\Blog\Block\Rss\Category
- - Ves\Blog\Block\Rss\Archive
- - Ves\Blog\Block\Rss\Tag
- - Ves\Blog\Block\Rss\Latest
- - Ves\Blog\Block\Rss\Author
- - Ves\Blog\Block\Rss\Comment
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Ves\Blog\Model\ResourceModel\Category\Grid\Collection
+ - Ves\Blog\Model\ResourceModel\Post\Grid\Collection
+ - Ves\Blog\Model\ResourceModel\Comment\Grid\Collection
+ - Ves\Blog\Model\ResourceModel\Tag\Grid\Collection
+ - Ves\Blog\Model\ResourceModel\Author\Grid\Collection
+ - Ves\Blog\Model\ResourceModel\Feed\Grid\Collection
+ - Ves\Blog\Model\ResourceModel\Importer\Grid\Collection
+ - Ves\Blog\Model\ResourceModel\ImporterLog\Grid\Collection
+
+
+
+
+
+ ves_blog_category
+ blog_category_grid_collection
+ category_grid_collection
+ Ves\Blog\Model\ResourceModel\Category
+
+
+
+
+ ves_blog_post
+ blog_post_grid_collection
+ post_grid_collection
+ Ves\Blog\Model\ResourceModel\Post
+
+
+
+
+ ves_blog_comment
+ blog_comment_grid_collection
+ comment_grid_collection
+ Ves\Blog\Model\ResourceModel\Comment
+
+
+
+
+ ves_blog_post_author
+ blog_author_grid_collection
+ author_grid_collection
+ Ves\Blog\Model\ResourceModel\Author
+
+
+
+
+ ves_blog_post_tag
+ blog_tag_grid_collection
+ tag_grid_collection
+ Ves\Blog\Model\ResourceModel\Tag
+
+
+
+
+ ves_blog_feed
+ blog_feed_grid_collection
+ feed_grid_collection
+ Ves\Blog\Model\ResourceModel\Feed
+
+
+
+
+ ves_blog_importer
+ blog_importer_grid_collection
+ importer_grid_collection
+ Ves\Blog\Model\ResourceModel\Importer
+
+
+
+
+ ves_blog_importer_log
+ blog_importer_log_grid_collection
+ importer_log_grid_collection
+ Ves\Blog\Model\ResourceModel\ImporterLog
+
+
+
+
+
+ - Magento\Framework\View\Element\UiComponent\DataProvider\RegularFilter
+ - Magento\Framework\View\Element\UiComponent\DataProvider\FulltextFilter
+
+
+
+
+
+ Ves\Blog\Model\ResourceModel\Category\Collection
+ BlogGridFilterPool
+
+
+
+
+ Ves\Blog\Model\ResourceModel\Importer\Collection
+ BlogGridFilterPool
+
+
+
+
+ Ves\Blog\Model\ResourceModel\ImporterLog\Collection
+ BlogGridFilterPool
+
+
+
+
+ Ves\Blog\Model\ResourceModel\Post\Collection
+ BlogGridFilterPool
+
+
+
+
+ Ves\Blog\Model\ResourceModel\Feed\Collection
+ BlogGridFilterPool
+
+
+
+
+ Ves\Blog\Model\ResourceModel\Comment\Collection
+ BlogGridFilterPool
+
+
+
+
+ Ves\Blog\Model\ResourceModel\Author\Collection
+ BlogGridFilterPool
+
+
+
+
+ Ves\Blog\Model\ResourceModel\Tag\Collection
+ BlogGridFilterPool
+
+
+
+
+
+ - Ves\Blog\Block\Rss\Category
+ - Ves\Blog\Block\Rss\Archive
+ - Ves\Blog\Block\Rss\Tag
+ - Ves\Blog\Block\Rss\Latest
+ - Ves\Blog\Block\Rss\Author
+ - Ves\Blog\Block\Rss\Comment
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/view/adminhtml/layout/default.xml b/view/adminhtml/layout/default.xml
index 2e98aa0..880a502 100644
--- a/view/adminhtml/layout/default.xml
+++ b/view/adminhtml/layout/default.xml
@@ -1,36 +1,27 @@
-
-
-
-
-
-
-
-
-
-
- Ves_Blog
-
-
-
-
-
\ No newline at end of file
+
+
+
+
+
+
+
diff --git a/view/frontend/layout/blog_post_richsnippets.xml b/view/frontend/layout/blog_post_richsnippets.xml
index 4ce70e4..835e76e 100644
--- a/view/frontend/layout/blog_post_richsnippets.xml
+++ b/view/frontend/layout/blog_post_richsnippets.xml
@@ -1,10 +1,23 @@
diff --git a/view/frontend/templates/latest.phtml b/view/frontend/templates/latest.phtml
index 3b53d06..483b1b7 100644
--- a/view/frontend/templates/latest.phtml
+++ b/view/frontend/templates/latest.phtml
@@ -109,14 +109,4 @@ $blockId = 'blog-' . $layout . time();
});
-
-
-
-
-
-
diff --git a/view/frontend/templates/post/view.phtml b/view/frontend/templates/post/view.phtml
index 292c794..231cee7 100644
--- a/view/frontend/templates/post/view.phtml
+++ b/view/frontend/templates/post/view.phtml
@@ -30,6 +30,7 @@ $show_createdtime = $helper->getConfig("post_page/show_createdtime");
$show_hits = $helper->getConfig("post_page/show_hits");
$show_tags = $helper->getConfig("post_page/show_tags");
$show_socialnetworks = $helper->getConfig("post_page/show_socialblock");
+$show_socialnetworks = false;
$_post->setData('categories', $_post->getPostCategories());
?>
getPostUrl($_post); ?>
@@ -169,7 +170,7 @@ $_post->setData('categories', $_post->getPostCategories());
-
+
= __('SHARE'); ?>