31. Araxis Merge File Comparison Report

Produced by Araxis Merge on 2022-09-08 08:48:55 +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.

31.1 Files compared

#LocationFileLast Modified
1/Volumes/Data 1/Ampps/www/Porto v4.0.2/Theme Files/Magento 2.x/Porto Theme/app/code/Mageplaza/Search/HelperMedia.php2021-12-28 10:15:02 +0000
2Theme Files/Magento 2.x/Porto Theme/app/code/Mageplaza/Search/HelperMedia.php2022-06-10 10:42:23 +0000

31.2 Comparison summary

DescriptionBetween
Files 1 and 2
Text BlocksLines
Unchanged1258
Changed00
Inserted00
Removed00

31.3 Comparison options

WhitespaceConsecutive whitespace is treated as a single space
Character caseDifferences in character case are significant
Line endingsDifferences in line endings (CR and LF characters) are ignored
CR/LF charactersNot shown in the comparison detail
Active line-pairing rules

31.4 Active regular expressions

No regular expressions were active.

31.5 Comparison detail

1 <?php 1 <?php
2 /** 2 /**
3  * Mageplaza 3  * Mageplaza
4  * 4  *
5  * NOTICE OF LICENSE 5  * NOTICE OF LICENSE
6  * 6  *
7  * This source file is subject to the Mageplaza.com license that is 7  * This source file is subject to the Mageplaza.com license that is
8  * available through the world-wide-web at this URL: 8  * available through the world-wide-web at this URL:
9  * https://www.mageplaza.com/LICENSE.txt 9  * https://www.mageplaza.com/LICENSE.txt
10  * 10  *
11  * DISCLAIMER 11  * DISCLAIMER
12  * 12  *
13  * Do not edit or add to this file if you wish to upgrade this extension to newer 13  * Do not edit or add to this file if you wish to upgrade this extension to newer
14  * version in the future. 14  * version in the future.
15  * 15  *
16  * @category    Mageplaza 16  * @category    Mageplaza
17  * @package     Mageplaza_Search 17  * @package     Mageplaza_Search
18  * @copyright   Copyright (c) Mageplaza (https://www.mageplaza.com/) 18  * @copyright   Copyright (c) Mageplaza (https://www.mageplaza.com/)
19  * @license     https://www.mageplaza.com/LICENSE.txt 19  * @license     https://www.mageplaza.com/LICENSE.txt
20  */ 20  */
21  21 
22 namespace Mageplaza\Search\Helper; 22 namespace Mageplaza\Search\Helper;
23  23 
24 use Exception; 24 use Exception;
25 use Magento\Catalog\Helper\ImageFactory; 25 use Magento\Catalog\Helper\ImageFactory;
26 use Magento\Catalog\Model\Product; 26 use Magento\Catalog\Model\Product;
27 use Magento\Framework\App\Helper\Context; 27 use Magento\Framework\App\Helper\Context;
28 use Magento\Framework\Exception\FileSystemException; 28 use Magento\Framework\Exception\FileSystemException;
29 use Magento\Framework\Filesystem; 29 use Magento\Framework\Filesystem;
30 use Magento\Framework\Image\AdapterFactory; 30 use Magento\Framework\Image\AdapterFactory;
31 use Magento\Framework\ObjectManagerInterface; 31 use Magento\Framework\ObjectManagerInterface;
32 use Magento\MediaStorage\Model\File\UploaderFactory; 32 use Magento\MediaStorage\Model\File\UploaderFactory;
33 use Magento\Store\Model\StoreManagerInterface; 33 use Magento\Store\Model\StoreManagerInterface;
34 use Mageplaza\Core\Helper\Media as CoreMedia; 34 use Mageplaza\Core\Helper\Media as CoreMedia;
35  35 
36 /** 36 /**
37  * Class Media 37  * Class Media
38  * @package Mageplaza\Search\Helper 38  * @package Mageplaza\Search\Helper
39  */ 39  */
40 class Media extends CoreMedia 40 class Media extends CoreMedia
41 { 41 {
42     const TEMPLATE_MEDIA_PATH = 'mageplaza/search'; 42     const TEMPLATE_MEDIA_PATH = 'mageplaza/search';
43  43 
44     /** 44     /**
45      * @var ImageFactory 45      * @var ImageFactory
46      */ 46      */
47     protected $imageFactory; 47     protected $imageFactory;
48  48 
49     /** 49     /**
50      * Media constructor. 50      * Media constructor.
51      * 51      *
52      * @param Context $context 52      * @param Context $context
53      * @param ObjectManagerInterface $objectManager 53      * @param ObjectManagerInterface $objectManager
54      * @param StoreManagerInterface $storeManager 54      * @param StoreManagerInterface $storeManager
55      * @param Filesystem $filesystem 55      * @param Filesystem $filesystem
56      * @param UploaderFactory $uploaderFactory 56      * @param UploaderFactory $uploaderFactory
57      * @param AdapterFactory $adapterFactory 57      * @param AdapterFactory $adapterFactory
58      * @param ImageFactory $imageFactory 58      * @param ImageFactory $imageFactory
59      * 59      *
60      * @throws FileSystemException 60      * @throws FileSystemException
61      */ 61      */
62     public function __construct( 62     public function __construct(
63         Context $context, 63         Context $context,
64         ObjectManagerInterface $objectManager, 64         ObjectManagerInterface $objectManager,
65         StoreManagerInterface $storeManager, 65         StoreManagerInterface $storeManager,
66         Filesystem $filesystem, 66         Filesystem $filesystem,
67         UploaderFactory $uploaderFactory, 67         UploaderFactory $uploaderFactory,
68         AdapterFactory $adapterFactory, 68         AdapterFactory $adapterFactory,
69         ImageFactory $imageFactory 69         ImageFactory $imageFactory
70     ) { 70     ) {
71         parent::__construct($context, $objectManager, $storeManager, $filesystem, $uploaderFactory, $adapterFactory); 71         parent::__construct($context, $objectManager, $storeManager, $filesystem, $uploaderFactory, $adapterFactory);
72  72 
73         $this->imageFactory = $imageFactory; 73         $this->imageFactory = $imageFactory;
74     } 74     }
75  75 
76     /** 76     /**
77      * Retrieve product image 77      * Retrieve product image
78      * 78      *
79      * @param Product $product 79      * @param Product $product
80      * @param string $imageId 80      * @param string $imageId
81      * 81      *
82      * @return string 82      * @return string
83      */ 83      */
84     public function getProductImage($product, $imageId = 'mpsearch_image') 84     public function getProductImage($product, $imageId = 'mpsearch_image')
85     { 85     {
86         $imageUrl = $this->imageFactory->create() 86         $imageUrl = $this->imageFactory->create()
87             ->init($product, $imageId) 87             ->init($product, $imageId)
88             ->getUrl(); 88             ->getUrl();
89  89 
90         $baseMediaUrl = $this->getSearchMediaUrl(); 90         $baseMediaUrl = $this->getSearchMediaUrl();
91         if (strpos($imageUrl, $baseMediaUrl) === 0) { 91         if (strpos($imageUrl, $baseMediaUrl) === 0) {
92             $imageUrl = substr($imageUrl, strlen($baseMediaUrl)); 92             $imageUrl = substr($imageUrl, strlen($baseMediaUrl));
93         } 93         }
94  94 
95         return $imageUrl; 95         return $imageUrl;
96     } 96     }
97  97 
98     /** 98     /**
99      * @return string 99      * @return string
100      */ 100      */
101     public function getSearchMediaUrl() 101     public function getSearchMediaUrl()
102     { 102     {
103         return $this->getBaseMediaUrl() . '/catalog/product/'; 103         return $this->getBaseMediaUrl() . '/catalog/product/';
104     } 104     }
105  105 
106     /** 106     /**
107      * @param $fileName 107      * @param $fileName
108      * @param $content 108      * @param $content
109      */ 109      */
110     public function createJsFile($fileName, $content) 110     public function createJsFile($fileName, $content)
111     { 111     {
112         try { 112         try {
113             $this->mediaDirectory->writeFile($fileName, $content); 113             $this->mediaDirectory->writeFile($fileName, $content);
114         } catch (Exception $e) { 114         } catch (Exception $e) {
115             $this->_logger->critical($e->getMessage()); 115             $this->_logger->critical($e->getMessage());
116         } 116         }
117     } 117     }
118  118 
119     /** 119     /**
120      * @return $this 120      * @return $this
121      * @throws FileSystemException 121      * @throws FileSystemException
122      */ 122      */
123     public function removeJsPath() 123     public function removeJsPath()
124     { 124     {
125         $this->removePath(self::TEMPLATE_MEDIA_PATH); 125         $this->removePath(self::TEMPLATE_MEDIA_PATH);
126  126 
127         return $this; 127         return $this;
128     } 128     }
129 } 129 }