sentence1
stringlengths
52
3.87M
sentence2
stringlengths
1
47.2k
label
stringclasses
1 value
public function validateActionsImageStyle() { $field = 'actions'; if ($this->isExcluded($field)) { return null; } $actions = $this->getSubmitted($field); if ($this->isUpdating() && !isset($actions)) { $this->unsetSubmitted($field); return null; } $label = $this->translation->text('Actions'); if (empty($actions)) { $this->setErrorRequired($field, $label); return false; } if (!is_array($actions)) { $this->setErrorInvalid($field, $label); return false; } $modified = $errors = array(); foreach ($actions as $line => $action) { $line++; $parts = gplcart_string_explode_whitespace($action, 2); $action_id = array_shift($parts); $value = array_filter(explode(',', implode('', $parts))); if (!$this->validateActionImageStyle($action_id, $value)) { $errors[] = $line; continue; } $modified[$action_id] = array('value' => $value, 'weight' => $line); } if (!empty($errors)) { $error = $this->translation->text('Error in @num definition', array('@num' => implode(',', $errors))); $this->setError($field, $error); } if ($this->isError()) { return false; } $this->setSubmitted($field, $modified); return true; }
Validates image actions @return boolean|null
entailment
protected function validateActionImageStyle($action_id, array &$value) { $handler = $this->image_style->getActionHandler($action_id); if (empty($handler)) { return false; } try { $callback = static::get($handler, null, 'validate'); return call_user_func_array($callback, array(&$value)); } catch (Exception $ex) { return false; } }
Calls an appropriate validator method for the given action ID @param string $action_id @param array $value @return boolean
entailment
public function route(array $values, $operator) { if (!in_array($operator, array('=', '!='))) { return $this->translation->text('Unsupported operator'); } $existing = $this->route->getList(); foreach ($values as $pattern) { if (empty($existing[$pattern])) { return $this->translation->text('@name is unavailable', array( '@name' => $this->translation->text('Condition'))); } } return true; }
Validates the route pattern @param array $values @param string $operator @return boolean|string
entailment
public function path(array $values, $operator) { if (!in_array($operator, array('=', '!='))) { return $this->translation->text('Unsupported operator'); } foreach ($values as $pattern) { if (!gplcart_string_is_regexp($pattern)) { return $this->translation->text('@field has invalid value', array( '@field' => $this->translation->text('Condition'))); } } return true; }
Validates the path pattern @param array $values @param string $operator @return boolean|string
entailment
public function getHandlers() { $handlers = &gplcart_static('mail.handlers'); if (isset($handlers)) { return $handlers; } $handlers = (array) gplcart_config_get(GC_FILE_CONFIG_MAIL); $this->hook->attach('mail.handlers', $handlers, $this); return $handlers; }
Returns an array of email handlers @return array
entailment
public function send($to, $subject, $message, $options) { if (!is_array($options)) { $options = array('from' => (string) $options); } settype($to, 'array'); $result = null; $this->hook->attach('mail.send', $to, $subject, $message, $options, $result); if (isset($result)) { return $result; } return $this->mail($to, $subject, $message, $options); }
Sends an e-mail @param string|array $to @param string $subject @param string $message @param array|string $options @return mixed
entailment
public function set($handler_id, array $arguments) { try { $handlers = $this->getHandlers(); $data = Handler::call($handlers, $handler_id, 'data', $arguments); return call_user_func_array(array($this, 'send'), $data); } catch (Exception $ex) { trigger_error($ex->getMessage()); return false; } }
Sends E-mail with predefined parameters using a handler ID @param string $handler_id @param array $arguments @return boolean
entailment
public function mail(array $receivers, $subject, $message, array $options) { $subject = "=?UTF-8?B?" . base64_encode($subject) . "?="; $from = "=?UTF-8?B?" . base64_encode($options['from']) . "?="; $headers = array(); $headers[] = "From: $from <$from>"; $headers[] = "MIME-Version: 1.0"; if (!empty($options['html'])) { $headers[] = "Content-type: text/html; charset=UTF-8"; } $header = implode("\r\n", $headers); $to = array(); foreach ($receivers as $address) { if (is_array($address)) { $to[] = "{$address[0]} <{$address[1]}>"; } else { $to[] = $address; } } return mail(implode(',', $to), $subject, $message, $header); }
Send E-mail using PHP mail() function @param array $receivers @param string $subject @param string $message @param array $options @return boolean
entailment
public static function get($name, $config = NULL) { if(isset($_COOKIE[$name])) { // Decrypt cookie using cookie key if($v = json_decode(Cipher::decrypt(base64_decode($_COOKIE[$name]), Config::config()->key), true)) { return $v; } } return FALSE; }
Decrypt and fetch cookie data @param string $name of cookie @param array $config settings @return mixed
entailment
public static function set($name, $value, $config = array()) { // Use default config settings if needed extract(array_merge(static::$settings, $config)); // If the cookie is being removed we want it left blank $value = $value ? base64_encode(Cipher::encrypt(json_encode($value), Config::config()->key)) : null; // Save cookie to user agent setcookie($name, $value, $expires, $path, $domain, $secure, $httponly); }
Called before any output is sent to create an encrypted cookie with the given value. @param $name @param mixed $value to save @param array $config settings return boolean @internal param string $key cookie name
entailment
protected function copyFiles($skeletonDir, $moduleDir, $files) { foreach ($files as $file) { $srcFile = $skeletonDir . DIRECTORY_SEPARATOR . $file; $dstFile = $moduleDir . DIRECTORY_SEPARATOR . $file; if (!file_exists($srcFile)) { throw new \InvalidArgumentException(sprintf('File does not exist: %s', $srcFile)); } if (file_exists($dstFile)) { throw new \InvalidArgumentException(sprintf('File already exists: %s', $dstFile)); } copy($srcFile, $dstFile); } }
@param string $skeletonDir @param string $moduleDir @param array $files @throws \InvalidArgumentException When a file path being created already exists
entailment
protected function createModuleStructure($moduleDir, $moduleName) { if (is_dir($moduleDir)) { throw new \InvalidArgumentException(sprintf('Unable to create module: %s it already exists at %s%s', $moduleName, $moduleDir, $moduleName)); } @mkdir($moduleDir); // Create base structure foreach ($this->coreDirs as $coreDir) { $tmpDir = $moduleDir . DIRECTORY_SEPARATOR . $coreDir; @mkdir($tmpDir); } }
@param string $moduleDir @param string $moduleName @throws \InvalidArgumentException When a dir path being created already exists
entailment
public function add(array $data) { $result = array(); $this->hook->attach('wishlist.add.product.before', $data, $result, $this); if (!empty($result)) { return (array) $result; } if ($this->wishlist->exists($data)) { return $this->getResultErrorExists($data); } if ($this->wishlist->exceedsLimit($data['user_id'], $data['store_id'])) { return $this->getResultErrorExceeds($data); } $data['wishlist_id'] = $this->wishlist->add($data); if (empty($data['wishlist_id'])) { return $this->getResultError(); } $result = $this->getResultAdded($data); $this->hook->attach('wishlist.add.product.after', $data, $result, $this); return (array) $result; }
Adds a product to a wishlist and returns an array of result data @param array $data @return array
entailment
public function delete(array $data) { $result = array(); $this->hook->attach('wishlist.delete.product.before', $data, $result, $this); if (!empty($result)) { return (array) $result; } if (!$this->wishlist->delete($data)) { return $this->getResultError(); } $result = $this->getResultDelete($data); $this->hook->attach('wishlist.delete.product.after', $data, $result, $this); return (array) $result; }
Delete a product from the wishlist @param array $data @return array
entailment
protected function getResultAdded(array $data) { $options = array( 'user_id' => $data['user_id'], 'store_id' => $data['store_id'] ); $href = $this->url->get('wishlist'); $existing = $this->wishlist->getList($options); return array( 'redirect' => '', 'severity' => 'success', 'quantity' => count($existing), 'wishlist_id' => $data['wishlist_id'], 'message' => $this->translation->text('Product has been added to your <a href="@url">wishlist</a>', array( '@url' => $href))); }
Returns an array of resulting data when a product has been added to the wishlist @param array $data @return array
entailment
protected function getResultErrorExceeds(array $data) { $vars = array('%num' => $this->wishlist->getLimit($data['user_id'])); return array( 'redirect' => '', 'severity' => 'warning', 'message' => $this->translation->text("You're exceeding limit of %num items", $vars) ); }
Returns an array of resulting data when a user exceeds the max allowed number of products in the wishlist @param array $data @return array
entailment
protected function getResultErrorExists(array $data) { $vars = array('@url' => $this->url->get('wishlist')); return array( 'redirect' => '', 'severity' => 'warning', 'wishlist_id' => $data['wishlist_id'], 'message' => $this->translation->text('Product already in your <a href="@url">wishlist</a>', $vars) ); }
Returns an array of resulting data when a product already exists in the wishlist @param array $data @return array
entailment
protected function getResultDelete(array $data) { unset($data['product_id']); $existing = $this->wishlist->getList($data); return array( 'message' => '', 'severity' => 'success', 'quantity' => count($existing), 'redirect' => empty($existing) ? 'wishlist' : '' ); }
Returns an array of resulting data when a product has been deleted from a wishlist @param array $data @return array
entailment
public function listReportEvent() { $this->clearReportEvent(); $this->actionListReportEvent(); $this->setTitleListReportEvent(); $this->setBreadcrumbListReportEvent(); $this->setFilterListReportEvent(); $this->setPagerListReportEvent(); $this->setData('types', $this->report->getTypes()); $this->setData('severities', $this->report->getSeverities()); $this->setData('records', $this->getListReportEvent()); $this->outputListReportEvent(); }
Displays the event overview page
entailment
protected function actionListReportEvent() { list($selected, $action) = $this->getPostedAction(); if ($action === 'delete' && $this->access('report_events')) { if ($this->report->delete(array('log_id' => $selected))) { $message = $this->text('Deleted %num item(s)', array('%num' => count($selected))); $this->setMessage($message, 'success'); } } }
Applies an action to the selected aliases
entailment
protected function setPagerListReportEvent() { $conditions = $this->query_filter; $conditions['count'] = true; $pager = array( 'query' => $this->query_filter, 'total' => (int) $this->report->getList($conditions) ); return $this->data_limit = $this->setPager($pager); }
Sets pager @return array
entailment
protected function clearReportEvent() { $key = 'clear'; $this->controlToken($key); if ($this->isQuery($key)) { $this->report->delete(); $this->redirect('admin/report/events'); } }
Deletes all system events from the database
entailment
protected function getListReportEvent() { $conditions = $this->query_filter; $conditions['limit'] = $this->data_limit; $list = (array) $this->report->getList($conditions); $this->prepareListReportEvent($list); return $list; }
Returns an array of system events @return array
entailment
protected function prepareListReportEvent(array &$list) { foreach ($list as &$item) { $variables = array(); if (!empty($item['data']['variables'])) { $variables = $item['data']['variables']; } $item['created'] = $this->date($item['created']); $type = "event_{$item['type']}"; $item['type'] = $this->text($type); if (!empty($item['translatable'])) { $item['text'] = $this->text($item['text'], $variables); } $item['summary'] = $this->truncate($item['text']); $item['severity_text'] = $this->text($item['severity']); } }
Prepare an array of system events @param array $list
entailment
public function getList(array $options) { $result = null; $this->hook->attach('translation.entity.list.before', $options, $result, $this); if (isset($result)) { return (array) $result; } $table = $this->getTable($options['entity']); $sql = "SELECT * FROM `$table` WHERE {$options['entity']}_id = ?"; $conditions = array($options['entity_id']); if (isset($options['language'])) { $sql .= ' AND language = ?'; $conditions[] = $options['language']; } $result = $this->db->fetchAll($sql, $conditions); $this->hook->attach('translation.entity.list.after', $options, $result, $this); return (array) $result; }
Returns an array of translations @param array $options @return array
entailment
public function delete(array $conditions) { $result = null; $this->hook->attach('translation.entity.delete.before', $conditions, $result, $this); if (isset($result)) { return (bool) $result; } $table = $this->getTable($conditions['entity']); unset($conditions['entity']); $result = (bool) $this->db->delete($table, $conditions); $this->hook->attach('translation.entity.delete.after', $conditions, $result, $this); return (bool) $result; }
Deletes translation(s) @param array $conditions @return bool
entailment
public function getTable($entity) { $tables = $this->getTables(); if (empty($tables[$entity])) { throw new OutOfBoundsException("Entity $entity is not supported for translations"); } return $tables[$entity]; }
Returns a database table name for the entity @param string $entity @return string @throws OutOfBoundsException
entailment
public function validate(array $object, Schema $schema, array $schemaExtensions = []) { $validationResult = new ValidationResult(); /** @var Schema[] $otherSchemas */ $otherSchemas = []; foreach ($schemaExtensions as $schemaExtension) { $otherSchemas[$schemaExtension->getId()] = $schemaExtension; } $this->validateByAttributes($object, $schema->getId(), $schema->getAttributes(), $otherSchemas, $validationResult, null); foreach ($otherSchemas as $schemaId => $otherSchema) { if (isset($object[$schemaId])) { $this->validateByAttributes($object[$schemaId], $otherSchema->getId(), $otherSchema->getAttributes(), [], $validationResult, null); } } return $validationResult; }
@param array $object @param Schema $schema @param Schema[] $schemaExtensions @return ValidationResult
entailment
public function categoryGroup(array &$submitted, array $options = array()) { $this->options = $options; $this->submitted = &$submitted; $this->validateCategoryGroup(); $this->validateTitle(); $this->validateTranslation(); $this->validateStoreId(); $this->validateTypeCategoryGroup(); $this->unsetSubmitted('update'); return $this->getResult(); }
Performs full category group data validation @param array $submitted @param array $options @return boolean|array
entailment
protected function validateCategoryGroup() { $id = $this->getUpdatingId(); if ($id === false) { return null; } $data = $this->category_group->get($id); if (empty($data)) { $this->setErrorUnavailable('update', $this->translation->text('Category group')); return false; } $this->setUpdating($data); return true; }
Validates a category group to be updated @return boolean|null
entailment
protected function validateTypeCategoryGroup() { $field = 'type'; if ($this->isExcluded($field) || $this->isError('store_id')) { return null; } $type = $this->getSubmitted($field); if ($this->isUpdating() && !isset($type)) { return null; } $store_id = $this->getSubmitted('store_id'); if (!isset($store_id)) { $this->setErrorRequired($field, $this->translation->text('Store')); return false; } $label = $this->translation->text('Type'); if (empty($type)) { $this->setErrorRequired($field, $label); return false; } $types = $this->category_group->getTypes(); if (!isset($types[$type])) { $this->setErrorUnavailable($field, $label); return false; } $updating = $this->getUpdating(); $list = $this->category_group->getList(array('type' => $type, 'store_id' => $store_id)); if (isset($updating['category_group_id'])) { unset($list[$updating['category_group_id']]); } if (empty($list)) { return true; } $error = $this->translation->text('Category group of this type already exists for this store'); $this->setError('type', $error); return false; }
Validates category group type @return boolean|null
entailment
public function thumbnail(&$source, $target, array $action) { list($width, $height) = $action['value']; if ($this->image->set($source)->thumbnail($width, $height)->save($target)) { $source = $target; return true; } return false; }
Make thumbnail @param string $source @param string $target @param array $action @return bool
entailment
public function crop(&$source, $target, array $action) { list($x1, $y1, $x2, $y2) = $action['value']; if ($this->image->set($source)->crop($x1, $y1, $x2, $y2)->save($target)) { $source = $target; return true; } return false; }
Crop @param string $source @param string $target @param array $action @return bool
entailment
public function fitWidth(&$source, $target, array $action) { $width = reset($action['value']); if ($this->image->set($source)->fitToWidth($width)->save($target)) { $source = $target; return true; } return false; }
Fit to width @param string $source @param string $target @param array $action @return bool
entailment
public function fitHeight(&$source, $target, array $action) { $height = reset($action['value']); if ($this->image->set($source)->fitToHeight($height)->save($target)) { $source = $target; return true; } return false; }
Fit to height @param string $source @param string $target @param array $action @return bool
entailment
protected function helper($helperName) { if (!isset($this->helpers[$helperName])) { throw new \InvalidArgumentException('Unable to locate controller helper: ' . $helperName); } return $this->helpers[$helperName]; }
Obtain a controller helper by its key name. @param string $helperName @throws \InvalidArgumentException @return mixed
entailment
protected function server($key = null, $default = null, $deep = false) { return $key === null ? $this->getServer()->all() : $this->getServer()->get($key, $default, $deep); }
Returns a server parameter by name. @param string $key The key @param mixed $default The default value if the parameter key does not exist @param bool $deep If true, a path like foo[bar] will find deeper items @return string
entailment
protected function post($key = null, $default = null, $deep = false) { return $key === null ? $this->getPost()->all() : $this->getPost()->get($key, $default, $deep); }
Returns a post parameter by name. @param string $key The key @param mixed $default The default value if the parameter key does not exist @param bool $deep If true, a path like foo[bar] will find deeper items @return string
entailment
protected function files($key = null, $default = null, $deep = false) { return $key === null ? $this->getFiles()->all() : $this->getFiles()->get($key, $default, $deep); }
Returns a files parameter by name. @param string $key The key @param mixed $default The default value if the parameter key does not exist @param bool $deep If true, a path like foo[bar] will find deeper items @return string
entailment
protected function queryString($key = null, $default = null, $deep = false) { return $key === null ? $this->getQueryString()->all() : $this->getQueryString()->get($key, $default, $deep); }
Returns a query string parameter by name. @param string $key The key @param mixed $default The default value if the parameter key does not exist @param bool $deep If true, a path like foo[bar] will find deeper items @return string
entailment
protected function cookie($key = null, $default = null, $deep = false) { return $key === null ? $this->getCookie()->all() : $this->getCookie()->get($key, $default, $deep); }
Returns a server parameter by name. @param string $key The key @param mixed $default The default value if the parameter key does not exist @param bool $deep If true, a path like foo[bar] will find deeper items @return string
entailment
protected function session($key = null, $default = null) { return $key === null ? $this->getSession()->all() : $this->getSession()->get($key, $default); }
Get/Set a session value. @param string $key @param null|mixed $default If this is not null, it enters setter mode @return mixed
entailment
protected function is($key) { switch ($key = strtolower($key)) { case 'ajax': if (!isset($this->isCache['ajax'])) { return $this->isCache['ajax'] = $this->getService('Request')->isXmlHttpRequest(); } return $this->isCache['ajax']; case 'put': case 'delete': case 'post': case 'patch': if (!isset($this->isCache['requestMethod'][$key])) { $this->isCache['requestMethod'][$key] = $this->getService('Request')->getMethod() === strtoupper($key); } return $this->isCache['requestMethod'][$key]; case 'ssl': case 'https': case 'secure': if (!isset($this->isCache['secure'])) { $this->isCache['secure'] = $this->getService('Request')->isSecure(); } return $this->isCache['secure']; default: throw new \InvalidArgumentException("Invalid 'is' key supplied: {$key}"); } }
Check if a condition 'is' true. @param string $key @throws InvalidArgumentException @return bool
entailment
protected function render($template, array $params = array(), array $options = array()) { $renderer = $this->serviceLocator->get('templating'); // Helpers if (isset($options['helpers'])) { foreach ($options['helpers'] as $helper) { $renderer->addHelper($helper); } } return $renderer->render($template, $params); }
Render a template. @param string $template The template to render @param array $params The params to pass to the renderer @param array $options Extra options @return string
entailment
protected function redirect($url, $statusCode = 302) { $response = new RedirectResponse($url, $statusCode); $this->getServiceLocator()->set('Response', $response); return $response; }
Create a RedirectResponse object with your $url and $statusCode. @param string $url @param int $statusCode @return RedirectResponse
entailment
protected function redirectToRoute($route, $parameters = array(), $absolute = false) { return $this->redirect($this->getService('Router')->generate($route, $parameters, $absolute)); }
Shortcut function for redirecting to a route without manually calling $this->generateUrl() You just specify a route name and it goes there. @param $route @param array $parameters @param bool|false $absolute @return RedirectResponse
entailment
protected function generateUrl($route, $parameters = array(), $absolute = false) { return $this->getService('Router')->generate($route, $parameters, $absolute); }
Generate a URL from the specified route name. @param string $route @param array $parameters @param bool $absolute @return string
entailment
public function shippingMethod(array $condition, array $data) { if (!isset($data['order']['shipping'])) { return false; } return $this->compare($data['order']['shipping'], $condition['value'], $condition['operator']); }
Whether the shipping service condition is met @param array $condition @param array $data @return boolean
entailment
public function paymentMethod(array $condition, array $data) { if (!isset($data['order']['payment'])) { return false; } return $this->compare($data['order']['payment'], $condition['value'], $condition['operator']); }
Whether the payment service condition is met @param array $condition @param array $data @return boolean
entailment
public function findAttribute($name) { foreach ($this->attributes as $attribute) { if ($attribute->getName() === $name) { return $attribute; } } return null; }
@param string $name @return null|Schema\Attribute
entailment
public static function deserializeObject(array $data) { /** @var Schema $result */ $result = self::deserializeCommonAttributes($data); $result->name = $data['name']; $result->description = $data['description']; $result->attributes = []; foreach ($data['attributes'] as $attribute) { $result->attributes[] = Schema\Attribute::deserializeObject($attribute); } return $result; }
@param array $data @return Schema
entailment
protected function setProductClassProductClassField($product_class_id) { $this->data_product_class = array(); if (is_numeric($product_class_id)) { $this->data_product_class = $this->product_class->get($product_class_id); if (empty($this->data_product_class)) { $this->outputHttpStatus(404); } } }
Sets the product class data @param integer $product_class_id
entailment
public function listProductClassField($product_class_id) { $this->setProductClassProductClassField($product_class_id); $this->setTitleListProductClassField(); $this->setBreadcrumbListProductClassField(); $this->setFilterListProductClassField(); $this->setData('field_types', $this->field->getTypes()); $this->setData('fields', $this->getListProductClassField()); $this->setData('product_class', $this->data_product_class); $this->submitListProductClassField(); $this->outputListProductClassField(); }
Route callback for the product class field overview page @param integer $product_class_id
entailment
protected function getListProductClassField(array $conditions = array()) { $conditions += $this->query_filter; $conditions['product_class_id'] = $this->data_product_class['product_class_id']; return (array) $this->product_class_field->getList($conditions); }
Returns an array of fields for the given product class @param array $conditions @return array
entailment
protected function getUniqueListProductClassField() { $types = $this->field->getTypes(); $fields = $this->getListProductClassField(array('index' => 'field_id')); $unique = array(); foreach ((array) $this->field->getList() as $field) { if (empty($fields[$field['field_id']])) { $type = empty($types[$field['type']]) ? $this->text('Unknown') : $types[$field['type']]; $unique[$field['field_id']] = "{$field['title']} ($type)"; } } return $unique; }
Returns an array of product class fields indexed by field ID which are unique for the product class @return array
entailment
protected function updateListProductClassField() { $this->controlAccess('product_class_edit'); foreach ((array) $this->setSubmitted('fields') as $id => $field) { if (!empty($field['remove'])) { $this->product_class_field->delete($id); continue; } $field['required'] = !empty($field['required']); $field['multiple'] = !empty($field['multiple']); $this->product_class_field->update($id, $field); } $this->redirect('', $this->text('Product class has been updated'), 'success'); }
Updates product class fields
entailment
protected function setBreadcrumbListProductClassField() { $breadcrumbs = array(); $breadcrumbs[] = array( 'url' => $this->url('admin'), 'text' => $this->text('Dashboard') ); $breadcrumbs[] = array( 'text' => $this->text('Product classes'), 'url' => $this->url('admin/content/product-class') ); $this->setBreadcrumbs($breadcrumbs); }
Sets breadcrumbs on the product class field overview page
entailment
public function editProductClassField($product_class_id) { $this->setProductClassProductClassField($product_class_id); $this->setTitleEditProductClassField(); $this->setBreadcrumbEditProductClassField(); $this->setData('product_class', $this->data_product_class); $this->setData('fields', $this->getUniqueListProductClassField()); $this->submitEditProductClassField(); $this->outputEditProductClassField(); }
Route callback Displays the edit product class field page @param integer $product_class_id
entailment
protected function validateEditProductClassField() { $this->setSubmitted('product_class'); $this->setSubmitted('product_class_id', $this->data_product_class['product_class_id']); $this->validateComponent('product_class_field'); return !$this->hasErrors(false); }
Validates an array of submitted product class fields @return bool
entailment
protected function addProductClassField() { $this->controlAccess('product_class_edit'); foreach ((array) $this->getSubmitted('field_id', array()) as $field_id) { $field = array( 'field_id' => $field_id, 'product_class_id' => $this->data_product_class['product_class_id'] ); $this->product_class_field->add($field); } $url = "admin/content/product-class/field/{$this->data_product_class['product_class_id']}"; $this->redirect($url, $this->text('Product class has been updated'), 'success'); }
Adds product class fields
entailment
protected function setBreadcrumbEditProductClassField() { $breadcrumbs = array(); $breadcrumbs[] = array( 'url' => $this->url('admin'), 'text' => $this->text('Dashboard') ); $breadcrumbs[] = array( 'text' => $this->text('Product classes'), 'url' => $this->url('admin/content/product-class') ); $breadcrumbs[] = array( 'text' => $this->text('Fields of %name', array('%name' => $this->data_product_class['title'])), 'url' => $this->url("admin/content/product-class/field/{$this->data_product_class['product_class_id']}") ); $this->setBreadcrumbs($breadcrumbs); }
Sets breadcrumbs on the edit product class field page
entailment
public function listCollection() { $this->actionListCollection(); $this->setTitleListCollection(); $this->setBreadcrumbListCollection(); $this->setFilterListCollection(); $this->setPagerListCollection(); $this->setData('collections', $this->getListCollection()); $this->setData('handlers', $this->collection->getHandlers()); $this->outputListCollection(); }
Displays the collection overview page
entailment
protected function setPagerListCollection() { $options = $this->query_filter; $options['count'] = true; $pager = array( 'query' => $this->query_filter, 'total' => (int) $this->collection->getList($options) ); return $this->data_limit = $this->setPager($pager); }
Set pager @return array
entailment
protected function getListCollection() { $conditions = $this->query_filter; $conditions['limit'] = $this->data_limit; return (array) $this->collection->getList($conditions); }
Returns an array of collections @return array
entailment
public function editCollection($collection_id = null) { $this->setCollection($collection_id); $this->setTitleEditCollection(); $this->setBreadcrumbEditCollection(); $this->setData('types', $this->collection->getTypes()); $this->setData('collection', $this->data_collection); $this->setData('can_delete', $this->canDeleteCollection()); $this->setData('languages', $this->language->getList(array('enabled' => true))); $this->submitEditCollection(); $this->outputEditCollection(); }
Displays the edit collection page @param null|integer $collection_id
entailment
protected function submitEditCollection() { if ($this->isPosted('delete')) { $this->deleteCollection(); } else if ($this->isPosted('save') && $this->validateEditCollection()) { if (isset($this->data_collection['collection_id'])) { $this->updateCollection(); } else { $this->addCollection(); } } }
Saves an array of submitted collection data
entailment
protected function validateEditCollection() { $this->setSubmitted('collection'); $this->setSubmittedBool('status'); $this->setSubmitted('update', $this->data_collection); $this->validateComponent('collection'); return !$this->hasErrors(); }
Validates a submitted collection @return bool
entailment
protected function canDeleteCollection() { return isset($this->data_collection['collection_id']) && $this->access('collection_delete') && $this->collection->canDelete($this->data_collection['collection_id']); }
Whether the current collection can be deleted @return bool
entailment
protected function setCollection($collection_id) { $this->data_collection = array(); if (is_numeric($collection_id)) { $conditions = array( 'language' => 'und', 'collection_id' => $collection_id ); $this->data_collection = $this->collection->get($conditions); if (empty($this->data_collection)) { $this->outputHttpStatus(404); } $this->prepareCollection($this->data_collection); } }
Sets a collection data @param integer $collection_id
entailment
protected function deleteCollection() { $this->controlAccess('collection_delete'); if ($this->collection->delete($this->data_collection['collection_id'])) { $this->redirect('admin/content/collection', $this->text('Collection has been deleted'), 'success'); } $this->redirect('', $this->text('Collection has not been deleted'), 'warning'); }
Deletes a collection
entailment
protected function updateCollection() { $this->controlAccess('collection_edit'); if ($this->collection->update($this->data_collection['collection_id'], $this->getSubmitted())) { $this->redirect('admin/content/collection', $this->text('Collection has been updated'), 'success'); } $this->redirect('', $this->text('Collection has not been updated'), 'danger'); }
Updates a collection
entailment
protected function addCollection() { $this->controlAccess('collection_add'); if ($this->collection->add($this->getSubmitted())) { $this->redirect('admin/content/collection', $this->text('Collection has been added'), 'success'); } $this->redirect('', $this->text('Collection has not been added'), 'danger'); }
Adds a new collection
entailment
protected function setTitleEditCollection() { if (isset($this->data_collection['title'])) { $title = $this->text('Edit %name', array('%name' => $this->data_collection['title'])); } else { $title = $this->text('Add collection'); } $this->setTitle($title); }
Sets title on the edit collection page
entailment
protected function setBreadcrumbEditCollection() { $breadcrumbs = array(); $breadcrumbs[] = array( 'url' => $this->url('admin'), 'text' => $this->text('Dashboard') ); $breadcrumbs[] = array( 'text' => $this->text('Collections'), 'url' => $this->url('admin/content/collection'), ); $this->setBreadcrumbs($breadcrumbs); }
Sets breadcrumbs on the edit collection page
entailment
public function startTLS() { if (!$this->sendCommand('STARTTLS', 'STARTTLS', 220)) { return false; } // Begin encrypted connection if (!stream_socket_enable_crypto( $this->smtp_conn, true, STREAM_CRYPTO_METHOD_TLS_CLIENT )) { return false; } return true; }
Initiate a TLS (encrypted) session. @access public @return boolean
entailment
public function authenticate( $username, $password, $authtype = null, $realm = '', $workstation = '' ) { if (!$this->server_caps) { $this->error = array('error' => 'Authentication is not allowed before HELO/EHLO'); return false; } if (array_key_exists('EHLO', $this->server_caps)) { // SMTP extensions are available. Let's try to find a proper authentication method if (!array_key_exists('AUTH', $this->server_caps)) { $this->error = array( 'error' => 'Authentication is not allowed at this stage' ); // 'at this stage' means that auth may be allowed after the stage changes // e.g. after STARTTLS return false; } self::edebug('Auth method requested: ' . ($authtype ? $authtype : 'UNKNOWN'), self::DEBUG_LOWLEVEL); self::edebug( 'Auth methods available on the server: ' . implode(',', $this->server_caps['AUTH']), self::DEBUG_LOWLEVEL ); if (empty($authtype)) { foreach (array('LOGIN', 'CRAM-MD5', 'NTLM', 'PLAIN') as $method) { if (in_array($method, $this->server_caps['AUTH'])) { $authtype = $method; break; } } if (empty($authtype)) { $this->error = array( 'error' => 'No supported authentication methods found' ); return false; } self::edebug('Auth method selected: '.$authtype, self::DEBUG_LOWLEVEL); } if (!in_array($authtype, $this->server_caps['AUTH'])) { $this->error = array( 'error' => 'The requested authentication method "' . $authtype . '" is not supported by the server' ); return false; } } elseif (empty($authtype)) { $authtype = 'LOGIN'; } switch ($authtype) { case 'PLAIN': // Start authentication if (!$this->sendCommand('AUTH', 'AUTH PLAIN', 334)) { return false; } // Send encoded username and password if (!$this->sendCommand( 'User & Password', base64_encode("\0" . $username . "\0" . $password), 235 ) ) { return false; } break; case 'LOGIN': // Start authentication if (!$this->sendCommand('AUTH', 'AUTH LOGIN', 334)) { return false; } if (!$this->sendCommand("Username", base64_encode($username), 334)) { return false; } if (!$this->sendCommand("Password", base64_encode($password), 235)) { return false; } break; case 'NTLM': /* * ntlm_sasl_client.php * Bundled with Permission * * How to telnet in windows: * http://technet.microsoft.com/en-us/library/aa995718%28EXCHG.65%29.aspx * PROTOCOL Docs http://curl.haxx.se/rfc/ntlm.html#ntlmSmtpAuthentication */ require_once 'extras/ntlm_sasl_client.php'; $temp = new stdClass(); $ntlm_client = new ntlm_sasl_client_class; //Check that functions are available if (!$ntlm_client->Initialize($temp)) { $this->error = array('error' => $temp->error); $this->edebug( 'You need to enable some modules in your php.ini file: ' . $this->error['error'], self::DEBUG_CLIENT ); return false; } //msg1 $msg1 = $ntlm_client->TypeMsg1($realm, $workstation); //msg1 if (!$this->sendCommand( 'AUTH NTLM', 'AUTH NTLM ' . base64_encode($msg1), 334 ) ) { return false; } //Though 0 based, there is a white space after the 3 digit number //msg2 $challenge = substr($this->last_reply, 3); $challenge = base64_decode($challenge); $ntlm_res = $ntlm_client->NTLMResponse( substr($challenge, 24, 8), $password ); //msg3 $msg3 = $ntlm_client->TypeMsg3( $ntlm_res, $username, $realm, $workstation ); // send encoded username return $this->sendCommand('Username', base64_encode($msg3), 235); case 'CRAM-MD5': // Start authentication if (!$this->sendCommand('AUTH CRAM-MD5', 'AUTH CRAM-MD5', 334)) { return false; } // Get the challenge $challenge = base64_decode(substr($this->last_reply, 4)); // Build the response $response = $username . ' ' . $this->hmac($challenge, $password); // send encoded credentials return $this->sendCommand('Username', base64_encode($response), 235); default: $this->error = array( 'error' => 'Authentication method "' . $authtype . '" is not supported' ); return false; } return true; }
Perform SMTP authentication. Must be run after hello(). @see hello() @param string $username The user name @param string $password The password @param string $authtype The auth type (PLAIN, LOGIN, NTLM, CRAM-MD5) @param string $realm The auth realm for NTLM @param string $workstation The auth workstation for NTLM @access public @return boolean True if successfully authenticated.
entailment
protected function parseHelloFields($type) { $this->server_caps = array(); $lines = explode("\n", $this->last_reply); foreach ($lines as $n => $s) { $s = trim(substr($s, 4)); if (!$s) { continue; } $fields = explode(' ', $s); if ($fields) { if (!$n) { $name = $type; $fields = $fields[0]; } else { $name = array_shift($fields); if ($name == 'SIZE') { $fields = ($fields) ? $fields[0] : 0; } } $this->server_caps[$name] = ($fields ? $fields : true); } } }
Parse a reply to HELO/EHLO command to discover server extensions. In case of HELO, the only parameter that can be discovered is a server name. @access protected @param string $type - 'HELO' or 'EHLO'
entailment
public function client_send($data) { $this->edebug("CLIENT -> SERVER: $data", self::DEBUG_CLIENT); return fwrite($this->smtp_conn, $data); }
Send raw data to the server. @param string $data The data to send @access public @return integer|boolean The number of bytes sent to the server or false on error
entailment
public function getServerExt($name) { if (!$this->server_caps) { $this->error = array('No HELO/EHLO was sent'); return null; } // the tight logic knot ;) if (!array_key_exists($name, $this->server_caps)) { if ($name == 'HELO') { return $this->server_caps['EHLO']; } if ($name == 'EHLO' || array_key_exists('EHLO', $this->server_caps)) { return false; } $this->error = array('HELO handshake was used. Client knows nothing about server extensions'); return null; } return $this->server_caps[$name]; }
A multipurpose method The method works in three ways, dependent on argument value and current state 1. HELO/EHLO was not sent - returns null and set up $this->error 2. HELO was sent $name = 'HELO': returns server name $name = 'EHLO': returns boolean false $name = any string: returns null and set up $this->error 3. EHLO was sent $name = 'HELO'|'EHLO': returns server name $name = any string: if extension $name exists, returns boolean True or its options. Otherwise returns boolean False In other words, one can use this method to detect 3 conditions: - null returned: handshake was not or we don't know about ext (refer to $this->error) - false returned: the requested feature exactly not exists - positive value returned: the requested feature exists @param string $name Name of SMTP extension or 'HELO'|'EHLO' @return mixed
entailment
public function route() { $path = Url::pathInfo(); $pathInfo = explode('/', $path); if($pathInfo['0'] == '') // 访问的是根目录 return array(ucfirst(Config::$application) . '\\' . Config::$controller['0'] . '\\Index', 'index', array()); else{ // 需要路由分发处理 if($this->route->routes) { // 有配置路由规则 if(isset($this->route->routes[$pathInfo['0']]) && is_string($this->route->routes[$pathInfo['0']])){ // 普通的子模块目录重写 $class = isset($pathInfo['1']) ? preg_replace("/[^0-9a-z_]/i", '', $pathInfo['1']) : 'index'; $method = isset($pathInfo['2']) ? preg_replace("/[^0-9a-z_]/i", '', $pathInfo['2']) : 'index'; $controller = ucfirst(Config::$application) . '\\' . Config::$controller['0'] . '\\' . ucwords($this->route->routes[$pathInfo['0']]) . '\\' . ucwords($class); $pathInfo && array_shift($pathInfo); $pathInfo && array_shift($pathInfo); $pathInfo && array_shift($pathInfo); $this->_routeRewrite = true; }else{ // 更高级的路由分发,一种直接在回调函数中处理,一种修改引用变量controller, method, pathInfo的值 foreach ($this->route->routes as $k => $v) { if(is_callable($v)){ $pattern = preg_replace(array('@\{(\w+)\}@', '@/\{(\w+)\?\}@'), array('(?<\1>[^/]+)', '/?(?<\1>[^/]?)'), $k); preg_match('@^' . $pattern . '$@', $path, $val); if(!$val) continue; $tok = array_filter(array_keys($val), 'is_string'); $val = array_map('urldecode', array_intersect_key( $val, array_flip($tok) )); // 正则匹配参数内容 foreach($val as $name => $value){ if(isset($this->route->pattern[$name])) if(!preg_match('/^' . $this->route->pattern[$name] . '$/', $value)) continue 2; } $controller = $method = null; $pathInfo = array(); $call = array_merge( $val, // 前面的url参数替换 array(&$controller, &$method, &$pathInfo) // 后3个参数为cmp ); call_user_func_array($v, $call); is_string($controller) && $controller = ucfirst(Config::$application) . '\\' . Config::$controller['0'] . '\\' . $controller; $this->_routeRewrite = true; break; // 只匹配第一个规则 } } } } if(!$this->_routeRewrite){ // 普通路由分发 $controller = ucfirst(Config::$application) . '\\' . Config::$controller['0'] . '\\' . ucwords(preg_replace("/[^0-9a-z_]/i", '', $pathInfo['0'])); $method = isset($pathInfo['1']) ? preg_replace("/[^0-9a-z_]/i", '', $pathInfo['1']) : 'index'; $pathInfo && array_shift($pathInfo); $pathInfo && array_shift($pathInfo); } return array($controller, $method, $pathInfo); } }
路由分发处理 @return array controller, method, params todo: 路由中参数的类型支持 route配置举例: 'admin' => 'admin', // 方式1,子模块模式 'admin/test/xx/{id1}/{id2}' => function($id1, $id2, &$controller, &$method){ // 方式2,指定c,m,p $controller = 'Index'; $method = 'index'; }, 'page/{id}' => function($id){ // 方式3,直接处理数据 var_dump($id); }, 'category/{id}/{slug}/{page?}' => function($id, $slug, $page, &$controller, &$method, &$pathInfo){ // 例2:category分类重写(最后一个参数可不传递, 用'?') $controller = 'Index'; $method = 'category'; $pathInfo = array($id, $slug, $page ? $page : 1); },
entailment
protected function setAdminModeCheckout($mode) { $this->admin = null; if ($this->access('order_add')) { if ($mode === 'add') { $this->admin = 'add'; } if ($mode === 'clone' && $this->access('order_edit')) { $this->admin = 'clone'; } } }
Sets the current admin mode @param string
entailment
protected function setUserCheckout($user_id) { $this->data_user = array(); if (!is_numeric($user_id)) { $this->outputHttpStatus(403); } $this->data_user = $this->user->get($user_id); if (empty($this->data_user['status'])) { $this->outputHttpStatus(404); } $this->order_user_id = $user_id; $this->order_store_id = $this->data_user['store_id']; }
Loads a user from the database @param integer $user_id
entailment
public function editCheckout() { $this->setCartContentCheckout(); $this->setTitleEditCheckout(); $this->setBreadcrumbEditCheckout(); $this->controlAccessCheckout(); $this->setFormDataBeforeCheckout(); $this->submitEditCheckout(); $this->setFormDataAfterCheckout(); $this->setDataFormCheckout(); $this->outputEditCheckout(); }
Page callback Displays the checkout page
entailment
protected function setOrderCheckout($order_id) { $this->data_order = $this->order->get($order_id); if (empty($this->data_order)) { $this->outputHttpStatus(404); } $this->prepareOrder($this->data_order); $this->order_id = $order_id; $this->order_user_id = $this->data_order['user_id']; $this->order_store_id = $this->data_order['store_id']; $this->data_user = $this->user->get($this->data_order['user_id']); }
Load and set an order from the database @param integer $order_id
entailment
protected function prepareOrder(array &$order) { $this->setItemTotalFormatted($order, $this->price); $this->setItemTotalFormattedNumber($order, $this->price); }
Prepare an array of order data @param array $order
entailment
protected function setCartContentCheckout() { $options = array( 'user_id' => $this->cart_uid, 'order_id' => $this->order_id, 'store_id' => $this->order_store_id ); return $this->data_cart = $this->getCart($options); }
Load and set the current cart content @return array
entailment
protected function setTitleEditCheckout() { if ($this->admin === 'clone') { $text = $this->text('Cloning order #@num', array('@num' => $this->data_order['order_id'])); } else if ($this->admin === 'add') { $text = $this->text('Add order for user %name', array('%name' => $this->data_user['name'])); } else { $text = $this->text('Checkout'); } $this->setTitle($text); }
Sets title on the checkout page
entailment
protected function controlAccessCheckout() { if (empty($this->data_cart['items'])) { $form = $this->render('checkout/form', array('admin' => $this->admin), true); $this->setData('checkout_form', $form); $this->output('checkout/checkout'); } }
Controls access to the checkout page
entailment
protected function setFormDataBeforeCheckout() { $this->data_form = array(); $default_order = $this->getDefaultOrder(); $order = gplcart_array_merge($default_order, $this->data_order); $payment_methods = $this->getPaymentMethodsCheckout(); $shipping_methods = $this->getShippingMethodsCheckout(); if (count($payment_methods) == 1) { reset($payment_methods); $order['payment'] = key($payment_methods); } if (count($shipping_methods)) { reset($shipping_methods); $order['shipping'] = key($shipping_methods); } $this->data_form['order'] = $order; $this->data_form['messages'] = array(); $this->data_form['admin'] = $this->admin; $this->data_form['user'] = $this->data_user; $this->data_form['statuses'] = $this->order->getStatuses(); $this->data_form['payment_methods'] = $payment_methods; $this->data_form['shipping_methods'] = $shipping_methods; $this->data_form['has_dynamic_payment_methods'] = $this->hasDynamicMethods($payment_methods); $this->data_form['has_dynamic_shipping_methods'] = $this->hasDynamicMethods($shipping_methods); // Price rule calculator requires this data $this->data_form['store_id'] = $this->order_store_id; $this->data_form['currency'] = $this->data_cart['currency']; $this->setFormDataDimensionsCheckout(); }
Sets initial form data
entailment
protected function getDefaultOrder() { return array( 'comment' => '', 'payment' => '', 'shipping' => '', 'user_id' => $this->order_user_id, 'creator' => $this->admin_user_id, 'store_id' => $this->order_store_id, 'currency' => $this->data_cart['currency'], 'status' => $this->order->getStatusInitial(), 'size_unit' => $this->config('order_size_unit', 'mm'), 'weight_unit' => $this->config('order_weight_unit', 'g'), 'data' => array() ); }
Returns an array of default order data @return array
entailment
protected function getPaymentMethodsCheckout() { $list = $this->payment->getList(array('status' => true)); $this->prepareMethodsCheckout($list); return $list; }
Returns an array of enabled payment methods @return array
entailment
protected function getShippingMethodsCheckout() { $list = $this->shipping->getList(array('status' => true)); $this->prepareMethodsCheckout($list); return $list; }
Returns an array of enabled shipping methods @return array
entailment
protected function prepareMethodsCheckout(array &$list) { foreach ($list as &$item) { if (isset($item['module']) && isset($item['image'])) { $path = GC_DIR_MODULE . "/{$item['module']}/{$item['image']}"; $item['image'] = $this->url(gplcart_path_relative($path)); } } }
Prepare payment and shipping methods @param array $list
entailment
protected function setFormDataAfterCheckout() { if (empty($this->data_cart)) { return null; } $this->data_form['cart'] = $this->data_cart; $this->setFormDataAddressCheckout(); if (empty($this->data_form['addresses'])) { $this->show_shipping_address_form = true; } $this->data_form['default_payment_method'] = false; $this->data_form['default_shipping_method'] = false; $this->data_form['same_payment_address'] = $this->same_payment_address; $this->data_form['get_payment_methods'] = $this->isPosted('get_payment_methods'); $this->data_form['get_shipping_methods'] = $this->isPosted('get_shipping_methods'); $this->data_form['show_login_form'] = $this->show_login_form; $this->data_form['show_payment_address_form'] = $this->show_payment_address_form; $this->data_form['show_shipping_address_form'] = $this->show_shipping_address_form; $this->data_form['show_payment_methods'] = !$this->data_form['has_dynamic_payment_methods']; $this->data_form['show_shipping_methods'] = !$this->data_form['has_dynamic_shipping_methods']; $submitted = array('order' => $this->getSubmitted()); $this->data_form['context_templates'] = array( 'payment' => $this->getPaymentMethodTemplate('context', $submitted['order'], $this->payment), 'shipping' => $this->getShippingMethodTemplate('context', $submitted['order'], $this->shipping), ); $this->data_form = gplcart_array_merge($this->data_form, $submitted); $this->setFormDataRequestServicesCheckout('payment'); $this->setFormDataRequestServicesCheckout('shipping'); $this->setFormDataCalculatedCheckout(); $this->setFormDataPanesCheckout(); }
Prepares the form data before passing to the templates
entailment
protected function setFormDataAddressCheckout() { $countries = array(); foreach ((array) $this->country->getList(array('status' => true)) as $code => $country) { $countries[$code] = $country['native_name']; } $default_country = count($countries) == 1 ? key($countries) : ''; $address = $this->getSubmitted('address', array()); if (!isset($address['payment']['country'])) { $address['payment']['country'] = $default_country; } if (!isset($address['shipping']['country'])) { $address['shipping']['country'] = $default_country; } $this->data_form['address'] = $address; $this->data_form['countries'] = $countries; $this->data_form['addresses'] = $this->address->getTranslatedList($this->order_user_id); $excessed = $this->address->getExceeded($this->order_user_id, $this->data_form['addresses']); $this->data_form['can_add_address'] = empty($excessed); $this->data_form['can_save_address'] = empty($excessed) && !empty($this->uid); foreach ($address as $type => $fields) { $this->data_form['format'][$type] = $this->country->getFormat($fields['country']); $this->data_form['states'][$type] = $this->state->getList(array('country' => $fields['country'], 'status' => 1)); if (empty($this->data_form['states'][$type])) { unset($this->data_form['format'][$type]['state_id']); } } }
Sets the checkout address variables
entailment
protected function setFormDataRequestServicesCheckout($type) { $this->data_form["request_{$type}_methods"] = false; if (!empty($this->data_form["get_{$type}_methods"]) || (!empty($this->data_form['order'][$type]) && !empty($this->data_form["has_dynamic_{$type}_methods"]))) { $this->data_form["show_{$type}_methods"] = true; $this->data_form["request_{$type}_methods"] = true; } }
Sets boolean flags to request dynamic shipping/payment methods @param string $type
entailment
protected function setFormDataDimensionsCheckout() { if (!empty($this->data_cart)) { $order = $this->data_form['order']; // Cart data passed by reference to convert product dimensions and measurement units $this->data_form['order']['volume'] = $this->order_dimension->getVolume($order, $this->data_cart); $this->data_form['order']['weight'] = $this->order_dimension->getWeight($order, $this->data_cart); } }
Calculates and sets order dimensions
entailment
protected function setFormDataCalculatedCheckout() { $result = $this->order->calculate($this->data_form); $this->data_form['total'] = $result['total']; $this->data_form['total_decimal'] = $result['total_decimal']; $this->data_form['total_formatted'] = $result['total_formatted']; $this->data_form['price_components'] = $this->prepareOrderComponentsCheckout($result); }
Calculates order total and price components
entailment
protected function setFormDataPanesCheckout() { $panes = array('login', 'review', 'payment_methods', 'shipping_methods', 'shipping_address', 'payment_address', 'comment', 'action'); foreach ($panes as $pane) { $this->data_form["pane_$pane"] = $this->render("checkout/panes/$pane", $this->data_form); } }
Sets rendered panes
entailment
protected function submitEditCheckout() { $this->setSubmitted('order'); $this->setAddressFormCheckout(); $this->submitAddAddressCheckout(); if ($this->isPosted('checkout_login') && empty($this->uid)) { $this->show_login_form = true; } $this->same_payment_address = (bool) $this->getPosted('same_payment_address', true, false, 'bool'); if ($this->isPosted('update')) { $this->setMessage($this->text('Form has been updated'), 'success', false); } $this->submitLoginCheckout(); if ($this->isPosted('checkout_anonymous')) { $this->show_login_form = false; } $this->validateCouponCheckout(); $this->submitCartCheckout(); $this->submitOrderCheckout(); }
Handles submitted actions
entailment