This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// ... $desc should be a JSON string ... | |
if (!empty($desc)) { | |
try { | |
$desc_obj = json_decode($desc); | |
if (!is_object($desc_obj)) { | |
throw new Exception(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// ... $desc should be a JSON string ... | |
if (!empty($desc)) { | |
$desc_obj = json_decode($desc); | |
$action = $desc_obj->action; | |
$reasons = explode(',', $desc_obj->reasons); | |
// ... parsing logic for $reasons ... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Shop; | |
require_once('/app/cottenio/code/autoloader.php'); | |
class DropShip | |
{ | |
public $shopcode; | |
public $name; | |
public $postalcode; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$shop = new Shop\DropShip($shop_id); | |
if ($shop) { | |
$code = $shop->shopcode; | |
$shop = $shop->shopname; | |
$zip = $shop->postalcode; | |
$phone = $shop->phone; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
try | |
{ | |
$response = $client->track($request); | |
if ($response->HighestSeverity != 'FAILURE' && $response->HighestSeverity != 'ERROR') | |
{ | |
if (isset($response->TrackDetails)) { | |
$return[0] = $response->TrackDetails->StatusCode; | |
$return[1] = $response->TrackDetails->StatusDescription; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$bird = new stdClass(); | |
$bird->name = "Mockingbird"; | |
$tail = new stdClass(); | |
$tail->color = "Brown"; | |
$tail->type = null; | |
$bird->tail = $tail; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
try | |
{ | |
$response = $client ->track($request); | |
if ($response -> HighestSeverity != 'FAILURE' && $response -> HighestSeverity != 'ERROR') | |
{ | |
$return[0]=$response->TrackDetails->StatusCode; | |
$return[1]=$response->TrackDetails->StatusDescription; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (!empty($img)) { | |
$tmg = pathinfo(str_replace('\\', '/', $img)); | |
$img = $tmg['basename']; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (!empty($img)) { | |
$tmg = explode("/", $img); | |
$img = $tmg[3]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Set relative product URLs | |
foreach ($products as &$product) { | |
$url = "&product_id={$product['id']}"; | |
$name = explode(" -- ", $product['name']); // like: Chocolates -- 587 | |
$url .= "&name={$name[0]}"; | |
if (!empty($name[1])) { | |
$name[1] = str_pad($name[1], 8, "0", STR_PAD_LEFT); // format as 00000587 |
NewerOlder