Skip to content
This repository was archived by the owner on Feb 8, 2023. It is now read-only.

Commit fe94da5

Browse files
Format Code
1 parent 386d013 commit fe94da5

File tree

13 files changed

+158
-138
lines changed

13 files changed

+158
-138
lines changed

.travis.yml

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -6,63 +6,63 @@ sudo: required
66
dist: trusty
77
env:
88
global:
9-
- COMPOSER_BIN_DIR=~/bin
10-
- INTEGRATION_SETS=3
11-
- NODE_JS_VERSION=6
12-
- MAGENTO_HOST_NAME="magento2.travis"
13-
- COMPOSER_MODULE=mageplaza/module-sitemap
9+
- COMPOSER_BIN_DIR=~/bin
10+
- INTEGRATION_SETS=3
11+
- NODE_JS_VERSION=6
12+
- MAGENTO_HOST_NAME="magento2.travis"
13+
- COMPOSER_MODULE=mageplaza/module-sitemap
1414
matrix:
15-
- MAGENTO_VERSION=2.2.1 TEST_SUITE=integration INTEGRATION_INDEX=1
16-
- MAGENTO_VERSION=2.2.1 TEST_SUITE=integration INTEGRATION_INDEX=2
17-
- MAGENTO_VERSION=2.2.1 TEST_SUITE=integration INTEGRATION_INDEX=3
18-
- MAGENTO_VERSION=2.2.2 TEST_SUITE=static
19-
- MAGENTO_VERSION=2.2.2 TEST_SUITE=js GRUNT_COMMAND=static
20-
- MAGENTO_VERSION=2.2.2 TEST_SUITE=integration INTEGRATION_INDEX=1
21-
- MAGENTO_VERSION=2.2.2 TEST_SUITE=integration INTEGRATION_INDEX=2
22-
- MAGENTO_VERSION=2.2.2 TEST_SUITE=integration INTEGRATION_INDEX=3
23-
- MAGENTO_VERSION=2.2.5 TEST_SUITE=integration INTEGRATION_INDEX=1
24-
- MAGENTO_VERSION=2.2.5 TEST_SUITE=integration INTEGRATION_INDEX=2
25-
- MAGENTO_VERSION=2.2.5 TEST_SUITE=integration INTEGRATION_INDEX=3
26-
- MAGENTO_VERSION=2.2.6 TEST_SUITE=integration INTEGRATION_INDEX=1
27-
- MAGENTO_VERSION=2.2.6 TEST_SUITE=integration INTEGRATION_INDEX=2
28-
- MAGENTO_VERSION=2.2.6 TEST_SUITE=integration INTEGRATION_INDEX=3
29-
15+
- MAGENTO_VERSION=2.2.1 TEST_SUITE=integration INTEGRATION_INDEX=1
16+
- MAGENTO_VERSION=2.2.1 TEST_SUITE=integration INTEGRATION_INDEX=2
17+
- MAGENTO_VERSION=2.2.1 TEST_SUITE=integration INTEGRATION_INDEX=3
18+
- MAGENTO_VERSION=2.2.2 TEST_SUITE=static
19+
- MAGENTO_VERSION=2.2.2 TEST_SUITE=js GRUNT_COMMAND=static
20+
- MAGENTO_VERSION=2.2.2 TEST_SUITE=integration INTEGRATION_INDEX=1
21+
- MAGENTO_VERSION=2.2.2 TEST_SUITE=integration INTEGRATION_INDEX=2
22+
- MAGENTO_VERSION=2.2.2 TEST_SUITE=integration INTEGRATION_INDEX=3
23+
- MAGENTO_VERSION=2.2.5 TEST_SUITE=integration INTEGRATION_INDEX=1
24+
- MAGENTO_VERSION=2.2.5 TEST_SUITE=integration INTEGRATION_INDEX=2
25+
- MAGENTO_VERSION=2.2.5 TEST_SUITE=integration INTEGRATION_INDEX=3
26+
- MAGENTO_VERSION=2.2.6 TEST_SUITE=integration INTEGRATION_INDEX=1
27+
- MAGENTO_VERSION=2.2.6 TEST_SUITE=integration INTEGRATION_INDEX=2
28+
- MAGENTO_VERSION=2.2.6 TEST_SUITE=integration INTEGRATION_INDEX=3
29+
3030
matrix:
3131
exclude:
32-
- php: 7.0
33-
env: MAGENTO_VERSION=2.2.2 TEST_SUITE=js GRUNT_COMMAND=static
34-
- php: 7.0
35-
env: MAGENTO_VERSION=2.2.2 TEST_SUITE=static
32+
- php: 7.0
33+
env: MAGENTO_VERSION=2.2.2 TEST_SUITE=js GRUNT_COMMAND=static
34+
- php: 7.0
35+
env: MAGENTO_VERSION=2.2.2 TEST_SUITE=static
3636
cache:
3737
apt: true
3838
directories:
39-
- "$HOME/.composer/cache"
40-
- "$HOME/.nvm"
39+
- "$HOME/.composer/cache"
40+
- "$HOME/.nvm"
4141
addons:
4242
apt:
4343
packages:
44-
- mysql-server-5.6
45-
- mysql-client-core-5.6
46-
- mysql-client-5.6
47-
- postfix
44+
- mysql-server-5.6
45+
- mysql-client-core-5.6
46+
- mysql-client-5.6
47+
- postfix
4848
firefox: '46.0'
4949
hosts:
5050
- magento2.travis
5151
before_install:
52-
- git clone https://github.com/magento/magento2 --branch $MAGENTO_VERSION
53-
- cd magento2
54-
- bash ./dev/travis/before_install.sh
52+
- git clone https://github.com/magento/magento2 --branch $MAGENTO_VERSION
53+
- cd magento2
54+
- bash ./dev/travis/before_install.sh
5555
install:
56-
- composer install --no-interaction --prefer-dist
57-
- composer require $COMPOSER_MODULE
56+
- composer install --no-interaction --prefer-dist
57+
- composer require $COMPOSER_MODULE
5858
before_script:
59-
#- cp -f ${TRAVIS_BUILD_DIR}/dev/tests/integration/phpunit.xml.dist dev/tests/integration/
60-
- echo "vendor/$COMPOSER_MODULE" > dev/tests/static/testsuite/Magento/Test/Less/_files/whitelist/common.txt
61-
- echo "vendor/$COMPOSER_MODULE" > dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/common.txt
62-
- echo "vendor/$COMPOSER_MODULE/**/*.js" > dev/tests/static/testsuite/Magento/Test/Js/_files/whitelist/magento.txt
63-
- bash ./dev/travis/before_script.sh
59+
#- cp -f ${TRAVIS_BUILD_DIR}/dev/tests/integration/phpunit.xml.dist dev/tests/integration/
60+
- echo "vendor/$COMPOSER_MODULE" > dev/tests/static/testsuite/Magento/Test/Less/_files/whitelist/common.txt
61+
- echo "vendor/$COMPOSER_MODULE" > dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/common.txt
62+
- echo "vendor/$COMPOSER_MODULE/**/*.js" > dev/tests/static/testsuite/Magento/Test/Js/_files/whitelist/magento.txt
63+
- bash ./dev/travis/before_script.sh
6464
script:
65-
- test $TEST_SUITE = "static" && TEST_FILTER='--filter "Magento\\Test\\Php\\LiveCodeTest"' || true
66-
- test $TEST_SUITE = "functional" && TEST_FILTER='dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests.php' || true
65+
- test $TEST_SUITE = "static" && TEST_FILTER='--filter "Magento\\Test\\Php\\LiveCodeTest"' || true
66+
- test $TEST_SUITE = "functional" && TEST_FILTER='dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests.php' || true
6767

