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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopCategoryTree/TShopCategoryTree.class.php | TShopCategoryTree.RenderCategoryName | protected function RenderCategoryName($sListFilterItemId = false, $bShowArticleCount = false, $iLevelCount = 1)
{
$aClass = array('CategoryName');
if ($this->bIsActive) {
$aClass[] = 'active';
$aClass[] = 'expanded';
}
$sHtml = '<a class="'.implode(' ', $aClass).'" href="'.$this->GetCategoryURL($sListFilterItemId).'">'.TGlobal::OutHtml($this->oRealCategory->GetName());
if ($bShowArticleCount) {
$sHtml .= $this->RenderCategoryCount();
}
$sHtml .= '</a>';
return $sHtml;
} | php | protected function RenderCategoryName($sListFilterItemId = false, $bShowArticleCount = false, $iLevelCount = 1)
{
$aClass = array('CategoryName');
if ($this->bIsActive) {
$aClass[] = 'active';
$aClass[] = 'expanded';
}
$sHtml = '<a class="'.implode(' ', $aClass).'" href="'.$this->GetCategoryURL($sListFilterItemId).'">'.TGlobal::OutHtml($this->oRealCategory->GetName());
if ($bShowArticleCount) {
$sHtml .= $this->RenderCategoryCount();
}
$sHtml .= '</a>';
return $sHtml;
} | [
"protected",
"function",
"RenderCategoryName",
"(",
"$",
"sListFilterItemId",
"=",
"false",
",",
"$",
"bShowArticleCount",
"=",
"false",
",",
"$",
"iLevelCount",
"=",
"1",
")",
"{",
"$",
"aClass",
"=",
"array",
"(",
"'CategoryName'",
")",
";",
"if",
"(",
"... | Renders the category name and item count.
@param bool $sListFilterItemId
@param bool $bShowArticleCount
@param int $iLevelCount
@return string | [
"Renders",
"the",
"category",
"name",
"and",
"item",
"count",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopCategoryTree/TShopCategoryTree.class.php#L220-L235 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopCategoryTree/TShopCategoryTree.class.php | TShopCategoryTree.GetCategoryURL | protected function GetCategoryURL($sListFilterItemId = false)
{
$sURL = '';
if (!is_null($this->oRealCategory)) {
if ($sListFilterItemId) {
$sURL = $this->GetAddFilterURL($sListFilterItemId);
} else {
$sURL = $this->oRealCategory->GetLink();
}
}
return $sURL;
} | php | protected function GetCategoryURL($sListFilterItemId = false)
{
$sURL = '';
if (!is_null($this->oRealCategory)) {
if ($sListFilterItemId) {
$sURL = $this->GetAddFilterURL($sListFilterItemId);
} else {
$sURL = $this->oRealCategory->GetLink();
}
}
return $sURL;
} | [
"protected",
"function",
"GetCategoryURL",
"(",
"$",
"sListFilterItemId",
"=",
"false",
")",
"{",
"$",
"sURL",
"=",
"''",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"oRealCategory",
")",
")",
"{",
"if",
"(",
"$",
"sListFilterItemId",
")",
... | Returns the URL of the category.
If tree was used as a filter function returns url to filter for the category.
If tree was used as normal category tree then function returns link to category detail page.
@param bool $sListFilterItemId
@return string | [
"Returns",
"the",
"URL",
"of",
"the",
"category",
".",
"If",
"tree",
"was",
"used",
"as",
"a",
"filter",
"function",
"returns",
"url",
"to",
"filter",
"for",
"the",
"category",
".",
"If",
"tree",
"was",
"used",
"as",
"normal",
"category",
"tree",
"then",... | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopCategoryTree/TShopCategoryTree.class.php#L256-L268 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopCategoryTree/TShopCategoryTree.class.php | TShopCategoryTree.GetAddFilterURL | public function GetAddFilterURL($sListFilterItemId)
{
$oActiveListFilter = TdbPkgShopListfilter::GetActiveInstance();
$aURLData = $oActiveListFilter->GetCurrentFilterAsArray();
$aURLData = $this->ClearOtherCategoryTreeFilter($aURLData, $sListFilterItemId);
$aURLData[TdbPkgShopListfilterItem::URL_PARAMETER_FILTER_DATA][$sListFilterItemId][] = $this->oRealCategory->id;
$aURLData[TdbPkgShopListfilter::URL_PARAMETER_IS_NEW_REQUEST] = '1';
return $this->getActivePageService()->getLinkToActivePageRelative($aURLData);
} | php | public function GetAddFilterURL($sListFilterItemId)
{
$oActiveListFilter = TdbPkgShopListfilter::GetActiveInstance();
$aURLData = $oActiveListFilter->GetCurrentFilterAsArray();
$aURLData = $this->ClearOtherCategoryTreeFilter($aURLData, $sListFilterItemId);
$aURLData[TdbPkgShopListfilterItem::URL_PARAMETER_FILTER_DATA][$sListFilterItemId][] = $this->oRealCategory->id;
$aURLData[TdbPkgShopListfilter::URL_PARAMETER_IS_NEW_REQUEST] = '1';
return $this->getActivePageService()->getLinkToActivePageRelative($aURLData);
} | [
"public",
"function",
"GetAddFilterURL",
"(",
"$",
"sListFilterItemId",
")",
"{",
"$",
"oActiveListFilter",
"=",
"TdbPkgShopListfilter",
"::",
"GetActiveInstance",
"(",
")",
";",
"$",
"aURLData",
"=",
"$",
"oActiveListFilter",
"->",
"GetCurrentFilterAsArray",
"(",
"... | return url that sets the filter to the current category.
@param string $sValue | [
"return",
"url",
"that",
"sets",
"the",
"filter",
"to",
"the",
"current",
"category",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopCategoryTree/TShopCategoryTree.class.php#L275-L284 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopCategoryTree/TShopCategoryTree.class.php | TShopCategoryTree.ClearOtherCategoryTreeFilter | protected function ClearOtherCategoryTreeFilter($aURLData, $sListFilterItemId)
{
if (is_array($aURLData) && array_key_exists(TdbPkgShopListfilterItem::URL_PARAMETER_FILTER_DATA, $aURLData) && is_array($aURLData[TdbPkgShopListfilterItem::URL_PARAMETER_FILTER_DATA]) && array_key_exists($sListFilterItemId, $aURLData[TdbPkgShopListfilterItem::URL_PARAMETER_FILTER_DATA])
) {
unset($aURLData[TdbPkgShopListfilterItem::URL_PARAMETER_FILTER_DATA][$sListFilterItemId]);
}
return $aURLData;
} | php | protected function ClearOtherCategoryTreeFilter($aURLData, $sListFilterItemId)
{
if (is_array($aURLData) && array_key_exists(TdbPkgShopListfilterItem::URL_PARAMETER_FILTER_DATA, $aURLData) && is_array($aURLData[TdbPkgShopListfilterItem::URL_PARAMETER_FILTER_DATA]) && array_key_exists($sListFilterItemId, $aURLData[TdbPkgShopListfilterItem::URL_PARAMETER_FILTER_DATA])
) {
unset($aURLData[TdbPkgShopListfilterItem::URL_PARAMETER_FILTER_DATA][$sListFilterItemId]);
}
return $aURLData;
} | [
"protected",
"function",
"ClearOtherCategoryTreeFilter",
"(",
"$",
"aURLData",
",",
"$",
"sListFilterItemId",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"aURLData",
")",
"&&",
"array_key_exists",
"(",
"TdbPkgShopListfilterItem",
"::",
"URL_PARAMETER_FILTER_DATA",
",",... | Clear active category filter for the filter url.
You can filter onyl for one category.
@param $aURLData
@param $sListFilterItemId
@return array | [
"Clear",
"active",
"category",
"filter",
"for",
"the",
"filter",
"url",
".",
"You",
"can",
"filter",
"onyl",
"for",
"one",
"category",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopCategoryTree/TShopCategoryTree.class.php#L295-L303 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopCategoryTree/TShopCategoryTree.class.php | TShopCategoryTree.AddItemCount | public function AddItemCount($sCategoryId, $iArticleCount)
{
$bSet = false;
if (array_key_exists($sCategoryId, $this->aContainingChildCategories)) {
$this->iAllItemCount = $this->iAllItemCount + $iArticleCount;
if (!is_null($this->oChildCategoryTreeList)) {
$this->oChildCategoryTreeList->GoToStart();
while ($oChildCategoryTree = $this->oChildCategoryTreeList->Next()) {
if (!$bSet) {
$bSet = $oChildCategoryTree->AddItemCount($sCategoryId, $iArticleCount);
}
}
}
} else {
if (!is_null($this->oRealCategory) && $sCategoryId == $this->oRealCategory->id) {
$this->iAllItemCount = $iArticleCount;
$bSet = true;
}
}
return $bSet;
} | php | public function AddItemCount($sCategoryId, $iArticleCount)
{
$bSet = false;
if (array_key_exists($sCategoryId, $this->aContainingChildCategories)) {
$this->iAllItemCount = $this->iAllItemCount + $iArticleCount;
if (!is_null($this->oChildCategoryTreeList)) {
$this->oChildCategoryTreeList->GoToStart();
while ($oChildCategoryTree = $this->oChildCategoryTreeList->Next()) {
if (!$bSet) {
$bSet = $oChildCategoryTree->AddItemCount($sCategoryId, $iArticleCount);
}
}
}
} else {
if (!is_null($this->oRealCategory) && $sCategoryId == $this->oRealCategory->id) {
$this->iAllItemCount = $iArticleCount;
$bSet = true;
}
}
return $bSet;
} | [
"public",
"function",
"AddItemCount",
"(",
"$",
"sCategoryId",
",",
"$",
"iArticleCount",
")",
"{",
"$",
"bSet",
"=",
"false",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"sCategoryId",
",",
"$",
"this",
"->",
"aContainingChildCategories",
")",
")",
"{",
... | Add item count to category in tree and add it to all parent categories.
@param $sCategoryId
@param $iArticleCount
@return bool | [
"Add",
"item",
"count",
"to",
"category",
"in",
"tree",
"and",
"add",
"it",
"to",
"all",
"parent",
"categories",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopCategoryTree/TShopCategoryTree.class.php#L313-L334 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopCategoryTree/TShopCategoryTree.class.php | TShopCategoryTree.MarkActiveCategories | public function MarkActiveCategories($aActiveCategories)
{
$this->bIsActive = false;
if (in_array($this->id, $aActiveCategories)) {
$this->bIsActive = true;
} else {
if (!is_null($this->oChildCategoryTreeList)) {
$this->oChildCategoryTreeList->GoToStart();
while (!$this->bIsActive && ($oCatTree = &$this->oChildCategoryTreeList->Next())) {
$this->bIsActive = $this->bIsActive || $oCatTree->MarkActiveCategories($aActiveCategories);
}
$this->oChildCategoryTreeList->GoToStart();
}
}
return $this->bIsActive;
} | php | public function MarkActiveCategories($aActiveCategories)
{
$this->bIsActive = false;
if (in_array($this->id, $aActiveCategories)) {
$this->bIsActive = true;
} else {
if (!is_null($this->oChildCategoryTreeList)) {
$this->oChildCategoryTreeList->GoToStart();
while (!$this->bIsActive && ($oCatTree = &$this->oChildCategoryTreeList->Next())) {
$this->bIsActive = $this->bIsActive || $oCatTree->MarkActiveCategories($aActiveCategories);
}
$this->oChildCategoryTreeList->GoToStart();
}
}
return $this->bIsActive;
} | [
"public",
"function",
"MarkActiveCategories",
"(",
"$",
"aActiveCategories",
")",
"{",
"$",
"this",
"->",
"bIsActive",
"=",
"false",
";",
"if",
"(",
"in_array",
"(",
"$",
"this",
"->",
"id",
",",
"$",
"aActiveCategories",
")",
")",
"{",
"$",
"this",
"->"... | mark categories and their parents as active if they are in the array.
@param $aActiveCategories
@return bool | [
"mark",
"categories",
"and",
"their",
"parents",
"as",
"active",
"if",
"they",
"are",
"in",
"the",
"array",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopCategoryTree/TShopCategoryTree.class.php#L343-L359 | train |
edmondscommerce/doctrine-static-meta | src/Entity/Factory/EntityFactory.php | EntityFactory.createFactoryForEntity | public function createFactoryForEntity(string $entityFqn)
{
$this->assertEntityManagerSet();
$factoryFqn = $this->namespaceHelper->getFactoryFqnFromEntityFqn($entityFqn);
return new $factoryFqn($this, $this->entityManager);
} | php | public function createFactoryForEntity(string $entityFqn)
{
$this->assertEntityManagerSet();
$factoryFqn = $this->namespaceHelper->getFactoryFqnFromEntityFqn($entityFqn);
return new $factoryFqn($this, $this->entityManager);
} | [
"public",
"function",
"createFactoryForEntity",
"(",
"string",
"$",
"entityFqn",
")",
"{",
"$",
"this",
"->",
"assertEntityManagerSet",
"(",
")",
";",
"$",
"factoryFqn",
"=",
"$",
"this",
"->",
"namespaceHelper",
"->",
"getFactoryFqnFromEntityFqn",
"(",
"$",
"en... | Get an instance of the specific Entity Factory for a specified Entity
Not type hinting the return because the whole point of this is to have an entity specific method, which we
can't hint for
@param string $entityFqn
@return mixed | [
"Get",
"an",
"instance",
"of",
"the",
"specific",
"Entity",
"Factory",
"for",
"a",
"specified",
"Entity"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/Factory/EntityFactory.php#L80-L86 | train |
edmondscommerce/doctrine-static-meta | src/Entity/Factory/EntityFactory.php | EntityFactory.create | public function create(string $entityFqn, DataTransferObjectInterface $dto = null)
{
$this->assertEntityManagerSet();
return $this->createEntity($entityFqn, $dto, true);
} | php | public function create(string $entityFqn, DataTransferObjectInterface $dto = null)
{
$this->assertEntityManagerSet();
return $this->createEntity($entityFqn, $dto, true);
} | [
"public",
"function",
"create",
"(",
"string",
"$",
"entityFqn",
",",
"DataTransferObjectInterface",
"$",
"dto",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"assertEntityManagerSet",
"(",
")",
";",
"return",
"$",
"this",
"->",
"createEntity",
"(",
"$",
"entity... | Build a new entity, optionally pass in a DTO to provide the data that should be used
Optionally pass in an array of property=>value
@param string $entityFqn
@param DataTransferObjectInterface|null $dto
@return mixed
@throws MultipleValidationException
@throws ValidationException | [
"Build",
"a",
"new",
"entity",
"optionally",
"pass",
"in",
"a",
"DTO",
"to",
"provide",
"the",
"data",
"that",
"should",
"be",
"used"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/Factory/EntityFactory.php#L115-L120 | train |
edmondscommerce/doctrine-static-meta | src/Entity/Factory/EntityFactory.php | EntityFactory.getNewInstance | private function getNewInstance(string $entityFqn, $id): EntityInterface
{
if (isset(self::$created[$entityFqn][(string)$id])) {
throw new \RuntimeException('Trying to get a new instance when one has already been created for this ID');
}
$reflection = $this->getDoctrineStaticMetaForEntityFqn($entityFqn)
->getReflectionClass();
$entity = $reflection->newInstanceWithoutConstructor();
$runInit = $reflection->getMethod(UsesPHPMetaDataInterface::METHOD_RUN_INIT);
$runInit->setAccessible(true);
$runInit->invoke($entity);
$transactionProperty = $reflection->getProperty(AlwaysValidInterface::CREATION_TRANSACTION_RUNNING_PROPERTY);
$transactionProperty->setAccessible(true);
$transactionProperty->setValue($entity, true);
$idSetter = $reflection->getMethod('set' . IdFieldInterface::PROP_ID);
$idSetter->setAccessible(true);
$idSetter->invoke($entity, $id);
if ($entity instanceof EntityInterface) {
$this->initialiseEntity($entity);
$this->entityManager->persist($entity);
return $entity;
}
throw new \LogicException('Failed to create an instance of EntityInterface');
} | php | private function getNewInstance(string $entityFqn, $id): EntityInterface
{
if (isset(self::$created[$entityFqn][(string)$id])) {
throw new \RuntimeException('Trying to get a new instance when one has already been created for this ID');
}
$reflection = $this->getDoctrineStaticMetaForEntityFqn($entityFqn)
->getReflectionClass();
$entity = $reflection->newInstanceWithoutConstructor();
$runInit = $reflection->getMethod(UsesPHPMetaDataInterface::METHOD_RUN_INIT);
$runInit->setAccessible(true);
$runInit->invoke($entity);
$transactionProperty = $reflection->getProperty(AlwaysValidInterface::CREATION_TRANSACTION_RUNNING_PROPERTY);
$transactionProperty->setAccessible(true);
$transactionProperty->setValue($entity, true);
$idSetter = $reflection->getMethod('set' . IdFieldInterface::PROP_ID);
$idSetter->setAccessible(true);
$idSetter->invoke($entity, $id);
if ($entity instanceof EntityInterface) {
$this->initialiseEntity($entity);
$this->entityManager->persist($entity);
return $entity;
}
throw new \LogicException('Failed to create an instance of EntityInterface');
} | [
"private",
"function",
"getNewInstance",
"(",
"string",
"$",
"entityFqn",
",",
"$",
"id",
")",
":",
"EntityInterface",
"{",
"if",
"(",
"isset",
"(",
"self",
"::",
"$",
"created",
"[",
"$",
"entityFqn",
"]",
"[",
"(",
"string",
")",
"$",
"id",
"]",
")... | Build a new instance, bypassing PPP protections so that we can call private methods and set the private
transaction property
@param string $entityFqn
@param mixed $id
@return EntityInterface | [
"Build",
"a",
"new",
"instance",
"bypassing",
"PPP",
"protections",
"so",
"that",
"we",
"can",
"call",
"private",
"methods",
"and",
"set",
"the",
"private",
"transaction",
"property"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/Factory/EntityFactory.php#L196-L225 | train |
edmondscommerce/doctrine-static-meta | src/Entity/Factory/EntityFactory.php | EntityFactory.initialiseEntity | public function initialiseEntity(EntityInterface $entity): void
{
$entity->ensureMetaDataIsSet($this->entityManager);
$this->addListenerToEntityIfRequired($entity);
$this->entityDependencyInjector->injectEntityDependencies($entity);
$debugInitMethod = $entity::getDoctrineStaticMeta()
->getReflectionClass()
->getMethod(UsesPHPMetaDataInterface::METHOD_DEBUG_INIT);
$debugInitMethod->setAccessible(true);
$debugInitMethod->invoke($entity);
} | php | public function initialiseEntity(EntityInterface $entity): void
{
$entity->ensureMetaDataIsSet($this->entityManager);
$this->addListenerToEntityIfRequired($entity);
$this->entityDependencyInjector->injectEntityDependencies($entity);
$debugInitMethod = $entity::getDoctrineStaticMeta()
->getReflectionClass()
->getMethod(UsesPHPMetaDataInterface::METHOD_DEBUG_INIT);
$debugInitMethod->setAccessible(true);
$debugInitMethod->invoke($entity);
} | [
"public",
"function",
"initialiseEntity",
"(",
"EntityInterface",
"$",
"entity",
")",
":",
"void",
"{",
"$",
"entity",
"->",
"ensureMetaDataIsSet",
"(",
"$",
"this",
"->",
"entityManager",
")",
";",
"$",
"this",
"->",
"addListenerToEntityIfRequired",
"(",
"$",
... | Take an already instantiated Entity and perform the final initialisation steps
@param EntityInterface $entity | [
"Take",
"an",
"already",
"instantiated",
"Entity",
"and",
"perform",
"the",
"final",
"initialisation",
"steps"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/Factory/EntityFactory.php#L237-L247 | train |
edmondscommerce/doctrine-static-meta | src/Entity/Factory/EntityFactory.php | EntityFactory.addListenerToEntityIfRequired | private function addListenerToEntityIfRequired(EntityInterface $entity): void
{
if (!$entity instanceof NotifyPropertyChanged) {
return;
}
$listener = $this->entityManager->getUnitOfWork();
$entity->addPropertyChangedListener($listener);
} | php | private function addListenerToEntityIfRequired(EntityInterface $entity): void
{
if (!$entity instanceof NotifyPropertyChanged) {
return;
}
$listener = $this->entityManager->getUnitOfWork();
$entity->addPropertyChangedListener($listener);
} | [
"private",
"function",
"addListenerToEntityIfRequired",
"(",
"EntityInterface",
"$",
"entity",
")",
":",
"void",
"{",
"if",
"(",
"!",
"$",
"entity",
"instanceof",
"NotifyPropertyChanged",
")",
"{",
"return",
";",
"}",
"$",
"listener",
"=",
"$",
"this",
"->",
... | Generally DSM Entities are using the Notify change tracking policy.
This ensures that they are fully set up for that
@param EntityInterface $entity | [
"Generally",
"DSM",
"Entities",
"are",
"using",
"the",
"Notify",
"change",
"tracking",
"policy",
".",
"This",
"ensures",
"that",
"they",
"are",
"fully",
"set",
"up",
"for",
"that"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/Factory/EntityFactory.php#L255-L262 | train |
edmondscommerce/doctrine-static-meta | src/Entity/Factory/EntityFactory.php | EntityFactory.convertCollectionOfDtosToEntities | private function convertCollectionOfDtosToEntities(Collection $collection)
{
if (0 === $collection->count()) {
return;
}
list($dtoFqn, $collectionEntityFqn) = $this->deriveDtoAndEntityFqnFromCollection($collection);
foreach ($collection as $key => $dto) {
if ($dto instanceof $collectionEntityFqn) {
continue;
}
if (false === \is_object($dto)) {
throw new \InvalidArgumentException('Unexpected DTO value ' .
\print_r($dto, true) .
', expected an instance of' .
$dtoFqn);
}
if (false === ($dto instanceof DataTransferObjectInterface)) {
throw new \InvalidArgumentException('Found none DTO item in collection, was instance of ' .
\get_class($dto));
}
if (false === ($dto instanceof $dtoFqn)) {
throw new \InvalidArgumentException('Unexpected DTO ' . \get_class($dto) . ', expected ' . $dtoFqn);
}
$collection->set($key, $this->createEntity($collectionEntityFqn, $dto, false));
}
} | php | private function convertCollectionOfDtosToEntities(Collection $collection)
{
if (0 === $collection->count()) {
return;
}
list($dtoFqn, $collectionEntityFqn) = $this->deriveDtoAndEntityFqnFromCollection($collection);
foreach ($collection as $key => $dto) {
if ($dto instanceof $collectionEntityFqn) {
continue;
}
if (false === \is_object($dto)) {
throw new \InvalidArgumentException('Unexpected DTO value ' .
\print_r($dto, true) .
', expected an instance of' .
$dtoFqn);
}
if (false === ($dto instanceof DataTransferObjectInterface)) {
throw new \InvalidArgumentException('Found none DTO item in collection, was instance of ' .
\get_class($dto));
}
if (false === ($dto instanceof $dtoFqn)) {
throw new \InvalidArgumentException('Unexpected DTO ' . \get_class($dto) . ', expected ' . $dtoFqn);
}
$collection->set($key, $this->createEntity($collectionEntityFqn, $dto, false));
}
} | [
"private",
"function",
"convertCollectionOfDtosToEntities",
"(",
"Collection",
"$",
"collection",
")",
"{",
"if",
"(",
"0",
"===",
"$",
"collection",
"->",
"count",
"(",
")",
")",
"{",
"return",
";",
"}",
"list",
"(",
"$",
"dtoFqn",
",",
"$",
"collectionEn... | This will take an ArrayCollection of DTO objects and replace them with the Entities
@param Collection $collection
@throws MultipleValidationException
@throws ValidationException | [
"This",
"will",
"take",
"an",
"ArrayCollection",
"of",
"DTO",
"objects",
"and",
"replace",
"them",
"with",
"the",
"Entities"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/Factory/EntityFactory.php#L418-L444 | train |
edmondscommerce/doctrine-static-meta | src/Entity/Factory/EntityFactory.php | EntityFactory.deriveDtoAndEntityFqnFromCollection | private function deriveDtoAndEntityFqnFromCollection(Collection $collection): array
{
if (0 === $collection->count()) {
throw new \RuntimeException('Collection is empty');
}
$dtoFqn = null;
$collectionEntityFqn = null;
foreach ($collection as $dto) {
if ($dto instanceof EntityInterface) {
$collectionEntityFqn = \get_class($dto);
continue;
}
if (false === ($dto instanceof DataTransferObjectInterface)) {
throw new \InvalidArgumentException(
'Found none DTO item in collection, was instance of ' . \get_class($dto)
);
}
if (null === $dtoFqn) {
$dtoFqn = \get_class($dto);
continue;
}
if (false === ($dto instanceof $dtoFqn)) {
throw new \InvalidArgumentException(
'Mismatched collection, expecting dtoFqn ' .
$dtoFqn .
' but found ' .
\get_class($dto)
);
}
}
if (null === $dtoFqn && null === $collectionEntityFqn) {
throw new \RuntimeException('Failed deriving either the DTO or Entity FQN from the collection');
}
if (null === $collectionEntityFqn) {
$collectionEntityFqn = $this->namespaceHelper->getEntityFqnFromEntityDtoFqn($dtoFqn);
}
if (null === $dtoFqn) {
$dtoFqn = $this->namespaceHelper->getEntityDtoFqnFromEntityFqn($collectionEntityFqn);
}
return [$dtoFqn, $collectionEntityFqn];
} | php | private function deriveDtoAndEntityFqnFromCollection(Collection $collection): array
{
if (0 === $collection->count()) {
throw new \RuntimeException('Collection is empty');
}
$dtoFqn = null;
$collectionEntityFqn = null;
foreach ($collection as $dto) {
if ($dto instanceof EntityInterface) {
$collectionEntityFqn = \get_class($dto);
continue;
}
if (false === ($dto instanceof DataTransferObjectInterface)) {
throw new \InvalidArgumentException(
'Found none DTO item in collection, was instance of ' . \get_class($dto)
);
}
if (null === $dtoFqn) {
$dtoFqn = \get_class($dto);
continue;
}
if (false === ($dto instanceof $dtoFqn)) {
throw new \InvalidArgumentException(
'Mismatched collection, expecting dtoFqn ' .
$dtoFqn .
' but found ' .
\get_class($dto)
);
}
}
if (null === $dtoFqn && null === $collectionEntityFqn) {
throw new \RuntimeException('Failed deriving either the DTO or Entity FQN from the collection');
}
if (null === $collectionEntityFqn) {
$collectionEntityFqn = $this->namespaceHelper->getEntityFqnFromEntityDtoFqn($dtoFqn);
}
if (null === $dtoFqn) {
$dtoFqn = $this->namespaceHelper->getEntityDtoFqnFromEntityFqn($collectionEntityFqn);
}
return [$dtoFqn, $collectionEntityFqn];
} | [
"private",
"function",
"deriveDtoAndEntityFqnFromCollection",
"(",
"Collection",
"$",
"collection",
")",
":",
"array",
"{",
"if",
"(",
"0",
"===",
"$",
"collection",
"->",
"count",
"(",
")",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'Collection... | Loop through a collection and determine the DTO and Entity Fqn it contains
@param Collection $collection
@return array
@SuppressWarnings(PHPMD.NPathComplexity)
@SuppressWarnings(PHPMD.CyclomaticComplexity) | [
"Loop",
"through",
"a",
"collection",
"and",
"determine",
"the",
"DTO",
"and",
"Entity",
"Fqn",
"it",
"contains"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/Factory/EntityFactory.php#L455-L496 | train |
edmondscommerce/doctrine-static-meta | src/Entity/Factory/EntityFactory.php | EntityFactory.stopTransaction | private function stopTransaction(): void
{
$validationExceptions = [];
foreach (self::$created as $entities) {
foreach ($entities as $entity) {
$transactionProperty =
$entity::getDoctrineStaticMeta()
->getReflectionClass()
->getProperty(AlwaysValidInterface::CREATION_TRANSACTION_RUNNING_PROPERTY);
$transactionProperty->setAccessible(true);
$transactionProperty->setValue($entity, false);
try {
$entity->getValidator()->validate();
} catch (ValidationException $validationException) {
$validationExceptions[] = $validationException;
continue;
}
}
}
if ([] !== $validationExceptions) {
throw new MultipleValidationException($validationExceptions);
}
self::$created = [];
$this->dtosProcessed = [];
} | php | private function stopTransaction(): void
{
$validationExceptions = [];
foreach (self::$created as $entities) {
foreach ($entities as $entity) {
$transactionProperty =
$entity::getDoctrineStaticMeta()
->getReflectionClass()
->getProperty(AlwaysValidInterface::CREATION_TRANSACTION_RUNNING_PROPERTY);
$transactionProperty->setAccessible(true);
$transactionProperty->setValue($entity, false);
try {
$entity->getValidator()->validate();
} catch (ValidationException $validationException) {
$validationExceptions[] = $validationException;
continue;
}
}
}
if ([] !== $validationExceptions) {
throw new MultipleValidationException($validationExceptions);
}
self::$created = [];
$this->dtosProcessed = [];
} | [
"private",
"function",
"stopTransaction",
"(",
")",
":",
"void",
"{",
"$",
"validationExceptions",
"=",
"[",
"]",
";",
"foreach",
"(",
"self",
"::",
"$",
"created",
"as",
"$",
"entities",
")",
"{",
"foreach",
"(",
"$",
"entities",
"as",
"$",
"entity",
... | Loop through all created entities and reset the transaction running property to false,
then remove the list of created entities
@throws MultipleValidationException | [
"Loop",
"through",
"all",
"created",
"entities",
"and",
"reset",
"the",
"transaction",
"running",
"property",
"to",
"false",
"then",
"remove",
"the",
"list",
"of",
"created",
"entities"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/Factory/EntityFactory.php#L504-L528 | train |
chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Model/IdList.php | OffAmazonPaymentsNotifications_Model_IdList.setId | public function setId($Id)
{
if (!$this->_isNumericArray($Id)) {
$Id = array ($Id);
}
$this->fields['Id']['FieldValue'] = $Id;
return $this;
} | php | public function setId($Id)
{
if (!$this->_isNumericArray($Id)) {
$Id = array ($Id);
}
$this->fields['Id']['FieldValue'] = $Id;
return $this;
} | [
"public",
"function",
"setId",
"(",
"$",
"Id",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_isNumericArray",
"(",
"$",
"Id",
")",
")",
"{",
"$",
"Id",
"=",
"array",
"(",
"$",
"Id",
")",
";",
"}",
"$",
"this",
"->",
"fields",
"[",
"'Id'",
"]... | Sets the value of the Id.
@param string|array $Id string or array of string Ids
@return this instance | [
"Sets",
"the",
"value",
"of",
"the",
"Id",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Model/IdList.php#L70-L77 | train |
chameleon-system/chameleon-shop | src/ShopRatingServiceBundle/objects/db/TPkgShopRatingServiceRating.class.php | TPkgShopRatingServiceRating.Render | public function Render($sViewName = 'RatingServiceRating_standard', $sViewSubType = 'pkgShopRatingService/views', $sViewType = 'Customer', $sSpotName = null, $aCallTimeVars = array())
{
$oView = new TViewParser();
$oRatingService = $this->GetFieldPkgShopRatingService();
$oView->AddVar('oRating', $this);
$oView->AddVar('oRatingService', $oRatingService);
$oView->AddVar('fieldRatingDate', $this->fieldRatingDate);
$sRatingText = $this->fieldRatingText;
if (false == $oRatingService->fieldRatingsContainHtml) {
$sRatingText = nl2br(TGlobal::OutHTML(strip_tags($sRatingText)));
}
$oView->AddVar('fieldRatingText', $sRatingText);
$oView->AddVar('fieldRatingService_CurrentRating', $this->GetFieldPkgShopRatingService()->fieldCurrentRating);
return $oView->RenderObjectPackageView($sViewName, $sViewSubType, $sViewType);
} | php | public function Render($sViewName = 'RatingServiceRating_standard', $sViewSubType = 'pkgShopRatingService/views', $sViewType = 'Customer', $sSpotName = null, $aCallTimeVars = array())
{
$oView = new TViewParser();
$oRatingService = $this->GetFieldPkgShopRatingService();
$oView->AddVar('oRating', $this);
$oView->AddVar('oRatingService', $oRatingService);
$oView->AddVar('fieldRatingDate', $this->fieldRatingDate);
$sRatingText = $this->fieldRatingText;
if (false == $oRatingService->fieldRatingsContainHtml) {
$sRatingText = nl2br(TGlobal::OutHTML(strip_tags($sRatingText)));
}
$oView->AddVar('fieldRatingText', $sRatingText);
$oView->AddVar('fieldRatingService_CurrentRating', $this->GetFieldPkgShopRatingService()->fieldCurrentRating);
return $oView->RenderObjectPackageView($sViewName, $sViewSubType, $sViewType);
} | [
"public",
"function",
"Render",
"(",
"$",
"sViewName",
"=",
"'RatingServiceRating_standard'",
",",
"$",
"sViewSubType",
"=",
"'pkgShopRatingService/views'",
",",
"$",
"sViewType",
"=",
"'Customer'",
",",
"$",
"sSpotName",
"=",
"null",
",",
"$",
"aCallTimeVars",
"=... | Render object.
@param string $sViewName
@param string $sViewSubType
@param string $sViewType
@param null $sSpotName
@param array $aCallTimeVars
@return string | [
"Render",
"object",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopRatingServiceBundle/objects/db/TPkgShopRatingServiceRating.class.php#L25-L43 | train |
PGB-LIV/php-ms | src/Utility/Fragment/FragmentFactory.php | FragmentFactory.getMethodFragments | public static function getMethodFragments($method, ModifiableSequenceInterface $sequence)
{
$fragmentTypes = array();
switch (strtoupper($method)) {
case 'CID':
case 'HCD':
$fragmentTypes['B'] = new BFragment($sequence);
$fragmentTypes['Y'] = new YFragment($sequence);
break;
case 'ECD':
$fragmentTypes['C'] = new CFragment($sequence);
$fragmentTypes['Z'] = new ZFragment($sequence);
$fragmentTypes['B'] = new BFragment($sequence);
break;
case 'ETD':
$fragmentTypes['C'] = new CFragment($sequence);
$fragmentTypes['Z'] = new ZFragment($sequence);
break;
case 'CTD':
case 'EDD':
case 'NETD':
$fragmentTypes['A'] = new AFragment($sequence);
$fragmentTypes['X'] = new XFragment($sequence);
break;
case 'ETHCD':
$fragmentTypes['B'] = new BFragment($sequence);
$fragmentTypes['Y'] = new YFragment($sequence);
$fragmentTypes['C'] = new CFragment($sequence);
$fragmentTypes['Z'] = new ZFragment($sequence);
break;
default:
throw new \InvalidArgumentException('Unknown fragmentation method type "' . $method . '"');
}
return $fragmentTypes;
} | php | public static function getMethodFragments($method, ModifiableSequenceInterface $sequence)
{
$fragmentTypes = array();
switch (strtoupper($method)) {
case 'CID':
case 'HCD':
$fragmentTypes['B'] = new BFragment($sequence);
$fragmentTypes['Y'] = new YFragment($sequence);
break;
case 'ECD':
$fragmentTypes['C'] = new CFragment($sequence);
$fragmentTypes['Z'] = new ZFragment($sequence);
$fragmentTypes['B'] = new BFragment($sequence);
break;
case 'ETD':
$fragmentTypes['C'] = new CFragment($sequence);
$fragmentTypes['Z'] = new ZFragment($sequence);
break;
case 'CTD':
case 'EDD':
case 'NETD':
$fragmentTypes['A'] = new AFragment($sequence);
$fragmentTypes['X'] = new XFragment($sequence);
break;
case 'ETHCD':
$fragmentTypes['B'] = new BFragment($sequence);
$fragmentTypes['Y'] = new YFragment($sequence);
$fragmentTypes['C'] = new CFragment($sequence);
$fragmentTypes['Z'] = new ZFragment($sequence);
break;
default:
throw new \InvalidArgumentException('Unknown fragmentation method type "' . $method . '"');
}
return $fragmentTypes;
} | [
"public",
"static",
"function",
"getMethodFragments",
"(",
"$",
"method",
",",
"ModifiableSequenceInterface",
"$",
"sequence",
")",
"{",
"$",
"fragmentTypes",
"=",
"array",
"(",
")",
";",
"switch",
"(",
"strtoupper",
"(",
"$",
"method",
")",
")",
"{",
"case"... | For a specified method, returns the possible fragmentat ion types that may be produced
@param string $method
The method to get fragment types for
@param ModifiableSequenceInterface $sequence
The peptide or protein sequence object to get fragment types for
@return FragmentInterface[] | [
"For",
"a",
"specified",
"method",
"returns",
"the",
"possible",
"fragmentat",
"ion",
"types",
"that",
"may",
"be",
"produced"
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Utility/Fragment/FragmentFactory.php#L59-L95 | train |
chameleon-system/chameleon-shop | src/ShopArticlePreorderBundle/pkgShop/objects/db/TPkgShopArticlePreorder_ShopArticle.class.php | TPkgShopArticlePreorder_ShopArticle.StockWasUpdatedHook | protected function StockWasUpdatedHook($dOldValue, $dNewValue)
{
$bReturn = parent::StockWasUpdatedHook($dOldValue, $dNewValue);
if ($dOldValue < 1 && $dNewValue > 0) {
$oShopArticlePreorderList = &TdbPkgShopArticlePreorderList::GetListForShopArticleId($this->id);
while ($oShopArticlePreorder = $oShopArticlePreorderList->Next()) {
$oShopArticlePreorder->SendMail();
}
}
return $bReturn;
} | php | protected function StockWasUpdatedHook($dOldValue, $dNewValue)
{
$bReturn = parent::StockWasUpdatedHook($dOldValue, $dNewValue);
if ($dOldValue < 1 && $dNewValue > 0) {
$oShopArticlePreorderList = &TdbPkgShopArticlePreorderList::GetListForShopArticleId($this->id);
while ($oShopArticlePreorder = $oShopArticlePreorderList->Next()) {
$oShopArticlePreorder->SendMail();
}
}
return $bReturn;
} | [
"protected",
"function",
"StockWasUpdatedHook",
"(",
"$",
"dOldValue",
",",
"$",
"dNewValue",
")",
"{",
"$",
"bReturn",
"=",
"parent",
"::",
"StockWasUpdatedHook",
"(",
"$",
"dOldValue",
",",
"$",
"dNewValue",
")",
";",
"if",
"(",
"$",
"dOldValue",
"<",
"1... | hook called when the stock value of the article changed.
@param float $dOldValue
@param float $dNewValue
@return bool | [
"hook",
"called",
"when",
"the",
"stock",
"value",
"of",
"the",
"article",
"changed",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticlePreorderBundle/pkgShop/objects/db/TPkgShopArticlePreorder_ShopArticle.class.php#L22-L33 | train |
Erebot/Erebot | src/IrcParser.php | IrcParser.stripCodes | public static function stripCodes($text, $strip = self::STRIP_ALL)
{
if (!is_int($strip)) {
throw new \Erebot\InvalidValueException("Invalid stripping flags");
}
if ($strip & self::STRIP_BOLD) {
$text = str_replace("\002", '', $text);
}
if ($strip & self::STRIP_COLORS) {
$text = preg_replace("/\003(?:[0-9]{1,2}(?:,[0-9]{1,2})?)?/", '', $text);
}
if ($strip & self::STRIP_RESET) {
$text = str_replace("\017", '', $text);
}
if ($strip & self::STRIP_REVERSE) {
$text = str_replace("\026", '', $text);
}
if ($strip & self::STRIP_UNDERLINE) {
$text = str_replace("\037", '', $text);
}
return $text;
} | php | public static function stripCodes($text, $strip = self::STRIP_ALL)
{
if (!is_int($strip)) {
throw new \Erebot\InvalidValueException("Invalid stripping flags");
}
if ($strip & self::STRIP_BOLD) {
$text = str_replace("\002", '', $text);
}
if ($strip & self::STRIP_COLORS) {
$text = preg_replace("/\003(?:[0-9]{1,2}(?:,[0-9]{1,2})?)?/", '', $text);
}
if ($strip & self::STRIP_RESET) {
$text = str_replace("\017", '', $text);
}
if ($strip & self::STRIP_REVERSE) {
$text = str_replace("\026", '', $text);
}
if ($strip & self::STRIP_UNDERLINE) {
$text = str_replace("\037", '', $text);
}
return $text;
} | [
"public",
"static",
"function",
"stripCodes",
"(",
"$",
"text",
",",
"$",
"strip",
"=",
"self",
"::",
"STRIP_ALL",
")",
"{",
"if",
"(",
"!",
"is_int",
"(",
"$",
"strip",
")",
")",
"{",
"throw",
"new",
"\\",
"Erebot",
"\\",
"InvalidValueException",
"(",... | Strips IRC styles from a text.
\param string $text
The text from which styles must be stripped.
\param int $strip
A bitwise OR of the codes of the styles we want to strip.
The default is to strip all forms of styles from the text.
See also the Erebot::IrcParser::STRIP_* constants.
\retval string
The text with all the styles specified in $strip stripped. | [
"Strips",
"IRC",
"styles",
"from",
"a",
"text",
"."
] | 691fc3fa8bc6f07061ff2b3798fec76bc3a039aa | https://github.com/Erebot/Erebot/blob/691fc3fa8bc6f07061ff2b3798fec76bc3a039aa/src/IrcParser.php#L88-L115 | train |
Erebot/Erebot | src/IrcParser.php | IrcParser.ctcpUnquote | protected static function ctcpUnquote($msg)
{
// CTCP-level unquoting
$quoting = array(
"\\a" => "\001",
"\\\\" => "\\",
"\\" => "", // Ignore quoting character
// for invalid sequences.
);
$msg = strtr($msg, $quoting);
// Low-level unquoting
$quoting = array(
"\0200" => "\000",
"\020n" => "\n",
"\020r" => "\r",
"\020\020" => "\020",
"\020" => "", // Ignore quoting character
// for invalid sequences.
);
$msg = strtr($msg, $quoting);
return $msg;
} | php | protected static function ctcpUnquote($msg)
{
// CTCP-level unquoting
$quoting = array(
"\\a" => "\001",
"\\\\" => "\\",
"\\" => "", // Ignore quoting character
// for invalid sequences.
);
$msg = strtr($msg, $quoting);
// Low-level unquoting
$quoting = array(
"\0200" => "\000",
"\020n" => "\n",
"\020r" => "\r",
"\020\020" => "\020",
"\020" => "", // Ignore quoting character
// for invalid sequences.
);
$msg = strtr($msg, $quoting);
return $msg;
} | [
"protected",
"static",
"function",
"ctcpUnquote",
"(",
"$",
"msg",
")",
"{",
"// CTCP-level unquoting",
"$",
"quoting",
"=",
"array",
"(",
"\"\\\\a\"",
"=>",
"\"\\001\"",
",",
"\"\\\\\\\\\"",
"=>",
"\"\\\\\"",
",",
"\"\\\\\"",
"=>",
"\"\"",
",",
"// Ignore quoti... | Unquotes a CTCP message.
\param string $msg
Some CTCP message to unquote.
\retval string
The message, with CTCP quoting removed.
\see
http://www.irchelp.org/irchelp/rfc/ctcpspec.html | [
"Unquotes",
"a",
"CTCP",
"message",
"."
] | 691fc3fa8bc6f07061ff2b3798fec76bc3a039aa | https://github.com/Erebot/Erebot/blob/691fc3fa8bc6f07061ff2b3798fec76bc3a039aa/src/IrcParser.php#L160-L182 | train |
Erebot/Erebot | src/IrcParser.php | IrcParser.noticeOrPrivmsg | protected function noticeOrPrivmsg($origin, $msg, $mapping)
{
// :nick1!ident@host NOTICE <nick2/#chan> :Message
// :nick1!ident@host PRIVMSG <nick2/#chan> :Message
$target = $msg[0];
$msg = $msg[1];
$isChan = (int) $this->connection->isChannel($target);
$len = strlen($msg);
if ($len > 1 && $msg[$len-1] == "\x01" && $msg[0] == "\x01") {
// Remove the markers.
$msg = (string) substr($msg, 1, -1);
// Unquote the message.
$msg = self::ctcpUnquote($msg);
// Extract the tag from the rest of the message.
$pos = strcspn($msg, " ");
$ctcp = substr($msg, 0, $pos);
$msg = (string) substr($msg, $pos + 1);
if ($ctcp == "ACTION") {
if ($isChan) {
return $this->connection->dispatch(
$this->makeEvent($mapping['action'][$isChan], $target, $origin, $msg)
);
}
return $this->connection->dispatch(
$this->makeEvent($mapping['action'][$isChan], $origin, $msg)
);
}
if ($isChan) {
return $this->connection->dispatch(
$this->makeEvent($mapping['ctcp'][$isChan], $target, $origin, $ctcp, $msg)
);
}
return $this->connection->dispatch(
$this->makeEvent($mapping['ctcp'][$isChan], $origin, $ctcp, $msg)
);
}
if ($isChan) {
return $this->connection->dispatch(
$this->makeEvent(
$mapping['normal'][$isChan],
$target,
$origin,
$msg
)
);
}
return $this->connection->dispatch(
$this->makeEvent($mapping['normal'][$isChan], $origin, $msg)
);
} | php | protected function noticeOrPrivmsg($origin, $msg, $mapping)
{
// :nick1!ident@host NOTICE <nick2/#chan> :Message
// :nick1!ident@host PRIVMSG <nick2/#chan> :Message
$target = $msg[0];
$msg = $msg[1];
$isChan = (int) $this->connection->isChannel($target);
$len = strlen($msg);
if ($len > 1 && $msg[$len-1] == "\x01" && $msg[0] == "\x01") {
// Remove the markers.
$msg = (string) substr($msg, 1, -1);
// Unquote the message.
$msg = self::ctcpUnquote($msg);
// Extract the tag from the rest of the message.
$pos = strcspn($msg, " ");
$ctcp = substr($msg, 0, $pos);
$msg = (string) substr($msg, $pos + 1);
if ($ctcp == "ACTION") {
if ($isChan) {
return $this->connection->dispatch(
$this->makeEvent($mapping['action'][$isChan], $target, $origin, $msg)
);
}
return $this->connection->dispatch(
$this->makeEvent($mapping['action'][$isChan], $origin, $msg)
);
}
if ($isChan) {
return $this->connection->dispatch(
$this->makeEvent($mapping['ctcp'][$isChan], $target, $origin, $ctcp, $msg)
);
}
return $this->connection->dispatch(
$this->makeEvent($mapping['ctcp'][$isChan], $origin, $ctcp, $msg)
);
}
if ($isChan) {
return $this->connection->dispatch(
$this->makeEvent(
$mapping['normal'][$isChan],
$target,
$origin,
$msg
)
);
}
return $this->connection->dispatch(
$this->makeEvent($mapping['normal'][$isChan], $origin, $msg)
);
} | [
"protected",
"function",
"noticeOrPrivmsg",
"(",
"$",
"origin",
",",
"$",
"msg",
",",
"$",
"mapping",
")",
"{",
"// :nick1!ident@host NOTICE <nick2/#chan> :Message",
"// :nick1!ident@host PRIVMSG <nick2/#chan> :Message",
"$",
"target",
"=",
"$",
"msg",
"[",
"0",
"]",
... | Process a NOTICE or PRIVMSG message.
\param string $origin
Origin of the message to process.
\param Erebot::Interfaces::IrcTextWrapper $msg
The message to process, wrapped in
a special object that makes it easier
to analyze each token separately.
\param array $mapping
A mapping of types to a list of event names.
Each list should contain two items. The first
one if the name of the event to use when the
message is targeted at an IRC user. The second
one is used for messages targeted at IRC channels.
The following (case-sensitive) types must appear
in the mapping: 'ctcp' (for CTCP messages),
'action' (for the special ACTION CTCP message)
and 'normal' for regular messages. | [
"Process",
"a",
"NOTICE",
"or",
"PRIVMSG",
"message",
"."
] | 691fc3fa8bc6f07061ff2b3798fec76bc3a039aa | https://github.com/Erebot/Erebot/blob/691fc3fa8bc6f07061ff2b3798fec76bc3a039aa/src/IrcParser.php#L347-L402 | train |
Erebot/Erebot | src/IrcParser.php | IrcParser.handleINVITE | protected function handleINVITE($origin, $msg)
{
// :nick1!ident@host INVITE nick2 :#chan
return $this->connection->dispatch(
$this->makeEvent('!Invite', $msg[1], $origin, $msg[0])
);
} | php | protected function handleINVITE($origin, $msg)
{
// :nick1!ident@host INVITE nick2 :#chan
return $this->connection->dispatch(
$this->makeEvent('!Invite', $msg[1], $origin, $msg[0])
);
} | [
"protected",
"function",
"handleINVITE",
"(",
"$",
"origin",
",",
"$",
"msg",
")",
"{",
"// :nick1!ident@host INVITE nick2 :#chan",
"return",
"$",
"this",
"->",
"connection",
"->",
"dispatch",
"(",
"$",
"this",
"->",
"makeEvent",
"(",
"'!Invite'",
",",
"$",
"m... | Processes a message of type INVITE.
\param string $origin
Origin of the message to process.
\param Erebot::Interfaces::IrcTextWrapper $msg
The message to process, wrapped in
a special object that makes it easier
to analyze each token separately. | [
"Processes",
"a",
"message",
"of",
"type",
"INVITE",
"."
] | 691fc3fa8bc6f07061ff2b3798fec76bc3a039aa | https://github.com/Erebot/Erebot/blob/691fc3fa8bc6f07061ff2b3798fec76bc3a039aa/src/IrcParser.php#L415-L421 | train |
Erebot/Erebot | src/IrcParser.php | IrcParser.handleJOIN | protected function handleJOIN($origin, $msg)
{
// :nick1!ident@host JOIN :#chan
return $this->connection->dispatch(
$this->makeEvent('!Join', $msg[0], $origin)
);
} | php | protected function handleJOIN($origin, $msg)
{
// :nick1!ident@host JOIN :#chan
return $this->connection->dispatch(
$this->makeEvent('!Join', $msg[0], $origin)
);
} | [
"protected",
"function",
"handleJOIN",
"(",
"$",
"origin",
",",
"$",
"msg",
")",
"{",
"// :nick1!ident@host JOIN :#chan",
"return",
"$",
"this",
"->",
"connection",
"->",
"dispatch",
"(",
"$",
"this",
"->",
"makeEvent",
"(",
"'!Join'",
",",
"$",
"msg",
"[",
... | Processes a message of type JOIN.
\param string $origin
Origin of the message to process.
\param Erebot::Interfaces::IrcTextWrapper $msg
The message to process, wrapped in
a special object that makes it easier
to analyze each token separately. | [
"Processes",
"a",
"message",
"of",
"type",
"JOIN",
"."
] | 691fc3fa8bc6f07061ff2b3798fec76bc3a039aa | https://github.com/Erebot/Erebot/blob/691fc3fa8bc6f07061ff2b3798fec76bc3a039aa/src/IrcParser.php#L434-L440 | train |
Erebot/Erebot | src/IrcParser.php | IrcParser.handleKICK | protected function handleKICK($origin, $msg)
{
// :nick1!ident@host KICK #chan nick2 :Reason
return $this->connection->dispatch(
$this->makeEvent('!Kick', $msg[0], $origin, $msg[1], $msg[2])
);
} | php | protected function handleKICK($origin, $msg)
{
// :nick1!ident@host KICK #chan nick2 :Reason
return $this->connection->dispatch(
$this->makeEvent('!Kick', $msg[0], $origin, $msg[1], $msg[2])
);
} | [
"protected",
"function",
"handleKICK",
"(",
"$",
"origin",
",",
"$",
"msg",
")",
"{",
"// :nick1!ident@host KICK #chan nick2 :Reason",
"return",
"$",
"this",
"->",
"connection",
"->",
"dispatch",
"(",
"$",
"this",
"->",
"makeEvent",
"(",
"'!Kick'",
",",
"$",
"... | Processes a message of type KICK.
\param string $origin
Origin of the message to process.
\param Erebot::Interfaces::IrcTextWrapper $msg
The message to process, wrapped in
a special object that makes it easier
to analyze each token separately. | [
"Processes",
"a",
"message",
"of",
"type",
"KICK",
"."
] | 691fc3fa8bc6f07061ff2b3798fec76bc3a039aa | https://github.com/Erebot/Erebot/blob/691fc3fa8bc6f07061ff2b3798fec76bc3a039aa/src/IrcParser.php#L453-L459 | train |
Erebot/Erebot | src/IrcParser.php | IrcParser.handleNICK | protected function handleNICK($origin, $msg)
{
// :oldnick!ident@host NICK newnick
return $this->connection->dispatch(
$this->makeEvent('!Nick', $origin, $msg[0])
);
} | php | protected function handleNICK($origin, $msg)
{
// :oldnick!ident@host NICK newnick
return $this->connection->dispatch(
$this->makeEvent('!Nick', $origin, $msg[0])
);
} | [
"protected",
"function",
"handleNICK",
"(",
"$",
"origin",
",",
"$",
"msg",
")",
"{",
"// :oldnick!ident@host NICK newnick",
"return",
"$",
"this",
"->",
"connection",
"->",
"dispatch",
"(",
"$",
"this",
"->",
"makeEvent",
"(",
"'!Nick'",
",",
"$",
"origin",
... | Processes a message of type NICK.
\param string $origin
Origin of the message to process.
\param Erebot::Interfaces::IrcTextWrapper $msg
The message to process, wrapped in
a special object that makes it easier
to analyze each token separately. | [
"Processes",
"a",
"message",
"of",
"type",
"NICK",
"."
] | 691fc3fa8bc6f07061ff2b3798fec76bc3a039aa | https://github.com/Erebot/Erebot/blob/691fc3fa8bc6f07061ff2b3798fec76bc3a039aa/src/IrcParser.php#L558-L564 | train |
Erebot/Erebot | src/IrcParser.php | IrcParser.handlePART | protected function handlePART($origin, $msg)
{
// :nick1!ident@host PART #chan [reason]
return $this->connection->dispatch(
$this->makeEvent(
'!Part',
$msg[0],
$origin,
isset($msg[1]) ? $msg[1] : ''
)
);
} | php | protected function handlePART($origin, $msg)
{
// :nick1!ident@host PART #chan [reason]
return $this->connection->dispatch(
$this->makeEvent(
'!Part',
$msg[0],
$origin,
isset($msg[1]) ? $msg[1] : ''
)
);
} | [
"protected",
"function",
"handlePART",
"(",
"$",
"origin",
",",
"$",
"msg",
")",
"{",
"// :nick1!ident@host PART #chan [reason]",
"return",
"$",
"this",
"->",
"connection",
"->",
"dispatch",
"(",
"$",
"this",
"->",
"makeEvent",
"(",
"'!Part'",
",",
"$",
"msg",... | Processes a message of type PART.
\param string $origin
Origin of the message to process.
\param Erebot::Interfaces::IrcTextWrapper $msg
The message to process, wrapped in
a special object that makes it easier
to analyze each token separately. | [
"Processes",
"a",
"message",
"of",
"type",
"PART",
"."
] | 691fc3fa8bc6f07061ff2b3798fec76bc3a039aa | https://github.com/Erebot/Erebot/blob/691fc3fa8bc6f07061ff2b3798fec76bc3a039aa/src/IrcParser.php#L600-L611 | train |
Erebot/Erebot | src/IrcParser.php | IrcParser.handlePONG | protected function handlePONG($origin, $msg)
{
// :origin PONG origin target
return $this->connection->dispatch(
$this->makeEvent('!Pong', $origin, $msg[1])
);
} | php | protected function handlePONG($origin, $msg)
{
// :origin PONG origin target
return $this->connection->dispatch(
$this->makeEvent('!Pong', $origin, $msg[1])
);
} | [
"protected",
"function",
"handlePONG",
"(",
"$",
"origin",
",",
"$",
"msg",
")",
"{",
"// :origin PONG origin target",
"return",
"$",
"this",
"->",
"connection",
"->",
"dispatch",
"(",
"$",
"this",
"->",
"makeEvent",
"(",
"'!Pong'",
",",
"$",
"origin",
",",
... | Processes a message of type PONG.
\param string $origin
Origin of the message to process.
\param Erebot::Interfaces::IrcTextWrapper $msg
The message to process, wrapped in
a special object that makes it easier
to analyze each token separately. | [
"Processes",
"a",
"message",
"of",
"type",
"PONG",
"."
] | 691fc3fa8bc6f07061ff2b3798fec76bc3a039aa | https://github.com/Erebot/Erebot/blob/691fc3fa8bc6f07061ff2b3798fec76bc3a039aa/src/IrcParser.php#L643-L649 | train |
Erebot/Erebot | src/IrcParser.php | IrcParser.handleQUIT | protected function handleQUIT($origin, $msg)
{
// :nick1!ident@host QUIT :Reason
return $this->connection->dispatch(
$this->makeEvent('!Quit', $origin, $msg[0])
);
} | php | protected function handleQUIT($origin, $msg)
{
// :nick1!ident@host QUIT :Reason
return $this->connection->dispatch(
$this->makeEvent('!Quit', $origin, $msg[0])
);
} | [
"protected",
"function",
"handleQUIT",
"(",
"$",
"origin",
",",
"$",
"msg",
")",
"{",
"// :nick1!ident@host QUIT :Reason",
"return",
"$",
"this",
"->",
"connection",
"->",
"dispatch",
"(",
"$",
"this",
"->",
"makeEvent",
"(",
"'!Quit'",
",",
"$",
"origin",
"... | Processes a message of type QUIT.
\param string $origin
Origin of the message to process.
\param Erebot::Interfaces::IrcTextWrapper $msg
The message to process, wrapped in
a special object that makes it easier
to analyze each token separately. | [
"Processes",
"a",
"message",
"of",
"type",
"QUIT",
"."
] | 691fc3fa8bc6f07061ff2b3798fec76bc3a039aa | https://github.com/Erebot/Erebot/blob/691fc3fa8bc6f07061ff2b3798fec76bc3a039aa/src/IrcParser.php#L685-L691 | train |
Erebot/Erebot | src/IrcParser.php | IrcParser.handleTOPIC | protected function handleTOPIC($origin, $msg)
{
// :nick1!ident@host TOPIC #chan :New topic
return $this->connection->dispatch(
$this->makeEvent('!Topic', $msg[0], $origin, $msg[1])
);
} | php | protected function handleTOPIC($origin, $msg)
{
// :nick1!ident@host TOPIC #chan :New topic
return $this->connection->dispatch(
$this->makeEvent('!Topic', $msg[0], $origin, $msg[1])
);
} | [
"protected",
"function",
"handleTOPIC",
"(",
"$",
"origin",
",",
"$",
"msg",
")",
"{",
"// :nick1!ident@host TOPIC #chan :New topic",
"return",
"$",
"this",
"->",
"connection",
"->",
"dispatch",
"(",
"$",
"this",
"->",
"makeEvent",
"(",
"'!Topic'",
",",
"$",
"... | Processes a message of type TOPIC.
\param string $origin
Origin of the message to process.
\param Erebot::Interfaces::IrcTextWrapper $msg
The message to process, wrapped in
a special object that makes it easier
to analyze each token separately. | [
"Processes",
"a",
"message",
"of",
"type",
"TOPIC",
"."
] | 691fc3fa8bc6f07061ff2b3798fec76bc3a039aa | https://github.com/Erebot/Erebot/blob/691fc3fa8bc6f07061ff2b3798fec76bc3a039aa/src/IrcParser.php#L704-L710 | train |
Erebot/Erebot | src/IrcParser.php | IrcParser.handle255 | protected function handle255($origin, $msg)
{
// \Erebot\Interfaces\Numerics::RPL_LUSERME
/* We can't rely on RPL_WELCOME because we may need
* to detect the server's capabilities first.
* So, we delay detection of the connection for as
* long as we can (while retaining portability). */
if (!$this->connection->isConnected()) {
return $this->connection->dispatch($this->makeEvent('!Connect'));
}
} | php | protected function handle255($origin, $msg)
{
// \Erebot\Interfaces\Numerics::RPL_LUSERME
/* We can't rely on RPL_WELCOME because we may need
* to detect the server's capabilities first.
* So, we delay detection of the connection for as
* long as we can (while retaining portability). */
if (!$this->connection->isConnected()) {
return $this->connection->dispatch($this->makeEvent('!Connect'));
}
} | [
"protected",
"function",
"handle255",
"(",
"$",
"origin",
",",
"$",
"msg",
")",
"{",
"// \\Erebot\\Interfaces\\Numerics::RPL_LUSERME",
"/* We can't rely on RPL_WELCOME because we may need\n * to detect the server's capabilities first.\n * So, we delay detection of the connect... | Processes a message with numeric 255.
\param string $origin
Origin of the message to process.
\param Erebot::Interfaces::IrcTextWrapper $msg
The message to process, wrapped in
a special object that makes it easier
to analyze each token separately.
\TODO
Use a NumericEventHandler instead, even though it is less effective. | [
"Processes",
"a",
"message",
"with",
"numeric",
"255",
"."
] | 691fc3fa8bc6f07061ff2b3798fec76bc3a039aa | https://github.com/Erebot/Erebot/blob/691fc3fa8bc6f07061ff2b3798fec76bc3a039aa/src/IrcParser.php#L726-L736 | train |
Erebot/Erebot | src/IrcParser.php | IrcParser.watchList | protected function watchList($event, $msg)
{
// <bot> <nick> <ident> <host> <timestamp> :<msg>
unset($msg[0]);
$nick = $msg[0];
$ident = $msg[1];
$host = $msg[2];
$timestamp = intval($msg[3], 10);
$timestamp = new \DateTime('@'.$timestamp);
$text = $msg[4];
return $this->connection->dispatch(
$this->makeEvent(
$event,
$nick,
($ident == '*' ? null : $ident),
($host == '*' ? null : $host),
$timestamp,
$text
)
);
} | php | protected function watchList($event, $msg)
{
// <bot> <nick> <ident> <host> <timestamp> :<msg>
unset($msg[0]);
$nick = $msg[0];
$ident = $msg[1];
$host = $msg[2];
$timestamp = intval($msg[3], 10);
$timestamp = new \DateTime('@'.$timestamp);
$text = $msg[4];
return $this->connection->dispatch(
$this->makeEvent(
$event,
$nick,
($ident == '*' ? null : $ident),
($host == '*' ? null : $host),
$timestamp,
$text
)
);
} | [
"protected",
"function",
"watchList",
"(",
"$",
"event",
",",
"$",
"msg",
")",
"{",
"// <bot> <nick> <ident> <host> <timestamp> :<msg>",
"unset",
"(",
"$",
"msg",
"[",
"0",
"]",
")",
";",
"$",
"nick",
"=",
"$",
"msg",
"[",
"0",
"]",
";",
"$",
"ident",
... | Processes a message related to the WATCH list.
\param string $event
Interface name for the event to produce.
\param Erebot::Interfaces::IrcTextWrapper $msg
The message to process, wrapped in
a special object that makes it easier
to analyze each token separately. | [
"Processes",
"a",
"message",
"related",
"to",
"the",
"WATCH",
"list",
"."
] | 691fc3fa8bc6f07061ff2b3798fec76bc3a039aa | https://github.com/Erebot/Erebot/blob/691fc3fa8bc6f07061ff2b3798fec76bc3a039aa/src/IrcParser.php#L829-L850 | train |
chameleon-system/chameleon-shop | src/SearchBundle/objects/db/TShopSearchIndexer.class.php | TShopSearchIndexer.CommitProcessData | protected function CommitProcessData()
{
TdbShopSearchFieldWeight::AddQueryBlock(false, null, null);
$sTmp = serialize($this->aTablesToProcess);
$aData = $this->sqlData;
$aData['processdata'] = $sTmp;
$this->LoadFromRow($aData);
$this->AllowEditByAll(true);
$this->Save();
} | php | protected function CommitProcessData()
{
TdbShopSearchFieldWeight::AddQueryBlock(false, null, null);
$sTmp = serialize($this->aTablesToProcess);
$aData = $this->sqlData;
$aData['processdata'] = $sTmp;
$this->LoadFromRow($aData);
$this->AllowEditByAll(true);
$this->Save();
} | [
"protected",
"function",
"CommitProcessData",
"(",
")",
"{",
"TdbShopSearchFieldWeight",
"::",
"AddQueryBlock",
"(",
"false",
",",
"null",
",",
"null",
")",
";",
"$",
"sTmp",
"=",
"serialize",
"(",
"$",
"this",
"->",
"aTablesToProcess",
")",
";",
"$",
"aData... | commit processing data to database. | [
"commit",
"processing",
"data",
"to",
"database",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/SearchBundle/objects/db/TShopSearchIndexer.class.php#L63-L72 | train |
chameleon-system/chameleon-shop | src/SearchBundle/objects/db/TShopSearchIndexer.class.php | TShopSearchIndexer.GetRemainingRowCount | protected function GetRemainingRowCount()
{
$aTableList = $this->aTablesToProcess;
$iCount = 0;
foreach ($aTableList as $iWorkId) {
$oIndexQuery = TdbShopSearchQuery::GetNewInstance();
/** @var $oIndexQuery TdbShopSearchQuery */
if ($oIndexQuery->Load($iWorkId)) {
$iCount = $iCount + $oIndexQuery->NumberOfRecordsLeftToIndex();
}
}
return $iCount;
} | php | protected function GetRemainingRowCount()
{
$aTableList = $this->aTablesToProcess;
$iCount = 0;
foreach ($aTableList as $iWorkId) {
$oIndexQuery = TdbShopSearchQuery::GetNewInstance();
/** @var $oIndexQuery TdbShopSearchQuery */
if ($oIndexQuery->Load($iWorkId)) {
$iCount = $iCount + $oIndexQuery->NumberOfRecordsLeftToIndex();
}
}
return $iCount;
} | [
"protected",
"function",
"GetRemainingRowCount",
"(",
")",
"{",
"$",
"aTableList",
"=",
"$",
"this",
"->",
"aTablesToProcess",
";",
"$",
"iCount",
"=",
"0",
";",
"foreach",
"(",
"$",
"aTableList",
"as",
"$",
"iWorkId",
")",
"{",
"$",
"oIndexQuery",
"=",
... | return the number of rows still to process.
@return unknown | [
"return",
"the",
"number",
"of",
"rows",
"still",
"to",
"process",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/SearchBundle/objects/db/TShopSearchIndexer.class.php#L100-L113 | train |
chameleon-system/chameleon-shop | src/SearchBundle/objects/db/TShopSearchIndexer.class.php | TShopSearchIndexer.ProcessNextIndexStep | public function ProcessNextIndexStep($bIndexUsingTicker = true)
{
TCacheManager::SetDisableCaching(true);
// if no index is running, prepare the indexer
$iTickerSize = self::INDEX_SET_SIZE;
if (!$bIndexUsingTicker) {
$iTickerSize = -1;
}
if (!$this->IsRunning()) {
$this->InitializeIndexer();
}
if ($this->IndexerHasFinished()) {
// indexing is done...
$this->IndexCompletedHook();
} elseif ($this->IsRunning()) {
// now process the next tick...
$iRecordsProcessed = 0;
do {
$iWorkId = $this->aTablesToProcess[0];
$oIndexQuery = TdbShopSearchQuery::GetNewInstance();
/** @var $oIndexQuery TdbShopSearchQuery */
if ($oIndexQuery->Load($iWorkId)) {
$iRecordsProcessedByIndexer = $oIndexQuery->CreateIndexTick($iTickerSize);
$iRecordsProcessed += $iRecordsProcessedByIndexer;
if (($iRecordsProcessedByIndexer < $iTickerSize) || ($iTickerSize < 0)) {
// if we processed less than we requested, we must be done with this query
// so we drop it from the list of queries we need to process
array_shift($this->aTablesToProcess);
}
} else {
// unalbe to load query object... so drop it from the list
array_shift($this->aTablesToProcess);
}
} while (!$this->IndexerHasFinished() && (($iRecordsProcessed < self::INDEX_SET_SIZE) || ($iTickerSize < 0)));
}
$this->CommitProcessData();
TCacheManager::SetDisableCaching(false);
} | php | public function ProcessNextIndexStep($bIndexUsingTicker = true)
{
TCacheManager::SetDisableCaching(true);
// if no index is running, prepare the indexer
$iTickerSize = self::INDEX_SET_SIZE;
if (!$bIndexUsingTicker) {
$iTickerSize = -1;
}
if (!$this->IsRunning()) {
$this->InitializeIndexer();
}
if ($this->IndexerHasFinished()) {
// indexing is done...
$this->IndexCompletedHook();
} elseif ($this->IsRunning()) {
// now process the next tick...
$iRecordsProcessed = 0;
do {
$iWorkId = $this->aTablesToProcess[0];
$oIndexQuery = TdbShopSearchQuery::GetNewInstance();
/** @var $oIndexQuery TdbShopSearchQuery */
if ($oIndexQuery->Load($iWorkId)) {
$iRecordsProcessedByIndexer = $oIndexQuery->CreateIndexTick($iTickerSize);
$iRecordsProcessed += $iRecordsProcessedByIndexer;
if (($iRecordsProcessedByIndexer < $iTickerSize) || ($iTickerSize < 0)) {
// if we processed less than we requested, we must be done with this query
// so we drop it from the list of queries we need to process
array_shift($this->aTablesToProcess);
}
} else {
// unalbe to load query object... so drop it from the list
array_shift($this->aTablesToProcess);
}
} while (!$this->IndexerHasFinished() && (($iRecordsProcessed < self::INDEX_SET_SIZE) || ($iTickerSize < 0)));
}
$this->CommitProcessData();
TCacheManager::SetDisableCaching(false);
} | [
"public",
"function",
"ProcessNextIndexStep",
"(",
"$",
"bIndexUsingTicker",
"=",
"true",
")",
"{",
"TCacheManager",
"::",
"SetDisableCaching",
"(",
"true",
")",
";",
"// if no index is running, prepare the indexer",
"$",
"iTickerSize",
"=",
"self",
"::",
"INDEX_SET_SIZ... | performs the next index set.
@param bool $bIndexUsingTicker - if set to true, each call to this method will only index as many rows as defined by INDEX_SET_SIZE | [
"performs",
"the",
"next",
"index",
"set",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/SearchBundle/objects/db/TShopSearchIndexer.class.php#L140-L178 | train |
chameleon-system/chameleon-shop | src/SearchBundle/objects/db/TShopSearchIndexer.class.php | TShopSearchIndexer.InitializeIndexer | public function InitializeIndexer()
{
$bWorkToDo = true;
if (!$this->bRegenerateCompleteIndex) {
// drop index
$query = "UPDATE shop_search_reindex_queue SET `processing` = '1'";
MySqlLegacySupport::getInstance()->query($query);
$query = "SELECT COUNT(*) AS reccount FROM shop_search_reindex_queue WHERE `processing` = '1'";
$aCount = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query));
if ($aCount['reccount'] > 0) {
$query = "SHOW TABLES LIKE '_index_%'";
$tRes = MySqlLegacySupport::getInstance()->query($query);
while ($aIndexTable = MySqlLegacySupport::getInstance()->fetch_row($tRes)) {
$query = "DELETE FROM {$aIndexTable[0]} USING {$aIndexTable[0]}, shop_search_reindex_queue WHERE {$aIndexTable[0]}.`shop_article_id`= shop_search_reindex_queue.object_id AND `shop_search_reindex_queue`.`processing`='1' ";
MySqlLegacySupport::getInstance()->query($query);
}
$sQuery = "DELETE FROM shop_search_reindex_queue WHERE `processing` = '1' AND `action` = 'delete'";
MySqlLegacySupport::getInstance()->query($sQuery);
$query = "SELECT COUNT(*) AS reccount FROM shop_search_reindex_queue WHERE `processing` = '1'";
$aCount = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query));
if (0 == $aCount['reccount']) {
$bWorkToDo = false;
}
} else {
$bWorkToDo = false;
}
}
if ($bWorkToDo) {
$this->aTablesToProcess = array();
$aData = $this->sqlData;
$aData['started'] = date('Y-m-d H:i:s');
$aData['completed'] = date('0000-00-00 00:00:00');
$iTotalRows = 0;
$query = 'SELECT shop_search_query.*
FROM shop_search_query
INNER JOIN shop_search_field_weight ON shop_search_query.id = shop_search_field_weight.shop_search_query_id
GROUP BY shop_search_query.id
';
$oIndexQueries = &TdbShopSearchQueryList::GetList($query);
while ($oIndexQuery = &$oIndexQueries->Next()) {
$oIndexQuery->StartIndex($this->bRegenerateCompleteIndex);
$iNumberOfItems = $oIndexQuery->NumberOfRecordsLeftToIndex();
if ($iNumberOfItems > 0) {
$iTotalRows += $iNumberOfItems;
$this->aTablesToProcess[] = $oIndexQuery->id;
}
}
$aData['total_rows_to_process'] = $iTotalRows;
$sTmp = serialize($this->aTablesToProcess);
$aData['processdata'] = $sTmp;
$this->LoadFromRow($aData);
$this->AllowEditByAll(true);
$this->Save();
$this->CommitProcessData();
$this->CreateIndexTables();
}
} | php | public function InitializeIndexer()
{
$bWorkToDo = true;
if (!$this->bRegenerateCompleteIndex) {
// drop index
$query = "UPDATE shop_search_reindex_queue SET `processing` = '1'";
MySqlLegacySupport::getInstance()->query($query);
$query = "SELECT COUNT(*) AS reccount FROM shop_search_reindex_queue WHERE `processing` = '1'";
$aCount = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query));
if ($aCount['reccount'] > 0) {
$query = "SHOW TABLES LIKE '_index_%'";
$tRes = MySqlLegacySupport::getInstance()->query($query);
while ($aIndexTable = MySqlLegacySupport::getInstance()->fetch_row($tRes)) {
$query = "DELETE FROM {$aIndexTable[0]} USING {$aIndexTable[0]}, shop_search_reindex_queue WHERE {$aIndexTable[0]}.`shop_article_id`= shop_search_reindex_queue.object_id AND `shop_search_reindex_queue`.`processing`='1' ";
MySqlLegacySupport::getInstance()->query($query);
}
$sQuery = "DELETE FROM shop_search_reindex_queue WHERE `processing` = '1' AND `action` = 'delete'";
MySqlLegacySupport::getInstance()->query($sQuery);
$query = "SELECT COUNT(*) AS reccount FROM shop_search_reindex_queue WHERE `processing` = '1'";
$aCount = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query));
if (0 == $aCount['reccount']) {
$bWorkToDo = false;
}
} else {
$bWorkToDo = false;
}
}
if ($bWorkToDo) {
$this->aTablesToProcess = array();
$aData = $this->sqlData;
$aData['started'] = date('Y-m-d H:i:s');
$aData['completed'] = date('0000-00-00 00:00:00');
$iTotalRows = 0;
$query = 'SELECT shop_search_query.*
FROM shop_search_query
INNER JOIN shop_search_field_weight ON shop_search_query.id = shop_search_field_weight.shop_search_query_id
GROUP BY shop_search_query.id
';
$oIndexQueries = &TdbShopSearchQueryList::GetList($query);
while ($oIndexQuery = &$oIndexQueries->Next()) {
$oIndexQuery->StartIndex($this->bRegenerateCompleteIndex);
$iNumberOfItems = $oIndexQuery->NumberOfRecordsLeftToIndex();
if ($iNumberOfItems > 0) {
$iTotalRows += $iNumberOfItems;
$this->aTablesToProcess[] = $oIndexQuery->id;
}
}
$aData['total_rows_to_process'] = $iTotalRows;
$sTmp = serialize($this->aTablesToProcess);
$aData['processdata'] = $sTmp;
$this->LoadFromRow($aData);
$this->AllowEditByAll(true);
$this->Save();
$this->CommitProcessData();
$this->CreateIndexTables();
}
} | [
"public",
"function",
"InitializeIndexer",
"(",
")",
"{",
"$",
"bWorkToDo",
"=",
"true",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"bRegenerateCompleteIndex",
")",
"{",
"// drop index",
"$",
"query",
"=",
"\"UPDATE shop_search_reindex_queue SET `processing` = '1'\"",
... | initialize indexer. | [
"initialize",
"indexer",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/SearchBundle/objects/db/TShopSearchIndexer.class.php#L205-L265 | train |
chameleon-system/chameleon-shop | src/SearchBundle/objects/db/TShopSearchIndexer.class.php | TShopSearchIndexer.& | protected static function &GetShopConfigForIndexer()
{
static $oShop;
if (!isset($oShop)) {
// get first shop we find
$oShops = &TdbShopList::GetList();
$oShop = $oShops->Current();
}
return $oShop;
} | php | protected static function &GetShopConfigForIndexer()
{
static $oShop;
if (!isset($oShop)) {
// get first shop we find
$oShops = &TdbShopList::GetList();
$oShop = $oShops->Current();
}
return $oShop;
} | [
"protected",
"static",
"function",
"&",
"GetShopConfigForIndexer",
"(",
")",
"{",
"static",
"$",
"oShop",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"oShop",
")",
")",
"{",
"// get first shop we find",
"$",
"oShops",
"=",
"&",
"TdbShopList",
"::",
"GetList",
... | get the shop we use for config data for the indexer... for now we just take
the first we find. later we need some way to connect the two.
@return TdbShop | [
"get",
"the",
"shop",
"we",
"use",
"for",
"config",
"data",
"for",
"the",
"indexer",
"...",
"for",
"now",
"we",
"just",
"take",
"the",
"first",
"we",
"find",
".",
"later",
"we",
"need",
"some",
"way",
"to",
"connect",
"the",
"two",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/SearchBundle/objects/db/TShopSearchIndexer.class.php#L273-L283 | train |
chameleon-system/chameleon-shop | src/SearchBundle/objects/db/TShopSearchIndexer.class.php | TShopSearchIndexer.CreateIndexTables | public function CreateIndexTables()
{
$aIndexTableNames = TdbShopSearchIndexer::GetAllIndexTableNames();
$aTmpIndex = array();
foreach ($aIndexTableNames as $sTableName => $length) {
$aTmpIndex['_tmp'.$sTableName] = $length;
}
$aIndexTableNames = $aTmpIndex;
foreach ($aIndexTableNames as $sTableName => $iLength) {
if (TCMSRecord::TableExists($sTableName)) {
$query = "DROP TABLE `{$sTableName}`";
MySqlLegacySupport::getInstance()->query($query);
}
$sPrimaryKey = '';
$query = 'CREATE TABLE `'.MySqlLegacySupport::getInstance()->real_escape_string($sTableName)."` (
`shop_article_id` CHAR(36) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL COMMENT 'the shop article',
`substring` CHAR( {$iLength} ) NOT NULL COMMENT 'the substring',
`cms_language_id` CHAR(36) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL COMMENT 'language of substring',
`occurrences` INT NOT NULL COMMENT 'Number of times the substring occured in the field for that article',
`weight` FLOAT NOT NULL COMMENT 'calculated weight for the substring',
`shop_search_field_weight_id` CHAR(36) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL COMMENT 'field for which the search term was made'
{$sPrimaryKey}
)";
MySqlLegacySupport::getInstance()->query($query);
}
// drop index fields not needed
$sBaseName = '_tmp'.self::INDEX_TBL_PREFIX;
$query = "SHOW TABLES LIKE '".MySqlLegacySupport::getInstance()->real_escape_string($sBaseName)."%'";
$rTableRes = MySqlLegacySupport::getInstance()->query($query);
while ($aTableData = MySqlLegacySupport::getInstance()->fetch_row($rTableRes)) {
if (!array_key_exists($aTableData[0], $aIndexTableNames)) {
$query = 'DROP TABLE `'.MySqlLegacySupport::getInstance()->real_escape_string($aTableData[0]).'`';
MySqlLegacySupport::getInstance()->query($query);
}
}
} | php | public function CreateIndexTables()
{
$aIndexTableNames = TdbShopSearchIndexer::GetAllIndexTableNames();
$aTmpIndex = array();
foreach ($aIndexTableNames as $sTableName => $length) {
$aTmpIndex['_tmp'.$sTableName] = $length;
}
$aIndexTableNames = $aTmpIndex;
foreach ($aIndexTableNames as $sTableName => $iLength) {
if (TCMSRecord::TableExists($sTableName)) {
$query = "DROP TABLE `{$sTableName}`";
MySqlLegacySupport::getInstance()->query($query);
}
$sPrimaryKey = '';
$query = 'CREATE TABLE `'.MySqlLegacySupport::getInstance()->real_escape_string($sTableName)."` (
`shop_article_id` CHAR(36) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL COMMENT 'the shop article',
`substring` CHAR( {$iLength} ) NOT NULL COMMENT 'the substring',
`cms_language_id` CHAR(36) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL COMMENT 'language of substring',
`occurrences` INT NOT NULL COMMENT 'Number of times the substring occured in the field for that article',
`weight` FLOAT NOT NULL COMMENT 'calculated weight for the substring',
`shop_search_field_weight_id` CHAR(36) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL COMMENT 'field for which the search term was made'
{$sPrimaryKey}
)";
MySqlLegacySupport::getInstance()->query($query);
}
// drop index fields not needed
$sBaseName = '_tmp'.self::INDEX_TBL_PREFIX;
$query = "SHOW TABLES LIKE '".MySqlLegacySupport::getInstance()->real_escape_string($sBaseName)."%'";
$rTableRes = MySqlLegacySupport::getInstance()->query($query);
while ($aTableData = MySqlLegacySupport::getInstance()->fetch_row($rTableRes)) {
if (!array_key_exists($aTableData[0], $aIndexTableNames)) {
$query = 'DROP TABLE `'.MySqlLegacySupport::getInstance()->real_escape_string($aTableData[0]).'`';
MySqlLegacySupport::getInstance()->query($query);
}
}
} | [
"public",
"function",
"CreateIndexTables",
"(",
")",
"{",
"$",
"aIndexTableNames",
"=",
"TdbShopSearchIndexer",
"::",
"GetAllIndexTableNames",
"(",
")",
";",
"$",
"aTmpIndex",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"aIndexTableNames",
"as",
"$",
"sT... | create all index tables for the field and drop tables no longer needed. | [
"create",
"all",
"index",
"tables",
"for",
"the",
"field",
"and",
"drop",
"tables",
"no",
"longer",
"needed",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/SearchBundle/objects/db/TShopSearchIndexer.class.php#L303-L339 | train |
chameleon-system/chameleon-shop | src/SearchBundle/objects/db/TShopSearchIndexer.class.php | TShopSearchIndexer.GetAllIndexTableNames | public static function GetAllIndexTableNames()
{
static $aNames;
if (!isset($aNames)) {
$aNames = array();
$oShop = &TdbShopSearchIndexer::GetShopConfigForIndexer();
for ($i = $oShop->fieldShopSearchMinIndexLength; $i <= $oShop->fieldShopSearchMaxIndexLength; ++$i) {
$aNames[TdbShopSearchIndexer::GetIndexTableNameForIndexLength($i)] = $i;
}
}
return $aNames;
} | php | public static function GetAllIndexTableNames()
{
static $aNames;
if (!isset($aNames)) {
$aNames = array();
$oShop = &TdbShopSearchIndexer::GetShopConfigForIndexer();
for ($i = $oShop->fieldShopSearchMinIndexLength; $i <= $oShop->fieldShopSearchMaxIndexLength; ++$i) {
$aNames[TdbShopSearchIndexer::GetIndexTableNameForIndexLength($i)] = $i;
}
}
return $aNames;
} | [
"public",
"static",
"function",
"GetAllIndexTableNames",
"(",
")",
"{",
"static",
"$",
"aNames",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"aNames",
")",
")",
"{",
"$",
"aNames",
"=",
"array",
"(",
")",
";",
"$",
"oShop",
"=",
"&",
"TdbShopSearchIndexer"... | get all index tables for the field.
@return array | [
"get",
"all",
"index",
"tables",
"for",
"the",
"field",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/SearchBundle/objects/db/TShopSearchIndexer.class.php#L451-L463 | train |
chameleon-system/chameleon-shop | src/SearchBundle/objects/db/TShopSearchIndexer.class.php | TShopSearchIndexer.GetWordListQuery | protected static function GetWordListQuery($aTerms, $sLanguageId, $aFieldRestrictions = null, $sTypeOfFieldRestriction = 'OR')
{
$aTableQueries = array();
// get affected tables
$aTableList = array();
foreach ($aTerms as $sTerm) {
$sTableName = TdbShopSearchIndexer::GetIndexTableNameForIndexLength(mb_strlen($sTerm));
if (!in_array($sTableName, $aTableList)) {
$aTableList[] = $sTableName;
}
if (false == TdbShopSearchIndexer::searchWithAND()) {
$sSoundEX = TdbShopSearchIndexer::GetSoundexForWord($sTerm);
$sSoundTable = TdbShopSearchIndexer::GetIndexTableNameForIndexLength(mb_strlen($sSoundEX));
if (!in_array($sSoundTable, $aTableList)) {
$aTableList[] = $sSoundTable;
}
}
}
$aFieldRestrictionQueries = array();
if (!is_null($aFieldRestrictions)) {
reset($aTableList);
foreach ($aTableList as $sTableName) {
$aFieldRestrictionQueries[$sTableName] = " ('".implode("','", $aFieldRestrictions)."')";
}
}
// build query
$aTableQueries = array();
reset($aTerms);
$sLanguageId = MySqlLegacySupport::getInstance()->real_escape_string($sLanguageId);
foreach ($aTerms as $sTerm) {
$sTermTable = TdbShopSearchIndexer::GetIndexTableNameForIndexLength(mb_strlen($sTerm));
if (!array_key_exists($sTermTable, $aTableQueries)) {
$aTableQueries[$sTermTable] = array();
}
$sTmpQuery = '';
$sTmpQuery .= " (`{$sTermTable}`.`substring` = '".MySqlLegacySupport::getInstance()->real_escape_string($sTerm)."' AND (`{$sTermTable}`.`cms_language_id` = '{$sLanguageId}' OR `{$sTermTable}`.`cms_language_id` = '')";
if (is_array($aFieldRestrictions)) {
$sTmpQuery .= " AND `{$sTermTable}`.`shop_search_field_weight_id` IN {$aFieldRestrictionQueries[$sTermTable]}";
}
$sTmpQuery .= ')';
$aTableQueries[$sTermTable][] = $sTmpQuery;
if (false == TdbShopSearchIndexer::searchWithAND()) {
//OR `{$sSoundTable}`.`substring` = '".MySqlLegacySupport::getInstance()->real_escape_string($sSoundEX)."')
$sSoundEX = TdbShopSearchIndexer::GetSoundexForWord($sTerm);
if ('0000' != $sSoundEX) {
$sSoundTable = TdbShopSearchIndexer::GetIndexTableNameForIndexLength(mb_strlen($sSoundEX));
$sTmpQuerySoundex = '';
$sTmpQuerySoundex .= " (`{$sSoundTable}`.`substring` = '".MySqlLegacySupport::getInstance()->real_escape_string($sSoundEX)."' AND (`{$sSoundTable}`.`cms_language_id` = '{$sLanguageId}' OR `{$sSoundTable}`.`cms_language_id` = '')";
if (is_array($aFieldRestrictions)) {
$sTmpQuerySoundex .= " AND `{$sSoundTable}`.`shop_search_field_weight_id` IN {$aFieldRestrictionQueries[$sSoundTable]}";
}
$sTmpQuerySoundex .= ')';
$aTableQueries[$sSoundTable][] = $sTmpQuerySoundex;
}
}
}
return $aTableQueries;
} | php | protected static function GetWordListQuery($aTerms, $sLanguageId, $aFieldRestrictions = null, $sTypeOfFieldRestriction = 'OR')
{
$aTableQueries = array();
// get affected tables
$aTableList = array();
foreach ($aTerms as $sTerm) {
$sTableName = TdbShopSearchIndexer::GetIndexTableNameForIndexLength(mb_strlen($sTerm));
if (!in_array($sTableName, $aTableList)) {
$aTableList[] = $sTableName;
}
if (false == TdbShopSearchIndexer::searchWithAND()) {
$sSoundEX = TdbShopSearchIndexer::GetSoundexForWord($sTerm);
$sSoundTable = TdbShopSearchIndexer::GetIndexTableNameForIndexLength(mb_strlen($sSoundEX));
if (!in_array($sSoundTable, $aTableList)) {
$aTableList[] = $sSoundTable;
}
}
}
$aFieldRestrictionQueries = array();
if (!is_null($aFieldRestrictions)) {
reset($aTableList);
foreach ($aTableList as $sTableName) {
$aFieldRestrictionQueries[$sTableName] = " ('".implode("','", $aFieldRestrictions)."')";
}
}
// build query
$aTableQueries = array();
reset($aTerms);
$sLanguageId = MySqlLegacySupport::getInstance()->real_escape_string($sLanguageId);
foreach ($aTerms as $sTerm) {
$sTermTable = TdbShopSearchIndexer::GetIndexTableNameForIndexLength(mb_strlen($sTerm));
if (!array_key_exists($sTermTable, $aTableQueries)) {
$aTableQueries[$sTermTable] = array();
}
$sTmpQuery = '';
$sTmpQuery .= " (`{$sTermTable}`.`substring` = '".MySqlLegacySupport::getInstance()->real_escape_string($sTerm)."' AND (`{$sTermTable}`.`cms_language_id` = '{$sLanguageId}' OR `{$sTermTable}`.`cms_language_id` = '')";
if (is_array($aFieldRestrictions)) {
$sTmpQuery .= " AND `{$sTermTable}`.`shop_search_field_weight_id` IN {$aFieldRestrictionQueries[$sTermTable]}";
}
$sTmpQuery .= ')';
$aTableQueries[$sTermTable][] = $sTmpQuery;
if (false == TdbShopSearchIndexer::searchWithAND()) {
//OR `{$sSoundTable}`.`substring` = '".MySqlLegacySupport::getInstance()->real_escape_string($sSoundEX)."')
$sSoundEX = TdbShopSearchIndexer::GetSoundexForWord($sTerm);
if ('0000' != $sSoundEX) {
$sSoundTable = TdbShopSearchIndexer::GetIndexTableNameForIndexLength(mb_strlen($sSoundEX));
$sTmpQuerySoundex = '';
$sTmpQuerySoundex .= " (`{$sSoundTable}`.`substring` = '".MySqlLegacySupport::getInstance()->real_escape_string($sSoundEX)."' AND (`{$sSoundTable}`.`cms_language_id` = '{$sLanguageId}' OR `{$sSoundTable}`.`cms_language_id` = '')";
if (is_array($aFieldRestrictions)) {
$sTmpQuerySoundex .= " AND `{$sSoundTable}`.`shop_search_field_weight_id` IN {$aFieldRestrictionQueries[$sSoundTable]}";
}
$sTmpQuerySoundex .= ')';
$aTableQueries[$sSoundTable][] = $sTmpQuerySoundex;
}
}
}
return $aTableQueries;
} | [
"protected",
"static",
"function",
"GetWordListQuery",
"(",
"$",
"aTerms",
",",
"$",
"sLanguageId",
",",
"$",
"aFieldRestrictions",
"=",
"null",
",",
"$",
"sTypeOfFieldRestriction",
"=",
"'OR'",
")",
"{",
"$",
"aTableQueries",
"=",
"array",
"(",
")",
";",
"/... | return subquery that searches for the terms in aTerms in all fields defined by aFieldRestriction
if no restrctions are passed, we search in all.
@param array $aTerms
@param string $sLanguage - search in which language?
@param array $aFieldRestrictions
@param string $sTypeOfFieldRestriction - if the field restrictions are ORed or ANDed
@return array - returns an array with one parameter holding the query, the other a list of relevant table names | [
"return",
"subquery",
"that",
"searches",
"for",
"the",
"terms",
"in",
"aTerms",
"in",
"all",
"fields",
"defined",
"by",
"aFieldRestriction",
"if",
"no",
"restrctions",
"are",
"passed",
"we",
"search",
"in",
"all",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/SearchBundle/objects/db/TShopSearchIndexer.class.php#L632-L695 | train |
chameleon-system/chameleon-shop | src/SearchBundle/objects/db/TShopSearchIndexer.class.php | TShopSearchIndexer.PrepareSearchWords | public static function PrepareSearchWords($sOrigianlString, $bFilterIgnoreWords = true)
{
$aWords = array();
$sOrigianlString = strip_tags($sOrigianlString);
$sOrigianlString = str_replace(array('/', "\n", '-', '_', '&', '+'), array(' ', ' ', ' ', ' ', ' ', ' '), $sOrigianlString);
$aTmpWords = explode(' ', $sOrigianlString);
foreach ($aTmpWords as $iIndex => $sWord) {
$sWord = trim($sWord);
if (!empty($sWord)) {
$sTmpWord = TdbShopSearchIndexer::PrepareSearchWord($sWord, $bFilterIgnoreWords);
if (!empty($sTmpWord)) {
$aWords[] = $sTmpWord;
}
}
}
return $aWords;
} | php | public static function PrepareSearchWords($sOrigianlString, $bFilterIgnoreWords = true)
{
$aWords = array();
$sOrigianlString = strip_tags($sOrigianlString);
$sOrigianlString = str_replace(array('/', "\n", '-', '_', '&', '+'), array(' ', ' ', ' ', ' ', ' ', ' '), $sOrigianlString);
$aTmpWords = explode(' ', $sOrigianlString);
foreach ($aTmpWords as $iIndex => $sWord) {
$sWord = trim($sWord);
if (!empty($sWord)) {
$sTmpWord = TdbShopSearchIndexer::PrepareSearchWord($sWord, $bFilterIgnoreWords);
if (!empty($sTmpWord)) {
$aWords[] = $sTmpWord;
}
}
}
return $aWords;
} | [
"public",
"static",
"function",
"PrepareSearchWords",
"(",
"$",
"sOrigianlString",
",",
"$",
"bFilterIgnoreWords",
"=",
"true",
")",
"{",
"$",
"aWords",
"=",
"array",
"(",
")",
";",
"$",
"sOrigianlString",
"=",
"strip_tags",
"(",
"$",
"sOrigianlString",
")",
... | splits the search words into an array with prepared search words.
@param string $sWords
@param bool $bFilterIgnoreWords - removes ignore words form the list if set
@return array | [
"splits",
"the",
"search",
"words",
"into",
"an",
"array",
"with",
"prepared",
"search",
"words",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/SearchBundle/objects/db/TShopSearchIndexer.class.php#L705-L722 | train |
chameleon-system/chameleon-shop | src/SearchBundle/objects/db/TShopSearchIndexer.class.php | TShopSearchIndexer.IsIgnoreWord | protected static function IsIgnoreWord($sWord)
{
static $aIgnoreWordCache;
static $bCompleteLoad = null;
// first try to cache all... if we have to many (more than 500) then work an a word base system instead
if (!isset($aIgnoreWordCache)) {
$aIgnoreWordCache = array();
$oShop = &TdbShopSearchIndexer::GetShopConfigForIndexer();
$query = "SELECT DISTINCT `name` FROM `shop_search_ignore_word` WHERE `shop_id`='".MySqlLegacySupport::getInstance()->real_escape_string($oShop->id)."'";
$tres = MySqlLegacySupport::getInstance()->query($query);
if (MySqlLegacySupport::getInstance()->num_rows($tres) <= 500) {
$bCompleteLoad = true;
} else {
$bCompleteLoad = false;
}
$count = 0;
while ($count < 500 && ($aRow = MySqlLegacySupport::getInstance()->fetch_row($tres))) {
$aIgnoreWordCache[mb_strtolower($aRow[0])] = 1; // store as assoc so we later have a quick lookup
++$count;
}
}
$sTmpWord = mb_strtolower($sWord);
$bIgnore = false;
if (array_key_exists($sTmpWord, $aIgnoreWordCache)) {
$bIgnore = true;
} elseif (!$bCompleteLoad) {
// check if we find it in the db
$oShop = &TdbShopSearchIndexer::GetShopConfigForIndexer();
$query = "SELECT DISTINCT `name` FROM `shop_search_ignore_word` WHERE `shop_id`='".MySqlLegacySupport::getInstance()->real_escape_string($oShop->id)."' AND `name` = '".MySqlLegacySupport::getInstance()->real_escape_string($sWord)."'";
$tres = MySqlLegacySupport::getInstance()->query($query);
if (MySqlLegacySupport::getInstance()->num_rows($tres) > 0) {
$aIgnoreWordCache[$sTmpWord] = 1;
$bIgnore = true;
}
}
return $bIgnore;
} | php | protected static function IsIgnoreWord($sWord)
{
static $aIgnoreWordCache;
static $bCompleteLoad = null;
// first try to cache all... if we have to many (more than 500) then work an a word base system instead
if (!isset($aIgnoreWordCache)) {
$aIgnoreWordCache = array();
$oShop = &TdbShopSearchIndexer::GetShopConfigForIndexer();
$query = "SELECT DISTINCT `name` FROM `shop_search_ignore_word` WHERE `shop_id`='".MySqlLegacySupport::getInstance()->real_escape_string($oShop->id)."'";
$tres = MySqlLegacySupport::getInstance()->query($query);
if (MySqlLegacySupport::getInstance()->num_rows($tres) <= 500) {
$bCompleteLoad = true;
} else {
$bCompleteLoad = false;
}
$count = 0;
while ($count < 500 && ($aRow = MySqlLegacySupport::getInstance()->fetch_row($tres))) {
$aIgnoreWordCache[mb_strtolower($aRow[0])] = 1; // store as assoc so we later have a quick lookup
++$count;
}
}
$sTmpWord = mb_strtolower($sWord);
$bIgnore = false;
if (array_key_exists($sTmpWord, $aIgnoreWordCache)) {
$bIgnore = true;
} elseif (!$bCompleteLoad) {
// check if we find it in the db
$oShop = &TdbShopSearchIndexer::GetShopConfigForIndexer();
$query = "SELECT DISTINCT `name` FROM `shop_search_ignore_word` WHERE `shop_id`='".MySqlLegacySupport::getInstance()->real_escape_string($oShop->id)."' AND `name` = '".MySqlLegacySupport::getInstance()->real_escape_string($sWord)."'";
$tres = MySqlLegacySupport::getInstance()->query($query);
if (MySqlLegacySupport::getInstance()->num_rows($tres) > 0) {
$aIgnoreWordCache[$sTmpWord] = 1;
$bIgnore = true;
}
}
return $bIgnore;
} | [
"protected",
"static",
"function",
"IsIgnoreWord",
"(",
"$",
"sWord",
")",
"{",
"static",
"$",
"aIgnoreWordCache",
";",
"static",
"$",
"bCompleteLoad",
"=",
"null",
";",
"// first try to cache all... if we have to many (more than 500) then work an a word base system instead",
... | return true if the word is in the ignore list.
@param string $sWord
@return bool | [
"return",
"true",
"if",
"the",
"word",
"is",
"in",
"the",
"ignore",
"list",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/SearchBundle/objects/db/TShopSearchIndexer.class.php#L769-L807 | train |
chameleon-system/chameleon-shop | src/SearchBundle/objects/db/TShopSearchIndexer.class.php | TShopSearchIndexer.searchWithAND | public static function searchWithAND()
{
$bUseAnd = false;
$oShop = TdbShop::GetInstance();
if ($oShop && array_key_exists('shop_search_use_boolean_and', $oShop->sqlData)) {
$bUseAnd = ('1' == $oShop->sqlData['shop_search_use_boolean_and']);
}
return $bUseAnd;
} | php | public static function searchWithAND()
{
$bUseAnd = false;
$oShop = TdbShop::GetInstance();
if ($oShop && array_key_exists('shop_search_use_boolean_and', $oShop->sqlData)) {
$bUseAnd = ('1' == $oShop->sqlData['shop_search_use_boolean_and']);
}
return $bUseAnd;
} | [
"public",
"static",
"function",
"searchWithAND",
"(",
")",
"{",
"$",
"bUseAnd",
"=",
"false",
";",
"$",
"oShop",
"=",
"TdbShop",
"::",
"GetInstance",
"(",
")",
";",
"if",
"(",
"$",
"oShop",
"&&",
"array_key_exists",
"(",
"'shop_search_use_boolean_and'",
",",... | returns always true!
non AND searches are disabled currently.
@return bool | [
"returns",
"always",
"true!",
"non",
"AND",
"searches",
"are",
"disabled",
"currently",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/SearchBundle/objects/db/TShopSearchIndexer.class.php#L874-L883 | train |
edmondscommerce/doctrine-static-meta | src/CodeGeneration/PathHelper.php | PathHelper.resolvePath | public function resolvePath(string $relativePath): string
{
$path = [];
$absolute = (strpos($relativePath, '/') === 0);
foreach (explode('/', $relativePath) as $part) {
// ignore parts that have no value
if (empty($part) || $part === '.') {
continue;
}
if ($part !== '..') {
$path[] = $part;
continue;
}
if (count($path) > 0) {
// going back up? sure
array_pop($path);
continue;
}
throw new \RuntimeException('Relative path resolves above root path.');
}
$return = implode('/', $path);
if ($absolute) {
$return = "/$return";
}
return $return;
} | php | public function resolvePath(string $relativePath): string
{
$path = [];
$absolute = (strpos($relativePath, '/') === 0);
foreach (explode('/', $relativePath) as $part) {
// ignore parts that have no value
if (empty($part) || $part === '.') {
continue;
}
if ($part !== '..') {
$path[] = $part;
continue;
}
if (count($path) > 0) {
// going back up? sure
array_pop($path);
continue;
}
throw new \RuntimeException('Relative path resolves above root path.');
}
$return = implode('/', $path);
if ($absolute) {
$return = "/$return";
}
return $return;
} | [
"public",
"function",
"resolvePath",
"(",
"string",
"$",
"relativePath",
")",
":",
"string",
"{",
"$",
"path",
"=",
"[",
"]",
";",
"$",
"absolute",
"=",
"(",
"strpos",
"(",
"$",
"relativePath",
",",
"'/'",
")",
"===",
"0",
")",
";",
"foreach",
"(",
... | Take a potentially non existent path and resolve the relativeness into a normal path
@param string $relativePath
@return string
@throws \RuntimeException | [
"Take",
"a",
"potentially",
"non",
"existent",
"path",
"and",
"resolve",
"the",
"relativeness",
"into",
"a",
"normal",
"path"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/PathHelper.php#L215-L243 | train |
chameleon-system/chameleon-shop | src/ShopWishlistBundle/objects/WebModules/MTShopBasketCore/MTShopWishlistBasketCore.class.php | MTShopWishlistBasketCore.RemoveFromWishlist | protected function RemoveFromWishlist($sPkgShopWishlistArticleId = null, $sMessageHandler = null, $bIsInternalCall = false)
{
$oGlobal = TGlobal::instance();
$aRequestData = $oGlobal->GetUserData(self::URL_REQUEST_PARAMETER);
if (is_null($sPkgShopWishlistArticleId) && array_key_exists(self::URL_ITEM_ID_NAME, $aRequestData)) {
$sPkgShopWishlistArticleId = $aRequestData[self::URL_ITEM_ID_NAME];
}
if (is_null($sMessageHandler) && array_key_exists(self::URL_MESSAGE_CONSUMER_NAME, $aRequestData)) {
$sMessageHandler = $aRequestData[self::URL_MESSAGE_CONSUMER_NAME];
if (empty($sMessageHandler)) {
$sMessageHandler = null;
}
}
if (is_null($sMessageHandler)) {
$sMessageHandler = self::MSG_CONSUMER_NAME;
}
$oMessageManager = TCMSMessageManager::GetInstance();
$oUser = TdbDataExtranetUser::GetInstance();
if (!$oUser->IsLoggedIn()) {
$oMessageManager->AddMessage($sMessageHandler, 'WISHLIST-USER-NOT-LOGGED-IN');
} else {
$oWishlistItem = TdbPkgShopWishlistArticle::GetNewInstance();
/** @var $oWishlistItem TdbPkgShopWishlistArticle */
$oWishlistItem->Load($sPkgShopWishlistArticleId);
$oArticle = $oWishlistItem->GetFieldShopArticle();
if ($oArticle) {
$aMessageData = array('sArticleLinkStart' => '<a href="'.TGlobal::OutHTML($oArticle->GetDetailLink()).'">', 'sArticleLinkEnd' => '</a>', 'sArticleName' => $oArticle->GetName());
} else {
$aMessageData = array();
}
$oUser->RemoveArticleFromWishlist($sPkgShopWishlistArticleId);
$oMessageManager->AddMessage($sMessageHandler, 'WISHLIST-REMOVED-ITEM', $aMessageData);
}
$iRedirectNodeId = null;
if (array_key_exists(self::URL_REDIRECT_NODE_ID_NAME, $aRequestData)) {
$iRedirectNodeId = $aRequestData[self::URL_REDIRECT_NODE_ID_NAME];
if (empty($iRedirectNodeId)) {
$iRedirectNodeId = null;
}
}
if (!$bIsInternalCall) {
$this->RedirectAfterEvent($iRedirectNodeId);
}
} | php | protected function RemoveFromWishlist($sPkgShopWishlistArticleId = null, $sMessageHandler = null, $bIsInternalCall = false)
{
$oGlobal = TGlobal::instance();
$aRequestData = $oGlobal->GetUserData(self::URL_REQUEST_PARAMETER);
if (is_null($sPkgShopWishlistArticleId) && array_key_exists(self::URL_ITEM_ID_NAME, $aRequestData)) {
$sPkgShopWishlistArticleId = $aRequestData[self::URL_ITEM_ID_NAME];
}
if (is_null($sMessageHandler) && array_key_exists(self::URL_MESSAGE_CONSUMER_NAME, $aRequestData)) {
$sMessageHandler = $aRequestData[self::URL_MESSAGE_CONSUMER_NAME];
if (empty($sMessageHandler)) {
$sMessageHandler = null;
}
}
if (is_null($sMessageHandler)) {
$sMessageHandler = self::MSG_CONSUMER_NAME;
}
$oMessageManager = TCMSMessageManager::GetInstance();
$oUser = TdbDataExtranetUser::GetInstance();
if (!$oUser->IsLoggedIn()) {
$oMessageManager->AddMessage($sMessageHandler, 'WISHLIST-USER-NOT-LOGGED-IN');
} else {
$oWishlistItem = TdbPkgShopWishlistArticle::GetNewInstance();
/** @var $oWishlistItem TdbPkgShopWishlistArticle */
$oWishlistItem->Load($sPkgShopWishlistArticleId);
$oArticle = $oWishlistItem->GetFieldShopArticle();
if ($oArticle) {
$aMessageData = array('sArticleLinkStart' => '<a href="'.TGlobal::OutHTML($oArticle->GetDetailLink()).'">', 'sArticleLinkEnd' => '</a>', 'sArticleName' => $oArticle->GetName());
} else {
$aMessageData = array();
}
$oUser->RemoveArticleFromWishlist($sPkgShopWishlistArticleId);
$oMessageManager->AddMessage($sMessageHandler, 'WISHLIST-REMOVED-ITEM', $aMessageData);
}
$iRedirectNodeId = null;
if (array_key_exists(self::URL_REDIRECT_NODE_ID_NAME, $aRequestData)) {
$iRedirectNodeId = $aRequestData[self::URL_REDIRECT_NODE_ID_NAME];
if (empty($iRedirectNodeId)) {
$iRedirectNodeId = null;
}
}
if (!$bIsInternalCall) {
$this->RedirectAfterEvent($iRedirectNodeId);
}
} | [
"protected",
"function",
"RemoveFromWishlist",
"(",
"$",
"sPkgShopWishlistArticleId",
"=",
"null",
",",
"$",
"sMessageHandler",
"=",
"null",
",",
"$",
"bIsInternalCall",
"=",
"false",
")",
"{",
"$",
"oGlobal",
"=",
"TGlobal",
"::",
"instance",
"(",
")",
";",
... | remove an item from the users wishlist.
@param string $sPkgShopWishlistArticleId - the pkg_shop_wishlist_article_id to remove from the list
@param string $sMessageHandler
@param bool $bIsInternalCall | [
"remove",
"an",
"item",
"from",
"the",
"users",
"wishlist",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopWishlistBundle/objects/WebModules/MTShopBasketCore/MTShopWishlistBasketCore.class.php#L110-L156 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/WebModules/MTShopCentralHandlerCore/MTShopCentralHandlerCoreEndPoint.class.php | MTShopCentralHandlerCoreEndPoint.GetArticleView | protected function GetArticleView($sShopArticleId = null, $sViewName = 'standard', $sViewType = 'Customer', $aCallTimeVars = array())
{
$oReturnObject = new stdClass();
$oArticle = TdbShopArticle::GetNewInstance();
$oArticle->Load($sShopArticleId);
if ($oArticle->IsVariant()) {
TdbShop::RegisterActiveVariantForSpot($this->sCallingSpotName, $oArticle->fieldVariantParentId, $oArticle->id);
}
$oReturnObject->sItemPage = $oArticle->Render($sViewName, $sViewType, $aCallTimeVars);
$sKey = $oArticle->id;
if ($oArticle->IsVariant()) {
$sKey = $oArticle->fieldVariantParentId;
}
$oReturnObject->iListKey = 'key'.md5($sKey);
return $oReturnObject;
} | php | protected function GetArticleView($sShopArticleId = null, $sViewName = 'standard', $sViewType = 'Customer', $aCallTimeVars = array())
{
$oReturnObject = new stdClass();
$oArticle = TdbShopArticle::GetNewInstance();
$oArticle->Load($sShopArticleId);
if ($oArticle->IsVariant()) {
TdbShop::RegisterActiveVariantForSpot($this->sCallingSpotName, $oArticle->fieldVariantParentId, $oArticle->id);
}
$oReturnObject->sItemPage = $oArticle->Render($sViewName, $sViewType, $aCallTimeVars);
$sKey = $oArticle->id;
if ($oArticle->IsVariant()) {
$sKey = $oArticle->fieldVariantParentId;
}
$oReturnObject->iListKey = 'key'.md5($sKey);
return $oReturnObject;
} | [
"protected",
"function",
"GetArticleView",
"(",
"$",
"sShopArticleId",
"=",
"null",
",",
"$",
"sViewName",
"=",
"'standard'",
",",
"$",
"sViewType",
"=",
"'Customer'",
",",
"$",
"aCallTimeVars",
"=",
"array",
"(",
")",
")",
"{",
"$",
"oReturnObject",
"=",
... | returns an article view.
@param string $sShopArticleId
@param string $sViewName
@param string $sViewType
@param array $aCallTimeVars
@return stdClass | [
"returns",
"an",
"article",
"view",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/WebModules/MTShopCentralHandlerCore/MTShopCentralHandlerCoreEndPoint.class.php#L45-L62 | train |
chameleon-system/chameleon-shop | src/AmazonPaymentBundle/pkgShop/OrderSteps/AmazonAddressStep.php | AmazonAddressStep.Init | public function Init()
{
parent::Init();
$oUser = TdbDataExtranetUser::GetInstance();
$shippingAddress = $oUser->GetShippingAddress();
if (true === $shippingAddress->getIsAmazonShippingAddress()) {
$oUser->resetAmazonAddresses();
$basket = $this->getShopService()->getActiveBasket();
$basket->RecalculateBasket(); // need to recalculate maybe changing address can change basket amount (gross net change)
}
} | php | public function Init()
{
parent::Init();
$oUser = TdbDataExtranetUser::GetInstance();
$shippingAddress = $oUser->GetShippingAddress();
if (true === $shippingAddress->getIsAmazonShippingAddress()) {
$oUser->resetAmazonAddresses();
$basket = $this->getShopService()->getActiveBasket();
$basket->RecalculateBasket(); // need to recalculate maybe changing address can change basket amount (gross net change)
}
} | [
"public",
"function",
"Init",
"(",
")",
"{",
"parent",
"::",
"Init",
"(",
")",
";",
"$",
"oUser",
"=",
"TdbDataExtranetUser",
"::",
"GetInstance",
"(",
")",
";",
"$",
"shippingAddress",
"=",
"$",
"oUser",
"->",
"GetShippingAddress",
"(",
")",
";",
"if",
... | reset address data because customer choose new in this step. | [
"reset",
"address",
"data",
"because",
"customer",
"choose",
"new",
"in",
"this",
"step",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/pkgShop/OrderSteps/AmazonAddressStep.php#L89-L99 | train |
chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Samples/CancellationResult.php | CancellationResult._waitUntilAuthorizationProcessingIsCompleted | private function _waitUntilAuthorizationProcessingIsCompleted
($amazonAuthorizationId)
{
// Check for the presence of the ipn notification
$this->waitForNotificationToBeProcessedBeforeContinuing(
$amazonAuthorizationId,
"AuthorizationNotification"
);
// Notification is present, go and get the full
// information for this notification
$response
= $this->callStepAndCheckForException(
'getAuthorizationDetails',
array($amazonAuthorizationId)
);
echo $this->printResponseToWebpage(
"printGetAuthorizationDetailsResponse", array($response)
);
validateThatAuthorizationIsOpen($response);
} | php | private function _waitUntilAuthorizationProcessingIsCompleted
($amazonAuthorizationId)
{
// Check for the presence of the ipn notification
$this->waitForNotificationToBeProcessedBeforeContinuing(
$amazonAuthorizationId,
"AuthorizationNotification"
);
// Notification is present, go and get the full
// information for this notification
$response
= $this->callStepAndCheckForException(
'getAuthorizationDetails',
array($amazonAuthorizationId)
);
echo $this->printResponseToWebpage(
"printGetAuthorizationDetailsResponse", array($response)
);
validateThatAuthorizationIsOpen($response);
} | [
"private",
"function",
"_waitUntilAuthorizationProcessingIsCompleted",
"(",
"$",
"amazonAuthorizationId",
")",
"{",
"// Check for the presence of the ipn notification",
"$",
"this",
"->",
"waitForNotificationToBeProcessedBeforeContinuing",
"(",
"$",
"amazonAuthorizationId",
",",
"\... | Check that we have received an IPN notification for the authorization
For PHP, there is an IPN handler that will write the contents of the IPN to
a file in the format of
<amazonAuthorizationId>_Authorization.
This method will check for the presnece of this file
and will loop/timeout until the notification has been handled.
Merchants can use alternative approaches such as memory caches,
shared memory or database storage so that scripts serving user
pages are able to check on the status of a notification
@param string $amazonAuthorizationId authorization transaction to query
@return void | [
"Check",
"that",
"we",
"have",
"received",
"an",
"IPN",
"notification",
"for",
"the",
"authorization"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Samples/CancellationResult.php#L161-L182 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopOrderStep/TShopStepBasketCore.class.php | TShopStepBasketCore.& | public function &GetNextStep()
{
static $oNextStep;
if (!$oNextStep) {
$oUsers = TdbDataExtranetUser::GetInstance();
if ($oUsers->IsLoggedIn() && $oUsers->HasData()) {
$oBasket = TShopBasket::GetInstance();
$oBasket->aCompletedOrderStepList['user'] = true;
// now search for the next step not marked as completed
$oStepList = TdbShopOrderStepList::GetList();
$oStepList->bAllowItemCache = true;
$oNextStep = null;
$bDone = false;
// do not allow access to the last stpe
$iNumItems = $oStepList->Length();
while (($iNumItems > 0) && !$bDone && ($oTmpStep = $oStepList->Next())) {
--$iNumItems;
if (!$oTmpStep->AllowAccessToStepPublic()) {
// step not completed...
$bDone = true;
} else {
$oNextStep = $oTmpStep;
}
}
} else {
$oNextStep = &TdbShopOrderStepList::GetNextStep($this);
}
}
return $oNextStep;
} | php | public function &GetNextStep()
{
static $oNextStep;
if (!$oNextStep) {
$oUsers = TdbDataExtranetUser::GetInstance();
if ($oUsers->IsLoggedIn() && $oUsers->HasData()) {
$oBasket = TShopBasket::GetInstance();
$oBasket->aCompletedOrderStepList['user'] = true;
// now search for the next step not marked as completed
$oStepList = TdbShopOrderStepList::GetList();
$oStepList->bAllowItemCache = true;
$oNextStep = null;
$bDone = false;
// do not allow access to the last stpe
$iNumItems = $oStepList->Length();
while (($iNumItems > 0) && !$bDone && ($oTmpStep = $oStepList->Next())) {
--$iNumItems;
if (!$oTmpStep->AllowAccessToStepPublic()) {
// step not completed...
$bDone = true;
} else {
$oNextStep = $oTmpStep;
}
}
} else {
$oNextStep = &TdbShopOrderStepList::GetNextStep($this);
}
}
return $oNextStep;
} | [
"public",
"function",
"&",
"GetNextStep",
"(",
")",
"{",
"static",
"$",
"oNextStep",
";",
"if",
"(",
"!",
"$",
"oNextStep",
")",
"{",
"$",
"oUsers",
"=",
"TdbDataExtranetUser",
"::",
"GetInstance",
"(",
")",
";",
"if",
"(",
"$",
"oUsers",
"->",
"IsLogg... | overwrite this to jump directly to the payment page for signed in users.
@return TdbShopOrderStep | [
"overwrite",
"this",
"to",
"jump",
"directly",
"to",
"the",
"payment",
"page",
"for",
"signed",
"in",
"users",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrderStep/TShopStepBasketCore.class.php#L86-L116 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopOrderStep/TShopStepBasketCore.class.php | TShopStepBasketCore.UpdateBasket | public function UpdateBasket($bInternalCall = false)
{
// we use the existing basket module to do all the work...
$oShop = TdbShop::GetInstance();
$oController = TGlobal::GetController();
$oBasketModule = $oController->moduleLoader->GetPointerToModule($oShop->fieldBasketSpotName);
$bSuccess = $oBasketModule->UpdateBasketItems(null, false, true);
// redirect to current page
if (!$bInternalCall) {
$this->ReloadCurrentStep();
}
return $bSuccess;
} | php | public function UpdateBasket($bInternalCall = false)
{
// we use the existing basket module to do all the work...
$oShop = TdbShop::GetInstance();
$oController = TGlobal::GetController();
$oBasketModule = $oController->moduleLoader->GetPointerToModule($oShop->fieldBasketSpotName);
$bSuccess = $oBasketModule->UpdateBasketItems(null, false, true);
// redirect to current page
if (!$bInternalCall) {
$this->ReloadCurrentStep();
}
return $bSuccess;
} | [
"public",
"function",
"UpdateBasket",
"(",
"$",
"bInternalCall",
"=",
"false",
")",
"{",
"// we use the existing basket module to do all the work...",
"$",
"oShop",
"=",
"TdbShop",
"::",
"GetInstance",
"(",
")",
";",
"$",
"oController",
"=",
"TGlobal",
"::",
"GetCon... | update current basket.
@param bool $bInternalCall - if set to true, all redirects will be supressed
@return bool | [
"update",
"current",
"basket",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrderStep/TShopStepBasketCore.class.php#L125-L139 | train |
chameleon-system/chameleon-shop | src/ShopCurrencyBundle/objects/db/TPkgShopCurrency.class.php | TPkgShopCurrency.GetBaseCurrency | public static function GetBaseCurrency()
{
static $oInstance = null;
if (null === $oInstance) {
$oInstance = TdbPkgShopCurrency::GetNewInstance();
if (false === $oInstance->LoadFromField('is_base_currency', '1')) {
$oInstance = false;
}
}
return $oInstance;
} | php | public static function GetBaseCurrency()
{
static $oInstance = null;
if (null === $oInstance) {
$oInstance = TdbPkgShopCurrency::GetNewInstance();
if (false === $oInstance->LoadFromField('is_base_currency', '1')) {
$oInstance = false;
}
}
return $oInstance;
} | [
"public",
"static",
"function",
"GetBaseCurrency",
"(",
")",
"{",
"static",
"$",
"oInstance",
"=",
"null",
";",
"if",
"(",
"null",
"===",
"$",
"oInstance",
")",
"{",
"$",
"oInstance",
"=",
"TdbPkgShopCurrency",
"::",
"GetNewInstance",
"(",
")",
";",
"if",
... | return the base currency relative to which all other currencies are calculated.
@return TdbPkgShopCurrency | [
"return",
"the",
"base",
"currency",
"relative",
"to",
"which",
"all",
"other",
"currencies",
"are",
"calculated",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopCurrencyBundle/objects/db/TPkgShopCurrency.class.php#L115-L126 | train |
chameleon-system/chameleon-shop | src/ShopCurrencyBundle/objects/db/TPkgShopCurrency.class.php | TPkgShopCurrency.SetAsActive | public function SetAsActive()
{
$sCurrencyId = $this->id;
/** @var Request $request */
$request = ServiceLocator::get('request_stack')->getCurrentRequest();
$request->getSession()->set(TdbPkgShopCurrency::SESSION_NAME, $sCurrencyId);
$sDomain = $request->getHost();
if ('www.' == substr($sDomain, 0, 4)) {
$sDomain = substr($sDomain, 4);
}
setcookie(TdbPkgShopCurrency::SESSION_NAME, base64_encode($sCurrencyId), time() + 60 * 60 * 24 * 365, '/', '.'.$sDomain, false, true);
$oUser = TdbDataExtranetUser::GetInstance();
if (!is_null($oUser->id) && !empty($oUser->id) && array_key_exists('pkg_shop_currency_id', $oUser->sqlData) && $oUser->sqlData['pkg_shop_currency_id'] != $sCurrencyId && $oUser->IsLoggedIn()) {
$oUser->SaveFieldsFast(array('pkg_shop_currency_id' => $sCurrencyId));
} else {
$oUser->sqlData['pkg_shop_currency_id'] = $sCurrencyId;
$oUser->fieldPkgShopCurrencyId = $sCurrencyId;
}
TdbPkgShopCurrency::GetActiveInstance(true);
$this->getEventDispatcher()->dispatch(
ShopCurrencyEvents::CURRENCY_CHANGED,
new CurrencyChangedEvent($sCurrencyId)
);
// also mark basket as "requires recalculation"
$oBasket = TShopBasket::GetInstance();
$oBasket->SetBasketRecalculationFlag(true);
} | php | public function SetAsActive()
{
$sCurrencyId = $this->id;
/** @var Request $request */
$request = ServiceLocator::get('request_stack')->getCurrentRequest();
$request->getSession()->set(TdbPkgShopCurrency::SESSION_NAME, $sCurrencyId);
$sDomain = $request->getHost();
if ('www.' == substr($sDomain, 0, 4)) {
$sDomain = substr($sDomain, 4);
}
setcookie(TdbPkgShopCurrency::SESSION_NAME, base64_encode($sCurrencyId), time() + 60 * 60 * 24 * 365, '/', '.'.$sDomain, false, true);
$oUser = TdbDataExtranetUser::GetInstance();
if (!is_null($oUser->id) && !empty($oUser->id) && array_key_exists('pkg_shop_currency_id', $oUser->sqlData) && $oUser->sqlData['pkg_shop_currency_id'] != $sCurrencyId && $oUser->IsLoggedIn()) {
$oUser->SaveFieldsFast(array('pkg_shop_currency_id' => $sCurrencyId));
} else {
$oUser->sqlData['pkg_shop_currency_id'] = $sCurrencyId;
$oUser->fieldPkgShopCurrencyId = $sCurrencyId;
}
TdbPkgShopCurrency::GetActiveInstance(true);
$this->getEventDispatcher()->dispatch(
ShopCurrencyEvents::CURRENCY_CHANGED,
new CurrencyChangedEvent($sCurrencyId)
);
// also mark basket as "requires recalculation"
$oBasket = TShopBasket::GetInstance();
$oBasket->SetBasketRecalculationFlag(true);
} | [
"public",
"function",
"SetAsActive",
"(",
")",
"{",
"$",
"sCurrencyId",
"=",
"$",
"this",
"->",
"id",
";",
"/** @var Request $request */",
"$",
"request",
"=",
"ServiceLocator",
"::",
"get",
"(",
"'request_stack'",
")",
"->",
"getCurrentRequest",
"(",
")",
";"... | set this currency object as the active object. | [
"set",
"this",
"currency",
"object",
"as",
"the",
"active",
"object",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopCurrencyBundle/objects/db/TPkgShopCurrency.class.php#L169-L199 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopModuleArticleListFilter/TShopModuleArticlelistFilterSearch.class.php | TShopModuleArticlelistFilterSearch.ModuleInitHook | public function ModuleInitHook()
{
parent::ModuleInitHook();
$oShop = TdbShop::GetInstance();
if ($oShop->fieldRedirectToNotFoundPageProductSearchOnNoResults) {
// in this case the shop may redirect after running the search. since this occurs in the Execute of the module, we need
// to prevent any other output from being auto-sent to the browser
TGlobal::GetController()->SetBlockAutoFlushToBrowser(true);
}
} | php | public function ModuleInitHook()
{
parent::ModuleInitHook();
$oShop = TdbShop::GetInstance();
if ($oShop->fieldRedirectToNotFoundPageProductSearchOnNoResults) {
// in this case the shop may redirect after running the search. since this occurs in the Execute of the module, we need
// to prevent any other output from being auto-sent to the browser
TGlobal::GetController()->SetBlockAutoFlushToBrowser(true);
}
} | [
"public",
"function",
"ModuleInitHook",
"(",
")",
"{",
"parent",
"::",
"ModuleInitHook",
"(",
")",
";",
"$",
"oShop",
"=",
"TdbShop",
"::",
"GetInstance",
"(",
")",
";",
"if",
"(",
"$",
"oShop",
"->",
"fieldRedirectToNotFoundPageProductSearchOnNoResults",
")",
... | is called when the module initializes. | [
"is",
"called",
"when",
"the",
"module",
"initializes",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopModuleArticleListFilter/TShopModuleArticlelistFilterSearch.class.php#L138-L147 | train |
Firesphere/silverstripe-bootstrapmfa | src/Extensions/SiteConfigExtension.php | SiteConfigExtension.updateCMSFields | public function updateCMSFields(FieldList $fields)
{
$fields->addFieldToTab(
'Root.MFA',
$checkbox = CheckboxField::create(
'EnforceMFA',
_t(self::class . '.ENFORCEMFA', 'Enforce MFA on all users'),
$this->isMFAEnforced()
)
);
$checkbox->setDescription(null);
$this->updateCheckboxDescription($fields);
} | php | public function updateCMSFields(FieldList $fields)
{
$fields->addFieldToTab(
'Root.MFA',
$checkbox = CheckboxField::create(
'EnforceMFA',
_t(self::class . '.ENFORCEMFA', 'Enforce MFA on all users'),
$this->isMFAEnforced()
)
);
$checkbox->setDescription(null);
$this->updateCheckboxDescription($fields);
} | [
"public",
"function",
"updateCMSFields",
"(",
"FieldList",
"$",
"fields",
")",
"{",
"$",
"fields",
"->",
"addFieldToTab",
"(",
"'Root.MFA'",
",",
"$",
"checkbox",
"=",
"CheckboxField",
"::",
"create",
"(",
"'EnforceMFA'",
",",
"_t",
"(",
"self",
"::",
"class... | Add the checkbox and if enabled the date since enforcement
@param FieldList $fields | [
"Add",
"the",
"checkbox",
"and",
"if",
"enabled",
"the",
"date",
"since",
"enforcement"
] | 8d2d6c6f2f918c8fa157da91550b897816495a4b | https://github.com/Firesphere/silverstripe-bootstrapmfa/blob/8d2d6c6f2f918c8fa157da91550b897816495a4b/src/Extensions/SiteConfigExtension.php#L31-L44 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticlePreviewImage.class.php | TShopArticlePreviewImage.LoadByName | public function LoadByName(&$oArticle, $sInternalName)
{
$bLoaded = false;
$this->oArticle = &$oArticle;
$this->oImageSize = TdbShopArticleImageSize::GetNewInstance();
/** @var $oImageSize TdbShopArticleImageSize */
if ($this->oImageSize->LoadFromField('name_internal', $sInternalName)) {
if ($this->LoadFromFields(array('shop_article_id' => $oArticle->id, 'shop_article_image_size_id' => $this->oImageSize->id))) {
$bLoaded = true;
} else {
$oPrimaryImage = $oArticle->GetPrimaryImage();
/** @var $oPrimaryImage TdbShopArticleImage */
if (!is_null($oPrimaryImage)) {
$aData = array('cms_media_id' => $oPrimaryImage->sqlData['cms_media_id'], 'shop_article_image_size_id' => $this->oImageSize->id, 'shop_article_id' => $oArticle->id);
$this->LoadFromRow($aData);
$bLoaded = true;
}
}
}
return $bLoaded;
} | php | public function LoadByName(&$oArticle, $sInternalName)
{
$bLoaded = false;
$this->oArticle = &$oArticle;
$this->oImageSize = TdbShopArticleImageSize::GetNewInstance();
/** @var $oImageSize TdbShopArticleImageSize */
if ($this->oImageSize->LoadFromField('name_internal', $sInternalName)) {
if ($this->LoadFromFields(array('shop_article_id' => $oArticle->id, 'shop_article_image_size_id' => $this->oImageSize->id))) {
$bLoaded = true;
} else {
$oPrimaryImage = $oArticle->GetPrimaryImage();
/** @var $oPrimaryImage TdbShopArticleImage */
if (!is_null($oPrimaryImage)) {
$aData = array('cms_media_id' => $oPrimaryImage->sqlData['cms_media_id'], 'shop_article_image_size_id' => $this->oImageSize->id, 'shop_article_id' => $oArticle->id);
$this->LoadFromRow($aData);
$bLoaded = true;
}
}
}
return $bLoaded;
} | [
"public",
"function",
"LoadByName",
"(",
"&",
"$",
"oArticle",
",",
"$",
"sInternalName",
")",
"{",
"$",
"bLoaded",
"=",
"false",
";",
"$",
"this",
"->",
"oArticle",
"=",
"&",
"$",
"oArticle",
";",
"$",
"this",
"->",
"oImageSize",
"=",
"TdbShopArticleIma... | return the image preview object. if the shop did not define one for this size,
then we create a virtual instance based on the first image of the article.
@param TdbShopArticle $oArticle - the article object
@param string $sInternalName - image size name
@return true | [
"return",
"the",
"image",
"preview",
"object",
".",
"if",
"the",
"shop",
"did",
"not",
"define",
"one",
"for",
"this",
"size",
"then",
"we",
"create",
"a",
"virtual",
"instance",
"based",
"on",
"the",
"first",
"image",
"of",
"the",
"article",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticlePreviewImage.class.php#L44-L65 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticlePreviewImage.class.php | TShopArticlePreviewImage.GetImageThumbnailObject | public function GetImageThumbnailObject($aEffects = array())
{
$oImageSize = &$this->GetImageSizeObject();
$oImage = &$this->GetImageObject();
$oThumb = null;
TdbCmsConfigImagemagick::SetEnableEffects(true);
$bEnableEffects = TdbCmsConfigImagemagick::GetEnableEffects();
if ($oImageSize->fieldForceSize) {
$oThumb = $oImage->GetForcedSizeThumbnail($oImageSize->fieldWidth, $oImageSize->fieldHeight);
} else {
$oThumb = $oImage->GetThumbnail($oImageSize->fieldWidth, $oImageSize->fieldHeight, true, $aEffects);
}
TdbCmsConfigImagemagick::SetEnableEffects($bEnableEffects);
return $oThumb;
} | php | public function GetImageThumbnailObject($aEffects = array())
{
$oImageSize = &$this->GetImageSizeObject();
$oImage = &$this->GetImageObject();
$oThumb = null;
TdbCmsConfigImagemagick::SetEnableEffects(true);
$bEnableEffects = TdbCmsConfigImagemagick::GetEnableEffects();
if ($oImageSize->fieldForceSize) {
$oThumb = $oImage->GetForcedSizeThumbnail($oImageSize->fieldWidth, $oImageSize->fieldHeight);
} else {
$oThumb = $oImage->GetThumbnail($oImageSize->fieldWidth, $oImageSize->fieldHeight, true, $aEffects);
}
TdbCmsConfigImagemagick::SetEnableEffects($bEnableEffects);
return $oThumb;
} | [
"public",
"function",
"GetImageThumbnailObject",
"(",
"$",
"aEffects",
"=",
"array",
"(",
")",
")",
"{",
"$",
"oImageSize",
"=",
"&",
"$",
"this",
"->",
"GetImageSizeObject",
"(",
")",
";",
"$",
"oImage",
"=",
"&",
"$",
"this",
"->",
"GetImageObject",
"(... | return thumbnail for current size.
@return TCMSImage | [
"return",
"thumbnail",
"for",
"current",
"size",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticlePreviewImage.class.php#L134-L150 | train |
chameleon-system/chameleon-shop | src/ShopWishlistBundle/objects/WebModules/MTPkgShopWishlistCore/MTPkgShopWishlistCore.class.php | MTPkgShopWishlistCore.ExecuteSendFormMode | protected function ExecuteSendFormMode()
{
if (!is_array($this->aUserInput)) {
$this->aUserInput = array('to_name' => '', 'to_mail' => '', 'comment' => '');
}
$this->data['aUserInput'] = $this->aUserInput;
} | php | protected function ExecuteSendFormMode()
{
if (!is_array($this->aUserInput)) {
$this->aUserInput = array('to_name' => '', 'to_mail' => '', 'comment' => '');
}
$this->data['aUserInput'] = $this->aUserInput;
} | [
"protected",
"function",
"ExecuteSendFormMode",
"(",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"this",
"->",
"aUserInput",
")",
")",
"{",
"$",
"this",
"->",
"aUserInput",
"=",
"array",
"(",
"'to_name'",
"=>",
"''",
",",
"'to_mail'",
"=>",
"''",
"... | Execute method called when the module is in the SendForm mode. | [
"Execute",
"method",
"called",
"when",
"the",
"module",
"is",
"in",
"the",
"SendForm",
"mode",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopWishlistBundle/objects/WebModules/MTPkgShopWishlistCore/MTPkgShopWishlistCore.class.php#L73-L79 | train |
chameleon-system/chameleon-shop | src/ShopWishlistBundle/objects/WebModules/MTPkgShopWishlistCore/MTPkgShopWishlistCore.class.php | MTPkgShopWishlistCore.UpdateWishlist | protected function UpdateWishlist()
{
$aInput = $this->global->GetUserData(TdbPkgShopWishlist::URL_PARAMETER_FILTER_DATA);
$sWishListDescription = '';
if (array_key_exists('description', $aInput)) {
$sWishListDescription = $aInput['description'];
}
$oMsgManager = TCMSMessageManager::GetInstance();
$oUser = TdbDataExtranetUser::GetInstance();
if ($oUser->IsLoggedIn()) {
$oWishlist = &$oUser->GetWishlist(true);
$aTmp = $oWishlist->sqlData;
$aTmp['description'] = $sWishListDescription;
if (array_key_exists('is_public', $aInput)) {
$aTmp['is_public'] = $aInput['is_public'];
}
$oWishlist->LoadFromRow($aTmp);
$oWishlist->Save();
$aItems = array();
if (array_key_exists('aItem', $aInput) && is_array($aInput['aItem'])) {
$aItems = $aInput['aItem'];
foreach ($aItems as $sWishlistItemId => $aItemData) {
$oWishlistItem = TdbPkgShopWishlistArticle::GetNewInstance();
/** @var $oWishlistItem TdbPkgShopWishlistArticle */
if ($oWishlistItem->LoadFromFields(array('pkg_shop_wishlist_id' => $oWishlist->id, 'id' => $sWishlistItemId))) {
$atmpData = $oWishlistItem->sqlData;
if (array_key_exists('comment', $aItemData)) {
$atmpData['comment'] = $aItemData['comment'];
}
if (array_key_exists('amount', $aItemData)) {
$atmpData['amount'] = $aItemData['amount'];
}
$oWishlistItem->LoadFromRow($atmpData);
$oWishlistItem->AllowEditByAll(true);
$oWishlistItem->Save();
}
}
}
$oMsgManager->AddMessage($oWishlist->GetMsgConsumerName(), 'WISHLIST-UPDATED-INFOS');
}
} | php | protected function UpdateWishlist()
{
$aInput = $this->global->GetUserData(TdbPkgShopWishlist::URL_PARAMETER_FILTER_DATA);
$sWishListDescription = '';
if (array_key_exists('description', $aInput)) {
$sWishListDescription = $aInput['description'];
}
$oMsgManager = TCMSMessageManager::GetInstance();
$oUser = TdbDataExtranetUser::GetInstance();
if ($oUser->IsLoggedIn()) {
$oWishlist = &$oUser->GetWishlist(true);
$aTmp = $oWishlist->sqlData;
$aTmp['description'] = $sWishListDescription;
if (array_key_exists('is_public', $aInput)) {
$aTmp['is_public'] = $aInput['is_public'];
}
$oWishlist->LoadFromRow($aTmp);
$oWishlist->Save();
$aItems = array();
if (array_key_exists('aItem', $aInput) && is_array($aInput['aItem'])) {
$aItems = $aInput['aItem'];
foreach ($aItems as $sWishlistItemId => $aItemData) {
$oWishlistItem = TdbPkgShopWishlistArticle::GetNewInstance();
/** @var $oWishlistItem TdbPkgShopWishlistArticle */
if ($oWishlistItem->LoadFromFields(array('pkg_shop_wishlist_id' => $oWishlist->id, 'id' => $sWishlistItemId))) {
$atmpData = $oWishlistItem->sqlData;
if (array_key_exists('comment', $aItemData)) {
$atmpData['comment'] = $aItemData['comment'];
}
if (array_key_exists('amount', $aItemData)) {
$atmpData['amount'] = $aItemData['amount'];
}
$oWishlistItem->LoadFromRow($atmpData);
$oWishlistItem->AllowEditByAll(true);
$oWishlistItem->Save();
}
}
}
$oMsgManager->AddMessage($oWishlist->GetMsgConsumerName(), 'WISHLIST-UPDATED-INFOS');
}
} | [
"protected",
"function",
"UpdateWishlist",
"(",
")",
"{",
"$",
"aInput",
"=",
"$",
"this",
"->",
"global",
"->",
"GetUserData",
"(",
"TdbPkgShopWishlist",
"::",
"URL_PARAMETER_FILTER_DATA",
")",
";",
"$",
"sWishListDescription",
"=",
"''",
";",
"if",
"(",
"arr... | Updates the wishlist comment, the lists item amount an comments using the data from post. | [
"Updates",
"the",
"wishlist",
"comment",
"the",
"lists",
"item",
"amount",
"an",
"comments",
"using",
"the",
"data",
"from",
"post",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopWishlistBundle/objects/WebModules/MTPkgShopWishlistCore/MTPkgShopWishlistCore.class.php#L151-L195 | train |
chameleon-system/chameleon-shop | src/ShopPrimaryNavigationBundle/pkgCmsNavigation/objects/TPkgShopPrimaryNavigation_TPkgCmsNavigationNode_Category.class.php | TPkgShopPrimaryNavigation_TPkgCmsNavigationNode_Category.getNodeIconURL | public function getNodeIconURL()
{
$sURL = null;
/** @var $oNode TdbShopCategory */
$oNode = $this->getNodeCopy();
$oImage = $oNode->GetImage(0, 'navi_icon_cms_media_id', $this->dummyImagesAllowed());
if ($oImage) {
$sURL = $oImage->GetRelativeURL();
$this->sNavigationIconId = $oImage->id;
}
return $sURL;
} | php | public function getNodeIconURL()
{
$sURL = null;
/** @var $oNode TdbShopCategory */
$oNode = $this->getNodeCopy();
$oImage = $oNode->GetImage(0, 'navi_icon_cms_media_id', $this->dummyImagesAllowed());
if ($oImage) {
$sURL = $oImage->GetRelativeURL();
$this->sNavigationIconId = $oImage->id;
}
return $sURL;
} | [
"public",
"function",
"getNodeIconURL",
"(",
")",
"{",
"$",
"sURL",
"=",
"null",
";",
"/** @var $oNode TdbShopCategory */",
"$",
"oNode",
"=",
"$",
"this",
"->",
"getNodeCopy",
"(",
")",
";",
"$",
"oImage",
"=",
"$",
"oNode",
"->",
"GetImage",
"(",
"0",
... | returns the url to an icon for the node - if set.
@return string|null | [
"returns",
"the",
"url",
"to",
"an",
"icon",
"for",
"the",
"node",
"-",
"if",
"set",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopPrimaryNavigationBundle/pkgCmsNavigation/objects/TPkgShopPrimaryNavigation_TPkgCmsNavigationNode_Category.class.php#L134-L146 | train |
chameleon-system/chameleon-shop | src/ShopArticleReviewBundle/objects/db/TPkgShopArticleReviewShopArticleReview.class.php | TPkgShopArticleReviewShopArticleReview.GetRateURL | public function GetRateURL($bPositiveLink = true, $bUseFullUrl = false)
{
if ($bPositiveLink) {
$bPositiveLink = '1';
} else {
$bPositiveLink = '0';
}
$aParameter = array('bRate' => $bPositiveLink, TdbShopArticleReview::URL_PARAM_REVIEW_ID => $this->id);
$sRatePositiveLink = TTools::GetExecuteMethodOnCurrentModuleURL('RateReview', $aParameter, $bUseFullUrl);
return $sRatePositiveLink;
} | php | public function GetRateURL($bPositiveLink = true, $bUseFullUrl = false)
{
if ($bPositiveLink) {
$bPositiveLink = '1';
} else {
$bPositiveLink = '0';
}
$aParameter = array('bRate' => $bPositiveLink, TdbShopArticleReview::URL_PARAM_REVIEW_ID => $this->id);
$sRatePositiveLink = TTools::GetExecuteMethodOnCurrentModuleURL('RateReview', $aParameter, $bUseFullUrl);
return $sRatePositiveLink;
} | [
"public",
"function",
"GetRateURL",
"(",
"$",
"bPositiveLink",
"=",
"true",
",",
"$",
"bUseFullUrl",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"bPositiveLink",
")",
"{",
"$",
"bPositiveLink",
"=",
"'1'",
";",
"}",
"else",
"{",
"$",
"bPositiveLink",
"=",
... | Returns URL to rate a comment.
@param bool $bPositiveLink Set if you want the url to rate a review positive or negative
@param bool $bUseFullUrl
@return string | [
"Returns",
"URL",
"to",
"rate",
"a",
"comment",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/db/TPkgShopArticleReviewShopArticleReview.class.php#L28-L39 | train |
chameleon-system/chameleon-shop | src/ShopArticleReviewBundle/objects/db/TPkgShopArticleReviewShopArticleReview.class.php | TPkgShopArticleReviewShopArticleReview.RateReview | public function RateReview($bRateUp = true)
{
if (false == $this->ReviewRatedByActiveUser()) {
$sRateString = 'helpful_count';
//helpful_count
//not_helpful_count
if (false == $bRateUp) {
$sRateString = 'not_helpful_count';
}
$query = 'UPDATE `'.MySqlLegacySupport::getInstance()->real_escape_string($this->table)."`
SET `{$sRateString}` = `{$sRateString}`+1
WHERE `id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."'
LIMIT 1
";
MySqlLegacySupport::getInstance()->query($query);
// get value from disc
$query = "SELECT `{$sRateString}` FROM `".MySqlLegacySupport::getInstance()->real_escape_string($this->table)."` WHERE `id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."'";
if ($aTmp = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query))) {
$this->sqlData[$sRateString] = $aTmp[$sRateString];
if ($bRateUp) {
$this->fieldHelpfulCount = $this->sqlData[$sRateString];
} else {
$this->fieldNotHelpfulCount = $this->sqlData[$sRateString];
}
}
if (!array_key_exists('TPkgShopArticleReviewShopArticleReviewRated', $_SESSION)) {
$_SESSION['TPkgShopArticleReviewShopArticleReviewRated'] = array();
}
$_SESSION['TPkgShopArticleReviewShopArticleReviewRated'][(string) $this->id] = time();
}
} | php | public function RateReview($bRateUp = true)
{
if (false == $this->ReviewRatedByActiveUser()) {
$sRateString = 'helpful_count';
//helpful_count
//not_helpful_count
if (false == $bRateUp) {
$sRateString = 'not_helpful_count';
}
$query = 'UPDATE `'.MySqlLegacySupport::getInstance()->real_escape_string($this->table)."`
SET `{$sRateString}` = `{$sRateString}`+1
WHERE `id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."'
LIMIT 1
";
MySqlLegacySupport::getInstance()->query($query);
// get value from disc
$query = "SELECT `{$sRateString}` FROM `".MySqlLegacySupport::getInstance()->real_escape_string($this->table)."` WHERE `id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."'";
if ($aTmp = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query))) {
$this->sqlData[$sRateString] = $aTmp[$sRateString];
if ($bRateUp) {
$this->fieldHelpfulCount = $this->sqlData[$sRateString];
} else {
$this->fieldNotHelpfulCount = $this->sqlData[$sRateString];
}
}
if (!array_key_exists('TPkgShopArticleReviewShopArticleReviewRated', $_SESSION)) {
$_SESSION['TPkgShopArticleReviewShopArticleReviewRated'] = array();
}
$_SESSION['TPkgShopArticleReviewShopArticleReviewRated'][(string) $this->id] = time();
}
} | [
"public",
"function",
"RateReview",
"(",
"$",
"bRateUp",
"=",
"true",
")",
"{",
"if",
"(",
"false",
"==",
"$",
"this",
"->",
"ReviewRatedByActiveUser",
"(",
")",
")",
"{",
"$",
"sRateString",
"=",
"'helpful_count'",
";",
"//helpful_count",
"//not_helpful_count... | vote the review up or down.
@param bool $bRateUp | [
"vote",
"the",
"review",
"up",
"or",
"down",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/db/TPkgShopArticleReviewShopArticleReview.class.php#L56-L86 | train |
chameleon-system/chameleon-shop | src/ShopArticleReviewBundle/objects/db/TPkgShopArticleReviewShopArticleReview.class.php | TPkgShopArticleReviewShopArticleReview.GetDeleteURL | public function GetDeleteURL($bUseFullUrl = false)
{
$aParameter = array(TdbShopArticleReview::URL_PARAM_REVIEW_ID => $this->id);
$sReportLink = TTools::GetExecuteMethodOnCurrentModuleURL('DeleteReview', $aParameter, $bUseFullUrl);
return $sReportLink;
} | php | public function GetDeleteURL($bUseFullUrl = false)
{
$aParameter = array(TdbShopArticleReview::URL_PARAM_REVIEW_ID => $this->id);
$sReportLink = TTools::GetExecuteMethodOnCurrentModuleURL('DeleteReview', $aParameter, $bUseFullUrl);
return $sReportLink;
} | [
"public",
"function",
"GetDeleteURL",
"(",
"$",
"bUseFullUrl",
"=",
"false",
")",
"{",
"$",
"aParameter",
"=",
"array",
"(",
"TdbShopArticleReview",
"::",
"URL_PARAM_REVIEW_ID",
"=>",
"$",
"this",
"->",
"id",
")",
";",
"$",
"sReportLink",
"=",
"TTools",
"::"... | Returns the URL to delete a review.
@param bool $bUseFullUrl
@return string | [
"Returns",
"the",
"URL",
"to",
"delete",
"a",
"review",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/db/TPkgShopArticleReviewShopArticleReview.class.php#L125-L131 | train |
chameleon-system/chameleon-shop | src/ShopArticleReviewBundle/objects/db/TPkgShopArticleReviewShopArticleReview.class.php | TPkgShopArticleReviewShopArticleReview.SendReviewCommentNotification | public function SendReviewCommentNotification($oComment)
{
if ($this->AllowSendAuthorReviewCommentNotification()) {
$sAuthorEmail = $this->GetSendReviewCommentNotificationEmail();
if (TTools::IsValidEMail($sAuthorEmail)) {
$oMail = TDataMailProfile::GetProfile('review-comment');
$aData = array();
$oArticle = &$this->GetFieldShopArticle();
$aData['sArticleName'] = $oArticle->GetName();
$aData['sReviewTitle'] = $this->fieldTitle;
$aData['sReviewText'] = $this->fieldComment;
$aData['sCommentText'] = $oComment->fieldComment;
$oMail->AddDataArray($aData);
$oMail->ChangeToAddress($this->fieldAuthorEmail, $this->fieldAuthorName);
$oMail->SendUsingObjectView('emails', 'Customer');
}
}
} | php | public function SendReviewCommentNotification($oComment)
{
if ($this->AllowSendAuthorReviewCommentNotification()) {
$sAuthorEmail = $this->GetSendReviewCommentNotificationEmail();
if (TTools::IsValidEMail($sAuthorEmail)) {
$oMail = TDataMailProfile::GetProfile('review-comment');
$aData = array();
$oArticle = &$this->GetFieldShopArticle();
$aData['sArticleName'] = $oArticle->GetName();
$aData['sReviewTitle'] = $this->fieldTitle;
$aData['sReviewText'] = $this->fieldComment;
$aData['sCommentText'] = $oComment->fieldComment;
$oMail->AddDataArray($aData);
$oMail->ChangeToAddress($this->fieldAuthorEmail, $this->fieldAuthorName);
$oMail->SendUsingObjectView('emails', 'Customer');
}
}
} | [
"public",
"function",
"SendReviewCommentNotification",
"(",
"$",
"oComment",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"AllowSendAuthorReviewCommentNotification",
"(",
")",
")",
"{",
"$",
"sAuthorEmail",
"=",
"$",
"this",
"->",
"GetSendReviewCommentNotificationEmail",
... | Send comment notification to review owner.
Send comment notification to owner only if owner set the option for the review.
@param TdbPkgComment $oComment | [
"Send",
"comment",
"notification",
"to",
"review",
"owner",
".",
"Send",
"comment",
"notification",
"to",
"owner",
"only",
"if",
"owner",
"set",
"the",
"option",
"for",
"the",
"review",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/db/TPkgShopArticleReviewShopArticleReview.class.php#L161-L178 | train |
chameleon-system/chameleon-shop | src/ShopArticleReviewBundle/objects/db/TPkgShopArticleReviewShopArticleReview.class.php | TPkgShopArticleReviewShopArticleReview.GetSendReviewCommentNotificationEmail | protected function GetSendReviewCommentNotificationEmail()
{
$sSendReviewCommentNotificationEmail = '';
if (!empty($this->fieldAuthorEmail)) {
$sSendReviewCommentNotificationEmail = $this->fieldAuthorEmail;
} elseif (!empty($this->fieldDataExtranetUserId)) {
$oAuthor = TdbDataExtranetUser::GetNewInstance();
if ($oAuthor->Load($this->fieldDataExtranetUserId)) {
$sSendReviewCommentNotificationEmail = $oAuthor->GetUserEMail();
}
}
return $sSendReviewCommentNotificationEmail;
} | php | protected function GetSendReviewCommentNotificationEmail()
{
$sSendReviewCommentNotificationEmail = '';
if (!empty($this->fieldAuthorEmail)) {
$sSendReviewCommentNotificationEmail = $this->fieldAuthorEmail;
} elseif (!empty($this->fieldDataExtranetUserId)) {
$oAuthor = TdbDataExtranetUser::GetNewInstance();
if ($oAuthor->Load($this->fieldDataExtranetUserId)) {
$sSendReviewCommentNotificationEmail = $oAuthor->GetUserEMail();
}
}
return $sSendReviewCommentNotificationEmail;
} | [
"protected",
"function",
"GetSendReviewCommentNotificationEmail",
"(",
")",
"{",
"$",
"sSendReviewCommentNotificationEmail",
"=",
"''",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"fieldAuthorEmail",
")",
")",
"{",
"$",
"sSendReviewCommentNotificationEmail",... | Get owner email for comment notification.
@return string|null | [
"Get",
"owner",
"email",
"for",
"comment",
"notification",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/db/TPkgShopArticleReviewShopArticleReview.class.php#L185-L198 | train |
chameleon-system/chameleon-shop | src/ShopArticleReviewBundle/objects/db/TPkgShopArticleReviewShopArticleReview.class.php | TPkgShopArticleReviewShopArticleReview.AllowSendAuthorReviewCommentNotification | protected function AllowSendAuthorReviewCommentNotification()
{
$bAllowSendAuthorCommentNotification = false;
if ($this->fieldSendCommentNotification) {
if (!empty($this->fieldAuthorEmail) || !empty($this->fieldDataExtranetUserId)) {
$bAllowSendAuthorCommentNotification = true;
}
}
return $bAllowSendAuthorCommentNotification;
} | php | protected function AllowSendAuthorReviewCommentNotification()
{
$bAllowSendAuthorCommentNotification = false;
if ($this->fieldSendCommentNotification) {
if (!empty($this->fieldAuthorEmail) || !empty($this->fieldDataExtranetUserId)) {
$bAllowSendAuthorCommentNotification = true;
}
}
return $bAllowSendAuthorCommentNotification;
} | [
"protected",
"function",
"AllowSendAuthorReviewCommentNotification",
"(",
")",
"{",
"$",
"bAllowSendAuthorCommentNotification",
"=",
"false",
";",
"if",
"(",
"$",
"this",
"->",
"fieldSendCommentNotification",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"-... | Checks if its allowed to send comment notification to owner.
@return bool | [
"Checks",
"if",
"its",
"allowed",
"to",
"send",
"comment",
"notification",
"to",
"owner",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/db/TPkgShopArticleReviewShopArticleReview.class.php#L205-L215 | train |
chameleon-system/chameleon-shop | src/ShopArticleReviewBundle/objects/db/TPkgShopArticleReviewShopArticleReview.class.php | TPkgShopArticleReviewShopArticleReview.SaveActionIdToComment | protected function SaveActionIdToComment()
{
$sActionId = TTools::GetUUID();
$this->sqlData['action_id'] = $sActionId;
$this->AllowEditByAll(true);
$this->Save();
$this->AllowEditByAll(false);
} | php | protected function SaveActionIdToComment()
{
$sActionId = TTools::GetUUID();
$this->sqlData['action_id'] = $sActionId;
$this->AllowEditByAll(true);
$this->Save();
$this->AllowEditByAll(false);
} | [
"protected",
"function",
"SaveActionIdToComment",
"(",
")",
"{",
"$",
"sActionId",
"=",
"TTools",
"::",
"GetUUID",
"(",
")",
";",
"$",
"this",
"->",
"sqlData",
"[",
"'action_id'",
"]",
"=",
"$",
"sActionId",
";",
"$",
"this",
"->",
"AllowEditByAll",
"(",
... | Add new unique action id to the comment.
Action id was needed to run an action like unlock or delete via post. | [
"Add",
"new",
"unique",
"action",
"id",
"to",
"the",
"comment",
".",
"Action",
"id",
"was",
"needed",
"to",
"run",
"an",
"action",
"like",
"unlock",
"or",
"delete",
"via",
"post",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/db/TPkgShopArticleReviewShopArticleReview.class.php#L221-L228 | train |
chameleon-system/chameleon-shop | src/ShopArticleReviewBundle/objects/db/TPkgShopArticleReviewShopArticleReview.class.php | TPkgShopArticleReviewShopArticleReview.GetDeleteWithActionIdURL | protected function GetDeleteWithActionIdURL($bUseFullUrl = false)
{
$sDeleteURL = '';
if (!empty($this->sqlData['action_id'])) {
$aParameter = array(TdbShopArticleReview::URL_PARAM_ACTION_ID => $this->sqlData['action_id']);
$sDeleteURL = TTools::GetExecuteMethodOnCurrentModuleURL('DeleteReview', $aParameter, $bUseFullUrl);
}
return $sDeleteURL;
} | php | protected function GetDeleteWithActionIdURL($bUseFullUrl = false)
{
$sDeleteURL = '';
if (!empty($this->sqlData['action_id'])) {
$aParameter = array(TdbShopArticleReview::URL_PARAM_ACTION_ID => $this->sqlData['action_id']);
$sDeleteURL = TTools::GetExecuteMethodOnCurrentModuleURL('DeleteReview', $aParameter, $bUseFullUrl);
}
return $sDeleteURL;
} | [
"protected",
"function",
"GetDeleteWithActionIdURL",
"(",
"$",
"bUseFullUrl",
"=",
"false",
")",
"{",
"$",
"sDeleteURL",
"=",
"''",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"sqlData",
"[",
"'action_id'",
"]",
")",
")",
"{",
"$",
"aParameter"... | Get URL to delete review with unique action id.
@param bool $bUseFullUrl
@return string | [
"Get",
"URL",
"to",
"delete",
"review",
"with",
"unique",
"action",
"id",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/db/TPkgShopArticleReviewShopArticleReview.class.php#L237-L246 | train |
chameleon-system/chameleon-shop | src/ShopArticleReviewBundle/objects/db/TPkgShopArticleReviewShopArticleReview.class.php | TPkgShopArticleReviewShopArticleReview.GetUnlockURL | protected function GetUnlockURL($bUseFullUrl = false)
{
$sUnlockURL = '';
if (!empty($this->sqlData['action_id'])) {
$aParameter = array(TdbShopArticleReview::URL_PARAM_ACTION_ID => $this->sqlData['action_id']);
$sUnlockURL = TTools::GetExecuteMethodOnCurrentModuleURL('UnlockReview', $aParameter, $bUseFullUrl);
}
return $sUnlockURL;
} | php | protected function GetUnlockURL($bUseFullUrl = false)
{
$sUnlockURL = '';
if (!empty($this->sqlData['action_id'])) {
$aParameter = array(TdbShopArticleReview::URL_PARAM_ACTION_ID => $this->sqlData['action_id']);
$sUnlockURL = TTools::GetExecuteMethodOnCurrentModuleURL('UnlockReview', $aParameter, $bUseFullUrl);
}
return $sUnlockURL;
} | [
"protected",
"function",
"GetUnlockURL",
"(",
"$",
"bUseFullUrl",
"=",
"false",
")",
"{",
"$",
"sUnlockURL",
"=",
"''",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"sqlData",
"[",
"'action_id'",
"]",
")",
")",
"{",
"$",
"aParameter",
"=",
"... | Get URL to unlock a review with unique action id.
@param bool $bUseFullUrl
@return string | [
"Get",
"URL",
"to",
"unlock",
"a",
"review",
"with",
"unique",
"action",
"id",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/db/TPkgShopArticleReviewShopArticleReview.class.php#L255-L264 | train |
chameleon-system/chameleon-shop | src/ShopArticleReviewBundle/objects/db/TPkgShopArticleReviewShopArticleReview.class.php | TPkgShopArticleReviewShopArticleReview.GetCacheTrigger | protected function GetCacheTrigger($id, $aCallTimeVars = array())
{
$aCacheTrigger = parent::GetCacheTrigger($id, $aCallTimeVars);
if (array_key_exists('oPkgCommentModuleConfig', $aCallTimeVars) && !is_null($aCallTimeVars['oPkgCommentModuleConfig'])) {
$aCallTimeVars['oPkgCommentModuleConfig']->SetActiveItem($this);
$aCacheTrigger = array_merge($aCacheTrigger, $aCallTimeVars['oPkgCommentModuleConfig']->GetCacheTrigger());
}
return $aCacheTrigger;
} | php | protected function GetCacheTrigger($id, $aCallTimeVars = array())
{
$aCacheTrigger = parent::GetCacheTrigger($id, $aCallTimeVars);
if (array_key_exists('oPkgCommentModuleConfig', $aCallTimeVars) && !is_null($aCallTimeVars['oPkgCommentModuleConfig'])) {
$aCallTimeVars['oPkgCommentModuleConfig']->SetActiveItem($this);
$aCacheTrigger = array_merge($aCacheTrigger, $aCallTimeVars['oPkgCommentModuleConfig']->GetCacheTrigger());
}
return $aCacheTrigger;
} | [
"protected",
"function",
"GetCacheTrigger",
"(",
"$",
"id",
",",
"$",
"aCallTimeVars",
"=",
"array",
"(",
")",
")",
"{",
"$",
"aCacheTrigger",
"=",
"parent",
"::",
"GetCacheTrigger",
"(",
"$",
"id",
",",
"$",
"aCallTimeVars",
")",
";",
"if",
"(",
"array_... | Get cache trigger for comments.
@param $id
@param array $aCallTimeVars
@return array | [
"Get",
"cache",
"trigger",
"for",
"comments",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopArticleReviewBundle/objects/db/TPkgShopArticleReviewShopArticleReview.class.php#L274-L283 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopUserNoticeList.class.php | TShopUserNoticeList.GetRemoveFromNoticeListLink | public function GetRemoveFromNoticeListLink()
{
$oShop = TdbShop::GetInstance();
$aParams = array('module_fnc['.$oShop->GetBasketModuleSpotName().']' => 'RemoveFromNoticeList', MTShopBasketCore::URL_ITEM_ID => $this->fieldShopArticleId);
return $this->getActivePageService()->getLinkToActivePageRelative($aParams);
} | php | public function GetRemoveFromNoticeListLink()
{
$oShop = TdbShop::GetInstance();
$aParams = array('module_fnc['.$oShop->GetBasketModuleSpotName().']' => 'RemoveFromNoticeList', MTShopBasketCore::URL_ITEM_ID => $this->fieldShopArticleId);
return $this->getActivePageService()->getLinkToActivePageRelative($aParams);
} | [
"public",
"function",
"GetRemoveFromNoticeListLink",
"(",
")",
"{",
"$",
"oShop",
"=",
"TdbShop",
"::",
"GetInstance",
"(",
")",
";",
"$",
"aParams",
"=",
"array",
"(",
"'module_fnc['",
".",
"$",
"oShop",
"->",
"GetBasketModuleSpotName",
"(",
")",
".",
"']'"... | return link that can be used to remove the item from the notice list.
@return string | [
"return",
"link",
"that",
"can",
"be",
"used",
"to",
"remove",
"the",
"item",
"from",
"the",
"notice",
"list",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopUserNoticeList.class.php#L21-L27 | train |
chameleon-system/chameleon-shop | src/ShopRatingServiceBundle/objects/TShopAuskunftAPI.class.php | TShopAuskunftAPI.ReadFromURI | public function ReadFromURI($sURL)
{
$sBuf = '';
$fp = @fopen($sURL, 'r');
if (!$fp) {
echo "<!-- shopauskunft - no connection! -->\n";
} else {
stream_set_timeout($fp, 5);
while (!feof($fp)) {
$sBuf .= fread($fp, 128);
}
fclose($fp);
}
return $sBuf;
} | php | public function ReadFromURI($sURL)
{
$sBuf = '';
$fp = @fopen($sURL, 'r');
if (!$fp) {
echo "<!-- shopauskunft - no connection! -->\n";
} else {
stream_set_timeout($fp, 5);
while (!feof($fp)) {
$sBuf .= fread($fp, 128);
}
fclose($fp);
}
return $sBuf;
} | [
"public",
"function",
"ReadFromURI",
"(",
"$",
"sURL",
")",
"{",
"$",
"sBuf",
"=",
"''",
";",
"$",
"fp",
"=",
"@",
"fopen",
"(",
"$",
"sURL",
",",
"'r'",
")",
";",
"if",
"(",
"!",
"$",
"fp",
")",
"{",
"echo",
"\"<!-- shopauskunft - no connection! -->... | Get content from URL.
@param $sURL
@return string | [
"Get",
"content",
"from",
"URL",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopRatingServiceBundle/objects/TShopAuskunftAPI.class.php#L58-L73 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopOrderStep/TShopOrderStep.class.php | TShopOrderStep.Init | public function Init()
{
$basket = $this->getShopService()->getActiveBasket();
$basket->aCompletedOrderStepList[$this->fieldSystemname] = false;
$this->CheckBasketContents();
if (false === $this->AllowAccessToStep(true)) {
$this->JumpToStep($this->GetPreviousStep());
}
if ('basket' !== $this->fieldSystemname && 'thankyou' !== $this->fieldSystemname) {
$basket->CommitCopyToDatabase(false, $this->fieldSystemname);
} // commit basket to database...
} | php | public function Init()
{
$basket = $this->getShopService()->getActiveBasket();
$basket->aCompletedOrderStepList[$this->fieldSystemname] = false;
$this->CheckBasketContents();
if (false === $this->AllowAccessToStep(true)) {
$this->JumpToStep($this->GetPreviousStep());
}
if ('basket' !== $this->fieldSystemname && 'thankyou' !== $this->fieldSystemname) {
$basket->CommitCopyToDatabase(false, $this->fieldSystemname);
} // commit basket to database...
} | [
"public",
"function",
"Init",
"(",
")",
"{",
"$",
"basket",
"=",
"$",
"this",
"->",
"getShopService",
"(",
")",
"->",
"getActiveBasket",
"(",
")",
";",
"$",
"basket",
"->",
"aCompletedOrderStepList",
"[",
"$",
"this",
"->",
"fieldSystemname",
"]",
"=",
"... | Called from the init method of the calling module.
Visitor permissions for the requested step may be checked and the user redirected. | [
"Called",
"from",
"the",
"init",
"method",
"of",
"the",
"calling",
"module",
".",
"Visitor",
"permissions",
"for",
"the",
"requested",
"step",
"may",
"be",
"checked",
"and",
"the",
"user",
"redirected",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrderStep/TShopOrderStep.class.php#L38-L50 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopOrderStep/TShopOrderStep.class.php | TShopOrderStep.CheckBasketContents | protected function CheckBasketContents()
{
if ('basket' !== $this->fieldSystemname) {
$oBasket = $this->getShopService()->getActiveBasket();
if ($oBasket->dTotalNumberOfArticles <= 0) {
$oBasketStep = TdbShopOrderStep::GetStep('basket');
$this->JumpToStep($oBasketStep);
}
}
} | php | protected function CheckBasketContents()
{
if ('basket' !== $this->fieldSystemname) {
$oBasket = $this->getShopService()->getActiveBasket();
if ($oBasket->dTotalNumberOfArticles <= 0) {
$oBasketStep = TdbShopOrderStep::GetStep('basket');
$this->JumpToStep($oBasketStep);
}
}
} | [
"protected",
"function",
"CheckBasketContents",
"(",
")",
"{",
"if",
"(",
"'basket'",
"!==",
"$",
"this",
"->",
"fieldSystemname",
")",
"{",
"$",
"oBasket",
"=",
"$",
"this",
"->",
"getShopService",
"(",
")",
"->",
"getActiveBasket",
"(",
")",
";",
"if",
... | Redirects back to the basket if basket is currently empty. | [
"Redirects",
"back",
"to",
"the",
"basket",
"if",
"basket",
"is",
"currently",
"empty",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrderStep/TShopOrderStep.class.php#L87-L96 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopOrderStep/TShopOrderStep.class.php | TShopOrderStep.GetStepURL | public function GetStepURL($bDisableAccessCheck = true, $bForcePortalLink = false, $aAdditionalParameter = array())
{
$sOrderPage = '';
if ($bDisableAccessCheck || $this->AllowAccessToStep()) {
if ($bForcePortalLink) {
$sOrderPage = $this->getOrderStepPageService()->getLinkToOrderStepPageAbsolute($this, $aAdditionalParameter);
} else {
$sOrderPage = $this->getOrderStepPageService()->getLinkToOrderStepPageRelative($this, $aAdditionalParameter);
}
}
return $sOrderPage;
} | php | public function GetStepURL($bDisableAccessCheck = true, $bForcePortalLink = false, $aAdditionalParameter = array())
{
$sOrderPage = '';
if ($bDisableAccessCheck || $this->AllowAccessToStep()) {
if ($bForcePortalLink) {
$sOrderPage = $this->getOrderStepPageService()->getLinkToOrderStepPageAbsolute($this, $aAdditionalParameter);
} else {
$sOrderPage = $this->getOrderStepPageService()->getLinkToOrderStepPageRelative($this, $aAdditionalParameter);
}
}
return $sOrderPage;
} | [
"public",
"function",
"GetStepURL",
"(",
"$",
"bDisableAccessCheck",
"=",
"true",
",",
"$",
"bForcePortalLink",
"=",
"false",
",",
"$",
"aAdditionalParameter",
"=",
"array",
"(",
")",
")",
"{",
"$",
"sOrderPage",
"=",
"''",
";",
"if",
"(",
"$",
"bDisableAc... | Returns the URL to this step.
@param bool $bDisableAccessCheck If false, there will be an access check for the step. If this access check fails, the returned URL will be empty.
@param bool $bForcePortalLink - set to true if you want to include the domain
@param array $aAdditionalParameter
@return string | [
"Returns",
"the",
"URL",
"to",
"this",
"step",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrderStep/TShopOrderStep.class.php#L229-L241 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopOrderStep/TShopOrderStep.class.php | TShopOrderStep.GetStepURLReturnStepViaAjax | public function GetStepURLReturnStepViaAjax($bDisableAccessCheck = true, $bForcePortalLink = false, $aAdditionalParameter = array())
{
$oGlobal = TGlobal::instance();
$aAdditionalParameter['module_fnc'] = array($oGlobal->GetExecutingModulePointer()->sModuleSpotName => 'ExecuteAjaxCall');
$aAdditionalParameter['_fnc'] = 'GetStepAsAjax';
$aAdditionalParameter['sStepName'] = $this->fieldSystemname;
return $this->GetStepURL($bDisableAccessCheck, $bForcePortalLink, $aAdditionalParameter);
} | php | public function GetStepURLReturnStepViaAjax($bDisableAccessCheck = true, $bForcePortalLink = false, $aAdditionalParameter = array())
{
$oGlobal = TGlobal::instance();
$aAdditionalParameter['module_fnc'] = array($oGlobal->GetExecutingModulePointer()->sModuleSpotName => 'ExecuteAjaxCall');
$aAdditionalParameter['_fnc'] = 'GetStepAsAjax';
$aAdditionalParameter['sStepName'] = $this->fieldSystemname;
return $this->GetStepURL($bDisableAccessCheck, $bForcePortalLink, $aAdditionalParameter);
} | [
"public",
"function",
"GetStepURLReturnStepViaAjax",
"(",
"$",
"bDisableAccessCheck",
"=",
"true",
",",
"$",
"bForcePortalLink",
"=",
"false",
",",
"$",
"aAdditionalParameter",
"=",
"array",
"(",
")",
")",
"{",
"$",
"oGlobal",
"=",
"TGlobal",
"::",
"instance",
... | Returns the URL required to load a step via ajax.
@param bool $bDisableAccessCheck
@param bool $bForcePortalLink
@return string | [
"Returns",
"the",
"URL",
"required",
"to",
"load",
"a",
"step",
"via",
"ajax",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrderStep/TShopOrderStep.class.php#L251-L259 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopOrderStep/TShopOrderStep.class.php | TShopOrderStep.ExecuteStep | public function ExecuteStep()
{
if ($this->ProcessStep()) {
$this->ProcessStepSuccessHook();
$oBasket = TShopBasket::GetInstance();
$oBasket->aCompletedOrderStepList[$this->fieldSystemname] = true;
$oNextStep = $this->GetNextStep();
$this->JumpToStep($oNextStep);
}
} | php | public function ExecuteStep()
{
if ($this->ProcessStep()) {
$this->ProcessStepSuccessHook();
$oBasket = TShopBasket::GetInstance();
$oBasket->aCompletedOrderStepList[$this->fieldSystemname] = true;
$oNextStep = $this->GetNextStep();
$this->JumpToStep($oNextStep);
}
} | [
"public",
"function",
"ExecuteStep",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"ProcessStep",
"(",
")",
")",
"{",
"$",
"this",
"->",
"ProcessStepSuccessHook",
"(",
")",
";",
"$",
"oBasket",
"=",
"TShopBasket",
"::",
"GetInstance",
"(",
")",
";",
"$"... | Executes the current step. Redirects to the next step in line if no errors occur. | [
"Executes",
"the",
"current",
"step",
".",
"Redirects",
"to",
"the",
"next",
"step",
"in",
"line",
"if",
"no",
"errors",
"occur",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrderStep/TShopOrderStep.class.php#L280-L289 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopOrderStep/TShopOrderStep.class.php | TShopOrderStep.Render | public function Render($sSpotName = null, $aCallTimeVars = array())
{
$oView = new TViewParser();
$oView->AddVar('oShop', $this->getShopService()->getActiveShop());
$oView->AddVar('oStep', $this);
$oStepNext = $this->GetNextStep();
$oStepPrevious = $this->GetPreviousStep();
$oView->AddVar('oStepNext', $oStepNext);
$oView->AddVar('oStepPrevious', $oStepPrevious);
$sBackLink = $this->GetReturnToLastStepURL();
$oView->AddVar('sBackLink', $sBackLink);
$oView->AddVar('sSpotName', $sSpotName);
$oView->AddVar('aCallTimeVars', $aCallTimeVars);
$sViewName = $this->GetRenderViewName();
$sViewType = $this->GetRenderViewType();
$aOtherParameters = &$this->GetAdditionalViewVariables($sViewName, $sViewType);
$oView->AddVarArray($aOtherParameters);
return $oView->RenderObjectPackageView($sViewName, $this->getStepViewPath(), $sViewType);
} | php | public function Render($sSpotName = null, $aCallTimeVars = array())
{
$oView = new TViewParser();
$oView->AddVar('oShop', $this->getShopService()->getActiveShop());
$oView->AddVar('oStep', $this);
$oStepNext = $this->GetNextStep();
$oStepPrevious = $this->GetPreviousStep();
$oView->AddVar('oStepNext', $oStepNext);
$oView->AddVar('oStepPrevious', $oStepPrevious);
$sBackLink = $this->GetReturnToLastStepURL();
$oView->AddVar('sBackLink', $sBackLink);
$oView->AddVar('sSpotName', $sSpotName);
$oView->AddVar('aCallTimeVars', $aCallTimeVars);
$sViewName = $this->GetRenderViewName();
$sViewType = $this->GetRenderViewType();
$aOtherParameters = &$this->GetAdditionalViewVariables($sViewName, $sViewType);
$oView->AddVarArray($aOtherParameters);
return $oView->RenderObjectPackageView($sViewName, $this->getStepViewPath(), $sViewType);
} | [
"public",
"function",
"Render",
"(",
"$",
"sSpotName",
"=",
"null",
",",
"$",
"aCallTimeVars",
"=",
"array",
"(",
")",
")",
"{",
"$",
"oView",
"=",
"new",
"TViewParser",
"(",
")",
";",
"$",
"oView",
"->",
"AddVar",
"(",
"'oShop'",
",",
"$",
"this",
... | Renders the requested step.
@param array $aCallTimeVars - place any custom vars that you want to pass through the call here
@return string | [
"Renders",
"the",
"requested",
"step",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrderStep/TShopOrderStep.class.php#L435-L459 | train |
chameleon-system/chameleon-shop | src/ShopListFilterBundle/objects/db/ListfilterItems/TPkgShopListfilterItemLevelTree.class.php | TPkgShopListfilterItemLevelTree.GetRenderedCategoryTree | public function GetRenderedCategoryTree()
{
$aFilterCategories = $this->GetOptions();
$oTree = TShopCategoryTree::GetCategoryTree();
$oTree->ResetCounter();
foreach ($aFilterCategories as $sCategoryId => $sCategoryCount) {
$oTree->AddItemCount($sCategoryId, $sCategoryCount);
}
if (is_array($this->aActiveFilterData) && count($this->aActiveFilterData) > 0) {
$oTree->MarkActiveCategories($this->aActiveFilterData);
}
$sRenderedCategoryTree = $oTree->Render($this->id, true, true);
return $sRenderedCategoryTree;
} | php | public function GetRenderedCategoryTree()
{
$aFilterCategories = $this->GetOptions();
$oTree = TShopCategoryTree::GetCategoryTree();
$oTree->ResetCounter();
foreach ($aFilterCategories as $sCategoryId => $sCategoryCount) {
$oTree->AddItemCount($sCategoryId, $sCategoryCount);
}
if (is_array($this->aActiveFilterData) && count($this->aActiveFilterData) > 0) {
$oTree->MarkActiveCategories($this->aActiveFilterData);
}
$sRenderedCategoryTree = $oTree->Render($this->id, true, true);
return $sRenderedCategoryTree;
} | [
"public",
"function",
"GetRenderedCategoryTree",
"(",
")",
"{",
"$",
"aFilterCategories",
"=",
"$",
"this",
"->",
"GetOptions",
"(",
")",
";",
"$",
"oTree",
"=",
"TShopCategoryTree",
"::",
"GetCategoryTree",
"(",
")",
";",
"$",
"oTree",
"->",
"ResetCounter",
... | Get the complete rendered filter as html.
@return string | [
"Get",
"the",
"complete",
"rendered",
"filter",
"as",
"html",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopListFilterBundle/objects/db/ListfilterItems/TPkgShopListfilterItemLevelTree.class.php#L34-L48 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TCMSWizardStep/TCMSWizardStepShopTellAFriend.class.php | TCMSWizardStepShopTellAFriend.ValidateUserData | protected function ValidateUserData()
{
$bIsValid = true;
$oMsgManager = TCMSMessageManager::GetInstance();
// check user data
$sCaptchaValue = $this->GetCaptchaValue();
if (empty($sCaptchaValue) || $sCaptchaValue != $this->aUserInput['captcha']) {
$bIsValid = false;
$oMsgManager->AddMessage('tell-a-friend-field-captcha', 'INPUT-ERROR-INVALID-CAPTCHA');
}
$aRequiredFields = $this->RequiredFields();
foreach ($aRequiredFields as $sFieldName) {
$sVal = trim($this->aUserInput[$sFieldName]);
if (empty($sVal)) {
$bIsValid = false;
$oMsgManager->AddMessage('tell-a-friend-field-'.$sFieldName, 'ERROR-USER-REQUIRED-FIELD-MISSING');
}
}
return $bIsValid;
} | php | protected function ValidateUserData()
{
$bIsValid = true;
$oMsgManager = TCMSMessageManager::GetInstance();
// check user data
$sCaptchaValue = $this->GetCaptchaValue();
if (empty($sCaptchaValue) || $sCaptchaValue != $this->aUserInput['captcha']) {
$bIsValid = false;
$oMsgManager->AddMessage('tell-a-friend-field-captcha', 'INPUT-ERROR-INVALID-CAPTCHA');
}
$aRequiredFields = $this->RequiredFields();
foreach ($aRequiredFields as $sFieldName) {
$sVal = trim($this->aUserInput[$sFieldName]);
if (empty($sVal)) {
$bIsValid = false;
$oMsgManager->AddMessage('tell-a-friend-field-'.$sFieldName, 'ERROR-USER-REQUIRED-FIELD-MISSING');
}
}
return $bIsValid;
} | [
"protected",
"function",
"ValidateUserData",
"(",
")",
"{",
"$",
"bIsValid",
"=",
"true",
";",
"$",
"oMsgManager",
"=",
"TCMSMessageManager",
"::",
"GetInstance",
"(",
")",
";",
"// check user data",
"$",
"sCaptchaValue",
"=",
"$",
"this",
"->",
"GetCaptchaValue... | validate the user input.
@return bool | [
"validate",
"the",
"user",
"input",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TCMSWizardStep/TCMSWizardStepShopTellAFriend.class.php#L183-L205 | train |
chameleon-system/chameleon-shop | src/ShopBundle/mappers/article/TPkgShopMapper_ArticleRatingOverview.class.php | TPkgShopMapper_ArticleRatingOverview.GetRatingOverview | protected function GetRatingOverview($oReviewModuleConfiguration, $oArticle, IMapperCacheTriggerRestricted $oCacheTriggerManager, $bCachingEnabled)
{
$aRatingOverview = array();
for ($i = $oReviewModuleConfiguration->fieldRatingCount; $i > 0; --$i) {
$aRatingOverview['r_'.$i] = array();
$aRatingOverview['r_'.$i]['dRating'] = $i;
$aRatingOverview['r_'.$i]['iRatingCount'] = 0;
}
$oReviewList = $oArticle->GetReviewsPublished();
while ($oReview = $oReviewList->Next()) {
if ($bCachingEnabled) {
$oCacheTriggerManager->addTrigger($oReview->table, $oReview->id);
}
if (isset($aRatingOverview['r_'.$oReview->fieldRating])) {
$aRatingOverview['r_'.$oReview->fieldRating];
++$aRatingOverview['r_'.$oReview->fieldRating]['iRatingCount'];
}
}
return $aRatingOverview;
} | php | protected function GetRatingOverview($oReviewModuleConfiguration, $oArticle, IMapperCacheTriggerRestricted $oCacheTriggerManager, $bCachingEnabled)
{
$aRatingOverview = array();
for ($i = $oReviewModuleConfiguration->fieldRatingCount; $i > 0; --$i) {
$aRatingOverview['r_'.$i] = array();
$aRatingOverview['r_'.$i]['dRating'] = $i;
$aRatingOverview['r_'.$i]['iRatingCount'] = 0;
}
$oReviewList = $oArticle->GetReviewsPublished();
while ($oReview = $oReviewList->Next()) {
if ($bCachingEnabled) {
$oCacheTriggerManager->addTrigger($oReview->table, $oReview->id);
}
if (isset($aRatingOverview['r_'.$oReview->fieldRating])) {
$aRatingOverview['r_'.$oReview->fieldRating];
++$aRatingOverview['r_'.$oReview->fieldRating]['iRatingCount'];
}
}
return $aRatingOverview;
} | [
"protected",
"function",
"GetRatingOverview",
"(",
"$",
"oReviewModuleConfiguration",
",",
"$",
"oArticle",
",",
"IMapperCacheTriggerRestricted",
"$",
"oCacheTriggerManager",
",",
"$",
"bCachingEnabled",
")",
"{",
"$",
"aRatingOverview",
"=",
"array",
"(",
")",
";",
... | Get array for each rating count holding the count of rated reviews.
@param TdbPkgShopArticleReviewModuleShopArticleReviewConfiguration $oReviewModuleConfiguration
@param TdbShopArticle $oArticle
@param \IMapperCacheTriggerRestricted $oCacheTriggerManager
@return array | [
"Get",
"array",
"for",
"each",
"rating",
"count",
"holding",
"the",
"count",
"of",
"rated",
"reviews",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/mappers/article/TPkgShopMapper_ArticleRatingOverview.class.php#L38-L58 | train |
chameleon-system/chameleon-shop | src/ShopRatingServiceBundle/objects/cronjobs/TPkgShopRating_CronJob_SendRatingMails.class.php | TPkgShopRating_CronJob_SendRatingMails.GetConfigValues | protected function GetConfigValues()
{
$oShopConfig = TdbShop::GetInstance(1);
$this->Shopreviewmail_MailDelay = $oShopConfig->fieldShopreviewmailMailDelay;
$this->Shopreviewmail_PercentOfCustomers = $oShopConfig->fieldShopreviewmailPercentOfCustomers;
$this->Shopreviewmail_SendForEachOrder = $oShopConfig->fieldShopreviewmailSendForEachOrder;
} | php | protected function GetConfigValues()
{
$oShopConfig = TdbShop::GetInstance(1);
$this->Shopreviewmail_MailDelay = $oShopConfig->fieldShopreviewmailMailDelay;
$this->Shopreviewmail_PercentOfCustomers = $oShopConfig->fieldShopreviewmailPercentOfCustomers;
$this->Shopreviewmail_SendForEachOrder = $oShopConfig->fieldShopreviewmailSendForEachOrder;
} | [
"protected",
"function",
"GetConfigValues",
"(",
")",
"{",
"$",
"oShopConfig",
"=",
"TdbShop",
"::",
"GetInstance",
"(",
"1",
")",
";",
"$",
"this",
"->",
"Shopreviewmail_MailDelay",
"=",
"$",
"oShopConfig",
"->",
"fieldShopreviewmailMailDelay",
";",
"$",
"this"... | Read rating-mail-config. | [
"Read",
"rating",
"-",
"mail",
"-",
"config",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopRatingServiceBundle/objects/cronjobs/TPkgShopRating_CronJob_SendRatingMails.class.php#L69-L75 | train |
chameleon-system/chameleon-shop | src/ShopRatingServiceBundle/objects/cronjobs/TPkgShopRating_CronJob_SendRatingMails.class.php | TPkgShopRating_CronJob_SendRatingMails.GetShippingDateLowerBound | public function GetShippingDateLowerBound()
{
$iAgeInDays = $this->Shopreviewmail_MailDelay;
$iNow = time();
$hour = date('G', $iNow);
$minute = date('i', $iNow);
if ('0' == substr($minute, 0, 1)) {
$minute = substr($minute, 1);
}
$second = date('s', $iNow);
if ('0' == substr($second, 0, 1)) {
$second = substr($second, 1);
}
$iLowerBound = mktime($hour, $minute, $second, date('n', $iNow), date('j', $iNow) - $iAgeInDays, date('Y', $iNow));
return $iLowerBound;
} | php | public function GetShippingDateLowerBound()
{
$iAgeInDays = $this->Shopreviewmail_MailDelay;
$iNow = time();
$hour = date('G', $iNow);
$minute = date('i', $iNow);
if ('0' == substr($minute, 0, 1)) {
$minute = substr($minute, 1);
}
$second = date('s', $iNow);
if ('0' == substr($second, 0, 1)) {
$second = substr($second, 1);
}
$iLowerBound = mktime($hour, $minute, $second, date('n', $iNow), date('j', $iNow) - $iAgeInDays, date('Y', $iNow));
return $iLowerBound;
} | [
"public",
"function",
"GetShippingDateLowerBound",
"(",
")",
"{",
"$",
"iAgeInDays",
"=",
"$",
"this",
"->",
"Shopreviewmail_MailDelay",
";",
"$",
"iNow",
"=",
"time",
"(",
")",
";",
"$",
"hour",
"=",
"date",
"(",
"'G'",
",",
"$",
"iNow",
")",
";",
"$"... | return the shipping date past which a review notification should be send.
@return int (unix time stamp) | [
"return",
"the",
"shipping",
"date",
"past",
"which",
"a",
"review",
"notification",
"should",
"be",
"send",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopRatingServiceBundle/objects/cronjobs/TPkgShopRating_CronJob_SendRatingMails.class.php#L125-L141 | train |
chameleon-system/chameleon-shop | src/ShopRatingServiceBundle/objects/cronjobs/TPkgShopRating_CronJob_SendRatingMails.class.php | TPkgShopRating_CronJob_SendRatingMails.SendShopReviewMail | public function SendShopReviewMail($aOrder)
{
$bMailWasSend = false;
$oUser = TdbDataExtranetUser::GetNewInstance();
$oUser->Load($aOrder['data_extranet_user_id']);
if ($this->AllowSendingMailForOrder($oUser, $aOrder)) {
$oRatingService = $this->GetSuitableRatingService($oUser, $aOrder);
if (null !== $oRatingService) {
$bMailWasSend = $oRatingService->SendShopRatingEmail($oUser, $aOrder);
if ($bMailWasSend) {
$query = "UPDATE `shop_order` SET `pkg_shop_rating_service_mail_sent` = '1', `pkg_shop_rating_service_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($oRatingService->id)."' WHERE `id` = '".MySqlLegacySupport::getInstance()->real_escape_string($aOrder['id'])."'";
MySqlLegacySupport::getInstance()->query($query);
if (false == $this->bDisableSentHistory) {
$sNewID = TTools::GetUUID();
$iSendDate = date('Y-m-d H:i:s');
$query = "INSERT INTO `pkg_shop_rating_service_history`
SET `id` = '".MySqlLegacySupport::getInstance()->real_escape_string($sNewID)."',
`data_extranet_user_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($oUser->id)."',
`shop_order_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($aOrder['id'])."',
`date` = '".MySqlLegacySupport::getInstance()->real_escape_string($iSendDate)."',
`pkg_shop_rating_service_id_list` = '".MySqlLegacySupport::getInstance()->real_escape_string($oRatingService->id)."'
";
if ($this->bDebug) {
echo __LINE__.': '.$query."\n<br />\n";
}
MySqlLegacySupport::getInstance()->query($query);
}
}
}
}
return $bMailWasSend;
} | php | public function SendShopReviewMail($aOrder)
{
$bMailWasSend = false;
$oUser = TdbDataExtranetUser::GetNewInstance();
$oUser->Load($aOrder['data_extranet_user_id']);
if ($this->AllowSendingMailForOrder($oUser, $aOrder)) {
$oRatingService = $this->GetSuitableRatingService($oUser, $aOrder);
if (null !== $oRatingService) {
$bMailWasSend = $oRatingService->SendShopRatingEmail($oUser, $aOrder);
if ($bMailWasSend) {
$query = "UPDATE `shop_order` SET `pkg_shop_rating_service_mail_sent` = '1', `pkg_shop_rating_service_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($oRatingService->id)."' WHERE `id` = '".MySqlLegacySupport::getInstance()->real_escape_string($aOrder['id'])."'";
MySqlLegacySupport::getInstance()->query($query);
if (false == $this->bDisableSentHistory) {
$sNewID = TTools::GetUUID();
$iSendDate = date('Y-m-d H:i:s');
$query = "INSERT INTO `pkg_shop_rating_service_history`
SET `id` = '".MySqlLegacySupport::getInstance()->real_escape_string($sNewID)."',
`data_extranet_user_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($oUser->id)."',
`shop_order_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($aOrder['id'])."',
`date` = '".MySqlLegacySupport::getInstance()->real_escape_string($iSendDate)."',
`pkg_shop_rating_service_id_list` = '".MySqlLegacySupport::getInstance()->real_escape_string($oRatingService->id)."'
";
if ($this->bDebug) {
echo __LINE__.': '.$query."\n<br />\n";
}
MySqlLegacySupport::getInstance()->query($query);
}
}
}
}
return $bMailWasSend;
} | [
"public",
"function",
"SendShopReviewMail",
"(",
"$",
"aOrder",
")",
"{",
"$",
"bMailWasSend",
"=",
"false",
";",
"$",
"oUser",
"=",
"TdbDataExtranetUser",
"::",
"GetNewInstance",
"(",
")",
";",
"$",
"oUser",
"->",
"Load",
"(",
"$",
"aOrder",
"[",
"'data_e... | send the shop review mail and log the action in es_shop_review
returns true if the mail was send. note that the method checks if the customer is allowed
to receiven a mail for the given order.
@param array $aOrder - the order data
@return bool | [
"send",
"the",
"shop",
"review",
"mail",
"and",
"log",
"the",
"action",
"in",
"es_shop_review",
"returns",
"true",
"if",
"the",
"mail",
"was",
"send",
".",
"note",
"that",
"the",
"method",
"checks",
"if",
"the",
"customer",
"is",
"allowed",
"to",
"receiven... | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopRatingServiceBundle/objects/cronjobs/TPkgShopRating_CronJob_SendRatingMails.class.php#L200-L234 | train |
chameleon-system/chameleon-shop | src/ShopRatingServiceBundle/objects/cronjobs/TPkgShopRating_CronJob_SendRatingMails.class.php | TPkgShopRating_CronJob_SendRatingMails.CleanupAffiliateCode | protected function CleanupAffiliateCode($sAffiliateCode)
{
$sRet = '';
$sAffiliateCode = trim($sAffiliateCode);
if (!empty($sAffiliateCode)) {
//get all rating services
$sQuery = " SELECT *
FROM `pkg_shop_rating_service`
WHERE `active` = '1'
ORDER BY `position`,`weight` ASC
";
$oRatingServiceList = TdbPkgShopRatingServiceList::GetList($sQuery);
$oRatingServiceList->GoToStart();
//loop and try to identify one...
while ($oService = $oRatingServiceList->Next()) {
/* @var $oService TdbPkgShopRatingService */
$pos = strpos($sAffiliateCode, strtolower(trim($oService->fieldAffiliateValue)));
if (false !== $pos) {
//service found!
$oRatingServiceList->GoToEnd();
$sRet = $oService->fieldAffiliateValue;
}
}
}
return $sRet;
} | php | protected function CleanupAffiliateCode($sAffiliateCode)
{
$sRet = '';
$sAffiliateCode = trim($sAffiliateCode);
if (!empty($sAffiliateCode)) {
//get all rating services
$sQuery = " SELECT *
FROM `pkg_shop_rating_service`
WHERE `active` = '1'
ORDER BY `position`,`weight` ASC
";
$oRatingServiceList = TdbPkgShopRatingServiceList::GetList($sQuery);
$oRatingServiceList->GoToStart();
//loop and try to identify one...
while ($oService = $oRatingServiceList->Next()) {
/* @var $oService TdbPkgShopRatingService */
$pos = strpos($sAffiliateCode, strtolower(trim($oService->fieldAffiliateValue)));
if (false !== $pos) {
//service found!
$oRatingServiceList->GoToEnd();
$sRet = $oService->fieldAffiliateValue;
}
}
}
return $sRet;
} | [
"protected",
"function",
"CleanupAffiliateCode",
"(",
"$",
"sAffiliateCode",
")",
"{",
"$",
"sRet",
"=",
"''",
";",
"$",
"sAffiliateCode",
"=",
"trim",
"(",
"$",
"sAffiliateCode",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"sAffiliateCode",
")",
")",
"... | Try to cleanup incomming shop_order.affiliate_code.
@param $sAffiliateCode
@return string | [
"Try",
"to",
"cleanup",
"incomming",
"shop_order",
".",
"affiliate_code",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopRatingServiceBundle/objects/cronjobs/TPkgShopRating_CronJob_SendRatingMails.class.php#L243-L270 | train |
chameleon-system/chameleon-shop | src/ShopRatingServiceBundle/objects/cronjobs/TPkgShopRating_CronJob_SendRatingMails.class.php | TPkgShopRating_CronJob_SendRatingMails.GetMaxNumberOfShopReviewMailsToSend | public function GetMaxNumberOfShopReviewMailsToSend($iSendForShippingDateNewerThan)
{
if ($this->bDebug) {
echo '<br><br>';
}
$query = "SELECT *
FROM `shop_order`
WHERE `shop_order`.`pkg_shop_rating_service_order_completely_shipped` > '0000-00-00 00:00:00'
AND `shop_order`.`shop_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->sShopID)."'
AND `shop_order`.`cms_language_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->sLanguageID)."'
AND `shop_order`.`pkg_shop_rating_service_order_completely_shipped` <= '".MySqlLegacySupport::getInstance()->real_escape_string(date('Y-m-d H:i:s', $iSendForShippingDateNewerThan))."'
AND `shop_order`.`pkg_shop_rating_service_rating_processed_on` = '0000-00-00 00:00:00'
AND `shop_order`.`pkg_shop_rating_service_mail_processed` = '0'
AND `shop_order`.`adr_billing_country_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->sUserCountryID)."'
";
if ($this->SendCustomersMailOnlyOnce()) {
$query .= 'GROUP BY `shop_order`.`customer_number`';
}
if ($this->bDebug) {
echo __LINE__.': '.$query."\n<br />\n";
}
$rRow = MySqlLegacySupport::getInstance()->query($query);
$iNumberOfCompletedOrders = MySqlLegacySupport::getInstance()->num_rows($rRow);
$query = ' SELECT * FROM `pkg_shop_rating_service_history` ';
if ($this->SendCustomersMailOnlyOnce()) {
$query .= 'GROUP BY `pkg_shop_rating_service_history`.`data_extranet_user_id`';
}
if ($this->bDebug) {
echo __LINE__.': '.$query."\n<br />\n";
}
$rRow = MySqlLegacySupport::getInstance()->query($query);
$iNumberOfReviewMailsSend = MySqlLegacySupport::getInstance()->num_rows($rRow);
$iPercentageToBeSend = $this->Shopreviewmail_PercentOfCustomers; //$this->GetConfigValue('shopreviewmail_percent_of_customers');;
$iPercentageMailSend = 100;
if (0 == $iNumberOfCompletedOrders && 0 == $iNumberOfReviewMailsSend) {
$iPercentageMailSend = 100;
} elseif ($iNumberOfCompletedOrders > 0) {
$iPercentageMailSend = ($iNumberOfReviewMailsSend / $iNumberOfCompletedOrders) * 100;
} else {
$iPercentageMailSend = 0;
}
if ($this->bDebug) {
echo '<br />';
}
if ($this->bDebug) {
echo __LINE__.'iPercentageToBeSend: '.$iPercentageToBeSend."\n<br />\n";
}
if ($this->bDebug) {
echo __LINE__.'iNumberOfCompletedOrders: '.$iNumberOfCompletedOrders."\n<br />\n";
}
$iNumberOfReviewMailsToBeSend = ceil(($iPercentageToBeSend / 100) * $iNumberOfCompletedOrders);
if ($this->bDebug) {
echo __LINE__.'iNumberOfReviewMailsToBeSend: '.$iNumberOfReviewMailsToBeSend."\n<br />\n";
}
if ($this->bDebug) {
echo __LINE__.'iNumberOfReviewMailsSend: '.$iNumberOfReviewMailsSend."\n<br />\n";
}
echo '<br><br>';
// NOTE: the total possible mails covers all orders that have been send out
// (so it includes orders which had their expected order date passed - Frau sommer 25.11.08)
return $iNumberOfReviewMailsToBeSend;
} | php | public function GetMaxNumberOfShopReviewMailsToSend($iSendForShippingDateNewerThan)
{
if ($this->bDebug) {
echo '<br><br>';
}
$query = "SELECT *
FROM `shop_order`
WHERE `shop_order`.`pkg_shop_rating_service_order_completely_shipped` > '0000-00-00 00:00:00'
AND `shop_order`.`shop_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->sShopID)."'
AND `shop_order`.`cms_language_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->sLanguageID)."'
AND `shop_order`.`pkg_shop_rating_service_order_completely_shipped` <= '".MySqlLegacySupport::getInstance()->real_escape_string(date('Y-m-d H:i:s', $iSendForShippingDateNewerThan))."'
AND `shop_order`.`pkg_shop_rating_service_rating_processed_on` = '0000-00-00 00:00:00'
AND `shop_order`.`pkg_shop_rating_service_mail_processed` = '0'
AND `shop_order`.`adr_billing_country_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->sUserCountryID)."'
";
if ($this->SendCustomersMailOnlyOnce()) {
$query .= 'GROUP BY `shop_order`.`customer_number`';
}
if ($this->bDebug) {
echo __LINE__.': '.$query."\n<br />\n";
}
$rRow = MySqlLegacySupport::getInstance()->query($query);
$iNumberOfCompletedOrders = MySqlLegacySupport::getInstance()->num_rows($rRow);
$query = ' SELECT * FROM `pkg_shop_rating_service_history` ';
if ($this->SendCustomersMailOnlyOnce()) {
$query .= 'GROUP BY `pkg_shop_rating_service_history`.`data_extranet_user_id`';
}
if ($this->bDebug) {
echo __LINE__.': '.$query."\n<br />\n";
}
$rRow = MySqlLegacySupport::getInstance()->query($query);
$iNumberOfReviewMailsSend = MySqlLegacySupport::getInstance()->num_rows($rRow);
$iPercentageToBeSend = $this->Shopreviewmail_PercentOfCustomers; //$this->GetConfigValue('shopreviewmail_percent_of_customers');;
$iPercentageMailSend = 100;
if (0 == $iNumberOfCompletedOrders && 0 == $iNumberOfReviewMailsSend) {
$iPercentageMailSend = 100;
} elseif ($iNumberOfCompletedOrders > 0) {
$iPercentageMailSend = ($iNumberOfReviewMailsSend / $iNumberOfCompletedOrders) * 100;
} else {
$iPercentageMailSend = 0;
}
if ($this->bDebug) {
echo '<br />';
}
if ($this->bDebug) {
echo __LINE__.'iPercentageToBeSend: '.$iPercentageToBeSend."\n<br />\n";
}
if ($this->bDebug) {
echo __LINE__.'iNumberOfCompletedOrders: '.$iNumberOfCompletedOrders."\n<br />\n";
}
$iNumberOfReviewMailsToBeSend = ceil(($iPercentageToBeSend / 100) * $iNumberOfCompletedOrders);
if ($this->bDebug) {
echo __LINE__.'iNumberOfReviewMailsToBeSend: '.$iNumberOfReviewMailsToBeSend."\n<br />\n";
}
if ($this->bDebug) {
echo __LINE__.'iNumberOfReviewMailsSend: '.$iNumberOfReviewMailsSend."\n<br />\n";
}
echo '<br><br>';
// NOTE: the total possible mails covers all orders that have been send out
// (so it includes orders which had their expected order date passed - Frau sommer 25.11.08)
return $iNumberOfReviewMailsToBeSend;
} | [
"public",
"function",
"GetMaxNumberOfShopReviewMailsToSend",
"(",
"$",
"iSendForShippingDateNewerThan",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"bDebug",
")",
"{",
"echo",
"'<br><br>'",
";",
"}",
"$",
"query",
"=",
"\"SELECT *\n FROM `shop_order`\n ... | returns the number of review mails that should be send out. this is relevant
if only a specified percentages of all orders should get a mail.
@param $iSendForShippingDateNewerThan
@return int | [
"returns",
"the",
"number",
"of",
"review",
"mails",
"that",
"should",
"be",
"send",
"out",
".",
"this",
"is",
"relevant",
"if",
"only",
"a",
"specified",
"percentages",
"of",
"all",
"orders",
"should",
"get",
"a",
"mail",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopRatingServiceBundle/objects/cronjobs/TPkgShopRating_CronJob_SendRatingMails.class.php#L323-L395 | train |
comporu/compo-core | src/Compo/Sonata/DashboardBundle/Admin/BlockAdmin.php | BlockAdmin.toString | public function toString($object)
{
if (!\is_object($object)) {
return '';
}
if (method_exists($object, 'getName') && null !== $object->getName()) {
return (string) $object->getName();
}
return parent::toString($object);
} | php | public function toString($object)
{
if (!\is_object($object)) {
return '';
}
if (method_exists($object, 'getName') && null !== $object->getName()) {
return (string) $object->getName();
}
return parent::toString($object);
} | [
"public",
"function",
"toString",
"(",
"$",
"object",
")",
"{",
"if",
"(",
"!",
"\\",
"is_object",
"(",
"$",
"object",
")",
")",
"{",
"return",
"''",
";",
"}",
"if",
"(",
"method_exists",
"(",
"$",
"object",
",",
"'getName'",
")",
"&&",
"null",
"!=... | Override needed to make the dashboard composer cleaner.
{@inheritdoc} | [
"Override",
"needed",
"to",
"make",
"the",
"dashboard",
"composer",
"cleaner",
"."
] | ebaa9fe8a4b831506c78fdf637da6b4deadec1e2 | https://github.com/comporu/compo-core/blob/ebaa9fe8a4b831506c78fdf637da6b4deadec1e2/src/Compo/Sonata/DashboardBundle/Admin/BlockAdmin.php#L281-L291 | train |
edmondscommerce/doctrine-static-meta | src/MappingHelper.php | MappingHelper.setSimpleStringFields | public static function setSimpleStringFields(
array $fields,
ClassMetadataBuilder $builder,
$default = null,
bool $isUnique = false
): void {
if (null !== $default && !\is_string($default)) {
throw new \InvalidArgumentException(
'Invalid default value ' . $default
. ' with type ' . self::getType($default)
);
}
foreach ($fields as $field) {
$fieldBuilder = new FieldBuilder(
$builder,
[
'fieldName' => $field,
'type' => Type::STRING,
'default' => $default,
]
);
$fieldBuilder
->columnName(self::getColumnNameForField($field))
->nullable(null === $default)
->unique($isUnique)
->length(Database::MAX_VARCHAR_LENGTH)
->build();
}
} | php | public static function setSimpleStringFields(
array $fields,
ClassMetadataBuilder $builder,
$default = null,
bool $isUnique = false
): void {
if (null !== $default && !\is_string($default)) {
throw new \InvalidArgumentException(
'Invalid default value ' . $default
. ' with type ' . self::getType($default)
);
}
foreach ($fields as $field) {
$fieldBuilder = new FieldBuilder(
$builder,
[
'fieldName' => $field,
'type' => Type::STRING,
'default' => $default,
]
);
$fieldBuilder
->columnName(self::getColumnNameForField($field))
->nullable(null === $default)
->unique($isUnique)
->length(Database::MAX_VARCHAR_LENGTH)
->build();
}
} | [
"public",
"static",
"function",
"setSimpleStringFields",
"(",
"array",
"$",
"fields",
",",
"ClassMetadataBuilder",
"$",
"builder",
",",
"$",
"default",
"=",
"null",
",",
"bool",
"$",
"isUnique",
"=",
"false",
")",
":",
"void",
"{",
"if",
"(",
"null",
"!=="... | Set bog standard string fields quickly in bulk
@param array $fields
@param ClassMetadataBuilder $builder
@param mixed $default
@param bool $isUnique
In this case the boolean argument is simply data
@SuppressWarnings(PHPMD.BooleanArgumentFlag) | [
"Set",
"bog",
"standard",
"string",
"fields",
"quickly",
"in",
"bulk"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/MappingHelper.php#L243-L271 | train |
edmondscommerce/doctrine-static-meta | src/MappingHelper.php | MappingHelper.setSimpleFloatFields | public static function setSimpleFloatFields(
array $fields,
ClassMetadataBuilder $builder,
$default = null
): void {
if (null !== $default && !\is_float($default)) {
throw new \InvalidArgumentException(
'Invalid default value ' . $default
. ' with type ' . self::getType($default)
);
}
foreach ($fields as $field) {
$fieldBuilder = new FieldBuilder(
$builder,
[
'fieldName' => $field,
'type' => Type::FLOAT,
'default' => $default,
]
);
$fieldBuilder
->columnName(self::getColumnNameForField($field))
->nullable(null === $default)
->build();
}
} | php | public static function setSimpleFloatFields(
array $fields,
ClassMetadataBuilder $builder,
$default = null
): void {
if (null !== $default && !\is_float($default)) {
throw new \InvalidArgumentException(
'Invalid default value ' . $default
. ' with type ' . self::getType($default)
);
}
foreach ($fields as $field) {
$fieldBuilder = new FieldBuilder(
$builder,
[
'fieldName' => $field,
'type' => Type::FLOAT,
'default' => $default,
]
);
$fieldBuilder
->columnName(self::getColumnNameForField($field))
->nullable(null === $default)
->build();
}
} | [
"public",
"static",
"function",
"setSimpleFloatFields",
"(",
"array",
"$",
"fields",
",",
"ClassMetadataBuilder",
"$",
"builder",
",",
"$",
"default",
"=",
"null",
")",
":",
"void",
"{",
"if",
"(",
"null",
"!==",
"$",
"default",
"&&",
"!",
"\\",
"is_float"... | Set bog standard float fields quickly in bulk
@param array $fields
@param ClassMetadataBuilder $builder
@param mixed $default
In this case the boolean argument is simply data
@SuppressWarnings(PHPMD.BooleanArgumentFlag) | [
"Set",
"bog",
"standard",
"float",
"fields",
"quickly",
"in",
"bulk"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/MappingHelper.php#L340-L365 | train |
edmondscommerce/doctrine-static-meta | src/MappingHelper.php | MappingHelper.setSimpleDecimalFields | public static function setSimpleDecimalFields(
array $fields,
ClassMetadataBuilder $builder,
$default = null
): void {
if (null !== $default && !\is_string($default)) {
throw new \InvalidArgumentException(
'Invalid default value ' . $default
. ' with type ' . self::getType($default)
);
}
if (null !== $default && !is_numeric($default)) {
throw new \InvalidArgumentException(
'Invalid default value ' . $default
. ', even though it is a string, it must be numeric '
);
}
foreach ($fields as $field) {
$fieldBuilder = new FieldBuilder(
$builder,
[
'fieldName' => $field,
'type' => Type::DECIMAL,
'default' => (string)(float)$default,
]
);
$fieldBuilder
->columnName(self::getColumnNameForField($field))
->nullable(null === $default)
->precision(Database::MAX_DECIMAL_PRECISION)
->scale(Database::MAX_DECIMAL_SCALE)
->build();
}
} | php | public static function setSimpleDecimalFields(
array $fields,
ClassMetadataBuilder $builder,
$default = null
): void {
if (null !== $default && !\is_string($default)) {
throw new \InvalidArgumentException(
'Invalid default value ' . $default
. ' with type ' . self::getType($default)
);
}
if (null !== $default && !is_numeric($default)) {
throw new \InvalidArgumentException(
'Invalid default value ' . $default
. ', even though it is a string, it must be numeric '
);
}
foreach ($fields as $field) {
$fieldBuilder = new FieldBuilder(
$builder,
[
'fieldName' => $field,
'type' => Type::DECIMAL,
'default' => (string)(float)$default,
]
);
$fieldBuilder
->columnName(self::getColumnNameForField($field))
->nullable(null === $default)
->precision(Database::MAX_DECIMAL_PRECISION)
->scale(Database::MAX_DECIMAL_SCALE)
->build();
}
} | [
"public",
"static",
"function",
"setSimpleDecimalFields",
"(",
"array",
"$",
"fields",
",",
"ClassMetadataBuilder",
"$",
"builder",
",",
"$",
"default",
"=",
"null",
")",
":",
"void",
"{",
"if",
"(",
"null",
"!==",
"$",
"default",
"&&",
"!",
"\\",
"is_stri... | Set bog standard decimal fields quickly in bulk
@param array $fields
@param ClassMetadataBuilder $builder
@param mixed $default
In this case the boolean argument is simply data
@SuppressWarnings(PHPMD.BooleanArgumentFlag) | [
"Set",
"bog",
"standard",
"decimal",
"fields",
"quickly",
"in",
"bulk"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/MappingHelper.php#L376-L409 | train |
edmondscommerce/doctrine-static-meta | src/MappingHelper.php | MappingHelper.setSimpleDatetimeFields | public static function setSimpleDatetimeFields(
array $fields,
ClassMetadataBuilder $builder,
$default = null
): void {
if (null !== $default) {
throw new \InvalidArgumentException('DateTime currently only support null as a default value');
}
foreach ($fields as $field) {
$fieldBuilder = new FieldBuilder(
$builder,
[
'fieldName' => $field,
'type' => Type::DATETIME_IMMUTABLE,
'default' => $default,
]
);
$fieldBuilder
->columnName(self::getColumnNameForField($field))
->nullable(null === $default)
->build();
}
} | php | public static function setSimpleDatetimeFields(
array $fields,
ClassMetadataBuilder $builder,
$default = null
): void {
if (null !== $default) {
throw new \InvalidArgumentException('DateTime currently only support null as a default value');
}
foreach ($fields as $field) {
$fieldBuilder = new FieldBuilder(
$builder,
[
'fieldName' => $field,
'type' => Type::DATETIME_IMMUTABLE,
'default' => $default,
]
);
$fieldBuilder
->columnName(self::getColumnNameForField($field))
->nullable(null === $default)
->build();
}
} | [
"public",
"static",
"function",
"setSimpleDatetimeFields",
"(",
"array",
"$",
"fields",
",",
"ClassMetadataBuilder",
"$",
"builder",
",",
"$",
"default",
"=",
"null",
")",
":",
"void",
"{",
"if",
"(",
"null",
"!==",
"$",
"default",
")",
"{",
"throw",
"new"... | Set bog standard dateTime fields quickly in bulk
@param array $fields
@param ClassMetadataBuilder $builder
@param mixed $default
In this case the boolean argument is simply data
@SuppressWarnings(PHPMD.BooleanArgumentFlag) | [
"Set",
"bog",
"standard",
"dateTime",
"fields",
"quickly",
"in",
"bulk"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/MappingHelper.php#L420-L442 | train |
edmondscommerce/doctrine-static-meta | src/MappingHelper.php | MappingHelper.setSimpleIntegerFields | public static function setSimpleIntegerFields(
array $fields,
ClassMetadataBuilder $builder,
$default = null,
bool $isUnique = false
): void {
if (null !== $default && !\is_int($default)) {
throw new \InvalidArgumentException(
'Invalid default value ' . $default
. ' with type ' . self::getType($default)
);
}
foreach ($fields as $field) {
$fieldBuilder = new FieldBuilder(
$builder,
[
'fieldName' => $field,
'type' => Type::INTEGER,
'default' => $default,
]
);
$fieldBuilder
->columnName(self::getColumnNameForField($field))
->nullable(null === $default)
->unique($isUnique)
->build();
}
} | php | public static function setSimpleIntegerFields(
array $fields,
ClassMetadataBuilder $builder,
$default = null,
bool $isUnique = false
): void {
if (null !== $default && !\is_int($default)) {
throw new \InvalidArgumentException(
'Invalid default value ' . $default
. ' with type ' . self::getType($default)
);
}
foreach ($fields as $field) {
$fieldBuilder = new FieldBuilder(
$builder,
[
'fieldName' => $field,
'type' => Type::INTEGER,
'default' => $default,
]
);
$fieldBuilder
->columnName(self::getColumnNameForField($field))
->nullable(null === $default)
->unique($isUnique)
->build();
}
} | [
"public",
"static",
"function",
"setSimpleIntegerFields",
"(",
"array",
"$",
"fields",
",",
"ClassMetadataBuilder",
"$",
"builder",
",",
"$",
"default",
"=",
"null",
",",
"bool",
"$",
"isUnique",
"=",
"false",
")",
":",
"void",
"{",
"if",
"(",
"null",
"!==... | Set bog standard integer fields quickly in bulk
@param array $fields
@param ClassMetadataBuilder $builder
@param mixed $default
@param bool $isUnique
In this case the boolean argument is simply data
@SuppressWarnings(PHPMD.BooleanArgumentFlag) | [
"Set",
"bog",
"standard",
"integer",
"fields",
"quickly",
"in",
"bulk"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/MappingHelper.php#L454-L481 | train |
edmondscommerce/doctrine-static-meta | src/MappingHelper.php | MappingHelper.setSimpleBooleanFields | public static function setSimpleBooleanFields(
array $fields,
ClassMetadataBuilder $builder,
$default = null
): void {
if (null !== $default && !\is_bool($default)) {
throw new \InvalidArgumentException(
'Invalid default value ' . $default
. ' with type ' . self::getType($default)
);
}
foreach ($fields as $field) {
$fieldBuilder = new FieldBuilder(
$builder,
[
'fieldName' => $field,
'type' => Type::BOOLEAN,
'default' => $default,
]
);
$fieldBuilder
->columnName(self::getColumnNameForField($field))
->nullable(null === $default)
->build();
}
} | php | public static function setSimpleBooleanFields(
array $fields,
ClassMetadataBuilder $builder,
$default = null
): void {
if (null !== $default && !\is_bool($default)) {
throw new \InvalidArgumentException(
'Invalid default value ' . $default
. ' with type ' . self::getType($default)
);
}
foreach ($fields as $field) {
$fieldBuilder = new FieldBuilder(
$builder,
[
'fieldName' => $field,
'type' => Type::BOOLEAN,
'default' => $default,
]
);
$fieldBuilder
->columnName(self::getColumnNameForField($field))
->nullable(null === $default)
->build();
}
} | [
"public",
"static",
"function",
"setSimpleBooleanFields",
"(",
"array",
"$",
"fields",
",",
"ClassMetadataBuilder",
"$",
"builder",
",",
"$",
"default",
"=",
"null",
")",
":",
"void",
"{",
"if",
"(",
"null",
"!==",
"$",
"default",
"&&",
"!",
"\\",
"is_bool... | Set bog standard boolean fields quickly in bulk
@param array $fields
@param ClassMetadataBuilder $builder
@param mixed $default
In this case the boolean argument is simply data
@SuppressWarnings(PHPMD.BooleanArgumentFlag) | [
"Set",
"bog",
"standard",
"boolean",
"fields",
"quickly",
"in",
"bulk"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/MappingHelper.php#L492-L517 | train |
edmondscommerce/doctrine-static-meta | src/MappingHelper.php | MappingHelper.setSimpleJsonFields | public static function setSimpleJsonFields(
array $fields,
ClassMetadataBuilder $builder,
$default = null
): void {
if (null !== $default && !\is_string($default)) {
throw new \InvalidArgumentException(
'Invalid default value ' . $default
. ' with type ' . self::getType($default)
);
}
foreach ($fields as $field) {
$fieldBuilder = new FieldBuilder(
$builder,
[
'fieldName' => $field,
'type' => Type::JSON,
'default' => $default,
]
);
$fieldBuilder
->columnName(self::getColumnNameForField($field))
->nullable(null === $default)
->build();
}
} | php | public static function setSimpleJsonFields(
array $fields,
ClassMetadataBuilder $builder,
$default = null
): void {
if (null !== $default && !\is_string($default)) {
throw new \InvalidArgumentException(
'Invalid default value ' . $default
. ' with type ' . self::getType($default)
);
}
foreach ($fields as $field) {
$fieldBuilder = new FieldBuilder(
$builder,
[
'fieldName' => $field,
'type' => Type::JSON,
'default' => $default,
]
);
$fieldBuilder
->columnName(self::getColumnNameForField($field))
->nullable(null === $default)
->build();
}
} | [
"public",
"static",
"function",
"setSimpleJsonFields",
"(",
"array",
"$",
"fields",
",",
"ClassMetadataBuilder",
"$",
"builder",
",",
"$",
"default",
"=",
"null",
")",
":",
"void",
"{",
"if",
"(",
"null",
"!==",
"$",
"default",
"&&",
"!",
"\\",
"is_string"... | Create JSON fields
Will use real JSON in the DB engine if it is supported
This should be used for any structured data, arrays, lists, simple objects
@param array $fields
@param ClassMetadataBuilder $builder
@param null $default | [
"Create",
"JSON",
"fields"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/MappingHelper.php#L530-L555 | train |
edmondscommerce/doctrine-static-meta | src/MappingHelper.php | MappingHelper.setSimpleFields | public static function setSimpleFields(
array $fieldToType,
ClassMetadataBuilder $builder
): void {
foreach ($fieldToType as $field => $type) {
$method = "setSimple$type" . 'fields';
static::$method([$field], $builder);
}
} | php | public static function setSimpleFields(
array $fieldToType,
ClassMetadataBuilder $builder
): void {
foreach ($fieldToType as $field => $type) {
$method = "setSimple$type" . 'fields';
static::$method([$field], $builder);
}
} | [
"public",
"static",
"function",
"setSimpleFields",
"(",
"array",
"$",
"fieldToType",
",",
"ClassMetadataBuilder",
"$",
"builder",
")",
":",
"void",
"{",
"foreach",
"(",
"$",
"fieldToType",
"as",
"$",
"field",
"=>",
"$",
"type",
")",
"{",
"$",
"method",
"="... | Bulk create multiple fields of different simple types
Always creates nullable fields, if you want to set a default, you must call the type based method
@param array $fieldToType [
'fieldName'=>'fieldSimpleType'
]
@param ClassMetadataBuilder $builder | [
"Bulk",
"create",
"multiple",
"fields",
"of",
"different",
"simple",
"types"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/MappingHelper.php#L567-L575 | train |
chameleon-system/chameleon-shop | src/ShopRatingServiceBundle/objects/db/TPkgShopRatingService.class.php | TPkgShopRatingService.GetInstanceFromSystemName | public static function GetInstanceFromSystemName($sSystemName)
{
$sQuery = "SELECT * FROM `pkg_shop_rating_service` WHERE `system_name` = '".MySqlLegacySupport::getInstance()->real_escape_string($sSystemName)."'";
$aData = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($sQuery));
if (is_array($aData)) {
$oInstance = TdbPkgShopRatingService::GetNewInstance($aData); // need to do this to morph to the correct subclass
} else {
$oInstance = null;
}
return $oInstance;
} | php | public static function GetInstanceFromSystemName($sSystemName)
{
$sQuery = "SELECT * FROM `pkg_shop_rating_service` WHERE `system_name` = '".MySqlLegacySupport::getInstance()->real_escape_string($sSystemName)."'";
$aData = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($sQuery));
if (is_array($aData)) {
$oInstance = TdbPkgShopRatingService::GetNewInstance($aData); // need to do this to morph to the correct subclass
} else {
$oInstance = null;
}
return $oInstance;
} | [
"public",
"static",
"function",
"GetInstanceFromSystemName",
"(",
"$",
"sSystemName",
")",
"{",
"$",
"sQuery",
"=",
"\"SELECT * FROM `pkg_shop_rating_service` WHERE `system_name` = '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"... | return the rating service via system name.
@static
@param string $sSystemName
@return TdbPkgShopRatingService | [
"return",
"the",
"rating",
"service",
"via",
"system",
"name",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopRatingServiceBundle/objects/db/TPkgShopRatingService.class.php#L23-L34 | train |
chameleon-system/chameleon-shop | src/ShopRatingServiceBundle/objects/db/TPkgShopRatingService.class.php | TPkgShopRatingService.GetNewInstance | public static function GetNewInstance($sData = null, $sLanguage = null)
{
$oObject = parent::GetNewInstance($sData, $sLanguage);
if ($oObject && !empty($oObject->fieldClass)) {
$aData = $oObject->sqlData;
$sClassName = $aData['class'];
$oObject = new $sClassName();
/** @var $oInterface TCMSInterfaceManagerBase */
$oObject->LoadFromRow($aData);
}
return $oObject;
} | php | public static function GetNewInstance($sData = null, $sLanguage = null)
{
$oObject = parent::GetNewInstance($sData, $sLanguage);
if ($oObject && !empty($oObject->fieldClass)) {
$aData = $oObject->sqlData;
$sClassName = $aData['class'];
$oObject = new $sClassName();
/** @var $oInterface TCMSInterfaceManagerBase */
$oObject->LoadFromRow($aData);
}
return $oObject;
} | [
"public",
"static",
"function",
"GetNewInstance",
"(",
"$",
"sData",
"=",
"null",
",",
"$",
"sLanguage",
"=",
"null",
")",
"{",
"$",
"oObject",
"=",
"parent",
"::",
"GetNewInstance",
"(",
"$",
"sData",
",",
"$",
"sLanguage",
")",
";",
"if",
"(",
"$",
... | Return new instance of "row-object".
factory creates a new instance and returns it.
@param string|array $sData - either the id of the object to load, or the row with which the instance should be initialized
@param string $sLanguage - init with the language passed
@return TdbPkgShopRatingService | [
"Return",
"new",
"instance",
"of",
"row",
"-",
"object",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopRatingServiceBundle/objects/db/TPkgShopRatingService.class.php#L45-L58 | train |
chameleon-system/chameleon-shop | src/ShopRatingServiceBundle/objects/db/TPkgShopRatingService.class.php | TPkgShopRatingService.Render | public function Render($sViewName = 'RatingService_standard', $sViewSubType = 'pkgShopRatingService/views', $sViewType = 'Customer', $sSpotName = null, $aCallTimeVars = array())
{
$sHTML = '';
$oView = new TViewParser();
/** @var $oView TViewParser */
//create view name for this "active" rating-service
if (!empty($this->fieldAffiliateValue)) {
$sViewName = $sViewName.'_'.trim($this->fieldAffiliateValue);
}
foreach ($aCallTimeVars as $sKeyName => $sValue) {
if (!empty($sKeyName)) {
$oView->AddVar($sKeyName, $sValue);
}
}
$sHTML .= $oView->RenderObjectPackageView($sViewName, $sViewSubType, $sViewType);
return $sHTML;
} | php | public function Render($sViewName = 'RatingService_standard', $sViewSubType = 'pkgShopRatingService/views', $sViewType = 'Customer', $sSpotName = null, $aCallTimeVars = array())
{
$sHTML = '';
$oView = new TViewParser();
/** @var $oView TViewParser */
//create view name for this "active" rating-service
if (!empty($this->fieldAffiliateValue)) {
$sViewName = $sViewName.'_'.trim($this->fieldAffiliateValue);
}
foreach ($aCallTimeVars as $sKeyName => $sValue) {
if (!empty($sKeyName)) {
$oView->AddVar($sKeyName, $sValue);
}
}
$sHTML .= $oView->RenderObjectPackageView($sViewName, $sViewSubType, $sViewType);
return $sHTML;
} | [
"public",
"function",
"Render",
"(",
"$",
"sViewName",
"=",
"'RatingService_standard'",
",",
"$",
"sViewSubType",
"=",
"'pkgShopRatingService/views'",
",",
"$",
"sViewType",
"=",
"'Customer'",
",",
"$",
"sSpotName",
"=",
"null",
",",
"$",
"aCallTimeVars",
"=",
"... | Render rating-widget for active rating-service.
@param string $sViewName
@param string $sViewSubType
@param string $sViewType
@param null $sSpotName
@param array $aCallTimeVars
@return string | [
"Render",
"rating",
"-",
"widget",
"for",
"active",
"rating",
"-",
"service",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopRatingServiceBundle/objects/db/TPkgShopRatingService.class.php#L71-L91 | train |
chameleon-system/chameleon-shop | src/ShopRatingServiceBundle/objects/db/TPkgShopRatingService.class.php | TPkgShopRatingService.UpdateMainScroeValue | protected function UpdateMainScroeValue()
{
$bRet = false;
$sQuery = " SELECT AVG( `score` ) AS main_score FROM `pkg_shop_rating_service_rating` WHERE `pkg_shop_rating_service_id` = '".$this->id."' ";
$rs = MySqlLegacySupport::getInstance()->query($sQuery);
if ($rs) {
$oAVG = MySqlLegacySupport::getInstance()->fetch_object($rs);
}
//Update value
if ($oAVG->main_score > 0) {
$sQuery = "UPDATE pkg_shop_rating_service SET current_rating = '".$oAVG->main_score."', current_rating_date = NOW() WHERE id = '".$this->id."' ";
MySqlLegacySupport::getInstance()->query($sQuery);
$bRet = $oAVG->main_score;
}
return $bRet;
} | php | protected function UpdateMainScroeValue()
{
$bRet = false;
$sQuery = " SELECT AVG( `score` ) AS main_score FROM `pkg_shop_rating_service_rating` WHERE `pkg_shop_rating_service_id` = '".$this->id."' ";
$rs = MySqlLegacySupport::getInstance()->query($sQuery);
if ($rs) {
$oAVG = MySqlLegacySupport::getInstance()->fetch_object($rs);
}
//Update value
if ($oAVG->main_score > 0) {
$sQuery = "UPDATE pkg_shop_rating_service SET current_rating = '".$oAVG->main_score."', current_rating_date = NOW() WHERE id = '".$this->id."' ";
MySqlLegacySupport::getInstance()->query($sQuery);
$bRet = $oAVG->main_score;
}
return $bRet;
} | [
"protected",
"function",
"UpdateMainScroeValue",
"(",
")",
"{",
"$",
"bRet",
"=",
"false",
";",
"$",
"sQuery",
"=",
"\" SELECT AVG( `score` ) AS main_score FROM `pkg_shop_rating_service_rating` WHERE `pkg_shop_rating_service_id` = '\"",
".",
"$",
"this",
"->",
"id",
".",
"\... | Update main score value of rating service - calculated from `pkg_shop_rating_service_rating`.`score`.
@return bool | [
"Update",
"main",
"score",
"value",
"of",
"rating",
"service",
"-",
"calculated",
"from",
"pkg_shop_rating_service_rating",
".",
"score",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopRatingServiceBundle/objects/db/TPkgShopRatingService.class.php#L108-L125 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopOrderStep/TShopStepUserDataV2EndPoint.class.php | TShopStepUserDataV2EndPoint.SetUserMode | public static function SetUserMode($sMode)
{
$aAllowedModes = array('register', 'user', 'guest');
if (false == in_array($sMode, $aAllowedModes)) {
trigger_error('invalid mode requested. please use one of '.implode(', ', $aAllowedModes), E_USER_ERROR);
}
$_SESSION['tw_order_umode'] = $sMode;
} | php | public static function SetUserMode($sMode)
{
$aAllowedModes = array('register', 'user', 'guest');
if (false == in_array($sMode, $aAllowedModes)) {
trigger_error('invalid mode requested. please use one of '.implode(', ', $aAllowedModes), E_USER_ERROR);
}
$_SESSION['tw_order_umode'] = $sMode;
} | [
"public",
"static",
"function",
"SetUserMode",
"(",
"$",
"sMode",
")",
"{",
"$",
"aAllowedModes",
"=",
"array",
"(",
"'register'",
",",
"'user'",
",",
"'guest'",
")",
";",
"if",
"(",
"false",
"==",
"in_array",
"(",
"$",
"sMode",
",",
"$",
"aAllowedModes"... | Set a user mode.
@static
@param string $sMode - must be one of register, user, or guest | [
"Set",
"a",
"user",
"mode",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrderStep/TShopStepUserDataV2EndPoint.class.php#L126-L133 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopOrderStep/TShopStepUserDataV2EndPoint.class.php | TShopStepUserDataV2EndPoint.GetUserMode | public static function GetUserMode()
{
$umode = 'register';
if (array_key_exists('tw_order_umode', $_SESSION)) {
$umode = $_SESSION['tw_order_umode'];
}
if ('user' != $umode) {
// check if the user is signed in... if so, we change the mode to user
$oUser = self::getExtranetUserProvider()->getActiveUser();
if ($oUser && $oUser->IsLoggedIn()) {
$umode = 'user';
TShopStepUserDataV2::SetUserMode($umode);
}
}
return $umode;
} | php | public static function GetUserMode()
{
$umode = 'register';
if (array_key_exists('tw_order_umode', $_SESSION)) {
$umode = $_SESSION['tw_order_umode'];
}
if ('user' != $umode) {
// check if the user is signed in... if so, we change the mode to user
$oUser = self::getExtranetUserProvider()->getActiveUser();
if ($oUser && $oUser->IsLoggedIn()) {
$umode = 'user';
TShopStepUserDataV2::SetUserMode($umode);
}
}
return $umode;
} | [
"public",
"static",
"function",
"GetUserMode",
"(",
")",
"{",
"$",
"umode",
"=",
"'register'",
";",
"if",
"(",
"array_key_exists",
"(",
"'tw_order_umode'",
",",
"$",
"_SESSION",
")",
")",
"{",
"$",
"umode",
"=",
"$",
"_SESSION",
"[",
"'tw_order_umode'",
"]... | return the current registration mode... if the user is logged in the mode will be forced to user.
@return string | [
"return",
"the",
"current",
"registration",
"mode",
"...",
"if",
"the",
"user",
"is",
"logged",
"in",
"the",
"mode",
"will",
"be",
"forced",
"to",
"user",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrderStep/TShopStepUserDataV2EndPoint.class.php#L140-L156 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopOrderStep/TShopStepUserDataV2EndPoint.class.php | TShopStepUserDataV2EndPoint.Init | public function Init()
{
parent::Init();
$this->bUserDataSubmission = false;
$this->InitUserData();
// primary address should be initialized first
if (TdbDataExtranetUserAddress::FORM_DATA_NAME_SHIPPING == $this->AddressUsedAsPrimaryAddress()) {
$this->InitShippingAddress();
$this->InitBillingAddress();
} else {
$this->InitBillingAddress();
$this->InitShippingAddress();
}
// change shipping to billing
$this->InitChangeShipToBillingState();
} | php | public function Init()
{
parent::Init();
$this->bUserDataSubmission = false;
$this->InitUserData();
// primary address should be initialized first
if (TdbDataExtranetUserAddress::FORM_DATA_NAME_SHIPPING == $this->AddressUsedAsPrimaryAddress()) {
$this->InitShippingAddress();
$this->InitBillingAddress();
} else {
$this->InitBillingAddress();
$this->InitShippingAddress();
}
// change shipping to billing
$this->InitChangeShipToBillingState();
} | [
"public",
"function",
"Init",
"(",
")",
"{",
"parent",
"::",
"Init",
"(",
")",
";",
"$",
"this",
"->",
"bUserDataSubmission",
"=",
"false",
";",
"$",
"this",
"->",
"InitUserData",
"(",
")",
";",
"// primary address should be initialized first",
"if",
"(",
"T... | we use the method to populate the state and user data. | [
"we",
"use",
"the",
"method",
"to",
"populate",
"the",
"state",
"and",
"user",
"data",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrderStep/TShopStepUserDataV2EndPoint.class.php#L161-L180 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.