diff --git a/Controller/Adminhtml/Config/Sftp/TestConnection.php b/Controller/Adminhtml/Config/Sftp/TestConnection.php index 79dc2bb..a7e121a 100644 --- a/Controller/Adminhtml/Config/Sftp/TestConnection.php +++ b/Controller/Adminhtml/Config/Sftp/TestConnection.php @@ -22,7 +22,12 @@ */ class TestConnection extends Action { - + public $sftp; + public $storeManager; + public $configProvider; + public $resultJsonFactory; + public $tagFilter; + /** * TestConnection constructor. * @@ -88,10 +93,10 @@ public function execute() /** - * @var \Magento\Framework\Controller\Result\Json $resultJson + * @var \Magento\Framework\Controller\Result\Json $resultJson */ $resultJson = $this->resultJsonFactory->create(); return $resultJson->setData($result); } -} \ No newline at end of file +} diff --git a/Logger/Logger.php b/Logger/Logger.php index ea6792b..fb55b6f 100644 --- a/Logger/Logger.php +++ b/Logger/Logger.php @@ -87,6 +87,6 @@ public function addRecord(int $level, string $message, array $context = [], Date print_r($message."\n"); } - return parent::addRecord($level, $message, $context); + return parent::addRecord($level, $message, $context, $datetime); } } diff --git a/Model/BVSEOSDK/BV.php b/Model/BVSEOSDK/BV.php index 6a3c900..a732d32 100644 --- a/Model/BVSEOSDK/BV.php +++ b/Model/BVSEOSDK/BV.php @@ -54,6 +54,31 @@ */ class BV { + public $config; + /** + * @var \Bazaarvoice\Connector\Model\BVSEOSDK\Reviews + */ + public $reviews; + /** + * @var \Bazaarvoice\Connector\Model\BVSEOSDK\Questions + */ + public $questions; + /** + * @var \Bazaarvoice\Connector\Model\BVSEOSDK\Stories + */ + public $stories; + /** + * @var \Bazaarvoice\Connector\Model\BVSEOSDK\Spotlights + */ + public $spotlights; + /** + * @var \Bazaarvoice\Connector\Model\BVSEOSDK\SellerRatings + */ + public $sellerratings; + /** + * @var \Bazaarvoice\Connector\Model\BVSEOSDK\SellerRatings|\Bazaarvoice\Connector\Model\BVSEOSDK\Reviews|\Bazaarvoice\Connector\Model\BVSEOSDK\Questions|\Bazaarvoice\Connector\Model\BVSEOSDK\Stories|\Bazaarvoice\Connector\Model\BVSEOSDK\Spotlights + */ + public $SEO; /** * BV Class Constructor @@ -196,4 +221,3 @@ protected function validateParameters($params) } } } - diff --git a/Model/BVSEOSDK/BVFooter.php b/Model/BVSEOSDK/BVFooter.php index 5f9d773..84ba94f 100644 --- a/Model/BVSEOSDK/BVFooter.php +++ b/Model/BVSEOSDK/BVFooter.php @@ -132,13 +132,15 @@ public function buildSDKDebugFooter() $footer .= "\n".'
  • '.$this->base->config['bv_root_folder'].'
  • '; $footer .= "\n".'
  • '.$this->base->config['charset'].'
  • '; $footer .= "\n".'
  • '.$ssl_enabled.'
  • '; - $footer .= "\n".'
  • '.$this->base->config['crawler_agent_pattern'].'
  • '; + $userAgent = $_SERVER['HTTP_USER_AGENT'] ?? ''; + $crawlerAgentPattern = $this->base->config['crawler_agent_pattern'] ?? ''; + $footer .= "\n".'
  • '.$crawlerAgentPattern.'
  • '; $footer .= "\n".'
  • '.urlencode($subject_id).'
  • '; $footer .= "\n".'
  • '.$sdk_enabled.'
  • '; $footer .= "\n".'
  • bvseo-'.$this->base->config['page'].'
  • '; - $footer .= "\n".'
  • '.$_SERVER['HTTP_USER_AGENT'].'
  • '; + $footer .= "\n".'
  • '.$userAgent.'
  • '; $footer .= "\n".'
  • '.$this->base->config['page_url'].'
  • '; $footer .= "\n".'
  • '.$this->base->config['base_url'].'
  • '; $footer .= "\n".'
  • '.$content_type.'
  • '; diff --git a/Model/BVSEOSDK/Base.php b/Model/BVSEOSDK/Base.php index 4219a17..5fce194 100644 --- a/Model/BVSEOSDK/Base.php +++ b/Model/BVSEOSDK/Base.php @@ -18,6 +18,21 @@ */ class Base { + + public $config; + /** + * @var array|array + */ + public $bv_config; + public $seo_url; + /** + * @var float|string + */ + public $start_time; + /** + * @var float + */ + public $response_time; private $msg = ''; public function __construct($params = array()) @@ -45,7 +60,8 @@ public function __construct($params = array()) : $this->config['execution_timeout']; // set up combined user agent to be passed to cloud storage (if needed) - $this->config['user_agent'] = "bv_php_sdk/3.2.1;".$_SERVER['HTTP_USER_AGENT']; + $userAgent = $_SERVER['HTTP_USER_AGENT'] ?? ''; + $this->config['user_agent'] = "bv_php_sdk/3.2.1;".$userAgent; } protected function validateParams($params) @@ -287,6 +303,10 @@ private function _isBot() return true; } + if (!isset($this->config['crawler_agent_pattern']) || !isset($_SERVER['HTTP_USER_AGENT'])) { + return true; + } + // search the user agent string for an indication if this is a search bot or not return mb_eregi('('.$this->config['crawler_agent_pattern'].')', $_SERVER['HTTP_USER_AGENT']); } diff --git a/Model/BVSEOSDK/Questions.php b/Model/BVSEOSDK/Questions.php index 31cd36c..6041f31 100644 --- a/Model/BVSEOSDK/Questions.php +++ b/Model/BVSEOSDK/Questions.php @@ -15,6 +15,10 @@ */ class Questions extends Base { + /** + * @var array|array + */ + public $config; function __construct($params = array()) { diff --git a/Model/BVSEOSDK/Reviews.php b/Model/BVSEOSDK/Reviews.php index 37c01f2..7d242ff 100644 --- a/Model/BVSEOSDK/Reviews.php +++ b/Model/BVSEOSDK/Reviews.php @@ -15,6 +15,10 @@ */ class Reviews extends Base { + /** + * @var array|array + */ + public $config; function __construct($params = array()) { diff --git a/Model/BVSEOSDK/SellerRatings.php b/Model/BVSEOSDK/SellerRatings.php index ae01e30..87c8fce 100644 --- a/Model/BVSEOSDK/SellerRatings.php +++ b/Model/BVSEOSDK/SellerRatings.php @@ -10,6 +10,10 @@ class SellerRatings extends Base { + /** + * @var array + */ + public $config; function __construct($params = array()) { diff --git a/Model/BVSEOSDK/Spotlights.php b/Model/BVSEOSDK/Spotlights.php index 1900051..b37fa1d 100644 --- a/Model/BVSEOSDK/Spotlights.php +++ b/Model/BVSEOSDK/Spotlights.php @@ -10,6 +10,10 @@ class Spotlights extends Base { + /** + * @var array + */ + public $config; function __construct($params = array()) { diff --git a/Model/BVSEOSDK/Stories.php b/Model/BVSEOSDK/Stories.php index c14613f..1e37c1f 100644 --- a/Model/BVSEOSDK/Stories.php +++ b/Model/BVSEOSDK/Stories.php @@ -15,6 +15,10 @@ */ class Stories extends Base { + /** + * @var array|array + */ + public $config; function __construct($params = array()) { diff --git a/Model/Indexer/Eav.php b/Model/Indexer/Eav.php index 1048634..d6b4864 100644 --- a/Model/Indexer/Eav.php +++ b/Model/Indexer/Eav.php @@ -46,6 +46,13 @@ class Eav implements IndexerActionInterface, MviewActionInterface { + /** + * @var \Magento\Catalog\Helper\Image + */ + public $imageHelper; + public $assetRepository; + public $design; + public $theme; /** * @var \Bazaarvoice\Connector\Logger\Logger */ diff --git a/Model/XMLWriter.php b/Model/XMLWriter.php index 3c4140f..2ba9402 100644 --- a/Model/XMLWriter.php +++ b/Model/XMLWriter.php @@ -20,7 +20,7 @@ class XMLWriter extends \XMLWriter * @param null $content * @param bool $cdata * - * @return bool|void + * @return bool */ public function writeElement($name, $content = null, $cdata = false): bool { @@ -31,26 +31,25 @@ public function writeElement($name, $content = null, $cdata = false): bool $this->endElement(); return true; } else { - parent::writeElement($name, $content); - return true; + return parent::writeElement($name, $content); } + return false; } /** * @param null $content * @param bool $cdata * - * @return bool|void + * @return bool */ public function writeRaw($content = null, $cdata = false): bool { $content = trim((string)$content); if ($cdata) { - $this->writeCdata($content); - return true; + return $this->writeCdata($content); } else { - parent::writeRaw($content); - return true; + return parent::writeRaw($content); } + return false; } -} \ No newline at end of file +} diff --git a/Setup/Patch/Data/UpgradeBvDataAtttribute.php b/Setup/Patch/Data/UpgradeBvDataAtttribute.php index c228b51..ab1c6fa 100644 --- a/Setup/Patch/Data/UpgradeBvDataAtttribute.php +++ b/Setup/Patch/Data/UpgradeBvDataAtttribute.php @@ -30,6 +30,7 @@ class UpgradeBvDataAtttribute implements DataPatchInterface, PatchRevertableInterface { + public $salesSetupFactory; const MODULE_NAME = 'Bazaarvoice_Connector'; /** * @var ModuleDataSetupInterface diff --git a/ViewModel/Pixel.php b/ViewModel/Pixel.php index 29a0abf..bc61652 100644 --- a/ViewModel/Pixel.php +++ b/ViewModel/Pixel.php @@ -132,11 +132,11 @@ public function getOrderDetails() $this->orderDetails['tax'] = number_format((float)$order->getTaxAmount() ?? 0.0, 2, '.', ''); $this->orderDetails['shipping'] = number_format((float)$order->getShippingAmount() ?? 0.0, 2, '.', ''); if (!$this->taxConfig->discountTax()) { - $this->orderDetails['discount'] = number_format(abs((float)$order->getDiscountAmount()) ?? 0.0, 2, '.', ''); + $this->orderDetails['discount'] = number_format((float)abs((float)$order->getDiscountAmount()) ?? 0.0, 2, '.', ''); } else { //when discount is applied to products "including tax" - extract tax compensation amount from "discount".   $this->orderDetails['discount'] = number_format( - abs((float)$order->getDiscountAmount()) - abs((float)$order->getDiscountTaxCompensationAmount()) ?? 0.0, 2, '.', '' ); + (float)abs((float)$order->getDiscountAmount()) - (float)abs((float)$order->getDiscountTaxCompensationAmount()) ?? 0.0, 2, '.', '' ); } if ($address) { diff --git a/composer.json b/composer.json index 8eee097..dcdd6b2 100644 --- a/composer.json +++ b/composer.json @@ -15,6 +15,7 @@ } }, "require": { - "php": "~7.0||~8.1.0||~8.2.0" ,"magento/framework": "~100.1|~101.0|~102.0|~103.0|~104.0" + "php": "~7.0||~8.1.0||~8.2.0||~8.3.0" , + "magento/framework": "*" } }