static function getTotalShipping($cart) { $cartArr = new PhpwebArray($cart); $shipping = $cartArr->get('shipping'); $shippingDiscount = $cartArr->get('shipping_discount'); return $shipping + $shippingDiscount; }
static function sendErrorLog($obj, $config, $error, $request) { if ($error instanceof Exception) { $newrelic = self::getNewRelic($config); $newrelic->callNewRelic('newrelic_notice_error', array($error->getMessage(), $error)); $obj->newrelic = $newrelic; } $to = NULL; if (isset($config['developer_email'])) { $to = $config['developer_email']; } if (!$to) { return; } $mailer = self::getMailer($config); $from = 'SIRCLO <*****@*****.**>'; $requestArr = print_r($request, TRUE); $body = <<<EOD Error Message: {$error} Request dump: {$requestArr} EOD; $reqArr = new PhpwebArray($request); $httpHost = $reqArr->get(array('server', 'HTTP_HOST'), 'Unknown Site'); $requestUri = $reqArr->get(array('server', 'REQUEST_URI')); $mailer->send($from, $to, NULL, NULL, "Internal Server Error Report ({$httpHost}{$requestUri})", $body); $obj->mailer = $mailer; }
static function getOptionsRaw($controller, $optionsSource) { $optionsRaw = array(); if (isset($optionsSource['function'])) { $function = $optionsSource['function']; $optionsRaw = $function($controller); } else { if (isset($optionsSource['product_option'])) { $optionsRaw = $controller->getConfigProductOption($optionsSource['product_option']); } else { if (isset($optionsSource['depconfig_key'])) { $optionsRaw = $controller->getOptionsFromDepConfig($optionsSource['depconfig_key']); } else { if (isset($optionsSource['db'])) { $db = $optionsSource['db']; $method = $optionsSource['method']; $attrs = array(); if (isset($optionsSource['method_attrs'])) { $attrs = $optionsSource['method_attrs']; } $optionsRaw = $controller->getObjects($db, $method, $attrs); } else { if (isset($optionsSource['configKey'])) { $getMethod = $optionsSource['method']; $optionsRaw = $controller->{$getMethod}($optionsSource['configKey']); } else { if (isset($optionsSource['krco_config_keys']) && isset($controller->krco_config)) { $configArr = new PhpwebArray($controller->krco_config); $optionsRaw = $configArr->get($optionsSource['krco_config_keys']); if (!isset($optionsRaw)) { $optionsRaw = array(); } } else { if (isset($optionsSource['class']) && isset($optionsSource['static_attribute'])) { $class = $optionsSource['class']; $attr = $optionsSource['static_attribute']; $optionsRaw = $class::${$attr}; } } } } } } } return $optionsRaw; }