diff --git a/lib/TrackingInfo.lib.php b/lib/TrackingInfo.lib.php index ea38bd3..a9828ef 100644 --- a/lib/TrackingInfo.lib.php +++ b/lib/TrackingInfo.lib.php @@ -9,6 +9,8 @@ class TrackingInfo { private $from = null; private $to = null; private $current_status = null; + private $carrierImageUrl = ""; + private $attributionText = ""; public function __construct($code = null, $carrier = null, $to = null, $from = null, $current_status = null, $history = null) { $this->code = $code; @@ -19,6 +21,14 @@ class TrackingInfo { $this->history = $history; } + public function setCarrierLogo(string $url) { + $this->carrierImageUrl = $url; + } + + public function setCarrierAttributionText(string $text) { + $this->attributionText = $text; + } + public function setCode(string $code) { $this->code = $code; } @@ -84,7 +94,9 @@ class TrackingInfo { "code" => $this->getCode(), "carrier" => [ "code" => Carriers::getCarrierCode($this->getCarrier()), - "name" => Carriers::getCarrierName($this->getCarrier()) + "name" => Carriers::getCarrierName($this->getCarrier()), + "attribution" => $this->attributionText, + "logo" => $this->carrierImageUrl ], "service" => [ "id" => $this->service->id, diff --git a/lib/Tracking_UPS.lib.php b/lib/Tracking_UPS.lib.php index d028fdf..7e4277e 100644 --- a/lib/Tracking_UPS.lib.php +++ b/lib/Tracking_UPS.lib.php @@ -89,6 +89,15 @@ class Tracking_UPS { $info->setCarrier("ups"); $info->setService(new Service($trackinfo["Service"]["Code"], $trackinfo["Service"]["Description"])); + $info->setCarrierLogo(($_SERVER['SERVER_PORT'] == 443 ? "https://" : "http://") + . $_SERVER['HTTP_HOST'] . env("urlbase", "/") + . "resources/logistics.tracking/logos/ups.gif"); + $info->setCarrierAttributionText("UPS, the UPS brand mark, and the Color Brown are " + . "trademarks of United Parcel Service of America, Inc. All Rights Reserved. " + . "© 2021 United Parcel Service of America, Inc. All Rights Reserved. Confidential " + . "and Proprietary The use, disclosure, reproduction, modification, transfer, or " + . "transmittal of this work for any purpose in any form or by any means without the " + . "written permission of United Parcel Service is strictly prohibited."); if (count($trackinfo["Package"]["Activity"]) > 0) { $current = $trackinfo["Package"]["Activity"][0]; diff --git a/lib/Tracking_USPS.lib.php b/lib/Tracking_USPS.lib.php index 4a6b59c..2b80385 100644 --- a/lib/Tracking_USPS.lib.php +++ b/lib/Tracking_USPS.lib.php @@ -51,6 +51,10 @@ class Tracking_USPS { $info->setCarrier("usps"); $info->setService(new Service((string) $trackinfo->ClassofMailCode, (string) $trackinfo->Class)); +// $info->setCarrierLogo(($_SERVER['SERVER_PORT'] == 443 ? "https://" : "http://") +// . $_SERVER['HTTP_HOST'] . env("urlbase", "/") +// . "resources/logistics.tracking/logos/usps.png"); + $info->setCarrierAttributionText("Information provided by www.usps.com."); $current_status = new TrackingEntry( TrackingStatus::USPSEventCodeToStatus($trackinfo->TrackSummary->EventCode), diff --git a/resources/logistics.tracking/logos/ups.gif b/resources/logistics.tracking/logos/ups.gif new file mode 100644 index 0000000..2638384 Binary files /dev/null and b/resources/logistics.tracking/logos/ups.gif differ