sentence1 stringlengths 52 3.87M | sentence2 stringlengths 1 47.2k | label stringclasses 1
value |
|---|---|---|
protected function deleteCountryState()
{
$this->controlAccess('state_delete');
if ($this->state->delete($this->data_state['state_id'])) {
$url = "admin/settings/states/{$this->data_country['code']}";
$this->redirect($url, $this->text('Country state has been deleted'), 'succ... | Deletes a country state | entailment |
protected function updateCountryState()
{
$this->controlAccess('state_edit');
if ($this->state->update($this->data_state['state_id'], $this->getSubmitted())) {
$url = "admin/settings/states/{$this->data_country['code']}";
$this->redirect($url, $this->text('Country state has ... | Updates a country state | entailment |
protected function addCountryState()
{
$this->controlAccess('state_add');
if ($this->state->add($this->getSubmitted())) {
$url = "admin/settings/states/{$this->data_country['code']}";
$this->redirect($url, $this->text('Country state has been added'), 'success');
}
... | Adds a new country state | entailment |
protected function setTitleEditCountryState()
{
if (isset($this->data_state['state_id'])) {
$title = $this->text('Edit %name', array('%name' => $this->data_state['name']));
} else {
$title = $this->text('Add country state for %name', array('%name' => $this->data_country['name... | Sets titles on the edit country state page | entailment |
protected function setBreadcrumbEditCountryState()
{
$breadcrumbs = array();
$breadcrumbs[] = array(
'url' => $this->url('admin'),
'text' => $this->text('Dashboard')
);
$breadcrumbs[] = array(
'url' => $this->url('admin/settings/country'),
... | Set breadcrumbs on the edit country state page | entailment |
public function productBundle(array &$submitted, array $options = array())
{
$this->options = $options;
$this->submitted = &$submitted;
$this->validateProductProductBundle();
$this->validateItemsProductBundle();
return $this->getResult();
} | Performs validation of submitted product bundle data
@param array $submitted
@param array $options
@return array|boolean | entailment |
protected function validateItemsProductBundle()
{
$field = 'bundle';
$value = $this->getSubmitted($field);
if (empty($value)) {
return null;
}
if (!is_array($value)) {
$this->setErrorInvalid($field, $this->translation->text('Product bundle'));
... | Validates bundled products
@return boolean|null | entailment |
public function compare(array &$submitted, array $options = array())
{
$this->options = $options;
$this->submitted = &$submitted;
$this->validateProductCompare();
return $this->getResult();
} | Performs full product comparison data validation
@param array $submitted
@param array $options
@return boolean|array | entailment |
public function get($schemaId)
{
$class = $this->getSchemaClass();
$data = static::$schemas[$schemaId];
/** @var Schema $schema */
$schema = call_user_func([$class, 'deserializeObject'], $data);
$schema->getMeta()->setLocation($this->schemasEndpointUrl.$schemaId);
re... | @param string $schemaId
@return \Tmilos\ScimSchema\Model\v1\Schema|\Tmilos\ScimSchema\Model\v2\Schema|Schema | entailment |
public function initAuth()
{
if ($this->_verified)
return true;
$output = $this->postRequest(
'identification/bankid/mobile',
[
'useEasyLogin' => false,
'generateEasyLoginId' => false,
'userId' =... | Initiate Mobile BankID authentication
Sends verification request to the users Mobile BankID app.
@return bool
@throws Exception | entailment |
public function verify()
{
if ($this->_verified)
return true;
$output = $this->getRequest('identification/bankid/mobile/verify');
if (empty($output->status))
throw new Exception('Mobile BankID cannot be verified. Maybe a session timeout.', 11);
$this->_veri... | Check Mobile BankID verification
See if the user have confirmed the authentication verification request.
@return bool True if verified. False to check later (eg. 5 seconds) for user verification.
@throws Exception | entailment |
public function zone(array &$submitted, array $options = array())
{
$this->options = $options;
$this->submitted = &$submitted;
$this->validateZone();
$this->validateBool('status');
$this->validateTitle();
$this->unsetSubmitted('update');
return $this->getRe... | Performs full zone data validation
@param array $submitted
@param array $options
@return array|boolean | entailment |
protected function validateZone()
{
$id = $this->getUpdatingId();
if ($id === false) {
return null;
}
$data = $this->zone->get($id);
if (empty($data)) {
$this->setErrorUnavailable('update', $this->translation->text('Zone'));
return false... | Validates a zone to be updated
@return boolean|null | entailment |
public function listProduct()
{
$this->actionListProduct();
$this->setTitleListProduct();
$this->setBreadcrumbListProduct();
$this->setFilterListProduct();
$this->setPagerListProduct();
$this->setData('products', $this->getListProduct());
$this->setData('curr... | Displays the product overview page | entailment |
protected function setPagerListProduct()
{
$conditions = $this->query_filter;
$conditions['count'] = true;
$pager = array(
'query' => $this->query_filter,
'total' => (int) $this->product->getList($conditions)
);
return $this->data_limit = $this->setP... | Set pager
@return array | entailment |
protected function actionListProduct()
{
list($selected, $action, $value) = $this->getPostedAction();
$deleted = $updated = 0;
foreach ($selected as $id) {
if ($action === 'status' && $this->access('product_edit')) {
$updated += (int) $this->product->update($id... | Applies an action to the selected products | entailment |
protected function getListProduct()
{
$conditions = $this->query_filter;
$conditions['limit'] = $this->data_limit;
$list = (array) $this->product->getList($conditions);
$this->prepareListProduct($list);
return $list;
} | Returns an array of products
@return array | entailment |
protected function prepareListProduct(array &$list)
{
foreach ($list as &$item) {
$this->setItemPriceFormatted($item, $this->price);
$this->setItemUrlEntity($item, $this->store, 'product');
}
} | Prepare an array of products
@param array $list | entailment |
public function editProduct($product_id = null)
{
$this->setProduct($product_id);
$this->setTitleEditProduct();
$this->setBreadcrumbEditProduct();
$this->setData('product', $this->data_product);
$this->setData('size_units', $this->convertor->getUnitNames('size'));
$t... | Displays the product edit form
@param integer|null $product_id | entailment |
protected function getListCategoryProduct($store_id)
{
$types = $this->category_group->getTypes();
$categories = array();
foreach (array_keys($types) as $type) {
$op = array(
'type' => $type,
'store_id' => $store_id
);
$d... | Returns an array of categories keyed by a type
@param integer $store_id
@return array | entailment |
protected function setProduct($product_id)
{
$this->data_product = array();
if (is_numeric($product_id)) {
$conditions = array(
'language' => 'und',
'product_id' => $product_id
);
$this->data_product = $this->product->get($condit... | Set a product data
@param integer $product_id | entailment |
protected function prepareProduct(array &$product)
{
$options = array(
'store_id' => $product['store_id'],
'product_id' => $product['product_id']
);
$product['related'] = $this->product->getRelated($options);
$product['price'] = $this->price->decimal($product... | Prepare an array of product data
@param array $product | entailment |
protected function setSkuCombinationProduct(array &$product)
{
if (!empty($product['combination'])) {
foreach ($product['combination'] as &$combination) {
$combination['path'] = $combination['thumb'] = '';
if (!empty($product['images'][$combination['file_id']]))... | Sets product SKU combinations data
@param array $product | entailment |
protected function submitEditProduct()
{
if ($this->isPosted('delete')) {
$this->deleteProduct();
} else if ($this->isPosted('save') && $this->validateEditProduct()) {
$this->deleteImagesProduct();
if (isset($this->data_product['product_id'])) {
$t... | Handles a submitted product | entailment |
protected function deleteImagesProduct()
{
$this->controlAccess('product_edit');
$file_ids = $this->getPosted('delete_images', array(), true, 'array');
return $this->image->delete($file_ids);
} | Delete product images
@return boolean | entailment |
protected function deleteProduct()
{
$this->controlAccess('product_delete');
if ($this->product->delete($this->data_product['product_id'])) {
$this->redirect('admin/content/product', $this->text('Product has been deleted'), 'success');
}
$this->redirect('', $this->text(... | Deletes a product | entailment |
protected function validateEditProduct()
{
$this->setSubmitted('product', null, false);
$this->setSubmittedBool('status');
$this->setSubmittedBool('subtract');
$this->setSubmitted('form', true);
$this->setSubmitted('update', $this->data_product);
if (isset($this->dat... | Validates an array of submitted product data
@return bool | entailment |
protected function updateProduct()
{
$this->controlAccess('product_edit');
if ($this->product->update($this->data_product['product_id'], $this->getSubmitted())) {
$this->redirect('admin/content/product', $this->text('Product has been updated'), 'success');
}
$this->redi... | Updates a product | entailment |
protected function addProduct()
{
$this->controlAccess('product_add');
if ($this->product->add($this->getSubmitted())) {
$this->redirect('admin/content/product', $this->text('Product has been added'), 'success');
}
$this->redirect('', $this->text('Product has not been a... | Adds a new product | entailment |
protected function setDataAuthorEditProduct()
{
$user_id = $this->getData('product.user_id');
if (!empty($user_id)) {
$user = $this->user->get($user_id);
$this->setData('product.author', $user['email']);
}
} | Sets the product author data | entailment |
protected function setDataFieldsEditProduct()
{
$output_field_form = false;
$get_product_class_id = $this->getQuery('product_class_id');
$product_class_id = $this->getData('product.product_class_id', 0);
if (isset($get_product_class_id)) {
$output_field_form = true;
... | Sets attributes/options product data | entailment |
protected function setDataRelatedEditProduct()
{
$product_ids = $this->getData('product.related');
$products = array();
if (!empty($product_ids)) {
$products = (array) $this->product->getList(array('product_id' => $product_ids));
}
$options = array(
... | Sets related products | entailment |
protected function setTitleEditProduct()
{
if (isset($this->data_product['product_id'])) {
$title = $this->text('Edit %name', array('%name' => $this->data_product['title']));
} else {
$title = $this->text('Add product');
}
$this->setTitle($title);
} | Sets titles on the product edit form | entailment |
protected function setBreadcrumbEditProduct()
{
$breadcrumbs = array();
$breadcrumbs[] = array(
'url' => $this->url('admin'),
'text' => $this->text('Dashboard')
);
$breadcrumbs[] = array(
'text' => $this->text('Products'),
'url' => $t... | Sets breadcrumbs on the product edit page | entailment |
public function product(array &$submitted, array $options = array())
{
$this->options = $options;
$this->submitted = &$submitted;
$this->validateProduct();
$this->validateSubtractProduct();
$this->validateBool('status');
$this->validateCurrencyProduct();
$thi... | Performs full product data validation
@param array $submitted
@param array $options
@return array|boolean | entailment |
protected function validateProduct()
{
$id = $this->getUpdatingId();
if ($id === false) {
return null;
}
$data = $this->product->get($id);
if (empty($data)) {
$this->setErrorUnavailable('update', $this->translation->text('Product'));
ret... | Validates a product data
@return boolean|null | entailment |
protected function validateSubtractProduct()
{
$field = 'subtract';
$value = $this->getSubmitted($field);
if (isset($value)) {
$this->setSubmitted($field, filter_var($value, FILTER_VALIDATE_BOOLEAN));
}
return true;
} | Validates "Subtract" bool value
@return boolean | entailment |
protected function validateCategoryProduct()
{
$fields = array(
'category_id' => $this->translation->text('Category'),
'brand_category_id' => $this->translation->text('Brand'),
);
$errors = 0;
foreach ($fields as $field => $label) {
$value = $th... | Validates product categories
@return boolean | entailment |
protected function validateUnitProduct()
{
$allowed = array(
'size_unit' => $this->convertor->getUnitNames('size'),
'weight_unit' => $this->convertor->getUnitNames('weight')
);
$fields = array(
'size_unit' => $this->translation->text('Size unit'),
... | Validates measurement units
@return boolean | entailment |
protected function validateDimensionProduct()
{
$fields = array(
'width' => $this->translation->text('Width'),
'height' => $this->translation->text('Height'),
'length' => $this->translation->text('Length'),
'weight' => $this->translation->text('Weight')
... | Validates product dimensions
@return boolean | entailment |
protected function validateRelatedProduct()
{
$field = 'related';
if ($this->isExcluded($field) || $this->isError('store_id')) {
return null;
}
$value = $this->getSubmitted($field);
if (empty($value)) {
$this->setSubmitted($field, array());
... | Validates related products
@return boolean|null | entailment |
protected function validateSkuProduct()
{
$field = 'sku';
if ($this->isExcluded($field) || $this->isError()) {
return null;
}
$value = $this->getSubmitted($field);
$label = $this->translation->text('SKU');
if ($this->isUpdating() && empty($value)) {
... | Validates a product SKU
@return boolean|null | entailment |
protected function validateClassProduct()
{
$field = 'product_class_id';
$value = $this->getSubmitted($field);
if (empty($value)) {
return null;
}
$label = $this->translation->text('Product class');
if (!is_numeric($value)) {
$this->setError... | Validates a product class
@return boolean|null | entailment |
protected function validateAttributeProduct()
{
$fields = $this->getSubmitted('product_fields.attribute');
if (empty($fields)) {
return null;
}
$attributes = $this->getSubmitted('field.attribute');
$errors = 0;
foreach ($fields as $field_id => $field) ... | Validates an array of product attributes
@return boolean|null | entailment |
protected function validateCombinationProduct()
{
$combinations = $this->getSubmitted('combination');
if (empty($combinations)) {
return null;
}
$index = 1;
foreach ($combinations as &$combination) {
$combination['status'] = !empty($combination['st... | Validates an array of product combinations
@return boolean|null | entailment |
protected function validateCombinationOptionsProduct($index, &$combination)
{
$options = $this->getSubmitted('product_fields.option');
if (empty($options)) {
return null;
}
$errors = 0;
foreach ($options as $field_id => $field) {
if (!empty($field['... | Validates option combination fields
@param integer $index
@param array $combination
@return boolean|null | entailment |
protected function validateCombinationSkuProduct($index, &$combination)
{
if (!isset($combination['sku'])) {
return null;
}
if ($combination['sku'] === '') {
return true;
}
$updating = $this->getUpdating();
$product_id = null;
if (i... | Validates option combination SKUs
@param integer $index
@param array $combination
@return boolean|null | entailment |
protected function validateCombinationPriceProduct($index, &$combination)
{
$price = $this->getSubmitted('price');
if (empty($combination['price'])) {
$combination['price'] = $price;
}
if (!is_numeric($combination['price']) || strlen($combination['price']) > 10) {
... | Validates combination stock price
@param integer $index
@param array $combination
@return boolean | entailment |
protected function validateCombinationStockProduct($index, &$combination)
{
if (empty($combination['stock'])) {
return null;
}
if (!is_numeric($combination['stock']) || strlen($combination['stock']) > 10) {
$error = $this->translation->text('Only numeric values and n... | Validates combination stock level
@param integer $index
@param array $combination
@return null|boolean | entailment |
public function getList(array $options = array())
{
$result = null;
$this->hook->attach('sku.list.before', $options, $result, $this);
if (isset($result)) {
return $result;
}
$sql = 'SELECT ps.*, p.title, p.currency';
if (!empty($options['count'])) {
... | Returns an array of SKUs or counts them
@param array $options
@return array|integer | entailment |
public function delete($product_id, array $options = array())
{
$result = null;
$this->hook->attach('sku.delete.before', $product_id, $options, $result, $this);
if (isset($result)) {
return (bool) $result;
}
$sql = 'DELETE FROM product_sku WHERE product_id=?';
... | Deletes a product SKU
@param integer $product_id
@param array $options
@todo Refactor
@return boolean | entailment |
public function generate($pattern, array $options = array())
{
$options += array('store_id' => null, 'placeholders' => array());
$result = null;
$this->hook->attach('sku.generate.before', $pattern, $options, $result);
if (isset($result)) {
return (string) $result;
... | Generates a SKU
@param string $pattern
@param array $options
@return string | entailment |
public function getUnique($sku, $store_id)
{
$existing = $this->get(array('sku' => $sku, 'store_id' => $store_id));
if (empty($existing)) {
return $sku;
}
$counter = 1;
do {
$modified = $sku . '-' . $counter;
$counter++;
} while ... | Returns a unique SKU for the given store ID
@param string $sku
@param integer|null $store_id
@return string | entailment |
public function getFieldValues($combination_id)
{
$field_value_ids = explode('_', substr($combination_id, strpos($combination_id, '-') + 1));
sort($field_value_ids);
return $field_value_ids;
} | Returns an array of field value IDs from a combination ID
@param string $combination_id
@return array | entailment |
public function getCombinationId(array $field_value_ids, $product_id = null)
{
sort($field_value_ids);
$combination_id = implode('_', $field_value_ids);
return empty($product_id) ? $combination_id : "$product_id-$combination_id";
} | Creates a field combination id from an array of field value ids
@param array $field_value_ids
@param null|integer $product_id
@return string | entailment |
public function selectCombination(array $product, array $field_value_ids)
{
$result = array();
$this->hook->attach('sku.select.combination.before', $product, $field_value_ids, $result, $this);
if (!empty($result)) {
return (array) $result;
}
$access = !empty($pr... | Returns an array of data when selecting SKU combinations
@param array $product
@param array $field_value_ids
@return array | entailment |
protected function prepareList(array $list)
{
foreach ($list as &$item) {
$item['fields'] = $this->getFieldValues($item['combination_id']);
}
return $list;
} | Prepare an array of product SKU items
@param array $list
@return array | entailment |
protected function getRelatedFieldValues(array $product, array $ids)
{
$related = array();
foreach ($product['combination'] as $combination) {
if (array_intersect($ids, $combination['fields'])) {
$related += $combination['fields'];
}
}
return ... | Returns an array of related fields value IDs
@todo Rethink this. It should return all possible combinations
@param array $product
@param array $ids
@return array | entailment |
protected function init()
{
parent::init();
$this->text = 'Submit';
$this->attributes['type'] = 'submit';
$this->attributes['id'] = !$this->name ? $this->attributes['id'] . 'submit' : $this->attributes['id'];
} | Initialize field settings | entailment |
protected function validatePost($request, $post, $validationRules)
{
$validationRules = $this->validateFieldByConditionalLogic($validationRules, $post, $post);
// Lets receive the current items from the post type validation array
if(array_key_exists('post_name', $validationRules) && !is_array($valid... | Validating the creation and change of a post | entailment |
protected function execute(InputInterface $input, OutputInterface $output)
{
$appName = 'PPI';
$mm = $this->getServiceManager()->get('ModuleManager');
$modules = $mm->getLoadedModules(true);
$output->writeln(sprintf('%s is running with <info>%d</info> modules loaded.', $appName... | {@inheritdoc} | entailment |
public function accountOrder($user_id, $order_id)
{
$this->setUserAccountOrder($user_id);
$this->setOrderAccountOrder($order_id);
$this->setTitleAccountOrder();
$this->setBreadcrumbAccountOrder();
$this->setData('user', $this->data_user);
$this->setDataPanelSummaryA... | Page callback
Displays the order overview page
@param integer $user_id
@param integer $order_id | entailment |
protected function setBreadcrumbAccountOrder()
{
$breadcrumbs = array();
$breadcrumbs[] = array(
'url' => $this->url('/'),
'text' => $this->text('Shop')
);
$breadcrumbs[] = array(
'text' => $this->text('Orders'),
'url' => $this->url("... | Sets breadcrumbs on the order overview page | entailment |
protected function setOrderAccountOrder($order_id)
{
$this->data_order = $this->order->get($order_id);
if (empty($this->data_order)) {
$this->outputHttpStatus(404);
}
$this->prepareOrderAccountOrder($this->data_order);
} | Sets an order data
@param integer $order_id | entailment |
protected function prepareOrderAccountOrder(array &$order)
{
$this->setItemTotalFormatted($order, $this->price);
$this->setItemOrderAddress($order, $this->address);
$this->setItemOrderStoreName($order, $this->store);
$this->setItemOrderStatusName($order, $this->order);
$this-... | Prepare an array of order data
@param array $order | entailment |
protected function prepareOrderComponentsAccountOrder(array &$order)
{
$this->setItemOrderCartComponent($order, $this->price);
$this->setItemOrderPriceRuleComponent($order, $this->price, $this->price_rule);
$this->setItemOrderPaymentComponent($order, $this->price, $this->payment, $this->orde... | Prepare order components
@param array $order | entailment |
protected function setUserAccountOrder($user_id)
{
$this->data_user = $this->user->get($user_id);
if (empty($this->data_user)) {
$this->outputHttpStatus(404);
}
if (empty($this->data_user['status']) && !$this->access('user')) {
$this->outputHttpStatus(403);
... | Sets a user data
@param integer $user_id | entailment |
protected function setDataPanelComponentsAccountOrder()
{
$order = $this->data_order;
$this->prepareOrderComponentsAccountOrder($order);
$data = array(
'order' => $order,
'components' => $order['data']['components']
);
$this->setData('components', $t... | Sets the order components panel on the order overview page | entailment |
public function viewHelp($hash)
{
$this->setFileHelp($hash);
$this->setTitleViewHelp();
$this->setBreadcrumbViewHelp();
$this->setData('help', $this->renderHelp());
$this->outputViewHelp();
} | View a help item
@param string $hash | entailment |
protected function setTitleViewHelp()
{
$meta = $this->help->getMeta($this->data_file);
$this->setTitle($meta['title']);
} | Sets titles on the view help page | entailment |
protected function setBreadcrumbViewHelp()
{
$breadcrumbs = array();
$breadcrumbs[] = array(
'url' => $this->url('admin'),
'text' => $this->text('Dashboard')
);
$breadcrumbs[] = array(
'url' => $this->url('admin/help'),
'text' => $thi... | Sets breadcrumbs on the view help page | entailment |
protected function setFileHelp($hash)
{
$this->data_file = gplcart_path_absolute(gplcart_string_decode($hash));
if (!is_file($this->data_file)) {
$this->outputHttpStatus(404);
}
} | Sets help file path
@param string $hash | entailment |
public function listHelp()
{
$this->setTitleListHelp();
$this->setBreadcrumbListHelp();
$this->setData('items', $this->getListHelp());
$this->outputListHelp();
} | Displays the help list page | entailment |
protected function setBreadcrumbListHelp()
{
$breadcrumbs = array();
$breadcrumbs[] = array(
'url' => $this->url('admin'),
'text' => $this->text('Dashboard')
);
$breadcrumbs[] = array(
'url' => $this->url('admin'),
'text' => $this->te... | Sets breadcrumbs on the help list page | entailment |
public function isMet(array $trigger, array $data)
{
$result = null;
$this->hook->attach('condition.met.before', $trigger, $data, $result, $this);
if (isset($result)) {
return (bool) $result;
}
if (empty($trigger['data']['conditions'])) {
return fals... | Whether all conditions are met
@param array $trigger
@param array $data
@return boolean | entailment |
protected function callHandler(array $condition, array $data)
{
try {
$handlers = $this->getHandlers();
return Handler::call($handlers, $condition['id'], 'process', array($condition, $data, $this));
} catch (Exception $ex) {
return false;
}
} | Call a condition handler
@param array $condition
@param array $data
@return bool | entailment |
public function getOperators()
{
return array(
"<" => $this->translation->text('Less than'),
">" => $this->translation->text('Greater than'),
"=" => $this->translation->text('Equal (is in list)'),
"<=" => $this->translation->text('Less than or equal to'),
... | Returns an array of condition operators
@return array | entailment |
public function init($group)
{
// Lets validate if the post type exists and if so, continue.
$postTypeModel = $this->getPostType($group);
if(!$postTypeModel){
$errorMessages = 'You are not authorized to do this.';
return $this->abort($errorMessages);
}
// Receiving the current data of the gro... | Display a single post | entailment |
public function fieldValue(array &$submitted, array $options = array())
{
$this->options = $options;
$this->submitted = &$submitted;
$this->validateFieldValue();
$this->validateTitle();
$this->validateWeight();
$this->validateTranslation();
$this->validateFie... | Performs full field value data validation
@param array $submitted
@param array $options
@return boolean|array | entailment |
protected function validateFieldValue()
{
$id = $this->getUpdatingId();
if ($id === false) {
return null;
}
$data = $this->field_value->get($id);
if (empty($data)) {
$this->setErrorUnavailable('update', $this->translation->text('Field value'));
... | Validates a field value to be updated
@return boolean|null | entailment |
protected function validateColorFieldValue()
{
$field = 'color';
if ($this->isExcluded($field)) {
return null;
}
$value = $this->getSubmitted($field);
if (!isset($value) || $value === '') {
return null;
}
if (preg_match('/#([a-fA-F0... | Validates a color code
@return boolean|null | entailment |
public function getNextWeight($type, $pos)
{
$step = 20;
$count = $this->count($type, $pos);
return $count * $step + $step;
} | Returns a weight for the next asset
@param string $type
@param string $pos
@return integer | entailment |
public function getMaxWeight($type, $pos)
{
if (empty($this->assets[$type][$pos])) {
return null;
}
$weights = array();
foreach ($this->assets[$type][$pos] as $asset) {
$weights[] = $asset['weight'];
}
return max($weights);
} | Returns the max weight of added assets
@param string $type
@param string $pos
@return int|null | entailment |
public function count($type, $pos)
{
return empty($this->assets[$type][$pos]) ? 0 : count($this->assets[$type][$pos]);
} | Returns a weight of the last added asset
@param string $type Either "css" or "js"
@param string $pos Either "top" or "bottom"
@return integer | entailment |
public function get($type, $position)
{
if (empty($this->assets[$type][$position])) {
return array();
}
return $this->assets[$type][$position];
} | Returns an array of asset items
@param string $type
@param string $position
@return array | entailment |
public function set(array $data)
{
$build = $this->build($data);
if (empty($build['asset'])) {
return false;
}
if (!empty($build['merge']) && is_array($build['asset'])) {
if (isset($this->assets[$build['type']][$build['position']][$build['merge']])) {
... | Sets an asset
@param array $data
@return bool|array | entailment |
public function build(array $data)
{
if (is_array($data['asset'])) {
$type = 'js';
} else if (strpos($data['asset'], 'http') === 0) {
$type = 'external';
} else {
$type = pathinfo($data['asset'], PATHINFO_EXTENSION);
}
$data += array(
... | Builds asset data
@param array $data
@return array | entailment |
public function listModule()
{
$this->actionListModule();
$this->setTitleListModule();
$this->setBreadcrumbListModule();
$this->setFilterListModule();
$this->setPagerListModule();
$this->setData('types', $this->getTypesModule());
$this->setData('modules', (ar... | Displays the module admin overview page | entailment |
protected function actionListModule()
{
$this->controlToken('action');
$action = $this->getQuery('action');
$module_id = $this->getQuery('module_id');
if (!empty($action) && !empty($module_id)) {
$this->setModule($module_id);
$result = $this->startActionModu... | Applies an action to a module | entailment |
protected function setModule($module_id)
{
$this->data_module = $this->module->get($module_id);
if (empty($this->data_module)) {
$this->outputHttpStatus(403);
}
} | Set a module data
@param string $module_id | entailment |
protected function finishActionModule($result)
{
if ($result === true) {
$this->redirect('', $this->text('Module has been updated'), 'success');
}
$message = $result ? $result : $this->text('Operation unavailable');
$this->redirect('', $message, 'danger');
} | Finishes module action
@param mixed $result | entailment |
protected function startActionModule($action)
{
$this->controlAccess("module_$action");
switch ($action) {
case 'enable':
return $this->module_model->enable($this->data_module['id']);
case 'disable':
return $this->module_model->disable($this->... | Performs an action against a module
@param string $action
@return mixed | entailment |
protected function getListModule($count = false)
{
$list = $this->module->getList();
$this->checkDependenciesListModule($list);
$this->prepareListModule($list);
$allowed = $this->getAllowedFiltersModule();
$this->filterList($list, $allowed, $this->query_filter);
$th... | Returns an array of modules
@param bool $count
@return array|int | entailment |
protected function prepareListModule(array &$list)
{
foreach ($list as &$item) {
$item['has_dependencies'] = !empty($item['requires']) || !empty($item['required_by']);
}
} | Prepare an array of modules
@param array $list | entailment |
protected function checkDependenciesListModule(array &$list)
{
$this->validateDependencies($list);
$list = $this->graph->build($list);
} | Validates module dependencies
@param array $list | entailment |
protected function getTypesModule()
{
$types = array();
foreach ($this->module->getList() as $module) {
$types[$module['type']] = $this->text(ucfirst($module['type']));
}
return $types;
} | Returns an array of module types
@return array | entailment |
protected function setPagerListModule()
{
$pager = array(
'query' => $this->query_filter,
'total' => (int) $this->getListModule(true)
);
return $this->data_limit = $this->setPager($pager);
} | Sets pager
@return array | entailment |
public function run()
{
$result = null;
$this->hook->attach('cron.run.before', $result, $this);
if (isset($result)) {
return (bool) $result;
}
ini_set('max_execution_time', 0);
register_shutdown_function(array($this, 'shutdownHandler'));
$this->... | Run cron tasks
@return bool | entailment |
public function process()
{
$this->report->deleteExpired();
$this->history->deleteExpired();
// Delete files in temporary directory
foreach (gplcart_file_scan_recursive(GC_DIR_PRIVATE_TEMP) as $file) {
if (strpos(basename($file), '.') !== 0) { // Ignore hidden files
... | Processes all defined tasks
@return bool | entailment |
protected function outputCommandListHelp()
{
$routes = $this->route->getList();
ksort($routes);
$rows = array(
array(
$this->text('Command'),
$this->text('Alias'),
$this->text('Description')
)
);
forea... | Output a list of all available CLI commands | entailment |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.