6868

Block/Sitemap.php

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323

2424
use Magento\Catalog\Helper\Category;
2525
use Magento\Catalog\Model\CategoryRepository;
26-
use Magento\Catalog\Model\Indexer\Category\Flat\State;
2726
use Magento\Catalog\Model\Product\Visibility as ProductVisibility;
2827
use Magento\Catalog\Model\ResourceModel\Category\Collection;
2928
use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory;
@@ -32,7 +31,6 @@
3231
use Magento\Cms\Model\ResourceModel\Page\Collection as PageCollection;
3332
use Magento\Framework\View\Element\Template;
3433
use Magento\Framework\View\Element\Template\Context;
35-
use Magento\Theme\Block\Html\Topmenu;
3634
use Mageplaza\Sitemap\Helper\Data as HelperConfig;
3735

3836
/**
@@ -90,24 +88,21 @@ class Sitemap extends Template
9088

9189
/**
9290
* Sitemap constructor.
93-
* @param \Magento\Framework\View\Element\Template\Context $context
94-
* @param \Magento\Catalog\Helper\Category $categoryHelper
95-
* @param \Magento\Catalog\Model\Indexer\Category\Flat\State $categoryFlatState
96-
* @param \Magento\Theme\Block\Html\Topmenu $topMenu
97-
* @param \Magento\Catalog\Model\ResourceModel\Category\Collection $collection
98-
* @param \Magento\Catalog\Model\ResourceModel\Category\CollectionFactory $categoryCollection
99-
* @param \Magento\Catalog\Model\CategoryRepository $categoryRepository
91+
*
92+
* @param Context $context
93+
* @param Category $categoryHelper
94+
* @param Collection $collection
95+
* @param CollectionFactory $categoryCollection
96+
* @param CategoryRepository $categoryRepository
10097
* @param HelperConfig $helper
101-
* @param \Magento\CatalogInventory\Helper\Stock $stockFilter
102-
* @param \Magento\Catalog\Model\Product\Visibility $productVisibility
103-
* @param \Magento\Catalog\Model\ResourceModel\Product\Collection $productCollection
104-
* @param \Magento\Cms\Model\ResourceModel\Page\Collection $pageCollection
98+
* @param Stock $stockFilter
99+
* @param ProductVisibility $productVisibility
100+
* @param ProductCollection $productCollection
101+
* @param PageCollection $pageCollection
105102
*/
106103
public function __construct(
107104
Context $context,
108105
Category $categoryHelper,
109-
State $categoryFlatState,
110-
Topmenu $topMenu,
111106
Collection $collection,
112107
CollectionFactory $categoryCollection,
113108
CategoryRepository $categoryRepository,
@@ -116,17 +111,16 @@ public function __construct(
116111
ProductVisibility $productVisibility,
117112
ProductCollection $productCollection,
118113
PageCollection $pageCollection
119-
)
120-
{
121-
$this->collection = $collection;
122-
$this->_categoryHelper = $categoryHelper;
114+
) {
115+
$this->collection = $collection;
116+
$this->_categoryHelper = $categoryHelper;
123117
$this->_categoryCollection = $categoryCollection;
124-
$this->categoryRepository = $categoryRepository;
125-
$this->_helper = $helper;
126-
$this->_stockFilter = $stockFilter;
127-
$this->productVisibility = $productVisibility;
128-
$this->productCollection = $productCollection;
129-
$this->pageCollection = $pageCollection;
118+
$this->categoryRepository = $categoryRepository;
119+
$this->_helper = $helper;
120+
$this->_stockFilter = $stockFilter;
121+
$this->productVisibility = $productVisibility;
122+
$this->productCollection = $productCollection;
123+
$this->pageCollection = $pageCollection;
130124

131125
parent::__construct($context);
132126
}
@@ -137,7 +131,7 @@ public function __construct(
137131
*/
138132
public function getProductCollection()
139133
{
140-
$limit = $this->_helper->getProductLimit() ? $this->_helper->getProductLimit() : self::DEFAULT_PRODUCT_LIMIT;
134+
$limit = $this->_helper->getProductLimit() ? $this->_helper->getProductLimit() : self::DEFAULT_PRODUCT_LIMIT;
141135
$collection = $this->productCollection
142136
->setVisibility($this->productVisibility->getVisibleInCatalogIds())
143137
->addMinimalPrice()
@@ -161,6 +155,7 @@ public function getCategoryCollection()
161155

162156
/**
163157
* @param $categoryId
158+
*
164159
* @return string
165160
* @throws \Magento\Framework\Exception\NoSuchEntityException
166161
*/
@@ -201,7 +196,7 @@ public function getExcludedPages()
201196
public function getAdditionLinksCollection()
202197
{
203198
$additionLinks = $this->_helper->getAdditionalLinks();
204-
$allLink = explode("\n", $additionLinks);
199+
$allLink = explode("\n", $additionLinks);
205200

206201
$result = [];
207202
foreach ($allLink as $link) {
@@ -215,8 +210,10 @@ public function getAdditionLinksCollection()
215210

216211
/**
217212
* Render link element
213+
*
218214
* @param $link
219215
* @param $title
216+
*
220217
* @return string
221218
*/
222219
public function renderLinkElement($link, $title)
@@ -229,6 +226,7 @@ public function renderLinkElement($link, $title)
229226
* @param $config
230227
* @param $title
231228
* @param $collection
229+
*
232230
* @return string
233231
* @throws \Magento\Framework\Exception\NoSuchEntityException
234232
*/

CHANGELOG

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Changelog: https://www.mageplaza.com/changelog/m2-seo.txt
1+
Changelog: https://www.mageplaza.com/releases/google-xml-sitemap/

Controller/Index/Index.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,14 @@ class Index extends Action
4545

4646
/**
4747
* Index constructor.
48+
*
4849
* @param Context $context
4950
* @param PageFactory $pageFactory
5051
* @param HelperConfig $helperConfig
5152
*/
5253
public function __construct(Context $context, PageFactory $pageFactory, HelperConfig $helperConfig)
5354
{
54-
$this->pageFactory = $pageFactory;
55+
$this->pageFactory = $pageFactory;
5556
$this->helperConfig = $helperConfig;
5657

5758
return parent::__construct($context);

Helper/Data.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ class Data extends AbstractHelper
3434

3535
/************************ HTML Sitemap Configuration *************************
3636
* Is enable html site map
37+
*
3738
* @param null $storeId
39+
*
3840
* @return mixed
3941
*/
4042
public function isEnableHtmlSiteMap($storeId = null)
@@ -45,6 +47,7 @@ public function isEnableHtmlSiteMap($storeId = null)
4547
/**
4648
* @param $code
4749
* @param null $storeId
50+
*
4851
* @return array|bool|mixed
4952
*/
5053
public function getHtmlSitemapConfig($code, $storeId = null)
@@ -125,8 +128,10 @@ public function getProductLimit()
125128
}
126129

127130
/*********************** XML Sitemap Configuration *************************
131+
*
128132
* @param $code
129133
* @param null $storeId
134+
*
130135
* @return mixed
131136
*/
132137
public function getXmlSitemapConfig($code, $storeId = null)
@@ -136,6 +141,7 @@ public function getXmlSitemapConfig($code, $storeId = null)
136141

137142
/**
138143
* @param null $storeId
144+
*
139145
* @return mixed
140146
*/
141147
public function isEnableHomepageOptimization($storeId = null)
@@ -145,6 +151,7 @@ public function isEnableHomepageOptimization($storeId = null)
145151

146152
/**
147153
* @param null $storeId
154+
*
148155
* @return mixed
149156
*/
150157
public function isEnableAdditionalLinks($storeId = null)
@@ -154,6 +161,7 @@ public function isEnableAdditionalLinks($storeId = null)
154161

155162
/**
156163
* @param null $storeId
164+
*
157165
* @return array
158166
*/
159167
public function getXmlAdditionalLinks($storeId = null)
@@ -163,6 +171,7 @@ public function getXmlAdditionalLinks($storeId = null)
163171

164172
/**
165173
* @param null $storeId
174+
*
166175
* @return mixed
167176
*/
168177
public function getFrequency($storeId = null)
@@ -172,10 +181,11 @@ public function getFrequency($storeId = null)
172181

173182
/**
174183
* @param null $storeId
184+
*
175185
* @return mixed
176186
*/
177187
public function getPriority($storeId = null)
178188
{
179189
return $this->getXmlSitemapConfig('priority', $storeId);
180190
}
181-
}
191+
}

0 commit comments

Comments
 (0)