b374k
m1n1 1.01
Apache/2.4.41 (Ubuntu)
Linux vmi616275.contaboserver.net 5.4.0-84-generic #94-Ubuntu SMP Thu Aug 26 20:27:37 UTC 2021 x86_64
uid=33(www-data) gid=33(www-data) groups=33(www-data)
server ip : 62.171.164.128 | your ip : 127.0.0.1
safemode OFF
 >  / home / dev2.destoffenstraat.com / app / code / WeSupply / Toolbox / Block /
Filename/home/dev2.destoffenstraat.com/app/code/WeSupply/Toolbox/Block/Track.php
Size2.08 kb
Permissionrwxrwxrwx
Ownerroot : root
Create time17-Aug-2025 10:26
Last modified17-May-2021 07:14
Last accessed23-Aug-2025 01:52
Actionsedit | rename | delete | download (gzip)
Viewtext | code | image
<?php

namespace WeSupply\Toolbox\Block;

use Magento\Framework\View\Element\Template;
use Magento\Framework\View\Element\Template\Context;
use WeSupply\Toolbox\Helper\Data as Helper;

class Track extends Template
{
/**
* @var array
*/
private $params;

/**
* @var Helper
*/
private $helper;

/**
* Track constructor.
* @param Context $context
* @param Helper $helper
*/
public function __construct(
Context $context,
Helper $helper
)
{
$this->params = $context->getRequest()->getParams();
$this->helper = $helper;

parent::__construct($context);
}

/**
* @return string
*/
public function getPlatform()
{
return $this->helper->getPlatform();
}

/**
* @return bool|mixed
*/
public function getOrderId()
{
$params = $this->getParams();
if (isset($params['orderID'])) {
return $params['orderID'];
}

return false;
}

/**
* @return string
*/
public function getWeSupplyTrackUrl()
{
if ($trackingId = $this->getTrackingCode()) {
return $this->helper->getWesupplyFullDomain() . 'track/' . $trackingId . '/';
}

return $this->helper->getWesupplyFullDomain();
}

/**
* @return bool
*/
public function canShowEmbedded()
{
if (
$this->helper->getWeSupplyEnabled() &&
$this->helper->getConnectionStatus()
) {
return true;
}
return false;
}

/**
* @return array
*/
private function getParams()
{
return $this->params;
}

/**
* Return tracking id which should be a param key with empty value
* @return bool|mixed
*/
private function getTrackingCode()
{
$res = array_filter($this->getParams(), function($val) {
return $val === '';
});

if ($res) {
$keys = array_keys($res);
return reset($keys) ?? false;
}

return false;
}
}