Data.php 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Sitemap\Helper;
  7. use Magento\Sitemap\Model\ItemProvider\CategoryConfigReader;
  8. use Magento\Sitemap\Model\ItemProvider\CmsPageConfigReader;
  9. use Magento\Sitemap\Model\ItemProvider\ProductConfigReader;
  10. use Magento\Sitemap\Model\SitemapConfigReader;
  11. use Magento\Store\Model\ScopeInterface;
  12. /**
  13. * @deprecated 100.3.0
  14. */
  15. class Data extends \Magento\Framework\App\Helper\AbstractHelper
  16. {
  17. /**
  18. * Config path to sitemap valid paths
  19. */
  20. const XML_PATH_SITEMAP_VALID_PATHS = 'sitemap/file/valid_paths';
  21. /**
  22. * Config path to valid file paths
  23. */
  24. const XML_PATH_PUBLIC_FILES_VALID_PATHS = 'general/file/public_files_valid_paths';
  25. /**#@+
  26. * Limits xpath config settings
  27. */
  28. const XML_PATH_MAX_LINES = 'sitemap/limit/max_lines';
  29. const XML_PATH_MAX_FILE_SIZE = 'sitemap/limit/max_file_size';
  30. /**#@-*/
  31. /**#@+
  32. * Change frequency xpath config settings
  33. */
  34. const XML_PATH_CATEGORY_CHANGEFREQ = 'sitemap/category/changefreq';
  35. const XML_PATH_PRODUCT_CHANGEFREQ = 'sitemap/product/changefreq';
  36. const XML_PATH_PAGE_CHANGEFREQ = 'sitemap/page/changefreq';
  37. /**#@-*/
  38. /**#@+
  39. * Change frequency xpath config settings
  40. */
  41. const XML_PATH_CATEGORY_PRIORITY = 'sitemap/category/priority';
  42. const XML_PATH_PRODUCT_PRIORITY = 'sitemap/product/priority';
  43. const XML_PATH_PAGE_PRIORITY = 'sitemap/page/priority';
  44. /**#@-*/
  45. /**#@+
  46. * Search Engine Submission Settings
  47. */
  48. const XML_PATH_SUBMISSION_ROBOTS = 'sitemap/search_engines/submission_robots';
  49. /**#@-*/
  50. const XML_PATH_PRODUCT_IMAGES_INCLUDE = 'sitemap/product/image_include';
  51. /**
  52. * Get maximum sitemap.xml URLs number
  53. *
  54. * @param int $storeId
  55. * @return int
  56. * @deprecated 100.3.0
  57. * @see SitemapConfigReader::getMaximumLinesNumber()
  58. */
  59. public function getMaximumLinesNumber($storeId)
  60. {
  61. return $this->scopeConfig->getValue(
  62. self::XML_PATH_MAX_LINES,
  63. ScopeInterface::SCOPE_STORE,
  64. $storeId
  65. );
  66. }
  67. /**
  68. * Get maximum sitemap.xml file size in bytes
  69. *
  70. * @param int $storeId
  71. * @return int
  72. * @deprecated 100.3.0
  73. * @see SitemapConfigReader::getMaximumFileSize()
  74. */
  75. public function getMaximumFileSize($storeId)
  76. {
  77. return $this->scopeConfig->getValue(
  78. self::XML_PATH_MAX_FILE_SIZE,
  79. ScopeInterface::SCOPE_STORE,
  80. $storeId
  81. );
  82. }
  83. /**
  84. * Get category change frequency
  85. *
  86. * @param int $storeId
  87. * @return string
  88. * @deprecated 100.3.0
  89. * @see CategoryConfigReader::getChangeFrequency()
  90. */
  91. public function getCategoryChangefreq($storeId)
  92. {
  93. return (string)$this->scopeConfig->getValue(
  94. self::XML_PATH_CATEGORY_CHANGEFREQ,
  95. ScopeInterface::SCOPE_STORE,
  96. $storeId
  97. );
  98. }
  99. /**
  100. * Get product change frequency
  101. *
  102. * @param int $storeId
  103. * @return string
  104. * @deprecated 100.3.0
  105. * @see ProductConfigReader::getChangeFrequency()
  106. */
  107. public function getProductChangefreq($storeId)
  108. {
  109. return (string)$this->scopeConfig->getValue(
  110. self::XML_PATH_PRODUCT_CHANGEFREQ,
  111. ScopeInterface::SCOPE_STORE,
  112. $storeId
  113. );
  114. }
  115. /**
  116. * Get page change frequency
  117. *
  118. * @param int $storeId
  119. * @return string
  120. * @deprecated 100.3.0
  121. * @see CmsPageConfigReader::getChangeFrequency()
  122. */
  123. public function getPageChangefreq($storeId)
  124. {
  125. return (string)$this->scopeConfig->getValue(
  126. self::XML_PATH_PAGE_CHANGEFREQ,
  127. ScopeInterface::SCOPE_STORE,
  128. $storeId
  129. );
  130. }
  131. /**
  132. * Get category priority
  133. *
  134. * @param int $storeId
  135. * @return string
  136. * @deprecated 100.3.0
  137. * @see CategoryConfigReader::getPriority()
  138. */
  139. public function getCategoryPriority($storeId)
  140. {
  141. return (string)$this->scopeConfig->getValue(
  142. self::XML_PATH_CATEGORY_PRIORITY,
  143. ScopeInterface::SCOPE_STORE,
  144. $storeId
  145. );
  146. }
  147. /**
  148. * Get product priority
  149. *
  150. * @param int $storeId
  151. * @return string
  152. * @deprecated 100.3.0
  153. * @see ProductConfigReader::getPriority()
  154. */
  155. public function getProductPriority($storeId)
  156. {
  157. return (string)$this->scopeConfig->getValue(
  158. self::XML_PATH_PRODUCT_PRIORITY,
  159. ScopeInterface::SCOPE_STORE,
  160. $storeId
  161. );
  162. }
  163. /**
  164. * Get page priority
  165. *
  166. * @param int $storeId
  167. * @return string
  168. * @deprecated 100.3.0
  169. * @see CmsPageConfigReader::getPriority()
  170. */
  171. public function getPagePriority($storeId)
  172. {
  173. return (string)$this->scopeConfig->getValue(
  174. self::XML_PATH_PAGE_PRIORITY,
  175. ScopeInterface::SCOPE_STORE,
  176. $storeId
  177. );
  178. }
  179. /**
  180. * Get enable Submission to Robots.txt
  181. *
  182. * @param int $storeId
  183. * @return int
  184. * @deprecated 100.3.0
  185. * @see SitemapConfigReader::getEnableSubmissionRobots()
  186. */
  187. public function getEnableSubmissionRobots($storeId)
  188. {
  189. return $this->scopeConfig->getValue(
  190. self::XML_PATH_SUBMISSION_ROBOTS,
  191. ScopeInterface::SCOPE_STORE,
  192. $storeId
  193. );
  194. }
  195. /**
  196. * Get product image include policy
  197. *
  198. * @param int $storeId
  199. * @return string
  200. * @deprecated 100.3.0
  201. * @see SitemapConfigReader::getProductImageIncludePolicy()
  202. */
  203. public function getProductImageIncludePolicy($storeId)
  204. {
  205. return (string)$this->scopeConfig->getValue(
  206. self::XML_PATH_PRODUCT_IMAGES_INCLUDE,
  207. ScopeInterface::SCOPE_STORE,
  208. $storeId
  209. );
  210. }
  211. /**
  212. * Get list valid paths for generate a sitemap XML file
  213. *
  214. * @return string[]
  215. * @deprecated 100.3.0
  216. * @see SitemapConfigReader::getValidPaths()
  217. */
  218. public function getValidPaths()
  219. {
  220. return array_merge(
  221. $this->scopeConfig->getValue(self::XML_PATH_SITEMAP_VALID_PATHS, ScopeInterface::SCOPE_STORE),
  222. $this->scopeConfig->getValue(self::XML_PATH_PUBLIC_FILES_VALID_PATHS, ScopeInterface::SCOPE_STORE)
  223. );
  224. }
  225. }