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,400
chameleon-system/chameleon-shop
src/ExtranetRegistrationGuestBundle/pkgExtranet/objects/WebModules/MTExtranetRegistrationGuestCore/MTExtranetRegistrationGuestCore.class.php
MTExtranetRegistrationGuestCore.ActivePageIsRegisterAfterShopping
protected function ActivePageIsRegisterAfterShopping() { $bActivePageIsRegisterAfterShopping = false; $oURLData = TCMSSmartURLData::GetActive(); $oShop = TdbShop::GetInstance($oURLData->iPortalId); $sNodeId = $oShop->GetSystemPageNodeId('register-after-shopping'); $oActivePage = $this->getActivePageService()->getActivePage(); if ($oActivePage && $sNodeId == $oActivePage->GetMainTreeId()) { $bActivePageIsRegisterAfterShopping = true; } return $bActivePageIsRegisterAfterShopping; }
php
protected function ActivePageIsRegisterAfterShopping() { $bActivePageIsRegisterAfterShopping = false; $oURLData = TCMSSmartURLData::GetActive(); $oShop = TdbShop::GetInstance($oURLData->iPortalId); $sNodeId = $oShop->GetSystemPageNodeId('register-after-shopping'); $oActivePage = $this->getActivePageService()->getActivePage(); if ($oActivePage && $sNodeId == $oActivePage->GetMainTreeId()) { $bActivePageIsRegisterAfterShopping = true; } return $bActivePageIsRegisterAfterShopping; }
[ "protected", "function", "ActivePageIsRegisterAfterShopping", "(", ")", "{", "$", "bActivePageIsRegisterAfterShopping", "=", "false", ";", "$", "oURLData", "=", "TCMSSmartURLData", "::", "GetActive", "(", ")", ";", "$", "oShop", "=", "TdbShop", "::", "GetInstance", "(", "$", "oURLData", "->", "iPortalId", ")", ";", "$", "sNodeId", "=", "$", "oShop", "->", "GetSystemPageNodeId", "(", "'register-after-shopping'", ")", ";", "$", "oActivePage", "=", "$", "this", "->", "getActivePageService", "(", ")", "->", "getActivePage", "(", ")", ";", "if", "(", "$", "oActivePage", "&&", "$", "sNodeId", "==", "$", "oActivePage", "->", "GetMainTreeId", "(", ")", ")", "{", "$", "bActivePageIsRegisterAfterShopping", "=", "true", ";", "}", "return", "$", "bActivePageIsRegisterAfterShopping", ";", "}" ]
Checks if active page is register guest page. @return bool
[ "Checks", "if", "active", "page", "is", "register", "guest", "page", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ExtranetRegistrationGuestBundle/pkgExtranet/objects/WebModules/MTExtranetRegistrationGuestCore/MTExtranetRegistrationGuestCore.class.php#L166-L178
31,401
chameleon-system/chameleon-shop
src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/RefundExample.php
RefundExample.getOrderReferenceDetails
public function getOrderReferenceDetails() { $getOrderReferenceDetailsRequest = new OffAmazonPaymentsService_Model_GetOrderReferenceDetailsRequest(); $getOrderReferenceDetailsRequest->setSellerId($this->_sellerId); $getOrderReferenceDetailsRequest->setAmazonOrderReferenceId( $this->_amazonOrderReferenceId ); return $this->_service->getOrderReferenceDetails( $getOrderReferenceDetailsRequest ); }
php
public function getOrderReferenceDetails() { $getOrderReferenceDetailsRequest = new OffAmazonPaymentsService_Model_GetOrderReferenceDetailsRequest(); $getOrderReferenceDetailsRequest->setSellerId($this->_sellerId); $getOrderReferenceDetailsRequest->setAmazonOrderReferenceId( $this->_amazonOrderReferenceId ); return $this->_service->getOrderReferenceDetails( $getOrderReferenceDetailsRequest ); }
[ "public", "function", "getOrderReferenceDetails", "(", ")", "{", "$", "getOrderReferenceDetailsRequest", "=", "new", "OffAmazonPaymentsService_Model_GetOrderReferenceDetailsRequest", "(", ")", ";", "$", "getOrderReferenceDetailsRequest", "->", "setSellerId", "(", "$", "this", "->", "_sellerId", ")", ";", "$", "getOrderReferenceDetailsRequest", "->", "setAmazonOrderReferenceId", "(", "$", "this", "->", "_amazonOrderReferenceId", ")", ";", "return", "$", "this", "->", "_service", "->", "getOrderReferenceDetails", "(", "$", "getOrderReferenceDetailsRequest", ")", ";", "}" ]
Get the order reference details to find to the state of the order reference @return OffAmazonPaymentsService_Model_GetOrderReferenceDetailsResponse response
[ "Get", "the", "order", "reference", "details", "to", "find", "to", "the", "state", "of", "the", "order", "reference" ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/RefundExample.php#L80-L92
31,402
chameleon-system/chameleon-shop
src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/RefundExample.php
RefundExample.getCaptureDetailsRequest
public function getCaptureDetailsRequest() { $getCaptureDetailsRequest = new OffAmazonPaymentsService_Model_GetCaptureDetailsRequest(); $getCaptureDetailsRequest->setSellerId($this->_sellerId); $getCaptureDetailsRequest->setAmazonCaptureId($this->_amazonCaptureId); return $this->_service->getCaptureDetails($getCaptureDetailsRequest); }
php
public function getCaptureDetailsRequest() { $getCaptureDetailsRequest = new OffAmazonPaymentsService_Model_GetCaptureDetailsRequest(); $getCaptureDetailsRequest->setSellerId($this->_sellerId); $getCaptureDetailsRequest->setAmazonCaptureId($this->_amazonCaptureId); return $this->_service->getCaptureDetails($getCaptureDetailsRequest); }
[ "public", "function", "getCaptureDetailsRequest", "(", ")", "{", "$", "getCaptureDetailsRequest", "=", "new", "OffAmazonPaymentsService_Model_GetCaptureDetailsRequest", "(", ")", ";", "$", "getCaptureDetailsRequest", "->", "setSellerId", "(", "$", "this", "->", "_sellerId", ")", ";", "$", "getCaptureDetailsRequest", "->", "setAmazonCaptureId", "(", "$", "this", "->", "_amazonCaptureId", ")", ";", "return", "$", "this", "->", "_service", "->", "getCaptureDetails", "(", "$", "getCaptureDetailsRequest", ")", ";", "}" ]
Get the capture details to find out the maximum amount that can be refunded @return OffAmazonPaymentsService_Model_GetCaptureDetailsResponse response
[ "Get", "the", "capture", "details", "to", "find", "out", "the", "maximum", "amount", "that", "can", "be", "refunded" ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/RefundExample.php#L100-L108
31,403
chameleon-system/chameleon-shop
src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/RefundExample.php
RefundExample.getRefundDetails
public function getRefundDetails($amazonRefundId) { $getRefundDetailsRequest = new OffAmazonPaymentsService_Model_GetRefundDetailsRequest(); $getRefundDetailsRequest->setSellerId($this->_sellerId); $getRefundDetailsRequest->setAmazonRefundId($amazonRefundId); return $this->_service->getRefundDetails($getRefundDetailsRequest); }
php
public function getRefundDetails($amazonRefundId) { $getRefundDetailsRequest = new OffAmazonPaymentsService_Model_GetRefundDetailsRequest(); $getRefundDetailsRequest->setSellerId($this->_sellerId); $getRefundDetailsRequest->setAmazonRefundId($amazonRefundId); return $this->_service->getRefundDetails($getRefundDetailsRequest); }
[ "public", "function", "getRefundDetails", "(", "$", "amazonRefundId", ")", "{", "$", "getRefundDetailsRequest", "=", "new", "OffAmazonPaymentsService_Model_GetRefundDetailsRequest", "(", ")", ";", "$", "getRefundDetailsRequest", "->", "setSellerId", "(", "$", "this", "->", "_sellerId", ")", ";", "$", "getRefundDetailsRequest", "->", "setAmazonRefundId", "(", "$", "amazonRefundId", ")", ";", "return", "$", "this", "->", "_service", "->", "getRefundDetails", "(", "$", "getRefundDetailsRequest", ")", ";", "}" ]
Perform the getRefundDetails request for the order @param string $amazonRefundId authorization transaction to query @return OffAmazonPaymentsService_Model_GetRefundDetailsResponse response
[ "Perform", "the", "getRefundDetails", "request", "for", "the", "order" ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/RefundExample.php#L180-L187
31,404
chameleon-system/chameleon-shop
src/ShopBundle/objects/TCMSTableEditor/TCMSTableEditorShopOrderEndPoint.class.php
TCMSTableEditorShopOrderEndPoint.ShopOrderSendConfirmOrderMail
public function ShopOrderSendConfirmOrderMail($sMail = null) { $oGlobal = TGlobal::instance(); if (is_null($sMail)) { $sMail = $oGlobal->GetUserData('sTargetMail'); } $oReturnData = $this->GetObjectShortInfo(); $oReturnData->sTargetMail = $sMail; $bSuccess = false; $oOrder = TdbShopOrder::GetNewInstance(); /** @var $oOrder TdbShopOrder */ $oOrder->AllowEditByAll(true); if (!$oOrder->Load($this->sId)) { $oOrder = null; } else { $bSuccess = $oOrder->SendOrderNotification($sMail); } if (true === $bSuccess) { $oReturnData->bSuccess = true; $oReturnData->sMessage = TGlobal::Translate('chameleon_system_shop.orders.msg_order_confirm_sent', array('%mail%' => $sMail)); } else { $oReturnData->bSuccess = false; $oReturnData->sMessage = TGlobal::Translate('chameleon_system_shop.orders.error_sending_confirm_mail', array('%error%' => $bSuccess)); } return $oReturnData; }
php
public function ShopOrderSendConfirmOrderMail($sMail = null) { $oGlobal = TGlobal::instance(); if (is_null($sMail)) { $sMail = $oGlobal->GetUserData('sTargetMail'); } $oReturnData = $this->GetObjectShortInfo(); $oReturnData->sTargetMail = $sMail; $bSuccess = false; $oOrder = TdbShopOrder::GetNewInstance(); /** @var $oOrder TdbShopOrder */ $oOrder->AllowEditByAll(true); if (!$oOrder->Load($this->sId)) { $oOrder = null; } else { $bSuccess = $oOrder->SendOrderNotification($sMail); } if (true === $bSuccess) { $oReturnData->bSuccess = true; $oReturnData->sMessage = TGlobal::Translate('chameleon_system_shop.orders.msg_order_confirm_sent', array('%mail%' => $sMail)); } else { $oReturnData->bSuccess = false; $oReturnData->sMessage = TGlobal::Translate('chameleon_system_shop.orders.error_sending_confirm_mail', array('%error%' => $bSuccess)); } return $oReturnData; }
[ "public", "function", "ShopOrderSendConfirmOrderMail", "(", "$", "sMail", "=", "null", ")", "{", "$", "oGlobal", "=", "TGlobal", "::", "instance", "(", ")", ";", "if", "(", "is_null", "(", "$", "sMail", ")", ")", "{", "$", "sMail", "=", "$", "oGlobal", "->", "GetUserData", "(", "'sTargetMail'", ")", ";", "}", "$", "oReturnData", "=", "$", "this", "->", "GetObjectShortInfo", "(", ")", ";", "$", "oReturnData", "->", "sTargetMail", "=", "$", "sMail", ";", "$", "bSuccess", "=", "false", ";", "$", "oOrder", "=", "TdbShopOrder", "::", "GetNewInstance", "(", ")", ";", "/** @var $oOrder TdbShopOrder */", "$", "oOrder", "->", "AllowEditByAll", "(", "true", ")", ";", "if", "(", "!", "$", "oOrder", "->", "Load", "(", "$", "this", "->", "sId", ")", ")", "{", "$", "oOrder", "=", "null", ";", "}", "else", "{", "$", "bSuccess", "=", "$", "oOrder", "->", "SendOrderNotification", "(", "$", "sMail", ")", ";", "}", "if", "(", "true", "===", "$", "bSuccess", ")", "{", "$", "oReturnData", "->", "bSuccess", "=", "true", ";", "$", "oReturnData", "->", "sMessage", "=", "TGlobal", "::", "Translate", "(", "'chameleon_system_shop.orders.msg_order_confirm_sent'", ",", "array", "(", "'%mail%'", "=>", "$", "sMail", ")", ")", ";", "}", "else", "{", "$", "oReturnData", "->", "bSuccess", "=", "false", ";", "$", "oReturnData", "->", "sMessage", "=", "TGlobal", "::", "Translate", "(", "'chameleon_system_shop.orders.error_sending_confirm_mail'", ",", "array", "(", "'%error%'", "=>", "$", "bSuccess", ")", ")", ";", "}", "return", "$", "oReturnData", ";", "}" ]
send the current order to the email. @param string $sMail - can also be passed via get/post
[ "send", "the", "current", "order", "to", "the", "email", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TCMSTableEditor/TCMSTableEditorShopOrderEndPoint.class.php#L50-L78
31,405
chameleon-system/chameleon-shop
src/ShopBundle/objects/TCMSTableEditor/TCMSTableEditorShopOrderEndPoint.class.php
TCMSTableEditorShopOrderEndPoint.GetFrontendActionUrlToSendOrderEmail
public function GetFrontendActionUrlToSendOrderEmail($sMail = null) { $sURL = ''; if (is_null($sMail)) { $oGlobal = \ChameleonSystem\CoreBundle\ServiceLocator::get('chameleon_system_core.global'); $sMail = $oGlobal->GetUserData('sTargetMail'); } if (!empty($sMail) && is_object($this->oTable)) { $sPortalId = $this->oTable->fieldCmsPortalId; if (empty($this->oTable->fieldCmsPortalId)) { $oPortal = $this->getPortalDomainService()->getActivePortal(); $sPortalId = $oPortal->id; } $oAction = TdbPkgRunFrontendAction::CreateAction('TPkgRunFrontendAction_SendOrderEMail', $sPortalId, array('email' => $sMail, 'order_id' => $this->sId)); $sURL = $oAction->getUrlToRunAction(); } return $sURL; }
php
public function GetFrontendActionUrlToSendOrderEmail($sMail = null) { $sURL = ''; if (is_null($sMail)) { $oGlobal = \ChameleonSystem\CoreBundle\ServiceLocator::get('chameleon_system_core.global'); $sMail = $oGlobal->GetUserData('sTargetMail'); } if (!empty($sMail) && is_object($this->oTable)) { $sPortalId = $this->oTable->fieldCmsPortalId; if (empty($this->oTable->fieldCmsPortalId)) { $oPortal = $this->getPortalDomainService()->getActivePortal(); $sPortalId = $oPortal->id; } $oAction = TdbPkgRunFrontendAction::CreateAction('TPkgRunFrontendAction_SendOrderEMail', $sPortalId, array('email' => $sMail, 'order_id' => $this->sId)); $sURL = $oAction->getUrlToRunAction(); } return $sURL; }
[ "public", "function", "GetFrontendActionUrlToSendOrderEmail", "(", "$", "sMail", "=", "null", ")", "{", "$", "sURL", "=", "''", ";", "if", "(", "is_null", "(", "$", "sMail", ")", ")", "{", "$", "oGlobal", "=", "\\", "ChameleonSystem", "\\", "CoreBundle", "\\", "ServiceLocator", "::", "get", "(", "'chameleon_system_core.global'", ")", ";", "$", "sMail", "=", "$", "oGlobal", "->", "GetUserData", "(", "'sTargetMail'", ")", ";", "}", "if", "(", "!", "empty", "(", "$", "sMail", ")", "&&", "is_object", "(", "$", "this", "->", "oTable", ")", ")", "{", "$", "sPortalId", "=", "$", "this", "->", "oTable", "->", "fieldCmsPortalId", ";", "if", "(", "empty", "(", "$", "this", "->", "oTable", "->", "fieldCmsPortalId", ")", ")", "{", "$", "oPortal", "=", "$", "this", "->", "getPortalDomainService", "(", ")", "->", "getActivePortal", "(", ")", ";", "$", "sPortalId", "=", "$", "oPortal", "->", "id", ";", "}", "$", "oAction", "=", "TdbPkgRunFrontendAction", "::", "CreateAction", "(", "'TPkgRunFrontendAction_SendOrderEMail'", ",", "$", "sPortalId", ",", "array", "(", "'email'", "=>", "$", "sMail", ",", "'order_id'", "=>", "$", "this", "->", "sId", ")", ")", ";", "$", "sURL", "=", "$", "oAction", "->", "getUrlToRunAction", "(", ")", ";", "}", "return", "$", "sURL", ";", "}" ]
send order notification for current order from backend - uses frontend action, so portal and snippets are set correctly. @param string $sMail - can also be passed via get/post @return string
[ "send", "order", "notification", "for", "current", "order", "from", "backend", "-", "uses", "frontend", "action", "so", "portal", "and", "snippets", "are", "set", "correctly", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TCMSTableEditor/TCMSTableEditorShopOrderEndPoint.class.php#L88-L106
31,406
chameleon-system/chameleon-shop
src/ShopBundle/objects/TCMSTableEditor/TCMSTableEditorShopOrderEndPoint.class.php
TCMSTableEditorShopOrderEndPoint.DeleteExecute
protected function DeleteExecute() { $oOrder = clone $this->oTable; $bReturn = parent::DeleteExecute(); if (!empty($oOrder->sqlData['data_extranet_user_id'])) { $oTmpuser = TdbDataExtranetUser::GetNewInstance(); $oTmpuser->Load($oOrder->sqlData['data_extranet_user_id']); if (!is_null($oTmpuser)) { TdbDataExtranetGroup::UpdateAutoAssignToUser($oTmpuser); } } return $bReturn; }
php
protected function DeleteExecute() { $oOrder = clone $this->oTable; $bReturn = parent::DeleteExecute(); if (!empty($oOrder->sqlData['data_extranet_user_id'])) { $oTmpuser = TdbDataExtranetUser::GetNewInstance(); $oTmpuser->Load($oOrder->sqlData['data_extranet_user_id']); if (!is_null($oTmpuser)) { TdbDataExtranetGroup::UpdateAutoAssignToUser($oTmpuser); } } return $bReturn; }
[ "protected", "function", "DeleteExecute", "(", ")", "{", "$", "oOrder", "=", "clone", "$", "this", "->", "oTable", ";", "$", "bReturn", "=", "parent", "::", "DeleteExecute", "(", ")", ";", "if", "(", "!", "empty", "(", "$", "oOrder", "->", "sqlData", "[", "'data_extranet_user_id'", "]", ")", ")", "{", "$", "oTmpuser", "=", "TdbDataExtranetUser", "::", "GetNewInstance", "(", ")", ";", "$", "oTmpuser", "->", "Load", "(", "$", "oOrder", "->", "sqlData", "[", "'data_extranet_user_id'", "]", ")", ";", "if", "(", "!", "is_null", "(", "$", "oTmpuser", ")", ")", "{", "TdbDataExtranetGroup", "::", "UpdateAutoAssignToUser", "(", "$", "oTmpuser", ")", ";", "}", "}", "return", "$", "bReturn", ";", "}" ]
is called only from Delete method and calls all delete relevant methods executes the final SQL Delete Query.
[ "is", "called", "only", "from", "Delete", "method", "and", "calls", "all", "delete", "relevant", "methods", "executes", "the", "final", "SQL", "Delete", "Query", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TCMSTableEditor/TCMSTableEditorShopOrderEndPoint.class.php#L156-L169
31,407
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TPkgShop_CmsLanguage.class.php
TPkgShop_CmsLanguage.GetTranslatedPageURL
public function GetTranslatedPageURL() { $sTranslatesPageURL = ''; $this->TargetLanguageSimulation(true); // product page $oActiveProduct = TdbShop::GetActiveItem(); if (is_object($oActiveProduct)) { $oNewProduct = TdbShopArticle::GetNewInstance($oActiveProduct->id, $this->id); $oActiveProductCategory = TdbShop::GetActiveCategory(); $sCatId = null; if (is_object($oActiveProductCategory)) { $sCatId = $oActiveProductCategory->id; } $sTranslatesPageURL = $oNewProduct->GetDetailLink(true, $sCatId); } // category page? if (empty($sTranslatesPageURL)) { $oActiveProductCategory = TdbShop::GetActiveCategory(); if (is_object($oActiveProductCategory)) { $oNewProductCategory = TdbShopCategory::GetNewInstance($oActiveProductCategory->id, $this->id); $sTranslatesPageURL = $oNewProductCategory->GetLink(true); } } $this->TargetLanguageSimulation(false); // shop basket wizard? if (empty($sTranslatesPageURL)) { $oGlobal = TGlobal::instance(); $sStepName = $oGlobal->GetUserData(MTShopOrderWizardCore::URL_PARAM_STEP_SYSTEM_NAME); if (!empty($sStepName)) { $oActiveStep = TdbShopOrderStep::GetStep($sStepName); $sTranslatesPageURL = $this->getOrderStepPageService()->getLinkToOrderStepPageAbsolute($oActiveStep, array(), null, $this); } } if (empty($sTranslatesPageURL)) { $sTranslatesPageURL = parent::GetTranslatedPageURL(); } return $sTranslatesPageURL; }
php
public function GetTranslatedPageURL() { $sTranslatesPageURL = ''; $this->TargetLanguageSimulation(true); // product page $oActiveProduct = TdbShop::GetActiveItem(); if (is_object($oActiveProduct)) { $oNewProduct = TdbShopArticle::GetNewInstance($oActiveProduct->id, $this->id); $oActiveProductCategory = TdbShop::GetActiveCategory(); $sCatId = null; if (is_object($oActiveProductCategory)) { $sCatId = $oActiveProductCategory->id; } $sTranslatesPageURL = $oNewProduct->GetDetailLink(true, $sCatId); } // category page? if (empty($sTranslatesPageURL)) { $oActiveProductCategory = TdbShop::GetActiveCategory(); if (is_object($oActiveProductCategory)) { $oNewProductCategory = TdbShopCategory::GetNewInstance($oActiveProductCategory->id, $this->id); $sTranslatesPageURL = $oNewProductCategory->GetLink(true); } } $this->TargetLanguageSimulation(false); // shop basket wizard? if (empty($sTranslatesPageURL)) { $oGlobal = TGlobal::instance(); $sStepName = $oGlobal->GetUserData(MTShopOrderWizardCore::URL_PARAM_STEP_SYSTEM_NAME); if (!empty($sStepName)) { $oActiveStep = TdbShopOrderStep::GetStep($sStepName); $sTranslatesPageURL = $this->getOrderStepPageService()->getLinkToOrderStepPageAbsolute($oActiveStep, array(), null, $this); } } if (empty($sTranslatesPageURL)) { $sTranslatesPageURL = parent::GetTranslatedPageURL(); } return $sTranslatesPageURL; }
[ "public", "function", "GetTranslatedPageURL", "(", ")", "{", "$", "sTranslatesPageURL", "=", "''", ";", "$", "this", "->", "TargetLanguageSimulation", "(", "true", ")", ";", "// product page", "$", "oActiveProduct", "=", "TdbShop", "::", "GetActiveItem", "(", ")", ";", "if", "(", "is_object", "(", "$", "oActiveProduct", ")", ")", "{", "$", "oNewProduct", "=", "TdbShopArticle", "::", "GetNewInstance", "(", "$", "oActiveProduct", "->", "id", ",", "$", "this", "->", "id", ")", ";", "$", "oActiveProductCategory", "=", "TdbShop", "::", "GetActiveCategory", "(", ")", ";", "$", "sCatId", "=", "null", ";", "if", "(", "is_object", "(", "$", "oActiveProductCategory", ")", ")", "{", "$", "sCatId", "=", "$", "oActiveProductCategory", "->", "id", ";", "}", "$", "sTranslatesPageURL", "=", "$", "oNewProduct", "->", "GetDetailLink", "(", "true", ",", "$", "sCatId", ")", ";", "}", "// category page?", "if", "(", "empty", "(", "$", "sTranslatesPageURL", ")", ")", "{", "$", "oActiveProductCategory", "=", "TdbShop", "::", "GetActiveCategory", "(", ")", ";", "if", "(", "is_object", "(", "$", "oActiveProductCategory", ")", ")", "{", "$", "oNewProductCategory", "=", "TdbShopCategory", "::", "GetNewInstance", "(", "$", "oActiveProductCategory", "->", "id", ",", "$", "this", "->", "id", ")", ";", "$", "sTranslatesPageURL", "=", "$", "oNewProductCategory", "->", "GetLink", "(", "true", ")", ";", "}", "}", "$", "this", "->", "TargetLanguageSimulation", "(", "false", ")", ";", "// shop basket wizard?", "if", "(", "empty", "(", "$", "sTranslatesPageURL", ")", ")", "{", "$", "oGlobal", "=", "TGlobal", "::", "instance", "(", ")", ";", "$", "sStepName", "=", "$", "oGlobal", "->", "GetUserData", "(", "MTShopOrderWizardCore", "::", "URL_PARAM_STEP_SYSTEM_NAME", ")", ";", "if", "(", "!", "empty", "(", "$", "sStepName", ")", ")", "{", "$", "oActiveStep", "=", "TdbShopOrderStep", "::", "GetStep", "(", "$", "sStepName", ")", ";", "$", "sTranslatesPageURL", "=", "$", "this", "->", "getOrderStepPageService", "(", ")", "->", "getLinkToOrderStepPageAbsolute", "(", "$", "oActiveStep", ",", "array", "(", ")", ",", "null", ",", "$", "this", ")", ";", "}", "}", "if", "(", "empty", "(", "$", "sTranslatesPageURL", ")", ")", "{", "$", "sTranslatesPageURL", "=", "parent", "::", "GetTranslatedPageURL", "(", ")", ";", "}", "return", "$", "sTranslatesPageURL", ";", "}" ]
Return translated page URL. @return string
[ "Return", "translated", "page", "URL", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TPkgShop_CmsLanguage.class.php#L21-L65
31,408
edmondscommerce/doctrine-static-meta
src/Container.php
Container.addConfiguration
final public function addConfiguration(ContainerBuilder $containerBuilder, array $server): void { $this->autoWireServices($containerBuilder); $this->defineConfig($containerBuilder, $server); $this->defineCache($containerBuilder, $server); $this->defineEntityManager($containerBuilder); $this->configureValidationComponents($containerBuilder); $this->defineAliases($containerBuilder); $this->registerCustomFakerDataFillers($containerBuilder); }
php
final public function addConfiguration(ContainerBuilder $containerBuilder, array $server): void { $this->autoWireServices($containerBuilder); $this->defineConfig($containerBuilder, $server); $this->defineCache($containerBuilder, $server); $this->defineEntityManager($containerBuilder); $this->configureValidationComponents($containerBuilder); $this->defineAliases($containerBuilder); $this->registerCustomFakerDataFillers($containerBuilder); }
[ "final", "public", "function", "addConfiguration", "(", "ContainerBuilder", "$", "containerBuilder", ",", "array", "$", "server", ")", ":", "void", "{", "$", "this", "->", "autoWireServices", "(", "$", "containerBuilder", ")", ";", "$", "this", "->", "defineConfig", "(", "$", "containerBuilder", ",", "$", "server", ")", ";", "$", "this", "->", "defineCache", "(", "$", "containerBuilder", ",", "$", "server", ")", ";", "$", "this", "->", "defineEntityManager", "(", "$", "containerBuilder", ")", ";", "$", "this", "->", "configureValidationComponents", "(", "$", "containerBuilder", ")", ";", "$", "this", "->", "defineAliases", "(", "$", "containerBuilder", ")", ";", "$", "this", "->", "registerCustomFakerDataFillers", "(", "$", "containerBuilder", ")", ";", "}" ]
Build all the definitions, alias and other configuration for this container. Each of these steps need to be carried out to allow the everything to work, however you may wish to change individual bits. Therefore this method has been made final, but the individual methods can be overwritten if you extend off the class @param ContainerBuilder $containerBuilder @param array $server @throws \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException @throws \Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException
[ "Build", "all", "the", "definitions", "alias", "and", "other", "configuration", "for", "this", "container", ".", "Each", "of", "these", "steps", "need", "to", "be", "carried", "out", "to", "allow", "the", "everything", "to", "work", "however", "you", "may", "wish", "to", "change", "individual", "bits", ".", "Therefore", "this", "method", "has", "been", "made", "final", "but", "the", "individual", "methods", "can", "be", "overwritten", "if", "you", "extend", "off", "the", "class" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Container.php#L348-L357
31,409
edmondscommerce/doctrine-static-meta
src/Container.php
Container.autoWireServices
public function autoWireServices(ContainerBuilder $containerBuilder): void { $services = $this->getServices(); foreach ($services as $class) { $containerBuilder->autowire($class, $class)->setPublic(true); } }
php
public function autoWireServices(ContainerBuilder $containerBuilder): void { $services = $this->getServices(); foreach ($services as $class) { $containerBuilder->autowire($class, $class)->setPublic(true); } }
[ "public", "function", "autoWireServices", "(", "ContainerBuilder", "$", "containerBuilder", ")", ":", "void", "{", "$", "services", "=", "$", "this", "->", "getServices", "(", ")", ";", "foreach", "(", "$", "services", "as", "$", "class", ")", "{", "$", "containerBuilder", "->", "autowire", "(", "$", "class", ",", "$", "class", ")", "->", "setPublic", "(", "true", ")", ";", "}", "}" ]
This takes every class from the getServices method, auto wires them and marks them as public. You may wish to override this if you want to mark certain classes as private @param ContainerBuilder $containerBuilder
[ "This", "takes", "every", "class", "from", "the", "getServices", "method", "auto", "wires", "them", "and", "marks", "them", "as", "public", ".", "You", "may", "wish", "to", "override", "this", "if", "you", "want", "to", "mark", "certain", "classes", "as", "private" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Container.php#L365-L371
31,410
edmondscommerce/doctrine-static-meta
src/Container.php
Container.defineEntityManager
public function defineEntityManager(ContainerBuilder $container): void { $container->getDefinition(EntityManagerInterface::class) ->addArgument(new Reference(Config::class)) ->setFactory( [ new Reference(EntityManagerFactory::class), 'getEntityManager', ] ); }
php
public function defineEntityManager(ContainerBuilder $container): void { $container->getDefinition(EntityManagerInterface::class) ->addArgument(new Reference(Config::class)) ->setFactory( [ new Reference(EntityManagerFactory::class), 'getEntityManager', ] ); }
[ "public", "function", "defineEntityManager", "(", "ContainerBuilder", "$", "container", ")", ":", "void", "{", "$", "container", "->", "getDefinition", "(", "EntityManagerInterface", "::", "class", ")", "->", "addArgument", "(", "new", "Reference", "(", "Config", "::", "class", ")", ")", "->", "setFactory", "(", "[", "new", "Reference", "(", "EntityManagerFactory", "::", "class", ")", ",", "'getEntityManager'", ",", "]", ")", ";", "}" ]
This is used to auto wire the entity manager. It first adds the DSM factory as the factory for the class, and sets the Entity Manager as the implementation of the interface. Overrider this if you want to use your own factory to create and configure the entity manager @param ContainerBuilder $container
[ "This", "is", "used", "to", "auto", "wire", "the", "entity", "manager", ".", "It", "first", "adds", "the", "DSM", "factory", "as", "the", "factory", "for", "the", "class", "and", "sets", "the", "Entity", "Manager", "as", "the", "implementation", "of", "the", "interface", ".", "Overrider", "this", "if", "you", "want", "to", "use", "your", "own", "factory", "to", "create", "and", "configure", "the", "entity", "manager" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Container.php#L460-L470
31,411
edmondscommerce/doctrine-static-meta
src/Container.php
Container.configureValidationComponents
public function configureValidationComponents(ContainerBuilder $containerBuilder): void { $containerBuilder->getDefinition(EntityDataValidator::class) ->setFactory( [ new Reference(EntityDataValidatorFactory::class), 'buildEntityDataValidator', ] )->setShared(false); }
php
public function configureValidationComponents(ContainerBuilder $containerBuilder): void { $containerBuilder->getDefinition(EntityDataValidator::class) ->setFactory( [ new Reference(EntityDataValidatorFactory::class), 'buildEntityDataValidator', ] )->setShared(false); }
[ "public", "function", "configureValidationComponents", "(", "ContainerBuilder", "$", "containerBuilder", ")", ":", "void", "{", "$", "containerBuilder", "->", "getDefinition", "(", "EntityDataValidator", "::", "class", ")", "->", "setFactory", "(", "[", "new", "Reference", "(", "EntityDataValidatorFactory", "::", "class", ")", ",", "'buildEntityDataValidator'", ",", "]", ")", "->", "setShared", "(", "false", ")", ";", "}" ]
Ensure we are using the container constraint validator factory so that custom validators with dependencies can simply declare them as normal. Note that you will need to define each custom validator as a service in your container. @param ContainerBuilder $containerBuilder
[ "Ensure", "we", "are", "using", "the", "container", "constraint", "validator", "factory", "so", "that", "custom", "validators", "with", "dependencies", "can", "simply", "declare", "them", "as", "normal", ".", "Note", "that", "you", "will", "need", "to", "define", "each", "custom", "validator", "as", "a", "service", "in", "your", "container", "." ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Container.php#L479-L488
31,412
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandler.class.php
TShopPaymentHandler.SetExecutePaymentInterrupt
public static function SetExecutePaymentInterrupt($bActive) { if ($bActive) { $_SESSION[TdbShopPaymentHandler::CONTINUE_PAYMENT_EXECUTION_FLAG] = '1'; } else { if (array_key_exists(TdbShopPaymentHandler::CONTINUE_PAYMENT_EXECUTION_FLAG, $_SESSION)) { $_SESSION[TdbShopPaymentHandler::CONTINUE_PAYMENT_EXECUTION_FLAG] = '0'; unset($_SESSION[TdbShopPaymentHandler::CONTINUE_PAYMENT_EXECUTION_FLAG]); } } }
php
public static function SetExecutePaymentInterrupt($bActive) { if ($bActive) { $_SESSION[TdbShopPaymentHandler::CONTINUE_PAYMENT_EXECUTION_FLAG] = '1'; } else { if (array_key_exists(TdbShopPaymentHandler::CONTINUE_PAYMENT_EXECUTION_FLAG, $_SESSION)) { $_SESSION[TdbShopPaymentHandler::CONTINUE_PAYMENT_EXECUTION_FLAG] = '0'; unset($_SESSION[TdbShopPaymentHandler::CONTINUE_PAYMENT_EXECUTION_FLAG]); } } }
[ "public", "static", "function", "SetExecutePaymentInterrupt", "(", "$", "bActive", ")", "{", "if", "(", "$", "bActive", ")", "{", "$", "_SESSION", "[", "TdbShopPaymentHandler", "::", "CONTINUE_PAYMENT_EXECUTION_FLAG", "]", "=", "'1'", ";", "}", "else", "{", "if", "(", "array_key_exists", "(", "TdbShopPaymentHandler", "::", "CONTINUE_PAYMENT_EXECUTION_FLAG", ",", "$", "_SESSION", ")", ")", "{", "$", "_SESSION", "[", "TdbShopPaymentHandler", "::", "CONTINUE_PAYMENT_EXECUTION_FLAG", "]", "=", "'0'", ";", "unset", "(", "$", "_SESSION", "[", "TdbShopPaymentHandler", "::", "CONTINUE_PAYMENT_EXECUTION_FLAG", "]", ")", ";", "}", "}", "}" ]
Set the ExecutePaymentInterrupt. If it is set to active, then the next request to the basket page will auto. @param bool $bActive
[ "Set", "the", "ExecutePaymentInterrupt", ".", "If", "it", "is", "set", "to", "active", "then", "the", "next", "request", "to", "the", "basket", "page", "will", "auto", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandler.class.php#L223-L233
31,413
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandler.class.php
TShopPaymentHandler.GetUserPaymentDataItem
public function GetUserPaymentDataItem($sItemName) { $aPaymentData = $this->GetUserPaymentData(); $sReturn = false; if (is_array($aPaymentData) && isset($aPaymentData[$sItemName])) { $sReturn = $aPaymentData[$sItemName]; } return $sReturn; }
php
public function GetUserPaymentDataItem($sItemName) { $aPaymentData = $this->GetUserPaymentData(); $sReturn = false; if (is_array($aPaymentData) && isset($aPaymentData[$sItemName])) { $sReturn = $aPaymentData[$sItemName]; } return $sReturn; }
[ "public", "function", "GetUserPaymentDataItem", "(", "$", "sItemName", ")", "{", "$", "aPaymentData", "=", "$", "this", "->", "GetUserPaymentData", "(", ")", ";", "$", "sReturn", "=", "false", ";", "if", "(", "is_array", "(", "$", "aPaymentData", ")", "&&", "isset", "(", "$", "aPaymentData", "[", "$", "sItemName", "]", ")", ")", "{", "$", "sReturn", "=", "$", "aPaymentData", "[", "$", "sItemName", "]", ";", "}", "return", "$", "sReturn", ";", "}" ]
return a variable from the user payment data. false if the variable is not found. @param $sItemName @return bool|string
[ "return", "a", "variable", "from", "the", "user", "payment", "data", ".", "false", "if", "the", "variable", "is", "not", "found", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandler.class.php#L366-L375
31,414
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandler.class.php
TShopPaymentHandler.Render
public function Render($sViewName = 'standard', $sViewType = 'Core', $aCallTimeVars = array()) { $oView = new TViewParser(); $oShop = TdbShop::GetInstance(); $oView->AddVar('oShop', $oShop); $oView->AddVar('oPaymentHandler', $this); $aUserPaymentData = $this->GetUserPaymentData(); $oView->AddVar('aUserPaymentData', $aUserPaymentData); $oView->AddVar('aCallTimeVars', $aCallTimeVars); $aOtherParameters = $this->GetAdditionalViewVariables($sViewName, $sViewType); $oView->AddVarArray($aOtherParameters); return $oView->RenderObjectPackageView($sViewName, $this->GetViewPath(), $sViewType); }
php
public function Render($sViewName = 'standard', $sViewType = 'Core', $aCallTimeVars = array()) { $oView = new TViewParser(); $oShop = TdbShop::GetInstance(); $oView->AddVar('oShop', $oShop); $oView->AddVar('oPaymentHandler', $this); $aUserPaymentData = $this->GetUserPaymentData(); $oView->AddVar('aUserPaymentData', $aUserPaymentData); $oView->AddVar('aCallTimeVars', $aCallTimeVars); $aOtherParameters = $this->GetAdditionalViewVariables($sViewName, $sViewType); $oView->AddVarArray($aOtherParameters); return $oView->RenderObjectPackageView($sViewName, $this->GetViewPath(), $sViewType); }
[ "public", "function", "Render", "(", "$", "sViewName", "=", "'standard'", ",", "$", "sViewType", "=", "'Core'", ",", "$", "aCallTimeVars", "=", "array", "(", ")", ")", "{", "$", "oView", "=", "new", "TViewParser", "(", ")", ";", "$", "oShop", "=", "TdbShop", "::", "GetInstance", "(", ")", ";", "$", "oView", "->", "AddVar", "(", "'oShop'", ",", "$", "oShop", ")", ";", "$", "oView", "->", "AddVar", "(", "'oPaymentHandler'", ",", "$", "this", ")", ";", "$", "aUserPaymentData", "=", "$", "this", "->", "GetUserPaymentData", "(", ")", ";", "$", "oView", "->", "AddVar", "(", "'aUserPaymentData'", ",", "$", "aUserPaymentData", ")", ";", "$", "oView", "->", "AddVar", "(", "'aCallTimeVars'", ",", "$", "aCallTimeVars", ")", ";", "$", "aOtherParameters", "=", "$", "this", "->", "GetAdditionalViewVariables", "(", "$", "sViewName", ",", "$", "sViewType", ")", ";", "$", "oView", "->", "AddVarArray", "(", "$", "aOtherParameters", ")", ";", "return", "$", "oView", "->", "RenderObjectPackageView", "(", "$", "sViewName", ",", "$", "this", "->", "GetViewPath", "(", ")", ",", "$", "sViewType", ")", ";", "}" ]
used to display the basket article list. @param string $sViewName - the view to use @param string $sViewType - where the view is located (Core, Custom-Core, Customer) @param array $aCallTimeVars - place any custom vars that you want to pass through the call here @return string
[ "used", "to", "display", "the", "basket", "article", "list", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandler.class.php#L407-L422
31,415
chameleon-system/chameleon-shop
src/ShopRatingServiceBundle/objects/webmodules/MTRatingList/MTRatingListCore.class.php
MTRatingListCore.SetActivePageSort
protected function SetActivePageSort() { $this->sActivePageSort = $this->GetUserInput('pagesort'); if (empty($this->sActivePageSort)) { //load default $this->sActivePageSort = $this->GetPageSortDefaultValue(); //default $this->SetModuleSessionParameter('pagesort', $this->sActivePageSort); } else { $bFound = false; foreach ($this->aPageSort as $iPsKey => $aPsVal) { if (in_array($this->sActivePageSort, $aPsVal)) { $bFound = true; } } if (!$bFound) { //try to load from session $this->sActivePageSort = strtolower(trim($this->GetModuleSessionParameter('pagesort', false))); if (!$this->sActivePageSort) { $this->sActivePageSort = $this->aPageSort[1]['id']; } //default $this->SetModuleSessionParameter('pagesort', $this->sActivePageSort); } } }
php
protected function SetActivePageSort() { $this->sActivePageSort = $this->GetUserInput('pagesort'); if (empty($this->sActivePageSort)) { //load default $this->sActivePageSort = $this->GetPageSortDefaultValue(); //default $this->SetModuleSessionParameter('pagesort', $this->sActivePageSort); } else { $bFound = false; foreach ($this->aPageSort as $iPsKey => $aPsVal) { if (in_array($this->sActivePageSort, $aPsVal)) { $bFound = true; } } if (!$bFound) { //try to load from session $this->sActivePageSort = strtolower(trim($this->GetModuleSessionParameter('pagesort', false))); if (!$this->sActivePageSort) { $this->sActivePageSort = $this->aPageSort[1]['id']; } //default $this->SetModuleSessionParameter('pagesort', $this->sActivePageSort); } } }
[ "protected", "function", "SetActivePageSort", "(", ")", "{", "$", "this", "->", "sActivePageSort", "=", "$", "this", "->", "GetUserInput", "(", "'pagesort'", ")", ";", "if", "(", "empty", "(", "$", "this", "->", "sActivePageSort", ")", ")", "{", "//load default", "$", "this", "->", "sActivePageSort", "=", "$", "this", "->", "GetPageSortDefaultValue", "(", ")", ";", "//default", "$", "this", "->", "SetModuleSessionParameter", "(", "'pagesort'", ",", "$", "this", "->", "sActivePageSort", ")", ";", "}", "else", "{", "$", "bFound", "=", "false", ";", "foreach", "(", "$", "this", "->", "aPageSort", "as", "$", "iPsKey", "=>", "$", "aPsVal", ")", "{", "if", "(", "in_array", "(", "$", "this", "->", "sActivePageSort", ",", "$", "aPsVal", ")", ")", "{", "$", "bFound", "=", "true", ";", "}", "}", "if", "(", "!", "$", "bFound", ")", "{", "//try to load from session", "$", "this", "->", "sActivePageSort", "=", "strtolower", "(", "trim", "(", "$", "this", "->", "GetModuleSessionParameter", "(", "'pagesort'", ",", "false", ")", ")", ")", ";", "if", "(", "!", "$", "this", "->", "sActivePageSort", ")", "{", "$", "this", "->", "sActivePageSort", "=", "$", "this", "->", "aPageSort", "[", "1", "]", "[", "'id'", "]", ";", "}", "//default", "$", "this", "->", "SetModuleSessionParameter", "(", "'pagesort'", ",", "$", "this", "->", "sActivePageSort", ")", ";", "}", "}", "}" ]
Set active page sort, load from user input, session, default.
[ "Set", "active", "page", "sort", "load", "from", "user", "input", "session", "default", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopRatingServiceBundle/objects/webmodules/MTRatingList/MTRatingListCore.class.php#L43-L66
31,416
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopArticleGroupList.class.php
TShopArticleGroupList.&
public static function &GetArticleGroups($iArticleId) { $oList = null; $query = "SELECT `shop_article_group`.* FROM `shop_article_group` INNER JOIN `shop_article_article_group_mlt` ON `shop_article_group`.`id` = `shop_article_article_group_mlt`.`target_id` WHERE `shop_article_article_group_mlt`.`source_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($iArticleId)."' ORDER BY `shop_article_group`.`name` "; $oList = &TdbShopArticleGroupList::GetList($query); return $oList; }
php
public static function &GetArticleGroups($iArticleId) { $oList = null; $query = "SELECT `shop_article_group`.* FROM `shop_article_group` INNER JOIN `shop_article_article_group_mlt` ON `shop_article_group`.`id` = `shop_article_article_group_mlt`.`target_id` WHERE `shop_article_article_group_mlt`.`source_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($iArticleId)."' ORDER BY `shop_article_group`.`name` "; $oList = &TdbShopArticleGroupList::GetList($query); return $oList; }
[ "public", "static", "function", "&", "GetArticleGroups", "(", "$", "iArticleId", ")", "{", "$", "oList", "=", "null", ";", "$", "query", "=", "\"SELECT `shop_article_group`.*\n FROM `shop_article_group`\n INNER JOIN `shop_article_article_group_mlt` ON `shop_article_group`.`id` = `shop_article_article_group_mlt`.`target_id`\n WHERE `shop_article_article_group_mlt`.`source_id` = '\"", ".", "MySqlLegacySupport", "::", "getInstance", "(", ")", "->", "real_escape_string", "(", "$", "iArticleId", ")", ".", "\"'\n ORDER BY `shop_article_group`.`name`\n \"", ";", "$", "oList", "=", "&", "TdbShopArticleGroupList", "::", "GetList", "(", "$", "query", ")", ";", "return", "$", "oList", ";", "}" ]
return article group list for an article. @param int $iArticleId @return TdbShopArticleGroupList
[ "return", "article", "group", "list", "for", "an", "article", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticleGroupList.class.php#L21-L34
31,417
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopArticleGroupList.class.php
TShopArticleGroupList.&
public function &GetMaxVat() { $iPointer = $this->getItemPointer(); $oMaxVatItem = null; $this->GoToStart(); while ($oItem = &$this->Next()) { $oCurrentVat = $oItem->GetVat(); if (!is_null($oCurrentVat)) { if (is_null($oMaxVatItem)) { $oMaxVatItem = $oCurrentVat; } elseif ($oMaxVatItem->fieldVatPercent < $oCurrentVat->fieldVatPercent) { $oMaxVatItem = $oCurrentVat; } } } $this->setItemPointer($iPointer); return $oMaxVatItem; }
php
public function &GetMaxVat() { $iPointer = $this->getItemPointer(); $oMaxVatItem = null; $this->GoToStart(); while ($oItem = &$this->Next()) { $oCurrentVat = $oItem->GetVat(); if (!is_null($oCurrentVat)) { if (is_null($oMaxVatItem)) { $oMaxVatItem = $oCurrentVat; } elseif ($oMaxVatItem->fieldVatPercent < $oCurrentVat->fieldVatPercent) { $oMaxVatItem = $oCurrentVat; } } } $this->setItemPointer($iPointer); return $oMaxVatItem; }
[ "public", "function", "&", "GetMaxVat", "(", ")", "{", "$", "iPointer", "=", "$", "this", "->", "getItemPointer", "(", ")", ";", "$", "oMaxVatItem", "=", "null", ";", "$", "this", "->", "GoToStart", "(", ")", ";", "while", "(", "$", "oItem", "=", "&", "$", "this", "->", "Next", "(", ")", ")", "{", "$", "oCurrentVat", "=", "$", "oItem", "->", "GetVat", "(", ")", ";", "if", "(", "!", "is_null", "(", "$", "oCurrentVat", ")", ")", "{", "if", "(", "is_null", "(", "$", "oMaxVatItem", ")", ")", "{", "$", "oMaxVatItem", "=", "$", "oCurrentVat", ";", "}", "elseif", "(", "$", "oMaxVatItem", "->", "fieldVatPercent", "<", "$", "oCurrentVat", "->", "fieldVatPercent", ")", "{", "$", "oMaxVatItem", "=", "$", "oCurrentVat", ";", "}", "}", "}", "$", "this", "->", "setItemPointer", "(", "$", "iPointer", ")", ";", "return", "$", "oMaxVatItem", ";", "}" ]
returns the max vat from the group list. @return TdbShopVat
[ "returns", "the", "max", "vat", "from", "the", "group", "list", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticleGroupList.class.php#L41-L59
31,418
edmondscommerce/doctrine-static-meta
src/CodeGeneration/NamespaceHelper.php
NamespaceHelper.cropSuffix
public function cropSuffix(string $fqn, string $suffix): string { if ($suffix === \substr($fqn, -\strlen($suffix))) { return \substr($fqn, 0, -\strlen($suffix)); } return $fqn; }
php
public function cropSuffix(string $fqn, string $suffix): string { if ($suffix === \substr($fqn, -\strlen($suffix))) { return \substr($fqn, 0, -\strlen($suffix)); } return $fqn; }
[ "public", "function", "cropSuffix", "(", "string", "$", "fqn", ",", "string", "$", "suffix", ")", ":", "string", "{", "if", "(", "$", "suffix", "===", "\\", "substr", "(", "$", "fqn", ",", "-", "\\", "strlen", "(", "$", "suffix", ")", ")", ")", "{", "return", "\\", "substr", "(", "$", "fqn", ",", "0", ",", "-", "\\", "strlen", "(", "$", "suffix", ")", ")", ";", "}", "return", "$", "fqn", ";", "}" ]
Crop a suffix from an FQN if it is there. If it is not there, do nothing and return the FQN as is @param string $fqn @param string $suffix @return string
[ "Crop", "a", "suffix", "from", "an", "FQN", "if", "it", "is", "there", "." ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/NamespaceHelper.php#L39-L46
31,419
edmondscommerce/doctrine-static-meta
src/CodeGeneration/NamespaceHelper.php
NamespaceHelper.basename
public function basename(string $namespace): string { $strrpos = \strrpos($namespace, '\\'); if (false === $strrpos) { return $namespace; } return $this->tidy(\substr($namespace, $strrpos + 1)); }
php
public function basename(string $namespace): string { $strrpos = \strrpos($namespace, '\\'); if (false === $strrpos) { return $namespace; } return $this->tidy(\substr($namespace, $strrpos + 1)); }
[ "public", "function", "basename", "(", "string", "$", "namespace", ")", ":", "string", "{", "$", "strrpos", "=", "\\", "strrpos", "(", "$", "namespace", ",", "'\\\\'", ")", ";", "if", "(", "false", "===", "$", "strrpos", ")", "{", "return", "$", "namespace", ";", "}", "return", "$", "this", "->", "tidy", "(", "\\", "substr", "(", "$", "namespace", ",", "$", "strrpos", "+", "1", ")", ")", ";", "}" ]
Get the basename of a namespace @param string $namespace @return string
[ "Get", "the", "basename", "of", "a", "namespace" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/NamespaceHelper.php#L97-L105
31,420
edmondscommerce/doctrine-static-meta
src/CodeGeneration/NamespaceHelper.php
NamespaceHelper.getNamespaceRootToDirectoryFromFqn
public function getNamespaceRootToDirectoryFromFqn(string $fqn, string $directory): ?string { $strPos = \strrpos( $fqn, $directory ); if (false !== $strPos) { return $this->tidy(\substr($fqn, 0, $strPos + \strlen($directory))); } return null; }
php
public function getNamespaceRootToDirectoryFromFqn(string $fqn, string $directory): ?string { $strPos = \strrpos( $fqn, $directory ); if (false !== $strPos) { return $this->tidy(\substr($fqn, 0, $strPos + \strlen($directory))); } return null; }
[ "public", "function", "getNamespaceRootToDirectoryFromFqn", "(", "string", "$", "fqn", ",", "string", "$", "directory", ")", ":", "?", "string", "{", "$", "strPos", "=", "\\", "strrpos", "(", "$", "fqn", ",", "$", "directory", ")", ";", "if", "(", "false", "!==", "$", "strPos", ")", "{", "return", "$", "this", "->", "tidy", "(", "\\", "substr", "(", "$", "fqn", ",", "0", ",", "$", "strPos", "+", "\\", "strlen", "(", "$", "directory", ")", ")", ")", ";", "}", "return", "null", ";", "}" ]
Get the namespace root up to and including a specified directory @param string $fqn @param string $directory @return null|string
[ "Get", "the", "namespace", "root", "up", "to", "and", "including", "a", "specified", "directory" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/NamespaceHelper.php#L174-L185
31,421
edmondscommerce/doctrine-static-meta
src/CodeGeneration/NamespaceHelper.php
NamespaceHelper.getEntitySubNamespace
public function getEntitySubNamespace( string $entityFqn ): string { return $this->tidy( \substr( $entityFqn, \strrpos( $entityFqn, '\\' . AbstractGenerator::ENTITIES_FOLDER_NAME . '\\' ) + \strlen('\\' . AbstractGenerator::ENTITIES_FOLDER_NAME . '\\') ) ); }
php
public function getEntitySubNamespace( string $entityFqn ): string { return $this->tidy( \substr( $entityFqn, \strrpos( $entityFqn, '\\' . AbstractGenerator::ENTITIES_FOLDER_NAME . '\\' ) + \strlen('\\' . AbstractGenerator::ENTITIES_FOLDER_NAME . '\\') ) ); }
[ "public", "function", "getEntitySubNamespace", "(", "string", "$", "entityFqn", ")", ":", "string", "{", "return", "$", "this", "->", "tidy", "(", "\\", "substr", "(", "$", "entityFqn", ",", "\\", "strrpos", "(", "$", "entityFqn", ",", "'\\\\'", ".", "AbstractGenerator", "::", "ENTITIES_FOLDER_NAME", ".", "'\\\\'", ")", "+", "\\", "strlen", "(", "'\\\\'", ".", "AbstractGenerator", "::", "ENTITIES_FOLDER_NAME", ".", "'\\\\'", ")", ")", ")", ";", "}" ]
Get the Namespace for an Entity, start from the Entities Fully Qualified Name base - normally `\My\Project\Entities\` @param string $entityFqn @return string
[ "Get", "the", "Namespace", "for", "an", "Entity", "start", "from", "the", "Entities", "Fully", "Qualified", "Name", "base", "-", "normally", "\\", "My", "\\", "Project", "\\", "Entities", "\\" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/NamespaceHelper.php#L229-L242
31,422
edmondscommerce/doctrine-static-meta
src/CodeGeneration/NamespaceHelper.php
NamespaceHelper.getTraitsNamespaceForEntity
public function getTraitsNamespaceForEntity( string $entityFqn ): string { $traitsNamespace = $this->getProjectNamespaceRootFromEntityFqn($entityFqn) . AbstractGenerator::ENTITY_RELATIONS_NAMESPACE . '\\' . $this->getEntitySubNamespace($entityFqn) . '\\Traits'; return $traitsNamespace; }
php
public function getTraitsNamespaceForEntity( string $entityFqn ): string { $traitsNamespace = $this->getProjectNamespaceRootFromEntityFqn($entityFqn) . AbstractGenerator::ENTITY_RELATIONS_NAMESPACE . '\\' . $this->getEntitySubNamespace($entityFqn) . '\\Traits'; return $traitsNamespace; }
[ "public", "function", "getTraitsNamespaceForEntity", "(", "string", "$", "entityFqn", ")", ":", "string", "{", "$", "traitsNamespace", "=", "$", "this", "->", "getProjectNamespaceRootFromEntityFqn", "(", "$", "entityFqn", ")", ".", "AbstractGenerator", "::", "ENTITY_RELATIONS_NAMESPACE", ".", "'\\\\'", ".", "$", "this", "->", "getEntitySubNamespace", "(", "$", "entityFqn", ")", ".", "'\\\\Traits'", ";", "return", "$", "traitsNamespace", ";", "}" ]
Get the Fully Qualified Namespace root for Traits for the specified Entity @param string $entityFqn @return string
[ "Get", "the", "Fully", "Qualified", "Namespace", "root", "for", "Traits", "for", "the", "specified", "Entity" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/NamespaceHelper.php#L251-L260
31,423
edmondscommerce/doctrine-static-meta
src/CodeGeneration/NamespaceHelper.php
NamespaceHelper.getProjectNamespaceRootFromEntityFqn
public function getProjectNamespaceRootFromEntityFqn(string $entityFqn): string { return $this->tidy( \substr( $entityFqn, 0, \strrpos( $entityFqn, '\\' . AbstractGenerator::ENTITIES_FOLDER_NAME . '\\' ) ) ); }
php
public function getProjectNamespaceRootFromEntityFqn(string $entityFqn): string { return $this->tidy( \substr( $entityFqn, 0, \strrpos( $entityFqn, '\\' . AbstractGenerator::ENTITIES_FOLDER_NAME . '\\' ) ) ); }
[ "public", "function", "getProjectNamespaceRootFromEntityFqn", "(", "string", "$", "entityFqn", ")", ":", "string", "{", "return", "$", "this", "->", "tidy", "(", "\\", "substr", "(", "$", "entityFqn", ",", "0", ",", "\\", "strrpos", "(", "$", "entityFqn", ",", "'\\\\'", ".", "AbstractGenerator", "::", "ENTITIES_FOLDER_NAME", ".", "'\\\\'", ")", ")", ")", ";", "}" ]
Use the fully qualified name of two Entities to calculate the Project Namespace Root - note: this assumes a single namespace level for entities, eg `Entities` @param string $entityFqn @return string
[ "Use", "the", "fully", "qualified", "name", "of", "two", "Entities", "to", "calculate", "the", "Project", "Namespace", "Root" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/NamespaceHelper.php#L271-L283
31,424
edmondscommerce/doctrine-static-meta
src/CodeGeneration/NamespaceHelper.php
NamespaceHelper.getHasPluralInterfaceFqnForEntity
public function getHasPluralInterfaceFqnForEntity( string $entityFqn ): string { $interfaceNamespace = $this->getInterfacesNamespaceForEntity($entityFqn); return $interfaceNamespace . '\\Has' . ucfirst($entityFqn::getDoctrineStaticMeta()->getPlural()) . 'Interface'; }
php
public function getHasPluralInterfaceFqnForEntity( string $entityFqn ): string { $interfaceNamespace = $this->getInterfacesNamespaceForEntity($entityFqn); return $interfaceNamespace . '\\Has' . ucfirst($entityFqn::getDoctrineStaticMeta()->getPlural()) . 'Interface'; }
[ "public", "function", "getHasPluralInterfaceFqnForEntity", "(", "string", "$", "entityFqn", ")", ":", "string", "{", "$", "interfaceNamespace", "=", "$", "this", "->", "getInterfacesNamespaceForEntity", "(", "$", "entityFqn", ")", ";", "return", "$", "interfaceNamespace", ".", "'\\\\Has'", ".", "ucfirst", "(", "$", "entityFqn", "::", "getDoctrineStaticMeta", "(", ")", "->", "getPlural", "(", ")", ")", ".", "'Interface'", ";", "}" ]
Get the Fully Qualified Namespace for the "HasEntities" interface for the specified Entity @param string $entityFqn @return string
[ "Get", "the", "Fully", "Qualified", "Namespace", "for", "the", "HasEntities", "interface", "for", "the", "specified", "Entity" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/NamespaceHelper.php#L292-L298
31,425
edmondscommerce/doctrine-static-meta
src/CodeGeneration/NamespaceHelper.php
NamespaceHelper.getInterfacesNamespaceForEntity
public function getInterfacesNamespaceForEntity( string $entityFqn ): string { $interfacesNamespace = $this->getProjectNamespaceRootFromEntityFqn($entityFqn) . AbstractGenerator::ENTITY_RELATIONS_NAMESPACE . '\\' . $this->getEntitySubNamespace($entityFqn) . '\\Interfaces'; return $this->tidy($interfacesNamespace); }
php
public function getInterfacesNamespaceForEntity( string $entityFqn ): string { $interfacesNamespace = $this->getProjectNamespaceRootFromEntityFqn($entityFqn) . AbstractGenerator::ENTITY_RELATIONS_NAMESPACE . '\\' . $this->getEntitySubNamespace($entityFqn) . '\\Interfaces'; return $this->tidy($interfacesNamespace); }
[ "public", "function", "getInterfacesNamespaceForEntity", "(", "string", "$", "entityFqn", ")", ":", "string", "{", "$", "interfacesNamespace", "=", "$", "this", "->", "getProjectNamespaceRootFromEntityFqn", "(", "$", "entityFqn", ")", ".", "AbstractGenerator", "::", "ENTITY_RELATIONS_NAMESPACE", ".", "'\\\\'", ".", "$", "this", "->", "getEntitySubNamespace", "(", "$", "entityFqn", ")", ".", "'\\\\Interfaces'", ";", "return", "$", "this", "->", "tidy", "(", "$", "interfacesNamespace", ")", ";", "}" ]
Get the Fully Qualified Namespace root for Interfaces for the specified Entity @param string $entityFqn @return string
[ "Get", "the", "Fully", "Qualified", "Namespace", "root", "for", "Interfaces", "for", "the", "specified", "Entity" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/NamespaceHelper.php#L307-L316
31,426
edmondscommerce/doctrine-static-meta
src/CodeGeneration/NamespaceHelper.php
NamespaceHelper.getHasSingularInterfaceFqnForEntity
public function getHasSingularInterfaceFqnForEntity( string $entityFqn ): string { try { $interfaceNamespace = $this->getInterfacesNamespaceForEntity($entityFqn); return $interfaceNamespace . '\\Has' . ucfirst($entityFqn::getDoctrineStaticMeta()->getSingular()) . 'Interface'; } catch (\Exception $e) { throw new DoctrineStaticMetaException( 'Exception in ' . __METHOD__ . ': ' . $e->getMessage(), $e->getCode(), $e ); } }
php
public function getHasSingularInterfaceFqnForEntity( string $entityFqn ): string { try { $interfaceNamespace = $this->getInterfacesNamespaceForEntity($entityFqn); return $interfaceNamespace . '\\Has' . ucfirst($entityFqn::getDoctrineStaticMeta()->getSingular()) . 'Interface'; } catch (\Exception $e) { throw new DoctrineStaticMetaException( 'Exception in ' . __METHOD__ . ': ' . $e->getMessage(), $e->getCode(), $e ); } }
[ "public", "function", "getHasSingularInterfaceFqnForEntity", "(", "string", "$", "entityFqn", ")", ":", "string", "{", "try", "{", "$", "interfaceNamespace", "=", "$", "this", "->", "getInterfacesNamespaceForEntity", "(", "$", "entityFqn", ")", ";", "return", "$", "interfaceNamespace", ".", "'\\\\Has'", ".", "ucfirst", "(", "$", "entityFqn", "::", "getDoctrineStaticMeta", "(", ")", "->", "getSingular", "(", ")", ")", ".", "'Interface'", ";", "}", "catch", "(", "\\", "Exception", "$", "e", ")", "{", "throw", "new", "DoctrineStaticMetaException", "(", "'Exception in '", ".", "__METHOD__", ".", "': '", ".", "$", "e", "->", "getMessage", "(", ")", ",", "$", "e", "->", "getCode", "(", ")", ",", "$", "e", ")", ";", "}", "}" ]
Get the Fully Qualified Namespace for the "HasEntity" interface for the specified Entity @param string $entityFqn @return string @throws DoctrineStaticMetaException
[ "Get", "the", "Fully", "Qualified", "Namespace", "for", "the", "HasEntity", "interface", "for", "the", "specified", "Entity" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/NamespaceHelper.php#L326-L341
31,427
edmondscommerce/doctrine-static-meta
src/CodeGeneration/NamespaceHelper.php
NamespaceHelper.getProjectRootNamespaceFromComposerJson
public function getProjectRootNamespaceFromComposerJson( string $dirForNamespace = 'src' ): string { try { $dirForNamespace = trim($dirForNamespace, '/'); $jsonPath = Config::getProjectRootDirectory() . '/composer.json'; $json = json_decode(\ts\file_get_contents($jsonPath), true); if (JSON_ERROR_NONE !== json_last_error()) { throw new \RuntimeException( 'Error decoding json from path ' . $jsonPath . ' , ' . json_last_error_msg() ); } /** * @var string[][][][] $json */ if (isset($json['autoload']['psr-4'])) { foreach ($json['autoload']['psr-4'] as $namespace => $dirs) { foreach ($dirs as $dir) { $dir = trim($dir, '/'); if ($dir === $dirForNamespace) { return $this->tidy(rtrim($namespace, '\\')); } } } } } catch (\Exception $e) { throw new DoctrineStaticMetaException( 'Exception in ' . __METHOD__ . ': ' . $e->getMessage(), $e->getCode(), $e ); } throw new DoctrineStaticMetaException('Failed to find psr-4 namespace root'); }
php
public function getProjectRootNamespaceFromComposerJson( string $dirForNamespace = 'src' ): string { try { $dirForNamespace = trim($dirForNamespace, '/'); $jsonPath = Config::getProjectRootDirectory() . '/composer.json'; $json = json_decode(\ts\file_get_contents($jsonPath), true); if (JSON_ERROR_NONE !== json_last_error()) { throw new \RuntimeException( 'Error decoding json from path ' . $jsonPath . ' , ' . json_last_error_msg() ); } /** * @var string[][][][] $json */ if (isset($json['autoload']['psr-4'])) { foreach ($json['autoload']['psr-4'] as $namespace => $dirs) { foreach ($dirs as $dir) { $dir = trim($dir, '/'); if ($dir === $dirForNamespace) { return $this->tidy(rtrim($namespace, '\\')); } } } } } catch (\Exception $e) { throw new DoctrineStaticMetaException( 'Exception in ' . __METHOD__ . ': ' . $e->getMessage(), $e->getCode(), $e ); } throw new DoctrineStaticMetaException('Failed to find psr-4 namespace root'); }
[ "public", "function", "getProjectRootNamespaceFromComposerJson", "(", "string", "$", "dirForNamespace", "=", "'src'", ")", ":", "string", "{", "try", "{", "$", "dirForNamespace", "=", "trim", "(", "$", "dirForNamespace", ",", "'/'", ")", ";", "$", "jsonPath", "=", "Config", "::", "getProjectRootDirectory", "(", ")", ".", "'/composer.json'", ";", "$", "json", "=", "json_decode", "(", "\\", "ts", "\\", "file_get_contents", "(", "$", "jsonPath", ")", ",", "true", ")", ";", "if", "(", "JSON_ERROR_NONE", "!==", "json_last_error", "(", ")", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "'Error decoding json from path '", ".", "$", "jsonPath", ".", "' , '", ".", "json_last_error_msg", "(", ")", ")", ";", "}", "/**\n * @var string[][][][] $json\n */", "if", "(", "isset", "(", "$", "json", "[", "'autoload'", "]", "[", "'psr-4'", "]", ")", ")", "{", "foreach", "(", "$", "json", "[", "'autoload'", "]", "[", "'psr-4'", "]", "as", "$", "namespace", "=>", "$", "dirs", ")", "{", "foreach", "(", "$", "dirs", "as", "$", "dir", ")", "{", "$", "dir", "=", "trim", "(", "$", "dir", ",", "'/'", ")", ";", "if", "(", "$", "dir", "===", "$", "dirForNamespace", ")", "{", "return", "$", "this", "->", "tidy", "(", "rtrim", "(", "$", "namespace", ",", "'\\\\'", ")", ")", ";", "}", "}", "}", "}", "}", "catch", "(", "\\", "Exception", "$", "e", ")", "{", "throw", "new", "DoctrineStaticMetaException", "(", "'Exception in '", ".", "__METHOD__", ".", "': '", ".", "$", "e", "->", "getMessage", "(", ")", ",", "$", "e", "->", "getCode", "(", ")", ",", "$", "e", ")", ";", "}", "throw", "new", "DoctrineStaticMetaException", "(", "'Failed to find psr-4 namespace root'", ")", ";", "}" ]
Read src autoloader from composer json @param string $dirForNamespace @return string @throws DoctrineStaticMetaException @SuppressWarnings(PHPMD.StaticAccess)
[ "Read", "src", "autoloader", "from", "composer", "json" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/NamespaceHelper.php#L509-L542
31,428
edmondscommerce/doctrine-static-meta
src/CodeGeneration/NamespaceHelper.php
NamespaceHelper.getOwningRelationsRootFqn
public function getOwningRelationsRootFqn( string $projectRootNamespace, array $subDirectories ): string { $relationsRootFqn = $projectRootNamespace . AbstractGenerator::ENTITY_RELATIONS_NAMESPACE . '\\'; if (count($subDirectories) > 0) { $relationsRootFqn .= implode('\\', $subDirectories) . '\\'; } return $this->tidy($relationsRootFqn); }
php
public function getOwningRelationsRootFqn( string $projectRootNamespace, array $subDirectories ): string { $relationsRootFqn = $projectRootNamespace . AbstractGenerator::ENTITY_RELATIONS_NAMESPACE . '\\'; if (count($subDirectories) > 0) { $relationsRootFqn .= implode('\\', $subDirectories) . '\\'; } return $this->tidy($relationsRootFqn); }
[ "public", "function", "getOwningRelationsRootFqn", "(", "string", "$", "projectRootNamespace", ",", "array", "$", "subDirectories", ")", ":", "string", "{", "$", "relationsRootFqn", "=", "$", "projectRootNamespace", ".", "AbstractGenerator", "::", "ENTITY_RELATIONS_NAMESPACE", ".", "'\\\\'", ";", "if", "(", "count", "(", "$", "subDirectories", ")", ">", "0", ")", "{", "$", "relationsRootFqn", ".=", "implode", "(", "'\\\\'", ",", "$", "subDirectories", ")", ".", "'\\\\'", ";", "}", "return", "$", "this", "->", "tidy", "(", "$", "relationsRootFqn", ")", ";", "}" ]
Get the Namespace root for Entity Relations @param string $projectRootNamespace @param array $subDirectories @return string
[ "Get", "the", "Namespace", "root", "for", "Entity", "Relations" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/NamespaceHelper.php#L594-L605
31,429
edmondscommerce/doctrine-static-meta
src/CodeGeneration/NamespaceHelper.php
NamespaceHelper.getBaseHasTypeTraitFqn
public function getBaseHasTypeTraitFqn( string $ownedHasName, string $hasType ): string { $required = \ts\stringContains($hasType, RelationsGenerator::PREFIX_REQUIRED) ? RelationsGenerator::PREFIX_REQUIRED : ''; $hasType = \str_replace(RelationsGenerator::PREFIX_REQUIRED, '', $hasType); foreach ([ RelationsGenerator::INTERNAL_TYPE_MANY_TO_MANY, RelationsGenerator::INTERNAL_TYPE_ONE_TO_ONE, ] as $noStrip) { if (\ts\stringContains($hasType, $noStrip)) { return 'Has' . $required . $ownedHasName . $hasType; } } foreach ([ RelationsGenerator::INTERNAL_TYPE_ONE_TO_MANY, RelationsGenerator::INTERNAL_TYPE_MANY_TO_ONE, ] as $stripAll) { if (\ts\stringContains($hasType, $stripAll)) { return str_replace( [ RelationsGenerator::PREFIX_OWNING, RelationsGenerator::PREFIX_INVERSE, ], '', 'Has' . $required . $ownedHasName . $hasType ); } } return str_replace( [ RelationsGenerator::PREFIX_INVERSE, ], '', 'Has' . $required . $ownedHasName . $hasType ); }
php
public function getBaseHasTypeTraitFqn( string $ownedHasName, string $hasType ): string { $required = \ts\stringContains($hasType, RelationsGenerator::PREFIX_REQUIRED) ? RelationsGenerator::PREFIX_REQUIRED : ''; $hasType = \str_replace(RelationsGenerator::PREFIX_REQUIRED, '', $hasType); foreach ([ RelationsGenerator::INTERNAL_TYPE_MANY_TO_MANY, RelationsGenerator::INTERNAL_TYPE_ONE_TO_ONE, ] as $noStrip) { if (\ts\stringContains($hasType, $noStrip)) { return 'Has' . $required . $ownedHasName . $hasType; } } foreach ([ RelationsGenerator::INTERNAL_TYPE_ONE_TO_MANY, RelationsGenerator::INTERNAL_TYPE_MANY_TO_ONE, ] as $stripAll) { if (\ts\stringContains($hasType, $stripAll)) { return str_replace( [ RelationsGenerator::PREFIX_OWNING, RelationsGenerator::PREFIX_INVERSE, ], '', 'Has' . $required . $ownedHasName . $hasType ); } } return str_replace( [ RelationsGenerator::PREFIX_INVERSE, ], '', 'Has' . $required . $ownedHasName . $hasType ); }
[ "public", "function", "getBaseHasTypeTraitFqn", "(", "string", "$", "ownedHasName", ",", "string", "$", "hasType", ")", ":", "string", "{", "$", "required", "=", "\\", "ts", "\\", "stringContains", "(", "$", "hasType", ",", "RelationsGenerator", "::", "PREFIX_REQUIRED", ")", "?", "RelationsGenerator", "::", "PREFIX_REQUIRED", ":", "''", ";", "$", "hasType", "=", "\\", "str_replace", "(", "RelationsGenerator", "::", "PREFIX_REQUIRED", ",", "''", ",", "$", "hasType", ")", ";", "foreach", "(", "[", "RelationsGenerator", "::", "INTERNAL_TYPE_MANY_TO_MANY", ",", "RelationsGenerator", "::", "INTERNAL_TYPE_ONE_TO_ONE", ",", "]", "as", "$", "noStrip", ")", "{", "if", "(", "\\", "ts", "\\", "stringContains", "(", "$", "hasType", ",", "$", "noStrip", ")", ")", "{", "return", "'Has'", ".", "$", "required", ".", "$", "ownedHasName", ".", "$", "hasType", ";", "}", "}", "foreach", "(", "[", "RelationsGenerator", "::", "INTERNAL_TYPE_ONE_TO_MANY", ",", "RelationsGenerator", "::", "INTERNAL_TYPE_MANY_TO_ONE", ",", "]", "as", "$", "stripAll", ")", "{", "if", "(", "\\", "ts", "\\", "stringContains", "(", "$", "hasType", ",", "$", "stripAll", ")", ")", "{", "return", "str_replace", "(", "[", "RelationsGenerator", "::", "PREFIX_OWNING", ",", "RelationsGenerator", "::", "PREFIX_INVERSE", ",", "]", ",", "''", ",", "'Has'", ".", "$", "required", ".", "$", "ownedHasName", ".", "$", "hasType", ")", ";", "}", "}", "return", "str_replace", "(", "[", "RelationsGenerator", "::", "PREFIX_INVERSE", ",", "]", ",", "''", ",", "'Has'", ".", "$", "required", ".", "$", "ownedHasName", ".", "$", "hasType", ")", ";", "}" ]
Normalise a has type, removing prefixes that are not required Inverse hasTypes use the standard template without the prefix The exclusion ot this are the ManyToMany and OneToOne relations @param string $ownedHasName @param string $hasType @return string
[ "Normalise", "a", "has", "type", "removing", "prefixes", "that", "are", "not", "required" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/NamespaceHelper.php#L618-L659
31,430
edmondscommerce/doctrine-static-meta
src/CodeGeneration/NamespaceHelper.php
NamespaceHelper.getOwningInterfaceFqn
public function getOwningInterfaceFqn( string $hasType, string $ownedEntityFqn, string $projectRootNamespace = null, string $srcFolder = AbstractCommand::DEFAULT_SRC_SUBFOLDER ): string { try { $ownedHasName = $this->getOwnedHasName($hasType, $ownedEntityFqn, $srcFolder, $projectRootNamespace); if (null === $projectRootNamespace) { $projectRootNamespace = $this->getProjectRootNamespaceFromComposerJson($srcFolder); } list($ownedClassName, , $ownedSubDirectories) = $this->parseFullyQualifiedName( $ownedEntityFqn, $srcFolder, $projectRootNamespace ); $interfaceSubDirectories = \array_slice($ownedSubDirectories, 2); $owningInterfaceFqn = $this->getOwningRelationsRootFqn( $projectRootNamespace, $interfaceSubDirectories ); $required = \ts\stringContains($hasType, RelationsGenerator::PREFIX_REQUIRED) ? 'Required' : ''; $owningInterfaceFqn .= '\\' . $ownedClassName . '\\Interfaces\\Has' . $required . $ownedHasName . 'Interface'; return $this->tidy($owningInterfaceFqn); } catch (\Exception $e) { throw new DoctrineStaticMetaException( 'Exception in ' . __METHOD__ . ': ' . $e->getMessage(), $e->getCode(), $e ); } }
php
public function getOwningInterfaceFqn( string $hasType, string $ownedEntityFqn, string $projectRootNamespace = null, string $srcFolder = AbstractCommand::DEFAULT_SRC_SUBFOLDER ): string { try { $ownedHasName = $this->getOwnedHasName($hasType, $ownedEntityFqn, $srcFolder, $projectRootNamespace); if (null === $projectRootNamespace) { $projectRootNamespace = $this->getProjectRootNamespaceFromComposerJson($srcFolder); } list($ownedClassName, , $ownedSubDirectories) = $this->parseFullyQualifiedName( $ownedEntityFqn, $srcFolder, $projectRootNamespace ); $interfaceSubDirectories = \array_slice($ownedSubDirectories, 2); $owningInterfaceFqn = $this->getOwningRelationsRootFqn( $projectRootNamespace, $interfaceSubDirectories ); $required = \ts\stringContains($hasType, RelationsGenerator::PREFIX_REQUIRED) ? 'Required' : ''; $owningInterfaceFqn .= '\\' . $ownedClassName . '\\Interfaces\\Has' . $required . $ownedHasName . 'Interface'; return $this->tidy($owningInterfaceFqn); } catch (\Exception $e) { throw new DoctrineStaticMetaException( 'Exception in ' . __METHOD__ . ': ' . $e->getMessage(), $e->getCode(), $e ); } }
[ "public", "function", "getOwningInterfaceFqn", "(", "string", "$", "hasType", ",", "string", "$", "ownedEntityFqn", ",", "string", "$", "projectRootNamespace", "=", "null", ",", "string", "$", "srcFolder", "=", "AbstractCommand", "::", "DEFAULT_SRC_SUBFOLDER", ")", ":", "string", "{", "try", "{", "$", "ownedHasName", "=", "$", "this", "->", "getOwnedHasName", "(", "$", "hasType", ",", "$", "ownedEntityFqn", ",", "$", "srcFolder", ",", "$", "projectRootNamespace", ")", ";", "if", "(", "null", "===", "$", "projectRootNamespace", ")", "{", "$", "projectRootNamespace", "=", "$", "this", "->", "getProjectRootNamespaceFromComposerJson", "(", "$", "srcFolder", ")", ";", "}", "list", "(", "$", "ownedClassName", ",", ",", "$", "ownedSubDirectories", ")", "=", "$", "this", "->", "parseFullyQualifiedName", "(", "$", "ownedEntityFqn", ",", "$", "srcFolder", ",", "$", "projectRootNamespace", ")", ";", "$", "interfaceSubDirectories", "=", "\\", "array_slice", "(", "$", "ownedSubDirectories", ",", "2", ")", ";", "$", "owningInterfaceFqn", "=", "$", "this", "->", "getOwningRelationsRootFqn", "(", "$", "projectRootNamespace", ",", "$", "interfaceSubDirectories", ")", ";", "$", "required", "=", "\\", "ts", "\\", "stringContains", "(", "$", "hasType", ",", "RelationsGenerator", "::", "PREFIX_REQUIRED", ")", "?", "'Required'", ":", "''", ";", "$", "owningInterfaceFqn", ".=", "'\\\\'", ".", "$", "ownedClassName", ".", "'\\\\Interfaces\\\\Has'", ".", "$", "required", ".", "$", "ownedHasName", ".", "'Interface'", ";", "return", "$", "this", "->", "tidy", "(", "$", "owningInterfaceFqn", ")", ";", "}", "catch", "(", "\\", "Exception", "$", "e", ")", "{", "throw", "new", "DoctrineStaticMetaException", "(", "'Exception in '", ".", "__METHOD__", ".", "': '", ".", "$", "e", "->", "getMessage", "(", ")", ",", "$", "e", "->", "getCode", "(", ")", ",", "$", "e", ")", ";", "}", "}" ]
Get the Fully Qualified Namespace for the Relation Interface for a specific Entity and hasType @param string $hasType @param string $ownedEntityFqn @param string|null $projectRootNamespace @param string $srcFolder @return string @throws DoctrineStaticMetaException
[ "Get", "the", "Fully", "Qualified", "Namespace", "for", "the", "Relation", "Interface", "for", "a", "specific", "Entity", "and", "hasType" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/NamespaceHelper.php#L729-L768
31,431
chameleon-system/chameleon-shop
src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php
MTPkgShopArticleReviewCore.SetDefaultFieldVars
protected function SetDefaultFieldVars() { if ($this->global->UserDataExists(TdbShopArticleReview::INPUT_BASE_NAME)) { $aPostUserData = $this->global->GetuserData(TdbShopArticleReview::INPUT_BASE_NAME); } $aDefaultFieldDataList = array('comment' => '', 'author_email' => '', 'author_name' => '', 'title' => '', 'send_comment_notification' => '0', 'rating' => 1); if (isset($aPostUserData) && is_array($aPostUserData)) { foreach ($aDefaultFieldDataList as $sDefaultFieldDataKey => $aDefaultFieldDataValue) { if (!array_key_exists($sDefaultFieldDataKey, $aPostUserData)) { $aPostUserData[$sDefaultFieldDataKey] = $aDefaultFieldDataValue; } } $aDefaultFieldDataList = $aPostUserData; } return $aDefaultFieldDataList; }
php
protected function SetDefaultFieldVars() { if ($this->global->UserDataExists(TdbShopArticleReview::INPUT_BASE_NAME)) { $aPostUserData = $this->global->GetuserData(TdbShopArticleReview::INPUT_BASE_NAME); } $aDefaultFieldDataList = array('comment' => '', 'author_email' => '', 'author_name' => '', 'title' => '', 'send_comment_notification' => '0', 'rating' => 1); if (isset($aPostUserData) && is_array($aPostUserData)) { foreach ($aDefaultFieldDataList as $sDefaultFieldDataKey => $aDefaultFieldDataValue) { if (!array_key_exists($sDefaultFieldDataKey, $aPostUserData)) { $aPostUserData[$sDefaultFieldDataKey] = $aDefaultFieldDataValue; } } $aDefaultFieldDataList = $aPostUserData; } return $aDefaultFieldDataList; }
[ "protected", "function", "SetDefaultFieldVars", "(", ")", "{", "if", "(", "$", "this", "->", "global", "->", "UserDataExists", "(", "TdbShopArticleReview", "::", "INPUT_BASE_NAME", ")", ")", "{", "$", "aPostUserData", "=", "$", "this", "->", "global", "->", "GetuserData", "(", "TdbShopArticleReview", "::", "INPUT_BASE_NAME", ")", ";", "}", "$", "aDefaultFieldDataList", "=", "array", "(", "'comment'", "=>", "''", ",", "'author_email'", "=>", "''", ",", "'author_name'", "=>", "''", ",", "'title'", "=>", "''", ",", "'send_comment_notification'", "=>", "'0'", ",", "'rating'", "=>", "1", ")", ";", "if", "(", "isset", "(", "$", "aPostUserData", ")", "&&", "is_array", "(", "$", "aPostUserData", ")", ")", "{", "foreach", "(", "$", "aDefaultFieldDataList", "as", "$", "sDefaultFieldDataKey", "=>", "$", "aDefaultFieldDataValue", ")", "{", "if", "(", "!", "array_key_exists", "(", "$", "sDefaultFieldDataKey", ",", "$", "aPostUserData", ")", ")", "{", "$", "aPostUserData", "[", "$", "sDefaultFieldDataKey", "]", "=", "$", "aDefaultFieldDataValue", ";", "}", "}", "$", "aDefaultFieldDataList", "=", "$", "aPostUserData", ";", "}", "return", "$", "aDefaultFieldDataList", ";", "}" ]
Set default form parameter with init value or post values. @return array
[ "Set", "default", "form", "parameter", "with", "init", "value", "or", "post", "values", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php#L47-L63
31,432
chameleon-system/chameleon-shop
src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php
MTPkgShopArticleReviewCore.AllowToCommentReview
protected function AllowToCommentReview() { if ($this->GetCommentTypeId()) { $oModuleConfiguration = $this->GetModuleConfiguration(); if ($oModuleConfiguration->fieldAllowCommentReviews) { return true; } } return false; }
php
protected function AllowToCommentReview() { if ($this->GetCommentTypeId()) { $oModuleConfiguration = $this->GetModuleConfiguration(); if ($oModuleConfiguration->fieldAllowCommentReviews) { return true; } } return false; }
[ "protected", "function", "AllowToCommentReview", "(", ")", "{", "if", "(", "$", "this", "->", "GetCommentTypeId", "(", ")", ")", "{", "$", "oModuleConfiguration", "=", "$", "this", "->", "GetModuleConfiguration", "(", ")", ";", "if", "(", "$", "oModuleConfiguration", "->", "fieldAllowCommentReviews", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Checks if its allowed to write a comment to a review. Returns always false if package pkgcomment was not installed. @return bool
[ "Checks", "if", "its", "allowed", "to", "write", "a", "comment", "to", "a", "review", ".", "Returns", "always", "false", "if", "package", "pkgcomment", "was", "not", "installed", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php#L118-L128
31,433
chameleon-system/chameleon-shop
src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php
MTPkgShopArticleReviewCore.GetCommentTypeId
protected function GetCommentTypeId() { if (false === $this->sPkgCommentTypeId) { $sQuery = "SELECT * FROM `pkg_comment_type` WHERE `pkg_comment_type`.`class_name` = 'TPkgCommentTypePkgShopArticleReview'"; $oRes = MySqlLegacySupport::getInstance()->query($sQuery); if (MySqlLegacySupport::getInstance()->num_rows($oRes) > 0) { $aRow = MySqlLegacySupport::getInstance()->fetch_assoc($oRes); $this->sPkgCommentTypeId = $aRow['id']; } else { $this->sPkgCommentTypeId = ''; } } return $this->sPkgCommentTypeId; }
php
protected function GetCommentTypeId() { if (false === $this->sPkgCommentTypeId) { $sQuery = "SELECT * FROM `pkg_comment_type` WHERE `pkg_comment_type`.`class_name` = 'TPkgCommentTypePkgShopArticleReview'"; $oRes = MySqlLegacySupport::getInstance()->query($sQuery); if (MySqlLegacySupport::getInstance()->num_rows($oRes) > 0) { $aRow = MySqlLegacySupport::getInstance()->fetch_assoc($oRes); $this->sPkgCommentTypeId = $aRow['id']; } else { $this->sPkgCommentTypeId = ''; } } return $this->sPkgCommentTypeId; }
[ "protected", "function", "GetCommentTypeId", "(", ")", "{", "if", "(", "false", "===", "$", "this", "->", "sPkgCommentTypeId", ")", "{", "$", "sQuery", "=", "\"SELECT * FROM `pkg_comment_type` WHERE `pkg_comment_type`.`class_name` = 'TPkgCommentTypePkgShopArticleReview'\"", ";", "$", "oRes", "=", "MySqlLegacySupport", "::", "getInstance", "(", ")", "->", "query", "(", "$", "sQuery", ")", ";", "if", "(", "MySqlLegacySupport", "::", "getInstance", "(", ")", "->", "num_rows", "(", "$", "oRes", ")", ">", "0", ")", "{", "$", "aRow", "=", "MySqlLegacySupport", "::", "getInstance", "(", ")", "->", "fetch_assoc", "(", "$", "oRes", ")", ";", "$", "this", "->", "sPkgCommentTypeId", "=", "$", "aRow", "[", "'id'", "]", ";", "}", "else", "{", "$", "this", "->", "sPkgCommentTypeId", "=", "''", ";", "}", "}", "return", "$", "this", "->", "sPkgCommentTypeId", ";", "}" ]
Get the comment type for article reviews. @return TdbPkgCommentType
[ "Get", "the", "comment", "type", "for", "article", "reviews", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php#L135-L149
31,434
chameleon-system/chameleon-shop
src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php
MTPkgShopArticleReviewCore.AllowReadReview
protected function AllowReadReview() { $bAllowReadReview = false; $oModuleConfiguration = $this->GetModuleConfiguration(); $oUser = TdbDataExtranetUser::GetInstance(); if ($oModuleConfiguration->fieldAllowShowReviewLoggedinUsersOnly && $oUser->IsLoggedIn() || !$oModuleConfiguration->fieldAllowShowReviewLoggedinUsersOnly) { $bAllowReadReview = true; } return $bAllowReadReview; }
php
protected function AllowReadReview() { $bAllowReadReview = false; $oModuleConfiguration = $this->GetModuleConfiguration(); $oUser = TdbDataExtranetUser::GetInstance(); if ($oModuleConfiguration->fieldAllowShowReviewLoggedinUsersOnly && $oUser->IsLoggedIn() || !$oModuleConfiguration->fieldAllowShowReviewLoggedinUsersOnly) { $bAllowReadReview = true; } return $bAllowReadReview; }
[ "protected", "function", "AllowReadReview", "(", ")", "{", "$", "bAllowReadReview", "=", "false", ";", "$", "oModuleConfiguration", "=", "$", "this", "->", "GetModuleConfiguration", "(", ")", ";", "$", "oUser", "=", "TdbDataExtranetUser", "::", "GetInstance", "(", ")", ";", "if", "(", "$", "oModuleConfiguration", "->", "fieldAllowShowReviewLoggedinUsersOnly", "&&", "$", "oUser", "->", "IsLoggedIn", "(", ")", "||", "!", "$", "oModuleConfiguration", "->", "fieldAllowShowReviewLoggedinUsersOnly", ")", "{", "$", "bAllowReadReview", "=", "true", ";", "}", "return", "$", "bAllowReadReview", ";", "}" ]
Checks if its allowed to red reviews. @return bool
[ "Checks", "if", "its", "allowed", "to", "red", "reviews", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php#L156-L166
31,435
chameleon-system/chameleon-shop
src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php
MTPkgShopArticleReviewCore.AllowWriteReview
protected function AllowWriteReview() { $bAllowWriteReview = false; $oModuleConfiguration = $this->GetModuleConfiguration(); $oUser = TdbDataExtranetUser::GetInstance(); if ($oModuleConfiguration->fieldAllowWriteReviewLoggedinUsersOnly && $oUser->IsLoggedIn() || !$oModuleConfiguration->fieldAllowWriteReviewLoggedinUsersOnly) { $bAllowWriteReview = true; } return $bAllowWriteReview; }
php
protected function AllowWriteReview() { $bAllowWriteReview = false; $oModuleConfiguration = $this->GetModuleConfiguration(); $oUser = TdbDataExtranetUser::GetInstance(); if ($oModuleConfiguration->fieldAllowWriteReviewLoggedinUsersOnly && $oUser->IsLoggedIn() || !$oModuleConfiguration->fieldAllowWriteReviewLoggedinUsersOnly) { $bAllowWriteReview = true; } return $bAllowWriteReview; }
[ "protected", "function", "AllowWriteReview", "(", ")", "{", "$", "bAllowWriteReview", "=", "false", ";", "$", "oModuleConfiguration", "=", "$", "this", "->", "GetModuleConfiguration", "(", ")", ";", "$", "oUser", "=", "TdbDataExtranetUser", "::", "GetInstance", "(", ")", ";", "if", "(", "$", "oModuleConfiguration", "->", "fieldAllowWriteReviewLoggedinUsersOnly", "&&", "$", "oUser", "->", "IsLoggedIn", "(", ")", "||", "!", "$", "oModuleConfiguration", "->", "fieldAllowWriteReviewLoggedinUsersOnly", ")", "{", "$", "bAllowWriteReview", "=", "true", ";", "}", "return", "$", "bAllowWriteReview", ";", "}" ]
Checks if its allowed to write reviews. @return bool
[ "Checks", "if", "its", "allowed", "to", "write", "reviews", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php#L173-L183
31,436
chameleon-system/chameleon-shop
src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php
MTPkgShopArticleReviewCore.AllowRateReviews
protected function AllowRateReviews() { $bAllowRateReviews = $this->AllowReadReview(); if ($bAllowRateReviews) { $oModuleConfiguration = $this->GetModuleConfiguration(); if (!$oModuleConfiguration->fieldAllowRateReview) { $bAllowRateReviews = false; } } return $bAllowRateReviews; }
php
protected function AllowRateReviews() { $bAllowRateReviews = $this->AllowReadReview(); if ($bAllowRateReviews) { $oModuleConfiguration = $this->GetModuleConfiguration(); if (!$oModuleConfiguration->fieldAllowRateReview) { $bAllowRateReviews = false; } } return $bAllowRateReviews; }
[ "protected", "function", "AllowRateReviews", "(", ")", "{", "$", "bAllowRateReviews", "=", "$", "this", "->", "AllowReadReview", "(", ")", ";", "if", "(", "$", "bAllowRateReviews", ")", "{", "$", "oModuleConfiguration", "=", "$", "this", "->", "GetModuleConfiguration", "(", ")", ";", "if", "(", "!", "$", "oModuleConfiguration", "->", "fieldAllowRateReview", ")", "{", "$", "bAllowRateReviews", "=", "false", ";", "}", "}", "return", "$", "bAllowRateReviews", ";", "}" ]
Checks if its allowed to rate reviews. @return bool
[ "Checks", "if", "its", "allowed", "to", "rate", "reviews", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php#L190-L201
31,437
chameleon-system/chameleon-shop
src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php
MTPkgShopArticleReviewCore.AllowReportReviews
protected function AllowReportReviews() { $bAllowRateReviews = $this->AllowReadReview(); if ($bAllowRateReviews) { $oModuleConfiguration = $this->GetModuleConfiguration(); if (!$oModuleConfiguration->fieldAllowReportReviews) { $bAllowRateReviews = false; } } return $bAllowRateReviews; }
php
protected function AllowReportReviews() { $bAllowRateReviews = $this->AllowReadReview(); if ($bAllowRateReviews) { $oModuleConfiguration = $this->GetModuleConfiguration(); if (!$oModuleConfiguration->fieldAllowReportReviews) { $bAllowRateReviews = false; } } return $bAllowRateReviews; }
[ "protected", "function", "AllowReportReviews", "(", ")", "{", "$", "bAllowRateReviews", "=", "$", "this", "->", "AllowReadReview", "(", ")", ";", "if", "(", "$", "bAllowRateReviews", ")", "{", "$", "oModuleConfiguration", "=", "$", "this", "->", "GetModuleConfiguration", "(", ")", ";", "if", "(", "!", "$", "oModuleConfiguration", "->", "fieldAllowReportReviews", ")", "{", "$", "bAllowRateReviews", "=", "false", ";", "}", "}", "return", "$", "bAllowRateReviews", ";", "}" ]
Checks if its allowed to report reviews. @return bool
[ "Checks", "if", "its", "allowed", "to", "report", "reviews", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php#L208-L219
31,438
chameleon-system/chameleon-shop
src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php
MTPkgShopArticleReviewCore.NeedCaptcha
protected function NeedCaptcha() { $bNeedCaptcha = false; $oUser = TdbDataExtranetUser::GetInstance(); $oModuleConfiguration = $this->GetModuleConfiguration(); if (!$oModuleConfiguration->fieldAllowWriteReviewLoggedinUsersOnly && !$oUser->IsLoggedIn()) { $bNeedCaptcha = true; } return $bNeedCaptcha; }
php
protected function NeedCaptcha() { $bNeedCaptcha = false; $oUser = TdbDataExtranetUser::GetInstance(); $oModuleConfiguration = $this->GetModuleConfiguration(); if (!$oModuleConfiguration->fieldAllowWriteReviewLoggedinUsersOnly && !$oUser->IsLoggedIn()) { $bNeedCaptcha = true; } return $bNeedCaptcha; }
[ "protected", "function", "NeedCaptcha", "(", ")", "{", "$", "bNeedCaptcha", "=", "false", ";", "$", "oUser", "=", "TdbDataExtranetUser", "::", "GetInstance", "(", ")", ";", "$", "oModuleConfiguration", "=", "$", "this", "->", "GetModuleConfiguration", "(", ")", ";", "if", "(", "!", "$", "oModuleConfiguration", "->", "fieldAllowWriteReviewLoggedinUsersOnly", "&&", "!", "$", "oUser", "->", "IsLoggedIn", "(", ")", ")", "{", "$", "bNeedCaptcha", "=", "true", ";", "}", "return", "$", "bNeedCaptcha", ";", "}" ]
Check if captcha field is needed to show in forms. @return bool
[ "Check", "if", "captcha", "field", "is", "needed", "to", "show", "in", "forms", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php#L226-L236
31,439
chameleon-system/chameleon-shop
src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php
MTPkgShopArticleReviewCore.GetModuleConfiguration
protected function GetModuleConfiguration() { if (is_null($this->oModuleConfiguration)) { $oModuleConfiguration = TdbPkgShopArticleReviewModuleShopArticleReviewConfiguration::GetNewInstance(); if ($oModuleConfiguration->LoadFromField('cms_tpl_module_instance_id', $this->instanceID)) { } $this->oModuleConfiguration = $oModuleConfiguration; } return $this->oModuleConfiguration; }
php
protected function GetModuleConfiguration() { if (is_null($this->oModuleConfiguration)) { $oModuleConfiguration = TdbPkgShopArticleReviewModuleShopArticleReviewConfiguration::GetNewInstance(); if ($oModuleConfiguration->LoadFromField('cms_tpl_module_instance_id', $this->instanceID)) { } $this->oModuleConfiguration = $oModuleConfiguration; } return $this->oModuleConfiguration; }
[ "protected", "function", "GetModuleConfiguration", "(", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "oModuleConfiguration", ")", ")", "{", "$", "oModuleConfiguration", "=", "TdbPkgShopArticleReviewModuleShopArticleReviewConfiguration", "::", "GetNewInstance", "(", ")", ";", "if", "(", "$", "oModuleConfiguration", "->", "LoadFromField", "(", "'cms_tpl_module_instance_id'", ",", "$", "this", "->", "instanceID", ")", ")", "{", "}", "$", "this", "->", "oModuleConfiguration", "=", "$", "oModuleConfiguration", ";", "}", "return", "$", "this", "->", "oModuleConfiguration", ";", "}" ]
Get the module config for the module instance. @return TdbPkgShopArticleReviewModuleShopArticleReviewConfiguration
[ "Get", "the", "module", "config", "for", "the", "module", "instance", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php#L243-L253
31,440
chameleon-system/chameleon-shop
src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php
MTPkgShopArticleReviewCore.RedirectToItemPage
protected function RedirectToItemPage($oReviewItem = null, $aAddParameter = array(), $bGoToWriteReviewFrom = false) { $oActivePage = $this->getActivePageService()->getActivePage(); $sRedirectURL = $oActivePage->GetRealURLPlain($aAddParameter); if (null !== $oReviewItem) { $sRedirectURL .= '#'.TdbShopArticleReview::URL_PARAM_REVIEW_ITEM_JUMPER.$oReviewItem->sqlData['id']; } else { if ($bGoToWriteReviewFrom) { $sRedirectURL .= '#'.self::URL_PARAM_REVIEW_WRITE_JUMPER; } else { $sRedirectURL .= '#'.self::URL_PARAM_REVIEW_JUMPER; } } $this->getRedirect()->redirect($sRedirectURL); }
php
protected function RedirectToItemPage($oReviewItem = null, $aAddParameter = array(), $bGoToWriteReviewFrom = false) { $oActivePage = $this->getActivePageService()->getActivePage(); $sRedirectURL = $oActivePage->GetRealURLPlain($aAddParameter); if (null !== $oReviewItem) { $sRedirectURL .= '#'.TdbShopArticleReview::URL_PARAM_REVIEW_ITEM_JUMPER.$oReviewItem->sqlData['id']; } else { if ($bGoToWriteReviewFrom) { $sRedirectURL .= '#'.self::URL_PARAM_REVIEW_WRITE_JUMPER; } else { $sRedirectURL .= '#'.self::URL_PARAM_REVIEW_JUMPER; } } $this->getRedirect()->redirect($sRedirectURL); }
[ "protected", "function", "RedirectToItemPage", "(", "$", "oReviewItem", "=", "null", ",", "$", "aAddParameter", "=", "array", "(", ")", ",", "$", "bGoToWriteReviewFrom", "=", "false", ")", "{", "$", "oActivePage", "=", "$", "this", "->", "getActivePageService", "(", ")", "->", "getActivePage", "(", ")", ";", "$", "sRedirectURL", "=", "$", "oActivePage", "->", "GetRealURLPlain", "(", "$", "aAddParameter", ")", ";", "if", "(", "null", "!==", "$", "oReviewItem", ")", "{", "$", "sRedirectURL", ".=", "'#'", ".", "TdbShopArticleReview", "::", "URL_PARAM_REVIEW_ITEM_JUMPER", ".", "$", "oReviewItem", "->", "sqlData", "[", "'id'", "]", ";", "}", "else", "{", "if", "(", "$", "bGoToWriteReviewFrom", ")", "{", "$", "sRedirectURL", ".=", "'#'", ".", "self", "::", "URL_PARAM_REVIEW_WRITE_JUMPER", ";", "}", "else", "{", "$", "sRedirectURL", ".=", "'#'", ".", "self", "::", "URL_PARAM_REVIEW_JUMPER", ";", "}", "}", "$", "this", "->", "getRedirect", "(", ")", "->", "redirect", "(", "$", "sRedirectURL", ")", ";", "}" ]
Redirect to review item page and set anchor to start of the review module. @param array $aAddParameter
[ "Redirect", "to", "review", "item", "page", "and", "set", "anchor", "to", "start", "of", "the", "review", "module", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php#L350-L365
31,441
chameleon-system/chameleon-shop
src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php
MTPkgShopArticleReviewCore.GetReviewsForUser
protected function GetReviewsForUser() { $oUserReviews = null; $oUser = TdbDataExtranetUser::GetInstance(); if ($oUser->IsLoggedIn()) { $oUserReviews = $oUser->GetFieldShopArticleReviewList(); } return $oUserReviews; }
php
protected function GetReviewsForUser() { $oUserReviews = null; $oUser = TdbDataExtranetUser::GetInstance(); if ($oUser->IsLoggedIn()) { $oUserReviews = $oUser->GetFieldShopArticleReviewList(); } return $oUserReviews; }
[ "protected", "function", "GetReviewsForUser", "(", ")", "{", "$", "oUserReviews", "=", "null", ";", "$", "oUser", "=", "TdbDataExtranetUser", "::", "GetInstance", "(", ")", ";", "if", "(", "$", "oUser", "->", "IsLoggedIn", "(", ")", ")", "{", "$", "oUserReviews", "=", "$", "oUser", "->", "GetFieldShopArticleReviewList", "(", ")", ";", "}", "return", "$", "oUserReviews", ";", "}" ]
get the reviews from logged in user.
[ "get", "the", "reviews", "from", "logged", "in", "user", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php#L389-L398
31,442
chameleon-system/chameleon-shop
src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php
MTPkgShopArticleReviewCore.GetReviewsForArticle
protected function GetReviewsForArticle($oActiveArticle) { $oModuleConfiguration = $this->GetModuleConfiguration(); if ($oActiveArticle->IsVariant()) { $oActiveArticle = $oActiveArticle->GetFieldVariantParent(); } $oActiveCategory = TdbShop::GetActiveCategory(); $this->data['oActiveCategory'] = $oActiveCategory; $this->data['oActiveArticle'] = $oActiveArticle; if ($oModuleConfiguration->fieldAllowRateReview) { $oReviewList = TdbShopArticleReviewList::GetReviewsForArticleSortedByRate($oActiveArticle->id); } else { $oReviewList = TdbShopArticleReviewList::GetListForShopArticleId($oActiveArticle->id); } $oReviewList->AddFilterString("`shop_article_review`.`publish`='1'"); return $oReviewList; }
php
protected function GetReviewsForArticle($oActiveArticle) { $oModuleConfiguration = $this->GetModuleConfiguration(); if ($oActiveArticle->IsVariant()) { $oActiveArticle = $oActiveArticle->GetFieldVariantParent(); } $oActiveCategory = TdbShop::GetActiveCategory(); $this->data['oActiveCategory'] = $oActiveCategory; $this->data['oActiveArticle'] = $oActiveArticle; if ($oModuleConfiguration->fieldAllowRateReview) { $oReviewList = TdbShopArticleReviewList::GetReviewsForArticleSortedByRate($oActiveArticle->id); } else { $oReviewList = TdbShopArticleReviewList::GetListForShopArticleId($oActiveArticle->id); } $oReviewList->AddFilterString("`shop_article_review`.`publish`='1'"); return $oReviewList; }
[ "protected", "function", "GetReviewsForArticle", "(", "$", "oActiveArticle", ")", "{", "$", "oModuleConfiguration", "=", "$", "this", "->", "GetModuleConfiguration", "(", ")", ";", "if", "(", "$", "oActiveArticle", "->", "IsVariant", "(", ")", ")", "{", "$", "oActiveArticle", "=", "$", "oActiveArticle", "->", "GetFieldVariantParent", "(", ")", ";", "}", "$", "oActiveCategory", "=", "TdbShop", "::", "GetActiveCategory", "(", ")", ";", "$", "this", "->", "data", "[", "'oActiveCategory'", "]", "=", "$", "oActiveCategory", ";", "$", "this", "->", "data", "[", "'oActiveArticle'", "]", "=", "$", "oActiveArticle", ";", "if", "(", "$", "oModuleConfiguration", "->", "fieldAllowRateReview", ")", "{", "$", "oReviewList", "=", "TdbShopArticleReviewList", "::", "GetReviewsForArticleSortedByRate", "(", "$", "oActiveArticle", "->", "id", ")", ";", "}", "else", "{", "$", "oReviewList", "=", "TdbShopArticleReviewList", "::", "GetListForShopArticleId", "(", "$", "oActiveArticle", "->", "id", ")", ";", "}", "$", "oReviewList", "->", "AddFilterString", "(", "\"`shop_article_review`.`publish`='1'\"", ")", ";", "return", "$", "oReviewList", ";", "}" ]
Get the reviews for given shop article. @param TdbShopArticle $oActiveArticle @return TdbShopArticleReviewList
[ "Get", "the", "reviews", "for", "given", "shop", "article", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php#L407-L425
31,443
chameleon-system/chameleon-shop
src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php
MTPkgShopArticleReviewCore.UnlockReview
protected function UnlockReview() { $oGlobal = TGlobal::instance(); $oMsgManager = TCMSMessageManager::GetInstance(); if ($oGlobal->UserDataExists(TdbShopArticleReview::URL_PARAM_ACTION_ID)) { $oReviewItem = TdbShopArticleReview::GetNewInstance(); if ($oReviewItem->LoadFromField('action_id', $oGlobal->GetUserData(TdbShopArticleReview::URL_PARAM_ACTION_ID))) { if (0 == $oReviewItem->sqlData['publish']) { $oReviewItem->AllowEditByAll(true); $oReviewItem->sqlData['publish'] = true; $oReviewItem->sqlData['action_id'] = ''; $oReviewItem->Save(); $oArticle = TdbShop::GetActiveItem(); if ($oArticle->IsVariant()) { $oArticle = $oArticle->GetFieldVariantParent(); } $oArticle->UpdateStatsReviews(); $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-UNLOCK-SUCCESS'); } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-REVIEW-NOT-BLOCKED'); } } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-REVIEW-NOT-FOUND'); } } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-MISSING-PARAMETER'); } $this->RedirectToItemPage(); }
php
protected function UnlockReview() { $oGlobal = TGlobal::instance(); $oMsgManager = TCMSMessageManager::GetInstance(); if ($oGlobal->UserDataExists(TdbShopArticleReview::URL_PARAM_ACTION_ID)) { $oReviewItem = TdbShopArticleReview::GetNewInstance(); if ($oReviewItem->LoadFromField('action_id', $oGlobal->GetUserData(TdbShopArticleReview::URL_PARAM_ACTION_ID))) { if (0 == $oReviewItem->sqlData['publish']) { $oReviewItem->AllowEditByAll(true); $oReviewItem->sqlData['publish'] = true; $oReviewItem->sqlData['action_id'] = ''; $oReviewItem->Save(); $oArticle = TdbShop::GetActiveItem(); if ($oArticle->IsVariant()) { $oArticle = $oArticle->GetFieldVariantParent(); } $oArticle->UpdateStatsReviews(); $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-UNLOCK-SUCCESS'); } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-REVIEW-NOT-BLOCKED'); } } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-REVIEW-NOT-FOUND'); } } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-MISSING-PARAMETER'); } $this->RedirectToItemPage(); }
[ "protected", "function", "UnlockReview", "(", ")", "{", "$", "oGlobal", "=", "TGlobal", "::", "instance", "(", ")", ";", "$", "oMsgManager", "=", "TCMSMessageManager", "::", "GetInstance", "(", ")", ";", "if", "(", "$", "oGlobal", "->", "UserDataExists", "(", "TdbShopArticleReview", "::", "URL_PARAM_ACTION_ID", ")", ")", "{", "$", "oReviewItem", "=", "TdbShopArticleReview", "::", "GetNewInstance", "(", ")", ";", "if", "(", "$", "oReviewItem", "->", "LoadFromField", "(", "'action_id'", ",", "$", "oGlobal", "->", "GetUserData", "(", "TdbShopArticleReview", "::", "URL_PARAM_ACTION_ID", ")", ")", ")", "{", "if", "(", "0", "==", "$", "oReviewItem", "->", "sqlData", "[", "'publish'", "]", ")", "{", "$", "oReviewItem", "->", "AllowEditByAll", "(", "true", ")", ";", "$", "oReviewItem", "->", "sqlData", "[", "'publish'", "]", "=", "true", ";", "$", "oReviewItem", "->", "sqlData", "[", "'action_id'", "]", "=", "''", ";", "$", "oReviewItem", "->", "Save", "(", ")", ";", "$", "oArticle", "=", "TdbShop", "::", "GetActiveItem", "(", ")", ";", "if", "(", "$", "oArticle", "->", "IsVariant", "(", ")", ")", "{", "$", "oArticle", "=", "$", "oArticle", "->", "GetFieldVariantParent", "(", ")", ";", "}", "$", "oArticle", "->", "UpdateStatsReviews", "(", ")", ";", "$", "oMsgManager", "->", "AddMessage", "(", "self", "::", "MSG_CONSUMER_NAME", ",", "'ARTICLE-REVIEW-UNLOCK-SUCCESS'", ")", ";", "}", "else", "{", "$", "oMsgManager", "->", "AddMessage", "(", "self", "::", "MSG_CONSUMER_NAME", ",", "'ARTICLE-REVIEW-ACTION-REVIEW-NOT-BLOCKED'", ")", ";", "}", "}", "else", "{", "$", "oMsgManager", "->", "AddMessage", "(", "self", "::", "MSG_CONSUMER_NAME", ",", "'ARTICLE-REVIEW-ACTION-REVIEW-NOT-FOUND'", ")", ";", "}", "}", "else", "{", "$", "oMsgManager", "->", "AddMessage", "(", "self", "::", "MSG_CONSUMER_NAME", ",", "'ARTICLE-REVIEW-ACTION-MISSING-PARAMETER'", ")", ";", "}", "$", "this", "->", "RedirectToItemPage", "(", ")", ";", "}" ]
Unlocks a locked review.
[ "Unlocks", "a", "locked", "review", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php#L430-L458
31,444
chameleon-system/chameleon-shop
src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php
MTPkgShopArticleReviewCore.ChangeReviewReportNotificationState
public function ChangeReviewReportNotificationState() { $oGlobal = TGlobal::instance(); $oMsgManager = TCMSMessageManager::GetInstance(); if ($oGlobal->UserDataExists(TdbShopArticleReview::URL_PARAM_REVIEW_ID)) { $oReviewItem = TdbShopArticleReview::GetNewInstance(); if ($oReviewItem->Load($oGlobal->GetUserData(TdbShopArticleReview::URL_PARAM_REVIEW_ID)) && $oReviewItem->IsOwner()) { $sReviewReportNotificationState = $oReviewItem->fieldSendCommentNotification; if ($sReviewReportNotificationState) { $sReviewReportNotificationState = 0; } else { $sReviewReportNotificationState = 1; } $oReviewItem->sqlData['send_comment_notification'] = $sReviewReportNotificationState; $oReviewItem->AllowEditByAll(true); $oReviewItem->Save(); $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-CHANGE-REPORT-NOTIFICATION-STATE-SUCCESS'); } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-REVIEW-NOT-FOUND'); } } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-MISSING-PARAMETER'); } $this->RedirectToItemPage(); }
php
public function ChangeReviewReportNotificationState() { $oGlobal = TGlobal::instance(); $oMsgManager = TCMSMessageManager::GetInstance(); if ($oGlobal->UserDataExists(TdbShopArticleReview::URL_PARAM_REVIEW_ID)) { $oReviewItem = TdbShopArticleReview::GetNewInstance(); if ($oReviewItem->Load($oGlobal->GetUserData(TdbShopArticleReview::URL_PARAM_REVIEW_ID)) && $oReviewItem->IsOwner()) { $sReviewReportNotificationState = $oReviewItem->fieldSendCommentNotification; if ($sReviewReportNotificationState) { $sReviewReportNotificationState = 0; } else { $sReviewReportNotificationState = 1; } $oReviewItem->sqlData['send_comment_notification'] = $sReviewReportNotificationState; $oReviewItem->AllowEditByAll(true); $oReviewItem->Save(); $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-CHANGE-REPORT-NOTIFICATION-STATE-SUCCESS'); } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-REVIEW-NOT-FOUND'); } } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-MISSING-PARAMETER'); } $this->RedirectToItemPage(); }
[ "public", "function", "ChangeReviewReportNotificationState", "(", ")", "{", "$", "oGlobal", "=", "TGlobal", "::", "instance", "(", ")", ";", "$", "oMsgManager", "=", "TCMSMessageManager", "::", "GetInstance", "(", ")", ";", "if", "(", "$", "oGlobal", "->", "UserDataExists", "(", "TdbShopArticleReview", "::", "URL_PARAM_REVIEW_ID", ")", ")", "{", "$", "oReviewItem", "=", "TdbShopArticleReview", "::", "GetNewInstance", "(", ")", ";", "if", "(", "$", "oReviewItem", "->", "Load", "(", "$", "oGlobal", "->", "GetUserData", "(", "TdbShopArticleReview", "::", "URL_PARAM_REVIEW_ID", ")", ")", "&&", "$", "oReviewItem", "->", "IsOwner", "(", ")", ")", "{", "$", "sReviewReportNotificationState", "=", "$", "oReviewItem", "->", "fieldSendCommentNotification", ";", "if", "(", "$", "sReviewReportNotificationState", ")", "{", "$", "sReviewReportNotificationState", "=", "0", ";", "}", "else", "{", "$", "sReviewReportNotificationState", "=", "1", ";", "}", "$", "oReviewItem", "->", "sqlData", "[", "'send_comment_notification'", "]", "=", "$", "sReviewReportNotificationState", ";", "$", "oReviewItem", "->", "AllowEditByAll", "(", "true", ")", ";", "$", "oReviewItem", "->", "Save", "(", ")", ";", "$", "oMsgManager", "->", "AddMessage", "(", "self", "::", "MSG_CONSUMER_NAME", ",", "'ARTICLE-REVIEW-CHANGE-REPORT-NOTIFICATION-STATE-SUCCESS'", ")", ";", "}", "else", "{", "$", "oMsgManager", "->", "AddMessage", "(", "self", "::", "MSG_CONSUMER_NAME", ",", "'ARTICLE-REVIEW-ACTION-REVIEW-NOT-FOUND'", ")", ";", "}", "}", "else", "{", "$", "oMsgManager", "->", "AddMessage", "(", "self", "::", "MSG_CONSUMER_NAME", ",", "'ARTICLE-REVIEW-ACTION-MISSING-PARAMETER'", ")", ";", "}", "$", "this", "->", "RedirectToItemPage", "(", ")", ";", "}" ]
Changes the report notification state for one review. this can only be called from the owning user.
[ "Changes", "the", "report", "notification", "state", "for", "one", "review", ".", "this", "can", "only", "be", "called", "from", "the", "owning", "user", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php#L464-L488
31,445
chameleon-system/chameleon-shop
src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php
MTPkgShopArticleReviewCore.DeleteReview
public function DeleteReview() { $oGlobal = TGlobal::instance(); $oMsgManager = TCMSMessageManager::GetInstance(); if ($oGlobal->UserDataExists(TdbShopArticleReview::URL_PARAM_ACTION_ID)) { $this->DeleteReviewFromActionId(); } elseif ($oGlobal->UserDataExists(TdbShopArticleReview::URL_PARAM_REVIEW_ID)) { $this->DeleteReviewFromOwner(); } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-MISSING-PARAMETER'); } $this->RedirectToItemPage(); }
php
public function DeleteReview() { $oGlobal = TGlobal::instance(); $oMsgManager = TCMSMessageManager::GetInstance(); if ($oGlobal->UserDataExists(TdbShopArticleReview::URL_PARAM_ACTION_ID)) { $this->DeleteReviewFromActionId(); } elseif ($oGlobal->UserDataExists(TdbShopArticleReview::URL_PARAM_REVIEW_ID)) { $this->DeleteReviewFromOwner(); } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-MISSING-PARAMETER'); } $this->RedirectToItemPage(); }
[ "public", "function", "DeleteReview", "(", ")", "{", "$", "oGlobal", "=", "TGlobal", "::", "instance", "(", ")", ";", "$", "oMsgManager", "=", "TCMSMessageManager", "::", "GetInstance", "(", ")", ";", "if", "(", "$", "oGlobal", "->", "UserDataExists", "(", "TdbShopArticleReview", "::", "URL_PARAM_ACTION_ID", ")", ")", "{", "$", "this", "->", "DeleteReviewFromActionId", "(", ")", ";", "}", "elseif", "(", "$", "oGlobal", "->", "UserDataExists", "(", "TdbShopArticleReview", "::", "URL_PARAM_REVIEW_ID", ")", ")", "{", "$", "this", "->", "DeleteReviewFromOwner", "(", ")", ";", "}", "else", "{", "$", "oMsgManager", "->", "AddMessage", "(", "self", "::", "MSG_CONSUMER_NAME", ",", "'ARTICLE-REVIEW-ACTION-MISSING-PARAMETER'", ")", ";", "}", "$", "this", "->", "RedirectToItemPage", "(", ")", ";", "}" ]
Deletes one review. This function can only be called with valid action id or from owning user.
[ "Deletes", "one", "review", ".", "This", "function", "can", "only", "be", "called", "with", "valid", "action", "id", "or", "from", "owning", "user", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php#L494-L506
31,446
chameleon-system/chameleon-shop
src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php
MTPkgShopArticleReviewCore.DeleteReviewFromActionId
protected function DeleteReviewFromActionId() { $oReviewItem = TdbShopArticleReview::GetNewInstance(); $oGlobal = TGlobal::instance(); $oMsgManager = TCMSMessageManager::GetInstance(); if ($oReviewItem->LoadFromField('action_id', $oGlobal->GetUserData(TdbShopArticleReview::URL_PARAM_ACTION_ID))) { if (0 == $oReviewItem->sqlData['publish']) { $this->DeleteConnectedComments($oReviewItem); $oReviewItem->AllowEditByAll(true); $oReviewItem->Delete(); $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-DELETE-SUCCESS'); } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-REVIEW-NOT-BLOCKED'); } } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-REVIEW-NOT-FOUND'); } }
php
protected function DeleteReviewFromActionId() { $oReviewItem = TdbShopArticleReview::GetNewInstance(); $oGlobal = TGlobal::instance(); $oMsgManager = TCMSMessageManager::GetInstance(); if ($oReviewItem->LoadFromField('action_id', $oGlobal->GetUserData(TdbShopArticleReview::URL_PARAM_ACTION_ID))) { if (0 == $oReviewItem->sqlData['publish']) { $this->DeleteConnectedComments($oReviewItem); $oReviewItem->AllowEditByAll(true); $oReviewItem->Delete(); $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-DELETE-SUCCESS'); } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-REVIEW-NOT-BLOCKED'); } } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-REVIEW-NOT-FOUND'); } }
[ "protected", "function", "DeleteReviewFromActionId", "(", ")", "{", "$", "oReviewItem", "=", "TdbShopArticleReview", "::", "GetNewInstance", "(", ")", ";", "$", "oGlobal", "=", "TGlobal", "::", "instance", "(", ")", ";", "$", "oMsgManager", "=", "TCMSMessageManager", "::", "GetInstance", "(", ")", ";", "if", "(", "$", "oReviewItem", "->", "LoadFromField", "(", "'action_id'", ",", "$", "oGlobal", "->", "GetUserData", "(", "TdbShopArticleReview", "::", "URL_PARAM_ACTION_ID", ")", ")", ")", "{", "if", "(", "0", "==", "$", "oReviewItem", "->", "sqlData", "[", "'publish'", "]", ")", "{", "$", "this", "->", "DeleteConnectedComments", "(", "$", "oReviewItem", ")", ";", "$", "oReviewItem", "->", "AllowEditByAll", "(", "true", ")", ";", "$", "oReviewItem", "->", "Delete", "(", ")", ";", "$", "oMsgManager", "->", "AddMessage", "(", "self", "::", "MSG_CONSUMER_NAME", ",", "'ARTICLE-REVIEW-DELETE-SUCCESS'", ")", ";", "}", "else", "{", "$", "oMsgManager", "->", "AddMessage", "(", "self", "::", "MSG_CONSUMER_NAME", ",", "'ARTICLE-REVIEW-ACTION-REVIEW-NOT-BLOCKED'", ")", ";", "}", "}", "else", "{", "$", "oMsgManager", "->", "AddMessage", "(", "self", "::", "MSG_CONSUMER_NAME", ",", "'ARTICLE-REVIEW-ACTION-REVIEW-NOT-FOUND'", ")", ";", "}", "}" ]
Deletes one review with valid action id.
[ "Deletes", "one", "review", "with", "valid", "action", "id", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php#L511-L528
31,447
chameleon-system/chameleon-shop
src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php
MTPkgShopArticleReviewCore.DeleteReviewFromOwner
protected function DeleteReviewFromOwner() { $oReviewItem = TdbShopArticleReview::GetNewInstance(); $oGlobal = TGlobal::instance(); $oMsgManager = TCMSMessageManager::GetInstance(); if ($oReviewItem->Load($oGlobal->GetUserData(TdbShopArticleReview::URL_PARAM_REVIEW_ID)) && $oReviewItem->IsOwner()) { $this->DeleteConnectedComments($oReviewItem); $oReviewItem->AllowEditByAll(true); $oReviewItem->Delete(); $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-DELETE-SUCCESS'); } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-REVIEW-NOT-FOUND'); } }
php
protected function DeleteReviewFromOwner() { $oReviewItem = TdbShopArticleReview::GetNewInstance(); $oGlobal = TGlobal::instance(); $oMsgManager = TCMSMessageManager::GetInstance(); if ($oReviewItem->Load($oGlobal->GetUserData(TdbShopArticleReview::URL_PARAM_REVIEW_ID)) && $oReviewItem->IsOwner()) { $this->DeleteConnectedComments($oReviewItem); $oReviewItem->AllowEditByAll(true); $oReviewItem->Delete(); $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-DELETE-SUCCESS'); } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-REVIEW-NOT-FOUND'); } }
[ "protected", "function", "DeleteReviewFromOwner", "(", ")", "{", "$", "oReviewItem", "=", "TdbShopArticleReview", "::", "GetNewInstance", "(", ")", ";", "$", "oGlobal", "=", "TGlobal", "::", "instance", "(", ")", ";", "$", "oMsgManager", "=", "TCMSMessageManager", "::", "GetInstance", "(", ")", ";", "if", "(", "$", "oReviewItem", "->", "Load", "(", "$", "oGlobal", "->", "GetUserData", "(", "TdbShopArticleReview", "::", "URL_PARAM_REVIEW_ID", ")", ")", "&&", "$", "oReviewItem", "->", "IsOwner", "(", ")", ")", "{", "$", "this", "->", "DeleteConnectedComments", "(", "$", "oReviewItem", ")", ";", "$", "oReviewItem", "->", "AllowEditByAll", "(", "true", ")", ";", "$", "oReviewItem", "->", "Delete", "(", ")", ";", "$", "oMsgManager", "->", "AddMessage", "(", "self", "::", "MSG_CONSUMER_NAME", ",", "'ARTICLE-REVIEW-DELETE-SUCCESS'", ")", ";", "}", "else", "{", "$", "oMsgManager", "->", "AddMessage", "(", "self", "::", "MSG_CONSUMER_NAME", ",", "'ARTICLE-REVIEW-ACTION-REVIEW-NOT-FOUND'", ")", ";", "}", "}" ]
Deletes one review if owner is logged in.
[ "Deletes", "one", "review", "if", "owner", "is", "logged", "in", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php#L533-L546
31,448
chameleon-system/chameleon-shop
src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php
MTPkgShopArticleReviewCore.DeleteConnectedComments
protected function DeleteConnectedComments($oReviewItem) { if ($this->AllowToCommentReview()) { $sQuery = "SELECT `pkg_comment`.* FROM `cms_tbl_conf` INNER JOIN `pkg_comment_type` ON `pkg_comment_type`.`cms_tbl_conf_id` = `cms_tbl_conf`.`id` INNER JOIN `pkg_comment` ON `pkg_comment`.`pkg_comment_type_id` = `pkg_comment_type`.`id` WHERE `pkg_comment_type`.`class_name` = 'TPkgCommentTypePkgShopArticleReview' AND `cms_tbl_conf`.`name` = '".MySqlLegacySupport::getInstance()->real_escape_string($oReviewItem->table)."' AND `pkg_comment`.`item_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($oReviewItem->id)."'"; $oConnectedCommentList = TdbPkgCommentList::GetList($sQuery); while ($oConnectedComment = $oConnectedCommentList->Next()) { $oCommentEditor = TTools::GetTableEditorManager('pkg_comment', $oConnectedComment->id); $oCommentEditor->AllowDeleteByAll(true); $oCommentEditor->Delete($oConnectedComment->id); } } }
php
protected function DeleteConnectedComments($oReviewItem) { if ($this->AllowToCommentReview()) { $sQuery = "SELECT `pkg_comment`.* FROM `cms_tbl_conf` INNER JOIN `pkg_comment_type` ON `pkg_comment_type`.`cms_tbl_conf_id` = `cms_tbl_conf`.`id` INNER JOIN `pkg_comment` ON `pkg_comment`.`pkg_comment_type_id` = `pkg_comment_type`.`id` WHERE `pkg_comment_type`.`class_name` = 'TPkgCommentTypePkgShopArticleReview' AND `cms_tbl_conf`.`name` = '".MySqlLegacySupport::getInstance()->real_escape_string($oReviewItem->table)."' AND `pkg_comment`.`item_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($oReviewItem->id)."'"; $oConnectedCommentList = TdbPkgCommentList::GetList($sQuery); while ($oConnectedComment = $oConnectedCommentList->Next()) { $oCommentEditor = TTools::GetTableEditorManager('pkg_comment', $oConnectedComment->id); $oCommentEditor->AllowDeleteByAll(true); $oCommentEditor->Delete($oConnectedComment->id); } } }
[ "protected", "function", "DeleteConnectedComments", "(", "$", "oReviewItem", ")", "{", "if", "(", "$", "this", "->", "AllowToCommentReview", "(", ")", ")", "{", "$", "sQuery", "=", "\"SELECT `pkg_comment`.* FROM `cms_tbl_conf`\n INNER JOIN `pkg_comment_type` ON `pkg_comment_type`.`cms_tbl_conf_id` = `cms_tbl_conf`.`id`\n INNER JOIN `pkg_comment` ON `pkg_comment`.`pkg_comment_type_id` = `pkg_comment_type`.`id`\n WHERE `pkg_comment_type`.`class_name` = 'TPkgCommentTypePkgShopArticleReview'\n AND `cms_tbl_conf`.`name` = '\"", ".", "MySqlLegacySupport", "::", "getInstance", "(", ")", "->", "real_escape_string", "(", "$", "oReviewItem", "->", "table", ")", ".", "\"'\n AND `pkg_comment`.`item_id` = '\"", ".", "MySqlLegacySupport", "::", "getInstance", "(", ")", "->", "real_escape_string", "(", "$", "oReviewItem", "->", "id", ")", ".", "\"'\"", ";", "$", "oConnectedCommentList", "=", "TdbPkgCommentList", "::", "GetList", "(", "$", "sQuery", ")", ";", "while", "(", "$", "oConnectedComment", "=", "$", "oConnectedCommentList", "->", "Next", "(", ")", ")", "{", "$", "oCommentEditor", "=", "TTools", "::", "GetTableEditorManager", "(", "'pkg_comment'", ",", "$", "oConnectedComment", "->", "id", ")", ";", "$", "oCommentEditor", "->", "AllowDeleteByAll", "(", "true", ")", ";", "$", "oCommentEditor", "->", "Delete", "(", "$", "oConnectedComment", "->", "id", ")", ";", "}", "}", "}" ]
Deletes all comment for a given review. @param TdbShopArticleReview $oReviewItem
[ "Deletes", "all", "comment", "for", "a", "given", "review", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php#L553-L569
31,449
chameleon-system/chameleon-shop
src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php
MTPkgShopArticleReviewCore.ReportReview
public function ReportReview() { $oGlobal = TGlobal::instance(); $oMsgManager = TCMSMessageManager::GetInstance(); if ($oGlobal->UserDataExists(TdbShopArticleReview::URL_PARAM_REVIEW_ID) && $this->AllowReportReviews()) { $oReviewItem = TdbShopArticleReview::GetNewInstance(); if ($oReviewItem->Load($oGlobal->GetUserData(TdbShopArticleReview::URL_PARAM_REVIEW_ID))) { if (0 != $oReviewItem->sqlData['publish'] && '0' != $oReviewItem->sqlData['publish']) { $oReviewItem->sqlData['publish'] = 0; $oReviewItem->AllowEditByAll(true); $oReviewItem->Save(); $oReviewItem->SendReviewReportNotification(); $oArticle = TdbShop::GetActiveItem(); if ($oArticle->IsVariant()) { $oArticle = $oArticle->GetFieldVariantParent(); } $oArticle->UpdateStatsReviews(); $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-REPORT-REVIEW-SUCCESS'); $this->getRedirect()->redirect($this->getActivePageService()->getActivePage()->GetRealURLPlain()); } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-REPORT-REVIEW-ALREADY-BLOCKED'); } } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-REVIEW-NOT-FOUND'); } } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-MISSING-PARAMETER'); } $this->RedirectToItemPage(); }
php
public function ReportReview() { $oGlobal = TGlobal::instance(); $oMsgManager = TCMSMessageManager::GetInstance(); if ($oGlobal->UserDataExists(TdbShopArticleReview::URL_PARAM_REVIEW_ID) && $this->AllowReportReviews()) { $oReviewItem = TdbShopArticleReview::GetNewInstance(); if ($oReviewItem->Load($oGlobal->GetUserData(TdbShopArticleReview::URL_PARAM_REVIEW_ID))) { if (0 != $oReviewItem->sqlData['publish'] && '0' != $oReviewItem->sqlData['publish']) { $oReviewItem->sqlData['publish'] = 0; $oReviewItem->AllowEditByAll(true); $oReviewItem->Save(); $oReviewItem->SendReviewReportNotification(); $oArticle = TdbShop::GetActiveItem(); if ($oArticle->IsVariant()) { $oArticle = $oArticle->GetFieldVariantParent(); } $oArticle->UpdateStatsReviews(); $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-REPORT-REVIEW-SUCCESS'); $this->getRedirect()->redirect($this->getActivePageService()->getActivePage()->GetRealURLPlain()); } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-REPORT-REVIEW-ALREADY-BLOCKED'); } } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-REVIEW-NOT-FOUND'); } } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-MISSING-PARAMETER'); } $this->RedirectToItemPage(); }
[ "public", "function", "ReportReview", "(", ")", "{", "$", "oGlobal", "=", "TGlobal", "::", "instance", "(", ")", ";", "$", "oMsgManager", "=", "TCMSMessageManager", "::", "GetInstance", "(", ")", ";", "if", "(", "$", "oGlobal", "->", "UserDataExists", "(", "TdbShopArticleReview", "::", "URL_PARAM_REVIEW_ID", ")", "&&", "$", "this", "->", "AllowReportReviews", "(", ")", ")", "{", "$", "oReviewItem", "=", "TdbShopArticleReview", "::", "GetNewInstance", "(", ")", ";", "if", "(", "$", "oReviewItem", "->", "Load", "(", "$", "oGlobal", "->", "GetUserData", "(", "TdbShopArticleReview", "::", "URL_PARAM_REVIEW_ID", ")", ")", ")", "{", "if", "(", "0", "!=", "$", "oReviewItem", "->", "sqlData", "[", "'publish'", "]", "&&", "'0'", "!=", "$", "oReviewItem", "->", "sqlData", "[", "'publish'", "]", ")", "{", "$", "oReviewItem", "->", "sqlData", "[", "'publish'", "]", "=", "0", ";", "$", "oReviewItem", "->", "AllowEditByAll", "(", "true", ")", ";", "$", "oReviewItem", "->", "Save", "(", ")", ";", "$", "oReviewItem", "->", "SendReviewReportNotification", "(", ")", ";", "$", "oArticle", "=", "TdbShop", "::", "GetActiveItem", "(", ")", ";", "if", "(", "$", "oArticle", "->", "IsVariant", "(", ")", ")", "{", "$", "oArticle", "=", "$", "oArticle", "->", "GetFieldVariantParent", "(", ")", ";", "}", "$", "oArticle", "->", "UpdateStatsReviews", "(", ")", ";", "$", "oMsgManager", "->", "AddMessage", "(", "self", "::", "MSG_CONSUMER_NAME", ",", "'ARTICLE-REVIEW-REPORT-REVIEW-SUCCESS'", ")", ";", "$", "this", "->", "getRedirect", "(", ")", "->", "redirect", "(", "$", "this", "->", "getActivePageService", "(", ")", "->", "getActivePage", "(", ")", "->", "GetRealURLPlain", "(", ")", ")", ";", "}", "else", "{", "$", "oMsgManager", "->", "AddMessage", "(", "self", "::", "MSG_CONSUMER_NAME", ",", "'ARTICLE-REVIEW-REPORT-REVIEW-ALREADY-BLOCKED'", ")", ";", "}", "}", "else", "{", "$", "oMsgManager", "->", "AddMessage", "(", "self", "::", "MSG_CONSUMER_NAME", ",", "'ARTICLE-REVIEW-ACTION-REVIEW-NOT-FOUND'", ")", ";", "}", "}", "else", "{", "$", "oMsgManager", "->", "AddMessage", "(", "self", "::", "MSG_CONSUMER_NAME", ",", "'ARTICLE-REVIEW-ACTION-MISSING-PARAMETER'", ")", ";", "}", "$", "this", "->", "RedirectToItemPage", "(", ")", ";", "}" ]
Reports one review to shop owner and lock reported review. Shop owner owner will get an email with delete and unlock link.
[ "Reports", "one", "review", "to", "shop", "owner", "and", "lock", "reported", "review", ".", "Shop", "owner", "owner", "will", "get", "an", "email", "with", "delete", "and", "unlock", "link", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php#L575-L604
31,450
chameleon-system/chameleon-shop
src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php
MTPkgShopArticleReviewCore.RateReview
public function RateReview() { $oGlobal = TGlobal::instance(); $oMsgManager = TCMSMessageManager::GetInstance(); $oReviewItem = TdbShopArticleReview::GetNewInstance(); if ($oReviewItem->Load($oGlobal->GetUserData(TdbShopArticleReview::URL_PARAM_REVIEW_ID))) { if ($this->AllowRateReviews() && $oGlobal->UserDataExists('bRate') && $oGlobal->UserDataExists(TdbShopArticleReview::URL_PARAM_REVIEW_ID)) { $bRate = $oGlobal->GetUserData('bRate'); if ($bRate) { $oReviewItem->RateReview(true); } else { $oReviewItem->RateReview(false); } $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-RATE-REVIEW-SUCCESS'); } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-MISSING-PARAMETER'); } } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-REVIEW-NOT-FOUND'); } $this->RedirectToItemPage(); }
php
public function RateReview() { $oGlobal = TGlobal::instance(); $oMsgManager = TCMSMessageManager::GetInstance(); $oReviewItem = TdbShopArticleReview::GetNewInstance(); if ($oReviewItem->Load($oGlobal->GetUserData(TdbShopArticleReview::URL_PARAM_REVIEW_ID))) { if ($this->AllowRateReviews() && $oGlobal->UserDataExists('bRate') && $oGlobal->UserDataExists(TdbShopArticleReview::URL_PARAM_REVIEW_ID)) { $bRate = $oGlobal->GetUserData('bRate'); if ($bRate) { $oReviewItem->RateReview(true); } else { $oReviewItem->RateReview(false); } $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-RATE-REVIEW-SUCCESS'); } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-MISSING-PARAMETER'); } } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-REVIEW-NOT-FOUND'); } $this->RedirectToItemPage(); }
[ "public", "function", "RateReview", "(", ")", "{", "$", "oGlobal", "=", "TGlobal", "::", "instance", "(", ")", ";", "$", "oMsgManager", "=", "TCMSMessageManager", "::", "GetInstance", "(", ")", ";", "$", "oReviewItem", "=", "TdbShopArticleReview", "::", "GetNewInstance", "(", ")", ";", "if", "(", "$", "oReviewItem", "->", "Load", "(", "$", "oGlobal", "->", "GetUserData", "(", "TdbShopArticleReview", "::", "URL_PARAM_REVIEW_ID", ")", ")", ")", "{", "if", "(", "$", "this", "->", "AllowRateReviews", "(", ")", "&&", "$", "oGlobal", "->", "UserDataExists", "(", "'bRate'", ")", "&&", "$", "oGlobal", "->", "UserDataExists", "(", "TdbShopArticleReview", "::", "URL_PARAM_REVIEW_ID", ")", ")", "{", "$", "bRate", "=", "$", "oGlobal", "->", "GetUserData", "(", "'bRate'", ")", ";", "if", "(", "$", "bRate", ")", "{", "$", "oReviewItem", "->", "RateReview", "(", "true", ")", ";", "}", "else", "{", "$", "oReviewItem", "->", "RateReview", "(", "false", ")", ";", "}", "$", "oMsgManager", "->", "AddMessage", "(", "self", "::", "MSG_CONSUMER_NAME", ",", "'ARTICLE-REVIEW-RATE-REVIEW-SUCCESS'", ")", ";", "}", "else", "{", "$", "oMsgManager", "->", "AddMessage", "(", "self", "::", "MSG_CONSUMER_NAME", ",", "'ARTICLE-REVIEW-ACTION-MISSING-PARAMETER'", ")", ";", "}", "}", "else", "{", "$", "oMsgManager", "->", "AddMessage", "(", "self", "::", "MSG_CONSUMER_NAME", ",", "'ARTICLE-REVIEW-ACTION-REVIEW-NOT-FOUND'", ")", ";", "}", "$", "this", "->", "RedirectToItemPage", "(", ")", ";", "}" ]
Rates one review positive or negative.
[ "Rates", "one", "review", "positive", "or", "negative", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php#L609-L630
31,451
chameleon-system/chameleon-shop
src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php
MTPkgShopArticleReviewCore.EditReview
public function EditReview() { $oGlobal = TGlobal::instance(); $oMsgManager = TCMSMessageManager::GetInstance(); if ($oGlobal->UserDataExists(TdbShopArticleReview::URL_PARAM_REVIEW_ID) && $oGlobal->UserDataExists(TdbShopArticleReview::INPUT_BASE_NAME)) { $oEditReview = TdbShopArticleReview::GetNewInstance(); if ($oEditReview->Load($oGlobal->GetUserData(TdbShopArticleReview::URL_PARAM_REVIEW_ID))) { $aUserData = $oGlobal->GetuserData(TdbShopArticleReview::INPUT_BASE_NAME); foreach ($aUserData as $sKey => $sValue) { $oEditReview->sqlData[$sKey] = $sValue; } if ($this->ValidateWriteReviewData($oEditReview->sqlData)) { $oEditReview->AllowEditByAll(true); $oEditReview->Save(); $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-EDIT-REVIEW-SUCCESS'); } } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-REVIEW-NOT-FOUND'); } } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-MISSING-PARAMETER'); } }
php
public function EditReview() { $oGlobal = TGlobal::instance(); $oMsgManager = TCMSMessageManager::GetInstance(); if ($oGlobal->UserDataExists(TdbShopArticleReview::URL_PARAM_REVIEW_ID) && $oGlobal->UserDataExists(TdbShopArticleReview::INPUT_BASE_NAME)) { $oEditReview = TdbShopArticleReview::GetNewInstance(); if ($oEditReview->Load($oGlobal->GetUserData(TdbShopArticleReview::URL_PARAM_REVIEW_ID))) { $aUserData = $oGlobal->GetuserData(TdbShopArticleReview::INPUT_BASE_NAME); foreach ($aUserData as $sKey => $sValue) { $oEditReview->sqlData[$sKey] = $sValue; } if ($this->ValidateWriteReviewData($oEditReview->sqlData)) { $oEditReview->AllowEditByAll(true); $oEditReview->Save(); $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-EDIT-REVIEW-SUCCESS'); } } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-REVIEW-NOT-FOUND'); } } else { $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-MISSING-PARAMETER'); } }
[ "public", "function", "EditReview", "(", ")", "{", "$", "oGlobal", "=", "TGlobal", "::", "instance", "(", ")", ";", "$", "oMsgManager", "=", "TCMSMessageManager", "::", "GetInstance", "(", ")", ";", "if", "(", "$", "oGlobal", "->", "UserDataExists", "(", "TdbShopArticleReview", "::", "URL_PARAM_REVIEW_ID", ")", "&&", "$", "oGlobal", "->", "UserDataExists", "(", "TdbShopArticleReview", "::", "INPUT_BASE_NAME", ")", ")", "{", "$", "oEditReview", "=", "TdbShopArticleReview", "::", "GetNewInstance", "(", ")", ";", "if", "(", "$", "oEditReview", "->", "Load", "(", "$", "oGlobal", "->", "GetUserData", "(", "TdbShopArticleReview", "::", "URL_PARAM_REVIEW_ID", ")", ")", ")", "{", "$", "aUserData", "=", "$", "oGlobal", "->", "GetuserData", "(", "TdbShopArticleReview", "::", "INPUT_BASE_NAME", ")", ";", "foreach", "(", "$", "aUserData", "as", "$", "sKey", "=>", "$", "sValue", ")", "{", "$", "oEditReview", "->", "sqlData", "[", "$", "sKey", "]", "=", "$", "sValue", ";", "}", "if", "(", "$", "this", "->", "ValidateWriteReviewData", "(", "$", "oEditReview", "->", "sqlData", ")", ")", "{", "$", "oEditReview", "->", "AllowEditByAll", "(", "true", ")", ";", "$", "oEditReview", "->", "Save", "(", ")", ";", "$", "oMsgManager", "->", "AddMessage", "(", "self", "::", "MSG_CONSUMER_NAME", ",", "'ARTICLE-REVIEW-EDIT-REVIEW-SUCCESS'", ")", ";", "}", "}", "else", "{", "$", "oMsgManager", "->", "AddMessage", "(", "self", "::", "MSG_CONSUMER_NAME", ",", "'ARTICLE-REVIEW-ACTION-REVIEW-NOT-FOUND'", ")", ";", "}", "}", "else", "{", "$", "oMsgManager", "->", "AddMessage", "(", "self", "::", "MSG_CONSUMER_NAME", ",", "'ARTICLE-REVIEW-ACTION-MISSING-PARAMETER'", ")", ";", "}", "}" ]
Edit one review.
[ "Edit", "one", "review", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php#L635-L657
31,452
chameleon-system/chameleon-shop
src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php
MTPkgShopArticleReviewCore.WriteReview
public function WriteReview() { //validate user input... $oGlobal = TGlobal::instance(); $aUserData = array(); if ($this->AllowWriteReview()) { $aUserData = $this->GetReviewWriteData(); $oGlobal->GetuserData(TdbShopArticleReview::INPUT_BASE_NAME); if ($this->ValidateWriteReviewData($aUserData)) { $oArticle = $this->GetArticleToReview(); $oReviewItem = $this->CreateReview($aUserData, $oArticle); $oArticle->UpdateStatsReviews(); $oReviewItem->SendNewReviewNotification(); $oMsgManager = TCMSMessageManager::GetInstance(); $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-SUBMITTED', $aUserData); $this->RedirectToItemPage(); } } $this->RedirectToItemPage(null, array(TdbShopArticleReview::INPUT_BASE_NAME => $aUserData), true); }
php
public function WriteReview() { //validate user input... $oGlobal = TGlobal::instance(); $aUserData = array(); if ($this->AllowWriteReview()) { $aUserData = $this->GetReviewWriteData(); $oGlobal->GetuserData(TdbShopArticleReview::INPUT_BASE_NAME); if ($this->ValidateWriteReviewData($aUserData)) { $oArticle = $this->GetArticleToReview(); $oReviewItem = $this->CreateReview($aUserData, $oArticle); $oArticle->UpdateStatsReviews(); $oReviewItem->SendNewReviewNotification(); $oMsgManager = TCMSMessageManager::GetInstance(); $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-SUBMITTED', $aUserData); $this->RedirectToItemPage(); } } $this->RedirectToItemPage(null, array(TdbShopArticleReview::INPUT_BASE_NAME => $aUserData), true); }
[ "public", "function", "WriteReview", "(", ")", "{", "//validate user input...", "$", "oGlobal", "=", "TGlobal", "::", "instance", "(", ")", ";", "$", "aUserData", "=", "array", "(", ")", ";", "if", "(", "$", "this", "->", "AllowWriteReview", "(", ")", ")", "{", "$", "aUserData", "=", "$", "this", "->", "GetReviewWriteData", "(", ")", ";", "$", "oGlobal", "->", "GetuserData", "(", "TdbShopArticleReview", "::", "INPUT_BASE_NAME", ")", ";", "if", "(", "$", "this", "->", "ValidateWriteReviewData", "(", "$", "aUserData", ")", ")", "{", "$", "oArticle", "=", "$", "this", "->", "GetArticleToReview", "(", ")", ";", "$", "oReviewItem", "=", "$", "this", "->", "CreateReview", "(", "$", "aUserData", ",", "$", "oArticle", ")", ";", "$", "oArticle", "->", "UpdateStatsReviews", "(", ")", ";", "$", "oReviewItem", "->", "SendNewReviewNotification", "(", ")", ";", "$", "oMsgManager", "=", "TCMSMessageManager", "::", "GetInstance", "(", ")", ";", "$", "oMsgManager", "->", "AddMessage", "(", "self", "::", "MSG_CONSUMER_NAME", ",", "'ARTICLE-REVIEW-SUBMITTED'", ",", "$", "aUserData", ")", ";", "$", "this", "->", "RedirectToItemPage", "(", ")", ";", "}", "}", "$", "this", "->", "RedirectToItemPage", "(", "null", ",", "array", "(", "TdbShopArticleReview", "::", "INPUT_BASE_NAME", "=>", "$", "aUserData", ")", ",", "true", ")", ";", "}" ]
Writes a review.
[ "Writes", "a", "review", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php#L701-L720
31,453
chameleon-system/chameleon-shop
src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php
MTPkgShopArticleReviewCore.CreateReview
protected function CreateReview($aUserData, $oArticle) { $oModuleConfiguration = $this->GetModuleConfiguration(); $oReviewItem = TdbShopArticleReview::GetNewInstance(); /*@var $oReviewItem TdbShopArticleReview*/ $aUserData['shop_article_id'] = $oArticle->id; $oReviewItem->LoadFromRowProtected($aUserData); if ($oModuleConfiguration->fieldManageReviews) { $oReviewItem->sqlData['publish'] = '0'; } else { $oReviewItem->sqlData['publish'] = '1'; } $oReviewItem->AllowEditByAll(true); $oReviewItem->Save(); return $oReviewItem; }
php
protected function CreateReview($aUserData, $oArticle) { $oModuleConfiguration = $this->GetModuleConfiguration(); $oReviewItem = TdbShopArticleReview::GetNewInstance(); /*@var $oReviewItem TdbShopArticleReview*/ $aUserData['shop_article_id'] = $oArticle->id; $oReviewItem->LoadFromRowProtected($aUserData); if ($oModuleConfiguration->fieldManageReviews) { $oReviewItem->sqlData['publish'] = '0'; } else { $oReviewItem->sqlData['publish'] = '1'; } $oReviewItem->AllowEditByAll(true); $oReviewItem->Save(); return $oReviewItem; }
[ "protected", "function", "CreateReview", "(", "$", "aUserData", ",", "$", "oArticle", ")", "{", "$", "oModuleConfiguration", "=", "$", "this", "->", "GetModuleConfiguration", "(", ")", ";", "$", "oReviewItem", "=", "TdbShopArticleReview", "::", "GetNewInstance", "(", ")", ";", "/*@var $oReviewItem TdbShopArticleReview*/", "$", "aUserData", "[", "'shop_article_id'", "]", "=", "$", "oArticle", "->", "id", ";", "$", "oReviewItem", "->", "LoadFromRowProtected", "(", "$", "aUserData", ")", ";", "if", "(", "$", "oModuleConfiguration", "->", "fieldManageReviews", ")", "{", "$", "oReviewItem", "->", "sqlData", "[", "'publish'", "]", "=", "'0'", ";", "}", "else", "{", "$", "oReviewItem", "->", "sqlData", "[", "'publish'", "]", "=", "'1'", ";", "}", "$", "oReviewItem", "->", "AllowEditByAll", "(", "true", ")", ";", "$", "oReviewItem", "->", "Save", "(", ")", ";", "return", "$", "oReviewItem", ";", "}" ]
Create a new review for given article with given data. @param array $aUserData @param TdbShopArticle $oArticle @return TdbShopArticleReview
[ "Create", "a", "new", "review", "for", "given", "article", "with", "given", "data", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php#L759-L774
31,454
chameleon-system/chameleon-shop
src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php
MTPkgShopArticleReviewCore.ValidateWriteReviewData
protected function ValidateWriteReviewData($aUserData) { $bDataValid = false; $oMsgManager = TCMSMessageManager::GetInstance(); if (is_array($aUserData)) { $bDataValid = true; $sCaptcha = ''; if ($this->NeedCaptcha()) { if (array_key_exists('captcha', $aUserData)) { $sCaptcha = trim($aUserData['captcha']); } if (empty($sCaptcha) || $sCaptcha != $this->GetCaptchaValue()) { $bDataValid = false; $oMsgManager->AddMessage(TdbShopArticleReview::MSG_CONSUMER_BASE_NAME.'-captcha', 'INPUT-ERROR-INVALID-CAPTCHA'); } } $aRequiredFields = $this->GetRequiredFields(); foreach ($aRequiredFields as $sFieldName) { $sVal = ''; if (array_key_exists($sFieldName, $aUserData)) { $sVal = trim($aUserData[$sFieldName]); } if (empty($sVal)) { $bDataValid = false; $oMsgManager->AddMessage(TdbShopArticleReview::MSG_CONSUMER_BASE_NAME.'-'.$sFieldName, 'ERROR-USER-REQUIRED-FIELD-MISSING'); } } if ($this->InsertOfReviewLocked()) { $bDataValid = false; $oMsgManager->AddMessage(MTPkgShopArticleReview::MSG_CONSUMER_NAME, 'ERROR-REVIEW-IS-LOCKED'); } } return $bDataValid; }
php
protected function ValidateWriteReviewData($aUserData) { $bDataValid = false; $oMsgManager = TCMSMessageManager::GetInstance(); if (is_array($aUserData)) { $bDataValid = true; $sCaptcha = ''; if ($this->NeedCaptcha()) { if (array_key_exists('captcha', $aUserData)) { $sCaptcha = trim($aUserData['captcha']); } if (empty($sCaptcha) || $sCaptcha != $this->GetCaptchaValue()) { $bDataValid = false; $oMsgManager->AddMessage(TdbShopArticleReview::MSG_CONSUMER_BASE_NAME.'-captcha', 'INPUT-ERROR-INVALID-CAPTCHA'); } } $aRequiredFields = $this->GetRequiredFields(); foreach ($aRequiredFields as $sFieldName) { $sVal = ''; if (array_key_exists($sFieldName, $aUserData)) { $sVal = trim($aUserData[$sFieldName]); } if (empty($sVal)) { $bDataValid = false; $oMsgManager->AddMessage(TdbShopArticleReview::MSG_CONSUMER_BASE_NAME.'-'.$sFieldName, 'ERROR-USER-REQUIRED-FIELD-MISSING'); } } if ($this->InsertOfReviewLocked()) { $bDataValid = false; $oMsgManager->AddMessage(MTPkgShopArticleReview::MSG_CONSUMER_NAME, 'ERROR-REVIEW-IS-LOCKED'); } } return $bDataValid; }
[ "protected", "function", "ValidateWriteReviewData", "(", "$", "aUserData", ")", "{", "$", "bDataValid", "=", "false", ";", "$", "oMsgManager", "=", "TCMSMessageManager", "::", "GetInstance", "(", ")", ";", "if", "(", "is_array", "(", "$", "aUserData", ")", ")", "{", "$", "bDataValid", "=", "true", ";", "$", "sCaptcha", "=", "''", ";", "if", "(", "$", "this", "->", "NeedCaptcha", "(", ")", ")", "{", "if", "(", "array_key_exists", "(", "'captcha'", ",", "$", "aUserData", ")", ")", "{", "$", "sCaptcha", "=", "trim", "(", "$", "aUserData", "[", "'captcha'", "]", ")", ";", "}", "if", "(", "empty", "(", "$", "sCaptcha", ")", "||", "$", "sCaptcha", "!=", "$", "this", "->", "GetCaptchaValue", "(", ")", ")", "{", "$", "bDataValid", "=", "false", ";", "$", "oMsgManager", "->", "AddMessage", "(", "TdbShopArticleReview", "::", "MSG_CONSUMER_BASE_NAME", ".", "'-captcha'", ",", "'INPUT-ERROR-INVALID-CAPTCHA'", ")", ";", "}", "}", "$", "aRequiredFields", "=", "$", "this", "->", "GetRequiredFields", "(", ")", ";", "foreach", "(", "$", "aRequiredFields", "as", "$", "sFieldName", ")", "{", "$", "sVal", "=", "''", ";", "if", "(", "array_key_exists", "(", "$", "sFieldName", ",", "$", "aUserData", ")", ")", "{", "$", "sVal", "=", "trim", "(", "$", "aUserData", "[", "$", "sFieldName", "]", ")", ";", "}", "if", "(", "empty", "(", "$", "sVal", ")", ")", "{", "$", "bDataValid", "=", "false", ";", "$", "oMsgManager", "->", "AddMessage", "(", "TdbShopArticleReview", "::", "MSG_CONSUMER_BASE_NAME", ".", "'-'", ".", "$", "sFieldName", ",", "'ERROR-USER-REQUIRED-FIELD-MISSING'", ")", ";", "}", "}", "if", "(", "$", "this", "->", "InsertOfReviewLocked", "(", ")", ")", "{", "$", "bDataValid", "=", "false", ";", "$", "oMsgManager", "->", "AddMessage", "(", "MTPkgShopArticleReview", "::", "MSG_CONSUMER_NAME", ",", "'ERROR-REVIEW-IS-LOCKED'", ")", ";", "}", "}", "return", "$", "bDataValid", ";", "}" ]
Validates given review data to write a new review. @param array $aUserData @return bool
[ "Validates", "given", "review", "data", "to", "write", "a", "new", "review", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php#L800-L835
31,455
chameleon-system/chameleon-shop
src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php
MTPkgShopArticleReviewCore.NeedUserFieldForName
protected function NeedUserFieldForName() { $bNeedUserFieldForName = false; $oUser = TdbDataExtranetUser::GetInstance(); $oModuleConfiguration = $this->GetModuleConfiguration(); if ($oModuleConfiguration->fieldAllowWriteReviewLoggedinUsersOnly) { if (AuthorDisplayConstants::AUTHOR_DISPLAY_TYPE_ALIAS_PROVIDED == $oModuleConfiguration->fieldOptionShowAuthorName) { $bNeedUserFieldForName = true; } } else { if (AuthorDisplayConstants::AUTHOR_DISPLAY_TYPE_ALIAS_PROVIDED == $oModuleConfiguration->fieldOptionShowAuthorName || (AuthorDisplayConstants::AUTHOR_DISPLAY_TYPE_ALIAS == $oModuleConfiguration->fieldOptionShowAuthorName && !$oUser->IsLoggedIn()) || AuthorDisplayConstants::AUTHOR_DISPLAY_TYPE_FULL_NAME == $oModuleConfiguration->fieldOptionShowAuthorName && !$oUser->IsLoggedIn()) { $bNeedUserFieldForName = true; } } return $bNeedUserFieldForName; }
php
protected function NeedUserFieldForName() { $bNeedUserFieldForName = false; $oUser = TdbDataExtranetUser::GetInstance(); $oModuleConfiguration = $this->GetModuleConfiguration(); if ($oModuleConfiguration->fieldAllowWriteReviewLoggedinUsersOnly) { if (AuthorDisplayConstants::AUTHOR_DISPLAY_TYPE_ALIAS_PROVIDED == $oModuleConfiguration->fieldOptionShowAuthorName) { $bNeedUserFieldForName = true; } } else { if (AuthorDisplayConstants::AUTHOR_DISPLAY_TYPE_ALIAS_PROVIDED == $oModuleConfiguration->fieldOptionShowAuthorName || (AuthorDisplayConstants::AUTHOR_DISPLAY_TYPE_ALIAS == $oModuleConfiguration->fieldOptionShowAuthorName && !$oUser->IsLoggedIn()) || AuthorDisplayConstants::AUTHOR_DISPLAY_TYPE_FULL_NAME == $oModuleConfiguration->fieldOptionShowAuthorName && !$oUser->IsLoggedIn()) { $bNeedUserFieldForName = true; } } return $bNeedUserFieldForName; }
[ "protected", "function", "NeedUserFieldForName", "(", ")", "{", "$", "bNeedUserFieldForName", "=", "false", ";", "$", "oUser", "=", "TdbDataExtranetUser", "::", "GetInstance", "(", ")", ";", "$", "oModuleConfiguration", "=", "$", "this", "->", "GetModuleConfiguration", "(", ")", ";", "if", "(", "$", "oModuleConfiguration", "->", "fieldAllowWriteReviewLoggedinUsersOnly", ")", "{", "if", "(", "AuthorDisplayConstants", "::", "AUTHOR_DISPLAY_TYPE_ALIAS_PROVIDED", "==", "$", "oModuleConfiguration", "->", "fieldOptionShowAuthorName", ")", "{", "$", "bNeedUserFieldForName", "=", "true", ";", "}", "}", "else", "{", "if", "(", "AuthorDisplayConstants", "::", "AUTHOR_DISPLAY_TYPE_ALIAS_PROVIDED", "==", "$", "oModuleConfiguration", "->", "fieldOptionShowAuthorName", "||", "(", "AuthorDisplayConstants", "::", "AUTHOR_DISPLAY_TYPE_ALIAS", "==", "$", "oModuleConfiguration", "->", "fieldOptionShowAuthorName", "&&", "!", "$", "oUser", "->", "IsLoggedIn", "(", ")", ")", "||", "AuthorDisplayConstants", "::", "AUTHOR_DISPLAY_TYPE_FULL_NAME", "==", "$", "oModuleConfiguration", "->", "fieldOptionShowAuthorName", "&&", "!", "$", "oUser", "->", "IsLoggedIn", "(", ")", ")", "{", "$", "bNeedUserFieldForName", "=", "true", ";", "}", "}", "return", "$", "bNeedUserFieldForName", ";", "}" ]
Checks if user have to enter user name manually or user name comes from logged in user. @return bool
[ "Checks", "if", "user", "have", "to", "enter", "user", "name", "manually", "or", "user", "name", "comes", "from", "logged", "in", "user", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php#L875-L891
31,456
chameleon-system/chameleon-shop
src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php
MTPkgShopArticleReviewCore.GetAuthorName
protected function GetAuthorName($sUserPostName = false) { $oModuleConfiguration = $this->GetModuleConfiguration(); $oAuthor = TdbDataExtranetUser::GetInstance(); if ($this->NeedUserFieldForName()) { $sAuthor = $sUserPostName; } else { switch ($oModuleConfiguration->fieldOptionShowAuthorName) { case AuthorDisplayConstants::AUTHOR_DISPLAY_TYPE_FULL_NAME: $sAuthor = $oAuthor->fieldFirstname.' '.$oAuthor->fieldLastname; break; case AuthorDisplayConstants::AUTHOR_DISPLAY_TYPE_INITIALS: $sAuthor = $oAuthor->fieldFirstname.' '.substr($oAuthor->fieldLastname, 0, 1).'.'; break; case AuthorDisplayConstants::AUTHOR_DISPLAY_TYPE_ALIAS: $sAuthor = $oAuthor->fieldAliasName; if (empty($sAuthor)) { $sAuthor = $sUserPostName; } if (0 !== strcmp($sUserPostName, $oAuthor->fieldAliasName) && $oAuthor->IsLoggedIn() && $oAuthor->validateUserAlias($sUserPostName)) { $oAuthor->SaveFieldsFast(array('alias_name' => $sUserPostName)); } break; case AuthorDisplayConstants::AUTHOR_DISPLAY_TYPE_ANONYMOUS: default: $sAuthor = TGlobal::Translate('chameleon_system_shop_article_review.text.anonymous'); break; } } if (empty($sAuthor)) { $sAuthor = TGlobal::Translate('chameleon_system_shop_article_review.text.anonymous'); } return $sAuthor; }
php
protected function GetAuthorName($sUserPostName = false) { $oModuleConfiguration = $this->GetModuleConfiguration(); $oAuthor = TdbDataExtranetUser::GetInstance(); if ($this->NeedUserFieldForName()) { $sAuthor = $sUserPostName; } else { switch ($oModuleConfiguration->fieldOptionShowAuthorName) { case AuthorDisplayConstants::AUTHOR_DISPLAY_TYPE_FULL_NAME: $sAuthor = $oAuthor->fieldFirstname.' '.$oAuthor->fieldLastname; break; case AuthorDisplayConstants::AUTHOR_DISPLAY_TYPE_INITIALS: $sAuthor = $oAuthor->fieldFirstname.' '.substr($oAuthor->fieldLastname, 0, 1).'.'; break; case AuthorDisplayConstants::AUTHOR_DISPLAY_TYPE_ALIAS: $sAuthor = $oAuthor->fieldAliasName; if (empty($sAuthor)) { $sAuthor = $sUserPostName; } if (0 !== strcmp($sUserPostName, $oAuthor->fieldAliasName) && $oAuthor->IsLoggedIn() && $oAuthor->validateUserAlias($sUserPostName)) { $oAuthor->SaveFieldsFast(array('alias_name' => $sUserPostName)); } break; case AuthorDisplayConstants::AUTHOR_DISPLAY_TYPE_ANONYMOUS: default: $sAuthor = TGlobal::Translate('chameleon_system_shop_article_review.text.anonymous'); break; } } if (empty($sAuthor)) { $sAuthor = TGlobal::Translate('chameleon_system_shop_article_review.text.anonymous'); } return $sAuthor; }
[ "protected", "function", "GetAuthorName", "(", "$", "sUserPostName", "=", "false", ")", "{", "$", "oModuleConfiguration", "=", "$", "this", "->", "GetModuleConfiguration", "(", ")", ";", "$", "oAuthor", "=", "TdbDataExtranetUser", "::", "GetInstance", "(", ")", ";", "if", "(", "$", "this", "->", "NeedUserFieldForName", "(", ")", ")", "{", "$", "sAuthor", "=", "$", "sUserPostName", ";", "}", "else", "{", "switch", "(", "$", "oModuleConfiguration", "->", "fieldOptionShowAuthorName", ")", "{", "case", "AuthorDisplayConstants", "::", "AUTHOR_DISPLAY_TYPE_FULL_NAME", ":", "$", "sAuthor", "=", "$", "oAuthor", "->", "fieldFirstname", ".", "' '", ".", "$", "oAuthor", "->", "fieldLastname", ";", "break", ";", "case", "AuthorDisplayConstants", "::", "AUTHOR_DISPLAY_TYPE_INITIALS", ":", "$", "sAuthor", "=", "$", "oAuthor", "->", "fieldFirstname", ".", "' '", ".", "substr", "(", "$", "oAuthor", "->", "fieldLastname", ",", "0", ",", "1", ")", ".", "'.'", ";", "break", ";", "case", "AuthorDisplayConstants", "::", "AUTHOR_DISPLAY_TYPE_ALIAS", ":", "$", "sAuthor", "=", "$", "oAuthor", "->", "fieldAliasName", ";", "if", "(", "empty", "(", "$", "sAuthor", ")", ")", "{", "$", "sAuthor", "=", "$", "sUserPostName", ";", "}", "if", "(", "0", "!==", "strcmp", "(", "$", "sUserPostName", ",", "$", "oAuthor", "->", "fieldAliasName", ")", "&&", "$", "oAuthor", "->", "IsLoggedIn", "(", ")", "&&", "$", "oAuthor", "->", "validateUserAlias", "(", "$", "sUserPostName", ")", ")", "{", "$", "oAuthor", "->", "SaveFieldsFast", "(", "array", "(", "'alias_name'", "=>", "$", "sUserPostName", ")", ")", ";", "}", "break", ";", "case", "AuthorDisplayConstants", "::", "AUTHOR_DISPLAY_TYPE_ANONYMOUS", ":", "default", ":", "$", "sAuthor", "=", "TGlobal", "::", "Translate", "(", "'chameleon_system_shop_article_review.text.anonymous'", ")", ";", "break", ";", "}", "}", "if", "(", "empty", "(", "$", "sAuthor", ")", ")", "{", "$", "sAuthor", "=", "TGlobal", "::", "Translate", "(", "'chameleon_system_shop_article_review.text.anonymous'", ")", ";", "}", "return", "$", "sAuthor", ";", "}" ]
Gets the author name from post data or form logged in user. @param string $sUserPostName @return bool|string
[ "Gets", "the", "author", "name", "from", "post", "data", "or", "form", "logged", "in", "user", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php#L900-L934
31,457
chameleon-system/chameleon-shop
src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php
MTPkgShopArticleReviewCore.GetCaptchaValue
protected function GetCaptchaValue() { $sCaptchaValue = false; if (array_key_exists(self::SESSION_CAPTCHA, $_SESSION)) { $sCaptchaValue = $_SESSION[self::SESSION_CAPTCHA]; } return $sCaptchaValue; }
php
protected function GetCaptchaValue() { $sCaptchaValue = false; if (array_key_exists(self::SESSION_CAPTCHA, $_SESSION)) { $sCaptchaValue = $_SESSION[self::SESSION_CAPTCHA]; } return $sCaptchaValue; }
[ "protected", "function", "GetCaptchaValue", "(", ")", "{", "$", "sCaptchaValue", "=", "false", ";", "if", "(", "array_key_exists", "(", "self", "::", "SESSION_CAPTCHA", ",", "$", "_SESSION", ")", ")", "{", "$", "sCaptchaValue", "=", "$", "_SESSION", "[", "self", "::", "SESSION_CAPTCHA", "]", ";", "}", "return", "$", "sCaptchaValue", ";", "}" ]
gets captcha value fro session. @return bool
[ "gets", "captcha", "value", "fro", "session", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php#L941-L949
31,458
chameleon-system/chameleon-shop
src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php
MTPkgShopArticleReviewCore.GenerateCaptcha
protected function GenerateCaptcha() { $sCaptchaQuestion = false; if ($this->NeedCaptcha()) { $num1 = rand(1, 10); $num2 = rand(1, 10); $val = $num1 + $num2; $_SESSION[self::SESSION_CAPTCHA] = $val; $sCaptchaQuestion = ('Was ergibt '.$num1.' + '.$num2.' ?'); } return $sCaptchaQuestion; }
php
protected function GenerateCaptcha() { $sCaptchaQuestion = false; if ($this->NeedCaptcha()) { $num1 = rand(1, 10); $num2 = rand(1, 10); $val = $num1 + $num2; $_SESSION[self::SESSION_CAPTCHA] = $val; $sCaptchaQuestion = ('Was ergibt '.$num1.' + '.$num2.' ?'); } return $sCaptchaQuestion; }
[ "protected", "function", "GenerateCaptcha", "(", ")", "{", "$", "sCaptchaQuestion", "=", "false", ";", "if", "(", "$", "this", "->", "NeedCaptcha", "(", ")", ")", "{", "$", "num1", "=", "rand", "(", "1", ",", "10", ")", ";", "$", "num2", "=", "rand", "(", "1", ",", "10", ")", ";", "$", "val", "=", "$", "num1", "+", "$", "num2", ";", "$", "_SESSION", "[", "self", "::", "SESSION_CAPTCHA", "]", "=", "$", "val", ";", "$", "sCaptchaQuestion", "=", "(", "'Was ergibt '", ".", "$", "num1", ".", "' + '", ".", "$", "num2", ".", "' ?'", ")", ";", "}", "return", "$", "sCaptchaQuestion", ";", "}" ]
Generates new captcha. @return bool
[ "Generates", "new", "captcha", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/WebModules/MTPkgShopArticleReviewCore/MTPkgShopArticleReviewCore.class.php#L956-L968
31,459
PGB-LIV/php-ms
src/Statistic/FalseDiscoveryRate.php
FalseDiscoveryRate.getScore
public function getScore($targetRate) { $score = 0; foreach ($this->falseDiscoveryRates as $falseDiscoryRate) { if ($falseDiscoryRate['FDR'] < $targetRate) { $score = $falseDiscoryRate['score']; continue; } break; } return $score; }
php
public function getScore($targetRate) { $score = 0; foreach ($this->falseDiscoveryRates as $falseDiscoryRate) { if ($falseDiscoryRate['FDR'] < $targetRate) { $score = $falseDiscoryRate['score']; continue; } break; } return $score; }
[ "public", "function", "getScore", "(", "$", "targetRate", ")", "{", "$", "score", "=", "0", ";", "foreach", "(", "$", "this", "->", "falseDiscoveryRates", "as", "$", "falseDiscoryRate", ")", "{", "if", "(", "$", "falseDiscoryRate", "[", "'FDR'", "]", "<", "$", "targetRate", ")", "{", "$", "score", "=", "$", "falseDiscoryRate", "[", "'score'", "]", ";", "continue", ";", "}", "break", ";", "}", "return", "$", "score", ";", "}" ]
Gets the score that corresponds to the target FDR @param float $targetRate
[ "Gets", "the", "score", "that", "corresponds", "to", "the", "target", "FDR" ]
091751eb12512f4bc6ada07bda745ce49331e24f
https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Statistic/FalseDiscoveryRate.php#L75-L89
31,460
PGB-LIV/php-ms
src/Statistic/FalseDiscoveryRate.php
FalseDiscoveryRate.getMatches
public function getMatches($targetRate) { $matches = 0; foreach ($this->falseDiscoveryRates as $falseDiscoryRate) { if ($falseDiscoryRate['FDR'] <= $targetRate) { $matches ++; continue; } break; } return $matches; }
php
public function getMatches($targetRate) { $matches = 0; foreach ($this->falseDiscoveryRates as $falseDiscoryRate) { if ($falseDiscoryRate['FDR'] <= $targetRate) { $matches ++; continue; } break; } return $matches; }
[ "public", "function", "getMatches", "(", "$", "targetRate", ")", "{", "$", "matches", "=", "0", ";", "foreach", "(", "$", "this", "->", "falseDiscoveryRates", "as", "$", "falseDiscoryRate", ")", "{", "if", "(", "$", "falseDiscoryRate", "[", "'FDR'", "]", "<=", "$", "targetRate", ")", "{", "$", "matches", "++", ";", "continue", ";", "}", "break", ";", "}", "return", "$", "matches", ";", "}" ]
Gets the number of matches for the target FDR @param float $targetRate
[ "Gets", "the", "number", "of", "matches", "for", "the", "target", "FDR" ]
091751eb12512f4bc6ada07bda745ce49331e24f
https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Statistic/FalseDiscoveryRate.php#L96-L109
31,461
chameleon-system/chameleon-shop
src/ShopProductExportBundle/objects/TPkgShopProductExportBaseEndPoint.class.php
TPkgShopProductExportBaseEndPoint.Run
public function Run() { $bSuccess = false; set_time_limit(1800); TCacheManager::SetDisableCaching(true); TCacheManagerRuntimeCache::SetEnableAutoCaching(false); if ($this->Prepare()) { $bSuccess = $this->Perform(); } $this->Cleanup($bSuccess); TCacheManager::SetDisableCaching(false); TCacheManagerRuntimeCache::SetEnableAutoCaching(true); return $bSuccess; }
php
public function Run() { $bSuccess = false; set_time_limit(1800); TCacheManager::SetDisableCaching(true); TCacheManagerRuntimeCache::SetEnableAutoCaching(false); if ($this->Prepare()) { $bSuccess = $this->Perform(); } $this->Cleanup($bSuccess); TCacheManager::SetDisableCaching(false); TCacheManagerRuntimeCache::SetEnableAutoCaching(true); return $bSuccess; }
[ "public", "function", "Run", "(", ")", "{", "$", "bSuccess", "=", "false", ";", "set_time_limit", "(", "1800", ")", ";", "TCacheManager", "::", "SetDisableCaching", "(", "true", ")", ";", "TCacheManagerRuntimeCache", "::", "SetEnableAutoCaching", "(", "false", ")", ";", "if", "(", "$", "this", "->", "Prepare", "(", ")", ")", "{", "$", "bSuccess", "=", "$", "this", "->", "Perform", "(", ")", ";", "}", "$", "this", "->", "Cleanup", "(", "$", "bSuccess", ")", ";", "TCacheManager", "::", "SetDisableCaching", "(", "false", ")", ";", "TCacheManagerRuntimeCache", "::", "SetEnableAutoCaching", "(", "true", ")", ";", "return", "$", "bSuccess", ";", "}" ]
Run the export. returns true if the export was successful, otherwise false this method should not be overwritten in child classes. @return bool
[ "Run", "the", "export", ".", "returns", "true", "if", "the", "export", "was", "successful", "otherwise", "false", "this", "method", "should", "not", "be", "overwritten", "in", "child", "classes", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopProductExportBundle/objects/TPkgShopProductExportBaseEndPoint.class.php#L85-L100
31,462
chameleon-system/chameleon-shop
src/ShopProductExportBundle/objects/TPkgShopProductExportBaseEndPoint.class.php
TPkgShopProductExportBaseEndPoint.Perform
protected function Perform() { $bSuccess = true; $this->PreArticleListHandling(); $this->HandleArticleList(); $this->PostArticleListHandling(); return $bSuccess; }
php
protected function Perform() { $bSuccess = true; $this->PreArticleListHandling(); $this->HandleArticleList(); $this->PostArticleListHandling(); return $bSuccess; }
[ "protected", "function", "Perform", "(", ")", "{", "$", "bSuccess", "=", "true", ";", "$", "this", "->", "PreArticleListHandling", "(", ")", ";", "$", "this", "->", "HandleArticleList", "(", ")", ";", "$", "this", "->", "PostArticleListHandling", "(", ")", ";", "return", "$", "bSuccess", ";", "}" ]
perform the actual export work. return true if the export was successful, otherwise false. @return bool
[ "perform", "the", "actual", "export", "work", ".", "return", "true", "if", "the", "export", "was", "successful", "otherwise", "false", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopProductExportBundle/objects/TPkgShopProductExportBaseEndPoint.class.php#L138-L147
31,463
chameleon-system/chameleon-shop
src/ShopProductExportBundle/objects/TPkgShopProductExportBaseEndPoint.class.php
TPkgShopProductExportBaseEndPoint.getAttributeName
public function getAttributeName($sIdentifier) { static $aAttributesForSystemNames = null; static $aAttributesForIds = null; if (null === $aAttributesForSystemNames && null === $aAttributesForIds) { $oAttributesList = TdbShopAttributeList::GetList(); while ($oAttribute = &$oAttributesList->Next()) { $sName = $oAttribute->GetName(); $aAttributesForSystemNames[$oAttribute->fieldSystemName] = $sName; $aAttributesForIds[$oAttribute->id] = $sName; } } if (isset($aAttributesForSystemNames[$sIdentifier])) { return $aAttributesForSystemNames[$sIdentifier]; } elseif (isset($aAttributesForIds[$sIdentifier])) { return $aAttributesForIds[$sIdentifier]; } else { return ''; } }
php
public function getAttributeName($sIdentifier) { static $aAttributesForSystemNames = null; static $aAttributesForIds = null; if (null === $aAttributesForSystemNames && null === $aAttributesForIds) { $oAttributesList = TdbShopAttributeList::GetList(); while ($oAttribute = &$oAttributesList->Next()) { $sName = $oAttribute->GetName(); $aAttributesForSystemNames[$oAttribute->fieldSystemName] = $sName; $aAttributesForIds[$oAttribute->id] = $sName; } } if (isset($aAttributesForSystemNames[$sIdentifier])) { return $aAttributesForSystemNames[$sIdentifier]; } elseif (isset($aAttributesForIds[$sIdentifier])) { return $aAttributesForIds[$sIdentifier]; } else { return ''; } }
[ "public", "function", "getAttributeName", "(", "$", "sIdentifier", ")", "{", "static", "$", "aAttributesForSystemNames", "=", "null", ";", "static", "$", "aAttributesForIds", "=", "null", ";", "if", "(", "null", "===", "$", "aAttributesForSystemNames", "&&", "null", "===", "$", "aAttributesForIds", ")", "{", "$", "oAttributesList", "=", "TdbShopAttributeList", "::", "GetList", "(", ")", ";", "while", "(", "$", "oAttribute", "=", "&", "$", "oAttributesList", "->", "Next", "(", ")", ")", "{", "$", "sName", "=", "$", "oAttribute", "->", "GetName", "(", ")", ";", "$", "aAttributesForSystemNames", "[", "$", "oAttribute", "->", "fieldSystemName", "]", "=", "$", "sName", ";", "$", "aAttributesForIds", "[", "$", "oAttribute", "->", "id", "]", "=", "$", "sName", ";", "}", "}", "if", "(", "isset", "(", "$", "aAttributesForSystemNames", "[", "$", "sIdentifier", "]", ")", ")", "{", "return", "$", "aAttributesForSystemNames", "[", "$", "sIdentifier", "]", ";", "}", "elseif", "(", "isset", "(", "$", "aAttributesForIds", "[", "$", "sIdentifier", "]", ")", ")", "{", "return", "$", "aAttributesForIds", "[", "$", "sIdentifier", "]", ";", "}", "else", "{", "return", "''", ";", "}", "}" ]
load attribute by system_name field and return the name. @param string $sIdentifier @return string
[ "load", "attribute", "by", "system_name", "field", "and", "return", "the", "name", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopProductExportBundle/objects/TPkgShopProductExportBaseEndPoint.class.php#L241-L260
31,464
chameleon-system/chameleon-shop
src/ShopProductExportBundle/objects/TPkgShopProductExportBaseEndPoint.class.php
TPkgShopProductExportBaseEndPoint.GetArticleAttributeValueListForAttributeNames
public function GetArticleAttributeValueListForAttributeNames( &$oArticle, $aAttributeNames, $sFieldName = 'system_name' ) { $aList = array(); foreach ($aAttributeNames as $sAttributeName) { $aList[$sAttributeName] = $this->GetArticleAttributeValueForAttributeName( $oArticle, $sAttributeName, $sFieldName, false ); } return $aList; }
php
public function GetArticleAttributeValueListForAttributeNames( &$oArticle, $aAttributeNames, $sFieldName = 'system_name' ) { $aList = array(); foreach ($aAttributeNames as $sAttributeName) { $aList[$sAttributeName] = $this->GetArticleAttributeValueForAttributeName( $oArticle, $sAttributeName, $sFieldName, false ); } return $aList; }
[ "public", "function", "GetArticleAttributeValueListForAttributeNames", "(", "&", "$", "oArticle", ",", "$", "aAttributeNames", ",", "$", "sFieldName", "=", "'system_name'", ")", "{", "$", "aList", "=", "array", "(", ")", ";", "foreach", "(", "$", "aAttributeNames", "as", "$", "sAttributeName", ")", "{", "$", "aList", "[", "$", "sAttributeName", "]", "=", "$", "this", "->", "GetArticleAttributeValueForAttributeName", "(", "$", "oArticle", ",", "$", "sAttributeName", ",", "$", "sFieldName", ",", "false", ")", ";", "}", "return", "$", "aList", ";", "}" ]
returns an array with a nested array of values for each requested attribute. @param TdbShopArticle $oArticle @param array $aAttributeNames @param string $sFieldName @return array|null
[ "returns", "an", "array", "with", "a", "nested", "array", "of", "values", "for", "each", "requested", "attribute", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopProductExportBundle/objects/TPkgShopProductExportBaseEndPoint.class.php#L271-L287
31,465
chameleon-system/chameleon-shop
src/ShopProductExportBundle/objects/TPkgShopProductExportBaseEndPoint.class.php
TPkgShopProductExportBaseEndPoint.getArticleImageLink
protected function getArticleImageLink(&$oArticle, $iWidth = null) { $sLink = ''; $oArticleImage = $oArticle->GetPrimaryImage(); if (null !== $oArticleImage) { $oImage = $oArticleImage->GetImage(0, 'cms_media_id'); if (null !== $oImage) { if (is_int($iWidth) && $iWidth > 0) { $oThumbnail = $oImage->GetThumbnail($iWidth, 1000); $sLink = $oThumbnail->GetFullURL(); } else { $sLink = $oImage->GetFullURL(); } } } return $sLink; }
php
protected function getArticleImageLink(&$oArticle, $iWidth = null) { $sLink = ''; $oArticleImage = $oArticle->GetPrimaryImage(); if (null !== $oArticleImage) { $oImage = $oArticleImage->GetImage(0, 'cms_media_id'); if (null !== $oImage) { if (is_int($iWidth) && $iWidth > 0) { $oThumbnail = $oImage->GetThumbnail($iWidth, 1000); $sLink = $oThumbnail->GetFullURL(); } else { $sLink = $oImage->GetFullURL(); } } } return $sLink; }
[ "protected", "function", "getArticleImageLink", "(", "&", "$", "oArticle", ",", "$", "iWidth", "=", "null", ")", "{", "$", "sLink", "=", "''", ";", "$", "oArticleImage", "=", "$", "oArticle", "->", "GetPrimaryImage", "(", ")", ";", "if", "(", "null", "!==", "$", "oArticleImage", ")", "{", "$", "oImage", "=", "$", "oArticleImage", "->", "GetImage", "(", "0", ",", "'cms_media_id'", ")", ";", "if", "(", "null", "!==", "$", "oImage", ")", "{", "if", "(", "is_int", "(", "$", "iWidth", ")", "&&", "$", "iWidth", ">", "0", ")", "{", "$", "oThumbnail", "=", "$", "oImage", "->", "GetThumbnail", "(", "$", "iWidth", ",", "1000", ")", ";", "$", "sLink", "=", "$", "oThumbnail", "->", "GetFullURL", "(", ")", ";", "}", "else", "{", "$", "sLink", "=", "$", "oImage", "->", "GetFullURL", "(", ")", ";", "}", "}", "}", "return", "$", "sLink", ";", "}" ]
returns the link to the article image you can set iWidth to get thumbnail links. @param int|null $iWidth @param TdbShopArticle $oArticle @return string
[ "returns", "the", "link", "to", "the", "article", "image", "you", "can", "set", "iWidth", "to", "get", "thumbnail", "links", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopProductExportBundle/objects/TPkgShopProductExportBaseEndPoint.class.php#L393-L410
31,466
chameleon-system/chameleon-shop
src/ShopProductExportBundle/objects/TPkgShopProductExportBaseEndPoint.class.php
TPkgShopProductExportBaseEndPoint.GetTmpCacheFileFromCacheFileName
public static function GetTmpCacheFileFromCacheFileName($sCacheFileName) { $sCacheTmpFileName = false; $aFileInfo = pathinfo($sCacheFileName); if (is_array($aFileInfo) && isset($aFileInfo['filename'])) { $sCacheTmpFileName = 'generate_tmp_'.$aFileInfo['filename']; $sCacheTmpFileName = str_replace($aFileInfo['filename'], $sCacheTmpFileName, $sCacheFileName); } return $sCacheTmpFileName; }
php
public static function GetTmpCacheFileFromCacheFileName($sCacheFileName) { $sCacheTmpFileName = false; $aFileInfo = pathinfo($sCacheFileName); if (is_array($aFileInfo) && isset($aFileInfo['filename'])) { $sCacheTmpFileName = 'generate_tmp_'.$aFileInfo['filename']; $sCacheTmpFileName = str_replace($aFileInfo['filename'], $sCacheTmpFileName, $sCacheFileName); } return $sCacheTmpFileName; }
[ "public", "static", "function", "GetTmpCacheFileFromCacheFileName", "(", "$", "sCacheFileName", ")", "{", "$", "sCacheTmpFileName", "=", "false", ";", "$", "aFileInfo", "=", "pathinfo", "(", "$", "sCacheFileName", ")", ";", "if", "(", "is_array", "(", "$", "aFileInfo", ")", "&&", "isset", "(", "$", "aFileInfo", "[", "'filename'", "]", ")", ")", "{", "$", "sCacheTmpFileName", "=", "'generate_tmp_'", ".", "$", "aFileInfo", "[", "'filename'", "]", ";", "$", "sCacheTmpFileName", "=", "str_replace", "(", "$", "aFileInfo", "[", "'filename'", "]", ",", "$", "sCacheTmpFileName", ",", "$", "sCacheFileName", ")", ";", "}", "return", "$", "sCacheTmpFileName", ";", "}" ]
Returns tmp cache file name generated from cache file name. @static @param string $sCacheFileName @return bool|mixed|string
[ "Returns", "tmp", "cache", "file", "name", "generated", "from", "cache", "file", "name", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopProductExportBundle/objects/TPkgShopProductExportBaseEndPoint.class.php#L537-L547
31,467
chameleon-system/chameleon-shop
src/ShopProductExportBundle/objects/TPkgShopProductExportBaseEndPoint.class.php
TPkgShopProductExportBaseEndPoint.getAvailablePaymentList
protected function getAvailablePaymentList() { static $oPaymentList = null; if (null === $oPaymentList) { $sQuery = "SELECT * FROM `shop_payment_method` WHERE `shop_payment_method`.`active` = '1'"; $oPaymentList = TdbShopPaymentMethodList::GetList($sQuery); } return $oPaymentList; }
php
protected function getAvailablePaymentList() { static $oPaymentList = null; if (null === $oPaymentList) { $sQuery = "SELECT * FROM `shop_payment_method` WHERE `shop_payment_method`.`active` = '1'"; $oPaymentList = TdbShopPaymentMethodList::GetList($sQuery); } return $oPaymentList; }
[ "protected", "function", "getAvailablePaymentList", "(", ")", "{", "static", "$", "oPaymentList", "=", "null", ";", "if", "(", "null", "===", "$", "oPaymentList", ")", "{", "$", "sQuery", "=", "\"SELECT * FROM `shop_payment_method` WHERE `shop_payment_method`.`active` = '1'\"", ";", "$", "oPaymentList", "=", "TdbShopPaymentMethodList", "::", "GetList", "(", "$", "sQuery", ")", ";", "}", "return", "$", "oPaymentList", ";", "}" ]
loads list of available payment methods. @return TdbShopPaymentMethodList|null
[ "loads", "list", "of", "available", "payment", "methods", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopProductExportBundle/objects/TPkgShopProductExportBaseEndPoint.class.php#L575-L585
31,468
chameleon-system/chameleon-shop
src/ShopProductExportBundle/objects/TPkgShopProductExportBaseEndPoint.class.php
TPkgShopProductExportBaseEndPoint.getAvailablePaymentListAsString
protected function getAvailablePaymentListAsString() { static $sPaymentMethods = null; if (null === $sPaymentMethods) { $sPaymentMethods = ''; $oPaymentList = $this->getAvailablePaymentList(); if (null !== $oPaymentList) { if ($oPaymentList->Length() > 0) { while ($oPaymentMethod = $oPaymentList->Next()) { if ('' != $sPaymentMethods) { $sPaymentMethods .= ', '; } $sPaymentMethods .= $oPaymentMethod->GetName(); } } } } if (!is_string($sPaymentMethods)) { $sPaymentMethods = ''; } return $sPaymentMethods; }
php
protected function getAvailablePaymentListAsString() { static $sPaymentMethods = null; if (null === $sPaymentMethods) { $sPaymentMethods = ''; $oPaymentList = $this->getAvailablePaymentList(); if (null !== $oPaymentList) { if ($oPaymentList->Length() > 0) { while ($oPaymentMethod = $oPaymentList->Next()) { if ('' != $sPaymentMethods) { $sPaymentMethods .= ', '; } $sPaymentMethods .= $oPaymentMethod->GetName(); } } } } if (!is_string($sPaymentMethods)) { $sPaymentMethods = ''; } return $sPaymentMethods; }
[ "protected", "function", "getAvailablePaymentListAsString", "(", ")", "{", "static", "$", "sPaymentMethods", "=", "null", ";", "if", "(", "null", "===", "$", "sPaymentMethods", ")", "{", "$", "sPaymentMethods", "=", "''", ";", "$", "oPaymentList", "=", "$", "this", "->", "getAvailablePaymentList", "(", ")", ";", "if", "(", "null", "!==", "$", "oPaymentList", ")", "{", "if", "(", "$", "oPaymentList", "->", "Length", "(", ")", ">", "0", ")", "{", "while", "(", "$", "oPaymentMethod", "=", "$", "oPaymentList", "->", "Next", "(", ")", ")", "{", "if", "(", "''", "!=", "$", "sPaymentMethods", ")", "{", "$", "sPaymentMethods", ".=", "', '", ";", "}", "$", "sPaymentMethods", ".=", "$", "oPaymentMethod", "->", "GetName", "(", ")", ";", "}", "}", "}", "}", "if", "(", "!", "is_string", "(", "$", "sPaymentMethods", ")", ")", "{", "$", "sPaymentMethods", "=", "''", ";", "}", "return", "$", "sPaymentMethods", ";", "}" ]
returns comma separated string of payment methods. @return string
[ "returns", "comma", "separated", "string", "of", "payment", "methods", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopProductExportBundle/objects/TPkgShopProductExportBaseEndPoint.class.php#L592-L616
31,469
chameleon-system/chameleon-shop
src/ShopBundle/objects/TCMSFields/TCMSFieldShopVariantDetails.class.php
TCMSFieldShopVariantDetails.RenderVariantDetails
protected function RenderVariantDetails($sViewName, $aCallTimeVars = array()) { $oView = new TViewParser(); $aActivatedIds = $this->oTableRow->GetMLTIdList('shop_variant_type_value', 'shop_variant_type_value_mlt'); $oView->AddVar('aActivatedIds', $aActivatedIds); $oView->AddVar('oField', $this); $oView->AddVarArray($aCallTimeVars); return $oView->RenderObjectView($sViewName, 'TCMSFields/TCMSFieldShopVariantDetails', 'Core'); }
php
protected function RenderVariantDetails($sViewName, $aCallTimeVars = array()) { $oView = new TViewParser(); $aActivatedIds = $this->oTableRow->GetMLTIdList('shop_variant_type_value', 'shop_variant_type_value_mlt'); $oView->AddVar('aActivatedIds', $aActivatedIds); $oView->AddVar('oField', $this); $oView->AddVarArray($aCallTimeVars); return $oView->RenderObjectView($sViewName, 'TCMSFields/TCMSFieldShopVariantDetails', 'Core'); }
[ "protected", "function", "RenderVariantDetails", "(", "$", "sViewName", ",", "$", "aCallTimeVars", "=", "array", "(", ")", ")", "{", "$", "oView", "=", "new", "TViewParser", "(", ")", ";", "$", "aActivatedIds", "=", "$", "this", "->", "oTableRow", "->", "GetMLTIdList", "(", "'shop_variant_type_value'", ",", "'shop_variant_type_value_mlt'", ")", ";", "$", "oView", "->", "AddVar", "(", "'aActivatedIds'", ",", "$", "aActivatedIds", ")", ";", "$", "oView", "->", "AddVar", "(", "'oField'", ",", "$", "this", ")", ";", "$", "oView", "->", "AddVarArray", "(", "$", "aCallTimeVars", ")", ";", "return", "$", "oView", "->", "RenderObjectView", "(", "$", "sViewName", ",", "'TCMSFields/TCMSFieldShopVariantDetails'", ",", "'Core'", ")", ";", "}" ]
render field details. @param string $sViewName @param array $aCallTimeVars @return string
[ "render", "field", "details", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TCMSFields/TCMSFieldShopVariantDetails.class.php#L107-L116
31,470
chameleon-system/chameleon-shop
src/ShopBundle/objects/TCMSFields/TCMSFieldShopVariantDetails.class.php
TCMSFieldShopVariantDetails.GetSQL
public function GetSQL() { /** * @var array $aNewValues */ $aNewValues = $this->getInputFilterUtil()->getFilteredInput($this->name.'_new'); if (!is_array($this->data)) { $this->data = array(); } elseif (array_key_exists('x', $this->data)) { unset($this->data['x']); } $oEditorObjectConf = TdbCmsTblConf::GetNewInstance(); $oEditorObjectConf->LoadFromField('name', 'shop_variant_type_value'); if (!is_array($aNewValues)) { return false; } foreach ($aNewValues as $sShopVariantTypeId => $sNewValueName) { $sNewValueName = trim($sNewValueName); if (!empty($sNewValueName)) { // first make sure the value does not exist already $oValue = TdbShopVariantTypeValue::GetNewInstance(); if ($oValue->LoadFromFields( array('name' => $sNewValueName, 'shop_variant_type_id' => $sShopVariantTypeId) ) ) { $this->data[$sShopVariantTypeId] = $oValue->id; } else { // need to create entry $aNewItemData = array( 'shop_variant_type_id' => $sShopVariantTypeId, 'name' => $sNewValueName, 'url_name' => $this->getUrlNormalizationUtil()->normalizeUrl($sNewValueName), ); $oTableManager = new TCMSTableEditorManager(); $oTableManager->Init($oEditorObjectConf->id); $oTableManager->Save($aNewItemData); $this->data[$sShopVariantTypeId] = $oTableManager->sId; } } } // now save connecting records.... we can use the parent method return parent::GetSQL(); }
php
public function GetSQL() { /** * @var array $aNewValues */ $aNewValues = $this->getInputFilterUtil()->getFilteredInput($this->name.'_new'); if (!is_array($this->data)) { $this->data = array(); } elseif (array_key_exists('x', $this->data)) { unset($this->data['x']); } $oEditorObjectConf = TdbCmsTblConf::GetNewInstance(); $oEditorObjectConf->LoadFromField('name', 'shop_variant_type_value'); if (!is_array($aNewValues)) { return false; } foreach ($aNewValues as $sShopVariantTypeId => $sNewValueName) { $sNewValueName = trim($sNewValueName); if (!empty($sNewValueName)) { // first make sure the value does not exist already $oValue = TdbShopVariantTypeValue::GetNewInstance(); if ($oValue->LoadFromFields( array('name' => $sNewValueName, 'shop_variant_type_id' => $sShopVariantTypeId) ) ) { $this->data[$sShopVariantTypeId] = $oValue->id; } else { // need to create entry $aNewItemData = array( 'shop_variant_type_id' => $sShopVariantTypeId, 'name' => $sNewValueName, 'url_name' => $this->getUrlNormalizationUtil()->normalizeUrl($sNewValueName), ); $oTableManager = new TCMSTableEditorManager(); $oTableManager->Init($oEditorObjectConf->id); $oTableManager->Save($aNewItemData); $this->data[$sShopVariantTypeId] = $oTableManager->sId; } } } // now save connecting records.... we can use the parent method return parent::GetSQL(); }
[ "public", "function", "GetSQL", "(", ")", "{", "/**\n * @var array $aNewValues\n */", "$", "aNewValues", "=", "$", "this", "->", "getInputFilterUtil", "(", ")", "->", "getFilteredInput", "(", "$", "this", "->", "name", ".", "'_new'", ")", ";", "if", "(", "!", "is_array", "(", "$", "this", "->", "data", ")", ")", "{", "$", "this", "->", "data", "=", "array", "(", ")", ";", "}", "elseif", "(", "array_key_exists", "(", "'x'", ",", "$", "this", "->", "data", ")", ")", "{", "unset", "(", "$", "this", "->", "data", "[", "'x'", "]", ")", ";", "}", "$", "oEditorObjectConf", "=", "TdbCmsTblConf", "::", "GetNewInstance", "(", ")", ";", "$", "oEditorObjectConf", "->", "LoadFromField", "(", "'name'", ",", "'shop_variant_type_value'", ")", ";", "if", "(", "!", "is_array", "(", "$", "aNewValues", ")", ")", "{", "return", "false", ";", "}", "foreach", "(", "$", "aNewValues", "as", "$", "sShopVariantTypeId", "=>", "$", "sNewValueName", ")", "{", "$", "sNewValueName", "=", "trim", "(", "$", "sNewValueName", ")", ";", "if", "(", "!", "empty", "(", "$", "sNewValueName", ")", ")", "{", "// first make sure the value does not exist already", "$", "oValue", "=", "TdbShopVariantTypeValue", "::", "GetNewInstance", "(", ")", ";", "if", "(", "$", "oValue", "->", "LoadFromFields", "(", "array", "(", "'name'", "=>", "$", "sNewValueName", ",", "'shop_variant_type_id'", "=>", "$", "sShopVariantTypeId", ")", ")", ")", "{", "$", "this", "->", "data", "[", "$", "sShopVariantTypeId", "]", "=", "$", "oValue", "->", "id", ";", "}", "else", "{", "// need to create entry", "$", "aNewItemData", "=", "array", "(", "'shop_variant_type_id'", "=>", "$", "sShopVariantTypeId", ",", "'name'", "=>", "$", "sNewValueName", ",", "'url_name'", "=>", "$", "this", "->", "getUrlNormalizationUtil", "(", ")", "->", "normalizeUrl", "(", "$", "sNewValueName", ")", ",", ")", ";", "$", "oTableManager", "=", "new", "TCMSTableEditorManager", "(", ")", ";", "$", "oTableManager", "->", "Init", "(", "$", "oEditorObjectConf", "->", "id", ")", ";", "$", "oTableManager", "->", "Save", "(", "$", "aNewItemData", ")", ";", "$", "this", "->", "data", "[", "$", "sShopVariantTypeId", "]", "=", "$", "oTableManager", "->", "sId", ";", "}", "}", "}", "// now save connecting records.... we can use the parent method", "return", "parent", "::", "GetSQL", "(", ")", ";", "}" ]
overwrites sql method to ensure that the connecting mlt is filled properly. {@inheritdoc}
[ "overwrites", "sql", "method", "to", "ensure", "that", "the", "connecting", "mlt", "is", "filled", "properly", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TCMSFields/TCMSFieldShopVariantDetails.class.php#L160-L207
31,471
chameleon-system/chameleon-shop
src/ShopBundle/objects/TCMSFields/TCMSFieldShopVariantDetails.class.php
TCMSFieldShopVariantDetails.generateVariants
public function generateVariants() { /** * @var array|null $aVariantParameters */ $aVariantParameters = $this->getInputFilterUtil()->getFilteredInput('variantParameters'); if (null === $aVariantParameters) { return ''; } foreach ($aVariantParameters as $aVariant) { $oTableEditorManager = new TCMSTableEditorManager(); $oTableEditorManager->sRestrictionField = 'variant_parent_id'; $oTableEditorManager->sRestriction = $this->oTableRow->id; $oTableEditorManager->Init($this->oDefinition->fieldCmsTblConfId, $this->oTableRow->id); $oTableEditorManager->AllowEditByAll(true); $oTableEditorManager->Insert(); $oTableEditorManager->oTableEditor->SaveFields($this->mapVariantArticleData($aVariant)); foreach ($aVariant['variantIDs'] as $sVariantID) { $oTableEditorManager->AddMLTConnection($this->name, $sVariantID); } $nameList = $this->getProductVariantNameGenerator()->generateNamesForAllLanguages($oTableEditorManager->oTableEditor->oTable); $originalLanguageId = $oTableEditorManager->oTableEditor->oTableConf->GetLanguage(); foreach ($nameList as $languageId => $name) { $oTableEditorManager->oTableEditor->oTableConf->SetLanguage($languageId); $oTableEditorManager->SaveField('name_variant_info', $name); } $oTableEditorManager->oTableEditor->oTableConf->SetLanguage($originalLanguageId); } return TGlobal::Translate('chameleon_system_shop.field_shop_variant_details.msg_created_variants', array('%generatedVariantsCount%' => count($aVariantParameters))); }
php
public function generateVariants() { /** * @var array|null $aVariantParameters */ $aVariantParameters = $this->getInputFilterUtil()->getFilteredInput('variantParameters'); if (null === $aVariantParameters) { return ''; } foreach ($aVariantParameters as $aVariant) { $oTableEditorManager = new TCMSTableEditorManager(); $oTableEditorManager->sRestrictionField = 'variant_parent_id'; $oTableEditorManager->sRestriction = $this->oTableRow->id; $oTableEditorManager->Init($this->oDefinition->fieldCmsTblConfId, $this->oTableRow->id); $oTableEditorManager->AllowEditByAll(true); $oTableEditorManager->Insert(); $oTableEditorManager->oTableEditor->SaveFields($this->mapVariantArticleData($aVariant)); foreach ($aVariant['variantIDs'] as $sVariantID) { $oTableEditorManager->AddMLTConnection($this->name, $sVariantID); } $nameList = $this->getProductVariantNameGenerator()->generateNamesForAllLanguages($oTableEditorManager->oTableEditor->oTable); $originalLanguageId = $oTableEditorManager->oTableEditor->oTableConf->GetLanguage(); foreach ($nameList as $languageId => $name) { $oTableEditorManager->oTableEditor->oTableConf->SetLanguage($languageId); $oTableEditorManager->SaveField('name_variant_info', $name); } $oTableEditorManager->oTableEditor->oTableConf->SetLanguage($originalLanguageId); } return TGlobal::Translate('chameleon_system_shop.field_shop_variant_details.msg_created_variants', array('%generatedVariantsCount%' => count($aVariantParameters))); }
[ "public", "function", "generateVariants", "(", ")", "{", "/**\n * @var array|null $aVariantParameters\n */", "$", "aVariantParameters", "=", "$", "this", "->", "getInputFilterUtil", "(", ")", "->", "getFilteredInput", "(", "'variantParameters'", ")", ";", "if", "(", "null", "===", "$", "aVariantParameters", ")", "{", "return", "''", ";", "}", "foreach", "(", "$", "aVariantParameters", "as", "$", "aVariant", ")", "{", "$", "oTableEditorManager", "=", "new", "TCMSTableEditorManager", "(", ")", ";", "$", "oTableEditorManager", "->", "sRestrictionField", "=", "'variant_parent_id'", ";", "$", "oTableEditorManager", "->", "sRestriction", "=", "$", "this", "->", "oTableRow", "->", "id", ";", "$", "oTableEditorManager", "->", "Init", "(", "$", "this", "->", "oDefinition", "->", "fieldCmsTblConfId", ",", "$", "this", "->", "oTableRow", "->", "id", ")", ";", "$", "oTableEditorManager", "->", "AllowEditByAll", "(", "true", ")", ";", "$", "oTableEditorManager", "->", "Insert", "(", ")", ";", "$", "oTableEditorManager", "->", "oTableEditor", "->", "SaveFields", "(", "$", "this", "->", "mapVariantArticleData", "(", "$", "aVariant", ")", ")", ";", "foreach", "(", "$", "aVariant", "[", "'variantIDs'", "]", "as", "$", "sVariantID", ")", "{", "$", "oTableEditorManager", "->", "AddMLTConnection", "(", "$", "this", "->", "name", ",", "$", "sVariantID", ")", ";", "}", "$", "nameList", "=", "$", "this", "->", "getProductVariantNameGenerator", "(", ")", "->", "generateNamesForAllLanguages", "(", "$", "oTableEditorManager", "->", "oTableEditor", "->", "oTable", ")", ";", "$", "originalLanguageId", "=", "$", "oTableEditorManager", "->", "oTableEditor", "->", "oTableConf", "->", "GetLanguage", "(", ")", ";", "foreach", "(", "$", "nameList", "as", "$", "languageId", "=>", "$", "name", ")", "{", "$", "oTableEditorManager", "->", "oTableEditor", "->", "oTableConf", "->", "SetLanguage", "(", "$", "languageId", ")", ";", "$", "oTableEditorManager", "->", "SaveField", "(", "'name_variant_info'", ",", "$", "name", ")", ";", "}", "$", "oTableEditorManager", "->", "oTableEditor", "->", "oTableConf", "->", "SetLanguage", "(", "$", "originalLanguageId", ")", ";", "}", "return", "TGlobal", "::", "Translate", "(", "'chameleon_system_shop.field_shop_variant_details.msg_created_variants'", ",", "array", "(", "'%generatedVariantsCount%'", "=>", "count", "(", "$", "aVariantParameters", ")", ")", ")", ";", "}" ]
called via ajax generates all variants that where checked in the field matrix. @return string
[ "called", "via", "ajax", "generates", "all", "variants", "that", "where", "checked", "in", "the", "field", "matrix", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TCMSFields/TCMSFieldShopVariantDetails.class.php#L215-L248
31,472
chameleon-system/chameleon-shop
src/ShopBundle/objects/TCMSTableEditor/TCMSTableEditorShopCategory.class.php
TCMSTableEditorShopCategory.UpdateInheritableProperties
protected function UpdateInheritableProperties($oOwningCategory, $oCategory) { $activeValue = '1'; if (false === $oOwningCategory->fieldActive || false === $oCategory->parentCategoriesAreActive()) { $activeValue = '0'; } $oTableEditor = TTools::GetTableEditorManager($this->oTableConf->fieldName, $oCategory->id); $oTableEditor->AllowEditByAll($this->bAllowEditByAll); $oTableEditor->SaveField('tree_active', $activeValue, false); }
php
protected function UpdateInheritableProperties($oOwningCategory, $oCategory) { $activeValue = '1'; if (false === $oOwningCategory->fieldActive || false === $oCategory->parentCategoriesAreActive()) { $activeValue = '0'; } $oTableEditor = TTools::GetTableEditorManager($this->oTableConf->fieldName, $oCategory->id); $oTableEditor->AllowEditByAll($this->bAllowEditByAll); $oTableEditor->SaveField('tree_active', $activeValue, false); }
[ "protected", "function", "UpdateInheritableProperties", "(", "$", "oOwningCategory", ",", "$", "oCategory", ")", "{", "$", "activeValue", "=", "'1'", ";", "if", "(", "false", "===", "$", "oOwningCategory", "->", "fieldActive", "||", "false", "===", "$", "oCategory", "->", "parentCategoriesAreActive", "(", ")", ")", "{", "$", "activeValue", "=", "'0'", ";", "}", "$", "oTableEditor", "=", "TTools", "::", "GetTableEditorManager", "(", "$", "this", "->", "oTableConf", "->", "fieldName", ",", "$", "oCategory", "->", "id", ")", ";", "$", "oTableEditor", "->", "AllowEditByAll", "(", "$", "this", "->", "bAllowEditByAll", ")", ";", "$", "oTableEditor", "->", "SaveField", "(", "'tree_active'", ",", "$", "activeValue", ",", "false", ")", ";", "}" ]
update recursive properties in oCategory based on oOwningCategory. @param TdbShopCategory $oOwningCategory @param TdbShopCategory $oCategory
[ "update", "recursive", "properties", "in", "oCategory", "based", "on", "oOwningCategory", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TCMSTableEditor/TCMSTableEditorShopCategory.class.php#L51-L60
31,473
chameleon-system/chameleon-shop
src/ShopBundle/objects/TCMSTableEditor/TCMSTableEditorShopCategory.class.php
TCMSTableEditorShopCategory.UpdatePageNaviBreadCrumb
public function UpdatePageNaviBreadCrumb() { $sEditLanguage = $this->oTableConf->GetLanguage(); $breadcrumbs = self::GetNavigationBreadCrumbs($this->sId, $sEditLanguage); $this->SaveField('url_path', $breadcrumbs); // now we also need to update all children of this category... $oCategory = TdbShopCategory::GetNewInstance(); $oCategory->SetLanguage($sEditLanguage); /** @var $oCategory TdbShopCategory */ if (!$oCategory->Load($this->sId)) { $oCategory = null; } else { $oChildren = &$oCategory->GetChildren(); while ($oChild = $oChildren->Next()) { $oEditor = new TCMSTableEditorManager(); /** @var $oEditor TCMSTableEditorManager */ $oEditor->Init($this->oTableConf->id, $oChild->id, $sEditLanguage); $oEditor->AllowEditByAll($this->bAllowEditByAll); $oEditor->SaveField('name', $oChild->fieldName, true); } } }
php
public function UpdatePageNaviBreadCrumb() { $sEditLanguage = $this->oTableConf->GetLanguage(); $breadcrumbs = self::GetNavigationBreadCrumbs($this->sId, $sEditLanguage); $this->SaveField('url_path', $breadcrumbs); // now we also need to update all children of this category... $oCategory = TdbShopCategory::GetNewInstance(); $oCategory->SetLanguage($sEditLanguage); /** @var $oCategory TdbShopCategory */ if (!$oCategory->Load($this->sId)) { $oCategory = null; } else { $oChildren = &$oCategory->GetChildren(); while ($oChild = $oChildren->Next()) { $oEditor = new TCMSTableEditorManager(); /** @var $oEditor TCMSTableEditorManager */ $oEditor->Init($this->oTableConf->id, $oChild->id, $sEditLanguage); $oEditor->AllowEditByAll($this->bAllowEditByAll); $oEditor->SaveField('name', $oChild->fieldName, true); } } }
[ "public", "function", "UpdatePageNaviBreadCrumb", "(", ")", "{", "$", "sEditLanguage", "=", "$", "this", "->", "oTableConf", "->", "GetLanguage", "(", ")", ";", "$", "breadcrumbs", "=", "self", "::", "GetNavigationBreadCrumbs", "(", "$", "this", "->", "sId", ",", "$", "sEditLanguage", ")", ";", "$", "this", "->", "SaveField", "(", "'url_path'", ",", "$", "breadcrumbs", ")", ";", "// now we also need to update all children of this category...", "$", "oCategory", "=", "TdbShopCategory", "::", "GetNewInstance", "(", ")", ";", "$", "oCategory", "->", "SetLanguage", "(", "$", "sEditLanguage", ")", ";", "/** @var $oCategory TdbShopCategory */", "if", "(", "!", "$", "oCategory", "->", "Load", "(", "$", "this", "->", "sId", ")", ")", "{", "$", "oCategory", "=", "null", ";", "}", "else", "{", "$", "oChildren", "=", "&", "$", "oCategory", "->", "GetChildren", "(", ")", ";", "while", "(", "$", "oChild", "=", "$", "oChildren", "->", "Next", "(", ")", ")", "{", "$", "oEditor", "=", "new", "TCMSTableEditorManager", "(", ")", ";", "/** @var $oEditor TCMSTableEditorManager */", "$", "oEditor", "->", "Init", "(", "$", "this", "->", "oTableConf", "->", "id", ",", "$", "oChild", "->", "id", ",", "$", "sEditLanguage", ")", ";", "$", "oEditor", "->", "AllowEditByAll", "(", "$", "this", "->", "bAllowEditByAll", ")", ";", "$", "oEditor", "->", "SaveField", "(", "'name'", ",", "$", "oChild", "->", "fieldName", ",", "true", ")", ";", "}", "}", "}" ]
update the page navi breadcrumb.
[ "update", "the", "page", "navi", "breadcrumb", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TCMSTableEditor/TCMSTableEditorShopCategory.class.php#L75-L96
31,474
chameleon-system/chameleon-shop
src/ShopBundle/objects/TCMSTableEditor/TCMSTableEditorShopCategory.class.php
TCMSTableEditorShopCategory.GetNavigationBreadCrumbs
public static function GetNavigationBreadCrumbs($id, $sLanguageID = null) { $sBreadCrumb = ''; $oCategory = TdbShopCategory::GetNewInstance(); if (!is_null($sLanguageID)) { $oCategory->SetLanguage($sLanguageID); } /** @var $oCategory TdbShopCategory */ if (!$oCategory->Load($id)) { $oCategory = null; } if (!is_null($oCategory)) { $oCategoryBreadcrumb = &$oCategory->GetBreadcrumb(); $oCategoryBreadcrumb->GoToStart(); while ($oCategoryItem = $oCategoryBreadcrumb->Next()) { $sBreadCrumb .= '/'.self::getUrlNormalizationUtil()->normalizeUrl($oCategoryItem->GetName()); } } return $sBreadCrumb; }
php
public static function GetNavigationBreadCrumbs($id, $sLanguageID = null) { $sBreadCrumb = ''; $oCategory = TdbShopCategory::GetNewInstance(); if (!is_null($sLanguageID)) { $oCategory->SetLanguage($sLanguageID); } /** @var $oCategory TdbShopCategory */ if (!$oCategory->Load($id)) { $oCategory = null; } if (!is_null($oCategory)) { $oCategoryBreadcrumb = &$oCategory->GetBreadcrumb(); $oCategoryBreadcrumb->GoToStart(); while ($oCategoryItem = $oCategoryBreadcrumb->Next()) { $sBreadCrumb .= '/'.self::getUrlNormalizationUtil()->normalizeUrl($oCategoryItem->GetName()); } } return $sBreadCrumb; }
[ "public", "static", "function", "GetNavigationBreadCrumbs", "(", "$", "id", ",", "$", "sLanguageID", "=", "null", ")", "{", "$", "sBreadCrumb", "=", "''", ";", "$", "oCategory", "=", "TdbShopCategory", "::", "GetNewInstance", "(", ")", ";", "if", "(", "!", "is_null", "(", "$", "sLanguageID", ")", ")", "{", "$", "oCategory", "->", "SetLanguage", "(", "$", "sLanguageID", ")", ";", "}", "/** @var $oCategory TdbShopCategory */", "if", "(", "!", "$", "oCategory", "->", "Load", "(", "$", "id", ")", ")", "{", "$", "oCategory", "=", "null", ";", "}", "if", "(", "!", "is_null", "(", "$", "oCategory", ")", ")", "{", "$", "oCategoryBreadcrumb", "=", "&", "$", "oCategory", "->", "GetBreadcrumb", "(", ")", ";", "$", "oCategoryBreadcrumb", "->", "GoToStart", "(", ")", ";", "while", "(", "$", "oCategoryItem", "=", "$", "oCategoryBreadcrumb", "->", "Next", "(", ")", ")", "{", "$", "sBreadCrumb", ".=", "'/'", ".", "self", "::", "getUrlNormalizationUtil", "(", ")", "->", "normalizeUrl", "(", "$", "oCategoryItem", "->", "GetName", "(", ")", ")", ";", "}", "}", "return", "$", "sBreadCrumb", ";", "}" ]
returns the breadcrumb navigation as plaintext. @param string $id - id of the page to update @param string $sLanguageID @return string
[ "returns", "the", "breadcrumb", "navigation", "as", "plaintext", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TCMSTableEditor/TCMSTableEditorShopCategory.class.php#L106-L126
31,475
chameleon-system/chameleon-shop
src/ShopBundle/objects/TCMSTableEditor/TCMSShopTableEditor_ShopDiscount.class.php
TCMSShopTableEditor_ShopDiscount.PostSaveHook
protected function PostSaveHook(&$oFields, &$oPostTable) { parent::PostSaveHook($oFields, $oPostTable); $this->oTable->ClearCacheOnAllAffectedArticles(); }
php
protected function PostSaveHook(&$oFields, &$oPostTable) { parent::PostSaveHook($oFields, $oPostTable); $this->oTable->ClearCacheOnAllAffectedArticles(); }
[ "protected", "function", "PostSaveHook", "(", "&", "$", "oFields", ",", "&", "$", "oPostTable", ")", "{", "parent", "::", "PostSaveHook", "(", "$", "oFields", ",", "$", "oPostTable", ")", ";", "$", "this", "->", "oTable", "->", "ClearCacheOnAllAffectedArticles", "(", ")", ";", "}" ]
we need to cache trigger all articles connected to the discount. @param TIterator $oFields holds an iterator of all field classes from DB table with the posted values or default if no post data is present @param TCMSRecord $oPostTable holds the record object of all posted data
[ "we", "need", "to", "cache", "trigger", "all", "articles", "connected", "to", "the", "discount", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TCMSTableEditor/TCMSShopTableEditor_ShopDiscount.class.php#L23-L27
31,476
PGB-LIV/php-ms
src/Core/Modification.php
Modification.setLocation
public function setLocation($location) { if (! is_int($location)) { throw new \InvalidArgumentException( 'Argument 1 must be an int value. Valued passed is of type ' . gettype($location)); } $this->location = $location; }
php
public function setLocation($location) { if (! is_int($location)) { throw new \InvalidArgumentException( 'Argument 1 must be an int value. Valued passed is of type ' . gettype($location)); } $this->location = $location; }
[ "public", "function", "setLocation", "(", "$", "location", ")", "{", "if", "(", "!", "is_int", "(", "$", "location", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Argument 1 must be an int value. Valued passed is of type '", ".", "gettype", "(", "$", "location", ")", ")", ";", "}", "$", "this", "->", "location", "=", "$", "location", ";", "}" ]
Sets the location for this modification @param int $location The location to set this modification at @throws \InvalidArgumentException If argument 1 is not of type int
[ "Sets", "the", "location", "for", "this", "modification" ]
091751eb12512f4bc6ada07bda745ce49331e24f
https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Core/Modification.php#L69-L77
31,477
PGB-LIV/php-ms
src/Core/Modification.php
Modification.setMonoisotopicMass
public function setMonoisotopicMass($mass) { if (! is_float($mass) && ! is_int($mass)) { throw new \InvalidArgumentException( 'Argument 1 must be a float or integer value. Valued passed is of type ' . gettype($mass)); } $this->monoisotopicMass = $mass; }
php
public function setMonoisotopicMass($mass) { if (! is_float($mass) && ! is_int($mass)) { throw new \InvalidArgumentException( 'Argument 1 must be a float or integer value. Valued passed is of type ' . gettype($mass)); } $this->monoisotopicMass = $mass; }
[ "public", "function", "setMonoisotopicMass", "(", "$", "mass", ")", "{", "if", "(", "!", "is_float", "(", "$", "mass", ")", "&&", "!", "is_int", "(", "$", "mass", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Argument 1 must be a float or integer value. Valued passed is of type '", ".", "gettype", "(", "$", "mass", ")", ")", ";", "}", "$", "this", "->", "monoisotopicMass", "=", "$", "mass", ";", "}" ]
Sets the monoisotopic mass for this modification @param float $mass The monoisotopic mass to set @throws \InvalidArgumentException If argument 1 is not of type float
[ "Sets", "the", "monoisotopic", "mass", "for", "this", "modification" ]
091751eb12512f4bc6ada07bda745ce49331e24f
https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Core/Modification.php#L96-L104
31,478
PGB-LIV/php-ms
src/Core/Modification.php
Modification.setResidues
public function setResidues(array $residues) { if (empty($residues)) { throw new \InvalidArgumentException('Argument 1 must not be empty.'); } foreach ($residues as $residue) { if (!preg_match('/^[A-Z]$/', $residue)) { throw new \InvalidArgumentException('Argument 1 must be an array of single char values (A-Z). Value passed is ' . $residue); } } // Force sort order sort($residues); // Force unique residue positions $this->residues = array_combine($residues, $residues); }
php
public function setResidues(array $residues) { if (empty($residues)) { throw new \InvalidArgumentException('Argument 1 must not be empty.'); } foreach ($residues as $residue) { if (!preg_match('/^[A-Z]$/', $residue)) { throw new \InvalidArgumentException('Argument 1 must be an array of single char values (A-Z). Value passed is ' . $residue); } } // Force sort order sort($residues); // Force unique residue positions $this->residues = array_combine($residues, $residues); }
[ "public", "function", "setResidues", "(", "array", "$", "residues", ")", "{", "if", "(", "empty", "(", "$", "residues", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Argument 1 must not be empty.'", ")", ";", "}", "foreach", "(", "$", "residues", "as", "$", "residue", ")", "{", "if", "(", "!", "preg_match", "(", "'/^[A-Z]$/'", ",", "$", "residue", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Argument 1 must be an array of single char values (A-Z). Value passed is '", ".", "$", "residue", ")", ";", "}", "}", "// Force sort order", "sort", "(", "$", "residues", ")", ";", "// Force unique residue positions", "$", "this", "->", "residues", "=", "array_combine", "(", "$", "residues", ",", "$", "residues", ")", ";", "}" ]
Set residues for this modification @param array $residues Array of residues this modification may occur on @throws \InvalidArgumentException If argument 1 is not of type float
[ "Set", "residues", "for", "this", "modification" ]
091751eb12512f4bc6ada07bda745ce49331e24f
https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Core/Modification.php#L153-L170
31,479
PGB-LIV/php-ms
src/Core/Modification.php
Modification.setPosition
public function setPosition($position) { switch ($position) { case Modification::POSITION_ANY: case Modification::POSITION_NTERM: case Modification::POSITION_CTERM: case Modification::POSITION_PROTEIN_NTERM: case Modification::POSITION_PROTEIN_CTERM: $this->position = $position; break; default: throw new \InvalidArgumentException('Postion must be any or terminus (see POSITION_XXXX)'); } }
php
public function setPosition($position) { switch ($position) { case Modification::POSITION_ANY: case Modification::POSITION_NTERM: case Modification::POSITION_CTERM: case Modification::POSITION_PROTEIN_NTERM: case Modification::POSITION_PROTEIN_CTERM: $this->position = $position; break; default: throw new \InvalidArgumentException('Postion must be any or terminus (see POSITION_XXXX)'); } }
[ "public", "function", "setPosition", "(", "$", "position", ")", "{", "switch", "(", "$", "position", ")", "{", "case", "Modification", "::", "POSITION_ANY", ":", "case", "Modification", "::", "POSITION_NTERM", ":", "case", "Modification", "::", "POSITION_CTERM", ":", "case", "Modification", "::", "POSITION_PROTEIN_NTERM", ":", "case", "Modification", "::", "POSITION_PROTEIN_CTERM", ":", "$", "this", "->", "position", "=", "$", "position", ";", "break", ";", "default", ":", "throw", "new", "\\", "InvalidArgumentException", "(", "'Postion must be any or terminus (see POSITION_XXXX)'", ")", ";", "}", "}" ]
Sets the position this modification can occur on within the peptide or protein. Default is 'Any'. @param int $position Position the modification can occur, see POSITION_ for list of options. @throws \InvalidArgumentException If unknown position specified
[ "Sets", "the", "position", "this", "modification", "can", "occur", "on", "within", "the", "peptide", "or", "protein", ".", "Default", "is", "Any", "." ]
091751eb12512f4bc6ada07bda745ce49331e24f
https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Core/Modification.php#L214-L228
31,480
chameleon-system/chameleon-shop
src/ShopAffiliateBundle/objects/db/TPkgShopAffiliatePrograms/TPkgShopAffiliate_TradeDoubler.class.php
TPkgShopAffiliate_TradeDoubler.GetAdditionalViewVariables
protected function GetAdditionalViewVariables(&$oOrder, &$aParameter) { parent::GetAdditionalViewVariables($oOrder, $aParameter); $aParameter['currency'] = $this->GetValueFromArray($aParameter, 'currency'); $aParameter['organization'] = $this->GetValueFromArray($aParameter, 'organization'); $aParameter['checksumCode'] = $this->GetValueFromArray($aParameter, 'checksumCode'); $aParameter['event'] = $this->GetValueFromArray($aParameter, 'event'); $isSale = $this->GetValueFromArray($aParameter, 'isSale'); $isSecure = $this->GetValueFromArray($aParameter, 'isSecure'); $aParameter['shop_order__ordernumber'] = rawurlencode($aParameter['shop_order__ordernumber']); $aParameter['orderNumber'] = $aParameter['shop_order__ordernumber']; $aParameter['orderValue'] = $aParameter['dNetProductValue']; $aParameter['reportInfo'] = ''; $oItems = $oOrder->GetFieldShopOrderItemList(); /** @var TdbShopOrderItemList $oItems */ while ($oItem = $oItems->Next()) { /** @var TdbShopOrderItem $oItem */ $aParameter['reportInfo'] .= 'f1='.$oItem->fieldArticlenumber.'&amp;f2='.$oItem->GetName().'&amp;f3='.$oItem->fieldPrice.'&amp;f4='.$oItem->fieldOrderAmount.'|'; } $aParameter['reportInfo'] = urlencode($aParameter['reportInfo']); $aParameter['tduid'] = ''; if (!empty($_SESSION['TdbPkgShopAffiliate-data']['sCode'])) { $aParameter['tduid'] = $_SESSION['TdbPkgShopAffiliate-data']['sCode']; } //if (!empty($_COOKIE["tduid"])) $aParameter['tduid'] = $_COOKIE["TdbPkgShopAffiliate-data"]["sCode"]; if ($isSale) { $aParameter['domain'] = 'tbs.tradedoubler.com'; $aParameter['checkNumberName'] = 'orderNumber'; } else { $aParameter['domain'] = 'tbl.tradedoubler.com'; $aParameter['checkNumberName'] = 'leadNumber'; $aParameter['orderValue'] = '1'; } $aParameter['checksum'] = ''; $aParameter['checksum'] = 'v04'.md5($aParameter['checksumCode'].$aParameter['orderNumber'].$aParameter['orderValue']); if ($isSecure) { $aParameter['scheme'] = 'https'; } else { $aParameter['scheme'] = 'http'; } /*if ($isSale) { $trackBackUrl .= "&amp;orderValue=" . $orderValue . "&amp;currency=" . $currency; }*/ }
php
protected function GetAdditionalViewVariables(&$oOrder, &$aParameter) { parent::GetAdditionalViewVariables($oOrder, $aParameter); $aParameter['currency'] = $this->GetValueFromArray($aParameter, 'currency'); $aParameter['organization'] = $this->GetValueFromArray($aParameter, 'organization'); $aParameter['checksumCode'] = $this->GetValueFromArray($aParameter, 'checksumCode'); $aParameter['event'] = $this->GetValueFromArray($aParameter, 'event'); $isSale = $this->GetValueFromArray($aParameter, 'isSale'); $isSecure = $this->GetValueFromArray($aParameter, 'isSecure'); $aParameter['shop_order__ordernumber'] = rawurlencode($aParameter['shop_order__ordernumber']); $aParameter['orderNumber'] = $aParameter['shop_order__ordernumber']; $aParameter['orderValue'] = $aParameter['dNetProductValue']; $aParameter['reportInfo'] = ''; $oItems = $oOrder->GetFieldShopOrderItemList(); /** @var TdbShopOrderItemList $oItems */ while ($oItem = $oItems->Next()) { /** @var TdbShopOrderItem $oItem */ $aParameter['reportInfo'] .= 'f1='.$oItem->fieldArticlenumber.'&amp;f2='.$oItem->GetName().'&amp;f3='.$oItem->fieldPrice.'&amp;f4='.$oItem->fieldOrderAmount.'|'; } $aParameter['reportInfo'] = urlencode($aParameter['reportInfo']); $aParameter['tduid'] = ''; if (!empty($_SESSION['TdbPkgShopAffiliate-data']['sCode'])) { $aParameter['tduid'] = $_SESSION['TdbPkgShopAffiliate-data']['sCode']; } //if (!empty($_COOKIE["tduid"])) $aParameter['tduid'] = $_COOKIE["TdbPkgShopAffiliate-data"]["sCode"]; if ($isSale) { $aParameter['domain'] = 'tbs.tradedoubler.com'; $aParameter['checkNumberName'] = 'orderNumber'; } else { $aParameter['domain'] = 'tbl.tradedoubler.com'; $aParameter['checkNumberName'] = 'leadNumber'; $aParameter['orderValue'] = '1'; } $aParameter['checksum'] = ''; $aParameter['checksum'] = 'v04'.md5($aParameter['checksumCode'].$aParameter['orderNumber'].$aParameter['orderValue']); if ($isSecure) { $aParameter['scheme'] = 'https'; } else { $aParameter['scheme'] = 'http'; } /*if ($isSale) { $trackBackUrl .= "&amp;orderValue=" . $orderValue . "&amp;currency=" . $currency; }*/ }
[ "protected", "function", "GetAdditionalViewVariables", "(", "&", "$", "oOrder", ",", "&", "$", "aParameter", ")", "{", "parent", "::", "GetAdditionalViewVariables", "(", "$", "oOrder", ",", "$", "aParameter", ")", ";", "$", "aParameter", "[", "'currency'", "]", "=", "$", "this", "->", "GetValueFromArray", "(", "$", "aParameter", ",", "'currency'", ")", ";", "$", "aParameter", "[", "'organization'", "]", "=", "$", "this", "->", "GetValueFromArray", "(", "$", "aParameter", ",", "'organization'", ")", ";", "$", "aParameter", "[", "'checksumCode'", "]", "=", "$", "this", "->", "GetValueFromArray", "(", "$", "aParameter", ",", "'checksumCode'", ")", ";", "$", "aParameter", "[", "'event'", "]", "=", "$", "this", "->", "GetValueFromArray", "(", "$", "aParameter", ",", "'event'", ")", ";", "$", "isSale", "=", "$", "this", "->", "GetValueFromArray", "(", "$", "aParameter", ",", "'isSale'", ")", ";", "$", "isSecure", "=", "$", "this", "->", "GetValueFromArray", "(", "$", "aParameter", ",", "'isSecure'", ")", ";", "$", "aParameter", "[", "'shop_order__ordernumber'", "]", "=", "rawurlencode", "(", "$", "aParameter", "[", "'shop_order__ordernumber'", "]", ")", ";", "$", "aParameter", "[", "'orderNumber'", "]", "=", "$", "aParameter", "[", "'shop_order__ordernumber'", "]", ";", "$", "aParameter", "[", "'orderValue'", "]", "=", "$", "aParameter", "[", "'dNetProductValue'", "]", ";", "$", "aParameter", "[", "'reportInfo'", "]", "=", "''", ";", "$", "oItems", "=", "$", "oOrder", "->", "GetFieldShopOrderItemList", "(", ")", ";", "/** @var TdbShopOrderItemList $oItems */", "while", "(", "$", "oItem", "=", "$", "oItems", "->", "Next", "(", ")", ")", "{", "/** @var TdbShopOrderItem $oItem */", "$", "aParameter", "[", "'reportInfo'", "]", ".=", "'f1='", ".", "$", "oItem", "->", "fieldArticlenumber", ".", "'&amp;f2='", ".", "$", "oItem", "->", "GetName", "(", ")", ".", "'&amp;f3='", ".", "$", "oItem", "->", "fieldPrice", ".", "'&amp;f4='", ".", "$", "oItem", "->", "fieldOrderAmount", ".", "'|'", ";", "}", "$", "aParameter", "[", "'reportInfo'", "]", "=", "urlencode", "(", "$", "aParameter", "[", "'reportInfo'", "]", ")", ";", "$", "aParameter", "[", "'tduid'", "]", "=", "''", ";", "if", "(", "!", "empty", "(", "$", "_SESSION", "[", "'TdbPkgShopAffiliate-data'", "]", "[", "'sCode'", "]", ")", ")", "{", "$", "aParameter", "[", "'tduid'", "]", "=", "$", "_SESSION", "[", "'TdbPkgShopAffiliate-data'", "]", "[", "'sCode'", "]", ";", "}", "//if (!empty($_COOKIE[\"tduid\"])) $aParameter['tduid'] = $_COOKIE[\"TdbPkgShopAffiliate-data\"][\"sCode\"];", "if", "(", "$", "isSale", ")", "{", "$", "aParameter", "[", "'domain'", "]", "=", "'tbs.tradedoubler.com'", ";", "$", "aParameter", "[", "'checkNumberName'", "]", "=", "'orderNumber'", ";", "}", "else", "{", "$", "aParameter", "[", "'domain'", "]", "=", "'tbl.tradedoubler.com'", ";", "$", "aParameter", "[", "'checkNumberName'", "]", "=", "'leadNumber'", ";", "$", "aParameter", "[", "'orderValue'", "]", "=", "'1'", ";", "}", "$", "aParameter", "[", "'checksum'", "]", "=", "''", ";", "$", "aParameter", "[", "'checksum'", "]", "=", "'v04'", ".", "md5", "(", "$", "aParameter", "[", "'checksumCode'", "]", ".", "$", "aParameter", "[", "'orderNumber'", "]", ".", "$", "aParameter", "[", "'orderValue'", "]", ")", ";", "if", "(", "$", "isSecure", ")", "{", "$", "aParameter", "[", "'scheme'", "]", "=", "'https'", ";", "}", "else", "{", "$", "aParameter", "[", "'scheme'", "]", "=", "'http'", ";", "}", "/*if ($isSale) {\n $trackBackUrl\n .= \"&amp;orderValue=\" . $orderValue\n . \"&amp;currency=\" . $currency;\n }*/", "}" ]
add custom vars to the view. @param TdbShopOrder $oOrder @param array $aParameter
[ "add", "custom", "vars", "to", "the", "view", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopAffiliateBundle/objects/db/TPkgShopAffiliatePrograms/TPkgShopAffiliate_TradeDoubler.class.php#L20-L73
31,481
symbiote/silverstripe-cdncontent
code/content/ContentDeliveryService.php
ContentDeliveryService.storeThemeFile
public function storeThemeFile($toCdn, $file, $forceUpdate = false, $processReferences = false) { $mtime = @filemtime($file); $relativeName = self::CDN_THEME_PREFIX . '/' . $mtime . '/' . trim(str_replace(Director::baseFolder(), '', $file), '/'); if (!$forceUpdate) { // see if the file already exists, if not we do NOT do an update $reader = $this->contentService->findReaderFor($toCdn, $relativeName); if ($reader && $reader->exists()) { return $reader->getURL(); } } $clear = false; if ($processReferences) { $clear = true; $file = $this->processFileReferences($toCdn, $file, $forceUpdate); } // otherwise, lets get a content writer $writer = $this->contentService->getWriter($toCdn); try { $writer->write($file, $relativeName); } catch (Exception $e) { SS_Log::log($e, SS_Log::WARN); } if ($clear && strpos($file, '.cdn') > 0) { @unlink($file); } $id = $writer->getContentId(); return $writer->getReader()->getURL(); }
php
public function storeThemeFile($toCdn, $file, $forceUpdate = false, $processReferences = false) { $mtime = @filemtime($file); $relativeName = self::CDN_THEME_PREFIX . '/' . $mtime . '/' . trim(str_replace(Director::baseFolder(), '', $file), '/'); if (!$forceUpdate) { // see if the file already exists, if not we do NOT do an update $reader = $this->contentService->findReaderFor($toCdn, $relativeName); if ($reader && $reader->exists()) { return $reader->getURL(); } } $clear = false; if ($processReferences) { $clear = true; $file = $this->processFileReferences($toCdn, $file, $forceUpdate); } // otherwise, lets get a content writer $writer = $this->contentService->getWriter($toCdn); try { $writer->write($file, $relativeName); } catch (Exception $e) { SS_Log::log($e, SS_Log::WARN); } if ($clear && strpos($file, '.cdn') > 0) { @unlink($file); } $id = $writer->getContentId(); return $writer->getReader()->getURL(); }
[ "public", "function", "storeThemeFile", "(", "$", "toCdn", ",", "$", "file", ",", "$", "forceUpdate", "=", "false", ",", "$", "processReferences", "=", "false", ")", "{", "$", "mtime", "=", "@", "filemtime", "(", "$", "file", ")", ";", "$", "relativeName", "=", "self", "::", "CDN_THEME_PREFIX", ".", "'/'", ".", "$", "mtime", ".", "'/'", ".", "trim", "(", "str_replace", "(", "Director", "::", "baseFolder", "(", ")", ",", "''", ",", "$", "file", ")", ",", "'/'", ")", ";", "if", "(", "!", "$", "forceUpdate", ")", "{", "// see if the file already exists, if not we do NOT do an update", "$", "reader", "=", "$", "this", "->", "contentService", "->", "findReaderFor", "(", "$", "toCdn", ",", "$", "relativeName", ")", ";", "if", "(", "$", "reader", "&&", "$", "reader", "->", "exists", "(", ")", ")", "{", "return", "$", "reader", "->", "getURL", "(", ")", ";", "}", "}", "$", "clear", "=", "false", ";", "if", "(", "$", "processReferences", ")", "{", "$", "clear", "=", "true", ";", "$", "file", "=", "$", "this", "->", "processFileReferences", "(", "$", "toCdn", ",", "$", "file", ",", "$", "forceUpdate", ")", ";", "}", "// otherwise, lets get a content writer", "$", "writer", "=", "$", "this", "->", "contentService", "->", "getWriter", "(", "$", "toCdn", ")", ";", "try", "{", "$", "writer", "->", "write", "(", "$", "file", ",", "$", "relativeName", ")", ";", "}", "catch", "(", "Exception", "$", "e", ")", "{", "SS_Log", "::", "log", "(", "$", "e", ",", "SS_Log", "::", "WARN", ")", ";", "}", "if", "(", "$", "clear", "&&", "strpos", "(", "$", "file", ",", "'.cdn'", ")", ">", "0", ")", "{", "@", "unlink", "(", "$", "file", ")", ";", "}", "$", "id", "=", "$", "writer", "->", "getContentId", "(", ")", ";", "return", "$", "writer", "->", "getReader", "(", ")", "->", "getURL", "(", ")", ";", "}" ]
Store the contents of a folder on a CDN. If processReferences is set, relative URL references are attempted to be detected and stored remotely as well, with the file to be stored rewritten to refer to the CDN value. This really is only useful for CSS @param string $folder @param boolean $processReferences
[ "Store", "the", "contents", "of", "a", "folder", "on", "a", "CDN", "." ]
a5f82e802e9addaf98d506cf305a621b873a5c9b
https://github.com/symbiote/silverstripe-cdncontent/blob/a5f82e802e9addaf98d506cf305a621b873a5c9b/code/content/ContentDeliveryService.php#L58-L90
31,482
chameleon-system/chameleon-shop
src/SearchBundle/objects/db/TShopSearchFieldWeight.class.php
TShopSearchFieldWeight.InsertSoundex
protected function InsertSoundex($iArticleId, $sOriginalWord, $iCount, $dOriginalWeight) { $sSoundEx = TdbShopSearchIndexer::GetSoundexForWord($sOriginalWord); $sSoundEx = TdbShopSearchIndexer::PrepareSearchWord($sSoundEx); // clean and cut the word if (!empty($sSoundEx) && '0000' != $sSoundEx) { $oShop = &$this->GetFieldShop(); // now add to index $sIndexTable = TdbShopSearchIndexer::GetIndexTableNameForIndexLength(mb_strlen($sSoundEx)); $dWeight = $dOriginalWeight * $oShop->fieldShopSearchSoundexPenalty; $this->AddIndexToTable($sIndexTable, $iArticleId, $sSoundEx, $iCount, $dWeight); } }
php
protected function InsertSoundex($iArticleId, $sOriginalWord, $iCount, $dOriginalWeight) { $sSoundEx = TdbShopSearchIndexer::GetSoundexForWord($sOriginalWord); $sSoundEx = TdbShopSearchIndexer::PrepareSearchWord($sSoundEx); // clean and cut the word if (!empty($sSoundEx) && '0000' != $sSoundEx) { $oShop = &$this->GetFieldShop(); // now add to index $sIndexTable = TdbShopSearchIndexer::GetIndexTableNameForIndexLength(mb_strlen($sSoundEx)); $dWeight = $dOriginalWeight * $oShop->fieldShopSearchSoundexPenalty; $this->AddIndexToTable($sIndexTable, $iArticleId, $sSoundEx, $iCount, $dWeight); } }
[ "protected", "function", "InsertSoundex", "(", "$", "iArticleId", ",", "$", "sOriginalWord", ",", "$", "iCount", ",", "$", "dOriginalWeight", ")", "{", "$", "sSoundEx", "=", "TdbShopSearchIndexer", "::", "GetSoundexForWord", "(", "$", "sOriginalWord", ")", ";", "$", "sSoundEx", "=", "TdbShopSearchIndexer", "::", "PrepareSearchWord", "(", "$", "sSoundEx", ")", ";", "// clean and cut the word", "if", "(", "!", "empty", "(", "$", "sSoundEx", ")", "&&", "'0000'", "!=", "$", "sSoundEx", ")", "{", "$", "oShop", "=", "&", "$", "this", "->", "GetFieldShop", "(", ")", ";", "// now add to index", "$", "sIndexTable", "=", "TdbShopSearchIndexer", "::", "GetIndexTableNameForIndexLength", "(", "mb_strlen", "(", "$", "sSoundEx", ")", ")", ";", "$", "dWeight", "=", "$", "dOriginalWeight", "*", "$", "oShop", "->", "fieldShopSearchSoundexPenalty", ";", "$", "this", "->", "AddIndexToTable", "(", "$", "sIndexTable", ",", "$", "iArticleId", ",", "$", "sSoundEx", ",", "$", "iCount", ",", "$", "dWeight", ")", ";", "}", "}" ]
insert soundex for word. @param string $sOriginalWord @param float $dOriginalWeight
[ "insert", "soundex", "for", "word", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/SearchBundle/objects/db/TShopSearchFieldWeight.class.php#L221-L233
31,483
chameleon-system/chameleon-shop
src/ShopBundle/objects/WebModules/MTShopArticleQuestionEndPoint.class.php
MTShopArticleQuestionEndPoint.isAntiSpamFieldValid
protected function isAntiSpamFieldValid() { $bCodeIsValid = false; $oCaptcha = TdbPkgCmsCaptcha::GetInstanceFromName('text-field-javascript-hidden'); if ($oCaptcha->CodeIsValid('question', '')) { $bCodeIsValid = true; } return $bCodeIsValid; }
php
protected function isAntiSpamFieldValid() { $bCodeIsValid = false; $oCaptcha = TdbPkgCmsCaptcha::GetInstanceFromName('text-field-javascript-hidden'); if ($oCaptcha->CodeIsValid('question', '')) { $bCodeIsValid = true; } return $bCodeIsValid; }
[ "protected", "function", "isAntiSpamFieldValid", "(", ")", "{", "$", "bCodeIsValid", "=", "false", ";", "$", "oCaptcha", "=", "TdbPkgCmsCaptcha", "::", "GetInstanceFromName", "(", "'text-field-javascript-hidden'", ")", ";", "if", "(", "$", "oCaptcha", "->", "CodeIsValid", "(", "'question'", ",", "''", ")", ")", "{", "$", "bCodeIsValid", "=", "true", ";", "}", "return", "$", "bCodeIsValid", ";", "}" ]
checks the anti spam field. @return bool
[ "checks", "the", "anti", "spam", "field", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/WebModules/MTShopArticleQuestionEndPoint.class.php#L100-L109
31,484
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopPaymentMethodList.class.php
TShopPaymentMethodList.&
public static function &GetAvailableMethods($iGroupId) { $query = self::getAvailableMethodsQuery($iGroupId); $oList = &TdbShopPaymentMethodList::GetList($query); $oList->bAllowItemCache = true; $oList->RemoveInvalidItems(); return $oList; }
php
public static function &GetAvailableMethods($iGroupId) { $query = self::getAvailableMethodsQuery($iGroupId); $oList = &TdbShopPaymentMethodList::GetList($query); $oList->bAllowItemCache = true; $oList->RemoveInvalidItems(); return $oList; }
[ "public", "static", "function", "&", "GetAvailableMethods", "(", "$", "iGroupId", ")", "{", "$", "query", "=", "self", "::", "getAvailableMethodsQuery", "(", "$", "iGroupId", ")", ";", "$", "oList", "=", "&", "TdbShopPaymentMethodList", "::", "GetList", "(", "$", "query", ")", ";", "$", "oList", "->", "bAllowItemCache", "=", "true", ";", "$", "oList", "->", "RemoveInvalidItems", "(", ")", ";", "return", "$", "oList", ";", "}" ]
return list of shipping types that match the given group, the current basket, the current portal and the current user. @param int $iGroupId @return TdbShopPaymentMethodList
[ "return", "list", "of", "shipping", "types", "that", "match", "the", "given", "group", "the", "current", "basket", "the", "current", "portal", "and", "the", "current", "user", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentMethodList.class.php#L26-L34
31,485
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopPaymentMethodList.class.php
TShopPaymentMethodList.&
public static function &GetPublicPaymentMethods($iGroupId) { $query = self::getAvailableMethodsQuery($iGroupId); $oList = &TdbShopPaymentMethodList::GetList($query); $oList->bAllowItemCache = true; $oList->RemoveRestrictedItems(); return $oList; }
php
public static function &GetPublicPaymentMethods($iGroupId) { $query = self::getAvailableMethodsQuery($iGroupId); $oList = &TdbShopPaymentMethodList::GetList($query); $oList->bAllowItemCache = true; $oList->RemoveRestrictedItems(); return $oList; }
[ "public", "static", "function", "&", "GetPublicPaymentMethods", "(", "$", "iGroupId", ")", "{", "$", "query", "=", "self", "::", "getAvailableMethodsQuery", "(", "$", "iGroupId", ")", ";", "$", "oList", "=", "&", "TdbShopPaymentMethodList", "::", "GetList", "(", "$", "query", ")", ";", "$", "oList", "->", "bAllowItemCache", "=", "true", ";", "$", "oList", "->", "RemoveRestrictedItems", "(", ")", ";", "return", "$", "oList", ";", "}" ]
return all public payment methods for a given shipping group. @param int $iGroupId @return TdbShopPaymentMethodList
[ "return", "all", "public", "payment", "methods", "for", "a", "given", "shipping", "group", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentMethodList.class.php#L94-L103
31,486
chameleon-system/chameleon-shop
src/ShopRatingServiceBundle/objects/TPkgShopRatingService_EkomiEndPoint.class.php
TPkgShopRatingService_EkomiEndPoint.FetchCSVFile
protected function FetchCSVFile() { $bFileWritten = false; $sCSVData = file_get_contents($this->fieldRatingUrl); if (!empty($sCSVData)) { if (false !== file_put_contents($this->sCsvFilePath, $sCSVData)) { $bFileWritten = true; } else { $this->WriteLogEntry('Could not read CSV from '.$this->fieldRatingUrl, __LINE__); } } else { $this->WriteLogEntry($this->sCsvFilePath.' could not be written.', __LINE__); } return $bFileWritten; }
php
protected function FetchCSVFile() { $bFileWritten = false; $sCSVData = file_get_contents($this->fieldRatingUrl); if (!empty($sCSVData)) { if (false !== file_put_contents($this->sCsvFilePath, $sCSVData)) { $bFileWritten = true; } else { $this->WriteLogEntry('Could not read CSV from '.$this->fieldRatingUrl, __LINE__); } } else { $this->WriteLogEntry($this->sCsvFilePath.' could not be written.', __LINE__); } return $bFileWritten; }
[ "protected", "function", "FetchCSVFile", "(", ")", "{", "$", "bFileWritten", "=", "false", ";", "$", "sCSVData", "=", "file_get_contents", "(", "$", "this", "->", "fieldRatingUrl", ")", ";", "if", "(", "!", "empty", "(", "$", "sCSVData", ")", ")", "{", "if", "(", "false", "!==", "file_put_contents", "(", "$", "this", "->", "sCsvFilePath", ",", "$", "sCSVData", ")", ")", "{", "$", "bFileWritten", "=", "true", ";", "}", "else", "{", "$", "this", "->", "WriteLogEntry", "(", "'Could not read CSV from '", ".", "$", "this", "->", "fieldRatingUrl", ",", "__LINE__", ")", ";", "}", "}", "else", "{", "$", "this", "->", "WriteLogEntry", "(", "$", "this", "->", "sCsvFilePath", ".", "' could not be written.'", ",", "__LINE__", ")", ";", "}", "return", "$", "bFileWritten", ";", "}" ]
Fetches the csv data from the api and saves it to the rating cache. @return bool
[ "Fetches", "the", "csv", "data", "from", "the", "api", "and", "saves", "it", "to", "the", "rating", "cache", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopRatingServiceBundle/objects/TPkgShopRatingService_EkomiEndPoint.class.php#L92-L109
31,487
chameleon-system/chameleon-shop
src/ShopPaymentIPNBundle/objects/TPkgShopPaymentIPNManager.class.php
TPkgShopPaymentIPNManager.getIPNIdentifierFromOrder
private function getIPNIdentifierFromOrder(TdbShopOrder $oOrder) { $sIdentifier = null; $query = "SELECT `shop_payment_handler_group`.* FROM `shop_payment_handler_group` INNER JOIN `shop_payment_handler` on `shop_payment_handler_group`.`id` = `shop_payment_handler`.`shop_payment_handler_group_id` INNER JOIN `shop_payment_method` on `shop_payment_handler`.`id` = `shop_payment_method`.`shop_payment_handler_id` INNER JOIN `shop_order` on `shop_payment_method`.`id` = `shop_order`.`shop_payment_method_id` WHERE `shop_order`.`id` = '".MySqlLegacySupport::getInstance()->real_escape_string($oOrder->id)."' "; if ($aGroup = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query))) { $sIdentifier = trim($aGroup['ipn_group_identifier']); if ('' === $sIdentifier) { $sIdentifier = trim($aGroup['system_name']); } } return $sIdentifier; }
php
private function getIPNIdentifierFromOrder(TdbShopOrder $oOrder) { $sIdentifier = null; $query = "SELECT `shop_payment_handler_group`.* FROM `shop_payment_handler_group` INNER JOIN `shop_payment_handler` on `shop_payment_handler_group`.`id` = `shop_payment_handler`.`shop_payment_handler_group_id` INNER JOIN `shop_payment_method` on `shop_payment_handler`.`id` = `shop_payment_method`.`shop_payment_handler_id` INNER JOIN `shop_order` on `shop_payment_method`.`id` = `shop_order`.`shop_payment_method_id` WHERE `shop_order`.`id` = '".MySqlLegacySupport::getInstance()->real_escape_string($oOrder->id)."' "; if ($aGroup = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query))) { $sIdentifier = trim($aGroup['ipn_group_identifier']); if ('' === $sIdentifier) { $sIdentifier = trim($aGroup['system_name']); } } return $sIdentifier; }
[ "private", "function", "getIPNIdentifierFromOrder", "(", "TdbShopOrder", "$", "oOrder", ")", "{", "$", "sIdentifier", "=", "null", ";", "$", "query", "=", "\"SELECT `shop_payment_handler_group`.*\n FROM `shop_payment_handler_group`\n INNER JOIN `shop_payment_handler` on `shop_payment_handler_group`.`id` = `shop_payment_handler`.`shop_payment_handler_group_id`\n INNER JOIN `shop_payment_method` on `shop_payment_handler`.`id` = `shop_payment_method`.`shop_payment_handler_id`\n INNER JOIN `shop_order` on `shop_payment_method`.`id` = `shop_order`.`shop_payment_method_id`\n WHERE `shop_order`.`id` = '\"", ".", "MySqlLegacySupport", "::", "getInstance", "(", ")", "->", "real_escape_string", "(", "$", "oOrder", "->", "id", ")", ".", "\"'\n \"", ";", "if", "(", "$", "aGroup", "=", "MySqlLegacySupport", "::", "getInstance", "(", ")", "->", "fetch_assoc", "(", "MySqlLegacySupport", "::", "getInstance", "(", ")", "->", "query", "(", "$", "query", ")", ")", ")", "{", "$", "sIdentifier", "=", "trim", "(", "$", "aGroup", "[", "'ipn_group_identifier'", "]", ")", ";", "if", "(", "''", "===", "$", "sIdentifier", ")", "{", "$", "sIdentifier", "=", "trim", "(", "$", "aGroup", "[", "'system_name'", "]", ")", ";", "}", "}", "return", "$", "sIdentifier", ";", "}" ]
return the IPNIdentifier for an order passed. @param TdbShopOrder $oOrder @return string|null
[ "return", "the", "IPNIdentifier", "for", "an", "order", "passed", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopPaymentIPNBundle/objects/TPkgShopPaymentIPNManager.class.php#L52-L70
31,488
chameleon-system/chameleon-shop
src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Impl/Message.php
Message.getMandatoryField
public function getMandatoryField($fieldName) { $value = $this->getField($fieldName); if (is_null($value)) { throw new OffAmazonPaymentsNotifications_InvalidMessageException( "Error with json message - mandatory field " . $fieldName . " cannot be found" ); } return $value; }
php
public function getMandatoryField($fieldName) { $value = $this->getField($fieldName); if (is_null($value)) { throw new OffAmazonPaymentsNotifications_InvalidMessageException( "Error with json message - mandatory field " . $fieldName . " cannot be found" ); } return $value; }
[ "public", "function", "getMandatoryField", "(", "$", "fieldName", ")", "{", "$", "value", "=", "$", "this", "->", "getField", "(", "$", "fieldName", ")", ";", "if", "(", "is_null", "(", "$", "value", ")", ")", "{", "throw", "new", "OffAmazonPaymentsNotifications_InvalidMessageException", "(", "\"Error with json message - mandatory field \"", ".", "$", "fieldName", ".", "\" cannot be found\"", ")", ";", "}", "return", "$", "value", ";", "}" ]
Extract the mandatory field from the message and return the contents @param string $fieldName name of the field to extract @throws OffAmazonPaymentsNotifications_InvalidMessageException if not found @return string field contents if found
[ "Extract", "the", "mandatory", "field", "from", "the", "message", "and", "return", "the", "contents" ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Impl/Message.php#L100-L110
31,489
chameleon-system/chameleon-shop
src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Impl/Message.php
Message.getField
public function getField($fieldName) { if (array_key_exists($fieldName, $this->_message)) { return $this->_message[$fieldName]; } else { return null; } }
php
public function getField($fieldName) { if (array_key_exists($fieldName, $this->_message)) { return $this->_message[$fieldName]; } else { return null; } }
[ "public", "function", "getField", "(", "$", "fieldName", ")", "{", "if", "(", "array_key_exists", "(", "$", "fieldName", ",", "$", "this", "->", "_message", ")", ")", "{", "return", "$", "this", "->", "_message", "[", "$", "fieldName", "]", ";", "}", "else", "{", "return", "null", ";", "}", "}" ]
Extract the field if present, return null if not defined @param string $fieldName name of the field to extract @return string field contents if found, null otherwise
[ "Extract", "the", "field", "if", "present", "return", "null", "if", "not", "defined" ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Impl/Message.php#L119-L126
31,490
chameleon-system/chameleon-shop
src/ShopBundle/objects/WebModules/MTShopPageMetaCore/MTShopPageMetaCore.class.php
MTShopPageMetaCore.GetSeoPatternString
protected function GetSeoPatternString($dont_replace = false) { //return ''; //why? //#7767 $sPattern = ''; //"[{PORTAL_NAME}] - [{PAGE_NAME}]"; /** @var $oSeoRenderer TCMSRenderSeoPattern */ $oSeoRenderer = new TCMSRenderSeoPattern(); $sTmpPattern = parent::GetSeoPatternString(true); if (strlen(trim($sTmpPattern)) > 0) { $sPattern = $sTmpPattern; } $oActiveArticle = TdbShop::GetActiveItem(); if ($oActiveArticle) { $arrRepl = $oActiveArticle->GetSeoPattern($sPattern); $oSeoRenderer->AddPatternReplaceValues($arrRepl); return $oSeoRenderer->RenderPattern($sPattern); } else { $oActiveCategory = TdbShop::GetActiveCategory(); if ($oActiveCategory) { $arrRepl = $oActiveCategory->GetSeoPattern($sPattern); $oSeoRenderer->AddPatternReplaceValues($arrRepl); return $oSeoRenderer->RenderPattern($sPattern); } } return parent::GetSeoPatternString(); }
php
protected function GetSeoPatternString($dont_replace = false) { //return ''; //why? //#7767 $sPattern = ''; //"[{PORTAL_NAME}] - [{PAGE_NAME}]"; /** @var $oSeoRenderer TCMSRenderSeoPattern */ $oSeoRenderer = new TCMSRenderSeoPattern(); $sTmpPattern = parent::GetSeoPatternString(true); if (strlen(trim($sTmpPattern)) > 0) { $sPattern = $sTmpPattern; } $oActiveArticle = TdbShop::GetActiveItem(); if ($oActiveArticle) { $arrRepl = $oActiveArticle->GetSeoPattern($sPattern); $oSeoRenderer->AddPatternReplaceValues($arrRepl); return $oSeoRenderer->RenderPattern($sPattern); } else { $oActiveCategory = TdbShop::GetActiveCategory(); if ($oActiveCategory) { $arrRepl = $oActiveCategory->GetSeoPattern($sPattern); $oSeoRenderer->AddPatternReplaceValues($arrRepl); return $oSeoRenderer->RenderPattern($sPattern); } } return parent::GetSeoPatternString(); }
[ "protected", "function", "GetSeoPatternString", "(", "$", "dont_replace", "=", "false", ")", "{", "//return ''; //why? //#7767", "$", "sPattern", "=", "''", ";", "//\"[{PORTAL_NAME}] - [{PAGE_NAME}]\";", "/** @var $oSeoRenderer TCMSRenderSeoPattern */", "$", "oSeoRenderer", "=", "new", "TCMSRenderSeoPattern", "(", ")", ";", "$", "sTmpPattern", "=", "parent", "::", "GetSeoPatternString", "(", "true", ")", ";", "if", "(", "strlen", "(", "trim", "(", "$", "sTmpPattern", ")", ")", ">", "0", ")", "{", "$", "sPattern", "=", "$", "sTmpPattern", ";", "}", "$", "oActiveArticle", "=", "TdbShop", "::", "GetActiveItem", "(", ")", ";", "if", "(", "$", "oActiveArticle", ")", "{", "$", "arrRepl", "=", "$", "oActiveArticle", "->", "GetSeoPattern", "(", "$", "sPattern", ")", ";", "$", "oSeoRenderer", "->", "AddPatternReplaceValues", "(", "$", "arrRepl", ")", ";", "return", "$", "oSeoRenderer", "->", "RenderPattern", "(", "$", "sPattern", ")", ";", "}", "else", "{", "$", "oActiveCategory", "=", "TdbShop", "::", "GetActiveCategory", "(", ")", ";", "if", "(", "$", "oActiveCategory", ")", "{", "$", "arrRepl", "=", "$", "oActiveCategory", "->", "GetSeoPattern", "(", "$", "sPattern", ")", ";", "$", "oSeoRenderer", "->", "AddPatternReplaceValues", "(", "$", "arrRepl", ")", ";", "return", "$", "oSeoRenderer", "->", "RenderPattern", "(", "$", "sPattern", ")", ";", "}", "}", "return", "parent", "::", "GetSeoPatternString", "(", ")", ";", "}" ]
Get SEO pattern string. @param bool $dont_replace Do not replace pattern with values @return string
[ "Get", "SEO", "pattern", "string", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/WebModules/MTShopPageMetaCore/MTShopPageMetaCore.class.php#L175-L204
31,491
chameleon-system/chameleon-shop
src/ShopBundle/objects/WebModules/MTShopPageMetaCore/MTShopPageMetaCore.class.php
MTShopPageMetaCore.GetMetaCanonical
protected function GetMetaCanonical() { $sCanonical = ''; $shopService = $this->getShopService(); $oShopItem = $shopService->getActiveProduct(); /** @var $oShopItem TdbShopArticle */ if ($oShopItem) { $oCat = $oShopItem->GetPrimaryCategory(); $iCat = ''; if ($oCat) { $iCat = $oCat->id; } $sCanonical = $oShopItem->GetDetailLink(true, $iCat); } else { $category = $shopService->getActiveCategory(); if ($category) { $currentPage = $this->getInputFilterUtil()->getFilteredInput(TdbShopArticleList::URL_LIST_CURRENT_PAGE, 0); $additionalParam = array(); if (0 !== $currentPage) { $additionalParam = array(TdbShopArticleList::URL_LIST_CURRENT_PAGE => $currentPage); } $activePage = $this->getActivePageService()->getActivePage(); return $activePage->GetRealURLPlain($additionalParam, true); } $sCanonical = parent::GetMetaCanonical(); } return $sCanonical; }
php
protected function GetMetaCanonical() { $sCanonical = ''; $shopService = $this->getShopService(); $oShopItem = $shopService->getActiveProduct(); /** @var $oShopItem TdbShopArticle */ if ($oShopItem) { $oCat = $oShopItem->GetPrimaryCategory(); $iCat = ''; if ($oCat) { $iCat = $oCat->id; } $sCanonical = $oShopItem->GetDetailLink(true, $iCat); } else { $category = $shopService->getActiveCategory(); if ($category) { $currentPage = $this->getInputFilterUtil()->getFilteredInput(TdbShopArticleList::URL_LIST_CURRENT_PAGE, 0); $additionalParam = array(); if (0 !== $currentPage) { $additionalParam = array(TdbShopArticleList::URL_LIST_CURRENT_PAGE => $currentPage); } $activePage = $this->getActivePageService()->getActivePage(); return $activePage->GetRealURLPlain($additionalParam, true); } $sCanonical = parent::GetMetaCanonical(); } return $sCanonical; }
[ "protected", "function", "GetMetaCanonical", "(", ")", "{", "$", "sCanonical", "=", "''", ";", "$", "shopService", "=", "$", "this", "->", "getShopService", "(", ")", ";", "$", "oShopItem", "=", "$", "shopService", "->", "getActiveProduct", "(", ")", ";", "/** @var $oShopItem TdbShopArticle */", "if", "(", "$", "oShopItem", ")", "{", "$", "oCat", "=", "$", "oShopItem", "->", "GetPrimaryCategory", "(", ")", ";", "$", "iCat", "=", "''", ";", "if", "(", "$", "oCat", ")", "{", "$", "iCat", "=", "$", "oCat", "->", "id", ";", "}", "$", "sCanonical", "=", "$", "oShopItem", "->", "GetDetailLink", "(", "true", ",", "$", "iCat", ")", ";", "}", "else", "{", "$", "category", "=", "$", "shopService", "->", "getActiveCategory", "(", ")", ";", "if", "(", "$", "category", ")", "{", "$", "currentPage", "=", "$", "this", "->", "getInputFilterUtil", "(", ")", "->", "getFilteredInput", "(", "TdbShopArticleList", "::", "URL_LIST_CURRENT_PAGE", ",", "0", ")", ";", "$", "additionalParam", "=", "array", "(", ")", ";", "if", "(", "0", "!==", "$", "currentPage", ")", "{", "$", "additionalParam", "=", "array", "(", "TdbShopArticleList", "::", "URL_LIST_CURRENT_PAGE", "=>", "$", "currentPage", ")", ";", "}", "$", "activePage", "=", "$", "this", "->", "getActivePageService", "(", ")", "->", "getActivePage", "(", ")", ";", "return", "$", "activePage", "->", "GetRealURLPlain", "(", "$", "additionalParam", ",", "true", ")", ";", "}", "$", "sCanonical", "=", "parent", "::", "GetMetaCanonical", "(", ")", ";", "}", "return", "$", "sCanonical", ";", "}" ]
return the canonical URL for the page. @return string
[ "return", "the", "canonical", "URL", "for", "the", "page", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/WebModules/MTShopPageMetaCore/MTShopPageMetaCore.class.php#L211-L240
31,492
chameleon-system/chameleon-shop
src/ShopListFilterBundle/objects/db/ListfilterItems/TPkgShopListfilterItemVariant.class.php
TPkgShopListfilterItemVariant.GetVariantType
protected function GetVariantType($aRow) { $sKey = 'oVariantType_'.$aRow['shop_variant_set_id']; $oVariantType = &$this->GetFromInternalCache($sKey); if (null === $oVariantType) { $oVariantType = TdbShopVariantType::GetNewInstance(); if (!empty($aRow['shop_variant_set_id'])) { if (!$oVariantType->LoadFromFields(array('identifier' => $this->sVariantTypeIdentifier, 'shop_variant_set_id' => $aRow['shop_variant_set_id']))) { $oVariantType = false; } } else { $oVariantType = false; } $this->SetInternalCache($sKey, $oVariantType); } return $oVariantType; }
php
protected function GetVariantType($aRow) { $sKey = 'oVariantType_'.$aRow['shop_variant_set_id']; $oVariantType = &$this->GetFromInternalCache($sKey); if (null === $oVariantType) { $oVariantType = TdbShopVariantType::GetNewInstance(); if (!empty($aRow['shop_variant_set_id'])) { if (!$oVariantType->LoadFromFields(array('identifier' => $this->sVariantTypeIdentifier, 'shop_variant_set_id' => $aRow['shop_variant_set_id']))) { $oVariantType = false; } } else { $oVariantType = false; } $this->SetInternalCache($sKey, $oVariantType); } return $oVariantType; }
[ "protected", "function", "GetVariantType", "(", "$", "aRow", ")", "{", "$", "sKey", "=", "'oVariantType_'", ".", "$", "aRow", "[", "'shop_variant_set_id'", "]", ";", "$", "oVariantType", "=", "&", "$", "this", "->", "GetFromInternalCache", "(", "$", "sKey", ")", ";", "if", "(", "null", "===", "$", "oVariantType", ")", "{", "$", "oVariantType", "=", "TdbShopVariantType", "::", "GetNewInstance", "(", ")", ";", "if", "(", "!", "empty", "(", "$", "aRow", "[", "'shop_variant_set_id'", "]", ")", ")", "{", "if", "(", "!", "$", "oVariantType", "->", "LoadFromFields", "(", "array", "(", "'identifier'", "=>", "$", "this", "->", "sVariantTypeIdentifier", ",", "'shop_variant_set_id'", "=>", "$", "aRow", "[", "'shop_variant_set_id'", "]", ")", ")", ")", "{", "$", "oVariantType", "=", "false", ";", "}", "}", "else", "{", "$", "oVariantType", "=", "false", ";", "}", "$", "this", "->", "SetInternalCache", "(", "$", "sKey", ",", "$", "oVariantType", ")", ";", "}", "return", "$", "oVariantType", ";", "}" ]
return the variant type matching "color". @param array $aRow - the data of the current article @return TdbShopVariantType
[ "return", "the", "variant", "type", "matching", "color", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopListFilterBundle/objects/db/ListfilterItems/TPkgShopListfilterItemVariant.class.php#L41-L58
31,493
chameleon-system/chameleon-shop
src/ShopListFilterBundle/objects/db/ListfilterItems/TPkgShopListfilterItemVariant.class.php
TPkgShopListfilterItemVariant.GetItemName
public function GetItemName($sFieldName, $sFieldValue, $aRow) { static $aLookupList = array(); if (!array_key_exists($aRow['id'], $aLookupList)) { $aLookupList[$aRow['id']] = array(); $oVariantType = $this->GetVariantType($aRow); if ($oVariantType) { $oArticle = TdbShopArticle::GetNewInstance(); $oArticle->LoadFromRow($aRow); $aResult = array(); $oVariantValues = $oArticle->GetVariantValuesAvailableForType($oVariantType); if ($oVariantValues) { while ($oVariantValue = $oVariantValues->Next()) { if (!empty($oVariantValue->fieldNameGrouped)) { $aResult[] = $oVariantValue->fieldNameGrouped; } else { $aResult[] = $oVariantValue->GetName(); } } } $aLookupList[$aRow['id']] = $aResult; } } return $aLookupList[$aRow['id']]; }
php
public function GetItemName($sFieldName, $sFieldValue, $aRow) { static $aLookupList = array(); if (!array_key_exists($aRow['id'], $aLookupList)) { $aLookupList[$aRow['id']] = array(); $oVariantType = $this->GetVariantType($aRow); if ($oVariantType) { $oArticle = TdbShopArticle::GetNewInstance(); $oArticle->LoadFromRow($aRow); $aResult = array(); $oVariantValues = $oArticle->GetVariantValuesAvailableForType($oVariantType); if ($oVariantValues) { while ($oVariantValue = $oVariantValues->Next()) { if (!empty($oVariantValue->fieldNameGrouped)) { $aResult[] = $oVariantValue->fieldNameGrouped; } else { $aResult[] = $oVariantValue->GetName(); } } } $aLookupList[$aRow['id']] = $aResult; } } return $aLookupList[$aRow['id']]; }
[ "public", "function", "GetItemName", "(", "$", "sFieldName", ",", "$", "sFieldValue", ",", "$", "aRow", ")", "{", "static", "$", "aLookupList", "=", "array", "(", ")", ";", "if", "(", "!", "array_key_exists", "(", "$", "aRow", "[", "'id'", "]", ",", "$", "aLookupList", ")", ")", "{", "$", "aLookupList", "[", "$", "aRow", "[", "'id'", "]", "]", "=", "array", "(", ")", ";", "$", "oVariantType", "=", "$", "this", "->", "GetVariantType", "(", "$", "aRow", ")", ";", "if", "(", "$", "oVariantType", ")", "{", "$", "oArticle", "=", "TdbShopArticle", "::", "GetNewInstance", "(", ")", ";", "$", "oArticle", "->", "LoadFromRow", "(", "$", "aRow", ")", ";", "$", "aResult", "=", "array", "(", ")", ";", "$", "oVariantValues", "=", "$", "oArticle", "->", "GetVariantValuesAvailableForType", "(", "$", "oVariantType", ")", ";", "if", "(", "$", "oVariantValues", ")", "{", "while", "(", "$", "oVariantValue", "=", "$", "oVariantValues", "->", "Next", "(", ")", ")", "{", "if", "(", "!", "empty", "(", "$", "oVariantValue", "->", "fieldNameGrouped", ")", ")", "{", "$", "aResult", "[", "]", "=", "$", "oVariantValue", "->", "fieldNameGrouped", ";", "}", "else", "{", "$", "aResult", "[", "]", "=", "$", "oVariantValue", "->", "GetName", "(", ")", ";", "}", "}", "}", "$", "aLookupList", "[", "$", "aRow", "[", "'id'", "]", "]", "=", "$", "aResult", ";", "}", "}", "return", "$", "aLookupList", "[", "$", "aRow", "[", "'id'", "]", "]", ";", "}" ]
return the item name for a given ID. @param string $sFieldName @param string $sFieldValue @param array $aRow @return string
[ "return", "the", "item", "name", "for", "a", "given", "ID", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopListFilterBundle/objects/db/ListfilterItems/TPkgShopListfilterItemVariant.class.php#L101-L128
31,494
comporu/compo-core
src/Compo/ImportBundle/Controller/DefaultController.php
DefaultController.getLetterArray
private function getLetterArray() { $array = range('A', 'Z'); $letters = $array; foreach ($array as $first) { foreach ($array as $second) { $letters[] = $first . $second; } } return $letters; }
php
private function getLetterArray() { $array = range('A', 'Z'); $letters = $array; foreach ($array as $first) { foreach ($array as $second) { $letters[] = $first . $second; } } return $letters; }
[ "private", "function", "getLetterArray", "(", ")", "{", "$", "array", "=", "range", "(", "'A'", ",", "'Z'", ")", ";", "$", "letters", "=", "$", "array", ";", "foreach", "(", "$", "array", "as", "$", "first", ")", "{", "foreach", "(", "$", "array", "as", "$", "second", ")", "{", "$", "letters", "[", "]", "=", "$", "first", ".", "$", "second", ";", "}", "}", "return", "$", "letters", ";", "}" ]
get array from A to ZZ. @return array
[ "get", "array", "from", "A", "to", "ZZ", "." ]
ebaa9fe8a4b831506c78fdf637da6b4deadec1e2
https://github.com/comporu/compo-core/blob/ebaa9fe8a4b831506c78fdf637da6b4deadec1e2/src/Compo/ImportBundle/Controller/DefaultController.php#L114-L125
31,495
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerSofortueberweisung.class.php
TShopPaymentHandlerSofortueberweisung.GetResponseURL
protected function GetResponseURL($sResponse) { $sReturnURLBase = $this->getActivePageService()->getActivePage()->GetRealURLPlain(array(), true); if ('.html' === substr($sReturnURLBase, -5)) { $sReturnURLBase = substr($sReturnURLBase, 0, -5); } if ('/' !== substr($sReturnURLBase, -1)) { $sReturnURLBase .= '/'; } // remove http:// and https:// since these are set in the interface $sReturnURLBase = str_replace('https://', '', $sReturnURLBase); $sReturnURLBase = str_replace('http://', '', $sReturnURLBase); return $sReturnURLBase.self::URL_IDENTIFIER.$sResponse; }
php
protected function GetResponseURL($sResponse) { $sReturnURLBase = $this->getActivePageService()->getActivePage()->GetRealURLPlain(array(), true); if ('.html' === substr($sReturnURLBase, -5)) { $sReturnURLBase = substr($sReturnURLBase, 0, -5); } if ('/' !== substr($sReturnURLBase, -1)) { $sReturnURLBase .= '/'; } // remove http:// and https:// since these are set in the interface $sReturnURLBase = str_replace('https://', '', $sReturnURLBase); $sReturnURLBase = str_replace('http://', '', $sReturnURLBase); return $sReturnURLBase.self::URL_IDENTIFIER.$sResponse; }
[ "protected", "function", "GetResponseURL", "(", "$", "sResponse", ")", "{", "$", "sReturnURLBase", "=", "$", "this", "->", "getActivePageService", "(", ")", "->", "getActivePage", "(", ")", "->", "GetRealURLPlain", "(", "array", "(", ")", ",", "true", ")", ";", "if", "(", "'.html'", "===", "substr", "(", "$", "sReturnURLBase", ",", "-", "5", ")", ")", "{", "$", "sReturnURLBase", "=", "substr", "(", "$", "sReturnURLBase", ",", "0", ",", "-", "5", ")", ";", "}", "if", "(", "'/'", "!==", "substr", "(", "$", "sReturnURLBase", ",", "-", "1", ")", ")", "{", "$", "sReturnURLBase", ".=", "'/'", ";", "}", "// remove http:// and https:// since these are set in the interface", "$", "sReturnURLBase", "=", "str_replace", "(", "'https://'", ",", "''", ",", "$", "sReturnURLBase", ")", ";", "$", "sReturnURLBase", "=", "str_replace", "(", "'http://'", ",", "''", ",", "$", "sReturnURLBase", ")", ";", "return", "$", "sReturnURLBase", ".", "self", "::", "URL_IDENTIFIER", ".", "$", "sResponse", ";", "}" ]
return SEO URL for the requested response. @param $sResponseName string
[ "return", "SEO", "URL", "for", "the", "requested", "response", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerSofortueberweisung.class.php#L131-L145
31,496
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerSofortueberweisung.class.php
TShopPaymentHandlerSofortueberweisung.BuildIncomingHash
protected function BuildIncomingHash($aParameter) { $sHash = ''; $aBaseData = array(); if (false == $this->UsesAccountFromSofortBank()) { $aBaseData = array('transaction' => '', 'user_id' => '', 'project_id' => '', 'sender_holder' => '', 'sender_account_number' => '', 'sender_bank_code' => '', 'sender_bank_name' => '', 'sender_bank_bic' => '', 'sender_iban' => '', 'sender_country_id' => '', 'recipient_holder' => '', 'recipient_account_number' => '', 'recipient_bank_code' => '', 'recipient_bank_name' => '', 'recipient_bank_bic' => '', 'recipient_iban' => '', 'recipient_country_id' => '', 'international_transaction' => '', 'amount' => '', 'currency_id' => '', 'reason_1' => '', 'reason_2' => '', 'security_criteria' => '', 'user_variable_0' => '', 'user_variable_1' => '', 'user_variable_2' => '', 'user_variable_3' => '', 'user_variable_4' => '', 'user_variable_5' => '', 'created' => '', // 'status'=>'', // 'status_modified'=>'', 'notification_password' => $this->GetConfigParameter('notification_password'), ); } else { $aBaseData = array('transaction' => '', 'user_id' => '', 'project_id' => '', 'sender_holder' => '', 'sender_account_number' => '', 'sender_bank_code' => '', 'sender_bank_name' => '', 'sender_bank_bic' => '', 'sender_iban' => '', 'sender_country_id' => '', 'recipient_holder' => '', 'recipient_account_number' => '', 'recipient_bank_code' => '', 'recipient_bank_name' => '', 'recipient_bank_bic' => '', 'recipient_iban' => '', 'recipient_country_id' => '', 'international_transaction' => '', 'amount' => '', 'currency_id' => '', 'reason_1' => '', 'reason_2' => '', 'security_criteria' => '', 'user_variable_0' => '', 'user_variable_1' => '', 'user_variable_2' => '', 'user_variable_3' => '', 'user_variable_4' => '', 'user_variable_5' => '', 'created' => '', 'notification_password' => $this->GetConfigParameter('notification_password')); } foreach (array_keys($aBaseData) as $sBaseDataKey) { if (array_key_exists($sBaseDataKey, $aParameter)) { $aBaseData[$sBaseDataKey] = $aParameter[$sBaseDataKey]; } } $sRawHash = implode('|', array_values($aBaseData)); $sHash = hash('sha256', $sRawHash); return $sHash; }
php
protected function BuildIncomingHash($aParameter) { $sHash = ''; $aBaseData = array(); if (false == $this->UsesAccountFromSofortBank()) { $aBaseData = array('transaction' => '', 'user_id' => '', 'project_id' => '', 'sender_holder' => '', 'sender_account_number' => '', 'sender_bank_code' => '', 'sender_bank_name' => '', 'sender_bank_bic' => '', 'sender_iban' => '', 'sender_country_id' => '', 'recipient_holder' => '', 'recipient_account_number' => '', 'recipient_bank_code' => '', 'recipient_bank_name' => '', 'recipient_bank_bic' => '', 'recipient_iban' => '', 'recipient_country_id' => '', 'international_transaction' => '', 'amount' => '', 'currency_id' => '', 'reason_1' => '', 'reason_2' => '', 'security_criteria' => '', 'user_variable_0' => '', 'user_variable_1' => '', 'user_variable_2' => '', 'user_variable_3' => '', 'user_variable_4' => '', 'user_variable_5' => '', 'created' => '', // 'status'=>'', // 'status_modified'=>'', 'notification_password' => $this->GetConfigParameter('notification_password'), ); } else { $aBaseData = array('transaction' => '', 'user_id' => '', 'project_id' => '', 'sender_holder' => '', 'sender_account_number' => '', 'sender_bank_code' => '', 'sender_bank_name' => '', 'sender_bank_bic' => '', 'sender_iban' => '', 'sender_country_id' => '', 'recipient_holder' => '', 'recipient_account_number' => '', 'recipient_bank_code' => '', 'recipient_bank_name' => '', 'recipient_bank_bic' => '', 'recipient_iban' => '', 'recipient_country_id' => '', 'international_transaction' => '', 'amount' => '', 'currency_id' => '', 'reason_1' => '', 'reason_2' => '', 'security_criteria' => '', 'user_variable_0' => '', 'user_variable_1' => '', 'user_variable_2' => '', 'user_variable_3' => '', 'user_variable_4' => '', 'user_variable_5' => '', 'created' => '', 'notification_password' => $this->GetConfigParameter('notification_password')); } foreach (array_keys($aBaseData) as $sBaseDataKey) { if (array_key_exists($sBaseDataKey, $aParameter)) { $aBaseData[$sBaseDataKey] = $aParameter[$sBaseDataKey]; } } $sRawHash = implode('|', array_values($aBaseData)); $sHash = hash('sha256', $sRawHash); return $sHash; }
[ "protected", "function", "BuildIncomingHash", "(", "$", "aParameter", ")", "{", "$", "sHash", "=", "''", ";", "$", "aBaseData", "=", "array", "(", ")", ";", "if", "(", "false", "==", "$", "this", "->", "UsesAccountFromSofortBank", "(", ")", ")", "{", "$", "aBaseData", "=", "array", "(", "'transaction'", "=>", "''", ",", "'user_id'", "=>", "''", ",", "'project_id'", "=>", "''", ",", "'sender_holder'", "=>", "''", ",", "'sender_account_number'", "=>", "''", ",", "'sender_bank_code'", "=>", "''", ",", "'sender_bank_name'", "=>", "''", ",", "'sender_bank_bic'", "=>", "''", ",", "'sender_iban'", "=>", "''", ",", "'sender_country_id'", "=>", "''", ",", "'recipient_holder'", "=>", "''", ",", "'recipient_account_number'", "=>", "''", ",", "'recipient_bank_code'", "=>", "''", ",", "'recipient_bank_name'", "=>", "''", ",", "'recipient_bank_bic'", "=>", "''", ",", "'recipient_iban'", "=>", "''", ",", "'recipient_country_id'", "=>", "''", ",", "'international_transaction'", "=>", "''", ",", "'amount'", "=>", "''", ",", "'currency_id'", "=>", "''", ",", "'reason_1'", "=>", "''", ",", "'reason_2'", "=>", "''", ",", "'security_criteria'", "=>", "''", ",", "'user_variable_0'", "=>", "''", ",", "'user_variable_1'", "=>", "''", ",", "'user_variable_2'", "=>", "''", ",", "'user_variable_3'", "=>", "''", ",", "'user_variable_4'", "=>", "''", ",", "'user_variable_5'", "=>", "''", ",", "'created'", "=>", "''", ",", "// 'status'=>'',", "// 'status_modified'=>'',", "'notification_password'", "=>", "$", "this", "->", "GetConfigParameter", "(", "'notification_password'", ")", ",", ")", ";", "}", "else", "{", "$", "aBaseData", "=", "array", "(", "'transaction'", "=>", "''", ",", "'user_id'", "=>", "''", ",", "'project_id'", "=>", "''", ",", "'sender_holder'", "=>", "''", ",", "'sender_account_number'", "=>", "''", ",", "'sender_bank_code'", "=>", "''", ",", "'sender_bank_name'", "=>", "''", ",", "'sender_bank_bic'", "=>", "''", ",", "'sender_iban'", "=>", "''", ",", "'sender_country_id'", "=>", "''", ",", "'recipient_holder'", "=>", "''", ",", "'recipient_account_number'", "=>", "''", ",", "'recipient_bank_code'", "=>", "''", ",", "'recipient_bank_name'", "=>", "''", ",", "'recipient_bank_bic'", "=>", "''", ",", "'recipient_iban'", "=>", "''", ",", "'recipient_country_id'", "=>", "''", ",", "'international_transaction'", "=>", "''", ",", "'amount'", "=>", "''", ",", "'currency_id'", "=>", "''", ",", "'reason_1'", "=>", "''", ",", "'reason_2'", "=>", "''", ",", "'security_criteria'", "=>", "''", ",", "'user_variable_0'", "=>", "''", ",", "'user_variable_1'", "=>", "''", ",", "'user_variable_2'", "=>", "''", ",", "'user_variable_3'", "=>", "''", ",", "'user_variable_4'", "=>", "''", ",", "'user_variable_5'", "=>", "''", ",", "'created'", "=>", "''", ",", "'notification_password'", "=>", "$", "this", "->", "GetConfigParameter", "(", "'notification_password'", ")", ")", ";", "}", "foreach", "(", "array_keys", "(", "$", "aBaseData", ")", "as", "$", "sBaseDataKey", ")", "{", "if", "(", "array_key_exists", "(", "$", "sBaseDataKey", ",", "$", "aParameter", ")", ")", "{", "$", "aBaseData", "[", "$", "sBaseDataKey", "]", "=", "$", "aParameter", "[", "$", "sBaseDataKey", "]", ";", "}", "}", "$", "sRawHash", "=", "implode", "(", "'|'", ",", "array_values", "(", "$", "aBaseData", ")", ")", ";", "$", "sHash", "=", "hash", "(", "'sha256'", ",", "$", "sRawHash", ")", ";", "return", "$", "sHash", ";", "}" ]
build incoming hash string from data provided by sofortueberweisung. @param array $aParameter @return string
[ "build", "incoming", "hash", "string", "from", "data", "provided", "by", "sofortueberweisung", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerSofortueberweisung.class.php#L327-L348
31,497
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerSofortueberweisung.class.php
TShopPaymentHandlerSofortueberweisung.NotifyPayloadIsValid
protected function NotifyPayloadIsValid($aParameter) { $bIsValid = true; $aMessage = array('msg' => '', 'line' => 0); // validate hash $sCalculatedHash = $this->BuildIncomingHash($aParameter); $sHash = (array_key_exists('hash', $aParameter)) ? $aParameter['hash'] : ''; if (0 != strcmp($sHash, $sCalculatedHash)) { $aMessage = array('msg' => "sofortueberweisung-notify: calculated hash [{$sCalculatedHash}] does not match hash passed [{$sHash}] for order", 'line' => __LINE__); $bIsValid = false; } /** @var $oOrder TdbShopOrder */ $oOrder = null; if ($bIsValid) { // order id exists? $sOrderId = (array_key_exists('user_variable_3', $aParameter)) ? $aParameter['user_variable_3'] : ''; $oOrder = TdbShopOrder::GetNewInstance(); if (false == $oOrder->Load($sOrderId)) { $aMessage = array('msg' => "sofortueberweisung-notify: order id passed [{$sOrderId}] was not found in database: ", 'line' => __LINE__); $bIsValid = false; } } if ($bIsValid) { // order amount matches? $dOrderAmount = (array_key_exists('amount', $aParameter)) ? $aParameter['amount'] : ''; if (0 != strcmp($dOrderAmount, $oOrder->fieldValueTotal)) { $aMessage = array('msg' => "sofortueberweisung-notify: amount paid [{$dOrderAmount}] for order [{$oOrder->id}] does not match order value [{$oOrder->fieldValueTotal}]: ", 'line' => __LINE__); $bIsValid = false; } } if (false == $bIsValid) { TTools::WriteLogEntry($aMessage['msg'].' DATA: '.print_r($aParameter, true), 1, __FILE__, $aMessage['line']); $bIsValid = $aMessage['msg']; } return $bIsValid; }
php
protected function NotifyPayloadIsValid($aParameter) { $bIsValid = true; $aMessage = array('msg' => '', 'line' => 0); // validate hash $sCalculatedHash = $this->BuildIncomingHash($aParameter); $sHash = (array_key_exists('hash', $aParameter)) ? $aParameter['hash'] : ''; if (0 != strcmp($sHash, $sCalculatedHash)) { $aMessage = array('msg' => "sofortueberweisung-notify: calculated hash [{$sCalculatedHash}] does not match hash passed [{$sHash}] for order", 'line' => __LINE__); $bIsValid = false; } /** @var $oOrder TdbShopOrder */ $oOrder = null; if ($bIsValid) { // order id exists? $sOrderId = (array_key_exists('user_variable_3', $aParameter)) ? $aParameter['user_variable_3'] : ''; $oOrder = TdbShopOrder::GetNewInstance(); if (false == $oOrder->Load($sOrderId)) { $aMessage = array('msg' => "sofortueberweisung-notify: order id passed [{$sOrderId}] was not found in database: ", 'line' => __LINE__); $bIsValid = false; } } if ($bIsValid) { // order amount matches? $dOrderAmount = (array_key_exists('amount', $aParameter)) ? $aParameter['amount'] : ''; if (0 != strcmp($dOrderAmount, $oOrder->fieldValueTotal)) { $aMessage = array('msg' => "sofortueberweisung-notify: amount paid [{$dOrderAmount}] for order [{$oOrder->id}] does not match order value [{$oOrder->fieldValueTotal}]: ", 'line' => __LINE__); $bIsValid = false; } } if (false == $bIsValid) { TTools::WriteLogEntry($aMessage['msg'].' DATA: '.print_r($aParameter, true), 1, __FILE__, $aMessage['line']); $bIsValid = $aMessage['msg']; } return $bIsValid; }
[ "protected", "function", "NotifyPayloadIsValid", "(", "$", "aParameter", ")", "{", "$", "bIsValid", "=", "true", ";", "$", "aMessage", "=", "array", "(", "'msg'", "=>", "''", ",", "'line'", "=>", "0", ")", ";", "// validate hash", "$", "sCalculatedHash", "=", "$", "this", "->", "BuildIncomingHash", "(", "$", "aParameter", ")", ";", "$", "sHash", "=", "(", "array_key_exists", "(", "'hash'", ",", "$", "aParameter", ")", ")", "?", "$", "aParameter", "[", "'hash'", "]", ":", "''", ";", "if", "(", "0", "!=", "strcmp", "(", "$", "sHash", ",", "$", "sCalculatedHash", ")", ")", "{", "$", "aMessage", "=", "array", "(", "'msg'", "=>", "\"sofortueberweisung-notify: calculated hash [{$sCalculatedHash}] does not match hash passed [{$sHash}] for order\"", ",", "'line'", "=>", "__LINE__", ")", ";", "$", "bIsValid", "=", "false", ";", "}", "/** @var $oOrder TdbShopOrder */", "$", "oOrder", "=", "null", ";", "if", "(", "$", "bIsValid", ")", "{", "// order id exists?", "$", "sOrderId", "=", "(", "array_key_exists", "(", "'user_variable_3'", ",", "$", "aParameter", ")", ")", "?", "$", "aParameter", "[", "'user_variable_3'", "]", ":", "''", ";", "$", "oOrder", "=", "TdbShopOrder", "::", "GetNewInstance", "(", ")", ";", "if", "(", "false", "==", "$", "oOrder", "->", "Load", "(", "$", "sOrderId", ")", ")", "{", "$", "aMessage", "=", "array", "(", "'msg'", "=>", "\"sofortueberweisung-notify: order id passed [{$sOrderId}] was not found in database: \"", ",", "'line'", "=>", "__LINE__", ")", ";", "$", "bIsValid", "=", "false", ";", "}", "}", "if", "(", "$", "bIsValid", ")", "{", "// order amount matches?", "$", "dOrderAmount", "=", "(", "array_key_exists", "(", "'amount'", ",", "$", "aParameter", ")", ")", "?", "$", "aParameter", "[", "'amount'", "]", ":", "''", ";", "if", "(", "0", "!=", "strcmp", "(", "$", "dOrderAmount", ",", "$", "oOrder", "->", "fieldValueTotal", ")", ")", "{", "$", "aMessage", "=", "array", "(", "'msg'", "=>", "\"sofortueberweisung-notify: amount paid [{$dOrderAmount}] for order [{$oOrder->id}] does not match order value [{$oOrder->fieldValueTotal}]: \"", ",", "'line'", "=>", "__LINE__", ")", ";", "$", "bIsValid", "=", "false", ";", "}", "}", "if", "(", "false", "==", "$", "bIsValid", ")", "{", "TTools", "::", "WriteLogEntry", "(", "$", "aMessage", "[", "'msg'", "]", ".", "' DATA: '", ".", "print_r", "(", "$", "aParameter", ",", "true", ")", ",", "1", ",", "__FILE__", ",", "$", "aMessage", "[", "'line'", "]", ")", ";", "$", "bIsValid", "=", "$", "aMessage", "[", "'msg'", "]", ";", "}", "return", "$", "bIsValid", ";", "}" ]
validate input. return true if valid, or error string on error. @param array $aParameter @return bool
[ "validate", "input", ".", "return", "true", "if", "valid", "or", "error", "string", "on", "error", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerSofortueberweisung.class.php#L442-L482
31,498
chameleon-system/chameleon-shop
src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/RefundExampleCLI.php
RefundExampleCLI._getRefundAmount
private function _getRefundAmount() { print PHP_EOL . "----------------------------------------------------------------------------" . PHP_EOL; print "Enter the amount to refund the customer (to 2 decimal places): "; do { $refundAmount = trim(fgets(STDIN)); } while (!is_numeric($refundAmount)); return $refundAmount; }
php
private function _getRefundAmount() { print PHP_EOL . "----------------------------------------------------------------------------" . PHP_EOL; print "Enter the amount to refund the customer (to 2 decimal places): "; do { $refundAmount = trim(fgets(STDIN)); } while (!is_numeric($refundAmount)); return $refundAmount; }
[ "private", "function", "_getRefundAmount", "(", ")", "{", "print", "PHP_EOL", ".", "\"----------------------------------------------------------------------------\"", ".", "PHP_EOL", ";", "print", "\"Enter the amount to refund the customer (to 2 decimal places): \"", ";", "do", "{", "$", "refundAmount", "=", "trim", "(", "fgets", "(", "STDIN", ")", ")", ";", "}", "while", "(", "!", "is_numeric", "(", "$", "refundAmount", ")", ")", ";", "return", "$", "refundAmount", ";", "}" ]
Get the amount to refund @return string refund amount, as a numeric string`
[ "Get", "the", "amount", "to", "refund" ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/RefundExampleCLI.php#L116-L126
31,499
chameleon-system/chameleon-shop
src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/RefundExampleCLI.php
RefundExampleCLI._waitUntilRefundProcessingIsCompleted
private function _waitUntilRefundProcessingIsCompleted($amazonRefundReferenceId) { $response = $this->callStepAndCheckForException( 'waitUntilRefundProcessingIsCompleted', array($amazonRefundReferenceId) ); printGetRefundDetailsResponse($response); validateThatRefundIsCompleted($response->getGetRefundDetailsResult()->getRefundDetails()); }
php
private function _waitUntilRefundProcessingIsCompleted($amazonRefundReferenceId) { $response = $this->callStepAndCheckForException( 'waitUntilRefundProcessingIsCompleted', array($amazonRefundReferenceId) ); printGetRefundDetailsResponse($response); validateThatRefundIsCompleted($response->getGetRefundDetailsResult()->getRefundDetails()); }
[ "private", "function", "_waitUntilRefundProcessingIsCompleted", "(", "$", "amazonRefundReferenceId", ")", "{", "$", "response", "=", "$", "this", "->", "callStepAndCheckForException", "(", "'waitUntilRefundProcessingIsCompleted'", ",", "array", "(", "$", "amazonRefundReferenceId", ")", ")", ";", "printGetRefundDetailsResponse", "(", "$", "response", ")", ";", "validateThatRefundIsCompleted", "(", "$", "response", "->", "getGetRefundDetailsResult", "(", ")", "->", "getRefundDetails", "(", ")", ")", ";", "}" ]
Poll the API for the status of the Refund Request, and continue once the status has been updated Throw an error if the status is not equal to OPEN @param string $amazonRefundReferenceId refund transaction to query @return No value
[ "Poll", "the", "API", "for", "the", "status", "of", "the", "Refund", "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/RefundExampleCLI.php#L169-L178