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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
31,900 | PGB-LIV/php-ms | src/Search/MsgfPlusSearch.php | MsgfPlusSearch.executeCommand | private function executeCommand($command)
{
$stdoutPath = tempnam(sys_get_temp_dir(), 'php-msMsgfOut');
$stderrPath = tempnam(sys_get_temp_dir(), 'php-msMsGfErr');
$descriptors = array(
0 => array(
'pipe',
'r'
),
1 => array(
'file',
$stdoutPath,
'a'
),
2 => array(
'file',
$stderrPath,
'a'
)
);
$process = proc_open($command, $descriptors, $pipes);
proc_close($process);
if (filesize($stderrPath) > 0) {
throw new \InvalidArgumentException(file_get_contents($stderrPath));
}
return $stdoutPath;
} | php | private function executeCommand($command)
{
$stdoutPath = tempnam(sys_get_temp_dir(), 'php-msMsgfOut');
$stderrPath = tempnam(sys_get_temp_dir(), 'php-msMsGfErr');
$descriptors = array(
0 => array(
'pipe',
'r'
),
1 => array(
'file',
$stdoutPath,
'a'
),
2 => array(
'file',
$stderrPath,
'a'
)
);
$process = proc_open($command, $descriptors, $pipes);
proc_close($process);
if (filesize($stderrPath) > 0) {
throw new \InvalidArgumentException(file_get_contents($stderrPath));
}
return $stdoutPath;
} | [
"private",
"function",
"executeCommand",
"(",
"$",
"command",
")",
"{",
"$",
"stdoutPath",
"=",
"tempnam",
"(",
"sys_get_temp_dir",
"(",
")",
",",
"'php-msMsgfOut'",
")",
";",
"$",
"stderrPath",
"=",
"tempnam",
"(",
"sys_get_temp_dir",
"(",
")",
",",
"'php-msMsGfErr'",
")",
";",
"$",
"descriptors",
"=",
"array",
"(",
"0",
"=>",
"array",
"(",
"'pipe'",
",",
"'r'",
")",
",",
"1",
"=>",
"array",
"(",
"'file'",
",",
"$",
"stdoutPath",
",",
"'a'",
")",
",",
"2",
"=>",
"array",
"(",
"'file'",
",",
"$",
"stderrPath",
",",
"'a'",
")",
")",
";",
"$",
"process",
"=",
"proc_open",
"(",
"$",
"command",
",",
"$",
"descriptors",
",",
"$",
"pipes",
")",
";",
"proc_close",
"(",
"$",
"process",
")",
";",
"if",
"(",
"filesize",
"(",
"$",
"stderrPath",
")",
">",
"0",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"file_get_contents",
"(",
"$",
"stderrPath",
")",
")",
";",
"}",
"return",
"$",
"stdoutPath",
";",
"}"
] | Executes the MSGF+ Command.
@param string $command
Complete command line argument to execute
@throws \InvalidArgumentException Thrown if MS-GF+ writes anything to stderr
@return string Path to MS-GF+ stdout log file | [
"Executes",
"the",
"MSGF",
"+",
"Command",
"."
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Search/MsgfPlusSearch.php#L145-L175 |
31,901 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/SimpleCheckoutExampleCLI.php | SimpleCheckoutExampleCLI._waitUntilAuthorizationProcessingIsCompleted | private function _waitUntilAuthorizationProcessingIsCompleted($amazonAuthorizationId)
{
$response
= $this->callStepAndCheckForException(
'waitUntilAuthorizationProcessingIsCompleted',
array($amazonAuthorizationId)
);
printGetAuthorizationDetailsResponse($response);
validateThatAuthorizationIsOpen($response);
} | php | private function _waitUntilAuthorizationProcessingIsCompleted($amazonAuthorizationId)
{
$response
= $this->callStepAndCheckForException(
'waitUntilAuthorizationProcessingIsCompleted',
array($amazonAuthorizationId)
);
printGetAuthorizationDetailsResponse($response);
validateThatAuthorizationIsOpen($response);
} | [
"private",
"function",
"_waitUntilAuthorizationProcessingIsCompleted",
"(",
"$",
"amazonAuthorizationId",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"callStepAndCheckForException",
"(",
"'waitUntilAuthorizationProcessingIsCompleted'",
",",
"array",
"(",
"$",
"amazonAuthorizationId",
")",
")",
";",
"printGetAuthorizationDetailsResponse",
"(",
"$",
"response",
")",
";",
"validateThatAuthorizationIsOpen",
"(",
"$",
"response",
")",
";",
"}"
] | Poll the API for the status of the Authorization Request, and continue
once the status has been updated
Throw an error if the status is not equal to Open
@param string $amazonAuthorizationId authorization transaction to query | [
"Poll",
"the",
"API",
"for",
"the",
"status",
"of",
"the",
"Authorization",
"Request",
"and",
"continue",
"once",
"the",
"status",
"has",
"been",
"updated",
"Throw",
"an",
"error",
"if",
"the",
"status",
"is",
"not",
"equal",
"to",
"Open"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/SimpleCheckoutExampleCLI.php#L164-L173 |
31,902 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/SimpleCheckoutExampleCLI.php | SimpleCheckoutExampleCLI._getPreTaxAndShippingOrderAmountFromStdIn | private function _getPreTaxAndShippingOrderAmountFromStdIn()
{
print PHP_EOL . "-------------------------------------------" . PHP_EOL;
print "Enter the pre tax amount to charge for the order" .
"as a number (to 2 decimal places): ";
do {
$orderAmount = trim(fgets(STDIN));
} while (!is_numeric($orderAmount));
return $orderAmount;
} | php | private function _getPreTaxAndShippingOrderAmountFromStdIn()
{
print PHP_EOL . "-------------------------------------------" . PHP_EOL;
print "Enter the pre tax amount to charge for the order" .
"as a number (to 2 decimal places): ";
do {
$orderAmount = trim(fgets(STDIN));
} while (!is_numeric($orderAmount));
return $orderAmount;
} | [
"private",
"function",
"_getPreTaxAndShippingOrderAmountFromStdIn",
"(",
")",
"{",
"print",
"PHP_EOL",
".",
"\"-------------------------------------------\"",
".",
"PHP_EOL",
";",
"print",
"\"Enter the pre tax amount to charge for the order\"",
".",
"\"as a number (to 2 decimal places): \"",
";",
"do",
"{",
"$",
"orderAmount",
"=",
"trim",
"(",
"fgets",
"(",
"STDIN",
")",
")",
";",
"}",
"while",
"(",
"!",
"is_numeric",
"(",
"$",
"orderAmount",
")",
")",
";",
"return",
"$",
"orderAmount",
";",
"}"
] | Capture the pre tax order amount from standard input,
making sure that it is a numeric string
@return string total amount of the order before tax and shipping charges | [
"Capture",
"the",
"pre",
"tax",
"order",
"amount",
"from",
"standard",
"input",
"making",
"sure",
"that",
"it",
"is",
"a",
"numeric",
"string"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/SimpleCheckoutExampleCLI.php#L213-L223 |
31,903 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/SimpleCheckoutExampleCLI.php | SimpleCheckoutExampleCLI._getShippingTypeFromStdIn | private function _getShippingTypeFromStdIn()
{
print PHP_EOL . "Select a shipping option for the order:" . PHP_EOL;
print "\t 1 - Overnight shipping" . PHP_EOL;
print "\t 2 - 2-day shipping" . PHP_EOL;
print "\t 3 - 5-day shipping" . PHP_EOL;
print ">>";
do {
$shippingType = trim(fgets(STDIN));
} while (!is_numeric($shippingType) and
($shippingType < 1 or $shippingType > 3));
return $shippingType - 1;
} | php | private function _getShippingTypeFromStdIn()
{
print PHP_EOL . "Select a shipping option for the order:" . PHP_EOL;
print "\t 1 - Overnight shipping" . PHP_EOL;
print "\t 2 - 2-day shipping" . PHP_EOL;
print "\t 3 - 5-day shipping" . PHP_EOL;
print ">>";
do {
$shippingType = trim(fgets(STDIN));
} while (!is_numeric($shippingType) and
($shippingType < 1 or $shippingType > 3));
return $shippingType - 1;
} | [
"private",
"function",
"_getShippingTypeFromStdIn",
"(",
")",
"{",
"print",
"PHP_EOL",
".",
"\"Select a shipping option for the order:\"",
".",
"PHP_EOL",
";",
"print",
"\"\\t 1 - Overnight shipping\"",
".",
"PHP_EOL",
";",
"print",
"\"\\t 2 - 2-day shipping\"",
".",
"PHP_EOL",
";",
"print",
"\"\\t 3 - 5-day shipping\"",
".",
"PHP_EOL",
";",
"print",
"\">>\"",
";",
"do",
"{",
"$",
"shippingType",
"=",
"trim",
"(",
"fgets",
"(",
"STDIN",
")",
")",
";",
"}",
"while",
"(",
"!",
"is_numeric",
"(",
"$",
"shippingType",
")",
"and",
"(",
"$",
"shippingType",
"<",
"1",
"or",
"$",
"shippingType",
">",
"3",
")",
")",
";",
"return",
"$",
"shippingType",
"-",
"1",
";",
"}"
] | Capture the shipping type for this order, which determines
the shipping charge
@return number selected shipping type index | [
"Capture",
"the",
"shipping",
"type",
"for",
"this",
"order",
"which",
"determines",
"the",
"shipping",
"charge"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/SimpleCheckoutExampleCLI.php#L231-L245 |
31,904 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/SplitShipmentsCheckoutExampleCLI.php | SplitShipmentsCheckoutExampleCLI._performAuthAndCaptureForOrderShipment | private function _performAuthAndCaptureForOrderShipment($shipmentNumber)
{
$response = $amazonAuthorizationId = $this->_performAuthorizationForShipment($shipmentNumber);
$this->_waitUntilAuthorizationProcessingIsCompleted($amazonAuthorizationId);
$this->_performCaptureForShipment($shipmentNumber, $amazonAuthorizationId);
} | php | private function _performAuthAndCaptureForOrderShipment($shipmentNumber)
{
$response = $amazonAuthorizationId = $this->_performAuthorizationForShipment($shipmentNumber);
$this->_waitUntilAuthorizationProcessingIsCompleted($amazonAuthorizationId);
$this->_performCaptureForShipment($shipmentNumber, $amazonAuthorizationId);
} | [
"private",
"function",
"_performAuthAndCaptureForOrderShipment",
"(",
"$",
"shipmentNumber",
")",
"{",
"$",
"response",
"=",
"$",
"amazonAuthorizationId",
"=",
"$",
"this",
"->",
"_performAuthorizationForShipment",
"(",
"$",
"shipmentNumber",
")",
";",
"$",
"this",
"->",
"_waitUntilAuthorizationProcessingIsCompleted",
"(",
"$",
"amazonAuthorizationId",
")",
";",
"$",
"this",
"->",
"_performCaptureForShipment",
"(",
"$",
"shipmentNumber",
",",
"$",
"amazonAuthorizationId",
")",
";",
"}"
] | Perform the authorize and capture for a single shipment in the order
@param int $shipmentNumber the shipment to perform transactions on | [
"Perform",
"the",
"authorize",
"and",
"capture",
"for",
"a",
"single",
"shipment",
"in",
"the",
"order"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/SplitShipmentsCheckoutExampleCLI.php#L180-L185 |
31,905 | chameleon-system/chameleon-shop | src/ShopCurrencyBundle/Bridge/Chameleon/Objects/CurrencyBasket.php | CurrencyBasket.SetActivePaymentMethod | public function SetActivePaymentMethod($oShopPayment)
{
$oldActivePaymentMethod = $this->GetActivePaymentMethod();
$isPaymentSet = parent::SetActivePaymentMethod($oShopPayment);
$newActivePaymentMethod = $this->GetActivePaymentMethod();
if (null === $oldActivePaymentMethod || null === $newActivePaymentMethod) {
return $isPaymentSet;
}
if (false === $oldActivePaymentMethod->IsSameAs($newActivePaymentMethod)) {
return $isPaymentSet;
}
$activeCurrency = $this->getCurrencyService()->getObject();
if (null === $newActivePaymentMethod->fieldValueOriginal && true == $activeCurrency->fieldIsBaseCurrency) {
return $isPaymentSet;
}
if (null !== $newActivePaymentMethod->fieldValueOriginal) {
$convertedValue = \TdbPkgShopCurrency::ConvertToActiveCurrency($newActivePaymentMethod->fieldValueOriginal);
if ($convertedValue === $newActivePaymentMethod->GetPrice()) {
return $isPaymentSet;
}
}
$reloadedPayment = \TdbShopPaymentMethod::GetNewInstance($newActivePaymentMethod->id);
parent::SetActivePaymentMethod($reloadedPayment);
return $isPaymentSet;
} | php | public function SetActivePaymentMethod($oShopPayment)
{
$oldActivePaymentMethod = $this->GetActivePaymentMethod();
$isPaymentSet = parent::SetActivePaymentMethod($oShopPayment);
$newActivePaymentMethod = $this->GetActivePaymentMethod();
if (null === $oldActivePaymentMethod || null === $newActivePaymentMethod) {
return $isPaymentSet;
}
if (false === $oldActivePaymentMethod->IsSameAs($newActivePaymentMethod)) {
return $isPaymentSet;
}
$activeCurrency = $this->getCurrencyService()->getObject();
if (null === $newActivePaymentMethod->fieldValueOriginal && true == $activeCurrency->fieldIsBaseCurrency) {
return $isPaymentSet;
}
if (null !== $newActivePaymentMethod->fieldValueOriginal) {
$convertedValue = \TdbPkgShopCurrency::ConvertToActiveCurrency($newActivePaymentMethod->fieldValueOriginal);
if ($convertedValue === $newActivePaymentMethod->GetPrice()) {
return $isPaymentSet;
}
}
$reloadedPayment = \TdbShopPaymentMethod::GetNewInstance($newActivePaymentMethod->id);
parent::SetActivePaymentMethod($reloadedPayment);
return $isPaymentSet;
} | [
"public",
"function",
"SetActivePaymentMethod",
"(",
"$",
"oShopPayment",
")",
"{",
"$",
"oldActivePaymentMethod",
"=",
"$",
"this",
"->",
"GetActivePaymentMethod",
"(",
")",
";",
"$",
"isPaymentSet",
"=",
"parent",
"::",
"SetActivePaymentMethod",
"(",
"$",
"oShopPayment",
")",
";",
"$",
"newActivePaymentMethod",
"=",
"$",
"this",
"->",
"GetActivePaymentMethod",
"(",
")",
";",
"if",
"(",
"null",
"===",
"$",
"oldActivePaymentMethod",
"||",
"null",
"===",
"$",
"newActivePaymentMethod",
")",
"{",
"return",
"$",
"isPaymentSet",
";",
"}",
"if",
"(",
"false",
"===",
"$",
"oldActivePaymentMethod",
"->",
"IsSameAs",
"(",
"$",
"newActivePaymentMethod",
")",
")",
"{",
"return",
"$",
"isPaymentSet",
";",
"}",
"$",
"activeCurrency",
"=",
"$",
"this",
"->",
"getCurrencyService",
"(",
")",
"->",
"getObject",
"(",
")",
";",
"if",
"(",
"null",
"===",
"$",
"newActivePaymentMethod",
"->",
"fieldValueOriginal",
"&&",
"true",
"==",
"$",
"activeCurrency",
"->",
"fieldIsBaseCurrency",
")",
"{",
"return",
"$",
"isPaymentSet",
";",
"}",
"if",
"(",
"null",
"!==",
"$",
"newActivePaymentMethod",
"->",
"fieldValueOriginal",
")",
"{",
"$",
"convertedValue",
"=",
"\\",
"TdbPkgShopCurrency",
"::",
"ConvertToActiveCurrency",
"(",
"$",
"newActivePaymentMethod",
"->",
"fieldValueOriginal",
")",
";",
"if",
"(",
"$",
"convertedValue",
"===",
"$",
"newActivePaymentMethod",
"->",
"GetPrice",
"(",
")",
")",
"{",
"return",
"$",
"isPaymentSet",
";",
"}",
"}",
"$",
"reloadedPayment",
"=",
"\\",
"TdbShopPaymentMethod",
"::",
"GetNewInstance",
"(",
"$",
"newActivePaymentMethod",
"->",
"id",
")",
";",
"parent",
"::",
"SetActivePaymentMethod",
"(",
"$",
"reloadedPayment",
")",
";",
"return",
"$",
"isPaymentSet",
";",
"}"
] | Reloads the active payment method on currency change,
so that the payment method holds the payment charges in the correct currency.
{@inheritdoc} | [
"Reloads",
"the",
"active",
"payment",
"method",
"on",
"currency",
"change",
"so",
"that",
"the",
"payment",
"method",
"holds",
"the",
"payment",
"charges",
"in",
"the",
"correct",
"currency",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopCurrencyBundle/Bridge/Chameleon/Objects/CurrencyBasket.php#L25-L53 |
31,906 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopOrderStep/TShopOrderStepList.class.php | TShopOrderStepList.GetNavigationStepList | public static function GetNavigationStepList(TdbShopOrderStep $oActiveStep)
{
$query = "SELECT *
FROM `shop_order_step`
WHERE `show_in_navigation` = '1'
ORDER BY `position` ASC
";
$oSteps = &TdbShopOrderStepList::GetList($query);
$oSteps->bAllowItemCache = true;
$stepIdList = array();
while ($oStep = &$oSteps->Next()) {
if (false === $oStep->IsActive()) {
continue;
}
$stepIdList[] = MySqlLegacySupport::getInstance()->real_escape_string($oStep->id);
if ($oActiveStep->id == $oStep->id) {
$oStep->bIsTheActiveStep = true;
} else {
$oStep->bIsTheActiveStep = false;
}
}
$query = "SELECT *
FROM `shop_order_step`
WHERE `show_in_navigation` = '1' AND `id` IN ('".implode("','", $stepIdList)."')
ORDER BY `position` ASC
";
$oSteps = &TdbShopOrderStepList::GetList($query);
$oSteps->bAllowItemCache = true;
while ($oStep = &$oSteps->Next()) {
$stepIdList[] = $oStep->id;
if ($oActiveStep->id == $oStep->id) {
$oStep->bIsTheActiveStep = true;
} else {
$oStep->bIsTheActiveStep = false;
}
}
$oSteps->GoToStart();
return $oSteps;
} | php | public static function GetNavigationStepList(TdbShopOrderStep $oActiveStep)
{
$query = "SELECT *
FROM `shop_order_step`
WHERE `show_in_navigation` = '1'
ORDER BY `position` ASC
";
$oSteps = &TdbShopOrderStepList::GetList($query);
$oSteps->bAllowItemCache = true;
$stepIdList = array();
while ($oStep = &$oSteps->Next()) {
if (false === $oStep->IsActive()) {
continue;
}
$stepIdList[] = MySqlLegacySupport::getInstance()->real_escape_string($oStep->id);
if ($oActiveStep->id == $oStep->id) {
$oStep->bIsTheActiveStep = true;
} else {
$oStep->bIsTheActiveStep = false;
}
}
$query = "SELECT *
FROM `shop_order_step`
WHERE `show_in_navigation` = '1' AND `id` IN ('".implode("','", $stepIdList)."')
ORDER BY `position` ASC
";
$oSteps = &TdbShopOrderStepList::GetList($query);
$oSteps->bAllowItemCache = true;
while ($oStep = &$oSteps->Next()) {
$stepIdList[] = $oStep->id;
if ($oActiveStep->id == $oStep->id) {
$oStep->bIsTheActiveStep = true;
} else {
$oStep->bIsTheActiveStep = false;
}
}
$oSteps->GoToStart();
return $oSteps;
} | [
"public",
"static",
"function",
"GetNavigationStepList",
"(",
"TdbShopOrderStep",
"$",
"oActiveStep",
")",
"{",
"$",
"query",
"=",
"\"SELECT *\n FROM `shop_order_step`\n WHERE `show_in_navigation` = '1'\n ORDER BY `position` ASC\n \"",
";",
"$",
"oSteps",
"=",
"&",
"TdbShopOrderStepList",
"::",
"GetList",
"(",
"$",
"query",
")",
";",
"$",
"oSteps",
"->",
"bAllowItemCache",
"=",
"true",
";",
"$",
"stepIdList",
"=",
"array",
"(",
")",
";",
"while",
"(",
"$",
"oStep",
"=",
"&",
"$",
"oSteps",
"->",
"Next",
"(",
")",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"oStep",
"->",
"IsActive",
"(",
")",
")",
"{",
"continue",
";",
"}",
"$",
"stepIdList",
"[",
"]",
"=",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"oStep",
"->",
"id",
")",
";",
"if",
"(",
"$",
"oActiveStep",
"->",
"id",
"==",
"$",
"oStep",
"->",
"id",
")",
"{",
"$",
"oStep",
"->",
"bIsTheActiveStep",
"=",
"true",
";",
"}",
"else",
"{",
"$",
"oStep",
"->",
"bIsTheActiveStep",
"=",
"false",
";",
"}",
"}",
"$",
"query",
"=",
"\"SELECT *\n FROM `shop_order_step`\n WHERE `show_in_navigation` = '1' AND `id` IN ('\"",
".",
"implode",
"(",
"\"','\"",
",",
"$",
"stepIdList",
")",
".",
"\"')\n ORDER BY `position` ASC\n \"",
";",
"$",
"oSteps",
"=",
"&",
"TdbShopOrderStepList",
"::",
"GetList",
"(",
"$",
"query",
")",
";",
"$",
"oSteps",
"->",
"bAllowItemCache",
"=",
"true",
";",
"while",
"(",
"$",
"oStep",
"=",
"&",
"$",
"oSteps",
"->",
"Next",
"(",
")",
")",
"{",
"$",
"stepIdList",
"[",
"]",
"=",
"$",
"oStep",
"->",
"id",
";",
"if",
"(",
"$",
"oActiveStep",
"->",
"id",
"==",
"$",
"oStep",
"->",
"id",
")",
"{",
"$",
"oStep",
"->",
"bIsTheActiveStep",
"=",
"true",
";",
"}",
"else",
"{",
"$",
"oStep",
"->",
"bIsTheActiveStep",
"=",
"false",
";",
"}",
"}",
"$",
"oSteps",
"->",
"GoToStart",
"(",
")",
";",
"return",
"$",
"oSteps",
";",
"}"
] | returns all navi steps marked as navi steps. the active step will be marked as "is active".
@param TdbShopOrderStep $oActiveStep
@return TdbShopOrderStepList | [
"returns",
"all",
"navi",
"steps",
"marked",
"as",
"navi",
"steps",
".",
"the",
"active",
"step",
"will",
"be",
"marked",
"as",
"is",
"active",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrderStep/TShopOrderStepList.class.php#L73-L114 |
31,907 | edmondscommerce/doctrine-static-meta | src/CodeGeneration/Action/CreateEntityAction.php | CreateEntityAction.run | public function run(): void
{
$this->entityCreator->createTargetFileObject($this->entityFqn)->write();
$this->abstractEntityFactoryCreator->createTargetFileObject()->writeIfNotExists();
$this->entityFactoryCreator->createTargetFileObject()->write();
$this->entityInterfaceCreator->createTargetFileObject()->write();
$this->abstractEntityRepositoryCreator->createTargetFileObject()->writeIfNotExists();
$this->entityRepositoryCreator->createTargetFileObject()->write();
if (true === $this->generateSaver) {
$this->entitySaverCreator->createTargetFileObject()->write();
}
$this->entityFixtureCreator->createTargetFileObject()->write();
$this->abstractEntityTestCreator->createTargetFileObject()->writeIfNotExists();
$this->bootstrapCreator->createTargetFileObject()->writeIfNotExists();
$this->entityTestCreator->createTargetFileObject()->write();
$this->dataTransferObjectCreator->createTargetFileObject()->write();
$this->entityDtoFactoryCreator->createTargetFileObject()->write();
$this->entityUpserterCreator->createTargetFileObject()->write();
$this->entityUnitOfWorkHelperCreator->createTargetFileObject()->write();
} | php | public function run(): void
{
$this->entityCreator->createTargetFileObject($this->entityFqn)->write();
$this->abstractEntityFactoryCreator->createTargetFileObject()->writeIfNotExists();
$this->entityFactoryCreator->createTargetFileObject()->write();
$this->entityInterfaceCreator->createTargetFileObject()->write();
$this->abstractEntityRepositoryCreator->createTargetFileObject()->writeIfNotExists();
$this->entityRepositoryCreator->createTargetFileObject()->write();
if (true === $this->generateSaver) {
$this->entitySaverCreator->createTargetFileObject()->write();
}
$this->entityFixtureCreator->createTargetFileObject()->write();
$this->abstractEntityTestCreator->createTargetFileObject()->writeIfNotExists();
$this->bootstrapCreator->createTargetFileObject()->writeIfNotExists();
$this->entityTestCreator->createTargetFileObject()->write();
$this->dataTransferObjectCreator->createTargetFileObject()->write();
$this->entityDtoFactoryCreator->createTargetFileObject()->write();
$this->entityUpserterCreator->createTargetFileObject()->write();
$this->entityUnitOfWorkHelperCreator->createTargetFileObject()->write();
} | [
"public",
"function",
"run",
"(",
")",
":",
"void",
"{",
"$",
"this",
"->",
"entityCreator",
"->",
"createTargetFileObject",
"(",
"$",
"this",
"->",
"entityFqn",
")",
"->",
"write",
"(",
")",
";",
"$",
"this",
"->",
"abstractEntityFactoryCreator",
"->",
"createTargetFileObject",
"(",
")",
"->",
"writeIfNotExists",
"(",
")",
";",
"$",
"this",
"->",
"entityFactoryCreator",
"->",
"createTargetFileObject",
"(",
")",
"->",
"write",
"(",
")",
";",
"$",
"this",
"->",
"entityInterfaceCreator",
"->",
"createTargetFileObject",
"(",
")",
"->",
"write",
"(",
")",
";",
"$",
"this",
"->",
"abstractEntityRepositoryCreator",
"->",
"createTargetFileObject",
"(",
")",
"->",
"writeIfNotExists",
"(",
")",
";",
"$",
"this",
"->",
"entityRepositoryCreator",
"->",
"createTargetFileObject",
"(",
")",
"->",
"write",
"(",
")",
";",
"if",
"(",
"true",
"===",
"$",
"this",
"->",
"generateSaver",
")",
"{",
"$",
"this",
"->",
"entitySaverCreator",
"->",
"createTargetFileObject",
"(",
")",
"->",
"write",
"(",
")",
";",
"}",
"$",
"this",
"->",
"entityFixtureCreator",
"->",
"createTargetFileObject",
"(",
")",
"->",
"write",
"(",
")",
";",
"$",
"this",
"->",
"abstractEntityTestCreator",
"->",
"createTargetFileObject",
"(",
")",
"->",
"writeIfNotExists",
"(",
")",
";",
"$",
"this",
"->",
"bootstrapCreator",
"->",
"createTargetFileObject",
"(",
")",
"->",
"writeIfNotExists",
"(",
")",
";",
"$",
"this",
"->",
"entityTestCreator",
"->",
"createTargetFileObject",
"(",
")",
"->",
"write",
"(",
")",
";",
"$",
"this",
"->",
"dataTransferObjectCreator",
"->",
"createTargetFileObject",
"(",
")",
"->",
"write",
"(",
")",
";",
"$",
"this",
"->",
"entityDtoFactoryCreator",
"->",
"createTargetFileObject",
"(",
")",
"->",
"write",
"(",
")",
";",
"$",
"this",
"->",
"entityUpserterCreator",
"->",
"createTargetFileObject",
"(",
")",
"->",
"write",
"(",
")",
";",
"$",
"this",
"->",
"entityUnitOfWorkHelperCreator",
"->",
"createTargetFileObject",
"(",
")",
"->",
"write",
"(",
")",
";",
"}"
] | Create all the Entity related code
@throws \EdmondsCommerce\DoctrineStaticMeta\Exception\DoctrineStaticMetaException | [
"Create",
"all",
"the",
"Entity",
"related",
"code"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/Action/CreateEntityAction.php#L182-L215 |
31,908 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Samples/RefundResult.php | RefundResult._waitUntilRefundProcessingIsCompleted | private function _waitUntilRefundProcessingIsCompleted($amazonRefundId)
{
// Check for the presence of the ipn notification
$this->waitForNotificationToBeProcessedBeforeContinuing(
$amazonRefundId,
"RefundNotification"
);
// Notification is present, go and get the full
// information for this notification
$response = $this->callStepAndCheckForException(
'getRefundDetails', array($amazonRefundId)
);
validateThatRefundIsCompleted($response->getGetRefundDetailsResult()->getRefundDetails());
echo $this->printResponseToWebpage(
"printGetRefundDetailsResponse",
array($response)
);
} | php | private function _waitUntilRefundProcessingIsCompleted($amazonRefundId)
{
// Check for the presence of the ipn notification
$this->waitForNotificationToBeProcessedBeforeContinuing(
$amazonRefundId,
"RefundNotification"
);
// Notification is present, go and get the full
// information for this notification
$response = $this->callStepAndCheckForException(
'getRefundDetails', array($amazonRefundId)
);
validateThatRefundIsCompleted($response->getGetRefundDetailsResult()->getRefundDetails());
echo $this->printResponseToWebpage(
"printGetRefundDetailsResponse",
array($response)
);
} | [
"private",
"function",
"_waitUntilRefundProcessingIsCompleted",
"(",
"$",
"amazonRefundId",
")",
"{",
"// Check for the presence of the ipn notification",
"$",
"this",
"->",
"waitForNotificationToBeProcessedBeforeContinuing",
"(",
"$",
"amazonRefundId",
",",
"\"RefundNotification\"",
")",
";",
"// Notification is present, go and get the full",
"// information for this notification",
"$",
"response",
"=",
"$",
"this",
"->",
"callStepAndCheckForException",
"(",
"'getRefundDetails'",
",",
"array",
"(",
"$",
"amazonRefundId",
")",
")",
";",
"validateThatRefundIsCompleted",
"(",
"$",
"response",
"->",
"getGetRefundDetailsResult",
"(",
")",
"->",
"getRefundDetails",
"(",
")",
")",
";",
"echo",
"$",
"this",
"->",
"printResponseToWebpage",
"(",
"\"printGetRefundDetailsResponse\"",
",",
"array",
"(",
"$",
"response",
")",
")",
";",
"}"
] | Check that we have received an IPN notification for the refund
For PHP, there is an IPN handler that will write the contents of the IPN to
a file in the format of
<amazonReferenceId>_RefundNotification.txt
This method will check for the presence of this file
and will loop/timeout until the notification has been handled.
Merchants can use alternative approaches such as memory caches,
shared memory or database storage so that scripts serving user
pages are able to check on the status of a notification
@param string $amazonRefundId refund transaction to query
@return void | [
"Check",
"that",
"we",
"have",
"received",
"an",
"IPN",
"notification",
"for",
"the",
"refund"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Samples/RefundResult.php#L138-L156 |
31,909 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Samples/AutomaticPaymentsSimpleCheckoutResult.php | AutomaticPaymentsSimpleCheckoutResult._getAdditionalInformationForProcessedAuthorization | private function _getAdditionalInformationForProcessedAuthorization ($amazonAuthorizationId)
{
// Notification is present, go and get the full
// information for this notification
$response = $this->callStepAndCheckForException('getAuthorizationDetails',
array(
$amazonAuthorizationId
));
$this->printResponseToWebpage("printGetAuthorizationDetailsResponse", array(
$response
));
validateThatAuthorizationIsOpen($response);
} | php | private function _getAdditionalInformationForProcessedAuthorization ($amazonAuthorizationId)
{
// Notification is present, go and get the full
// information for this notification
$response = $this->callStepAndCheckForException('getAuthorizationDetails',
array(
$amazonAuthorizationId
));
$this->printResponseToWebpage("printGetAuthorizationDetailsResponse", array(
$response
));
validateThatAuthorizationIsOpen($response);
} | [
"private",
"function",
"_getAdditionalInformationForProcessedAuthorization",
"(",
"$",
"amazonAuthorizationId",
")",
"{",
"// Notification is present, go and get the full",
"// information for this notification",
"$",
"response",
"=",
"$",
"this",
"->",
"callStepAndCheckForException",
"(",
"'getAuthorizationDetails'",
",",
"array",
"(",
"$",
"amazonAuthorizationId",
")",
")",
";",
"$",
"this",
"->",
"printResponseToWebpage",
"(",
"\"printGetAuthorizationDetailsResponse\"",
",",
"array",
"(",
"$",
"response",
")",
")",
";",
"validateThatAuthorizationIsOpen",
"(",
"$",
"response",
")",
";",
"}"
] | Display additional information about a completed authorization
Once an IPN has been received to notify the transition of an IPN to
one of the terminal states, the merchant may optionally call
GetAuthorizationDetails to obtain additional information about the authorization.
In countries which require VAT invoicing, this approach will allow you to obtain
the buyers billing address so that the invocing requirements can be met. | [
"Display",
"additional",
"information",
"about",
"a",
"completed",
"authorization"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Samples/AutomaticPaymentsSimpleCheckoutResult.php#L230-L244 |
31,910 | chameleon-system/chameleon-shop | src/ShopPaymentIPNBundle/pkgShop/objects/db/TPkgShopPaymentIPN_TShopOrder.class.php | TPkgShopPaymentIPN_TShopOrder.hasIPNStatusCode | final public function hasIPNStatusCode($sStatusCode)
{
$oStatusCode = TdbPkgShopPaymentIpnMessage::getMessageForOrder($this, $sStatusCode);
$bHasStatusCode = (null !== $oStatusCode);
return $bHasStatusCode;
} | php | final public function hasIPNStatusCode($sStatusCode)
{
$oStatusCode = TdbPkgShopPaymentIpnMessage::getMessageForOrder($this, $sStatusCode);
$bHasStatusCode = (null !== $oStatusCode);
return $bHasStatusCode;
} | [
"final",
"public",
"function",
"hasIPNStatusCode",
"(",
"$",
"sStatusCode",
")",
"{",
"$",
"oStatusCode",
"=",
"TdbPkgShopPaymentIpnMessage",
"::",
"getMessageForOrder",
"(",
"$",
"this",
",",
"$",
"sStatusCode",
")",
";",
"$",
"bHasStatusCode",
"=",
"(",
"null",
"!==",
"$",
"oStatusCode",
")",
";",
"return",
"$",
"bHasStatusCode",
";",
"}"
] | returns true if the status code has been sent as an IPN for the order.
@param $sStatusCode
@return bool | [
"returns",
"true",
"if",
"the",
"status",
"code",
"has",
"been",
"sent",
"as",
"an",
"IPN",
"for",
"the",
"order",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopPaymentIPNBundle/pkgShop/objects/db/TPkgShopPaymentIPN_TShopOrder.class.php#L21-L27 |
31,911 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerPayOne.class.php | TShopPaymentHandlerPayOne.PayOne3dSecure_3dScheck | protected function PayOne3dSecure_3dScheck()
{
$aResponse = array();
$aResponse['success'] = false;
$oGlobal = TGlobal::instance();
$oBasket = TShopBasket::GetInstance();
// load data from POST
$aUserPaymentData = $this->GetUserPaymentData();
// Save to session
$_SESSION['PayOneResponse']['pseudocardpan'] = $aUserPaymentData['pseudocardpan'];
$_SESSION['PayOneResponse']['truncatedcardpan'] = $aUserPaymentData['truncatedcardpan'];
// create success URL
$aSuccessCall = array('module_fnc' => array($oGlobal->GetExecutingModulePointer()->sModuleSpotName => 'PostProcessExternalPaymentHandlerHook'));
$aExcludes = array_keys($aSuccessCall);
$aExcludes[] = 'aShipping';
$aExcludes[] = 'orderstepmethod';
$aExcludes[] = 'aPayment';
$aExcludes[] = 'module_fnc';
$sSuccessURL = urldecode(str_replace('&', '&', $this->getActivePageService()->getLinkToActivePageAbsolute($aSuccessCall, $aExcludes)));
$sSuccessURL .= '&payrequest=3dsredirect';
// Init 3D-Secure params
$frequest = new financegateRequest();
$fconnect = new financegateConnect();
$frequest->setRequest('3dscheck');
$frequest->setClearingType('cc');
$frequest->setPortalId($this->GetConfigParameter('portalid'));
$frequest->setKey($this->GetConfigParameter('key'));
$frequest->setMId($this->GetConfigParameter('mid'));
$frequest->setAId($this->GetConfigParameter('aid'));
$frequest->setMode($this->GetConfigParameter('mode'));
$request = $this->getCurrentRequest();
$frequest->setIp(null === $request ? '' : $request->getClientIp());
$frequest->setExitUrl($sSuccessURL);
$frequest->setAmount($oBasket->dCostTotal * 100);
$frequest->setCurrency($this->GetCurrency());
$frequest->setLanguage($this->GetCurrentLanguageCode());
$frequest->setPseudocardpan($aUserPaymentData['pseudocardpan']);
$fconnect->setApiUrl($this->GetConfigParameter('serverApiUrlPayOne'));
$fresponse = $fconnect->processByRequest($frequest);
//if(_ES_DEBUG) var_dump($fresponse);
$sStatus = $fresponse->getStatus();
$aResponse['success'] = true;
$aResponse['status'] = $sStatus;
if ('ENROLLED' == $sStatus) {
$this->ExecuteExternalPayOneCall($fresponse); // REDIRECT TO EXTERNAL SECURE-PIN-URL!
} else {
if ('VALID' == $sStatus) {
// do nothing
} else {
$aResponse['success'] = false;
$aResponse['status'] = $sStatus;
$aResponse['errormessage'] = $fresponse->getErrorMessage();
$aResponse['errortext'] = $fresponse->getCustomerMessage();
//if(_ES_DEBUG) print_form($_REQUEST,$info);
}
}
return $aResponse;
} | php | protected function PayOne3dSecure_3dScheck()
{
$aResponse = array();
$aResponse['success'] = false;
$oGlobal = TGlobal::instance();
$oBasket = TShopBasket::GetInstance();
// load data from POST
$aUserPaymentData = $this->GetUserPaymentData();
// Save to session
$_SESSION['PayOneResponse']['pseudocardpan'] = $aUserPaymentData['pseudocardpan'];
$_SESSION['PayOneResponse']['truncatedcardpan'] = $aUserPaymentData['truncatedcardpan'];
// create success URL
$aSuccessCall = array('module_fnc' => array($oGlobal->GetExecutingModulePointer()->sModuleSpotName => 'PostProcessExternalPaymentHandlerHook'));
$aExcludes = array_keys($aSuccessCall);
$aExcludes[] = 'aShipping';
$aExcludes[] = 'orderstepmethod';
$aExcludes[] = 'aPayment';
$aExcludes[] = 'module_fnc';
$sSuccessURL = urldecode(str_replace('&', '&', $this->getActivePageService()->getLinkToActivePageAbsolute($aSuccessCall, $aExcludes)));
$sSuccessURL .= '&payrequest=3dsredirect';
// Init 3D-Secure params
$frequest = new financegateRequest();
$fconnect = new financegateConnect();
$frequest->setRequest('3dscheck');
$frequest->setClearingType('cc');
$frequest->setPortalId($this->GetConfigParameter('portalid'));
$frequest->setKey($this->GetConfigParameter('key'));
$frequest->setMId($this->GetConfigParameter('mid'));
$frequest->setAId($this->GetConfigParameter('aid'));
$frequest->setMode($this->GetConfigParameter('mode'));
$request = $this->getCurrentRequest();
$frequest->setIp(null === $request ? '' : $request->getClientIp());
$frequest->setExitUrl($sSuccessURL);
$frequest->setAmount($oBasket->dCostTotal * 100);
$frequest->setCurrency($this->GetCurrency());
$frequest->setLanguage($this->GetCurrentLanguageCode());
$frequest->setPseudocardpan($aUserPaymentData['pseudocardpan']);
$fconnect->setApiUrl($this->GetConfigParameter('serverApiUrlPayOne'));
$fresponse = $fconnect->processByRequest($frequest);
//if(_ES_DEBUG) var_dump($fresponse);
$sStatus = $fresponse->getStatus();
$aResponse['success'] = true;
$aResponse['status'] = $sStatus;
if ('ENROLLED' == $sStatus) {
$this->ExecuteExternalPayOneCall($fresponse); // REDIRECT TO EXTERNAL SECURE-PIN-URL!
} else {
if ('VALID' == $sStatus) {
// do nothing
} else {
$aResponse['success'] = false;
$aResponse['status'] = $sStatus;
$aResponse['errormessage'] = $fresponse->getErrorMessage();
$aResponse['errortext'] = $fresponse->getCustomerMessage();
//if(_ES_DEBUG) print_form($_REQUEST,$info);
}
}
return $aResponse;
} | [
"protected",
"function",
"PayOne3dSecure_3dScheck",
"(",
")",
"{",
"$",
"aResponse",
"=",
"array",
"(",
")",
";",
"$",
"aResponse",
"[",
"'success'",
"]",
"=",
"false",
";",
"$",
"oGlobal",
"=",
"TGlobal",
"::",
"instance",
"(",
")",
";",
"$",
"oBasket",
"=",
"TShopBasket",
"::",
"GetInstance",
"(",
")",
";",
"// load data from POST",
"$",
"aUserPaymentData",
"=",
"$",
"this",
"->",
"GetUserPaymentData",
"(",
")",
";",
"// Save to session",
"$",
"_SESSION",
"[",
"'PayOneResponse'",
"]",
"[",
"'pseudocardpan'",
"]",
"=",
"$",
"aUserPaymentData",
"[",
"'pseudocardpan'",
"]",
";",
"$",
"_SESSION",
"[",
"'PayOneResponse'",
"]",
"[",
"'truncatedcardpan'",
"]",
"=",
"$",
"aUserPaymentData",
"[",
"'truncatedcardpan'",
"]",
";",
"// create success URL",
"$",
"aSuccessCall",
"=",
"array",
"(",
"'module_fnc'",
"=>",
"array",
"(",
"$",
"oGlobal",
"->",
"GetExecutingModulePointer",
"(",
")",
"->",
"sModuleSpotName",
"=>",
"'PostProcessExternalPaymentHandlerHook'",
")",
")",
";",
"$",
"aExcludes",
"=",
"array_keys",
"(",
"$",
"aSuccessCall",
")",
";",
"$",
"aExcludes",
"[",
"]",
"=",
"'aShipping'",
";",
"$",
"aExcludes",
"[",
"]",
"=",
"'orderstepmethod'",
";",
"$",
"aExcludes",
"[",
"]",
"=",
"'aPayment'",
";",
"$",
"aExcludes",
"[",
"]",
"=",
"'module_fnc'",
";",
"$",
"sSuccessURL",
"=",
"urldecode",
"(",
"str_replace",
"(",
"'&'",
",",
"'&'",
",",
"$",
"this",
"->",
"getActivePageService",
"(",
")",
"->",
"getLinkToActivePageAbsolute",
"(",
"$",
"aSuccessCall",
",",
"$",
"aExcludes",
")",
")",
")",
";",
"$",
"sSuccessURL",
".=",
"'&payrequest=3dsredirect'",
";",
"// Init 3D-Secure params",
"$",
"frequest",
"=",
"new",
"financegateRequest",
"(",
")",
";",
"$",
"fconnect",
"=",
"new",
"financegateConnect",
"(",
")",
";",
"$",
"frequest",
"->",
"setRequest",
"(",
"'3dscheck'",
")",
";",
"$",
"frequest",
"->",
"setClearingType",
"(",
"'cc'",
")",
";",
"$",
"frequest",
"->",
"setPortalId",
"(",
"$",
"this",
"->",
"GetConfigParameter",
"(",
"'portalid'",
")",
")",
";",
"$",
"frequest",
"->",
"setKey",
"(",
"$",
"this",
"->",
"GetConfigParameter",
"(",
"'key'",
")",
")",
";",
"$",
"frequest",
"->",
"setMId",
"(",
"$",
"this",
"->",
"GetConfigParameter",
"(",
"'mid'",
")",
")",
";",
"$",
"frequest",
"->",
"setAId",
"(",
"$",
"this",
"->",
"GetConfigParameter",
"(",
"'aid'",
")",
")",
";",
"$",
"frequest",
"->",
"setMode",
"(",
"$",
"this",
"->",
"GetConfigParameter",
"(",
"'mode'",
")",
")",
";",
"$",
"request",
"=",
"$",
"this",
"->",
"getCurrentRequest",
"(",
")",
";",
"$",
"frequest",
"->",
"setIp",
"(",
"null",
"===",
"$",
"request",
"?",
"''",
":",
"$",
"request",
"->",
"getClientIp",
"(",
")",
")",
";",
"$",
"frequest",
"->",
"setExitUrl",
"(",
"$",
"sSuccessURL",
")",
";",
"$",
"frequest",
"->",
"setAmount",
"(",
"$",
"oBasket",
"->",
"dCostTotal",
"*",
"100",
")",
";",
"$",
"frequest",
"->",
"setCurrency",
"(",
"$",
"this",
"->",
"GetCurrency",
"(",
")",
")",
";",
"$",
"frequest",
"->",
"setLanguage",
"(",
"$",
"this",
"->",
"GetCurrentLanguageCode",
"(",
")",
")",
";",
"$",
"frequest",
"->",
"setPseudocardpan",
"(",
"$",
"aUserPaymentData",
"[",
"'pseudocardpan'",
"]",
")",
";",
"$",
"fconnect",
"->",
"setApiUrl",
"(",
"$",
"this",
"->",
"GetConfigParameter",
"(",
"'serverApiUrlPayOne'",
")",
")",
";",
"$",
"fresponse",
"=",
"$",
"fconnect",
"->",
"processByRequest",
"(",
"$",
"frequest",
")",
";",
"//if(_ES_DEBUG) var_dump($fresponse);",
"$",
"sStatus",
"=",
"$",
"fresponse",
"->",
"getStatus",
"(",
")",
";",
"$",
"aResponse",
"[",
"'success'",
"]",
"=",
"true",
";",
"$",
"aResponse",
"[",
"'status'",
"]",
"=",
"$",
"sStatus",
";",
"if",
"(",
"'ENROLLED'",
"==",
"$",
"sStatus",
")",
"{",
"$",
"this",
"->",
"ExecuteExternalPayOneCall",
"(",
"$",
"fresponse",
")",
";",
"// REDIRECT TO EXTERNAL SECURE-PIN-URL!",
"}",
"else",
"{",
"if",
"(",
"'VALID'",
"==",
"$",
"sStatus",
")",
"{",
"// do nothing",
"}",
"else",
"{",
"$",
"aResponse",
"[",
"'success'",
"]",
"=",
"false",
";",
"$",
"aResponse",
"[",
"'status'",
"]",
"=",
"$",
"sStatus",
";",
"$",
"aResponse",
"[",
"'errormessage'",
"]",
"=",
"$",
"fresponse",
"->",
"getErrorMessage",
"(",
")",
";",
"$",
"aResponse",
"[",
"'errortext'",
"]",
"=",
"$",
"fresponse",
"->",
"getCustomerMessage",
"(",
")",
";",
"//if(_ES_DEBUG) print_form($_REQUEST,$info);",
"}",
"}",
"return",
"$",
"aResponse",
";",
"}"
] | 3D-Secure - 3dScheck.
@return $response array | [
"3D",
"-",
"Secure",
"-",
"3dScheck",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerPayOne.class.php#L554-L626 |
31,912 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerPayOne.class.php | TShopPaymentHandlerPayOne.ExecuteExternalPayOneCall | protected function ExecuteExternalPayOneCall($fresponse)
{
$oShop = TShop::GetInstance();
$sRedirectURL = $oShop->GetLinkToSystemPage('PayOne3DSecureHelper');
// save 3D Secure Parameter in session to load it in the helper redirect page
$_SESSION['PayOneRedirectParams']['AcsUrl'] = $fresponse->getAcsUrl();
$_SESSION['PayOneRedirectParams']['PaReq'] = $fresponse->getPaReq();
$_SESSION['PayOneRedirectParams']['TermUrl'] = $fresponse->getTermUrl();
$_SESSION['PayOneRedirectParams']['MD'] = $fresponse->getMd();
$this->getRedirect()->redirect($sRedirectURL);
} | php | protected function ExecuteExternalPayOneCall($fresponse)
{
$oShop = TShop::GetInstance();
$sRedirectURL = $oShop->GetLinkToSystemPage('PayOne3DSecureHelper');
// save 3D Secure Parameter in session to load it in the helper redirect page
$_SESSION['PayOneRedirectParams']['AcsUrl'] = $fresponse->getAcsUrl();
$_SESSION['PayOneRedirectParams']['PaReq'] = $fresponse->getPaReq();
$_SESSION['PayOneRedirectParams']['TermUrl'] = $fresponse->getTermUrl();
$_SESSION['PayOneRedirectParams']['MD'] = $fresponse->getMd();
$this->getRedirect()->redirect($sRedirectURL);
} | [
"protected",
"function",
"ExecuteExternalPayOneCall",
"(",
"$",
"fresponse",
")",
"{",
"$",
"oShop",
"=",
"TShop",
"::",
"GetInstance",
"(",
")",
";",
"$",
"sRedirectURL",
"=",
"$",
"oShop",
"->",
"GetLinkToSystemPage",
"(",
"'PayOne3DSecureHelper'",
")",
";",
"// save 3D Secure Parameter in session to load it in the helper redirect page",
"$",
"_SESSION",
"[",
"'PayOneRedirectParams'",
"]",
"[",
"'AcsUrl'",
"]",
"=",
"$",
"fresponse",
"->",
"getAcsUrl",
"(",
")",
";",
"$",
"_SESSION",
"[",
"'PayOneRedirectParams'",
"]",
"[",
"'PaReq'",
"]",
"=",
"$",
"fresponse",
"->",
"getPaReq",
"(",
")",
";",
"$",
"_SESSION",
"[",
"'PayOneRedirectParams'",
"]",
"[",
"'TermUrl'",
"]",
"=",
"$",
"fresponse",
"->",
"getTermUrl",
"(",
")",
";",
"$",
"_SESSION",
"[",
"'PayOneRedirectParams'",
"]",
"[",
"'MD'",
"]",
"=",
"$",
"fresponse",
"->",
"getMd",
"(",
")",
";",
"$",
"this",
"->",
"getRedirect",
"(",
")",
"->",
"redirect",
"(",
"$",
"sRedirectURL",
")",
";",
"}"
] | perform the API redirect to PayOne using Server-API.
@return array $fresponse - params to handle request/redirect | [
"perform",
"the",
"API",
"redirect",
"to",
"PayOne",
"using",
"Server",
"-",
"API",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerPayOne.class.php#L743-L755 |
31,913 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopStockMessage.class.php | TShopStockMessage.RenderShippingMessageFromTriggerForQuantity | protected function RenderShippingMessageFromTriggerForQuantity($aMessage = array())
{
$sTriggerMessage = $aMessage['oTrigger']->fieldMessage;
$sString = '<span class="'.$this->getCssClassForMessageForQuantity($aMessage).'">'.
TGlobal::Translate(
'chameleon_system_shop.stock_message.different_shipping_time_applies',
array(
'%amount%' => $aMessage['amount'],
'%shippingMessage%' => $sTriggerMessage,
)
).'</span>';
return $sString;
} | php | protected function RenderShippingMessageFromTriggerForQuantity($aMessage = array())
{
$sTriggerMessage = $aMessage['oTrigger']->fieldMessage;
$sString = '<span class="'.$this->getCssClassForMessageForQuantity($aMessage).'">'.
TGlobal::Translate(
'chameleon_system_shop.stock_message.different_shipping_time_applies',
array(
'%amount%' => $aMessage['amount'],
'%shippingMessage%' => $sTriggerMessage,
)
).'</span>';
return $sString;
} | [
"protected",
"function",
"RenderShippingMessageFromTriggerForQuantity",
"(",
"$",
"aMessage",
"=",
"array",
"(",
")",
")",
"{",
"$",
"sTriggerMessage",
"=",
"$",
"aMessage",
"[",
"'oTrigger'",
"]",
"->",
"fieldMessage",
";",
"$",
"sString",
"=",
"'<span class=\"'",
".",
"$",
"this",
"->",
"getCssClassForMessageForQuantity",
"(",
"$",
"aMessage",
")",
".",
"'\">'",
".",
"TGlobal",
"::",
"Translate",
"(",
"'chameleon_system_shop.stock_message.different_shipping_time_applies'",
",",
"array",
"(",
"'%amount%'",
"=>",
"$",
"aMessage",
"[",
"'amount'",
"]",
",",
"'%shippingMessage%'",
"=>",
"$",
"sTriggerMessage",
",",
")",
")",
".",
"'</span>'",
";",
"return",
"$",
"sString",
";",
"}"
] | renders the trigger message.
@param array $aMessage
@return string | [
"renders",
"the",
"trigger",
"message",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopStockMessage.class.php#L106-L119 |
31,914 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopStockMessage.class.php | TShopStockMessage.& | public function &GetFieldShopStockMessageTrigger()
{
$oShopStockMessageTrigger = $this->GetFromInternalCache('oActive_shop_stock_message_trigger_id');
if (is_null($oShopStockMessageTrigger)) {
$sQuery = "SELECT *
FROM `shop_stock_message_trigger`
WHERE `shop_stock_message_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."'
AND `amount` >= '".MySqlLegacySupport::getInstance()->real_escape_string($this->GetArticle()->getAvailableStock())."'
ORDER BY `amount` ASC
LIMIT 1
";
$oShopStockMessageTrigger = TdbShopStockMessageTrigger::GetNewInstance();
/** @var $oShopStockMessageTrigger TdbShopStockMessageTrigger */
$oTmp = MySqlLegacySupport::getInstance()->fetch_object(MySqlLegacySupport::getInstance()->query($sQuery));
//if (!$oShopStockMessageTrigger->LoadFromRow(MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($sQuery)))) $oShopStockMessageTrigger = null;
if (is_object($oTmp)) {
if (!$oShopStockMessageTrigger->LoadFromField('id', $oTmp->id)) {
$oShopStockMessageTrigger = null;
}
} else {
$oShopStockMessageTrigger = null;
}
$this->SetInternalCache('oActive_shop_stock_message_trigger_id', $oShopStockMessageTrigger);
}
return $oShopStockMessageTrigger;
} | php | public function &GetFieldShopStockMessageTrigger()
{
$oShopStockMessageTrigger = $this->GetFromInternalCache('oActive_shop_stock_message_trigger_id');
if (is_null($oShopStockMessageTrigger)) {
$sQuery = "SELECT *
FROM `shop_stock_message_trigger`
WHERE `shop_stock_message_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."'
AND `amount` >= '".MySqlLegacySupport::getInstance()->real_escape_string($this->GetArticle()->getAvailableStock())."'
ORDER BY `amount` ASC
LIMIT 1
";
$oShopStockMessageTrigger = TdbShopStockMessageTrigger::GetNewInstance();
/** @var $oShopStockMessageTrigger TdbShopStockMessageTrigger */
$oTmp = MySqlLegacySupport::getInstance()->fetch_object(MySqlLegacySupport::getInstance()->query($sQuery));
//if (!$oShopStockMessageTrigger->LoadFromRow(MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($sQuery)))) $oShopStockMessageTrigger = null;
if (is_object($oTmp)) {
if (!$oShopStockMessageTrigger->LoadFromField('id', $oTmp->id)) {
$oShopStockMessageTrigger = null;
}
} else {
$oShopStockMessageTrigger = null;
}
$this->SetInternalCache('oActive_shop_stock_message_trigger_id', $oShopStockMessageTrigger);
}
return $oShopStockMessageTrigger;
} | [
"public",
"function",
"&",
"GetFieldShopStockMessageTrigger",
"(",
")",
"{",
"$",
"oShopStockMessageTrigger",
"=",
"$",
"this",
"->",
"GetFromInternalCache",
"(",
"'oActive_shop_stock_message_trigger_id'",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"oShopStockMessageTrigger",
")",
")",
"{",
"$",
"sQuery",
"=",
"\"SELECT *\n FROM `shop_stock_message_trigger`\n WHERE `shop_stock_message_id` = '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"this",
"->",
"id",
")",
".",
"\"'\n AND `amount` >= '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"this",
"->",
"GetArticle",
"(",
")",
"->",
"getAvailableStock",
"(",
")",
")",
".",
"\"'\n ORDER BY `amount` ASC\n LIMIT 1\n \"",
";",
"$",
"oShopStockMessageTrigger",
"=",
"TdbShopStockMessageTrigger",
"::",
"GetNewInstance",
"(",
")",
";",
"/** @var $oShopStockMessageTrigger TdbShopStockMessageTrigger */",
"$",
"oTmp",
"=",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"fetch_object",
"(",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"query",
"(",
"$",
"sQuery",
")",
")",
";",
"//if (!$oShopStockMessageTrigger->LoadFromRow(MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($sQuery)))) $oShopStockMessageTrigger = null;",
"if",
"(",
"is_object",
"(",
"$",
"oTmp",
")",
")",
"{",
"if",
"(",
"!",
"$",
"oShopStockMessageTrigger",
"->",
"LoadFromField",
"(",
"'id'",
",",
"$",
"oTmp",
"->",
"id",
")",
")",
"{",
"$",
"oShopStockMessageTrigger",
"=",
"null",
";",
"}",
"}",
"else",
"{",
"$",
"oShopStockMessageTrigger",
"=",
"null",
";",
"}",
"$",
"this",
"->",
"SetInternalCache",
"(",
"'oActive_shop_stock_message_trigger_id'",
",",
"$",
"oShopStockMessageTrigger",
")",
";",
"}",
"return",
"$",
"oShopStockMessageTrigger",
";",
"}"
] | The method checks the ShopStockMessageTrigger for the current ShopStockMessage
if there is a Match it will return this matching one in the other case
it will return a null object.
@return TdbShopStockMessageTrigger | [
"The",
"method",
"checks",
"the",
"ShopStockMessageTrigger",
"for",
"the",
"current",
"ShopStockMessage",
"if",
"there",
"is",
"a",
"Match",
"it",
"will",
"return",
"this",
"matching",
"one",
"in",
"the",
"other",
"case",
"it",
"will",
"return",
"a",
"null",
"object",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopStockMessage.class.php#L180-L206 |
31,915 | chameleon-system/chameleon-shop | src/ShopWishlistBundle/objects/db/TShopWishlistArticle.class.php | TShopWishlistArticle.GetToWishlistLink | public function GetToWishlistLink($bIncludePortalLink = false, $bRedirectToLoginPage = true)
{
$oShopConfig = TdbShop::GetInstance();
$aParameters = array('module_fnc['.$oShopConfig->GetBasketModuleSpotName().']' => 'AddToWishlist', MTShopBasketCore::URL_ITEM_ID => $this->id, MTShopBasketCore::URL_ITEM_AMOUNT => 1, MTShopBasketCore::URL_MESSAGE_CONSUMER => $this->GetMessageConsumerName());
$aIncludeParams = TdbShop::GetURLPageStateParameters();
$oGlobal = TGlobal::instance();
foreach ($aIncludeParams as $sKeyName) {
if ($oGlobal->UserDataExists($sKeyName) && !array_key_exists($sKeyName, $aParameters)) {
$aParameters[$sKeyName] = $oGlobal->GetUserData($sKeyName);
}
}
$oActivePage = $this->getActivePageService()->getActivePage();
$sLink = $oActivePage->GetRealURLPlain($aParameters, $bIncludePortalLink);
$oUser = TdbDataExtranetUser::GetInstance();
if ($bRedirectToLoginPage && !$oUser->IsLoggedIn()) {
$sSuccessLink = $sLink;
$oExtranet = TdbDataExtranet::GetInstance();
$sLoginPageURL = $oExtranet->GetLinkLoginPage(true);
$sLink = $sLoginPageURL.'?sSuccessURL='.urlencode($sSuccessLink);
}
return $sLink;
} | php | public function GetToWishlistLink($bIncludePortalLink = false, $bRedirectToLoginPage = true)
{
$oShopConfig = TdbShop::GetInstance();
$aParameters = array('module_fnc['.$oShopConfig->GetBasketModuleSpotName().']' => 'AddToWishlist', MTShopBasketCore::URL_ITEM_ID => $this->id, MTShopBasketCore::URL_ITEM_AMOUNT => 1, MTShopBasketCore::URL_MESSAGE_CONSUMER => $this->GetMessageConsumerName());
$aIncludeParams = TdbShop::GetURLPageStateParameters();
$oGlobal = TGlobal::instance();
foreach ($aIncludeParams as $sKeyName) {
if ($oGlobal->UserDataExists($sKeyName) && !array_key_exists($sKeyName, $aParameters)) {
$aParameters[$sKeyName] = $oGlobal->GetUserData($sKeyName);
}
}
$oActivePage = $this->getActivePageService()->getActivePage();
$sLink = $oActivePage->GetRealURLPlain($aParameters, $bIncludePortalLink);
$oUser = TdbDataExtranetUser::GetInstance();
if ($bRedirectToLoginPage && !$oUser->IsLoggedIn()) {
$sSuccessLink = $sLink;
$oExtranet = TdbDataExtranet::GetInstance();
$sLoginPageURL = $oExtranet->GetLinkLoginPage(true);
$sLink = $sLoginPageURL.'?sSuccessURL='.urlencode($sSuccessLink);
}
return $sLink;
} | [
"public",
"function",
"GetToWishlistLink",
"(",
"$",
"bIncludePortalLink",
"=",
"false",
",",
"$",
"bRedirectToLoginPage",
"=",
"true",
")",
"{",
"$",
"oShopConfig",
"=",
"TdbShop",
"::",
"GetInstance",
"(",
")",
";",
"$",
"aParameters",
"=",
"array",
"(",
"'module_fnc['",
".",
"$",
"oShopConfig",
"->",
"GetBasketModuleSpotName",
"(",
")",
".",
"']'",
"=>",
"'AddToWishlist'",
",",
"MTShopBasketCore",
"::",
"URL_ITEM_ID",
"=>",
"$",
"this",
"->",
"id",
",",
"MTShopBasketCore",
"::",
"URL_ITEM_AMOUNT",
"=>",
"1",
",",
"MTShopBasketCore",
"::",
"URL_MESSAGE_CONSUMER",
"=>",
"$",
"this",
"->",
"GetMessageConsumerName",
"(",
")",
")",
";",
"$",
"aIncludeParams",
"=",
"TdbShop",
"::",
"GetURLPageStateParameters",
"(",
")",
";",
"$",
"oGlobal",
"=",
"TGlobal",
"::",
"instance",
"(",
")",
";",
"foreach",
"(",
"$",
"aIncludeParams",
"as",
"$",
"sKeyName",
")",
"{",
"if",
"(",
"$",
"oGlobal",
"->",
"UserDataExists",
"(",
"$",
"sKeyName",
")",
"&&",
"!",
"array_key_exists",
"(",
"$",
"sKeyName",
",",
"$",
"aParameters",
")",
")",
"{",
"$",
"aParameters",
"[",
"$",
"sKeyName",
"]",
"=",
"$",
"oGlobal",
"->",
"GetUserData",
"(",
"$",
"sKeyName",
")",
";",
"}",
"}",
"$",
"oActivePage",
"=",
"$",
"this",
"->",
"getActivePageService",
"(",
")",
"->",
"getActivePage",
"(",
")",
";",
"$",
"sLink",
"=",
"$",
"oActivePage",
"->",
"GetRealURLPlain",
"(",
"$",
"aParameters",
",",
"$",
"bIncludePortalLink",
")",
";",
"$",
"oUser",
"=",
"TdbDataExtranetUser",
"::",
"GetInstance",
"(",
")",
";",
"if",
"(",
"$",
"bRedirectToLoginPage",
"&&",
"!",
"$",
"oUser",
"->",
"IsLoggedIn",
"(",
")",
")",
"{",
"$",
"sSuccessLink",
"=",
"$",
"sLink",
";",
"$",
"oExtranet",
"=",
"TdbDataExtranet",
"::",
"GetInstance",
"(",
")",
";",
"$",
"sLoginPageURL",
"=",
"$",
"oExtranet",
"->",
"GetLinkLoginPage",
"(",
"true",
")",
";",
"$",
"sLink",
"=",
"$",
"sLoginPageURL",
".",
"'?sSuccessURL='",
".",
"urlencode",
"(",
"$",
"sSuccessLink",
")",
";",
"}",
"return",
"$",
"sLink",
";",
"}"
] | return the link that can be used to add the article to the users wishlist.
@param bool $bIncludePortalLink
@return string | [
"return",
"the",
"link",
"that",
"can",
"be",
"used",
"to",
"add",
"the",
"article",
"to",
"the",
"users",
"wishlist",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopWishlistBundle/objects/db/TShopWishlistArticle.class.php#L23-L48 |
31,916 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/AmazonDataConverter.php | AmazonDataConverter.convertAddressLineData | protected function convertAddressLineData($localAddressData, array $address)
{
if ('AT' == $address['CountryCode'] || 'DE' == $address['CountryCode']) {
$addressLine1 = $address['AddressLine1'];
$addressLine2 = $address['AddressLine2'];
$addressLine3 = $address['AddressLine3'];
$postBox = '';
$company = '';
$street = '';
if ('' != $addressLine3) {
$street = $addressLine3;
if (true === is_numeric($addressLine1) ||
true === strstr($addressLine1.' '.$addressLine2, 'Packstation')
) {
$postBox = $addressLine1.' '.$addressLine2;
} else {
$company = $addressLine1.' '.$addressLine2;
}
} else {
if ('' != $addressLine2) {
$street = $addressLine2;
if (true === is_numeric($addressLine1) || true === strstr($addressLine1, 'Packstation')) {
$postBox = $addressLine1;
} else {
$company = $addressLine1;
}
} else {
if ('' != $addressLine1) {
$street = $addressLine1;
}
}
}
$localAddressData['company'] = $company;
$localAddressData['address_additional_info'] = $postBox;
$localAddressData['street'] = $street;
}
return $localAddressData;
} | php | protected function convertAddressLineData($localAddressData, array $address)
{
if ('AT' == $address['CountryCode'] || 'DE' == $address['CountryCode']) {
$addressLine1 = $address['AddressLine1'];
$addressLine2 = $address['AddressLine2'];
$addressLine3 = $address['AddressLine3'];
$postBox = '';
$company = '';
$street = '';
if ('' != $addressLine3) {
$street = $addressLine3;
if (true === is_numeric($addressLine1) ||
true === strstr($addressLine1.' '.$addressLine2, 'Packstation')
) {
$postBox = $addressLine1.' '.$addressLine2;
} else {
$company = $addressLine1.' '.$addressLine2;
}
} else {
if ('' != $addressLine2) {
$street = $addressLine2;
if (true === is_numeric($addressLine1) || true === strstr($addressLine1, 'Packstation')) {
$postBox = $addressLine1;
} else {
$company = $addressLine1;
}
} else {
if ('' != $addressLine1) {
$street = $addressLine1;
}
}
}
$localAddressData['company'] = $company;
$localAddressData['address_additional_info'] = $postBox;
$localAddressData['street'] = $street;
}
return $localAddressData;
} | [
"protected",
"function",
"convertAddressLineData",
"(",
"$",
"localAddressData",
",",
"array",
"$",
"address",
")",
"{",
"if",
"(",
"'AT'",
"==",
"$",
"address",
"[",
"'CountryCode'",
"]",
"||",
"'DE'",
"==",
"$",
"address",
"[",
"'CountryCode'",
"]",
")",
"{",
"$",
"addressLine1",
"=",
"$",
"address",
"[",
"'AddressLine1'",
"]",
";",
"$",
"addressLine2",
"=",
"$",
"address",
"[",
"'AddressLine2'",
"]",
";",
"$",
"addressLine3",
"=",
"$",
"address",
"[",
"'AddressLine3'",
"]",
";",
"$",
"postBox",
"=",
"''",
";",
"$",
"company",
"=",
"''",
";",
"$",
"street",
"=",
"''",
";",
"if",
"(",
"''",
"!=",
"$",
"addressLine3",
")",
"{",
"$",
"street",
"=",
"$",
"addressLine3",
";",
"if",
"(",
"true",
"===",
"is_numeric",
"(",
"$",
"addressLine1",
")",
"||",
"true",
"===",
"strstr",
"(",
"$",
"addressLine1",
".",
"' '",
".",
"$",
"addressLine2",
",",
"'Packstation'",
")",
")",
"{",
"$",
"postBox",
"=",
"$",
"addressLine1",
".",
"' '",
".",
"$",
"addressLine2",
";",
"}",
"else",
"{",
"$",
"company",
"=",
"$",
"addressLine1",
".",
"' '",
".",
"$",
"addressLine2",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"''",
"!=",
"$",
"addressLine2",
")",
"{",
"$",
"street",
"=",
"$",
"addressLine2",
";",
"if",
"(",
"true",
"===",
"is_numeric",
"(",
"$",
"addressLine1",
")",
"||",
"true",
"===",
"strstr",
"(",
"$",
"addressLine1",
",",
"'Packstation'",
")",
")",
"{",
"$",
"postBox",
"=",
"$",
"addressLine1",
";",
"}",
"else",
"{",
"$",
"company",
"=",
"$",
"addressLine1",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"''",
"!=",
"$",
"addressLine1",
")",
"{",
"$",
"street",
"=",
"$",
"addressLine1",
";",
"}",
"}",
"}",
"$",
"localAddressData",
"[",
"'company'",
"]",
"=",
"$",
"company",
";",
"$",
"localAddressData",
"[",
"'address_additional_info'",
"]",
"=",
"$",
"postBox",
";",
"$",
"localAddressData",
"[",
"'street'",
"]",
"=",
"$",
"street",
";",
"}",
"return",
"$",
"localAddressData",
";",
"}"
] | code from amazon to convert address lines to company postbox and street
for countries AT nad DE only.
@param array $localAddressData
@param array $address
@return array | [
"code",
"from",
"amazon",
"to",
"convert",
"address",
"lines",
"to",
"company",
"postbox",
"and",
"street",
"for",
"countries",
"AT",
"nad",
"DE",
"only",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/AmazonDataConverter.php#L123-L161 |
31,917 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/AmazonDataConverter.php | AmazonDataConverter.isCountryForAddressTypeActive | private function isCountryForAddressTypeActive(TdbDataCountry $country, $targetAddressType)
{
if (self::ORDER_ADDRESS_TYPE_BILLING === $targetAddressType) {
return true;
}
return $country->isActive();
} | php | private function isCountryForAddressTypeActive(TdbDataCountry $country, $targetAddressType)
{
if (self::ORDER_ADDRESS_TYPE_BILLING === $targetAddressType) {
return true;
}
return $country->isActive();
} | [
"private",
"function",
"isCountryForAddressTypeActive",
"(",
"TdbDataCountry",
"$",
"country",
",",
"$",
"targetAddressType",
")",
"{",
"if",
"(",
"self",
"::",
"ORDER_ADDRESS_TYPE_BILLING",
"===",
"$",
"targetAddressType",
")",
"{",
"return",
"true",
";",
"}",
"return",
"$",
"country",
"->",
"isActive",
"(",
")",
";",
"}"
] | Check if country is active if address is not a billing address.
@param TdbDataCountry $country
@param int $targetAddressType
@return bool | [
"Check",
"if",
"country",
"is",
"active",
"if",
"address",
"is",
"not",
"a",
"billing",
"address",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/AmazonDataConverter.php#L217-L224 |
31,918 | avto-dev/dev-tools | src/Laravel/VarDumper/VarDumperMiddleware.php | VarDumperMiddleware.handle | public function handle(Request $request, Closure $next)
{
/** @var Response $response */
$response = $next($request);
if ($this->stack->count() > 0) {
$dumped = \implode(\PHP_EOL, $this->stack->all());
$this->stack->clear();
$response->setContent($dumped . $response->getContent());
}
return $response;
} | php | public function handle(Request $request, Closure $next)
{
/** @var Response $response */
$response = $next($request);
if ($this->stack->count() > 0) {
$dumped = \implode(\PHP_EOL, $this->stack->all());
$this->stack->clear();
$response->setContent($dumped . $response->getContent());
}
return $response;
} | [
"public",
"function",
"handle",
"(",
"Request",
"$",
"request",
",",
"Closure",
"$",
"next",
")",
"{",
"/** @var Response $response */",
"$",
"response",
"=",
"$",
"next",
"(",
"$",
"request",
")",
";",
"if",
"(",
"$",
"this",
"->",
"stack",
"->",
"count",
"(",
")",
">",
"0",
")",
"{",
"$",
"dumped",
"=",
"\\",
"implode",
"(",
"\\",
"PHP_EOL",
",",
"$",
"this",
"->",
"stack",
"->",
"all",
"(",
")",
")",
";",
"$",
"this",
"->",
"stack",
"->",
"clear",
"(",
")",
";",
"$",
"response",
"->",
"setContent",
"(",
"$",
"dumped",
".",
"$",
"response",
"->",
"getContent",
"(",
")",
")",
";",
"}",
"return",
"$",
"response",
";",
"}"
] | Modify response after the request is handled by the application.
@param Request $request
@param Closure $next
@return mixed | [
"Modify",
"response",
"after",
"the",
"request",
"is",
"handled",
"by",
"the",
"application",
"."
] | 0a9b13f0322878cbfa55f5f73cfb0dc521457373 | https://github.com/avto-dev/dev-tools/blob/0a9b13f0322878cbfa55f5f73cfb0dc521457373/src/Laravel/VarDumper/VarDumperMiddleware.php#L39-L53 |
31,919 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopOrderStep/TShopStepLoginEndPoint.class.php | TShopStepLoginEndPoint.AllowAccessToStep | protected function AllowAccessToStep($bRedirectToPreviousPermittedStep = false)
{
$bAllowAccess = parent::AllowAccessToStep($bRedirectToPreviousPermittedStep);
if ($bAllowAccess && $bRedirectToPreviousPermittedStep) {
$oUser = TdbDataExtranetUser::GetInstance();
if ($oUser->IsLoggedIn()) {
$this->JumpToStep($this->GetNextStep());
}
}
return $bAllowAccess;
} | php | protected function AllowAccessToStep($bRedirectToPreviousPermittedStep = false)
{
$bAllowAccess = parent::AllowAccessToStep($bRedirectToPreviousPermittedStep);
if ($bAllowAccess && $bRedirectToPreviousPermittedStep) {
$oUser = TdbDataExtranetUser::GetInstance();
if ($oUser->IsLoggedIn()) {
$this->JumpToStep($this->GetNextStep());
}
}
return $bAllowAccess;
} | [
"protected",
"function",
"AllowAccessToStep",
"(",
"$",
"bRedirectToPreviousPermittedStep",
"=",
"false",
")",
"{",
"$",
"bAllowAccess",
"=",
"parent",
"::",
"AllowAccessToStep",
"(",
"$",
"bRedirectToPreviousPermittedStep",
")",
";",
"if",
"(",
"$",
"bAllowAccess",
"&&",
"$",
"bRedirectToPreviousPermittedStep",
")",
"{",
"$",
"oUser",
"=",
"TdbDataExtranetUser",
"::",
"GetInstance",
"(",
")",
";",
"if",
"(",
"$",
"oUser",
"->",
"IsLoggedIn",
"(",
")",
")",
"{",
"$",
"this",
"->",
"JumpToStep",
"(",
"$",
"this",
"->",
"GetNextStep",
"(",
")",
")",
";",
"}",
"}",
"return",
"$",
"bAllowAccess",
";",
"}"
] | we allow access only if
a) the user is not yet registered.
@param bool $bRedirectToPreviousPermittedStep
@return bool | [
"we",
"allow",
"access",
"only",
"if",
"a",
")",
"the",
"user",
"is",
"not",
"yet",
"registered",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrderStep/TShopStepLoginEndPoint.class.php#L28-L39 |
31,920 | edmondscommerce/doctrine-static-meta | src/CodeGeneration/Command/CliConfigCommandFactory.php | CliConfigCommandFactory.getCommands | public function getCommands(): array
{
$commands = [
$this->container->get(GenerateRelationsCommand::class),
$this->container->get(GenerateEntityCommand::class),
$this->container->get(SetRelationCommand::class),
$this->container->get(GenerateFieldCommand::class),
$this->container->get(SetFieldCommand::class),
$this->container->get(SetEmbeddableCommand::class),
$this->container->get(GenerateEmbeddableFromArchetypeCommand::class),
$this->container->get(GenerateEmbeddableSkeletonCommand::class),
$this->container->get(RemoveUnusedRelationsCommand::class),
$this->container->get(OverrideCreateCommand::class),
$this->container->get(OverridesUpdateCommand::class),
$this->container->get(CreateConstraintCommand::class),
$this->container->get(FinaliseBuildCommand::class),
$this->container->get(CreateConstraintCommand::class),
];
$migrationsCommands = [
$this->container->get(ExecuteCommand::class),
$this->container->get(GenerateCommand::class),
$this->container->get(LatestCommand::class),
$this->container->get(MigrateCommand::class),
$this->container->get(DiffCommand::class),
$this->container->get(UpToDateCommand::class),
$this->container->get(StatusCommand::class),
$this->container->get(VersionCommand::class),
];
foreach ($migrationsCommands as $command) {
$commands[] = $this->addMigrationsConfig($command);
}
return $commands;
} | php | public function getCommands(): array
{
$commands = [
$this->container->get(GenerateRelationsCommand::class),
$this->container->get(GenerateEntityCommand::class),
$this->container->get(SetRelationCommand::class),
$this->container->get(GenerateFieldCommand::class),
$this->container->get(SetFieldCommand::class),
$this->container->get(SetEmbeddableCommand::class),
$this->container->get(GenerateEmbeddableFromArchetypeCommand::class),
$this->container->get(GenerateEmbeddableSkeletonCommand::class),
$this->container->get(RemoveUnusedRelationsCommand::class),
$this->container->get(OverrideCreateCommand::class),
$this->container->get(OverridesUpdateCommand::class),
$this->container->get(CreateConstraintCommand::class),
$this->container->get(FinaliseBuildCommand::class),
$this->container->get(CreateConstraintCommand::class),
];
$migrationsCommands = [
$this->container->get(ExecuteCommand::class),
$this->container->get(GenerateCommand::class),
$this->container->get(LatestCommand::class),
$this->container->get(MigrateCommand::class),
$this->container->get(DiffCommand::class),
$this->container->get(UpToDateCommand::class),
$this->container->get(StatusCommand::class),
$this->container->get(VersionCommand::class),
];
foreach ($migrationsCommands as $command) {
$commands[] = $this->addMigrationsConfig($command);
}
return $commands;
} | [
"public",
"function",
"getCommands",
"(",
")",
":",
"array",
"{",
"$",
"commands",
"=",
"[",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"GenerateRelationsCommand",
"::",
"class",
")",
",",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"GenerateEntityCommand",
"::",
"class",
")",
",",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"SetRelationCommand",
"::",
"class",
")",
",",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"GenerateFieldCommand",
"::",
"class",
")",
",",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"SetFieldCommand",
"::",
"class",
")",
",",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"SetEmbeddableCommand",
"::",
"class",
")",
",",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"GenerateEmbeddableFromArchetypeCommand",
"::",
"class",
")",
",",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"GenerateEmbeddableSkeletonCommand",
"::",
"class",
")",
",",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"RemoveUnusedRelationsCommand",
"::",
"class",
")",
",",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"OverrideCreateCommand",
"::",
"class",
")",
",",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"OverridesUpdateCommand",
"::",
"class",
")",
",",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"CreateConstraintCommand",
"::",
"class",
")",
",",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"FinaliseBuildCommand",
"::",
"class",
")",
",",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"CreateConstraintCommand",
"::",
"class",
")",
",",
"]",
";",
"$",
"migrationsCommands",
"=",
"[",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"ExecuteCommand",
"::",
"class",
")",
",",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"GenerateCommand",
"::",
"class",
")",
",",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"LatestCommand",
"::",
"class",
")",
",",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"MigrateCommand",
"::",
"class",
")",
",",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"DiffCommand",
"::",
"class",
")",
",",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"UpToDateCommand",
"::",
"class",
")",
",",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"StatusCommand",
"::",
"class",
")",
",",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"VersionCommand",
"::",
"class",
")",
",",
"]",
";",
"foreach",
"(",
"$",
"migrationsCommands",
"as",
"$",
"command",
")",
"{",
"$",
"commands",
"[",
"]",
"=",
"$",
"this",
"->",
"addMigrationsConfig",
"(",
"$",
"command",
")",
";",
"}",
"return",
"$",
"commands",
";",
"}"
] | For use in your project's cli-config.php file
@see /cli-config.php
@return array | [
"For",
"use",
"in",
"your",
"project",
"s",
"cli",
"-",
"config",
".",
"php",
"file"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/Command/CliConfigCommandFactory.php#L58-L91 |
31,921 | chameleon-system/chameleon-shop | src/ShopPaymentIPNBundle/objects/db/TPkgShopPaymentIpnMessage.class.php | TPkgShopPaymentIpnMessage.getMessageForOrder | public static function getMessageForOrder(TdbShopOrder $oOrder, $sStatusCode)
{
$oStatus = null;
$oPaymentHandler = $oOrder->GetPaymentHandler();
$query = "SELECT `pkg_shop_payment_ipn_message`.*
FROM `pkg_shop_payment_ipn_message`
INNER JOIN `pkg_shop_payment_ipn_status` ON `pkg_shop_payment_ipn_message`.`pkg_shop_payment_ipn_status_id` = `pkg_shop_payment_ipn_status`.`id`
WHERE (
`pkg_shop_payment_ipn_message`.`shop_order_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($oOrder->id)."'
AND `pkg_shop_payment_ipn_message`.`shop_payment_handler_group_id` = '".MySqlLegacySupport::getInstance()->real_escape_string(
$oPaymentHandler->fieldShopPaymentHandlerGroupId
)."'
AND `pkg_shop_payment_ipn_message`.`success` = '1'
AND `pkg_shop_payment_ipn_message`.`completed` = '1'
)
AND `pkg_shop_payment_ipn_status`.`code` = '".MySqlLegacySupport::getInstance()->real_escape_string($sStatusCode)."'
";
if ($aMessage = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query))) {
$oStatus = TdbPkgShopPaymentIpnMessage::GetNewInstance($aMessage);
}
return $oStatus;
} | php | public static function getMessageForOrder(TdbShopOrder $oOrder, $sStatusCode)
{
$oStatus = null;
$oPaymentHandler = $oOrder->GetPaymentHandler();
$query = "SELECT `pkg_shop_payment_ipn_message`.*
FROM `pkg_shop_payment_ipn_message`
INNER JOIN `pkg_shop_payment_ipn_status` ON `pkg_shop_payment_ipn_message`.`pkg_shop_payment_ipn_status_id` = `pkg_shop_payment_ipn_status`.`id`
WHERE (
`pkg_shop_payment_ipn_message`.`shop_order_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($oOrder->id)."'
AND `pkg_shop_payment_ipn_message`.`shop_payment_handler_group_id` = '".MySqlLegacySupport::getInstance()->real_escape_string(
$oPaymentHandler->fieldShopPaymentHandlerGroupId
)."'
AND `pkg_shop_payment_ipn_message`.`success` = '1'
AND `pkg_shop_payment_ipn_message`.`completed` = '1'
)
AND `pkg_shop_payment_ipn_status`.`code` = '".MySqlLegacySupport::getInstance()->real_escape_string($sStatusCode)."'
";
if ($aMessage = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query))) {
$oStatus = TdbPkgShopPaymentIpnMessage::GetNewInstance($aMessage);
}
return $oStatus;
} | [
"public",
"static",
"function",
"getMessageForOrder",
"(",
"TdbShopOrder",
"$",
"oOrder",
",",
"$",
"sStatusCode",
")",
"{",
"$",
"oStatus",
"=",
"null",
";",
"$",
"oPaymentHandler",
"=",
"$",
"oOrder",
"->",
"GetPaymentHandler",
"(",
")",
";",
"$",
"query",
"=",
"\"SELECT `pkg_shop_payment_ipn_message`.*\n FROM `pkg_shop_payment_ipn_message`\n INNER JOIN `pkg_shop_payment_ipn_status` ON `pkg_shop_payment_ipn_message`.`pkg_shop_payment_ipn_status_id` = `pkg_shop_payment_ipn_status`.`id`\n WHERE (\n `pkg_shop_payment_ipn_message`.`shop_order_id` = '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"oOrder",
"->",
"id",
")",
".",
"\"'\n AND `pkg_shop_payment_ipn_message`.`shop_payment_handler_group_id` = '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"oPaymentHandler",
"->",
"fieldShopPaymentHandlerGroupId",
")",
".",
"\"'\n AND `pkg_shop_payment_ipn_message`.`success` = '1'\n AND `pkg_shop_payment_ipn_message`.`completed` = '1'\n )\n AND `pkg_shop_payment_ipn_status`.`code` = '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"sStatusCode",
")",
".",
"\"'\n \"",
";",
"if",
"(",
"$",
"aMessage",
"=",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"fetch_assoc",
"(",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"query",
"(",
"$",
"query",
")",
")",
")",
"{",
"$",
"oStatus",
"=",
"TdbPkgShopPaymentIpnMessage",
"::",
"GetNewInstance",
"(",
"$",
"aMessage",
")",
";",
"}",
"return",
"$",
"oStatus",
";",
"}"
] | returns the status object with a specific code for an order.
@param TdbShopOrder $oOrder
@param string $sStatusCode
@return TdbPkgShopPaymentIpnMessage|null | [
"returns",
"the",
"status",
"object",
"with",
"a",
"specific",
"code",
"for",
"an",
"order",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopPaymentIPNBundle/objects/db/TPkgShopPaymentIpnMessage.class.php#L72-L94 |
31,922 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/AmazonPaymentGroupConfig.php | AmazonPaymentGroupConfig.getPayWithAmazonButton | public function getPayWithAmazonButton()
{
$buttonURL = $this->getValue('payWithAmazonButtonURL', null);
if (null !== $buttonURL) {
$buttonURL .= '?sellerId='.urlencode($this->getMerchantId());
}
return $buttonURL;
} | php | public function getPayWithAmazonButton()
{
$buttonURL = $this->getValue('payWithAmazonButtonURL', null);
if (null !== $buttonURL) {
$buttonURL .= '?sellerId='.urlencode($this->getMerchantId());
}
return $buttonURL;
} | [
"public",
"function",
"getPayWithAmazonButton",
"(",
")",
"{",
"$",
"buttonURL",
"=",
"$",
"this",
"->",
"getValue",
"(",
"'payWithAmazonButtonURL'",
",",
"null",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"buttonURL",
")",
"{",
"$",
"buttonURL",
".=",
"'?sellerId='",
".",
"urlencode",
"(",
"$",
"this",
"->",
"getMerchantId",
"(",
")",
")",
";",
"}",
"return",
"$",
"buttonURL",
";",
"}"
] | return buy button url inc. merchant id parameter.
@return string | [
"return",
"buy",
"button",
"url",
"inc",
".",
"merchant",
"id",
"parameter",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/AmazonPaymentGroupConfig.php#L131-L139 |
31,923 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/AmazonPaymentGroupConfig.php | AmazonPaymentGroupConfig.getSellerAuthorizationNote | public function getSellerAuthorizationNote(\TdbShopOrder $order, $amount, $captureNow, array $itemList = array())
{
$text = $this->getValue('sellerAuthorizationNote');
$data = $this->getTemplateDataFromOrder($order);
$data['captureNow'] = $captureNow;
$data['transaction__totalValue'] = $amount;
$data['transaction__items'] = $itemList;
return $this->render($text, $data);
} | php | public function getSellerAuthorizationNote(\TdbShopOrder $order, $amount, $captureNow, array $itemList = array())
{
$text = $this->getValue('sellerAuthorizationNote');
$data = $this->getTemplateDataFromOrder($order);
$data['captureNow'] = $captureNow;
$data['transaction__totalValue'] = $amount;
$data['transaction__items'] = $itemList;
return $this->render($text, $data);
} | [
"public",
"function",
"getSellerAuthorizationNote",
"(",
"\\",
"TdbShopOrder",
"$",
"order",
",",
"$",
"amount",
",",
"$",
"captureNow",
",",
"array",
"$",
"itemList",
"=",
"array",
"(",
")",
")",
"{",
"$",
"text",
"=",
"$",
"this",
"->",
"getValue",
"(",
"'sellerAuthorizationNote'",
")",
";",
"$",
"data",
"=",
"$",
"this",
"->",
"getTemplateDataFromOrder",
"(",
"$",
"order",
")",
";",
"$",
"data",
"[",
"'captureNow'",
"]",
"=",
"$",
"captureNow",
";",
"$",
"data",
"[",
"'transaction__totalValue'",
"]",
"=",
"$",
"amount",
";",
"$",
"data",
"[",
"'transaction__items'",
"]",
"=",
"$",
"itemList",
";",
"return",
"$",
"this",
"->",
"render",
"(",
"$",
"text",
",",
"$",
"data",
")",
";",
"}"
] | returns a text displayed on the auth email sent by amazon to the buyer.
@param \TdbShopOrder $order
@param float $amount
@param bool $captureNow
@param array $itemList
@return string | [
"returns",
"a",
"text",
"displayed",
"on",
"the",
"auth",
"email",
"sent",
"by",
"amazon",
"to",
"the",
"buyer",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/AmazonPaymentGroupConfig.php#L204-L213 |
31,924 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/AmazonPaymentGroupConfig.php | AmazonPaymentGroupConfig.getTemplateDataFromOrder | protected function getTemplateDataFromOrder(\TdbShopOrder $order)
{
$data = $order->GetSQLWithTablePrefix($order->table);
$shop = $order->GetFieldShop();
$shopData = $shop->GetSQLWithTablePrefix($shop->table);
$data = array_merge($data, $shopData);
return $data;
} | php | protected function getTemplateDataFromOrder(\TdbShopOrder $order)
{
$data = $order->GetSQLWithTablePrefix($order->table);
$shop = $order->GetFieldShop();
$shopData = $shop->GetSQLWithTablePrefix($shop->table);
$data = array_merge($data, $shopData);
return $data;
} | [
"protected",
"function",
"getTemplateDataFromOrder",
"(",
"\\",
"TdbShopOrder",
"$",
"order",
")",
"{",
"$",
"data",
"=",
"$",
"order",
"->",
"GetSQLWithTablePrefix",
"(",
"$",
"order",
"->",
"table",
")",
";",
"$",
"shop",
"=",
"$",
"order",
"->",
"GetFieldShop",
"(",
")",
";",
"$",
"shopData",
"=",
"$",
"shop",
"->",
"GetSQLWithTablePrefix",
"(",
"$",
"shop",
"->",
"table",
")",
";",
"$",
"data",
"=",
"array_merge",
"(",
"$",
"data",
",",
"$",
"shopData",
")",
";",
"return",
"$",
"data",
";",
"}"
] | extract data from oder to be used by text generated via template.
@param \TdbShopOrder $order
@return array | [
"extract",
"data",
"from",
"oder",
"to",
"be",
"used",
"by",
"text",
"generated",
"via",
"template",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/AmazonPaymentGroupConfig.php#L254-L262 |
31,925 | symbiote/silverstripe-cdncontent | code/controllers/CDNSecureFileController.php | CDNSecureFileController.handleRequest | public function handleRequest(SS_HTTPRequest $request, DataModel $model) {
$response = new SS_HTTPResponse();
$filename = $request->getURL();
if (strpos($filename, 'cdnassets') === 0) {
$filename = 'assets/' . substr($filename, strlen('cdnassets/'));
}
$file = null;
if (strpos($filename, '_resampled') !== false) {
$file = ContentServiceAsset::get()->filter('Filename', $filename)->first();
} else if (strpos($filename, '/_versions/') !== false) {
$file = FileVersion::get()->filter('Filename', "/" . $filename)->first();
} else {
$file = File::get()->filter('filename', $filename)->first();
}
if ($file && $file->canView()) {
if (!$file->CDNFile && !$file->FilePointer) {
return $this->httpError(404);
}
// Permission passed redirect to file
$redirectLink = '';
if ($file->getViewType() != CDNFile::ANYONE_PERM) {
if ($file->hasMethod('getSecureURL')) {
$redirectLink = $file->getSecureURL(180);
}
if (!strlen($redirectLink)) {
// can we stream it?
return $this->sendFile($file);
}
} else {
$redirectLink = $file->getURL();
}
if ($redirectLink && trim($redirectLink, '/') != $request->getURL()) {
$response->redirect($redirectLink);
} else {
return $this->httpError(404);
}
} else {
if (class_exists('SecureFileController')) {
$handoff = SecureFileController::create();
return $handoff->handleRequest($request, $model);
} elseif ($file instanceof File) {
// Permission failure
Security::permissionFailure($this, 'You are not authorised to access this resource. Please log in.');
} else {
// File doesn't exist
$response = new SS_HTTPResponse('File Not Found', 404);
}
}
return $response;
} | php | public function handleRequest(SS_HTTPRequest $request, DataModel $model) {
$response = new SS_HTTPResponse();
$filename = $request->getURL();
if (strpos($filename, 'cdnassets') === 0) {
$filename = 'assets/' . substr($filename, strlen('cdnassets/'));
}
$file = null;
if (strpos($filename, '_resampled') !== false) {
$file = ContentServiceAsset::get()->filter('Filename', $filename)->first();
} else if (strpos($filename, '/_versions/') !== false) {
$file = FileVersion::get()->filter('Filename', "/" . $filename)->first();
} else {
$file = File::get()->filter('filename', $filename)->first();
}
if ($file && $file->canView()) {
if (!$file->CDNFile && !$file->FilePointer) {
return $this->httpError(404);
}
// Permission passed redirect to file
$redirectLink = '';
if ($file->getViewType() != CDNFile::ANYONE_PERM) {
if ($file->hasMethod('getSecureURL')) {
$redirectLink = $file->getSecureURL(180);
}
if (!strlen($redirectLink)) {
// can we stream it?
return $this->sendFile($file);
}
} else {
$redirectLink = $file->getURL();
}
if ($redirectLink && trim($redirectLink, '/') != $request->getURL()) {
$response->redirect($redirectLink);
} else {
return $this->httpError(404);
}
} else {
if (class_exists('SecureFileController')) {
$handoff = SecureFileController::create();
return $handoff->handleRequest($request, $model);
} elseif ($file instanceof File) {
// Permission failure
Security::permissionFailure($this, 'You are not authorised to access this resource. Please log in.');
} else {
// File doesn't exist
$response = new SS_HTTPResponse('File Not Found', 404);
}
}
return $response;
} | [
"public",
"function",
"handleRequest",
"(",
"SS_HTTPRequest",
"$",
"request",
",",
"DataModel",
"$",
"model",
")",
"{",
"$",
"response",
"=",
"new",
"SS_HTTPResponse",
"(",
")",
";",
"$",
"filename",
"=",
"$",
"request",
"->",
"getURL",
"(",
")",
";",
"if",
"(",
"strpos",
"(",
"$",
"filename",
",",
"'cdnassets'",
")",
"===",
"0",
")",
"{",
"$",
"filename",
"=",
"'assets/'",
".",
"substr",
"(",
"$",
"filename",
",",
"strlen",
"(",
"'cdnassets/'",
")",
")",
";",
"}",
"$",
"file",
"=",
"null",
";",
"if",
"(",
"strpos",
"(",
"$",
"filename",
",",
"'_resampled'",
")",
"!==",
"false",
")",
"{",
"$",
"file",
"=",
"ContentServiceAsset",
"::",
"get",
"(",
")",
"->",
"filter",
"(",
"'Filename'",
",",
"$",
"filename",
")",
"->",
"first",
"(",
")",
";",
"}",
"else",
"if",
"(",
"strpos",
"(",
"$",
"filename",
",",
"'/_versions/'",
")",
"!==",
"false",
")",
"{",
"$",
"file",
"=",
"FileVersion",
"::",
"get",
"(",
")",
"->",
"filter",
"(",
"'Filename'",
",",
"\"/\"",
".",
"$",
"filename",
")",
"->",
"first",
"(",
")",
";",
"}",
"else",
"{",
"$",
"file",
"=",
"File",
"::",
"get",
"(",
")",
"->",
"filter",
"(",
"'filename'",
",",
"$",
"filename",
")",
"->",
"first",
"(",
")",
";",
"}",
"if",
"(",
"$",
"file",
"&&",
"$",
"file",
"->",
"canView",
"(",
")",
")",
"{",
"if",
"(",
"!",
"$",
"file",
"->",
"CDNFile",
"&&",
"!",
"$",
"file",
"->",
"FilePointer",
")",
"{",
"return",
"$",
"this",
"->",
"httpError",
"(",
"404",
")",
";",
"}",
"// Permission passed redirect to file",
"$",
"redirectLink",
"=",
"''",
";",
"if",
"(",
"$",
"file",
"->",
"getViewType",
"(",
")",
"!=",
"CDNFile",
"::",
"ANYONE_PERM",
")",
"{",
"if",
"(",
"$",
"file",
"->",
"hasMethod",
"(",
"'getSecureURL'",
")",
")",
"{",
"$",
"redirectLink",
"=",
"$",
"file",
"->",
"getSecureURL",
"(",
"180",
")",
";",
"}",
"if",
"(",
"!",
"strlen",
"(",
"$",
"redirectLink",
")",
")",
"{",
"// can we stream it?",
"return",
"$",
"this",
"->",
"sendFile",
"(",
"$",
"file",
")",
";",
"}",
"}",
"else",
"{",
"$",
"redirectLink",
"=",
"$",
"file",
"->",
"getURL",
"(",
")",
";",
"}",
"if",
"(",
"$",
"redirectLink",
"&&",
"trim",
"(",
"$",
"redirectLink",
",",
"'/'",
")",
"!=",
"$",
"request",
"->",
"getURL",
"(",
")",
")",
"{",
"$",
"response",
"->",
"redirect",
"(",
"$",
"redirectLink",
")",
";",
"}",
"else",
"{",
"return",
"$",
"this",
"->",
"httpError",
"(",
"404",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"class_exists",
"(",
"'SecureFileController'",
")",
")",
"{",
"$",
"handoff",
"=",
"SecureFileController",
"::",
"create",
"(",
")",
";",
"return",
"$",
"handoff",
"->",
"handleRequest",
"(",
"$",
"request",
",",
"$",
"model",
")",
";",
"}",
"elseif",
"(",
"$",
"file",
"instanceof",
"File",
")",
"{",
"// Permission failure",
"Security",
"::",
"permissionFailure",
"(",
"$",
"this",
",",
"'You are not authorised to access this resource. Please log in.'",
")",
";",
"}",
"else",
"{",
"// File doesn't exist",
"$",
"response",
"=",
"new",
"SS_HTTPResponse",
"(",
"'File Not Found'",
",",
"404",
")",
";",
"}",
"}",
"return",
"$",
"response",
";",
"}"
] | Process all incoming requests passed to this controller, checking
that the file exists and passing the file through if possible. | [
"Process",
"all",
"incoming",
"requests",
"passed",
"to",
"this",
"controller",
"checking",
"that",
"the",
"file",
"exists",
"and",
"passing",
"the",
"file",
"through",
"if",
"possible",
"."
] | a5f82e802e9addaf98d506cf305a621b873a5c9b | https://github.com/symbiote/silverstripe-cdncontent/blob/a5f82e802e9addaf98d506cf305a621b873a5c9b/code/controllers/CDNSecureFileController.php#L17-L73 |
31,926 | symbiote/silverstripe-cdncontent | code/controllers/CDNSecureFileController.php | CDNSecureFileController.sendFile | public function sendFile($file) {
$reader = $file->reader();
if (!$reader || !$reader->isReadable()) {
return;
}
if(class_exists('SapphireTest', false) && SapphireTest::is_running_test()) {
return $reader->read();
}
$type = HTTP::get_mime_type($file->Filename);
$disposition = strpos($type, 'image') !== false ? 'inline' : 'attachment';
header('Content-Description: File Transfer');
// Quotes needed to retain spaces (http://kb.mozillazine.org/Filenames_with_spaces_are_truncated_upon_download)
header(sprintf('Content-Disposition: %s; filename="%s"', $disposition, basename($file->Filename)));
header('Content-Length: ' . $file->FileSize);
header('Content-Type: ' . $type);
header('Content-Transfer-Encoding: binary');
// Ensure we enforce no-cache headers consistently, so that files accesses aren't cached by CDN/edge networks
header('Pragma: no-cache');
header('Cache-Control: private, no-cache, no-store');
increase_time_limit_to(0);
// Clear PHP buffer, otherwise the script will try to allocate memory for entire file.
while (ob_get_level() > 0) {
ob_end_flush();
}
// Prevent blocking of the session file by PHP. Without this the user can't visit another page of the same
// website during download (see http://konrness.com/php5/how-to-prevent-blocking-php-requests/)
session_write_close();
echo $reader->read();
die();
} | php | public function sendFile($file) {
$reader = $file->reader();
if (!$reader || !$reader->isReadable()) {
return;
}
if(class_exists('SapphireTest', false) && SapphireTest::is_running_test()) {
return $reader->read();
}
$type = HTTP::get_mime_type($file->Filename);
$disposition = strpos($type, 'image') !== false ? 'inline' : 'attachment';
header('Content-Description: File Transfer');
// Quotes needed to retain spaces (http://kb.mozillazine.org/Filenames_with_spaces_are_truncated_upon_download)
header(sprintf('Content-Disposition: %s; filename="%s"', $disposition, basename($file->Filename)));
header('Content-Length: ' . $file->FileSize);
header('Content-Type: ' . $type);
header('Content-Transfer-Encoding: binary');
// Ensure we enforce no-cache headers consistently, so that files accesses aren't cached by CDN/edge networks
header('Pragma: no-cache');
header('Cache-Control: private, no-cache, no-store');
increase_time_limit_to(0);
// Clear PHP buffer, otherwise the script will try to allocate memory for entire file.
while (ob_get_level() > 0) {
ob_end_flush();
}
// Prevent blocking of the session file by PHP. Without this the user can't visit another page of the same
// website during download (see http://konrness.com/php5/how-to-prevent-blocking-php-requests/)
session_write_close();
echo $reader->read();
die();
} | [
"public",
"function",
"sendFile",
"(",
"$",
"file",
")",
"{",
"$",
"reader",
"=",
"$",
"file",
"->",
"reader",
"(",
")",
";",
"if",
"(",
"!",
"$",
"reader",
"||",
"!",
"$",
"reader",
"->",
"isReadable",
"(",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"class_exists",
"(",
"'SapphireTest'",
",",
"false",
")",
"&&",
"SapphireTest",
"::",
"is_running_test",
"(",
")",
")",
"{",
"return",
"$",
"reader",
"->",
"read",
"(",
")",
";",
"}",
"$",
"type",
"=",
"HTTP",
"::",
"get_mime_type",
"(",
"$",
"file",
"->",
"Filename",
")",
";",
"$",
"disposition",
"=",
"strpos",
"(",
"$",
"type",
",",
"'image'",
")",
"!==",
"false",
"?",
"'inline'",
":",
"'attachment'",
";",
"header",
"(",
"'Content-Description: File Transfer'",
")",
";",
"// Quotes needed to retain spaces (http://kb.mozillazine.org/Filenames_with_spaces_are_truncated_upon_download)",
"header",
"(",
"sprintf",
"(",
"'Content-Disposition: %s; filename=\"%s\"'",
",",
"$",
"disposition",
",",
"basename",
"(",
"$",
"file",
"->",
"Filename",
")",
")",
")",
";",
"header",
"(",
"'Content-Length: '",
".",
"$",
"file",
"->",
"FileSize",
")",
";",
"header",
"(",
"'Content-Type: '",
".",
"$",
"type",
")",
";",
"header",
"(",
"'Content-Transfer-Encoding: binary'",
")",
";",
"// Ensure we enforce no-cache headers consistently, so that files accesses aren't cached by CDN/edge networks",
"header",
"(",
"'Pragma: no-cache'",
")",
";",
"header",
"(",
"'Cache-Control: private, no-cache, no-store'",
")",
";",
"increase_time_limit_to",
"(",
"0",
")",
";",
"// Clear PHP buffer, otherwise the script will try to allocate memory for entire file.",
"while",
"(",
"ob_get_level",
"(",
")",
">",
"0",
")",
"{",
"ob_end_flush",
"(",
")",
";",
"}",
"// Prevent blocking of the session file by PHP. Without this the user can't visit another page of the same",
"// website during download (see http://konrness.com/php5/how-to-prevent-blocking-php-requests/)",
"session_write_close",
"(",
")",
";",
"echo",
"$",
"reader",
"->",
"read",
"(",
")",
";",
"die",
"(",
")",
";",
"}"
] | Output file to the browser.
For performance reasons, we avoid SS_HTTPResponse and just output the contents instead. | [
"Output",
"file",
"to",
"the",
"browser",
".",
"For",
"performance",
"reasons",
"we",
"avoid",
"SS_HTTPResponse",
"and",
"just",
"output",
"the",
"contents",
"instead",
"."
] | a5f82e802e9addaf98d506cf305a621b873a5c9b | https://github.com/symbiote/silverstripe-cdncontent/blob/a5f82e802e9addaf98d506cf305a621b873a5c9b/code/controllers/CDNSecureFileController.php#L79-L116 |
31,927 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/pkgShop/db/AmazonShopOrder.php | AmazonShopOrder.getAmazonOrderReferenceId | public function getAmazonOrderReferenceId()
{
$paymentHandler = $this->GetPaymentHandler();
if (false === ($paymentHandler instanceof AmazonPaymentHandler)) {
throw new \InvalidArgumentException('order was not paid with amazon payment');
}
/** @var $paymentHandler AmazonPaymentHandler */
return $paymentHandler->getAmazonOrderReferenceId();
} | php | public function getAmazonOrderReferenceId()
{
$paymentHandler = $this->GetPaymentHandler();
if (false === ($paymentHandler instanceof AmazonPaymentHandler)) {
throw new \InvalidArgumentException('order was not paid with amazon payment');
}
/** @var $paymentHandler AmazonPaymentHandler */
return $paymentHandler->getAmazonOrderReferenceId();
} | [
"public",
"function",
"getAmazonOrderReferenceId",
"(",
")",
"{",
"$",
"paymentHandler",
"=",
"$",
"this",
"->",
"GetPaymentHandler",
"(",
")",
";",
"if",
"(",
"false",
"===",
"(",
"$",
"paymentHandler",
"instanceof",
"AmazonPaymentHandler",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'order was not paid with amazon payment'",
")",
";",
"}",
"/** @var $paymentHandler AmazonPaymentHandler */",
"return",
"$",
"paymentHandler",
"->",
"getAmazonOrderReferenceId",
"(",
")",
";",
"}"
] | returns amazon order reference id if the order was paid with amazon. throws an InvalidArgumentException if the
order was not paid with amazon.
@throws \InvalidArgumentException
@return string | [
"returns",
"amazon",
"order",
"reference",
"id",
"if",
"the",
"order",
"was",
"paid",
"with",
"amazon",
".",
"throws",
"an",
"InvalidArgumentException",
"if",
"the",
"order",
"was",
"not",
"paid",
"with",
"amazon",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/pkgShop/db/AmazonShopOrder.php#L27-L37 |
31,928 | chameleon-system/chameleon-shop | src/ShopBundle/objects/WebModules/MTShopOrderWizardCore/MTShopOrderWizardCoreEndPoint.class.php | MTShopOrderWizardCoreEndPoint.GetCallingURL | public static function GetCallingURL()
{
$sURL = '/';
if (array_key_exists(self::SESSION_PARAM_NAME, $_SESSION)) {
$sURL = $_SESSION[self::SESSION_PARAM_NAME];
} else {
$sURL = self::getPageService()->getLinkToPortalHomePageAbsolute();
}
return $sURL;
} | php | public static function GetCallingURL()
{
$sURL = '/';
if (array_key_exists(self::SESSION_PARAM_NAME, $_SESSION)) {
$sURL = $_SESSION[self::SESSION_PARAM_NAME];
} else {
$sURL = self::getPageService()->getLinkToPortalHomePageAbsolute();
}
return $sURL;
} | [
"public",
"static",
"function",
"GetCallingURL",
"(",
")",
"{",
"$",
"sURL",
"=",
"'/'",
";",
"if",
"(",
"array_key_exists",
"(",
"self",
"::",
"SESSION_PARAM_NAME",
",",
"$",
"_SESSION",
")",
")",
"{",
"$",
"sURL",
"=",
"$",
"_SESSION",
"[",
"self",
"::",
"SESSION_PARAM_NAME",
"]",
";",
"}",
"else",
"{",
"$",
"sURL",
"=",
"self",
"::",
"getPageService",
"(",
")",
"->",
"getLinkToPortalHomePageAbsolute",
"(",
")",
";",
"}",
"return",
"$",
"sURL",
";",
"}"
] | return the url to the page that requested the order step.
@return string | [
"return",
"the",
"url",
"to",
"the",
"page",
"that",
"requested",
"the",
"order",
"step",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/WebModules/MTShopOrderWizardCore/MTShopOrderWizardCoreEndPoint.class.php#L130-L140 |
31,929 | chameleon-system/chameleon-shop | src/ShopBundle/objects/WebModules/MTShopOrderWizardCore/MTShopOrderWizardCoreEndPoint.class.php | MTShopOrderWizardCoreEndPoint.GetStepAsAjax | protected function GetStepAsAjax($sStepName = null)
{
$sHTML = '';
if (is_null($sStepName)) {
$sStepName = $this->global->GetUserData('sStepName');
}
$oStep = TdbShopOrderStep::GetStep($sStepName);
if ($oStep) {
$sModuleSpotName = $this->sModuleSpotName;
$sHTML = $oStep->Render($sModuleSpotName);
}
return $sHTML;
} | php | protected function GetStepAsAjax($sStepName = null)
{
$sHTML = '';
if (is_null($sStepName)) {
$sStepName = $this->global->GetUserData('sStepName');
}
$oStep = TdbShopOrderStep::GetStep($sStepName);
if ($oStep) {
$sModuleSpotName = $this->sModuleSpotName;
$sHTML = $oStep->Render($sModuleSpotName);
}
return $sHTML;
} | [
"protected",
"function",
"GetStepAsAjax",
"(",
"$",
"sStepName",
"=",
"null",
")",
"{",
"$",
"sHTML",
"=",
"''",
";",
"if",
"(",
"is_null",
"(",
"$",
"sStepName",
")",
")",
"{",
"$",
"sStepName",
"=",
"$",
"this",
"->",
"global",
"->",
"GetUserData",
"(",
"'sStepName'",
")",
";",
"}",
"$",
"oStep",
"=",
"TdbShopOrderStep",
"::",
"GetStep",
"(",
"$",
"sStepName",
")",
";",
"if",
"(",
"$",
"oStep",
")",
"{",
"$",
"sModuleSpotName",
"=",
"$",
"this",
"->",
"sModuleSpotName",
";",
"$",
"sHTML",
"=",
"$",
"oStep",
"->",
"Render",
"(",
"$",
"sModuleSpotName",
")",
";",
"}",
"return",
"$",
"sHTML",
";",
"}"
] | return the step passed as ajax.
@param string $sStepName
@return string | [
"return",
"the",
"step",
"passed",
"as",
"ajax",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/WebModules/MTShopOrderWizardCore/MTShopOrderWizardCoreEndPoint.class.php#L254-L267 |
31,930 | chameleon-system/chameleon-shop | src/ShopBundle/objects/WebModules/MTShopOrderWizardCore/MTShopOrderWizardCoreEndPoint.class.php | MTShopOrderWizardCoreEndPoint.JumpSelectPaymentMethod | protected function JumpSelectPaymentMethod($sPaymentMethodId = null, $sPaymentMethodNameInternal = null)
{
$oPaymentMethod = null;
if (is_null($sPaymentMethodId)) {
$sPaymentMethodId = $this->global->GetUserData('sPaymentMethodId');
}
if (empty($sPaymentMethodId)) {
$oPaymentMethod = TdbShopPaymentMethod::GetNewInstance();
if (is_null($sPaymentMethodNameInternal)) {
$sPaymentMethodNameInternal = $this->global->GetUserData('sPaymentMethodNameInternal');
}
$oPaymentMethod->LoadFromField('name_internal', $sPaymentMethodNameInternal);
}
if (is_null($oPaymentMethod)) {
$oPaymentMethod = TdbShopPaymentMethod::GetNewInstance();
$oPaymentMethod->Load($sPaymentMethodId);
}
if ($oPaymentMethod->IsAvailable()) {
$oBasket = TShopBasket::GetInstance();
$oBasket->SetActivePaymentMethod($oPaymentMethod);
// check if payment method was set
$oCheckPayment = $oBasket->GetActivePaymentMethod();
if (!$oCheckPayment) {
TTools::WriteLogEntry('JumpSelectPaymentMethod: unable to select payment method', 1, __FILE__, __LINE__);
}
// also set shipping type if not already set
$oActiveShippingGroup = $oBasket->GetActiveShippingGroup();
if (is_null($oActiveShippingGroup) || !$oPaymentMethod->isConnected('shop_shipping_group', $oActiveShippingGroup->id)) {
$oMatchingShippingGroup = TdbShopShippingGroupList::GetShippingGroupsThatAllowPaymentWith($oPaymentMethod->fieldNameInternal);
$oBasket->SetActiveShippingGroup($oMatchingShippingGroup);
$oBasket->RecalculateBasket();
}
$oPaymentMethod->GetFieldShopPaymentHandler()->PostSelectPaymentHook(TCMSMessageManager::GLOBAL_CONSUMER_NAME);
return true;
} else {
trigger_error('trying to access an unavailable payment method through JumpSelect', E_USER_WARNING);
return false;
}
} | php | protected function JumpSelectPaymentMethod($sPaymentMethodId = null, $sPaymentMethodNameInternal = null)
{
$oPaymentMethod = null;
if (is_null($sPaymentMethodId)) {
$sPaymentMethodId = $this->global->GetUserData('sPaymentMethodId');
}
if (empty($sPaymentMethodId)) {
$oPaymentMethod = TdbShopPaymentMethod::GetNewInstance();
if (is_null($sPaymentMethodNameInternal)) {
$sPaymentMethodNameInternal = $this->global->GetUserData('sPaymentMethodNameInternal');
}
$oPaymentMethod->LoadFromField('name_internal', $sPaymentMethodNameInternal);
}
if (is_null($oPaymentMethod)) {
$oPaymentMethod = TdbShopPaymentMethod::GetNewInstance();
$oPaymentMethod->Load($sPaymentMethodId);
}
if ($oPaymentMethod->IsAvailable()) {
$oBasket = TShopBasket::GetInstance();
$oBasket->SetActivePaymentMethod($oPaymentMethod);
// check if payment method was set
$oCheckPayment = $oBasket->GetActivePaymentMethod();
if (!$oCheckPayment) {
TTools::WriteLogEntry('JumpSelectPaymentMethod: unable to select payment method', 1, __FILE__, __LINE__);
}
// also set shipping type if not already set
$oActiveShippingGroup = $oBasket->GetActiveShippingGroup();
if (is_null($oActiveShippingGroup) || !$oPaymentMethod->isConnected('shop_shipping_group', $oActiveShippingGroup->id)) {
$oMatchingShippingGroup = TdbShopShippingGroupList::GetShippingGroupsThatAllowPaymentWith($oPaymentMethod->fieldNameInternal);
$oBasket->SetActiveShippingGroup($oMatchingShippingGroup);
$oBasket->RecalculateBasket();
}
$oPaymentMethod->GetFieldShopPaymentHandler()->PostSelectPaymentHook(TCMSMessageManager::GLOBAL_CONSUMER_NAME);
return true;
} else {
trigger_error('trying to access an unavailable payment method through JumpSelect', E_USER_WARNING);
return false;
}
} | [
"protected",
"function",
"JumpSelectPaymentMethod",
"(",
"$",
"sPaymentMethodId",
"=",
"null",
",",
"$",
"sPaymentMethodNameInternal",
"=",
"null",
")",
"{",
"$",
"oPaymentMethod",
"=",
"null",
";",
"if",
"(",
"is_null",
"(",
"$",
"sPaymentMethodId",
")",
")",
"{",
"$",
"sPaymentMethodId",
"=",
"$",
"this",
"->",
"global",
"->",
"GetUserData",
"(",
"'sPaymentMethodId'",
")",
";",
"}",
"if",
"(",
"empty",
"(",
"$",
"sPaymentMethodId",
")",
")",
"{",
"$",
"oPaymentMethod",
"=",
"TdbShopPaymentMethod",
"::",
"GetNewInstance",
"(",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"sPaymentMethodNameInternal",
")",
")",
"{",
"$",
"sPaymentMethodNameInternal",
"=",
"$",
"this",
"->",
"global",
"->",
"GetUserData",
"(",
"'sPaymentMethodNameInternal'",
")",
";",
"}",
"$",
"oPaymentMethod",
"->",
"LoadFromField",
"(",
"'name_internal'",
",",
"$",
"sPaymentMethodNameInternal",
")",
";",
"}",
"if",
"(",
"is_null",
"(",
"$",
"oPaymentMethod",
")",
")",
"{",
"$",
"oPaymentMethod",
"=",
"TdbShopPaymentMethod",
"::",
"GetNewInstance",
"(",
")",
";",
"$",
"oPaymentMethod",
"->",
"Load",
"(",
"$",
"sPaymentMethodId",
")",
";",
"}",
"if",
"(",
"$",
"oPaymentMethod",
"->",
"IsAvailable",
"(",
")",
")",
"{",
"$",
"oBasket",
"=",
"TShopBasket",
"::",
"GetInstance",
"(",
")",
";",
"$",
"oBasket",
"->",
"SetActivePaymentMethod",
"(",
"$",
"oPaymentMethod",
")",
";",
"// check if payment method was set",
"$",
"oCheckPayment",
"=",
"$",
"oBasket",
"->",
"GetActivePaymentMethod",
"(",
")",
";",
"if",
"(",
"!",
"$",
"oCheckPayment",
")",
"{",
"TTools",
"::",
"WriteLogEntry",
"(",
"'JumpSelectPaymentMethod: unable to select payment method'",
",",
"1",
",",
"__FILE__",
",",
"__LINE__",
")",
";",
"}",
"// also set shipping type if not already set",
"$",
"oActiveShippingGroup",
"=",
"$",
"oBasket",
"->",
"GetActiveShippingGroup",
"(",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"oActiveShippingGroup",
")",
"||",
"!",
"$",
"oPaymentMethod",
"->",
"isConnected",
"(",
"'shop_shipping_group'",
",",
"$",
"oActiveShippingGroup",
"->",
"id",
")",
")",
"{",
"$",
"oMatchingShippingGroup",
"=",
"TdbShopShippingGroupList",
"::",
"GetShippingGroupsThatAllowPaymentWith",
"(",
"$",
"oPaymentMethod",
"->",
"fieldNameInternal",
")",
";",
"$",
"oBasket",
"->",
"SetActiveShippingGroup",
"(",
"$",
"oMatchingShippingGroup",
")",
";",
"$",
"oBasket",
"->",
"RecalculateBasket",
"(",
")",
";",
"}",
"$",
"oPaymentMethod",
"->",
"GetFieldShopPaymentHandler",
"(",
")",
"->",
"PostSelectPaymentHook",
"(",
"TCMSMessageManager",
"::",
"GLOBAL_CONSUMER_NAME",
")",
";",
"return",
"true",
";",
"}",
"else",
"{",
"trigger_error",
"(",
"'trying to access an unavailable payment method through JumpSelect'",
",",
"E_USER_WARNING",
")",
";",
"return",
"false",
";",
"}",
"}"
] | executes the post select payment hook for the given payment method. you can pass either the id
or the internal name of the payment method.
@param string $sPaymentMethodId
@param string $sPaymentMethodNameInternal | [
"executes",
"the",
"post",
"select",
"payment",
"hook",
"for",
"the",
"given",
"payment",
"method",
".",
"you",
"can",
"pass",
"either",
"the",
"id",
"or",
"the",
"internal",
"name",
"of",
"the",
"payment",
"method",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/WebModules/MTShopOrderWizardCore/MTShopOrderWizardCoreEndPoint.class.php#L297-L342 |
31,931 | CVO-Technologies/cakephp-github | src/Webservice/GitHubWebservice.php | GitHubWebservice._parseLinks | protected function _parseLinks($links)
{
$links = array_map(function ($value) {
$matches = [];
preg_match('/\<(?P<link>.*)\>\; rel\=\"(?P<rel>.*)\"/', $value, $matches);
return $matches;
}, explode(', ', $links));
return Hash::combine($links, '{n}.rel', '{n}.link');
} | php | protected function _parseLinks($links)
{
$links = array_map(function ($value) {
$matches = [];
preg_match('/\<(?P<link>.*)\>\; rel\=\"(?P<rel>.*)\"/', $value, $matches);
return $matches;
}, explode(', ', $links));
return Hash::combine($links, '{n}.rel', '{n}.link');
} | [
"protected",
"function",
"_parseLinks",
"(",
"$",
"links",
")",
"{",
"$",
"links",
"=",
"array_map",
"(",
"function",
"(",
"$",
"value",
")",
"{",
"$",
"matches",
"=",
"[",
"]",
";",
"preg_match",
"(",
"'/\\<(?P<link>.*)\\>\\; rel\\=\\\"(?P<rel>.*)\\\"/'",
",",
"$",
"value",
",",
"$",
"matches",
")",
";",
"return",
"$",
"matches",
";",
"}",
",",
"explode",
"(",
"', '",
",",
"$",
"links",
")",
")",
";",
"return",
"Hash",
"::",
"combine",
"(",
"$",
"links",
",",
"'{n}.rel'",
",",
"'{n}.link'",
")",
";",
"}"
] | Parse Link headers from response.
@param array|null $links List of Link headers
@return array | [
"Parse",
"Link",
"headers",
"from",
"response",
"."
] | 43647e53fd87a3ab93fe2f24ce3686b594d36241 | https://github.com/CVO-Technologies/cakephp-github/blob/43647e53fd87a3ab93fe2f24ce3686b594d36241/src/Webservice/GitHubWebservice.php#L147-L157 |
31,932 | edmondscommerce/doctrine-static-meta | src/Entity/Factory/EntityDependencyInjector.php | EntityDependencyInjector.injectEntityDependencies | public function injectEntityDependencies(EntityInterface $entity): void
{
$this->buildEntityInjectMethodsForEntity($entity);
$entityFqn = $this->leadingSlash($entity::getDoctrineStaticMeta()->getReflectionClass()->getName());
$this->injectStatic($entity, $this->entityInjectMethods[$entityFqn][self::TYPE_KEY_STATIC]);
$this->inject($entity, $this->entityInjectMethods[$entityFqn][self::TYPE_KEY_INSTANCE]);
} | php | public function injectEntityDependencies(EntityInterface $entity): void
{
$this->buildEntityInjectMethodsForEntity($entity);
$entityFqn = $this->leadingSlash($entity::getDoctrineStaticMeta()->getReflectionClass()->getName());
$this->injectStatic($entity, $this->entityInjectMethods[$entityFqn][self::TYPE_KEY_STATIC]);
$this->inject($entity, $this->entityInjectMethods[$entityFqn][self::TYPE_KEY_INSTANCE]);
} | [
"public",
"function",
"injectEntityDependencies",
"(",
"EntityInterface",
"$",
"entity",
")",
":",
"void",
"{",
"$",
"this",
"->",
"buildEntityInjectMethodsForEntity",
"(",
"$",
"entity",
")",
";",
"$",
"entityFqn",
"=",
"$",
"this",
"->",
"leadingSlash",
"(",
"$",
"entity",
"::",
"getDoctrineStaticMeta",
"(",
")",
"->",
"getReflectionClass",
"(",
")",
"->",
"getName",
"(",
")",
")",
";",
"$",
"this",
"->",
"injectStatic",
"(",
"$",
"entity",
",",
"$",
"this",
"->",
"entityInjectMethods",
"[",
"$",
"entityFqn",
"]",
"[",
"self",
"::",
"TYPE_KEY_STATIC",
"]",
")",
";",
"$",
"this",
"->",
"inject",
"(",
"$",
"entity",
",",
"$",
"this",
"->",
"entityInjectMethods",
"[",
"$",
"entityFqn",
"]",
"[",
"self",
"::",
"TYPE_KEY_INSTANCE",
"]",
")",
";",
"}"
] | This method loops over the inject methods for an Entity and then injects the relevant dependencies
We match the method argument type with the dependency to be injected.
@param EntityInterface $entity | [
"This",
"method",
"loops",
"over",
"the",
"inject",
"methods",
"for",
"an",
"Entity",
"and",
"then",
"injects",
"the",
"relevant",
"dependencies"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/Factory/EntityDependencyInjector.php#L41-L47 |
31,933 | edmondscommerce/doctrine-static-meta | src/Entity/Factory/EntityDependencyInjector.php | EntityDependencyInjector.buildEntityInjectMethodsForEntity | private function buildEntityInjectMethodsForEntity(EntityInterface $entity): void
{
$reflection = $entity::getDoctrineStaticMeta()->getReflectionClass();
$entityFqn = $this->leadingSlash($reflection->getName());
if (array_key_exists($entityFqn, $this->entityInjectMethods)) {
return;
}
$this->entityInjectMethods[$entityFqn] = [
self::TYPE_KEY_INSTANCE => [],
self::TYPE_KEY_STATIC => [],
];
$methods = $reflection->getMethods(\ReflectionMethod::IS_PUBLIC);
foreach ($methods as $method) {
if (!\ts\stringStartsWith($method->getName(), self::INJECT_DEPENDENCY_METHOD_PREFIX)) {
continue;
}
$typeKey = $method->isStatic() ? self::TYPE_KEY_STATIC : self::TYPE_KEY_INSTANCE;
$this->entityInjectMethods[$entityFqn][$typeKey][$method->getName()] =
$this->getDependencyForInjectMethod($method);
}
} | php | private function buildEntityInjectMethodsForEntity(EntityInterface $entity): void
{
$reflection = $entity::getDoctrineStaticMeta()->getReflectionClass();
$entityFqn = $this->leadingSlash($reflection->getName());
if (array_key_exists($entityFqn, $this->entityInjectMethods)) {
return;
}
$this->entityInjectMethods[$entityFqn] = [
self::TYPE_KEY_INSTANCE => [],
self::TYPE_KEY_STATIC => [],
];
$methods = $reflection->getMethods(\ReflectionMethod::IS_PUBLIC);
foreach ($methods as $method) {
if (!\ts\stringStartsWith($method->getName(), self::INJECT_DEPENDENCY_METHOD_PREFIX)) {
continue;
}
$typeKey = $method->isStatic() ? self::TYPE_KEY_STATIC : self::TYPE_KEY_INSTANCE;
$this->entityInjectMethods[$entityFqn][$typeKey][$method->getName()] =
$this->getDependencyForInjectMethod($method);
}
} | [
"private",
"function",
"buildEntityInjectMethodsForEntity",
"(",
"EntityInterface",
"$",
"entity",
")",
":",
"void",
"{",
"$",
"reflection",
"=",
"$",
"entity",
"::",
"getDoctrineStaticMeta",
"(",
")",
"->",
"getReflectionClass",
"(",
")",
";",
"$",
"entityFqn",
"=",
"$",
"this",
"->",
"leadingSlash",
"(",
"$",
"reflection",
"->",
"getName",
"(",
")",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"entityFqn",
",",
"$",
"this",
"->",
"entityInjectMethods",
")",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"entityInjectMethods",
"[",
"$",
"entityFqn",
"]",
"=",
"[",
"self",
"::",
"TYPE_KEY_INSTANCE",
"=>",
"[",
"]",
",",
"self",
"::",
"TYPE_KEY_STATIC",
"=>",
"[",
"]",
",",
"]",
";",
"$",
"methods",
"=",
"$",
"reflection",
"->",
"getMethods",
"(",
"\\",
"ReflectionMethod",
"::",
"IS_PUBLIC",
")",
";",
"foreach",
"(",
"$",
"methods",
"as",
"$",
"method",
")",
"{",
"if",
"(",
"!",
"\\",
"ts",
"\\",
"stringStartsWith",
"(",
"$",
"method",
"->",
"getName",
"(",
")",
",",
"self",
"::",
"INJECT_DEPENDENCY_METHOD_PREFIX",
")",
")",
"{",
"continue",
";",
"}",
"$",
"typeKey",
"=",
"$",
"method",
"->",
"isStatic",
"(",
")",
"?",
"self",
"::",
"TYPE_KEY_STATIC",
":",
"self",
"::",
"TYPE_KEY_INSTANCE",
";",
"$",
"this",
"->",
"entityInjectMethods",
"[",
"$",
"entityFqn",
"]",
"[",
"$",
"typeKey",
"]",
"[",
"$",
"method",
"->",
"getName",
"(",
")",
"]",
"=",
"$",
"this",
"->",
"getDependencyForInjectMethod",
"(",
"$",
"method",
")",
";",
"}",
"}"
] | Build the array of entity methods to dependencies ready to be used for injection
@param EntityInterface $entity
@throws \ReflectionException | [
"Build",
"the",
"array",
"of",
"entity",
"methods",
"to",
"dependencies",
"ready",
"to",
"be",
"used",
"for",
"injection"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/Factory/EntityDependencyInjector.php#L56-L78 |
31,934 | edmondscommerce/doctrine-static-meta | src/EntityManager/RetryConnection/PingingAndReconnectingConnection.php | PingingAndReconnectingConnection.ping | public function ping(): bool
{
parent::connect();
if ($this->_conn instanceof Driver\PingableConnection) {
return $this->_conn->ping();
}
try {
parent::query($this->getDatabasePlatform()->getDummySelectSQL());
return true;
} catch (DBALException $e) {
return false;
}
} | php | public function ping(): bool
{
parent::connect();
if ($this->_conn instanceof Driver\PingableConnection) {
return $this->_conn->ping();
}
try {
parent::query($this->getDatabasePlatform()->getDummySelectSQL());
return true;
} catch (DBALException $e) {
return false;
}
} | [
"public",
"function",
"ping",
"(",
")",
":",
"bool",
"{",
"parent",
"::",
"connect",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"_conn",
"instanceof",
"Driver",
"\\",
"PingableConnection",
")",
"{",
"return",
"$",
"this",
"->",
"_conn",
"->",
"ping",
"(",
")",
";",
"}",
"try",
"{",
"parent",
"::",
"query",
"(",
"$",
"this",
"->",
"getDatabasePlatform",
"(",
")",
"->",
"getDummySelectSQL",
"(",
")",
")",
";",
"return",
"true",
";",
"}",
"catch",
"(",
"DBALException",
"$",
"e",
")",
"{",
"return",
"false",
";",
"}",
"}"
] | Overriding the ping method so we explicitly call the raw unwrapped methods as required, otherwise we go into
infinite loop
@return bool | [
"Overriding",
"the",
"ping",
"method",
"so",
"we",
"explicitly",
"call",
"the",
"raw",
"unwrapped",
"methods",
"as",
"required",
"otherwise",
"we",
"go",
"into",
"infinite",
"loop"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/EntityManager/RetryConnection/PingingAndReconnectingConnection.php#L87-L102 |
31,935 | edmondscommerce/doctrine-static-meta | src/EntityManager/RetryConnection/PingingAndReconnectingConnection.php | PingingAndReconnectingConnection.resetTransactionNestingLevel | private function resetTransactionNestingLevel(): void
{
if (!$this->selfReflectionNestingLevelProperty instanceof \ReflectionProperty) {
$reflection = new \ts\Reflection\ReflectionClass(Connection::class);
$this->selfReflectionNestingLevelProperty = $reflection->getProperty('transactionNestingLevel');
$this->selfReflectionNestingLevelProperty->setAccessible(true);
}
$this->selfReflectionNestingLevelProperty->setValue($this, 0);
} | php | private function resetTransactionNestingLevel(): void
{
if (!$this->selfReflectionNestingLevelProperty instanceof \ReflectionProperty) {
$reflection = new \ts\Reflection\ReflectionClass(Connection::class);
$this->selfReflectionNestingLevelProperty = $reflection->getProperty('transactionNestingLevel');
$this->selfReflectionNestingLevelProperty->setAccessible(true);
}
$this->selfReflectionNestingLevelProperty->setValue($this, 0);
} | [
"private",
"function",
"resetTransactionNestingLevel",
"(",
")",
":",
"void",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"selfReflectionNestingLevelProperty",
"instanceof",
"\\",
"ReflectionProperty",
")",
"{",
"$",
"reflection",
"=",
"new",
"\\",
"ts",
"\\",
"Reflection",
"\\",
"ReflectionClass",
"(",
"Connection",
"::",
"class",
")",
";",
"$",
"this",
"->",
"selfReflectionNestingLevelProperty",
"=",
"$",
"reflection",
"->",
"getProperty",
"(",
"'transactionNestingLevel'",
")",
";",
"$",
"this",
"->",
"selfReflectionNestingLevelProperty",
"->",
"setAccessible",
"(",
"true",
")",
";",
"}",
"$",
"this",
"->",
"selfReflectionNestingLevelProperty",
"->",
"setValue",
"(",
"$",
"this",
",",
"0",
")",
";",
"}"
] | This is required because beginTransaction increment _transactionNestingLevel
before the real query is executed, and results incremented also on gone away error.
This should be safe for a new established connection. | [
"This",
"is",
"required",
"because",
"beginTransaction",
"increment",
"_transactionNestingLevel",
"before",
"the",
"real",
"query",
"is",
"executed",
"and",
"results",
"incremented",
"also",
"on",
"gone",
"away",
"error",
".",
"This",
"should",
"be",
"safe",
"for",
"a",
"new",
"established",
"connection",
"."
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/EntityManager/RetryConnection/PingingAndReconnectingConnection.php#L110-L119 |
31,936 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopShippingTypeList.class.php | TShopShippingTypeList.& | public static function &GetAvailableTypes($iGroupId)
{
$shippingTypeDataAccess = self::getShippingTypeDataAccess();
$shopService = self::getShopService();
$oUser = self::getExtranetUserProvider()->getActiveUser();
$oShippingAddress = $oUser->GetShippingAddress();
$sActiveShippingCountryId = '';
if ($oShippingAddress) {
$sActiveShippingCountryId = $oShippingAddress->fieldDataCountryId;
}
if (true === empty($sActiveShippingCountryId)) {
// use default country
$oShop = $shopService->getActiveShop();
if ($oShop) {
$sActiveShippingCountryId = $oShop->fieldDataCountryId;
}
}
$rows = $shippingTypeDataAccess->getAvailableShippingTypes($iGroupId, $sActiveShippingCountryId, $shopService->getActiveBasket());
$idList = array();
$oBasket = TShopBasket::GetInstance();
$oBasket->ResetAllShippingMarkers(); // once we are done, we want to clear the marker again
foreach ($rows as $row) {
$item = TdbShopShippingType::GetNewInstance($row);
if ($item->IsAvailable()) {
$idList[] = $item->id;
}
}
$query = 'SELECT * FROM `shop_shipping_type` WHERE `id` IN (:idList) ORDER BY `position`';
$oList = new TdbShopShippingTypeList();
$oList->Load($query, array('idList' => $idList), array('idList' => Connection::PARAM_STR_ARRAY));
$oList->bAllowItemCache = true;
$oList->RemoveInvalidItems();
return $oList;
} | php | public static function &GetAvailableTypes($iGroupId)
{
$shippingTypeDataAccess = self::getShippingTypeDataAccess();
$shopService = self::getShopService();
$oUser = self::getExtranetUserProvider()->getActiveUser();
$oShippingAddress = $oUser->GetShippingAddress();
$sActiveShippingCountryId = '';
if ($oShippingAddress) {
$sActiveShippingCountryId = $oShippingAddress->fieldDataCountryId;
}
if (true === empty($sActiveShippingCountryId)) {
// use default country
$oShop = $shopService->getActiveShop();
if ($oShop) {
$sActiveShippingCountryId = $oShop->fieldDataCountryId;
}
}
$rows = $shippingTypeDataAccess->getAvailableShippingTypes($iGroupId, $sActiveShippingCountryId, $shopService->getActiveBasket());
$idList = array();
$oBasket = TShopBasket::GetInstance();
$oBasket->ResetAllShippingMarkers(); // once we are done, we want to clear the marker again
foreach ($rows as $row) {
$item = TdbShopShippingType::GetNewInstance($row);
if ($item->IsAvailable()) {
$idList[] = $item->id;
}
}
$query = 'SELECT * FROM `shop_shipping_type` WHERE `id` IN (:idList) ORDER BY `position`';
$oList = new TdbShopShippingTypeList();
$oList->Load($query, array('idList' => $idList), array('idList' => Connection::PARAM_STR_ARRAY));
$oList->bAllowItemCache = true;
$oList->RemoveInvalidItems();
return $oList;
} | [
"public",
"static",
"function",
"&",
"GetAvailableTypes",
"(",
"$",
"iGroupId",
")",
"{",
"$",
"shippingTypeDataAccess",
"=",
"self",
"::",
"getShippingTypeDataAccess",
"(",
")",
";",
"$",
"shopService",
"=",
"self",
"::",
"getShopService",
"(",
")",
";",
"$",
"oUser",
"=",
"self",
"::",
"getExtranetUserProvider",
"(",
")",
"->",
"getActiveUser",
"(",
")",
";",
"$",
"oShippingAddress",
"=",
"$",
"oUser",
"->",
"GetShippingAddress",
"(",
")",
";",
"$",
"sActiveShippingCountryId",
"=",
"''",
";",
"if",
"(",
"$",
"oShippingAddress",
")",
"{",
"$",
"sActiveShippingCountryId",
"=",
"$",
"oShippingAddress",
"->",
"fieldDataCountryId",
";",
"}",
"if",
"(",
"true",
"===",
"empty",
"(",
"$",
"sActiveShippingCountryId",
")",
")",
"{",
"// use default country",
"$",
"oShop",
"=",
"$",
"shopService",
"->",
"getActiveShop",
"(",
")",
";",
"if",
"(",
"$",
"oShop",
")",
"{",
"$",
"sActiveShippingCountryId",
"=",
"$",
"oShop",
"->",
"fieldDataCountryId",
";",
"}",
"}",
"$",
"rows",
"=",
"$",
"shippingTypeDataAccess",
"->",
"getAvailableShippingTypes",
"(",
"$",
"iGroupId",
",",
"$",
"sActiveShippingCountryId",
",",
"$",
"shopService",
"->",
"getActiveBasket",
"(",
")",
")",
";",
"$",
"idList",
"=",
"array",
"(",
")",
";",
"$",
"oBasket",
"=",
"TShopBasket",
"::",
"GetInstance",
"(",
")",
";",
"$",
"oBasket",
"->",
"ResetAllShippingMarkers",
"(",
")",
";",
"// once we are done, we want to clear the marker again",
"foreach",
"(",
"$",
"rows",
"as",
"$",
"row",
")",
"{",
"$",
"item",
"=",
"TdbShopShippingType",
"::",
"GetNewInstance",
"(",
"$",
"row",
")",
";",
"if",
"(",
"$",
"item",
"->",
"IsAvailable",
"(",
")",
")",
"{",
"$",
"idList",
"[",
"]",
"=",
"$",
"item",
"->",
"id",
";",
"}",
"}",
"$",
"query",
"=",
"'SELECT * FROM `shop_shipping_type` WHERE `id` IN (:idList) ORDER BY `position`'",
";",
"$",
"oList",
"=",
"new",
"TdbShopShippingTypeList",
"(",
")",
";",
"$",
"oList",
"->",
"Load",
"(",
"$",
"query",
",",
"array",
"(",
"'idList'",
"=>",
"$",
"idList",
")",
",",
"array",
"(",
"'idList'",
"=>",
"Connection",
"::",
"PARAM_STR_ARRAY",
")",
")",
";",
"$",
"oList",
"->",
"bAllowItemCache",
"=",
"true",
";",
"$",
"oList",
"->",
"RemoveInvalidItems",
"(",
")",
";",
"return",
"$",
"oList",
";",
"}"
] | return list of shipping types that match the given group, the current basket,
and the current user.
@param int $iGroupId
@return TdbShopShippingTypeList | [
"return",
"list",
"of",
"shipping",
"types",
"that",
"match",
"the",
"given",
"group",
"the",
"current",
"basket",
"and",
"the",
"current",
"user",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopShippingTypeList.class.php#L53-L91 |
31,937 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopShippingTypeList.class.php | TShopShippingTypeList.& | public static function &GetPublicShippingTypes($iGroupId)
{
$query = "SELECT `shop_shipping_type`.*
FROM `shop_shipping_type`
INNER JOIN `shop_shipping_group_shop_shipping_type_mlt` ON `shop_shipping_type`.`id` = `shop_shipping_group_shop_shipping_type_mlt`.`target_id`
WHERE `shop_shipping_group_shop_shipping_type_mlt`.`source_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($iGroupId)."'
";
$oList = &TdbShopShippingTypeList::GetList($query);
$oList->RemoveRestrictedItems();
return $oList;
} | php | public static function &GetPublicShippingTypes($iGroupId)
{
$query = "SELECT `shop_shipping_type`.*
FROM `shop_shipping_type`
INNER JOIN `shop_shipping_group_shop_shipping_type_mlt` ON `shop_shipping_type`.`id` = `shop_shipping_group_shop_shipping_type_mlt`.`target_id`
WHERE `shop_shipping_group_shop_shipping_type_mlt`.`source_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($iGroupId)."'
";
$oList = &TdbShopShippingTypeList::GetList($query);
$oList->RemoveRestrictedItems();
return $oList;
} | [
"public",
"static",
"function",
"&",
"GetPublicShippingTypes",
"(",
"$",
"iGroupId",
")",
"{",
"$",
"query",
"=",
"\"SELECT `shop_shipping_type`.*\n FROM `shop_shipping_type`\n INNER JOIN `shop_shipping_group_shop_shipping_type_mlt` ON `shop_shipping_type`.`id` = `shop_shipping_group_shop_shipping_type_mlt`.`target_id`\n WHERE `shop_shipping_group_shop_shipping_type_mlt`.`source_id` = '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"iGroupId",
")",
".",
"\"'\n \"",
";",
"$",
"oList",
"=",
"&",
"TdbShopShippingTypeList",
"::",
"GetList",
"(",
"$",
"query",
")",
";",
"$",
"oList",
"->",
"RemoveRestrictedItems",
"(",
")",
";",
"return",
"$",
"oList",
";",
"}"
] | return all public shipping types for a given shipping group.
@param int $iGroupId
@return TdbShopShippingTypeList | [
"return",
"all",
"public",
"shipping",
"types",
"for",
"a",
"given",
"shipping",
"group",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopShippingTypeList.class.php#L100-L112 |
31,938 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopShippingTypeList.class.php | TShopShippingTypeList.RemoveRestrictedItems | public function RemoveRestrictedItems()
{
// since this is a tcmsrecord list, we need to collect all valid ids, and the reload the list with them
$aValidIds = array();
$this->GoToStart();
while ($oItem = &$this->Next()) {
if ($oItem->IsPublic()) {
$aValidIds[] = MySqlLegacySupport::getInstance()->real_escape_string($oItem->id);
}
}
$query = 'SELECT `shop_shipping_type`.*
FROM `shop_shipping_type`
WHERE ';
if (count($aValidIds) > 0) {
$query .= " `shop_shipping_type`.`id` IN ('".implode("','", $aValidIds)."') ";
} else {
$query .= ' 1 = 0 ';
}
$query .= ' ORDER BY `shop_shipping_type`.`position`';
$this->Load($query);
} | php | public function RemoveRestrictedItems()
{
// since this is a tcmsrecord list, we need to collect all valid ids, and the reload the list with them
$aValidIds = array();
$this->GoToStart();
while ($oItem = &$this->Next()) {
if ($oItem->IsPublic()) {
$aValidIds[] = MySqlLegacySupport::getInstance()->real_escape_string($oItem->id);
}
}
$query = 'SELECT `shop_shipping_type`.*
FROM `shop_shipping_type`
WHERE ';
if (count($aValidIds) > 0) {
$query .= " `shop_shipping_type`.`id` IN ('".implode("','", $aValidIds)."') ";
} else {
$query .= ' 1 = 0 ';
}
$query .= ' ORDER BY `shop_shipping_type`.`position`';
$this->Load($query);
} | [
"public",
"function",
"RemoveRestrictedItems",
"(",
")",
"{",
"// since this is a tcmsrecord list, we need to collect all valid ids, and the reload the list with them",
"$",
"aValidIds",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"GoToStart",
"(",
")",
";",
"while",
"(",
"$",
"oItem",
"=",
"&",
"$",
"this",
"->",
"Next",
"(",
")",
")",
"{",
"if",
"(",
"$",
"oItem",
"->",
"IsPublic",
"(",
")",
")",
"{",
"$",
"aValidIds",
"[",
"]",
"=",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"oItem",
"->",
"id",
")",
";",
"}",
"}",
"$",
"query",
"=",
"'SELECT `shop_shipping_type`.*\n FROM `shop_shipping_type`\n WHERE '",
";",
"if",
"(",
"count",
"(",
"$",
"aValidIds",
")",
">",
"0",
")",
"{",
"$",
"query",
".=",
"\" `shop_shipping_type`.`id` IN ('\"",
".",
"implode",
"(",
"\"','\"",
",",
"$",
"aValidIds",
")",
".",
"\"') \"",
";",
"}",
"else",
"{",
"$",
"query",
".=",
"' 1 = 0 '",
";",
"}",
"$",
"query",
".=",
"' ORDER BY `shop_shipping_type`.`position`'",
";",
"$",
"this",
"->",
"Load",
"(",
"$",
"query",
")",
";",
"}"
] | remove list items that are restricted to some user or user group. | [
"remove",
"list",
"items",
"that",
"are",
"restricted",
"to",
"some",
"user",
"or",
"user",
"group",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopShippingTypeList.class.php#L150-L171 |
31,939 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Samples/NotificationSample.php | OffAmazonPaymentsNotifications_Samples_NotificationSample.logNotification | public function logNotification()
{
try {
$this->logNotificationContents();
$this->ipnLogFile->writeLine("=============================================================================");
$this->ipnLogFile->closeFile();
} catch (Exception $ex){
error_log($ex->getMessage());
}
} | php | public function logNotification()
{
try {
$this->logNotificationContents();
$this->ipnLogFile->writeLine("=============================================================================");
$this->ipnLogFile->closeFile();
} catch (Exception $ex){
error_log($ex->getMessage());
}
} | [
"public",
"function",
"logNotification",
"(",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"logNotificationContents",
"(",
")",
";",
"$",
"this",
"->",
"ipnLogFile",
"->",
"writeLine",
"(",
"\"=============================================================================\"",
")",
";",
"$",
"this",
"->",
"ipnLogFile",
"->",
"closeFile",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"$",
"ex",
")",
"{",
"error_log",
"(",
"$",
"ex",
"->",
"getMessage",
"(",
")",
")",
";",
"}",
"}"
] | Log the notification to the file
@return void | [
"Log",
"the",
"notification",
"to",
"the",
"file"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Samples/NotificationSample.php#L79-L88 |
31,940 | sylingd/Yesf | src/Connection/Pool.php | Pool.get | public static function get($config = null) {
if (!isset($config['driver'])) {
throw new ConnectionException("Unknown driver");
}
if (!isset($config['host']) || !isset($config['port'])) {
throw new ConnectionException("Host and Port is required");
}
$type = $config['driver'];
$hash = md5($type . ':' . $config['host'] . ':' . $config['port']);
if (!isset(self::$created_driver[$hash])) {
if (isset(self::$driver[$type])) {
$className = self::$driver[$type];
} else {
$className = __NAMESPACE__ . '\\Driver\\' . ucfirst($type);
}
self::$created_driver[$hash] = new $className($config);
}
return self::$created_driver[$hash];
} | php | public static function get($config = null) {
if (!isset($config['driver'])) {
throw new ConnectionException("Unknown driver");
}
if (!isset($config['host']) || !isset($config['port'])) {
throw new ConnectionException("Host and Port is required");
}
$type = $config['driver'];
$hash = md5($type . ':' . $config['host'] . ':' . $config['port']);
if (!isset(self::$created_driver[$hash])) {
if (isset(self::$driver[$type])) {
$className = self::$driver[$type];
} else {
$className = __NAMESPACE__ . '\\Driver\\' . ucfirst($type);
}
self::$created_driver[$hash] = new $className($config);
}
return self::$created_driver[$hash];
} | [
"public",
"static",
"function",
"get",
"(",
"$",
"config",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"config",
"[",
"'driver'",
"]",
")",
")",
"{",
"throw",
"new",
"ConnectionException",
"(",
"\"Unknown driver\"",
")",
";",
"}",
"if",
"(",
"!",
"isset",
"(",
"$",
"config",
"[",
"'host'",
"]",
")",
"||",
"!",
"isset",
"(",
"$",
"config",
"[",
"'port'",
"]",
")",
")",
"{",
"throw",
"new",
"ConnectionException",
"(",
"\"Host and Port is required\"",
")",
";",
"}",
"$",
"type",
"=",
"$",
"config",
"[",
"'driver'",
"]",
";",
"$",
"hash",
"=",
"md5",
"(",
"$",
"type",
".",
"':'",
".",
"$",
"config",
"[",
"'host'",
"]",
".",
"':'",
".",
"$",
"config",
"[",
"'port'",
"]",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"created_driver",
"[",
"$",
"hash",
"]",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"self",
"::",
"$",
"driver",
"[",
"$",
"type",
"]",
")",
")",
"{",
"$",
"className",
"=",
"self",
"::",
"$",
"driver",
"[",
"$",
"type",
"]",
";",
"}",
"else",
"{",
"$",
"className",
"=",
"__NAMESPACE__",
".",
"'\\\\Driver\\\\'",
".",
"ucfirst",
"(",
"$",
"type",
")",
";",
"}",
"self",
"::",
"$",
"created_driver",
"[",
"$",
"hash",
"]",
"=",
"new",
"$",
"className",
"(",
"$",
"config",
")",
";",
"}",
"return",
"self",
"::",
"$",
"created_driver",
"[",
"$",
"hash",
"]",
";",
"}"
] | Get a connection
@access public
@param mixed $config
@return object | [
"Get",
"a",
"connection"
] | 0fc2b42903bb3519c54c596270c890c826aeb1df | https://github.com/sylingd/Yesf/blob/0fc2b42903bb3519c54c596270c890c826aeb1df/src/Connection/Pool.php#L70-L88 |
31,941 | chameleon-system/chameleon-shop | src/ImageHotspotBundle/objects/db/TPkgImageHotspotItemMarker.class.php | TPkgImageHotspotItemMarker.GetURLForConnectedRecord | public function GetURLForConnectedRecord()
{
$oSpotObject = &$this->GetFieldLinkedRecord();
$oCmsConfig = &TdbCmsConfig::GetInstance();
$sLink = $this->fieldUrl;
if (is_object($oSpotObject)) {
if ($oSpotObject instanceof TdbCmsTplPage) {
$sLink = $this->getPageService()->getLinkToPageObjectRelative($oSpotObject);
} elseif ($oSpotObject instanceof TdbShopArticle) {
$sLink = $oSpotObject->GetDetailLink();
} elseif ($oSpotObject instanceof TdbShopCategory) {
$sLink = $oSpotObject->GetLink();
} elseif ($oCmsConfig->GetConfigParameter('pkgArticle', false, true)) {
if ($oSpotObject instanceof TPkgArticle_BreadcrumbItem) {
$sLink = $oSpotObject->GetLink();
} elseif ($oSpotObject instanceof TPkgArticleCategory_BreadcrumbItem) {
$sLink = $oSpotObject->GetLink();
} elseif ($oSpotObject instanceof TdbPkgArticle) {
$sLink = $oSpotObject->GetLinkDetailPage();
} elseif ($oSpotObject instanceof TdbPkgArticleCategory) {
$sLink = $oSpotObject->GetURL();
}
} else { //nothing that we know matched - try to use generic method
$sLink = $oSpotObject->GetURL();
// still no url? trigger a user error
if (empty($sLink)) {
trigger_error("couldn't get url from connected record object make sure you implement a method for fetching the url - maybe you have to extend ".__CLASS__.' and overwrite the method GetLinkFromConnectedRecord()', E_USER_ERROR);
}
}
}
return $sLink;
} | php | public function GetURLForConnectedRecord()
{
$oSpotObject = &$this->GetFieldLinkedRecord();
$oCmsConfig = &TdbCmsConfig::GetInstance();
$sLink = $this->fieldUrl;
if (is_object($oSpotObject)) {
if ($oSpotObject instanceof TdbCmsTplPage) {
$sLink = $this->getPageService()->getLinkToPageObjectRelative($oSpotObject);
} elseif ($oSpotObject instanceof TdbShopArticle) {
$sLink = $oSpotObject->GetDetailLink();
} elseif ($oSpotObject instanceof TdbShopCategory) {
$sLink = $oSpotObject->GetLink();
} elseif ($oCmsConfig->GetConfigParameter('pkgArticle', false, true)) {
if ($oSpotObject instanceof TPkgArticle_BreadcrumbItem) {
$sLink = $oSpotObject->GetLink();
} elseif ($oSpotObject instanceof TPkgArticleCategory_BreadcrumbItem) {
$sLink = $oSpotObject->GetLink();
} elseif ($oSpotObject instanceof TdbPkgArticle) {
$sLink = $oSpotObject->GetLinkDetailPage();
} elseif ($oSpotObject instanceof TdbPkgArticleCategory) {
$sLink = $oSpotObject->GetURL();
}
} else { //nothing that we know matched - try to use generic method
$sLink = $oSpotObject->GetURL();
// still no url? trigger a user error
if (empty($sLink)) {
trigger_error("couldn't get url from connected record object make sure you implement a method for fetching the url - maybe you have to extend ".__CLASS__.' and overwrite the method GetLinkFromConnectedRecord()', E_USER_ERROR);
}
}
}
return $sLink;
} | [
"public",
"function",
"GetURLForConnectedRecord",
"(",
")",
"{",
"$",
"oSpotObject",
"=",
"&",
"$",
"this",
"->",
"GetFieldLinkedRecord",
"(",
")",
";",
"$",
"oCmsConfig",
"=",
"&",
"TdbCmsConfig",
"::",
"GetInstance",
"(",
")",
";",
"$",
"sLink",
"=",
"$",
"this",
"->",
"fieldUrl",
";",
"if",
"(",
"is_object",
"(",
"$",
"oSpotObject",
")",
")",
"{",
"if",
"(",
"$",
"oSpotObject",
"instanceof",
"TdbCmsTplPage",
")",
"{",
"$",
"sLink",
"=",
"$",
"this",
"->",
"getPageService",
"(",
")",
"->",
"getLinkToPageObjectRelative",
"(",
"$",
"oSpotObject",
")",
";",
"}",
"elseif",
"(",
"$",
"oSpotObject",
"instanceof",
"TdbShopArticle",
")",
"{",
"$",
"sLink",
"=",
"$",
"oSpotObject",
"->",
"GetDetailLink",
"(",
")",
";",
"}",
"elseif",
"(",
"$",
"oSpotObject",
"instanceof",
"TdbShopCategory",
")",
"{",
"$",
"sLink",
"=",
"$",
"oSpotObject",
"->",
"GetLink",
"(",
")",
";",
"}",
"elseif",
"(",
"$",
"oCmsConfig",
"->",
"GetConfigParameter",
"(",
"'pkgArticle'",
",",
"false",
",",
"true",
")",
")",
"{",
"if",
"(",
"$",
"oSpotObject",
"instanceof",
"TPkgArticle_BreadcrumbItem",
")",
"{",
"$",
"sLink",
"=",
"$",
"oSpotObject",
"->",
"GetLink",
"(",
")",
";",
"}",
"elseif",
"(",
"$",
"oSpotObject",
"instanceof",
"TPkgArticleCategory_BreadcrumbItem",
")",
"{",
"$",
"sLink",
"=",
"$",
"oSpotObject",
"->",
"GetLink",
"(",
")",
";",
"}",
"elseif",
"(",
"$",
"oSpotObject",
"instanceof",
"TdbPkgArticle",
")",
"{",
"$",
"sLink",
"=",
"$",
"oSpotObject",
"->",
"GetLinkDetailPage",
"(",
")",
";",
"}",
"elseif",
"(",
"$",
"oSpotObject",
"instanceof",
"TdbPkgArticleCategory",
")",
"{",
"$",
"sLink",
"=",
"$",
"oSpotObject",
"->",
"GetURL",
"(",
")",
";",
"}",
"}",
"else",
"{",
"//nothing that we know matched - try to use generic method",
"$",
"sLink",
"=",
"$",
"oSpotObject",
"->",
"GetURL",
"(",
")",
";",
"// still no url? trigger a user error",
"if",
"(",
"empty",
"(",
"$",
"sLink",
")",
")",
"{",
"trigger_error",
"(",
"\"couldn't get url from connected record object make sure you implement a method for fetching the url - maybe you have to extend \"",
".",
"__CLASS__",
".",
"' and overwrite the method GetLinkFromConnectedRecord()'",
",",
"E_USER_ERROR",
")",
";",
"}",
"}",
"}",
"return",
"$",
"sLink",
";",
"}"
] | fetches the connected record and tries to get a url from that.
@return string | [
"fetches",
"the",
"connected",
"record",
"and",
"tries",
"to",
"get",
"a",
"url",
"from",
"that",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ImageHotspotBundle/objects/db/TPkgImageHotspotItemMarker.class.php#L53-L85 |
31,942 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopUnitOfMeasurement.class.php | TShopUnitOfMeasurement.GetBasePrice | public function GetBasePrice($sourcePrice, $sourceQuantity)
{
if (empty($this->fieldFactor)) {
$factor = 1;
} else {
$factor = $this->fieldFactor;
}
// 4€ = 500ml; 4€ = 500(0,001)L; 4/(500*0,001)€ = 1L; 4/0,5€=1L; 8€ = 1L
$conversionFactor = $sourceQuantity * $factor;
if ($conversionFactor < 0.000001 && $conversionFactor > -0.000001) {
$basePrice = $sourcePrice;
} else {
$basePrice = $sourcePrice / $conversionFactor;
}
return $basePrice;
} | php | public function GetBasePrice($sourcePrice, $sourceQuantity)
{
if (empty($this->fieldFactor)) {
$factor = 1;
} else {
$factor = $this->fieldFactor;
}
// 4€ = 500ml; 4€ = 500(0,001)L; 4/(500*0,001)€ = 1L; 4/0,5€=1L; 8€ = 1L
$conversionFactor = $sourceQuantity * $factor;
if ($conversionFactor < 0.000001 && $conversionFactor > -0.000001) {
$basePrice = $sourcePrice;
} else {
$basePrice = $sourcePrice / $conversionFactor;
}
return $basePrice;
} | [
"public",
"function",
"GetBasePrice",
"(",
"$",
"sourcePrice",
",",
"$",
"sourceQuantity",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"fieldFactor",
")",
")",
"{",
"$",
"factor",
"=",
"1",
";",
"}",
"else",
"{",
"$",
"factor",
"=",
"$",
"this",
"->",
"fieldFactor",
";",
"}",
"// 4€ = 500ml; 4€ = 500(0,001)L; 4/(500*0,001)€ = 1L; 4/0,5€=1L; 8€ = 1L",
"$",
"conversionFactor",
"=",
"$",
"sourceQuantity",
"*",
"$",
"factor",
";",
"if",
"(",
"$",
"conversionFactor",
"<",
"0.000001",
"&&",
"$",
"conversionFactor",
">",
"-",
"0.000001",
")",
"{",
"$",
"basePrice",
"=",
"$",
"sourcePrice",
";",
"}",
"else",
"{",
"$",
"basePrice",
"=",
"$",
"sourcePrice",
"/",
"$",
"conversionFactor",
";",
"}",
"return",
"$",
"basePrice",
";",
"}"
] | Returns the base price for the source price.
@param float $sourcePrice
@param float $sourceQuantity
@return float | [
"Returns",
"the",
"base",
"price",
"for",
"the",
"source",
"price",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopUnitOfMeasurement.class.php#L25-L41 |
31,943 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticle.class.php | TShopArticle.& | public function &GetContributorList($aContributorTypes)
{
if (!is_array($aContributorTypes)) {
$aContributorTypes = array($aContributorTypes);
}
$aContributorTypes = TTools::MysqlRealEscapeArray($aContributorTypes);
$sQuery = "SELECT `shop_contributor`.*
FROM `shop_article_contributor`
LEFT JOIN `shop_contributor` ON `shop_article_contributor`.`shop_contributor_id` = `shop_contributor`.`id`
LEFT JOIN `shop_contributor_type` ON `shop_article_contributor`.`shop_contributor_type_id` = `shop_contributor_type`.`id`
WHERE `shop_contributor_type`.`identifier` in ('".implode("', '", $aContributorTypes)."')
AND `shop_article_contributor`.`shop_article_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."'
ORDER BY `shop_article_contributor`.`position`
";
return TdbShopContributorList::GetList($sQuery);
} | php | public function &GetContributorList($aContributorTypes)
{
if (!is_array($aContributorTypes)) {
$aContributorTypes = array($aContributorTypes);
}
$aContributorTypes = TTools::MysqlRealEscapeArray($aContributorTypes);
$sQuery = "SELECT `shop_contributor`.*
FROM `shop_article_contributor`
LEFT JOIN `shop_contributor` ON `shop_article_contributor`.`shop_contributor_id` = `shop_contributor`.`id`
LEFT JOIN `shop_contributor_type` ON `shop_article_contributor`.`shop_contributor_type_id` = `shop_contributor_type`.`id`
WHERE `shop_contributor_type`.`identifier` in ('".implode("', '", $aContributorTypes)."')
AND `shop_article_contributor`.`shop_article_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."'
ORDER BY `shop_article_contributor`.`position`
";
return TdbShopContributorList::GetList($sQuery);
} | [
"public",
"function",
"&",
"GetContributorList",
"(",
"$",
"aContributorTypes",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"aContributorTypes",
")",
")",
"{",
"$",
"aContributorTypes",
"=",
"array",
"(",
"$",
"aContributorTypes",
")",
";",
"}",
"$",
"aContributorTypes",
"=",
"TTools",
"::",
"MysqlRealEscapeArray",
"(",
"$",
"aContributorTypes",
")",
";",
"$",
"sQuery",
"=",
"\"SELECT `shop_contributor`.*\n FROM `shop_article_contributor`\n LEFT JOIN `shop_contributor` ON `shop_article_contributor`.`shop_contributor_id` = `shop_contributor`.`id`\n LEFT JOIN `shop_contributor_type` ON `shop_article_contributor`.`shop_contributor_type_id` = `shop_contributor_type`.`id`\n WHERE `shop_contributor_type`.`identifier` in ('\"",
".",
"implode",
"(",
"\"', '\"",
",",
"$",
"aContributorTypes",
")",
".",
"\"')\n AND `shop_article_contributor`.`shop_article_id` = '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"this",
"->",
"id",
")",
".",
"\"'\n ORDER BY `shop_article_contributor`.`position`\n \"",
";",
"return",
"TdbShopContributorList",
"::",
"GetList",
"(",
"$",
"sQuery",
")",
";",
"}"
] | Returns Contributors for article for given types.
@param array $aContributorTypes (from field 'identifier')
@return TdbShopContributorList | [
"Returns",
"Contributors",
"for",
"article",
"for",
"given",
"types",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L91-L107 |
31,944 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticle.class.php | TShopArticle.GetBasePrice | public function GetBasePrice()
{
$dBasePrice = $this->GetFromInternalCache('dBasePrice');
if (is_null($dBasePrice)) {
$dBasePrice = false;
$oUnitsOfMeasurement = $this->GetFieldShopUnitOfMeasurement();
if ($oUnitsOfMeasurement) {
$dBasePrice = $oUnitsOfMeasurement->GetBasePrice($this->dPrice, $this->fieldQuantityInUnits);
}
$this->SetInternalCache('dBasePrice', $dBasePrice);
}
return $dBasePrice;
} | php | public function GetBasePrice()
{
$dBasePrice = $this->GetFromInternalCache('dBasePrice');
if (is_null($dBasePrice)) {
$dBasePrice = false;
$oUnitsOfMeasurement = $this->GetFieldShopUnitOfMeasurement();
if ($oUnitsOfMeasurement) {
$dBasePrice = $oUnitsOfMeasurement->GetBasePrice($this->dPrice, $this->fieldQuantityInUnits);
}
$this->SetInternalCache('dBasePrice', $dBasePrice);
}
return $dBasePrice;
} | [
"public",
"function",
"GetBasePrice",
"(",
")",
"{",
"$",
"dBasePrice",
"=",
"$",
"this",
"->",
"GetFromInternalCache",
"(",
"'dBasePrice'",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"dBasePrice",
")",
")",
"{",
"$",
"dBasePrice",
"=",
"false",
";",
"$",
"oUnitsOfMeasurement",
"=",
"$",
"this",
"->",
"GetFieldShopUnitOfMeasurement",
"(",
")",
";",
"if",
"(",
"$",
"oUnitsOfMeasurement",
")",
"{",
"$",
"dBasePrice",
"=",
"$",
"oUnitsOfMeasurement",
"->",
"GetBasePrice",
"(",
"$",
"this",
"->",
"dPrice",
",",
"$",
"this",
"->",
"fieldQuantityInUnits",
")",
";",
"}",
"$",
"this",
"->",
"SetInternalCache",
"(",
"'dBasePrice'",
",",
"$",
"dBasePrice",
")",
";",
"}",
"return",
"$",
"dBasePrice",
";",
"}"
] | return the base price for 1 base unit as defined through the shop_unit_of_measurement and quantity_in_units.
@return float|bool | [
"return",
"the",
"base",
"price",
"for",
"1",
"base",
"unit",
"as",
"defined",
"through",
"the",
"shop_unit_of_measurement",
"and",
"quantity_in_units",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L124-L137 |
31,945 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticle.class.php | TShopArticle.& | public function &GetReviewsPublished()
{
$oReviews = $this->GetFromInternalCache('oPublishedReviews');
if (is_null($oReviews)) {
$oReviews = &TdbShopArticleReviewList::GetPublishedReviews($this->id, $this->iLanguageId);
$this->SetInternalCache('oPublishedReviews', $oReviews);
}
return $oReviews;
} | php | public function &GetReviewsPublished()
{
$oReviews = $this->GetFromInternalCache('oPublishedReviews');
if (is_null($oReviews)) {
$oReviews = &TdbShopArticleReviewList::GetPublishedReviews($this->id, $this->iLanguageId);
$this->SetInternalCache('oPublishedReviews', $oReviews);
}
return $oReviews;
} | [
"public",
"function",
"&",
"GetReviewsPublished",
"(",
")",
"{",
"$",
"oReviews",
"=",
"$",
"this",
"->",
"GetFromInternalCache",
"(",
"'oPublishedReviews'",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"oReviews",
")",
")",
"{",
"$",
"oReviews",
"=",
"&",
"TdbShopArticleReviewList",
"::",
"GetPublishedReviews",
"(",
"$",
"this",
"->",
"id",
",",
"$",
"this",
"->",
"iLanguageId",
")",
";",
"$",
"this",
"->",
"SetInternalCache",
"(",
"'oPublishedReviews'",
",",
"$",
"oReviews",
")",
";",
"}",
"return",
"$",
"oReviews",
";",
"}"
] | return all published reviews for the article.
@return TdbShopArticleReviewList | [
"return",
"all",
"published",
"reviews",
"for",
"the",
"article",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L144-L153 |
31,946 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticle.class.php | TShopArticle.GetReviewAverageScore | public function GetReviewAverageScore($bRecount = false)
{
if ($bRecount) {
$oReviews = $this->GetReviewsPublished();
return $oReviews->GetAverageScore();
} else {
return $this->getProductStatsService()->getStats($this->id)->getReviewAverage();
}
} | php | public function GetReviewAverageScore($bRecount = false)
{
if ($bRecount) {
$oReviews = $this->GetReviewsPublished();
return $oReviews->GetAverageScore();
} else {
return $this->getProductStatsService()->getStats($this->id)->getReviewAverage();
}
} | [
"public",
"function",
"GetReviewAverageScore",
"(",
"$",
"bRecount",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"bRecount",
")",
"{",
"$",
"oReviews",
"=",
"$",
"this",
"->",
"GetReviewsPublished",
"(",
")",
";",
"return",
"$",
"oReviews",
"->",
"GetAverageScore",
"(",
")",
";",
"}",
"else",
"{",
"return",
"$",
"this",
"->",
"getProductStatsService",
"(",
")",
"->",
"getStats",
"(",
"$",
"this",
"->",
"id",
")",
"->",
"getReviewAverage",
"(",
")",
";",
"}",
"}"
] | return the average rating of the article based on the customer reviews for the article.
@param bool $bRecount - force a recount of the actual data
@return float | [
"return",
"the",
"average",
"rating",
"of",
"the",
"article",
"based",
"on",
"the",
"customer",
"reviews",
"for",
"the",
"article",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L162-L171 |
31,947 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticle.class.php | TShopArticle.GetVat | public function GetVat()
{
$oVat = $this->GetFromInternalCache('ovat');
if (is_null($oVat)) {
$oVat = $this->getOwnVat();
if (is_null($oVat)) {
// try to fetch from article group
$oArticleGroups = $this->GetArticleGroups();
$oVat = $oArticleGroups->GetMaxVat();
}
if (is_null($oVat)) {
// try to fetch from category
$oCategories = $this->GetFieldShopCategoryList();
$oVat = $oCategories->GetMaxVat();
}
if (is_null($oVat)) {
// try to fetch from shop
$oShopConfig = TdbShop::GetInstance();
$oVat = $oShopConfig->GetVat();
}
$this->SetInternalCache('ovat', $oVat);
}
return $oVat;
} | php | public function GetVat()
{
$oVat = $this->GetFromInternalCache('ovat');
if (is_null($oVat)) {
$oVat = $this->getOwnVat();
if (is_null($oVat)) {
// try to fetch from article group
$oArticleGroups = $this->GetArticleGroups();
$oVat = $oArticleGroups->GetMaxVat();
}
if (is_null($oVat)) {
// try to fetch from category
$oCategories = $this->GetFieldShopCategoryList();
$oVat = $oCategories->GetMaxVat();
}
if (is_null($oVat)) {
// try to fetch from shop
$oShopConfig = TdbShop::GetInstance();
$oVat = $oShopConfig->GetVat();
}
$this->SetInternalCache('ovat', $oVat);
}
return $oVat;
} | [
"public",
"function",
"GetVat",
"(",
")",
"{",
"$",
"oVat",
"=",
"$",
"this",
"->",
"GetFromInternalCache",
"(",
"'ovat'",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"oVat",
")",
")",
"{",
"$",
"oVat",
"=",
"$",
"this",
"->",
"getOwnVat",
"(",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"oVat",
")",
")",
"{",
"// try to fetch from article group",
"$",
"oArticleGroups",
"=",
"$",
"this",
"->",
"GetArticleGroups",
"(",
")",
";",
"$",
"oVat",
"=",
"$",
"oArticleGroups",
"->",
"GetMaxVat",
"(",
")",
";",
"}",
"if",
"(",
"is_null",
"(",
"$",
"oVat",
")",
")",
"{",
"// try to fetch from category",
"$",
"oCategories",
"=",
"$",
"this",
"->",
"GetFieldShopCategoryList",
"(",
")",
";",
"$",
"oVat",
"=",
"$",
"oCategories",
"->",
"GetMaxVat",
"(",
")",
";",
"}",
"if",
"(",
"is_null",
"(",
"$",
"oVat",
")",
")",
"{",
"// try to fetch from shop",
"$",
"oShopConfig",
"=",
"TdbShop",
"::",
"GetInstance",
"(",
")",
";",
"$",
"oVat",
"=",
"$",
"oShopConfig",
"->",
"GetVat",
"(",
")",
";",
"}",
"$",
"this",
"->",
"SetInternalCache",
"(",
"'ovat'",
",",
"$",
"oVat",
")",
";",
"}",
"return",
"$",
"oVat",
";",
"}"
] | return the vat group of the article.
@return TdbShopVat | [
"return",
"the",
"vat",
"group",
"of",
"the",
"article",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L196-L222 |
31,948 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticle.class.php | TShopArticle.getLink | public function getLink($bAbsolute = false, $sAnchor = null, $aOptionalParameters = array(), \TdbCmsPortal $portal = null, \TdbCmsLanguage $language = null)
{
// if no category is given, fetch the first category of the article
$shopService = $this->getShopService();
$oShop = $shopService->getActiveShop();
$sCategoryId = null;
if (true === array_key_exists(TdbShopArticle::CMS_LINKABLE_OBJECT_PARAM_CATEGORY, $aOptionalParameters)) {
$sCategoryId = $aOptionalParameters[TdbShopArticle::CMS_LINKABLE_OBJECT_PARAM_CATEGORY];
unset($aOptionalParameters[TdbShopArticle::CMS_LINKABLE_OBJECT_PARAM_CATEGORY]);
}
if (is_array($aOptionalParameters) && 0 === count($aOptionalParameters)) {
$aOptionalParameters = null;
}
$aKey = array(
'class' => __CLASS__,
'method' => 'GetDetailLink',
'bIncludePortalLink' => $bAbsolute,
TdbShopArticle::CMS_LINKABLE_OBJECT_PARAM_CATEGORY => $sCategoryId,
'id' => $this->id,
'table' => $this->table,
);
if (is_null($sCategoryId)) {
$oActiveCategory = $shopService->getActiveCategory();
if ($oActiveCategory) {
$aKey[TdbShopArticle::CMS_LINKABLE_OBJECT_PARAM_CATEGORY] = $oActiveCategory->id;
}
}
$sKey = TCacheManager::GetKey($aKey);
$sLink = $this->GetFromInternalCache('link'.$sKey);
if (is_null($sLink)) {
if (!array_key_exists('product_url_mode', $oShop->sqlData)) {
$oShop->sqlData['product_url_mode'] = 'V1';
}
switch ($oShop->sqlData['product_url_mode']) {
case 'V2':
$sLink = $this->GetDetailLinkV2($bAbsolute, $sCategoryId, $portal, $language);
break;
case 'V1':
default:
$sLink = $this->GetDetailLinkV1($bAbsolute, $sCategoryId);
break;
}
$this->SetInternalCache('link'.$sKey, $sLink);
}
if (null !== $aOptionalParameters) {
$sLink .= $this->getUrlUtil()->getArrayAsUrl($aOptionalParameters, '?', '&');
}
if (null !== $sAnchor) {
$sLink .= '#'.urlencode($sAnchor);
}
return $sLink;
} | php | public function getLink($bAbsolute = false, $sAnchor = null, $aOptionalParameters = array(), \TdbCmsPortal $portal = null, \TdbCmsLanguage $language = null)
{
// if no category is given, fetch the first category of the article
$shopService = $this->getShopService();
$oShop = $shopService->getActiveShop();
$sCategoryId = null;
if (true === array_key_exists(TdbShopArticle::CMS_LINKABLE_OBJECT_PARAM_CATEGORY, $aOptionalParameters)) {
$sCategoryId = $aOptionalParameters[TdbShopArticle::CMS_LINKABLE_OBJECT_PARAM_CATEGORY];
unset($aOptionalParameters[TdbShopArticle::CMS_LINKABLE_OBJECT_PARAM_CATEGORY]);
}
if (is_array($aOptionalParameters) && 0 === count($aOptionalParameters)) {
$aOptionalParameters = null;
}
$aKey = array(
'class' => __CLASS__,
'method' => 'GetDetailLink',
'bIncludePortalLink' => $bAbsolute,
TdbShopArticle::CMS_LINKABLE_OBJECT_PARAM_CATEGORY => $sCategoryId,
'id' => $this->id,
'table' => $this->table,
);
if (is_null($sCategoryId)) {
$oActiveCategory = $shopService->getActiveCategory();
if ($oActiveCategory) {
$aKey[TdbShopArticle::CMS_LINKABLE_OBJECT_PARAM_CATEGORY] = $oActiveCategory->id;
}
}
$sKey = TCacheManager::GetKey($aKey);
$sLink = $this->GetFromInternalCache('link'.$sKey);
if (is_null($sLink)) {
if (!array_key_exists('product_url_mode', $oShop->sqlData)) {
$oShop->sqlData['product_url_mode'] = 'V1';
}
switch ($oShop->sqlData['product_url_mode']) {
case 'V2':
$sLink = $this->GetDetailLinkV2($bAbsolute, $sCategoryId, $portal, $language);
break;
case 'V1':
default:
$sLink = $this->GetDetailLinkV1($bAbsolute, $sCategoryId);
break;
}
$this->SetInternalCache('link'.$sKey, $sLink);
}
if (null !== $aOptionalParameters) {
$sLink .= $this->getUrlUtil()->getArrayAsUrl($aOptionalParameters, '?', '&');
}
if (null !== $sAnchor) {
$sLink .= '#'.urlencode($sAnchor);
}
return $sLink;
} | [
"public",
"function",
"getLink",
"(",
"$",
"bAbsolute",
"=",
"false",
",",
"$",
"sAnchor",
"=",
"null",
",",
"$",
"aOptionalParameters",
"=",
"array",
"(",
")",
",",
"\\",
"TdbCmsPortal",
"$",
"portal",
"=",
"null",
",",
"\\",
"TdbCmsLanguage",
"$",
"language",
"=",
"null",
")",
"{",
"// if no category is given, fetch the first category of the article",
"$",
"shopService",
"=",
"$",
"this",
"->",
"getShopService",
"(",
")",
";",
"$",
"oShop",
"=",
"$",
"shopService",
"->",
"getActiveShop",
"(",
")",
";",
"$",
"sCategoryId",
"=",
"null",
";",
"if",
"(",
"true",
"===",
"array_key_exists",
"(",
"TdbShopArticle",
"::",
"CMS_LINKABLE_OBJECT_PARAM_CATEGORY",
",",
"$",
"aOptionalParameters",
")",
")",
"{",
"$",
"sCategoryId",
"=",
"$",
"aOptionalParameters",
"[",
"TdbShopArticle",
"::",
"CMS_LINKABLE_OBJECT_PARAM_CATEGORY",
"]",
";",
"unset",
"(",
"$",
"aOptionalParameters",
"[",
"TdbShopArticle",
"::",
"CMS_LINKABLE_OBJECT_PARAM_CATEGORY",
"]",
")",
";",
"}",
"if",
"(",
"is_array",
"(",
"$",
"aOptionalParameters",
")",
"&&",
"0",
"===",
"count",
"(",
"$",
"aOptionalParameters",
")",
")",
"{",
"$",
"aOptionalParameters",
"=",
"null",
";",
"}",
"$",
"aKey",
"=",
"array",
"(",
"'class'",
"=>",
"__CLASS__",
",",
"'method'",
"=>",
"'GetDetailLink'",
",",
"'bIncludePortalLink'",
"=>",
"$",
"bAbsolute",
",",
"TdbShopArticle",
"::",
"CMS_LINKABLE_OBJECT_PARAM_CATEGORY",
"=>",
"$",
"sCategoryId",
",",
"'id'",
"=>",
"$",
"this",
"->",
"id",
",",
"'table'",
"=>",
"$",
"this",
"->",
"table",
",",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"sCategoryId",
")",
")",
"{",
"$",
"oActiveCategory",
"=",
"$",
"shopService",
"->",
"getActiveCategory",
"(",
")",
";",
"if",
"(",
"$",
"oActiveCategory",
")",
"{",
"$",
"aKey",
"[",
"TdbShopArticle",
"::",
"CMS_LINKABLE_OBJECT_PARAM_CATEGORY",
"]",
"=",
"$",
"oActiveCategory",
"->",
"id",
";",
"}",
"}",
"$",
"sKey",
"=",
"TCacheManager",
"::",
"GetKey",
"(",
"$",
"aKey",
")",
";",
"$",
"sLink",
"=",
"$",
"this",
"->",
"GetFromInternalCache",
"(",
"'link'",
".",
"$",
"sKey",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"sLink",
")",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"'product_url_mode'",
",",
"$",
"oShop",
"->",
"sqlData",
")",
")",
"{",
"$",
"oShop",
"->",
"sqlData",
"[",
"'product_url_mode'",
"]",
"=",
"'V1'",
";",
"}",
"switch",
"(",
"$",
"oShop",
"->",
"sqlData",
"[",
"'product_url_mode'",
"]",
")",
"{",
"case",
"'V2'",
":",
"$",
"sLink",
"=",
"$",
"this",
"->",
"GetDetailLinkV2",
"(",
"$",
"bAbsolute",
",",
"$",
"sCategoryId",
",",
"$",
"portal",
",",
"$",
"language",
")",
";",
"break",
";",
"case",
"'V1'",
":",
"default",
":",
"$",
"sLink",
"=",
"$",
"this",
"->",
"GetDetailLinkV1",
"(",
"$",
"bAbsolute",
",",
"$",
"sCategoryId",
")",
";",
"break",
";",
"}",
"$",
"this",
"->",
"SetInternalCache",
"(",
"'link'",
".",
"$",
"sKey",
",",
"$",
"sLink",
")",
";",
"}",
"if",
"(",
"null",
"!==",
"$",
"aOptionalParameters",
")",
"{",
"$",
"sLink",
".=",
"$",
"this",
"->",
"getUrlUtil",
"(",
")",
"->",
"getArrayAsUrl",
"(",
"$",
"aOptionalParameters",
",",
"'?'",
",",
"'&'",
")",
";",
"}",
"if",
"(",
"null",
"!==",
"$",
"sAnchor",
")",
"{",
"$",
"sLink",
".=",
"'#'",
".",
"urlencode",
"(",
"$",
"sAnchor",
")",
";",
"}",
"return",
"$",
"sLink",
";",
"}"
] | return the link to the detail view of the product.
@param bool $bAbsolute set to true to include the domain in the link
@param string|null $sAnchor
@param array $aOptionalParameters supported optional parameters:
TdbShopArticle::CMS_LINKABLE_OBJECT_PARAM_CATEGORY - (string) force the article link to be within the given category id (only works if the category is assigned to the article)
@param TdbCmsPortal|null $portal
@param TdbCmsLanguage|null $language
@return string | [
"return",
"the",
"link",
"to",
"the",
"detail",
"view",
"of",
"the",
"product",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L258-L312 |
31,949 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticle.class.php | TShopArticle.GetReviewFormLink | public function GetReviewFormLink($bIncludePortalLink = false, $iCategoryId = null)
{
return $this->GetDetailLink($bIncludePortalLink, $iCategoryId).'#review'.TGlobal::OutHTML($this->id);
} | php | public function GetReviewFormLink($bIncludePortalLink = false, $iCategoryId = null)
{
return $this->GetDetailLink($bIncludePortalLink, $iCategoryId).'#review'.TGlobal::OutHTML($this->id);
} | [
"public",
"function",
"GetReviewFormLink",
"(",
"$",
"bIncludePortalLink",
"=",
"false",
",",
"$",
"iCategoryId",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"GetDetailLink",
"(",
"$",
"bIncludePortalLink",
",",
"$",
"iCategoryId",
")",
".",
"'#review'",
".",
"TGlobal",
"::",
"OutHTML",
"(",
"$",
"this",
"->",
"id",
")",
";",
"}"
] | return the link to the review page of the product.
@param bool $bIncludePortalLink - set to true to include the domain in the link
@param int $iCategoryId - pass a category to force a category (only works if the category is assigned to the article)
@return string | [
"return",
"the",
"link",
"to",
"the",
"review",
"page",
"of",
"the",
"product",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L485-L488 |
31,950 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticle.class.php | TShopArticle.GetToBasketLink | public function GetToBasketLink($bIncludePortalLink = false, $bRedirectToBasket = false, $bReplaceBasketContents = false, $bGetAjaxParameter = false, $sMessageConsumer = MTShopBasketCore::MSG_CONSUMER_NAME_MINIBASKET)
{
$sLink = '';
$aParameters = $this->GetToBasketLinkParameters($bRedirectToBasket, $bReplaceBasketContents, $bGetAjaxParameter, $sMessageConsumer);
// convert module_fnc to array to string
$aIncludeParams = TdbShop::GetURLPageStateParameters();
$oGlobal = TGlobal::instance();
foreach ($aIncludeParams as $sKeyName) {
if ($oGlobal->UserDataExists($sKeyName) && !array_key_exists($sKeyName, $aParameters)) {
$aParameters[$sKeyName] = $oGlobal->GetUserData($sKeyName);
}
}
return $this->generateLinkForToBasketParameters($aParameters, $bIncludePortalLink);
} | php | public function GetToBasketLink($bIncludePortalLink = false, $bRedirectToBasket = false, $bReplaceBasketContents = false, $bGetAjaxParameter = false, $sMessageConsumer = MTShopBasketCore::MSG_CONSUMER_NAME_MINIBASKET)
{
$sLink = '';
$aParameters = $this->GetToBasketLinkParameters($bRedirectToBasket, $bReplaceBasketContents, $bGetAjaxParameter, $sMessageConsumer);
// convert module_fnc to array to string
$aIncludeParams = TdbShop::GetURLPageStateParameters();
$oGlobal = TGlobal::instance();
foreach ($aIncludeParams as $sKeyName) {
if ($oGlobal->UserDataExists($sKeyName) && !array_key_exists($sKeyName, $aParameters)) {
$aParameters[$sKeyName] = $oGlobal->GetUserData($sKeyName);
}
}
return $this->generateLinkForToBasketParameters($aParameters, $bIncludePortalLink);
} | [
"public",
"function",
"GetToBasketLink",
"(",
"$",
"bIncludePortalLink",
"=",
"false",
",",
"$",
"bRedirectToBasket",
"=",
"false",
",",
"$",
"bReplaceBasketContents",
"=",
"false",
",",
"$",
"bGetAjaxParameter",
"=",
"false",
",",
"$",
"sMessageConsumer",
"=",
"MTShopBasketCore",
"::",
"MSG_CONSUMER_NAME_MINIBASKET",
")",
"{",
"$",
"sLink",
"=",
"''",
";",
"$",
"aParameters",
"=",
"$",
"this",
"->",
"GetToBasketLinkParameters",
"(",
"$",
"bRedirectToBasket",
",",
"$",
"bReplaceBasketContents",
",",
"$",
"bGetAjaxParameter",
",",
"$",
"sMessageConsumer",
")",
";",
"// convert module_fnc to array to string",
"$",
"aIncludeParams",
"=",
"TdbShop",
"::",
"GetURLPageStateParameters",
"(",
")",
";",
"$",
"oGlobal",
"=",
"TGlobal",
"::",
"instance",
"(",
")",
";",
"foreach",
"(",
"$",
"aIncludeParams",
"as",
"$",
"sKeyName",
")",
"{",
"if",
"(",
"$",
"oGlobal",
"->",
"UserDataExists",
"(",
"$",
"sKeyName",
")",
"&&",
"!",
"array_key_exists",
"(",
"$",
"sKeyName",
",",
"$",
"aParameters",
")",
")",
"{",
"$",
"aParameters",
"[",
"$",
"sKeyName",
"]",
"=",
"$",
"oGlobal",
"->",
"GetUserData",
"(",
"$",
"sKeyName",
")",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"generateLinkForToBasketParameters",
"(",
"$",
"aParameters",
",",
"$",
"bIncludePortalLink",
")",
";",
"}"
] | generates a link that can be used to add this product to the basket.
@param bool $bIncludePortalLink - include domain in link
@param bool $bRedirectToBasket - redirect to basket page after adding product
@param bool $bReplaceBasketContents - set to true if you want the contents of the basket to be replaced by the product wenn added to basket
@param bool $bGetAjaxParameter - set to true if you want to get basket link for ajax call
@param string $sMessageConsumer - set custom message consumer
@return string | [
"generates",
"a",
"link",
"that",
"can",
"be",
"used",
"to",
"add",
"this",
"product",
"to",
"the",
"basket",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L501-L515 |
31,951 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticle.class.php | TShopArticle.generateLinkForToBasketParameters | protected function generateLinkForToBasketParameters($aParameters = array(), $bIncludePortalLink)
{
$activePage = $this->getActivePageService()->getActivePage();
if (!is_object($activePage)) {
$sLink = '?'.TTools::GetArrayAsURL($aParameters);
if ($bIncludePortalLink) {
/** @var Request $request */
$request = \ChameleonSystem\CoreBundle\ServiceLocator::get('request_stack')->getCurrentRequest();
$sLink = $request->getSchemeAndHttpHost().$sLink;
}
} else {
$sLink = $activePage->GetRealURLPlain($aParameters, $bIncludePortalLink);
}
return $sLink;
} | php | protected function generateLinkForToBasketParameters($aParameters = array(), $bIncludePortalLink)
{
$activePage = $this->getActivePageService()->getActivePage();
if (!is_object($activePage)) {
$sLink = '?'.TTools::GetArrayAsURL($aParameters);
if ($bIncludePortalLink) {
/** @var Request $request */
$request = \ChameleonSystem\CoreBundle\ServiceLocator::get('request_stack')->getCurrentRequest();
$sLink = $request->getSchemeAndHttpHost().$sLink;
}
} else {
$sLink = $activePage->GetRealURLPlain($aParameters, $bIncludePortalLink);
}
return $sLink;
} | [
"protected",
"function",
"generateLinkForToBasketParameters",
"(",
"$",
"aParameters",
"=",
"array",
"(",
")",
",",
"$",
"bIncludePortalLink",
")",
"{",
"$",
"activePage",
"=",
"$",
"this",
"->",
"getActivePageService",
"(",
")",
"->",
"getActivePage",
"(",
")",
";",
"if",
"(",
"!",
"is_object",
"(",
"$",
"activePage",
")",
")",
"{",
"$",
"sLink",
"=",
"'?'",
".",
"TTools",
"::",
"GetArrayAsURL",
"(",
"$",
"aParameters",
")",
";",
"if",
"(",
"$",
"bIncludePortalLink",
")",
"{",
"/** @var Request $request */",
"$",
"request",
"=",
"\\",
"ChameleonSystem",
"\\",
"CoreBundle",
"\\",
"ServiceLocator",
"::",
"get",
"(",
"'request_stack'",
")",
"->",
"getCurrentRequest",
"(",
")",
";",
"$",
"sLink",
"=",
"$",
"request",
"->",
"getSchemeAndHttpHost",
"(",
")",
".",
"$",
"sLink",
";",
"}",
"}",
"else",
"{",
"$",
"sLink",
"=",
"$",
"activePage",
"->",
"GetRealURLPlain",
"(",
"$",
"aParameters",
",",
"$",
"bIncludePortalLink",
")",
";",
"}",
"return",
"$",
"sLink",
";",
"}"
] | Creates to basket link from given to basket parameters.
@param array $aParameters
@param $bIncludePortalLink
@return string | [
"Creates",
"to",
"basket",
"link",
"from",
"given",
"to",
"basket",
"parameters",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L525-L540 |
31,952 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticle.class.php | TShopArticle.GetToBasketLinkForExternalCalls | public function GetToBasketLinkForExternalCalls()
{
return 'http://'.$this->getPortalDomainService()->getActiveDomain()->getInsecureDomainName().'/'.TdbShopArticle::URL_EXTERNAL_TO_BASKET_REQUEST.'/id/'.urlencode($this->id);
} | php | public function GetToBasketLinkForExternalCalls()
{
return 'http://'.$this->getPortalDomainService()->getActiveDomain()->getInsecureDomainName().'/'.TdbShopArticle::URL_EXTERNAL_TO_BASKET_REQUEST.'/id/'.urlencode($this->id);
} | [
"public",
"function",
"GetToBasketLinkForExternalCalls",
"(",
")",
"{",
"return",
"'http://'",
".",
"$",
"this",
"->",
"getPortalDomainService",
"(",
")",
"->",
"getActiveDomain",
"(",
")",
"->",
"getInsecureDomainName",
"(",
")",
".",
"'/'",
".",
"TdbShopArticle",
"::",
"URL_EXTERNAL_TO_BASKET_REQUEST",
".",
"'/id/'",
".",
"urlencode",
"(",
"$",
"this",
"->",
"id",
")",
";",
"}"
] | returns a url to place the item in the basket from an external location.
@return string | [
"returns",
"a",
"url",
"to",
"place",
"the",
"item",
"in",
"the",
"basket",
"from",
"an",
"external",
"location",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L547-L550 |
31,953 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticle.class.php | TShopArticle.GetToBasketLinkParameters | public function GetToBasketLinkParameters($bRedirectToBasket = false, $bReplaceBasketContents = false, $bGetAjaxParameter = false, $sMessageConsumer = MTShopBasketCore::MSG_CONSUMER_NAME_MINIBASKET)
{
$aParameters = $this->getToBasketLinkBasketParameters($bRedirectToBasket, $bReplaceBasketContents, $bGetAjaxParameter, $sMessageConsumer);
$aParameters = $this->getToBasketLinkOtherParameters($aParameters);
return $aParameters;
} | php | public function GetToBasketLinkParameters($bRedirectToBasket = false, $bReplaceBasketContents = false, $bGetAjaxParameter = false, $sMessageConsumer = MTShopBasketCore::MSG_CONSUMER_NAME_MINIBASKET)
{
$aParameters = $this->getToBasketLinkBasketParameters($bRedirectToBasket, $bReplaceBasketContents, $bGetAjaxParameter, $sMessageConsumer);
$aParameters = $this->getToBasketLinkOtherParameters($aParameters);
return $aParameters;
} | [
"public",
"function",
"GetToBasketLinkParameters",
"(",
"$",
"bRedirectToBasket",
"=",
"false",
",",
"$",
"bReplaceBasketContents",
"=",
"false",
",",
"$",
"bGetAjaxParameter",
"=",
"false",
",",
"$",
"sMessageConsumer",
"=",
"MTShopBasketCore",
"::",
"MSG_CONSUMER_NAME_MINIBASKET",
")",
"{",
"$",
"aParameters",
"=",
"$",
"this",
"->",
"getToBasketLinkBasketParameters",
"(",
"$",
"bRedirectToBasket",
",",
"$",
"bReplaceBasketContents",
",",
"$",
"bGetAjaxParameter",
",",
"$",
"sMessageConsumer",
")",
";",
"$",
"aParameters",
"=",
"$",
"this",
"->",
"getToBasketLinkOtherParameters",
"(",
"$",
"aParameters",
")",
";",
"return",
"$",
"aParameters",
";",
"}"
] | return parameters needed for a to basket call.
@param bool $bRedirectToBasket - redirect to basket page after adding product
@param bool $bReplaceBasketContents - set to true if you want the contents of the basket to be replaced by the product wenn added to basket
@param bool $bGetAjaxParameter - set to true if you want to get basket link for ajax call
@param string $sMessageConsumer - set custom message consumer
@return array | [
"return",
"parameters",
"needed",
"for",
"a",
"to",
"basket",
"call",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L562-L568 |
31,954 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticle.class.php | TShopArticle.GetToNoticeListLink | public function GetToNoticeListLink($bIncludePortalLink = false, $sMsgConsumerName = false)
{
if (false === $sMsgConsumerName) {
$sMsgConsumerName = $this->GetMessageConsumerName();
}
$oShopConfig = TdbShop::GetInstance();
$aParameters = array(
'module_fnc' => array(
$oShopConfig->GetBasketModuleSpotName() => 'AddToNoticeList',
),
MTShopBasketCore::URL_ITEM_ID => $this->id,
MTShopBasketCore::URL_ITEM_AMOUNT => 1,
MTShopBasketCore::URL_MESSAGE_CONSUMER => $sMsgConsumerName,
);
$aExcludeParameters = TCMSSmartURLData::GetActive()->getSeoURLParameters();
foreach ($aParameters as $sKey => $sVal) {
$aExcludeParameters[] = $sKey;
}
// now add all OTHER parameters
$aOtherParameters = TGlobal::instance()->GetUserData(null, $aExcludeParameters);
foreach ($aOtherParameters as $sKey => $sVal) {
$aParameters[$sKey] = $sVal;
}
$activePage = $this->getActivePageService()->getActivePage();
return $activePage->GetRealURLPlain($aParameters, $bIncludePortalLink);
} | php | public function GetToNoticeListLink($bIncludePortalLink = false, $sMsgConsumerName = false)
{
if (false === $sMsgConsumerName) {
$sMsgConsumerName = $this->GetMessageConsumerName();
}
$oShopConfig = TdbShop::GetInstance();
$aParameters = array(
'module_fnc' => array(
$oShopConfig->GetBasketModuleSpotName() => 'AddToNoticeList',
),
MTShopBasketCore::URL_ITEM_ID => $this->id,
MTShopBasketCore::URL_ITEM_AMOUNT => 1,
MTShopBasketCore::URL_MESSAGE_CONSUMER => $sMsgConsumerName,
);
$aExcludeParameters = TCMSSmartURLData::GetActive()->getSeoURLParameters();
foreach ($aParameters as $sKey => $sVal) {
$aExcludeParameters[] = $sKey;
}
// now add all OTHER parameters
$aOtherParameters = TGlobal::instance()->GetUserData(null, $aExcludeParameters);
foreach ($aOtherParameters as $sKey => $sVal) {
$aParameters[$sKey] = $sVal;
}
$activePage = $this->getActivePageService()->getActivePage();
return $activePage->GetRealURLPlain($aParameters, $bIncludePortalLink);
} | [
"public",
"function",
"GetToNoticeListLink",
"(",
"$",
"bIncludePortalLink",
"=",
"false",
",",
"$",
"sMsgConsumerName",
"=",
"false",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"sMsgConsumerName",
")",
"{",
"$",
"sMsgConsumerName",
"=",
"$",
"this",
"->",
"GetMessageConsumerName",
"(",
")",
";",
"}",
"$",
"oShopConfig",
"=",
"TdbShop",
"::",
"GetInstance",
"(",
")",
";",
"$",
"aParameters",
"=",
"array",
"(",
"'module_fnc'",
"=>",
"array",
"(",
"$",
"oShopConfig",
"->",
"GetBasketModuleSpotName",
"(",
")",
"=>",
"'AddToNoticeList'",
",",
")",
",",
"MTShopBasketCore",
"::",
"URL_ITEM_ID",
"=>",
"$",
"this",
"->",
"id",
",",
"MTShopBasketCore",
"::",
"URL_ITEM_AMOUNT",
"=>",
"1",
",",
"MTShopBasketCore",
"::",
"URL_MESSAGE_CONSUMER",
"=>",
"$",
"sMsgConsumerName",
",",
")",
";",
"$",
"aExcludeParameters",
"=",
"TCMSSmartURLData",
"::",
"GetActive",
"(",
")",
"->",
"getSeoURLParameters",
"(",
")",
";",
"foreach",
"(",
"$",
"aParameters",
"as",
"$",
"sKey",
"=>",
"$",
"sVal",
")",
"{",
"$",
"aExcludeParameters",
"[",
"]",
"=",
"$",
"sKey",
";",
"}",
"// now add all OTHER parameters",
"$",
"aOtherParameters",
"=",
"TGlobal",
"::",
"instance",
"(",
")",
"->",
"GetUserData",
"(",
"null",
",",
"$",
"aExcludeParameters",
")",
";",
"foreach",
"(",
"$",
"aOtherParameters",
"as",
"$",
"sKey",
"=>",
"$",
"sVal",
")",
"{",
"$",
"aParameters",
"[",
"$",
"sKey",
"]",
"=",
"$",
"sVal",
";",
"}",
"$",
"activePage",
"=",
"$",
"this",
"->",
"getActivePageService",
"(",
")",
"->",
"getActivePage",
"(",
")",
";",
"return",
"$",
"activePage",
"->",
"GetRealURLPlain",
"(",
"$",
"aParameters",
",",
"$",
"bIncludePortalLink",
")",
";",
"}"
] | generate a link used to add the article to the notice list.
@param bool $bIncludePortalLink - include domain in link
@param bool $sMsgConsumerName
@return string | [
"generate",
"a",
"link",
"used",
"to",
"add",
"the",
"article",
"to",
"the",
"notice",
"list",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L578-L609 |
31,955 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticle.class.php | TShopArticle.& | public function &GetPrimaryCategory()
{
$oCategory = null;
// if this is a variant, then we want to take the parent object instead - at least if no data is set for the child
if (!empty($this->fieldShopCategoryId)) {
$oCategory = &$this->GetFieldShopCategory();
if (!is_null($oCategory) && false == $oCategory->AllowDisplayInShop()) {
$oCategory = null;
}
}
if (is_null($oCategory)) {
$oCategories = &$this->GetFieldShopCategoryList();
$oCategories->GoToStart();
if ($oCategories->Length() > 0) {
$oCategory = &$oCategories->Current();
}
}
if (is_null($oCategory) && $this->IsVariant()) {
$oParent = &$this->GetFieldVariantParent();
$oCategory = &$oParent->GetPrimaryCategory();
}
return $oCategory;
} | php | public function &GetPrimaryCategory()
{
$oCategory = null;
// if this is a variant, then we want to take the parent object instead - at least if no data is set for the child
if (!empty($this->fieldShopCategoryId)) {
$oCategory = &$this->GetFieldShopCategory();
if (!is_null($oCategory) && false == $oCategory->AllowDisplayInShop()) {
$oCategory = null;
}
}
if (is_null($oCategory)) {
$oCategories = &$this->GetFieldShopCategoryList();
$oCategories->GoToStart();
if ($oCategories->Length() > 0) {
$oCategory = &$oCategories->Current();
}
}
if (is_null($oCategory) && $this->IsVariant()) {
$oParent = &$this->GetFieldVariantParent();
$oCategory = &$oParent->GetPrimaryCategory();
}
return $oCategory;
} | [
"public",
"function",
"&",
"GetPrimaryCategory",
"(",
")",
"{",
"$",
"oCategory",
"=",
"null",
";",
"// if this is a variant, then we want to take the parent object instead - at least if no data is set for the child",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"fieldShopCategoryId",
")",
")",
"{",
"$",
"oCategory",
"=",
"&",
"$",
"this",
"->",
"GetFieldShopCategory",
"(",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"oCategory",
")",
"&&",
"false",
"==",
"$",
"oCategory",
"->",
"AllowDisplayInShop",
"(",
")",
")",
"{",
"$",
"oCategory",
"=",
"null",
";",
"}",
"}",
"if",
"(",
"is_null",
"(",
"$",
"oCategory",
")",
")",
"{",
"$",
"oCategories",
"=",
"&",
"$",
"this",
"->",
"GetFieldShopCategoryList",
"(",
")",
";",
"$",
"oCategories",
"->",
"GoToStart",
"(",
")",
";",
"if",
"(",
"$",
"oCategories",
"->",
"Length",
"(",
")",
">",
"0",
")",
"{",
"$",
"oCategory",
"=",
"&",
"$",
"oCategories",
"->",
"Current",
"(",
")",
";",
"}",
"}",
"if",
"(",
"is_null",
"(",
"$",
"oCategory",
")",
"&&",
"$",
"this",
"->",
"IsVariant",
"(",
")",
")",
"{",
"$",
"oParent",
"=",
"&",
"$",
"this",
"->",
"GetFieldVariantParent",
"(",
")",
";",
"$",
"oCategory",
"=",
"&",
"$",
"oParent",
"->",
"GetPrimaryCategory",
"(",
")",
";",
"}",
"return",
"$",
"oCategory",
";",
"}"
] | return the primary category of the article (usually just the first one found.
@return TdbShopCategory | [
"return",
"the",
"primary",
"category",
"of",
"the",
"article",
"(",
"usually",
"just",
"the",
"first",
"one",
"found",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L647-L671 |
31,956 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticle.class.php | TShopArticle.& | public function &GetFieldShopCategoryList($sOrderBy = '')
{
$oCategories = &$this->GetFromInternalCache('oCategories');
if (is_null($oCategories)) {
$oCategories = &TdbShopCategoryList::GetArticleCategories($this->id, $this->iLanguageId);
$this->SetInternalCache('oCategories', $oCategories);
}
return $oCategories;
} | php | public function &GetFieldShopCategoryList($sOrderBy = '')
{
$oCategories = &$this->GetFromInternalCache('oCategories');
if (is_null($oCategories)) {
$oCategories = &TdbShopCategoryList::GetArticleCategories($this->id, $this->iLanguageId);
$this->SetInternalCache('oCategories', $oCategories);
}
return $oCategories;
} | [
"public",
"function",
"&",
"GetFieldShopCategoryList",
"(",
"$",
"sOrderBy",
"=",
"''",
")",
"{",
"$",
"oCategories",
"=",
"&",
"$",
"this",
"->",
"GetFromInternalCache",
"(",
"'oCategories'",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"oCategories",
")",
")",
"{",
"$",
"oCategories",
"=",
"&",
"TdbShopCategoryList",
"::",
"GetArticleCategories",
"(",
"$",
"this",
"->",
"id",
",",
"$",
"this",
"->",
"iLanguageId",
")",
";",
"$",
"this",
"->",
"SetInternalCache",
"(",
"'oCategories'",
",",
"$",
"oCategories",
")",
";",
"}",
"return",
"$",
"oCategories",
";",
"}"
] | return all categories assigned to the article.
@param string $sOrderBy
@return TdbShopCategoryList | [
"return",
"all",
"categories",
"assigned",
"to",
"the",
"article",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L680-L689 |
31,957 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticle.class.php | TShopArticle.& | public function &GetArticleGroups()
{
$oArticleGroups = &$this->GetFromInternalCache('oArticleGroups');
if (is_null($oArticleGroups)) {
$oArticleGroups = &TdbShopArticleGroupList::GetArticleGroups($this->id);
$this->SetInternalCache('oArticleGroups', $oArticleGroups);
}
return $oArticleGroups;
} | php | public function &GetArticleGroups()
{
$oArticleGroups = &$this->GetFromInternalCache('oArticleGroups');
if (is_null($oArticleGroups)) {
$oArticleGroups = &TdbShopArticleGroupList::GetArticleGroups($this->id);
$this->SetInternalCache('oArticleGroups', $oArticleGroups);
}
return $oArticleGroups;
} | [
"public",
"function",
"&",
"GetArticleGroups",
"(",
")",
"{",
"$",
"oArticleGroups",
"=",
"&",
"$",
"this",
"->",
"GetFromInternalCache",
"(",
"'oArticleGroups'",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"oArticleGroups",
")",
")",
"{",
"$",
"oArticleGroups",
"=",
"&",
"TdbShopArticleGroupList",
"::",
"GetArticleGroups",
"(",
"$",
"this",
"->",
"id",
")",
";",
"$",
"this",
"->",
"SetInternalCache",
"(",
"'oArticleGroups'",
",",
"$",
"oArticleGroups",
")",
";",
"}",
"return",
"$",
"oArticleGroups",
";",
"}"
] | return all article groups assigend to the article.
@return TdbShopArticleGroupList | [
"return",
"all",
"article",
"groups",
"assigend",
"to",
"the",
"article",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L696-L705 |
31,958 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticle.class.php | TShopArticle.GetMessages | protected function GetMessages($aMessageConsumerToCheck)
{
$sMessages = '';
$oMsgManager = TCMSMessageManager::GetInstance();
foreach ($aMessageConsumerToCheck as $sMessageConsumer) {
if ($oMsgManager->ConsumerHasMessages($sMessageConsumer)) {
$sMessages .= $oMsgManager->RenderMessages($sMessageConsumer);
}
}
return $sMessages;
} | php | protected function GetMessages($aMessageConsumerToCheck)
{
$sMessages = '';
$oMsgManager = TCMSMessageManager::GetInstance();
foreach ($aMessageConsumerToCheck as $sMessageConsumer) {
if ($oMsgManager->ConsumerHasMessages($sMessageConsumer)) {
$sMessages .= $oMsgManager->RenderMessages($sMessageConsumer);
}
}
return $sMessages;
} | [
"protected",
"function",
"GetMessages",
"(",
"$",
"aMessageConsumerToCheck",
")",
"{",
"$",
"sMessages",
"=",
"''",
";",
"$",
"oMsgManager",
"=",
"TCMSMessageManager",
"::",
"GetInstance",
"(",
")",
";",
"foreach",
"(",
"$",
"aMessageConsumerToCheck",
"as",
"$",
"sMessageConsumer",
")",
"{",
"if",
"(",
"$",
"oMsgManager",
"->",
"ConsumerHasMessages",
"(",
"$",
"sMessageConsumer",
")",
")",
"{",
"$",
"sMessages",
".=",
"$",
"oMsgManager",
"->",
"RenderMessages",
"(",
"$",
"sMessageConsumer",
")",
";",
"}",
"}",
"return",
"$",
"sMessages",
";",
"}"
] | uses message manager to render messages and return them as string.
@param $aMessageConsumerToCheck
@return string | [
"uses",
"message",
"manager",
"to",
"render",
"messages",
"and",
"return",
"them",
"as",
"string",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L756-L768 |
31,959 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticle.class.php | TShopArticle.GetPrimaryImage | public function GetPrimaryImage()
{
$oPrimaryImage = &$this->GetFromInternalCache('oPrimaryImage');
if (is_null($oPrimaryImage)) {
if (!empty($this->fieldCmsMediaDefaultPreviewImageId) && (!is_numeric($this->fieldCmsMediaDefaultPreviewImageId) || intval($this->fieldCmsMediaDefaultPreviewImageId) > 1000)) {
$oShop = TdbShop::GetInstance();
$aData = array('shop_article_id' => $this->id, 'cms_media_id' => $this->fieldCmsMediaDefaultPreviewImageId, 'position' => 1);
$oPrimaryImage = TdbShopArticleImage::GetNewInstance();
$oPrimaryImage->LoadFromRow($aData);
} else {
$oImages = &$this->GetFieldShopArticleImageList();
$activePage = $this->getActivePageService()->getActivePage();
if (0 == $oImages->Length() && (!is_null($activePage))) {
$oShop = TdbShop::GetInstance();
$aData = array('shop_article_id' => $this->id, 'cms_media_id' => $oShop->fieldNotFoundImage, 'position' => 1);
$oPrimaryImage = TdbShopArticleImage::GetNewInstance();
$oPrimaryImage->LoadFromRow($aData);
} else {
$oImages->GoToStart();
$oPrimaryImage = &$oImages->Current();
}
}
if (false === $oPrimaryImage) {
$oPrimaryImage = null;
if ($this->IsVariant()) {
$oParent = $this->GetFieldVariantParent();
if (null != $oParent) {
$oPrimaryImage = $oParent->GetPrimaryImage();
}
}
}
$this->SetInternalCache('oPrimaryImage', $oPrimaryImage);
}
return $oPrimaryImage;
} | php | public function GetPrimaryImage()
{
$oPrimaryImage = &$this->GetFromInternalCache('oPrimaryImage');
if (is_null($oPrimaryImage)) {
if (!empty($this->fieldCmsMediaDefaultPreviewImageId) && (!is_numeric($this->fieldCmsMediaDefaultPreviewImageId) || intval($this->fieldCmsMediaDefaultPreviewImageId) > 1000)) {
$oShop = TdbShop::GetInstance();
$aData = array('shop_article_id' => $this->id, 'cms_media_id' => $this->fieldCmsMediaDefaultPreviewImageId, 'position' => 1);
$oPrimaryImage = TdbShopArticleImage::GetNewInstance();
$oPrimaryImage->LoadFromRow($aData);
} else {
$oImages = &$this->GetFieldShopArticleImageList();
$activePage = $this->getActivePageService()->getActivePage();
if (0 == $oImages->Length() && (!is_null($activePage))) {
$oShop = TdbShop::GetInstance();
$aData = array('shop_article_id' => $this->id, 'cms_media_id' => $oShop->fieldNotFoundImage, 'position' => 1);
$oPrimaryImage = TdbShopArticleImage::GetNewInstance();
$oPrimaryImage->LoadFromRow($aData);
} else {
$oImages->GoToStart();
$oPrimaryImage = &$oImages->Current();
}
}
if (false === $oPrimaryImage) {
$oPrimaryImage = null;
if ($this->IsVariant()) {
$oParent = $this->GetFieldVariantParent();
if (null != $oParent) {
$oPrimaryImage = $oParent->GetPrimaryImage();
}
}
}
$this->SetInternalCache('oPrimaryImage', $oPrimaryImage);
}
return $oPrimaryImage;
} | [
"public",
"function",
"GetPrimaryImage",
"(",
")",
"{",
"$",
"oPrimaryImage",
"=",
"&",
"$",
"this",
"->",
"GetFromInternalCache",
"(",
"'oPrimaryImage'",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"oPrimaryImage",
")",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"fieldCmsMediaDefaultPreviewImageId",
")",
"&&",
"(",
"!",
"is_numeric",
"(",
"$",
"this",
"->",
"fieldCmsMediaDefaultPreviewImageId",
")",
"||",
"intval",
"(",
"$",
"this",
"->",
"fieldCmsMediaDefaultPreviewImageId",
")",
">",
"1000",
")",
")",
"{",
"$",
"oShop",
"=",
"TdbShop",
"::",
"GetInstance",
"(",
")",
";",
"$",
"aData",
"=",
"array",
"(",
"'shop_article_id'",
"=>",
"$",
"this",
"->",
"id",
",",
"'cms_media_id'",
"=>",
"$",
"this",
"->",
"fieldCmsMediaDefaultPreviewImageId",
",",
"'position'",
"=>",
"1",
")",
";",
"$",
"oPrimaryImage",
"=",
"TdbShopArticleImage",
"::",
"GetNewInstance",
"(",
")",
";",
"$",
"oPrimaryImage",
"->",
"LoadFromRow",
"(",
"$",
"aData",
")",
";",
"}",
"else",
"{",
"$",
"oImages",
"=",
"&",
"$",
"this",
"->",
"GetFieldShopArticleImageList",
"(",
")",
";",
"$",
"activePage",
"=",
"$",
"this",
"->",
"getActivePageService",
"(",
")",
"->",
"getActivePage",
"(",
")",
";",
"if",
"(",
"0",
"==",
"$",
"oImages",
"->",
"Length",
"(",
")",
"&&",
"(",
"!",
"is_null",
"(",
"$",
"activePage",
")",
")",
")",
"{",
"$",
"oShop",
"=",
"TdbShop",
"::",
"GetInstance",
"(",
")",
";",
"$",
"aData",
"=",
"array",
"(",
"'shop_article_id'",
"=>",
"$",
"this",
"->",
"id",
",",
"'cms_media_id'",
"=>",
"$",
"oShop",
"->",
"fieldNotFoundImage",
",",
"'position'",
"=>",
"1",
")",
";",
"$",
"oPrimaryImage",
"=",
"TdbShopArticleImage",
"::",
"GetNewInstance",
"(",
")",
";",
"$",
"oPrimaryImage",
"->",
"LoadFromRow",
"(",
"$",
"aData",
")",
";",
"}",
"else",
"{",
"$",
"oImages",
"->",
"GoToStart",
"(",
")",
";",
"$",
"oPrimaryImage",
"=",
"&",
"$",
"oImages",
"->",
"Current",
"(",
")",
";",
"}",
"}",
"if",
"(",
"false",
"===",
"$",
"oPrimaryImage",
")",
"{",
"$",
"oPrimaryImage",
"=",
"null",
";",
"if",
"(",
"$",
"this",
"->",
"IsVariant",
"(",
")",
")",
"{",
"$",
"oParent",
"=",
"$",
"this",
"->",
"GetFieldVariantParent",
"(",
")",
";",
"if",
"(",
"null",
"!=",
"$",
"oParent",
")",
"{",
"$",
"oPrimaryImage",
"=",
"$",
"oParent",
"->",
"GetPrimaryImage",
"(",
")",
";",
"}",
"}",
"}",
"$",
"this",
"->",
"SetInternalCache",
"(",
"'oPrimaryImage'",
",",
"$",
"oPrimaryImage",
")",
";",
"}",
"return",
"$",
"oPrimaryImage",
";",
"}"
] | return the primary image object of the shop article. this is either the cms_media_default_preview_image_id
or the first image in the image list.
@return TdbShopArticleImage | [
"return",
"the",
"primary",
"image",
"object",
"of",
"the",
"shop",
"article",
".",
"this",
"is",
"either",
"the",
"cms_media_default_preview_image_id",
"or",
"the",
"first",
"image",
"in",
"the",
"image",
"list",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L830-L866 |
31,960 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticle.class.php | TShopArticle.IsInArticleGroups | public function IsInArticleGroups($aGroupList)
{
$bIsInGroups = false;
$aArticleGroups = $this->GetMLTIdList('shop_article_group');
$aIntersec = array_intersect($aArticleGroups, $aGroupList);
if (0 == count($aIntersec) && 0 == count($aArticleGroups) && $this->IsVariant()) {
$oParent = &$this->GetFieldVariantParent();
if ($oParent) {
$bIsInGroups = $oParent->IsInArticleGroups($aGroupList);
}
} else {
$bIsInGroups = (count($aIntersec) > 0);
}
return $bIsInGroups;
} | php | public function IsInArticleGroups($aGroupList)
{
$bIsInGroups = false;
$aArticleGroups = $this->GetMLTIdList('shop_article_group');
$aIntersec = array_intersect($aArticleGroups, $aGroupList);
if (0 == count($aIntersec) && 0 == count($aArticleGroups) && $this->IsVariant()) {
$oParent = &$this->GetFieldVariantParent();
if ($oParent) {
$bIsInGroups = $oParent->IsInArticleGroups($aGroupList);
}
} else {
$bIsInGroups = (count($aIntersec) > 0);
}
return $bIsInGroups;
} | [
"public",
"function",
"IsInArticleGroups",
"(",
"$",
"aGroupList",
")",
"{",
"$",
"bIsInGroups",
"=",
"false",
";",
"$",
"aArticleGroups",
"=",
"$",
"this",
"->",
"GetMLTIdList",
"(",
"'shop_article_group'",
")",
";",
"$",
"aIntersec",
"=",
"array_intersect",
"(",
"$",
"aArticleGroups",
",",
"$",
"aGroupList",
")",
";",
"if",
"(",
"0",
"==",
"count",
"(",
"$",
"aIntersec",
")",
"&&",
"0",
"==",
"count",
"(",
"$",
"aArticleGroups",
")",
"&&",
"$",
"this",
"->",
"IsVariant",
"(",
")",
")",
"{",
"$",
"oParent",
"=",
"&",
"$",
"this",
"->",
"GetFieldVariantParent",
"(",
")",
";",
"if",
"(",
"$",
"oParent",
")",
"{",
"$",
"bIsInGroups",
"=",
"$",
"oParent",
"->",
"IsInArticleGroups",
"(",
"$",
"aGroupList",
")",
";",
"}",
"}",
"else",
"{",
"$",
"bIsInGroups",
"=",
"(",
"count",
"(",
"$",
"aIntersec",
")",
">",
"0",
")",
";",
"}",
"return",
"$",
"bIsInGroups",
";",
"}"
] | return true if the article is in at least one of the groups.
@param array $aGroupList
@return bool | [
"return",
"true",
"if",
"the",
"article",
"is",
"in",
"at",
"least",
"one",
"of",
"the",
"groups",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L937-L953 |
31,961 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticle.class.php | TShopArticle.GetExportObject | public function GetExportObject()
{
$oExportObject = new stdClass();
$oExportObject->id = $this->id;
foreach ($this as $sPropName => $sPropVal) {
if ('field' == substr($sPropName, 0, 5)) {
$oExportObject->{$sPropName} = $sPropVal;
}
}
// Add additional infos that might be useful for an export
// Images
if (TGlobal::IsCMSMode()) {
$oPortals = &TdbCmsPortalList::GetList();
$oPortal = $oPortals->Current();
$oShop = &TdbShop::GetInstance($oPortal->id);
} else {
$oShop = TdbShop::GetInstance();
}
$oImageSizeList = &TdbShopArticleImageSizeList::GetListForShopId($oShop->id);
$oExportObject->aImages = array();
$oImagePropertyList = &$this->GetFieldShopArticleImageList();
$aImageData = array('original' => array(), 'thumb' => array());
while ($oImageProperty = &$oImagePropertyList->Next()) {
$oImage = $oImageProperty->GetImage(0, 'cms_media_id');
if (null !== $oImage) {
$aImageData['original'][] = $oImage->GetFullURL();
$aImageData['originalLocal'][] = $oImage->GetFullLocalPath();
}
}
$oImageSizeList->GoToStart();
while ($oImageSize = &$oImageSizeList->Next()) {
$oPreviewImageDescription = &$this->GetImagePreviewObject($oImageSize->fieldNameInternal);
if (null !== $oPreviewImageDescription) {
$oImage = $oPreviewImageDescription->GetImageThumbnailObject();
$aImageData['thumb'][$oImageSize->fieldNameInternal] = $oImage->GetFullURL();
$aImageData['thumbLocal'][$oImageSize->fieldNameInternal] = $oImage->GetFullLocalPath();
}
}
$oExportObject->aImages = $aImageData;
// DeepLink
$oExportObject->fieldDeepLink = $this->GetDetailLink(true);
// Author Lost
$oContributorList = $this->GetContributorList(array('author'));
$aContributorList = array();
while ($oContributor = $oContributorList->Next()) {
$aContributorList[] = $oContributor->GetName();
}
$oExportObject->aAuthors = $aContributorList;
// Stock Message
$oExportObject->oStockMessage = $this->GetFieldShopStockMessage();
return $oExportObject;
} | php | public function GetExportObject()
{
$oExportObject = new stdClass();
$oExportObject->id = $this->id;
foreach ($this as $sPropName => $sPropVal) {
if ('field' == substr($sPropName, 0, 5)) {
$oExportObject->{$sPropName} = $sPropVal;
}
}
// Add additional infos that might be useful for an export
// Images
if (TGlobal::IsCMSMode()) {
$oPortals = &TdbCmsPortalList::GetList();
$oPortal = $oPortals->Current();
$oShop = &TdbShop::GetInstance($oPortal->id);
} else {
$oShop = TdbShop::GetInstance();
}
$oImageSizeList = &TdbShopArticleImageSizeList::GetListForShopId($oShop->id);
$oExportObject->aImages = array();
$oImagePropertyList = &$this->GetFieldShopArticleImageList();
$aImageData = array('original' => array(), 'thumb' => array());
while ($oImageProperty = &$oImagePropertyList->Next()) {
$oImage = $oImageProperty->GetImage(0, 'cms_media_id');
if (null !== $oImage) {
$aImageData['original'][] = $oImage->GetFullURL();
$aImageData['originalLocal'][] = $oImage->GetFullLocalPath();
}
}
$oImageSizeList->GoToStart();
while ($oImageSize = &$oImageSizeList->Next()) {
$oPreviewImageDescription = &$this->GetImagePreviewObject($oImageSize->fieldNameInternal);
if (null !== $oPreviewImageDescription) {
$oImage = $oPreviewImageDescription->GetImageThumbnailObject();
$aImageData['thumb'][$oImageSize->fieldNameInternal] = $oImage->GetFullURL();
$aImageData['thumbLocal'][$oImageSize->fieldNameInternal] = $oImage->GetFullLocalPath();
}
}
$oExportObject->aImages = $aImageData;
// DeepLink
$oExportObject->fieldDeepLink = $this->GetDetailLink(true);
// Author Lost
$oContributorList = $this->GetContributorList(array('author'));
$aContributorList = array();
while ($oContributor = $oContributorList->Next()) {
$aContributorList[] = $oContributor->GetName();
}
$oExportObject->aAuthors = $aContributorList;
// Stock Message
$oExportObject->oStockMessage = $this->GetFieldShopStockMessage();
return $oExportObject;
} | [
"public",
"function",
"GetExportObject",
"(",
")",
"{",
"$",
"oExportObject",
"=",
"new",
"stdClass",
"(",
")",
";",
"$",
"oExportObject",
"->",
"id",
"=",
"$",
"this",
"->",
"id",
";",
"foreach",
"(",
"$",
"this",
"as",
"$",
"sPropName",
"=>",
"$",
"sPropVal",
")",
"{",
"if",
"(",
"'field'",
"==",
"substr",
"(",
"$",
"sPropName",
",",
"0",
",",
"5",
")",
")",
"{",
"$",
"oExportObject",
"->",
"{",
"$",
"sPropName",
"}",
"=",
"$",
"sPropVal",
";",
"}",
"}",
"// Add additional infos that might be useful for an export",
"// Images",
"if",
"(",
"TGlobal",
"::",
"IsCMSMode",
"(",
")",
")",
"{",
"$",
"oPortals",
"=",
"&",
"TdbCmsPortalList",
"::",
"GetList",
"(",
")",
";",
"$",
"oPortal",
"=",
"$",
"oPortals",
"->",
"Current",
"(",
")",
";",
"$",
"oShop",
"=",
"&",
"TdbShop",
"::",
"GetInstance",
"(",
"$",
"oPortal",
"->",
"id",
")",
";",
"}",
"else",
"{",
"$",
"oShop",
"=",
"TdbShop",
"::",
"GetInstance",
"(",
")",
";",
"}",
"$",
"oImageSizeList",
"=",
"&",
"TdbShopArticleImageSizeList",
"::",
"GetListForShopId",
"(",
"$",
"oShop",
"->",
"id",
")",
";",
"$",
"oExportObject",
"->",
"aImages",
"=",
"array",
"(",
")",
";",
"$",
"oImagePropertyList",
"=",
"&",
"$",
"this",
"->",
"GetFieldShopArticleImageList",
"(",
")",
";",
"$",
"aImageData",
"=",
"array",
"(",
"'original'",
"=>",
"array",
"(",
")",
",",
"'thumb'",
"=>",
"array",
"(",
")",
")",
";",
"while",
"(",
"$",
"oImageProperty",
"=",
"&",
"$",
"oImagePropertyList",
"->",
"Next",
"(",
")",
")",
"{",
"$",
"oImage",
"=",
"$",
"oImageProperty",
"->",
"GetImage",
"(",
"0",
",",
"'cms_media_id'",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"oImage",
")",
"{",
"$",
"aImageData",
"[",
"'original'",
"]",
"[",
"]",
"=",
"$",
"oImage",
"->",
"GetFullURL",
"(",
")",
";",
"$",
"aImageData",
"[",
"'originalLocal'",
"]",
"[",
"]",
"=",
"$",
"oImage",
"->",
"GetFullLocalPath",
"(",
")",
";",
"}",
"}",
"$",
"oImageSizeList",
"->",
"GoToStart",
"(",
")",
";",
"while",
"(",
"$",
"oImageSize",
"=",
"&",
"$",
"oImageSizeList",
"->",
"Next",
"(",
")",
")",
"{",
"$",
"oPreviewImageDescription",
"=",
"&",
"$",
"this",
"->",
"GetImagePreviewObject",
"(",
"$",
"oImageSize",
"->",
"fieldNameInternal",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"oPreviewImageDescription",
")",
"{",
"$",
"oImage",
"=",
"$",
"oPreviewImageDescription",
"->",
"GetImageThumbnailObject",
"(",
")",
";",
"$",
"aImageData",
"[",
"'thumb'",
"]",
"[",
"$",
"oImageSize",
"->",
"fieldNameInternal",
"]",
"=",
"$",
"oImage",
"->",
"GetFullURL",
"(",
")",
";",
"$",
"aImageData",
"[",
"'thumbLocal'",
"]",
"[",
"$",
"oImageSize",
"->",
"fieldNameInternal",
"]",
"=",
"$",
"oImage",
"->",
"GetFullLocalPath",
"(",
")",
";",
"}",
"}",
"$",
"oExportObject",
"->",
"aImages",
"=",
"$",
"aImageData",
";",
"// DeepLink",
"$",
"oExportObject",
"->",
"fieldDeepLink",
"=",
"$",
"this",
"->",
"GetDetailLink",
"(",
"true",
")",
";",
"// Author Lost",
"$",
"oContributorList",
"=",
"$",
"this",
"->",
"GetContributorList",
"(",
"array",
"(",
"'author'",
")",
")",
";",
"$",
"aContributorList",
"=",
"array",
"(",
")",
";",
"while",
"(",
"$",
"oContributor",
"=",
"$",
"oContributorList",
"->",
"Next",
"(",
")",
")",
"{",
"$",
"aContributorList",
"[",
"]",
"=",
"$",
"oContributor",
"->",
"GetName",
"(",
")",
";",
"}",
"$",
"oExportObject",
"->",
"aAuthors",
"=",
"$",
"aContributorList",
";",
"// Stock Message",
"$",
"oExportObject",
"->",
"oStockMessage",
"=",
"$",
"this",
"->",
"GetFieldShopStockMessage",
"(",
")",
";",
"return",
"$",
"oExportObject",
";",
"}"
] | returns an article object with additional elements needed for exports and
interfaces like full URL image links, attachment links and so on.
When called from CMS BackEnd it WILL use the first portal/shop found
@return stdClass | [
"returns",
"an",
"article",
"object",
"with",
"additional",
"elements",
"needed",
"for",
"exports",
"and",
"interfaces",
"like",
"full",
"URL",
"image",
"links",
"attachment",
"links",
"and",
"so",
"on",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L963-L1021 |
31,962 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticle.class.php | TShopArticle.IsInCategory | public function IsInCategory($aCategoryList)
{
$bIsInCategory = false;
if (in_array($this->fieldShopCategoryId, $aCategoryList)) {
$bIsInCategory = true;
} else {
$aArticleCategories = $this->GetMLTIdList('shop_category_mlt');
$aIntersec = array_intersect($aArticleCategories, $aCategoryList);
if (0 == count($aIntersec) && 0 == count($aArticleCategories) && $this->IsVariant()) {
$oParent = &$this->GetFieldVariantParent();
if ($oParent) {
$bIsInCategory = $oParent->IsInCategory($aCategoryList);
}
} else {
$bIsInCategory = (count($aIntersec) > 0);
}
}
return $bIsInCategory;
} | php | public function IsInCategory($aCategoryList)
{
$bIsInCategory = false;
if (in_array($this->fieldShopCategoryId, $aCategoryList)) {
$bIsInCategory = true;
} else {
$aArticleCategories = $this->GetMLTIdList('shop_category_mlt');
$aIntersec = array_intersect($aArticleCategories, $aCategoryList);
if (0 == count($aIntersec) && 0 == count($aArticleCategories) && $this->IsVariant()) {
$oParent = &$this->GetFieldVariantParent();
if ($oParent) {
$bIsInCategory = $oParent->IsInCategory($aCategoryList);
}
} else {
$bIsInCategory = (count($aIntersec) > 0);
}
}
return $bIsInCategory;
} | [
"public",
"function",
"IsInCategory",
"(",
"$",
"aCategoryList",
")",
"{",
"$",
"bIsInCategory",
"=",
"false",
";",
"if",
"(",
"in_array",
"(",
"$",
"this",
"->",
"fieldShopCategoryId",
",",
"$",
"aCategoryList",
")",
")",
"{",
"$",
"bIsInCategory",
"=",
"true",
";",
"}",
"else",
"{",
"$",
"aArticleCategories",
"=",
"$",
"this",
"->",
"GetMLTIdList",
"(",
"'shop_category_mlt'",
")",
";",
"$",
"aIntersec",
"=",
"array_intersect",
"(",
"$",
"aArticleCategories",
",",
"$",
"aCategoryList",
")",
";",
"if",
"(",
"0",
"==",
"count",
"(",
"$",
"aIntersec",
")",
"&&",
"0",
"==",
"count",
"(",
"$",
"aArticleCategories",
")",
"&&",
"$",
"this",
"->",
"IsVariant",
"(",
")",
")",
"{",
"$",
"oParent",
"=",
"&",
"$",
"this",
"->",
"GetFieldVariantParent",
"(",
")",
";",
"if",
"(",
"$",
"oParent",
")",
"{",
"$",
"bIsInCategory",
"=",
"$",
"oParent",
"->",
"IsInCategory",
"(",
"$",
"aCategoryList",
")",
";",
"}",
"}",
"else",
"{",
"$",
"bIsInCategory",
"=",
"(",
"count",
"(",
"$",
"aIntersec",
")",
">",
"0",
")",
";",
"}",
"}",
"return",
"$",
"bIsInCategory",
";",
"}"
] | return true if the article is in at least one of the categories.
@param array $aCategoryList
@return bool | [
"return",
"true",
"if",
"the",
"article",
"is",
"in",
"at",
"least",
"one",
"of",
"the",
"categories",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L1030-L1049 |
31,963 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticle.class.php | TShopArticle.UpdateProductViewCount | public function UpdateProductViewCount()
{
if (CMS_SHOP_TRACK_ARTICLE_DETAIL_VIEWS && !is_null($this->id)) {
$this->getProductStatsService()->add($this->id, ProductStatisticsServiceInterface::TYPE_DETAIL_VIEWS, 1);
}
} | php | public function UpdateProductViewCount()
{
if (CMS_SHOP_TRACK_ARTICLE_DETAIL_VIEWS && !is_null($this->id)) {
$this->getProductStatsService()->add($this->id, ProductStatisticsServiceInterface::TYPE_DETAIL_VIEWS, 1);
}
} | [
"public",
"function",
"UpdateProductViewCount",
"(",
")",
"{",
"if",
"(",
"CMS_SHOP_TRACK_ARTICLE_DETAIL_VIEWS",
"&&",
"!",
"is_null",
"(",
"$",
"this",
"->",
"id",
")",
")",
"{",
"$",
"this",
"->",
"getProductStatsService",
"(",
")",
"->",
"add",
"(",
"$",
"this",
"->",
"id",
",",
"ProductStatisticsServiceInterface",
"::",
"TYPE_DETAIL_VIEWS",
",",
"1",
")",
";",
"}",
"}"
] | increase the product view counter by one. | [
"increase",
"the",
"product",
"view",
"counter",
"by",
"one",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L1054-L1059 |
31,964 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticle.class.php | TShopArticle.UpdateStatsReviews | public function UpdateStatsReviews()
{
$sArticleId = $this->id;
if ($this->IsVariant()) {
$sArticleId = $this->fieldVariantParentId;
}
$iCount = $this->GetReviewCount(true);
$dAvrg = $this->GetReviewAverageScore(true);
$this->getProductStatsService()->set($this->id, ProductStatisticsServiceInterface::TYPE_REVIEW_AVERAGE, $dAvrg);
$this->getProductStatsService()->set($this->id, ProductStatisticsServiceInterface::TYPE_REVIEW_COUNT, $iCount);
TCacheManager::PerformeTableChange($this->table, $sArticleId);
} | php | public function UpdateStatsReviews()
{
$sArticleId = $this->id;
if ($this->IsVariant()) {
$sArticleId = $this->fieldVariantParentId;
}
$iCount = $this->GetReviewCount(true);
$dAvrg = $this->GetReviewAverageScore(true);
$this->getProductStatsService()->set($this->id, ProductStatisticsServiceInterface::TYPE_REVIEW_AVERAGE, $dAvrg);
$this->getProductStatsService()->set($this->id, ProductStatisticsServiceInterface::TYPE_REVIEW_COUNT, $iCount);
TCacheManager::PerformeTableChange($this->table, $sArticleId);
} | [
"public",
"function",
"UpdateStatsReviews",
"(",
")",
"{",
"$",
"sArticleId",
"=",
"$",
"this",
"->",
"id",
";",
"if",
"(",
"$",
"this",
"->",
"IsVariant",
"(",
")",
")",
"{",
"$",
"sArticleId",
"=",
"$",
"this",
"->",
"fieldVariantParentId",
";",
"}",
"$",
"iCount",
"=",
"$",
"this",
"->",
"GetReviewCount",
"(",
"true",
")",
";",
"$",
"dAvrg",
"=",
"$",
"this",
"->",
"GetReviewAverageScore",
"(",
"true",
")",
";",
"$",
"this",
"->",
"getProductStatsService",
"(",
")",
"->",
"set",
"(",
"$",
"this",
"->",
"id",
",",
"ProductStatisticsServiceInterface",
"::",
"TYPE_REVIEW_AVERAGE",
",",
"$",
"dAvrg",
")",
";",
"$",
"this",
"->",
"getProductStatsService",
"(",
")",
"->",
"set",
"(",
"$",
"this",
"->",
"id",
",",
"ProductStatisticsServiceInterface",
"::",
"TYPE_REVIEW_COUNT",
",",
"$",
"iCount",
")",
";",
"TCacheManager",
"::",
"PerformeTableChange",
"(",
"$",
"this",
"->",
"table",
",",
"$",
"sArticleId",
")",
";",
"}"
] | updates the review stats for the article. | [
"updates",
"the",
"review",
"stats",
"for",
"the",
"article",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L1064-L1075 |
31,965 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticle.class.php | TShopArticle.GetMetaKeywords | public function GetMetaKeywords()
{
if (strlen(trim(strip_tags($this->fieldMetaKeywords))) > 0) {
$aKeywords = explode(',', trim(strip_tags($this->fieldMetaKeywords)));
} else {
$aKeywords = explode(' ', $this->fieldName.' '.strip_tags($this->fieldDescriptionShort));
}
return $aKeywords;
} | php | public function GetMetaKeywords()
{
if (strlen(trim(strip_tags($this->fieldMetaKeywords))) > 0) {
$aKeywords = explode(',', trim(strip_tags($this->fieldMetaKeywords)));
} else {
$aKeywords = explode(' ', $this->fieldName.' '.strip_tags($this->fieldDescriptionShort));
}
return $aKeywords;
} | [
"public",
"function",
"GetMetaKeywords",
"(",
")",
"{",
"if",
"(",
"strlen",
"(",
"trim",
"(",
"strip_tags",
"(",
"$",
"this",
"->",
"fieldMetaKeywords",
")",
")",
")",
">",
"0",
")",
"{",
"$",
"aKeywords",
"=",
"explode",
"(",
"','",
",",
"trim",
"(",
"strip_tags",
"(",
"$",
"this",
"->",
"fieldMetaKeywords",
")",
")",
")",
";",
"}",
"else",
"{",
"$",
"aKeywords",
"=",
"explode",
"(",
"' '",
",",
"$",
"this",
"->",
"fieldName",
".",
"' '",
".",
"strip_tags",
"(",
"$",
"this",
"->",
"fieldDescriptionShort",
")",
")",
";",
"}",
"return",
"$",
"aKeywords",
";",
"}"
] | return keywords for the meta tag on article detail pages.
@return array | [
"return",
"keywords",
"for",
"the",
"meta",
"tag",
"on",
"article",
"detail",
"pages",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L1082-L1091 |
31,966 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticle.class.php | TShopArticle.HasVariants | public function HasVariants($bCheckForActiveVariantsOnly = false)
{
if ($this->IsVariant()) {
return false;
}
$sInternalCacheKey = 'bHasVariants';
if ($bCheckForActiveVariantsOnly) {
$sInternalCacheKey .= 'OnlyActive';
}
$bHasVariants = &$this->GetFromInternalCache($sInternalCacheKey);
if (is_null($bHasVariants)) {
$bHasVariants = false;
if (!empty($this->fieldShopVariantSetId)) {
$oVariants = $this->GetFieldShopArticleVariantsList(array(), $bCheckForActiveVariantsOnly);
$bHasVariants = (!is_null($oVariants) && $oVariants->Length() > 0);
}
$this->SetInternalCache($sInternalCacheKey, $bHasVariants);
}
return $bHasVariants;
} | php | public function HasVariants($bCheckForActiveVariantsOnly = false)
{
if ($this->IsVariant()) {
return false;
}
$sInternalCacheKey = 'bHasVariants';
if ($bCheckForActiveVariantsOnly) {
$sInternalCacheKey .= 'OnlyActive';
}
$bHasVariants = &$this->GetFromInternalCache($sInternalCacheKey);
if (is_null($bHasVariants)) {
$bHasVariants = false;
if (!empty($this->fieldShopVariantSetId)) {
$oVariants = $this->GetFieldShopArticleVariantsList(array(), $bCheckForActiveVariantsOnly);
$bHasVariants = (!is_null($oVariants) && $oVariants->Length() > 0);
}
$this->SetInternalCache($sInternalCacheKey, $bHasVariants);
}
return $bHasVariants;
} | [
"public",
"function",
"HasVariants",
"(",
"$",
"bCheckForActiveVariantsOnly",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"IsVariant",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"sInternalCacheKey",
"=",
"'bHasVariants'",
";",
"if",
"(",
"$",
"bCheckForActiveVariantsOnly",
")",
"{",
"$",
"sInternalCacheKey",
".=",
"'OnlyActive'",
";",
"}",
"$",
"bHasVariants",
"=",
"&",
"$",
"this",
"->",
"GetFromInternalCache",
"(",
"$",
"sInternalCacheKey",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"bHasVariants",
")",
")",
"{",
"$",
"bHasVariants",
"=",
"false",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"fieldShopVariantSetId",
")",
")",
"{",
"$",
"oVariants",
"=",
"$",
"this",
"->",
"GetFieldShopArticleVariantsList",
"(",
"array",
"(",
")",
",",
"$",
"bCheckForActiveVariantsOnly",
")",
";",
"$",
"bHasVariants",
"=",
"(",
"!",
"is_null",
"(",
"$",
"oVariants",
")",
"&&",
"$",
"oVariants",
"->",
"Length",
"(",
")",
">",
"0",
")",
";",
"}",
"$",
"this",
"->",
"SetInternalCache",
"(",
"$",
"sInternalCacheKey",
",",
"$",
"bHasVariants",
")",
";",
"}",
"return",
"$",
"bHasVariants",
";",
"}"
] | return true if the article has variants.
@param bool $bCheckForActiveVariantsOnly
@return bool | [
"return",
"true",
"if",
"the",
"article",
"has",
"variants",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L1190-L1210 |
31,967 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticle.class.php | TShopArticle.& | public function &GetFieldShopArticleVariantsList($aSelectedTypeValues = array(), $bLoadOnlyActive = true)
{
$sKey = 'oFieldShopArticleVariantsList'.serialize($aSelectedTypeValues);
if ($bLoadOnlyActive) {
$sKey .= 'active';
} else {
$sKey .= 'inactive';
}
$oVariantList = &$this->GetFromInternalCache($sKey);
if (is_null($oVariantList)) {
if (count($aSelectedTypeValues) > 0) {
$query = "SELECT `shop_article`.*
FROM `shop_article`
LEFT JOIN `shop_article_shop_variant_type_value_mlt` ON `shop_article`.`id` = `shop_article_shop_variant_type_value_mlt`.`source_id`
LEFT JOIN `shop_variant_type_value` ON `shop_article_shop_variant_type_value_mlt`.`target_id` = `shop_variant_type_value`.`id`
WHERE `shop_article`.`variant_parent_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."'
";
$aRestriction = array();
foreach ($aSelectedTypeValues as $sShopVariantTypeId => $sShopVariantTypeValueId) {
$aRestriction[] = "(`shop_variant_type_value`.`shop_variant_type_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($sShopVariantTypeId)."' AND `shop_variant_type_value`.`id` = '".MySqlLegacySupport::getInstance()->real_escape_string($sShopVariantTypeValueId)."')";
}
$query .= ' AND ('.implode(' OR ', $aRestriction).')';
if ($bLoadOnlyActive) {
$sActiveArticleRestriction = TdbShopArticleList::GetActiveArticleQueryRestriction(false);
if (!empty($sActiveArticleRestriction)) {
$query .= ' AND ('.$sActiveArticleRestriction.')';
}
}
$query .= ' GROUP BY `shop_article`.`id` HAVING COUNT(`shop_article`.`id`) = '.count($aSelectedTypeValues);
$oVariantList = TdbShopArticleList::GetList($query);
} else {
$query = "SELECT `shop_article`.*
FROM `shop_article`
WHERE `shop_article`.`variant_parent_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."'
";
if ($bLoadOnlyActive) {
$sActiveArticleRestriction = TdbShopArticleList::GetActiveArticleQueryRestriction(false);
if (!empty($sActiveArticleRestriction)) {
$query .= ' AND ('.$sActiveArticleRestriction.')';
}
}
$oVariantList = TdbShopArticleList::GetList($query);
}
$oVariantList->bAllowItemCache = true;
$this->SetInternalCache($sKey, $oVariantList);
}
$oVariantList->GoToStart();
return $oVariantList;
} | php | public function &GetFieldShopArticleVariantsList($aSelectedTypeValues = array(), $bLoadOnlyActive = true)
{
$sKey = 'oFieldShopArticleVariantsList'.serialize($aSelectedTypeValues);
if ($bLoadOnlyActive) {
$sKey .= 'active';
} else {
$sKey .= 'inactive';
}
$oVariantList = &$this->GetFromInternalCache($sKey);
if (is_null($oVariantList)) {
if (count($aSelectedTypeValues) > 0) {
$query = "SELECT `shop_article`.*
FROM `shop_article`
LEFT JOIN `shop_article_shop_variant_type_value_mlt` ON `shop_article`.`id` = `shop_article_shop_variant_type_value_mlt`.`source_id`
LEFT JOIN `shop_variant_type_value` ON `shop_article_shop_variant_type_value_mlt`.`target_id` = `shop_variant_type_value`.`id`
WHERE `shop_article`.`variant_parent_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."'
";
$aRestriction = array();
foreach ($aSelectedTypeValues as $sShopVariantTypeId => $sShopVariantTypeValueId) {
$aRestriction[] = "(`shop_variant_type_value`.`shop_variant_type_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($sShopVariantTypeId)."' AND `shop_variant_type_value`.`id` = '".MySqlLegacySupport::getInstance()->real_escape_string($sShopVariantTypeValueId)."')";
}
$query .= ' AND ('.implode(' OR ', $aRestriction).')';
if ($bLoadOnlyActive) {
$sActiveArticleRestriction = TdbShopArticleList::GetActiveArticleQueryRestriction(false);
if (!empty($sActiveArticleRestriction)) {
$query .= ' AND ('.$sActiveArticleRestriction.')';
}
}
$query .= ' GROUP BY `shop_article`.`id` HAVING COUNT(`shop_article`.`id`) = '.count($aSelectedTypeValues);
$oVariantList = TdbShopArticleList::GetList($query);
} else {
$query = "SELECT `shop_article`.*
FROM `shop_article`
WHERE `shop_article`.`variant_parent_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."'
";
if ($bLoadOnlyActive) {
$sActiveArticleRestriction = TdbShopArticleList::GetActiveArticleQueryRestriction(false);
if (!empty($sActiveArticleRestriction)) {
$query .= ' AND ('.$sActiveArticleRestriction.')';
}
}
$oVariantList = TdbShopArticleList::GetList($query);
}
$oVariantList->bAllowItemCache = true;
$this->SetInternalCache($sKey, $oVariantList);
}
$oVariantList->GoToStart();
return $oVariantList;
} | [
"public",
"function",
"&",
"GetFieldShopArticleVariantsList",
"(",
"$",
"aSelectedTypeValues",
"=",
"array",
"(",
")",
",",
"$",
"bLoadOnlyActive",
"=",
"true",
")",
"{",
"$",
"sKey",
"=",
"'oFieldShopArticleVariantsList'",
".",
"serialize",
"(",
"$",
"aSelectedTypeValues",
")",
";",
"if",
"(",
"$",
"bLoadOnlyActive",
")",
"{",
"$",
"sKey",
".=",
"'active'",
";",
"}",
"else",
"{",
"$",
"sKey",
".=",
"'inactive'",
";",
"}",
"$",
"oVariantList",
"=",
"&",
"$",
"this",
"->",
"GetFromInternalCache",
"(",
"$",
"sKey",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"oVariantList",
")",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"aSelectedTypeValues",
")",
">",
"0",
")",
"{",
"$",
"query",
"=",
"\"SELECT `shop_article`.*\n FROM `shop_article`\n LEFT JOIN `shop_article_shop_variant_type_value_mlt` ON `shop_article`.`id` = `shop_article_shop_variant_type_value_mlt`.`source_id`\n LEFT JOIN `shop_variant_type_value` ON `shop_article_shop_variant_type_value_mlt`.`target_id` = `shop_variant_type_value`.`id`\n WHERE `shop_article`.`variant_parent_id` = '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"this",
"->",
"id",
")",
".",
"\"'\n \"",
";",
"$",
"aRestriction",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"aSelectedTypeValues",
"as",
"$",
"sShopVariantTypeId",
"=>",
"$",
"sShopVariantTypeValueId",
")",
"{",
"$",
"aRestriction",
"[",
"]",
"=",
"\"(`shop_variant_type_value`.`shop_variant_type_id` = '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"sShopVariantTypeId",
")",
".",
"\"' AND `shop_variant_type_value`.`id` = '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"sShopVariantTypeValueId",
")",
".",
"\"')\"",
";",
"}",
"$",
"query",
".=",
"' AND ('",
".",
"implode",
"(",
"' OR '",
",",
"$",
"aRestriction",
")",
".",
"')'",
";",
"if",
"(",
"$",
"bLoadOnlyActive",
")",
"{",
"$",
"sActiveArticleRestriction",
"=",
"TdbShopArticleList",
"::",
"GetActiveArticleQueryRestriction",
"(",
"false",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"sActiveArticleRestriction",
")",
")",
"{",
"$",
"query",
".=",
"' AND ('",
".",
"$",
"sActiveArticleRestriction",
".",
"')'",
";",
"}",
"}",
"$",
"query",
".=",
"' GROUP BY `shop_article`.`id` HAVING COUNT(`shop_article`.`id`) = '",
".",
"count",
"(",
"$",
"aSelectedTypeValues",
")",
";",
"$",
"oVariantList",
"=",
"TdbShopArticleList",
"::",
"GetList",
"(",
"$",
"query",
")",
";",
"}",
"else",
"{",
"$",
"query",
"=",
"\"SELECT `shop_article`.*\n FROM `shop_article`\n WHERE `shop_article`.`variant_parent_id` = '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"this",
"->",
"id",
")",
".",
"\"'\n \"",
";",
"if",
"(",
"$",
"bLoadOnlyActive",
")",
"{",
"$",
"sActiveArticleRestriction",
"=",
"TdbShopArticleList",
"::",
"GetActiveArticleQueryRestriction",
"(",
"false",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"sActiveArticleRestriction",
")",
")",
"{",
"$",
"query",
".=",
"' AND ('",
".",
"$",
"sActiveArticleRestriction",
".",
"')'",
";",
"}",
"}",
"$",
"oVariantList",
"=",
"TdbShopArticleList",
"::",
"GetList",
"(",
"$",
"query",
")",
";",
"}",
"$",
"oVariantList",
"->",
"bAllowItemCache",
"=",
"true",
";",
"$",
"this",
"->",
"SetInternalCache",
"(",
"$",
"sKey",
",",
"$",
"oVariantList",
")",
";",
"}",
"$",
"oVariantList",
"->",
"GoToStart",
"(",
")",
";",
"return",
"$",
"oVariantList",
";",
"}"
] | load list of article variants.
@param array $aSelectedTypeValues - restrict list to values matching this preselection (format: array(shop_variant_type_id=>shop_variant_type_value_id,...)
@param bool $bLoadOnlyActive
@return TdbShopArticleList | [
"load",
"list",
"of",
"article",
"variants",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L1220-L1271 |
31,968 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticle.class.php | TShopArticle.GetLowestPricedVariant | public function GetLowestPricedVariant()
{
$oLowestPrictedVariant = null;
$oVariants = $this->GetFieldShopArticleVariantsList();
while ($oVariant = $oVariants->Next()) {
if (is_null($oLowestPrictedVariant) || $oVariant->fieldPrice < $oLowestPrictedVariant->fieldPrice) {
$oLowestPrictedVariant = $oVariant;
}
}
return $oLowestPrictedVariant;
} | php | public function GetLowestPricedVariant()
{
$oLowestPrictedVariant = null;
$oVariants = $this->GetFieldShopArticleVariantsList();
while ($oVariant = $oVariants->Next()) {
if (is_null($oLowestPrictedVariant) || $oVariant->fieldPrice < $oLowestPrictedVariant->fieldPrice) {
$oLowestPrictedVariant = $oVariant;
}
}
return $oLowestPrictedVariant;
} | [
"public",
"function",
"GetLowestPricedVariant",
"(",
")",
"{",
"$",
"oLowestPrictedVariant",
"=",
"null",
";",
"$",
"oVariants",
"=",
"$",
"this",
"->",
"GetFieldShopArticleVariantsList",
"(",
")",
";",
"while",
"(",
"$",
"oVariant",
"=",
"$",
"oVariants",
"->",
"Next",
"(",
")",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"oLowestPrictedVariant",
")",
"||",
"$",
"oVariant",
"->",
"fieldPrice",
"<",
"$",
"oLowestPrictedVariant",
"->",
"fieldPrice",
")",
"{",
"$",
"oLowestPrictedVariant",
"=",
"$",
"oVariant",
";",
"}",
"}",
"return",
"$",
"oLowestPrictedVariant",
";",
"}"
] | return variant with the lowest price.
@return TdbShopArticle | [
"return",
"variant",
"with",
"the",
"lowest",
"price",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L1278-L1290 |
31,969 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticle.class.php | TShopArticle.getVariantIDList | public function getVariantIDList($aSelectedTypeValues = array(), $bLoadActiveOnly = true)
{
$aArticleIdList = array();
$oVariantList = null;
if ($this->IsVariant()) {
$oParent = &$this->GetFieldVariantParent();
$oVariantList = $oParent->GetFieldShopArticleVariantsList($aSelectedTypeValues, $bLoadActiveOnly);
} else {
$oVariantList = $this->GetFieldShopArticleVariantsList($aSelectedTypeValues, $bLoadActiveOnly);
}
if ($oVariantList->Length() > 0) {
$oVariantList->GoToStart();
while ($oVariantArticle = $oVariantList->Next()) {
$aArticleIdList[] = MySqlLegacySupport::getInstance()->real_escape_string($oVariantArticle->id);
}
}
return $aArticleIdList;
} | php | public function getVariantIDList($aSelectedTypeValues = array(), $bLoadActiveOnly = true)
{
$aArticleIdList = array();
$oVariantList = null;
if ($this->IsVariant()) {
$oParent = &$this->GetFieldVariantParent();
$oVariantList = $oParent->GetFieldShopArticleVariantsList($aSelectedTypeValues, $bLoadActiveOnly);
} else {
$oVariantList = $this->GetFieldShopArticleVariantsList($aSelectedTypeValues, $bLoadActiveOnly);
}
if ($oVariantList->Length() > 0) {
$oVariantList->GoToStart();
while ($oVariantArticle = $oVariantList->Next()) {
$aArticleIdList[] = MySqlLegacySupport::getInstance()->real_escape_string($oVariantArticle->id);
}
}
return $aArticleIdList;
} | [
"public",
"function",
"getVariantIDList",
"(",
"$",
"aSelectedTypeValues",
"=",
"array",
"(",
")",
",",
"$",
"bLoadActiveOnly",
"=",
"true",
")",
"{",
"$",
"aArticleIdList",
"=",
"array",
"(",
")",
";",
"$",
"oVariantList",
"=",
"null",
";",
"if",
"(",
"$",
"this",
"->",
"IsVariant",
"(",
")",
")",
"{",
"$",
"oParent",
"=",
"&",
"$",
"this",
"->",
"GetFieldVariantParent",
"(",
")",
";",
"$",
"oVariantList",
"=",
"$",
"oParent",
"->",
"GetFieldShopArticleVariantsList",
"(",
"$",
"aSelectedTypeValues",
",",
"$",
"bLoadActiveOnly",
")",
";",
"}",
"else",
"{",
"$",
"oVariantList",
"=",
"$",
"this",
"->",
"GetFieldShopArticleVariantsList",
"(",
"$",
"aSelectedTypeValues",
",",
"$",
"bLoadActiveOnly",
")",
";",
"}",
"if",
"(",
"$",
"oVariantList",
"->",
"Length",
"(",
")",
">",
"0",
")",
"{",
"$",
"oVariantList",
"->",
"GoToStart",
"(",
")",
";",
"while",
"(",
"$",
"oVariantArticle",
"=",
"$",
"oVariantList",
"->",
"Next",
"(",
")",
")",
"{",
"$",
"aArticleIdList",
"[",
"]",
"=",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"oVariantArticle",
"->",
"id",
")",
";",
"}",
"}",
"return",
"$",
"aArticleIdList",
";",
"}"
] | returns an array of IDs of all variant articles of this article.
@param array $aSelectedTypeValues - restrict list to values matching this preselection (format: array(shop_variant_type_id=>shop_variant_type_value_id,...)
@param bool $bLoadActiveOnly - set to false if you want to load inactive articles too
@return array | [
"returns",
"an",
"array",
"of",
"IDs",
"of",
"all",
"variant",
"articles",
"of",
"this",
"article",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L1322-L1341 |
31,970 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticle.class.php | TShopArticle.GetVariantValuesAvailableForType | public function GetVariantValuesAvailableForType($oVariantType, $aSelectedTypeValues = array())
{
$oVariantValueList = null;
$aArticleIdList = $this->getVariantIDList($aSelectedTypeValues, true);
if (count($aArticleIdList) > 0) {
$query = "SELECT `shop_variant_type_value`.*
FROM `shop_variant_type_value`
INNER JOIN `shop_article_shop_variant_type_value_mlt` ON `shop_variant_type_value`.`id` = `shop_article_shop_variant_type_value_mlt`.`target_id`
WHERE `shop_variant_type_value`.`shop_variant_type_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($oVariantType->id)."'
AND `shop_article_shop_variant_type_value_mlt`.`source_id` IN ('".implode("','", $aArticleIdList)."')
GROUP BY `shop_variant_type_value`.`id`
ORDER BY `shop_variant_type_value`.`".MySqlLegacySupport::getInstance()->real_escape_string($oVariantType->fieldShopVariantTypeValueCmsfieldname).'`
';
$oVariantValueList = TdbShopVariantTypeValueList::GetList($query);
}
return $oVariantValueList;
} | php | public function GetVariantValuesAvailableForType($oVariantType, $aSelectedTypeValues = array())
{
$oVariantValueList = null;
$aArticleIdList = $this->getVariantIDList($aSelectedTypeValues, true);
if (count($aArticleIdList) > 0) {
$query = "SELECT `shop_variant_type_value`.*
FROM `shop_variant_type_value`
INNER JOIN `shop_article_shop_variant_type_value_mlt` ON `shop_variant_type_value`.`id` = `shop_article_shop_variant_type_value_mlt`.`target_id`
WHERE `shop_variant_type_value`.`shop_variant_type_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($oVariantType->id)."'
AND `shop_article_shop_variant_type_value_mlt`.`source_id` IN ('".implode("','", $aArticleIdList)."')
GROUP BY `shop_variant_type_value`.`id`
ORDER BY `shop_variant_type_value`.`".MySqlLegacySupport::getInstance()->real_escape_string($oVariantType->fieldShopVariantTypeValueCmsfieldname).'`
';
$oVariantValueList = TdbShopVariantTypeValueList::GetList($query);
}
return $oVariantValueList;
} | [
"public",
"function",
"GetVariantValuesAvailableForType",
"(",
"$",
"oVariantType",
",",
"$",
"aSelectedTypeValues",
"=",
"array",
"(",
")",
")",
"{",
"$",
"oVariantValueList",
"=",
"null",
";",
"$",
"aArticleIdList",
"=",
"$",
"this",
"->",
"getVariantIDList",
"(",
"$",
"aSelectedTypeValues",
",",
"true",
")",
";",
"if",
"(",
"count",
"(",
"$",
"aArticleIdList",
")",
">",
"0",
")",
"{",
"$",
"query",
"=",
"\"SELECT `shop_variant_type_value`.*\n FROM `shop_variant_type_value`\n INNER JOIN `shop_article_shop_variant_type_value_mlt` ON `shop_variant_type_value`.`id` = `shop_article_shop_variant_type_value_mlt`.`target_id`\n WHERE `shop_variant_type_value`.`shop_variant_type_id` = '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"oVariantType",
"->",
"id",
")",
".",
"\"'\n AND `shop_article_shop_variant_type_value_mlt`.`source_id` IN ('\"",
".",
"implode",
"(",
"\"','\"",
",",
"$",
"aArticleIdList",
")",
".",
"\"')\n GROUP BY `shop_variant_type_value`.`id`\n ORDER BY `shop_variant_type_value`.`\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"oVariantType",
"->",
"fieldShopVariantTypeValueCmsfieldname",
")",
".",
"'`\n '",
";",
"$",
"oVariantValueList",
"=",
"TdbShopVariantTypeValueList",
"::",
"GetList",
"(",
"$",
"query",
")",
";",
"}",
"return",
"$",
"oVariantValueList",
";",
"}"
] | return all variant values that are available for the given type and this article.
@param TdbShopVariantType $oVariantType
@param array $aSelectedTypeValues - restrict list to values matching this preselection (format: array(shop_variant_type_id=>shop_variant_type_value_id,...)
@return TdbShopVariantTypeValueList | [
"return",
"all",
"variant",
"values",
"that",
"are",
"available",
"for",
"the",
"given",
"type",
"and",
"this",
"article",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L1351-L1370 |
31,971 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticle.class.php | TShopArticle.GetActiveVariantValue | public function GetActiveVariantValue($sVariantTypeIdentifier)
{
$oVariantValueObject = null;
$aVariantValues = &$this->GetFromInternalCache('aActiveVariantValues');
if (is_null($aVariantValues)) {
$query = "SELECT `shop_variant_type_value`.*, `shop_variant_type`.`identifier` AS variantTypeName
FROM `shop_variant_type_value`
INNER JOIN `shop_article_shop_variant_type_value_mlt` ON `shop_variant_type_value`.`id` = `shop_article_shop_variant_type_value_mlt`.`target_id`
INNER JOIN `shop_variant_type` ON `shop_variant_type_value`.`shop_variant_type_id` = `shop_variant_type`.`id`
WHERE `shop_article_shop_variant_type_value_mlt`.`source_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."'
";
$oVariantValues = TdbShopVariantTypeValueList::GetList($query);
while ($oVariantValue = $oVariantValues->Next()) {
$aVariantValues[$oVariantValue->sqlData['variantTypeName']] = $oVariantValue;
}
$this->SetInternalCache('aActiveVariantValues', $aVariantValues);
}
if (is_array($aVariantValues) && array_key_exists($sVariantTypeIdentifier, $aVariantValues)) {
$oVariantValueObject = $aVariantValues[$sVariantTypeIdentifier];
}
return $oVariantValueObject;
} | php | public function GetActiveVariantValue($sVariantTypeIdentifier)
{
$oVariantValueObject = null;
$aVariantValues = &$this->GetFromInternalCache('aActiveVariantValues');
if (is_null($aVariantValues)) {
$query = "SELECT `shop_variant_type_value`.*, `shop_variant_type`.`identifier` AS variantTypeName
FROM `shop_variant_type_value`
INNER JOIN `shop_article_shop_variant_type_value_mlt` ON `shop_variant_type_value`.`id` = `shop_article_shop_variant_type_value_mlt`.`target_id`
INNER JOIN `shop_variant_type` ON `shop_variant_type_value`.`shop_variant_type_id` = `shop_variant_type`.`id`
WHERE `shop_article_shop_variant_type_value_mlt`.`source_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."'
";
$oVariantValues = TdbShopVariantTypeValueList::GetList($query);
while ($oVariantValue = $oVariantValues->Next()) {
$aVariantValues[$oVariantValue->sqlData['variantTypeName']] = $oVariantValue;
}
$this->SetInternalCache('aActiveVariantValues', $aVariantValues);
}
if (is_array($aVariantValues) && array_key_exists($sVariantTypeIdentifier, $aVariantValues)) {
$oVariantValueObject = $aVariantValues[$sVariantTypeIdentifier];
}
return $oVariantValueObject;
} | [
"public",
"function",
"GetActiveVariantValue",
"(",
"$",
"sVariantTypeIdentifier",
")",
"{",
"$",
"oVariantValueObject",
"=",
"null",
";",
"$",
"aVariantValues",
"=",
"&",
"$",
"this",
"->",
"GetFromInternalCache",
"(",
"'aActiveVariantValues'",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"aVariantValues",
")",
")",
"{",
"$",
"query",
"=",
"\"SELECT `shop_variant_type_value`.*, `shop_variant_type`.`identifier` AS variantTypeName\n FROM `shop_variant_type_value`\n INNER JOIN `shop_article_shop_variant_type_value_mlt` ON `shop_variant_type_value`.`id` = `shop_article_shop_variant_type_value_mlt`.`target_id`\n INNER JOIN `shop_variant_type` ON `shop_variant_type_value`.`shop_variant_type_id` = `shop_variant_type`.`id`\n WHERE `shop_article_shop_variant_type_value_mlt`.`source_id` = '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"this",
"->",
"id",
")",
".",
"\"'\n \"",
";",
"$",
"oVariantValues",
"=",
"TdbShopVariantTypeValueList",
"::",
"GetList",
"(",
"$",
"query",
")",
";",
"while",
"(",
"$",
"oVariantValue",
"=",
"$",
"oVariantValues",
"->",
"Next",
"(",
")",
")",
"{",
"$",
"aVariantValues",
"[",
"$",
"oVariantValue",
"->",
"sqlData",
"[",
"'variantTypeName'",
"]",
"]",
"=",
"$",
"oVariantValue",
";",
"}",
"$",
"this",
"->",
"SetInternalCache",
"(",
"'aActiveVariantValues'",
",",
"$",
"aVariantValues",
")",
";",
"}",
"if",
"(",
"is_array",
"(",
"$",
"aVariantValues",
")",
"&&",
"array_key_exists",
"(",
"$",
"sVariantTypeIdentifier",
",",
"$",
"aVariantValues",
")",
")",
"{",
"$",
"oVariantValueObject",
"=",
"$",
"aVariantValues",
"[",
"$",
"sVariantTypeIdentifier",
"]",
";",
"}",
"return",
"$",
"oVariantValueObject",
";",
"}"
] | returns the variant type value for the given identifier.
note: there was a typo in the method name GetActiveVaraintValue
please change your custom code to use the renamed method
(the old method name is redirected, but will be removed in the future)
@param string $sVariantTypeIdentifier
@return TdbShopVariantTypeValue - returns null if $sVariantTypeIdentifier was not found | [
"returns",
"the",
"variant",
"type",
"value",
"for",
"the",
"given",
"identifier",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L1465-L1487 |
31,972 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticle.class.php | TShopArticle.GetVariantTypeActiveValue | public function GetVariantTypeActiveValue($sVariantTypeId)
{
$sValue = false;
$aVariantValueIds = $this->GetFromInternalCache('aActiveVariantValueIds');
if (is_null($aVariantValueIds)) {
$oValueList = &$this->GetFieldShopVariantTypeValueList();
while ($oValue = $oValueList->Next()) {
$aVariantValueIds[$oValue->fieldShopVariantTypeId] = $oValue->id;
}
$oValueList->GoToStart();
$this->SetInternalCache('aActiveVariantValueIds', $aVariantValueIds);
}
if (is_array($aVariantValueIds) && array_key_exists($sVariantTypeId, $aVariantValueIds)) {
$sValue = $aVariantValueIds[$sVariantTypeId];
}
return $sValue;
} | php | public function GetVariantTypeActiveValue($sVariantTypeId)
{
$sValue = false;
$aVariantValueIds = $this->GetFromInternalCache('aActiveVariantValueIds');
if (is_null($aVariantValueIds)) {
$oValueList = &$this->GetFieldShopVariantTypeValueList();
while ($oValue = $oValueList->Next()) {
$aVariantValueIds[$oValue->fieldShopVariantTypeId] = $oValue->id;
}
$oValueList->GoToStart();
$this->SetInternalCache('aActiveVariantValueIds', $aVariantValueIds);
}
if (is_array($aVariantValueIds) && array_key_exists($sVariantTypeId, $aVariantValueIds)) {
$sValue = $aVariantValueIds[$sVariantTypeId];
}
return $sValue;
} | [
"public",
"function",
"GetVariantTypeActiveValue",
"(",
"$",
"sVariantTypeId",
")",
"{",
"$",
"sValue",
"=",
"false",
";",
"$",
"aVariantValueIds",
"=",
"$",
"this",
"->",
"GetFromInternalCache",
"(",
"'aActiveVariantValueIds'",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"aVariantValueIds",
")",
")",
"{",
"$",
"oValueList",
"=",
"&",
"$",
"this",
"->",
"GetFieldShopVariantTypeValueList",
"(",
")",
";",
"while",
"(",
"$",
"oValue",
"=",
"$",
"oValueList",
"->",
"Next",
"(",
")",
")",
"{",
"$",
"aVariantValueIds",
"[",
"$",
"oValue",
"->",
"fieldShopVariantTypeId",
"]",
"=",
"$",
"oValue",
"->",
"id",
";",
"}",
"$",
"oValueList",
"->",
"GoToStart",
"(",
")",
";",
"$",
"this",
"->",
"SetInternalCache",
"(",
"'aActiveVariantValueIds'",
",",
"$",
"aVariantValueIds",
")",
";",
"}",
"if",
"(",
"is_array",
"(",
"$",
"aVariantValueIds",
")",
"&&",
"array_key_exists",
"(",
"$",
"sVariantTypeId",
",",
"$",
"aVariantValueIds",
")",
")",
"{",
"$",
"sValue",
"=",
"$",
"aVariantValueIds",
"[",
"$",
"sVariantTypeId",
"]",
";",
"}",
"return",
"$",
"sValue",
";",
"}"
] | returns the id of the active value for the given variant type.
@param string $sVariantTypeId
@return string | [
"returns",
"the",
"id",
"of",
"the",
"active",
"value",
"for",
"the",
"given",
"variant",
"type",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L1496-L1513 |
31,973 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticle.class.php | TShopArticle.RenderVariantSelection | public function RenderVariantSelection($sViewName = 'vStandard', $sViewType = 'Customer')
{
$sHTML = '';
$oVariantSet = null;
if ($this->IsVariant()) {
$oParent = &$this->GetFieldVariantParent();
$oVariantSet = &$oParent->GetFieldShopVariantSet();
} else {
$oVariantSet = &$this->GetFieldShopVariantSet();
}
if (!is_null($oVariantSet)) {
$oHandler = $oVariantSet->GetFieldShopVariantDisplayHandler();
$sHTML = $oHandler->Render($this, $sViewName, $sViewType);
}
return $sHTML;
} | php | public function RenderVariantSelection($sViewName = 'vStandard', $sViewType = 'Customer')
{
$sHTML = '';
$oVariantSet = null;
if ($this->IsVariant()) {
$oParent = &$this->GetFieldVariantParent();
$oVariantSet = &$oParent->GetFieldShopVariantSet();
} else {
$oVariantSet = &$this->GetFieldShopVariantSet();
}
if (!is_null($oVariantSet)) {
$oHandler = $oVariantSet->GetFieldShopVariantDisplayHandler();
$sHTML = $oHandler->Render($this, $sViewName, $sViewType);
}
return $sHTML;
} | [
"public",
"function",
"RenderVariantSelection",
"(",
"$",
"sViewName",
"=",
"'vStandard'",
",",
"$",
"sViewType",
"=",
"'Customer'",
")",
"{",
"$",
"sHTML",
"=",
"''",
";",
"$",
"oVariantSet",
"=",
"null",
";",
"if",
"(",
"$",
"this",
"->",
"IsVariant",
"(",
")",
")",
"{",
"$",
"oParent",
"=",
"&",
"$",
"this",
"->",
"GetFieldVariantParent",
"(",
")",
";",
"$",
"oVariantSet",
"=",
"&",
"$",
"oParent",
"->",
"GetFieldShopVariantSet",
"(",
")",
";",
"}",
"else",
"{",
"$",
"oVariantSet",
"=",
"&",
"$",
"this",
"->",
"GetFieldShopVariantSet",
"(",
")",
";",
"}",
"if",
"(",
"!",
"is_null",
"(",
"$",
"oVariantSet",
")",
")",
"{",
"$",
"oHandler",
"=",
"$",
"oVariantSet",
"->",
"GetFieldShopVariantDisplayHandler",
"(",
")",
";",
"$",
"sHTML",
"=",
"$",
"oHandler",
"->",
"Render",
"(",
"$",
"this",
",",
"$",
"sViewName",
",",
"$",
"sViewType",
")",
";",
"}",
"return",
"$",
"sHTML",
";",
"}"
] | render the variant selection html using the display handler defined through the variant set.
@param string $sViewName
@param string $sViewType
@return string | [
"render",
"the",
"variant",
"selection",
"html",
"using",
"the",
"display",
"handler",
"defined",
"through",
"the",
"variant",
"set",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L1523-L1540 |
31,974 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticle.class.php | TShopArticle.GetVariantFromValues | public function GetVariantFromValues($aTypeValuePairs)
{
$oArticle = null;
if (!$this->IsVariant()) {
$query = "SELECT `shop_article`.*
FROM `shop_article`
INNER JOIN `shop_article_shop_variant_type_value_mlt` ON `shop_article`.`id` = `shop_article_shop_variant_type_value_mlt`.`source_id`
INNER JOIN `shop_variant_type_value` ON `shop_article_shop_variant_type_value_mlt`.`target_id` = `shop_variant_type_value`.`id`
WHERE `shop_article`.`variant_parent_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."'
";
$aParts = array();
foreach ($aTypeValuePairs as $sVariantTypeId => $sVariantTypeValueId) {
$aParts[] = "`shop_variant_type_value`.`shop_variant_type_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($sVariantTypeId)."' AND `shop_variant_type_value`.`id` = '".MySqlLegacySupport::getInstance()->real_escape_string($sVariantTypeValueId)."'";
}
$query .= ' AND ('.implode(') OR (', $aParts).')';
$query .= ' GROUP BY `shop_article`.`id`';
$query .= ' HAVING COUNT(`shop_article`.`id`) = '.MySqlLegacySupport::getInstance()->real_escape_string(count($aParts));
$query .= ' ORDER BY `shop_article`.`active` DESC'; //we want the active article if multiple present
if ($aMatch = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query))) {
$oArticle = TdbShopArticle::GetNewInstance();
$oArticle->LoadFromRow($aMatch);
}
}
return $oArticle;
} | php | public function GetVariantFromValues($aTypeValuePairs)
{
$oArticle = null;
if (!$this->IsVariant()) {
$query = "SELECT `shop_article`.*
FROM `shop_article`
INNER JOIN `shop_article_shop_variant_type_value_mlt` ON `shop_article`.`id` = `shop_article_shop_variant_type_value_mlt`.`source_id`
INNER JOIN `shop_variant_type_value` ON `shop_article_shop_variant_type_value_mlt`.`target_id` = `shop_variant_type_value`.`id`
WHERE `shop_article`.`variant_parent_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."'
";
$aParts = array();
foreach ($aTypeValuePairs as $sVariantTypeId => $sVariantTypeValueId) {
$aParts[] = "`shop_variant_type_value`.`shop_variant_type_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($sVariantTypeId)."' AND `shop_variant_type_value`.`id` = '".MySqlLegacySupport::getInstance()->real_escape_string($sVariantTypeValueId)."'";
}
$query .= ' AND ('.implode(') OR (', $aParts).')';
$query .= ' GROUP BY `shop_article`.`id`';
$query .= ' HAVING COUNT(`shop_article`.`id`) = '.MySqlLegacySupport::getInstance()->real_escape_string(count($aParts));
$query .= ' ORDER BY `shop_article`.`active` DESC'; //we want the active article if multiple present
if ($aMatch = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query))) {
$oArticle = TdbShopArticle::GetNewInstance();
$oArticle->LoadFromRow($aMatch);
}
}
return $oArticle;
} | [
"public",
"function",
"GetVariantFromValues",
"(",
"$",
"aTypeValuePairs",
")",
"{",
"$",
"oArticle",
"=",
"null",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"IsVariant",
"(",
")",
")",
"{",
"$",
"query",
"=",
"\"SELECT `shop_article`.*\n FROM `shop_article`\n INNER JOIN `shop_article_shop_variant_type_value_mlt` ON `shop_article`.`id` = `shop_article_shop_variant_type_value_mlt`.`source_id`\n INNER JOIN `shop_variant_type_value` ON `shop_article_shop_variant_type_value_mlt`.`target_id` = `shop_variant_type_value`.`id`\n WHERE `shop_article`.`variant_parent_id` = '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"this",
"->",
"id",
")",
".",
"\"'\n \"",
";",
"$",
"aParts",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"aTypeValuePairs",
"as",
"$",
"sVariantTypeId",
"=>",
"$",
"sVariantTypeValueId",
")",
"{",
"$",
"aParts",
"[",
"]",
"=",
"\"`shop_variant_type_value`.`shop_variant_type_id` = '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"sVariantTypeId",
")",
".",
"\"' AND `shop_variant_type_value`.`id` = '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"sVariantTypeValueId",
")",
".",
"\"'\"",
";",
"}",
"$",
"query",
".=",
"' AND ('",
".",
"implode",
"(",
"') OR ('",
",",
"$",
"aParts",
")",
".",
"')'",
";",
"$",
"query",
".=",
"' GROUP BY `shop_article`.`id`'",
";",
"$",
"query",
".=",
"' HAVING COUNT(`shop_article`.`id`) = '",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"count",
"(",
"$",
"aParts",
")",
")",
";",
"$",
"query",
".=",
"' ORDER BY `shop_article`.`active` DESC'",
";",
"//we want the active article if multiple present",
"if",
"(",
"$",
"aMatch",
"=",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"fetch_assoc",
"(",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"query",
"(",
"$",
"query",
")",
")",
")",
"{",
"$",
"oArticle",
"=",
"TdbShopArticle",
"::",
"GetNewInstance",
"(",
")",
";",
"$",
"oArticle",
"->",
"LoadFromRow",
"(",
"$",
"aMatch",
")",
";",
"}",
"}",
"return",
"$",
"oArticle",
";",
"}"
] | return the variant matching the shop_variant_type_value paris.
@param array $aTypeValuePairs
@return TdbShopArticle | [
"return",
"the",
"variant",
"matching",
"the",
"shop_variant_type_value",
"paris",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L1549-L1574 |
31,975 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticle.class.php | TShopArticle.GetMessageConsumerName | public function GetMessageConsumerName()
{
$sId = $this->id;
if ($this->IsVariant()) {
$sId = $this->fieldVariantParentId;
}
return TdbShopArticle::MSG_CONSUMER_BASE_NAME.$sId;
} | php | public function GetMessageConsumerName()
{
$sId = $this->id;
if ($this->IsVariant()) {
$sId = $this->fieldVariantParentId;
}
return TdbShopArticle::MSG_CONSUMER_BASE_NAME.$sId;
} | [
"public",
"function",
"GetMessageConsumerName",
"(",
")",
"{",
"$",
"sId",
"=",
"$",
"this",
"->",
"id",
";",
"if",
"(",
"$",
"this",
"->",
"IsVariant",
"(",
")",
")",
"{",
"$",
"sId",
"=",
"$",
"this",
"->",
"fieldVariantParentId",
";",
"}",
"return",
"TdbShopArticle",
"::",
"MSG_CONSUMER_BASE_NAME",
".",
"$",
"sId",
";",
"}"
] | return the message consumer name of this article. note that varaints
always talk through their parents - so if you want to talk to the
variant directly, you will need to overwrite this method.
@return string | [
"return",
"the",
"message",
"consumer",
"name",
"of",
"this",
"article",
".",
"note",
"that",
"varaints",
"always",
"talk",
"through",
"their",
"parents",
"-",
"so",
"if",
"you",
"want",
"to",
"talk",
"to",
"the",
"variant",
"directly",
"you",
"will",
"need",
"to",
"overwrite",
"this",
"method",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L1617-L1625 |
31,976 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticle.class.php | TShopArticle.& | public function &GetFieldShopBundleArticleList()
{
$oBundleList = parent::GetFieldShopBundleArticleList();
if (0 == $oBundleList->Length() && $this->IsVariant()) {
$oBundleList = $this->GetFieldVariantParent()->GetFieldShopBundleArticleList();
}
$oBundleList->bAllowItemCache = true;
return $oBundleList;
} | php | public function &GetFieldShopBundleArticleList()
{
$oBundleList = parent::GetFieldShopBundleArticleList();
if (0 == $oBundleList->Length() && $this->IsVariant()) {
$oBundleList = $this->GetFieldVariantParent()->GetFieldShopBundleArticleList();
}
$oBundleList->bAllowItemCache = true;
return $oBundleList;
} | [
"public",
"function",
"&",
"GetFieldShopBundleArticleList",
"(",
")",
"{",
"$",
"oBundleList",
"=",
"parent",
"::",
"GetFieldShopBundleArticleList",
"(",
")",
";",
"if",
"(",
"0",
"==",
"$",
"oBundleList",
"->",
"Length",
"(",
")",
"&&",
"$",
"this",
"->",
"IsVariant",
"(",
")",
")",
"{",
"$",
"oBundleList",
"=",
"$",
"this",
"->",
"GetFieldVariantParent",
"(",
")",
"->",
"GetFieldShopBundleArticleList",
"(",
")",
";",
"}",
"$",
"oBundleList",
"->",
"bAllowItemCache",
"=",
"true",
";",
"return",
"$",
"oBundleList",
";",
"}"
] | Get bundle article list - if we are a variant an no bundle articles are set, the we return the bundles of the parent.
@return TdbShopBundleArticleList | [
"Get",
"bundle",
"article",
"list",
"-",
"if",
"we",
"are",
"a",
"variant",
"an",
"no",
"bundle",
"articles",
"are",
"set",
"the",
"we",
"return",
"the",
"bundles",
"of",
"the",
"parent",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L1632-L1641 |
31,977 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticle.class.php | TShopArticle.GetFieldShopAttributeValueList | public function GetFieldShopAttributeValueList($sOrderBy = '')
{
$oAttributeValueList = parent::GetFieldShopAttributeValueList($sOrderBy);
if (0 == $oAttributeValueList->Length() && $this->IsVariant()) {
$oAttributeValueList = $this->GetFieldVariantParent()->GetFieldShopAttributeValueList($sOrderBy);
}
$oAttributeValueList->bAllowItemCache = true;
return $oAttributeValueList;
} | php | public function GetFieldShopAttributeValueList($sOrderBy = '')
{
$oAttributeValueList = parent::GetFieldShopAttributeValueList($sOrderBy);
if (0 == $oAttributeValueList->Length() && $this->IsVariant()) {
$oAttributeValueList = $this->GetFieldVariantParent()->GetFieldShopAttributeValueList($sOrderBy);
}
$oAttributeValueList->bAllowItemCache = true;
return $oAttributeValueList;
} | [
"public",
"function",
"GetFieldShopAttributeValueList",
"(",
"$",
"sOrderBy",
"=",
"''",
")",
"{",
"$",
"oAttributeValueList",
"=",
"parent",
"::",
"GetFieldShopAttributeValueList",
"(",
"$",
"sOrderBy",
")",
";",
"if",
"(",
"0",
"==",
"$",
"oAttributeValueList",
"->",
"Length",
"(",
")",
"&&",
"$",
"this",
"->",
"IsVariant",
"(",
")",
")",
"{",
"$",
"oAttributeValueList",
"=",
"$",
"this",
"->",
"GetFieldVariantParent",
"(",
")",
"->",
"GetFieldShopAttributeValueList",
"(",
"$",
"sOrderBy",
")",
";",
"}",
"$",
"oAttributeValueList",
"->",
"bAllowItemCache",
"=",
"true",
";",
"return",
"$",
"oAttributeValueList",
";",
"}"
] | get article attribute value list - if we are a variant and no attribute values are set, then we return the attribute values of
the parent.
@param string $sOrderBy - an sql order by string (without the order by)
@return TdbShopAttributeValueList | [
"get",
"article",
"attribute",
"value",
"list",
"-",
"if",
"we",
"are",
"a",
"variant",
"and",
"no",
"attribute",
"values",
"are",
"set",
"then",
"we",
"return",
"the",
"attribute",
"values",
"of",
"the",
"parent",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L1670-L1679 |
31,978 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticle.class.php | TShopArticle.GetSeoPattern | public function GetSeoPattern(&$sPaternIn)
{
//$sPaternIn = "[{PORTAL_NAME}] - [{CATEGORY_NAME}] - [{ARTICLE_NAME}]"; //default
$aPatRepl = null;
if (!empty($this->sqlData['seo_pattern'])) {
$sPaternIn = $this->sqlData['seo_pattern'];
}
$aPatRepl = array();
$activePage = $this->getActivePageService()->getActivePage();
$aPatRepl['PORTAL_NAME'] = $activePage->GetPortal()->GetTitle();
$activeCategory = $this->getShopService()->getActiveCategory();
if (is_object($activeCategory)) {
$aPatRepl['CATEGORY_NAME'] = $activeCategory->GetName();
}
$oManufacturer = $this->GetFieldShopManufacturer();
if (is_object($oManufacturer)) {
$aPatRepl['MANUFACTURER_NAME'] = $oManufacturer->GetName();
}
$aPatRepl['ARTICLE_NAME'] = $this->GetName();
return $aPatRepl;
} | php | public function GetSeoPattern(&$sPaternIn)
{
//$sPaternIn = "[{PORTAL_NAME}] - [{CATEGORY_NAME}] - [{ARTICLE_NAME}]"; //default
$aPatRepl = null;
if (!empty($this->sqlData['seo_pattern'])) {
$sPaternIn = $this->sqlData['seo_pattern'];
}
$aPatRepl = array();
$activePage = $this->getActivePageService()->getActivePage();
$aPatRepl['PORTAL_NAME'] = $activePage->GetPortal()->GetTitle();
$activeCategory = $this->getShopService()->getActiveCategory();
if (is_object($activeCategory)) {
$aPatRepl['CATEGORY_NAME'] = $activeCategory->GetName();
}
$oManufacturer = $this->GetFieldShopManufacturer();
if (is_object($oManufacturer)) {
$aPatRepl['MANUFACTURER_NAME'] = $oManufacturer->GetName();
}
$aPatRepl['ARTICLE_NAME'] = $this->GetName();
return $aPatRepl;
} | [
"public",
"function",
"GetSeoPattern",
"(",
"&",
"$",
"sPaternIn",
")",
"{",
"//$sPaternIn = \"[{PORTAL_NAME}] - [{CATEGORY_NAME}] - [{ARTICLE_NAME}]\"; //default",
"$",
"aPatRepl",
"=",
"null",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"sqlData",
"[",
"'seo_pattern'",
"]",
")",
")",
"{",
"$",
"sPaternIn",
"=",
"$",
"this",
"->",
"sqlData",
"[",
"'seo_pattern'",
"]",
";",
"}",
"$",
"aPatRepl",
"=",
"array",
"(",
")",
";",
"$",
"activePage",
"=",
"$",
"this",
"->",
"getActivePageService",
"(",
")",
"->",
"getActivePage",
"(",
")",
";",
"$",
"aPatRepl",
"[",
"'PORTAL_NAME'",
"]",
"=",
"$",
"activePage",
"->",
"GetPortal",
"(",
")",
"->",
"GetTitle",
"(",
")",
";",
"$",
"activeCategory",
"=",
"$",
"this",
"->",
"getShopService",
"(",
")",
"->",
"getActiveCategory",
"(",
")",
";",
"if",
"(",
"is_object",
"(",
"$",
"activeCategory",
")",
")",
"{",
"$",
"aPatRepl",
"[",
"'CATEGORY_NAME'",
"]",
"=",
"$",
"activeCategory",
"->",
"GetName",
"(",
")",
";",
"}",
"$",
"oManufacturer",
"=",
"$",
"this",
"->",
"GetFieldShopManufacturer",
"(",
")",
";",
"if",
"(",
"is_object",
"(",
"$",
"oManufacturer",
")",
")",
"{",
"$",
"aPatRepl",
"[",
"'MANUFACTURER_NAME'",
"]",
"=",
"$",
"oManufacturer",
"->",
"GetName",
"(",
")",
";",
"}",
"$",
"aPatRepl",
"[",
"'ARTICLE_NAME'",
"]",
"=",
"$",
"this",
"->",
"GetName",
"(",
")",
";",
"return",
"$",
"aPatRepl",
";",
"}"
] | Get SEO pattern of current article.
@param string $sPaternIn SEO pattern string
@return array SEO pattern replace values | [
"Get",
"SEO",
"pattern",
"of",
"current",
"article",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L1724-L1750 |
31,979 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticle.class.php | TShopArticle.UpdateStock | public function UpdateStock($dNewStockValue, $bNewAmountIsDelta = false, $bUpdateSaleCounter = false, $bForceUpdate = false)
{
if ($this->HasVariants()) {
return false;
}
$oldStock = $this->getAvailableStock();
// NOTE the below comparison always has true as result (compares int to double); see https://github.com/chameleon-system/chameleon-system/issues/120
$stockIsChanging = ($bNewAmountIsDelta || $oldStock !== $dNewStockValue);
if (false === $stockIsChanging && false === $bUpdateSaleCounter && false === $bForceUpdate) {
return false;
}
if ($bNewAmountIsDelta) {
$this->getInventoryService()->addStock($this->id, $dNewStockValue);
} else {
$this->getInventoryService()->setStock($this->id, $dNewStockValue);
}
if ($bUpdateSaleCounter && $bNewAmountIsDelta) {
$dSaleAmount = -1 * $dNewStockValue;
$this->getProductStatsService()->add($this->id, ProductStatisticsServiceInterface::TYPE_SALES, $dSaleAmount);
}
$newStock = $this->getAvailableStock();
$bActive = $this->CheckActivateOrDeactivate($newStock);
$this->setIsActive(1 === $bActive);
// check if the article is part of a bundle... if it is, make sure the bundle article does not exceed the total number of single items
$query = 'SELECT shop_article.*,
shop_bundle_article.amount AS ItemsPerBundle,
(shop_bundle_article.amount * shop_article_stock.amount) AS required_stock
FROM shop_article
INNER JOIN shop_bundle_article ON shop_article.id = shop_bundle_article.shop_article_id
LEFT JOIN shop_article_stock ON shop_article.id = shop_article_stock.shop_article_id
WHERE shop_bundle_article.bundle_article_id = :articleId
AND (shop_bundle_article.amount * shop_article_stock.amount) > :newStock
';
$aBundleChangeList = $this->getDatabaseConnection()->fetchAll($query, array('articleId' => $this->id, 'newStock' => $newStock), array('articleId' => \PDO::PARAM_STR, 'newStock' => \PDO::PARAM_INT));
foreach ($aBundleChangeList as $aBundleChange) {
$iAllowedStock = floor($newStock / $aBundleChange['ItemsPerBundle']);
$oBundleArticle = TdbShopArticle::GetNewInstance();
$oBundleArticle->LoadFromRow($aBundleChange);
$oBundleArticle->UpdateStock($iAllowedStock, false, false);
}
if ($oldStock !== $newStock || true === $bForceUpdate) {
$this->StockWasUpdatedHook($oldStock, $newStock);
$this->getEventDispatcher()->dispatch(ShopEvents::UPDATE_PRODUCT_STOCK, new UpdateProductStockEvent($this->id, $newStock, $oldStock));
}
return $oldStock !== $newStock;
} | php | public function UpdateStock($dNewStockValue, $bNewAmountIsDelta = false, $bUpdateSaleCounter = false, $bForceUpdate = false)
{
if ($this->HasVariants()) {
return false;
}
$oldStock = $this->getAvailableStock();
// NOTE the below comparison always has true as result (compares int to double); see https://github.com/chameleon-system/chameleon-system/issues/120
$stockIsChanging = ($bNewAmountIsDelta || $oldStock !== $dNewStockValue);
if (false === $stockIsChanging && false === $bUpdateSaleCounter && false === $bForceUpdate) {
return false;
}
if ($bNewAmountIsDelta) {
$this->getInventoryService()->addStock($this->id, $dNewStockValue);
} else {
$this->getInventoryService()->setStock($this->id, $dNewStockValue);
}
if ($bUpdateSaleCounter && $bNewAmountIsDelta) {
$dSaleAmount = -1 * $dNewStockValue;
$this->getProductStatsService()->add($this->id, ProductStatisticsServiceInterface::TYPE_SALES, $dSaleAmount);
}
$newStock = $this->getAvailableStock();
$bActive = $this->CheckActivateOrDeactivate($newStock);
$this->setIsActive(1 === $bActive);
// check if the article is part of a bundle... if it is, make sure the bundle article does not exceed the total number of single items
$query = 'SELECT shop_article.*,
shop_bundle_article.amount AS ItemsPerBundle,
(shop_bundle_article.amount * shop_article_stock.amount) AS required_stock
FROM shop_article
INNER JOIN shop_bundle_article ON shop_article.id = shop_bundle_article.shop_article_id
LEFT JOIN shop_article_stock ON shop_article.id = shop_article_stock.shop_article_id
WHERE shop_bundle_article.bundle_article_id = :articleId
AND (shop_bundle_article.amount * shop_article_stock.amount) > :newStock
';
$aBundleChangeList = $this->getDatabaseConnection()->fetchAll($query, array('articleId' => $this->id, 'newStock' => $newStock), array('articleId' => \PDO::PARAM_STR, 'newStock' => \PDO::PARAM_INT));
foreach ($aBundleChangeList as $aBundleChange) {
$iAllowedStock = floor($newStock / $aBundleChange['ItemsPerBundle']);
$oBundleArticle = TdbShopArticle::GetNewInstance();
$oBundleArticle->LoadFromRow($aBundleChange);
$oBundleArticle->UpdateStock($iAllowedStock, false, false);
}
if ($oldStock !== $newStock || true === $bForceUpdate) {
$this->StockWasUpdatedHook($oldStock, $newStock);
$this->getEventDispatcher()->dispatch(ShopEvents::UPDATE_PRODUCT_STOCK, new UpdateProductStockEvent($this->id, $newStock, $oldStock));
}
return $oldStock !== $newStock;
} | [
"public",
"function",
"UpdateStock",
"(",
"$",
"dNewStockValue",
",",
"$",
"bNewAmountIsDelta",
"=",
"false",
",",
"$",
"bUpdateSaleCounter",
"=",
"false",
",",
"$",
"bForceUpdate",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"HasVariants",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"oldStock",
"=",
"$",
"this",
"->",
"getAvailableStock",
"(",
")",
";",
"// NOTE the below comparison always has true as result (compares int to double); see https://github.com/chameleon-system/chameleon-system/issues/120",
"$",
"stockIsChanging",
"=",
"(",
"$",
"bNewAmountIsDelta",
"||",
"$",
"oldStock",
"!==",
"$",
"dNewStockValue",
")",
";",
"if",
"(",
"false",
"===",
"$",
"stockIsChanging",
"&&",
"false",
"===",
"$",
"bUpdateSaleCounter",
"&&",
"false",
"===",
"$",
"bForceUpdate",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"$",
"bNewAmountIsDelta",
")",
"{",
"$",
"this",
"->",
"getInventoryService",
"(",
")",
"->",
"addStock",
"(",
"$",
"this",
"->",
"id",
",",
"$",
"dNewStockValue",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"getInventoryService",
"(",
")",
"->",
"setStock",
"(",
"$",
"this",
"->",
"id",
",",
"$",
"dNewStockValue",
")",
";",
"}",
"if",
"(",
"$",
"bUpdateSaleCounter",
"&&",
"$",
"bNewAmountIsDelta",
")",
"{",
"$",
"dSaleAmount",
"=",
"-",
"1",
"*",
"$",
"dNewStockValue",
";",
"$",
"this",
"->",
"getProductStatsService",
"(",
")",
"->",
"add",
"(",
"$",
"this",
"->",
"id",
",",
"ProductStatisticsServiceInterface",
"::",
"TYPE_SALES",
",",
"$",
"dSaleAmount",
")",
";",
"}",
"$",
"newStock",
"=",
"$",
"this",
"->",
"getAvailableStock",
"(",
")",
";",
"$",
"bActive",
"=",
"$",
"this",
"->",
"CheckActivateOrDeactivate",
"(",
"$",
"newStock",
")",
";",
"$",
"this",
"->",
"setIsActive",
"(",
"1",
"===",
"$",
"bActive",
")",
";",
"// check if the article is part of a bundle... if it is, make sure the bundle article does not exceed the total number of single items",
"$",
"query",
"=",
"'SELECT shop_article.*,\n shop_bundle_article.amount AS ItemsPerBundle,\n (shop_bundle_article.amount * shop_article_stock.amount) AS required_stock\n FROM shop_article\n INNER JOIN shop_bundle_article ON shop_article.id = shop_bundle_article.shop_article_id\n LEFT JOIN shop_article_stock ON shop_article.id = shop_article_stock.shop_article_id\n WHERE shop_bundle_article.bundle_article_id = :articleId\n AND (shop_bundle_article.amount * shop_article_stock.amount) > :newStock\n '",
";",
"$",
"aBundleChangeList",
"=",
"$",
"this",
"->",
"getDatabaseConnection",
"(",
")",
"->",
"fetchAll",
"(",
"$",
"query",
",",
"array",
"(",
"'articleId'",
"=>",
"$",
"this",
"->",
"id",
",",
"'newStock'",
"=>",
"$",
"newStock",
")",
",",
"array",
"(",
"'articleId'",
"=>",
"\\",
"PDO",
"::",
"PARAM_STR",
",",
"'newStock'",
"=>",
"\\",
"PDO",
"::",
"PARAM_INT",
")",
")",
";",
"foreach",
"(",
"$",
"aBundleChangeList",
"as",
"$",
"aBundleChange",
")",
"{",
"$",
"iAllowedStock",
"=",
"floor",
"(",
"$",
"newStock",
"/",
"$",
"aBundleChange",
"[",
"'ItemsPerBundle'",
"]",
")",
";",
"$",
"oBundleArticle",
"=",
"TdbShopArticle",
"::",
"GetNewInstance",
"(",
")",
";",
"$",
"oBundleArticle",
"->",
"LoadFromRow",
"(",
"$",
"aBundleChange",
")",
";",
"$",
"oBundleArticle",
"->",
"UpdateStock",
"(",
"$",
"iAllowedStock",
",",
"false",
",",
"false",
")",
";",
"}",
"if",
"(",
"$",
"oldStock",
"!==",
"$",
"newStock",
"||",
"true",
"===",
"$",
"bForceUpdate",
")",
"{",
"$",
"this",
"->",
"StockWasUpdatedHook",
"(",
"$",
"oldStock",
",",
"$",
"newStock",
")",
";",
"$",
"this",
"->",
"getEventDispatcher",
"(",
")",
"->",
"dispatch",
"(",
"ShopEvents",
"::",
"UPDATE_PRODUCT_STOCK",
",",
"new",
"UpdateProductStockEvent",
"(",
"$",
"this",
"->",
"id",
",",
"$",
"newStock",
",",
"$",
"oldStock",
")",
")",
";",
"}",
"return",
"$",
"oldStock",
"!==",
"$",
"newStock",
";",
"}"
] | the methods recalculates the total available stock for a base article based on
the articles variants. You can call this either on the primary article or on
a variant - both calls will result in an update to the parent article.
@param float $dNewStockValue - optional: you can update the stock of the current article to this new value
@param bool $bNewAmountIsDelta - set to true if you want to increase or decrease the amount by some quantity
@param bool $bUpdateSaleCounter - set to true if you also want to update the sales counter (IMPORTANT: changes the sales counter ONLY if $bNewAmountIsDelta is also set to true)
@param bool $bForceUpdate - set to true, if you want to trigger update action, even if nothing changed (needed for example, if an article is changed via the table editor)
@return bool - return true if some data was changed | [
"the",
"methods",
"recalculates",
"the",
"total",
"available",
"stock",
"for",
"a",
"base",
"article",
"based",
"on",
"the",
"articles",
"variants",
".",
"You",
"can",
"call",
"this",
"either",
"on",
"the",
"primary",
"article",
"or",
"on",
"a",
"variant",
"-",
"both",
"calls",
"will",
"result",
"in",
"an",
"update",
"to",
"the",
"parent",
"article",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L1819-L1871 |
31,980 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticle.class.php | TShopArticle.CheckActivateOrDeactivate | public function CheckActivateOrDeactivate($dNewStockValue = null)
{
if (null === $dNewStockValue) {
$dNewStockValue = $this->getAvailableStock();
}
$isActive = 0;
if ($this->fieldActive) {
$isActive = 1;
}
$oStockMessage = &$this->GetFieldShopStockMessage();
if ($oStockMessage) {
if ($oStockMessage->fieldAutoActivateOnStock && $dNewStockValue > 0) {
$isActive = 1;
}
if ($oStockMessage->fieldAutoDeactivateOnZeroStock && $dNewStockValue < 1) {
$isActive = 0;
}
}
return $isActive;
} | php | public function CheckActivateOrDeactivate($dNewStockValue = null)
{
if (null === $dNewStockValue) {
$dNewStockValue = $this->getAvailableStock();
}
$isActive = 0;
if ($this->fieldActive) {
$isActive = 1;
}
$oStockMessage = &$this->GetFieldShopStockMessage();
if ($oStockMessage) {
if ($oStockMessage->fieldAutoActivateOnStock && $dNewStockValue > 0) {
$isActive = 1;
}
if ($oStockMessage->fieldAutoDeactivateOnZeroStock && $dNewStockValue < 1) {
$isActive = 0;
}
}
return $isActive;
} | [
"public",
"function",
"CheckActivateOrDeactivate",
"(",
"$",
"dNewStockValue",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"dNewStockValue",
")",
"{",
"$",
"dNewStockValue",
"=",
"$",
"this",
"->",
"getAvailableStock",
"(",
")",
";",
"}",
"$",
"isActive",
"=",
"0",
";",
"if",
"(",
"$",
"this",
"->",
"fieldActive",
")",
"{",
"$",
"isActive",
"=",
"1",
";",
"}",
"$",
"oStockMessage",
"=",
"&",
"$",
"this",
"->",
"GetFieldShopStockMessage",
"(",
")",
";",
"if",
"(",
"$",
"oStockMessage",
")",
"{",
"if",
"(",
"$",
"oStockMessage",
"->",
"fieldAutoActivateOnStock",
"&&",
"$",
"dNewStockValue",
">",
"0",
")",
"{",
"$",
"isActive",
"=",
"1",
";",
"}",
"if",
"(",
"$",
"oStockMessage",
"->",
"fieldAutoDeactivateOnZeroStock",
"&&",
"$",
"dNewStockValue",
"<",
"1",
")",
"{",
"$",
"isActive",
"=",
"0",
";",
"}",
"}",
"return",
"$",
"isActive",
";",
"}"
] | checks if we would deactivate the article if the stock of the article was dNewStockValue
returns 1 if the article remains active, 0 if it would be deactivated.
@param float $dNewStockValue - the stock we want to check the state of the article for
@return int | [
"checks",
"if",
"we",
"would",
"deactivate",
"the",
"article",
"if",
"the",
"stock",
"of",
"the",
"article",
"was",
"dNewStockValue",
"returns",
"1",
"if",
"the",
"article",
"remains",
"active",
"0",
"if",
"it",
"would",
"be",
"deactivated",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L1973-L1993 |
31,981 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticle.class.php | TShopArticle.& | public function &GetFieldShopStockMessage()
{
$oItem = $this->GetFromInternalCache('oLookupshop_stock_message_id');
if (null === $oItem) {
$oItem = $this->getShopStockMessageDataAccess()->getStockMessage($this->fieldShopStockMessageId, $this->iLanguageId);
if (null !== $oItem) {
$this->SetInternalCache('oLookupshop_stock_message_id', $oItem);
}
}
if (null !== $oItem && false === $oItem->GetArticle()) {
$oItem->SetArticle($this);
}
if (null !== $oItem && false === is_array($oItem->sqlData)) {
$oItem = null;
}
return $oItem;
} | php | public function &GetFieldShopStockMessage()
{
$oItem = $this->GetFromInternalCache('oLookupshop_stock_message_id');
if (null === $oItem) {
$oItem = $this->getShopStockMessageDataAccess()->getStockMessage($this->fieldShopStockMessageId, $this->iLanguageId);
if (null !== $oItem) {
$this->SetInternalCache('oLookupshop_stock_message_id', $oItem);
}
}
if (null !== $oItem && false === $oItem->GetArticle()) {
$oItem->SetArticle($this);
}
if (null !== $oItem && false === is_array($oItem->sqlData)) {
$oItem = null;
}
return $oItem;
} | [
"public",
"function",
"&",
"GetFieldShopStockMessage",
"(",
")",
"{",
"$",
"oItem",
"=",
"$",
"this",
"->",
"GetFromInternalCache",
"(",
"'oLookupshop_stock_message_id'",
")",
";",
"if",
"(",
"null",
"===",
"$",
"oItem",
")",
"{",
"$",
"oItem",
"=",
"$",
"this",
"->",
"getShopStockMessageDataAccess",
"(",
")",
"->",
"getStockMessage",
"(",
"$",
"this",
"->",
"fieldShopStockMessageId",
",",
"$",
"this",
"->",
"iLanguageId",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"oItem",
")",
"{",
"$",
"this",
"->",
"SetInternalCache",
"(",
"'oLookupshop_stock_message_id'",
",",
"$",
"oItem",
")",
";",
"}",
"}",
"if",
"(",
"null",
"!==",
"$",
"oItem",
"&&",
"false",
"===",
"$",
"oItem",
"->",
"GetArticle",
"(",
")",
")",
"{",
"$",
"oItem",
"->",
"SetArticle",
"(",
"$",
"this",
")",
";",
"}",
"if",
"(",
"null",
"!==",
"$",
"oItem",
"&&",
"false",
"===",
"is_array",
"(",
"$",
"oItem",
"->",
"sqlData",
")",
")",
"{",
"$",
"oItem",
"=",
"null",
";",
"}",
"return",
"$",
"oItem",
";",
"}"
] | the method gets the shopstockmessage for the current article.
@return TdbShopStockMessage|null | [
"the",
"method",
"gets",
"the",
"shopstockmessage",
"for",
"the",
"current",
"article",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L2008-L2026 |
31,982 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticle.class.php | TShopArticle.getToBasketLinkOtherParameters | private function getToBasketLinkOtherParameters($aParameters = array())
{
$aExcludeParameters = TCMSSmartURLData::GetActive()->getSeoURLParameters();
foreach ($aParameters as $sKey => $sVal) {
$aExcludeParameters[] = $sKey;
}
// now add all OTHER parameters
$aOtherParameters = TGlobal::instance()->GetUserData(null, $aExcludeParameters);
foreach ($aOtherParameters as $sKey => $sVal) {
$aParameters[$sKey] = $sVal;
}
return $aParameters;
} | php | private function getToBasketLinkOtherParameters($aParameters = array())
{
$aExcludeParameters = TCMSSmartURLData::GetActive()->getSeoURLParameters();
foreach ($aParameters as $sKey => $sVal) {
$aExcludeParameters[] = $sKey;
}
// now add all OTHER parameters
$aOtherParameters = TGlobal::instance()->GetUserData(null, $aExcludeParameters);
foreach ($aOtherParameters as $sKey => $sVal) {
$aParameters[$sKey] = $sVal;
}
return $aParameters;
} | [
"private",
"function",
"getToBasketLinkOtherParameters",
"(",
"$",
"aParameters",
"=",
"array",
"(",
")",
")",
"{",
"$",
"aExcludeParameters",
"=",
"TCMSSmartURLData",
"::",
"GetActive",
"(",
")",
"->",
"getSeoURLParameters",
"(",
")",
";",
"foreach",
"(",
"$",
"aParameters",
"as",
"$",
"sKey",
"=>",
"$",
"sVal",
")",
"{",
"$",
"aExcludeParameters",
"[",
"]",
"=",
"$",
"sKey",
";",
"}",
"// now add all OTHER parameters",
"$",
"aOtherParameters",
"=",
"TGlobal",
"::",
"instance",
"(",
")",
"->",
"GetUserData",
"(",
"null",
",",
"$",
"aExcludeParameters",
")",
";",
"foreach",
"(",
"$",
"aOtherParameters",
"as",
"$",
"sKey",
"=>",
"$",
"sVal",
")",
"{",
"$",
"aParameters",
"[",
"$",
"sKey",
"]",
"=",
"$",
"sVal",
";",
"}",
"return",
"$",
"aParameters",
";",
"}"
] | Get all post and get parameters an add them to parameter list.
@param array $aParameters
@return array | [
"Get",
"all",
"post",
"and",
"get",
"parameters",
"an",
"add",
"them",
"to",
"parameter",
"list",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticle.class.php#L2206-L2221 |
31,983 | PGB-LIV/php-ms | src/Writer/MgfWriter.php | MgfWriter.write | public function write(PrecursorIon $precursor)
{
if (is_null($this->fileHandle)) {
throw new \BadMethodCallException('The file handle is closed. Cannot write after close() has been called.');
}
// TODO: Validate mandatory/optional fields
fwrite($this->fileHandle, 'BEGIN IONS' . PHP_EOL);
fwrite($this->fileHandle, 'TITLE=' . $precursor->getTitle() . PHP_EOL);
fwrite($this->fileHandle, 'PEPMASS=' . $precursor->getMonoisotopicMassCharge());
if (! is_null($precursor->getIntensity())) {
fwrite($this->fileHandle, ' ' . $precursor->getIntensity());
}
fwrite($this->fileHandle, PHP_EOL);
fwrite($this->fileHandle, 'CHARGE=' . $precursor->getCharge() . '+' . PHP_EOL);
if (! is_null($precursor->getScan())) {
fwrite($this->fileHandle, 'SCANS=' . $precursor->getScan() . PHP_EOL);
}
if (! is_null($precursor->getRetentionTime())) {
if ($precursor->hasRetentionTimeWindow()) {
fwrite($this->fileHandle, 'RTINSECONDS=' . implode(',', $precursor->getRetentionTimeWindow()) . PHP_EOL);
} else {
fwrite($this->fileHandle, 'RTINSECONDS=' . $precursor->getRetentionTime() . PHP_EOL);
}
}
foreach ($precursor->getFragmentIons() as $ion) {
fwrite($this->fileHandle, $ion->getMonoisotopicMassCharge() . ' ');
fwrite($this->fileHandle, $ion->getIntensity());
if (! is_null($ion->getCharge()) && $ion->getCharge() != 1) {
fwrite($this->fileHandle, ' ' . $ion->getCharge());
}
fwrite($this->fileHandle, PHP_EOL);
}
fwrite($this->fileHandle, 'END IONS' . PHP_EOL);
} | php | public function write(PrecursorIon $precursor)
{
if (is_null($this->fileHandle)) {
throw new \BadMethodCallException('The file handle is closed. Cannot write after close() has been called.');
}
// TODO: Validate mandatory/optional fields
fwrite($this->fileHandle, 'BEGIN IONS' . PHP_EOL);
fwrite($this->fileHandle, 'TITLE=' . $precursor->getTitle() . PHP_EOL);
fwrite($this->fileHandle, 'PEPMASS=' . $precursor->getMonoisotopicMassCharge());
if (! is_null($precursor->getIntensity())) {
fwrite($this->fileHandle, ' ' . $precursor->getIntensity());
}
fwrite($this->fileHandle, PHP_EOL);
fwrite($this->fileHandle, 'CHARGE=' . $precursor->getCharge() . '+' . PHP_EOL);
if (! is_null($precursor->getScan())) {
fwrite($this->fileHandle, 'SCANS=' . $precursor->getScan() . PHP_EOL);
}
if (! is_null($precursor->getRetentionTime())) {
if ($precursor->hasRetentionTimeWindow()) {
fwrite($this->fileHandle, 'RTINSECONDS=' . implode(',', $precursor->getRetentionTimeWindow()) . PHP_EOL);
} else {
fwrite($this->fileHandle, 'RTINSECONDS=' . $precursor->getRetentionTime() . PHP_EOL);
}
}
foreach ($precursor->getFragmentIons() as $ion) {
fwrite($this->fileHandle, $ion->getMonoisotopicMassCharge() . ' ');
fwrite($this->fileHandle, $ion->getIntensity());
if (! is_null($ion->getCharge()) && $ion->getCharge() != 1) {
fwrite($this->fileHandle, ' ' . $ion->getCharge());
}
fwrite($this->fileHandle, PHP_EOL);
}
fwrite($this->fileHandle, 'END IONS' . PHP_EOL);
} | [
"public",
"function",
"write",
"(",
"PrecursorIon",
"$",
"precursor",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"fileHandle",
")",
")",
"{",
"throw",
"new",
"\\",
"BadMethodCallException",
"(",
"'The file handle is closed. Cannot write after close() has been called.'",
")",
";",
"}",
"// TODO: Validate mandatory/optional fields",
"fwrite",
"(",
"$",
"this",
"->",
"fileHandle",
",",
"'BEGIN IONS'",
".",
"PHP_EOL",
")",
";",
"fwrite",
"(",
"$",
"this",
"->",
"fileHandle",
",",
"'TITLE='",
".",
"$",
"precursor",
"->",
"getTitle",
"(",
")",
".",
"PHP_EOL",
")",
";",
"fwrite",
"(",
"$",
"this",
"->",
"fileHandle",
",",
"'PEPMASS='",
".",
"$",
"precursor",
"->",
"getMonoisotopicMassCharge",
"(",
")",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"precursor",
"->",
"getIntensity",
"(",
")",
")",
")",
"{",
"fwrite",
"(",
"$",
"this",
"->",
"fileHandle",
",",
"' '",
".",
"$",
"precursor",
"->",
"getIntensity",
"(",
")",
")",
";",
"}",
"fwrite",
"(",
"$",
"this",
"->",
"fileHandle",
",",
"PHP_EOL",
")",
";",
"fwrite",
"(",
"$",
"this",
"->",
"fileHandle",
",",
"'CHARGE='",
".",
"$",
"precursor",
"->",
"getCharge",
"(",
")",
".",
"'+'",
".",
"PHP_EOL",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"precursor",
"->",
"getScan",
"(",
")",
")",
")",
"{",
"fwrite",
"(",
"$",
"this",
"->",
"fileHandle",
",",
"'SCANS='",
".",
"$",
"precursor",
"->",
"getScan",
"(",
")",
".",
"PHP_EOL",
")",
";",
"}",
"if",
"(",
"!",
"is_null",
"(",
"$",
"precursor",
"->",
"getRetentionTime",
"(",
")",
")",
")",
"{",
"if",
"(",
"$",
"precursor",
"->",
"hasRetentionTimeWindow",
"(",
")",
")",
"{",
"fwrite",
"(",
"$",
"this",
"->",
"fileHandle",
",",
"'RTINSECONDS='",
".",
"implode",
"(",
"','",
",",
"$",
"precursor",
"->",
"getRetentionTimeWindow",
"(",
")",
")",
".",
"PHP_EOL",
")",
";",
"}",
"else",
"{",
"fwrite",
"(",
"$",
"this",
"->",
"fileHandle",
",",
"'RTINSECONDS='",
".",
"$",
"precursor",
"->",
"getRetentionTime",
"(",
")",
".",
"PHP_EOL",
")",
";",
"}",
"}",
"foreach",
"(",
"$",
"precursor",
"->",
"getFragmentIons",
"(",
")",
"as",
"$",
"ion",
")",
"{",
"fwrite",
"(",
"$",
"this",
"->",
"fileHandle",
",",
"$",
"ion",
"->",
"getMonoisotopicMassCharge",
"(",
")",
".",
"' '",
")",
";",
"fwrite",
"(",
"$",
"this",
"->",
"fileHandle",
",",
"$",
"ion",
"->",
"getIntensity",
"(",
")",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"ion",
"->",
"getCharge",
"(",
")",
")",
"&&",
"$",
"ion",
"->",
"getCharge",
"(",
")",
"!=",
"1",
")",
"{",
"fwrite",
"(",
"$",
"this",
"->",
"fileHandle",
",",
"' '",
".",
"$",
"ion",
"->",
"getCharge",
"(",
")",
")",
";",
"}",
"fwrite",
"(",
"$",
"this",
"->",
"fileHandle",
",",
"PHP_EOL",
")",
";",
"}",
"fwrite",
"(",
"$",
"this",
"->",
"fileHandle",
",",
"'END IONS'",
".",
"PHP_EOL",
")",
";",
"}"
] | Writes the precursor ion and it's associated fragments to the file associated with this instance
@param PrecursorIon $precursor
The precursor ion to write | [
"Writes",
"the",
"precursor",
"ion",
"and",
"it",
"s",
"associated",
"fragments",
"to",
"the",
"file",
"associated",
"with",
"this",
"instance"
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Writer/MgfWriter.php#L55-L96 |
31,984 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopVariantDisplayHandler/TShopVariantDisplayHandler.class.php | TShopVariantDisplayHandler.GetInstance | public static function GetInstance($sId)
{
$oRealObject = null;
$oObject = TdbShopVariantDisplayHandler::GetNewInstance();
/** @var $oObject TdbShopVariantDisplayHandler */
if ($oObject->Load($sId)) {
$sClassName = $oObject->fieldClass;
$oRealObject = new $sClassName();
$oRealObject->LoadFromRow($oObject->sqlData);
}
return $oRealObject;
} | php | public static function GetInstance($sId)
{
$oRealObject = null;
$oObject = TdbShopVariantDisplayHandler::GetNewInstance();
/** @var $oObject TdbShopVariantDisplayHandler */
if ($oObject->Load($sId)) {
$sClassName = $oObject->fieldClass;
$oRealObject = new $sClassName();
$oRealObject->LoadFromRow($oObject->sqlData);
}
return $oRealObject;
} | [
"public",
"static",
"function",
"GetInstance",
"(",
"$",
"sId",
")",
"{",
"$",
"oRealObject",
"=",
"null",
";",
"$",
"oObject",
"=",
"TdbShopVariantDisplayHandler",
"::",
"GetNewInstance",
"(",
")",
";",
"/** @var $oObject TdbShopVariantDisplayHandler */",
"if",
"(",
"$",
"oObject",
"->",
"Load",
"(",
"$",
"sId",
")",
")",
"{",
"$",
"sClassName",
"=",
"$",
"oObject",
"->",
"fieldClass",
";",
"$",
"oRealObject",
"=",
"new",
"$",
"sClassName",
"(",
")",
";",
"$",
"oRealObject",
"->",
"LoadFromRow",
"(",
"$",
"oObject",
"->",
"sqlData",
")",
";",
"}",
"return",
"$",
"oRealObject",
";",
"}"
] | return an instance of the handler type for the given id.
@param string $sId
@example TdbShopVariantDisplayHandler | [
"return",
"an",
"instance",
"of",
"the",
"handler",
"type",
"for",
"the",
"given",
"id",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopVariantDisplayHandler/TShopVariantDisplayHandler.class.php#L23-L35 |
31,985 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopVariantDisplayHandler/TShopVariantDisplayHandler.class.php | TShopVariantDisplayHandler.GetArticleMatchingCurrentSelection | public static function GetArticleMatchingCurrentSelection(TdbShopArticle &$oParentArticle, $bOnlyIfAPartialSelectionExists = true)
{
$aActiveSelection = TdbShopVariantDisplayHandler::GetActiveVariantTypeSelection(true);
if (!$bOnlyIfAPartialSelectionExists || (is_array($aActiveSelection) && count($aActiveSelection))) {
return $oParentArticle->GetVariantFromValues($aActiveSelection);
} else {
return null;
}
} | php | public static function GetArticleMatchingCurrentSelection(TdbShopArticle &$oParentArticle, $bOnlyIfAPartialSelectionExists = true)
{
$aActiveSelection = TdbShopVariantDisplayHandler::GetActiveVariantTypeSelection(true);
if (!$bOnlyIfAPartialSelectionExists || (is_array($aActiveSelection) && count($aActiveSelection))) {
return $oParentArticle->GetVariantFromValues($aActiveSelection);
} else {
return null;
}
} | [
"public",
"static",
"function",
"GetArticleMatchingCurrentSelection",
"(",
"TdbShopArticle",
"&",
"$",
"oParentArticle",
",",
"$",
"bOnlyIfAPartialSelectionExists",
"=",
"true",
")",
"{",
"$",
"aActiveSelection",
"=",
"TdbShopVariantDisplayHandler",
"::",
"GetActiveVariantTypeSelection",
"(",
"true",
")",
";",
"if",
"(",
"!",
"$",
"bOnlyIfAPartialSelectionExists",
"||",
"(",
"is_array",
"(",
"$",
"aActiveSelection",
")",
"&&",
"count",
"(",
"$",
"aActiveSelection",
")",
")",
")",
"{",
"return",
"$",
"oParentArticle",
"->",
"GetVariantFromValues",
"(",
"$",
"aActiveSelection",
")",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}"
] | return the first article matchin the current selection given a parent article
this can be usefull if a user has selected color but not size for a clothing article and you
want to display the images of the color variant.
@param TdbShopArticle $oParentArticle
@param bool $bOnlyIfAPartialSelectionExists - set to true if you also want to fetch the first variant if no
user selection (such as color) exists
@return TdbShopArticle | [
"return",
"the",
"first",
"article",
"matchin",
"the",
"current",
"selection",
"given",
"a",
"parent",
"article",
"this",
"can",
"be",
"usefull",
"if",
"a",
"user",
"has",
"selected",
"color",
"but",
"not",
"size",
"for",
"a",
"clothing",
"article",
"and",
"you",
"want",
"to",
"display",
"the",
"images",
"of",
"the",
"color",
"variant",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopVariantDisplayHandler/TShopVariantDisplayHandler.class.php#L127-L135 |
31,986 | PGB-LIV/php-ms | src/Search/Parameters/MsgfPlusSearchParameters.php | MsgfPlusSearchParameters.createModificationFile | public static function createModificationFile(array $modifications, $numMods = 2)
{
// TODO:
// All array must be this class
// NumMods must be uint
$data = 'NumMods=' . $numMods . PHP_EOL;
foreach ($modifications as $modification) {
$entry = $modification->getMonoisotopicMass() . ',';
$entry .= count($modification->getResidues()) == 0 ? '*' : implode('', $modification->getResidues());
$entry .= ',';
$entry .= $modification->isFixed() ? 'fix,' : 'opt,';
$position = '';
switch ($modification->getPosition()) {
case Modification::POSITION_PROTEIN_NTERM:
$position = 'Prot-N-term';
break;
case Modification::POSITION_PROTEIN_CTERM:
$position = 'Prot-C-term';
break;
case Modification::POSITION_NTERM:
$position = 'N-term';
break;
case Modification::POSITION_CTERM:
$position = 'C-term';
break;
case Modification::POSITION_ANY:
default:
$position = 'any';
break;
}
$entry .= $position . ',';
$entry .= $modification->getName();
$data .= $entry . PHP_EOL;
}
$modFile = tempnam(sys_get_temp_dir(), 'php-msMsgfMods');
file_put_contents($modFile, $data);
return $modFile;
} | php | public static function createModificationFile(array $modifications, $numMods = 2)
{
// TODO:
// All array must be this class
// NumMods must be uint
$data = 'NumMods=' . $numMods . PHP_EOL;
foreach ($modifications as $modification) {
$entry = $modification->getMonoisotopicMass() . ',';
$entry .= count($modification->getResidues()) == 0 ? '*' : implode('', $modification->getResidues());
$entry .= ',';
$entry .= $modification->isFixed() ? 'fix,' : 'opt,';
$position = '';
switch ($modification->getPosition()) {
case Modification::POSITION_PROTEIN_NTERM:
$position = 'Prot-N-term';
break;
case Modification::POSITION_PROTEIN_CTERM:
$position = 'Prot-C-term';
break;
case Modification::POSITION_NTERM:
$position = 'N-term';
break;
case Modification::POSITION_CTERM:
$position = 'C-term';
break;
case Modification::POSITION_ANY:
default:
$position = 'any';
break;
}
$entry .= $position . ',';
$entry .= $modification->getName();
$data .= $entry . PHP_EOL;
}
$modFile = tempnam(sys_get_temp_dir(), 'php-msMsgfMods');
file_put_contents($modFile, $data);
return $modFile;
} | [
"public",
"static",
"function",
"createModificationFile",
"(",
"array",
"$",
"modifications",
",",
"$",
"numMods",
"=",
"2",
")",
"{",
"// TODO:",
"// All array must be this class",
"// NumMods must be uint",
"$",
"data",
"=",
"'NumMods='",
".",
"$",
"numMods",
".",
"PHP_EOL",
";",
"foreach",
"(",
"$",
"modifications",
"as",
"$",
"modification",
")",
"{",
"$",
"entry",
"=",
"$",
"modification",
"->",
"getMonoisotopicMass",
"(",
")",
".",
"','",
";",
"$",
"entry",
".=",
"count",
"(",
"$",
"modification",
"->",
"getResidues",
"(",
")",
")",
"==",
"0",
"?",
"'*'",
":",
"implode",
"(",
"''",
",",
"$",
"modification",
"->",
"getResidues",
"(",
")",
")",
";",
"$",
"entry",
".=",
"','",
";",
"$",
"entry",
".=",
"$",
"modification",
"->",
"isFixed",
"(",
")",
"?",
"'fix,'",
":",
"'opt,'",
";",
"$",
"position",
"=",
"''",
";",
"switch",
"(",
"$",
"modification",
"->",
"getPosition",
"(",
")",
")",
"{",
"case",
"Modification",
"::",
"POSITION_PROTEIN_NTERM",
":",
"$",
"position",
"=",
"'Prot-N-term'",
";",
"break",
";",
"case",
"Modification",
"::",
"POSITION_PROTEIN_CTERM",
":",
"$",
"position",
"=",
"'Prot-C-term'",
";",
"break",
";",
"case",
"Modification",
"::",
"POSITION_NTERM",
":",
"$",
"position",
"=",
"'N-term'",
";",
"break",
";",
"case",
"Modification",
"::",
"POSITION_CTERM",
":",
"$",
"position",
"=",
"'C-term'",
";",
"break",
";",
"case",
"Modification",
"::",
"POSITION_ANY",
":",
"default",
":",
"$",
"position",
"=",
"'any'",
";",
"break",
";",
"}",
"$",
"entry",
".=",
"$",
"position",
".",
"','",
";",
"$",
"entry",
".=",
"$",
"modification",
"->",
"getName",
"(",
")",
";",
"$",
"data",
".=",
"$",
"entry",
".",
"PHP_EOL",
";",
"}",
"$",
"modFile",
"=",
"tempnam",
"(",
"sys_get_temp_dir",
"(",
")",
",",
"'php-msMsgfMods'",
")",
";",
"file_put_contents",
"(",
"$",
"modFile",
",",
"$",
"data",
")",
";",
"return",
"$",
"modFile",
";",
"}"
] | Creates a modification file from an array of modifications
@param Modification[] $modifications
@param number $numMods
Max number of modifications to search per peptide
@return string File path the newly created modification file | [
"Creates",
"a",
"modification",
"file",
"from",
"an",
"array",
"of",
"modifications"
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Search/Parameters/MsgfPlusSearchParameters.php#L455-L499 |
31,987 | sylingd/Yesf | src/Config/Adapter/QConf.php | QConf.getKey | protected function getKey($key) {
$key = '/' . $this->environment . '.' . $key;
$key = str_replace('.', '/', $key);
if (!empty($this->appName)) {
$key = '/' . $this->appName . $key;
}
return $key;
} | php | protected function getKey($key) {
$key = '/' . $this->environment . '.' . $key;
$key = str_replace('.', '/', $key);
if (!empty($this->appName)) {
$key = '/' . $this->appName . $key;
}
return $key;
} | [
"protected",
"function",
"getKey",
"(",
"$",
"key",
")",
"{",
"$",
"key",
"=",
"'/'",
".",
"$",
"this",
"->",
"environment",
".",
"'.'",
".",
"$",
"key",
";",
"$",
"key",
"=",
"str_replace",
"(",
"'.'",
",",
"'/'",
",",
"$",
"key",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"appName",
")",
")",
"{",
"$",
"key",
"=",
"'/'",
".",
"$",
"this",
"->",
"appName",
".",
"$",
"key",
";",
"}",
"return",
"$",
"key",
";",
"}"
] | Get real key
@access protected
@param string $key original key
@return string | [
"Get",
"real",
"key"
] | 0fc2b42903bb3519c54c596270c890c826aeb1df | https://github.com/sylingd/Yesf/blob/0fc2b42903bb3519c54c596270c890c826aeb1df/src/Config/Adapter/QConf.php#L33-L40 |
31,988 | belgattitude/soluble-dbwrapper | src/Soluble/DbWrapper/Result/Resultset.php | Resultset.append | public function append(array $row): void
{
if ($this->returnType === self::TYPE_ARRAYOBJECT) {
$this->storage[] = new ArrayObject($row);
} else {
$this->storage[] = $row;
}
++$this->count;
} | php | public function append(array $row): void
{
if ($this->returnType === self::TYPE_ARRAYOBJECT) {
$this->storage[] = new ArrayObject($row);
} else {
$this->storage[] = $row;
}
++$this->count;
} | [
"public",
"function",
"append",
"(",
"array",
"$",
"row",
")",
":",
"void",
"{",
"if",
"(",
"$",
"this",
"->",
"returnType",
"===",
"self",
"::",
"TYPE_ARRAYOBJECT",
")",
"{",
"$",
"this",
"->",
"storage",
"[",
"]",
"=",
"new",
"ArrayObject",
"(",
"$",
"row",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"storage",
"[",
"]",
"=",
"$",
"row",
";",
"}",
"++",
"$",
"this",
"->",
"count",
";",
"}"
] | Append a row to the end of resultset.
@param array $row an associative array | [
"Append",
"a",
"row",
"to",
"the",
"end",
"of",
"resultset",
"."
] | d2ba7b8855521613178246d2b66d8a7287706747 | https://github.com/belgattitude/soluble-dbwrapper/blob/d2ba7b8855521613178246d2b66d8a7287706747/src/Soluble/DbWrapper/Result/Resultset.php#L124-L132 |
31,989 | belgattitude/soluble-dbwrapper | src/Soluble/DbWrapper/Result/Resultset.php | Resultset.getArrayObject | public function getArrayObject(): ArrayObject
{
if ($this->returnType === self::TYPE_ARRAY) {
return new ArrayObject($this->storage);
} else {
/** @var ArrayObject $storageAsArrayObject to silent static code analyzers */
$storageAsArrayObject = $this->storage;
return $storageAsArrayObject;
}
} | php | public function getArrayObject(): ArrayObject
{
if ($this->returnType === self::TYPE_ARRAY) {
return new ArrayObject($this->storage);
} else {
/** @var ArrayObject $storageAsArrayObject to silent static code analyzers */
$storageAsArrayObject = $this->storage;
return $storageAsArrayObject;
}
} | [
"public",
"function",
"getArrayObject",
"(",
")",
":",
"ArrayObject",
"{",
"if",
"(",
"$",
"this",
"->",
"returnType",
"===",
"self",
"::",
"TYPE_ARRAY",
")",
"{",
"return",
"new",
"ArrayObject",
"(",
"$",
"this",
"->",
"storage",
")",
";",
"}",
"else",
"{",
"/** @var ArrayObject $storageAsArrayObject to silent static code analyzers */",
"$",
"storageAsArrayObject",
"=",
"$",
"this",
"->",
"storage",
";",
"return",
"$",
"storageAsArrayObject",
";",
"}",
"}"
] | Return underlying stored resultset as ArrayObject.
Depending on the $returnType Resultset::TYPE_ARRAY|Resultset::TYPE_ARRAYOBJECT you can modify
the internal storage
@return ArrayObject | [
"Return",
"underlying",
"stored",
"resultset",
"as",
"ArrayObject",
"."
] | d2ba7b8855521613178246d2b66d8a7287706747 | https://github.com/belgattitude/soluble-dbwrapper/blob/d2ba7b8855521613178246d2b66d8a7287706747/src/Soluble/DbWrapper/Result/Resultset.php#L187-L197 |
31,990 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Impl/IpnNotificationParser.php | IpnNotificationParser.parseSnsMessage | public static function parseSnsMessage(Message $snsMsg)
{
// Create the message and extract the information we need
$ipnMsg = new Message($snsMsg->getMandatoryField("Message"));
self::_addMetadataToIpnMessage(
$ipnMsg,
$snsMsg->getNotificationMetadata()
);
return $ipnMsg;
} | php | public static function parseSnsMessage(Message $snsMsg)
{
// Create the message and extract the information we need
$ipnMsg = new Message($snsMsg->getMandatoryField("Message"));
self::_addMetadataToIpnMessage(
$ipnMsg,
$snsMsg->getNotificationMetadata()
);
return $ipnMsg;
} | [
"public",
"static",
"function",
"parseSnsMessage",
"(",
"Message",
"$",
"snsMsg",
")",
"{",
"// Create the message and extract the information we need",
"$",
"ipnMsg",
"=",
"new",
"Message",
"(",
"$",
"snsMsg",
"->",
"getMandatoryField",
"(",
"\"Message\"",
")",
")",
";",
"self",
"::",
"_addMetadataToIpnMessage",
"(",
"$",
"ipnMsg",
",",
"$",
"snsMsg",
"->",
"getNotificationMetadata",
"(",
")",
")",
";",
"return",
"$",
"ipnMsg",
";",
"}"
] | Converts a an sns message into a
ipn notification object
@param Messsage $snsMsg snsMessage
@throws OffAmazonPaymentsNotifications if there is an error
@return Message ipn message | [
"Converts",
"a",
"an",
"sns",
"message",
"into",
"a",
"ipn",
"notification",
"object"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Impl/IpnNotificationParser.php#L37-L46 |
31,991 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Impl/IpnNotificationParser.php | IpnNotificationParser._addMetadataToIpnMessage | private static function _addMetadataToIpnMessage (
Message $ipnMsg,
OffAmazonPaymentsNotifications_NotificationMetadata $messageMetadata = null
) {
$ipnMetadata
= new OffAmazonPaymentsNotifications_Model_IPNNotificationMetadata(
$ipnMsg,
$messageMetadata
);
$ipnMsg->setNotificationMetadata($ipnMetadata);
} | php | private static function _addMetadataToIpnMessage (
Message $ipnMsg,
OffAmazonPaymentsNotifications_NotificationMetadata $messageMetadata = null
) {
$ipnMetadata
= new OffAmazonPaymentsNotifications_Model_IPNNotificationMetadata(
$ipnMsg,
$messageMetadata
);
$ipnMsg->setNotificationMetadata($ipnMetadata);
} | [
"private",
"static",
"function",
"_addMetadataToIpnMessage",
"(",
"Message",
"$",
"ipnMsg",
",",
"OffAmazonPaymentsNotifications_NotificationMetadata",
"$",
"messageMetadata",
"=",
"null",
")",
"{",
"$",
"ipnMetadata",
"=",
"new",
"OffAmazonPaymentsNotifications_Model_IPNNotificationMetadata",
"(",
"$",
"ipnMsg",
",",
"$",
"messageMetadata",
")",
";",
"$",
"ipnMsg",
"->",
"setNotificationMetadata",
"(",
"$",
"ipnMetadata",
")",
";",
"}"
] | Create the metadata object for the ipn message and attach
to the object instance
@param Message $ipnMsg ipn message
@param OffAmazonPaymentsNotifications_NotificationMetadata $messageMetadata parent notification
@return void | [
"Create",
"the",
"metadata",
"object",
"for",
"the",
"ipn",
"message",
"and",
"attach",
"to",
"the",
"object",
"instance"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Impl/IpnNotificationParser.php#L57-L67 |
31,992 | edmondscommerce/doctrine-static-meta | src/Builder/Builder.php | Builder.finaliseBuild | public function finaliseBuild(): self
{
$this->dataTransferObjectsForAllEntitiesAction->run();
$this->entityFormatter->run();
$this->copyPhpstormMeta->run();
return $this;
} | php | public function finaliseBuild(): self
{
$this->dataTransferObjectsForAllEntitiesAction->run();
$this->entityFormatter->run();
$this->copyPhpstormMeta->run();
return $this;
} | [
"public",
"function",
"finaliseBuild",
"(",
")",
":",
"self",
"{",
"$",
"this",
"->",
"dataTransferObjectsForAllEntitiesAction",
"->",
"run",
"(",
")",
";",
"$",
"this",
"->",
"entityFormatter",
"->",
"run",
"(",
")",
";",
"$",
"this",
"->",
"copyPhpstormMeta",
"->",
"run",
"(",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Finalise build - run various steps to wrap up the build and tidy up the codebase
@return Builder | [
"Finalise",
"build",
"-",
"run",
"various",
"steps",
"to",
"wrap",
"up",
"the",
"build",
"and",
"tidy",
"up",
"the",
"codebase"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Builder/Builder.php#L182-L189 |
31,993 | Firesphere/silverstripe-bootstrapmfa | src/Extensions/MemberExtension.php | MemberExtension.onBeforeWrite | public function onBeforeWrite()
{
if (!$this->owner->MFAEnabled && SiteConfig::current_site_config()->ForceMFA) {
$this->owner->MFAEnabled = true;
$this->owner->updateMFA = true;
}
if (!$this->owner->BackupCodeSalt || $this->owner->updateMFA) {
$algorithm = Security::config()->get('password_encryption_algorithm');
$encryptor = PasswordEncryptor::create_for_algorithm($algorithm);
// No password. It's not even used in the salt generation
$this->owner->BackupCodeSalt = $encryptor->salt('');
}
} | php | public function onBeforeWrite()
{
if (!$this->owner->MFAEnabled && SiteConfig::current_site_config()->ForceMFA) {
$this->owner->MFAEnabled = true;
$this->owner->updateMFA = true;
}
if (!$this->owner->BackupCodeSalt || $this->owner->updateMFA) {
$algorithm = Security::config()->get('password_encryption_algorithm');
$encryptor = PasswordEncryptor::create_for_algorithm($algorithm);
// No password. It's not even used in the salt generation
$this->owner->BackupCodeSalt = $encryptor->salt('');
}
} | [
"public",
"function",
"onBeforeWrite",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"owner",
"->",
"MFAEnabled",
"&&",
"SiteConfig",
"::",
"current_site_config",
"(",
")",
"->",
"ForceMFA",
")",
"{",
"$",
"this",
"->",
"owner",
"->",
"MFAEnabled",
"=",
"true",
";",
"$",
"this",
"->",
"owner",
"->",
"updateMFA",
"=",
"true",
";",
"}",
"if",
"(",
"!",
"$",
"this",
"->",
"owner",
"->",
"BackupCodeSalt",
"||",
"$",
"this",
"->",
"owner",
"->",
"updateMFA",
")",
"{",
"$",
"algorithm",
"=",
"Security",
"::",
"config",
"(",
")",
"->",
"get",
"(",
"'password_encryption_algorithm'",
")",
";",
"$",
"encryptor",
"=",
"PasswordEncryptor",
"::",
"create_for_algorithm",
"(",
"$",
"algorithm",
")",
";",
"// No password. It's not even used in the salt generation",
"$",
"this",
"->",
"owner",
"->",
"BackupCodeSalt",
"=",
"$",
"encryptor",
"->",
"salt",
"(",
"''",
")",
";",
"}",
"}"
] | Force enable MFA on the member if needed | [
"Force",
"enable",
"MFA",
"on",
"the",
"member",
"if",
"needed"
] | 8d2d6c6f2f918c8fa157da91550b897816495a4b | https://github.com/Firesphere/silverstripe-bootstrapmfa/blob/8d2d6c6f2f918c8fa157da91550b897816495a4b/src/Extensions/MemberExtension.php#L95-L109 |
31,994 | Firesphere/silverstripe-bootstrapmfa | src/Extensions/MemberExtension.php | MemberExtension.isInGracePeriod | public function isInGracePeriod()
{
/** @var Member|MemberExtension $member */
$member = $this->owner;
// If MFA is enabled on the member, we're always using it
if ($member->MFAEnabled) {
return false;
}
/** @var SiteConfig|SiteConfigExtension $config */
$config = SiteConfig::current_site_config();
// If MFA is not enforced, we're in an endless grace period
if ($config->ForceMFA === null) {
return true;
}
// Default the grace start day
$graceStartDay = ($member->Created > $config->ForceMFA) ? $member->Created : $config->ForceMFA;
$graceStartDay = new DateTime($graceStartDay);
$gracePeriodInDays = Config::inst()->get(BootstrapMFAAuthenticator::class, 'grace_period');
$nowDate = new DateTime(DBDatetime::now()->Format(DBDatetime::ISO_DATE));
$daysSinceGraceStart = $nowDate->diff($graceStartDay)->days;
return $daysSinceGraceStart < $gracePeriodInDays;
} | php | public function isInGracePeriod()
{
/** @var Member|MemberExtension $member */
$member = $this->owner;
// If MFA is enabled on the member, we're always using it
if ($member->MFAEnabled) {
return false;
}
/** @var SiteConfig|SiteConfigExtension $config */
$config = SiteConfig::current_site_config();
// If MFA is not enforced, we're in an endless grace period
if ($config->ForceMFA === null) {
return true;
}
// Default the grace start day
$graceStartDay = ($member->Created > $config->ForceMFA) ? $member->Created : $config->ForceMFA;
$graceStartDay = new DateTime($graceStartDay);
$gracePeriodInDays = Config::inst()->get(BootstrapMFAAuthenticator::class, 'grace_period');
$nowDate = new DateTime(DBDatetime::now()->Format(DBDatetime::ISO_DATE));
$daysSinceGraceStart = $nowDate->diff($graceStartDay)->days;
return $daysSinceGraceStart < $gracePeriodInDays;
} | [
"public",
"function",
"isInGracePeriod",
"(",
")",
"{",
"/** @var Member|MemberExtension $member */",
"$",
"member",
"=",
"$",
"this",
"->",
"owner",
";",
"// If MFA is enabled on the member, we're always using it",
"if",
"(",
"$",
"member",
"->",
"MFAEnabled",
")",
"{",
"return",
"false",
";",
"}",
"/** @var SiteConfig|SiteConfigExtension $config */",
"$",
"config",
"=",
"SiteConfig",
"::",
"current_site_config",
"(",
")",
";",
"// If MFA is not enforced, we're in an endless grace period",
"if",
"(",
"$",
"config",
"->",
"ForceMFA",
"===",
"null",
")",
"{",
"return",
"true",
";",
"}",
"// Default the grace start day",
"$",
"graceStartDay",
"=",
"(",
"$",
"member",
"->",
"Created",
">",
"$",
"config",
"->",
"ForceMFA",
")",
"?",
"$",
"member",
"->",
"Created",
":",
"$",
"config",
"->",
"ForceMFA",
";",
"$",
"graceStartDay",
"=",
"new",
"DateTime",
"(",
"$",
"graceStartDay",
")",
";",
"$",
"gracePeriodInDays",
"=",
"Config",
"::",
"inst",
"(",
")",
"->",
"get",
"(",
"BootstrapMFAAuthenticator",
"::",
"class",
",",
"'grace_period'",
")",
";",
"$",
"nowDate",
"=",
"new",
"DateTime",
"(",
"DBDatetime",
"::",
"now",
"(",
")",
"->",
"Format",
"(",
"DBDatetime",
"::",
"ISO_DATE",
")",
")",
";",
"$",
"daysSinceGraceStart",
"=",
"$",
"nowDate",
"->",
"diff",
"(",
"$",
"graceStartDay",
")",
"->",
"days",
";",
"return",
"$",
"daysSinceGraceStart",
"<",
"$",
"gracePeriodInDays",
";",
"}"
] | Check if a member is in grace period based on Created, date or enforcement
@return bool
@throws \Exception | [
"Check",
"if",
"a",
"member",
"is",
"in",
"grace",
"period",
"based",
"on",
"Created",
"date",
"or",
"enforcement"
] | 8d2d6c6f2f918c8fa157da91550b897816495a4b | https://github.com/Firesphere/silverstripe-bootstrapmfa/blob/8d2d6c6f2f918c8fa157da91550b897816495a4b/src/Extensions/MemberExtension.php#L132-L160 |
31,995 | PGB-LIV/php-ms | src/Core/AminoAcidMono.php | AminoAcidMono.getMonoisotopicMass | public static function getMonoisotopicMass($acid)
{
$value = @constant('pgb_liv\php_ms\Core\AminoAcidMono::' . $acid);
if (! is_null($value)) {
return $value;
}
if (strlen($acid) > 1) {
throw new \InvalidArgumentException('Value must be a single amino acid. Input was ' . $acid);
}
throw new \InvalidArgumentException('Value must be a valid amino acid. Input was ' . $acid);
} | php | public static function getMonoisotopicMass($acid)
{
$value = @constant('pgb_liv\php_ms\Core\AminoAcidMono::' . $acid);
if (! is_null($value)) {
return $value;
}
if (strlen($acid) > 1) {
throw new \InvalidArgumentException('Value must be a single amino acid. Input was ' . $acid);
}
throw new \InvalidArgumentException('Value must be a valid amino acid. Input was ' . $acid);
} | [
"public",
"static",
"function",
"getMonoisotopicMass",
"(",
"$",
"acid",
")",
"{",
"$",
"value",
"=",
"@",
"constant",
"(",
"'pgb_liv\\php_ms\\Core\\AminoAcidMono::'",
".",
"$",
"acid",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"value",
")",
")",
"{",
"return",
"$",
"value",
";",
"}",
"if",
"(",
"strlen",
"(",
"$",
"acid",
")",
">",
"1",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Value must be a single amino acid. Input was '",
".",
"$",
"acid",
")",
";",
"}",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Value must be a valid amino acid. Input was '",
".",
"$",
"acid",
")",
";",
"}"
] | Gets the monoisotopic mass for the provided amino acid.
@param string $acid
Amino acid
@throws \InvalidArgumentException If acid is not a single character or valid amino acid
@return float Monoisotopic mass | [
"Gets",
"the",
"monoisotopic",
"mass",
"for",
"the",
"provided",
"amino",
"acid",
"."
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Core/AminoAcidMono.php#L77-L90 |
31,996 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerPayPalExpress.class.php | TShopPaymentHandlerPayPalExpress.GetUserDataFromPayPalData | protected function GetUserDataFromPayPalData(&$aBilling, &$aShipping)
{
$sCountryIsoCode = 'de';
if (array_key_exists('SHIPTOCOUNTRYCODE', $this->aCheckoutDetails)) {
$sCountryIsoCode = $this->aCheckoutDetails['SHIPTOCOUNTRYCODE'];
}
$oShippingCountry = TdbDataCountry::GetInstanceForIsoCode($sCountryIsoCode);
$sMail = (array_key_exists('EMAIL', $this->aCheckoutDetails)) ? $this->aCheckoutDetails['EMAIL'] : '';
$sCompany = (array_key_exists('BUSINESS', $this->aCheckoutDetails)) ? $this->aCheckoutDetails['BUSINESS'] : '';
//$sDataExtranetSalutationId = (array_key_exists('',$this->aCheckoutDetails)) ? $this->aCheckoutDetails[''] : '';
$sFirstname = (array_key_exists('FIRSTNAME', $this->aCheckoutDetails)) ? $this->aCheckoutDetails['FIRSTNAME'] : '';
$sLastname = (array_key_exists('LASTNAME', $this->aCheckoutDetails)) ? $this->aCheckoutDetails['LASTNAME'] : '';
$sStreet = (array_key_exists('SHIPTOSTREET', $this->aCheckoutDetails)) ? $this->aCheckoutDetails['SHIPTOSTREET'] : '';
$sCity = (array_key_exists('SHIPTOCITY', $this->aCheckoutDetails)) ? $this->aCheckoutDetails['SHIPTOCITY'] : '';
$sPostalcode = (array_key_exists('SHIPTOZIP', $this->aCheckoutDetails)) ? $this->aCheckoutDetails['SHIPTOZIP'] : '';
$sTelefon = (array_key_exists('PHONENUM', $this->aCheckoutDetails)) ? $this->aCheckoutDetails['PHONENUM'] : '';
$addressAdditionalInfo = (array_key_exists('SHIPTOSTREET2', $this->aCheckoutDetails)) ? $this->aCheckoutDetails['SHIPTOSTREET2'] : '';
$aBilling = array('name' => $sMail, 'email' => $sMail, 'company' => $sCompany, 'data_extranet_salutation_id' => '', 'firstname' => $sFirstname, 'lastname' => $sLastname, 'street' => $sStreet, 'streenr' => '', 'city' => $sCity, 'postalcode' => $sPostalcode, 'telefon' => $sTelefon, 'fax' => '', 'data_country_id' => $oShippingCountry->id, 'address_additional_info' => $addressAdditionalInfo);
$sShippingLastName = (array_key_exists('SHIPTONAME', $this->aCheckoutDetails) && '' != $this->aCheckoutDetails['SHIPTONAME']) ? $this->aCheckoutDetails['SHIPTONAME'] : $sFirstname.' '.$sLastname;
$aShipping = array('company' => $sCompany, 'data_extranet_salutation_id' => '', 'firstname' => '', 'lastname' => $sShippingLastName, 'street' => $sStreet, 'streenr' => '', 'city' => $sCity, 'postalcode' => $sPostalcode, 'telefon' => $sTelefon, 'fax' => '', 'data_country_id' => $oShippingCountry->id, 'address_additional_info' => $addressAdditionalInfo);
$this->postProcessBillingAndShippingAddress($aBilling, $aShipping);
} | php | protected function GetUserDataFromPayPalData(&$aBilling, &$aShipping)
{
$sCountryIsoCode = 'de';
if (array_key_exists('SHIPTOCOUNTRYCODE', $this->aCheckoutDetails)) {
$sCountryIsoCode = $this->aCheckoutDetails['SHIPTOCOUNTRYCODE'];
}
$oShippingCountry = TdbDataCountry::GetInstanceForIsoCode($sCountryIsoCode);
$sMail = (array_key_exists('EMAIL', $this->aCheckoutDetails)) ? $this->aCheckoutDetails['EMAIL'] : '';
$sCompany = (array_key_exists('BUSINESS', $this->aCheckoutDetails)) ? $this->aCheckoutDetails['BUSINESS'] : '';
//$sDataExtranetSalutationId = (array_key_exists('',$this->aCheckoutDetails)) ? $this->aCheckoutDetails[''] : '';
$sFirstname = (array_key_exists('FIRSTNAME', $this->aCheckoutDetails)) ? $this->aCheckoutDetails['FIRSTNAME'] : '';
$sLastname = (array_key_exists('LASTNAME', $this->aCheckoutDetails)) ? $this->aCheckoutDetails['LASTNAME'] : '';
$sStreet = (array_key_exists('SHIPTOSTREET', $this->aCheckoutDetails)) ? $this->aCheckoutDetails['SHIPTOSTREET'] : '';
$sCity = (array_key_exists('SHIPTOCITY', $this->aCheckoutDetails)) ? $this->aCheckoutDetails['SHIPTOCITY'] : '';
$sPostalcode = (array_key_exists('SHIPTOZIP', $this->aCheckoutDetails)) ? $this->aCheckoutDetails['SHIPTOZIP'] : '';
$sTelefon = (array_key_exists('PHONENUM', $this->aCheckoutDetails)) ? $this->aCheckoutDetails['PHONENUM'] : '';
$addressAdditionalInfo = (array_key_exists('SHIPTOSTREET2', $this->aCheckoutDetails)) ? $this->aCheckoutDetails['SHIPTOSTREET2'] : '';
$aBilling = array('name' => $sMail, 'email' => $sMail, 'company' => $sCompany, 'data_extranet_salutation_id' => '', 'firstname' => $sFirstname, 'lastname' => $sLastname, 'street' => $sStreet, 'streenr' => '', 'city' => $sCity, 'postalcode' => $sPostalcode, 'telefon' => $sTelefon, 'fax' => '', 'data_country_id' => $oShippingCountry->id, 'address_additional_info' => $addressAdditionalInfo);
$sShippingLastName = (array_key_exists('SHIPTONAME', $this->aCheckoutDetails) && '' != $this->aCheckoutDetails['SHIPTONAME']) ? $this->aCheckoutDetails['SHIPTONAME'] : $sFirstname.' '.$sLastname;
$aShipping = array('company' => $sCompany, 'data_extranet_salutation_id' => '', 'firstname' => '', 'lastname' => $sShippingLastName, 'street' => $sStreet, 'streenr' => '', 'city' => $sCity, 'postalcode' => $sPostalcode, 'telefon' => $sTelefon, 'fax' => '', 'data_country_id' => $oShippingCountry->id, 'address_additional_info' => $addressAdditionalInfo);
$this->postProcessBillingAndShippingAddress($aBilling, $aShipping);
} | [
"protected",
"function",
"GetUserDataFromPayPalData",
"(",
"&",
"$",
"aBilling",
",",
"&",
"$",
"aShipping",
")",
"{",
"$",
"sCountryIsoCode",
"=",
"'de'",
";",
"if",
"(",
"array_key_exists",
"(",
"'SHIPTOCOUNTRYCODE'",
",",
"$",
"this",
"->",
"aCheckoutDetails",
")",
")",
"{",
"$",
"sCountryIsoCode",
"=",
"$",
"this",
"->",
"aCheckoutDetails",
"[",
"'SHIPTOCOUNTRYCODE'",
"]",
";",
"}",
"$",
"oShippingCountry",
"=",
"TdbDataCountry",
"::",
"GetInstanceForIsoCode",
"(",
"$",
"sCountryIsoCode",
")",
";",
"$",
"sMail",
"=",
"(",
"array_key_exists",
"(",
"'EMAIL'",
",",
"$",
"this",
"->",
"aCheckoutDetails",
")",
")",
"?",
"$",
"this",
"->",
"aCheckoutDetails",
"[",
"'EMAIL'",
"]",
":",
"''",
";",
"$",
"sCompany",
"=",
"(",
"array_key_exists",
"(",
"'BUSINESS'",
",",
"$",
"this",
"->",
"aCheckoutDetails",
")",
")",
"?",
"$",
"this",
"->",
"aCheckoutDetails",
"[",
"'BUSINESS'",
"]",
":",
"''",
";",
"//$sDataExtranetSalutationId = (array_key_exists('',$this->aCheckoutDetails)) ? $this->aCheckoutDetails[''] : '';",
"$",
"sFirstname",
"=",
"(",
"array_key_exists",
"(",
"'FIRSTNAME'",
",",
"$",
"this",
"->",
"aCheckoutDetails",
")",
")",
"?",
"$",
"this",
"->",
"aCheckoutDetails",
"[",
"'FIRSTNAME'",
"]",
":",
"''",
";",
"$",
"sLastname",
"=",
"(",
"array_key_exists",
"(",
"'LASTNAME'",
",",
"$",
"this",
"->",
"aCheckoutDetails",
")",
")",
"?",
"$",
"this",
"->",
"aCheckoutDetails",
"[",
"'LASTNAME'",
"]",
":",
"''",
";",
"$",
"sStreet",
"=",
"(",
"array_key_exists",
"(",
"'SHIPTOSTREET'",
",",
"$",
"this",
"->",
"aCheckoutDetails",
")",
")",
"?",
"$",
"this",
"->",
"aCheckoutDetails",
"[",
"'SHIPTOSTREET'",
"]",
":",
"''",
";",
"$",
"sCity",
"=",
"(",
"array_key_exists",
"(",
"'SHIPTOCITY'",
",",
"$",
"this",
"->",
"aCheckoutDetails",
")",
")",
"?",
"$",
"this",
"->",
"aCheckoutDetails",
"[",
"'SHIPTOCITY'",
"]",
":",
"''",
";",
"$",
"sPostalcode",
"=",
"(",
"array_key_exists",
"(",
"'SHIPTOZIP'",
",",
"$",
"this",
"->",
"aCheckoutDetails",
")",
")",
"?",
"$",
"this",
"->",
"aCheckoutDetails",
"[",
"'SHIPTOZIP'",
"]",
":",
"''",
";",
"$",
"sTelefon",
"=",
"(",
"array_key_exists",
"(",
"'PHONENUM'",
",",
"$",
"this",
"->",
"aCheckoutDetails",
")",
")",
"?",
"$",
"this",
"->",
"aCheckoutDetails",
"[",
"'PHONENUM'",
"]",
":",
"''",
";",
"$",
"addressAdditionalInfo",
"=",
"(",
"array_key_exists",
"(",
"'SHIPTOSTREET2'",
",",
"$",
"this",
"->",
"aCheckoutDetails",
")",
")",
"?",
"$",
"this",
"->",
"aCheckoutDetails",
"[",
"'SHIPTOSTREET2'",
"]",
":",
"''",
";",
"$",
"aBilling",
"=",
"array",
"(",
"'name'",
"=>",
"$",
"sMail",
",",
"'email'",
"=>",
"$",
"sMail",
",",
"'company'",
"=>",
"$",
"sCompany",
",",
"'data_extranet_salutation_id'",
"=>",
"''",
",",
"'firstname'",
"=>",
"$",
"sFirstname",
",",
"'lastname'",
"=>",
"$",
"sLastname",
",",
"'street'",
"=>",
"$",
"sStreet",
",",
"'streenr'",
"=>",
"''",
",",
"'city'",
"=>",
"$",
"sCity",
",",
"'postalcode'",
"=>",
"$",
"sPostalcode",
",",
"'telefon'",
"=>",
"$",
"sTelefon",
",",
"'fax'",
"=>",
"''",
",",
"'data_country_id'",
"=>",
"$",
"oShippingCountry",
"->",
"id",
",",
"'address_additional_info'",
"=>",
"$",
"addressAdditionalInfo",
")",
";",
"$",
"sShippingLastName",
"=",
"(",
"array_key_exists",
"(",
"'SHIPTONAME'",
",",
"$",
"this",
"->",
"aCheckoutDetails",
")",
"&&",
"''",
"!=",
"$",
"this",
"->",
"aCheckoutDetails",
"[",
"'SHIPTONAME'",
"]",
")",
"?",
"$",
"this",
"->",
"aCheckoutDetails",
"[",
"'SHIPTONAME'",
"]",
":",
"$",
"sFirstname",
".",
"' '",
".",
"$",
"sLastname",
";",
"$",
"aShipping",
"=",
"array",
"(",
"'company'",
"=>",
"$",
"sCompany",
",",
"'data_extranet_salutation_id'",
"=>",
"''",
",",
"'firstname'",
"=>",
"''",
",",
"'lastname'",
"=>",
"$",
"sShippingLastName",
",",
"'street'",
"=>",
"$",
"sStreet",
",",
"'streenr'",
"=>",
"''",
",",
"'city'",
"=>",
"$",
"sCity",
",",
"'postalcode'",
"=>",
"$",
"sPostalcode",
",",
"'telefon'",
"=>",
"$",
"sTelefon",
",",
"'fax'",
"=>",
"''",
",",
"'data_country_id'",
"=>",
"$",
"oShippingCountry",
"->",
"id",
",",
"'address_additional_info'",
"=>",
"$",
"addressAdditionalInfo",
")",
";",
"$",
"this",
"->",
"postProcessBillingAndShippingAddress",
"(",
"$",
"aBilling",
",",
"$",
"aShipping",
")",
";",
"}"
] | updates teh aBilling and aShipping arrays with the user billing and shipping
info returned from paypal.
@param array $aBilling
@param array $aShipping | [
"updates",
"teh",
"aBilling",
"and",
"aShipping",
"arrays",
"with",
"the",
"user",
"billing",
"and",
"shipping",
"info",
"returned",
"from",
"paypal",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerPayPalExpress.class.php#L116-L144 |
31,997 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/CLIExample.php | CLIExample.callStepAndCheckForException | protected function callStepAndCheckForException($stepName, $args = array())
{
try {
$response = call_user_func_array(array($this->exampleClass, $stepName), $args);
} catch (OffAmazonPaymentsService_Exception $ex) {
$this->printExceptionToCLI($ex, $stepName);
throw $ex;
}
return $response;
} | php | protected function callStepAndCheckForException($stepName, $args = array())
{
try {
$response = call_user_func_array(array($this->exampleClass, $stepName), $args);
} catch (OffAmazonPaymentsService_Exception $ex) {
$this->printExceptionToCLI($ex, $stepName);
throw $ex;
}
return $response;
} | [
"protected",
"function",
"callStepAndCheckForException",
"(",
"$",
"stepName",
",",
"$",
"args",
"=",
"array",
"(",
")",
")",
"{",
"try",
"{",
"$",
"response",
"=",
"call_user_func_array",
"(",
"array",
"(",
"$",
"this",
"->",
"exampleClass",
",",
"$",
"stepName",
")",
",",
"$",
"args",
")",
";",
"}",
"catch",
"(",
"OffAmazonPaymentsService_Exception",
"$",
"ex",
")",
"{",
"$",
"this",
"->",
"printExceptionToCLI",
"(",
"$",
"ex",
",",
"$",
"stepName",
")",
";",
"throw",
"$",
"ex",
";",
"}",
"return",
"$",
"response",
";",
"}"
] | Call the desired setp and check that it does not throw an
exception
@param string $stepName the name of the step to call on the example class
@return mixed the response object from the step, or an exception if thrown | [
"Call",
"the",
"desired",
"setp",
"and",
"check",
"that",
"it",
"does",
"not",
"throw",
"an",
"exception"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/CLIExample.php#L37-L47 |
31,998 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/CLIExample.php | CLIExample.printExceptionToCLI | protected function printExceptionToCLI(
OffAmazonPaymentsService_Exception $ex,
$stepName
) {
print "Error caught executing step " . $stepName . PHP_EOL;
print "Caught Exception: " . $ex->getMessage() . PHP_EOL;
print "Response Status Code: " . $ex->getStatusCode() . PHP_EOL;
print "Error Code: " . $ex->getErrorCode() . PHP_EOL;
print "Error Type: " . $ex->getErrorType() . PHP_EOL;
print "Request ID: " . $ex->getRequestId() . PHP_EOL;
print "XML: " . $ex->getXML() . PHP_EOL;
print "ResponseHeaderMetadata: " . $ex->getResponseHeaderMetadata() . PHP_EOL;
} | php | protected function printExceptionToCLI(
OffAmazonPaymentsService_Exception $ex,
$stepName
) {
print "Error caught executing step " . $stepName . PHP_EOL;
print "Caught Exception: " . $ex->getMessage() . PHP_EOL;
print "Response Status Code: " . $ex->getStatusCode() . PHP_EOL;
print "Error Code: " . $ex->getErrorCode() . PHP_EOL;
print "Error Type: " . $ex->getErrorType() . PHP_EOL;
print "Request ID: " . $ex->getRequestId() . PHP_EOL;
print "XML: " . $ex->getXML() . PHP_EOL;
print "ResponseHeaderMetadata: " . $ex->getResponseHeaderMetadata() . PHP_EOL;
} | [
"protected",
"function",
"printExceptionToCLI",
"(",
"OffAmazonPaymentsService_Exception",
"$",
"ex",
",",
"$",
"stepName",
")",
"{",
"print",
"\"Error caught executing step \"",
".",
"$",
"stepName",
".",
"PHP_EOL",
";",
"print",
"\"Caught Exception: \"",
".",
"$",
"ex",
"->",
"getMessage",
"(",
")",
".",
"PHP_EOL",
";",
"print",
"\"Response Status Code: \"",
".",
"$",
"ex",
"->",
"getStatusCode",
"(",
")",
".",
"PHP_EOL",
";",
"print",
"\"Error Code: \"",
".",
"$",
"ex",
"->",
"getErrorCode",
"(",
")",
".",
"PHP_EOL",
";",
"print",
"\"Error Type: \"",
".",
"$",
"ex",
"->",
"getErrorType",
"(",
")",
".",
"PHP_EOL",
";",
"print",
"\"Request ID: \"",
".",
"$",
"ex",
"->",
"getRequestId",
"(",
")",
".",
"PHP_EOL",
";",
"print",
"\"XML: \"",
".",
"$",
"ex",
"->",
"getXML",
"(",
")",
".",
"PHP_EOL",
";",
"print",
"\"ResponseHeaderMetadata: \"",
".",
"$",
"ex",
"->",
"getResponseHeaderMetadata",
"(",
")",
".",
"PHP_EOL",
";",
"}"
] | Output information about the raised exception to standard output
@param OffAmazonPaymentsService_Exception $ex exception
@param string $stepName step where ex occured
@return no value | [
"Output",
"information",
"about",
"the",
"raised",
"exception",
"to",
"standard",
"output"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/CLIExample.php#L57-L69 |
31,999 | chameleon-system/chameleon-shop | src/ShopListFilterBundle/objects/db/ListfilterItems/TPkgShopListfilterItemVariantDynamic.class.php | TPkgShopListfilterItemVariantDynamic.PostLoadHook | protected function PostLoadHook()
{
parent::PostLoadHook();
$oListFilterItemType = $this->GetFieldPkgShopListfilterItemType();
if ($oListFilterItemType) {
$this->sVariantTypeIdentifier = $this->fieldVariantIdentifier;
}
} | php | protected function PostLoadHook()
{
parent::PostLoadHook();
$oListFilterItemType = $this->GetFieldPkgShopListfilterItemType();
if ($oListFilterItemType) {
$this->sVariantTypeIdentifier = $this->fieldVariantIdentifier;
}
} | [
"protected",
"function",
"PostLoadHook",
"(",
")",
"{",
"parent",
"::",
"PostLoadHook",
"(",
")",
";",
"$",
"oListFilterItemType",
"=",
"$",
"this",
"->",
"GetFieldPkgShopListfilterItemType",
"(",
")",
";",
"if",
"(",
"$",
"oListFilterItemType",
")",
"{",
"$",
"this",
"->",
"sVariantTypeIdentifier",
"=",
"$",
"this",
"->",
"fieldVariantIdentifier",
";",
"}",
"}"
] | Get variant system name and set it to sVariantTypeIdentifier. | [
"Get",
"variant",
"system",
"name",
"and",
"set",
"it",
"to",
"sVariantTypeIdentifier",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopListFilterBundle/objects/db/ListfilterItems/TPkgShopListfilterItemVariantDynamic.class.php#L24-L31 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.