![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/cartforge.co/app/code/Amasty/MWishlist/Plugin/DataPost/ |
<?php /** * @author Amasty Team * @copyright Copyright (c) Amasty (https://www.amasty.com) * @package Multiple Wishlist for Magento 2 */ namespace Amasty\MWishlist\Plugin\DataPost; use Amasty\MWishlist\Model\ConfigProvider; class Replacer { public const DATA_POST = 'data-post'; public const DATA_ADD_POPUP_ATTRIBUTE = 'data-mwishlist-popup="open"'; public const DATA_POST_AJAX = 'data-mwishlist-ajax'; public const HREF_ATTR = '@href="#"@'; public const WISHLIST_REGEX = '@(<a[^>]*)data-post([^>]*towishlist[^>]*)@'; /** * @var ConfigProvider */ private $configProvider; public function __construct(ConfigProvider $configProvider) { $this->configProvider = $configProvider; } /** * @param string $html * @param string $pattern */ public function dataPostReplace(&$html, $pattern = '@' . self::DATA_POST . '@') { if ($this->configProvider->isEnabled()) { $html = preg_replace( $pattern, '$1' . static::DATA_ADD_POPUP_ATTRIBUTE . ' ' . static::DATA_POST_AJAX . '$2', $html ); // $html = preg_replace(static::HREF_ATTR, '', $html); } } }