Produced by Araxis Merge on 2023-07-12 04:42:43 +0000. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | Porto v4.0.5/Theme Files/Porto Theme/app/code/Smartwave/Megamenu/Helper | Data.php | 2020-06-10 07:45:42 +0000 |
| 2 | Porto v4.0.6/Theme Files/Porto Theme/app/code/Smartwave/Megamenu/Helper | Data.php | 2023-04-19 01:30:14 +0000 |
| Description | Between Files 1 and 2 | |
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 222 |
| Changed | 0 | 0 |
| Inserted | 1 | 1 |
| Removed | 0 | 0 |
| Whitespace | Consecutive whitespace is treated as a single space |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
| Active line-pairing rules |
No regular expressions were active.
| 1 | <?php | 1 | <?php | |||
| 2 | /** | 2 | /** | |||
| 3 | * Copyright © 2018 Porto. All rights reserved. | 3 | * Copyright © 2018 Porto. All rights reserved. | |||
| 4 | */ | 4 | */ | |||
| 5 | namespace Smartwave\Megamenu\Helper; | 5 | namespace Smartwave\Megamenu\Helper; | |||
| 6 | 6 | |||||
| 7 | use Magento\Framework\View\Result\PageFactory; | 7 | use Magento\Framework\View\Result\PageFactory; | |||
| 8 | 8 | |||||
| 9 | class Data extends \Magento\Framework\App\Helper\AbstractHelper | 9 | class Data extends \Magento\Framework\App\Helper\AbstractHelper | |||
| 10 | { | 10 | { | |||
| 11 | 11 | |||||
| 12 | protected $_objectManager; | 12 | protected $_objectManager; | |||
| 13 | protected $_categoryHelper; | 13 | protected $_categoryHelper; | |||
| 14 | protected $_categoryFactory; | 14 | protected $_categoryFactory; | |||
| 15 | protected $_categoryFlatConfig; | 15 | protected $_categoryFlatConfig; | |||
| 16 | protected $_filterProvider; | 16 | protected $_filterProvider; | |||
| 17 | protected $resultPageFactory; | 17 | protected $resultPageFactory; | |||
| 18 | protected $_storeManager; | |||||
| 18 | 19 | |||||
| 19 | public function __construct( | 20 | public function __construct( | |||
| 20 | \Magento\Framework\App\Helper\Context $context, | 21 | \Magento\Framework\App\Helper\Context $context, | |||
| 21 | \Magento\Catalog\Helper\Category $categoryHelper, | 22 | \Magento\Catalog\Helper\Category $categoryHelper, | |||
| 22 | \Magento\Catalog\Model\CategoryFactory $categoryFactory, | 23 | \Magento\Catalog\Model\CategoryFactory $categoryFactory, | |||
| 23 | \Magento\Catalog\Model\Indexer\Category\Flat\State $categoryFlatState, | 24 | \Magento\Catalog\Model\Indexer\Category\Flat\State $categoryFlatState, | |||
| 24 | \Magento\Framework\ObjectManagerInterface $objectManager, | 25 | \Magento\Framework\ObjectManagerInterface $objectManager, | |||
| 25 | \Magento\Cms\Model\Template\FilterProvider $filterProvider, | 26 | \Magento\Cms\Model\Template\FilterProvider $filterProvider, | |||
| 26 | PageFactory $resultPageFactory, | 27 | PageFactory $resultPageFactory, | |||
| 27 | \Magento\Store\Model\StoreManagerInterface $storeManager | 28 | \Magento\Store\Model\StoreManagerInterface $storeManager | |||
| 28 | ) { | 29 | ) { | |||
| 29 | $this->_storeManager = $storeManager; | 30 | $this->_storeManager = $storeManager; | |||
| 30 | $this->_objectManager= $objectManager; | 31 | $this->_objectManager= $objectManager; | |||
| 31 | $this->_categoryFactory = $categoryFactory; | 32 | $this->_categoryFactory = $categoryFactory; | |||
| 32 | $this->_categoryFlatConfig = $categoryFlatState; | 33 | $this->_categoryFlatConfig = $categoryFlatState; | |||
| 33 | $this->_categoryHelper = $categoryHelper; | 34 | $this->_categoryHelper = $categoryHelper; | |||
| 34 | $this->resultPageFactory = $resultPageFactory; | 35 | $this->resultPageFactory = $resultPageFactory; | |||
| 35 | $this->_filterProvider = $filterProvider; | 36 | $this->_filterProvider = $filterProvider; | |||
| 36 | 37 | |||||
| 37 | parent::__construct($context); | 38 | parent::__construct($context); | |||
| 38 | } | 39 | } | |||
| 39 | public function getBaseUrl($url_type=\Magento\Framework\UrlInterface::URL_TYPE_MEDIA) | 40 | public function getBaseUrl($url_type=\Magento\Framework\UrlInterface::URL_TYPE_MEDIA) | |||
| 40 | { | 41 | { | |||
| 41 | return $this->_storeManager->getStore()->getBaseUrl(); | 42 | return $this->_storeManager->getStore()->getBaseUrl(); | |||
| 42 | } | 43 | } | |||
| 43 | public function getConfig($config_path) | 44 | public function getConfig($config_path) | |||
| 44 | { | 45 | { | |||
| 45 | return $this->scopeConfig->getValue( | 46 | return $this->scopeConfig->getValue( | |||
| 46 | $config_path, | 47 | $config_path, | |||
| 47 | \Magento\Store\Model\ScopeInterface::SCOPE_STORE | 48 | \Magento\Store\Model\ScopeInterface::SCOPE_STORE | |||
| 48 | ); | 49 | ); | |||
| 49 | } | 50 | } | |||
| 50 | public function getModel($model) { | 51 | public function getModel($model) { | |||
| 51 | return $this->_objectManager->create($model); | 52 | return $this->_objectManager->create($model); | |||
| 52 | } | 53 | } | |||
| 53 | public function getCurrentStore() { | 54 | public function getCurrentStore() { | |||
| 54 | return $this->_storeManager->getStore(); | 55 | return $this->_storeManager->getStore(); | |||
| 55 | } | 56 | } | |||
| 56 | public function getFirstLevelCategories($sorted = false, $asCollection = false, $toLoad = true) { | 57 | public function getFirstLevelCategories($sorted = false, $asCollection = false, $toLoad = true) { | |||
| 57 | return $this->_categoryHelper->getStoreCategories($sorted , $asCollection, $toLoad); | 58 | return $this->_categoryHelper->getStoreCategories($sorted , $asCollection, $toLoad); | |||
| 58 | } | 59 | } | |||
| 59 | public function getCategoryModel($id) | 60 | public function getCategoryModel($id) | |||
| 60 | { | 61 | { | |||
| 61 | $_category = $this->_categoryFactory->create(); | 62 | $_category = $this->_categoryFactory->create(); | |||
| 62 | $_category->load($id); | 63 | $_category->load($id); | |||
| 63 | 64 | |||||
| 64 | return $_category; | 65 | return $_category; | |||
| 65 | } | 66 | } | |||
| 66 | public function getActiveChildCategories($category) | 67 | public function getActiveChildCategories($category) | |||
| 67 | { | 68 | { | |||
| 68 | $children = []; | 69 | $children = []; | |||
| 69 | $subcategories = $category->getChildrenCategories(); | 70 | $subcategories = $category->getChildrenCategories(); | |||
| 70 | foreach($subcategories as $category) { | 71 | foreach($subcategories as $category) { | |||
| 71 | if (!$category->getIsActive()) { | 72 | if (!$category->getIsActive()) { | |||
| 72 | continue; | 73 | continue; | |||
| 73 | } | 74 | } | |||
| 74 | $children[] = $category; | 75 | $children[] = $category; | |||
| 75 | } | 76 | } | |||
| 76 | return $children; | 77 | return $children; | |||
| 77 | } | 78 | } | |||
| 78 | public function getBlockContent($content = '') { | 79 | public function getBlockContent($content = '') { | |||
| 79 | if(!$this->_filterProvider) | 80 | if(!$this->_filterProvider) | |||
| 80 | return $content; | 81 | return $content; | |||
| 81 | return $this->_filterProvider->getBlockFilter()->filter(trim($content)); | 82 | return $this->_filterProvider->getBlockFilter()->filter(trim($content)); | |||
| 82 | } | 83 | } | |||
| 83 | public function getResultPageFactory() { | 84 | public function getResultPageFactory() { | |||
| 84 | return $this->resultPageFactory; | 85 | return $this->resultPageFactory; | |||
| 85 | } | 86 | } | |||
| 86 | public function getSubmenuItemsHtml($children, $level=0, $max_level=2) | 87 | public function getSubmenuItemsHtml($children, $level=0, $max_level=2) | |||
| 87 | { | 88 | { | |||
| 88 | $html = ''; | 89 | $html = ''; | |||
| 89 | if(count($children) && ($level < $max_level)){ | 90 | if(count($children) && ($level < $max_level)){ | |||
| 90 | $html .= '<ul'; | 91 | $html .= '<ul'; | |||
| 91 | if($level == 0) | 92 | if($level == 0) | |||
| 92 | $html .=' class="columns5"'; | 93 | $html .=' class="columns5"'; | |||
| 93 | $html .= '>'; | 94 | $html .= '>'; | |||
| 94 | foreach($children as $child) { | 95 | foreach($children as $child) { | |||
| 95 | $html .= '<li class="menu-item level'.$level; | 96 | $html .= '<li class="menu-item level'.$level; | |||
| 96 | $activeChildren = $this->getActiveChildCategories($child); | 97 | $activeChildren = $this->getActiveChildCategories($child); | |||
| 97 | 98 | |||||
| 98 | if(count($activeChildren)) | 99 | if(count($activeChildren)) | |||
| 99 | $html .= ' menu-parent-item'; | 100 | $html .= ' menu-parent-item'; | |||
| 100 | $html .= '">'; | 101 | $html .= '">'; | |||
| 101 | 102 | |||||
| 102 | $html .='<a href="'.$child->getUrl().'" data-id="'.$child->getId().'"><span>'.$child->getName().'</span></a>'; | 103 | $html .='<a href="'.$child->getUrl().'" data-id="'.$child->getId().'"><span>'.$child->getName().'</span></a>'; | |||
| 103 | if(count($activeChildren)) | 104 | if(count($activeChildren)) | |||
| 104 | $html .= $this->getSubmenuItemsHtml($activeChildren, $level+1, $max_level); | 105 | $html .= $this->getSubmenuItemsHtml($activeChildren, $level+1, $max_level); | |||
| 105 | $html .= '</li>'; | 106 | $html .= '</li>'; | |||
| 106 | } | 107 | } | |||
| 107 | $html .= '</ul>'; | 108 | $html .= '</ul>'; | |||
| 108 | } | 109 | } | |||
| 109 | return $html; | 110 | return $html; | |||
| 110 | } | 111 | } | |||
| 111 | } | 112 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993–2019 Araxis Ltd (www.araxis.com). All rights reserved.