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
partition
stringclasses
1 value
edmondscommerce/doctrine-static-meta
src/Entity/DataTransferObjects/DtoFactory.php
DtoFactory.addNestedDtoToCollection
private function addNestedDtoToCollection( DataTransferObjectInterface $dto, string $propertyName, string $entityInterfaceFqn ): void { $collectionGetter = 'get' . $propertyName; $dto->$collectionGetter()->add( $this->createDtoRelatedToDto( $dto, $this->namespaceHelper->getEntityFqnFromEntityInterfaceFqn($entityInterfaceFqn) ) ); }
php
private function addNestedDtoToCollection( DataTransferObjectInterface $dto, string $propertyName, string $entityInterfaceFqn ): void { $collectionGetter = 'get' . $propertyName; $dto->$collectionGetter()->add( $this->createDtoRelatedToDto( $dto, $this->namespaceHelper->getEntityFqnFromEntityInterfaceFqn($entityInterfaceFqn) ) ); }
[ "private", "function", "addNestedDtoToCollection", "(", "DataTransferObjectInterface", "$", "dto", ",", "string", "$", "propertyName", ",", "string", "$", "entityInterfaceFqn", ")", ":", "void", "{", "$", "collectionGetter", "=", "'get'", ".", "$", "propertyName", ...
Create and add a related DTO into the owning DTO collection property @param DataTransferObjectInterface $dto @param string $propertyName @param string $entityInterfaceFqn @throws \EdmondsCommerce\DoctrineStaticMeta\Exception\DoctrineStaticMetaException @throws \ReflectionException
[ "Create", "and", "add", "a", "related", "DTO", "into", "the", "owning", "DTO", "collection", "property" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/DataTransferObjects/DtoFactory.php#L159-L171
train
edmondscommerce/doctrine-static-meta
src/Entity/DataTransferObjects/DtoFactory.php
DtoFactory.createDtoRelatedToDto
public function createDtoRelatedToDto( DataTransferObjectInterface $owningDto, string $relatedEntityFqn ): DataTransferObjectInterface { $this->resetCreationTransaction(); return $this->createDtoRelatedToEntityDataObject($owningDto, $relatedEntityFqn); }
php
public function createDtoRelatedToDto( DataTransferObjectInterface $owningDto, string $relatedEntityFqn ): DataTransferObjectInterface { $this->resetCreationTransaction(); return $this->createDtoRelatedToEntityDataObject($owningDto, $relatedEntityFqn); }
[ "public", "function", "createDtoRelatedToDto", "(", "DataTransferObjectInterface", "$", "owningDto", ",", "string", "$", "relatedEntityFqn", ")", ":", "DataTransferObjectInterface", "{", "$", "this", "->", "resetCreationTransaction", "(", ")", ";", "return", "$", "thi...
Create a DTO with a preset relation to the owning Entity DTO and all other items filled with new objects @param DataTransferObjectInterface $owningDto @param string $relatedEntityFqn @return DataTransferObjectInterface @throws \EdmondsCommerce\DoctrineStaticMeta\Exception\DoctrineStaticMetaException @throws \ReflectionException
[ "Create", "a", "DTO", "with", "a", "preset", "relation", "to", "the", "owning", "Entity", "DTO", "and", "all", "other", "items", "filled", "with", "new", "objects" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/DataTransferObjects/DtoFactory.php#L183-L189
train
edmondscommerce/doctrine-static-meta
src/Entity/DataTransferObjects/DtoFactory.php
DtoFactory.createDtoRelatedToEntityInstance
public function createDtoRelatedToEntityInstance( EntityInterface $owningEntity, string $relatedEntityFqn ): DataTransferObjectInterface { $this->resetCreationTransaction(); return $this->createDtoRelatedToEntityDataObject($owningEntity, $relatedEntityFqn); }
php
public function createDtoRelatedToEntityInstance( EntityInterface $owningEntity, string $relatedEntityFqn ): DataTransferObjectInterface { $this->resetCreationTransaction(); return $this->createDtoRelatedToEntityDataObject($owningEntity, $relatedEntityFqn); }
[ "public", "function", "createDtoRelatedToEntityInstance", "(", "EntityInterface", "$", "owningEntity", ",", "string", "$", "relatedEntityFqn", ")", ":", "DataTransferObjectInterface", "{", "$", "this", "->", "resetCreationTransaction", "(", ")", ";", "return", "$", "t...
Create a DTO with a preset relation to the owning Entity and all other items filled with new objects @param EntityInterface $owningEntity @param string $relatedEntityFqn @return DataTransferObjectInterface @throws \EdmondsCommerce\DoctrineStaticMeta\Exception\DoctrineStaticMetaException @throws \ReflectionException
[ "Create", "a", "DTO", "with", "a", "preset", "relation", "to", "the", "owning", "Entity", "and", "all", "other", "items", "filled", "with", "new", "objects" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/DataTransferObjects/DtoFactory.php#L315-L321
train
edmondscommerce/doctrine-static-meta
src/Entity/DataTransferObjects/DtoFactory.php
DtoFactory.createDtoFromEntity
public function createDtoFromEntity(EntityInterface $entity) { $this->resetCreationTransaction(); $dsm = $entity::getDoctrineStaticMeta(); $dtoFqn = $this->namespaceHelper->getEntityDtoFqnFromEntityFqn($dsm->getReflectionClass()->getName()); $dto = new $dtoFqn(); $setters = $dsm->getSetters(); foreach ($setters as $getterName => $setterName) { $dto->$setterName($entity->$getterName()); } return $dto; }
php
public function createDtoFromEntity(EntityInterface $entity) { $this->resetCreationTransaction(); $dsm = $entity::getDoctrineStaticMeta(); $dtoFqn = $this->namespaceHelper->getEntityDtoFqnFromEntityFqn($dsm->getReflectionClass()->getName()); $dto = new $dtoFqn(); $setters = $dsm->getSetters(); foreach ($setters as $getterName => $setterName) { $dto->$setterName($entity->$getterName()); } return $dto; }
[ "public", "function", "createDtoFromEntity", "(", "EntityInterface", "$", "entity", ")", "{", "$", "this", "->", "resetCreationTransaction", "(", ")", ";", "$", "dsm", "=", "$", "entity", "::", "getDoctrineStaticMeta", "(", ")", ";", "$", "dtoFqn", "=", "$",...
Create a DTO with the values from teh Entity, optionally with some values directly overridden with your values to set @param EntityInterface $entity @return mixed
[ "Create", "a", "DTO", "with", "the", "values", "from", "teh", "Entity", "optionally", "with", "some", "values", "directly", "overridden", "with", "your", "values", "to", "set" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/DataTransferObjects/DtoFactory.php#L331-L343
train
chameleon-system/chameleon-shop
src/ShopProductExportBundle/objects/TCMSFields/TCMSFieldText_ShowExportURL.class.php
TCMSFieldText_ShowExportURL.GetExportURLList
public function GetExportURLList() { $sReturn = ''; if (isset($this->oTableRow) && $this->oTableRow instanceof TdbShop) { /* @var $oShop TdbShop */ $oShop = $this->oTableRow; $oPortalList = $oShop->GetFieldCmsPortalList(); $systemPageService = $this->getSystemPageService(); while ($oPortal = $oPortalList->Next()) { $sExportPageURL = $systemPageService->getLinkToSystemPageRelative('productexport', array(), $oPortal); if (strstr($sExportPageURL, 'javascript:alert')) { $sReturn = '<div>'.TGlobal::OutHTML(TGlobal::Translate('chameleon_system_shop_product_export.field_show_export_url.error_export_page_missing')).'</div>'; continue; } $sExportPageId = $oPortal->GetSystemPageId('productexport'); $sSpotName = $this->getExportModuleSpotName($sExportPageId); if ('' == $sSpotName) { $sReturn = '<div>'.TGlobal::OutHTML(TGlobal::Translate('chameleon_system_shop_product_export.field_show_export_url.error_export_module_missing')).'</div>'; continue; } $aViewList = $this->getViewNameList($sExportPageId); if (0 === count($aViewList)) { $sReturn = '<div>'.TGlobal::OutHTML(TGlobal::Translate('chameleon_system_shop_product_export.field_show_export_url.error_export_views_missing')).'</div>'; continue; } $sReturn .= '<div><h5>'.TGlobal::OutHTML(TGlobal::Translate('chameleon_system_shop_product_export.field_show_export_url.headline', array('%portalName%' => $oPortal->GetName()))).'</h5></div>'; foreach ($aViewList as $sView) { $sURL = $sExportPageURL.'sModuleSpotName/'.$sSpotName.'/view/'.$sView.'/key/'.$oShop->fieldExportKey; $sReturn .= '<div><b>'.$sView.' -></b> <a href="'.$sURL.'" title="export" target="_blank">'.$sURL.'</a>'; } } } else { $sReturn = $sReturn = '<div>'.TGlobal::OutHTML(TGlobal::Translate('chameleon_system_shop_product_export.field_show_export_url.error_invalid_field_owner')).'</div>'; } return $sReturn; }
php
public function GetExportURLList() { $sReturn = ''; if (isset($this->oTableRow) && $this->oTableRow instanceof TdbShop) { /* @var $oShop TdbShop */ $oShop = $this->oTableRow; $oPortalList = $oShop->GetFieldCmsPortalList(); $systemPageService = $this->getSystemPageService(); while ($oPortal = $oPortalList->Next()) { $sExportPageURL = $systemPageService->getLinkToSystemPageRelative('productexport', array(), $oPortal); if (strstr($sExportPageURL, 'javascript:alert')) { $sReturn = '<div>'.TGlobal::OutHTML(TGlobal::Translate('chameleon_system_shop_product_export.field_show_export_url.error_export_page_missing')).'</div>'; continue; } $sExportPageId = $oPortal->GetSystemPageId('productexport'); $sSpotName = $this->getExportModuleSpotName($sExportPageId); if ('' == $sSpotName) { $sReturn = '<div>'.TGlobal::OutHTML(TGlobal::Translate('chameleon_system_shop_product_export.field_show_export_url.error_export_module_missing')).'</div>'; continue; } $aViewList = $this->getViewNameList($sExportPageId); if (0 === count($aViewList)) { $sReturn = '<div>'.TGlobal::OutHTML(TGlobal::Translate('chameleon_system_shop_product_export.field_show_export_url.error_export_views_missing')).'</div>'; continue; } $sReturn .= '<div><h5>'.TGlobal::OutHTML(TGlobal::Translate('chameleon_system_shop_product_export.field_show_export_url.headline', array('%portalName%' => $oPortal->GetName()))).'</h5></div>'; foreach ($aViewList as $sView) { $sURL = $sExportPageURL.'sModuleSpotName/'.$sSpotName.'/view/'.$sView.'/key/'.$oShop->fieldExportKey; $sReturn .= '<div><b>'.$sView.' -></b> <a href="'.$sURL.'" title="export" target="_blank">'.$sURL.'</a>'; } } } else { $sReturn = $sReturn = '<div>'.TGlobal::OutHTML(TGlobal::Translate('chameleon_system_shop_product_export.field_show_export_url.error_invalid_field_owner')).'</div>'; } return $sReturn; }
[ "public", "function", "GetExportURLList", "(", ")", "{", "$", "sReturn", "=", "''", ";", "if", "(", "isset", "(", "$", "this", "->", "oTableRow", ")", "&&", "$", "this", "->", "oTableRow", "instanceof", "TdbShop", ")", "{", "/* @var $oShop TdbShop */", "$"...
get list of all possible export urls as html. @return string
[ "get", "list", "of", "all", "possible", "export", "urls", "as", "html", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopProductExportBundle/objects/TCMSFields/TCMSFieldText_ShowExportURL.class.php#L34-L70
train
chameleon-system/chameleon-shop
src/ShopProductExportBundle/objects/TCMSFields/TCMSFieldText_ShowExportURL.class.php
TCMSFieldText_ShowExportURL.getExportModuleSpotName
protected function getExportModuleSpotName($sPageId) { $sSpotName = ''; $sQuery = "SELECT `cms_master_pagedef_spot`.`name` FROM `cms_tpl_page_cms_master_pagedef_spot` INNER JOIN `cms_master_pagedef_spot`ON `cms_master_pagedef_spot`.`id` = `cms_tpl_page_cms_master_pagedef_spot`.`cms_master_pagedef_spot_id` WHERE `cms_tpl_page_cms_master_pagedef_spot`.`cms_tpl_page_id` = '".$sPageId."' AND `static` = '0'"; $oRes = MySqlLegacySupport::getInstance()->query($sQuery); if (MySqlLegacySupport::getInstance()->num_rows($oRes) > 0) { while ($aRow = MySqlLegacySupport::getInstance()->fetch_assoc($oRes)) { $sSpotName = $aRow['name']; } } return $sSpotName; }
php
protected function getExportModuleSpotName($sPageId) { $sSpotName = ''; $sQuery = "SELECT `cms_master_pagedef_spot`.`name` FROM `cms_tpl_page_cms_master_pagedef_spot` INNER JOIN `cms_master_pagedef_spot`ON `cms_master_pagedef_spot`.`id` = `cms_tpl_page_cms_master_pagedef_spot`.`cms_master_pagedef_spot_id` WHERE `cms_tpl_page_cms_master_pagedef_spot`.`cms_tpl_page_id` = '".$sPageId."' AND `static` = '0'"; $oRes = MySqlLegacySupport::getInstance()->query($sQuery); if (MySqlLegacySupport::getInstance()->num_rows($oRes) > 0) { while ($aRow = MySqlLegacySupport::getInstance()->fetch_assoc($oRes)) { $sSpotName = $aRow['name']; } } return $sSpotName; }
[ "protected", "function", "getExportModuleSpotName", "(", "$", "sPageId", ")", "{", "$", "sSpotName", "=", "''", ";", "$", "sQuery", "=", "\"SELECT `cms_master_pagedef_spot`.`name` FROM `cms_tpl_page_cms_master_pagedef_spot`\n INNER JOIN `cms_master_pagedef_spot`ON ...
get spot name for export module on given page. @param string $sPageId @return string
[ "get", "spot", "name", "for", "export", "module", "on", "given", "page", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopProductExportBundle/objects/TCMSFields/TCMSFieldText_ShowExportURL.class.php#L79-L94
train
chameleon-system/chameleon-shop
src/ShopProductExportBundle/objects/TCMSFields/TCMSFieldText_ShowExportURL.class.php
TCMSFieldText_ShowExportURL.getViewNameList
protected function getViewNameList($sPageId) { $aViewNameList = array(); $sQuery = "SELECT `cms_tpl_page_cms_master_pagedef_spot`.`model` FROM `cms_tpl_page_cms_master_pagedef_spot` INNER JOIN `cms_master_pagedef_spot`ON `cms_master_pagedef_spot`.`id` = `cms_tpl_page_cms_master_pagedef_spot`.`cms_master_pagedef_spot_id` WHERE `cms_tpl_page_cms_master_pagedef_spot`.`cms_tpl_page_id` = '".$sPageId."' AND `static` = '0'"; $oRes = MySqlLegacySupport::getInstance()->query($sQuery); if (MySqlLegacySupport::getInstance()->num_rows($oRes) > 0) { $sModuleName = ''; while ($aRow = MySqlLegacySupport::getInstance()->fetch_assoc($oRes)) { $sModuleName = $aRow['model']; } $sModulePath = realpath(PATH_CUSTOMER_FRAMEWORK.'/modules/'.$sModuleName.'/views/'); if (false != $sModuleName && is_dir($sModulePath)) { if ($oDirHandle = opendir($sModulePath)) { while (false !== ($sFile = readdir($oDirHandle))) { if ('.' !== $sFile && '..' !== $sFile && true === is_file($sModulePath.'/'.$sFile)) { $sFile = str_replace('.view.php', '', $sFile); $aViewNameList[] = $sFile; } } } } } return $aViewNameList; }
php
protected function getViewNameList($sPageId) { $aViewNameList = array(); $sQuery = "SELECT `cms_tpl_page_cms_master_pagedef_spot`.`model` FROM `cms_tpl_page_cms_master_pagedef_spot` INNER JOIN `cms_master_pagedef_spot`ON `cms_master_pagedef_spot`.`id` = `cms_tpl_page_cms_master_pagedef_spot`.`cms_master_pagedef_spot_id` WHERE `cms_tpl_page_cms_master_pagedef_spot`.`cms_tpl_page_id` = '".$sPageId."' AND `static` = '0'"; $oRes = MySqlLegacySupport::getInstance()->query($sQuery); if (MySqlLegacySupport::getInstance()->num_rows($oRes) > 0) { $sModuleName = ''; while ($aRow = MySqlLegacySupport::getInstance()->fetch_assoc($oRes)) { $sModuleName = $aRow['model']; } $sModulePath = realpath(PATH_CUSTOMER_FRAMEWORK.'/modules/'.$sModuleName.'/views/'); if (false != $sModuleName && is_dir($sModulePath)) { if ($oDirHandle = opendir($sModulePath)) { while (false !== ($sFile = readdir($oDirHandle))) { if ('.' !== $sFile && '..' !== $sFile && true === is_file($sModulePath.'/'.$sFile)) { $sFile = str_replace('.view.php', '', $sFile); $aViewNameList[] = $sFile; } } } } } return $aViewNameList; }
[ "protected", "function", "getViewNameList", "(", "$", "sPageId", ")", "{", "$", "aViewNameList", "=", "array", "(", ")", ";", "$", "sQuery", "=", "\"SELECT `cms_tpl_page_cms_master_pagedef_spot`.`model` FROM `cms_tpl_page_cms_master_pagedef_spot`\n INNER JOIN `...
get all possible export views for export module on given page. @param string $sPageId @return array
[ "get", "all", "possible", "export", "views", "for", "export", "module", "on", "given", "page", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopProductExportBundle/objects/TCMSFields/TCMSFieldText_ShowExportURL.class.php#L103-L130
train
chameleon-system/chameleon-shop
src/ShopProductExportBundle/objects/TCMSFields/TCMSFieldText_ShowExportURL.class.php
TCMSFieldText_ShowExportURL.GetHTML
public function GetHTML() { $sHtml = parent::GetHTML(); $sHtml .= '<input id="showExportURLList" type="button" class="btn btn-sm btn-secondary mt-2" value="'.TGlobal::OutHTML($this->getTranslator()->trans('chameleon_system_shop_product_export.field_show_export_url.show_list_button_title')).'"/>'; $sHtml .= '<div id="exportURLListcontainer" class="mt-2"></div>'; $sHtml .= " <script type=\"text/javascript\"> $(document).ready(function() { $('#showExportURLList').click(function(){ GetAjaxCallTransparent('".$this->GenerateAjaxURL( array('_fnc' => 'GetExportURLList', '_fieldName' => $this->name) )."', GetExportURLList); return false;}); }); function GetExportURLList(data,statusText) { $('#exportURLListcontainer').html(''); $('#exportURLListcontainer').append(data); } </script> "; return $sHtml; }
php
public function GetHTML() { $sHtml = parent::GetHTML(); $sHtml .= '<input id="showExportURLList" type="button" class="btn btn-sm btn-secondary mt-2" value="'.TGlobal::OutHTML($this->getTranslator()->trans('chameleon_system_shop_product_export.field_show_export_url.show_list_button_title')).'"/>'; $sHtml .= '<div id="exportURLListcontainer" class="mt-2"></div>'; $sHtml .= " <script type=\"text/javascript\"> $(document).ready(function() { $('#showExportURLList').click(function(){ GetAjaxCallTransparent('".$this->GenerateAjaxURL( array('_fnc' => 'GetExportURLList', '_fieldName' => $this->name) )."', GetExportURLList); return false;}); }); function GetExportURLList(data,statusText) { $('#exportURLListcontainer').html(''); $('#exportURLListcontainer').append(data); } </script> "; return $sHtml; }
[ "public", "function", "GetHTML", "(", ")", "{", "$", "sHtml", "=", "parent", "::", "GetHTML", "(", ")", ";", "$", "sHtml", ".=", "'<input id=\"showExportURLList\" type=\"button\" class=\"btn btn-sm btn-secondary mt-2\" value=\"'", ".", "TGlobal", "::", "OutHTML", "(", ...
adds js to get url list. @return string
[ "adds", "js", "to", "get", "url", "list", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopProductExportBundle/objects/TCMSFields/TCMSFieldText_ShowExportURL.class.php#L137-L161
train
chameleon-system/chameleon-shop
src/ShopOrderStatusBundle/objects/TPkgShopOrderStatusManagerEndPoint.class.php
TPkgShopOrderStatusManagerEndPoint.validateStatusData
protected function validateStatusData(TPkgShopOrderStatusData $oData) { // does the order exists? $order = $oData->getOrder(); if (!$order) { throw new TPkgCmsException_Log('order status update: missing order object', array('statusdata' => $oData)); } // do the items exists and belong to the order? and is the amount shippable? $aItems = $oData->getItems(); foreach ($aItems as $oItem) { /** @var TPkgShopOrderStatusItemData $oItem */ $oOrderItem = TdbShopOrderItem::GetNewInstance(); if (false === $oOrderItem->LoadFromFields( array('shop_order_id' => $order->id, 'id' => $oItem->getShopOrderItemId()) ) ) { throw new TPkgCmsException_Log( 'order status update: order item invalid', array('statusdata' => $oData, 'item' => $oItem) ); } } }
php
protected function validateStatusData(TPkgShopOrderStatusData $oData) { // does the order exists? $order = $oData->getOrder(); if (!$order) { throw new TPkgCmsException_Log('order status update: missing order object', array('statusdata' => $oData)); } // do the items exists and belong to the order? and is the amount shippable? $aItems = $oData->getItems(); foreach ($aItems as $oItem) { /** @var TPkgShopOrderStatusItemData $oItem */ $oOrderItem = TdbShopOrderItem::GetNewInstance(); if (false === $oOrderItem->LoadFromFields( array('shop_order_id' => $order->id, 'id' => $oItem->getShopOrderItemId()) ) ) { throw new TPkgCmsException_Log( 'order status update: order item invalid', array('statusdata' => $oData, 'item' => $oItem) ); } } }
[ "protected", "function", "validateStatusData", "(", "TPkgShopOrderStatusData", "$", "oData", ")", "{", "// does the order exists?", "$", "order", "=", "$", "oData", "->", "getOrder", "(", ")", ";", "if", "(", "!", "$", "order", ")", "{", "throw", "new", "TPk...
validates the input. @param TPkgShopOrderStatusData $oData @throws TPkgCmsException_Log
[ "validates", "the", "input", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopOrderStatusBundle/objects/TPkgShopOrderStatusManagerEndPoint.class.php#L129-L151
train
chameleon-system/chameleon-shop
src/ShopOrderStatusBundle/objects/TPkgShopOrderStatusManagerEndPoint.class.php
TPkgShopOrderStatusManagerEndPoint.sendStatusMailToCustomerWithFrontEndAction
protected function sendStatusMailToCustomerWithFrontEndAction(TdbShopOrderStatus $oStatus) { $bSuccess = false; $sPortalId = null; $oOrder = $oStatus->GetFieldShopOrder(); if (!is_null($oOrder) && '' != $oOrder->fieldCmsPortalId) { $sPortalId = $oOrder->fieldCmsPortalId; } $oAction = TdbPkgRunFrontendAction::CreateAction( 'TPkgRunFrontendAction_SendOrderStatusEMail', $sPortalId, array('order_status_id' => $oStatus->id, 'order_id' => $oStatus->fieldShopOrderId) ); $sURL = $oAction->getUrlToRunAction(); $sURL = str_replace('&amp;', '&', $sURL); // remove encoding $oToHostHandler = new TPkgCmsCoreSendToHost(); $oToHostHandler->setConfigFromUrl($sURL); $this->getShopLogger()->info(sprintf('sending mail via frontend action using URL: %s', $sURL)); $executeRequestResponse = $oToHostHandler->executeRequest(); if (preg_match('#{.*}#', $executeRequestResponse, $aMatches)) { $this->getShopLogger()->info('done sending mail via frontend action. got response ', array('response' => $aMatches[0])); $aResponse = json_decode($aMatches[0], true); if (is_array($aResponse) && count( $aResponse ) > 0 && isset($aResponse['sMessageType']) && 'MESSAGE' == $aResponse['sMessageType'] ) { $bSuccess = true; } } else { $this->getShopLogger()->error('failed sending mail via frontend action. got response', array('response' => $executeRequestResponse)); } return $bSuccess; }
php
protected function sendStatusMailToCustomerWithFrontEndAction(TdbShopOrderStatus $oStatus) { $bSuccess = false; $sPortalId = null; $oOrder = $oStatus->GetFieldShopOrder(); if (!is_null($oOrder) && '' != $oOrder->fieldCmsPortalId) { $sPortalId = $oOrder->fieldCmsPortalId; } $oAction = TdbPkgRunFrontendAction::CreateAction( 'TPkgRunFrontendAction_SendOrderStatusEMail', $sPortalId, array('order_status_id' => $oStatus->id, 'order_id' => $oStatus->fieldShopOrderId) ); $sURL = $oAction->getUrlToRunAction(); $sURL = str_replace('&amp;', '&', $sURL); // remove encoding $oToHostHandler = new TPkgCmsCoreSendToHost(); $oToHostHandler->setConfigFromUrl($sURL); $this->getShopLogger()->info(sprintf('sending mail via frontend action using URL: %s', $sURL)); $executeRequestResponse = $oToHostHandler->executeRequest(); if (preg_match('#{.*}#', $executeRequestResponse, $aMatches)) { $this->getShopLogger()->info('done sending mail via frontend action. got response ', array('response' => $aMatches[0])); $aResponse = json_decode($aMatches[0], true); if (is_array($aResponse) && count( $aResponse ) > 0 && isset($aResponse['sMessageType']) && 'MESSAGE' == $aResponse['sMessageType'] ) { $bSuccess = true; } } else { $this->getShopLogger()->error('failed sending mail via frontend action. got response', array('response' => $executeRequestResponse)); } return $bSuccess; }
[ "protected", "function", "sendStatusMailToCustomerWithFrontEndAction", "(", "TdbShopOrderStatus", "$", "oStatus", ")", "{", "$", "bSuccess", "=", "false", ";", "$", "sPortalId", "=", "null", ";", "$", "oOrder", "=", "$", "oStatus", "->", "GetFieldShopOrder", "(", ...
send status mail simulating a front end action to use twig templates from customer. @param TdbShopOrderStatus $oStatus @return bool
[ "send", "status", "mail", "simulating", "a", "front", "end", "action", "to", "use", "twig", "templates", "from", "customer", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopOrderStatusBundle/objects/TPkgShopOrderStatusManagerEndPoint.class.php#L238-L271
train
chameleon-system/chameleon-shop
src/ShopPrimaryNavigationBundle/objects/TPkgShopPrimaryNaviList.class.php
TPkgShopPrimaryNaviList.GetDefaultQuery
public static function GetDefaultQuery($iLanguageId, $sFilterString = false) { $sDefaultQuery = 'SELECT `pkg_shop_primary_navi`.* FROM `pkg_shop_primary_navi` WHERE [{sFilterConditions}] ORDER BY `pkg_shop_primary_navi`.`position` ASC'; $sActivePrimaryNavigationQueryRestriction = ''; if (!TGlobal::IsCMSMode()) { $sActivePrimaryNavigationQueryRestriction = TdbPkgShopPrimaryNaviList::GetActivePrimaryNavigationQueryRestriction(); } if (strlen($sActivePrimaryNavigationQueryRestriction) > 0) { if (false === $sFilterString) { $sFilterString = " $sActivePrimaryNavigationQueryRestriction "; } else { $sFilterString = ' ( '.$sFilterString.' ) AND ('.$sActivePrimaryNavigationQueryRestriction.')'; } } else { if (false === $sFilterString) { $sFilterString = ' 1 = 1 '; } } $sDefaultQuery = str_replace('[{sFilterConditions}]', $sFilterString, $sDefaultQuery); return $sDefaultQuery; }
php
public static function GetDefaultQuery($iLanguageId, $sFilterString = false) { $sDefaultQuery = 'SELECT `pkg_shop_primary_navi`.* FROM `pkg_shop_primary_navi` WHERE [{sFilterConditions}] ORDER BY `pkg_shop_primary_navi`.`position` ASC'; $sActivePrimaryNavigationQueryRestriction = ''; if (!TGlobal::IsCMSMode()) { $sActivePrimaryNavigationQueryRestriction = TdbPkgShopPrimaryNaviList::GetActivePrimaryNavigationQueryRestriction(); } if (strlen($sActivePrimaryNavigationQueryRestriction) > 0) { if (false === $sFilterString) { $sFilterString = " $sActivePrimaryNavigationQueryRestriction "; } else { $sFilterString = ' ( '.$sFilterString.' ) AND ('.$sActivePrimaryNavigationQueryRestriction.')'; } } else { if (false === $sFilterString) { $sFilterString = ' 1 = 1 '; } } $sDefaultQuery = str_replace('[{sFilterConditions}]', $sFilterString, $sDefaultQuery); return $sDefaultQuery; }
[ "public", "static", "function", "GetDefaultQuery", "(", "$", "iLanguageId", ",", "$", "sFilterString", "=", "false", ")", "{", "$", "sDefaultQuery", "=", "'SELECT `pkg_shop_primary_navi`.*\n FROM `pkg_shop_primary_navi`\n WHERE [{sFi...
return default query for the table. if not in CMS mode return only active navigation trees. @param int $iLanguageId - language used for query @param bool|string $sFilterString - any filter conditions to add to the query @return string
[ "return", "default", "query", "for", "the", "table", ".", "if", "not", "in", "CMS", "mode", "return", "only", "active", "navigation", "trees", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopPrimaryNavigationBundle/objects/TPkgShopPrimaryNaviList.class.php#L23-L47
train
PGB-LIV/php-ms
src/Utility/Sort/IdentificationSort.php
IdentificationSort.sortByScore
protected function sortByScore(Identification $a, Identification $b) { if (is_null($this->scoreKey)) { throw new \BadMethodCallException('The key to sort on must be defined using SetScoreKey() prior to sorting.'); } if ($a->getScore($this->scoreKey) == $b->getScore($this->scoreKey)) { return 0; } return $a->getScore($this->scoreKey) > $b->getScore($this->scoreKey) ? $this->returnTrue : $this->returnFalse; }
php
protected function sortByScore(Identification $a, Identification $b) { if (is_null($this->scoreKey)) { throw new \BadMethodCallException('The key to sort on must be defined using SetScoreKey() prior to sorting.'); } if ($a->getScore($this->scoreKey) == $b->getScore($this->scoreKey)) { return 0; } return $a->getScore($this->scoreKey) > $b->getScore($this->scoreKey) ? $this->returnTrue : $this->returnFalse; }
[ "protected", "function", "sortByScore", "(", "Identification", "$", "a", ",", "Identification", "$", "b", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "scoreKey", ")", ")", "{", "throw", "new", "\\", "BadMethodCallException", "(", "'The key to sor...
Sort the identifications by score using the sort order and key provided @param Identification $a @param Identification $b @throws \BadMethodCallException Thrown if the key has not been specified @return int
[ "Sort", "the", "identifications", "by", "score", "using", "the", "sort", "order", "and", "key", "provided" ]
091751eb12512f4bc6ada07bda745ce49331e24f
https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Utility/Sort/IdentificationSort.php#L57-L68
train
PGB-LIV/php-ms
src/Utility/Sort/IdentificationSort.php
IdentificationSort.sortByRank
protected function sortByRank(Identification $a, Identification $b) { if ($a->getRank() == $b->getRank()) { return 0; } return $a->getRank() > $b->getRank() ? $this->returnTrue : $this->returnFalse; }
php
protected function sortByRank(Identification $a, Identification $b) { if ($a->getRank() == $b->getRank()) { return 0; } return $a->getRank() > $b->getRank() ? $this->returnTrue : $this->returnFalse; }
[ "protected", "function", "sortByRank", "(", "Identification", "$", "a", ",", "Identification", "$", "b", ")", "{", "if", "(", "$", "a", "->", "getRank", "(", ")", "==", "$", "b", "->", "getRank", "(", ")", ")", "{", "return", "0", ";", "}", "return...
Sort the identifications by rank using the sort order provided @param Identification $a @param Identification $b @return int
[ "Sort", "the", "identifications", "by", "rank", "using", "the", "sort", "order", "provided" ]
091751eb12512f4bc6ada07bda745ce49331e24f
https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Utility/Sort/IdentificationSort.php#L77-L84
train
CHH/sirel
lib/Sirel/Selections.php
Selections.where
function where($expr) { foreach (func_get_args() as $expr) { $this->getNodes()->restrictions[] = $expr; } return $this; }
php
function where($expr) { foreach (func_get_args() as $expr) { $this->getNodes()->restrictions[] = $expr; } return $this; }
[ "function", "where", "(", "$", "expr", ")", "{", "foreach", "(", "func_get_args", "(", ")", "as", "$", "expr", ")", "{", "$", "this", "->", "getNodes", "(", ")", "->", "restrictions", "[", "]", "=", "$", "expr", ";", "}", "return", "$", "this", "...
Add a node to the criteria @param Node $expr,... @return SelectManager
[ "Add", "a", "node", "to", "the", "criteria" ]
7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8
https://github.com/CHH/sirel/blob/7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8/lib/Sirel/Selections.php#L20-L27
train
CHH/sirel
lib/Sirel/Selections.php
Selections.reorder
function reorder($expr, $direction = null) { $this->order(null); $this->order($expr, $direction); return $this; }
php
function reorder($expr, $direction = null) { $this->order(null); $this->order($expr, $direction); return $this; }
[ "function", "reorder", "(", "$", "expr", ",", "$", "direction", "=", "null", ")", "{", "$", "this", "->", "order", "(", "null", ")", ";", "$", "this", "->", "order", "(", "$", "expr", ",", "$", "direction", ")", ";", "return", "$", "this", ";", ...
Override all previous order clauses with a new one. @see order() @param mixed $expr @param int $direction
[ "Override", "all", "previous", "order", "clauses", "with", "a", "new", "one", "." ]
7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8
https://github.com/CHH/sirel/blob/7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8/lib/Sirel/Selections.php#L36-L42
train
CHH/sirel
lib/Sirel/Selections.php
Selections.reverseOrder
function reverseOrder(array $attributes = null) { if ($attributes !== null) { $attributes = array_map('strval', $attributes); $orders = array_filter($this->getNodes()->orders, function($o) use ($attributes) { $expr = $o->getExpression(); $name = (string) $expr; return in_array($name, $attributes); }); } else { $orders = $this->getNodes()->orders; } foreach ($orders as $order) { $order->reverse(); } return $this; }
php
function reverseOrder(array $attributes = null) { if ($attributes !== null) { $attributes = array_map('strval', $attributes); $orders = array_filter($this->getNodes()->orders, function($o) use ($attributes) { $expr = $o->getExpression(); $name = (string) $expr; return in_array($name, $attributes); }); } else { $orders = $this->getNodes()->orders; } foreach ($orders as $order) { $order->reverse(); } return $this; }
[ "function", "reverseOrder", "(", "array", "$", "attributes", "=", "null", ")", "{", "if", "(", "$", "attributes", "!==", "null", ")", "{", "$", "attributes", "=", "array_map", "(", "'strval'", ",", "$", "attributes", ")", ";", "$", "orders", "=", "arra...
Reverses the order of all order clauses @param array $attributes Optional list of attributes which should be reversed @return SelectManager
[ "Reverses", "the", "order", "of", "all", "order", "clauses" ]
7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8
https://github.com/CHH/sirel/blob/7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8/lib/Sirel/Selections.php#L66-L86
train
CHH/sirel
lib/Sirel/Selections.php
Selections.take
function take($numRows) { $this->getNodes()->limit = $numRows !== null ? new Limit($numRows) : null; return $this; }
php
function take($numRows) { $this->getNodes()->limit = $numRows !== null ? new Limit($numRows) : null; return $this; }
[ "function", "take", "(", "$", "numRows", ")", "{", "$", "this", "->", "getNodes", "(", ")", "->", "limit", "=", "$", "numRows", "!==", "null", "?", "new", "Limit", "(", "$", "numRows", ")", ":", "null", ";", "return", "$", "this", ";", "}" ]
Adds a Limit Expression @param int $numRows @return SelectManager
[ "Adds", "a", "Limit", "Expression" ]
7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8
https://github.com/CHH/sirel/blob/7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8/lib/Sirel/Selections.php#L94-L98
train
CHH/sirel
lib/Sirel/Selections.php
Selections.skip
function skip($numRows) { $this->getNodes()->offset = $numRows !== null ? new Offset($numRows) : null; return $this; }
php
function skip($numRows) { $this->getNodes()->offset = $numRows !== null ? new Offset($numRows) : null; return $this; }
[ "function", "skip", "(", "$", "numRows", ")", "{", "$", "this", "->", "getNodes", "(", ")", "->", "offset", "=", "$", "numRows", "!==", "null", "?", "new", "Offset", "(", "$", "numRows", ")", ":", "null", ";", "return", "$", "this", ";", "}" ]
Adds an Offset Expression @param int $numRows @return SelectManager
[ "Adds", "an", "Offset", "Expression" ]
7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8
https://github.com/CHH/sirel/blob/7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8/lib/Sirel/Selections.php#L106-L110
train
CHH/sirel
lib/Sirel/Visitor/ToSql.php
ToSql.visitSirelNodeSelectStatement
protected function visitSirelNodeSelectStatement(Node\SelectStatement $select) { return join(" ", array_filter(array( "SELECT", ($select->distinct ? "DISTINCT" : null), ($select->projections ? join(", ", $this->visitEach($select->projections)) : '*'), // FROM $this->visit($select->source), // WHERE ($select->restrictions ? "WHERE " . join(" AND ", $this->visitEach($select->restrictions)) : null ), // ORDER BY ($select->orders ? "ORDER BY " . join(", ", $this->visitEach($select->orders)) : null), // GROUP BY ($select->groups ? "GROUP BY " . join(', ', $this->visitEach($select->groups)) : null), // LIMIT ($select->limit ? $this->visit($select->limit) : null), // OFFSET ($select->offset ? $this->visit($select->offset) : null) ))) . ';'; }
php
protected function visitSirelNodeSelectStatement(Node\SelectStatement $select) { return join(" ", array_filter(array( "SELECT", ($select->distinct ? "DISTINCT" : null), ($select->projections ? join(", ", $this->visitEach($select->projections)) : '*'), // FROM $this->visit($select->source), // WHERE ($select->restrictions ? "WHERE " . join(" AND ", $this->visitEach($select->restrictions)) : null ), // ORDER BY ($select->orders ? "ORDER BY " . join(", ", $this->visitEach($select->orders)) : null), // GROUP BY ($select->groups ? "GROUP BY " . join(', ', $this->visitEach($select->groups)) : null), // LIMIT ($select->limit ? $this->visit($select->limit) : null), // OFFSET ($select->offset ? $this->visit($select->offset) : null) ))) . ';'; }
[ "protected", "function", "visitSirelNodeSelectStatement", "(", "Node", "\\", "SelectStatement", "$", "select", ")", "{", "return", "join", "(", "\" \"", ",", "array_filter", "(", "array", "(", "\"SELECT\"", ",", "(", "$", "select", "->", "distinct", "?", "\"DI...
Get a SELECT Query @param Node\SelectStatement $select @return string
[ "Get", "a", "SELECT", "Query" ]
7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8
https://github.com/CHH/sirel/blob/7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8/lib/Sirel/Visitor/ToSql.php#L44-L80
train
CHH/sirel
lib/Sirel/Visitor/ToSql.php
ToSql.visitSirelNodeInsertStatement
protected function visitSirelNodeInsertStatement(Node\InsertStatement $insert) { return "INSERT INTO " . $this->visit($insert->relation) . ' (' . join(', ', $this->visitEach($insert->columns)) . ')' . ' VALUES (' . join(', ', $this->visitEach($insert->values)) . ');'; }
php
protected function visitSirelNodeInsertStatement(Node\InsertStatement $insert) { return "INSERT INTO " . $this->visit($insert->relation) . ' (' . join(', ', $this->visitEach($insert->columns)) . ')' . ' VALUES (' . join(', ', $this->visitEach($insert->values)) . ');'; }
[ "protected", "function", "visitSirelNodeInsertStatement", "(", "Node", "\\", "InsertStatement", "$", "insert", ")", "{", "return", "\"INSERT INTO \"", ".", "$", "this", "->", "visit", "(", "$", "insert", "->", "relation", ")", ".", "' ('", ".", "join", "(", ...
Creates an INSERT Statement @param Node\InsertStatement $insert @return string
[ "Creates", "an", "INSERT", "Statement" ]
7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8
https://github.com/CHH/sirel/blob/7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8/lib/Sirel/Visitor/ToSql.php#L88-L94
train
CHH/sirel
lib/Sirel/Visitor/ToSql.php
ToSql.visitSirelNodeOrder
protected function visitSirelNodeOrder(Node\Order $order) { return $this->visit($order->getExpression()) . " " . ($order->isAscending() ? "ASC" : "DESC"); }
php
protected function visitSirelNodeOrder(Node\Order $order) { return $this->visit($order->getExpression()) . " " . ($order->isAscending() ? "ASC" : "DESC"); }
[ "protected", "function", "visitSirelNodeOrder", "(", "Node", "\\", "Order", "$", "order", ")", "{", "return", "$", "this", "->", "visit", "(", "$", "order", "->", "getExpression", "(", ")", ")", ".", "\" \"", ".", "(", "$", "order", "->", "isAscending", ...
Create an ORDER Expression @param Node\Order $order @return string
[ "Create", "an", "ORDER", "Expression" ]
7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8
https://github.com/CHH/sirel/blob/7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8/lib/Sirel/Visitor/ToSql.php#L240-L244
train
CHH/sirel
lib/Sirel/Visitor/ToSql.php
ToSql.visitSirelNodeAssignment
protected function visitSirelNodeAssignment(Node\Assignment $assign) { return $this->visit($assign->getLeft()) . " = " . $this->visit($assign->getRight()); }
php
protected function visitSirelNodeAssignment(Node\Assignment $assign) { return $this->visit($assign->getLeft()) . " = " . $this->visit($assign->getRight()); }
[ "protected", "function", "visitSirelNodeAssignment", "(", "Node", "\\", "Assignment", "$", "assign", ")", "{", "return", "$", "this", "->", "visit", "(", "$", "assign", "->", "getLeft", "(", ")", ")", ".", "\" = \"", ".", "$", "this", "->", "visit", "(",...
Handle an Assignment, join with "=" @param Node\Assignment $assign @return string
[ "Handle", "an", "Assignment", "join", "with", "=" ]
7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8
https://github.com/CHH/sirel/blob/7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8/lib/Sirel/Visitor/ToSql.php#L252-L256
train
CHH/sirel
lib/Sirel/Visitor/ToSql.php
ToSql.visitSirelNodeEqual
protected function visitSirelNodeEqual(Node\Equal $equal) { $left = $this->visit($equal->getLeft()); $right = $equal->getRight(); if ($right === null) { return $left . ' IS NULL'; } else { return $left . ' = ' . $this->visit($right); } }
php
protected function visitSirelNodeEqual(Node\Equal $equal) { $left = $this->visit($equal->getLeft()); $right = $equal->getRight(); if ($right === null) { return $left . ' IS NULL'; } else { return $left . ' = ' . $this->visit($right); } }
[ "protected", "function", "visitSirelNodeEqual", "(", "Node", "\\", "Equal", "$", "equal", ")", "{", "$", "left", "=", "$", "this", "->", "visit", "(", "$", "equal", "->", "getLeft", "(", ")", ")", ";", "$", "right", "=", "$", "equal", "->", "getRight...
Transform to SQL Equality, if the right operand is NULL, then an "IS NULL" comparison is generated. @param Node\Equal $equal @return string
[ "Transform", "to", "SQL", "Equality", "if", "the", "right", "operand", "is", "NULL", "then", "an", "IS", "NULL", "comparison", "is", "generated", "." ]
7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8
https://github.com/CHH/sirel/blob/7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8/lib/Sirel/Visitor/ToSql.php#L265-L275
train
CHH/sirel
lib/Sirel/Visitor/ToSql.php
ToSql.visitSirelNodeJoinSource
protected function visitSirelNodeJoinSource(Node\JoinSource $joinSource) { $right = $joinSource->getRight(); return "FROM " . $this->visit($joinSource->getLeft()) . ($right ? ' ' . join(' ', $this->visitEach($right)) : null); }
php
protected function visitSirelNodeJoinSource(Node\JoinSource $joinSource) { $right = $joinSource->getRight(); return "FROM " . $this->visit($joinSource->getLeft()) . ($right ? ' ' . join(' ', $this->visitEach($right)) : null); }
[ "protected", "function", "visitSirelNodeJoinSource", "(", "Node", "\\", "JoinSource", "$", "joinSource", ")", "{", "$", "right", "=", "$", "joinSource", "->", "getRight", "(", ")", ";", "return", "\"FROM \"", ".", "$", "this", "->", "visit", "(", "$", "joi...
Returns the FROM part and visits the JOINs @param Node\JoinSource $joinSource @return string
[ "Returns", "the", "FROM", "part", "and", "visits", "the", "JOINs" ]
7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8
https://github.com/CHH/sirel/blob/7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8/lib/Sirel/Visitor/ToSql.php#L406-L414
train
CHH/sirel
lib/Sirel/Visitor/ToSql.php
ToSql.visitSirelNodeJoin
protected function visitSirelNodeJoin(Node\Join $join) { switch ($join->mode) { case Node\Join::INNER: $mode = "INNER"; break; case Node\Join::LEFT: $mode = "LEFT"; break; case Node\Join::LEFT_OUTER: $mode = "LEFT OUTER"; break; case Node\Join::RIGHT: $mode = "RIGHT"; break; case Node\Join::OUTER; $mode = "OUTER"; break; default: $mode = ''; break; } return ($join->natural ? 'NATURAL ' : '') . ($mode ? $mode . ' ' : '') . "JOIN " . $this->visit($join->left) . ($join->right ? ' ' . $this->visit($join->right) : ''); }
php
protected function visitSirelNodeJoin(Node\Join $join) { switch ($join->mode) { case Node\Join::INNER: $mode = "INNER"; break; case Node\Join::LEFT: $mode = "LEFT"; break; case Node\Join::LEFT_OUTER: $mode = "LEFT OUTER"; break; case Node\Join::RIGHT: $mode = "RIGHT"; break; case Node\Join::OUTER; $mode = "OUTER"; break; default: $mode = ''; break; } return ($join->natural ? 'NATURAL ' : '') . ($mode ? $mode . ' ' : '') . "JOIN " . $this->visit($join->left) . ($join->right ? ' ' . $this->visit($join->right) : ''); }
[ "protected", "function", "visitSirelNodeJoin", "(", "Node", "\\", "Join", "$", "join", ")", "{", "switch", "(", "$", "join", "->", "mode", ")", "{", "case", "Node", "\\", "Join", "::", "INNER", ":", "$", "mode", "=", "\"INNER\"", ";", "break", ";", "...
Creates a JOIN @param Node\Join $join @return string
[ "Creates", "a", "JOIN" ]
7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8
https://github.com/CHH/sirel/blob/7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8/lib/Sirel/Visitor/ToSql.php#L422-L450
train
chameleon-system/chameleon-shop
src/ShopRatingServiceBundle/objects/TPkgShopRatingService_TrustedShops.class.php
TPkgShopRatingService_TrustedShops.TrustedShopsImage_CacheCheck
public function TrustedShopsImage_CacheCheck($filename_cache, $timeout = 10800) { $bRet = false; if (file_exists($filename_cache)) { $timestamp = filemtime($filename_cache); // Seconds if (mktime() - $timestamp < $timeout) { $bRet = true; } else { $bRet = false; } } else { $bRet = false; } return $bRet; }
php
public function TrustedShopsImage_CacheCheck($filename_cache, $timeout = 10800) { $bRet = false; if (file_exists($filename_cache)) { $timestamp = filemtime($filename_cache); // Seconds if (mktime() - $timestamp < $timeout) { $bRet = true; } else { $bRet = false; } } else { $bRet = false; } return $bRet; }
[ "public", "function", "TrustedShopsImage_CacheCheck", "(", "$", "filename_cache", ",", "$", "timeout", "=", "10800", ")", "{", "$", "bRet", "=", "false", ";", "if", "(", "file_exists", "(", "$", "filename_cache", ")", ")", "{", "$", "timestamp", "=", "file...
Return FALSE if cache no more valid! @param string $filename_cache @param int $timeout @return bool
[ "Return", "FALSE", "if", "cache", "no", "more", "valid!" ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopRatingServiceBundle/objects/TPkgShopRatingService_TrustedShops.class.php#L195-L211
train
sylingd/Yesf
src/Http/Dispatcher.php
Dispatcher.handleRequest
public function handleRequest(Request $request, Response $response) { if ($this->static_enable) { $request->uri = $request->server['request_uri']; $uri = $request->server['request_uri']; if (strpos($uri, $this->static_prefix) === 0) { $uri = substr($uri, strlen($this->static_prefix)); } $path = realpath($this->static_dir . $uri); if ($path !== false && strpos($path, $this->static_dir) === 0) { if ($this->executeInterceptor('before', $request, $response) !== null) { $request->end(); $response->end(); unset($request, $response); return; } $response->mimeType(pathinfo($path, PATHINFO_EXTENSION)); $response->sendfile($path); $this->executeInterceptor('after', $request, $response); $request->end(); $response->end(); unset($request, $response); return; } } $this->router->parse($request); if ($this->executeInterceptor('before', $request, $response) !== null) { $request->end(); $response->end(); unset($request, $response); return; } $this->dispatch($request, $response); }
php
public function handleRequest(Request $request, Response $response) { if ($this->static_enable) { $request->uri = $request->server['request_uri']; $uri = $request->server['request_uri']; if (strpos($uri, $this->static_prefix) === 0) { $uri = substr($uri, strlen($this->static_prefix)); } $path = realpath($this->static_dir . $uri); if ($path !== false && strpos($path, $this->static_dir) === 0) { if ($this->executeInterceptor('before', $request, $response) !== null) { $request->end(); $response->end(); unset($request, $response); return; } $response->mimeType(pathinfo($path, PATHINFO_EXTENSION)); $response->sendfile($path); $this->executeInterceptor('after', $request, $response); $request->end(); $response->end(); unset($request, $response); return; } } $this->router->parse($request); if ($this->executeInterceptor('before', $request, $response) !== null) { $request->end(); $response->end(); unset($request, $response); return; } $this->dispatch($request, $response); }
[ "public", "function", "handleRequest", "(", "Request", "$", "request", ",", "Response", "$", "response", ")", "{", "if", "(", "$", "this", "->", "static_enable", ")", "{", "$", "request", "->", "uri", "=", "$", "request", "->", "server", "[", "'request_u...
Handle http request @access public @param Request $req Request @param Response $res Response
[ "Handle", "http", "request" ]
0fc2b42903bb3519c54c596270c890c826aeb1df
https://github.com/sylingd/Yesf/blob/0fc2b42903bb3519c54c596270c890c826aeb1df/src/Http/Dispatcher.php#L193-L225
train
PGB-LIV/php-ms
src/Core/AminoAcidComposition.php
AminoAcidComposition.getFormula
public static function getFormula($acid) { $formula = @constant('pgb_liv\php_ms\Core\AminoAcidComposition::' . $acid); if (! is_null($formula)) { return $formula; } if (strlen($acid) > 1) { throw new \InvalidArgumentException('Value must be a single amino acid. Input was ' . $acid); } throw new \InvalidArgumentException('Value must be a valid amino acid. Input was ' . $acid); }
php
public static function getFormula($acid) { $formula = @constant('pgb_liv\php_ms\Core\AminoAcidComposition::' . $acid); if (! is_null($formula)) { return $formula; } if (strlen($acid) > 1) { throw new \InvalidArgumentException('Value must be a single amino acid. Input was ' . $acid); } throw new \InvalidArgumentException('Value must be a valid amino acid. Input was ' . $acid); }
[ "public", "static", "function", "getFormula", "(", "$", "acid", ")", "{", "$", "formula", "=", "@", "constant", "(", "'pgb_liv\\php_ms\\Core\\AminoAcidComposition::'", ".", "$", "acid", ")", ";", "if", "(", "!", "is_null", "(", "$", "formula", ")", ")", "{...
Gets the molecular formula for the provided amino acid. @param string $acid Amino acid @throws \InvalidArgumentException If acid is not a single character or valid amino acid @return string Molecular formula
[ "Gets", "the", "molecular", "formula", "for", "the", "provided", "amino", "acid", "." ]
091751eb12512f4bc6ada07bda745ce49331e24f
https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Core/AminoAcidComposition.php#L77-L90
train
edmondscommerce/doctrine-static-meta
src/Entity/Fields/Traits/String/UrlFieldTrait.php
UrlFieldTrait.validatorMetaForPropertyUrl
protected static function validatorMetaForPropertyUrl(ValidatorClassMetaData $metadata): void { $metadata->addPropertyConstraint( UrlFieldInterface::PROP_URL, new Url([ 'relativeProtocol' => true, 'protocols' => ['http', 'https'], ]) ); }
php
protected static function validatorMetaForPropertyUrl(ValidatorClassMetaData $metadata): void { $metadata->addPropertyConstraint( UrlFieldInterface::PROP_URL, new Url([ 'relativeProtocol' => true, 'protocols' => ['http', 'https'], ]) ); }
[ "protected", "static", "function", "validatorMetaForPropertyUrl", "(", "ValidatorClassMetaData", "$", "metadata", ")", ":", "void", "{", "$", "metadata", "->", "addPropertyConstraint", "(", "UrlFieldInterface", "::", "PROP_URL", ",", "new", "Url", "(", "[", "'relati...
This method validates that the url is valid It allows the protocol to be ommitted, eg //www.edmondscommerce.co.uk You can extend the list of allowed protocols as you see fit
[ "This", "method", "validates", "that", "the", "url", "is", "valid" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/Fields/Traits/String/UrlFieldTrait.php#L43-L52
train
comporu/compo-core
src/Compo/FeedbackBundle/Controller/Api/FeedbackController.php
FeedbackController.postAction
public function postAction(Request $request) { //if (!$request->isXmlHttpRequest()) { //throw new \HttpRequestMethodException('Not isXmlHttpRequest'); //} $request_params = $this->getJsonParams($request); $feedback = new Feedback(); $feedbackManager = $this->get('compo_feedback.manager.feedback'); $feedbackType = $feedbackManager->getType($request_params['data']['type']); $form = $this->createForm($feedbackType['form'], $feedback); $form->submit($request_params['data']); $csrf = $this->get('security.csrf.token_manager'); if (!$form->isValid()) { $csrf->refreshToken('feedback_protection'); return View::create(['success' => false, 'error' => 'form_not_valid'], 400); } try { $em = $this->getDoctrine()->getManager(); $em->persist($feedback); $em->flush(); $csrf->refreshToken('feedback_protection'); $this->get('compo_notification.manager.notification')->send($feedback->getType(), ['feedback' => $feedback]); return View::create(['success' => true, 'message' => 'contacts_sent'], 200); } catch (\Exception $e) { return View::create(['success' => false, 'error' => $e->getMessage()], 400); } }
php
public function postAction(Request $request) { //if (!$request->isXmlHttpRequest()) { //throw new \HttpRequestMethodException('Not isXmlHttpRequest'); //} $request_params = $this->getJsonParams($request); $feedback = new Feedback(); $feedbackManager = $this->get('compo_feedback.manager.feedback'); $feedbackType = $feedbackManager->getType($request_params['data']['type']); $form = $this->createForm($feedbackType['form'], $feedback); $form->submit($request_params['data']); $csrf = $this->get('security.csrf.token_manager'); if (!$form->isValid()) { $csrf->refreshToken('feedback_protection'); return View::create(['success' => false, 'error' => 'form_not_valid'], 400); } try { $em = $this->getDoctrine()->getManager(); $em->persist($feedback); $em->flush(); $csrf->refreshToken('feedback_protection'); $this->get('compo_notification.manager.notification')->send($feedback->getType(), ['feedback' => $feedback]); return View::create(['success' => true, 'message' => 'contacts_sent'], 200); } catch (\Exception $e) { return View::create(['success' => false, 'error' => $e->getMessage()], 400); } }
[ "public", "function", "postAction", "(", "Request", "$", "request", ")", "{", "//if (!$request->isXmlHttpRequest()) {", "//throw new \\HttpRequestMethodException('Not isXmlHttpRequest');", "//}", "$", "request_params", "=", "$", "this", "->", "getJsonParams", "(", "$", "req...
Works with contact form data. Validates contact form, Saves contact entity, Sends notification message to user and site administration @REST\Route(requirements={"_format"="json|xml"}) @ApiDoc( requirements={ {"name"="$request", "dataType"="Request", "requirement"="Request", "description"="Request represents an HTTP request."} }, statusCodes={ 200="Returned when contacts is successfully saved and notification sent", 400="Returned when an error has occurred while contact form validated or when something went wrong", } ) @param Request $request request represents an HTTP request @throws \Throwable @return View
[ "Works", "with", "contact", "form", "data", "." ]
ebaa9fe8a4b831506c78fdf637da6b4deadec1e2
https://github.com/comporu/compo-core/blob/ebaa9fe8a4b831506c78fdf637da6b4deadec1e2/src/Compo/FeedbackBundle/Controller/Api/FeedbackController.php#L51-L90
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopOrderExportLog.class.php
TShopOrderExportLog.WriteLog
public static function WriteLog($iOrderId, $sData) { /** @var $oItem TdbShopOrderExportLog */ $oItem = TdbShopOrderExportLog::GetNewInstance(); /** @var Request $request */ $request = \ChameleonSystem\CoreBundle\ServiceLocator::get('request_stack')->getCurrentRequest(); $ip = $request->getClientIp(); $aData = array('shop_order_id' => $iOrderId, 'datecreated' => date('Y-m-d H:i:s'), 'ip' => $ip, 'data' => $sData, 'user_session_id' => session_id()); $oItem->LoadFromRow($aData); $oItem->AllowEditByAll(true); $oItem->Save(); }
php
public static function WriteLog($iOrderId, $sData) { /** @var $oItem TdbShopOrderExportLog */ $oItem = TdbShopOrderExportLog::GetNewInstance(); /** @var Request $request */ $request = \ChameleonSystem\CoreBundle\ServiceLocator::get('request_stack')->getCurrentRequest(); $ip = $request->getClientIp(); $aData = array('shop_order_id' => $iOrderId, 'datecreated' => date('Y-m-d H:i:s'), 'ip' => $ip, 'data' => $sData, 'user_session_id' => session_id()); $oItem->LoadFromRow($aData); $oItem->AllowEditByAll(true); $oItem->Save(); }
[ "public", "static", "function", "WriteLog", "(", "$", "iOrderId", ",", "$", "sData", ")", "{", "/** @var $oItem TdbShopOrderExportLog */", "$", "oItem", "=", "TdbShopOrderExportLog", "::", "GetNewInstance", "(", ")", ";", "/** @var Request $request */", "$", "request"...
write a Log Entry. @param int $iOrderId @param string $sData
[ "write", "a", "Log", "Entry", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrderExportLog.class.php#L22-L33
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopManufacturer.class.php
TShopManufacturer.GetLinkProducts
public function GetLinkProducts($bUseAbsoluteURL = false) { $oShop = TdbShop::GetInstance(); $sLink = $oShop->GetLinkToSystemPage('manufacturer'); if ('.html' == substr($sLink, -5)) { $sLink = substr($sLink, 0, -5).'/'; } $sLink = $sLink.$this->getUrlNormalizationUtil()->normalizeUrl($this->fieldName).'/id/'.urlencode($this->id); return $sLink; }
php
public function GetLinkProducts($bUseAbsoluteURL = false) { $oShop = TdbShop::GetInstance(); $sLink = $oShop->GetLinkToSystemPage('manufacturer'); if ('.html' == substr($sLink, -5)) { $sLink = substr($sLink, 0, -5).'/'; } $sLink = $sLink.$this->getUrlNormalizationUtil()->normalizeUrl($this->fieldName).'/id/'.urlencode($this->id); return $sLink; }
[ "public", "function", "GetLinkProducts", "(", "$", "bUseAbsoluteURL", "=", "false", ")", "{", "$", "oShop", "=", "TdbShop", "::", "GetInstance", "(", ")", ";", "$", "sLink", "=", "$", "oShop", "->", "GetLinkToSystemPage", "(", "'manufacturer'", ")", ";", "...
return link to the product pages for the manufacturer. @param bool $bUseAbsoluteURL @return string
[ "return", "link", "to", "the", "product", "pages", "for", "the", "manufacturer", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopManufacturer.class.php#L26-L36
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopManufacturer.class.php
TShopManufacturer.GetNumberOfHitsForSearchCacheId
public function GetNumberOfHitsForSearchCacheId($iShopSearchCacheId, $bApplyActiveFilter = false) { $iNumHits = 0; if ($bApplyActiveFilter) { $query = "SELECT COUNT(DISTINCT `shop_search_cache_item`.`id`) AS hits FROM `shop_search_cache_item` INNER JOIN `shop_article` ON `shop_search_cache_item`.`shop_article_id` = `shop_article`.`id` LEFT JOIN `shop_article_shop_category_mlt` ON `shop_article`.`id` = `shop_article_shop_category_mlt`.`source_id` WHERE `shop_search_cache_item`.`shop_search_cache_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($iShopSearchCacheId)."' AND `shop_article`.`shop_manufacturer_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."' "; $sFilter = TdbShop::GetActiveFilterString(TdbShopManufacturer::FILTER_KEY_NAME); if (!empty($sFilter)) { $query .= " AND {$sFilter}"; } $query .= ' GROUP BY `shop_article`.`shop_manufacturer_id`'; // echo "<pre>".$query."</pre><br>"; } else { $query = "SELECT COUNT(DISTINCT `shop_search_cache_item`.`id`) AS hits FROM `shop_search_cache_item` INNER JOIN `shop_article` ON `shop_search_cache_item`.`shop_article_id` = `shop_article`.`id` WHERE `shop_search_cache_item`.`shop_search_cache_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($iShopSearchCacheId)."' AND `shop_article`.`shop_manufacturer_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."' GROUP BY `shop_article`.`shop_manufacturer_id` "; } if ($row = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query))) { $iNumHits = $row['hits']; } return $iNumHits; }
php
public function GetNumberOfHitsForSearchCacheId($iShopSearchCacheId, $bApplyActiveFilter = false) { $iNumHits = 0; if ($bApplyActiveFilter) { $query = "SELECT COUNT(DISTINCT `shop_search_cache_item`.`id`) AS hits FROM `shop_search_cache_item` INNER JOIN `shop_article` ON `shop_search_cache_item`.`shop_article_id` = `shop_article`.`id` LEFT JOIN `shop_article_shop_category_mlt` ON `shop_article`.`id` = `shop_article_shop_category_mlt`.`source_id` WHERE `shop_search_cache_item`.`shop_search_cache_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($iShopSearchCacheId)."' AND `shop_article`.`shop_manufacturer_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."' "; $sFilter = TdbShop::GetActiveFilterString(TdbShopManufacturer::FILTER_KEY_NAME); if (!empty($sFilter)) { $query .= " AND {$sFilter}"; } $query .= ' GROUP BY `shop_article`.`shop_manufacturer_id`'; // echo "<pre>".$query."</pre><br>"; } else { $query = "SELECT COUNT(DISTINCT `shop_search_cache_item`.`id`) AS hits FROM `shop_search_cache_item` INNER JOIN `shop_article` ON `shop_search_cache_item`.`shop_article_id` = `shop_article`.`id` WHERE `shop_search_cache_item`.`shop_search_cache_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($iShopSearchCacheId)."' AND `shop_article`.`shop_manufacturer_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."' GROUP BY `shop_article`.`shop_manufacturer_id` "; } if ($row = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query))) { $iNumHits = $row['hits']; } return $iNumHits; }
[ "public", "function", "GetNumberOfHitsForSearchCacheId", "(", "$", "iShopSearchCacheId", ",", "$", "bApplyActiveFilter", "=", "false", ")", "{", "$", "iNumHits", "=", "0", ";", "if", "(", "$", "bApplyActiveFilter", ")", "{", "$", "query", "=", "\"SELECT COUNT(DI...
returns the number of search hits for a manufacturer. @param int $iShopSearchCacheId @param bool $bApplyActiveFilter - set to true if you want to count only hits that match the current filter @return int
[ "returns", "the", "number", "of", "search", "hits", "for", "a", "manufacturer", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopManufacturer.class.php#L118-L151
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopManufacturer.class.php
TShopManufacturer.GetIcon
public function GetIcon($bReturnDefaultImageIfNoneSet = false) { $oIcon = $this->GetFromInternalCache('oIcon'); if (is_null($oIcon)) { $oIcon = $this->GetImage(0, 'cms_media_id', $bReturnDefaultImageIfNoneSet); if (is_null($oIcon)) { $oIcon = false; } $this->SetInternalCache('oIcon', $oIcon); } return $oIcon; }
php
public function GetIcon($bReturnDefaultImageIfNoneSet = false) { $oIcon = $this->GetFromInternalCache('oIcon'); if (is_null($oIcon)) { $oIcon = $this->GetImage(0, 'cms_media_id', $bReturnDefaultImageIfNoneSet); if (is_null($oIcon)) { $oIcon = false; } $this->SetInternalCache('oIcon', $oIcon); } return $oIcon; }
[ "public", "function", "GetIcon", "(", "$", "bReturnDefaultImageIfNoneSet", "=", "false", ")", "{", "$", "oIcon", "=", "$", "this", "->", "GetFromInternalCache", "(", "'oIcon'", ")", ";", "if", "(", "is_null", "(", "$", "oIcon", ")", ")", "{", "$", "oIcon...
return the icon for the manufacturer. returns false if none found. @return TCMSImage
[ "return", "the", "icon", "for", "the", "manufacturer", ".", "returns", "false", "if", "none", "found", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopManufacturer.class.php#L158-L170
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopManufacturer.class.php
TShopManufacturer.GetLogo
public function GetLogo($bReturnDefaultImageIfNoneSet = false) { $oLogo = $this->GetFromInternalCache('oLogo'); if (is_null($oLogo)) { $oLogo = $this->GetImage(1, 'cms_media_id', $bReturnDefaultImageIfNoneSet); if (is_null($oLogo)) { $oLogo = $this->GetIcon($bReturnDefaultImageIfNoneSet); } if (is_null($oLogo)) { $oLogo = false; } $this->SetInternalCache('oLogo', $oLogo); } return $oLogo; }
php
public function GetLogo($bReturnDefaultImageIfNoneSet = false) { $oLogo = $this->GetFromInternalCache('oLogo'); if (is_null($oLogo)) { $oLogo = $this->GetImage(1, 'cms_media_id', $bReturnDefaultImageIfNoneSet); if (is_null($oLogo)) { $oLogo = $this->GetIcon($bReturnDefaultImageIfNoneSet); } if (is_null($oLogo)) { $oLogo = false; } $this->SetInternalCache('oLogo', $oLogo); } return $oLogo; }
[ "public", "function", "GetLogo", "(", "$", "bReturnDefaultImageIfNoneSet", "=", "false", ")", "{", "$", "oLogo", "=", "$", "this", "->", "GetFromInternalCache", "(", "'oLogo'", ")", ";", "if", "(", "is_null", "(", "$", "oLogo", ")", ")", "{", "$", "oLogo...
return the logo for the manufacturer. if none has been set, it will return the icon instead if there is no icon either, it will return false. @return TCMSImage
[ "return", "the", "logo", "for", "the", "manufacturer", ".", "if", "none", "has", "been", "set", "it", "will", "return", "the", "icon", "instead", "if", "there", "is", "no", "icon", "either", "it", "will", "return", "false", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopManufacturer.class.php#L178-L193
train
chameleon-system/chameleon-shop
src/SearchBundle/objects/db/TShopSearchKeywordArticleList.class.php
TShopSearchKeywordArticleList.&
public static function &GetListForShopKeywords($iShopId, $aKeywordList, $iLanguageId = null) { if (null === $iLanguageId) { $iLanguageId = self::getMyLanguageService()->getActiveLanguageId(); } $aKeywordList = TTools::MysqlRealEscapeArray($aKeywordList); $query = self::GetDefaultQuery($iLanguageId, "`shop_search_keyword_article`.`shop_id`= '".MySqlLegacySupport::getInstance()->real_escape_string($iShopId)."' AND `shop_search_keyword_article`.`name` IN ('".implode("','", $aKeywordList)."') AND (`shop_search_keyword_article`.`cms_language_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($iLanguageId)."' OR `shop_search_keyword_article`.`cms_language_id` = '') "); return TdbShopSearchKeywordArticleList::GetList($query, $iLanguageId); }
php
public static function &GetListForShopKeywords($iShopId, $aKeywordList, $iLanguageId = null) { if (null === $iLanguageId) { $iLanguageId = self::getMyLanguageService()->getActiveLanguageId(); } $aKeywordList = TTools::MysqlRealEscapeArray($aKeywordList); $query = self::GetDefaultQuery($iLanguageId, "`shop_search_keyword_article`.`shop_id`= '".MySqlLegacySupport::getInstance()->real_escape_string($iShopId)."' AND `shop_search_keyword_article`.`name` IN ('".implode("','", $aKeywordList)."') AND (`shop_search_keyword_article`.`cms_language_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($iLanguageId)."' OR `shop_search_keyword_article`.`cms_language_id` = '') "); return TdbShopSearchKeywordArticleList::GetList($query, $iLanguageId); }
[ "public", "static", "function", "&", "GetListForShopKeywords", "(", "$", "iShopId", ",", "$", "aKeywordList", ",", "$", "iLanguageId", "=", "null", ")", "{", "if", "(", "null", "===", "$", "iLanguageId", ")", "{", "$", "iLanguageId", "=", "self", "::", "...
return list for a set of keywords. @param int $iShopId @param array $aKeywordList @param int $iLanguageId @return TdbShopSearchKeywordArticleList
[ "return", "list", "for", "a", "set", "of", "keywords", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/SearchBundle/objects/db/TShopSearchKeywordArticleList.class.php#L23-L32
train
chameleon-system/chameleon-shop
src/ShopDhlPackstationBundle/pkgExtranet/objects/db/TPkgShopDhlPackstation_DataExtranetUser.class.php
TPkgShopDhlPackstation_DataExtranetUser.SetAddressAsBillingAddress
public function SetAddressAsBillingAddress($sAddressId) { $oNewBillingAdr = null; if (0 != strcmp($this->fieldDefaultBillingAddressId, $sAddressId)) { $oAdr = TdbDataExtranetUserAddress::GetNewInstance(); if ($oAdr->LoadFromFields( array('id' => $sAddressId, 'data_extranet_user_id' => $this->id, 'is_dhl_packstation' => '0') ) ) { $this->SaveFieldsFast(array('default_billing_address_id' => $sAddressId)); $oNewBillingAdr = $this->GetBillingAddress(true); } } else { $oNewBillingAdr = $this->GetBillingAddress(); } return $oNewBillingAdr; }
php
public function SetAddressAsBillingAddress($sAddressId) { $oNewBillingAdr = null; if (0 != strcmp($this->fieldDefaultBillingAddressId, $sAddressId)) { $oAdr = TdbDataExtranetUserAddress::GetNewInstance(); if ($oAdr->LoadFromFields( array('id' => $sAddressId, 'data_extranet_user_id' => $this->id, 'is_dhl_packstation' => '0') ) ) { $this->SaveFieldsFast(array('default_billing_address_id' => $sAddressId)); $oNewBillingAdr = $this->GetBillingAddress(true); } } else { $oNewBillingAdr = $this->GetBillingAddress(); } return $oNewBillingAdr; }
[ "public", "function", "SetAddressAsBillingAddress", "(", "$", "sAddressId", ")", "{", "$", "oNewBillingAdr", "=", "null", ";", "if", "(", "0", "!=", "strcmp", "(", "$", "this", "->", "fieldDefaultBillingAddressId", ",", "$", "sAddressId", ")", ")", "{", "$",...
set address as new billing address... will check if the address belongs to the user. @param $sAddressId @return TdbDataExtranetUserAddress
[ "set", "address", "as", "new", "billing", "address", "...", "will", "check", "if", "the", "address", "belongs", "to", "the", "user", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopDhlPackstationBundle/pkgExtranet/objects/db/TPkgShopDhlPackstation_DataExtranetUser.class.php#L21-L38
train
chameleon-system/chameleon-shop
src/ShopDhlPackstationBundle/pkgExtranet/objects/db/TPkgShopDhlPackstation_DataExtranetUser.class.php
TPkgShopDhlPackstation_DataExtranetUser.UpdateShippingAddress
public function UpdateShippingAddress($aAddressData) { $aAddressData = $this->fillPackStationFieldValue($aAddressData); $bChangeDHLPackStation = $this->DHLPackStationStatusChanged($aAddressData); $bIsDHLPackStation = ('0' == $aAddressData['is_dhl_packstation']) ? false : true; $bUpdated = parent::UpdateShippingAddress($aAddressData); if (true === $bUpdated && true === $bChangeDHLPackStation) { $oShippingAddress = $this->GetShippingAddress(); if (false === is_null($oShippingAddress)) { $oShippingAddress->SetIsDhlPackstation($bIsDHLPackStation, false); } } return $bUpdated; }
php
public function UpdateShippingAddress($aAddressData) { $aAddressData = $this->fillPackStationFieldValue($aAddressData); $bChangeDHLPackStation = $this->DHLPackStationStatusChanged($aAddressData); $bIsDHLPackStation = ('0' == $aAddressData['is_dhl_packstation']) ? false : true; $bUpdated = parent::UpdateShippingAddress($aAddressData); if (true === $bUpdated && true === $bChangeDHLPackStation) { $oShippingAddress = $this->GetShippingAddress(); if (false === is_null($oShippingAddress)) { $oShippingAddress->SetIsDhlPackstation($bIsDHLPackStation, false); } } return $bUpdated; }
[ "public", "function", "UpdateShippingAddress", "(", "$", "aAddressData", ")", "{", "$", "aAddressData", "=", "$", "this", "->", "fillPackStationFieldValue", "(", "$", "aAddressData", ")", ";", "$", "bChangeDHLPackStation", "=", "$", "this", "->", "DHLPackStationSt...
clear field for type change after updating address. @param array $aAddressData @return bool
[ "clear", "field", "for", "type", "change", "after", "updating", "address", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopDhlPackstationBundle/pkgExtranet/objects/db/TPkgShopDhlPackstation_DataExtranetUser.class.php#L47-L61
train
chameleon-system/chameleon-shop
src/ShopDhlPackstationBundle/pkgExtranet/objects/db/TPkgShopDhlPackstation_DataExtranetUser.class.php
TPkgShopDhlPackstation_DataExtranetUser.DHLPackStationStatusChanged
public function DHLPackStationStatusChanged($aAddressData) { $bChangeDHLPackStation = false; $aAddressData = $this->fillPackStationFieldValue($aAddressData); $bIsDHLPackStation = ('0' == $aAddressData['is_dhl_packstation']) ? false : true; $oOldAddress = clone $this->GetShippingAddress(); if ($bIsDHLPackStation != $oOldAddress->fieldIsDhlPackstation) { $bChangeDHLPackStation = true; } return $bChangeDHLPackStation; }
php
public function DHLPackStationStatusChanged($aAddressData) { $bChangeDHLPackStation = false; $aAddressData = $this->fillPackStationFieldValue($aAddressData); $bIsDHLPackStation = ('0' == $aAddressData['is_dhl_packstation']) ? false : true; $oOldAddress = clone $this->GetShippingAddress(); if ($bIsDHLPackStation != $oOldAddress->fieldIsDhlPackstation) { $bChangeDHLPackStation = true; } return $bChangeDHLPackStation; }
[ "public", "function", "DHLPackStationStatusChanged", "(", "$", "aAddressData", ")", "{", "$", "bChangeDHLPackStation", "=", "false", ";", "$", "aAddressData", "=", "$", "this", "->", "fillPackStationFieldValue", "(", "$", "aAddressData", ")", ";", "$", "bIsDHLPack...
check if address type status changed. @param array $aAddressData @return bool
[ "check", "if", "address", "type", "status", "changed", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopDhlPackstationBundle/pkgExtranet/objects/db/TPkgShopDhlPackstation_DataExtranetUser.class.php#L86-L97
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShop.class.php
TShop.GetAffilateCode
public function GetAffilateCode() { $sCode = false; if (array_key_exists(TdbShop::SESSION_AFFILIATE_CODE, $_SESSION)) { $sCode = $_SESSION[TdbShop::SESSION_AFFILIATE_CODE]; } return $sCode; }
php
public function GetAffilateCode() { $sCode = false; if (array_key_exists(TdbShop::SESSION_AFFILIATE_CODE, $_SESSION)) { $sCode = $_SESSION[TdbShop::SESSION_AFFILIATE_CODE]; } return $sCode; }
[ "public", "function", "GetAffilateCode", "(", ")", "{", "$", "sCode", "=", "false", ";", "if", "(", "array_key_exists", "(", "TdbShop", "::", "SESSION_AFFILIATE_CODE", ",", "$", "_SESSION", ")", ")", "{", "$", "sCode", "=", "$", "_SESSION", "[", "TdbShop",...
return the affiliate partner code for the current session. @return string
[ "return", "the", "affiliate", "partner", "code", "for", "the", "current", "session", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShop.class.php#L52-L60
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShop.class.php
TShop.SetActiveSearchCacheObject
public function SetActiveSearchCacheObject(TdbShopSearchCache $oActiveSearchCache) { $this->oActiveSearchCache = &$oActiveSearchCache; if (!is_null($oActiveSearchCache)) { $_SESSION[self::SESSION_ACTIVE_SEARCH_CACHE_ID] = base64_encode(serialize($oActiveSearchCache)); } else { unset($_SESSION[self::SESSION_ACTIVE_SEARCH_CACHE_ID]); } }
php
public function SetActiveSearchCacheObject(TdbShopSearchCache $oActiveSearchCache) { $this->oActiveSearchCache = &$oActiveSearchCache; if (!is_null($oActiveSearchCache)) { $_SESSION[self::SESSION_ACTIVE_SEARCH_CACHE_ID] = base64_encode(serialize($oActiveSearchCache)); } else { unset($_SESSION[self::SESSION_ACTIVE_SEARCH_CACHE_ID]); } }
[ "public", "function", "SetActiveSearchCacheObject", "(", "TdbShopSearchCache", "$", "oActiveSearchCache", ")", "{", "$", "this", "->", "oActiveSearchCache", "=", "&", "$", "oActiveSearchCache", ";", "if", "(", "!", "is_null", "(", "$", "oActiveSearchCache", ")", "...
store a copy of the active search object. @param TdbShopSearchCache $oActiveSearchCache
[ "store", "a", "copy", "of", "the", "active", "search", "object", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShop.class.php#L105-L113
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShop.class.php
TShop.&
public function &GetActiveSearchObject() { if (is_null($this->oActiveSearchCache) && array_key_exists(self::SESSION_ACTIVE_SEARCH_CACHE_ID, $_SESSION)) { $this->oActiveSearchCache = unserialize(base64_decode($_SESSION[self::SESSION_ACTIVE_SEARCH_CACHE_ID])); // $this->oActiveSearchCache = TdbShopSearchCache::GetNewInstance(); // if (!$this->oActiveSearchCache->Load($_SESSION[self::SESSION_ACTIVE_SEARCH_CACHE_ID])) $this->oActiveSearchCache = null; } return $this->oActiveSearchCache; }
php
public function &GetActiveSearchObject() { if (is_null($this->oActiveSearchCache) && array_key_exists(self::SESSION_ACTIVE_SEARCH_CACHE_ID, $_SESSION)) { $this->oActiveSearchCache = unserialize(base64_decode($_SESSION[self::SESSION_ACTIVE_SEARCH_CACHE_ID])); // $this->oActiveSearchCache = TdbShopSearchCache::GetNewInstance(); // if (!$this->oActiveSearchCache->Load($_SESSION[self::SESSION_ACTIVE_SEARCH_CACHE_ID])) $this->oActiveSearchCache = null; } return $this->oActiveSearchCache; }
[ "public", "function", "&", "GetActiveSearchObject", "(", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "oActiveSearchCache", ")", "&&", "array_key_exists", "(", "self", "::", "SESSION_ACTIVE_SEARCH_CACHE_ID", ",", "$", "_SESSION", ")", ")", "{", "$",...
return pointer to the search cache object. @return TdbShopSearchCache
[ "return", "pointer", "to", "the", "search", "cache", "object", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShop.class.php#L120-L129
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShop.class.php
TShop.GetActiveManufacturer
public static function GetActiveManufacturer() { static $oActiveManufacturer = 'x'; if ('x' === $oActiveManufacturer) { $oActiveManufacturer = null; $oGlobal = TGlobal::instance(); $iManufacturerId = $oGlobal->GetUserData(MTShopManufacturerArticleCatalogCore::URL_MANUFACTURER_ID); if (empty($iManufacturerId)) { $oItem = self::getShopService()->getActiveProduct(); if (null !== $oItem) { $oActiveManufacturer = $oItem->GetFieldShopManufacturer(); } } else { $oActiveManufacturer = TdbShopManufacturer::GetNewInstance(); if (!$oActiveManufacturer->Load($iManufacturerId)) { $oActiveManufacturer = null; } } } return $oActiveManufacturer; }
php
public static function GetActiveManufacturer() { static $oActiveManufacturer = 'x'; if ('x' === $oActiveManufacturer) { $oActiveManufacturer = null; $oGlobal = TGlobal::instance(); $iManufacturerId = $oGlobal->GetUserData(MTShopManufacturerArticleCatalogCore::URL_MANUFACTURER_ID); if (empty($iManufacturerId)) { $oItem = self::getShopService()->getActiveProduct(); if (null !== $oItem) { $oActiveManufacturer = $oItem->GetFieldShopManufacturer(); } } else { $oActiveManufacturer = TdbShopManufacturer::GetNewInstance(); if (!$oActiveManufacturer->Load($iManufacturerId)) { $oActiveManufacturer = null; } } } return $oActiveManufacturer; }
[ "public", "static", "function", "GetActiveManufacturer", "(", ")", "{", "static", "$", "oActiveManufacturer", "=", "'x'", ";", "if", "(", "'x'", "===", "$", "oActiveManufacturer", ")", "{", "$", "oActiveManufacturer", "=", "null", ";", "$", "oGlobal", "=", "...
Returns the active manufacturer. @return TdbShopManufacturer|null
[ "Returns", "the", "active", "manufacturer", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShop.class.php#L160-L181
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShop.class.php
TShop.GetActiveRootCategory
public static function GetActiveRootCategory() { static $oActiveRootCategory = 'x'; if ('x' === $oActiveRootCategory) { $oActiveRootCategory = null; $oActiveCategory = self::getShopService()->GetActiveCategory(); if (null !== $oActiveCategory) { $oActiveRootCategory = $oActiveCategory->GetRootCategory(); } } return $oActiveRootCategory; }
php
public static function GetActiveRootCategory() { static $oActiveRootCategory = 'x'; if ('x' === $oActiveRootCategory) { $oActiveRootCategory = null; $oActiveCategory = self::getShopService()->GetActiveCategory(); if (null !== $oActiveCategory) { $oActiveRootCategory = $oActiveCategory->GetRootCategory(); } } return $oActiveRootCategory; }
[ "public", "static", "function", "GetActiveRootCategory", "(", ")", "{", "static", "$", "oActiveRootCategory", "=", "'x'", ";", "if", "(", "'x'", "===", "$", "oActiveRootCategory", ")", "{", "$", "oActiveRootCategory", "=", "null", ";", "$", "oActiveCategory", ...
return the active root category. @return TdbShopCategory
[ "return", "the", "active", "root", "category", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShop.class.php#L200-L212
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShop.class.php
TShop.GetActiveFilter
public static function GetActiveFilter() { static $aFilter = 'x'; if ('x' === $aFilter) { $oGlobal = TGlobal::instance(); $aFilter = $oGlobal->GetUserData(MTShopArticleCatalogCore::URL_FILTER); if (!is_array($aFilter)) { $aFilter = array(); } // now reduce filter list to valid filter fields $aValidFilterFields = TdbShop::GetValidFilterFields(); $aValidFilter = array(); foreach ($aValidFilterFields as $sField) { if (array_key_exists($sField, $aFilter)) { $aValidFilter[$sField] = $aFilter[$sField]; } } $aFilter = $aValidFilter; } return $aFilter; }
php
public static function GetActiveFilter() { static $aFilter = 'x'; if ('x' === $aFilter) { $oGlobal = TGlobal::instance(); $aFilter = $oGlobal->GetUserData(MTShopArticleCatalogCore::URL_FILTER); if (!is_array($aFilter)) { $aFilter = array(); } // now reduce filter list to valid filter fields $aValidFilterFields = TdbShop::GetValidFilterFields(); $aValidFilter = array(); foreach ($aValidFilterFields as $sField) { if (array_key_exists($sField, $aFilter)) { $aValidFilter[$sField] = $aFilter[$sField]; } } $aFilter = $aValidFilter; } return $aFilter; }
[ "public", "static", "function", "GetActiveFilter", "(", ")", "{", "static", "$", "aFilter", "=", "'x'", ";", "if", "(", "'x'", "===", "$", "aFilter", ")", "{", "$", "oGlobal", "=", "TGlobal", "::", "instance", "(", ")", ";", "$", "aFilter", "=", "$",...
return current active filter conditions. @return array
[ "return", "current", "active", "filter", "conditions", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShop.class.php#L219-L240
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShop.class.php
TShop.GetActiveFilterString
public static function GetActiveFilterString($sExcludeKey = '') { $aFilter = TdbShop::GetActiveFilter(); $aTmp = array(); foreach ($aFilter as $filterKey => $filterVal) { if ($filterKey != $sExcludeKey) { $aTmp[] = TdbShop::GetFilterSQLString($filterKey, $filterVal); } } return implode(' AND ', $aTmp); }
php
public static function GetActiveFilterString($sExcludeKey = '') { $aFilter = TdbShop::GetActiveFilter(); $aTmp = array(); foreach ($aFilter as $filterKey => $filterVal) { if ($filterKey != $sExcludeKey) { $aTmp[] = TdbShop::GetFilterSQLString($filterKey, $filterVal); } } return implode(' AND ', $aTmp); }
[ "public", "static", "function", "GetActiveFilterString", "(", "$", "sExcludeKey", "=", "''", ")", "{", "$", "aFilter", "=", "TdbShop", "::", "GetActiveFilter", "(", ")", ";", "$", "aTmp", "=", "array", "(", ")", ";", "foreach", "(", "$", "aFilter", "as",...
return an sql string for the current filter. @return string
[ "return", "an", "sql", "string", "for", "the", "current", "filter", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShop.class.php#L247-L258
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShop.class.php
TShop.GetActiveItemVariant
public static function GetActiveItemVariant($oArticle) { $aVariantTypeSelection = TdbShopVariantDisplayHandler::GetActiveVariantTypeSelection(true); if (is_array($aVariantTypeSelection)) { $oSet = &$oArticle->GetFieldShopVariantSet(); if (null === $oSet) { return $oArticle; } $oTypes = &$oSet->GetFieldShopVariantTypeList(); if (count($aVariantTypeSelection) == $oTypes->Length()) { if (!$oArticle->IsVariant()) { $oVariants = &$oArticle->GetFieldShopArticleVariantsList($aVariantTypeSelection); } else { $oParentArticle = $oArticle->GetFieldVariantParent(); $oVariants = &$oParentArticle->GetFieldShopArticleVariantsList($aVariantTypeSelection); } if (1 == $oVariants->Length()) { $oArticle = $oVariants->Current(); } } } elseif (!$oArticle->IsVariant()) { $oVariants = &$oArticle->GetFieldShopArticleVariantsList(); if (1 == $oVariants->Length()) { $oArticle = $oVariants->Current(); } } return $oArticle; }
php
public static function GetActiveItemVariant($oArticle) { $aVariantTypeSelection = TdbShopVariantDisplayHandler::GetActiveVariantTypeSelection(true); if (is_array($aVariantTypeSelection)) { $oSet = &$oArticle->GetFieldShopVariantSet(); if (null === $oSet) { return $oArticle; } $oTypes = &$oSet->GetFieldShopVariantTypeList(); if (count($aVariantTypeSelection) == $oTypes->Length()) { if (!$oArticle->IsVariant()) { $oVariants = &$oArticle->GetFieldShopArticleVariantsList($aVariantTypeSelection); } else { $oParentArticle = $oArticle->GetFieldVariantParent(); $oVariants = &$oParentArticle->GetFieldShopArticleVariantsList($aVariantTypeSelection); } if (1 == $oVariants->Length()) { $oArticle = $oVariants->Current(); } } } elseif (!$oArticle->IsVariant()) { $oVariants = &$oArticle->GetFieldShopArticleVariantsList(); if (1 == $oVariants->Length()) { $oArticle = $oVariants->Current(); } } return $oArticle; }
[ "public", "static", "function", "GetActiveItemVariant", "(", "$", "oArticle", ")", "{", "$", "aVariantTypeSelection", "=", "TdbShopVariantDisplayHandler", "::", "GetActiveVariantTypeSelection", "(", "true", ")", ";", "if", "(", "is_array", "(", "$", "aVariantTypeSelec...
Returns the active variant for given article. If no Variant is active return given article. @param TdbShopArticle $oArticle @return TdbShopArticle
[ "Returns", "the", "active", "variant", "for", "given", "article", ".", "If", "no", "Variant", "is", "active", "return", "given", "article", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShop.class.php#L317-L346
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShop.class.php
TShop.GetSystemPageNames
public function GetSystemPageNames() { $aSystemPages = array(); $oPortal = self::getPortalDomainService()->getActivePortal(); if ($oPortal) { $aSystemPages = $oPortal->GetSystemPageNames(); } return $aSystemPages; }
php
public function GetSystemPageNames() { $aSystemPages = array(); $oPortal = self::getPortalDomainService()->getActivePortal(); if ($oPortal) { $aSystemPages = $oPortal->GetSystemPageNames(); } return $aSystemPages; }
[ "public", "function", "GetSystemPageNames", "(", ")", "{", "$", "aSystemPages", "=", "array", "(", ")", ";", "$", "oPortal", "=", "self", "::", "getPortalDomainService", "(", ")", "->", "getActivePortal", "(", ")", ";", "if", "(", "$", "oPortal", ")", "{...
return list of system page names. @return array
[ "return", "list", "of", "system", "page", "names", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShop.class.php#L519-L528
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShop.class.php
TShop.GetSystemPageNodeId
public function GetSystemPageNodeId($sSystemPageName) { $systemPage = $this->getSystemPageService()->getSystemPage($sSystemPageName); if (null === $systemPage) { return null; } return $systemPage->fieldCmsTreeId; }
php
public function GetSystemPageNodeId($sSystemPageName) { $systemPage = $this->getSystemPageService()->getSystemPage($sSystemPageName); if (null === $systemPage) { return null; } return $systemPage->fieldCmsTreeId; }
[ "public", "function", "GetSystemPageNodeId", "(", "$", "sSystemPageName", ")", "{", "$", "systemPage", "=", "$", "this", "->", "getSystemPageService", "(", ")", "->", "getSystemPage", "(", "$", "sSystemPageName", ")", ";", "if", "(", "null", "===", "$", "sys...
return the node for the system page with the name sSystemPageName. see GetLinkToSystemPage for details. @deprecated since 6.1.0 - use system_page_service::getSystemPage()->fieldCmsTreeId instead @param string $sSystemPageName @return string|null
[ "return", "the", "node", "for", "the", "system", "page", "with", "the", "name", "sSystemPageName", ".", "see", "GetLinkToSystemPage", "for", "details", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShop.class.php#L568-L576
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShop.class.php
TShop.GetShopInfo
public function GetShopInfo($sShopInfoName) { $oInfo = TdbShopSystemInfo::GetNewInstance(); if (!$oInfo->LoadFromFields(array('shop_id' => $this->id, 'name_internal' => $sShopInfoName))) { $oInfo = null; } return $oInfo; }
php
public function GetShopInfo($sShopInfoName) { $oInfo = TdbShopSystemInfo::GetNewInstance(); if (!$oInfo->LoadFromFields(array('shop_id' => $this->id, 'name_internal' => $sShopInfoName))) { $oInfo = null; } return $oInfo; }
[ "public", "function", "GetShopInfo", "(", "$", "sShopInfoName", ")", "{", "$", "oInfo", "=", "TdbShopSystemInfo", "::", "GetNewInstance", "(", ")", ";", "if", "(", "!", "$", "oInfo", "->", "LoadFromFields", "(", "array", "(", "'shop_id'", "=>", "$", "this"...
return the system info with the given name. @param string $sShopInfoName - internal name of the info record @return TdbShopSystemInfo
[ "return", "the", "system", "info", "with", "the", "given", "name", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShop.class.php#L585-L593
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShop.class.php
TShop.RenderShippingInfo
public function RenderShippingInfo($sViewName, $sViewType, $aCallTimeVars = array()) { $oView = new TViewParser(); $oView->AddVar('oShop', $this); $oShippingIntroText = $this->GetShopInfo('shipping-intro'); $oShippingEndText = $this->GetShopInfo('shipping-end'); $oView->AddVar('oShippingIntroText', $oShippingIntroText); $oView->AddVar('oShippingEndText', $oShippingEndText); // get the shipping list for users not sigend in $oPublicShippingGroups = &TdbShopShippingGroupList::GetPublicShippingGroups(); $oView->AddVar('oPublicShippingGroups', $oPublicShippingGroups); $oView->AddVar('aCallTimeVars', $aCallTimeVars); $aOtherParameters = $this->GetAdditionalViewVariables($sViewName, $sViewType); $oView->AddVarArray($aOtherParameters); return $oView->RenderObjectPackageView($sViewName, self::VIEW_PATH, $sViewType); }
php
public function RenderShippingInfo($sViewName, $sViewType, $aCallTimeVars = array()) { $oView = new TViewParser(); $oView->AddVar('oShop', $this); $oShippingIntroText = $this->GetShopInfo('shipping-intro'); $oShippingEndText = $this->GetShopInfo('shipping-end'); $oView->AddVar('oShippingIntroText', $oShippingIntroText); $oView->AddVar('oShippingEndText', $oShippingEndText); // get the shipping list for users not sigend in $oPublicShippingGroups = &TdbShopShippingGroupList::GetPublicShippingGroups(); $oView->AddVar('oPublicShippingGroups', $oPublicShippingGroups); $oView->AddVar('aCallTimeVars', $aCallTimeVars); $aOtherParameters = $this->GetAdditionalViewVariables($sViewName, $sViewType); $oView->AddVarArray($aOtherParameters); return $oView->RenderObjectPackageView($sViewName, self::VIEW_PATH, $sViewType); }
[ "public", "function", "RenderShippingInfo", "(", "$", "sViewName", ",", "$", "sViewType", ",", "$", "aCallTimeVars", "=", "array", "(", ")", ")", "{", "$", "oView", "=", "new", "TViewParser", "(", ")", ";", "$", "oView", "->", "AddVar", "(", "'oShop'", ...
render the shipping infos. @return string
[ "render", "the", "shipping", "infos", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShop.class.php#L602-L620
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShop.class.php
TShop.GetCentralShopHandlerAjaxURL
public function GetCentralShopHandlerAjaxURL($sMethod, $aParameter = array()) { $oGlobal = TGlobal::instance(); $aParameter[MTShopCentralHandler::URL_CALLING_SPOT_NAME] = $oGlobal->GetExecutingModulePointer()->sModuleSpotName; $aRealParams = array('module_fnc' => array($this->fieldShopCentralHandlerSpotName => 'ExecuteAjaxCall'), '_fnc' => $sMethod, MTShopCentralHandler::URL_DATA => $aParameter); $oActivePage = self::getActivePageService()->getActivePage(); return $oActivePage->GetRealURLPlain($aRealParams); }
php
public function GetCentralShopHandlerAjaxURL($sMethod, $aParameter = array()) { $oGlobal = TGlobal::instance(); $aParameter[MTShopCentralHandler::URL_CALLING_SPOT_NAME] = $oGlobal->GetExecutingModulePointer()->sModuleSpotName; $aRealParams = array('module_fnc' => array($this->fieldShopCentralHandlerSpotName => 'ExecuteAjaxCall'), '_fnc' => $sMethod, MTShopCentralHandler::URL_DATA => $aParameter); $oActivePage = self::getActivePageService()->getActivePage(); return $oActivePage->GetRealURLPlain($aRealParams); }
[ "public", "function", "GetCentralShopHandlerAjaxURL", "(", "$", "sMethod", ",", "$", "aParameter", "=", "array", "(", ")", ")", "{", "$", "oGlobal", "=", "TGlobal", "::", "instance", "(", ")", ";", "$", "aParameter", "[", "MTShopCentralHandler", "::", "URL_C...
return ajax url to a function in the central shop handler. @param string $sMethod @param array $aParameter @return string
[ "return", "ajax", "url", "to", "a", "function", "in", "the", "central", "shop", "handler", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShop.class.php#L643-L652
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShop.class.php
TShop.RegisterActiveVariantForSpot
public static function RegisterActiveVariantForSpot($sSpotName, $sParentId, $sShopVariantArticleId) { if (!array_key_exists(TdbShop::SESSION_ACTIVE_VARIANT_ARRAY, $_SESSION)) { $_SESSION[TdbShop::SESSION_ACTIVE_VARIANT_ARRAY] = array(); } if (!array_key_exists($sSpotName, $_SESSION[TdbShop::SESSION_ACTIVE_VARIANT_ARRAY])) { $_SESSION[TdbShop::SESSION_ACTIVE_VARIANT_ARRAY][$sSpotName] = array(); } $_SESSION[TdbShop::SESSION_ACTIVE_VARIANT_ARRAY][$sSpotName][$sParentId] = $sShopVariantArticleId; }
php
public static function RegisterActiveVariantForSpot($sSpotName, $sParentId, $sShopVariantArticleId) { if (!array_key_exists(TdbShop::SESSION_ACTIVE_VARIANT_ARRAY, $_SESSION)) { $_SESSION[TdbShop::SESSION_ACTIVE_VARIANT_ARRAY] = array(); } if (!array_key_exists($sSpotName, $_SESSION[TdbShop::SESSION_ACTIVE_VARIANT_ARRAY])) { $_SESSION[TdbShop::SESSION_ACTIVE_VARIANT_ARRAY][$sSpotName] = array(); } $_SESSION[TdbShop::SESSION_ACTIVE_VARIANT_ARRAY][$sSpotName][$sParentId] = $sShopVariantArticleId; }
[ "public", "static", "function", "RegisterActiveVariantForSpot", "(", "$", "sSpotName", ",", "$", "sParentId", ",", "$", "sShopVariantArticleId", ")", "{", "if", "(", "!", "array_key_exists", "(", "TdbShop", "::", "SESSION_ACTIVE_VARIANT_ARRAY", ",", "$", "_SESSION",...
register the active variant for an article with a spot - this allow us to later refresh all data for that spot without loosing the currentl selected variant info. @param string $sSpotName @param string $sParentId @param string $sShopVariantArticleId
[ "register", "the", "active", "variant", "for", "an", "article", "with", "a", "spot", "-", "this", "allow", "us", "to", "later", "refresh", "all", "data", "for", "that", "spot", "without", "loosing", "the", "currentl", "selected", "variant", "info", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShop.class.php#L679-L688
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShop.class.php
TShop.GetRegisteredActiveVariantForCurrentSpot
public static function GetRegisteredActiveVariantForCurrentSpot($sParentId) { $sShopVariantArticleId = false; if (array_key_exists(TdbShop::SESSION_ACTIVE_VARIANT_ARRAY, $_SESSION)) { $oGlobal = TGlobal::instance(); $oExecutingModuleSpot = $oGlobal->GetExecutingModulePointer(); if ($oExecutingModuleSpot) { $sSpotName = $oExecutingModuleSpot->sModuleSpotName; if (array_key_exists($sSpotName, $_SESSION[TdbShop::SESSION_ACTIVE_VARIANT_ARRAY]) && array_key_exists($sParentId, $_SESSION[TdbShop::SESSION_ACTIVE_VARIANT_ARRAY][$sSpotName])) { $sShopVariantArticleId = $_SESSION[TdbShop::SESSION_ACTIVE_VARIANT_ARRAY][$sSpotName][$sParentId]; } } } return $sShopVariantArticleId; }
php
public static function GetRegisteredActiveVariantForCurrentSpot($sParentId) { $sShopVariantArticleId = false; if (array_key_exists(TdbShop::SESSION_ACTIVE_VARIANT_ARRAY, $_SESSION)) { $oGlobal = TGlobal::instance(); $oExecutingModuleSpot = $oGlobal->GetExecutingModulePointer(); if ($oExecutingModuleSpot) { $sSpotName = $oExecutingModuleSpot->sModuleSpotName; if (array_key_exists($sSpotName, $_SESSION[TdbShop::SESSION_ACTIVE_VARIANT_ARRAY]) && array_key_exists($sParentId, $_SESSION[TdbShop::SESSION_ACTIVE_VARIANT_ARRAY][$sSpotName])) { $sShopVariantArticleId = $_SESSION[TdbShop::SESSION_ACTIVE_VARIANT_ARRAY][$sSpotName][$sParentId]; } } } return $sShopVariantArticleId; }
[ "public", "static", "function", "GetRegisteredActiveVariantForCurrentSpot", "(", "$", "sParentId", ")", "{", "$", "sShopVariantArticleId", "=", "false", ";", "if", "(", "array_key_exists", "(", "TdbShop", "::", "SESSION_ACTIVE_VARIANT_ARRAY", ",", "$", "_SESSION", ")"...
return the active variant for a parent article and a given spot. returns false if no variant has been selected for that parent in the spot yet. @param string $sParentId @return string
[ "return", "the", "active", "variant", "for", "a", "parent", "article", "and", "a", "given", "spot", ".", "returns", "false", "if", "no", "variant", "has", "been", "selected", "for", "that", "parent", "in", "the", "spot", "yet", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShop.class.php#L698-L713
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShop.class.php
TShop.GetURLPageStateParameters
public static function GetURLPageStateParameters() { // ------------------------------------------------------------------------ $oURLData = &TCMSSmartURLData::GetActive(); $aSeoParam = $oURLData->getSeoURLParameters(); $aSeoParam[] = MTShopBasketCoreEndpoint::URL_REQUEST_PARAMETER; $aSeoParam[] = 'module_fnc'; $aSeoParam[] = 'pagedef'; return array_keys(TGlobal::instance()->GetRawUserData(null, $aSeoParam)); }
php
public static function GetURLPageStateParameters() { // ------------------------------------------------------------------------ $oURLData = &TCMSSmartURLData::GetActive(); $aSeoParam = $oURLData->getSeoURLParameters(); $aSeoParam[] = MTShopBasketCoreEndpoint::URL_REQUEST_PARAMETER; $aSeoParam[] = 'module_fnc'; $aSeoParam[] = 'pagedef'; return array_keys(TGlobal::instance()->GetRawUserData(null, $aSeoParam)); }
[ "public", "static", "function", "GetURLPageStateParameters", "(", ")", "{", "// ------------------------------------------------------------------------", "$", "oURLData", "=", "&", "TCMSSmartURLData", "::", "GetActive", "(", ")", ";", "$", "aSeoParam", "=", "$", "oURLDat...
return an array of all parameters that define a state of a page and therefore must be included in links that want to call an action on a page. @return array
[ "return", "an", "array", "of", "all", "parameters", "that", "define", "a", "state", "of", "a", "page", "and", "therefore", "must", "be", "included", "in", "links", "that", "want", "to", "call", "an", "action", "on", "a", "page", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShop.class.php#L731-L741
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShop.class.php
TShop.CacheGetKey
protected static function CacheGetKey($iPortalId = null) { if (is_null($iPortalId)) { $portal = self::getPortalDomainService()->getActivePortal(); if (null !== $portal) { $iPortalId = $portal->id; } } $aKey = array('class' => 'TdbShop', 'ident' => 'objectInstance', 'portalid' => $iPortalId); return TCacheManager::GetKey($aKey); }
php
protected static function CacheGetKey($iPortalId = null) { if (is_null($iPortalId)) { $portal = self::getPortalDomainService()->getActivePortal(); if (null !== $portal) { $iPortalId = $portal->id; } } $aKey = array('class' => 'TdbShop', 'ident' => 'objectInstance', 'portalid' => $iPortalId); return TCacheManager::GetKey($aKey); }
[ "protected", "static", "function", "CacheGetKey", "(", "$", "iPortalId", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "iPortalId", ")", ")", "{", "$", "portal", "=", "self", "::", "getPortalDomainService", "(", ")", "->", "getActivePortal", "(", ...
get the cache key used to id the object in cache. @param string|int|null $iPortalId @return string
[ "get", "the", "cache", "key", "used", "to", "id", "the", "object", "in", "cache", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShop.class.php#L768-L779
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgoneBase.class.php
TShopPaymentHandlerOgoneBase.GetPaymentURL
protected function GetPaymentURL() { if (IPkgShopOrderPaymentConfig::ENVIRONMENT_PRODUCTION === $this->getEnvironment()) { $sPaymentURL = $this->GetConfigParameter('sOgonePaymentURLLive'); } else { $sPaymentURL = $this->GetConfigParameter('sOgonePaymentURLTest'); } return $sPaymentURL; }
php
protected function GetPaymentURL() { if (IPkgShopOrderPaymentConfig::ENVIRONMENT_PRODUCTION === $this->getEnvironment()) { $sPaymentURL = $this->GetConfigParameter('sOgonePaymentURLLive'); } else { $sPaymentURL = $this->GetConfigParameter('sOgonePaymentURLTest'); } return $sPaymentURL; }
[ "protected", "function", "GetPaymentURL", "(", ")", "{", "if", "(", "IPkgShopOrderPaymentConfig", "::", "ENVIRONMENT_PRODUCTION", "===", "$", "this", "->", "getEnvironment", "(", ")", ")", "{", "$", "sPaymentURL", "=", "$", "this", "->", "GetConfigParameter", "(...
Get the payment service URL to redirect or send post request. @return string
[ "Get", "the", "payment", "service", "URL", "to", "redirect", "or", "send", "post", "request", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgoneBase.class.php#L59-L68
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgoneBase.class.php
TShopPaymentHandlerOgoneBase.CheckIncomingHash
protected function CheckIncomingHash($aURLParameter) { $bIsValid = false; $oGlobal = TGlobal::instance(); $sSharedSecret = $this->GetConfigParameter('sSharedSecretIn'); $sIncomingHash = $oGlobal->GetUserData('SHASIGN'); $aHashParameter = $this->GetIncomingPaymentParameter(); $sHash = ''; $aURLParameter = array_change_key_case($aURLParameter, CASE_UPPER); if ('' != $sIncomingHash) { foreach ($aHashParameter as $sHashParameter) { if (array_key_exists($sHashParameter, $aURLParameter) && '' != $aURLParameter[$sHashParameter]) { $sHash .= $sHashParameter.'='.$aURLParameter[$sHashParameter].$sSharedSecret; } } $sHash = strtoupper(hash('sha256', $sHash)); if ($sHash == $sIncomingHash) { $bIsValid = true; } } else { $bIsValid = true; } return $bIsValid; }
php
protected function CheckIncomingHash($aURLParameter) { $bIsValid = false; $oGlobal = TGlobal::instance(); $sSharedSecret = $this->GetConfigParameter('sSharedSecretIn'); $sIncomingHash = $oGlobal->GetUserData('SHASIGN'); $aHashParameter = $this->GetIncomingPaymentParameter(); $sHash = ''; $aURLParameter = array_change_key_case($aURLParameter, CASE_UPPER); if ('' != $sIncomingHash) { foreach ($aHashParameter as $sHashParameter) { if (array_key_exists($sHashParameter, $aURLParameter) && '' != $aURLParameter[$sHashParameter]) { $sHash .= $sHashParameter.'='.$aURLParameter[$sHashParameter].$sSharedSecret; } } $sHash = strtoupper(hash('sha256', $sHash)); if ($sHash == $sIncomingHash) { $bIsValid = true; } } else { $bIsValid = true; } return $bIsValid; }
[ "protected", "function", "CheckIncomingHash", "(", "$", "aURLParameter", ")", "{", "$", "bIsValid", "=", "false", ";", "$", "oGlobal", "=", "TGlobal", "::", "instance", "(", ")", ";", "$", "sSharedSecret", "=", "$", "this", "->", "GetConfigParameter", "(", ...
Generate hash with transfer parameter and saved shared secret and compare it with transfer hash. HEADS UP! the OUT key in the shop config has to match the IN Key in the Ogone backend and vice versa @param string $aURLParameter @return bool
[ "Generate", "hash", "with", "transfer", "parameter", "and", "saved", "shared", "secret", "and", "compare", "it", "with", "transfer", "hash", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgoneBase.class.php#L107-L131
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgoneBase.class.php
TShopPaymentHandlerOgoneBase.HandleNotifyMessageForPaymentState
protected function HandleNotifyMessageForPaymentState($sPaymentState, $aParameter, $oOrder) { if (!$oOrder->fieldOrderIsPaid) { if ('9' === $sPaymentState) { $oOrder->SetStatusPaid(true); $oOrder->SetStatusCanceled(false); $this->HandleNotifyOrderOnChange($oOrder, true, true, true); TTools::WriteLogEntry('OGONE: handle notify message order ('.$aParameter['ORDERID'].') was activated and paid by notify (Status 9 paid)', 1, __FILE__, __LINE__); } elseif ('5' === $sPaymentState) { if ($oOrder->fieldCanceled || !$oOrder->fieldSystemOrderSaveCompleted) { $oOrder->SetStatusCanceled(false); $oOrder->SetStatusPaid(false); TTools::WriteLogEntry('OGONE: handle notify message order ('.$aParameter['ORDERID'].') was activated by notify and set to not paid (Status 5 reservation)', 1, __FILE__, __LINE__); $this->HandleNotifyOrderOnChange($oOrder, false, !$oOrder->fieldSystemOrderSaveCompleted, true); } } else { if ('6' === $sPaymentState || '1' === $sPaymentState || '2' === $sPaymentState || '0' === $sPaymentState) { $oOrder->SetStatusCanceled(true); $oOrder->SetStatusPaid(false); $this->HandleNotifyOrderOnChange($oOrder, false, false, true); TTools::WriteLogEntry('OGONE: handle notify message order ('.$aParameter['ORDERID'].') was canceled and set to not paid by notify (Status 0,1,2,6)', 1, __FILE__, __LINE__); } } } else { TTools::WriteLogEntry('OGONE: handle notify message order ('.$aParameter['ORDERID'].') was already paid nothing to do)', 1, __FILE__, __LINE__); } }
php
protected function HandleNotifyMessageForPaymentState($sPaymentState, $aParameter, $oOrder) { if (!$oOrder->fieldOrderIsPaid) { if ('9' === $sPaymentState) { $oOrder->SetStatusPaid(true); $oOrder->SetStatusCanceled(false); $this->HandleNotifyOrderOnChange($oOrder, true, true, true); TTools::WriteLogEntry('OGONE: handle notify message order ('.$aParameter['ORDERID'].') was activated and paid by notify (Status 9 paid)', 1, __FILE__, __LINE__); } elseif ('5' === $sPaymentState) { if ($oOrder->fieldCanceled || !$oOrder->fieldSystemOrderSaveCompleted) { $oOrder->SetStatusCanceled(false); $oOrder->SetStatusPaid(false); TTools::WriteLogEntry('OGONE: handle notify message order ('.$aParameter['ORDERID'].') was activated by notify and set to not paid (Status 5 reservation)', 1, __FILE__, __LINE__); $this->HandleNotifyOrderOnChange($oOrder, false, !$oOrder->fieldSystemOrderSaveCompleted, true); } } else { if ('6' === $sPaymentState || '1' === $sPaymentState || '2' === $sPaymentState || '0' === $sPaymentState) { $oOrder->SetStatusCanceled(true); $oOrder->SetStatusPaid(false); $this->HandleNotifyOrderOnChange($oOrder, false, false, true); TTools::WriteLogEntry('OGONE: handle notify message order ('.$aParameter['ORDERID'].') was canceled and set to not paid by notify (Status 0,1,2,6)', 1, __FILE__, __LINE__); } } } else { TTools::WriteLogEntry('OGONE: handle notify message order ('.$aParameter['ORDERID'].') was already paid nothing to do)', 1, __FILE__, __LINE__); } }
[ "protected", "function", "HandleNotifyMessageForPaymentState", "(", "$", "sPaymentState", ",", "$", "aParameter", ",", "$", "oOrder", ")", "{", "if", "(", "!", "$", "oOrder", "->", "fieldOrderIsPaid", ")", "{", "if", "(", "'9'", "===", "$", "sPaymentState", ...
Handles Ogone notify and update order state depending on notify state. @param string $sPaymentState state of the notified transaction @param array $aParameter @param TdbShopOrder $oOrder
[ "Handles", "Ogone", "notify", "and", "update", "order", "state", "depending", "on", "notify", "state", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerOgoneBase.class.php#L178-L204
train
CHH/sirel
lib/Sirel/Visitor/AbstractVisitor.php
AbstractVisitor.visit
function visit($node) { $method = "visit"; if (is_object($node)) { $method .= join('', explode("\\", get_class($node))); } else { $method .= ucfirst(gettype($node)); } if (!is_callable(array($this, $method))) { throw new UnexpectedValueException(sprintf( "No Visitor Method for Node of Type %s available", is_object($node) ? get_class($node) : gettype($node) )); } return $this->$method($node); }
php
function visit($node) { $method = "visit"; if (is_object($node)) { $method .= join('', explode("\\", get_class($node))); } else { $method .= ucfirst(gettype($node)); } if (!is_callable(array($this, $method))) { throw new UnexpectedValueException(sprintf( "No Visitor Method for Node of Type %s available", is_object($node) ? get_class($node) : gettype($node) )); } return $this->$method($node); }
[ "function", "visit", "(", "$", "node", ")", "{", "$", "method", "=", "\"visit\"", ";", "if", "(", "is_object", "(", "$", "node", ")", ")", "{", "$", "method", ".=", "join", "(", "''", ",", "explode", "(", "\"\\\\\"", ",", "get_class", "(", "$", "...
Inspects the Type of the Node and calls the appropiate type-specific Visitor if possible. For example: - If the Node is of Class "Sirel\\Node\\Equal", then the concrete visitor method "visitSirelNodeEqual" gets called - If the Node is of Type Integer, then the visitor method "visitInt" gets called (the return value of `gettype()`, with the first char uppercased) The visitor method always receives the node, unchanged, as first argument. You may enforce more strict typing in the more specific visitor methods. @throws UnexpectedValueException If no visitor for the Class/Type is found @param mixed $node The Node, can be everything @return mixed The return value of the concrete visitor
[ "Inspects", "the", "Type", "of", "the", "Node", "and", "calls", "the", "appropiate", "type", "-", "specific", "Visitor", "if", "possible", "." ]
7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8
https://github.com/CHH/sirel/blob/7c32b8ed3b975dc18c0e5e257edfd11207e5c8a8/lib/Sirel/Visitor/AbstractVisitor.php#L48-L66
train
chameleon-system/chameleon-shop
src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Model/CaptureNotification.php
OffAmazonPaymentsNotifications_Model_CaptureNotification.fromXML
public static function fromXML($xml) { $dom = new DOMDocument(); $dom->loadXML($xml); $xpath = new DOMXPath($dom); $xpath->registerNamespace('a', self::getNamespace()); $response = $xpath->query('//a:CaptureNotification'); if ($response->length == 1) { return new OffAmazonPaymentsNotifications_Model_CaptureNotification( $response->item(0) ); } else { throw new Exception( "Unable to construct " . "OffAmazonPaymentsNotifications_Model_CaptureNotification" . "from provided XML. Make sure that CaptureNotification" . "is a root element" ); } }
php
public static function fromXML($xml) { $dom = new DOMDocument(); $dom->loadXML($xml); $xpath = new DOMXPath($dom); $xpath->registerNamespace('a', self::getNamespace()); $response = $xpath->query('//a:CaptureNotification'); if ($response->length == 1) { return new OffAmazonPaymentsNotifications_Model_CaptureNotification( $response->item(0) ); } else { throw new Exception( "Unable to construct " . "OffAmazonPaymentsNotifications_Model_CaptureNotification" . "from provided XML. Make sure that CaptureNotification" . "is a root element" ); } }
[ "public", "static", "function", "fromXML", "(", "$", "xml", ")", "{", "$", "dom", "=", "new", "DOMDocument", "(", ")", ";", "$", "dom", "->", "loadXML", "(", "$", "xml", ")", ";", "$", "xpath", "=", "new", "DOMXPath", "(", "$", "dom", ")", ";", ...
Construct OffAmazonPaymentsNotifications_Model_CaptureNotification from XML string @param string $xml XML string to construct from @return OffAmazonPaymentsNotifications_Model_CaptureNotification
[ "Construct", "OffAmazonPaymentsNotifications_Model_CaptureNotification", "from", "XML", "string" ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Model/CaptureNotification.php#L74-L94
train
chameleon-system/chameleon-shop
src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Model/CaptureNotification.php
OffAmazonPaymentsNotifications_Model_CaptureNotification.toXML
public function toXML() { $xml = ""; $xml .= "<CaptureNotification xmlns=\""; $xml .= self::getNamespace(); $xml .= "\">"; $xml .= $this->_toXMLFragment(); $xml .= "</CaptureNotification>"; return $xml; }
php
public function toXML() { $xml = ""; $xml .= "<CaptureNotification xmlns=\""; $xml .= self::getNamespace(); $xml .= "\">"; $xml .= $this->_toXMLFragment(); $xml .= "</CaptureNotification>"; return $xml; }
[ "public", "function", "toXML", "(", ")", "{", "$", "xml", "=", "\"\"", ";", "$", "xml", ".=", "\"<CaptureNotification xmlns=\\\"\"", ";", "$", "xml", ".=", "self", "::", "getNamespace", "(", ")", ";", "$", "xml", ".=", "\"\\\">\"", ";", "$", "xml", ".=...
XML Representation for this object @return string XML for this object
[ "XML", "Representation", "for", "this", "object" ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Model/CaptureNotification.php#L148-L157
train
PGB-LIV/php-ms
src/Reader/MgfReader.php
MgfReader.getLine
private function getLine() { if ($this->filePeek == null) { return fgets($this->fileHandle); } $ret = $this->filePeek; $this->filePeek = null; return $ret; }
php
private function getLine() { if ($this->filePeek == null) { return fgets($this->fileHandle); } $ret = $this->filePeek; $this->filePeek = null; return $ret; }
[ "private", "function", "getLine", "(", ")", "{", "if", "(", "$", "this", "->", "filePeek", "==", "null", ")", "{", "return", "fgets", "(", "$", "this", "->", "fileHandle", ")", ";", "}", "$", "ret", "=", "$", "this", "->", "filePeek", ";", "$", "...
Gets the next line and increments the file iterator @return string The next line in the file
[ "Gets", "the", "next", "line", "and", "increments", "the", "file", "iterator" ]
091751eb12512f4bc6ada07bda745ce49331e24f
https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Reader/MgfReader.php#L94-L104
train
PGB-LIV/php-ms
src/Reader/MgfReader.php
MgfReader.peekLine
private function peekLine() { if ($this->filePeek == null) { $this->filePeek = fgets($this->fileHandle); } return $this->filePeek; }
php
private function peekLine() { if ($this->filePeek == null) { $this->filePeek = fgets($this->fileHandle); } return $this->filePeek; }
[ "private", "function", "peekLine", "(", ")", "{", "if", "(", "$", "this", "->", "filePeek", "==", "null", ")", "{", "$", "this", "->", "filePeek", "=", "fgets", "(", "$", "this", "->", "fileHandle", ")", ";", "}", "return", "$", "this", "->", "file...
Gets the next line, though does not move the file iterator @return string The next line in the file
[ "Gets", "the", "next", "line", "though", "does", "not", "move", "the", "file", "iterator" ]
091751eb12512f4bc6ada07bda745ce49331e24f
https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Reader/MgfReader.php#L111-L118
train
PGB-LIV/php-ms
src/Reader/MgfReader.php
MgfReader.parseMeta
private function parseMeta(PrecursorIon $precursor) { $line = trim($this->getLine()); $pair = explode('=', $line, 2); $value = $pair[1]; if (is_numeric($value)) { $value += 0; } if ($pair[0] == 'TITLE') { $precursor->setTitle($pair[1]); } elseif ($pair[0] == 'PEPMASS') { $chunks = explode(' ', $pair[1]); if (count($chunks) > 1) { $precursor->setIntensity((float) $chunks[1] + 0); } $this->massCharge = (float) $chunks[0] + 0; } elseif ($pair[0] == 'CHARGE') { $this->charge = (int) $pair[1]; } elseif ($pair[0] == 'SCANS') { $precursor->setScan((int) $pair[1] + 0); } elseif ($pair[0] == 'RTINSECONDS') { $window = explode(',', $pair[1]); if (count($window) == 1) { $precursor->setRetentionTime((float) $window[0] + 0); } else { $precursor->setRetentionTimeWindow((float) $window[0] + 0, (float) $window[1] + 0); } } }
php
private function parseMeta(PrecursorIon $precursor) { $line = trim($this->getLine()); $pair = explode('=', $line, 2); $value = $pair[1]; if (is_numeric($value)) { $value += 0; } if ($pair[0] == 'TITLE') { $precursor->setTitle($pair[1]); } elseif ($pair[0] == 'PEPMASS') { $chunks = explode(' ', $pair[1]); if (count($chunks) > 1) { $precursor->setIntensity((float) $chunks[1] + 0); } $this->massCharge = (float) $chunks[0] + 0; } elseif ($pair[0] == 'CHARGE') { $this->charge = (int) $pair[1]; } elseif ($pair[0] == 'SCANS') { $precursor->setScan((int) $pair[1] + 0); } elseif ($pair[0] == 'RTINSECONDS') { $window = explode(',', $pair[1]); if (count($window) == 1) { $precursor->setRetentionTime((float) $window[0] + 0); } else { $precursor->setRetentionTimeWindow((float) $window[0] + 0, (float) $window[1] + 0); } } }
[ "private", "function", "parseMeta", "(", "PrecursorIon", "$", "precursor", ")", "{", "$", "line", "=", "trim", "(", "$", "this", "->", "getLine", "(", ")", ")", ";", "$", "pair", "=", "explode", "(", "'='", ",", "$", "line", ",", "2", ")", ";", "...
Parses the meta information from the scan and writes it to the precursor entry @param PrecursorIon $precursor The precursor to append to
[ "Parses", "the", "meta", "information", "from", "the", "scan", "and", "writes", "it", "to", "the", "precursor", "entry" ]
091751eb12512f4bc6ada07bda745ce49331e24f
https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Reader/MgfReader.php#L179-L210
train
PGB-LIV/php-ms
src/Reader/MgfReader.php
MgfReader.parseFragments
private function parseFragments(PrecursorIon $precursor) { $line = trim($this->getLine()); if (strlen($line) == 0) { return; } $pair = preg_split('/\\s/', $line, 3); $ion = new FragmentIon(); $fragmentMz = (float) $pair[0]; $fragmentCharge = 1; if (count($pair) > 1) { $ion->setIntensity((float) $pair[1]); } if (count($pair) > 2) { $fragmentCharge = (int) $pair[2]; } $ion->setMonoisotopicMassCharge($fragmentMz, $fragmentCharge); $precursor->addFragmentIon($ion); }
php
private function parseFragments(PrecursorIon $precursor) { $line = trim($this->getLine()); if (strlen($line) == 0) { return; } $pair = preg_split('/\\s/', $line, 3); $ion = new FragmentIon(); $fragmentMz = (float) $pair[0]; $fragmentCharge = 1; if (count($pair) > 1) { $ion->setIntensity((float) $pair[1]); } if (count($pair) > 2) { $fragmentCharge = (int) $pair[2]; } $ion->setMonoisotopicMassCharge($fragmentMz, $fragmentCharge); $precursor->addFragmentIon($ion); }
[ "private", "function", "parseFragments", "(", "PrecursorIon", "$", "precursor", ")", "{", "$", "line", "=", "trim", "(", "$", "this", "->", "getLine", "(", ")", ")", ";", "if", "(", "strlen", "(", "$", "line", ")", "==", "0", ")", "{", "return", ";...
Parses the fragment information from the scan and writes it to the precursor entry @param PrecursorIon $precursor The precursor to append to
[ "Parses", "the", "fragment", "information", "from", "the", "scan", "and", "writes", "it", "to", "the", "precursor", "entry" ]
091751eb12512f4bc6ada07bda745ce49331e24f
https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Reader/MgfReader.php#L218-L243
train
comporu/compo-core
src/Compo/FaqBundle/Controller/FaqController.php
FaqController.indexAction
public function indexAction(Request $request) { $manager = $this->get('compo_faq.manager.faq'); $page = $request->get('page', 1); $pager = $manager->getPager([], $page); $totalPages = $pager->getPageCount(); $seoPage = $this->get('sonata.seo.page'); $seoPage->setContext('faq_list'); $seoPage->addVar('page', $page); $seoPage->addVar('total_pages', $pager->getPageCount()); if (1 !== $page) { $seoPage->setLinkCanonical($manager->getFaqIndexPermalink(['page' => $page], 0)); $metas = $seoPage->getMetas(); $metas['name']['robots'] = 'noindex, follow'; $seoPage->setMetas($metas); } else { $seoPage->setLinkCanonical($manager->getFaqIndexPermalink([], 0)); } if ($totalPages > 1 && $page < $totalPages) { $seoPage->setLinkNext($manager->getFaqIndexPermalink(['page' => $page + 1], 0)); } if ($totalPages > 1 && $page > 1) { $seoPage->setLinkPrev($manager->getFaqIndexPermalink(['page' => $page - 1], 0)); } $seoPage->build(); return $this->render( 'CompoFaqBundle:Faq:index.html.twig', [ 'pager' => $pager, ] ); }
php
public function indexAction(Request $request) { $manager = $this->get('compo_faq.manager.faq'); $page = $request->get('page', 1); $pager = $manager->getPager([], $page); $totalPages = $pager->getPageCount(); $seoPage = $this->get('sonata.seo.page'); $seoPage->setContext('faq_list'); $seoPage->addVar('page', $page); $seoPage->addVar('total_pages', $pager->getPageCount()); if (1 !== $page) { $seoPage->setLinkCanonical($manager->getFaqIndexPermalink(['page' => $page], 0)); $metas = $seoPage->getMetas(); $metas['name']['robots'] = 'noindex, follow'; $seoPage->setMetas($metas); } else { $seoPage->setLinkCanonical($manager->getFaqIndexPermalink([], 0)); } if ($totalPages > 1 && $page < $totalPages) { $seoPage->setLinkNext($manager->getFaqIndexPermalink(['page' => $page + 1], 0)); } if ($totalPages > 1 && $page > 1) { $seoPage->setLinkPrev($manager->getFaqIndexPermalink(['page' => $page - 1], 0)); } $seoPage->build(); return $this->render( 'CompoFaqBundle:Faq:index.html.twig', [ 'pager' => $pager, ] ); }
[ "public", "function", "indexAction", "(", "Request", "$", "request", ")", "{", "$", "manager", "=", "$", "this", "->", "get", "(", "'compo_faq.manager.faq'", ")", ";", "$", "page", "=", "$", "request", "->", "get", "(", "'page'", ",", "1", ")", ";", ...
Lists all article entities. @param Request $request @throws \Throwable @return \Symfony\Component\HttpFoundation\Response
[ "Lists", "all", "article", "entities", "." ]
ebaa9fe8a4b831506c78fdf637da6b4deadec1e2
https://github.com/comporu/compo-core/blob/ebaa9fe8a4b831506c78fdf637da6b4deadec1e2/src/Compo/FaqBundle/Controller/FaqController.php#L29-L68
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopOrderStep/TShopStepOrderCompletedCore.class.php
TShopStepOrderCompletedCore.GetDescriptionVariables
protected function GetDescriptionVariables() { $aParameter = parent::GetDescriptionVariables(); // add some data about the order so that we can display the details on the closing page $oUserOrder = &TShopBasket::GetLastCreatedOrder(); if (!is_null($oUserOrder)) { foreach ($oUserOrder as $sProperty => $sPropertyValue) { if ('field' == substr($sProperty, 0, 5)) { $aParameter[$sProperty] = $sPropertyValue; } } $aParameter['sOrderNumber'] = $oUserOrder->fieldOrdernumber; } $oShop = TdbShop::GetInstance(); // add link to display a printable version of the order $aParameter['sLinkPrintableVersion'] = $oShop->GetLinkToSystemPage('print-order', array('id' => $oUserOrder->id)); $aParameter[strtolower('sLinkPrintableVersion')] = $aParameter['sLinkPrintableVersion']; // links should be all lowercase - some customers force this (and some wysiwyg may require this as well) so we provide both variations $aParameter['oLastOrder'] = $oUserOrder; return $aParameter; }
php
protected function GetDescriptionVariables() { $aParameter = parent::GetDescriptionVariables(); // add some data about the order so that we can display the details on the closing page $oUserOrder = &TShopBasket::GetLastCreatedOrder(); if (!is_null($oUserOrder)) { foreach ($oUserOrder as $sProperty => $sPropertyValue) { if ('field' == substr($sProperty, 0, 5)) { $aParameter[$sProperty] = $sPropertyValue; } } $aParameter['sOrderNumber'] = $oUserOrder->fieldOrdernumber; } $oShop = TdbShop::GetInstance(); // add link to display a printable version of the order $aParameter['sLinkPrintableVersion'] = $oShop->GetLinkToSystemPage('print-order', array('id' => $oUserOrder->id)); $aParameter[strtolower('sLinkPrintableVersion')] = $aParameter['sLinkPrintableVersion']; // links should be all lowercase - some customers force this (and some wysiwyg may require this as well) so we provide both variations $aParameter['oLastOrder'] = $oUserOrder; return $aParameter; }
[ "protected", "function", "GetDescriptionVariables", "(", ")", "{", "$", "aParameter", "=", "parent", "::", "GetDescriptionVariables", "(", ")", ";", "// add some data about the order so that we can display the details on the closing page", "$", "oUserOrder", "=", "&", "TShopB...
method should return any variables that should be replaced in the description field. @return array
[ "method", "should", "return", "any", "variables", "that", "should", "be", "replaced", "in", "the", "description", "field", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrderStep/TShopStepOrderCompletedCore.class.php#L50-L72
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopOrderStep/TShopStepOrderCompletedCore.class.php
TShopStepOrderCompletedCore.Render
public function Render($sSpotName = null, $aCallTimeVars = array()) { $oUser = TdbDataExtranetUser::GetInstance(); if (!is_null($oUser->fieldName) && !$oUser->IsLoggedIn()) { $this->SetLastUserBoughtToSession($oUser); } $sHTML = parent::Render($sSpotName, $aCallTimeVars); TdbShopOrderStep::ResetMarkOrderProcessAsCompleted(); // if the user is not logged in, we need to clear the user object if (empty($oUser->id) || false == $oUser->IsLoggedIn()) { $tmp = $oUser->GetInstance(true); } return $sHTML; }
php
public function Render($sSpotName = null, $aCallTimeVars = array()) { $oUser = TdbDataExtranetUser::GetInstance(); if (!is_null($oUser->fieldName) && !$oUser->IsLoggedIn()) { $this->SetLastUserBoughtToSession($oUser); } $sHTML = parent::Render($sSpotName, $aCallTimeVars); TdbShopOrderStep::ResetMarkOrderProcessAsCompleted(); // if the user is not logged in, we need to clear the user object if (empty($oUser->id) || false == $oUser->IsLoggedIn()) { $tmp = $oUser->GetInstance(true); } return $sHTML; }
[ "public", "function", "Render", "(", "$", "sSpotName", "=", "null", ",", "$", "aCallTimeVars", "=", "array", "(", ")", ")", "{", "$", "oUser", "=", "TdbDataExtranetUser", "::", "GetInstance", "(", ")", ";", "if", "(", "!", "is_null", "(", "$", "oUser",...
used to display the step. @param array $aCallTimeVars - place any custom vars that you want to pass through the call here @return string
[ "used", "to", "display", "the", "step", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrderStep/TShopStepOrderCompletedCore.class.php#L81-L96
train
edmondscommerce/doctrine-static-meta
src/EntityManager/RetryConnection/Statement.php
Statement.createStatement
private function createStatement() { $this->wrappedStatement = $this->connection->prepareUnwrapped($this->sql); foreach ($this->params as $params) { $this->bindParam(...$params); } $this->params = []; foreach ($this->values as $values) { $this->bindValue(...$values); } $this->values = []; }
php
private function createStatement() { $this->wrappedStatement = $this->connection->prepareUnwrapped($this->sql); foreach ($this->params as $params) { $this->bindParam(...$params); } $this->params = []; foreach ($this->values as $values) { $this->bindValue(...$values); } $this->values = []; }
[ "private", "function", "createStatement", "(", ")", "{", "$", "this", "->", "wrappedStatement", "=", "$", "this", "->", "connection", "->", "prepareUnwrapped", "(", "$", "this", "->", "sql", ")", ";", "foreach", "(", "$", "this", "->", "params", "as", "$...
Create Statement.
[ "Create", "Statement", "." ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/EntityManager/RetryConnection/Statement.php#L52-L63
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopShippingGroupList.class.php
TShopShippingGroupList.&
public static function &GetAvailableShippingGroups() { $oList = &TdbShopShippingGroupList::GetList(); $oList->bAllowItemCache = true; $oList->RemoveInvalidItems(); $oList->GoToStart(); return $oList; }
php
public static function &GetAvailableShippingGroups() { $oList = &TdbShopShippingGroupList::GetList(); $oList->bAllowItemCache = true; $oList->RemoveInvalidItems(); $oList->GoToStart(); return $oList; }
[ "public", "static", "function", "&", "GetAvailableShippingGroups", "(", ")", "{", "$", "oList", "=", "&", "TdbShopShippingGroupList", "::", "GetList", "(", ")", ";", "$", "oList", "->", "bAllowItemCache", "=", "true", ";", "$", "oList", "->", "RemoveInvalidIte...
return all shipping groups available to the current user with the current basket. @return TdbShopShippingGroupList
[ "return", "all", "shipping", "groups", "available", "to", "the", "current", "user", "with", "the", "current", "basket", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopShippingGroupList.class.php#L19-L27
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopShippingGroupList.class.php
TShopShippingGroupList.&
public static function &GetShippingGroupsThatAllowPaymentWith($sPaymentInternalName) { $oList = &TdbShopShippingGroupList::GetAvailableShippingGroups(); $bFound = false; $oShippingGroup = null; while (!$bFound && ($oShippingGroup = &$oList->Next())) { $oPaymentMethods = &$oShippingGroup->GetValidPaymentMethods(); $oPayPal = $oPaymentMethods->FindItemWithProperty('fieldNameInternal', $sPaymentInternalName); if ($oPayPal) { $bFound = true; } } if (!$bFound) { $oShippingGroup = false; } return $oShippingGroup; }
php
public static function &GetShippingGroupsThatAllowPaymentWith($sPaymentInternalName) { $oList = &TdbShopShippingGroupList::GetAvailableShippingGroups(); $bFound = false; $oShippingGroup = null; while (!$bFound && ($oShippingGroup = &$oList->Next())) { $oPaymentMethods = &$oShippingGroup->GetValidPaymentMethods(); $oPayPal = $oPaymentMethods->FindItemWithProperty('fieldNameInternal', $sPaymentInternalName); if ($oPayPal) { $bFound = true; } } if (!$bFound) { $oShippingGroup = false; } return $oShippingGroup; }
[ "public", "static", "function", "&", "GetShippingGroupsThatAllowPaymentWith", "(", "$", "sPaymentInternalName", ")", "{", "$", "oList", "=", "&", "TdbShopShippingGroupList", "::", "GetAvailableShippingGroups", "(", ")", ";", "$", "bFound", "=", "false", ";", "$", ...
search for a shipping group that supports the given payment type returns false if nothing is found. @param string $sPaymentInternalName @return bool
[ "search", "for", "a", "shipping", "group", "that", "supports", "the", "given", "payment", "type", "returns", "false", "if", "nothing", "is", "found", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopShippingGroupList.class.php#L37-L55
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopShippingGroupList.class.php
TShopShippingGroupList.&
public static function &GetPublicShippingGroups() { $oList = &TdbShopShippingGroupList::GetList(); $oList->bAllowItemCache = true; $oList->RemoveRestrictedItems(); return $oList; }
php
public static function &GetPublicShippingGroups() { $oList = &TdbShopShippingGroupList::GetList(); $oList->bAllowItemCache = true; $oList->RemoveRestrictedItems(); return $oList; }
[ "public", "static", "function", "&", "GetPublicShippingGroups", "(", ")", "{", "$", "oList", "=", "&", "TdbShopShippingGroupList", "::", "GetList", "(", ")", ";", "$", "oList", "->", "bAllowItemCache", "=", "true", ";", "$", "oList", "->", "RemoveRestrictedIte...
return all shipping groups that have no user restriction. @return TdbShopShippingGroupList
[ "return", "all", "shipping", "groups", "that", "have", "no", "user", "restriction", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopShippingGroupList.class.php#L62-L69
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/db/TShopShippingGroupList.class.php
TShopShippingGroupList.RemoveInvalidItems
public function RemoveInvalidItems() { // since this is a tcmsrecord list, we need to collect all valid ids, and the reload the list with them $oBasket = TShopBasket::GetInstance(); $aValidIds = array(); $this->GoToStart(); $aValidShippingGroupItems = array(); while ($oItem = &$this->Next()) { $oBasket->ResetAllShippingMarkers(); // we need to reset the shipping marker on every group call - since we want // to consider every single item in the basket if ($oItem->isAvailableIgnoreGroupRestriction()) { $aValidIds[] = MySqlLegacySupport::getInstance()->real_escape_string($oItem->id); $aValidShippingGroupItems['x'.$oItem->id] = $oItem; } } $oBasket->ResetAllShippingMarkers(); // once we are done, we want to clear the marker again // remove any shipping groups that are not allowed to be shown when other shipping groups are available $aRealValidIds = array(); foreach ($aValidIds as $sShippingGroupId) { /** @var $oItem TdbShopShippingGroup */ $oItem = $aValidShippingGroupItems['x'.$sShippingGroupId]; if ($oItem->allowedForShippingGroupList($aValidIds)) { $aRealValidIds[] = $sShippingGroupId; } } $aValidIds = $aRealValidIds; unset($aRealValidIds); $query = 'SELECT `shop_shipping_group`.* FROM `shop_shipping_group` WHERE '; if (count($aValidIds) > 0) { $query .= " `shop_shipping_group`.`id` IN ('".implode("','", $aValidIds)."') "; } else { $query .= ' 1 = 0 '; } $query .= ' ORDER BY `shop_shipping_group`.`position`'; $this->Load($query); }
php
public function RemoveInvalidItems() { // since this is a tcmsrecord list, we need to collect all valid ids, and the reload the list with them $oBasket = TShopBasket::GetInstance(); $aValidIds = array(); $this->GoToStart(); $aValidShippingGroupItems = array(); while ($oItem = &$this->Next()) { $oBasket->ResetAllShippingMarkers(); // we need to reset the shipping marker on every group call - since we want // to consider every single item in the basket if ($oItem->isAvailableIgnoreGroupRestriction()) { $aValidIds[] = MySqlLegacySupport::getInstance()->real_escape_string($oItem->id); $aValidShippingGroupItems['x'.$oItem->id] = $oItem; } } $oBasket->ResetAllShippingMarkers(); // once we are done, we want to clear the marker again // remove any shipping groups that are not allowed to be shown when other shipping groups are available $aRealValidIds = array(); foreach ($aValidIds as $sShippingGroupId) { /** @var $oItem TdbShopShippingGroup */ $oItem = $aValidShippingGroupItems['x'.$sShippingGroupId]; if ($oItem->allowedForShippingGroupList($aValidIds)) { $aRealValidIds[] = $sShippingGroupId; } } $aValidIds = $aRealValidIds; unset($aRealValidIds); $query = 'SELECT `shop_shipping_group`.* FROM `shop_shipping_group` WHERE '; if (count($aValidIds) > 0) { $query .= " `shop_shipping_group`.`id` IN ('".implode("','", $aValidIds)."') "; } else { $query .= ' 1 = 0 '; } $query .= ' ORDER BY `shop_shipping_group`.`position`'; $this->Load($query); }
[ "public", "function", "RemoveInvalidItems", "(", ")", "{", "// since this is a tcmsrecord list, we need to collect all valid ids, and the reload the list with them", "$", "oBasket", "=", "TShopBasket", "::", "GetInstance", "(", ")", ";", "$", "aValidIds", "=", "array", "(", ...
remove list items that are not permited for the current user or basket.
[ "remove", "list", "items", "that", "are", "not", "permited", "for", "the", "current", "user", "or", "basket", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopShippingGroupList.class.php#L74-L114
train
MetaModels/filter_checkbox
src/FilterSetting/Checkbox.php
Checkbox.getAvailableLanguages
private function getAvailableLanguages(IMetaModel $objMetaModel) { return ($objMetaModel->isTranslated() && $this->get('all_langs')) ? $objMetaModel->getAvailableLanguages() : array($objMetaModel->getActiveLanguage()); }
php
private function getAvailableLanguages(IMetaModel $objMetaModel) { return ($objMetaModel->isTranslated() && $this->get('all_langs')) ? $objMetaModel->getAvailableLanguages() : array($objMetaModel->getActiveLanguage()); }
[ "private", "function", "getAvailableLanguages", "(", "IMetaModel", "$", "objMetaModel", ")", "{", "return", "(", "$", "objMetaModel", "->", "isTranslated", "(", ")", "&&", "$", "this", "->", "get", "(", "'all_langs'", ")", ")", "?", "$", "objMetaModel", "->"...
Get available langauges. @param IMetaModel $objMetaModel The metamodel. @return array|null|\string[]
[ "Get", "available", "langauges", "." ]
613512934656b17a545a45a231e940e26fbd7b6c
https://github.com/MetaModels/filter_checkbox/blob/613512934656b17a545a45a231e940e26fbd7b6c/src/FilterSetting/Checkbox.php#L191-L196
train
MetaModels/filter_checkbox
src/FilterSetting/Checkbox.php
Checkbox.prepareLabel
private function prepareLabel(IAttribute $objAttribute) { return ($this->get('ynmode') == 'radio' || $this->get('ynfield') ? array( ($this->get('label') ?: $objAttribute->getName()), ($this->get('ynmode') == 'yes' ? $GLOBALS['TL_LANG']['MSC']['yes'] : $GLOBALS['TL_LANG']['MSC']['no'] ) ) : array( ($this->get('label') ?: $objAttribute->getName()), ($this->get('ynmode') == 'no' ? sprintf( $GLOBALS['TL_LANG']['MSC']['extended_no'], ($this->get('label') ?: $objAttribute->getName()) ) : ($this->get('label') ?: $objAttribute->getName()) ) ) ); }
php
private function prepareLabel(IAttribute $objAttribute) { return ($this->get('ynmode') == 'radio' || $this->get('ynfield') ? array( ($this->get('label') ?: $objAttribute->getName()), ($this->get('ynmode') == 'yes' ? $GLOBALS['TL_LANG']['MSC']['yes'] : $GLOBALS['TL_LANG']['MSC']['no'] ) ) : array( ($this->get('label') ?: $objAttribute->getName()), ($this->get('ynmode') == 'no' ? sprintf( $GLOBALS['TL_LANG']['MSC']['extended_no'], ($this->get('label') ?: $objAttribute->getName()) ) : ($this->get('label') ?: $objAttribute->getName()) ) ) ); }
[ "private", "function", "prepareLabel", "(", "IAttribute", "$", "objAttribute", ")", "{", "return", "(", "$", "this", "->", "get", "(", "'ynmode'", ")", "==", "'radio'", "||", "$", "this", "->", "get", "(", "'ynfield'", ")", "?", "array", "(", "(", "$",...
Prepare the label depending on yes no mode. @param IAttribute $objAttribute The metamodel attribute. @return array @SuppressWarnings(PHPMD.Superglobals)
[ "Prepare", "the", "label", "depending", "on", "yes", "no", "mode", "." ]
613512934656b17a545a45a231e940e26fbd7b6c
https://github.com/MetaModels/filter_checkbox/blob/613512934656b17a545a45a231e940e26fbd7b6c/src/FilterSetting/Checkbox.php#L207-L229
train
symbiote/silverstripe-cdncontent
code/extensions/CDNFile.php
CDNFile.targetStore
public function targetStore() { if ($this->owner->ParentID) { $store = $this->owner->Parent()->getCDNStore(); return $store; } return $this->contentService->getDefaultStore(); }
php
public function targetStore() { if ($this->owner->ParentID) { $store = $this->owner->Parent()->getCDNStore(); return $store; } return $this->contentService->getDefaultStore(); }
[ "public", "function", "targetStore", "(", ")", "{", "if", "(", "$", "this", "->", "owner", "->", "ParentID", ")", "{", "$", "store", "=", "$", "this", "->", "owner", "->", "Parent", "(", ")", "->", "getCDNStore", "(", ")", ";", "return", "$", "stor...
Return the CDN store that this file should be stored into, based on its parent setting, if no parent is found the ContentService default is returned
[ "Return", "the", "CDN", "store", "that", "this", "file", "should", "be", "stored", "into", "based", "on", "its", "parent", "setting", "if", "no", "parent", "is", "found", "the", "ContentService", "default", "is", "returned" ]
a5f82e802e9addaf98d506cf305a621b873a5c9b
https://github.com/symbiote/silverstripe-cdncontent/blob/a5f82e802e9addaf98d506cf305a621b873a5c9b/code/extensions/CDNFile.php#L154-L161
train
symbiote/silverstripe-cdncontent
code/extensions/CDNFile.php
CDNFile.updateURL
public function updateURL(&$url) { if($this->owner instanceof \Image_Cached || $this->owner instanceof \CdnImage_Cached) { return; /** handled in @link ImageCachedExtension */ } // in the CMS, we do _not_ change the asset $controller = Controller::has_curr() ? Controller::curr() : null; if ($controller instanceof LeftAndMain) { return; } if ($this->owner->CanViewType && $this->owner->getViewType() != CDNFile::ANYONE_PERM) { return; } $cdnLink = $this->getCdnLink(); if ($cdnLink) { $url = $cdnLink; } }
php
public function updateURL(&$url) { if($this->owner instanceof \Image_Cached || $this->owner instanceof \CdnImage_Cached) { return; /** handled in @link ImageCachedExtension */ } // in the CMS, we do _not_ change the asset $controller = Controller::has_curr() ? Controller::curr() : null; if ($controller instanceof LeftAndMain) { return; } if ($this->owner->CanViewType && $this->owner->getViewType() != CDNFile::ANYONE_PERM) { return; } $cdnLink = $this->getCdnLink(); if ($cdnLink) { $url = $cdnLink; } }
[ "public", "function", "updateURL", "(", "&", "$", "url", ")", "{", "if", "(", "$", "this", "->", "owner", "instanceof", "\\", "Image_Cached", "||", "$", "this", "->", "owner", "instanceof", "\\", "CdnImage_Cached", ")", "{", "return", ";", "/** handled in ...
Update the URL used for a file in various locations @param type $url @return null
[ "Update", "the", "URL", "used", "for", "a", "file", "in", "various", "locations" ]
a5f82e802e9addaf98d506cf305a621b873a5c9b
https://github.com/symbiote/silverstripe-cdncontent/blob/a5f82e802e9addaf98d506cf305a621b873a5c9b/code/extensions/CDNFile.php#L189-L208
train
symbiote/silverstripe-cdncontent
code/extensions/CDNFile.php
CDNFile.getSecureURL
public function getSecureURL($expires = 60) { if($this->owner instanceof \Image_Cached || $this->owner instanceof \CdnImage_Cached) { return; } /** @var \FileContent $pointer */ $pointer = $this->owner->obj('CDNFile'); if($pointer->exists()) { $reader = $this->reader(); if ($reader && $this->owner->canView() && method_exists($reader, 'getSecureURL')) { return $reader->getSecureURL($expires); } } }
php
public function getSecureURL($expires = 60) { if($this->owner instanceof \Image_Cached || $this->owner instanceof \CdnImage_Cached) { return; } /** @var \FileContent $pointer */ $pointer = $this->owner->obj('CDNFile'); if($pointer->exists()) { $reader = $this->reader(); if ($reader && $this->owner->canView() && method_exists($reader, 'getSecureURL')) { return $reader->getSecureURL($expires); } } }
[ "public", "function", "getSecureURL", "(", "$", "expires", "=", "60", ")", "{", "if", "(", "$", "this", "->", "owner", "instanceof", "\\", "Image_Cached", "||", "$", "this", "->", "owner", "instanceof", "\\", "CdnImage_Cached", ")", "{", "return", ";", "...
Return a secure url for the file. Currently we expect all secure urls are time limited but other limiting methods nay be supported in the future @param Int $expires number of second the URL will remain valid @return String URL pointing the the resource
[ "Return", "a", "secure", "url", "for", "the", "file", ".", "Currently", "we", "expect", "all", "secure", "urls", "are", "time", "limited", "but", "other", "limiting", "methods", "nay", "be", "supported", "in", "the", "future" ]
a5f82e802e9addaf98d506cf305a621b873a5c9b
https://github.com/symbiote/silverstripe-cdncontent/blob/a5f82e802e9addaf98d506cf305a621b873a5c9b/code/extensions/CDNFile.php#L236-L250
train
symbiote/silverstripe-cdncontent
code/extensions/CDNFile.php
CDNFile.getViewType
public function getViewType() { $perm = null; if ($this->owner->CanViewType == 'Inherit') { if ($this->owner->ParentID) { $perm = $this->owner->Parent()->getViewType(); } else { $member = Member::currentUser(); $perm = $this->owner->defaultPermissions($member); } } else { $perm = $this->owner->CanViewType; } $default = Config::inst()->get('SecureAssets', 'Defaults'); $default = isset($default['Permission']) ? $default['Permission'] : CDNFile::ANYONE_PERM; return $perm ? $perm : $default; }
php
public function getViewType() { $perm = null; if ($this->owner->CanViewType == 'Inherit') { if ($this->owner->ParentID) { $perm = $this->owner->Parent()->getViewType(); } else { $member = Member::currentUser(); $perm = $this->owner->defaultPermissions($member); } } else { $perm = $this->owner->CanViewType; } $default = Config::inst()->get('SecureAssets', 'Defaults'); $default = isset($default['Permission']) ? $default['Permission'] : CDNFile::ANYONE_PERM; return $perm ? $perm : $default; }
[ "public", "function", "getViewType", "(", ")", "{", "$", "perm", "=", "null", ";", "if", "(", "$", "this", "->", "owner", "->", "CanViewType", "==", "'Inherit'", ")", "{", "if", "(", "$", "this", "->", "owner", "->", "ParentID", ")", "{", "$", "per...
Climbs the folder hierarchy until there's a CanViewType that does not equal Inherit @return String The first valid CanViewType of this File
[ "Climbs", "the", "folder", "hierarchy", "until", "there", "s", "a", "CanViewType", "that", "does", "not", "equal", "Inherit" ]
a5f82e802e9addaf98d506cf305a621b873a5c9b
https://github.com/symbiote/silverstripe-cdncontent/blob/a5f82e802e9addaf98d506cf305a621b873a5c9b/code/extensions/CDNFile.php#L257-L276
train
symbiote/silverstripe-cdncontent
code/extensions/CDNFile.php
CDNFile.onBeforeDelete
public function onBeforeDelete() { $store = $this->targetStore(); if (strlen($store)) { Config::inst()->update('File', 'update_filesystem', false); } parent::onBeforeDelete(); }
php
public function onBeforeDelete() { $store = $this->targetStore(); if (strlen($store)) { Config::inst()->update('File', 'update_filesystem', false); } parent::onBeforeDelete(); }
[ "public", "function", "onBeforeDelete", "(", ")", "{", "$", "store", "=", "$", "this", "->", "targetStore", "(", ")", ";", "if", "(", "strlen", "(", "$", "store", ")", ")", "{", "Config", "::", "inst", "(", ")", "->", "update", "(", "'File'", ",", ...
And if deleting don't do so
[ "And", "if", "deleting", "don", "t", "do", "so" ]
a5f82e802e9addaf98d506cf305a621b873a5c9b
https://github.com/symbiote/silverstripe-cdncontent/blob/a5f82e802e9addaf98d506cf305a621b873a5c9b/code/extensions/CDNFile.php#L327-L334
train
symbiote/silverstripe-cdncontent
code/extensions/CDNFile.php
CDNFile.uploadToContentService
public function uploadToContentService() { /** @var \File $file */ $file = $this->owner; $writer = $this->writer(); if (!$writer) { return; } $path = $file->getFullPath(); if (strlen($path) && is_file($path) && file_exists($path)) { $mtime = @filemtime($path); $name = trim($file->getFilename(), '/'); if (!$mtime) { $mtime = '0'; } //Insert the file modified time to make file unique-ish if ($lastPos = strrpos($name, '/')) { // Add in at as last folder name $name = substr($name, 0, $lastPos) . '/' . $mtime . substr($name, $lastPos); } else { //No folder found create one for the mtime $name = $mtime . '/' . $name; } $fileKeyLength = strlen($name); if ($fileKeyLength > CDNFile::MAX_FILE_PATH_LENGTH) { $lastPos = strrpos($name, '/'); $ext = ''; $filename = substr($name, $lastPos + 1); // Try and find a file extension if (strrpos($name, '.') !== false) { // Store and trim extension for later replacement $ext = substr($name, strrpos($name, '.')); $filename = substr($filename, 0, strrpos($filename, '.')); } // add 1 here so we can add in a ~ to indictate truncation $truncateLength = ($fileKeyLength + strlen($ext) + 1) - CDNFile::MAX_FILE_PATH_LENGTH; if (strlen($filename) <= $truncateLength) { // Folder length exceeds CDNFile::MAX_FILE_PATH_LENGTH. MD5 file to prevent file loss log error SS_Log::log("CDNFile: Total file length (folders + name) exceeds " . CDNFile::MAX_FILE_PATH_LENGTH . " characters and can't be " . "trimmed. File key has been MD5 encoded. File key: " . md5($name) . $ext . " Filename: " . "$name", SS_Log::ERR); $name = md5($name) . $ext; } else { // Recombine folder and file name while truncating the filename and appending a ~ then extension $name = substr($name, 0, $lastPos) . '/' . substr($filename, 0, (0 - $truncateLength)) . '~' . $ext; } } $writer->write(fopen($path, 'r'), $name); // writer should now have an id $file->CDNFile = $writer->getContentId(); $file->FileSize = @filesize($path); // check whether it's an image, and handle its dimensions if ($file instanceof CdnImage) { $file->storeDimensions(); } $file->write(); // confirm the remote upload is there, and delete the local file // Oct 2016 - UNLESS the versioned files extension is on, we have to treat it slightly different $this->deleteLocalIfExistsOnContentService(); } }
php
public function uploadToContentService() { /** @var \File $file */ $file = $this->owner; $writer = $this->writer(); if (!$writer) { return; } $path = $file->getFullPath(); if (strlen($path) && is_file($path) && file_exists($path)) { $mtime = @filemtime($path); $name = trim($file->getFilename(), '/'); if (!$mtime) { $mtime = '0'; } //Insert the file modified time to make file unique-ish if ($lastPos = strrpos($name, '/')) { // Add in at as last folder name $name = substr($name, 0, $lastPos) . '/' . $mtime . substr($name, $lastPos); } else { //No folder found create one for the mtime $name = $mtime . '/' . $name; } $fileKeyLength = strlen($name); if ($fileKeyLength > CDNFile::MAX_FILE_PATH_LENGTH) { $lastPos = strrpos($name, '/'); $ext = ''; $filename = substr($name, $lastPos + 1); // Try and find a file extension if (strrpos($name, '.') !== false) { // Store and trim extension for later replacement $ext = substr($name, strrpos($name, '.')); $filename = substr($filename, 0, strrpos($filename, '.')); } // add 1 here so we can add in a ~ to indictate truncation $truncateLength = ($fileKeyLength + strlen($ext) + 1) - CDNFile::MAX_FILE_PATH_LENGTH; if (strlen($filename) <= $truncateLength) { // Folder length exceeds CDNFile::MAX_FILE_PATH_LENGTH. MD5 file to prevent file loss log error SS_Log::log("CDNFile: Total file length (folders + name) exceeds " . CDNFile::MAX_FILE_PATH_LENGTH . " characters and can't be " . "trimmed. File key has been MD5 encoded. File key: " . md5($name) . $ext . " Filename: " . "$name", SS_Log::ERR); $name = md5($name) . $ext; } else { // Recombine folder and file name while truncating the filename and appending a ~ then extension $name = substr($name, 0, $lastPos) . '/' . substr($filename, 0, (0 - $truncateLength)) . '~' . $ext; } } $writer->write(fopen($path, 'r'), $name); // writer should now have an id $file->CDNFile = $writer->getContentId(); $file->FileSize = @filesize($path); // check whether it's an image, and handle its dimensions if ($file instanceof CdnImage) { $file->storeDimensions(); } $file->write(); // confirm the remote upload is there, and delete the local file // Oct 2016 - UNLESS the versioned files extension is on, we have to treat it slightly different $this->deleteLocalIfExistsOnContentService(); } }
[ "public", "function", "uploadToContentService", "(", ")", "{", "/** @var \\File $file */", "$", "file", "=", "$", "this", "->", "owner", ";", "$", "writer", "=", "$", "this", "->", "writer", "(", ")", ";", "if", "(", "!", "$", "writer", ")", "{", "retu...
Upload this content asset to the configured CDN
[ "Upload", "this", "content", "asset", "to", "the", "configured", "CDN" ]
a5f82e802e9addaf98d506cf305a621b873a5c9b
https://github.com/symbiote/silverstripe-cdncontent/blob/a5f82e802e9addaf98d506cf305a621b873a5c9b/code/extensions/CDNFile.php#L403-L471
train
symbiote/silverstripe-cdncontent
code/extensions/CDNFile.php
CDNFile.moveToCdn
public function moveToCdn($newCdn) { $reader = $this->reader(); // gets the _new_ writer $writer = $this->getCDNWriter(); // hooking it to match the current cdn path. $writer->setId($reader->getId()); $writer->write($reader); $this->owner->CDNFile = $writer->getContentId(); $this->owner->write(); // do the same for all versions if ($this->owner->hasExtension('VersionedFileExtension')) { foreach ($this->owner->Versions() as $version) { if ($version->hasMethod('moveToCdn')) { try { $version->moveToCdn($newCdn); } catch (Exception $ex) { } } } } // delete source $newReader = $writer->getReader(); if ($newReader->exists() && $newReader->getContentId() != $reader->getContentId()) { $oldWriter = $reader->getWriter(); $oldWriter->delete(); } }
php
public function moveToCdn($newCdn) { $reader = $this->reader(); // gets the _new_ writer $writer = $this->getCDNWriter(); // hooking it to match the current cdn path. $writer->setId($reader->getId()); $writer->write($reader); $this->owner->CDNFile = $writer->getContentId(); $this->owner->write(); // do the same for all versions if ($this->owner->hasExtension('VersionedFileExtension')) { foreach ($this->owner->Versions() as $version) { if ($version->hasMethod('moveToCdn')) { try { $version->moveToCdn($newCdn); } catch (Exception $ex) { } } } } // delete source $newReader = $writer->getReader(); if ($newReader->exists() && $newReader->getContentId() != $reader->getContentId()) { $oldWriter = $reader->getWriter(); $oldWriter->delete(); } }
[ "public", "function", "moveToCdn", "(", "$", "newCdn", ")", "{", "$", "reader", "=", "$", "this", "->", "reader", "(", ")", ";", "// gets the _new_ writer", "$", "writer", "=", "$", "this", "->", "getCDNWriter", "(", ")", ";", "// hooking it to match the cur...
Moves this file to its same path on the named CDN @param string $newCdn
[ "Moves", "this", "file", "to", "its", "same", "path", "on", "the", "named", "CDN" ]
a5f82e802e9addaf98d506cf305a621b873a5c9b
https://github.com/symbiote/silverstripe-cdncontent/blob/a5f82e802e9addaf98d506cf305a621b873a5c9b/code/extensions/CDNFile.php#L518-L550
train
comporu/compo-core
src/Compo/Sonata/AdminBundle/Admin/BreadcrumbsBuilder.php
BreadcrumbsBuilder.createMenuItem
private function createMenuItem( AdminInterface $admin, ItemInterface $menu, $name, $translationDomain = null, array $options = [] ) { $options = array_merge([ 'extras' => [ 'translation_domain' => $translationDomain, ], ], $options); return $menu->addChild( $admin->getLabelTranslatorStrategy()->getLabel( $name, 'breadcrumb', 'link' ), $options ); }
php
private function createMenuItem( AdminInterface $admin, ItemInterface $menu, $name, $translationDomain = null, array $options = [] ) { $options = array_merge([ 'extras' => [ 'translation_domain' => $translationDomain, ], ], $options); return $menu->addChild( $admin->getLabelTranslatorStrategy()->getLabel( $name, 'breadcrumb', 'link' ), $options ); }
[ "private", "function", "createMenuItem", "(", "AdminInterface", "$", "admin", ",", "ItemInterface", "$", "menu", ",", "$", "name", ",", "$", "translationDomain", "=", "null", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "options", "=", "ar...
Creates a new menu item from a simple name. The name is normalized and translated with the specified translation domain. @param AdminInterface $admin used for translation @param ItemInterface $menu will be modified and returned @param string $name the source of the final label @param string $translationDomain for label translation @param array $options menu item options @return ItemInterface
[ "Creates", "a", "new", "menu", "item", "from", "a", "simple", "name", ".", "The", "name", "is", "normalized", "and", "translated", "with", "the", "specified", "translation", "domain", "." ]
ebaa9fe8a4b831506c78fdf637da6b4deadec1e2
https://github.com/comporu/compo-core/blob/ebaa9fe8a4b831506c78fdf637da6b4deadec1e2/src/Compo/Sonata/AdminBundle/Admin/BreadcrumbsBuilder.php#L182-L203
train
edmondscommerce/doctrine-static-meta
src/CodeGeneration/Creation/Process/ReplaceEntityIdFieldProcess.php
ReplaceEntityIdFieldProcess.getUseStatement
private function getUseStatement(): string { switch ($this->idTraitFqn) { case IdFieldTrait::class: $useStatement = 'use DSM\Fields\Traits\PrimaryKey\IdFieldTrait;'; break; case NonBinaryUuidFieldTrait::class: $useStatement = 'use DSM\Fields\Traits\PrimaryKey\NonBinaryUuidFieldTrait;'; break; case UuidFieldTrait::class: $useStatement = 'use DSM\Fields\Traits\PrimaryKey\UuidFieldTrait;'; break; default: throw new \LogicException('Unknown trait selected ' . $this->idTraitFqn); } return $useStatement; }
php
private function getUseStatement(): string { switch ($this->idTraitFqn) { case IdFieldTrait::class: $useStatement = 'use DSM\Fields\Traits\PrimaryKey\IdFieldTrait;'; break; case NonBinaryUuidFieldTrait::class: $useStatement = 'use DSM\Fields\Traits\PrimaryKey\NonBinaryUuidFieldTrait;'; break; case UuidFieldTrait::class: $useStatement = 'use DSM\Fields\Traits\PrimaryKey\UuidFieldTrait;'; break; default: throw new \LogicException('Unknown trait selected ' . $this->idTraitFqn); } return $useStatement; }
[ "private", "function", "getUseStatement", "(", ")", ":", "string", "{", "switch", "(", "$", "this", "->", "idTraitFqn", ")", "{", "case", "IdFieldTrait", "::", "class", ":", "$", "useStatement", "=", "'use DSM\\Fields\\Traits\\PrimaryKey\\IdFieldTrait;'", ";", "br...
Get the use statement to replace it with @return string
[ "Get", "the", "use", "statement", "to", "replace", "it", "with" ]
c5b1caab0b2e3a84c34082af96529a274f0c3d7e
https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/Creation/Process/ReplaceEntityIdFieldProcess.php#L47-L64
train
Erebot/Erebot
src/Patches.php
Patches.patch
public static function patch() { set_error_handler( function ($errno, $errstr, $errfile, $errline) { if (($errno & error_reporting()) !== $errno) { return false; } throw new \Erebot\ErrorReportingException( $errstr, $errno, $errfile, $errline ); }, E_ALL ); // The name "glob" is already used internally as of PHP 5.3.0. // Moreover, the wrapper returns an XML document, hence "xglob". if (!in_array("xglob", stream_get_wrappers())) { stream_wrapper_register('xglob', '\\Erebot\\XGlobStream', STREAM_IS_URL); } /* Needed to prevent libxml from trying to magically "fix" URLs * included with XInclude as this breaks a lot of things. * This requires libxml >= 2.6.20 (which was released in 2005). */ if (!defined('LIBXML_NOBASEFIX')) { define('LIBXML_NOBASEFIX', 1 << 18); } }
php
public static function patch() { set_error_handler( function ($errno, $errstr, $errfile, $errline) { if (($errno & error_reporting()) !== $errno) { return false; } throw new \Erebot\ErrorReportingException( $errstr, $errno, $errfile, $errline ); }, E_ALL ); // The name "glob" is already used internally as of PHP 5.3.0. // Moreover, the wrapper returns an XML document, hence "xglob". if (!in_array("xglob", stream_get_wrappers())) { stream_wrapper_register('xglob', '\\Erebot\\XGlobStream', STREAM_IS_URL); } /* Needed to prevent libxml from trying to magically "fix" URLs * included with XInclude as this breaks a lot of things. * This requires libxml >= 2.6.20 (which was released in 2005). */ if (!defined('LIBXML_NOBASEFIX')) { define('LIBXML_NOBASEFIX', 1 << 18); } }
[ "public", "static", "function", "patch", "(", ")", "{", "set_error_handler", "(", "function", "(", "$", "errno", ",", "$", "errstr", ",", "$", "errfile", ",", "$", "errline", ")", "{", "if", "(", "(", "$", "errno", "&", "error_reporting", "(", ")", "...
Apply a few patches to PHP. \return This method does not return anything.
[ "Apply", "a", "few", "patches", "to", "PHP", "." ]
691fc3fa8bc6f07061ff2b3798fec76bc3a039aa
https://github.com/Erebot/Erebot/blob/691fc3fa8bc6f07061ff2b3798fec76bc3a039aa/src/Patches.php#L36-L66
train
chameleon-system/chameleon-shop
src/ShopDhlPackstationBundle/pkgShop/objects/db/TShopOrderStep/TPkgShopDhlPackstation_ShopStepUserDataV2.class.php
TPkgShopDhlPackstation_ShopStepUserDataV2.ChangeShippingAddressIsPackstationState
public function ChangeShippingAddressIsPackstationState() { $this->SetPreventProcessStepMethodFromExecuting(true); $bIsDhlPackstation = false; $aShipping = $this->GetShippingAddressData(); if (is_array($aShipping) && array_key_exists('is_dhl_packstation', $aShipping)) { $bIsDhlPackstation = ('1' == $aShipping['is_dhl_packstation']) ? (true) : (false); } $sShippingAdrId = ''; if (is_array($aShipping) && array_key_exists('id', $aShipping)) { $sShippingAdrId = $aShipping['id']; } $oUser = TdbDataExtranetUser::GetInstance(); if (!empty($sShippingAdrId)) { $oAdr = TdbDataExtranetUserAddress::GetNewInstance(); if ($oAdr->LoadFromFields(array('data_extranet_user_id' => $oUser->id, 'id' => $sShippingAdrId))) { $oAdr->SetIsDhlPackstation($bIsDhlPackstation); $this->SetShippingAddressData($oAdr->sqlData); $oUser->GetShippingAddress(true); } } else { $oAdr = TdbDataExtranetUserAddress::GetNewInstance(); $oAdr->LoadFromRowProtected($aShipping); $oAdr->SetIsDhlPackstation($bIsDhlPackstation); $this->SetShippingAddressData($oAdr->sqlData); $oUser->GetShippingAddress(true, true); } if ($bIsDhlPackstation) { $bChangedBillingAddress = false; if ('0' != $this->GetShipToBillingAddress()) { $this->SetShipToBillingAddress('0'); $bChangedBillingAddress = true; } // if the shipping address is also the billing address, then we need to change the billing address $sBillingAdrId = ''; $aBilling = $this->GetBillingAddressData(); if (is_array($aBilling) && array_key_exists('id', $aBilling)) { $sBillingAdrId = $aBilling['id']; } if (!empty($sBillingAdrId) && !empty($aShipping) && 0 == strcmp($sBillingAdrId, $sShippingAdrId)) { $bChangedBillingAddress = true; $aNewBilling = array('selectedAddressId' => $this->GetAnotherAddressFromUser($sBillingAdrId, TdbDataExtranetUserAddress::FORM_DATA_NAME_BILLING)); $this->SetBillingAddressData($aNewBilling); } if ($bChangedBillingAddress) { $oMsgManager = TCMSMessageManager::GetInstance(); $oMsgManager->AddMessage(TdbDataExtranetUserAddress::FORM_DATA_NAME_BILLING, 'PkgShopDhlPackstation-ERROR-BILLING-MAY-NOT-BE-PACKSTATION'); } } }
php
public function ChangeShippingAddressIsPackstationState() { $this->SetPreventProcessStepMethodFromExecuting(true); $bIsDhlPackstation = false; $aShipping = $this->GetShippingAddressData(); if (is_array($aShipping) && array_key_exists('is_dhl_packstation', $aShipping)) { $bIsDhlPackstation = ('1' == $aShipping['is_dhl_packstation']) ? (true) : (false); } $sShippingAdrId = ''; if (is_array($aShipping) && array_key_exists('id', $aShipping)) { $sShippingAdrId = $aShipping['id']; } $oUser = TdbDataExtranetUser::GetInstance(); if (!empty($sShippingAdrId)) { $oAdr = TdbDataExtranetUserAddress::GetNewInstance(); if ($oAdr->LoadFromFields(array('data_extranet_user_id' => $oUser->id, 'id' => $sShippingAdrId))) { $oAdr->SetIsDhlPackstation($bIsDhlPackstation); $this->SetShippingAddressData($oAdr->sqlData); $oUser->GetShippingAddress(true); } } else { $oAdr = TdbDataExtranetUserAddress::GetNewInstance(); $oAdr->LoadFromRowProtected($aShipping); $oAdr->SetIsDhlPackstation($bIsDhlPackstation); $this->SetShippingAddressData($oAdr->sqlData); $oUser->GetShippingAddress(true, true); } if ($bIsDhlPackstation) { $bChangedBillingAddress = false; if ('0' != $this->GetShipToBillingAddress()) { $this->SetShipToBillingAddress('0'); $bChangedBillingAddress = true; } // if the shipping address is also the billing address, then we need to change the billing address $sBillingAdrId = ''; $aBilling = $this->GetBillingAddressData(); if (is_array($aBilling) && array_key_exists('id', $aBilling)) { $sBillingAdrId = $aBilling['id']; } if (!empty($sBillingAdrId) && !empty($aShipping) && 0 == strcmp($sBillingAdrId, $sShippingAdrId)) { $bChangedBillingAddress = true; $aNewBilling = array('selectedAddressId' => $this->GetAnotherAddressFromUser($sBillingAdrId, TdbDataExtranetUserAddress::FORM_DATA_NAME_BILLING)); $this->SetBillingAddressData($aNewBilling); } if ($bChangedBillingAddress) { $oMsgManager = TCMSMessageManager::GetInstance(); $oMsgManager->AddMessage(TdbDataExtranetUserAddress::FORM_DATA_NAME_BILLING, 'PkgShopDhlPackstation-ERROR-BILLING-MAY-NOT-BE-PACKSTATION'); } } }
[ "public", "function", "ChangeShippingAddressIsPackstationState", "(", ")", "{", "$", "this", "->", "SetPreventProcessStepMethodFromExecuting", "(", "true", ")", ";", "$", "bIsDhlPackstation", "=", "false", ";", "$", "aShipping", "=", "$", "this", "->", "GetShippingA...
switch the current shipping address from being a packstation address to a normal address and back.
[ "switch", "the", "current", "shipping", "address", "from", "being", "a", "packstation", "address", "to", "a", "normal", "address", "and", "back", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopDhlPackstationBundle/pkgShop/objects/db/TShopOrderStep/TPkgShopDhlPackstation_ShopStepUserDataV2.class.php#L32-L86
train
chameleon-system/chameleon-shop
src/ShopDhlPackstationBundle/pkgShop/objects/db/TShopOrderStep/TPkgShopDhlPackstation_ShopStepUserDataV2.class.php
TPkgShopDhlPackstation_ShopStepUserDataV2.ChangeSelectedAddress
public function ChangeSelectedAddress() { $oUser = self::getExtranetUserProvider()->getActiveUser(); if ($oUser->IsLoggedIn()) { $newShippingAddressId = $this->GetShippingAddressData('selectedAddressId'); $newBillingAddressId = $this->GetBillingAddressData('selectedAddressId'); if ('new' !== $newShippingAddressId) { $this->updateStepAddressDataForAddressId($newShippingAddressId, $newBillingAddressId); if ($newShippingAddressId === $newBillingAddressId && true === $this->isShipToBillingAddressAndBillingAddressIsPackstation() ) { $this->SetShipToBillingAddress('0'); $newBillingAddress = $oUser->GetBillingAddress(); $this->SetBillingAddressData($newBillingAddress->sqlData); $this->getFlashMessageService()->addMessage( TdbDataExtranetUserAddress::FORM_DATA_NAME_BILLING, 'PkgShopDhlPackstation-ERROR-BILLING-MAY-NOT-BE-PACKSTATION' ); } } } parent::ChangeSelectedAddress(); }
php
public function ChangeSelectedAddress() { $oUser = self::getExtranetUserProvider()->getActiveUser(); if ($oUser->IsLoggedIn()) { $newShippingAddressId = $this->GetShippingAddressData('selectedAddressId'); $newBillingAddressId = $this->GetBillingAddressData('selectedAddressId'); if ('new' !== $newShippingAddressId) { $this->updateStepAddressDataForAddressId($newShippingAddressId, $newBillingAddressId); if ($newShippingAddressId === $newBillingAddressId && true === $this->isShipToBillingAddressAndBillingAddressIsPackstation() ) { $this->SetShipToBillingAddress('0'); $newBillingAddress = $oUser->GetBillingAddress(); $this->SetBillingAddressData($newBillingAddress->sqlData); $this->getFlashMessageService()->addMessage( TdbDataExtranetUserAddress::FORM_DATA_NAME_BILLING, 'PkgShopDhlPackstation-ERROR-BILLING-MAY-NOT-BE-PACKSTATION' ); } } } parent::ChangeSelectedAddress(); }
[ "public", "function", "ChangeSelectedAddress", "(", ")", "{", "$", "oUser", "=", "self", "::", "getExtranetUserProvider", "(", ")", "->", "getActiveUser", "(", ")", ";", "if", "(", "$", "oUser", "->", "IsLoggedIn", "(", ")", ")", "{", "$", "newShippingAddr...
Set correct billing address if new selected shipping address is packstation. {@inheritdoc}
[ "Set", "correct", "billing", "address", "if", "new", "selected", "shipping", "address", "is", "packstation", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopDhlPackstationBundle/pkgShop/objects/db/TShopOrderStep/TPkgShopDhlPackstation_ShopStepUserDataV2.class.php#L179-L202
train
chameleon-system/chameleon-shop
src/ShopDhlPackstationBundle/pkgShop/objects/db/TShopOrderStep/TPkgShopDhlPackstation_ShopStepUserDataV2.class.php
TPkgShopDhlPackstation_ShopStepUserDataV2.updateStepAddressDataForAddressId
private function updateStepAddressDataForAddressId($newShippingAddressId, $newBillingAddressId) { $newBillingAddress = TdbDataExtranetUserAddress::GetNewInstance(); if (true === $newBillingAddress->Load($newBillingAddressId)) { $this->SetBillingAddressData($newBillingAddress->sqlData); } if ($newShippingAddressId === $newBillingAddressId) { $this->SetShippingAddressData($newBillingAddress->sqlData); } else { $newShippingAddress = TdbDataExtranetUserAddress::GetNewInstance(); if (true === $newShippingAddress->Load($newShippingAddressId)) { $this->SetShippingAddressData($newShippingAddress->sqlData); } } }
php
private function updateStepAddressDataForAddressId($newShippingAddressId, $newBillingAddressId) { $newBillingAddress = TdbDataExtranetUserAddress::GetNewInstance(); if (true === $newBillingAddress->Load($newBillingAddressId)) { $this->SetBillingAddressData($newBillingAddress->sqlData); } if ($newShippingAddressId === $newBillingAddressId) { $this->SetShippingAddressData($newBillingAddress->sqlData); } else { $newShippingAddress = TdbDataExtranetUserAddress::GetNewInstance(); if (true === $newShippingAddress->Load($newShippingAddressId)) { $this->SetShippingAddressData($newShippingAddress->sqlData); } } }
[ "private", "function", "updateStepAddressDataForAddressId", "(", "$", "newShippingAddressId", ",", "$", "newBillingAddressId", ")", "{", "$", "newBillingAddress", "=", "TdbDataExtranetUserAddress", "::", "GetNewInstance", "(", ")", ";", "if", "(", "true", "===", "$", ...
Loads given addresses and updates step address data. Needed for address selection to load the new selected address. @param string $newShippingAddressId @param string $newBillingAddressId
[ "Loads", "given", "addresses", "and", "updates", "step", "address", "data", ".", "Needed", "for", "address", "selection", "to", "load", "the", "new", "selected", "address", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopDhlPackstationBundle/pkgShop/objects/db/TShopOrderStep/TPkgShopDhlPackstation_ShopStepUserDataV2.class.php#L220-L234
train
Firesphere/silverstripe-bootstrapmfa
src/Handlers/BootstrapMFALoginHandler.php
BootstrapMFALoginHandler.doLogin
public function doLogin($data, MemberLoginForm $form, HTTPRequest $request) { /** * @var ValidationResult $message * @var Member|MemberExtension $member */ $member = $this->checkLogin($data, $request, $message); if (!$member) { return $this->redirectBack(); } // If we're in grace period, continue to the parent if ($member->isInGracePeriod()) { return parent::doLogin($data, $form, $request); } if ($message->isValid()) { /** @var Session $session */ $session = $request->getSession(); $session->set(BootstrapMFAAuthenticator::SESSION_KEY . '.MemberID', $member->ID); $session->set(BootstrapMFAAuthenticator::SESSION_KEY . '.Data', $data); if (!empty($data['BackURL'])) { $session->set(BootstrapMFAAuthenticator::SESSION_KEY . '.BackURL', $data['BackURL']); } return $this->redirect($this->link('verify')); } return $this->redirectBack(); }
php
public function doLogin($data, MemberLoginForm $form, HTTPRequest $request) { /** * @var ValidationResult $message * @var Member|MemberExtension $member */ $member = $this->checkLogin($data, $request, $message); if (!$member) { return $this->redirectBack(); } // If we're in grace period, continue to the parent if ($member->isInGracePeriod()) { return parent::doLogin($data, $form, $request); } if ($message->isValid()) { /** @var Session $session */ $session = $request->getSession(); $session->set(BootstrapMFAAuthenticator::SESSION_KEY . '.MemberID', $member->ID); $session->set(BootstrapMFAAuthenticator::SESSION_KEY . '.Data', $data); if (!empty($data['BackURL'])) { $session->set(BootstrapMFAAuthenticator::SESSION_KEY . '.BackURL', $data['BackURL']); } return $this->redirect($this->link('verify')); } return $this->redirectBack(); }
[ "public", "function", "doLogin", "(", "$", "data", ",", "MemberLoginForm", "$", "form", ",", "HTTPRequest", "$", "request", ")", "{", "/**\n * @var ValidationResult $message\n * @var Member|MemberExtension $member\n */", "$", "member", "=", "$", "thi...
Override the doLogin method to do our own work here @param array $data @param MemberLoginForm $form @param HTTPRequest $request @return HTTPResponse
[ "Override", "the", "doLogin", "method", "to", "do", "our", "own", "work", "here" ]
8d2d6c6f2f918c8fa157da91550b897816495a4b
https://github.com/Firesphere/silverstripe-bootstrapmfa/blob/8d2d6c6f2f918c8fa157da91550b897816495a4b/src/Handlers/BootstrapMFALoginHandler.php#L91-L121
train
Firesphere/silverstripe-bootstrapmfa
src/Handlers/BootstrapMFALoginHandler.php
BootstrapMFALoginHandler.secondFactor
public function secondFactor(HTTPRequest $request) { $memberID = $request->getSession()->get(BootstrapMFAAuthenticator::SESSION_KEY . '.MemberID'); /** @var Member|MemberExtension $member */ $member = Member::get()->byID($memberID); if (!$member) { // Assume the session has gone state... return $this->redirectBack(); } $primary = $member->PrimaryMFA; $formList = $this->getFormList(); $view = ArrayData::create(['Forms' => ArrayList::create($formList)]); $rendered = [ 'Forms' => $formList, 'Form' => $view->renderWith(self::class . '_MFAForms'), 'Primary' => $primary ]; $this->extend('onBeforeSecondFactor', $rendered, $view); return $rendered; }
php
public function secondFactor(HTTPRequest $request) { $memberID = $request->getSession()->get(BootstrapMFAAuthenticator::SESSION_KEY . '.MemberID'); /** @var Member|MemberExtension $member */ $member = Member::get()->byID($memberID); if (!$member) { // Assume the session has gone state... return $this->redirectBack(); } $primary = $member->PrimaryMFA; $formList = $this->getFormList(); $view = ArrayData::create(['Forms' => ArrayList::create($formList)]); $rendered = [ 'Forms' => $formList, 'Form' => $view->renderWith(self::class . '_MFAForms'), 'Primary' => $primary ]; $this->extend('onBeforeSecondFactor', $rendered, $view); return $rendered; }
[ "public", "function", "secondFactor", "(", "HTTPRequest", "$", "request", ")", "{", "$", "memberID", "=", "$", "request", "->", "getSession", "(", ")", "->", "get", "(", "BootstrapMFAAuthenticator", "::", "SESSION_KEY", ".", "'.MemberID'", ")", ";", "/** @var ...
Render the second factor forms for displaying at the frontend @param HTTPRequest $request @return array @throws \Exception
[ "Render", "the", "second", "factor", "forms", "for", "displaying", "at", "the", "frontend" ]
8d2d6c6f2f918c8fa157da91550b897816495a4b
https://github.com/Firesphere/silverstripe-bootstrapmfa/blob/8d2d6c6f2f918c8fa157da91550b897816495a4b/src/Handlers/BootstrapMFALoginHandler.php#L130-L154
train
Firesphere/silverstripe-bootstrapmfa
src/Handlers/BootstrapMFALoginHandler.php
BootstrapMFALoginHandler.getFormList
protected function getFormList() { $formList = []; foreach ($this->availableAuthenticators as $key => $className) { /** @var BootstrapMFAAuthenticator $class */ $class = Injector::inst()->get($className); $formList[] = $class->getMFAForm($this, static::VERIFICATION_METHOD); } return $formList; }
php
protected function getFormList() { $formList = []; foreach ($this->availableAuthenticators as $key => $className) { /** @var BootstrapMFAAuthenticator $class */ $class = Injector::inst()->get($className); $formList[] = $class->getMFAForm($this, static::VERIFICATION_METHOD); } return $formList; }
[ "protected", "function", "getFormList", "(", ")", "{", "$", "formList", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "availableAuthenticators", "as", "$", "key", "=>", "$", "className", ")", "{", "/** @var BootstrapMFAAuthenticator $class */", "$", "...
Get all MFA forms from the enabled authenticators @return array
[ "Get", "all", "MFA", "forms", "from", "the", "enabled", "authenticators" ]
8d2d6c6f2f918c8fa157da91550b897816495a4b
https://github.com/Firesphere/silverstripe-bootstrapmfa/blob/8d2d6c6f2f918c8fa157da91550b897816495a4b/src/Handlers/BootstrapMFALoginHandler.php#L161-L171
train
chameleon-system/chameleon-shop
src/ShopArticlePreorderBundle/objects/db/TPkgShopArticlePreorder.class.php
TPkgShopArticlePreorder.SendMail
public function SendMail($oArticle = null, $sEmail = '') { // ------------------------------------------------------------------------ static $aPortals = array(); if (null === $oArticle) { $oArticle = $this->GetFieldShopArticle(); } if ('' === $sEmail) { $sEmail = $this->fieldPreorderUserEmail; } if (!is_null($oArticle) && !empty($sEmail)) { $oMail = TdbDataMailProfile::GetProfile('preorder-available'); $sArticleDetailLink = $oArticle->GetDetailLink(true); if (!array_key_exists($this->fieldCmsPortalId, $aPortals)) { $oCMSPortal = TdbCmsPortal::GetNewInstance(); if ($oCMSPortal->Load($this->fieldCmsPortalId)) { $aPortals[$this->fieldCmsPortalId] = $oCMSPortal; } } $sArticleBasketLink = ''; if (array_key_exists($this->fieldCmsPortalId, $aPortals)) { $sArticleBasketLink = 'http://'.$aPortals[$this->fieldCmsPortalId]->GetPrimaryDomain().'/'.TdbShopArticle::URL_EXTERNAL_TO_BASKET_REQUEST.'/id/'.urlencode($oArticle->id); } $oMail->AddData('sUserEmail', $sEmail); $oMail->AddData('sArticleName', $oArticle->GetName()); $oMail->AddData('sArticleDetailLink', $sArticleDetailLink); $oMail->AddData('sArticleBasketLink', $sArticleBasketLink); $oMail->ChangeToAddress($sEmail); $oMail->SendUsingObjectView('emails', 'Customer'); $this->AllowEditByAll(true); $this->Delete(); $this->AllowEditByAll(false); return true; } else { return false; } }
php
public function SendMail($oArticle = null, $sEmail = '') { // ------------------------------------------------------------------------ static $aPortals = array(); if (null === $oArticle) { $oArticle = $this->GetFieldShopArticle(); } if ('' === $sEmail) { $sEmail = $this->fieldPreorderUserEmail; } if (!is_null($oArticle) && !empty($sEmail)) { $oMail = TdbDataMailProfile::GetProfile('preorder-available'); $sArticleDetailLink = $oArticle->GetDetailLink(true); if (!array_key_exists($this->fieldCmsPortalId, $aPortals)) { $oCMSPortal = TdbCmsPortal::GetNewInstance(); if ($oCMSPortal->Load($this->fieldCmsPortalId)) { $aPortals[$this->fieldCmsPortalId] = $oCMSPortal; } } $sArticleBasketLink = ''; if (array_key_exists($this->fieldCmsPortalId, $aPortals)) { $sArticleBasketLink = 'http://'.$aPortals[$this->fieldCmsPortalId]->GetPrimaryDomain().'/'.TdbShopArticle::URL_EXTERNAL_TO_BASKET_REQUEST.'/id/'.urlencode($oArticle->id); } $oMail->AddData('sUserEmail', $sEmail); $oMail->AddData('sArticleName', $oArticle->GetName()); $oMail->AddData('sArticleDetailLink', $sArticleDetailLink); $oMail->AddData('sArticleBasketLink', $sArticleBasketLink); $oMail->ChangeToAddress($sEmail); $oMail->SendUsingObjectView('emails', 'Customer'); $this->AllowEditByAll(true); $this->Delete(); $this->AllowEditByAll(false); return true; } else { return false; } }
[ "public", "function", "SendMail", "(", "$", "oArticle", "=", "null", ",", "$", "sEmail", "=", "''", ")", "{", "// ------------------------------------------------------------------------", "static", "$", "aPortals", "=", "array", "(", ")", ";", "if", "(", "null", ...
send email to users email for the given article. @param TShopArticle $oArticle @param string $sEmail @return bool
[ "send", "email", "to", "users", "email", "for", "the", "given", "article", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticlePreorderBundle/objects/db/TPkgShopArticlePreorder.class.php#L24-L66
train
chameleon-system/chameleon-shop
src/ShopArticlePreorderBundle/objects/db/TPkgShopArticlePreorder.class.php
TPkgShopArticlePreorder.SaveNewPreorder
public function SaveNewPreorder($sArticleId = '') { // ------------------------------------------------------------------------ $oGlobal = TGlobal::instance(); $oMsgManager = TCMSMessageManager::GetInstance(); if ($oGlobal->userDataExists('eMail') && TTools::IsValidEMail($oGlobal->GetuserData('eMail')) && !$oShopArticlePreorder = TdbShopArticlePreorder::LoadFromFields(array('shop_article_id' => $sArticleId, 'preorder_user_email' => $oGlobal->GetuserData('eMail')))) { $activePortal = $this->getPortalDomainService()->getActivePortal(); $aPostData = array('shop_article_id' => $sArticleId, 'preorder_user_email' => $oGlobal->GetuserData('eMail'), 'preorder_date' => date('Y-m-d H:i:s'), 'cms_portal_id' => $activePortal->id); $this->LoadFromRow($aPostData); $this->AllowEditByAll(true); $this->Save(); $this->AllowEditByAll(false); $oMsgManager->AddMessage('mail-preorder-form-eMail', 'SUCCESS-USER-SIGNUP-PREORDER-ARTICLE'); return true; } else { if (!TTools::IsValidEMail($oGlobal->GetuserData('eMail'))) { $oMsgManager->AddMessage('mail-preorder-form-eMail', 'ERROR-E-MAIL-INVALID-INPUT'); return false; } else { if ($oShopArticlePreorder = TdbShopArticlePreorder::LoadFromFields(array('shop_article_id' => $sArticleId, 'preorder_user_email' => $oGlobal->GetuserData('eMail')))) { $oMsgManager->AddMessage('mail-preorder-form-eMail', 'ERROR-USER-SIGNUP-PREORDER-ARTICLE'); return false; } else { return false; } } } }
php
public function SaveNewPreorder($sArticleId = '') { // ------------------------------------------------------------------------ $oGlobal = TGlobal::instance(); $oMsgManager = TCMSMessageManager::GetInstance(); if ($oGlobal->userDataExists('eMail') && TTools::IsValidEMail($oGlobal->GetuserData('eMail')) && !$oShopArticlePreorder = TdbShopArticlePreorder::LoadFromFields(array('shop_article_id' => $sArticleId, 'preorder_user_email' => $oGlobal->GetuserData('eMail')))) { $activePortal = $this->getPortalDomainService()->getActivePortal(); $aPostData = array('shop_article_id' => $sArticleId, 'preorder_user_email' => $oGlobal->GetuserData('eMail'), 'preorder_date' => date('Y-m-d H:i:s'), 'cms_portal_id' => $activePortal->id); $this->LoadFromRow($aPostData); $this->AllowEditByAll(true); $this->Save(); $this->AllowEditByAll(false); $oMsgManager->AddMessage('mail-preorder-form-eMail', 'SUCCESS-USER-SIGNUP-PREORDER-ARTICLE'); return true; } else { if (!TTools::IsValidEMail($oGlobal->GetuserData('eMail'))) { $oMsgManager->AddMessage('mail-preorder-form-eMail', 'ERROR-E-MAIL-INVALID-INPUT'); return false; } else { if ($oShopArticlePreorder = TdbShopArticlePreorder::LoadFromFields(array('shop_article_id' => $sArticleId, 'preorder_user_email' => $oGlobal->GetuserData('eMail')))) { $oMsgManager->AddMessage('mail-preorder-form-eMail', 'ERROR-USER-SIGNUP-PREORDER-ARTICLE'); return false; } else { return false; } } } }
[ "public", "function", "SaveNewPreorder", "(", "$", "sArticleId", "=", "''", ")", "{", "// ------------------------------------------------------------------------", "$", "oGlobal", "=", "TGlobal", "::", "instance", "(", ")", ";", "$", "oMsgManager", "=", "TCMSMessageMan...
save new preorder to the DB. @param string $sArticleId @return bool
[ "save", "new", "preorder", "to", "the", "DB", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticlePreorderBundle/objects/db/TPkgShopArticlePreorder.class.php#L79-L109
train
chameleon-system/chameleon-shop
src/ShopDhlPackstationBundle/pkgExtranet/objects/WebModules/MTExtranet_PkgShopDhlPackstation.class.php
MTExtranet_PkgShopDhlPackstation.UpdateShippingAddress
protected function UpdateShippingAddress($aAddress) { $oUser = TdbDataExtranetUser::GetInstance(); if ($oUser->DHLPackStationStatusChanged($aAddress)) { $aAddress = $oUser->fillPackStationFieldValue($aAddress); if (true === $this->isAddressBillingAddress($aAddress, $oUser) && true === $this->isAddressPackstation($aAddress) ) { $this->getFlashMessage()->addMessage( TdbDataExtranetUserAddress::FORM_DATA_NAME_SHIPPING, 'PkgShopDhlPackstation-ERROR-SHIPPING-IS-BILLING-MAY-NOT-BE-PACKSTATION' ); return false; } $bUpdateOk = $oUser->UpdateShippingAddress($aAddress); $oShippingAddress = $oUser->GetShippingAddress(); if ($oShippingAddress) { $bUpdateOk = $oShippingAddress->ValidateData(TdbDataExtranetUserAddress::FORM_DATA_NAME_SHIPPING); } } else { $bUpdateOk = parent::UpdateShippingAddress($aAddress); } return $bUpdateOk; }
php
protected function UpdateShippingAddress($aAddress) { $oUser = TdbDataExtranetUser::GetInstance(); if ($oUser->DHLPackStationStatusChanged($aAddress)) { $aAddress = $oUser->fillPackStationFieldValue($aAddress); if (true === $this->isAddressBillingAddress($aAddress, $oUser) && true === $this->isAddressPackstation($aAddress) ) { $this->getFlashMessage()->addMessage( TdbDataExtranetUserAddress::FORM_DATA_NAME_SHIPPING, 'PkgShopDhlPackstation-ERROR-SHIPPING-IS-BILLING-MAY-NOT-BE-PACKSTATION' ); return false; } $bUpdateOk = $oUser->UpdateShippingAddress($aAddress); $oShippingAddress = $oUser->GetShippingAddress(); if ($oShippingAddress) { $bUpdateOk = $oShippingAddress->ValidateData(TdbDataExtranetUserAddress::FORM_DATA_NAME_SHIPPING); } } else { $bUpdateOk = parent::UpdateShippingAddress($aAddress); } return $bUpdateOk; }
[ "protected", "function", "UpdateShippingAddress", "(", "$", "aAddress", ")", "{", "$", "oUser", "=", "TdbDataExtranetUser", "::", "GetInstance", "(", ")", ";", "if", "(", "$", "oUser", "->", "DHLPackStationStatusChanged", "(", "$", "aAddress", ")", ")", "{", ...
update the shipping address with the data passed. Set new pack station type before validating @param array $aAddress @return bool
[ "update", "the", "shipping", "address", "with", "the", "data", "passed", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopDhlPackstationBundle/pkgExtranet/objects/WebModules/MTExtranet_PkgShopDhlPackstation.class.php#L25-L50
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/WebModules/MTShopManufacturerArticleCatalogCore/MTShopManufacturerArticleCatalogCore.class.php
MTShopManufacturerArticleCatalogCore.LoadManufacturer
protected function LoadManufacturer() { if (is_null($this->oActiveManufacturer) && !is_null($this->iActiveManufacturerId)) { $this->oActiveManufacturer = TdbShopManufacturer::GetNewInstance(); if (!$this->oActiveManufacturer->Load($this->iActiveManufacturerId)) { $this->oActiveManufacturer = null; // unable to find manufacturer - redirect to not found page $this->getRedirect()->redirect($this->getPortalDomainService()->getActivePortal()->GetFieldPageNotFoundNodePageURL()); } } }
php
protected function LoadManufacturer() { if (is_null($this->oActiveManufacturer) && !is_null($this->iActiveManufacturerId)) { $this->oActiveManufacturer = TdbShopManufacturer::GetNewInstance(); if (!$this->oActiveManufacturer->Load($this->iActiveManufacturerId)) { $this->oActiveManufacturer = null; // unable to find manufacturer - redirect to not found page $this->getRedirect()->redirect($this->getPortalDomainService()->getActivePortal()->GetFieldPageNotFoundNodePageURL()); } } }
[ "protected", "function", "LoadManufacturer", "(", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "oActiveManufacturer", ")", "&&", "!", "is_null", "(", "$", "this", "->", "iActiveManufacturerId", ")", ")", "{", "$", "this", "->", "oActiveManufacture...
load manufacturer and related data.
[ "load", "manufacturer", "and", "related", "data", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/WebModules/MTShopManufacturerArticleCatalogCore/MTShopManufacturerArticleCatalogCore.class.php#L43-L53
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/WebModules/MTShopArticleCatalogCore/MTShopArticleCatalogCoreEndPoint.class.php
MTShopArticleCatalogCoreEndPoint.ChangePageAjax
public function ChangePageAjax($iListIdent = null) { $oResponse = new MTShopArticleListResponse(); /** @var $oResponse MTShopArticleListResponse */ if (null === $iListIdent) { $oGlobal = TGlobal::instance(); $iListIdent = $oGlobal->GetUserData(TdbShopArticleList::URL_LIST_KEY_NAME); } $oListItem = $this->oList; if (null !== $oListItem) { $bViewNameExists = false; $bViewTypeExists = false; $bCallTimeVarsExists = false; $aItemRawData = TdbShopArticleList::GetInstanceDataFromSession($iListIdent); if (is_array($aItemRawData)) { $bViewNameExists = (array_key_exists('sViewName', $aItemRawData)); $bViewTypeExists = (array_key_exists('sViewType', $aItemRawData)); $bCallTimeVarsExists = (array_key_exists('aCallTimeVars', $aItemRawData)); } if ($bViewNameExists && $bViewTypeExists && $bCallTimeVarsExists) { // fetch data for requested item $oResponse->iNumberOfResults = $oListItem->GetNumberOfRecordsForCurrentPage(); $oResponse->bHasNextPage = $oListItem->HasNextPage(); $oResponse->bHasPreviousPage = $oListItem->HasPreviousPage(); $oResponse->sItemPage = $oListItem->Render($aItemRawData['sViewName'], $aItemRawData['sViewType'], $aItemRawData['aCallTimeVars']); $oResponse->iListKey = $iListIdent; } } $_SESSION['iLastPageNumber'] = $oListItem->GetCurrentPageNumber() - 1; return $oResponse; }
php
public function ChangePageAjax($iListIdent = null) { $oResponse = new MTShopArticleListResponse(); /** @var $oResponse MTShopArticleListResponse */ if (null === $iListIdent) { $oGlobal = TGlobal::instance(); $iListIdent = $oGlobal->GetUserData(TdbShopArticleList::URL_LIST_KEY_NAME); } $oListItem = $this->oList; if (null !== $oListItem) { $bViewNameExists = false; $bViewTypeExists = false; $bCallTimeVarsExists = false; $aItemRawData = TdbShopArticleList::GetInstanceDataFromSession($iListIdent); if (is_array($aItemRawData)) { $bViewNameExists = (array_key_exists('sViewName', $aItemRawData)); $bViewTypeExists = (array_key_exists('sViewType', $aItemRawData)); $bCallTimeVarsExists = (array_key_exists('aCallTimeVars', $aItemRawData)); } if ($bViewNameExists && $bViewTypeExists && $bCallTimeVarsExists) { // fetch data for requested item $oResponse->iNumberOfResults = $oListItem->GetNumberOfRecordsForCurrentPage(); $oResponse->bHasNextPage = $oListItem->HasNextPage(); $oResponse->bHasPreviousPage = $oListItem->HasPreviousPage(); $oResponse->sItemPage = $oListItem->Render($aItemRawData['sViewName'], $aItemRawData['sViewType'], $aItemRawData['aCallTimeVars']); $oResponse->iListKey = $iListIdent; } } $_SESSION['iLastPageNumber'] = $oListItem->GetCurrentPageNumber() - 1; return $oResponse; }
[ "public", "function", "ChangePageAjax", "(", "$", "iListIdent", "=", "null", ")", "{", "$", "oResponse", "=", "new", "MTShopArticleListResponse", "(", ")", ";", "/** @var $oResponse MTShopArticleListResponse */", "if", "(", "null", "===", "$", "iListIdent", ")", "...
send a paging signal to the list with iListIdent since we changed the list to act on the signal on its own, we only need to return the result here. @param string $iListIdent @return
[ "send", "a", "paging", "signal", "to", "the", "list", "with", "iListIdent", "since", "we", "changed", "the", "list", "to", "act", "on", "the", "signal", "on", "its", "own", "we", "only", "need", "to", "return", "the", "result", "here", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/WebModules/MTShopArticleCatalogCore/MTShopArticleCatalogCoreEndPoint.class.php#L144-L178
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/WebModules/MTShopArticleCatalogCore/MTShopArticleCatalogCoreEndPoint.class.php
MTShopArticleCatalogCoreEndPoint.WriteReview
public function WriteReview() { // validate user input... $bDataValide = false; $oMsgManager = TCMSMessageManager::GetInstance(); $oGlobal = TGlobal::instance(); $aUserData = $oGlobal->GetUserData(TdbShopArticleReview::INPUT_BASE_NAME); if (is_array($aUserData)) { $bDataValide = true; $sCaptcha = ''; if (array_key_exists('captcha', $aUserData)) { $sCaptcha = trim($aUserData['captcha']); } if (empty($sCaptcha) || $sCaptcha != $this->GetCaptchaValue()) { $bDataValide = false; $oMsgManager->AddMessage( TdbShopArticleReview::MSG_CONSUMER_BASE_NAME.'-captcha', 'INPUT-ERROR-INVALID-CAPTCHA' ); } $aRequiredFields = array('rating', 'author_name', 'author_email'); foreach ($aRequiredFields as $sFieldName) { $sVal = ''; if (array_key_exists($sFieldName, $aUserData)) { $sVal = trim($aUserData[$sFieldName]); } if (empty($sVal)) { $bDataValide = false; $oMsgManager->AddMessage( TdbShopArticleReview::MSG_CONSUMER_BASE_NAME.'-'.$sFieldName, 'ERROR-USER-REQUIRED-FIELD-MISSING' ); } } } if ($bDataValide) { if (!preg_match('#^[0-5]$#', $aUserData['rating'])) { $oMsgManager->AddMessage( TdbShopArticleReview::MSG_CONSUMER_BASE_NAME.'-rating', 'ERROR-INVALID-FIELD-VALUE-RATING' ); $bDataValide = false; } } if ($bDataValide) { // save item $oReviewItem = TdbShopArticleReview::GetNewInstance(); /** @var $oReviewItem TdbShopArticleReview */ $aUserData['shop_article_id'] = $this->iItemId; $oReviewItem->LoadFromRowProtected($aUserData); $oReviewItem->AllowEditByAll(true); $oReviewItem->Save(); // notify the shop owner $oReviewItem->SendNewReviewNotification(); $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-SUBMITTED', $aUserData); $oActiveItm = static::GetActiveItem(); $oActiveCategory = static::GetActiveCategory(); $iActiveCategoryId = null; if (is_object($oActiveCategory)) { $iActiveCategoryId = $oActiveCategory->id; } $sURL = $oActiveItm->GetDetailLink(true, $iActiveCategoryId); $this->controller->HeaderURLRedirect($sURL); } }
php
public function WriteReview() { // validate user input... $bDataValide = false; $oMsgManager = TCMSMessageManager::GetInstance(); $oGlobal = TGlobal::instance(); $aUserData = $oGlobal->GetUserData(TdbShopArticleReview::INPUT_BASE_NAME); if (is_array($aUserData)) { $bDataValide = true; $sCaptcha = ''; if (array_key_exists('captcha', $aUserData)) { $sCaptcha = trim($aUserData['captcha']); } if (empty($sCaptcha) || $sCaptcha != $this->GetCaptchaValue()) { $bDataValide = false; $oMsgManager->AddMessage( TdbShopArticleReview::MSG_CONSUMER_BASE_NAME.'-captcha', 'INPUT-ERROR-INVALID-CAPTCHA' ); } $aRequiredFields = array('rating', 'author_name', 'author_email'); foreach ($aRequiredFields as $sFieldName) { $sVal = ''; if (array_key_exists($sFieldName, $aUserData)) { $sVal = trim($aUserData[$sFieldName]); } if (empty($sVal)) { $bDataValide = false; $oMsgManager->AddMessage( TdbShopArticleReview::MSG_CONSUMER_BASE_NAME.'-'.$sFieldName, 'ERROR-USER-REQUIRED-FIELD-MISSING' ); } } } if ($bDataValide) { if (!preg_match('#^[0-5]$#', $aUserData['rating'])) { $oMsgManager->AddMessage( TdbShopArticleReview::MSG_CONSUMER_BASE_NAME.'-rating', 'ERROR-INVALID-FIELD-VALUE-RATING' ); $bDataValide = false; } } if ($bDataValide) { // save item $oReviewItem = TdbShopArticleReview::GetNewInstance(); /** @var $oReviewItem TdbShopArticleReview */ $aUserData['shop_article_id'] = $this->iItemId; $oReviewItem->LoadFromRowProtected($aUserData); $oReviewItem->AllowEditByAll(true); $oReviewItem->Save(); // notify the shop owner $oReviewItem->SendNewReviewNotification(); $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-SUBMITTED', $aUserData); $oActiveItm = static::GetActiveItem(); $oActiveCategory = static::GetActiveCategory(); $iActiveCategoryId = null; if (is_object($oActiveCategory)) { $iActiveCategoryId = $oActiveCategory->id; } $sURL = $oActiveItm->GetDetailLink(true, $iActiveCategoryId); $this->controller->HeaderURLRedirect($sURL); } }
[ "public", "function", "WriteReview", "(", ")", "{", "// validate user input...", "$", "bDataValide", "=", "false", ";", "$", "oMsgManager", "=", "TCMSMessageManager", "::", "GetInstance", "(", ")", ";", "$", "oGlobal", "=", "TGlobal", "::", "instance", "(", ")...
write a review.
[ "write", "a", "review", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/WebModules/MTShopArticleCatalogCore/MTShopArticleCatalogCoreEndPoint.class.php#L317-L386
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/WebModules/MTShopArticleCatalogCore/MTShopArticleCatalogCoreEndPoint.class.php
MTShopArticleCatalogCoreEndPoint.ViewArticleHook
protected function ViewArticleHook() { $this->SetTemplate('MTShopArticleCatalog', 'system/article'); // add review item and fill with user data $oReviewItem = TdbShopArticleReview::GetNewInstance(); /** @var $oReviewItem TdbShopArticleReview */ $oGlobal = TGlobal::instance(); $aReviewData = array(); if ($oGlobal->UserDataExists(TdbShopArticleReview::INPUT_BASE_NAME)) { $aReviewData = $oGlobal->GetUserData(TdbShopArticleReview::INPUT_BASE_NAME); } else { $oUser = TdbDataExtranetUser::GetInstance(); if ($oUser->IsLoggedIn()) { $aReviewData['author_name'] = $oUser->GetUserAlias(); $aReviewData['author_email'] = $oUser->GetUserEMail(); } } $aReviewData['captcha-question'] = $this->GenerateCaptcha(); if (is_array($aReviewData)) { $oReviewItem->LoadFromRowProtected($aReviewData); } $this->data['oReviewEntryItem'] = &$oReviewItem; }
php
protected function ViewArticleHook() { $this->SetTemplate('MTShopArticleCatalog', 'system/article'); // add review item and fill with user data $oReviewItem = TdbShopArticleReview::GetNewInstance(); /** @var $oReviewItem TdbShopArticleReview */ $oGlobal = TGlobal::instance(); $aReviewData = array(); if ($oGlobal->UserDataExists(TdbShopArticleReview::INPUT_BASE_NAME)) { $aReviewData = $oGlobal->GetUserData(TdbShopArticleReview::INPUT_BASE_NAME); } else { $oUser = TdbDataExtranetUser::GetInstance(); if ($oUser->IsLoggedIn()) { $aReviewData['author_name'] = $oUser->GetUserAlias(); $aReviewData['author_email'] = $oUser->GetUserEMail(); } } $aReviewData['captcha-question'] = $this->GenerateCaptcha(); if (is_array($aReviewData)) { $oReviewItem->LoadFromRowProtected($aReviewData); } $this->data['oReviewEntryItem'] = &$oReviewItem; }
[ "protected", "function", "ViewArticleHook", "(", ")", "{", "$", "this", "->", "SetTemplate", "(", "'MTShopArticleCatalog'", ",", "'system/article'", ")", ";", "// add review item and fill with user data", "$", "oReviewItem", "=", "TdbShopArticleReview", "::", "GetNewInsta...
called if the user requested to view an item.
[ "called", "if", "the", "user", "requested", "to", "view", "an", "item", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/WebModules/MTShopArticleCatalogCore/MTShopArticleCatalogCoreEndPoint.class.php#L413-L437
train
chameleon-system/chameleon-shop
src/ShopBundle/objects/WebModules/MTShopArticleCatalogCore/MTShopArticleCatalogCoreEndPoint.class.php
MTShopArticleCatalogCoreEndPoint.&
protected function &GetOrderByFilterList() { $aFilterIds = $this->oModuleConf->GetMLTIdList('shop_module_articlelist_orderby'); $oList = TdbShopModuleArticlelistOrderbyList::GetListForIds($aFilterIds); $oList->bAllowItemCache = true; // fill item cache $i = 0; while ($oItem = $oList->Next()) { ++$i; } $oList->GoToStart(); return $oList; }
php
protected function &GetOrderByFilterList() { $aFilterIds = $this->oModuleConf->GetMLTIdList('shop_module_articlelist_orderby'); $oList = TdbShopModuleArticlelistOrderbyList::GetListForIds($aFilterIds); $oList->bAllowItemCache = true; // fill item cache $i = 0; while ($oItem = $oList->Next()) { ++$i; } $oList->GoToStart(); return $oList; }
[ "protected", "function", "&", "GetOrderByFilterList", "(", ")", "{", "$", "aFilterIds", "=", "$", "this", "->", "oModuleConf", "->", "GetMLTIdList", "(", "'shop_module_articlelist_orderby'", ")", ";", "$", "oList", "=", "TdbShopModuleArticlelistOrderbyList", "::", "...
return order by list for category view. @return TdbShopModuleArticlelistOrderbyList
[ "return", "order", "by", "list", "for", "category", "view", "." ]
2e47f4eeab604449605ee1867180c9a37a8c208e
https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/WebModules/MTShopArticleCatalogCore/MTShopArticleCatalogCoreEndPoint.class.php#L494-L507
train