id
int32
0
241k
repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
32,300
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopOrder.class.php
TShopOrder.getCountryName
public static function getCountryName($sDBValue, $aOrderRow) { $oCountry = TdbDataCountry::GetNewInstance(); $sCountry = '-'; if ($oCountry->Load($sDBValue)) { $sCountry = $oCountry->fieldName; } return $sCountry; }
php
public static function getCountryName($sDBValue, $aOrderRow) { $oCountry = TdbDataCountry::GetNewInstance(); $sCountry = '-'; if ($oCountry->Load($sDBValue)) { $sCountry = $oCountry->fieldName; } return $sCountry; }
[ "public", "static", "function", "getCountryName", "(", "$", "sDBValue", ",", "$", "aOrderRow", ")", "{", "$", "oCountry", "=", "TdbDataCountry", "::", "GetNewInstance", "(", ")", ";", "$", "sCountry", "=", "'-'", ";", "if", "(", "$", "oCountry", "->", "Load", "(", "$", "sDBValue", ")", ")", "{", "$", "sCountry", "=", "$", "oCountry", "->", "fieldName", ";", "}", "return", "$", "sCountry", ";", "}" ]
Get country name for value. Was used for cms list.
[ "Get", "country", "name", "for", "value", ".", "Was", "used", "for", "cms", "list", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrder.class.php#L750-L759
32,301
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopOrder.class.php
TShopOrder.getShippingCountryName
public static function getShippingCountryName($sDBValue, $aOrderRow) { if ('' == $sDBValue) { $sCountry = TdbShopOrder::getCountryName($aOrderRow['adr_billing_country_id'], $aOrderRow); } else { $sCountry = TdbShopOrder::getCountryName($sDBValue, $aOrderRow); } return $sCountry; }
php
public static function getShippingCountryName($sDBValue, $aOrderRow) { if ('' == $sDBValue) { $sCountry = TdbShopOrder::getCountryName($aOrderRow['adr_billing_country_id'], $aOrderRow); } else { $sCountry = TdbShopOrder::getCountryName($sDBValue, $aOrderRow); } return $sCountry; }
[ "public", "static", "function", "getShippingCountryName", "(", "$", "sDBValue", ",", "$", "aOrderRow", ")", "{", "if", "(", "''", "==", "$", "sDBValue", ")", "{", "$", "sCountry", "=", "TdbShopOrder", "::", "getCountryName", "(", "$", "aOrderRow", "[", "'adr_billing_country_id'", "]", ",", "$", "aOrderRow", ")", ";", "}", "else", "{", "$", "sCountry", "=", "TdbShopOrder", "::", "getCountryName", "(", "$", "sDBValue", ",", "$", "aOrderRow", ")", ";", "}", "return", "$", "sCountry", ";", "}" ]
Get shipping country from value. If value was empty get billing country Was used for cms list.
[ "Get", "shipping", "country", "from", "value", ".", "If", "value", "was", "empty", "get", "billing", "country", "Was", "used", "for", "cms", "list", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrder.class.php#L766-L775
32,302
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopOrder.class.php
TShopOrder.UpdateStock
public function UpdateStock($bRemoveFromStock) { $oOrderItemList = $this->GetFieldShopOrderItemList(); $oOrderItemList->GoToStart(); while ($oOrderItem = $oOrderItemList->Next()) { $oItem = $oOrderItem->GetFieldShopArticle(); if ($oItem) { $dAmount = $oOrderItem->fieldOrderAmount; if ($bRemoveFromStock) { $dAmount = -1 * $dAmount; } $oItem->UpdateStock($dAmount, true, true); } } $oOrderItemList->GoToStart(); }
php
public function UpdateStock($bRemoveFromStock) { $oOrderItemList = $this->GetFieldShopOrderItemList(); $oOrderItemList->GoToStart(); while ($oOrderItem = $oOrderItemList->Next()) { $oItem = $oOrderItem->GetFieldShopArticle(); if ($oItem) { $dAmount = $oOrderItem->fieldOrderAmount; if ($bRemoveFromStock) { $dAmount = -1 * $dAmount; } $oItem->UpdateStock($dAmount, true, true); } } $oOrderItemList->GoToStart(); }
[ "public", "function", "UpdateStock", "(", "$", "bRemoveFromStock", ")", "{", "$", "oOrderItemList", "=", "$", "this", "->", "GetFieldShopOrderItemList", "(", ")", ";", "$", "oOrderItemList", "->", "GoToStart", "(", ")", ";", "while", "(", "$", "oOrderItem", "=", "$", "oOrderItemList", "->", "Next", "(", ")", ")", "{", "$", "oItem", "=", "$", "oOrderItem", "->", "GetFieldShopArticle", "(", ")", ";", "if", "(", "$", "oItem", ")", "{", "$", "dAmount", "=", "$", "oOrderItem", "->", "fieldOrderAmount", ";", "if", "(", "$", "bRemoveFromStock", ")", "{", "$", "dAmount", "=", "-", "1", "*", "$", "dAmount", ";", "}", "$", "oItem", "->", "UpdateStock", "(", "$", "dAmount", ",", "true", ",", "true", ")", ";", "}", "}", "$", "oOrderItemList", "->", "GoToStart", "(", ")", ";", "}" ]
remove or add the stock of the order back into the product pool. @param bool $bRemoveFromStock
[ "remove", "or", "add", "the", "stock", "of", "the", "order", "back", "into", "the", "product", "pool", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrder.class.php#L1018-L1033
32,303
chameleon-system/chameleon-shop
src/ShopListFilterBundle/objects/db/ListfilterItems/TPkgShopListfilterItemMultiselect.class.php
TPkgShopListfilterItemMultiselect.IsSelected
public function IsSelected($sItemName) { $bIsSelected = false; if (is_array($this->aActiveFilterData)) { $bIsSelected = in_array($sItemName, $this->aActiveFilterData); } elseif (!empty($this->aActiveFilterData) && is_string($this->aActiveFilterData)) { $bIsSelected = ($sItemName == $this->aActiveFilterData); } return $bIsSelected; }
php
public function IsSelected($sItemName) { $bIsSelected = false; if (is_array($this->aActiveFilterData)) { $bIsSelected = in_array($sItemName, $this->aActiveFilterData); } elseif (!empty($this->aActiveFilterData) && is_string($this->aActiveFilterData)) { $bIsSelected = ($sItemName == $this->aActiveFilterData); } return $bIsSelected; }
[ "public", "function", "IsSelected", "(", "$", "sItemName", ")", "{", "$", "bIsSelected", "=", "false", ";", "if", "(", "is_array", "(", "$", "this", "->", "aActiveFilterData", ")", ")", "{", "$", "bIsSelected", "=", "in_array", "(", "$", "sItemName", ",", "$", "this", "->", "aActiveFilterData", ")", ";", "}", "elseif", "(", "!", "empty", "(", "$", "this", "->", "aActiveFilterData", ")", "&&", "is_string", "(", "$", "this", "->", "aActiveFilterData", ")", ")", "{", "$", "bIsSelected", "=", "(", "$", "sItemName", "==", "$", "this", "->", "aActiveFilterData", ")", ";", "}", "return", "$", "bIsSelected", ";", "}" ]
return true if the item is selected. @param string $sItemName @return bool
[ "return", "true", "if", "the", "item", "is", "selected", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopListFilterBundle/objects/db/ListfilterItems/TPkgShopListfilterItemMultiselect.class.php#L36-L46
32,304
chameleon-system/chameleon-shop
src/ShopListFilterBundle/objects/db/ListfilterItems/TPkgShopListfilterItemMultiselect.class.php
TPkgShopListfilterItemMultiselect.GetTargetTableNameField
protected function GetTargetTableNameField() { static $sTargetTableName = null; if (is_null($sTargetTableName)) { $oTargetTableConf = TdbCmsTblConf::GetNewInstance(); /** @var $oTargetTableConf TdbCmsTblConf */ $oTargetTableConf->LoadFromField('name', $this->sItemTableName); $sTargetTableName = $oTargetTableConf->GetNameColumn(); $sClassName = TCMSTableToClass::GetClassName(TCMSTableToClass::PREFIX_CLASS, $oTargetTableConf->fieldName); if (call_user_func(array($sClassName, 'CMSFieldIsTranslated'), $sTargetTableName)) { $sLanguagePrefix = TGlobal::GetLanguagePrefix(); if (!empty($sLanguagePrefix)) { $sTargetTableName = $sTargetTableName.'__'.$sLanguagePrefix; } } } return $sTargetTableName; }
php
protected function GetTargetTableNameField() { static $sTargetTableName = null; if (is_null($sTargetTableName)) { $oTargetTableConf = TdbCmsTblConf::GetNewInstance(); /** @var $oTargetTableConf TdbCmsTblConf */ $oTargetTableConf->LoadFromField('name', $this->sItemTableName); $sTargetTableName = $oTargetTableConf->GetNameColumn(); $sClassName = TCMSTableToClass::GetClassName(TCMSTableToClass::PREFIX_CLASS, $oTargetTableConf->fieldName); if (call_user_func(array($sClassName, 'CMSFieldIsTranslated'), $sTargetTableName)) { $sLanguagePrefix = TGlobal::GetLanguagePrefix(); if (!empty($sLanguagePrefix)) { $sTargetTableName = $sTargetTableName.'__'.$sLanguagePrefix; } } } return $sTargetTableName; }
[ "protected", "function", "GetTargetTableNameField", "(", ")", "{", "static", "$", "sTargetTableName", "=", "null", ";", "if", "(", "is_null", "(", "$", "sTargetTableName", ")", ")", "{", "$", "oTargetTableConf", "=", "TdbCmsTblConf", "::", "GetNewInstance", "(", ")", ";", "/** @var $oTargetTableConf TdbCmsTblConf */", "$", "oTargetTableConf", "->", "LoadFromField", "(", "'name'", ",", "$", "this", "->", "sItemTableName", ")", ";", "$", "sTargetTableName", "=", "$", "oTargetTableConf", "->", "GetNameColumn", "(", ")", ";", "$", "sClassName", "=", "TCMSTableToClass", "::", "GetClassName", "(", "TCMSTableToClass", "::", "PREFIX_CLASS", ",", "$", "oTargetTableConf", "->", "fieldName", ")", ";", "if", "(", "call_user_func", "(", "array", "(", "$", "sClassName", ",", "'CMSFieldIsTranslated'", ")", ",", "$", "sTargetTableName", ")", ")", "{", "$", "sLanguagePrefix", "=", "TGlobal", "::", "GetLanguagePrefix", "(", ")", ";", "if", "(", "!", "empty", "(", "$", "sLanguagePrefix", ")", ")", "{", "$", "sTargetTableName", "=", "$", "sTargetTableName", ".", "'__'", ".", "$", "sLanguagePrefix", ";", "}", "}", "}", "return", "$", "sTargetTableName", ";", "}" ]
returns the name field of the target table. @return string
[ "returns", "the", "name", "field", "of", "the", "target", "table", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopListFilterBundle/objects/db/ListfilterItems/TPkgShopListfilterItemMultiselect.class.php#L207-L225
32,305
chameleon-system/chameleon-shop
src/AmazonPaymentBundle/pkgShop/AmazonPaymentHandler.php
AmazonPaymentHandler.isCaptureOnShipment
public function isCaptureOnShipment() { $isPaymentOnShipmentStored = $this->GetUserPaymentDataItem(self::PARAMETER_IS_PAYMENT_ON_SHIPMENT); if (false !== $isPaymentOnShipmentStored) { return '1' === $isPaymentOnShipmentStored; } $config = $this->getAmazonPaymentGroupConfig($this->getActivePortalId()); return $config->isCaptureOnShipment(); }
php
public function isCaptureOnShipment() { $isPaymentOnShipmentStored = $this->GetUserPaymentDataItem(self::PARAMETER_IS_PAYMENT_ON_SHIPMENT); if (false !== $isPaymentOnShipmentStored) { return '1' === $isPaymentOnShipmentStored; } $config = $this->getAmazonPaymentGroupConfig($this->getActivePortalId()); return $config->isCaptureOnShipment(); }
[ "public", "function", "isCaptureOnShipment", "(", ")", "{", "$", "isPaymentOnShipmentStored", "=", "$", "this", "->", "GetUserPaymentDataItem", "(", "self", "::", "PARAMETER_IS_PAYMENT_ON_SHIPMENT", ")", ";", "if", "(", "false", "!==", "$", "isPaymentOnShipmentStored", ")", "{", "return", "'1'", "===", "$", "isPaymentOnShipmentStored", ";", "}", "$", "config", "=", "$", "this", "->", "getAmazonPaymentGroupConfig", "(", "$", "this", "->", "getActivePortalId", "(", ")", ")", ";", "return", "$", "config", "->", "isCaptureOnShipment", "(", ")", ";", "}" ]
return true if capture on shipment is active. @return bool
[ "return", "true", "if", "capture", "on", "shipment", "is", "active", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/pkgShop/AmazonPaymentHandler.php#L130-L140
32,306
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopDiscountList.class.php
TShopDiscountList.GetActiveDiscountList
public static function GetActiveDiscountList($sFilter = null, $sOrder = '`shop_discount`.`position`') { static $aActiveDiscountList = array(); $aKey = array('sFilter' => $sFilter, 'sOrder' => $sOrder); $sKey = TCacheManager::GetKey($aKey); if (!array_key_exists($sKey, $aActiveDiscountList)) { $now = MySqlLegacySupport::getInstance()->real_escape_string(date('Y-m-d H:i:s')); if (!empty($sOrder)) { $sOrder = "ORDER BY {$sOrder}"; } if (is_null($sFilter)) { $sFilter = ''; } else { $sFilter = " AND ({$sFilter})"; } $query = "SELECT * FROM `shop_discount` WHERE `shop_discount`.`active` = '1' AND (`shop_discount`.`active_from` <= '{$now}' AND (`shop_discount`.`active_to` >= '{$now}' || `shop_discount`.`active_to` = '0000-00-00 00:00:00')) {$sFilter} {$sOrder} "; $aActiveDiscountList[$sKey] = parent::GetList($query); $aActiveDiscountList[$sKey]->bAllowItemCache = true; } else { $aActiveDiscountList[$sKey]->GoToStart(); } return $aActiveDiscountList[$sKey]; }
php
public static function GetActiveDiscountList($sFilter = null, $sOrder = '`shop_discount`.`position`') { static $aActiveDiscountList = array(); $aKey = array('sFilter' => $sFilter, 'sOrder' => $sOrder); $sKey = TCacheManager::GetKey($aKey); if (!array_key_exists($sKey, $aActiveDiscountList)) { $now = MySqlLegacySupport::getInstance()->real_escape_string(date('Y-m-d H:i:s')); if (!empty($sOrder)) { $sOrder = "ORDER BY {$sOrder}"; } if (is_null($sFilter)) { $sFilter = ''; } else { $sFilter = " AND ({$sFilter})"; } $query = "SELECT * FROM `shop_discount` WHERE `shop_discount`.`active` = '1' AND (`shop_discount`.`active_from` <= '{$now}' AND (`shop_discount`.`active_to` >= '{$now}' || `shop_discount`.`active_to` = '0000-00-00 00:00:00')) {$sFilter} {$sOrder} "; $aActiveDiscountList[$sKey] = parent::GetList($query); $aActiveDiscountList[$sKey]->bAllowItemCache = true; } else { $aActiveDiscountList[$sKey]->GoToStart(); } return $aActiveDiscountList[$sKey]; }
[ "public", "static", "function", "GetActiveDiscountList", "(", "$", "sFilter", "=", "null", ",", "$", "sOrder", "=", "'`shop_discount`.`position`'", ")", "{", "static", "$", "aActiveDiscountList", "=", "array", "(", ")", ";", "$", "aKey", "=", "array", "(", "'sFilter'", "=>", "$", "sFilter", ",", "'sOrder'", "=>", "$", "sOrder", ")", ";", "$", "sKey", "=", "TCacheManager", "::", "GetKey", "(", "$", "aKey", ")", ";", "if", "(", "!", "array_key_exists", "(", "$", "sKey", ",", "$", "aActiveDiscountList", ")", ")", "{", "$", "now", "=", "MySqlLegacySupport", "::", "getInstance", "(", ")", "->", "real_escape_string", "(", "date", "(", "'Y-m-d H:i:s'", ")", ")", ";", "if", "(", "!", "empty", "(", "$", "sOrder", ")", ")", "{", "$", "sOrder", "=", "\"ORDER BY {$sOrder}\"", ";", "}", "if", "(", "is_null", "(", "$", "sFilter", ")", ")", "{", "$", "sFilter", "=", "''", ";", "}", "else", "{", "$", "sFilter", "=", "\" AND ({$sFilter})\"", ";", "}", "$", "query", "=", "\"SELECT *\n FROM `shop_discount`\n WHERE `shop_discount`.`active` = '1'\n AND (`shop_discount`.`active_from` <= '{$now}' AND (`shop_discount`.`active_to` >= '{$now}' || `shop_discount`.`active_to` = '0000-00-00 00:00:00'))\n {$sFilter}\n {$sOrder}\n \"", ";", "$", "aActiveDiscountList", "[", "$", "sKey", "]", "=", "parent", "::", "GetList", "(", "$", "query", ")", ";", "$", "aActiveDiscountList", "[", "$", "sKey", "]", "->", "bAllowItemCache", "=", "true", ";", "}", "else", "{", "$", "aActiveDiscountList", "[", "$", "sKey", "]", "->", "GoToStart", "(", ")", ";", "}", "return", "$", "aActiveDiscountList", "[", "$", "sKey", "]", ";", "}" ]
return all discounts that are currently set to active. @param string $sFilter @param string $sOrder @return TdbShopDiscountList
[ "return", "all", "discounts", "that", "are", "currently", "set", "to", "active", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopDiscountList.class.php#L22-L51
32,307
comporu/compo-core
src/Compo/ImportBundle/Exporter/Writer/XmlExcelWriter.php
XmlExcelWriter.init
protected function init($data) { $i = 0; foreach ($data as $header => $value) { $column = self::formatColumnName($i); $this->setHeader($column, $header); ++$i; } $this->setBoldLabels(); }
php
protected function init($data) { $i = 0; foreach ($data as $header => $value) { $column = self::formatColumnName($i); $this->setHeader($column, $header); ++$i; } $this->setBoldLabels(); }
[ "protected", "function", "init", "(", "$", "data", ")", "{", "$", "i", "=", "0", ";", "foreach", "(", "$", "data", "as", "$", "header", "=>", "$", "value", ")", "{", "$", "column", "=", "self", "::", "formatColumnName", "(", "$", "i", ")", ";", "$", "this", "->", "setHeader", "(", "$", "column", ",", "$", "header", ")", ";", "++", "$", "i", ";", "}", "$", "this", "->", "setBoldLabels", "(", ")", ";", "}" ]
Set labels. @param array $data
[ "Set", "labels", "." ]
ebaa9fe8a4b831506c78fdf637da6b4deadec1e2
https://github.com/comporu/compo-core/blob/ebaa9fe8a4b831506c78fdf637da6b4deadec1e2/src/Compo/ImportBundle/Exporter/Writer/XmlExcelWriter.php#L121-L131
32,308
comporu/compo-core
src/Compo/ImportBundle/Exporter/Writer/XmlExcelWriter.php
XmlExcelWriter.close
public function close() { $writer = IOFactory::createWriter($this->phpExcelObject, 'Xlsx'); //\PHPExcel_IOFactory::createWriter($this->phpExcelObject, 'Excel2007'); $writer->save($this->filename); }
php
public function close() { $writer = IOFactory::createWriter($this->phpExcelObject, 'Xlsx'); //\PHPExcel_IOFactory::createWriter($this->phpExcelObject, 'Excel2007'); $writer->save($this->filename); }
[ "public", "function", "close", "(", ")", "{", "$", "writer", "=", "IOFactory", "::", "createWriter", "(", "$", "this", "->", "phpExcelObject", ",", "'Xlsx'", ")", ";", "//\\PHPExcel_IOFactory::createWriter($this->phpExcelObject, 'Excel2007');", "$", "writer", "->", "save", "(", "$", "this", "->", "filename", ")", ";", "}" ]
Save Excel file.
[ "Save", "Excel", "file", "." ]
ebaa9fe8a4b831506c78fdf637da6b4deadec1e2
https://github.com/comporu/compo-core/blob/ebaa9fe8a4b831506c78fdf637da6b4deadec1e2/src/Compo/ImportBundle/Exporter/Writer/XmlExcelWriter.php#L136-L141
32,309
comporu/compo-core
src/Compo/ImportBundle/Exporter/Writer/XmlExcelWriter.php
XmlExcelWriter.formatColumnName
public static function formatColumnName($number) { for ($char = ''; $number >= 0; $number = (int) ($number / 26) - 1) { $char = \chr($number % 26 + 0x41) . $char; } return $char; }
php
public static function formatColumnName($number) { for ($char = ''; $number >= 0; $number = (int) ($number / 26) - 1) { $char = \chr($number % 26 + 0x41) . $char; } return $char; }
[ "public", "static", "function", "formatColumnName", "(", "$", "number", ")", "{", "for", "(", "$", "char", "=", "''", ";", "$", "number", ">=", "0", ";", "$", "number", "=", "(", "int", ")", "(", "$", "number", "/", "26", ")", "-", "1", ")", "{", "$", "char", "=", "\\", "chr", "(", "$", "number", "%", "26", "+", "0x41", ")", ".", "$", "char", ";", "}", "return", "$", "char", ";", "}" ]
Returns letter for number based on Excel columns. @param int $number @return string
[ "Returns", "letter", "for", "number", "based", "on", "Excel", "columns", "." ]
ebaa9fe8a4b831506c78fdf637da6b4deadec1e2
https://github.com/comporu/compo-core/blob/ebaa9fe8a4b831506c78fdf637da6b4deadec1e2/src/Compo/ImportBundle/Exporter/Writer/XmlExcelWriter.php#L150-L157
32,310
comporu/compo-core
src/Compo/ImportBundle/Exporter/Writer/XmlExcelWriter.php
XmlExcelWriter.setBoldLabels
private function setBoldLabels() { $this->getActiveSheet()->getStyle( sprintf( '%s1:%s1', reset($this->headerColumns), end($this->headerColumns) ) )->getFont()->setBold(true); }
php
private function setBoldLabels() { $this->getActiveSheet()->getStyle( sprintf( '%s1:%s1', reset($this->headerColumns), end($this->headerColumns) ) )->getFont()->setBold(true); }
[ "private", "function", "setBoldLabels", "(", ")", "{", "$", "this", "->", "getActiveSheet", "(", ")", "->", "getStyle", "(", "sprintf", "(", "'%s1:%s1'", ",", "reset", "(", "$", "this", "->", "headerColumns", ")", ",", "end", "(", "$", "this", "->", "headerColumns", ")", ")", ")", "->", "getFont", "(", ")", "->", "setBold", "(", "true", ")", ";", "}" ]
Makes header bold.
[ "Makes", "header", "bold", "." ]
ebaa9fe8a4b831506c78fdf637da6b4deadec1e2
https://github.com/comporu/compo-core/blob/ebaa9fe8a4b831506c78fdf637da6b4deadec1e2/src/Compo/ImportBundle/Exporter/Writer/XmlExcelWriter.php#L170-L179
32,311
comporu/compo-core
src/Compo/ImportBundle/Exporter/Writer/XmlExcelWriter.php
XmlExcelWriter.setCellValue
private function setCellValue($column, $value) { $cellValue = $value; if (\is_bool($value)) { if ($value) { $cellValue = 1; } else { $cellValue = 0; } } $this->getActiveSheet()->setCellValue($column, $cellValue); }
php
private function setCellValue($column, $value) { $cellValue = $value; if (\is_bool($value)) { if ($value) { $cellValue = 1; } else { $cellValue = 0; } } $this->getActiveSheet()->setCellValue($column, $cellValue); }
[ "private", "function", "setCellValue", "(", "$", "column", ",", "$", "value", ")", "{", "$", "cellValue", "=", "$", "value", ";", "if", "(", "\\", "is_bool", "(", "$", "value", ")", ")", "{", "if", "(", "$", "value", ")", "{", "$", "cellValue", "=", "1", ";", "}", "else", "{", "$", "cellValue", "=", "0", ";", "}", "}", "$", "this", "->", "getActiveSheet", "(", ")", "->", "setCellValue", "(", "$", "column", ",", "$", "cellValue", ")", ";", "}" ]
Sets cell value. @param string $column @param string|bool $value
[ "Sets", "cell", "value", "." ]
ebaa9fe8a4b831506c78fdf637da6b4deadec1e2
https://github.com/comporu/compo-core/blob/ebaa9fe8a4b831506c78fdf637da6b4deadec1e2/src/Compo/ImportBundle/Exporter/Writer/XmlExcelWriter.php#L187-L200
32,312
comporu/compo-core
src/Compo/ImportBundle/Exporter/Writer/XmlExcelWriter.php
XmlExcelWriter.setHeader
private function setHeader($column, $value) { $this->setCellValue($column . self::LABEL_COLUMN, $value); $this->getActiveSheet()->getColumnDimension($column)->setAutoSize(true); $this->headerColumns[$value] = $column; }
php
private function setHeader($column, $value) { $this->setCellValue($column . self::LABEL_COLUMN, $value); $this->getActiveSheet()->getColumnDimension($column)->setAutoSize(true); $this->headerColumns[$value] = $column; }
[ "private", "function", "setHeader", "(", "$", "column", ",", "$", "value", ")", "{", "$", "this", "->", "setCellValue", "(", "$", "column", ".", "self", "::", "LABEL_COLUMN", ",", "$", "value", ")", ";", "$", "this", "->", "getActiveSheet", "(", ")", "->", "getColumnDimension", "(", "$", "column", ")", "->", "setAutoSize", "(", "true", ")", ";", "$", "this", "->", "headerColumns", "[", "$", "value", "]", "=", "$", "column", ";", "}" ]
Set column label and make column auto size. @param string $column @param string $value
[ "Set", "column", "label", "and", "make", "column", "auto", "size", "." ]
ebaa9fe8a4b831506c78fdf637da6b4deadec1e2
https://github.com/comporu/compo-core/blob/ebaa9fe8a4b831506c78fdf637da6b4deadec1e2/src/Compo/ImportBundle/Exporter/Writer/XmlExcelWriter.php#L208-L213
32,313
chameleon-system/chameleon-shop
src/ShopBundle/objects/TCMSTableEditor/TCMSShopTableEditor_ShopArticle.class.php
TCMSShopTableEditor_ShopArticle.ProcessFieldsBeforeDisplay
public function ProcessFieldsBeforeDisplay(&$oFields) { /** @var TdbShopArticle $product */ $product = $this->oTable; if ($product->IsVariant()) { $oParent = &$product->GetFieldVariantParent(); if (null != $oParent) { $oVariantSet = &$oParent->GetFieldShopVariantSet(); if (!is_null($oVariantSet)) { $aPermittedFields = $oVariantSet->GetMLTIdList('cms_field_conf', 'cms_field_conf_mlt'); $oPermittedFields = new TIterator(); $oFields->GoToStart(); while ($oField = $oFields->Next()) { /** @var $oField TCMSField */ if (in_array($oField->oDefinition->id, $aPermittedFields)) { $oPermittedFields->AddItem($oField); } } $oFields = $oPermittedFields; } } } }
php
public function ProcessFieldsBeforeDisplay(&$oFields) { /** @var TdbShopArticle $product */ $product = $this->oTable; if ($product->IsVariant()) { $oParent = &$product->GetFieldVariantParent(); if (null != $oParent) { $oVariantSet = &$oParent->GetFieldShopVariantSet(); if (!is_null($oVariantSet)) { $aPermittedFields = $oVariantSet->GetMLTIdList('cms_field_conf', 'cms_field_conf_mlt'); $oPermittedFields = new TIterator(); $oFields->GoToStart(); while ($oField = $oFields->Next()) { /** @var $oField TCMSField */ if (in_array($oField->oDefinition->id, $aPermittedFields)) { $oPermittedFields->AddItem($oField); } } $oFields = $oPermittedFields; } } } }
[ "public", "function", "ProcessFieldsBeforeDisplay", "(", "&", "$", "oFields", ")", "{", "/** @var TdbShopArticle $product */", "$", "product", "=", "$", "this", "->", "oTable", ";", "if", "(", "$", "product", "->", "IsVariant", "(", ")", ")", "{", "$", "oParent", "=", "&", "$", "product", "->", "GetFieldVariantParent", "(", ")", ";", "if", "(", "null", "!=", "$", "oParent", ")", "{", "$", "oVariantSet", "=", "&", "$", "oParent", "->", "GetFieldShopVariantSet", "(", ")", ";", "if", "(", "!", "is_null", "(", "$", "oVariantSet", ")", ")", "{", "$", "aPermittedFields", "=", "$", "oVariantSet", "->", "GetMLTIdList", "(", "'cms_field_conf'", ",", "'cms_field_conf_mlt'", ")", ";", "$", "oPermittedFields", "=", "new", "TIterator", "(", ")", ";", "$", "oFields", "->", "GoToStart", "(", ")", ";", "while", "(", "$", "oField", "=", "$", "oFields", "->", "Next", "(", ")", ")", "{", "/** @var $oField TCMSField */", "if", "(", "in_array", "(", "$", "oField", "->", "oDefinition", "->", "id", ",", "$", "aPermittedFields", ")", ")", "{", "$", "oPermittedFields", "->", "AddItem", "(", "$", "oField", ")", ";", "}", "}", "$", "oFields", "=", "$", "oPermittedFields", ";", "}", "}", "}", "}" ]
if the current article is a variant AND a variant set has been defined, then mark all fields as hidden that are NOT activated through the set. @param TIterator $oFields
[ "if", "the", "current", "article", "is", "a", "variant", "AND", "a", "variant", "set", "has", "been", "defined", "then", "mark", "all", "fields", "as", "hidden", "that", "are", "NOT", "activated", "through", "the", "set", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TCMSTableEditor/TCMSShopTableEditor_ShopArticle.class.php#L26-L48
32,314
chameleon-system/chameleon-shop
src/ShopBundle/objects/TCMSTableEditor/TCMSShopTableEditor_ShopArticle.class.php
TCMSShopTableEditor_ShopArticle.PrepareDataForSave
protected function PrepareDataForSave($postData) { if (array_key_exists('active', $postData)) { if (!array_key_exists('variant_parent_id', $postData) || empty($postData['variant_parent_id'])) { $postData['variant_parent_is_active'] = $postData['active']; } } return $postData; }
php
protected function PrepareDataForSave($postData) { if (array_key_exists('active', $postData)) { if (!array_key_exists('variant_parent_id', $postData) || empty($postData['variant_parent_id'])) { $postData['variant_parent_is_active'] = $postData['active']; } } return $postData; }
[ "protected", "function", "PrepareDataForSave", "(", "$", "postData", ")", "{", "if", "(", "array_key_exists", "(", "'active'", ",", "$", "postData", ")", ")", "{", "if", "(", "!", "array_key_exists", "(", "'variant_parent_id'", ",", "$", "postData", ")", "||", "empty", "(", "$", "postData", "[", "'variant_parent_id'", "]", ")", ")", "{", "$", "postData", "[", "'variant_parent_is_active'", "]", "=", "$", "postData", "[", "'active'", "]", ";", "}", "}", "return", "$", "postData", ";", "}" ]
here you can modify, clean or filter data before saving. @var array $postData @return array
[ "here", "you", "can", "modify", "clean", "or", "filter", "data", "before", "saving", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TCMSTableEditor/TCMSShopTableEditor_ShopArticle.class.php#L148-L157
32,315
chameleon-system/chameleon-shop
src/ShopBundle/objects/TCMSTableEditor/TCMSShopTableEditor_ShopArticle.class.php
TCMSShopTableEditor_ShopArticle.isNewVariant
protected function isNewVariant() { $bIsNewVariant = false; if (!is_null($this->sRestriction) && !is_null($this->sRestrictionField) && '_id' == substr($this->sRestrictionField, -3)) { if ('variant_parent_id' == $this->sRestrictionField) { $bIsNewVariant = true; } } return $bIsNewVariant; }
php
protected function isNewVariant() { $bIsNewVariant = false; if (!is_null($this->sRestriction) && !is_null($this->sRestrictionField) && '_id' == substr($this->sRestrictionField, -3)) { if ('variant_parent_id' == $this->sRestrictionField) { $bIsNewVariant = true; } } return $bIsNewVariant; }
[ "protected", "function", "isNewVariant", "(", ")", "{", "$", "bIsNewVariant", "=", "false", ";", "if", "(", "!", "is_null", "(", "$", "this", "->", "sRestriction", ")", "&&", "!", "is_null", "(", "$", "this", "->", "sRestrictionField", ")", "&&", "'_id'", "==", "substr", "(", "$", "this", "->", "sRestrictionField", ",", "-", "3", ")", ")", "{", "if", "(", "'variant_parent_id'", "==", "$", "this", "->", "sRestrictionField", ")", "{", "$", "bIsNewVariant", "=", "true", ";", "}", "}", "return", "$", "bIsNewVariant", ";", "}" ]
determine if the current loaded record is a variant or a parent. @return bool
[ "determine", "if", "the", "current", "loaded", "record", "is", "a", "variant", "or", "a", "parent", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TCMSTableEditor/TCMSShopTableEditor_ShopArticle.class.php#L164-L174
32,316
chameleon-system/chameleon-shop
src/ShopBundle/objects/TCMSTableEditor/TCMSShopTableEditor_ShopArticle.class.php
TCMSShopTableEditor_ShopArticle.Insert
public function Insert() { if ($this->isNewVariant()) { $this->sId = $this->sRestriction; $variant = $this->DatabaseCopy(); /** @var TdbShopArticle $product */ $product = $this->oTable; if (!$product->fieldActive) { $variantTableEditor = TTools::GetTableEditorManager('shop_article', $variant->id); $variantTableEditor->SaveField('variant_parent_is_active', '0'); } } else { parent::Insert(); } }
php
public function Insert() { if ($this->isNewVariant()) { $this->sId = $this->sRestriction; $variant = $this->DatabaseCopy(); /** @var TdbShopArticle $product */ $product = $this->oTable; if (!$product->fieldActive) { $variantTableEditor = TTools::GetTableEditorManager('shop_article', $variant->id); $variantTableEditor->SaveField('variant_parent_is_active', '0'); } } else { parent::Insert(); } }
[ "public", "function", "Insert", "(", ")", "{", "if", "(", "$", "this", "->", "isNewVariant", "(", ")", ")", "{", "$", "this", "->", "sId", "=", "$", "this", "->", "sRestriction", ";", "$", "variant", "=", "$", "this", "->", "DatabaseCopy", "(", ")", ";", "/** @var TdbShopArticle $product */", "$", "product", "=", "$", "this", "->", "oTable", ";", "if", "(", "!", "$", "product", "->", "fieldActive", ")", "{", "$", "variantTableEditor", "=", "TTools", "::", "GetTableEditorManager", "(", "'shop_article'", ",", "$", "variant", "->", "id", ")", ";", "$", "variantTableEditor", "->", "SaveField", "(", "'variant_parent_is_active'", ",", "'0'", ")", ";", "}", "}", "else", "{", "parent", "::", "Insert", "(", ")", ";", "}", "}" ]
we overwrite the insert method, so that when inserting variants, we realy perform a copy of the parent.
[ "we", "overwrite", "the", "insert", "method", "so", "that", "when", "inserting", "variants", "we", "realy", "perform", "a", "copy", "of", "the", "parent", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TCMSTableEditor/TCMSShopTableEditor_ShopArticle.class.php#L180-L194
32,317
chameleon-system/chameleon-shop
src/ShopBundle/objects/TCMSTableEditor/TCMSShopTableEditor_ShopArticle.class.php
TCMSShopTableEditor_ShopArticle.CopyPropertyRecords
public function CopyPropertyRecords($oField, $sourceRecordID) { if (!$this->isNewVariant() || 'shop_article_variants' != $oField->name) { parent::CopyPropertyRecords($oField, $sourceRecordID); } }
php
public function CopyPropertyRecords($oField, $sourceRecordID) { if (!$this->isNewVariant() || 'shop_article_variants' != $oField->name) { parent::CopyPropertyRecords($oField, $sourceRecordID); } }
[ "public", "function", "CopyPropertyRecords", "(", "$", "oField", ",", "$", "sourceRecordID", ")", "{", "if", "(", "!", "$", "this", "->", "isNewVariant", "(", ")", "||", "'shop_article_variants'", "!=", "$", "oField", "->", "name", ")", "{", "parent", "::", "CopyPropertyRecords", "(", "$", "oField", ",", "$", "sourceRecordID", ")", ";", "}", "}" ]
if we are creating a variant, do NOT copy the parents variants. @param TCMSField $oField @param int $sourceRecordID
[ "if", "we", "are", "creating", "a", "variant", "do", "NOT", "copy", "the", "parents", "variants", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TCMSTableEditor/TCMSShopTableEditor_ShopArticle.class.php#L210-L215
32,318
chameleon-system/chameleon-shop
src/ShopBundle/objects/TCMSTableEditor/TCMSShopTableEditor_ShopArticle.class.php
TCMSShopTableEditor_ShopArticle.UpdatePriceToLowestVariant
public function UpdatePriceToLowestVariant() { /** @var TdbShopArticle $product */ $product = $this->oTable; $oLowestPriceVariant = $product->GetLowestPricedVariant(); if ($oLowestPriceVariant) { $aData = array('price' => $oLowestPriceVariant->fieldPriceFormated, 'price_reference' => $oLowestPriceVariant->fieldPriceReferenceFormated); $this->SaveFields($aData, false); } }
php
public function UpdatePriceToLowestVariant() { /** @var TdbShopArticle $product */ $product = $this->oTable; $oLowestPriceVariant = $product->GetLowestPricedVariant(); if ($oLowestPriceVariant) { $aData = array('price' => $oLowestPriceVariant->fieldPriceFormated, 'price_reference' => $oLowestPriceVariant->fieldPriceReferenceFormated); $this->SaveFields($aData, false); } }
[ "public", "function", "UpdatePriceToLowestVariant", "(", ")", "{", "/** @var TdbShopArticle $product */", "$", "product", "=", "$", "this", "->", "oTable", ";", "$", "oLowestPriceVariant", "=", "$", "product", "->", "GetLowestPricedVariant", "(", ")", ";", "if", "(", "$", "oLowestPriceVariant", ")", "{", "$", "aData", "=", "array", "(", "'price'", "=>", "$", "oLowestPriceVariant", "->", "fieldPriceFormated", ",", "'price_reference'", "=>", "$", "oLowestPriceVariant", "->", "fieldPriceReferenceFormated", ")", ";", "$", "this", "->", "SaveFields", "(", "$", "aData", ",", "false", ")", ";", "}", "}" ]
changes price of parent article to lowest variant.
[ "changes", "price", "of", "parent", "article", "to", "lowest", "variant", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TCMSTableEditor/TCMSShopTableEditor_ShopArticle.class.php#L220-L229
32,319
belgattitude/soluble-dbwrapper
src/Soluble/DbWrapper/AdapterFactory.php
AdapterFactory.createAdapterFromResource
public static function createAdapterFromResource($resource) { if (is_scalar($resource) || is_array($resource)) { throw new Exception\InvalidArgumentException("Resource param must be a valid 'resource' link (mysqli, pdo)"); } if ($resource instanceof \PDO) { $adapter = self::getAdapterFromPdo($resource); } elseif (extension_loaded('mysqli') && $resource instanceof \mysqli) { $adapter = new Adapter\MysqliAdapter($resource); } else { throw new Exception\InvalidArgumentException('Resource must be a valid connection link, like PDO or mysqli'); } return $adapter; }
php
public static function createAdapterFromResource($resource) { if (is_scalar($resource) || is_array($resource)) { throw new Exception\InvalidArgumentException("Resource param must be a valid 'resource' link (mysqli, pdo)"); } if ($resource instanceof \PDO) { $adapter = self::getAdapterFromPdo($resource); } elseif (extension_loaded('mysqli') && $resource instanceof \mysqli) { $adapter = new Adapter\MysqliAdapter($resource); } else { throw new Exception\InvalidArgumentException('Resource must be a valid connection link, like PDO or mysqli'); } return $adapter; }
[ "public", "static", "function", "createAdapterFromResource", "(", "$", "resource", ")", "{", "if", "(", "is_scalar", "(", "$", "resource", ")", "||", "is_array", "(", "$", "resource", ")", ")", "{", "throw", "new", "Exception", "\\", "InvalidArgumentException", "(", "\"Resource param must be a valid 'resource' link (mysqli, pdo)\"", ")", ";", "}", "if", "(", "$", "resource", "instanceof", "\\", "PDO", ")", "{", "$", "adapter", "=", "self", "::", "getAdapterFromPdo", "(", "$", "resource", ")", ";", "}", "elseif", "(", "extension_loaded", "(", "'mysqli'", ")", "&&", "$", "resource", "instanceof", "\\", "mysqli", ")", "{", "$", "adapter", "=", "new", "Adapter", "\\", "MysqliAdapter", "(", "$", "resource", ")", ";", "}", "else", "{", "throw", "new", "Exception", "\\", "InvalidArgumentException", "(", "'Resource must be a valid connection link, like PDO or mysqli'", ")", ";", "}", "return", "$", "adapter", ";", "}" ]
Create adapter from an existing connection resource. @param mixed $resource database connection object (mysqli, pdo_mysql,...) @throws Exception\InvalidArgumentException @throws Exception\UnsupportedDriverException @return Adapter\AdapterInterface
[ "Create", "adapter", "from", "an", "existing", "connection", "resource", "." ]
d2ba7b8855521613178246d2b66d8a7287706747
https://github.com/belgattitude/soluble-dbwrapper/blob/d2ba7b8855521613178246d2b66d8a7287706747/src/Soluble/DbWrapper/AdapterFactory.php#L55-L69
32,320
belgattitude/soluble-dbwrapper
src/Soluble/DbWrapper/AdapterFactory.php
AdapterFactory.getAdapterFromPdo
protected static function getAdapterFromPdo(\PDO $resource) { $driver = mb_strtolower($resource->getAttribute(\PDO::ATTR_DRIVER_NAME)); switch ($driver) { case 'mysql': $adapter = new Adapter\PdoMysqlAdapter($resource); break; case 'sqlite': $adapter = new Adapter\PdoSqliteAdapter($resource); break; default: $msg = "Driver 'PDO_$driver' is not currently supported."; throw new Exception\UnsupportedDriverException($msg); } return $adapter; }
php
protected static function getAdapterFromPdo(\PDO $resource) { $driver = mb_strtolower($resource->getAttribute(\PDO::ATTR_DRIVER_NAME)); switch ($driver) { case 'mysql': $adapter = new Adapter\PdoMysqlAdapter($resource); break; case 'sqlite': $adapter = new Adapter\PdoSqliteAdapter($resource); break; default: $msg = "Driver 'PDO_$driver' is not currently supported."; throw new Exception\UnsupportedDriverException($msg); } return $adapter; }
[ "protected", "static", "function", "getAdapterFromPdo", "(", "\\", "PDO", "$", "resource", ")", "{", "$", "driver", "=", "mb_strtolower", "(", "$", "resource", "->", "getAttribute", "(", "\\", "PDO", "::", "ATTR_DRIVER_NAME", ")", ")", ";", "switch", "(", "$", "driver", ")", "{", "case", "'mysql'", ":", "$", "adapter", "=", "new", "Adapter", "\\", "PdoMysqlAdapter", "(", "$", "resource", ")", ";", "break", ";", "case", "'sqlite'", ":", "$", "adapter", "=", "new", "Adapter", "\\", "PdoSqliteAdapter", "(", "$", "resource", ")", ";", "break", ";", "default", ":", "$", "msg", "=", "\"Driver 'PDO_$driver' is not currently supported.\"", ";", "throw", "new", "Exception", "\\", "UnsupportedDriverException", "(", "$", "msg", ")", ";", "}", "return", "$", "adapter", ";", "}" ]
Get an adapter from an existing connection resource. @param \PDO $resource database connection object @throws Exception\UnsupportedDriverException @return Adapter\AdapterInterface
[ "Get", "an", "adapter", "from", "an", "existing", "connection", "resource", "." ]
d2ba7b8855521613178246d2b66d8a7287706747
https://github.com/belgattitude/soluble-dbwrapper/blob/d2ba7b8855521613178246d2b66d8a7287706747/src/Soluble/DbWrapper/AdapterFactory.php#L80-L96
32,321
sylingd/Yesf
src/Config/Adapter/Apollo.php
Apollo.getClient
protected function getClient($namespace) { $path = sprintf('%s/configs/%s/%s/%s?releaseKey=%s', $this->conf['path'], $this->conf['appid'], $this->conf['cluster'], $this->conf['namespace'], $this->last_key); if ($this->conf['with_ip']) { $cidr = Container::getInstance()->get(CIDRmatch::class); foreach (swoole_get_local_ip() as $v) { if ($cidr->match($v, $this->conf['with_ip'])) { $path .= '&ip=' . $v; break; } } } $cli = new Client($this->conf['host'], $this->conf['port']); $cli->set([ 'timeout' => 1 ]); $cli->setDefer(); $cli->get($path); return $cli; }
php
protected function getClient($namespace) { $path = sprintf('%s/configs/%s/%s/%s?releaseKey=%s', $this->conf['path'], $this->conf['appid'], $this->conf['cluster'], $this->conf['namespace'], $this->last_key); if ($this->conf['with_ip']) { $cidr = Container::getInstance()->get(CIDRmatch::class); foreach (swoole_get_local_ip() as $v) { if ($cidr->match($v, $this->conf['with_ip'])) { $path .= '&ip=' . $v; break; } } } $cli = new Client($this->conf['host'], $this->conf['port']); $cli->set([ 'timeout' => 1 ]); $cli->setDefer(); $cli->get($path); return $cli; }
[ "protected", "function", "getClient", "(", "$", "namespace", ")", "{", "$", "path", "=", "sprintf", "(", "'%s/configs/%s/%s/%s?releaseKey=%s'", ",", "$", "this", "->", "conf", "[", "'path'", "]", ",", "$", "this", "->", "conf", "[", "'appid'", "]", ",", "$", "this", "->", "conf", "[", "'cluster'", "]", ",", "$", "this", "->", "conf", "[", "'namespace'", "]", ",", "$", "this", "->", "last_key", ")", ";", "if", "(", "$", "this", "->", "conf", "[", "'with_ip'", "]", ")", "{", "$", "cidr", "=", "Container", "::", "getInstance", "(", ")", "->", "get", "(", "CIDRmatch", "::", "class", ")", ";", "foreach", "(", "swoole_get_local_ip", "(", ")", "as", "$", "v", ")", "{", "if", "(", "$", "cidr", "->", "match", "(", "$", "v", ",", "$", "this", "->", "conf", "[", "'with_ip'", "]", ")", ")", "{", "$", "path", ".=", "'&ip='", ".", "$", "v", ";", "break", ";", "}", "}", "}", "$", "cli", "=", "new", "Client", "(", "$", "this", "->", "conf", "[", "'host'", "]", ",", "$", "this", "->", "conf", "[", "'port'", "]", ")", ";", "$", "cli", "->", "set", "(", "[", "'timeout'", "=>", "1", "]", ")", ";", "$", "cli", "->", "setDefer", "(", ")", ";", "$", "cli", "->", "get", "(", "$", "path", ")", ";", "return", "$", "cli", ";", "}" ]
Get HTTP Client @access protected @param string $namespace @return object
[ "Get", "HTTP", "Client" ]
0fc2b42903bb3519c54c596270c890c826aeb1df
https://github.com/sylingd/Yesf/blob/0fc2b42903bb3519c54c596270c890c826aeb1df/src/Config/Adapter/Apollo.php#L76-L99
32,322
sylingd/Yesf
src/Config/Adapter/Apollo.php
Apollo.update
protected function update($namespace, $config) { foreach ($config as $k => $v) { if (strpos($k, '.') === false) { $this->cache[$namespace][$k] = $v; continue; } $keys = explode('.', $k); $total = count($keys) - 1; $parent = &$this->cache[$namespace]; foreach ($keys as $kk => $vv) { if ($total === $kk) { $parent[$vv] = $v; } else { if (!isset($parent[$vv])) { $parent[$vv] = []; } $parent = &$parent[$vv]; } } } }
php
protected function update($namespace, $config) { foreach ($config as $k => $v) { if (strpos($k, '.') === false) { $this->cache[$namespace][$k] = $v; continue; } $keys = explode('.', $k); $total = count($keys) - 1; $parent = &$this->cache[$namespace]; foreach ($keys as $kk => $vv) { if ($total === $kk) { $parent[$vv] = $v; } else { if (!isset($parent[$vv])) { $parent[$vv] = []; } $parent = &$parent[$vv]; } } } }
[ "protected", "function", "update", "(", "$", "namespace", ",", "$", "config", ")", "{", "foreach", "(", "$", "config", "as", "$", "k", "=>", "$", "v", ")", "{", "if", "(", "strpos", "(", "$", "k", ",", "'.'", ")", "===", "false", ")", "{", "$", "this", "->", "cache", "[", "$", "namespace", "]", "[", "$", "k", "]", "=", "$", "v", ";", "continue", ";", "}", "$", "keys", "=", "explode", "(", "'.'", ",", "$", "k", ")", ";", "$", "total", "=", "count", "(", "$", "keys", ")", "-", "1", ";", "$", "parent", "=", "&", "$", "this", "->", "cache", "[", "$", "namespace", "]", ";", "foreach", "(", "$", "keys", "as", "$", "kk", "=>", "$", "vv", ")", "{", "if", "(", "$", "total", "===", "$", "kk", ")", "{", "$", "parent", "[", "$", "vv", "]", "=", "$", "v", ";", "}", "else", "{", "if", "(", "!", "isset", "(", "$", "parent", "[", "$", "vv", "]", ")", ")", "{", "$", "parent", "[", "$", "vv", "]", "=", "[", "]", ";", "}", "$", "parent", "=", "&", "$", "parent", "[", "$", "vv", "]", ";", "}", "}", "}", "}" ]
Update cache with result @access protected @param string $namespace @param array $config
[ "Update", "cache", "with", "result" ]
0fc2b42903bb3519c54c596270c890c826aeb1df
https://github.com/sylingd/Yesf/blob/0fc2b42903bb3519c54c596270c890c826aeb1df/src/Config/Adapter/Apollo.php#L107-L127
32,323
sylingd/Yesf
src/Config/Adapter/Apollo.php
Apollo.refresh
public function refresh($force = false) { if (!$force && time() - $this->last_fetch < $this->config['refresh_interval']) { return; } $clis = []; foreach ($this->conf['namespace'] as $v) { $clis[] = $this->getClient($v); } foreach ($clis as $cli) { $cli->recv(); if ($cli->statusCode === 304) { continue; } $res = json_decode($cli->body, true); $ns = $res['namespaceName']; $this->last_key[$ns] = $res['releaseKey']; $this->update($ns, $res['configurations']); } $this->last_fetch = time(); }
php
public function refresh($force = false) { if (!$force && time() - $this->last_fetch < $this->config['refresh_interval']) { return; } $clis = []; foreach ($this->conf['namespace'] as $v) { $clis[] = $this->getClient($v); } foreach ($clis as $cli) { $cli->recv(); if ($cli->statusCode === 304) { continue; } $res = json_decode($cli->body, true); $ns = $res['namespaceName']; $this->last_key[$ns] = $res['releaseKey']; $this->update($ns, $res['configurations']); } $this->last_fetch = time(); }
[ "public", "function", "refresh", "(", "$", "force", "=", "false", ")", "{", "if", "(", "!", "$", "force", "&&", "time", "(", ")", "-", "$", "this", "->", "last_fetch", "<", "$", "this", "->", "config", "[", "'refresh_interval'", "]", ")", "{", "return", ";", "}", "$", "clis", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "conf", "[", "'namespace'", "]", "as", "$", "v", ")", "{", "$", "clis", "[", "]", "=", "$", "this", "->", "getClient", "(", "$", "v", ")", ";", "}", "foreach", "(", "$", "clis", "as", "$", "cli", ")", "{", "$", "cli", "->", "recv", "(", ")", ";", "if", "(", "$", "cli", "->", "statusCode", "===", "304", ")", "{", "continue", ";", "}", "$", "res", "=", "json_decode", "(", "$", "cli", "->", "body", ",", "true", ")", ";", "$", "ns", "=", "$", "res", "[", "'namespaceName'", "]", ";", "$", "this", "->", "last_key", "[", "$", "ns", "]", "=", "$", "res", "[", "'releaseKey'", "]", ";", "$", "this", "->", "update", "(", "$", "ns", ",", "$", "res", "[", "'configurations'", "]", ")", ";", "}", "$", "this", "->", "last_fetch", "=", "time", "(", ")", ";", "}" ]
Refresh all configs @access public @param bool $force Is force refresh or not
[ "Refresh", "all", "configs" ]
0fc2b42903bb3519c54c596270c890c826aeb1df
https://github.com/sylingd/Yesf/blob/0fc2b42903bb3519c54c596270c890c826aeb1df/src/Config/Adapter/Apollo.php#L134-L153
32,324
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerEasyCash/TShopPaymentHandlerEasyCash_Debit.class.php
TShopPaymentHandlerEasyCash_Debit.ConfirmEasyCashResponse
protected function ConfirmEasyCashResponse($sPayId, $sXID) { $bConfirmed = false; $aParam = array('PayID' => $sPayId, 'XID' => $sXID); $aResponse = $this->SendRequestToEasyCash(self::EASY_CASH_CONFIRM_PATH, $aParam); if (is_array($aResponse) && stristr($aResponse['header'], 'HTTP/1.1 200 OK')) { $bConfirmed = true; } else { TTools::WriteLogEntry("EasyCash ConfirmEasyCashResponse Error: UNABLE TO CONFIRM; sPayId: {$sPayId}; sXID: {$sXID}".print_r($aResponse, true), 1, __FILE__, __LINE__); } return $bConfirmed; }
php
protected function ConfirmEasyCashResponse($sPayId, $sXID) { $bConfirmed = false; $aParam = array('PayID' => $sPayId, 'XID' => $sXID); $aResponse = $this->SendRequestToEasyCash(self::EASY_CASH_CONFIRM_PATH, $aParam); if (is_array($aResponse) && stristr($aResponse['header'], 'HTTP/1.1 200 OK')) { $bConfirmed = true; } else { TTools::WriteLogEntry("EasyCash ConfirmEasyCashResponse Error: UNABLE TO CONFIRM; sPayId: {$sPayId}; sXID: {$sXID}".print_r($aResponse, true), 1, __FILE__, __LINE__); } return $bConfirmed; }
[ "protected", "function", "ConfirmEasyCashResponse", "(", "$", "sPayId", ",", "$", "sXID", ")", "{", "$", "bConfirmed", "=", "false", ";", "$", "aParam", "=", "array", "(", "'PayID'", "=>", "$", "sPayId", ",", "'XID'", "=>", "$", "sXID", ")", ";", "$", "aResponse", "=", "$", "this", "->", "SendRequestToEasyCash", "(", "self", "::", "EASY_CASH_CONFIRM_PATH", ",", "$", "aParam", ")", ";", "if", "(", "is_array", "(", "$", "aResponse", ")", "&&", "stristr", "(", "$", "aResponse", "[", "'header'", "]", ",", "'HTTP/1.1 200 OK'", ")", ")", "{", "$", "bConfirmed", "=", "true", ";", "}", "else", "{", "TTools", "::", "WriteLogEntry", "(", "\"EasyCash ConfirmEasyCashResponse Error: UNABLE TO CONFIRM; sPayId: {$sPayId}; sXID: {$sXID}\"", ".", "print_r", "(", "$", "aResponse", ",", "true", ")", ",", "1", ",", "__FILE__", ",", "__LINE__", ")", ";", "}", "return", "$", "bConfirmed", ";", "}" ]
returns true if the transaction confirmation was successfully send to EasyCash. @param $sPayId @param $sXID @return bool
[ "returns", "true", "if", "the", "transaction", "confirmation", "was", "successfully", "send", "to", "EasyCash", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerEasyCash/TShopPaymentHandlerEasyCash_Debit.class.php#L121-L133
32,325
chameleon-system/chameleon-shop
src/ShopPaymentIPNBundle/pkgShopPaymentTransaction/objects/TPkgShopPaymentIPN_TransactionDetails.class.php
TPkgShopPaymentIPN_TransactionDetails.getAdditionalData
public function getAdditionalData($key) { if (true === isset($this->additionalData[$key])) { return $this->additionalData[$key]; } return null; }
php
public function getAdditionalData($key) { if (true === isset($this->additionalData[$key])) { return $this->additionalData[$key]; } return null; }
[ "public", "function", "getAdditionalData", "(", "$", "key", ")", "{", "if", "(", "true", "===", "isset", "(", "$", "this", "->", "additionalData", "[", "$", "key", "]", ")", ")", "{", "return", "$", "this", "->", "additionalData", "[", "$", "key", "]", ";", "}", "return", "null", ";", "}" ]
here you can get additional data like the transaction id from the transaction details, If key not exists return null. @param $key @return mixed|null
[ "here", "you", "can", "get", "additional", "data", "like", "the", "transaction", "id", "from", "the", "transaction", "details", "If", "key", "not", "exists", "return", "null", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopPaymentIPNBundle/pkgShopPaymentTransaction/objects/TPkgShopPaymentIPN_TransactionDetails.class.php#L116-L123
32,326
PGB-LIV/php-ms
src/Core/ChargedMassTrait.php
ChargedMassTrait.setMonoisotopicMassCharge
public function setMonoisotopicMassCharge($massCharge, $charge) { $this->setMonoisotopicMass($this->getNeutralMass($massCharge, $charge)); $this->setCharge($charge); }
php
public function setMonoisotopicMassCharge($massCharge, $charge) { $this->setMonoisotopicMass($this->getNeutralMass($massCharge, $charge)); $this->setCharge($charge); }
[ "public", "function", "setMonoisotopicMassCharge", "(", "$", "massCharge", ",", "$", "charge", ")", "{", "$", "this", "->", "setMonoisotopicMass", "(", "$", "this", "->", "getNeutralMass", "(", "$", "massCharge", ",", "$", "charge", ")", ")", ";", "$", "this", "->", "setCharge", "(", "$", "charge", ")", ";", "}" ]
Sets the monoisotopic mass-to-charge ratio for this instance. @param float $massCharge The mass-to-charge ratio to set to @param int $charge The charge associated with the $massCharge @throws \InvalidArgumentException If $mz is not a valid floating point value
[ "Sets", "the", "monoisotopic", "mass", "-", "to", "-", "charge", "ratio", "for", "this", "instance", "." ]
091751eb12512f4bc6ada07bda745ce49331e24f
https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Core/ChargedMassTrait.php#L47-L51
32,327
PGB-LIV/php-ms
src/Core/ChargedMassTrait.php
ChargedMassTrait.setAverageMassCharge
public function setAverageMassCharge($massCharge, $charge) { $this->setAverageMass($this->getNeutralMass($massCharge, $charge)); $this->setCharge($charge); }
php
public function setAverageMassCharge($massCharge, $charge) { $this->setAverageMass($this->getNeutralMass($massCharge, $charge)); $this->setCharge($charge); }
[ "public", "function", "setAverageMassCharge", "(", "$", "massCharge", ",", "$", "charge", ")", "{", "$", "this", "->", "setAverageMass", "(", "$", "this", "->", "getNeutralMass", "(", "$", "massCharge", ",", "$", "charge", ")", ")", ";", "$", "this", "->", "setCharge", "(", "$", "charge", ")", ";", "}" ]
Sets the average mass-to-charge ratio for this instance @param float $massCharge The mass-to-charge ratio to set to @param int $charge The charge associated with the $massCharge @throws \InvalidArgumentException If $mz is not a valid floating point value
[ "Sets", "the", "average", "mass", "-", "to", "-", "charge", "ratio", "for", "this", "instance" ]
091751eb12512f4bc6ada07bda745ce49331e24f
https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Core/ChargedMassTrait.php#L62-L66
32,328
PGB-LIV/php-ms
src/Core/ChargedMassTrait.php
ChargedMassTrait.getMassCharge
public static function getMassCharge($mass, $charge) { if (! is_float($mass)) { throw new \InvalidArgumentException('Argument 1 must be of type float. Value is of type ' . gettype($mass)); } if (! is_int($charge)) { throw new \InvalidArgumentException('Argument 2 must be of type int. Value is of type ' . gettype($charge)); } if ($charge == 0) { return $mass; } return ($mass + ($charge * PhysicalConstants::PROTON_MASS)) / $charge; }
php
public static function getMassCharge($mass, $charge) { if (! is_float($mass)) { throw new \InvalidArgumentException('Argument 1 must be of type float. Value is of type ' . gettype($mass)); } if (! is_int($charge)) { throw new \InvalidArgumentException('Argument 2 must be of type int. Value is of type ' . gettype($charge)); } if ($charge == 0) { return $mass; } return ($mass + ($charge * PhysicalConstants::PROTON_MASS)) / $charge; }
[ "public", "static", "function", "getMassCharge", "(", "$", "mass", ",", "$", "charge", ")", "{", "if", "(", "!", "is_float", "(", "$", "mass", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Argument 1 must be of type float. Value is of type '", ".", "gettype", "(", "$", "mass", ")", ")", ";", "}", "if", "(", "!", "is_int", "(", "$", "charge", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Argument 2 must be of type int. Value is of type '", ".", "gettype", "(", "$", "charge", ")", ")", ";", "}", "if", "(", "$", "charge", "==", "0", ")", "{", "return", "$", "mass", ";", "}", "return", "(", "$", "mass", "+", "(", "$", "charge", "*", "PhysicalConstants", "::", "PROTON_MASS", ")", ")", "/", "$", "charge", ";", "}" ]
Gets the mass-to-charge value for the specified mass and charge @param float $mass @param int $charge @return float
[ "Gets", "the", "mass", "-", "to", "-", "charge", "value", "for", "the", "specified", "mass", "and", "charge" ]
091751eb12512f4bc6ada07bda745ce49331e24f
https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Core/ChargedMassTrait.php#L116-L131
32,329
PGB-LIV/php-ms
src/Core/ChargedMassTrait.php
ChargedMassTrait.getNeutralMass
public static function getNeutralMass($massCharge, $charge) { if (! is_float($massCharge)) { throw new \InvalidArgumentException( 'Argument 1 must be of type float. Value is of type ' . gettype($massCharge)); } if (! is_int($charge)) { throw new \InvalidArgumentException('Argument 2 must be of type int. Value is of type ' . gettype($charge)); } if ($charge == 0) { return $massCharge; } return ($massCharge * $charge) - (PhysicalConstants::PROTON_MASS * $charge); }
php
public static function getNeutralMass($massCharge, $charge) { if (! is_float($massCharge)) { throw new \InvalidArgumentException( 'Argument 1 must be of type float. Value is of type ' . gettype($massCharge)); } if (! is_int($charge)) { throw new \InvalidArgumentException('Argument 2 must be of type int. Value is of type ' . gettype($charge)); } if ($charge == 0) { return $massCharge; } return ($massCharge * $charge) - (PhysicalConstants::PROTON_MASS * $charge); }
[ "public", "static", "function", "getNeutralMass", "(", "$", "massCharge", ",", "$", "charge", ")", "{", "if", "(", "!", "is_float", "(", "$", "massCharge", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Argument 1 must be of type float. Value is of type '", ".", "gettype", "(", "$", "massCharge", ")", ")", ";", "}", "if", "(", "!", "is_int", "(", "$", "charge", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Argument 2 must be of type int. Value is of type '", ".", "gettype", "(", "$", "charge", ")", ")", ";", "}", "if", "(", "$", "charge", "==", "0", ")", "{", "return", "$", "massCharge", ";", "}", "return", "(", "$", "massCharge", "*", "$", "charge", ")", "-", "(", "PhysicalConstants", "::", "PROTON_MASS", "*", "$", "charge", ")", ";", "}" ]
gets the neutral mass for the specified mass-to-charge ratio and charge @param float $massCharge @param int $charge @throws \InvalidArgumentException @return float
[ "gets", "the", "neutral", "mass", "for", "the", "specified", "mass", "-", "to", "-", "charge", "ratio", "and", "charge" ]
091751eb12512f4bc6ada07bda745ce49331e24f
https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Core/ChargedMassTrait.php#L141-L157
32,330
chameleon-system/chameleon-shop
src/ShopBundle/objects/ArticleList/Module.php
Module.getRenderedList
protected function getRenderedList() { $enrichedState = $this->enrichStateWithDefaultsFromConfiguration(); $results = $this->getResults($enrichedState); $oResponse = new MTShopArticleListResponse(); $oResponse->bHasNextPage = ($results->getNumberOfPages() > $results->getPage() + 1); $oResponse->bHasPreviousPage = ($results->getPage() > 0); $oResponse->iListKey = $this->sModuleSpotName; $oResponse->iNumberOfResults = $results->getTotalNumberOfResults(); $template = $this->getListTemplateFromConfigName($this->aModuleConfig['view']); $oResponse->sItemPage = $this->renderProducts($template); return $oResponse; }
php
protected function getRenderedList() { $enrichedState = $this->enrichStateWithDefaultsFromConfiguration(); $results = $this->getResults($enrichedState); $oResponse = new MTShopArticleListResponse(); $oResponse->bHasNextPage = ($results->getNumberOfPages() > $results->getPage() + 1); $oResponse->bHasPreviousPage = ($results->getPage() > 0); $oResponse->iListKey = $this->sModuleSpotName; $oResponse->iNumberOfResults = $results->getTotalNumberOfResults(); $template = $this->getListTemplateFromConfigName($this->aModuleConfig['view']); $oResponse->sItemPage = $this->renderProducts($template); return $oResponse; }
[ "protected", "function", "getRenderedList", "(", ")", "{", "$", "enrichedState", "=", "$", "this", "->", "enrichStateWithDefaultsFromConfiguration", "(", ")", ";", "$", "results", "=", "$", "this", "->", "getResults", "(", "$", "enrichedState", ")", ";", "$", "oResponse", "=", "new", "MTShopArticleListResponse", "(", ")", ";", "$", "oResponse", "->", "bHasNextPage", "=", "(", "$", "results", "->", "getNumberOfPages", "(", ")", ">", "$", "results", "->", "getPage", "(", ")", "+", "1", ")", ";", "$", "oResponse", "->", "bHasPreviousPage", "=", "(", "$", "results", "->", "getPage", "(", ")", ">", "0", ")", ";", "$", "oResponse", "->", "iListKey", "=", "$", "this", "->", "sModuleSpotName", ";", "$", "oResponse", "->", "iNumberOfResults", "=", "$", "results", "->", "getTotalNumberOfResults", "(", ")", ";", "$", "template", "=", "$", "this", "->", "getListTemplateFromConfigName", "(", "$", "this", "->", "aModuleConfig", "[", "'view'", "]", ")", ";", "$", "oResponse", "->", "sItemPage", "=", "$", "this", "->", "renderProducts", "(", "$", "template", ")", ";", "return", "$", "oResponse", ";", "}" ]
returns a fully rendered list - used to page via ajax. @return MTShopArticleListResponse
[ "returns", "a", "fully", "rendered", "list", "-", "used", "to", "page", "via", "ajax", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/ArticleList/Module.php#L533-L548
32,331
chameleon-system/chameleon-shop
src/ShopBundle/objects/ArticleList/Module.php
Module.renderProducts
protected function renderProducts($viewName, ResultDataInterface $results = null, StateInterface $enrichedState = null) { // need to cache this $cacheKey = null; if ($this->_AllowCache()) { $cacheKeyData = $this->_GetCacheParameters(); $cacheKeyData['is_article_list_content'] = true; $cacheKey = $this->cache->getKey($cacheKeyData); $resultHTML = $this->cache->get($cacheKey); if (null !== $resultHTML) { return $resultHTML; } } if (null === $enrichedState) { $enrichedState = $this->enrichStateWithDefaultsFromConfiguration(); } if (null === $results) { $results = $this->getResults($enrichedState); } $items = $results->asArray(); $inputData = array( 'activePageNumber' => $results->getPage(), 'itemMapperBaseData' => $this->getItemMapperBaseData(), 'items' => $items, 'results' => $results, 'listPagerUrl' => $this->getListPageUrl(), 'listPageSizeChangeUrl' => $this->getListPageSizeUrl(), 'numberOfPages' => $results->getNumberOfPages(), 'state' => $enrichedState->getStateArrayWithoutQueryParameter(), 'stateObject' => $enrichedState, 'sortList' => $this->getSortList(), 'sortFieldName' => $this->getSortFieldName(), 'sortFormAction' => $this->getSortFormAction(), 'sortFormStateInputFields' => $this->getSortFormStateInputFields(), 'activeSortId' => $this->getActiveSortId(), 'listConfiguration' => $this->getConfiguration(), 'sModuleSpotName' => $this->sModuleSpotName, 'local' => $this->getActiveLocal(), 'currency' => $this->getActiveCurrency(), 'shop' => $this->getActiveShop(), ); $inputData = array_merge($inputData, $this->getListInformationFromConfiguration()); $resultHTML = $this->render($viewName, $inputData); if ($this->_AllowCache()) { $cacheTrigger = new \MapperCacheTrigger(); $cacheTriggerRestricted = new \MapperCacheTriggerRestrictedProxy($cacheTrigger); $this->configureCacheTrigger($cacheTriggerRestricted); $trigger = $cacheTrigger->getTrigger(); $this->cache->set($cacheKey, $resultHTML, $trigger); } return $resultHTML; }
php
protected function renderProducts($viewName, ResultDataInterface $results = null, StateInterface $enrichedState = null) { // need to cache this $cacheKey = null; if ($this->_AllowCache()) { $cacheKeyData = $this->_GetCacheParameters(); $cacheKeyData['is_article_list_content'] = true; $cacheKey = $this->cache->getKey($cacheKeyData); $resultHTML = $this->cache->get($cacheKey); if (null !== $resultHTML) { return $resultHTML; } } if (null === $enrichedState) { $enrichedState = $this->enrichStateWithDefaultsFromConfiguration(); } if (null === $results) { $results = $this->getResults($enrichedState); } $items = $results->asArray(); $inputData = array( 'activePageNumber' => $results->getPage(), 'itemMapperBaseData' => $this->getItemMapperBaseData(), 'items' => $items, 'results' => $results, 'listPagerUrl' => $this->getListPageUrl(), 'listPageSizeChangeUrl' => $this->getListPageSizeUrl(), 'numberOfPages' => $results->getNumberOfPages(), 'state' => $enrichedState->getStateArrayWithoutQueryParameter(), 'stateObject' => $enrichedState, 'sortList' => $this->getSortList(), 'sortFieldName' => $this->getSortFieldName(), 'sortFormAction' => $this->getSortFormAction(), 'sortFormStateInputFields' => $this->getSortFormStateInputFields(), 'activeSortId' => $this->getActiveSortId(), 'listConfiguration' => $this->getConfiguration(), 'sModuleSpotName' => $this->sModuleSpotName, 'local' => $this->getActiveLocal(), 'currency' => $this->getActiveCurrency(), 'shop' => $this->getActiveShop(), ); $inputData = array_merge($inputData, $this->getListInformationFromConfiguration()); $resultHTML = $this->render($viewName, $inputData); if ($this->_AllowCache()) { $cacheTrigger = new \MapperCacheTrigger(); $cacheTriggerRestricted = new \MapperCacheTriggerRestrictedProxy($cacheTrigger); $this->configureCacheTrigger($cacheTriggerRestricted); $trigger = $cacheTrigger->getTrigger(); $this->cache->set($cacheKey, $resultHTML, $trigger); } return $resultHTML; }
[ "protected", "function", "renderProducts", "(", "$", "viewName", ",", "ResultDataInterface", "$", "results", "=", "null", ",", "StateInterface", "$", "enrichedState", "=", "null", ")", "{", "// need to cache this", "$", "cacheKey", "=", "null", ";", "if", "(", "$", "this", "->", "_AllowCache", "(", ")", ")", "{", "$", "cacheKeyData", "=", "$", "this", "->", "_GetCacheParameters", "(", ")", ";", "$", "cacheKeyData", "[", "'is_article_list_content'", "]", "=", "true", ";", "$", "cacheKey", "=", "$", "this", "->", "cache", "->", "getKey", "(", "$", "cacheKeyData", ")", ";", "$", "resultHTML", "=", "$", "this", "->", "cache", "->", "get", "(", "$", "cacheKey", ")", ";", "if", "(", "null", "!==", "$", "resultHTML", ")", "{", "return", "$", "resultHTML", ";", "}", "}", "if", "(", "null", "===", "$", "enrichedState", ")", "{", "$", "enrichedState", "=", "$", "this", "->", "enrichStateWithDefaultsFromConfiguration", "(", ")", ";", "}", "if", "(", "null", "===", "$", "results", ")", "{", "$", "results", "=", "$", "this", "->", "getResults", "(", "$", "enrichedState", ")", ";", "}", "$", "items", "=", "$", "results", "->", "asArray", "(", ")", ";", "$", "inputData", "=", "array", "(", "'activePageNumber'", "=>", "$", "results", "->", "getPage", "(", ")", ",", "'itemMapperBaseData'", "=>", "$", "this", "->", "getItemMapperBaseData", "(", ")", ",", "'items'", "=>", "$", "items", ",", "'results'", "=>", "$", "results", ",", "'listPagerUrl'", "=>", "$", "this", "->", "getListPageUrl", "(", ")", ",", "'listPageSizeChangeUrl'", "=>", "$", "this", "->", "getListPageSizeUrl", "(", ")", ",", "'numberOfPages'", "=>", "$", "results", "->", "getNumberOfPages", "(", ")", ",", "'state'", "=>", "$", "enrichedState", "->", "getStateArrayWithoutQueryParameter", "(", ")", ",", "'stateObject'", "=>", "$", "enrichedState", ",", "'sortList'", "=>", "$", "this", "->", "getSortList", "(", ")", ",", "'sortFieldName'", "=>", "$", "this", "->", "getSortFieldName", "(", ")", ",", "'sortFormAction'", "=>", "$", "this", "->", "getSortFormAction", "(", ")", ",", "'sortFormStateInputFields'", "=>", "$", "this", "->", "getSortFormStateInputFields", "(", ")", ",", "'activeSortId'", "=>", "$", "this", "->", "getActiveSortId", "(", ")", ",", "'listConfiguration'", "=>", "$", "this", "->", "getConfiguration", "(", ")", ",", "'sModuleSpotName'", "=>", "$", "this", "->", "sModuleSpotName", ",", "'local'", "=>", "$", "this", "->", "getActiveLocal", "(", ")", ",", "'currency'", "=>", "$", "this", "->", "getActiveCurrency", "(", ")", ",", "'shop'", "=>", "$", "this", "->", "getActiveShop", "(", ")", ",", ")", ";", "$", "inputData", "=", "array_merge", "(", "$", "inputData", ",", "$", "this", "->", "getListInformationFromConfiguration", "(", ")", ")", ";", "$", "resultHTML", "=", "$", "this", "->", "render", "(", "$", "viewName", ",", "$", "inputData", ")", ";", "if", "(", "$", "this", "->", "_AllowCache", "(", ")", ")", "{", "$", "cacheTrigger", "=", "new", "\\", "MapperCacheTrigger", "(", ")", ";", "$", "cacheTriggerRestricted", "=", "new", "\\", "MapperCacheTriggerRestrictedProxy", "(", "$", "cacheTrigger", ")", ";", "$", "this", "->", "configureCacheTrigger", "(", "$", "cacheTriggerRestricted", ")", ";", "$", "trigger", "=", "$", "cacheTrigger", "->", "getTrigger", "(", ")", ";", "$", "this", "->", "cache", "->", "set", "(", "$", "cacheKey", ",", "$", "resultHTML", ",", "$", "trigger", ")", ";", "}", "return", "$", "resultHTML", ";", "}" ]
renders product list using the view provided. this should really be in another controller, unfortunately Chameleon currently does not support calling other controllers the way symfony does. @param string $viewName @param ResultDataInterface $results @param StateInterface $enrichedState @return string
[ "renders", "product", "list", "using", "the", "view", "provided", ".", "this", "should", "really", "be", "in", "another", "controller", "unfortunately", "Chameleon", "currently", "does", "not", "support", "calling", "other", "controllers", "the", "way", "symfony", "does", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/ArticleList/Module.php#L560-L618
32,332
chameleon-system/chameleon-shop
src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/CancellationExample.php
CancellationExample.setupOrderReference
public function setupOrderReference() { $orderTotal = new OffAmazonPaymentsService_Model_OrderTotal(); $orderTotal->setCurrencyCode($this->_currencyCode); $orderTotal->setAmount($this->_orderTotalAmount); $setOrderReferenceDetailsRequest = new OffAmazonPaymentsService_Model_SetOrderReferenceDetailsRequest(); $setOrderReferenceDetailsRequest->setSellerId($this->_sellerId); $setOrderReferenceDetailsRequest ->setAmazonOrderReferenceId($this->_amazonOrderReferenceId); $setOrderReferenceDetailsRequest ->setOrderReferenceAttributes( new OffAmazonPaymentsService_Model_OrderReferenceAttributes() ); $setOrderReferenceDetailsRequest ->getOrderReferenceAttributes()->setOrderTotal($orderTotal); return $this->_service->setOrderReferenceDetails( $setOrderReferenceDetailsRequest ); }
php
public function setupOrderReference() { $orderTotal = new OffAmazonPaymentsService_Model_OrderTotal(); $orderTotal->setCurrencyCode($this->_currencyCode); $orderTotal->setAmount($this->_orderTotalAmount); $setOrderReferenceDetailsRequest = new OffAmazonPaymentsService_Model_SetOrderReferenceDetailsRequest(); $setOrderReferenceDetailsRequest->setSellerId($this->_sellerId); $setOrderReferenceDetailsRequest ->setAmazonOrderReferenceId($this->_amazonOrderReferenceId); $setOrderReferenceDetailsRequest ->setOrderReferenceAttributes( new OffAmazonPaymentsService_Model_OrderReferenceAttributes() ); $setOrderReferenceDetailsRequest ->getOrderReferenceAttributes()->setOrderTotal($orderTotal); return $this->_service->setOrderReferenceDetails( $setOrderReferenceDetailsRequest ); }
[ "public", "function", "setupOrderReference", "(", ")", "{", "$", "orderTotal", "=", "new", "OffAmazonPaymentsService_Model_OrderTotal", "(", ")", ";", "$", "orderTotal", "->", "setCurrencyCode", "(", "$", "this", "->", "_currencyCode", ")", ";", "$", "orderTotal", "->", "setAmount", "(", "$", "this", "->", "_orderTotalAmount", ")", ";", "$", "setOrderReferenceDetailsRequest", "=", "new", "OffAmazonPaymentsService_Model_SetOrderReferenceDetailsRequest", "(", ")", ";", "$", "setOrderReferenceDetailsRequest", "->", "setSellerId", "(", "$", "this", "->", "_sellerId", ")", ";", "$", "setOrderReferenceDetailsRequest", "->", "setAmazonOrderReferenceId", "(", "$", "this", "->", "_amazonOrderReferenceId", ")", ";", "$", "setOrderReferenceDetailsRequest", "->", "setOrderReferenceAttributes", "(", "new", "OffAmazonPaymentsService_Model_OrderReferenceAttributes", "(", ")", ")", ";", "$", "setOrderReferenceDetailsRequest", "->", "getOrderReferenceAttributes", "(", ")", "->", "setOrderTotal", "(", "$", "orderTotal", ")", ";", "return", "$", "this", "->", "_service", "->", "setOrderReferenceDetails", "(", "$", "setOrderReferenceDetailsRequest", ")", ";", "}" ]
Add information to the payment contract so that it can be confirmed in a later step Simulates a merchant adding the order details to the payment contract @return OffAmazonPaymentsService_Model_SetOrderReferenceDetailsResponse response
[ "Add", "information", "to", "the", "payment", "contract", "so", "that", "it", "can", "be", "confirmed", "in", "a", "later", "step", "Simulates", "a", "merchant", "adding", "the", "order", "details", "to", "the", "payment", "contract" ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/CancellationExample.php#L95-L116
32,333
chameleon-system/chameleon-shop
src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/CancellationExample.php
CancellationExample.cancelOrderReference
public function cancelOrderReference() { $cancelOrderReferenceRequest = new OffAmazonPaymentsService_Model_CancelOrderReferenceRequest(); $cancelOrderReferenceRequest->setSellerId($this->_sellerId); $cancelOrderReferenceRequest ->setAmazonOrderReferenceId($this->_amazonOrderReferenceId); return $this->_service->cancelOrderReference($cancelOrderReferenceRequest); }
php
public function cancelOrderReference() { $cancelOrderReferenceRequest = new OffAmazonPaymentsService_Model_CancelOrderReferenceRequest(); $cancelOrderReferenceRequest->setSellerId($this->_sellerId); $cancelOrderReferenceRequest ->setAmazonOrderReferenceId($this->_amazonOrderReferenceId); return $this->_service->cancelOrderReference($cancelOrderReferenceRequest); }
[ "public", "function", "cancelOrderReference", "(", ")", "{", "$", "cancelOrderReferenceRequest", "=", "new", "OffAmazonPaymentsService_Model_CancelOrderReferenceRequest", "(", ")", ";", "$", "cancelOrderReferenceRequest", "->", "setSellerId", "(", "$", "this", "->", "_sellerId", ")", ";", "$", "cancelOrderReferenceRequest", "->", "setAmazonOrderReferenceId", "(", "$", "this", "->", "_amazonOrderReferenceId", ")", ";", "return", "$", "this", "->", "_service", "->", "cancelOrderReference", "(", "$", "cancelOrderReferenceRequest", ")", ";", "}" ]
Cancel the payment contract - this can be performed on any order reference that does not have a completed transaction @return OffAmazonPaymentsService_Model_CancelOrderReferenceResponse response
[ "Cancel", "the", "payment", "contract", "-", "this", "can", "be", "performed", "on", "any", "order", "reference", "that", "does", "not", "have", "a", "completed", "transaction" ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/CancellationExample.php#L230-L239
32,334
edmondscommerce/doctrine-static-meta
src/Entity/Embeddable/Objects/Identity/FullNameEmbeddable.php
FullNameEmbeddable.getFormatted
public function getFormatted(): string { return $this->format( [ $this->getTitle(), $this->getFirstName(), $this->format($this->middleNames), $this->getLastName(), $this->getSuffix(), ] ); }
php
public function getFormatted(): string { return $this->format( [ $this->getTitle(), $this->getFirstName(), $this->format($this->middleNames), $this->getLastName(), $this->getSuffix(), ] ); }
[ "public", "function", "getFormatted", "(", ")", ":", "string", "{", "return", "$", "this", "->", "format", "(", "[", "$", "this", "->", "getTitle", "(", ")", ",", "$", "this", "->", "getFirstName", "(", ")", ",", "$", "this", "->", "format", "(", "$", "this", "->", "middleNames", ")", ",", "$", "this", "->", "getLastName", "(", ")", ",", "$", "this", "->", "getSuffix", "(", ")", ",", "]", ")", ";", "}" ]
Get the full name as a single string @return string
[ "Get", "the", "full", "name", "as", "a", "single", "string" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/Embeddable/Objects/Identity/FullNameEmbeddable.php#L186-L197
32,335
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopVoucher.class.php
TShopVoucher.GetRemoveFromBasketLink
public function GetRemoveFromBasketLink($sMessageHandler = null) { if (is_null($sMessageHandler)) { $sMessageHandler = MTShopBasketCore::MSG_CONSUMER_NAME; } $oShopConfig = $this->getShopService()->getActiveShop(); return $this->getActivePageService()->getLinkToActivePageRelative(array( 'module_fnc' => array( $oShopConfig->GetBasketModuleSpotName() => 'RemoveVoucher', ), MTShopBasketCore::URL_REQUEST_PARAMETER => array( MTShopBasketCore::URL_MESSAGE_CONSUMER_NAME => $sMessageHandler, MTShopBasketCore::URL_VOUCHER_BASKET_KEY => $this->sBasketVoucherKey, ), )); }
php
public function GetRemoveFromBasketLink($sMessageHandler = null) { if (is_null($sMessageHandler)) { $sMessageHandler = MTShopBasketCore::MSG_CONSUMER_NAME; } $oShopConfig = $this->getShopService()->getActiveShop(); return $this->getActivePageService()->getLinkToActivePageRelative(array( 'module_fnc' => array( $oShopConfig->GetBasketModuleSpotName() => 'RemoveVoucher', ), MTShopBasketCore::URL_REQUEST_PARAMETER => array( MTShopBasketCore::URL_MESSAGE_CONSUMER_NAME => $sMessageHandler, MTShopBasketCore::URL_VOUCHER_BASKET_KEY => $this->sBasketVoucherKey, ), )); }
[ "public", "function", "GetRemoveFromBasketLink", "(", "$", "sMessageHandler", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "sMessageHandler", ")", ")", "{", "$", "sMessageHandler", "=", "MTShopBasketCore", "::", "MSG_CONSUMER_NAME", ";", "}", "$", "oShopConfig", "=", "$", "this", "->", "getShopService", "(", ")", "->", "getActiveShop", "(", ")", ";", "return", "$", "this", "->", "getActivePageService", "(", ")", "->", "getLinkToActivePageRelative", "(", "array", "(", "'module_fnc'", "=>", "array", "(", "$", "oShopConfig", "->", "GetBasketModuleSpotName", "(", ")", "=>", "'RemoveVoucher'", ",", ")", ",", "MTShopBasketCore", "::", "URL_REQUEST_PARAMETER", "=>", "array", "(", "MTShopBasketCore", "::", "URL_MESSAGE_CONSUMER_NAME", "=>", "$", "sMessageHandler", ",", "MTShopBasketCore", "::", "URL_VOUCHER_BASKET_KEY", "=>", "$", "this", "->", "sBasketVoucherKey", ",", ")", ",", ")", ")", ";", "}" ]
return a link to remove the voucher from the basket. @param string $sMessageHandler - the message handler which should be used to display the result - if nothing is specified, MTShopBasketCore::MSG_CONSUMER_NAME will be used @return string
[ "return", "a", "link", "to", "remove", "the", "voucher", "from", "the", "basket", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopVoucher.class.php#L149-L165
32,336
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopVoucher.class.php
TShopVoucher.GetValue
public function GetValue($bCalculateVoucher = false, $dMaxValueAllowed = null, $bSponsoredVouchers = false) { if ($bCalculateVoucher) { $oSeries = &$this->GetFieldShopVoucherSeries(); $dValue = $oSeries->fieldValue; $oBasket = TShopBasket::GetInstance(); $dBasketValueApplicableForVoucher = $oBasket->GetBasketSumForVoucher($this); if ('prozent' == $oSeries->fieldValueType) { $dValue = round($dBasketValueApplicableForVoucher * ($dValue / 100), 2); } else { // now we need to subtract the amount already used... $dValue = $dValue - $this->GetValuePreviouslyUsed_GetValueHook(); } // now if the voucher is worth more than the current basket, we need to use only the part that we can if ($dBasketValueApplicableForVoucher < $dValue) { $dValue = $dBasketValueApplicableForVoucher; } if ($dValue > $dMaxValueAllowed) { $dValue = $dMaxValueAllowed; } // if this is a NOT sponsored voucher, we need to reduce the article value if (false == $bSponsoredVouchers) { $oBasket->ApplyNoneSponsoredVoucherValueToItems($this, $dValue); } $this->voucherValueInBasket = $dValue; } return $this->voucherValueInBasket; }
php
public function GetValue($bCalculateVoucher = false, $dMaxValueAllowed = null, $bSponsoredVouchers = false) { if ($bCalculateVoucher) { $oSeries = &$this->GetFieldShopVoucherSeries(); $dValue = $oSeries->fieldValue; $oBasket = TShopBasket::GetInstance(); $dBasketValueApplicableForVoucher = $oBasket->GetBasketSumForVoucher($this); if ('prozent' == $oSeries->fieldValueType) { $dValue = round($dBasketValueApplicableForVoucher * ($dValue / 100), 2); } else { // now we need to subtract the amount already used... $dValue = $dValue - $this->GetValuePreviouslyUsed_GetValueHook(); } // now if the voucher is worth more than the current basket, we need to use only the part that we can if ($dBasketValueApplicableForVoucher < $dValue) { $dValue = $dBasketValueApplicableForVoucher; } if ($dValue > $dMaxValueAllowed) { $dValue = $dMaxValueAllowed; } // if this is a NOT sponsored voucher, we need to reduce the article value if (false == $bSponsoredVouchers) { $oBasket->ApplyNoneSponsoredVoucherValueToItems($this, $dValue); } $this->voucherValueInBasket = $dValue; } return $this->voucherValueInBasket; }
[ "public", "function", "GetValue", "(", "$", "bCalculateVoucher", "=", "false", ",", "$", "dMaxValueAllowed", "=", "null", ",", "$", "bSponsoredVouchers", "=", "false", ")", "{", "if", "(", "$", "bCalculateVoucher", ")", "{", "$", "oSeries", "=", "&", "$", "this", "->", "GetFieldShopVoucherSeries", "(", ")", ";", "$", "dValue", "=", "$", "oSeries", "->", "fieldValue", ";", "$", "oBasket", "=", "TShopBasket", "::", "GetInstance", "(", ")", ";", "$", "dBasketValueApplicableForVoucher", "=", "$", "oBasket", "->", "GetBasketSumForVoucher", "(", "$", "this", ")", ";", "if", "(", "'prozent'", "==", "$", "oSeries", "->", "fieldValueType", ")", "{", "$", "dValue", "=", "round", "(", "$", "dBasketValueApplicableForVoucher", "*", "(", "$", "dValue", "/", "100", ")", ",", "2", ")", ";", "}", "else", "{", "// now we need to subtract the amount already used...", "$", "dValue", "=", "$", "dValue", "-", "$", "this", "->", "GetValuePreviouslyUsed_GetValueHook", "(", ")", ";", "}", "// now if the voucher is worth more than the current basket, we need to use only the part that we can", "if", "(", "$", "dBasketValueApplicableForVoucher", "<", "$", "dValue", ")", "{", "$", "dValue", "=", "$", "dBasketValueApplicableForVoucher", ";", "}", "if", "(", "$", "dValue", ">", "$", "dMaxValueAllowed", ")", "{", "$", "dValue", "=", "$", "dMaxValueAllowed", ";", "}", "// if this is a NOT sponsored voucher, we need to reduce the article value", "if", "(", "false", "==", "$", "bSponsoredVouchers", ")", "{", "$", "oBasket", "->", "ApplyNoneSponsoredVoucherValueToItems", "(", "$", "this", ",", "$", "dValue", ")", ";", "}", "$", "this", "->", "voucherValueInBasket", "=", "$", "dValue", ";", "}", "return", "$", "this", "->", "voucherValueInBasket", ";", "}" ]
Returns the value of the voucher - takes the current basket and user into consideration. @param bool $bCalculateVoucher - set to true when we calculate the voucher value for the basket this should only be set to true when calling the method through the TShopBasketVoucherList::GetVoucherValue @param float $dMaxValueAllowed - if a value is passed, then the voucher will never exceed the value passed @return float
[ "Returns", "the", "value", "of", "the", "voucher", "-", "takes", "the", "current", "basket", "and", "user", "into", "consideration", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopVoucher.class.php#L315-L345
32,337
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopVoucher.class.php
TShopVoucher.GetValuePreviouslyUsed
public function GetValuePreviouslyUsed() { // we have to make sure that is value is accurate... so we will fetch it from database every time // performance should not be a big issue, since it only affects users that include a voucher in their basket $dValueUsed = 0; $query = "SELECT SUM(`value_used`) AS totalused FROM `shop_voucher_use` INNER JOIN `shop_order` ON `shop_voucher_use`.`shop_order_id` = `shop_order`.`id` WHERE `shop_voucher_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."' AND `shop_order`.`canceled` = '0' "; if ($aValue = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query))) { if (null !== $aValue['totalused']) { $dValueUsed = $aValue['totalused']; } } return $dValueUsed; }
php
public function GetValuePreviouslyUsed() { // we have to make sure that is value is accurate... so we will fetch it from database every time // performance should not be a big issue, since it only affects users that include a voucher in their basket $dValueUsed = 0; $query = "SELECT SUM(`value_used`) AS totalused FROM `shop_voucher_use` INNER JOIN `shop_order` ON `shop_voucher_use`.`shop_order_id` = `shop_order`.`id` WHERE `shop_voucher_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."' AND `shop_order`.`canceled` = '0' "; if ($aValue = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query))) { if (null !== $aValue['totalused']) { $dValueUsed = $aValue['totalused']; } } return $dValueUsed; }
[ "public", "function", "GetValuePreviouslyUsed", "(", ")", "{", "// we have to make sure that is value is accurate... so we will fetch it from database every time", "// performance should not be a big issue, since it only affects users that include a voucher in their basket", "$", "dValueUsed", "=", "0", ";", "$", "query", "=", "\"SELECT SUM(`value_used`) AS totalused\n FROM `shop_voucher_use`\n INNER JOIN `shop_order` ON `shop_voucher_use`.`shop_order_id` = `shop_order`.`id`\n WHERE `shop_voucher_id` = '\"", ".", "MySqlLegacySupport", "::", "getInstance", "(", ")", "->", "real_escape_string", "(", "$", "this", "->", "id", ")", ".", "\"'\n AND `shop_order`.`canceled` = '0'\n \"", ";", "if", "(", "$", "aValue", "=", "MySqlLegacySupport", "::", "getInstance", "(", ")", "->", "fetch_assoc", "(", "MySqlLegacySupport", "::", "getInstance", "(", ")", "->", "query", "(", "$", "query", ")", ")", ")", "{", "if", "(", "null", "!==", "$", "aValue", "[", "'totalused'", "]", ")", "{", "$", "dValueUsed", "=", "$", "aValue", "[", "'totalused'", "]", ";", "}", "}", "return", "$", "dValueUsed", ";", "}" ]
return the amount of the voucher used up in previous orders. @return float
[ "return", "the", "amount", "of", "the", "voucher", "used", "up", "in", "previous", "orders", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopVoucher.class.php#L362-L380
32,338
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopVoucher.class.php
TShopVoucher.CommitVoucherUseForCurrentUser
public function CommitVoucherUseForCurrentUser($iShopOrderId) { $oShopVoucherUse = TdbShopVoucherUse::GetNewInstance(); /** @var $oShopvoucherUse TdbShopVoucherUse */ $aData = array('shop_voucher_id' => $this->id, 'date_used' => date('Y-m-d H:i:s'), 'value_used' => $this->GetValue(), 'shop_order_id' => $iShopOrderId); // hook to post-convert value (as may be required when dealing with currency) $this->CommitVoucherUseForCurrentUserPreSaveHook($aData); $oShopVoucherUse->LoadFromRow($aData); $oShopVoucherUse->AllowEditByAll(true); $oShopVoucherUse->Save(); if ($this->checkMarkVoucherAsCompletelyUsed()) { $this->MarkVoucherAsCompletelyUsed(); } }
php
public function CommitVoucherUseForCurrentUser($iShopOrderId) { $oShopVoucherUse = TdbShopVoucherUse::GetNewInstance(); /** @var $oShopvoucherUse TdbShopVoucherUse */ $aData = array('shop_voucher_id' => $this->id, 'date_used' => date('Y-m-d H:i:s'), 'value_used' => $this->GetValue(), 'shop_order_id' => $iShopOrderId); // hook to post-convert value (as may be required when dealing with currency) $this->CommitVoucherUseForCurrentUserPreSaveHook($aData); $oShopVoucherUse->LoadFromRow($aData); $oShopVoucherUse->AllowEditByAll(true); $oShopVoucherUse->Save(); if ($this->checkMarkVoucherAsCompletelyUsed()) { $this->MarkVoucherAsCompletelyUsed(); } }
[ "public", "function", "CommitVoucherUseForCurrentUser", "(", "$", "iShopOrderId", ")", "{", "$", "oShopVoucherUse", "=", "TdbShopVoucherUse", "::", "GetNewInstance", "(", ")", ";", "/** @var $oShopvoucherUse TdbShopVoucherUse */", "$", "aData", "=", "array", "(", "'shop_voucher_id'", "=>", "$", "this", "->", "id", ",", "'date_used'", "=>", "date", "(", "'Y-m-d H:i:s'", ")", ",", "'value_used'", "=>", "$", "this", "->", "GetValue", "(", ")", ",", "'shop_order_id'", "=>", "$", "iShopOrderId", ")", ";", "// hook to post-convert value (as may be required when dealing with currency)", "$", "this", "->", "CommitVoucherUseForCurrentUserPreSaveHook", "(", "$", "aData", ")", ";", "$", "oShopVoucherUse", "->", "LoadFromRow", "(", "$", "aData", ")", ";", "$", "oShopVoucherUse", "->", "AllowEditByAll", "(", "true", ")", ";", "$", "oShopVoucherUse", "->", "Save", "(", ")", ";", "if", "(", "$", "this", "->", "checkMarkVoucherAsCompletelyUsed", "(", ")", ")", "{", "$", "this", "->", "MarkVoucherAsCompletelyUsed", "(", ")", ";", "}", "}" ]
marks the voucher as used in the database, and logs the voucher data for the current user in the shop_voucher_use table. @param int $iShopOrderId - the order for which the voucher is being used
[ "marks", "the", "voucher", "as", "used", "in", "the", "database", "and", "logs", "the", "voucher", "data", "for", "the", "current", "user", "in", "the", "shop_voucher_use", "table", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopVoucher.class.php#L388-L402
32,339
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopVoucher.class.php
TShopVoucher.checkMarkVoucherAsCompletelyUsed
public function checkMarkVoucherAsCompletelyUsed() { $bMarkVoucherAsCompletelyUsed = false; $oVoucherSeries = &$this->GetFieldShopVoucherSeries(); if ('absolut' == $oVoucherSeries->fieldValueType && !is_null($oVoucherSeries->GetFieldShopVoucherSeriesSponsor())) { $dValueUsed = $this->GetValuePreviouslyUsed(); if ($dValueUsed >= $this->GetVoucherSeriesOriginalValue()) { $bMarkVoucherAsCompletelyUsed = true; } } elseif ('absolut' == $oVoucherSeries->fieldValueType && is_null($oVoucherSeries->GetFieldShopVoucherSeriesSponsor())) { $bMarkVoucherAsCompletelyUsed = true; } else { $bMarkVoucherAsCompletelyUsed = true; } return $bMarkVoucherAsCompletelyUsed; }
php
public function checkMarkVoucherAsCompletelyUsed() { $bMarkVoucherAsCompletelyUsed = false; $oVoucherSeries = &$this->GetFieldShopVoucherSeries(); if ('absolut' == $oVoucherSeries->fieldValueType && !is_null($oVoucherSeries->GetFieldShopVoucherSeriesSponsor())) { $dValueUsed = $this->GetValuePreviouslyUsed(); if ($dValueUsed >= $this->GetVoucherSeriesOriginalValue()) { $bMarkVoucherAsCompletelyUsed = true; } } elseif ('absolut' == $oVoucherSeries->fieldValueType && is_null($oVoucherSeries->GetFieldShopVoucherSeriesSponsor())) { $bMarkVoucherAsCompletelyUsed = true; } else { $bMarkVoucherAsCompletelyUsed = true; } return $bMarkVoucherAsCompletelyUsed; }
[ "public", "function", "checkMarkVoucherAsCompletelyUsed", "(", ")", "{", "$", "bMarkVoucherAsCompletelyUsed", "=", "false", ";", "$", "oVoucherSeries", "=", "&", "$", "this", "->", "GetFieldShopVoucherSeries", "(", ")", ";", "if", "(", "'absolut'", "==", "$", "oVoucherSeries", "->", "fieldValueType", "&&", "!", "is_null", "(", "$", "oVoucherSeries", "->", "GetFieldShopVoucherSeriesSponsor", "(", ")", ")", ")", "{", "$", "dValueUsed", "=", "$", "this", "->", "GetValuePreviouslyUsed", "(", ")", ";", "if", "(", "$", "dValueUsed", ">=", "$", "this", "->", "GetVoucherSeriesOriginalValue", "(", ")", ")", "{", "$", "bMarkVoucherAsCompletelyUsed", "=", "true", ";", "}", "}", "elseif", "(", "'absolut'", "==", "$", "oVoucherSeries", "->", "fieldValueType", "&&", "is_null", "(", "$", "oVoucherSeries", "->", "GetFieldShopVoucherSeriesSponsor", "(", ")", ")", ")", "{", "$", "bMarkVoucherAsCompletelyUsed", "=", "true", ";", "}", "else", "{", "$", "bMarkVoucherAsCompletelyUsed", "=", "true", ";", "}", "return", "$", "bMarkVoucherAsCompletelyUsed", ";", "}" ]
if the voucher 1.) has an absolute value, a sponsor, and if the value has been used up 2.) has an absolute value, no sponsor 3.) has an relative value we need to mark the voucher as used. @return bool
[ "if", "the", "voucher", "1", ".", ")", "has", "an", "absolute", "value", "a", "sponsor", "and", "if", "the", "value", "has", "been", "used", "up", "2", ".", ")", "has", "an", "absolute", "value", "no", "sponsor", "3", ".", ")", "has", "an", "relative", "value", "we", "need", "to", "mark", "the", "voucher", "as", "used", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopVoucher.class.php#L413-L429
32,340
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopVoucher.class.php
TShopVoucher.MarkVoucherAsCompletelyUsed
public function MarkVoucherAsCompletelyUsed() { $aData = $this->sqlData; $aData['date_used_up'] = date('Y-m-d H:i:s'); $aData['is_used_up'] = '1'; $this->LoadFromRow($aData); $bEditState = $this->bAllowEditByAll; $this->AllowEditByAll(true); $this->Save(); $this->AllowEditByAll($bEditState); }
php
public function MarkVoucherAsCompletelyUsed() { $aData = $this->sqlData; $aData['date_used_up'] = date('Y-m-d H:i:s'); $aData['is_used_up'] = '1'; $this->LoadFromRow($aData); $bEditState = $this->bAllowEditByAll; $this->AllowEditByAll(true); $this->Save(); $this->AllowEditByAll($bEditState); }
[ "public", "function", "MarkVoucherAsCompletelyUsed", "(", ")", "{", "$", "aData", "=", "$", "this", "->", "sqlData", ";", "$", "aData", "[", "'date_used_up'", "]", "=", "date", "(", "'Y-m-d H:i:s'", ")", ";", "$", "aData", "[", "'is_used_up'", "]", "=", "'1'", ";", "$", "this", "->", "LoadFromRow", "(", "$", "aData", ")", ";", "$", "bEditState", "=", "$", "this", "->", "bAllowEditByAll", ";", "$", "this", "->", "AllowEditByAll", "(", "true", ")", ";", "$", "this", "->", "Save", "(", ")", ";", "$", "this", "->", "AllowEditByAll", "(", "$", "bEditState", ")", ";", "}" ]
mark the voucher as Completely used.
[ "mark", "the", "voucher", "as", "Completely", "used", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopVoucher.class.php#L455-L465
32,341
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopVoucher.class.php
TShopVoucher.AllowVoucherForArticle
public function AllowVoucherForArticle(TShopBasketArticle $oArticle) { $bMayBeUsed = true; $oVoucherDef = &$this->GetFieldShopVoucherSeries(); if ($oArticle->fieldExcludeFromVouchers && empty($oVoucherDef->fieldShopVoucherSeriesSponsorId)) { $bMayBeUsed = false; } // check article restrictions if ($bMayBeUsed) { $aArticleRestrictons = $oVoucherDef->GetMLTIdList('shop_article_mlt'); if (count($aArticleRestrictons) > 0 && !in_array($oArticle->id, $aArticleRestrictons)) { $bMayBeUsed = false; } } // check manufacturer restrictions if ($bMayBeUsed) { $aManufacturerRestrictons = $oVoucherDef->GetMLTIdList('shop_manufacturer_mlt'); if (count($aManufacturerRestrictons) > 0 && !in_array($oArticle->fieldShopManufacturerId, $aManufacturerRestrictons)) { $bMayBeUsed = false; } } // check category restrictions if ($bMayBeUsed) { $aCategoryRestrictons = $oVoucherDef->GetMLTIdList('shop_category_mlt'); if (count($aCategoryRestrictons) > 0) { if (!$oArticle->IsInCategory($aCategoryRestrictons)) { $bMayBeUsed = false; } } } // check product group restrictions if ($bMayBeUsed) { $aArticleGroupRestrictons = $oVoucherDef->GetMLTIdList('shop_article_group_mlt'); if (count($aArticleGroupRestrictons) > 0) { $aGroups = $oArticle->GetMLTIdList('shop_article_group_mlt'); $aMatches = array_intersect($aGroups, $aArticleGroupRestrictons); if (0 == count($aMatches)) { $bMayBeUsed = false; } } } return $bMayBeUsed; }
php
public function AllowVoucherForArticle(TShopBasketArticle $oArticle) { $bMayBeUsed = true; $oVoucherDef = &$this->GetFieldShopVoucherSeries(); if ($oArticle->fieldExcludeFromVouchers && empty($oVoucherDef->fieldShopVoucherSeriesSponsorId)) { $bMayBeUsed = false; } // check article restrictions if ($bMayBeUsed) { $aArticleRestrictons = $oVoucherDef->GetMLTIdList('shop_article_mlt'); if (count($aArticleRestrictons) > 0 && !in_array($oArticle->id, $aArticleRestrictons)) { $bMayBeUsed = false; } } // check manufacturer restrictions if ($bMayBeUsed) { $aManufacturerRestrictons = $oVoucherDef->GetMLTIdList('shop_manufacturer_mlt'); if (count($aManufacturerRestrictons) > 0 && !in_array($oArticle->fieldShopManufacturerId, $aManufacturerRestrictons)) { $bMayBeUsed = false; } } // check category restrictions if ($bMayBeUsed) { $aCategoryRestrictons = $oVoucherDef->GetMLTIdList('shop_category_mlt'); if (count($aCategoryRestrictons) > 0) { if (!$oArticle->IsInCategory($aCategoryRestrictons)) { $bMayBeUsed = false; } } } // check product group restrictions if ($bMayBeUsed) { $aArticleGroupRestrictons = $oVoucherDef->GetMLTIdList('shop_article_group_mlt'); if (count($aArticleGroupRestrictons) > 0) { $aGroups = $oArticle->GetMLTIdList('shop_article_group_mlt'); $aMatches = array_intersect($aGroups, $aArticleGroupRestrictons); if (0 == count($aMatches)) { $bMayBeUsed = false; } } } return $bMayBeUsed; }
[ "public", "function", "AllowVoucherForArticle", "(", "TShopBasketArticle", "$", "oArticle", ")", "{", "$", "bMayBeUsed", "=", "true", ";", "$", "oVoucherDef", "=", "&", "$", "this", "->", "GetFieldShopVoucherSeries", "(", ")", ";", "if", "(", "$", "oArticle", "->", "fieldExcludeFromVouchers", "&&", "empty", "(", "$", "oVoucherDef", "->", "fieldShopVoucherSeriesSponsorId", ")", ")", "{", "$", "bMayBeUsed", "=", "false", ";", "}", "// check article restrictions", "if", "(", "$", "bMayBeUsed", ")", "{", "$", "aArticleRestrictons", "=", "$", "oVoucherDef", "->", "GetMLTIdList", "(", "'shop_article_mlt'", ")", ";", "if", "(", "count", "(", "$", "aArticleRestrictons", ")", ">", "0", "&&", "!", "in_array", "(", "$", "oArticle", "->", "id", ",", "$", "aArticleRestrictons", ")", ")", "{", "$", "bMayBeUsed", "=", "false", ";", "}", "}", "// check manufacturer restrictions", "if", "(", "$", "bMayBeUsed", ")", "{", "$", "aManufacturerRestrictons", "=", "$", "oVoucherDef", "->", "GetMLTIdList", "(", "'shop_manufacturer_mlt'", ")", ";", "if", "(", "count", "(", "$", "aManufacturerRestrictons", ")", ">", "0", "&&", "!", "in_array", "(", "$", "oArticle", "->", "fieldShopManufacturerId", ",", "$", "aManufacturerRestrictons", ")", ")", "{", "$", "bMayBeUsed", "=", "false", ";", "}", "}", "// check category restrictions", "if", "(", "$", "bMayBeUsed", ")", "{", "$", "aCategoryRestrictons", "=", "$", "oVoucherDef", "->", "GetMLTIdList", "(", "'shop_category_mlt'", ")", ";", "if", "(", "count", "(", "$", "aCategoryRestrictons", ")", ">", "0", ")", "{", "if", "(", "!", "$", "oArticle", "->", "IsInCategory", "(", "$", "aCategoryRestrictons", ")", ")", "{", "$", "bMayBeUsed", "=", "false", ";", "}", "}", "}", "// check product group restrictions", "if", "(", "$", "bMayBeUsed", ")", "{", "$", "aArticleGroupRestrictons", "=", "$", "oVoucherDef", "->", "GetMLTIdList", "(", "'shop_article_group_mlt'", ")", ";", "if", "(", "count", "(", "$", "aArticleGroupRestrictons", ")", ">", "0", ")", "{", "$", "aGroups", "=", "$", "oArticle", "->", "GetMLTIdList", "(", "'shop_article_group_mlt'", ")", ";", "$", "aMatches", "=", "array_intersect", "(", "$", "aGroups", ",", "$", "aArticleGroupRestrictons", ")", ";", "if", "(", "0", "==", "count", "(", "$", "aMatches", ")", ")", "{", "$", "bMayBeUsed", "=", "false", ";", "}", "}", "}", "return", "$", "bMayBeUsed", ";", "}" ]
return true if the voucher may be used for the article. @param TShopBasketArticle $oArticle @return bool
[ "return", "true", "if", "the", "voucher", "may", "be", "used", "for", "the", "article", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopVoucher.class.php#L474-L523
32,342
PGB-LIV/php-ms
src/Core/Tolerance.php
Tolerance.getDaltonDelta
public function getDaltonDelta($mass) { if ($this->unit == Tolerance::DA) { return $this->tolerance; } $toleranceRatio = $this->tolerance / 1000000; return $mass * $toleranceRatio; }
php
public function getDaltonDelta($mass) { if ($this->unit == Tolerance::DA) { return $this->tolerance; } $toleranceRatio = $this->tolerance / 1000000; return $mass * $toleranceRatio; }
[ "public", "function", "getDaltonDelta", "(", "$", "mass", ")", "{", "if", "(", "$", "this", "->", "unit", "==", "Tolerance", "::", "DA", ")", "{", "return", "$", "this", "->", "tolerance", ";", "}", "$", "toleranceRatio", "=", "$", "this", "->", "tolerance", "/", "1000000", ";", "return", "$", "mass", "*", "$", "toleranceRatio", ";", "}" ]
Calculates the Dalton tolerance value of this mass using the set tolerance value @param float $mass Mass to calculate tolerance for @return float Tolerance value
[ "Calculates", "the", "Dalton", "tolerance", "value", "of", "this", "mass", "using", "the", "set", "tolerance", "value" ]
091751eb12512f4bc6ada07bda745ce49331e24f
https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Core/Tolerance.php#L99-L108
32,343
PGB-LIV/php-ms
src/Core/Tolerance.php
Tolerance.getPpmDelta
public function getPpmDelta($mass) { if ($this->unit == Tolerance::PPM) { return $this->tolerance; } $toleranceRatio = $this->tolerance / $mass; return $toleranceRatio * 1000000; }
php
public function getPpmDelta($mass) { if ($this->unit == Tolerance::PPM) { return $this->tolerance; } $toleranceRatio = $this->tolerance / $mass; return $toleranceRatio * 1000000; }
[ "public", "function", "getPpmDelta", "(", "$", "mass", ")", "{", "if", "(", "$", "this", "->", "unit", "==", "Tolerance", "::", "PPM", ")", "{", "return", "$", "this", "->", "tolerance", ";", "}", "$", "toleranceRatio", "=", "$", "this", "->", "tolerance", "/", "$", "mass", ";", "return", "$", "toleranceRatio", "*", "1000000", ";", "}" ]
Calculates the ppm tolerance value of this mass using the set tolerance value @param float $mass Mass to calculate tolerance for @return float Tolerance value
[ "Calculates", "the", "ppm", "tolerance", "value", "of", "this", "mass", "using", "the", "set", "tolerance", "value" ]
091751eb12512f4bc6ada07bda745ce49331e24f
https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Core/Tolerance.php#L117-L126
32,344
PGB-LIV/php-ms
src/Core/Tolerance.php
Tolerance.isTolerable
public function isTolerable($observed, $expected) { $diff = $this->getDifference($observed, $expected); if ($diff > $this->tolerance) { return false; } return true; }
php
public function isTolerable($observed, $expected) { $diff = $this->getDifference($observed, $expected); if ($diff > $this->tolerance) { return false; } return true; }
[ "public", "function", "isTolerable", "(", "$", "observed", ",", "$", "expected", ")", "{", "$", "diff", "=", "$", "this", "->", "getDifference", "(", "$", "observed", ",", "$", "expected", ")", ";", "if", "(", "$", "diff", ">", "$", "this", "->", "tolerance", ")", "{", "return", "false", ";", "}", "return", "true", ";", "}" ]
Test if the observed and expected values are within the accepted tolerance @param float $observed The observed value @param float $expected The expected value @return boolean
[ "Test", "if", "the", "observed", "and", "expected", "values", "are", "within", "the", "accepted", "tolerance" ]
091751eb12512f4bc6ada07bda745ce49331e24f
https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Core/Tolerance.php#L137-L146
32,345
PGB-LIV/php-ms
src/Core/Tolerance.php
Tolerance.getDifference
public function getDifference($observed, $expected) { if ($this->unit == Tolerance::DA) { return abs($observed - $expected); } return abs(self::getDifferencePpm($observed, $expected)); }
php
public function getDifference($observed, $expected) { if ($this->unit == Tolerance::DA) { return abs($observed - $expected); } return abs(self::getDifferencePpm($observed, $expected)); }
[ "public", "function", "getDifference", "(", "$", "observed", ",", "$", "expected", ")", "{", "if", "(", "$", "this", "->", "unit", "==", "Tolerance", "::", "DA", ")", "{", "return", "abs", "(", "$", "observed", "-", "$", "expected", ")", ";", "}", "return", "abs", "(", "self", "::", "getDifferencePpm", "(", "$", "observed", ",", "$", "expected", ")", ")", ";", "}" ]
Gets the difference between the observed and expected, and returns it depending on the instance unit @param float $observed The observed value @param float $expected The expected value @return float
[ "Gets", "the", "difference", "between", "the", "observed", "and", "expected", "and", "returns", "it", "depending", "on", "the", "instance", "unit" ]
091751eb12512f4bc6ada07bda745ce49331e24f
https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Core/Tolerance.php#L157-L164
32,346
chameleon-system/chameleon-shop
src/ShopCurrencyBundle/objects/TCMSFields/TPkgShopCurrency_CMSFieldPrice.class.php
TPkgShopCurrency_CMSFieldPrice.RenderFieldPostWakeupString
public function RenderFieldPostWakeupString() { $oViewParser = new TViewParser(); /** @var $oViewParser TViewParser */ $oViewParser->bShowTemplatePathAsHTMLHint = false; $aData = $this->GetFieldWriterData(); $aData['numberOfDecimals'] = $this->_GetNumberOfDecimals(); $oViewParser->AddVarArray($aData); return $oViewParser->RenderObjectPackageView('postwakeup', 'pkgShopCurrency/views/TCMSFields/TPkgShopCurrency_CMSFieldPrice'); }
php
public function RenderFieldPostWakeupString() { $oViewParser = new TViewParser(); /** @var $oViewParser TViewParser */ $oViewParser->bShowTemplatePathAsHTMLHint = false; $aData = $this->GetFieldWriterData(); $aData['numberOfDecimals'] = $this->_GetNumberOfDecimals(); $oViewParser->AddVarArray($aData); return $oViewParser->RenderObjectPackageView('postwakeup', 'pkgShopCurrency/views/TCMSFields/TPkgShopCurrency_CMSFieldPrice'); }
[ "public", "function", "RenderFieldPostWakeupString", "(", ")", "{", "$", "oViewParser", "=", "new", "TViewParser", "(", ")", ";", "/** @var $oViewParser TViewParser */", "$", "oViewParser", "->", "bShowTemplatePathAsHTMLHint", "=", "false", ";", "$", "aData", "=", "$", "this", "->", "GetFieldWriterData", "(", ")", ";", "$", "aData", "[", "'numberOfDecimals'", "]", "=", "$", "this", "->", "_GetNumberOfDecimals", "(", ")", ";", "$", "oViewParser", "->", "AddVarArray", "(", "$", "aData", ")", ";", "return", "$", "oViewParser", "->", "RenderObjectPackageView", "(", "'postwakeup'", ",", "'pkgShopCurrency/views/TCMSFields/TPkgShopCurrency_CMSFieldPrice'", ")", ";", "}" ]
injected into the PostWakeupHook in the auto class. @return string
[ "injected", "into", "the", "PostWakeupHook", "in", "the", "auto", "class", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopCurrencyBundle/objects/TCMSFields/TPkgShopCurrency_CMSFieldPrice.class.php#L32-L42
32,347
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopArticleReviewList.class.php
TShopArticleReviewList.GetAverageScore
public function GetAverageScore() { $dAvgScore = 0; if ($this->Length() > 0) { $iPt = $this->getItemPointer(); $this->GoToStart(); $dScore = 0; while ($oitem = &$this->Next()) { $dScore += $oitem->fieldRating; } $this->setItemPointer($iPt); $dAvgScore = $dScore / $this->Length(); } return $dAvgScore; }
php
public function GetAverageScore() { $dAvgScore = 0; if ($this->Length() > 0) { $iPt = $this->getItemPointer(); $this->GoToStart(); $dScore = 0; while ($oitem = &$this->Next()) { $dScore += $oitem->fieldRating; } $this->setItemPointer($iPt); $dAvgScore = $dScore / $this->Length(); } return $dAvgScore; }
[ "public", "function", "GetAverageScore", "(", ")", "{", "$", "dAvgScore", "=", "0", ";", "if", "(", "$", "this", "->", "Length", "(", ")", ">", "0", ")", "{", "$", "iPt", "=", "$", "this", "->", "getItemPointer", "(", ")", ";", "$", "this", "->", "GoToStart", "(", ")", ";", "$", "dScore", "=", "0", ";", "while", "(", "$", "oitem", "=", "&", "$", "this", "->", "Next", "(", ")", ")", "{", "$", "dScore", "+=", "$", "oitem", "->", "fieldRating", ";", "}", "$", "this", "->", "setItemPointer", "(", "$", "iPt", ")", ";", "$", "dAvgScore", "=", "$", "dScore", "/", "$", "this", "->", "Length", "(", ")", ";", "}", "return", "$", "dAvgScore", ";", "}" ]
return the average score for the review list. @return float
[ "return", "the", "average", "score", "for", "the", "review", "list", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticleReviewList.class.php#L28-L44
32,348
chameleon-system/chameleon-shop
src/ShopDhlPackstationBundle/pkgExtranet/objects/db/TPkgShopDhlPackstation_DataExtranetUserAddress.class.php
TPkgShopDhlPackstation_DataExtranetUserAddress.GetRequiredFields
public function GetRequiredFields() { $aRequiredFields = parent::GetRequiredFields(); if ($this->fieldIsDhlPackstation) { $aRequiredFields[] = 'address_additional_info'; $sKey = array_search('telefon', $aRequiredFields); if (false !== $sKey) { unset($aRequiredFields[$sKey]); } $sKey = array_search('fax', $aRequiredFields); if (false !== $sKey) { unset($aRequiredFields[$sKey]); } } return $aRequiredFields; }
php
public function GetRequiredFields() { $aRequiredFields = parent::GetRequiredFields(); if ($this->fieldIsDhlPackstation) { $aRequiredFields[] = 'address_additional_info'; $sKey = array_search('telefon', $aRequiredFields); if (false !== $sKey) { unset($aRequiredFields[$sKey]); } $sKey = array_search('fax', $aRequiredFields); if (false !== $sKey) { unset($aRequiredFields[$sKey]); } } return $aRequiredFields; }
[ "public", "function", "GetRequiredFields", "(", ")", "{", "$", "aRequiredFields", "=", "parent", "::", "GetRequiredFields", "(", ")", ";", "if", "(", "$", "this", "->", "fieldIsDhlPackstation", ")", "{", "$", "aRequiredFields", "[", "]", "=", "'address_additional_info'", ";", "$", "sKey", "=", "array_search", "(", "'telefon'", ",", "$", "aRequiredFields", ")", ";", "if", "(", "false", "!==", "$", "sKey", ")", "{", "unset", "(", "$", "aRequiredFields", "[", "$", "sKey", "]", ")", ";", "}", "$", "sKey", "=", "array_search", "(", "'fax'", ",", "$", "aRequiredFields", ")", ";", "if", "(", "false", "!==", "$", "sKey", ")", "{", "unset", "(", "$", "aRequiredFields", "[", "$", "sKey", "]", ")", ";", "}", "}", "return", "$", "aRequiredFields", ";", "}" ]
return array with required fields. @return array
[ "return", "array", "with", "required", "fields", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopDhlPackstationBundle/pkgExtranet/objects/db/TPkgShopDhlPackstation_DataExtranetUserAddress.class.php#L44-L60
32,349
edmondscommerce/doctrine-static-meta
src/Entity/Fields/Traits/PrimaryKey/AbstractUuidFieldTrait.php
AbstractUuidFieldTrait.injectUuid
public function injectUuid(UuidFactory $uuidFactory) { if (null === $this->id) { $this->setId(self::buildUuid($uuidFactory)); } }
php
public function injectUuid(UuidFactory $uuidFactory) { if (null === $this->id) { $this->setId(self::buildUuid($uuidFactory)); } }
[ "public", "function", "injectUuid", "(", "UuidFactory", "$", "uuidFactory", ")", "{", "if", "(", "null", "===", "$", "this", "->", "id", ")", "{", "$", "this", "->", "setId", "(", "self", "::", "buildUuid", "(", "$", "uuidFactory", ")", ")", ";", "}", "}" ]
This is leveraging the setter injection that happens on Entity creation to ensure that the UUID is set @param UuidFactory $uuidFactory
[ "This", "is", "leveraging", "the", "setter", "injection", "that", "happens", "on", "Entity", "creation", "to", "ensure", "that", "the", "UUID", "is", "set" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/Fields/Traits/PrimaryKey/AbstractUuidFieldTrait.php#L25-L30
32,350
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopArticleReview.class.php
TShopArticleReview.GetReviewAgeAsString
public function GetReviewAgeAsString() { $iNow = time(); $dYear = date('Y', $iNow); $dMonth = date('n', $iNow); $dDay = date('j', $iNow); $dHour = date('G', $iNow); $dMin = date('i', $iNow); if ('0' == substr($dMin, 0, 1)) { $dMin = substr($dMin, 1); } $iPreviewDate = strtotime($this->fieldDatecreated); $dPreviewYear = date('Y', $iPreviewDate); $dPreviewMonth = date('n', $iPreviewDate); $dPreviewDay = date('j', $iPreviewDate); $dPreviewHour = date('G', $iPreviewDate); $dPreviewMin = date('i', $iPreviewDate); if ('0' == substr($dPreviewMin, 0, 1)) { $dPreviewMin = substr($dPreviewMin, 1); } $iAgeYear = $dYear - $dPreviewYear; $iAgeMonth = $dMonth - $dPreviewMonth; $iAgeDay = $dDay - $dPreviewDay; $iAgeHour = $dHour - $dPreviewHour; $iAgeMin = $dMin - $dPreviewMin; if ($iAgeMin >= 30) { $iAgeHour += 0.5; } $aAgeParts = array(); $oLocal = &TCMSLocal::GetActive(); if ($iAgeYear > 0) { $sName = 'Jahr'; if ($iAgeYear > 1) { $sName = 'Jahren'; } $aAgeParts[] = $iAgeYear.' '.$sName; } if ($iAgeMonth > 0) { $sName = 'Monat'; if ($iAgeMonth > 1) { $sName = 'Monaten'; } $aAgeParts[] = $iAgeMonth.' '.$sName; } if ($iAgeDay > 0) { $sName = 'Tag'; if ($iAgeDay > 1) { $sName = 'Tagen'; } $aAgeParts[] = $iAgeDay.' '.$sName; } if ($iAgeHour > 0) { if (1 == $iAgeHour) { $aAgeParts[] = $iAgeDay.' Stunde'; } elseif ($iAgeHour - floor($iAgeHour) > 0) { $aAgeParts[] = $oLocal->FormatNumber($iAgeHour, 1).' Stunden'; } else { $aAgeParts[] = $iAgeHour.' Stunden'; } } $sAgeString = implode(', ', $aAgeParts); if (empty($sAgeString)) { $sAgeString = 'weniger als einer halben Stunde'; } return $sAgeString; }
php
public function GetReviewAgeAsString() { $iNow = time(); $dYear = date('Y', $iNow); $dMonth = date('n', $iNow); $dDay = date('j', $iNow); $dHour = date('G', $iNow); $dMin = date('i', $iNow); if ('0' == substr($dMin, 0, 1)) { $dMin = substr($dMin, 1); } $iPreviewDate = strtotime($this->fieldDatecreated); $dPreviewYear = date('Y', $iPreviewDate); $dPreviewMonth = date('n', $iPreviewDate); $dPreviewDay = date('j', $iPreviewDate); $dPreviewHour = date('G', $iPreviewDate); $dPreviewMin = date('i', $iPreviewDate); if ('0' == substr($dPreviewMin, 0, 1)) { $dPreviewMin = substr($dPreviewMin, 1); } $iAgeYear = $dYear - $dPreviewYear; $iAgeMonth = $dMonth - $dPreviewMonth; $iAgeDay = $dDay - $dPreviewDay; $iAgeHour = $dHour - $dPreviewHour; $iAgeMin = $dMin - $dPreviewMin; if ($iAgeMin >= 30) { $iAgeHour += 0.5; } $aAgeParts = array(); $oLocal = &TCMSLocal::GetActive(); if ($iAgeYear > 0) { $sName = 'Jahr'; if ($iAgeYear > 1) { $sName = 'Jahren'; } $aAgeParts[] = $iAgeYear.' '.$sName; } if ($iAgeMonth > 0) { $sName = 'Monat'; if ($iAgeMonth > 1) { $sName = 'Monaten'; } $aAgeParts[] = $iAgeMonth.' '.$sName; } if ($iAgeDay > 0) { $sName = 'Tag'; if ($iAgeDay > 1) { $sName = 'Tagen'; } $aAgeParts[] = $iAgeDay.' '.$sName; } if ($iAgeHour > 0) { if (1 == $iAgeHour) { $aAgeParts[] = $iAgeDay.' Stunde'; } elseif ($iAgeHour - floor($iAgeHour) > 0) { $aAgeParts[] = $oLocal->FormatNumber($iAgeHour, 1).' Stunden'; } else { $aAgeParts[] = $iAgeHour.' Stunden'; } } $sAgeString = implode(', ', $aAgeParts); if (empty($sAgeString)) { $sAgeString = 'weniger als einer halben Stunde'; } return $sAgeString; }
[ "public", "function", "GetReviewAgeAsString", "(", ")", "{", "$", "iNow", "=", "time", "(", ")", ";", "$", "dYear", "=", "date", "(", "'Y'", ",", "$", "iNow", ")", ";", "$", "dMonth", "=", "date", "(", "'n'", ",", "$", "iNow", ")", ";", "$", "dDay", "=", "date", "(", "'j'", ",", "$", "iNow", ")", ";", "$", "dHour", "=", "date", "(", "'G'", ",", "$", "iNow", ")", ";", "$", "dMin", "=", "date", "(", "'i'", ",", "$", "iNow", ")", ";", "if", "(", "'0'", "==", "substr", "(", "$", "dMin", ",", "0", ",", "1", ")", ")", "{", "$", "dMin", "=", "substr", "(", "$", "dMin", ",", "1", ")", ";", "}", "$", "iPreviewDate", "=", "strtotime", "(", "$", "this", "->", "fieldDatecreated", ")", ";", "$", "dPreviewYear", "=", "date", "(", "'Y'", ",", "$", "iPreviewDate", ")", ";", "$", "dPreviewMonth", "=", "date", "(", "'n'", ",", "$", "iPreviewDate", ")", ";", "$", "dPreviewDay", "=", "date", "(", "'j'", ",", "$", "iPreviewDate", ")", ";", "$", "dPreviewHour", "=", "date", "(", "'G'", ",", "$", "iPreviewDate", ")", ";", "$", "dPreviewMin", "=", "date", "(", "'i'", ",", "$", "iPreviewDate", ")", ";", "if", "(", "'0'", "==", "substr", "(", "$", "dPreviewMin", ",", "0", ",", "1", ")", ")", "{", "$", "dPreviewMin", "=", "substr", "(", "$", "dPreviewMin", ",", "1", ")", ";", "}", "$", "iAgeYear", "=", "$", "dYear", "-", "$", "dPreviewYear", ";", "$", "iAgeMonth", "=", "$", "dMonth", "-", "$", "dPreviewMonth", ";", "$", "iAgeDay", "=", "$", "dDay", "-", "$", "dPreviewDay", ";", "$", "iAgeHour", "=", "$", "dHour", "-", "$", "dPreviewHour", ";", "$", "iAgeMin", "=", "$", "dMin", "-", "$", "dPreviewMin", ";", "if", "(", "$", "iAgeMin", ">=", "30", ")", "{", "$", "iAgeHour", "+=", "0.5", ";", "}", "$", "aAgeParts", "=", "array", "(", ")", ";", "$", "oLocal", "=", "&", "TCMSLocal", "::", "GetActive", "(", ")", ";", "if", "(", "$", "iAgeYear", ">", "0", ")", "{", "$", "sName", "=", "'Jahr'", ";", "if", "(", "$", "iAgeYear", ">", "1", ")", "{", "$", "sName", "=", "'Jahren'", ";", "}", "$", "aAgeParts", "[", "]", "=", "$", "iAgeYear", ".", "' '", ".", "$", "sName", ";", "}", "if", "(", "$", "iAgeMonth", ">", "0", ")", "{", "$", "sName", "=", "'Monat'", ";", "if", "(", "$", "iAgeMonth", ">", "1", ")", "{", "$", "sName", "=", "'Monaten'", ";", "}", "$", "aAgeParts", "[", "]", "=", "$", "iAgeMonth", ".", "' '", ".", "$", "sName", ";", "}", "if", "(", "$", "iAgeDay", ">", "0", ")", "{", "$", "sName", "=", "'Tag'", ";", "if", "(", "$", "iAgeDay", ">", "1", ")", "{", "$", "sName", "=", "'Tagen'", ";", "}", "$", "aAgeParts", "[", "]", "=", "$", "iAgeDay", ".", "' '", ".", "$", "sName", ";", "}", "if", "(", "$", "iAgeHour", ">", "0", ")", "{", "if", "(", "1", "==", "$", "iAgeHour", ")", "{", "$", "aAgeParts", "[", "]", "=", "$", "iAgeDay", ".", "' Stunde'", ";", "}", "elseif", "(", "$", "iAgeHour", "-", "floor", "(", "$", "iAgeHour", ")", ">", "0", ")", "{", "$", "aAgeParts", "[", "]", "=", "$", "oLocal", "->", "FormatNumber", "(", "$", "iAgeHour", ",", "1", ")", ".", "' Stunden'", ";", "}", "else", "{", "$", "aAgeParts", "[", "]", "=", "$", "iAgeHour", ".", "' Stunden'", ";", "}", "}", "$", "sAgeString", "=", "implode", "(", "', '", ",", "$", "aAgeParts", ")", ";", "if", "(", "empty", "(", "$", "sAgeString", ")", ")", "{", "$", "sAgeString", "=", "'weniger als einer halben Stunde'", ";", "}", "return", "$", "sAgeString", ";", "}" ]
return the age of the review as a string. @return string
[ "return", "the", "age", "of", "the", "review", "as", "a", "string", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticleReview.class.php#L26-L97
32,351
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopArticleReview.class.php
TShopArticleReview.LoadFromRowProtected
public function LoadFromRowProtected($aRow) { $whitelist = $this->getFieldWhitelistForLoadByRow(); $safeData = []; foreach ($aRow as $key => $val) { if (\in_array($key, $whitelist, true)) { $safeData[$key] = $val; } } $user = TdbDataExtranetUser::GetInstance(); if ($user->IsLoggedIn()) { $safeData['data_extranet_user_id'] = $user->id; } $this->LoadFromRow($safeData); }
php
public function LoadFromRowProtected($aRow) { $whitelist = $this->getFieldWhitelistForLoadByRow(); $safeData = []; foreach ($aRow as $key => $val) { if (\in_array($key, $whitelist, true)) { $safeData[$key] = $val; } } $user = TdbDataExtranetUser::GetInstance(); if ($user->IsLoggedIn()) { $safeData['data_extranet_user_id'] = $user->id; } $this->LoadFromRow($safeData); }
[ "public", "function", "LoadFromRowProtected", "(", "$", "aRow", ")", "{", "$", "whitelist", "=", "$", "this", "->", "getFieldWhitelistForLoadByRow", "(", ")", ";", "$", "safeData", "=", "[", "]", ";", "foreach", "(", "$", "aRow", "as", "$", "key", "=>", "$", "val", ")", "{", "if", "(", "\\", "in_array", "(", "$", "key", ",", "$", "whitelist", ",", "true", ")", ")", "{", "$", "safeData", "[", "$", "key", "]", "=", "$", "val", ";", "}", "}", "$", "user", "=", "TdbDataExtranetUser", "::", "GetInstance", "(", ")", ";", "if", "(", "$", "user", "->", "IsLoggedIn", "(", ")", ")", "{", "$", "safeData", "[", "'data_extranet_user_id'", "]", "=", "$", "user", "->", "id", ";", "}", "$", "this", "->", "LoadFromRow", "(", "$", "safeData", ")", ";", "}" ]
load data from row, only allowing user-changeable fields. @param array $aRow
[ "load", "data", "from", "row", "only", "allowing", "user", "-", "changeable", "fields", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticleReview.class.php#L156-L170
32,352
edmondscommerce/doctrine-static-meta
src/EntityManager/EntityManagerFactory.php
EntityManagerFactory.getEntityManager
final public function getEntityManager(ConfigInterface $config): EntityManagerInterface { try { $dbParams = $this->getDbConnectionInfo($config); $doctrineConfig = $this->getDoctrineConfig($config); $this->addDsmParamsToConfig($doctrineConfig, $config); $entityManager = $this->createEntityManager($dbParams, $doctrineConfig); $this->addEntityFactories($entityManager); $this->setDebuggingInfo($config, $entityManager); return $entityManager; } catch (\Exception $e) { $message = 'Exception in ' . __METHOD__ . ': ' . $e->getMessage(); throw new DoctrineStaticMetaException($message, $e->getCode(), $e); } }
php
final public function getEntityManager(ConfigInterface $config): EntityManagerInterface { try { $dbParams = $this->getDbConnectionInfo($config); $doctrineConfig = $this->getDoctrineConfig($config); $this->addDsmParamsToConfig($doctrineConfig, $config); $entityManager = $this->createEntityManager($dbParams, $doctrineConfig); $this->addEntityFactories($entityManager); $this->setDebuggingInfo($config, $entityManager); return $entityManager; } catch (\Exception $e) { $message = 'Exception in ' . __METHOD__ . ': ' . $e->getMessage(); throw new DoctrineStaticMetaException($message, $e->getCode(), $e); } }
[ "final", "public", "function", "getEntityManager", "(", "ConfigInterface", "$", "config", ")", ":", "EntityManagerInterface", "{", "try", "{", "$", "dbParams", "=", "$", "this", "->", "getDbConnectionInfo", "(", "$", "config", ")", ";", "$", "doctrineConfig", "=", "$", "this", "->", "getDoctrineConfig", "(", "$", "config", ")", ";", "$", "this", "->", "addDsmParamsToConfig", "(", "$", "doctrineConfig", ",", "$", "config", ")", ";", "$", "entityManager", "=", "$", "this", "->", "createEntityManager", "(", "$", "dbParams", ",", "$", "doctrineConfig", ")", ";", "$", "this", "->", "addEntityFactories", "(", "$", "entityManager", ")", ";", "$", "this", "->", "setDebuggingInfo", "(", "$", "config", ",", "$", "entityManager", ")", ";", "return", "$", "entityManager", ";", "}", "catch", "(", "\\", "Exception", "$", "e", ")", "{", "$", "message", "=", "'Exception in '", ".", "__METHOD__", ".", "': '", ".", "$", "e", "->", "getMessage", "(", ")", ";", "throw", "new", "DoctrineStaticMetaException", "(", "$", "message", ",", "$", "e", "->", "getCode", "(", ")", ",", "$", "e", ")", ";", "}", "}" ]
This is used to create a new instance of the entity manager. Each of the steps involved need to take place, however you may wish to make modifications to individual ones. There for the method is final, but the child steps are public and can be overwritten if you extend the class @param ConfigInterface $config @return EntityManagerInterface @throws DoctrineStaticMetaException
[ "This", "is", "used", "to", "create", "a", "new", "instance", "of", "the", "entity", "manager", ".", "Each", "of", "the", "steps", "involved", "need", "to", "take", "place", "however", "you", "may", "wish", "to", "make", "modifications", "to", "individual", "ones", ".", "There", "for", "the", "method", "is", "final", "but", "the", "child", "steps", "are", "public", "and", "can", "be", "overwritten", "if", "you", "extend", "the", "class" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/EntityManager/EntityManagerFactory.php#L78-L94
32,353
edmondscommerce/doctrine-static-meta
src/EntityManager/EntityManagerFactory.php
EntityManagerFactory.getDbConnectionInfo
public function getDbConnectionInfo(ConfigInterface $config): array { $dbUser = $config->get(ConfigInterface::PARAM_DB_USER); $dbPass = $config->get(ConfigInterface::PARAM_DB_PASS); $dbHost = $config->get(ConfigInterface::PARAM_DB_HOST); $dbName = $config->get(ConfigInterface::PARAM_DB_NAME); $useRetryConnection = $config->get(ConfigInterface::PARAM_USE_RETRY_CONNECTION); $return = [ 'driver' => 'pdo_mysql', 'user' => $dbUser, 'password' => $dbPass, 'dbname' => $dbName, 'host' => $dbHost, 'charset' => 'utf8mb4', ]; if (true === $useRetryConnection) { $return['wrapperClass'] = PingingAndReconnectingConnection::class; } return $return; }
php
public function getDbConnectionInfo(ConfigInterface $config): array { $dbUser = $config->get(ConfigInterface::PARAM_DB_USER); $dbPass = $config->get(ConfigInterface::PARAM_DB_PASS); $dbHost = $config->get(ConfigInterface::PARAM_DB_HOST); $dbName = $config->get(ConfigInterface::PARAM_DB_NAME); $useRetryConnection = $config->get(ConfigInterface::PARAM_USE_RETRY_CONNECTION); $return = [ 'driver' => 'pdo_mysql', 'user' => $dbUser, 'password' => $dbPass, 'dbname' => $dbName, 'host' => $dbHost, 'charset' => 'utf8mb4', ]; if (true === $useRetryConnection) { $return['wrapperClass'] = PingingAndReconnectingConnection::class; } return $return; }
[ "public", "function", "getDbConnectionInfo", "(", "ConfigInterface", "$", "config", ")", ":", "array", "{", "$", "dbUser", "=", "$", "config", "->", "get", "(", "ConfigInterface", "::", "PARAM_DB_USER", ")", ";", "$", "dbPass", "=", "$", "config", "->", "get", "(", "ConfigInterface", "::", "PARAM_DB_PASS", ")", ";", "$", "dbHost", "=", "$", "config", "->", "get", "(", "ConfigInterface", "::", "PARAM_DB_HOST", ")", ";", "$", "dbName", "=", "$", "config", "->", "get", "(", "ConfigInterface", "::", "PARAM_DB_NAME", ")", ";", "$", "useRetryConnection", "=", "$", "config", "->", "get", "(", "ConfigInterface", "::", "PARAM_USE_RETRY_CONNECTION", ")", ";", "$", "return", "=", "[", "'driver'", "=>", "'pdo_mysql'", ",", "'user'", "=>", "$", "dbUser", ",", "'password'", "=>", "$", "dbPass", ",", "'dbname'", "=>", "$", "dbName", ",", "'host'", "=>", "$", "dbHost", ",", "'charset'", "=>", "'utf8mb4'", ",", "]", ";", "if", "(", "true", "===", "$", "useRetryConnection", ")", "{", "$", "return", "[", "'wrapperClass'", "]", "=", "PingingAndReconnectingConnection", "::", "class", ";", "}", "return", "$", "return", ";", "}" ]
This is used to get the connection information for doctrine. By default this pulls the information out of the configuration interface, however if you connection information is in a different format you can override this method and set it @param ConfigInterface $config @return array
[ "This", "is", "used", "to", "get", "the", "connection", "information", "for", "doctrine", ".", "By", "default", "this", "pulls", "the", "information", "out", "of", "the", "configuration", "interface", "however", "if", "you", "connection", "information", "is", "in", "a", "different", "format", "you", "can", "override", "this", "method", "and", "set", "it" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/EntityManager/EntityManagerFactory.php#L106-L128
32,354
edmondscommerce/doctrine-static-meta
src/EntityManager/EntityManagerFactory.php
EntityManagerFactory.getDoctrineConfig
public function getDoctrineConfig(ConfigInterface $config): Configuration { $isDevMode = (bool)$config->get(ConfigInterface::PARAM_DEVMODE); $proxyDir = $config->get(ConfigInterface::PARAM_DOCTRINE_PROXY_DIR); $cache = $isDevMode ? null : $this->cache; return Tools\Setup::createConfiguration($isDevMode, $proxyDir, $cache); }
php
public function getDoctrineConfig(ConfigInterface $config): Configuration { $isDevMode = (bool)$config->get(ConfigInterface::PARAM_DEVMODE); $proxyDir = $config->get(ConfigInterface::PARAM_DOCTRINE_PROXY_DIR); $cache = $isDevMode ? null : $this->cache; return Tools\Setup::createConfiguration($isDevMode, $proxyDir, $cache); }
[ "public", "function", "getDoctrineConfig", "(", "ConfigInterface", "$", "config", ")", ":", "Configuration", "{", "$", "isDevMode", "=", "(", "bool", ")", "$", "config", "->", "get", "(", "ConfigInterface", "::", "PARAM_DEVMODE", ")", ";", "$", "proxyDir", "=", "$", "config", "->", "get", "(", "ConfigInterface", "::", "PARAM_DOCTRINE_PROXY_DIR", ")", ";", "$", "cache", "=", "$", "isDevMode", "?", "null", ":", "$", "this", "->", "cache", ";", "return", "Tools", "\\", "Setup", "::", "createConfiguration", "(", "$", "isDevMode", ",", "$", "proxyDir", ",", "$", "cache", ")", ";", "}" ]
This is used to get the doctrine configuration object. By default this creates a new instance, however if you already have an object configured you can override this method and inject it @param ConfigInterface $config @return Configuration @SuppressWarnings(PHPMD.StaticAccess)
[ "This", "is", "used", "to", "get", "the", "doctrine", "configuration", "object", ".", "By", "default", "this", "creates", "a", "new", "instance", "however", "if", "you", "already", "have", "an", "object", "configured", "you", "can", "override", "this", "method", "and", "inject", "it" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/EntityManager/EntityManagerFactory.php#L139-L146
32,355
edmondscommerce/doctrine-static-meta
src/EntityManager/EntityManagerFactory.php
EntityManagerFactory.addDsmParamsToConfig
public function addDsmParamsToConfig(Configuration $doctrineConfig, ConfigInterface $config): void { $paths = $this->getPathInformation($config); $namingStrategy = $config->get(ConfigInterface::PARAM_DOCTRINE_NAMING_STRATEGY); $driver = new StaticPHPDriver($paths); $doctrineConfig->setMetadataDriverImpl($driver); $doctrineConfig->setNamingStrategy($namingStrategy); }
php
public function addDsmParamsToConfig(Configuration $doctrineConfig, ConfigInterface $config): void { $paths = $this->getPathInformation($config); $namingStrategy = $config->get(ConfigInterface::PARAM_DOCTRINE_NAMING_STRATEGY); $driver = new StaticPHPDriver($paths); $doctrineConfig->setMetadataDriverImpl($driver); $doctrineConfig->setNamingStrategy($namingStrategy); }
[ "public", "function", "addDsmParamsToConfig", "(", "Configuration", "$", "doctrineConfig", ",", "ConfigInterface", "$", "config", ")", ":", "void", "{", "$", "paths", "=", "$", "this", "->", "getPathInformation", "(", "$", "config", ")", ";", "$", "namingStrategy", "=", "$", "config", "->", "get", "(", "ConfigInterface", "::", "PARAM_DOCTRINE_NAMING_STRATEGY", ")", ";", "$", "driver", "=", "new", "StaticPHPDriver", "(", "$", "paths", ")", ";", "$", "doctrineConfig", "->", "setMetadataDriverImpl", "(", "$", "driver", ")", ";", "$", "doctrineConfig", "->", "setNamingStrategy", "(", "$", "namingStrategy", ")", ";", "}" ]
This is used to add the DSM specific configuration to doctrine Configuration object. You shouldn't need to override this, but if you do you can @param Configuration $doctrineConfig @param ConfigInterface $config
[ "This", "is", "used", "to", "add", "the", "DSM", "specific", "configuration", "to", "doctrine", "Configuration", "object", ".", "You", "shouldn", "t", "need", "to", "override", "this", "but", "if", "you", "do", "you", "can" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/EntityManager/EntityManagerFactory.php#L155-L162
32,356
edmondscommerce/doctrine-static-meta
src/EntityManager/EntityManagerFactory.php
EntityManagerFactory.createEntityManager
public function createEntityManager(array $dbParams, Configuration $doctrineConfig): EntityManagerInterface { $entityManager = EntityManager::create($dbParams, $doctrineConfig); return new EntityFactoryManagerDecorator($entityManager); }
php
public function createEntityManager(array $dbParams, Configuration $doctrineConfig): EntityManagerInterface { $entityManager = EntityManager::create($dbParams, $doctrineConfig); return new EntityFactoryManagerDecorator($entityManager); }
[ "public", "function", "createEntityManager", "(", "array", "$", "dbParams", ",", "Configuration", "$", "doctrineConfig", ")", ":", "EntityManagerInterface", "{", "$", "entityManager", "=", "EntityManager", "::", "create", "(", "$", "dbParams", ",", "$", "doctrineConfig", ")", ";", "return", "new", "EntityFactoryManagerDecorator", "(", "$", "entityManager", ")", ";", "}" ]
This is used to create the Entity manager. You can override this if there are any calls you wish to make on it after it has been created @param array $dbParams @param Configuration $doctrineConfig @return EntityManagerInterface @throws \Doctrine\ORM\ORMException @SuppressWarnings(PHPMD.StaticAccess)
[ "This", "is", "used", "to", "create", "the", "Entity", "manager", ".", "You", "can", "override", "this", "if", "there", "are", "any", "calls", "you", "wish", "to", "make", "on", "it", "after", "it", "has", "been", "created" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/EntityManager/EntityManagerFactory.php#L192-L197
32,357
edmondscommerce/doctrine-static-meta
src/EntityManager/EntityManagerFactory.php
EntityManagerFactory.setDebuggingInfo
public function setDebuggingInfo(ConfigInterface $config, EntityManagerInterface $entityManager): void { $isDbDebug = (bool)$config->get(ConfigInterface::PARAM_DB_DEBUG); if (false === $isDbDebug) { return; } $connection = $entityManager->getConnection(); $connection->query( " set global general_log = 1; set global log_output = 'table'; truncate general_log; " ); }
php
public function setDebuggingInfo(ConfigInterface $config, EntityManagerInterface $entityManager): void { $isDbDebug = (bool)$config->get(ConfigInterface::PARAM_DB_DEBUG); if (false === $isDbDebug) { return; } $connection = $entityManager->getConnection(); $connection->query( " set global general_log = 1; set global log_output = 'table'; truncate general_log; " ); }
[ "public", "function", "setDebuggingInfo", "(", "ConfigInterface", "$", "config", ",", "EntityManagerInterface", "$", "entityManager", ")", ":", "void", "{", "$", "isDbDebug", "=", "(", "bool", ")", "$", "config", "->", "get", "(", "ConfigInterface", "::", "PARAM_DB_DEBUG", ")", ";", "if", "(", "false", "===", "$", "isDbDebug", ")", "{", "return", ";", "}", "$", "connection", "=", "$", "entityManager", "->", "getConnection", "(", ")", ";", "$", "connection", "->", "query", "(", "\"\n set global general_log = 1;\n set global log_output = 'table';\n truncate general_log;\n \"", ")", ";", "}" ]
This is used to set any debugging information, by default it enables MySql logging and clears the log table. Override this method if there is anything else that you need to do @param ConfigInterface $config @param EntityManagerInterface $entityManager @throws \Doctrine\DBAL\DBALException
[ "This", "is", "used", "to", "set", "any", "debugging", "information", "by", "default", "it", "enables", "MySql", "logging", "and", "clears", "the", "log", "table", ".", "Override", "this", "method", "if", "there", "is", "anything", "else", "that", "you", "need", "to", "do" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/EntityManager/EntityManagerFactory.php#L220-L234
32,358
chameleon-system/chameleon-shop
src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/SplitShipmentsCheckoutExample.php
SplitShipmentsCheckoutExample.getAuthorizationDetails
public function getAuthorizationDetails($amazonAuthorizationId) { $getAuthorizationDetailsRequest = new OffAmazonPaymentsService_Model_GetAuthorizationDetailsRequest(); $getAuthorizationDetailsRequest->setSellerId($this->_sellerId); $getAuthorizationDetailsRequest->setAmazonAuthorizationId($amazonAuthorizationId); return $this->_service->getAuthorizationDetails($getAuthorizationDetailsRequest); }
php
public function getAuthorizationDetails($amazonAuthorizationId) { $getAuthorizationDetailsRequest = new OffAmazonPaymentsService_Model_GetAuthorizationDetailsRequest(); $getAuthorizationDetailsRequest->setSellerId($this->_sellerId); $getAuthorizationDetailsRequest->setAmazonAuthorizationId($amazonAuthorizationId); return $this->_service->getAuthorizationDetails($getAuthorizationDetailsRequest); }
[ "public", "function", "getAuthorizationDetails", "(", "$", "amazonAuthorizationId", ")", "{", "$", "getAuthorizationDetailsRequest", "=", "new", "OffAmazonPaymentsService_Model_GetAuthorizationDetailsRequest", "(", ")", ";", "$", "getAuthorizationDetailsRequest", "->", "setSellerId", "(", "$", "this", "->", "_sellerId", ")", ";", "$", "getAuthorizationDetailsRequest", "->", "setAmazonAuthorizationId", "(", "$", "amazonAuthorizationId", ")", ";", "return", "$", "this", "->", "_service", "->", "getAuthorizationDetails", "(", "$", "getAuthorizationDetailsRequest", ")", ";", "}" ]
Perform the getAuthroizationDetails request for the order @param string $amazonAuthorizationReferenceId authorization transaction to query @return OffAmazonPaymentsService_Model_GetAuthorizationDetailsResponse service response
[ "Perform", "the", "getAuthroizationDetails", "request", "for", "the", "order" ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/SplitShipmentsCheckoutExample.php#L199-L206
32,359
chameleon-system/chameleon-shop
src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/SplitShipmentsCheckoutExample.php
SplitShipmentsCheckoutExample._getOrderTotal
private function _getOrderTotal() { return array_reduce( $this->_orderShipments, function($runningTotal, $item) { $runningTotal += $item->price; return $runningTotal; } ); }
php
private function _getOrderTotal() { return array_reduce( $this->_orderShipments, function($runningTotal, $item) { $runningTotal += $item->price; return $runningTotal; } ); }
[ "private", "function", "_getOrderTotal", "(", ")", "{", "return", "array_reduce", "(", "$", "this", "->", "_orderShipments", ",", "function", "(", "$", "runningTotal", ",", "$", "item", ")", "{", "$", "runningTotal", "+=", "$", "item", "->", "price", ";", "return", "$", "runningTotal", ";", "}", ")", ";", "}" ]
Return the total amount for the order @return int order total
[ "Return", "the", "total", "amount", "for", "the", "order" ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/SplitShipmentsCheckoutExample.php#L295-L304
32,360
edmondscommerce/doctrine-static-meta
src/Schema/Schema.php
Schema.update
public function update(): Schema { if ('cli' !== PHP_SAPI) { throw new \RuntimeException('This should only be called from the command line'); } $metadata = $this->getAllMetaData(); $schemaUpdateSql = $this->schemaTool->getUpdateSchemaSql($metadata); if (0 !== count($schemaUpdateSql)) { $connection = $this->entityManager->getConnection(); foreach ($schemaUpdateSql as $sql) { try { $connection->executeQuery($sql); } catch (DBALException $e) { throw new DoctrineStaticMetaException( "exception running update sql:\n$sql\n", $e->getCode(), $e ); } } } $this->generateProxies(); return $this; }
php
public function update(): Schema { if ('cli' !== PHP_SAPI) { throw new \RuntimeException('This should only be called from the command line'); } $metadata = $this->getAllMetaData(); $schemaUpdateSql = $this->schemaTool->getUpdateSchemaSql($metadata); if (0 !== count($schemaUpdateSql)) { $connection = $this->entityManager->getConnection(); foreach ($schemaUpdateSql as $sql) { try { $connection->executeQuery($sql); } catch (DBALException $e) { throw new DoctrineStaticMetaException( "exception running update sql:\n$sql\n", $e->getCode(), $e ); } } } $this->generateProxies(); return $this; }
[ "public", "function", "update", "(", ")", ":", "Schema", "{", "if", "(", "'cli'", "!==", "PHP_SAPI", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "'This should only be called from the command line'", ")", ";", "}", "$", "metadata", "=", "$", "this", "->", "getAllMetaData", "(", ")", ";", "$", "schemaUpdateSql", "=", "$", "this", "->", "schemaTool", "->", "getUpdateSchemaSql", "(", "$", "metadata", ")", ";", "if", "(", "0", "!==", "count", "(", "$", "schemaUpdateSql", ")", ")", "{", "$", "connection", "=", "$", "this", "->", "entityManager", "->", "getConnection", "(", ")", ";", "foreach", "(", "$", "schemaUpdateSql", "as", "$", "sql", ")", "{", "try", "{", "$", "connection", "->", "executeQuery", "(", "$", "sql", ")", ";", "}", "catch", "(", "DBALException", "$", "e", ")", "{", "throw", "new", "DoctrineStaticMetaException", "(", "\"exception running update sql:\\n$sql\\n\"", ",", "$", "e", "->", "getCode", "(", ")", ",", "$", "e", ")", ";", "}", "}", "}", "$", "this", "->", "generateProxies", "(", ")", ";", "return", "$", "this", ";", "}" ]
Update or Create all tables @return Schema @throws \RuntimeException @throws DoctrineStaticMetaException
[ "Update", "or", "Create", "all", "tables" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Schema/Schema.php#L77-L101
32,361
edmondscommerce/doctrine-static-meta
src/Schema/Schema.php
Schema.validate
public function validate(): Schema { $errors = $this->schemaValidator->validateMapping(); if (!empty($errors)) { $allMetaData = $this->getAllMetaData(); $mappingPath = __DIR__ . '/../../var/doctrineMapping.ser'; file_put_contents($mappingPath, print_r($allMetaData, true)); throw new DoctrineStaticMetaException( 'Found errors in Doctrine mapping, mapping has been dumped to ' . $mappingPath . "\n\n" . print_r( $errors, true ) ); } return $this; }
php
public function validate(): Schema { $errors = $this->schemaValidator->validateMapping(); if (!empty($errors)) { $allMetaData = $this->getAllMetaData(); $mappingPath = __DIR__ . '/../../var/doctrineMapping.ser'; file_put_contents($mappingPath, print_r($allMetaData, true)); throw new DoctrineStaticMetaException( 'Found errors in Doctrine mapping, mapping has been dumped to ' . $mappingPath . "\n\n" . print_r( $errors, true ) ); } return $this; }
[ "public", "function", "validate", "(", ")", ":", "Schema", "{", "$", "errors", "=", "$", "this", "->", "schemaValidator", "->", "validateMapping", "(", ")", ";", "if", "(", "!", "empty", "(", "$", "errors", ")", ")", "{", "$", "allMetaData", "=", "$", "this", "->", "getAllMetaData", "(", ")", ";", "$", "mappingPath", "=", "__DIR__", ".", "'/../../var/doctrineMapping.ser'", ";", "file_put_contents", "(", "$", "mappingPath", ",", "print_r", "(", "$", "allMetaData", ",", "true", ")", ")", ";", "throw", "new", "DoctrineStaticMetaException", "(", "'Found errors in Doctrine mapping, mapping has been dumped to '", ".", "$", "mappingPath", ".", "\"\\n\\n\"", ".", "print_r", "(", "$", "errors", ",", "true", ")", ")", ";", "}", "return", "$", "this", ";", "}" ]
Validate the configured mapping metadata @return Schema @throws DoctrineStaticMetaException
[ "Validate", "the", "configured", "mapping", "metadata" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Schema/Schema.php#L130-L146
32,362
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopPaymentMethod.class.php
TShopPaymentMethod.postSelectPaymentHook
public function postSelectPaymentHook(TdbShop $oShop, TShopBasket $oBasket, TdbDataExtranetUser $oUser, $sMessageConsumer) { return $this->GetFieldShopPaymentHandler()->PostSelectPaymentHook($sMessageConsumer); }
php
public function postSelectPaymentHook(TdbShop $oShop, TShopBasket $oBasket, TdbDataExtranetUser $oUser, $sMessageConsumer) { return $this->GetFieldShopPaymentHandler()->PostSelectPaymentHook($sMessageConsumer); }
[ "public", "function", "postSelectPaymentHook", "(", "TdbShop", "$", "oShop", ",", "TShopBasket", "$", "oBasket", ",", "TdbDataExtranetUser", "$", "oUser", ",", "$", "sMessageConsumer", ")", "{", "return", "$", "this", "->", "GetFieldShopPaymentHandler", "(", ")", "->", "PostSelectPaymentHook", "(", "$", "sMessageConsumer", ")", ";", "}" ]
called after the payment method is selected - return false the selection is invalid. @param TdbShop $oShop @param TShopBasket $oBasket @param TdbDataExtranetUser $oUser @param $sMessageConsumer @return bool
[ "called", "after", "the", "payment", "method", "is", "selected", "-", "return", "false", "the", "selection", "is", "invalid", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentMethod.class.php#L64-L67
32,363
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopPaymentMethod.class.php
TShopPaymentMethod.IsValidForCurrentUser
public function IsValidForCurrentUser() { $bIsValidForUser = false; $bIsValidShippingCountry = false; $bIsValidBillingCountry = false; $oUser = TdbDataExtranetUser::GetInstance(); $bIsValidGroup = $this->checkUserGroup($oUser); if ($bIsValidGroup) { $bIsValidForUser = $this->checkUser($oUser); } if ($bIsValidForUser && $bIsValidGroup) { $bIsValidShippingCountry = $this->checkUserShippingCountry($oUser); } if ($bIsValidForUser && $bIsValidGroup && $bIsValidShippingCountry) { $bIsValidBillingCountry = $this->checkUserBillingCountry($oUser); } return $bIsValidForUser && $bIsValidGroup && $bIsValidShippingCountry && $bIsValidBillingCountry; }
php
public function IsValidForCurrentUser() { $bIsValidForUser = false; $bIsValidShippingCountry = false; $bIsValidBillingCountry = false; $oUser = TdbDataExtranetUser::GetInstance(); $bIsValidGroup = $this->checkUserGroup($oUser); if ($bIsValidGroup) { $bIsValidForUser = $this->checkUser($oUser); } if ($bIsValidForUser && $bIsValidGroup) { $bIsValidShippingCountry = $this->checkUserShippingCountry($oUser); } if ($bIsValidForUser && $bIsValidGroup && $bIsValidShippingCountry) { $bIsValidBillingCountry = $this->checkUserBillingCountry($oUser); } return $bIsValidForUser && $bIsValidGroup && $bIsValidShippingCountry && $bIsValidBillingCountry; }
[ "public", "function", "IsValidForCurrentUser", "(", ")", "{", "$", "bIsValidForUser", "=", "false", ";", "$", "bIsValidShippingCountry", "=", "false", ";", "$", "bIsValidBillingCountry", "=", "false", ";", "$", "oUser", "=", "TdbDataExtranetUser", "::", "GetInstance", "(", ")", ";", "$", "bIsValidGroup", "=", "$", "this", "->", "checkUserGroup", "(", "$", "oUser", ")", ";", "if", "(", "$", "bIsValidGroup", ")", "{", "$", "bIsValidForUser", "=", "$", "this", "->", "checkUser", "(", "$", "oUser", ")", ";", "}", "if", "(", "$", "bIsValidForUser", "&&", "$", "bIsValidGroup", ")", "{", "$", "bIsValidShippingCountry", "=", "$", "this", "->", "checkUserShippingCountry", "(", "$", "oUser", ")", ";", "}", "if", "(", "$", "bIsValidForUser", "&&", "$", "bIsValidGroup", "&&", "$", "bIsValidShippingCountry", ")", "{", "$", "bIsValidBillingCountry", "=", "$", "this", "->", "checkUserBillingCountry", "(", "$", "oUser", ")", ";", "}", "return", "$", "bIsValidForUser", "&&", "$", "bIsValidGroup", "&&", "$", "bIsValidShippingCountry", "&&", "$", "bIsValidBillingCountry", ";", "}" ]
return true if the payment method is allowed for the current user. @return bool
[ "return", "true", "if", "the", "payment", "method", "is", "allowed", "for", "the", "current", "user", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentMethod.class.php#L172-L191
32,364
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopPaymentMethod.class.php
TShopPaymentMethod.checkUserGroup
protected function checkUserGroup(TdbDataExtranetUser $oUser) { $bIsValidGroup = false; $aUserGroups = $this->getPaymentMethodDataAccess()->getPermittedUserGroupIds($this->id); if (!is_array($aUserGroups) || count($aUserGroups) < 1) { $bIsValidGroup = true; } elseif ($oUser->IsLoggedIn()) { $bIsValidGroup = $oUser->InUserGroups($aUserGroups); } return $bIsValidGroup; }
php
protected function checkUserGroup(TdbDataExtranetUser $oUser) { $bIsValidGroup = false; $aUserGroups = $this->getPaymentMethodDataAccess()->getPermittedUserGroupIds($this->id); if (!is_array($aUserGroups) || count($aUserGroups) < 1) { $bIsValidGroup = true; } elseif ($oUser->IsLoggedIn()) { $bIsValidGroup = $oUser->InUserGroups($aUserGroups); } return $bIsValidGroup; }
[ "protected", "function", "checkUserGroup", "(", "TdbDataExtranetUser", "$", "oUser", ")", "{", "$", "bIsValidGroup", "=", "false", ";", "$", "aUserGroups", "=", "$", "this", "->", "getPaymentMethodDataAccess", "(", ")", "->", "getPermittedUserGroupIds", "(", "$", "this", "->", "id", ")", ";", "if", "(", "!", "is_array", "(", "$", "aUserGroups", ")", "||", "count", "(", "$", "aUserGroups", ")", "<", "1", ")", "{", "$", "bIsValidGroup", "=", "true", ";", "}", "elseif", "(", "$", "oUser", "->", "IsLoggedIn", "(", ")", ")", "{", "$", "bIsValidGroup", "=", "$", "oUser", "->", "InUserGroups", "(", "$", "aUserGroups", ")", ";", "}", "return", "$", "bIsValidGroup", ";", "}" ]
check user group. @param TdbDataExtranetUser $oUser @return bool
[ "check", "user", "group", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentMethod.class.php#L200-L211
32,365
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopPaymentMethod.class.php
TShopPaymentMethod.checkUser
protected function checkUser(TdbDataExtranetUser $oUser) { $bIsValidForUser = false; $aUserList = $this->getPaymentMethodDataAccess()->getPermittedUserIds($this->id); if (!is_array($aUserList) || count($aUserList) < 1) { $bIsValidForUser = true; } elseif ($oUser->IsLoggedIn()) { $bIsValidForUser = in_array($oUser->id, $aUserList); } return $bIsValidForUser; }
php
protected function checkUser(TdbDataExtranetUser $oUser) { $bIsValidForUser = false; $aUserList = $this->getPaymentMethodDataAccess()->getPermittedUserIds($this->id); if (!is_array($aUserList) || count($aUserList) < 1) { $bIsValidForUser = true; } elseif ($oUser->IsLoggedIn()) { $bIsValidForUser = in_array($oUser->id, $aUserList); } return $bIsValidForUser; }
[ "protected", "function", "checkUser", "(", "TdbDataExtranetUser", "$", "oUser", ")", "{", "$", "bIsValidForUser", "=", "false", ";", "$", "aUserList", "=", "$", "this", "->", "getPaymentMethodDataAccess", "(", ")", "->", "getPermittedUserIds", "(", "$", "this", "->", "id", ")", ";", "if", "(", "!", "is_array", "(", "$", "aUserList", ")", "||", "count", "(", "$", "aUserList", ")", "<", "1", ")", "{", "$", "bIsValidForUser", "=", "true", ";", "}", "elseif", "(", "$", "oUser", "->", "IsLoggedIn", "(", ")", ")", "{", "$", "bIsValidForUser", "=", "in_array", "(", "$", "oUser", "->", "id", ",", "$", "aUserList", ")", ";", "}", "return", "$", "bIsValidForUser", ";", "}" ]
now check user id. @param TdbDataExtranetUser $oUser @return bool
[ "now", "check", "user", "id", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentMethod.class.php#L220-L231
32,366
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopPaymentMethod.class.php
TShopPaymentMethod.checkUserShippingCountry
protected function checkUserShippingCountry(TdbDataExtranetUser $oUser) { $bIsValidShippingCountry = false; $aShippingCountryRestriction = $this->getPaymentMethodDataAccess()->getShippingCountryIds($this->id); if (count($aShippingCountryRestriction) > 0) { $oShippingAddress = $oUser->GetShippingAddress(); if (in_array($oShippingAddress->fieldDataCountryId, $aShippingCountryRestriction)) { $bIsValidShippingCountry = true; } } else { $bIsValidShippingCountry = true; } return $bIsValidShippingCountry; }
php
protected function checkUserShippingCountry(TdbDataExtranetUser $oUser) { $bIsValidShippingCountry = false; $aShippingCountryRestriction = $this->getPaymentMethodDataAccess()->getShippingCountryIds($this->id); if (count($aShippingCountryRestriction) > 0) { $oShippingAddress = $oUser->GetShippingAddress(); if (in_array($oShippingAddress->fieldDataCountryId, $aShippingCountryRestriction)) { $bIsValidShippingCountry = true; } } else { $bIsValidShippingCountry = true; } return $bIsValidShippingCountry; }
[ "protected", "function", "checkUserShippingCountry", "(", "TdbDataExtranetUser", "$", "oUser", ")", "{", "$", "bIsValidShippingCountry", "=", "false", ";", "$", "aShippingCountryRestriction", "=", "$", "this", "->", "getPaymentMethodDataAccess", "(", ")", "->", "getShippingCountryIds", "(", "$", "this", "->", "id", ")", ";", "if", "(", "count", "(", "$", "aShippingCountryRestriction", ")", ">", "0", ")", "{", "$", "oShippingAddress", "=", "$", "oUser", "->", "GetShippingAddress", "(", ")", ";", "if", "(", "in_array", "(", "$", "oShippingAddress", "->", "fieldDataCountryId", ",", "$", "aShippingCountryRestriction", ")", ")", "{", "$", "bIsValidShippingCountry", "=", "true", ";", "}", "}", "else", "{", "$", "bIsValidShippingCountry", "=", "true", ";", "}", "return", "$", "bIsValidShippingCountry", ";", "}" ]
check shipping country. @param TdbDataExtranetUser $oUser @return bool
[ "check", "shipping", "country", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentMethod.class.php#L240-L254
32,367
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopPaymentMethod.class.php
TShopPaymentMethod.checkUserBillingCountry
protected function checkUserBillingCountry(TdbDataExtranetUser $oUser) { $bIsValidBillingCountry = false; $aShippingCountryRestriction = $this->getPaymentMethodDataAccess()->getBillingCountryIds($this->id); if (count($aShippingCountryRestriction) > 0) { $oBillingAddress = $oUser->GetBillingAddress(); if (in_array($oBillingAddress->fieldDataCountryId, $aShippingCountryRestriction)) { $bIsValidBillingCountry = true; } } else { $bIsValidBillingCountry = true; } return $bIsValidBillingCountry; }
php
protected function checkUserBillingCountry(TdbDataExtranetUser $oUser) { $bIsValidBillingCountry = false; $aShippingCountryRestriction = $this->getPaymentMethodDataAccess()->getBillingCountryIds($this->id); if (count($aShippingCountryRestriction) > 0) { $oBillingAddress = $oUser->GetBillingAddress(); if (in_array($oBillingAddress->fieldDataCountryId, $aShippingCountryRestriction)) { $bIsValidBillingCountry = true; } } else { $bIsValidBillingCountry = true; } return $bIsValidBillingCountry; }
[ "protected", "function", "checkUserBillingCountry", "(", "TdbDataExtranetUser", "$", "oUser", ")", "{", "$", "bIsValidBillingCountry", "=", "false", ";", "$", "aShippingCountryRestriction", "=", "$", "this", "->", "getPaymentMethodDataAccess", "(", ")", "->", "getBillingCountryIds", "(", "$", "this", "->", "id", ")", ";", "if", "(", "count", "(", "$", "aShippingCountryRestriction", ")", ">", "0", ")", "{", "$", "oBillingAddress", "=", "$", "oUser", "->", "GetBillingAddress", "(", ")", ";", "if", "(", "in_array", "(", "$", "oBillingAddress", "->", "fieldDataCountryId", ",", "$", "aShippingCountryRestriction", ")", ")", "{", "$", "bIsValidBillingCountry", "=", "true", ";", "}", "}", "else", "{", "$", "bIsValidBillingCountry", "=", "true", ";", "}", "return", "$", "bIsValidBillingCountry", ";", "}" ]
check billing country. @param TdbDataExtranetUser $oUser @return bool
[ "check", "billing", "country", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentMethod.class.php#L271-L285
32,368
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopPaymentMethod.class.php
TShopPaymentMethod.GetPrice
public function GetPrice() { if (is_null($this->dPrice)) { $this->dPrice = 0; $oBasket = TShopBasket::GetInstance(); if ('absolut' == $this->fieldValueType) { $this->dPrice = $this->fieldValue; } else { $this->dPrice = ($oBasket->dCostArticlesTotalAfterDiscounts * ($this->fieldValue / 100)); } $this->dPrice = round($this->dPrice, 2); } return $this->dPrice; }
php
public function GetPrice() { if (is_null($this->dPrice)) { $this->dPrice = 0; $oBasket = TShopBasket::GetInstance(); if ('absolut' == $this->fieldValueType) { $this->dPrice = $this->fieldValue; } else { $this->dPrice = ($oBasket->dCostArticlesTotalAfterDiscounts * ($this->fieldValue / 100)); } $this->dPrice = round($this->dPrice, 2); } return $this->dPrice; }
[ "public", "function", "GetPrice", "(", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "dPrice", ")", ")", "{", "$", "this", "->", "dPrice", "=", "0", ";", "$", "oBasket", "=", "TShopBasket", "::", "GetInstance", "(", ")", ";", "if", "(", "'absolut'", "==", "$", "this", "->", "fieldValueType", ")", "{", "$", "this", "->", "dPrice", "=", "$", "this", "->", "fieldValue", ";", "}", "else", "{", "$", "this", "->", "dPrice", "=", "(", "$", "oBasket", "->", "dCostArticlesTotalAfterDiscounts", "*", "(", "$", "this", "->", "fieldValue", "/", "100", ")", ")", ";", "}", "$", "this", "->", "dPrice", "=", "round", "(", "$", "this", "->", "dPrice", ",", "2", ")", ";", "}", "return", "$", "this", "->", "dPrice", ";", "}" ]
return payment method cost. @return float
[ "return", "payment", "method", "cost", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentMethod.class.php#L410-L424
32,369
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopPaymentMethod.class.php
TShopPaymentMethod.GetVat
public function GetVat() { $oVat = $this->GetFromInternalCache('ovat'); if (is_null($oVat)) { $oVat = $this->GetFieldShopVat(); if (is_null($oVat)) { $oShopConf = TdbShop::GetInstance(); $oVat = $oShopConf->GetVat(); } $this->SetInternalCache('ovat', $oVat); } return $oVat; }
php
public function GetVat() { $oVat = $this->GetFromInternalCache('ovat'); if (is_null($oVat)) { $oVat = $this->GetFieldShopVat(); if (is_null($oVat)) { $oShopConf = TdbShop::GetInstance(); $oVat = $oShopConf->GetVat(); } $this->SetInternalCache('ovat', $oVat); } return $oVat; }
[ "public", "function", "GetVat", "(", ")", "{", "$", "oVat", "=", "$", "this", "->", "GetFromInternalCache", "(", "'ovat'", ")", ";", "if", "(", "is_null", "(", "$", "oVat", ")", ")", "{", "$", "oVat", "=", "$", "this", "->", "GetFieldShopVat", "(", ")", ";", "if", "(", "is_null", "(", "$", "oVat", ")", ")", "{", "$", "oShopConf", "=", "TdbShop", "::", "GetInstance", "(", ")", ";", "$", "oVat", "=", "$", "oShopConf", "->", "GetVat", "(", ")", ";", "}", "$", "this", "->", "SetInternalCache", "(", "'ovat'", ",", "$", "oVat", ")", ";", "}", "return", "$", "oVat", ";", "}" ]
return the vat group for this payment method. attention: vat-logic for payment-methods is currently not implemented in basket! @return TdbShopVat
[ "return", "the", "vat", "group", "for", "this", "payment", "method", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentMethod.class.php#L434-L447
32,370
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopPaymentMethod.class.php
TShopPaymentMethod.processConfirmOrderUserResponse
public function processConfirmOrderUserResponse(TdbDataExtranetUser $user, $userData) { if (false === $this->GetFieldShopPaymentHandler() instanceof IPkgShopPaymentHandlerCustomConfirmOrderBlockInterface) { return true; } return $this->GetFieldShopPaymentHandler()->processConfirmOrderUserResponse($this, $user, $userData); }
php
public function processConfirmOrderUserResponse(TdbDataExtranetUser $user, $userData) { if (false === $this->GetFieldShopPaymentHandler() instanceof IPkgShopPaymentHandlerCustomConfirmOrderBlockInterface) { return true; } return $this->GetFieldShopPaymentHandler()->processConfirmOrderUserResponse($this, $user, $userData); }
[ "public", "function", "processConfirmOrderUserResponse", "(", "TdbDataExtranetUser", "$", "user", ",", "$", "userData", ")", "{", "if", "(", "false", "===", "$", "this", "->", "GetFieldShopPaymentHandler", "(", ")", "instanceof", "IPkgShopPaymentHandlerCustomConfirmOrderBlockInterface", ")", "{", "return", "true", ";", "}", "return", "$", "this", "->", "GetFieldShopPaymentHandler", "(", ")", "->", "processConfirmOrderUserResponse", "(", "$", "this", ",", "$", "user", ",", "$", "userData", ")", ";", "}" ]
is called when the user submits the order - allows you do validate and store any data the payment handler requested via renderConfirmOrderBlock. @param array $userData @return bool
[ "is", "called", "when", "the", "user", "submits", "the", "order", "-", "allows", "you", "do", "validate", "and", "store", "any", "data", "the", "payment", "handler", "requested", "via", "renderConfirmOrderBlock", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentMethod.class.php#L522-L529
32,371
chameleon-system/chameleon-shop
src/ImageHotspotBundle/mappers/TPkgImageHotspotMapper.class.php
TPkgImageHotspotMapper.renderObject
protected function renderObject($oTargetObject, $aRenderObjectConfig) { $sClassName = get_class($oTargetObject); if (false === isset($aRenderObjectConfig[$sClassName])) { return ''; } $aMapper = $aRenderObjectConfig[$sClassName]['mapper']; if (false === is_array($aMapper)) { $aMapper = array($aMapper); } $sSnippet = $aRenderObjectConfig[$sClassName]['snippet']; $oViewRenderer = new ViewRenderer(); foreach ($aMapper as $sMapper) { if (true === empty($sMapper)) { continue; } $oViewRenderer->addMapperFromIdentifier($sMapper); } $oViewRenderer->AddSourceObject('oObject', $oTargetObject); return $oViewRenderer->Render($sSnippet); }
php
protected function renderObject($oTargetObject, $aRenderObjectConfig) { $sClassName = get_class($oTargetObject); if (false === isset($aRenderObjectConfig[$sClassName])) { return ''; } $aMapper = $aRenderObjectConfig[$sClassName]['mapper']; if (false === is_array($aMapper)) { $aMapper = array($aMapper); } $sSnippet = $aRenderObjectConfig[$sClassName]['snippet']; $oViewRenderer = new ViewRenderer(); foreach ($aMapper as $sMapper) { if (true === empty($sMapper)) { continue; } $oViewRenderer->addMapperFromIdentifier($sMapper); } $oViewRenderer->AddSourceObject('oObject', $oTargetObject); return $oViewRenderer->Render($sSnippet); }
[ "protected", "function", "renderObject", "(", "$", "oTargetObject", ",", "$", "aRenderObjectConfig", ")", "{", "$", "sClassName", "=", "get_class", "(", "$", "oTargetObject", ")", ";", "if", "(", "false", "===", "isset", "(", "$", "aRenderObjectConfig", "[", "$", "sClassName", "]", ")", ")", "{", "return", "''", ";", "}", "$", "aMapper", "=", "$", "aRenderObjectConfig", "[", "$", "sClassName", "]", "[", "'mapper'", "]", ";", "if", "(", "false", "===", "is_array", "(", "$", "aMapper", ")", ")", "{", "$", "aMapper", "=", "array", "(", "$", "aMapper", ")", ";", "}", "$", "sSnippet", "=", "$", "aRenderObjectConfig", "[", "$", "sClassName", "]", "[", "'snippet'", "]", ";", "$", "oViewRenderer", "=", "new", "ViewRenderer", "(", ")", ";", "foreach", "(", "$", "aMapper", "as", "$", "sMapper", ")", "{", "if", "(", "true", "===", "empty", "(", "$", "sMapper", ")", ")", "{", "continue", ";", "}", "$", "oViewRenderer", "->", "addMapperFromIdentifier", "(", "$", "sMapper", ")", ";", "}", "$", "oViewRenderer", "->", "AddSourceObject", "(", "'oObject'", ",", "$", "oTargetObject", ")", ";", "return", "$", "oViewRenderer", "->", "Render", "(", "$", "sSnippet", ")", ";", "}" ]
renders hotspot marker layover container content. @param $oTargetObject @param array $aRenderObjectConfig @return string
[ "renders", "hotspot", "marker", "layover", "container", "content", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ImageHotspotBundle/mappers/TPkgImageHotspotMapper.class.php#L231-L253
32,372
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopModuleArticleList.class.php
TShopModuleArticleList.UpdateOrderById
public function UpdateOrderById($iId) { $this->sqlData['shop_module_articlelist_orderby_id'] = $iId; $this->fieldShopModuleArticlelistOrderbyId = $iId; $oItem = null; $this->SetInternalCache('oLookupshop_module_articlelist_orderby_id', $oItem); }
php
public function UpdateOrderById($iId) { $this->sqlData['shop_module_articlelist_orderby_id'] = $iId; $this->fieldShopModuleArticlelistOrderbyId = $iId; $oItem = null; $this->SetInternalCache('oLookupshop_module_articlelist_orderby_id', $oItem); }
[ "public", "function", "UpdateOrderById", "(", "$", "iId", ")", "{", "$", "this", "->", "sqlData", "[", "'shop_module_articlelist_orderby_id'", "]", "=", "$", "iId", ";", "$", "this", "->", "fieldShopModuleArticlelistOrderbyId", "=", "$", "iId", ";", "$", "oItem", "=", "null", ";", "$", "this", "->", "SetInternalCache", "(", "'oLookupshop_module_articlelist_orderby_id'", ",", "$", "oItem", ")", ";", "}" ]
set a new order by id - we need to do this using a method so that we can reset the internal cache for the connected lookup. @param int $iId
[ "set", "a", "new", "order", "by", "id", "-", "we", "need", "to", "do", "this", "using", "a", "method", "so", "that", "we", "can", "reset", "the", "internal", "cache", "for", "the", "connected", "lookup", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopModuleArticleList.class.php#L20-L26
32,373
chameleon-system/chameleon-shop
src/ShopPaymentIPNBundle/objects/db/TPkgShopPaymentIPN_TPkgShopPaymentHandlerGroup.class.php
TPkgShopPaymentIPN_TPkgShopPaymentHandlerGroup.isValidIP
public function isValidIP($sIP) { $bAllowed = false; $sIPSource = trim($this->fieldIpnAllowedIps); if ('' === $sIPSource) { return true; } $oNetworkHelper = new TPkgCoreUtility_Network(); $aIPList = explode("\n", $sIPSource); foreach ($aIPList as $sAllowedIP) { $sRangeType = $oNetworkHelper->getRangeType($sAllowedIP); switch ($sRangeType) { case TPkgCoreUtility_Network::IP_RANGE_TYPE_NONE: $bAllowed = ($sIP === $sAllowedIP); break; case TPkgCoreUtility_Network::IP_RANGE_TYPE_RANGE: case TPkgCoreUtility_Network::IP_RANGE_TYPE_WILDCARD: case TPkgCoreUtility_Network::IP_RANGE_TYPE_CIDR: $bAllowed = $oNetworkHelper->ipIsInRange($sIP, $sAllowedIP); break; } if (true === $bAllowed) { break; } } return $bAllowed; }
php
public function isValidIP($sIP) { $bAllowed = false; $sIPSource = trim($this->fieldIpnAllowedIps); if ('' === $sIPSource) { return true; } $oNetworkHelper = new TPkgCoreUtility_Network(); $aIPList = explode("\n", $sIPSource); foreach ($aIPList as $sAllowedIP) { $sRangeType = $oNetworkHelper->getRangeType($sAllowedIP); switch ($sRangeType) { case TPkgCoreUtility_Network::IP_RANGE_TYPE_NONE: $bAllowed = ($sIP === $sAllowedIP); break; case TPkgCoreUtility_Network::IP_RANGE_TYPE_RANGE: case TPkgCoreUtility_Network::IP_RANGE_TYPE_WILDCARD: case TPkgCoreUtility_Network::IP_RANGE_TYPE_CIDR: $bAllowed = $oNetworkHelper->ipIsInRange($sIP, $sAllowedIP); break; } if (true === $bAllowed) { break; } } return $bAllowed; }
[ "public", "function", "isValidIP", "(", "$", "sIP", ")", "{", "$", "bAllowed", "=", "false", ";", "$", "sIPSource", "=", "trim", "(", "$", "this", "->", "fieldIpnAllowedIps", ")", ";", "if", "(", "''", "===", "$", "sIPSource", ")", "{", "return", "true", ";", "}", "$", "oNetworkHelper", "=", "new", "TPkgCoreUtility_Network", "(", ")", ";", "$", "aIPList", "=", "explode", "(", "\"\\n\"", ",", "$", "sIPSource", ")", ";", "foreach", "(", "$", "aIPList", "as", "$", "sAllowedIP", ")", "{", "$", "sRangeType", "=", "$", "oNetworkHelper", "->", "getRangeType", "(", "$", "sAllowedIP", ")", ";", "switch", "(", "$", "sRangeType", ")", "{", "case", "TPkgCoreUtility_Network", "::", "IP_RANGE_TYPE_NONE", ":", "$", "bAllowed", "=", "(", "$", "sIP", "===", "$", "sAllowedIP", ")", ";", "break", ";", "case", "TPkgCoreUtility_Network", "::", "IP_RANGE_TYPE_RANGE", ":", "case", "TPkgCoreUtility_Network", "::", "IP_RANGE_TYPE_WILDCARD", ":", "case", "TPkgCoreUtility_Network", "::", "IP_RANGE_TYPE_CIDR", ":", "$", "bAllowed", "=", "$", "oNetworkHelper", "->", "ipIsInRange", "(", "$", "sIP", ",", "$", "sAllowedIP", ")", ";", "break", ";", "}", "if", "(", "true", "===", "$", "bAllowed", ")", "{", "break", ";", "}", "}", "return", "$", "bAllowed", ";", "}" ]
return true if the ip may send IPN to this payment type. @param $sIP @return bool
[ "return", "true", "if", "the", "ip", "may", "send", "IPN", "to", "this", "payment", "type", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopPaymentIPNBundle/objects/db/TPkgShopPaymentIPN_TPkgShopPaymentHandlerGroup.class.php#L21-L50
32,374
chameleon-system/chameleon-shop
src/ShopPaymentIPNBundle/objects/db/TPkgShopPaymentIPN_TPkgShopPaymentHandlerGroup.class.php
TPkgShopPaymentIPN_TPkgShopPaymentHandlerGroup.handleTransactionHook
protected function handleTransactionHook(IPkgShopPaymentIPNHandler $oHandler, TPkgShopPaymentIPNRequest $oRequest) { $oOrder = $oRequest->getOrder(); if (null === $oOrder) { return; } $oTransactionDetails = $oHandler->getIPNTransactionDetails($oRequest); if (null === $oTransactionDetails) { return; } $oTransactionManager = new TPkgShopPaymentTransactionManager($oOrder); $sStatus = ''; $oStatus = $oRequest->getIpnStatus(); if (null !== $oStatus) { $sStatus = $oStatus->fieldCode; } $oTransaction = null; // try to update the corresponding transaction first if (null !== $oTransactionDetails->getSequenceNumber()) { $oTransaction = $oTransactionManager->confirmTransaction( $oTransactionDetails->getSequenceNumber(), $oTransactionDetails->getTransactionTimestamp() ); } if (null === $oTransaction) { \ChameleonSystem\CoreBundle\ServiceLocator::get('monolog.logger.order_payment_ipn')->warning( "IPN had transaction data but no matching transaction was found. order-id: {$oOrder->id}, ordernumber: {$oOrder->fieldOrdernumber}", array('request' => $oRequest->getRequestPayload()) ); } }
php
protected function handleTransactionHook(IPkgShopPaymentIPNHandler $oHandler, TPkgShopPaymentIPNRequest $oRequest) { $oOrder = $oRequest->getOrder(); if (null === $oOrder) { return; } $oTransactionDetails = $oHandler->getIPNTransactionDetails($oRequest); if (null === $oTransactionDetails) { return; } $oTransactionManager = new TPkgShopPaymentTransactionManager($oOrder); $sStatus = ''; $oStatus = $oRequest->getIpnStatus(); if (null !== $oStatus) { $sStatus = $oStatus->fieldCode; } $oTransaction = null; // try to update the corresponding transaction first if (null !== $oTransactionDetails->getSequenceNumber()) { $oTransaction = $oTransactionManager->confirmTransaction( $oTransactionDetails->getSequenceNumber(), $oTransactionDetails->getTransactionTimestamp() ); } if (null === $oTransaction) { \ChameleonSystem\CoreBundle\ServiceLocator::get('monolog.logger.order_payment_ipn')->warning( "IPN had transaction data but no matching transaction was found. order-id: {$oOrder->id}, ordernumber: {$oOrder->fieldOrdernumber}", array('request' => $oRequest->getRequestPayload()) ); } }
[ "protected", "function", "handleTransactionHook", "(", "IPkgShopPaymentIPNHandler", "$", "oHandler", ",", "TPkgShopPaymentIPNRequest", "$", "oRequest", ")", "{", "$", "oOrder", "=", "$", "oRequest", "->", "getOrder", "(", ")", ";", "if", "(", "null", "===", "$", "oOrder", ")", "{", "return", ";", "}", "$", "oTransactionDetails", "=", "$", "oHandler", "->", "getIPNTransactionDetails", "(", "$", "oRequest", ")", ";", "if", "(", "null", "===", "$", "oTransactionDetails", ")", "{", "return", ";", "}", "$", "oTransactionManager", "=", "new", "TPkgShopPaymentTransactionManager", "(", "$", "oOrder", ")", ";", "$", "sStatus", "=", "''", ";", "$", "oStatus", "=", "$", "oRequest", "->", "getIpnStatus", "(", ")", ";", "if", "(", "null", "!==", "$", "oStatus", ")", "{", "$", "sStatus", "=", "$", "oStatus", "->", "fieldCode", ";", "}", "$", "oTransaction", "=", "null", ";", "// try to update the corresponding transaction first", "if", "(", "null", "!==", "$", "oTransactionDetails", "->", "getSequenceNumber", "(", ")", ")", "{", "$", "oTransaction", "=", "$", "oTransactionManager", "->", "confirmTransaction", "(", "$", "oTransactionDetails", "->", "getSequenceNumber", "(", ")", ",", "$", "oTransactionDetails", "->", "getTransactionTimestamp", "(", ")", ")", ";", "}", "if", "(", "null", "===", "$", "oTransaction", ")", "{", "\\", "ChameleonSystem", "\\", "CoreBundle", "\\", "ServiceLocator", "::", "get", "(", "'monolog.logger.order_payment_ipn'", ")", "->", "warning", "(", "\"IPN had transaction data but no matching transaction was found. order-id: {$oOrder->id}, ordernumber: {$oOrder->fieldOrdernumber}\"", ",", "array", "(", "'request'", "=>", "$", "oRequest", "->", "getRequestPayload", "(", ")", ")", ")", ";", "}", "}" ]
trigger transaction for the order based on the IPN. @param IPkgShopPaymentIPNHandler $oHandler @param TPkgShopPaymentIPNRequest $oRequest
[ "trigger", "transaction", "for", "the", "order", "based", "on", "the", "IPN", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopPaymentIPNBundle/objects/db/TPkgShopPaymentIPN_TPkgShopPaymentHandlerGroup.class.php#L103-L138
32,375
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopModuleArticleListFilter/TShopModuleArticleListFilter.class.php
TShopModuleArticleListFilter.GetNewInstance
public static function GetNewInstance($sData = null, $sLanguage = null) { $canBeCached = false; $cacheKey = null; if (false === is_array($sData)) { $canBeCached = true; $cacheKey = "$sData|$sLanguage"; if (isset(self::$cache[$cacheKey])) { return clone self::$cache[$cacheKey]; } } $oObject = parent:: GetNewInstance($sData, $sLanguage); if ($oObject && false !== $oObject->sqlData && isset($oObject->sqlData['class']) && !empty($oObject->sqlData['class'])) { $sClassName = $oObject->sqlData['class']; $oNewObject = new $sClassName(); $oNewObject->LoadFromRow($oObject->sqlData); if ($canBeCached) { self::$cache[$cacheKey] = $oNewObject; } return $oNewObject; } return $oObject; }
php
public static function GetNewInstance($sData = null, $sLanguage = null) { $canBeCached = false; $cacheKey = null; if (false === is_array($sData)) { $canBeCached = true; $cacheKey = "$sData|$sLanguage"; if (isset(self::$cache[$cacheKey])) { return clone self::$cache[$cacheKey]; } } $oObject = parent:: GetNewInstance($sData, $sLanguage); if ($oObject && false !== $oObject->sqlData && isset($oObject->sqlData['class']) && !empty($oObject->sqlData['class'])) { $sClassName = $oObject->sqlData['class']; $oNewObject = new $sClassName(); $oNewObject->LoadFromRow($oObject->sqlData); if ($canBeCached) { self::$cache[$cacheKey] = $oNewObject; } return $oNewObject; } return $oObject; }
[ "public", "static", "function", "GetNewInstance", "(", "$", "sData", "=", "null", ",", "$", "sLanguage", "=", "null", ")", "{", "$", "canBeCached", "=", "false", ";", "$", "cacheKey", "=", "null", ";", "if", "(", "false", "===", "is_array", "(", "$", "sData", ")", ")", "{", "$", "canBeCached", "=", "true", ";", "$", "cacheKey", "=", "\"$sData|$sLanguage\"", ";", "if", "(", "isset", "(", "self", "::", "$", "cache", "[", "$", "cacheKey", "]", ")", ")", "{", "return", "clone", "self", "::", "$", "cache", "[", "$", "cacheKey", "]", ";", "}", "}", "$", "oObject", "=", "parent", "::", "GetNewInstance", "(", "$", "sData", ",", "$", "sLanguage", ")", ";", "if", "(", "$", "oObject", "&&", "false", "!==", "$", "oObject", "->", "sqlData", "&&", "isset", "(", "$", "oObject", "->", "sqlData", "[", "'class'", "]", ")", "&&", "!", "empty", "(", "$", "oObject", "->", "sqlData", "[", "'class'", "]", ")", ")", "{", "$", "sClassName", "=", "$", "oObject", "->", "sqlData", "[", "'class'", "]", ";", "$", "oNewObject", "=", "new", "$", "sClassName", "(", ")", ";", "$", "oNewObject", "->", "LoadFromRow", "(", "$", "oObject", "->", "sqlData", ")", ";", "if", "(", "$", "canBeCached", ")", "{", "self", "::", "$", "cache", "[", "$", "cacheKey", "]", "=", "$", "oNewObject", ";", "}", "return", "$", "oNewObject", ";", "}", "return", "$", "oObject", ";", "}" ]
factory creates a new instance and returns it. @param string|array $sData - either the id of the object to load, or the row with which the instance should be initialized @param string $sLanguage - init with the language passed @return TdbShopModuleArticleListFilter
[ "factory", "creates", "a", "new", "instance", "and", "returns", "it", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopModuleArticleListFilter/TShopModuleArticleListFilter.class.php#L37-L62
32,376
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopModuleArticleListFilter/TShopModuleArticleListFilter.class.php
TShopModuleArticleListFilter.GetGlobalQueryRestrictions
protected function GetGlobalQueryRestrictions($oListConfig) { $aRestrictions = array(); $bRestrictToParentArticles = (false == $this->AllowArticleVariants()); $aRestrictions[] = TdbShopArticleList::GetActiveArticleQueryRestriction($bRestrictToParentArticles); return $aRestrictions; }
php
protected function GetGlobalQueryRestrictions($oListConfig) { $aRestrictions = array(); $bRestrictToParentArticles = (false == $this->AllowArticleVariants()); $aRestrictions[] = TdbShopArticleList::GetActiveArticleQueryRestriction($bRestrictToParentArticles); return $aRestrictions; }
[ "protected", "function", "GetGlobalQueryRestrictions", "(", "$", "oListConfig", ")", "{", "$", "aRestrictions", "=", "array", "(", ")", ";", "$", "bRestrictToParentArticles", "=", "(", "false", "==", "$", "this", "->", "AllowArticleVariants", "(", ")", ")", ";", "$", "aRestrictions", "[", "]", "=", "TdbShopArticleList", "::", "GetActiveArticleQueryRestriction", "(", "$", "bRestrictToParentArticles", ")", ";", "return", "$", "aRestrictions", ";", "}" ]
query restrictions added to the list. @param $oListConfig @return array
[ "query", "restrictions", "added", "to", "the", "list", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopModuleArticleListFilter/TShopModuleArticleListFilter.class.php#L138-L145
32,377
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopModuleArticleListFilter/TShopModuleArticleListFilter.class.php
TShopModuleArticleListFilter.GetListBaseQueryRestrictedToCategories
protected function GetListBaseQueryRestrictedToCategories(&$oListConfig, $aCategoryList = null) { $aCustRestriction = array(); // get category products $categories = $oListConfig->GetMLTIdList('shop_category_mlt'); $databaseConnection = $this->getDatabaseConnection(); $quotedListConfigId = $databaseConnection->quote($oListConfig->id); $quotedCategories = implode(',', array_map(array($databaseConnection, 'quote'), $categories)); $sQuery = "SELECT DISTINCT `shop_module_article_list_article`.`name` AS conf_alternativ_header, (-1*`shop_module_article_list_article`.`position`) AS cms_search_weight, `shop_article`.* FROM `shop_article` LEFT JOIN `shop_article_shop_category_mlt` ON `shop_article`.`id` = `shop_article_shop_category_mlt`.`source_id` LEFT JOIN `shop_article_stats` ON `shop_article`.`id` = `shop_article_stats`.`shop_article_id` LEFT JOIN `shop_article_stock` ON `shop_article`.`id` = `shop_article_stock`.`shop_article_id` LEFT JOIN `shop_module_article_list_article` ON (`shop_module_article_list_article`.`shop_module_article_list_id` = $quotedListConfigId AND `shop_article`.`id` = `shop_module_article_list_article`.`shop_article_id`) "; if (count($categories) > 0) { $aCustRestriction[] = "`shop_article_shop_category_mlt`.`target_id` IN ($quotedCategories)"; } $manuallySelectedArticles = &$oListConfig->GetFieldShopModuleArticleListArticleList(); if ($manuallySelectedArticles->Length() > 0) { $aCustRestriction[] = "`shop_module_article_list_article`.`shop_module_article_list_id` = $quotedListConfigId"; } // get warengruppen $productGroupRestriction = $oListConfig->GetMLTIdList('shop_article_group_mlt'); if (count($productGroupRestriction) > 0) { $sQuery .= ' LEFT JOIN `shop_article_shop_article_group_mlt` ON `shop_article`.`id` = `shop_article_shop_article_group_mlt`.`source_id` '; $productGroupRestriction = implode(',', array_map(array($databaseConnection, 'quote'), $productGroupRestriction)); $aCustRestriction[] = "`shop_article_shop_article_group_mlt`.`target_id` IN ($productGroupRestriction)"; } $sCustQuery = 'WHERE 1=0'; if (count($aCustRestriction) > 0) { $sCustQuery = 'WHERE ('.implode("\nOR ", $aCustRestriction).')'; } if (null !== $aCategoryList) { $escapedCategoryList = implode(',', array_map(array($databaseConnection, 'quote'), $aCategoryList)); $sCustQuery .= " AND (`shop_article_shop_category_mlt`.`target_id` IN ($escapedCategoryList))"; } $sQuery .= $sCustQuery; return $sQuery; }
php
protected function GetListBaseQueryRestrictedToCategories(&$oListConfig, $aCategoryList = null) { $aCustRestriction = array(); // get category products $categories = $oListConfig->GetMLTIdList('shop_category_mlt'); $databaseConnection = $this->getDatabaseConnection(); $quotedListConfigId = $databaseConnection->quote($oListConfig->id); $quotedCategories = implode(',', array_map(array($databaseConnection, 'quote'), $categories)); $sQuery = "SELECT DISTINCT `shop_module_article_list_article`.`name` AS conf_alternativ_header, (-1*`shop_module_article_list_article`.`position`) AS cms_search_weight, `shop_article`.* FROM `shop_article` LEFT JOIN `shop_article_shop_category_mlt` ON `shop_article`.`id` = `shop_article_shop_category_mlt`.`source_id` LEFT JOIN `shop_article_stats` ON `shop_article`.`id` = `shop_article_stats`.`shop_article_id` LEFT JOIN `shop_article_stock` ON `shop_article`.`id` = `shop_article_stock`.`shop_article_id` LEFT JOIN `shop_module_article_list_article` ON (`shop_module_article_list_article`.`shop_module_article_list_id` = $quotedListConfigId AND `shop_article`.`id` = `shop_module_article_list_article`.`shop_article_id`) "; if (count($categories) > 0) { $aCustRestriction[] = "`shop_article_shop_category_mlt`.`target_id` IN ($quotedCategories)"; } $manuallySelectedArticles = &$oListConfig->GetFieldShopModuleArticleListArticleList(); if ($manuallySelectedArticles->Length() > 0) { $aCustRestriction[] = "`shop_module_article_list_article`.`shop_module_article_list_id` = $quotedListConfigId"; } // get warengruppen $productGroupRestriction = $oListConfig->GetMLTIdList('shop_article_group_mlt'); if (count($productGroupRestriction) > 0) { $sQuery .= ' LEFT JOIN `shop_article_shop_article_group_mlt` ON `shop_article`.`id` = `shop_article_shop_article_group_mlt`.`source_id` '; $productGroupRestriction = implode(',', array_map(array($databaseConnection, 'quote'), $productGroupRestriction)); $aCustRestriction[] = "`shop_article_shop_article_group_mlt`.`target_id` IN ($productGroupRestriction)"; } $sCustQuery = 'WHERE 1=0'; if (count($aCustRestriction) > 0) { $sCustQuery = 'WHERE ('.implode("\nOR ", $aCustRestriction).')'; } if (null !== $aCategoryList) { $escapedCategoryList = implode(',', array_map(array($databaseConnection, 'quote'), $aCategoryList)); $sCustQuery .= " AND (`shop_article_shop_category_mlt`.`target_id` IN ($escapedCategoryList))"; } $sQuery .= $sCustQuery; return $sQuery; }
[ "protected", "function", "GetListBaseQueryRestrictedToCategories", "(", "&", "$", "oListConfig", ",", "$", "aCategoryList", "=", "null", ")", "{", "$", "aCustRestriction", "=", "array", "(", ")", ";", "// get category products", "$", "categories", "=", "$", "oListConfig", "->", "GetMLTIdList", "(", "'shop_category_mlt'", ")", ";", "$", "databaseConnection", "=", "$", "this", "->", "getDatabaseConnection", "(", ")", ";", "$", "quotedListConfigId", "=", "$", "databaseConnection", "->", "quote", "(", "$", "oListConfig", "->", "id", ")", ";", "$", "quotedCategories", "=", "implode", "(", "','", ",", "array_map", "(", "array", "(", "$", "databaseConnection", ",", "'quote'", ")", ",", "$", "categories", ")", ")", ";", "$", "sQuery", "=", "\"SELECT DISTINCT `shop_module_article_list_article`.`name` AS conf_alternativ_header, (-1*`shop_module_article_list_article`.`position`) AS cms_search_weight, `shop_article`.*\n FROM `shop_article`\n LEFT JOIN `shop_article_shop_category_mlt` ON `shop_article`.`id` = `shop_article_shop_category_mlt`.`source_id`\n LEFT JOIN `shop_article_stats` ON `shop_article`.`id` = `shop_article_stats`.`shop_article_id`\n LEFT JOIN `shop_article_stock` ON `shop_article`.`id` = `shop_article_stock`.`shop_article_id`\n LEFT JOIN `shop_module_article_list_article` ON (`shop_module_article_list_article`.`shop_module_article_list_id` = $quotedListConfigId AND `shop_article`.`id` = `shop_module_article_list_article`.`shop_article_id`)\n \"", ";", "if", "(", "count", "(", "$", "categories", ")", ">", "0", ")", "{", "$", "aCustRestriction", "[", "]", "=", "\"`shop_article_shop_category_mlt`.`target_id` IN ($quotedCategories)\"", ";", "}", "$", "manuallySelectedArticles", "=", "&", "$", "oListConfig", "->", "GetFieldShopModuleArticleListArticleList", "(", ")", ";", "if", "(", "$", "manuallySelectedArticles", "->", "Length", "(", ")", ">", "0", ")", "{", "$", "aCustRestriction", "[", "]", "=", "\"`shop_module_article_list_article`.`shop_module_article_list_id` = $quotedListConfigId\"", ";", "}", "// get warengruppen", "$", "productGroupRestriction", "=", "$", "oListConfig", "->", "GetMLTIdList", "(", "'shop_article_group_mlt'", ")", ";", "if", "(", "count", "(", "$", "productGroupRestriction", ")", ">", "0", ")", "{", "$", "sQuery", ".=", "' LEFT JOIN `shop_article_shop_article_group_mlt` ON `shop_article`.`id` = `shop_article_shop_article_group_mlt`.`source_id` '", ";", "$", "productGroupRestriction", "=", "implode", "(", "','", ",", "array_map", "(", "array", "(", "$", "databaseConnection", ",", "'quote'", ")", ",", "$", "productGroupRestriction", ")", ")", ";", "$", "aCustRestriction", "[", "]", "=", "\"`shop_article_shop_article_group_mlt`.`target_id` IN ($productGroupRestriction)\"", ";", "}", "$", "sCustQuery", "=", "'WHERE 1=0'", ";", "if", "(", "count", "(", "$", "aCustRestriction", ")", ">", "0", ")", "{", "$", "sCustQuery", "=", "'WHERE ('", ".", "implode", "(", "\"\\nOR \"", ",", "$", "aCustRestriction", ")", ".", "')'", ";", "}", "if", "(", "null", "!==", "$", "aCategoryList", ")", "{", "$", "escapedCategoryList", "=", "implode", "(", "','", ",", "array_map", "(", "array", "(", "$", "databaseConnection", ",", "'quote'", ")", ",", "$", "aCategoryList", ")", ")", ";", "$", "sCustQuery", ".=", "\" AND (`shop_article_shop_category_mlt`.`target_id` IN ($escapedCategoryList))\"", ";", "}", "$", "sQuery", ".=", "$", "sCustQuery", ";", "return", "$", "sQuery", ";", "}" ]
return a query for all manually assigned articles. this list can be restricted to a list of categories. @param TdbShopModuleArticleList $oListConfig @param array $aCategoryList @return string
[ "return", "a", "query", "for", "all", "manually", "assigned", "articles", ".", "this", "list", "can", "be", "restricted", "to", "a", "list", "of", "categories", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopModuleArticleListFilter/TShopModuleArticleListFilter.class.php#L185-L231
32,378
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerPayPal.class.php
TShopPaymentHandlerPayPal.CallPayPalExpressCheckout
protected function CallPayPalExpressCheckout($sMessageConsumer) { $oGlobal = TGlobal::instance(); $sReturnURLBase = $this->getActivePageService()->getActivePage()->GetRealURLPlain(array(), true); if ('.html' == substr($sReturnURLBase, -5)) { $sReturnURLBase = substr($sReturnURLBase, 0, -5); } if ('/' != substr($sReturnURLBase, -1)) { $sReturnURLBase .= '/'; } $sSuccessURL = $sReturnURLBase.self::URL_IDENTIFIER.'success/spot_'.$oGlobal->GetExecutingModulePointer()->sModuleSpotName; $sCancelURL = $sReturnURLBase.self::URL_IDENTIFIER.'cancel/spot_'.$oGlobal->GetExecutingModulePointer()->sModuleSpotName; $oBasket = TShopBasket::GetInstance(); $aParameter = array(); $aParameter['PAYMENTREQUEST_0_AMT'] = number_format($oBasket->dCostTotal, 2); // the total value to charge (use US-Format (1000.00) $aParameter['PAYMENTREQUEST_0_CURRENCYCODE'] = $this->GetCurrencyIdentifier(); $aParameter['RETURNURL'] = $sSuccessURL; // go to the checkout complete page $aParameter['CANCELURL'] = $sCancelURL; //urldecode(str_replace('&amp;','&',$oActivePage->GetRealURL(array('paypalreturn'=>'1'),$aExcludes,true))); // return to the cancel page // styling $aParameter['HDRIMG'] = ''; // - : specify an image to appear at the top left of the payment page $aParameter['HDRBORDERCOLOR'] = ''; // - : set the border color around the header of the payment page $aParameter['HDRBACKCOLOR'] = ''; // - : set the background color for the background of the header of the payment page $aParameter['PAYFLOWCOLOR'] = ''; // - : set the background color for the payment page //$aParameter['notify_url'] = $this->GetInstantPaymentNotificationListenerURL(); // instant payment notification url $logger = $this->getPaypalLogger(); $logger->info('Parameters sent to the PayPal API', $aParameter); $aResponse = $this->ExecutePayPalCall('SetExpressCheckout', $aParameter); $sSuccess = false; // store relevant data in session - and redirect to paypal if (array_key_exists('ACK', $aResponse)) { $sAckResponse = strtoupper($aResponse['ACK']); if ('SUCCESS' == $sAckResponse) { $this->sPayPalToken = urldecode($aResponse['TOKEN']); $payPalURL = $this->GetConfigParameter('url').'?cmd=_express-checkout&token='.$this->sPayPalToken; $this->getRedirect()->redirect($payPalURL); $sSuccess = true; } } if (!$sSuccess) { $sResponse = self::GetPayPalErrorMessage($aResponse); $logger->critical('PayPal payment could not be initiated.', array($sResponse)); $oMsgManager = TCMSMessageManager::GetInstance(); $oMsgManager->AddMessage($sMessageConsumer, 'ERROR-ORDER-REQUEST-PAYMENT-ERROR', array('errorMsg' => 'Error Number: '.$aResponse['L_ERRORCODE0'])); } return $sSuccess; }
php
protected function CallPayPalExpressCheckout($sMessageConsumer) { $oGlobal = TGlobal::instance(); $sReturnURLBase = $this->getActivePageService()->getActivePage()->GetRealURLPlain(array(), true); if ('.html' == substr($sReturnURLBase, -5)) { $sReturnURLBase = substr($sReturnURLBase, 0, -5); } if ('/' != substr($sReturnURLBase, -1)) { $sReturnURLBase .= '/'; } $sSuccessURL = $sReturnURLBase.self::URL_IDENTIFIER.'success/spot_'.$oGlobal->GetExecutingModulePointer()->sModuleSpotName; $sCancelURL = $sReturnURLBase.self::URL_IDENTIFIER.'cancel/spot_'.$oGlobal->GetExecutingModulePointer()->sModuleSpotName; $oBasket = TShopBasket::GetInstance(); $aParameter = array(); $aParameter['PAYMENTREQUEST_0_AMT'] = number_format($oBasket->dCostTotal, 2); // the total value to charge (use US-Format (1000.00) $aParameter['PAYMENTREQUEST_0_CURRENCYCODE'] = $this->GetCurrencyIdentifier(); $aParameter['RETURNURL'] = $sSuccessURL; // go to the checkout complete page $aParameter['CANCELURL'] = $sCancelURL; //urldecode(str_replace('&amp;','&',$oActivePage->GetRealURL(array('paypalreturn'=>'1'),$aExcludes,true))); // return to the cancel page // styling $aParameter['HDRIMG'] = ''; // - : specify an image to appear at the top left of the payment page $aParameter['HDRBORDERCOLOR'] = ''; // - : set the border color around the header of the payment page $aParameter['HDRBACKCOLOR'] = ''; // - : set the background color for the background of the header of the payment page $aParameter['PAYFLOWCOLOR'] = ''; // - : set the background color for the payment page //$aParameter['notify_url'] = $this->GetInstantPaymentNotificationListenerURL(); // instant payment notification url $logger = $this->getPaypalLogger(); $logger->info('Parameters sent to the PayPal API', $aParameter); $aResponse = $this->ExecutePayPalCall('SetExpressCheckout', $aParameter); $sSuccess = false; // store relevant data in session - and redirect to paypal if (array_key_exists('ACK', $aResponse)) { $sAckResponse = strtoupper($aResponse['ACK']); if ('SUCCESS' == $sAckResponse) { $this->sPayPalToken = urldecode($aResponse['TOKEN']); $payPalURL = $this->GetConfigParameter('url').'?cmd=_express-checkout&token='.$this->sPayPalToken; $this->getRedirect()->redirect($payPalURL); $sSuccess = true; } } if (!$sSuccess) { $sResponse = self::GetPayPalErrorMessage($aResponse); $logger->critical('PayPal payment could not be initiated.', array($sResponse)); $oMsgManager = TCMSMessageManager::GetInstance(); $oMsgManager->AddMessage($sMessageConsumer, 'ERROR-ORDER-REQUEST-PAYMENT-ERROR', array('errorMsg' => 'Error Number: '.$aResponse['L_ERRORCODE0'])); } return $sSuccess; }
[ "protected", "function", "CallPayPalExpressCheckout", "(", "$", "sMessageConsumer", ")", "{", "$", "oGlobal", "=", "TGlobal", "::", "instance", "(", ")", ";", "$", "sReturnURLBase", "=", "$", "this", "->", "getActivePageService", "(", ")", "->", "getActivePage", "(", ")", "->", "GetRealURLPlain", "(", "array", "(", ")", ",", "true", ")", ";", "if", "(", "'.html'", "==", "substr", "(", "$", "sReturnURLBase", ",", "-", "5", ")", ")", "{", "$", "sReturnURLBase", "=", "substr", "(", "$", "sReturnURLBase", ",", "0", ",", "-", "5", ")", ";", "}", "if", "(", "'/'", "!=", "substr", "(", "$", "sReturnURLBase", ",", "-", "1", ")", ")", "{", "$", "sReturnURLBase", ".=", "'/'", ";", "}", "$", "sSuccessURL", "=", "$", "sReturnURLBase", ".", "self", "::", "URL_IDENTIFIER", ".", "'success/spot_'", ".", "$", "oGlobal", "->", "GetExecutingModulePointer", "(", ")", "->", "sModuleSpotName", ";", "$", "sCancelURL", "=", "$", "sReturnURLBase", ".", "self", "::", "URL_IDENTIFIER", ".", "'cancel/spot_'", ".", "$", "oGlobal", "->", "GetExecutingModulePointer", "(", ")", "->", "sModuleSpotName", ";", "$", "oBasket", "=", "TShopBasket", "::", "GetInstance", "(", ")", ";", "$", "aParameter", "=", "array", "(", ")", ";", "$", "aParameter", "[", "'PAYMENTREQUEST_0_AMT'", "]", "=", "number_format", "(", "$", "oBasket", "->", "dCostTotal", ",", "2", ")", ";", "// the total value to charge (use US-Format (1000.00)", "$", "aParameter", "[", "'PAYMENTREQUEST_0_CURRENCYCODE'", "]", "=", "$", "this", "->", "GetCurrencyIdentifier", "(", ")", ";", "$", "aParameter", "[", "'RETURNURL'", "]", "=", "$", "sSuccessURL", ";", "// go to the checkout complete page", "$", "aParameter", "[", "'CANCELURL'", "]", "=", "$", "sCancelURL", ";", "//urldecode(str_replace('&amp;','&',$oActivePage->GetRealURL(array('paypalreturn'=>'1'),$aExcludes,true))); // return to the cancel page", "// styling", "$", "aParameter", "[", "'HDRIMG'", "]", "=", "''", ";", "// - : specify an image to appear at the top left of the payment page", "$", "aParameter", "[", "'HDRBORDERCOLOR'", "]", "=", "''", ";", "// - : set the border color around the header of the payment page", "$", "aParameter", "[", "'HDRBACKCOLOR'", "]", "=", "''", ";", "// - : set the background color for the background of the header of the payment page", "$", "aParameter", "[", "'PAYFLOWCOLOR'", "]", "=", "''", ";", "// - : set the background color for the payment page", "//$aParameter['notify_url'] = $this->GetInstantPaymentNotificationListenerURL(); // instant payment notification url", "$", "logger", "=", "$", "this", "->", "getPaypalLogger", "(", ")", ";", "$", "logger", "->", "info", "(", "'Parameters sent to the PayPal API'", ",", "$", "aParameter", ")", ";", "$", "aResponse", "=", "$", "this", "->", "ExecutePayPalCall", "(", "'SetExpressCheckout'", ",", "$", "aParameter", ")", ";", "$", "sSuccess", "=", "false", ";", "// store relevant data in session - and redirect to paypal", "if", "(", "array_key_exists", "(", "'ACK'", ",", "$", "aResponse", ")", ")", "{", "$", "sAckResponse", "=", "strtoupper", "(", "$", "aResponse", "[", "'ACK'", "]", ")", ";", "if", "(", "'SUCCESS'", "==", "$", "sAckResponse", ")", "{", "$", "this", "->", "sPayPalToken", "=", "urldecode", "(", "$", "aResponse", "[", "'TOKEN'", "]", ")", ";", "$", "payPalURL", "=", "$", "this", "->", "GetConfigParameter", "(", "'url'", ")", ".", "'?cmd=_express-checkout&token='", ".", "$", "this", "->", "sPayPalToken", ";", "$", "this", "->", "getRedirect", "(", ")", "->", "redirect", "(", "$", "payPalURL", ")", ";", "$", "sSuccess", "=", "true", ";", "}", "}", "if", "(", "!", "$", "sSuccess", ")", "{", "$", "sResponse", "=", "self", "::", "GetPayPalErrorMessage", "(", "$", "aResponse", ")", ";", "$", "logger", "->", "critical", "(", "'PayPal payment could not be initiated.'", ",", "array", "(", "$", "sResponse", ")", ")", ";", "$", "oMsgManager", "=", "TCMSMessageManager", "::", "GetInstance", "(", ")", ";", "$", "oMsgManager", "->", "AddMessage", "(", "$", "sMessageConsumer", ",", "'ERROR-ORDER-REQUEST-PAYMENT-ERROR'", ",", "array", "(", "'errorMsg'", "=>", "'Error Number: '", ".", "$", "aResponse", "[", "'L_ERRORCODE0'", "]", ")", ")", ";", "}", "return", "$", "sSuccess", ";", "}" ]
return the URL to the IFrame we call in order for paypal to collect the data. @param string $sMessageConsumer - the name of the message handler that can display messages if an error occurs (assuming you return false) @return string
[ "return", "the", "URL", "to", "the", "IFrame", "we", "call", "in", "order", "for", "paypal", "to", "collect", "the", "data", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerPayPal.class.php#L57-L112
32,379
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerPayPal.class.php
TShopPaymentHandlerPayPal.GetPayPalErrorMessage
protected static function GetPayPalErrorMessage($aMessageData) { $aMsg = array(); if (array_key_exists('curl_error_no', $aMessageData)) { $aMsg[] = 'Error Number: '.$aMessageData['curl_error_no']; $aMsg[] = 'Error Message: '.$aMessageData['curl_error_msg']; } elseif (count($aMessageData) > 0) { $aMsg[] = 'Ack: '.$aMessageData['ACK']; $aMsg[] = 'Correlation ID: '.$aMessageData['CORRELATIONID']; $aMsg[] = 'Version: '.$aMessageData['VERSION']; $count = 0; while (isset($aMessageData['L_SHORTMESSAGE'.$count])) { $aMsg[] = 'Error Number: '.$aMessageData['L_ERRORCODE'.$count]; $aMsg[] = 'Short Message: '.$aMessageData['L_SHORTMESSAGE'.$count]; $aMsg[] = 'Long Message: '.$aMessageData['L_LONGMESSAGE'.$count]; $count = $count + 1; } } else { $aMsg[] = 'Problem communicating with PayPal. See log for details.'; } $sMsg = implode("\n", $aMsg); $sMsg = nl2br($sMsg); return $sMsg; }
php
protected static function GetPayPalErrorMessage($aMessageData) { $aMsg = array(); if (array_key_exists('curl_error_no', $aMessageData)) { $aMsg[] = 'Error Number: '.$aMessageData['curl_error_no']; $aMsg[] = 'Error Message: '.$aMessageData['curl_error_msg']; } elseif (count($aMessageData) > 0) { $aMsg[] = 'Ack: '.$aMessageData['ACK']; $aMsg[] = 'Correlation ID: '.$aMessageData['CORRELATIONID']; $aMsg[] = 'Version: '.$aMessageData['VERSION']; $count = 0; while (isset($aMessageData['L_SHORTMESSAGE'.$count])) { $aMsg[] = 'Error Number: '.$aMessageData['L_ERRORCODE'.$count]; $aMsg[] = 'Short Message: '.$aMessageData['L_SHORTMESSAGE'.$count]; $aMsg[] = 'Long Message: '.$aMessageData['L_LONGMESSAGE'.$count]; $count = $count + 1; } } else { $aMsg[] = 'Problem communicating with PayPal. See log for details.'; } $sMsg = implode("\n", $aMsg); $sMsg = nl2br($sMsg); return $sMsg; }
[ "protected", "static", "function", "GetPayPalErrorMessage", "(", "$", "aMessageData", ")", "{", "$", "aMsg", "=", "array", "(", ")", ";", "if", "(", "array_key_exists", "(", "'curl_error_no'", ",", "$", "aMessageData", ")", ")", "{", "$", "aMsg", "[", "]", "=", "'Error Number: '", ".", "$", "aMessageData", "[", "'curl_error_no'", "]", ";", "$", "aMsg", "[", "]", "=", "'Error Message: '", ".", "$", "aMessageData", "[", "'curl_error_msg'", "]", ";", "}", "elseif", "(", "count", "(", "$", "aMessageData", ")", ">", "0", ")", "{", "$", "aMsg", "[", "]", "=", "'Ack: '", ".", "$", "aMessageData", "[", "'ACK'", "]", ";", "$", "aMsg", "[", "]", "=", "'Correlation ID: '", ".", "$", "aMessageData", "[", "'CORRELATIONID'", "]", ";", "$", "aMsg", "[", "]", "=", "'Version: '", ".", "$", "aMessageData", "[", "'VERSION'", "]", ";", "$", "count", "=", "0", ";", "while", "(", "isset", "(", "$", "aMessageData", "[", "'L_SHORTMESSAGE'", ".", "$", "count", "]", ")", ")", "{", "$", "aMsg", "[", "]", "=", "'Error Number: '", ".", "$", "aMessageData", "[", "'L_ERRORCODE'", ".", "$", "count", "]", ";", "$", "aMsg", "[", "]", "=", "'Short Message: '", ".", "$", "aMessageData", "[", "'L_SHORTMESSAGE'", ".", "$", "count", "]", ";", "$", "aMsg", "[", "]", "=", "'Long Message: '", ".", "$", "aMessageData", "[", "'L_LONGMESSAGE'", ".", "$", "count", "]", ";", "$", "count", "=", "$", "count", "+", "1", ";", "}", "}", "else", "{", "$", "aMsg", "[", "]", "=", "'Problem communicating with PayPal. See log for details.'", ";", "}", "$", "sMsg", "=", "implode", "(", "\"\\n\"", ",", "$", "aMsg", ")", ";", "$", "sMsg", "=", "nl2br", "(", "$", "sMsg", ")", ";", "return", "$", "sMsg", ";", "}" ]
renders a paypal response error message. @param $aMessageData @return string
[ "renders", "a", "paypal", "response", "error", "message", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerPayPal.class.php#L121-L145
32,380
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerPayPal.class.php
TShopPaymentHandlerPayPal.ExecutePayment
public function ExecutePayment(TdbShopOrder &$oOrder, $sMessageConsumer = '') { $bPaymentOk = parent::ExecutePayment($oOrder); $oCurrency = null; if (method_exists($oOrder, 'GetFieldPkgShopCurrency')) { $oCurrency = $oOrder->GetFieldPkgShopCurrency(); } $sCurrency = $this->GetCurrencyIdentifier($oCurrency); $request = $this->getCurrentRequest(); $aCommand = array( 'TOKEN' => $this->sPayPalToken, 'PAYERID' => $this->aCheckoutDetails['PAYERID'], 'PAYMENTREQUEST_0_PAYMENTACTION' => 'Sale', 'PAYMENTREQUEST_0_AMT' => round($oOrder->fieldValueTotal, 2), 'PAYMENTREQUEST_0_CURRENCYCODE' => $sCurrency, 'IPADDRESS' => null === $request ? '' : $request->getClientIp(), 'PAYMENTREQUEST_0_INVNUM' => $this->GetOrderNumber($oOrder), 'PAYMENTREQUEST_0_CUSTOM' => $this->id.','.$oOrder->id, ); $sIPNURL = $this->GetInstantPaymentNotificationListenerURL($oOrder); if (!empty($sIPNURL)) { $aCommand['PAYMENTREQUEST_0_NOTIFYURL'] = $sIPNURL; } $aAnswer = $this->ExecutePayPalCall('DoExpressCheckoutPayment', $aCommand); $ack = strtoupper($aAnswer['ACK']); if ('SUCCESS' == $ack) { $bPaymentOk = true; // add the response data to the order foreach ($aAnswer as $sKey => $sVal) { if (!array_key_exists($sKey, $this->aPaymentUserData)) { $this->aPaymentUserData[$sKey] = $sVal; } } // $this->SaveUserPaymentDataToOrder($oOrder->id); if (array_key_exists('PAYMENTINFO_0_PAYMENTSTATUS', $aAnswer) && 'COMPLETED' == strtoupper($aAnswer['PAYMENTINFO_0_PAYMENTSTATUS'])) { $oOrder->SetStatusPaid(); } } else { $bPaymentOk = false; } if (!$bPaymentOk) { // error! $oMsgManager = TCMSMessageManager::GetInstance(); $oMsgManager->AddMessage($sMessageConsumer, 'ERROR-ORDER-REQUEST-PAYMENT-ERROR', array('errorMsg' => self::GetPayPalErrorMessage($aAnswer))); $logContext = array( 'Command' => $aCommand, 'PayPalAnswer' => $aAnswer, ); $this->getPaypalLogger()->critical('PayPal payment could not be executed for order id '.$oOrder->id, $logContext); } return $bPaymentOk; }
php
public function ExecutePayment(TdbShopOrder &$oOrder, $sMessageConsumer = '') { $bPaymentOk = parent::ExecutePayment($oOrder); $oCurrency = null; if (method_exists($oOrder, 'GetFieldPkgShopCurrency')) { $oCurrency = $oOrder->GetFieldPkgShopCurrency(); } $sCurrency = $this->GetCurrencyIdentifier($oCurrency); $request = $this->getCurrentRequest(); $aCommand = array( 'TOKEN' => $this->sPayPalToken, 'PAYERID' => $this->aCheckoutDetails['PAYERID'], 'PAYMENTREQUEST_0_PAYMENTACTION' => 'Sale', 'PAYMENTREQUEST_0_AMT' => round($oOrder->fieldValueTotal, 2), 'PAYMENTREQUEST_0_CURRENCYCODE' => $sCurrency, 'IPADDRESS' => null === $request ? '' : $request->getClientIp(), 'PAYMENTREQUEST_0_INVNUM' => $this->GetOrderNumber($oOrder), 'PAYMENTREQUEST_0_CUSTOM' => $this->id.','.$oOrder->id, ); $sIPNURL = $this->GetInstantPaymentNotificationListenerURL($oOrder); if (!empty($sIPNURL)) { $aCommand['PAYMENTREQUEST_0_NOTIFYURL'] = $sIPNURL; } $aAnswer = $this->ExecutePayPalCall('DoExpressCheckoutPayment', $aCommand); $ack = strtoupper($aAnswer['ACK']); if ('SUCCESS' == $ack) { $bPaymentOk = true; // add the response data to the order foreach ($aAnswer as $sKey => $sVal) { if (!array_key_exists($sKey, $this->aPaymentUserData)) { $this->aPaymentUserData[$sKey] = $sVal; } } // $this->SaveUserPaymentDataToOrder($oOrder->id); if (array_key_exists('PAYMENTINFO_0_PAYMENTSTATUS', $aAnswer) && 'COMPLETED' == strtoupper($aAnswer['PAYMENTINFO_0_PAYMENTSTATUS'])) { $oOrder->SetStatusPaid(); } } else { $bPaymentOk = false; } if (!$bPaymentOk) { // error! $oMsgManager = TCMSMessageManager::GetInstance(); $oMsgManager->AddMessage($sMessageConsumer, 'ERROR-ORDER-REQUEST-PAYMENT-ERROR', array('errorMsg' => self::GetPayPalErrorMessage($aAnswer))); $logContext = array( 'Command' => $aCommand, 'PayPalAnswer' => $aAnswer, ); $this->getPaypalLogger()->critical('PayPal payment could not be executed for order id '.$oOrder->id, $logContext); } return $bPaymentOk; }
[ "public", "function", "ExecutePayment", "(", "TdbShopOrder", "&", "$", "oOrder", ",", "$", "sMessageConsumer", "=", "''", ")", "{", "$", "bPaymentOk", "=", "parent", "::", "ExecutePayment", "(", "$", "oOrder", ")", ";", "$", "oCurrency", "=", "null", ";", "if", "(", "method_exists", "(", "$", "oOrder", ",", "'GetFieldPkgShopCurrency'", ")", ")", "{", "$", "oCurrency", "=", "$", "oOrder", "->", "GetFieldPkgShopCurrency", "(", ")", ";", "}", "$", "sCurrency", "=", "$", "this", "->", "GetCurrencyIdentifier", "(", "$", "oCurrency", ")", ";", "$", "request", "=", "$", "this", "->", "getCurrentRequest", "(", ")", ";", "$", "aCommand", "=", "array", "(", "'TOKEN'", "=>", "$", "this", "->", "sPayPalToken", ",", "'PAYERID'", "=>", "$", "this", "->", "aCheckoutDetails", "[", "'PAYERID'", "]", ",", "'PAYMENTREQUEST_0_PAYMENTACTION'", "=>", "'Sale'", ",", "'PAYMENTREQUEST_0_AMT'", "=>", "round", "(", "$", "oOrder", "->", "fieldValueTotal", ",", "2", ")", ",", "'PAYMENTREQUEST_0_CURRENCYCODE'", "=>", "$", "sCurrency", ",", "'IPADDRESS'", "=>", "null", "===", "$", "request", "?", "''", ":", "$", "request", "->", "getClientIp", "(", ")", ",", "'PAYMENTREQUEST_0_INVNUM'", "=>", "$", "this", "->", "GetOrderNumber", "(", "$", "oOrder", ")", ",", "'PAYMENTREQUEST_0_CUSTOM'", "=>", "$", "this", "->", "id", ".", "','", ".", "$", "oOrder", "->", "id", ",", ")", ";", "$", "sIPNURL", "=", "$", "this", "->", "GetInstantPaymentNotificationListenerURL", "(", "$", "oOrder", ")", ";", "if", "(", "!", "empty", "(", "$", "sIPNURL", ")", ")", "{", "$", "aCommand", "[", "'PAYMENTREQUEST_0_NOTIFYURL'", "]", "=", "$", "sIPNURL", ";", "}", "$", "aAnswer", "=", "$", "this", "->", "ExecutePayPalCall", "(", "'DoExpressCheckoutPayment'", ",", "$", "aCommand", ")", ";", "$", "ack", "=", "strtoupper", "(", "$", "aAnswer", "[", "'ACK'", "]", ")", ";", "if", "(", "'SUCCESS'", "==", "$", "ack", ")", "{", "$", "bPaymentOk", "=", "true", ";", "// add the response data to the order", "foreach", "(", "$", "aAnswer", "as", "$", "sKey", "=>", "$", "sVal", ")", "{", "if", "(", "!", "array_key_exists", "(", "$", "sKey", ",", "$", "this", "->", "aPaymentUserData", ")", ")", "{", "$", "this", "->", "aPaymentUserData", "[", "$", "sKey", "]", "=", "$", "sVal", ";", "}", "}", "// $this->SaveUserPaymentDataToOrder($oOrder->id);", "if", "(", "array_key_exists", "(", "'PAYMENTINFO_0_PAYMENTSTATUS'", ",", "$", "aAnswer", ")", "&&", "'COMPLETED'", "==", "strtoupper", "(", "$", "aAnswer", "[", "'PAYMENTINFO_0_PAYMENTSTATUS'", "]", ")", ")", "{", "$", "oOrder", "->", "SetStatusPaid", "(", ")", ";", "}", "}", "else", "{", "$", "bPaymentOk", "=", "false", ";", "}", "if", "(", "!", "$", "bPaymentOk", ")", "{", "// error!", "$", "oMsgManager", "=", "TCMSMessageManager", "::", "GetInstance", "(", ")", ";", "$", "oMsgManager", "->", "AddMessage", "(", "$", "sMessageConsumer", ",", "'ERROR-ORDER-REQUEST-PAYMENT-ERROR'", ",", "array", "(", "'errorMsg'", "=>", "self", "::", "GetPayPalErrorMessage", "(", "$", "aAnswer", ")", ")", ")", ";", "$", "logContext", "=", "array", "(", "'Command'", "=>", "$", "aCommand", ",", "'PayPalAnswer'", "=>", "$", "aAnswer", ",", ")", ";", "$", "this", "->", "getPaypalLogger", "(", ")", "->", "critical", "(", "'PayPal payment could not be executed for order id '", ".", "$", "oOrder", "->", "id", ",", "$", "logContext", ")", ";", "}", "return", "$", "bPaymentOk", ";", "}" ]
executes payment for order - in this case, we commit the paypal payment. @param TdbShopOrder $oOrder @param string $sMessageConsumer - send error messages here @return bool
[ "executes", "payment", "for", "order", "-", "in", "this", "case", "we", "commit", "the", "paypal", "payment", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerPayPal.class.php#L178-L234
32,381
chameleon-system/chameleon-shop
src/ShopRatingServiceBundle/objects/webmodules/MTRatingServiceWidget/MTRatingServiceWidgetCore.class.php
MTRatingServiceWidgetCore.GetRatingService
protected function GetRatingService() { $oRatingServiceItem = null; if (!empty($this->oModuleConfig->fieldPkgShopRatingServiceId)) { $oRatingServiceItem = TdbPkgShopRatingService::GetNewInstance($this->oModuleConfig->fieldPkgShopRatingServiceId); } return $oRatingServiceItem; }
php
protected function GetRatingService() { $oRatingServiceItem = null; if (!empty($this->oModuleConfig->fieldPkgShopRatingServiceId)) { $oRatingServiceItem = TdbPkgShopRatingService::GetNewInstance($this->oModuleConfig->fieldPkgShopRatingServiceId); } return $oRatingServiceItem; }
[ "protected", "function", "GetRatingService", "(", ")", "{", "$", "oRatingServiceItem", "=", "null", ";", "if", "(", "!", "empty", "(", "$", "this", "->", "oModuleConfig", "->", "fieldPkgShopRatingServiceId", ")", ")", "{", "$", "oRatingServiceItem", "=", "TdbPkgShopRatingService", "::", "GetNewInstance", "(", "$", "this", "->", "oModuleConfig", "->", "fieldPkgShopRatingServiceId", ")", ";", "}", "return", "$", "oRatingServiceItem", ";", "}" ]
Select right RatingService object. @return TdbPkgShopRatingService|null
[ "Select", "right", "RatingService", "object", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopRatingServiceBundle/objects/webmodules/MTRatingServiceWidget/MTRatingServiceWidgetCore.class.php#L37-L45
32,382
chameleon-system/chameleon-shop
src/ShopBundle/objects/TShopBasket/TShopBasketArticleCore.class.php
TShopBasketArticleCore.ResetDiscounts
public function ResetDiscounts() { $this->oActingShopDiscountList = null; $this->dPriceAfterDiscount = $this->dPrice; $this->dPriceTotalAfterDiscount = $this->dPriceTotal; $this->dPriceAfterDiscountWithoutVouchers = $this->dPriceAfterDiscount; $this->dPriceTotalAfterDiscountWithoutVouchers = $this->dPriceTotalAfterDiscount; }
php
public function ResetDiscounts() { $this->oActingShopDiscountList = null; $this->dPriceAfterDiscount = $this->dPrice; $this->dPriceTotalAfterDiscount = $this->dPriceTotal; $this->dPriceAfterDiscountWithoutVouchers = $this->dPriceAfterDiscount; $this->dPriceTotalAfterDiscountWithoutVouchers = $this->dPriceTotalAfterDiscount; }
[ "public", "function", "ResetDiscounts", "(", ")", "{", "$", "this", "->", "oActingShopDiscountList", "=", "null", ";", "$", "this", "->", "dPriceAfterDiscount", "=", "$", "this", "->", "dPrice", ";", "$", "this", "->", "dPriceTotalAfterDiscount", "=", "$", "this", "->", "dPriceTotal", ";", "$", "this", "->", "dPriceAfterDiscountWithoutVouchers", "=", "$", "this", "->", "dPriceAfterDiscount", ";", "$", "this", "->", "dPriceTotalAfterDiscountWithoutVouchers", "=", "$", "this", "->", "dPriceTotalAfterDiscount", ";", "}" ]
remove acting discounts.
[ "remove", "acting", "discounts", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketArticleCore.class.php#L119-L126
32,383
chameleon-system/chameleon-shop
src/ShopBundle/objects/TShopBasket/TShopBasketArticleCore.class.php
TShopBasketArticleCore.ApplyDiscount
public function ApplyDiscount(TdbShopDiscount $oShopDiscount, $dMaxValueUsable = 0) { $dRemainingValue = 0; if (is_null($this->oActingShopDiscountList)) { $this->oActingShopDiscountList = new TShopBasketArticleDiscountList(); } if ('absolut' == $oShopDiscount->fieldValueType) { $dUsedValue = $dMaxValueUsable; if ($this->dPriceTotalAfterDiscount < $dUsedValue) { $dUsedValue = $this->dPriceTotalAfterDiscount; $dRemainingValue = $dMaxValueUsable - $this->dPriceTotalAfterDiscount; } $oShopDiscount->dRealValueUsed = $dUsedValue; } else { $oShopDiscount->dRealValueUsed = round($this->dPriceTotalAfterDiscount * ($oShopDiscount->fieldValue / 100), 2); } $this->dPriceTotalAfterDiscount = $this->dPriceTotalAfterDiscount - $oShopDiscount->dRealValueUsed; $this->dPriceAfterDiscount = $this->dPriceTotalAfterDiscount / $this->dAmount; $this->dPriceAfterDiscountWithoutVouchers = $this->dPriceAfterDiscount; $this->dPriceTotalAfterDiscountWithoutVouchers = $this->dPriceTotalAfterDiscount; $this->oActingShopDiscountList->AddItem($oShopDiscount); return $dRemainingValue; }
php
public function ApplyDiscount(TdbShopDiscount $oShopDiscount, $dMaxValueUsable = 0) { $dRemainingValue = 0; if (is_null($this->oActingShopDiscountList)) { $this->oActingShopDiscountList = new TShopBasketArticleDiscountList(); } if ('absolut' == $oShopDiscount->fieldValueType) { $dUsedValue = $dMaxValueUsable; if ($this->dPriceTotalAfterDiscount < $dUsedValue) { $dUsedValue = $this->dPriceTotalAfterDiscount; $dRemainingValue = $dMaxValueUsable - $this->dPriceTotalAfterDiscount; } $oShopDiscount->dRealValueUsed = $dUsedValue; } else { $oShopDiscount->dRealValueUsed = round($this->dPriceTotalAfterDiscount * ($oShopDiscount->fieldValue / 100), 2); } $this->dPriceTotalAfterDiscount = $this->dPriceTotalAfterDiscount - $oShopDiscount->dRealValueUsed; $this->dPriceAfterDiscount = $this->dPriceTotalAfterDiscount / $this->dAmount; $this->dPriceAfterDiscountWithoutVouchers = $this->dPriceAfterDiscount; $this->dPriceTotalAfterDiscountWithoutVouchers = $this->dPriceTotalAfterDiscount; $this->oActingShopDiscountList->AddItem($oShopDiscount); return $dRemainingValue; }
[ "public", "function", "ApplyDiscount", "(", "TdbShopDiscount", "$", "oShopDiscount", ",", "$", "dMaxValueUsable", "=", "0", ")", "{", "$", "dRemainingValue", "=", "0", ";", "if", "(", "is_null", "(", "$", "this", "->", "oActingShopDiscountList", ")", ")", "{", "$", "this", "->", "oActingShopDiscountList", "=", "new", "TShopBasketArticleDiscountList", "(", ")", ";", "}", "if", "(", "'absolut'", "==", "$", "oShopDiscount", "->", "fieldValueType", ")", "{", "$", "dUsedValue", "=", "$", "dMaxValueUsable", ";", "if", "(", "$", "this", "->", "dPriceTotalAfterDiscount", "<", "$", "dUsedValue", ")", "{", "$", "dUsedValue", "=", "$", "this", "->", "dPriceTotalAfterDiscount", ";", "$", "dRemainingValue", "=", "$", "dMaxValueUsable", "-", "$", "this", "->", "dPriceTotalAfterDiscount", ";", "}", "$", "oShopDiscount", "->", "dRealValueUsed", "=", "$", "dUsedValue", ";", "}", "else", "{", "$", "oShopDiscount", "->", "dRealValueUsed", "=", "round", "(", "$", "this", "->", "dPriceTotalAfterDiscount", "*", "(", "$", "oShopDiscount", "->", "fieldValue", "/", "100", ")", ",", "2", ")", ";", "}", "$", "this", "->", "dPriceTotalAfterDiscount", "=", "$", "this", "->", "dPriceTotalAfterDiscount", "-", "$", "oShopDiscount", "->", "dRealValueUsed", ";", "$", "this", "->", "dPriceAfterDiscount", "=", "$", "this", "->", "dPriceTotalAfterDiscount", "/", "$", "this", "->", "dAmount", ";", "$", "this", "->", "dPriceAfterDiscountWithoutVouchers", "=", "$", "this", "->", "dPriceAfterDiscount", ";", "$", "this", "->", "dPriceTotalAfterDiscountWithoutVouchers", "=", "$", "this", "->", "dPriceTotalAfterDiscount", ";", "$", "this", "->", "oActingShopDiscountList", "->", "AddItem", "(", "$", "oShopDiscount", ")", ";", "return", "$", "dRemainingValue", ";", "}" ]
apply a discount to the article (note that the method will not check if the discount may be applied - it assumes you checked that using the function in TShopDiscount. @param TdbShopDiscount $oShopDiscount @param dobule $dMaxValueUsable - for absolute value discounts, this parameter defines how much may be at most applied to the article @return float - returns the remaining discount value to distribute (0 if the discount is a percent discount)
[ "apply", "a", "discount", "to", "the", "article", "(", "note", "that", "the", "method", "will", "not", "check", "if", "the", "discount", "may", "be", "applied", "-", "it", "assumes", "you", "checked", "that", "using", "the", "function", "in", "TShopDiscount", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketArticleCore.class.php#L137-L161
32,384
chameleon-system/chameleon-shop
src/ShopBundle/objects/TShopBasket/TShopBasketArticleCore.class.php
TShopBasketArticleCore.GetRemoveFromBasketLink
public function GetRemoveFromBasketLink() { $activeShop = $this->getShopService()->getActiveShop(); $aParameters = array('module_fnc['.$activeShop->GetBasketModuleSpotName().']' => 'RemoveFromBasketViaBasketItemKey', MTShopBasketCore::URL_ITEM_BASKET_KEY => $this->sBasketItemKey, MTShopBasketCore::URL_MESSAGE_CONSUMER => MTShopBasketCore::MSG_CONSUMER_NAME); return $this->getActivePageService()->getLinkToActivePageRelative($aParameters); }
php
public function GetRemoveFromBasketLink() { $activeShop = $this->getShopService()->getActiveShop(); $aParameters = array('module_fnc['.$activeShop->GetBasketModuleSpotName().']' => 'RemoveFromBasketViaBasketItemKey', MTShopBasketCore::URL_ITEM_BASKET_KEY => $this->sBasketItemKey, MTShopBasketCore::URL_MESSAGE_CONSUMER => MTShopBasketCore::MSG_CONSUMER_NAME); return $this->getActivePageService()->getLinkToActivePageRelative($aParameters); }
[ "public", "function", "GetRemoveFromBasketLink", "(", ")", "{", "$", "activeShop", "=", "$", "this", "->", "getShopService", "(", ")", "->", "getActiveShop", "(", ")", ";", "$", "aParameters", "=", "array", "(", "'module_fnc['", ".", "$", "activeShop", "->", "GetBasketModuleSpotName", "(", ")", ".", "']'", "=>", "'RemoveFromBasketViaBasketItemKey'", ",", "MTShopBasketCore", "::", "URL_ITEM_BASKET_KEY", "=>", "$", "this", "->", "sBasketItemKey", ",", "MTShopBasketCore", "::", "URL_MESSAGE_CONSUMER", "=>", "MTShopBasketCore", "::", "MSG_CONSUMER_NAME", ")", ";", "return", "$", "this", "->", "getActivePageService", "(", ")", "->", "getLinkToActivePageRelative", "(", "$", "aParameters", ")", ";", "}" ]
returns the link to remove this item from the basket. @return string
[ "returns", "the", "link", "to", "remove", "this", "item", "from", "the", "basket", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketArticleCore.class.php#L213-L219
32,385
chameleon-system/chameleon-shop
src/ShopBundle/objects/TShopBasket/TShopBasketArticleCore.class.php
TShopBasketArticleCore.UpdateItemInfo
protected function UpdateItemInfo() { $this->dPriceTotal = $this->dAmount * $this->dPrice; $this->dTotalWeight = $this->dAmount * $this->fieldSizeWeight; $this->dTotalVolume = $this->dAmount * $this->dVolume; $this->dPriceAfterDiscount = $this->dPrice; $this->dPriceTotalAfterDiscount = $this->dPriceTotal; $this->dPriceTotalAfterDiscountWithoutVouchers = $this->dPriceTotalAfterDiscount; }
php
protected function UpdateItemInfo() { $this->dPriceTotal = $this->dAmount * $this->dPrice; $this->dTotalWeight = $this->dAmount * $this->fieldSizeWeight; $this->dTotalVolume = $this->dAmount * $this->dVolume; $this->dPriceAfterDiscount = $this->dPrice; $this->dPriceTotalAfterDiscount = $this->dPriceTotal; $this->dPriceTotalAfterDiscountWithoutVouchers = $this->dPriceTotalAfterDiscount; }
[ "protected", "function", "UpdateItemInfo", "(", ")", "{", "$", "this", "->", "dPriceTotal", "=", "$", "this", "->", "dAmount", "*", "$", "this", "->", "dPrice", ";", "$", "this", "->", "dTotalWeight", "=", "$", "this", "->", "dAmount", "*", "$", "this", "->", "fieldSizeWeight", ";", "$", "this", "->", "dTotalVolume", "=", "$", "this", "->", "dAmount", "*", "$", "this", "->", "dVolume", ";", "$", "this", "->", "dPriceAfterDiscount", "=", "$", "this", "->", "dPrice", ";", "$", "this", "->", "dPriceTotalAfterDiscount", "=", "$", "this", "->", "dPriceTotal", ";", "$", "this", "->", "dPriceTotalAfterDiscountWithoutVouchers", "=", "$", "this", "->", "dPriceTotalAfterDiscount", ";", "}" ]
update the price total of the object.
[ "update", "the", "price", "total", "of", "the", "object", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketArticleCore.class.php#L241-L249
32,386
chameleon-system/chameleon-shop
src/ShopBundle/objects/TShopBasket/TShopBasketArticleCore.class.php
TShopBasketArticleCore.RefreshDataFromDatabase
public function RefreshDataFromDatabase() { $this->ClearInternalCache(); $sActiveLanguageId = self::getLanguageService()->getActiveLanguageId(); if (null !== $sActiveLanguageId) { $this->SetLanguage($sActiveLanguageId); } $bEnableObjectCaching = $this->GetEnableObjectCaching(); $this->SetEnableObjectCaching(false); $this->Load($this->id); $this->SetEnableObjectCaching($bEnableObjectCaching); }
php
public function RefreshDataFromDatabase() { $this->ClearInternalCache(); $sActiveLanguageId = self::getLanguageService()->getActiveLanguageId(); if (null !== $sActiveLanguageId) { $this->SetLanguage($sActiveLanguageId); } $bEnableObjectCaching = $this->GetEnableObjectCaching(); $this->SetEnableObjectCaching(false); $this->Load($this->id); $this->SetEnableObjectCaching($bEnableObjectCaching); }
[ "public", "function", "RefreshDataFromDatabase", "(", ")", "{", "$", "this", "->", "ClearInternalCache", "(", ")", ";", "$", "sActiveLanguageId", "=", "self", "::", "getLanguageService", "(", ")", "->", "getActiveLanguageId", "(", ")", ";", "if", "(", "null", "!==", "$", "sActiveLanguageId", ")", "{", "$", "this", "->", "SetLanguage", "(", "$", "sActiveLanguageId", ")", ";", "}", "$", "bEnableObjectCaching", "=", "$", "this", "->", "GetEnableObjectCaching", "(", ")", ";", "$", "this", "->", "SetEnableObjectCaching", "(", "false", ")", ";", "$", "this", "->", "Load", "(", "$", "this", "->", "id", ")", ";", "$", "this", "->", "SetEnableObjectCaching", "(", "$", "bEnableObjectCaching", ")", ";", "}" ]
reloads the article data from database if called.
[ "reloads", "the", "article", "data", "from", "database", "if", "called", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketArticleCore.class.php#L323-L334
32,387
chameleon-system/chameleon-shop
src/ShopBundle/objects/TCMSInterface/TShopInterfaceExportCustomers.class.php
TShopInterfaceExportCustomers.GetDataList
protected function GetDataList() { $query = 'SELECT `data_extranet_user`.`id` AS UserId, `data_extranet_user`.`name` AS EMail, `data_extranet_user`.`customer_number` AS KundenNr, `data_extranet_user`.`datecreated`, `pkg_newsletter_user`.`signup_date` AS NewsletterAnmeldedatum, AdrB.`company` AS RechAdr_Firma, AdrBSalutation.`name` AS RechAdr_Anrede, AdrB.`firstname` AS RechAdr_Vorname, AdrB.`lastname` AS RechAdr_Nachname, AdrB.`street` AS RechAdr_Strasse, AdrB.`streetnr` AS RechAdr_Hausnummer, AdrB.`city` AS RechAdr_Stadt, AdrB.`postalcode` AS RechAdr_PLZ, AdrB.`telefon` AS RechAdr_Telefon, AdrB.`fax` AS RechAdr_Fax, AdrBCountry.`name` AS RechAdr_Land, AdrS.`company` AS LiefAdr_Firma, AdrSSalutation.`name` AS LiefAdr_Anrede, AdrS.`firstname` AS LiefAdr_Vorname, AdrS.`lastname` AS LiefAdr_Nachname, AdrS.`street` AS LiefAdr_Strasse, AdrS.`streetnr` AS LiefAdr_Hausnummer, AdrS.`city` AS LiefAdr_Stadt, AdrS.`postalcode` AS LiefAdr_PLZ, AdrS.`telefon` AS LiefAdr_Telefon, AdrS.`fax` AS LiefAdr_Fax, AdrSCountry.`name` AS LiefAdr_Land FROM `data_extranet_user` LEFT JOIN `data_extranet_user_address` AS AdrB ON (`data_extranet_user`.`default_billing_address_id` = AdrB.`id`) LEFT JOIN `data_extranet_salutation` AS AdrBSalutation ON AdrB.`data_extranet_salutation_id` = AdrBSalutation.`id` LEFT JOIN `data_country` AS AdrBCountry ON AdrB.`data_country_id` = AdrBCountry.`id` LEFT JOIN `data_extranet_user_address` AS AdrS ON (`data_extranet_user`.`default_shipping_address_id` = AdrS.`id`) LEFT JOIN `data_extranet_salutation` AS AdrSSalutation ON AdrB.`data_extranet_salutation_id` = AdrSSalutation.`id` LEFT JOIN `data_country` AS AdrSCountry ON AdrS.`data_country_id` = AdrSCountry.`id` LEFT JOIN `pkg_newsletter_user` ON (`data_extranet_user`.`id` = `pkg_newsletter_user`.`data_extranet_user_id`) '; $oTCMSRecordList = new TCMSRecordList(); /** @var $oTCMSRecordList TCMSRecordList */ $oTCMSRecordList->sTableName = 'data_extranet_user'; $oTCMSRecordList->Load($query); return $oTCMSRecordList; }
php
protected function GetDataList() { $query = 'SELECT `data_extranet_user`.`id` AS UserId, `data_extranet_user`.`name` AS EMail, `data_extranet_user`.`customer_number` AS KundenNr, `data_extranet_user`.`datecreated`, `pkg_newsletter_user`.`signup_date` AS NewsletterAnmeldedatum, AdrB.`company` AS RechAdr_Firma, AdrBSalutation.`name` AS RechAdr_Anrede, AdrB.`firstname` AS RechAdr_Vorname, AdrB.`lastname` AS RechAdr_Nachname, AdrB.`street` AS RechAdr_Strasse, AdrB.`streetnr` AS RechAdr_Hausnummer, AdrB.`city` AS RechAdr_Stadt, AdrB.`postalcode` AS RechAdr_PLZ, AdrB.`telefon` AS RechAdr_Telefon, AdrB.`fax` AS RechAdr_Fax, AdrBCountry.`name` AS RechAdr_Land, AdrS.`company` AS LiefAdr_Firma, AdrSSalutation.`name` AS LiefAdr_Anrede, AdrS.`firstname` AS LiefAdr_Vorname, AdrS.`lastname` AS LiefAdr_Nachname, AdrS.`street` AS LiefAdr_Strasse, AdrS.`streetnr` AS LiefAdr_Hausnummer, AdrS.`city` AS LiefAdr_Stadt, AdrS.`postalcode` AS LiefAdr_PLZ, AdrS.`telefon` AS LiefAdr_Telefon, AdrS.`fax` AS LiefAdr_Fax, AdrSCountry.`name` AS LiefAdr_Land FROM `data_extranet_user` LEFT JOIN `data_extranet_user_address` AS AdrB ON (`data_extranet_user`.`default_billing_address_id` = AdrB.`id`) LEFT JOIN `data_extranet_salutation` AS AdrBSalutation ON AdrB.`data_extranet_salutation_id` = AdrBSalutation.`id` LEFT JOIN `data_country` AS AdrBCountry ON AdrB.`data_country_id` = AdrBCountry.`id` LEFT JOIN `data_extranet_user_address` AS AdrS ON (`data_extranet_user`.`default_shipping_address_id` = AdrS.`id`) LEFT JOIN `data_extranet_salutation` AS AdrSSalutation ON AdrB.`data_extranet_salutation_id` = AdrSSalutation.`id` LEFT JOIN `data_country` AS AdrSCountry ON AdrS.`data_country_id` = AdrSCountry.`id` LEFT JOIN `pkg_newsletter_user` ON (`data_extranet_user`.`id` = `pkg_newsletter_user`.`data_extranet_user_id`) '; $oTCMSRecordList = new TCMSRecordList(); /** @var $oTCMSRecordList TCMSRecordList */ $oTCMSRecordList->sTableName = 'data_extranet_user'; $oTCMSRecordList->Load($query); return $oTCMSRecordList; }
[ "protected", "function", "GetDataList", "(", ")", "{", "$", "query", "=", "'SELECT `data_extranet_user`.`id` AS UserId,\n `data_extranet_user`.`name` AS EMail,\n `data_extranet_user`.`customer_number` AS KundenNr,\n `data_extranet_user`.`datecreated`,\n `pkg_newsletter_user`.`signup_date` AS NewsletterAnmeldedatum,\n\n AdrB.`company` AS RechAdr_Firma,\n AdrBSalutation.`name` AS RechAdr_Anrede,\n AdrB.`firstname` AS RechAdr_Vorname,\n AdrB.`lastname` AS RechAdr_Nachname,\n AdrB.`street` AS RechAdr_Strasse,\n AdrB.`streetnr` AS RechAdr_Hausnummer,\n AdrB.`city` AS RechAdr_Stadt,\n AdrB.`postalcode` AS RechAdr_PLZ,\n AdrB.`telefon` AS RechAdr_Telefon,\n AdrB.`fax` AS RechAdr_Fax,\n AdrBCountry.`name` AS RechAdr_Land,\n\n AdrS.`company` AS LiefAdr_Firma,\n AdrSSalutation.`name` AS LiefAdr_Anrede,\n AdrS.`firstname` AS LiefAdr_Vorname,\n AdrS.`lastname` AS LiefAdr_Nachname,\n AdrS.`street` AS LiefAdr_Strasse,\n AdrS.`streetnr` AS LiefAdr_Hausnummer,\n AdrS.`city` AS LiefAdr_Stadt,\n AdrS.`postalcode` AS LiefAdr_PLZ,\n AdrS.`telefon` AS LiefAdr_Telefon,\n AdrS.`fax` AS LiefAdr_Fax,\n AdrSCountry.`name` AS LiefAdr_Land\n\n FROM `data_extranet_user`\n LEFT JOIN `data_extranet_user_address` AS AdrB ON (`data_extranet_user`.`default_billing_address_id` = AdrB.`id`)\n LEFT JOIN `data_extranet_salutation` AS AdrBSalutation ON AdrB.`data_extranet_salutation_id` = AdrBSalutation.`id`\n LEFT JOIN `data_country` AS AdrBCountry ON AdrB.`data_country_id` = AdrBCountry.`id`\n\n LEFT JOIN `data_extranet_user_address` AS AdrS ON (`data_extranet_user`.`default_shipping_address_id` = AdrS.`id`)\n LEFT JOIN `data_extranet_salutation` AS AdrSSalutation ON AdrB.`data_extranet_salutation_id` = AdrSSalutation.`id`\n LEFT JOIN `data_country` AS AdrSCountry ON AdrS.`data_country_id` = AdrSCountry.`id`\n\n LEFT JOIN `pkg_newsletter_user` ON (`data_extranet_user`.`id` = `pkg_newsletter_user`.`data_extranet_user_id`)\n '", ";", "$", "oTCMSRecordList", "=", "new", "TCMSRecordList", "(", ")", ";", "/** @var $oTCMSRecordList TCMSRecordList */", "$", "oTCMSRecordList", "->", "sTableName", "=", "'data_extranet_user'", ";", "$", "oTCMSRecordList", "->", "Load", "(", "$", "query", ")", ";", "return", "$", "oTCMSRecordList", ";", "}" ]
OVERWRITE THIS TO FETCH THE DATA. MUST RETURN A TCMSRecordList. @return TCMSRecordList
[ "OVERWRITE", "THIS", "TO", "FETCH", "THE", "DATA", ".", "MUST", "RETURN", "A", "TCMSRecordList", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TCMSInterface/TShopInterfaceExportCustomers.class.php#L19-L68
32,388
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php
TShopPaymentHandlerIPaymentEndPoint.GetAllInputFieldParameter
protected function GetAllInputFieldParameter($aParameter = array()) { if (!is_array($aParameter)) { $aParameter = array(); } $aParameter = $this->GetStandardInputFieldParameter($aParameter); $aParameter['trx_typ'] = $this->GetConfigParameter('trx_typ'); $aParameter['use_datastorage'] = $this->GetConfigParameter('use_datastorage'); $aParameter['datastorage_reuse_method'] = $this->GetConfigParameter('datastorage_reuse_method'); $sDataExpireDateSec = time() + ((int) $this->GetConfigParameter('expiretime_min')) * 60; $aParameter['datastorage_expirydate'] = date('Y/m/d H:i:s', $sDataExpireDateSec); $oGlobal = TGlobal::instance(); $aParameter['spot'] = $oGlobal->GetExecutingModulePointer()->sModuleSpotName; return $aParameter; }
php
protected function GetAllInputFieldParameter($aParameter = array()) { if (!is_array($aParameter)) { $aParameter = array(); } $aParameter = $this->GetStandardInputFieldParameter($aParameter); $aParameter['trx_typ'] = $this->GetConfigParameter('trx_typ'); $aParameter['use_datastorage'] = $this->GetConfigParameter('use_datastorage'); $aParameter['datastorage_reuse_method'] = $this->GetConfigParameter('datastorage_reuse_method'); $sDataExpireDateSec = time() + ((int) $this->GetConfigParameter('expiretime_min')) * 60; $aParameter['datastorage_expirydate'] = date('Y/m/d H:i:s', $sDataExpireDateSec); $oGlobal = TGlobal::instance(); $aParameter['spot'] = $oGlobal->GetExecutingModulePointer()->sModuleSpotName; return $aParameter; }
[ "protected", "function", "GetAllInputFieldParameter", "(", "$", "aParameter", "=", "array", "(", ")", ")", "{", "if", "(", "!", "is_array", "(", "$", "aParameter", ")", ")", "{", "$", "aParameter", "=", "array", "(", ")", ";", "}", "$", "aParameter", "=", "$", "this", "->", "GetStandardInputFieldParameter", "(", "$", "aParameter", ")", ";", "$", "aParameter", "[", "'trx_typ'", "]", "=", "$", "this", "->", "GetConfigParameter", "(", "'trx_typ'", ")", ";", "$", "aParameter", "[", "'use_datastorage'", "]", "=", "$", "this", "->", "GetConfigParameter", "(", "'use_datastorage'", ")", ";", "$", "aParameter", "[", "'datastorage_reuse_method'", "]", "=", "$", "this", "->", "GetConfigParameter", "(", "'datastorage_reuse_method'", ")", ";", "$", "sDataExpireDateSec", "=", "time", "(", ")", "+", "(", "(", "int", ")", "$", "this", "->", "GetConfigParameter", "(", "'expiretime_min'", ")", ")", "*", "60", ";", "$", "aParameter", "[", "'datastorage_expirydate'", "]", "=", "date", "(", "'Y/m/d H:i:s'", ",", "$", "sDataExpireDateSec", ")", ";", "$", "oGlobal", "=", "TGlobal", "::", "instance", "(", ")", ";", "$", "aParameter", "[", "'spot'", "]", "=", "$", "oGlobal", "->", "GetExecutingModulePointer", "(", ")", "->", "sModuleSpotName", ";", "return", "$", "aParameter", ";", "}" ]
Get all needed parameter for first request to ipayment Contain standat parameter and storage parameter. @param array $aParameter @return array $aParameter
[ "Get", "all", "needed", "parameter", "for", "first", "request", "to", "ipayment", "Contain", "standat", "parameter", "and", "storage", "parameter", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php#L111-L126
32,389
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php
TShopPaymentHandlerIPaymentEndPoint.GetStandardInputFieldParameter
protected function GetStandardInputFieldParameter($aParameter = array()) { if (!is_array($aParameter)) { $aParameter = array(); } $oShopBasket = TShopBasket::GetInstance(); $aParameter['ppcdccd'] = '51a492928930f294568ff'; // chameleon ipayment identifier $aParameter['trxuser_id'] = $this->GetConfigParameter('trxuser_id'); $aParameter['trxpassword'] = $this->GetConfigParameter('transaction_password'); $aParameter['adminactionpassword'] = $this->GetConfigParameter('adminactionpassword'); $aParameter['silent'] = $this->GetConfigParameter('silent_mode'); $aParameter['advanced_strict_id_check'] = $this->GetConfigParameter('advanced_strict_id_check'); $aParameter['return_paymentdata_details'] = $this->GetConfigParameter('return_paymentdata_details'); $aParameter['shopper_id'] = $oShopBasket->sBasketIdentifier; $aParameter['trx_amount'] = round($oShopBasket->dCostTotal * 100, 0); $aParameter['trx_currency'] = $this->GetCurrencyIdentifier(); $sSecurityHash = $this->GenerateSecurityHash($aParameter); if (!empty($sSecurityHash)) { $aParameter['trx_securityhash'] = $sSecurityHash; } $oStep = $this->GetActiveOrderStep(); $redirectUrl = $this->GetExecutePaymentErrorURL($oStep->fieldSystemname); $aParameter['redirect_url'] = $redirectUrl.'/'.self::URL_PARAMETER_NAME.'/success'; $aParameter['silent_error_url'] = $redirectUrl.'/'.self::URL_PARAMETER_NAME.'/error'; return $aParameter; }
php
protected function GetStandardInputFieldParameter($aParameter = array()) { if (!is_array($aParameter)) { $aParameter = array(); } $oShopBasket = TShopBasket::GetInstance(); $aParameter['ppcdccd'] = '51a492928930f294568ff'; // chameleon ipayment identifier $aParameter['trxuser_id'] = $this->GetConfigParameter('trxuser_id'); $aParameter['trxpassword'] = $this->GetConfigParameter('transaction_password'); $aParameter['adminactionpassword'] = $this->GetConfigParameter('adminactionpassword'); $aParameter['silent'] = $this->GetConfigParameter('silent_mode'); $aParameter['advanced_strict_id_check'] = $this->GetConfigParameter('advanced_strict_id_check'); $aParameter['return_paymentdata_details'] = $this->GetConfigParameter('return_paymentdata_details'); $aParameter['shopper_id'] = $oShopBasket->sBasketIdentifier; $aParameter['trx_amount'] = round($oShopBasket->dCostTotal * 100, 0); $aParameter['trx_currency'] = $this->GetCurrencyIdentifier(); $sSecurityHash = $this->GenerateSecurityHash($aParameter); if (!empty($sSecurityHash)) { $aParameter['trx_securityhash'] = $sSecurityHash; } $oStep = $this->GetActiveOrderStep(); $redirectUrl = $this->GetExecutePaymentErrorURL($oStep->fieldSystemname); $aParameter['redirect_url'] = $redirectUrl.'/'.self::URL_PARAMETER_NAME.'/success'; $aParameter['silent_error_url'] = $redirectUrl.'/'.self::URL_PARAMETER_NAME.'/error'; return $aParameter; }
[ "protected", "function", "GetStandardInputFieldParameter", "(", "$", "aParameter", "=", "array", "(", ")", ")", "{", "if", "(", "!", "is_array", "(", "$", "aParameter", ")", ")", "{", "$", "aParameter", "=", "array", "(", ")", ";", "}", "$", "oShopBasket", "=", "TShopBasket", "::", "GetInstance", "(", ")", ";", "$", "aParameter", "[", "'ppcdccd'", "]", "=", "'51a492928930f294568ff'", ";", "// chameleon ipayment identifier", "$", "aParameter", "[", "'trxuser_id'", "]", "=", "$", "this", "->", "GetConfigParameter", "(", "'trxuser_id'", ")", ";", "$", "aParameter", "[", "'trxpassword'", "]", "=", "$", "this", "->", "GetConfigParameter", "(", "'transaction_password'", ")", ";", "$", "aParameter", "[", "'adminactionpassword'", "]", "=", "$", "this", "->", "GetConfigParameter", "(", "'adminactionpassword'", ")", ";", "$", "aParameter", "[", "'silent'", "]", "=", "$", "this", "->", "GetConfigParameter", "(", "'silent_mode'", ")", ";", "$", "aParameter", "[", "'advanced_strict_id_check'", "]", "=", "$", "this", "->", "GetConfigParameter", "(", "'advanced_strict_id_check'", ")", ";", "$", "aParameter", "[", "'return_paymentdata_details'", "]", "=", "$", "this", "->", "GetConfigParameter", "(", "'return_paymentdata_details'", ")", ";", "$", "aParameter", "[", "'shopper_id'", "]", "=", "$", "oShopBasket", "->", "sBasketIdentifier", ";", "$", "aParameter", "[", "'trx_amount'", "]", "=", "round", "(", "$", "oShopBasket", "->", "dCostTotal", "*", "100", ",", "0", ")", ";", "$", "aParameter", "[", "'trx_currency'", "]", "=", "$", "this", "->", "GetCurrencyIdentifier", "(", ")", ";", "$", "sSecurityHash", "=", "$", "this", "->", "GenerateSecurityHash", "(", "$", "aParameter", ")", ";", "if", "(", "!", "empty", "(", "$", "sSecurityHash", ")", ")", "{", "$", "aParameter", "[", "'trx_securityhash'", "]", "=", "$", "sSecurityHash", ";", "}", "$", "oStep", "=", "$", "this", "->", "GetActiveOrderStep", "(", ")", ";", "$", "redirectUrl", "=", "$", "this", "->", "GetExecutePaymentErrorURL", "(", "$", "oStep", "->", "fieldSystemname", ")", ";", "$", "aParameter", "[", "'redirect_url'", "]", "=", "$", "redirectUrl", ".", "'/'", ".", "self", "::", "URL_PARAMETER_NAME", ".", "'/success'", ";", "$", "aParameter", "[", "'silent_error_url'", "]", "=", "$", "redirectUrl", ".", "'/'", ".", "self", "::", "URL_PARAMETER_NAME", ".", "'/error'", ";", "return", "$", "aParameter", ";", "}" ]
Get standard parameters needed for all requests to Ipayment. @param array $aParameter @return array $aParameter
[ "Get", "standard", "parameters", "needed", "for", "all", "requests", "to", "Ipayment", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php#L135-L166
32,390
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php
TShopPaymentHandlerIPaymentEndPoint.GenerateSecurityHash
protected function GenerateSecurityHash($aParameter) { $trx_securityhash = ''; $sSharedSecret = $this->GetConfigParameter('shared_secret'); if (!empty($sSharedSecret)) { $trx_securityhash = md5($aParameter['trxuser_id'].$aParameter['trx_amount'].$aParameter['trx_currency'].$aParameter['trxpassword'].$sSharedSecret); } return $trx_securityhash; }
php
protected function GenerateSecurityHash($aParameter) { $trx_securityhash = ''; $sSharedSecret = $this->GetConfigParameter('shared_secret'); if (!empty($sSharedSecret)) { $trx_securityhash = md5($aParameter['trxuser_id'].$aParameter['trx_amount'].$aParameter['trx_currency'].$aParameter['trxpassword'].$sSharedSecret); } return $trx_securityhash; }
[ "protected", "function", "GenerateSecurityHash", "(", "$", "aParameter", ")", "{", "$", "trx_securityhash", "=", "''", ";", "$", "sSharedSecret", "=", "$", "this", "->", "GetConfigParameter", "(", "'shared_secret'", ")", ";", "if", "(", "!", "empty", "(", "$", "sSharedSecret", ")", ")", "{", "$", "trx_securityhash", "=", "md5", "(", "$", "aParameter", "[", "'trxuser_id'", "]", ".", "$", "aParameter", "[", "'trx_amount'", "]", ".", "$", "aParameter", "[", "'trx_currency'", "]", ".", "$", "aParameter", "[", "'trxpassword'", "]", ".", "$", "sSharedSecret", ")", ";", "}", "return", "$", "trx_securityhash", ";", "}" ]
return the security hash for the input data. @param $aParameter @return string
[ "return", "the", "security", "hash", "for", "the", "input", "data", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php#L175-L184
32,391
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php
TShopPaymentHandlerIPaymentEndPoint.GetActiveOrderStep
protected function GetActiveOrderStep() { $oActiveOrderStep = null; $oGlobal = TGlobal::instance(); $sActiveStepSysName = $oGlobal->GetUserData('stpsysname'); $oActiveOrderStep = TdbShopOrderStep::GetStep($sActiveStepSysName); return $oActiveOrderStep; }
php
protected function GetActiveOrderStep() { $oActiveOrderStep = null; $oGlobal = TGlobal::instance(); $sActiveStepSysName = $oGlobal->GetUserData('stpsysname'); $oActiveOrderStep = TdbShopOrderStep::GetStep($sActiveStepSysName); return $oActiveOrderStep; }
[ "protected", "function", "GetActiveOrderStep", "(", ")", "{", "$", "oActiveOrderStep", "=", "null", ";", "$", "oGlobal", "=", "TGlobal", "::", "instance", "(", ")", ";", "$", "sActiveStepSysName", "=", "$", "oGlobal", "->", "GetUserData", "(", "'stpsysname'", ")", ";", "$", "oActiveOrderStep", "=", "TdbShopOrderStep", "::", "GetStep", "(", "$", "sActiveStepSysName", ")", ";", "return", "$", "oActiveOrderStep", ";", "}" ]
Get the active oder step neede for redirect url. @return TdbShopOrderStep $oActiveOrderStep
[ "Get", "the", "active", "oder", "step", "neede", "for", "redirect", "url", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php#L213-L221
32,392
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php
TShopPaymentHandlerIPaymentEndPoint.GetPayFieldParameter
protected function GetPayFieldParameter($aParameter = array(), $oOrder) { if (!is_array($aParameter)) { $aParameter = array(); } $aParameter = $this->GetStandardInputFieldParameter($aParameter); if (!empty($this->sStorageId)) { $aParameter['from_datastorage_id'] = $this->sStorageId; } $oShopBasket = TShopBasket::GetInstance(); $oActivePaymentMethod = $oShopBasket->GetActivePaymentMethod(); $aParameter['shop_payment_method_id'] = $oActivePaymentMethod->id; $redirectUrl = $this->GetRedirectUrl(); $sSilentErrorURL = $this->GetExecutePaymentErrorURL(); if ($sSilentErrorURL) { $aParameter['silent_error_url'] = $sSilentErrorURL.'/'.self::URL_PARAMETER_NAME.'/error'; } $aParameter['redirect_url'] = $redirectUrl; $oIPNManager = new TPkgShopPaymentIPNManager(); $oPortal = $this->getPortalDomainService()->getActivePortal(); $aParameter['hidden_trigger_url'] = $oIPNManager->getIPNURL($oPortal, $oOrder); $aParameter['expire_datastorage'] = true; $aParameter['execute_order'] = true; $oGlobal = TGlobal::instance(); $aParameter['spot'] = $oGlobal->GetExecutingModulePointer()->sModuleSpotName; $aParameter['trx_typ'] = $this->GetConfigParameter('trx_typ_pay'); return $aParameter; }
php
protected function GetPayFieldParameter($aParameter = array(), $oOrder) { if (!is_array($aParameter)) { $aParameter = array(); } $aParameter = $this->GetStandardInputFieldParameter($aParameter); if (!empty($this->sStorageId)) { $aParameter['from_datastorage_id'] = $this->sStorageId; } $oShopBasket = TShopBasket::GetInstance(); $oActivePaymentMethod = $oShopBasket->GetActivePaymentMethod(); $aParameter['shop_payment_method_id'] = $oActivePaymentMethod->id; $redirectUrl = $this->GetRedirectUrl(); $sSilentErrorURL = $this->GetExecutePaymentErrorURL(); if ($sSilentErrorURL) { $aParameter['silent_error_url'] = $sSilentErrorURL.'/'.self::URL_PARAMETER_NAME.'/error'; } $aParameter['redirect_url'] = $redirectUrl; $oIPNManager = new TPkgShopPaymentIPNManager(); $oPortal = $this->getPortalDomainService()->getActivePortal(); $aParameter['hidden_trigger_url'] = $oIPNManager->getIPNURL($oPortal, $oOrder); $aParameter['expire_datastorage'] = true; $aParameter['execute_order'] = true; $oGlobal = TGlobal::instance(); $aParameter['spot'] = $oGlobal->GetExecutingModulePointer()->sModuleSpotName; $aParameter['trx_typ'] = $this->GetConfigParameter('trx_typ_pay'); return $aParameter; }
[ "protected", "function", "GetPayFieldParameter", "(", "$", "aParameter", "=", "array", "(", ")", ",", "$", "oOrder", ")", "{", "if", "(", "!", "is_array", "(", "$", "aParameter", ")", ")", "{", "$", "aParameter", "=", "array", "(", ")", ";", "}", "$", "aParameter", "=", "$", "this", "->", "GetStandardInputFieldParameter", "(", "$", "aParameter", ")", ";", "if", "(", "!", "empty", "(", "$", "this", "->", "sStorageId", ")", ")", "{", "$", "aParameter", "[", "'from_datastorage_id'", "]", "=", "$", "this", "->", "sStorageId", ";", "}", "$", "oShopBasket", "=", "TShopBasket", "::", "GetInstance", "(", ")", ";", "$", "oActivePaymentMethod", "=", "$", "oShopBasket", "->", "GetActivePaymentMethod", "(", ")", ";", "$", "aParameter", "[", "'shop_payment_method_id'", "]", "=", "$", "oActivePaymentMethod", "->", "id", ";", "$", "redirectUrl", "=", "$", "this", "->", "GetRedirectUrl", "(", ")", ";", "$", "sSilentErrorURL", "=", "$", "this", "->", "GetExecutePaymentErrorURL", "(", ")", ";", "if", "(", "$", "sSilentErrorURL", ")", "{", "$", "aParameter", "[", "'silent_error_url'", "]", "=", "$", "sSilentErrorURL", ".", "'/'", ".", "self", "::", "URL_PARAMETER_NAME", ".", "'/error'", ";", "}", "$", "aParameter", "[", "'redirect_url'", "]", "=", "$", "redirectUrl", ";", "$", "oIPNManager", "=", "new", "TPkgShopPaymentIPNManager", "(", ")", ";", "$", "oPortal", "=", "$", "this", "->", "getPortalDomainService", "(", ")", "->", "getActivePortal", "(", ")", ";", "$", "aParameter", "[", "'hidden_trigger_url'", "]", "=", "$", "oIPNManager", "->", "getIPNURL", "(", "$", "oPortal", ",", "$", "oOrder", ")", ";", "$", "aParameter", "[", "'expire_datastorage'", "]", "=", "true", ";", "$", "aParameter", "[", "'execute_order'", "]", "=", "true", ";", "$", "oGlobal", "=", "TGlobal", "::", "instance", "(", ")", ";", "$", "aParameter", "[", "'spot'", "]", "=", "$", "oGlobal", "->", "GetExecutingModulePointer", "(", ")", "->", "sModuleSpotName", ";", "$", "aParameter", "[", "'trx_typ'", "]", "=", "$", "this", "->", "GetConfigParameter", "(", "'trx_typ_pay'", ")", ";", "return", "$", "aParameter", ";", "}" ]
Get parameter to pay a transaction on IPayment with saved storage id. @param array $aParameter @return array $aParameter
[ "Get", "parameter", "to", "pay", "a", "transaction", "on", "IPayment", "with", "saved", "storage", "id", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php#L230-L258
32,393
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php
TShopPaymentHandlerIPaymentEndPoint.GetBillingCountryISOCode
protected function GetBillingCountryISOCode($oBillingAddress) { $sIsoCode = ''; $oCountry = $oBillingAddress->GetFieldDataCountry(); if (!is_null($oCountry)) { $oSystemCountry = $oCountry->GetFieldTCountry(); if (!is_null($oSystemCountry)) { $sIsoCode = $oSystemCountry->fieldIsoCode2; } } return $sIsoCode; }
php
protected function GetBillingCountryISOCode($oBillingAddress) { $sIsoCode = ''; $oCountry = $oBillingAddress->GetFieldDataCountry(); if (!is_null($oCountry)) { $oSystemCountry = $oCountry->GetFieldTCountry(); if (!is_null($oSystemCountry)) { $sIsoCode = $oSystemCountry->fieldIsoCode2; } } return $sIsoCode; }
[ "protected", "function", "GetBillingCountryISOCode", "(", "$", "oBillingAddress", ")", "{", "$", "sIsoCode", "=", "''", ";", "$", "oCountry", "=", "$", "oBillingAddress", "->", "GetFieldDataCountry", "(", ")", ";", "if", "(", "!", "is_null", "(", "$", "oCountry", ")", ")", "{", "$", "oSystemCountry", "=", "$", "oCountry", "->", "GetFieldTCountry", "(", ")", ";", "if", "(", "!", "is_null", "(", "$", "oSystemCountry", ")", ")", "{", "$", "sIsoCode", "=", "$", "oSystemCountry", "->", "fieldIsoCode2", ";", "}", "}", "return", "$", "sIsoCode", ";", "}" ]
Get the iso code from users billing address. @param TdbDataExtranetUserAddress $oBillingAddress @return string $sIsoCode
[ "Get", "the", "iso", "code", "from", "users", "billing", "address", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php#L314-L326
32,394
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php
TShopPaymentHandlerIPaymentEndPoint.GetRequestURL
protected function GetRequestURL() { $sAccountId = $this->GetConfigParameter('account_id'); $sRequestUrl = $this->GetConfigParameter('request_url'); $sRequestUrl = str_replace('[{sAccountId}]', $sAccountId, $sRequestUrl); return $sRequestUrl; }
php
protected function GetRequestURL() { $sAccountId = $this->GetConfigParameter('account_id'); $sRequestUrl = $this->GetConfigParameter('request_url'); $sRequestUrl = str_replace('[{sAccountId}]', $sAccountId, $sRequestUrl); return $sRequestUrl; }
[ "protected", "function", "GetRequestURL", "(", ")", "{", "$", "sAccountId", "=", "$", "this", "->", "GetConfigParameter", "(", "'account_id'", ")", ";", "$", "sRequestUrl", "=", "$", "this", "->", "GetConfigParameter", "(", "'request_url'", ")", ";", "$", "sRequestUrl", "=", "str_replace", "(", "'[{sAccountId}]'", ",", "$", "sAccountId", ",", "$", "sRequestUrl", ")", ";", "return", "$", "sRequestUrl", ";", "}" ]
Get the ipayment request url with replaced account id. @return string $sRequestUrl
[ "Get", "the", "ipayment", "request", "url", "with", "replaced", "account", "id", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php#L333-L340
32,395
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php
TShopPaymentHandlerIPaymentEndPoint.GetErrorCodesFromResponse
protected function GetErrorCodesFromResponse() { $SReturnMessage = false; if ($this->bIsCorrectIPaymentType()) { $oGlobal = TGlobal::instance(); $SReturnState = $oGlobal->GetUserData('ret_status'); if ('ERROR' == $SReturnState) { $SReturnMessage = $oGlobal->GetUserData('ret_errormsg'); $SReturnMessage = utf8_encode($SReturnMessage); } } return $SReturnMessage; }
php
protected function GetErrorCodesFromResponse() { $SReturnMessage = false; if ($this->bIsCorrectIPaymentType()) { $oGlobal = TGlobal::instance(); $SReturnState = $oGlobal->GetUserData('ret_status'); if ('ERROR' == $SReturnState) { $SReturnMessage = $oGlobal->GetUserData('ret_errormsg'); $SReturnMessage = utf8_encode($SReturnMessage); } } return $SReturnMessage; }
[ "protected", "function", "GetErrorCodesFromResponse", "(", ")", "{", "$", "SReturnMessage", "=", "false", ";", "if", "(", "$", "this", "->", "bIsCorrectIPaymentType", "(", ")", ")", "{", "$", "oGlobal", "=", "TGlobal", "::", "instance", "(", ")", ";", "$", "SReturnState", "=", "$", "oGlobal", "->", "GetUserData", "(", "'ret_status'", ")", ";", "if", "(", "'ERROR'", "==", "$", "SReturnState", ")", "{", "$", "SReturnMessage", "=", "$", "oGlobal", "->", "GetUserData", "(", "'ret_errormsg'", ")", ";", "$", "SReturnMessage", "=", "utf8_encode", "(", "$", "SReturnMessage", ")", ";", "}", "}", "return", "$", "SReturnMessage", ";", "}" ]
Get error message sent by IPayment to cms. @return string $SReturnMessage
[ "Get", "error", "message", "sent", "by", "IPayment", "to", "cms", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php#L403-L416
32,396
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php
TShopPaymentHandlerIPaymentEndPoint.PostProcessExternalPaymentHandlerHook
public function PostProcessExternalPaymentHandlerHook() { $bPaymentTransmitOk = parent::PostProcessExternalPaymentHandlerHook(); if ($bPaymentTransmitOk) { $oGlobal = TGlobal::instance(); $sStatus = $oGlobal->GetUserData('ret_status'); if ('ERROR' == $sStatus) { $this->SetErrorCodesFromResponseToMessageManager(); $bPaymentTransmitOk = false; } $this->sStorageId = $oGlobal->GetUserData('storage_id'); $this->aPaymentUserData = $oGlobal->GetUserData(); // the data from ipayment is not returned as iso-8859 foreach (array_keys($this->aPaymentUserData) as $sKey) { if (!is_array($this->aPaymentUserData[$sKey])) { $this->aPaymentUserData[$sKey] = utf8_encode($this->aPaymentUserData[$sKey]); } } $this->aPaymentUserData['sStorageId'] = $this->sStorageId; } if (true === $bPaymentTransmitOk) { $aSecuritiyCheckPostParameter = $this->GetNeedeResponsePostParameterForSecurityCheck(); $bPaymentTransmitOk = $this->IsSecurityCheckOk($aSecuritiyCheckPostParameter['trxuser_id'], $aSecuritiyCheckPostParameter['trx_amount'], $aSecuritiyCheckPostParameter['trx_currency'], $aSecuritiyCheckPostParameter['ret_authcode'], $aSecuritiyCheckPostParameter['ret_trx_number'], $aSecuritiyCheckPostParameter['ret_param_checksum']); if (false === $bPaymentTransmitOk) { // security error - unable to validate hash TTools::WriteLogEntry('iPayment Error: unable to validate security hash. Either the Request is manipulated, or the "Transaktions-Security-Key" was not set in the ipayment configuration', 1, __FILE__, __LINE__); $oMsgManager = TCMSMessageManager::GetInstance(); $oMsgManager->AddMessage(TShopPaymentHandlerIPaymentCreditCard::MSG_MANAGER_NAME, 'ERROR-ORDER-REQUEST-PAYMENT-ERROR', array('errorMsg' => 'unable to validate security hash. Either the Request is manipulated, or the "Transaktions-Security-Key" was not set in the ipayment configuration')); } } return $bPaymentTransmitOk; }
php
public function PostProcessExternalPaymentHandlerHook() { $bPaymentTransmitOk = parent::PostProcessExternalPaymentHandlerHook(); if ($bPaymentTransmitOk) { $oGlobal = TGlobal::instance(); $sStatus = $oGlobal->GetUserData('ret_status'); if ('ERROR' == $sStatus) { $this->SetErrorCodesFromResponseToMessageManager(); $bPaymentTransmitOk = false; } $this->sStorageId = $oGlobal->GetUserData('storage_id'); $this->aPaymentUserData = $oGlobal->GetUserData(); // the data from ipayment is not returned as iso-8859 foreach (array_keys($this->aPaymentUserData) as $sKey) { if (!is_array($this->aPaymentUserData[$sKey])) { $this->aPaymentUserData[$sKey] = utf8_encode($this->aPaymentUserData[$sKey]); } } $this->aPaymentUserData['sStorageId'] = $this->sStorageId; } if (true === $bPaymentTransmitOk) { $aSecuritiyCheckPostParameter = $this->GetNeedeResponsePostParameterForSecurityCheck(); $bPaymentTransmitOk = $this->IsSecurityCheckOk($aSecuritiyCheckPostParameter['trxuser_id'], $aSecuritiyCheckPostParameter['trx_amount'], $aSecuritiyCheckPostParameter['trx_currency'], $aSecuritiyCheckPostParameter['ret_authcode'], $aSecuritiyCheckPostParameter['ret_trx_number'], $aSecuritiyCheckPostParameter['ret_param_checksum']); if (false === $bPaymentTransmitOk) { // security error - unable to validate hash TTools::WriteLogEntry('iPayment Error: unable to validate security hash. Either the Request is manipulated, or the "Transaktions-Security-Key" was not set in the ipayment configuration', 1, __FILE__, __LINE__); $oMsgManager = TCMSMessageManager::GetInstance(); $oMsgManager->AddMessage(TShopPaymentHandlerIPaymentCreditCard::MSG_MANAGER_NAME, 'ERROR-ORDER-REQUEST-PAYMENT-ERROR', array('errorMsg' => 'unable to validate security hash. Either the Request is manipulated, or the "Transaktions-Security-Key" was not set in the ipayment configuration')); } } return $bPaymentTransmitOk; }
[ "public", "function", "PostProcessExternalPaymentHandlerHook", "(", ")", "{", "$", "bPaymentTransmitOk", "=", "parent", "::", "PostProcessExternalPaymentHandlerHook", "(", ")", ";", "if", "(", "$", "bPaymentTransmitOk", ")", "{", "$", "oGlobal", "=", "TGlobal", "::", "instance", "(", ")", ";", "$", "sStatus", "=", "$", "oGlobal", "->", "GetUserData", "(", "'ret_status'", ")", ";", "if", "(", "'ERROR'", "==", "$", "sStatus", ")", "{", "$", "this", "->", "SetErrorCodesFromResponseToMessageManager", "(", ")", ";", "$", "bPaymentTransmitOk", "=", "false", ";", "}", "$", "this", "->", "sStorageId", "=", "$", "oGlobal", "->", "GetUserData", "(", "'storage_id'", ")", ";", "$", "this", "->", "aPaymentUserData", "=", "$", "oGlobal", "->", "GetUserData", "(", ")", ";", "// the data from ipayment is not returned as iso-8859", "foreach", "(", "array_keys", "(", "$", "this", "->", "aPaymentUserData", ")", "as", "$", "sKey", ")", "{", "if", "(", "!", "is_array", "(", "$", "this", "->", "aPaymentUserData", "[", "$", "sKey", "]", ")", ")", "{", "$", "this", "->", "aPaymentUserData", "[", "$", "sKey", "]", "=", "utf8_encode", "(", "$", "this", "->", "aPaymentUserData", "[", "$", "sKey", "]", ")", ";", "}", "}", "$", "this", "->", "aPaymentUserData", "[", "'sStorageId'", "]", "=", "$", "this", "->", "sStorageId", ";", "}", "if", "(", "true", "===", "$", "bPaymentTransmitOk", ")", "{", "$", "aSecuritiyCheckPostParameter", "=", "$", "this", "->", "GetNeedeResponsePostParameterForSecurityCheck", "(", ")", ";", "$", "bPaymentTransmitOk", "=", "$", "this", "->", "IsSecurityCheckOk", "(", "$", "aSecuritiyCheckPostParameter", "[", "'trxuser_id'", "]", ",", "$", "aSecuritiyCheckPostParameter", "[", "'trx_amount'", "]", ",", "$", "aSecuritiyCheckPostParameter", "[", "'trx_currency'", "]", ",", "$", "aSecuritiyCheckPostParameter", "[", "'ret_authcode'", "]", ",", "$", "aSecuritiyCheckPostParameter", "[", "'ret_trx_number'", "]", ",", "$", "aSecuritiyCheckPostParameter", "[", "'ret_param_checksum'", "]", ")", ";", "if", "(", "false", "===", "$", "bPaymentTransmitOk", ")", "{", "// security error - unable to validate hash", "TTools", "::", "WriteLogEntry", "(", "'iPayment Error: unable to validate security hash. Either the Request is manipulated, or the \"Transaktions-Security-Key\" was not set in the ipayment configuration'", ",", "1", ",", "__FILE__", ",", "__LINE__", ")", ";", "$", "oMsgManager", "=", "TCMSMessageManager", "::", "GetInstance", "(", ")", ";", "$", "oMsgManager", "->", "AddMessage", "(", "TShopPaymentHandlerIPaymentCreditCard", "::", "MSG_MANAGER_NAME", ",", "'ERROR-ORDER-REQUEST-PAYMENT-ERROR'", ",", "array", "(", "'errorMsg'", "=>", "'unable to validate security hash. Either the Request is manipulated, or the \"Transaktions-Security-Key\" was not set in the ipayment configuration'", ")", ")", ";", "}", "}", "return", "$", "bPaymentTransmitOk", ";", "}" ]
Save storage id sent from IPayment and make security check the method is called when an external payment handler returns successfully.
[ "Save", "storage", "id", "sent", "from", "IPayment", "and", "make", "security", "check", "the", "method", "is", "called", "when", "an", "external", "payment", "handler", "returns", "successfully", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php#L422-L455
32,397
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php
TShopPaymentHandlerIPaymentEndPoint.ExecuteIPaymentCall
protected function ExecuteIPaymentCall($oOrder) { $parameters = $this->GetPayFieldParameter(array(), $oOrder); $requestUrl = $this->GetRequestURL(); $url = $requestUrl.$this->getUrlUtil()->getArrayAsUrl($parameters, '?', '&'); $this->getRedirect()->redirect($url); }
php
protected function ExecuteIPaymentCall($oOrder) { $parameters = $this->GetPayFieldParameter(array(), $oOrder); $requestUrl = $this->GetRequestURL(); $url = $requestUrl.$this->getUrlUtil()->getArrayAsUrl($parameters, '?', '&'); $this->getRedirect()->redirect($url); }
[ "protected", "function", "ExecuteIPaymentCall", "(", "$", "oOrder", ")", "{", "$", "parameters", "=", "$", "this", "->", "GetPayFieldParameter", "(", "array", "(", ")", ",", "$", "oOrder", ")", ";", "$", "requestUrl", "=", "$", "this", "->", "GetRequestURL", "(", ")", ";", "$", "url", "=", "$", "requestUrl", ".", "$", "this", "->", "getUrlUtil", "(", ")", "->", "getArrayAsUrl", "(", "$", "parameters", ",", "'?'", ",", "'&'", ")", ";", "$", "this", "->", "getRedirect", "(", ")", "->", "redirect", "(", "$", "url", ")", ";", "}" ]
Send payment call to IPayment and check if payment was successfully done.
[ "Send", "payment", "call", "to", "IPayment", "and", "check", "if", "payment", "was", "successfully", "done", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php#L520-L526
32,398
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php
TShopPaymentHandlerIPaymentEndPoint.IsSuccessResponse
protected function IsSuccessResponse($response = '') { $bPaymentOk = false; $oGlobal = TGlobal::instance(); if (empty($response)) { $aResult = $this->GetNeedeResponsePostParameterForSecurityCheck(); $aResult['ret_status'] = $oGlobal->GetUserData('ret_status'); } else { $aResult = $this->GetResultFormResponse($response); } if (count($aResult) > 0 && array_key_exists('ret_status', $aResult) && 'SUCCESS' == $aResult['ret_status']) { $bPaymentOk = true; } if ($bPaymentOk) { $bPaymentOk = $this->IsSecurityCheckOk($aResult['trxuser_id'], $aResult['trx_amount'], $aResult['trx_currency'], $aResult['ret_authcode'], $aResult['ret_trx_number'], $aResult['ret_param_checksum']); } return $bPaymentOk; }
php
protected function IsSuccessResponse($response = '') { $bPaymentOk = false; $oGlobal = TGlobal::instance(); if (empty($response)) { $aResult = $this->GetNeedeResponsePostParameterForSecurityCheck(); $aResult['ret_status'] = $oGlobal->GetUserData('ret_status'); } else { $aResult = $this->GetResultFormResponse($response); } if (count($aResult) > 0 && array_key_exists('ret_status', $aResult) && 'SUCCESS' == $aResult['ret_status']) { $bPaymentOk = true; } if ($bPaymentOk) { $bPaymentOk = $this->IsSecurityCheckOk($aResult['trxuser_id'], $aResult['trx_amount'], $aResult['trx_currency'], $aResult['ret_authcode'], $aResult['ret_trx_number'], $aResult['ret_param_checksum']); } return $bPaymentOk; }
[ "protected", "function", "IsSuccessResponse", "(", "$", "response", "=", "''", ")", "{", "$", "bPaymentOk", "=", "false", ";", "$", "oGlobal", "=", "TGlobal", "::", "instance", "(", ")", ";", "if", "(", "empty", "(", "$", "response", ")", ")", "{", "$", "aResult", "=", "$", "this", "->", "GetNeedeResponsePostParameterForSecurityCheck", "(", ")", ";", "$", "aResult", "[", "'ret_status'", "]", "=", "$", "oGlobal", "->", "GetUserData", "(", "'ret_status'", ")", ";", "}", "else", "{", "$", "aResult", "=", "$", "this", "->", "GetResultFormResponse", "(", "$", "response", ")", ";", "}", "if", "(", "count", "(", "$", "aResult", ")", ">", "0", "&&", "array_key_exists", "(", "'ret_status'", ",", "$", "aResult", ")", "&&", "'SUCCESS'", "==", "$", "aResult", "[", "'ret_status'", "]", ")", "{", "$", "bPaymentOk", "=", "true", ";", "}", "if", "(", "$", "bPaymentOk", ")", "{", "$", "bPaymentOk", "=", "$", "this", "->", "IsSecurityCheckOk", "(", "$", "aResult", "[", "'trxuser_id'", "]", ",", "$", "aResult", "[", "'trx_amount'", "]", ",", "$", "aResult", "[", "'trx_currency'", "]", ",", "$", "aResult", "[", "'ret_authcode'", "]", ",", "$", "aResult", "[", "'ret_trx_number'", "]", ",", "$", "aResult", "[", "'ret_param_checksum'", "]", ")", ";", "}", "return", "$", "bPaymentOk", ";", "}" ]
Check if the payment call to IPayment was succesfully done by parameter ret_status and hash check. deprecated @param string $response if empty function get parameter from post @return bool $bPaymentOk
[ "Check", "if", "the", "payment", "call", "to", "IPayment", "was", "succesfully", "done", "by", "parameter", "ret_status", "and", "hash", "check", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php#L538-L557
32,399
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php
TShopPaymentHandlerIPaymentEndPoint.IsSecurityCheckOk
protected function IsSecurityCheckOk($trxuser_id, $trx_amount, $trx_currency, $trxpassword, $ret_trx_number, $sOldChecksum) { $bChecksumIsOk = true; $sSharedSecret = $this->GetConfigParameter('shared_secret'); if (!empty($sSharedSecret)) { $sNewChecksum = md5($trxuser_id.$trx_amount.$trx_currency.$trxpassword.$ret_trx_number.$sSharedSecret); if ($sNewChecksum != $sOldChecksum) { $bChecksumIsOk = false; } } return $bChecksumIsOk; }
php
protected function IsSecurityCheckOk($trxuser_id, $trx_amount, $trx_currency, $trxpassword, $ret_trx_number, $sOldChecksum) { $bChecksumIsOk = true; $sSharedSecret = $this->GetConfigParameter('shared_secret'); if (!empty($sSharedSecret)) { $sNewChecksum = md5($trxuser_id.$trx_amount.$trx_currency.$trxpassword.$ret_trx_number.$sSharedSecret); if ($sNewChecksum != $sOldChecksum) { $bChecksumIsOk = false; } } return $bChecksumIsOk; }
[ "protected", "function", "IsSecurityCheckOk", "(", "$", "trxuser_id", ",", "$", "trx_amount", ",", "$", "trx_currency", ",", "$", "trxpassword", ",", "$", "ret_trx_number", ",", "$", "sOldChecksum", ")", "{", "$", "bChecksumIsOk", "=", "true", ";", "$", "sSharedSecret", "=", "$", "this", "->", "GetConfigParameter", "(", "'shared_secret'", ")", ";", "if", "(", "!", "empty", "(", "$", "sSharedSecret", ")", ")", "{", "$", "sNewChecksum", "=", "md5", "(", "$", "trxuser_id", ".", "$", "trx_amount", ".", "$", "trx_currency", ".", "$", "trxpassword", ".", "$", "ret_trx_number", ".", "$", "sSharedSecret", ")", ";", "if", "(", "$", "sNewChecksum", "!=", "$", "sOldChecksum", ")", "{", "$", "bChecksumIsOk", "=", "false", ";", "}", "}", "return", "$", "bChecksumIsOk", ";", "}" ]
make md5 check over security parameter with shared secret and chek resutl with hash from IPayment. @param string $trxuser_id @param string $trx_amount @param string $trx_currency @param string $trxpassword @param string $ret_trx_number @param string $sOldChecksum @return bool $bChecksumIsOk
[ "make", "md5", "check", "over", "security", "parameter", "with", "shared", "secret", "and", "chek", "resutl", "with", "hash", "from", "IPayment", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php#L572-L584