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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
OXID-eSales/oxideshop_ce | source/Application/Model/Order.php | Order.getOrderSum | public function getOrderSum($blToday = false)
{
$sSelect = 'select sum(oxtotalordersum / oxcurrate) from oxorder where ';
$sSelect .= 'oxshopid = "' . \OxidEsales\Eshop\Core\Registry::getConfig()->getShopId() . '" and oxorder.oxstorno != "1" ';
if ($blToday) {
$sSelect .= 'and oxorderdate like "' . date('Y-m-d') . '%" ';
}
// We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804).
return ( double ) \OxidEsales\Eshop\Core\DatabaseProvider::getMaster()->getOne($sSelect);
} | php | public function getOrderSum($blToday = false)
{
$sSelect = 'select sum(oxtotalordersum / oxcurrate) from oxorder where ';
$sSelect .= 'oxshopid = "' . \OxidEsales\Eshop\Core\Registry::getConfig()->getShopId() . '" and oxorder.oxstorno != "1" ';
if ($blToday) {
$sSelect .= 'and oxorderdate like "' . date('Y-m-d') . '%" ';
}
// We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804).
return ( double ) \OxidEsales\Eshop\Core\DatabaseProvider::getMaster()->getOne($sSelect);
} | [
"public",
"function",
"getOrderSum",
"(",
"$",
"blToday",
"=",
"false",
")",
"{",
"$",
"sSelect",
"=",
"'select sum(oxtotalordersum / oxcurrate) from oxorder where '",
";",
"$",
"sSelect",
".=",
"'oxshopid = \"'",
".",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core"... | Returns orders total price
@param bool $blToday if true calculates only current day orders
@return double | [
"Returns",
"orders",
"total",
"price"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Order.php#L1610-L1621 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Order.php | Order.getOrderCnt | public function getOrderCnt($blToday = false)
{
$sSelect = 'select count(*) from oxorder where ';
$sSelect .= 'oxshopid = "' . \OxidEsales\Eshop\Core\Registry::getConfig()->getShopId() . '" and oxorder.oxstorno != "1" ';
if ($blToday) {
$sSelect .= 'and oxorderdate like "' . date('Y-m-d') . '%" ';
}
// We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804).
return ( int ) \OxidEsales\Eshop\Core\DatabaseProvider::getMaster()->getOne($sSelect);
} | php | public function getOrderCnt($blToday = false)
{
$sSelect = 'select count(*) from oxorder where ';
$sSelect .= 'oxshopid = "' . \OxidEsales\Eshop\Core\Registry::getConfig()->getShopId() . '" and oxorder.oxstorno != "1" ';
if ($blToday) {
$sSelect .= 'and oxorderdate like "' . date('Y-m-d') . '%" ';
}
// We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804).
return ( int ) \OxidEsales\Eshop\Core\DatabaseProvider::getMaster()->getOne($sSelect);
} | [
"public",
"function",
"getOrderCnt",
"(",
"$",
"blToday",
"=",
"false",
")",
"{",
"$",
"sSelect",
"=",
"'select count(*) from oxorder where '",
";",
"$",
"sSelect",
".=",
"'oxshopid = \"'",
".",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
... | Returns orders count
@param bool $blToday if true calculates only current day orders
@return int | [
"Returns",
"orders",
"count"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Order.php#L1630-L1641 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Order.php | Order._checkOrderExist | protected function _checkOrderExist($sOxId = null)
{
if (!$sOxId) {
return false;
}
// We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804).
$masterDb = \OxidEsales\Eshop\Core\DatabaseProvider::getMaster();
if ($masterDb->getOne('select oxid from oxorder where oxid = ' . $masterDb->quote($sOxId))) {
return true;
}
return false;
} | php | protected function _checkOrderExist($sOxId = null)
{
if (!$sOxId) {
return false;
}
// We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804).
$masterDb = \OxidEsales\Eshop\Core\DatabaseProvider::getMaster();
if ($masterDb->getOne('select oxid from oxorder where oxid = ' . $masterDb->quote($sOxId))) {
return true;
}
return false;
} | [
"protected",
"function",
"_checkOrderExist",
"(",
"$",
"sOxId",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"sOxId",
")",
"{",
"return",
"false",
";",
"}",
"// We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804).",
"... | Checking if this order is already stored.
@param string $sOxId order ID
@return bool | [
"Checking",
"if",
"this",
"order",
"is",
"already",
"stored",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Order.php#L1651-L1664 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Order.php | Order._sendOrderByEmail | protected function _sendOrderByEmail($oUser = null, $oBasket = null, $oPayment = null)
{
$iRet = self::ORDER_STATE_MAILINGERROR;
// add user, basket and payment to order
$this->_oUser = $oUser;
$this->_oBasket = $oBasket;
$this->_oPayment = $oPayment;
$oxEmail = oxNew(\OxidEsales\Eshop\Core\Email::class);
// send order email to user
if ($oxEmail->sendOrderEMailToUser($this)) {
// mail to user was successfully sent
$iRet = self::ORDER_STATE_OK;
}
// send order email to shop owner
$oxEmail->sendOrderEMailToOwner($this);
return $iRet;
} | php | protected function _sendOrderByEmail($oUser = null, $oBasket = null, $oPayment = null)
{
$iRet = self::ORDER_STATE_MAILINGERROR;
// add user, basket and payment to order
$this->_oUser = $oUser;
$this->_oBasket = $oBasket;
$this->_oPayment = $oPayment;
$oxEmail = oxNew(\OxidEsales\Eshop\Core\Email::class);
// send order email to user
if ($oxEmail->sendOrderEMailToUser($this)) {
// mail to user was successfully sent
$iRet = self::ORDER_STATE_OK;
}
// send order email to shop owner
$oxEmail->sendOrderEMailToOwner($this);
return $iRet;
} | [
"protected",
"function",
"_sendOrderByEmail",
"(",
"$",
"oUser",
"=",
"null",
",",
"$",
"oBasket",
"=",
"null",
",",
"$",
"oPayment",
"=",
"null",
")",
"{",
"$",
"iRet",
"=",
"self",
"::",
"ORDER_STATE_MAILINGERROR",
";",
"// add user, basket and payment to orde... | Send order to shop owner and user
@param \OxidEsales\Eshop\Application\Model\User $oUser order user
@param \OxidEsales\Eshop\Application\Model\Basket $oBasket current order basket
@param \OxidEsales\Eshop\Application\Model\UserPayment $oPayment order payment
@return bool | [
"Send",
"order",
"to",
"shop",
"owner",
"and",
"user"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Order.php#L1675-L1696 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Order.php | Order.getDelSet | public function getDelSet()
{
if ($this->_oDelSet == null) {
// load deliveryset info
$this->_oDelSet = oxNew(\OxidEsales\Eshop\Application\Model\DeliverySet::class);
$this->_oDelSet->load($this->oxorder__oxdeltype->value);
}
return $this->_oDelSet;
} | php | public function getDelSet()
{
if ($this->_oDelSet == null) {
// load deliveryset info
$this->_oDelSet = oxNew(\OxidEsales\Eshop\Application\Model\DeliverySet::class);
$this->_oDelSet->load($this->oxorder__oxdeltype->value);
}
return $this->_oDelSet;
} | [
"public",
"function",
"getDelSet",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_oDelSet",
"==",
"null",
")",
"{",
"// load deliveryset info",
"$",
"this",
"->",
"_oDelSet",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Application",
"\\",
... | Returns order deliveryset object
@return oxDeliverySet | [
"Returns",
"order",
"deliveryset",
"object"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Order.php#L1733-L1742 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Order.php | Order.getPaymentType | public function getPaymentType()
{
if ($this->oxorder__oxpaymentid->value && $this->_oPaymentType === null) {
$this->_oPaymentType = false;
$oPaymentType = oxNew(\OxidEsales\Eshop\Application\Model\UserPayment::class);
if ($oPaymentType->load($this->oxorder__oxpaymentid->value)) {
$this->_oPaymentType = $oPaymentType;
}
}
return $this->_oPaymentType;
} | php | public function getPaymentType()
{
if ($this->oxorder__oxpaymentid->value && $this->_oPaymentType === null) {
$this->_oPaymentType = false;
$oPaymentType = oxNew(\OxidEsales\Eshop\Application\Model\UserPayment::class);
if ($oPaymentType->load($this->oxorder__oxpaymentid->value)) {
$this->_oPaymentType = $oPaymentType;
}
}
return $this->_oPaymentType;
} | [
"public",
"function",
"getPaymentType",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"oxorder__oxpaymentid",
"->",
"value",
"&&",
"$",
"this",
"->",
"_oPaymentType",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"_oPaymentType",
"=",
"false",
";",
"$",
"oP... | Get payment type
@return \OxidEsales\Eshop\Application\Model\UserPayment | [
"Get",
"payment",
"type"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Order.php#L1749-L1760 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Order.php | Order.getGiftCard | public function getGiftCard()
{
if ($this->oxorder__oxcardid->value && $this->_oGiftCard == null) {
$this->_oGiftCard = oxNew(\OxidEsales\Eshop\Application\Model\Wrapping::class);
$this->_oGiftCard->load($this->oxorder__oxcardid->value);
}
return $this->_oGiftCard;
} | php | public function getGiftCard()
{
if ($this->oxorder__oxcardid->value && $this->_oGiftCard == null) {
$this->_oGiftCard = oxNew(\OxidEsales\Eshop\Application\Model\Wrapping::class);
$this->_oGiftCard->load($this->oxorder__oxcardid->value);
}
return $this->_oGiftCard;
} | [
"public",
"function",
"getGiftCard",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"oxorder__oxcardid",
"->",
"value",
"&&",
"$",
"this",
"->",
"_oGiftCard",
"==",
"null",
")",
"{",
"$",
"this",
"->",
"_oGiftCard",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
... | Get gift card
@return oxWrapping | [
"Get",
"gift",
"card"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Order.php#L1767-L1775 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Order.php | Order.getLastUserPaymentType | public function getLastUserPaymentType($sUserId)
{
// We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804).
$masterDb = \OxidEsales\Eshop\Core\DatabaseProvider::getMaster();
$sQ = 'select oxorder.oxpaymenttype from oxorder where oxorder.oxshopid="' . \OxidEsales\Eshop\Core\Registry::getConfig()->getShopId() . '" and oxorder.oxuserid=' . $masterDb->quote($sUserId) . ' order by oxorder.oxorderdate desc ';
$sLastPaymentId = $masterDb->getOne($sQ);
return $sLastPaymentId;
} | php | public function getLastUserPaymentType($sUserId)
{
// We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804).
$masterDb = \OxidEsales\Eshop\Core\DatabaseProvider::getMaster();
$sQ = 'select oxorder.oxpaymenttype from oxorder where oxorder.oxshopid="' . \OxidEsales\Eshop\Core\Registry::getConfig()->getShopId() . '" and oxorder.oxuserid=' . $masterDb->quote($sUserId) . ' order by oxorder.oxorderdate desc ';
$sLastPaymentId = $masterDb->getOne($sQ);
return $sLastPaymentId;
} | [
"public",
"function",
"getLastUserPaymentType",
"(",
"$",
"sUserId",
")",
"{",
"// We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804).",
"$",
"masterDb",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Databa... | Get users payment type from last order
@param string $sUserId order user id
@return string $sLastPaymentId payment id | [
"Get",
"users",
"payment",
"type",
"from",
"last",
"order"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Order.php#L1794-L1802 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Order.php | Order._addOrderArticlesToBasket | protected function _addOrderArticlesToBasket($oBasket, $aOrderArticles)
{
// if no order articles, return empty basket
if (count($aOrderArticles) > 0) {
//adding order articles to basket
foreach ($aOrderArticles as $oOrderArticle) {
$oBasket->addOrderArticleToBasket($oOrderArticle);
}
}
} | php | protected function _addOrderArticlesToBasket($oBasket, $aOrderArticles)
{
// if no order articles, return empty basket
if (count($aOrderArticles) > 0) {
//adding order articles to basket
foreach ($aOrderArticles as $oOrderArticle) {
$oBasket->addOrderArticleToBasket($oOrderArticle);
}
}
} | [
"protected",
"function",
"_addOrderArticlesToBasket",
"(",
"$",
"oBasket",
",",
"$",
"aOrderArticles",
")",
"{",
"// if no order articles, return empty basket",
"if",
"(",
"count",
"(",
"$",
"aOrderArticles",
")",
">",
"0",
")",
"{",
"//adding order articles to basket",... | Adds order articles back to virtual basket. Needed for recalculating order.
@param \OxidEsales\Eshop\Application\Model\Basket $oBasket basket object
@param array $aOrderArticles order articles | [
"Adds",
"order",
"articles",
"back",
"to",
"virtual",
"basket",
".",
"Needed",
"for",
"recalculating",
"order",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Order.php#L1810-L1819 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Order.php | Order.getTotalOrderSum | public function getTotalOrderSum()
{
$oCur = \OxidEsales\Eshop\Core\Registry::getConfig()->getActShopCurrencyObject();
return number_format((double) $this->oxorder__oxtotalordersum->value, $oCur->decimal, '.', '');
} | php | public function getTotalOrderSum()
{
$oCur = \OxidEsales\Eshop\Core\Registry::getConfig()->getActShopCurrencyObject();
return number_format((double) $this->oxorder__oxtotalordersum->value, $oCur->decimal, '.', '');
} | [
"public",
"function",
"getTotalOrderSum",
"(",
")",
"{",
"$",
"oCur",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
"getActShopCurrencyObject",
"(",
")",
";",
"return",
"number_format",
"(",
"(",
... | Get total sum from last order
@return string | [
"Get",
"total",
"sum",
"from",
"last",
"order"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Order.php#L1850-L1855 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Order.php | Order.getProductVats | public function getProductVats($blFormatCurrency = true)
{
$aVats = [];
if ($this->oxorder__oxartvat1->value) {
$aVats[$this->oxorder__oxartvat1->value] = $this->oxorder__oxartvatprice1->value;
}
if ($this->oxorder__oxartvat2->value) {
$aVats[$this->oxorder__oxartvat2->value] = $this->oxorder__oxartvatprice2->value;
}
if ($blFormatCurrency) {
$oLang = \OxidEsales\Eshop\Core\Registry::getLang();
$oCur = \OxidEsales\Eshop\Core\Registry::getConfig()->getActShopCurrencyObject();
foreach ($aVats as $sKey => $dVat) {
$aVats[$sKey] = $oLang->formatCurrency($dVat, $oCur);
}
}
return $aVats;
} | php | public function getProductVats($blFormatCurrency = true)
{
$aVats = [];
if ($this->oxorder__oxartvat1->value) {
$aVats[$this->oxorder__oxartvat1->value] = $this->oxorder__oxartvatprice1->value;
}
if ($this->oxorder__oxartvat2->value) {
$aVats[$this->oxorder__oxartvat2->value] = $this->oxorder__oxartvatprice2->value;
}
if ($blFormatCurrency) {
$oLang = \OxidEsales\Eshop\Core\Registry::getLang();
$oCur = \OxidEsales\Eshop\Core\Registry::getConfig()->getActShopCurrencyObject();
foreach ($aVats as $sKey => $dVat) {
$aVats[$sKey] = $oLang->formatCurrency($dVat, $oCur);
}
}
return $aVats;
} | [
"public",
"function",
"getProductVats",
"(",
"$",
"blFormatCurrency",
"=",
"true",
")",
"{",
"$",
"aVats",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"oxorder__oxartvat1",
"->",
"value",
")",
"{",
"$",
"aVats",
"[",
"$",
"this",
"->",
"oxorder__... | Returns array of plain formatted VATs stored in order
@param bool $blFormatCurrency enables currency formatting
@return array | [
"Returns",
"array",
"of",
"plain",
"formatted",
"VATs",
"stored",
"in",
"order"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Order.php#L1864-L1883 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Order.php | Order.getBillCountry | public function getBillCountry()
{
if (!$this->oxorder__oxbillcountry->value) {
$this->oxorder__oxbillcountry = new \OxidEsales\Eshop\Core\Field($this->_getCountryTitle($this->oxorder__oxbillcountryid->value));
}
return $this->oxorder__oxbillcountry;
} | php | public function getBillCountry()
{
if (!$this->oxorder__oxbillcountry->value) {
$this->oxorder__oxbillcountry = new \OxidEsales\Eshop\Core\Field($this->_getCountryTitle($this->oxorder__oxbillcountryid->value));
}
return $this->oxorder__oxbillcountry;
} | [
"public",
"function",
"getBillCountry",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"oxorder__oxbillcountry",
"->",
"value",
")",
"{",
"$",
"this",
"->",
"oxorder__oxbillcountry",
"=",
"new",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Fi... | Get billing country name from billing country id
@return oxField | [
"Get",
"billing",
"country",
"name",
"from",
"billing",
"country",
"id"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Order.php#L1890-L1897 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Order.php | Order.getDelCountry | public function getDelCountry()
{
if (!$this->oxorder__oxdelcountry->value) {
$this->oxorder__oxdelcountry = new \OxidEsales\Eshop\Core\Field($this->_getCountryTitle($this->oxorder__oxdelcountryid->value));
}
return $this->oxorder__oxdelcountry;
} | php | public function getDelCountry()
{
if (!$this->oxorder__oxdelcountry->value) {
$this->oxorder__oxdelcountry = new \OxidEsales\Eshop\Core\Field($this->_getCountryTitle($this->oxorder__oxdelcountryid->value));
}
return $this->oxorder__oxdelcountry;
} | [
"public",
"function",
"getDelCountry",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"oxorder__oxdelcountry",
"->",
"value",
")",
"{",
"$",
"this",
"->",
"oxorder__oxdelcountry",
"=",
"new",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Field... | Get delivery country name from delivery country id
@return oxField | [
"Get",
"delivery",
"country",
"name",
"from",
"delivery",
"country",
"id"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Order.php#L1904-L1911 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Order.php | Order.cancelOrder | public function cancelOrder()
{
$this->oxorder__oxstorno = new \OxidEsales\Eshop\Core\Field(1);
if ($this->save()) {
// canceling ordered products
foreach ($this->getOrderArticles() as $oOrderArticle) {
$oOrderArticle->cancelOrderArticle();
}
}
} | php | public function cancelOrder()
{
$this->oxorder__oxstorno = new \OxidEsales\Eshop\Core\Field(1);
if ($this->save()) {
// canceling ordered products
foreach ($this->getOrderArticles() as $oOrderArticle) {
$oOrderArticle->cancelOrderArticle();
}
}
} | [
"public",
"function",
"cancelOrder",
"(",
")",
"{",
"$",
"this",
"->",
"oxorder__oxstorno",
"=",
"new",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Field",
"(",
"1",
")",
";",
"if",
"(",
"$",
"this",
"->",
"save",
"(",
")",
")",
"{",
"/... | Performs order cancel process | [
"Performs",
"order",
"cancel",
"process"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Order.php#L1936-L1945 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Order.php | Order.getOrderCurrency | public function getOrderCurrency()
{
if ($this->_oOrderCurrency === null) {
// setting default in case unrecognized currency was set during order
$aCurrencies = \OxidEsales\Eshop\Core\Registry::getConfig()->getCurrencyArray();
$this->_oOrderCurrency = current($aCurrencies);
foreach ($aCurrencies as $oCurr) {
if ($oCurr->name == $this->oxorder__oxcurrency->value) {
$this->_oOrderCurrency = $oCurr;
break;
}
}
}
return $this->_oOrderCurrency;
} | php | public function getOrderCurrency()
{
if ($this->_oOrderCurrency === null) {
// setting default in case unrecognized currency was set during order
$aCurrencies = \OxidEsales\Eshop\Core\Registry::getConfig()->getCurrencyArray();
$this->_oOrderCurrency = current($aCurrencies);
foreach ($aCurrencies as $oCurr) {
if ($oCurr->name == $this->oxorder__oxcurrency->value) {
$this->_oOrderCurrency = $oCurr;
break;
}
}
}
return $this->_oOrderCurrency;
} | [
"public",
"function",
"getOrderCurrency",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_oOrderCurrency",
"===",
"null",
")",
"{",
"// setting default in case unrecognized currency was set during order",
"$",
"aCurrencies",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\"... | Returns actual order currency object. In case currency was not recognized
due to changed name returns first shop currency object
@return stdClass | [
"Returns",
"actual",
"order",
"currency",
"object",
".",
"In",
"case",
"currency",
"was",
"not",
"recognized",
"due",
"to",
"changed",
"name",
"returns",
"first",
"shop",
"currency",
"object"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Order.php#L1953-L1969 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Order.php | Order.validateOrder | public function validateOrder($oBasket, $oUser)
{
// validating stock
$iValidState = $this->validateStock($oBasket);
if (!$iValidState) {
// validating delivery
$iValidState = $this->validateDelivery($oBasket);
}
if (!$iValidState) {
// validating payment
$iValidState = $this->validatePayment($oBasket);
}
if (!$iValidState) {
//0003110 validating delivery address, it is not be changed during checkout process
$iValidState = $this->validateDeliveryAddress($oUser);
}
if (!$iValidState) {
// validating minimum price
$iValidState = $this->validateBasket($oBasket);
}
return $iValidState;
} | php | public function validateOrder($oBasket, $oUser)
{
// validating stock
$iValidState = $this->validateStock($oBasket);
if (!$iValidState) {
// validating delivery
$iValidState = $this->validateDelivery($oBasket);
}
if (!$iValidState) {
// validating payment
$iValidState = $this->validatePayment($oBasket);
}
if (!$iValidState) {
//0003110 validating delivery address, it is not be changed during checkout process
$iValidState = $this->validateDeliveryAddress($oUser);
}
if (!$iValidState) {
// validating minimum price
$iValidState = $this->validateBasket($oBasket);
}
return $iValidState;
} | [
"public",
"function",
"validateOrder",
"(",
"$",
"oBasket",
",",
"$",
"oUser",
")",
"{",
"// validating stock",
"$",
"iValidState",
"=",
"$",
"this",
"->",
"validateStock",
"(",
"$",
"oBasket",
")",
";",
"if",
"(",
"!",
"$",
"iValidState",
")",
"{",
"// ... | Validates order parameters like stock, delivery and payment
parameters
@param \OxidEsales\Eshop\Application\Model\Basket $oBasket basket object
@param \OxidEsales\Eshop\Application\Model\User $oUser order user
@return null | [
"Validates",
"order",
"parameters",
"like",
"stock",
"delivery",
"and",
"payment",
"parameters"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Order.php#L1980-L2006 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Order.php | Order.validatePayment | public function validatePayment($oBasket)
{
$paymentId = $oBasket->getPaymentId();
if (!$this->isValidPaymentId($paymentId) || !$this->isValidPayment($oBasket)) {
return self::ORDER_STATE_INVALIDPAYMENT;
}
} | php | public function validatePayment($oBasket)
{
$paymentId = $oBasket->getPaymentId();
if (!$this->isValidPaymentId($paymentId) || !$this->isValidPayment($oBasket)) {
return self::ORDER_STATE_INVALIDPAYMENT;
}
} | [
"public",
"function",
"validatePayment",
"(",
"$",
"oBasket",
")",
"{",
"$",
"paymentId",
"=",
"$",
"oBasket",
"->",
"getPaymentId",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"isValidPaymentId",
"(",
"$",
"paymentId",
")",
"||",
"!",
"$",
"this... | Checks if payment used for current order is available and active.
Throws exception if not available
@param \OxidEsales\Eshop\Application\Model\Basket $oBasket basket object
@return null | [
"Checks",
"if",
"payment",
"used",
"for",
"current",
"order",
"is",
"available",
"and",
"active",
".",
"Throws",
"exception",
"if",
"not",
"available"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Order.php#L2099-L2106 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Order.php | Order.getFormattedTotalNetSum | public function getFormattedTotalNetSum()
{
return \OxidEsales\Eshop\Core\Registry::getLang()->formatCurrency($this->oxorder__oxtotalnetsum->value, $this->getOrderCurrency());
} | php | public function getFormattedTotalNetSum()
{
return \OxidEsales\Eshop\Core\Registry::getLang()->formatCurrency($this->oxorder__oxtotalnetsum->value, $this->getOrderCurrency());
} | [
"public",
"function",
"getFormattedTotalNetSum",
"(",
")",
"{",
"return",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getLang",
"(",
")",
"->",
"formatCurrency",
"(",
"$",
"this",
"->",
"oxorder__oxtotalnetsum",
"->",
"value",
","... | Get total net sum formatted
@return string | [
"Get",
"total",
"net",
"sum",
"formatted"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Order.php#L2113-L2116 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Order.php | Order.getFormattedTotalBrutSum | public function getFormattedTotalBrutSum()
{
return \OxidEsales\Eshop\Core\Registry::getLang()->formatCurrency($this->oxorder__oxtotalbrutsum->value, $this->getOrderCurrency());
} | php | public function getFormattedTotalBrutSum()
{
return \OxidEsales\Eshop\Core\Registry::getLang()->formatCurrency($this->oxorder__oxtotalbrutsum->value, $this->getOrderCurrency());
} | [
"public",
"function",
"getFormattedTotalBrutSum",
"(",
")",
"{",
"return",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getLang",
"(",
")",
"->",
"formatCurrency",
"(",
"$",
"this",
"->",
"oxorder__oxtotalbrutsum",
"->",
"value",
"... | Get total brut sum formatted
@return string | [
"Get",
"total",
"brut",
"sum",
"formatted"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Order.php#L2123-L2126 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Order.php | Order.getFormattedDeliveryCost | public function getFormattedDeliveryCost()
{
return \OxidEsales\Eshop\Core\Registry::getLang()->formatCurrency($this->oxorder__oxdelcost->value, $this->getOrderCurrency());
} | php | public function getFormattedDeliveryCost()
{
return \OxidEsales\Eshop\Core\Registry::getLang()->formatCurrency($this->oxorder__oxdelcost->value, $this->getOrderCurrency());
} | [
"public",
"function",
"getFormattedDeliveryCost",
"(",
")",
"{",
"return",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getLang",
"(",
")",
"->",
"formatCurrency",
"(",
"$",
"this",
"->",
"oxorder__oxdelcost",
"->",
"value",
",",
... | Get Delivery cost sum formatted
@return string | [
"Get",
"Delivery",
"cost",
"sum",
"formatted"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Order.php#L2133-L2136 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Order.php | Order.getFormattedPayCost | public function getFormattedPayCost()
{
return \OxidEsales\Eshop\Core\Registry::getLang()->formatCurrency($this->oxorder__oxpaycost->value, $this->getOrderCurrency());
} | php | public function getFormattedPayCost()
{
return \OxidEsales\Eshop\Core\Registry::getLang()->formatCurrency($this->oxorder__oxpaycost->value, $this->getOrderCurrency());
} | [
"public",
"function",
"getFormattedPayCost",
"(",
")",
"{",
"return",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getLang",
"(",
")",
"->",
"formatCurrency",
"(",
"$",
"this",
"->",
"oxorder__oxpaycost",
"->",
"value",
",",
"$",... | Get pay cost sum formatted
@return string | [
"Get",
"pay",
"cost",
"sum",
"formatted"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Order.php#L2155-L2158 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Order.php | Order.getFormattedTotalVouchers | public function getFormattedTotalVouchers()
{
return \OxidEsales\Eshop\Core\Registry::getLang()->formatCurrency($this->oxorder__oxvoucherdiscount->value, $this->getOrderCurrency());
} | php | public function getFormattedTotalVouchers()
{
return \OxidEsales\Eshop\Core\Registry::getLang()->formatCurrency($this->oxorder__oxvoucherdiscount->value, $this->getOrderCurrency());
} | [
"public",
"function",
"getFormattedTotalVouchers",
"(",
")",
"{",
"return",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getLang",
"(",
")",
"->",
"formatCurrency",
"(",
"$",
"this",
"->",
"oxorder__oxvoucherdiscount",
"->",
"value",... | Get total vouchers formatted
@return string | [
"Get",
"total",
"vouchers",
"formatted"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Order.php#L2185-L2188 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Order.php | Order.getFormattedDiscount | public function getFormattedDiscount()
{
return \OxidEsales\Eshop\Core\Registry::getLang()->formatCurrency($this->oxorder__oxdiscount->value, $this->getOrderCurrency());
} | php | public function getFormattedDiscount()
{
return \OxidEsales\Eshop\Core\Registry::getLang()->formatCurrency($this->oxorder__oxdiscount->value, $this->getOrderCurrency());
} | [
"public",
"function",
"getFormattedDiscount",
"(",
")",
"{",
"return",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getLang",
"(",
")",
"->",
"formatCurrency",
"(",
"$",
"this",
"->",
"oxorder__oxdiscount",
"->",
"value",
",",
"$... | Get Discount formatted
@return string | [
"Get",
"Discount",
"formatted"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Order.php#L2195-L2198 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Order.php | Order.getFormattedTotalOrderSum | public function getFormattedTotalOrderSum()
{
return \OxidEsales\Eshop\Core\Registry::getLang()->formatCurrency($this->oxorder__oxtotalordersum->value, $this->getOrderCurrency());
} | php | public function getFormattedTotalOrderSum()
{
return \OxidEsales\Eshop\Core\Registry::getLang()->formatCurrency($this->oxorder__oxtotalordersum->value, $this->getOrderCurrency());
} | [
"public",
"function",
"getFormattedTotalOrderSum",
"(",
")",
"{",
"return",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getLang",
"(",
")",
"->",
"formatCurrency",
"(",
"$",
"this",
"->",
"oxorder__oxtotalordersum",
"->",
"value",
... | Get formatted total sum from last order
@return string | [
"Get",
"formatted",
"total",
"sum",
"from",
"last",
"order"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Order.php#L2205-L2208 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Order.php | Order.getShipmentTrackingUrl | public function getShipmentTrackingUrl()
{
$oConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
if ($this->_sShipTrackUrl === null) {
$sParcelService = $oConfig->getConfigParam('sParcelService');
$sTrackingCode = $this->getTrackCode();
if ($sParcelService && $sTrackingCode) {
$this->_sShipTrackUrl = str_replace("##ID##", $sTrackingCode, $sParcelService);
}
}
return $this->_sShipTrackUrl;
} | php | public function getShipmentTrackingUrl()
{
$oConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
if ($this->_sShipTrackUrl === null) {
$sParcelService = $oConfig->getConfigParam('sParcelService');
$sTrackingCode = $this->getTrackCode();
if ($sParcelService && $sTrackingCode) {
$this->_sShipTrackUrl = str_replace("##ID##", $sTrackingCode, $sParcelService);
}
}
return $this->_sShipTrackUrl;
} | [
"public",
"function",
"getShipmentTrackingUrl",
"(",
")",
"{",
"$",
"oConfig",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"_sShipTrackUrl",
"===",
"null",
")",
"... | Returns shipment tracking url if oxtrackcode and shipment tracking url are supplied
@return string | [
"Returns",
"shipment",
"tracking",
"url",
"if",
"oxtrackcode",
"and",
"shipment",
"tracking",
"url",
"are",
"supplied"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Order.php#L2225-L2237 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Order.php | Order.isValidPaymentId | private function isValidPaymentId($paymentId)
{
// We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804).
$masterDb = DatabaseProvider::getMaster();
$paymentModel = oxNew(EshopPayment::class);
$tableName = $paymentModel->getViewName();
$sql = "
select
1
from
{$tableName}
where
{$tableName}.oxid = {$masterDb->quote($paymentId)}
and {$paymentModel->getSqlActiveSnippet()}
";
return (bool) $masterDb->getOne($sql);
} | php | private function isValidPaymentId($paymentId)
{
// We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804).
$masterDb = DatabaseProvider::getMaster();
$paymentModel = oxNew(EshopPayment::class);
$tableName = $paymentModel->getViewName();
$sql = "
select
1
from
{$tableName}
where
{$tableName}.oxid = {$masterDb->quote($paymentId)}
and {$paymentModel->getSqlActiveSnippet()}
";
return (bool) $masterDb->getOne($sql);
} | [
"private",
"function",
"isValidPaymentId",
"(",
"$",
"paymentId",
")",
"{",
"// We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804).",
"$",
"masterDb",
"=",
"DatabaseProvider",
"::",
"getMaster",
"(",
")",
";",
"$",
"payme... | Returns true if paymentId is valid.
@param int $paymentId
@return bool | [
"Returns",
"true",
"if",
"paymentId",
"is",
"valid",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Order.php#L2246-L2265 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Order.php | Order.isValidPayment | private function isValidPayment($basket)
{
$paymentId = $basket->getPaymentId();
$paymentModel = oxNew(EshopPayment::class);
$paymentModel->load($paymentId);
$dynamicValues = $this->getDynamicValues();
$shopId = \OxidEsales\Eshop\Core\Registry::getConfig()->getShopId();
return $paymentModel->isValidPayment(
$dynamicValues,
$shopId,
$this->getUser(),
$basket->getPriceForPayment(),
$basket->getShippingId()
);
} | php | private function isValidPayment($basket)
{
$paymentId = $basket->getPaymentId();
$paymentModel = oxNew(EshopPayment::class);
$paymentModel->load($paymentId);
$dynamicValues = $this->getDynamicValues();
$shopId = \OxidEsales\Eshop\Core\Registry::getConfig()->getShopId();
return $paymentModel->isValidPayment(
$dynamicValues,
$shopId,
$this->getUser(),
$basket->getPriceForPayment(),
$basket->getShippingId()
);
} | [
"private",
"function",
"isValidPayment",
"(",
"$",
"basket",
")",
"{",
"$",
"paymentId",
"=",
"$",
"basket",
"->",
"getPaymentId",
"(",
")",
";",
"$",
"paymentModel",
"=",
"oxNew",
"(",
"EshopPayment",
"::",
"class",
")",
";",
"$",
"paymentModel",
"->",
... | Returns true if payment is valid.
@param \OxidEsales\Eshop\Application\Model\Basket $basket
@return bool | [
"Returns",
"true",
"if",
"payment",
"is",
"valid",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Order.php#L2274-L2290 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Address.php | Address.toString | public function toString()
{
$sFirstName = $this->oxaddress__oxfname->value;
$sLastName = $this->oxaddress__oxlname->value;
$sStreet = $this->oxaddress__oxstreet->value;
$sStreetNr = $this->oxaddress__oxstreetnr->value;
$sCity = $this->oxaddress__oxcity->value;
//format it
$sAddress = "";
if ($sFirstName || $sLastName) {
$sAddress = $sFirstName . ($sFirstName ? " " : "") . "$sLastName, ";
}
$sAddress .= "$sStreet $sStreetNr, $sCity";
return trim($sAddress);
} | php | public function toString()
{
$sFirstName = $this->oxaddress__oxfname->value;
$sLastName = $this->oxaddress__oxlname->value;
$sStreet = $this->oxaddress__oxstreet->value;
$sStreetNr = $this->oxaddress__oxstreetnr->value;
$sCity = $this->oxaddress__oxcity->value;
//format it
$sAddress = "";
if ($sFirstName || $sLastName) {
$sAddress = $sFirstName . ($sFirstName ? " " : "") . "$sLastName, ";
}
$sAddress .= "$sStreet $sStreetNr, $sCity";
return trim($sAddress);
} | [
"public",
"function",
"toString",
"(",
")",
"{",
"$",
"sFirstName",
"=",
"$",
"this",
"->",
"oxaddress__oxfname",
"->",
"value",
";",
"$",
"sLastName",
"=",
"$",
"this",
"->",
"oxaddress__oxlname",
"->",
"value",
";",
"$",
"sStreet",
"=",
"$",
"this",
"-... | Formats address as a single line string
@return string | [
"Formats",
"address",
"as",
"a",
"single",
"line",
"string"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Address.php#L71-L87 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Address.php | Address._getMergedAddressFields | protected function _getMergedAddressFields()
{
$sDelAddress = '';
$sDelAddress .= $this->oxaddress__oxcompany;
$sDelAddress .= $this->oxaddress__oxfname;
$sDelAddress .= $this->oxaddress__oxlname;
$sDelAddress .= $this->oxaddress__oxstreet;
$sDelAddress .= $this->oxaddress__oxstreetnr;
$sDelAddress .= $this->oxaddress__oxaddinfo;
$sDelAddress .= $this->oxaddress__oxcity;
$sDelAddress .= $this->oxaddress__oxcountryid;
$sDelAddress .= $this->oxaddress__oxstateid;
$sDelAddress .= $this->oxaddress__oxzip;
$sDelAddress .= $this->oxaddress__oxfon;
$sDelAddress .= $this->oxaddress__oxfax;
$sDelAddress .= $this->oxaddress__oxsal;
return $sDelAddress;
} | php | protected function _getMergedAddressFields()
{
$sDelAddress = '';
$sDelAddress .= $this->oxaddress__oxcompany;
$sDelAddress .= $this->oxaddress__oxfname;
$sDelAddress .= $this->oxaddress__oxlname;
$sDelAddress .= $this->oxaddress__oxstreet;
$sDelAddress .= $this->oxaddress__oxstreetnr;
$sDelAddress .= $this->oxaddress__oxaddinfo;
$sDelAddress .= $this->oxaddress__oxcity;
$sDelAddress .= $this->oxaddress__oxcountryid;
$sDelAddress .= $this->oxaddress__oxstateid;
$sDelAddress .= $this->oxaddress__oxzip;
$sDelAddress .= $this->oxaddress__oxfon;
$sDelAddress .= $this->oxaddress__oxfax;
$sDelAddress .= $this->oxaddress__oxsal;
return $sDelAddress;
} | [
"protected",
"function",
"_getMergedAddressFields",
"(",
")",
"{",
"$",
"sDelAddress",
"=",
"''",
";",
"$",
"sDelAddress",
".=",
"$",
"this",
"->",
"oxaddress__oxcompany",
";",
"$",
"sDelAddress",
".=",
"$",
"this",
"->",
"oxaddress__oxfname",
";",
"$",
"sDelA... | Returns merged address fields.
@return string | [
"Returns",
"merged",
"address",
"fields",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Address.php#L151-L169 | train |
OXID-eSales/oxideshop_ce | source/Core/Service/ApplicationServerService.php | ApplicationServerService.loadAppServer | public function loadAppServer($id)
{
/** @var \OxidEsales\Eshop\Core\DataObject\ApplicationServer $appServer */
$appServer = $this->appServerDao->findAppServer($id);
if ($appServer === null) {
/** @var \OxidEsales\Eshop\Core\Exception\NoResultException $exception */
$exception = oxNew(\OxidEsales\Eshop\Core\Exception\NoResultException::class);
throw $exception;
}
return $appServer;
} | php | public function loadAppServer($id)
{
/** @var \OxidEsales\Eshop\Core\DataObject\ApplicationServer $appServer */
$appServer = $this->appServerDao->findAppServer($id);
if ($appServer === null) {
/** @var \OxidEsales\Eshop\Core\Exception\NoResultException $exception */
$exception = oxNew(\OxidEsales\Eshop\Core\Exception\NoResultException::class);
throw $exception;
}
return $appServer;
} | [
"public",
"function",
"loadAppServer",
"(",
"$",
"id",
")",
"{",
"/** @var \\OxidEsales\\Eshop\\Core\\DataObject\\ApplicationServer $appServer */",
"$",
"appServer",
"=",
"$",
"this",
"->",
"appServerDao",
"->",
"findAppServer",
"(",
"$",
"id",
")",
";",
"if",
"(",
... | Load the application server for given id.
@param string $id The id of the application server to load.
@throws \OxidEsales\Eshop\Core\Exception\NoResultException
@return \OxidEsales\Eshop\Core\DataObject\ApplicationServer | [
"Load",
"the",
"application",
"server",
"for",
"given",
"id",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Service/ApplicationServerService.php#L74-L84 | train |
OXID-eSales/oxideshop_ce | source/Core/Service/ApplicationServerService.php | ApplicationServerService.filterActiveAppServers | protected function filterActiveAppServers($appServerList)
{
$activeServerList = [];
/** @var \OxidEsales\Eshop\Core\DataObject\ApplicationServer $server */
foreach ($appServerList as $server) {
if ($server->isInUse($this->currentTime)) {
$activeServerList[$server->getId()] = $server;
}
}
return $activeServerList;
} | php | protected function filterActiveAppServers($appServerList)
{
$activeServerList = [];
/** @var \OxidEsales\Eshop\Core\DataObject\ApplicationServer $server */
foreach ($appServerList as $server) {
if ($server->isInUse($this->currentTime)) {
$activeServerList[$server->getId()] = $server;
}
}
return $activeServerList;
} | [
"protected",
"function",
"filterActiveAppServers",
"(",
"$",
"appServerList",
")",
"{",
"$",
"activeServerList",
"=",
"[",
"]",
";",
"/** @var \\OxidEsales\\Eshop\\Core\\DataObject\\ApplicationServer $server */",
"foreach",
"(",
"$",
"appServerList",
"as",
"$",
"server",
... | Filter only active application servers from given list.
@param array $appServerList The list of application servers.
@return array | [
"Filter",
"only",
"active",
"application",
"servers",
"from",
"given",
"list",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Service/ApplicationServerService.php#L124-L134 | train |
OXID-eSales/oxideshop_ce | source/Core/Service/ApplicationServerService.php | ApplicationServerService.cleanupAppServers | private function cleanupAppServers()
{
$allFoundServers = $this->loadAppServerList();
/** @var \OxidEsales\Eshop\Core\DataObject\ApplicationServer $server */
foreach ($allFoundServers as $server) {
if ($server->needToDelete($this->currentTime)) {
$this->deleteAppServerById($server->getId());
}
}
} | php | private function cleanupAppServers()
{
$allFoundServers = $this->loadAppServerList();
/** @var \OxidEsales\Eshop\Core\DataObject\ApplicationServer $server */
foreach ($allFoundServers as $server) {
if ($server->needToDelete($this->currentTime)) {
$this->deleteAppServerById($server->getId());
}
}
} | [
"private",
"function",
"cleanupAppServers",
"(",
")",
"{",
"$",
"allFoundServers",
"=",
"$",
"this",
"->",
"loadAppServerList",
"(",
")",
";",
"/** @var \\OxidEsales\\Eshop\\Core\\DataObject\\ApplicationServer $server */",
"foreach",
"(",
"$",
"allFoundServers",
"as",
"$"... | Deletes all application servers, that are longer not active. | [
"Deletes",
"all",
"application",
"servers",
"that",
"are",
"longer",
"not",
"active",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Service/ApplicationServerService.php#L139-L148 | train |
OXID-eSales/oxideshop_ce | source/Core/Service/ApplicationServerService.php | ApplicationServerService.updateAppServerInformation | public function updateAppServerInformation($adminMode)
{
$this->appServerDao->startTransaction();
try {
/** @var \OxidEsales\Eshop\Core\DataObject\ApplicationServer $appServer */
$appServer = $this->appServerDao->findAppServer($this->utilsServer->getServerNodeId());
if ($appServer === null) {
$this->addNewAppServerData($adminMode);
} elseif ($appServer->needToUpdate($this->currentTime)) {
$this->updateAppServerData($appServer, $adminMode);
}
} catch (\Exception $exception) {
$this->appServerDao->rollbackTransaction();
throw $exception;
}
$this->appServerDao->commitTransaction();
} | php | public function updateAppServerInformation($adminMode)
{
$this->appServerDao->startTransaction();
try {
/** @var \OxidEsales\Eshop\Core\DataObject\ApplicationServer $appServer */
$appServer = $this->appServerDao->findAppServer($this->utilsServer->getServerNodeId());
if ($appServer === null) {
$this->addNewAppServerData($adminMode);
} elseif ($appServer->needToUpdate($this->currentTime)) {
$this->updateAppServerData($appServer, $adminMode);
}
} catch (\Exception $exception) {
$this->appServerDao->rollbackTransaction();
throw $exception;
}
$this->appServerDao->commitTransaction();
} | [
"public",
"function",
"updateAppServerInformation",
"(",
"$",
"adminMode",
")",
"{",
"$",
"this",
"->",
"appServerDao",
"->",
"startTransaction",
"(",
")",
";",
"try",
"{",
"/** @var \\OxidEsales\\Eshop\\Core\\DataObject\\ApplicationServer $appServer */",
"$",
"appServer",
... | Renews application server information if it is outdated or if it does not exist.
@throws \Exception
@param bool $adminMode The status of admin mode | [
"Renews",
"application",
"server",
"information",
"if",
"it",
"is",
"outdated",
"or",
"if",
"it",
"does",
"not",
"exist",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Service/ApplicationServerService.php#L175-L191 | train |
OXID-eSales/oxideshop_ce | source/Core/Service/ApplicationServerService.php | ApplicationServerService.updateAppServerData | private function updateAppServerData($appServer, $adminMode)
{
$appServer->setId($this->utilsServer->getServerNodeId());
$appServer->setIp($this->utilsServer->getServerIp());
$appServer->setTimestamp($this->currentTime);
if ($adminMode) {
$appServer->setLastAdminUsage($this->currentTime);
} else {
$appServer->setLastFrontendUsage($this->currentTime);
}
$this->saveAppServer($appServer);
$this->cleanupAppServers();
} | php | private function updateAppServerData($appServer, $adminMode)
{
$appServer->setId($this->utilsServer->getServerNodeId());
$appServer->setIp($this->utilsServer->getServerIp());
$appServer->setTimestamp($this->currentTime);
if ($adminMode) {
$appServer->setLastAdminUsage($this->currentTime);
} else {
$appServer->setLastFrontendUsage($this->currentTime);
}
$this->saveAppServer($appServer);
$this->cleanupAppServers();
} | [
"private",
"function",
"updateAppServerData",
"(",
"$",
"appServer",
",",
"$",
"adminMode",
")",
"{",
"$",
"appServer",
"->",
"setId",
"(",
"$",
"this",
"->",
"utilsServer",
"->",
"getServerNodeId",
"(",
")",
")",
";",
"$",
"appServer",
"->",
"setIp",
"(",... | Updates application server with the newest information.
@param \OxidEsales\Eshop\Core\DataObject\ApplicationServer $appServer The application server to update.
@param bool $adminMode The status of admin mode. | [
"Updates",
"application",
"server",
"with",
"the",
"newest",
"information",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Service/ApplicationServerService.php#L199-L211 | train |
OXID-eSales/oxideshop_ce | source/Core/Service/ApplicationServerService.php | ApplicationServerService.addNewAppServerData | private function addNewAppServerData($adminMode)
{
/** @var \OxidEsales\Eshop\Core\DataObject\ApplicationServer $appServer */
$appServer = oxNew(\OxidEsales\Eshop\Core\DataObject\ApplicationServer::class);
$appServer->setId($this->utilsServer->getServerNodeId());
$appServer->setIp($this->utilsServer->getServerIp());
$appServer->setTimestamp($this->currentTime);
if ($adminMode) {
$appServer->setLastAdminUsage($this->currentTime);
} else {
$appServer->setLastFrontendUsage($this->currentTime);
}
$this->saveAppServer($appServer);
$this->cleanupAppServers();
} | php | private function addNewAppServerData($adminMode)
{
/** @var \OxidEsales\Eshop\Core\DataObject\ApplicationServer $appServer */
$appServer = oxNew(\OxidEsales\Eshop\Core\DataObject\ApplicationServer::class);
$appServer->setId($this->utilsServer->getServerNodeId());
$appServer->setIp($this->utilsServer->getServerIp());
$appServer->setTimestamp($this->currentTime);
if ($adminMode) {
$appServer->setLastAdminUsage($this->currentTime);
} else {
$appServer->setLastFrontendUsage($this->currentTime);
}
$this->saveAppServer($appServer);
$this->cleanupAppServers();
} | [
"private",
"function",
"addNewAppServerData",
"(",
"$",
"adminMode",
")",
"{",
"/** @var \\OxidEsales\\Eshop\\Core\\DataObject\\ApplicationServer $appServer */",
"$",
"appServer",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"DataObject",
"\\"... | Adds new application server.
@param bool $adminMode The status of admin mode. | [
"Adds",
"new",
"application",
"server",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Service/ApplicationServerService.php#L218-L233 | train |
OXID-eSales/oxideshop_ce | source/Core/Form/FormFieldsCleaner.php | FormFieldsCleaner.filterByUpdatableFields | public function filterByUpdatableFields(array $listToClean)
{
$allowedFields = $this->updatableFields->getUpdatableFields();
$cleanedList = $listToClean;
if ($allowedFields->count() > 0) {
$cleanedList = $this->filterFieldsByWhiteList($allowedFields, $listToClean);
}
return $cleanedList;
} | php | public function filterByUpdatableFields(array $listToClean)
{
$allowedFields = $this->updatableFields->getUpdatableFields();
$cleanedList = $listToClean;
if ($allowedFields->count() > 0) {
$cleanedList = $this->filterFieldsByWhiteList($allowedFields, $listToClean);
}
return $cleanedList;
} | [
"public",
"function",
"filterByUpdatableFields",
"(",
"array",
"$",
"listToClean",
")",
"{",
"$",
"allowedFields",
"=",
"$",
"this",
"->",
"updatableFields",
"->",
"getUpdatableFields",
"(",
")",
";",
"$",
"cleanedList",
"=",
"$",
"listToClean",
";",
"if",
"("... | Return only those items which exist in both lists.
@param array $listToClean All fields.
@return array | [
"Return",
"only",
"those",
"items",
"which",
"exist",
"in",
"both",
"lists",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Form/FormFieldsCleaner.php#L32-L42 | train |
OXID-eSales/oxideshop_ce | source/Core/Form/FormFieldsCleaner.php | FormFieldsCleaner.filterFieldsByWhiteList | private function filterFieldsByWhiteList(\ArrayIterator $allowedFields, array $listToClean)
{
$allowedFieldsLowerCase = array_map('strtolower', (array)$allowedFields);
$cleanedList = array_filter($listToClean, function ($field) use ($allowedFieldsLowerCase) {
return in_array(strtolower($field), $allowedFieldsLowerCase);
}, ARRAY_FILTER_USE_KEY);
return $cleanedList;
} | php | private function filterFieldsByWhiteList(\ArrayIterator $allowedFields, array $listToClean)
{
$allowedFieldsLowerCase = array_map('strtolower', (array)$allowedFields);
$cleanedList = array_filter($listToClean, function ($field) use ($allowedFieldsLowerCase) {
return in_array(strtolower($field), $allowedFieldsLowerCase);
}, ARRAY_FILTER_USE_KEY);
return $cleanedList;
} | [
"private",
"function",
"filterFieldsByWhiteList",
"(",
"\\",
"ArrayIterator",
"$",
"allowedFields",
",",
"array",
"$",
"listToClean",
")",
"{",
"$",
"allowedFieldsLowerCase",
"=",
"array_map",
"(",
"'strtolower'",
",",
"(",
"array",
")",
"$",
"allowedFields",
")",... | Return fields by performing a case-insensitive compare.
Does not change original case-sensitivity of fields.
@param \ArrayIterator $allowedFields
@param array $listToClean
@return array | [
"Return",
"fields",
"by",
"performing",
"a",
"case",
"-",
"insensitive",
"compare",
".",
"Does",
"not",
"change",
"original",
"case",
"-",
"sensitivity",
"of",
"fields",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Form/FormFieldsCleaner.php#L53-L61 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/NewsletterSend.php | NewsletterSend.resetUserCount | public function resetUserCount()
{
\OxidEsales\Eshop\Core\Registry::getSession()->deleteVariable("iUserCount");
$this->_iUserCount = null;
} | php | public function resetUserCount()
{
\OxidEsales\Eshop\Core\Registry::getSession()->deleteVariable("iUserCount");
$this->_iUserCount = null;
} | [
"public",
"function",
"resetUserCount",
"(",
")",
"{",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getSession",
"(",
")",
"->",
"deleteVariable",
"(",
"\"iUserCount\"",
")",
";",
"$",
"this",
"->",
"_iUserCount",
"=",
"null",
... | Resets users count | [
"Resets",
"users",
"count"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/NewsletterSend.php#L162-L166 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/NewsletterSend.php | NewsletterSend._setupNavigation | protected function _setupNavigation($sNode)
{
$sNode = 'newsletter_list';
$myAdminNavig = $this->getNavigation();
// active tab
$iActTab = 3;
// tabs
$this->_aViewData['editnavi'] = $myAdminNavig->getTabs($sNode, $iActTab);
// active tab
$this->_aViewData['actlocation'] = $myAdminNavig->getActiveTab($sNode, $iActTab);
// default tab
$this->_aViewData['default_edit'] = $myAdminNavig->getActiveTab($sNode, $this->_iDefEdit);
// passign active tab number
$this->_aViewData['actedit'] = $iActTab;
} | php | protected function _setupNavigation($sNode)
{
$sNode = 'newsletter_list';
$myAdminNavig = $this->getNavigation();
// active tab
$iActTab = 3;
// tabs
$this->_aViewData['editnavi'] = $myAdminNavig->getTabs($sNode, $iActTab);
// active tab
$this->_aViewData['actlocation'] = $myAdminNavig->getActiveTab($sNode, $iActTab);
// default tab
$this->_aViewData['default_edit'] = $myAdminNavig->getActiveTab($sNode, $this->_iDefEdit);
// passign active tab number
$this->_aViewData['actedit'] = $iActTab;
} | [
"protected",
"function",
"_setupNavigation",
"(",
"$",
"sNode",
")",
"{",
"$",
"sNode",
"=",
"'newsletter_list'",
";",
"$",
"myAdminNavig",
"=",
"$",
"this",
"->",
"getNavigation",
"(",
")",
";",
"// active tab",
"$",
"iActTab",
"=",
"3",
";",
"// tabs",
"... | Overrides parent method to pass referred id
@param string $sNode referred id | [
"Overrides",
"parent",
"method",
"to",
"pass",
"referred",
"id"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/NewsletterSend.php#L183-L203 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/ListObject.php | ListObject.assign | public function assign($aData)
{
if (!is_array($aData)) {
return;
}
foreach ($aData as $sKey => $sValue) {
$sFieldName = strtolower($this->_sTableName . '__' . $sKey);
$this->$sFieldName = new \OxidEsales\Eshop\Core\Field($sValue);
}
} | php | public function assign($aData)
{
if (!is_array($aData)) {
return;
}
foreach ($aData as $sKey => $sValue) {
$sFieldName = strtolower($this->_sTableName . '__' . $sKey);
$this->$sFieldName = new \OxidEsales\Eshop\Core\Field($sValue);
}
} | [
"public",
"function",
"assign",
"(",
"$",
"aData",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"aData",
")",
")",
"{",
"return",
";",
"}",
"foreach",
"(",
"$",
"aData",
"as",
"$",
"sKey",
"=>",
"$",
"sValue",
")",
"{",
"$",
"sFieldName",
"=",... | Assigns database record to object
@param object $aData Database record
@return null | [
"Assigns",
"database",
"record",
"to",
"object"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/ListObject.php#L38-L47 | train |
OXID-eSales/oxideshop_ce | source/Core/UtilsView.php | UtilsView.getTemplateOutput | public function getTemplateOutput($templateName, $oObject)
{
$smarty = $this->getSmarty();
$debugMode = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('iDebug');
// assign
$viewData = $oObject->getViewData();
if (is_array($viewData)) {
foreach (array_keys($viewData) as $viewName) {
// show debug information
if ($debugMode == 4) {
echo("TemplateData[$viewName] : \n");
var_export($viewData[$viewName]);
}
$smarty->assign($viewName, $viewData[$viewName]);
}
}
return $smarty->fetch($templateName);
} | php | public function getTemplateOutput($templateName, $oObject)
{
$smarty = $this->getSmarty();
$debugMode = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('iDebug');
// assign
$viewData = $oObject->getViewData();
if (is_array($viewData)) {
foreach (array_keys($viewData) as $viewName) {
// show debug information
if ($debugMode == 4) {
echo("TemplateData[$viewName] : \n");
var_export($viewData[$viewName]);
}
$smarty->assign($viewName, $viewData[$viewName]);
}
}
return $smarty->fetch($templateName);
} | [
"public",
"function",
"getTemplateOutput",
"(",
"$",
"templateName",
",",
"$",
"oObject",
")",
"{",
"$",
"smarty",
"=",
"$",
"this",
"->",
"getSmarty",
"(",
")",
";",
"$",
"debugMode",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry... | Returns rendered template output. According to debug configuration outputs
debug information.
@param string $templateName template file name
@param object $oObject object, witch template we wish to output
@return string | [
"Returns",
"rendered",
"template",
"output",
".",
"According",
"to",
"debug",
"configuration",
"outputs",
"debug",
"information",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/UtilsView.php#L86-L105 | train |
OXID-eSales/oxideshop_ce | source/Core/UtilsView.php | UtilsView.passAllErrorsToView | public function passAllErrorsToView(&$aView, $errors)
{
if (count($errors) > 0) {
foreach ($errors as $sLocation => $aEx2) {
foreach ($aEx2 as $sKey => $oEr) {
$aView['Errors'][$sLocation][$sKey] = unserialize($oEr);
}
}
}
} | php | public function passAllErrorsToView(&$aView, $errors)
{
if (count($errors) > 0) {
foreach ($errors as $sLocation => $aEx2) {
foreach ($aEx2 as $sKey => $oEr) {
$aView['Errors'][$sLocation][$sKey] = unserialize($oEr);
}
}
}
} | [
"public",
"function",
"passAllErrorsToView",
"(",
"&",
"$",
"aView",
",",
"$",
"errors",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"errors",
")",
">",
"0",
")",
"{",
"foreach",
"(",
"$",
"errors",
"as",
"$",
"sLocation",
"=>",
"$",
"aEx2",
")",
"{",
... | adds the given errors to the view array
@param array $aView view data array
@param array $errors array of errors to pass to view | [
"adds",
"the",
"given",
"errors",
"to",
"the",
"view",
"array"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/UtilsView.php#L113-L122 | train |
OXID-eSales/oxideshop_ce | source/Core/UtilsView.php | UtilsView.addErrorToDisplay | public function addErrorToDisplay($oEr, $blFull = false, $useCustomDestination = false, $customDestination = "", $activeController = "")
{
//default
$destination = 'default';
$customDestination = $customDestination ? $customDestination : \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('CustomError');
if ($useCustomDestination && $customDestination) {
$destination = $customDestination;
}
//starting session if not yet started as all exception
//messages are stored in session
$session = $this->getSession();
if (!$session->getId() && !$session->isHeaderSent()) {
$session->setForceNewSession();
$session->start();
}
$aEx = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable('Errors');
if ($oEr instanceof \OxidEsales\Eshop\Core\Exception\StandardException) {
$oEx = oxNew(\OxidEsales\Eshop\Core\Exception\ExceptionToDisplay::class);
$oEx->setMessage($oEr->getMessage());
$oEx->setExceptionType($oEr->getType());
if ($oEr instanceof \OxidEsales\Eshop\Core\Exception\SystemComponentException) {
$oEx->setMessageArgs($oEr->getComponent());
}
$oEx->setValues($oEr->getValues());
$oEx->setStackTrace($oEr->getTraceAsString());
$oEx->setDebug($blFull);
$oEr = $oEx;
} elseif ($oEr && !($oEr instanceof \OxidEsales\Eshop\Core\Contract\IDisplayError)) {
// assuming that a string was given
$sTmp = $oEr;
$oEr = oxNew(\OxidEsales\Eshop\Core\DisplayError::class);
$oEr->setMessage($sTmp);
} elseif ($oEr instanceof \OxidEsales\Eshop\Core\Contract\IDisplayError) {
// take the object
} else {
$oEr = null;
}
if ($oEr) {
$aEx[$destination][] = serialize($oEr);
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable('Errors', $aEx);
if ($activeController == '') {
$activeController = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('actcontrol');
}
if ($activeController) {
$aControllerErrors[$destination] = $activeController;
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable('ErrorController', $aControllerErrors);
}
}
} | php | public function addErrorToDisplay($oEr, $blFull = false, $useCustomDestination = false, $customDestination = "", $activeController = "")
{
//default
$destination = 'default';
$customDestination = $customDestination ? $customDestination : \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('CustomError');
if ($useCustomDestination && $customDestination) {
$destination = $customDestination;
}
//starting session if not yet started as all exception
//messages are stored in session
$session = $this->getSession();
if (!$session->getId() && !$session->isHeaderSent()) {
$session->setForceNewSession();
$session->start();
}
$aEx = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable('Errors');
if ($oEr instanceof \OxidEsales\Eshop\Core\Exception\StandardException) {
$oEx = oxNew(\OxidEsales\Eshop\Core\Exception\ExceptionToDisplay::class);
$oEx->setMessage($oEr->getMessage());
$oEx->setExceptionType($oEr->getType());
if ($oEr instanceof \OxidEsales\Eshop\Core\Exception\SystemComponentException) {
$oEx->setMessageArgs($oEr->getComponent());
}
$oEx->setValues($oEr->getValues());
$oEx->setStackTrace($oEr->getTraceAsString());
$oEx->setDebug($blFull);
$oEr = $oEx;
} elseif ($oEr && !($oEr instanceof \OxidEsales\Eshop\Core\Contract\IDisplayError)) {
// assuming that a string was given
$sTmp = $oEr;
$oEr = oxNew(\OxidEsales\Eshop\Core\DisplayError::class);
$oEr->setMessage($sTmp);
} elseif ($oEr instanceof \OxidEsales\Eshop\Core\Contract\IDisplayError) {
// take the object
} else {
$oEr = null;
}
if ($oEr) {
$aEx[$destination][] = serialize($oEr);
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable('Errors', $aEx);
if ($activeController == '') {
$activeController = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('actcontrol');
}
if ($activeController) {
$aControllerErrors[$destination] = $activeController;
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable('ErrorController', $aControllerErrors);
}
}
} | [
"public",
"function",
"addErrorToDisplay",
"(",
"$",
"oEr",
",",
"$",
"blFull",
"=",
"false",
",",
"$",
"useCustomDestination",
"=",
"false",
",",
"$",
"customDestination",
"=",
"\"\"",
",",
"$",
"activeController",
"=",
"\"\"",
")",
"{",
"//default",
"$",
... | Adds an exception to the array of displayed exceptions for the view
by default is displayed in the inc_header, but with the custom destination set to true
the exception won't be displayed by default but can be displayed where ever wanted in the tpl
@param StandardException|IDisplayError|string $oEr an exception object or just a language local (string),
which will be converted into a oxExceptionToDisplay object
@param bool $blFull if true the whole object is add to display (default false)
@param bool $useCustomDestination true if the exception shouldn't be displayed
at the default position (default false)
@param string $customDestination defines a name of the view variable containing
the messages, overrides Parameter 'CustomError' ("default")
@param string $activeController defines a name of the controller, which should
handle the error. | [
"Adds",
"an",
"exception",
"to",
"the",
"array",
"of",
"displayed",
"exceptions",
"for",
"the",
"view",
"by",
"default",
"is",
"displayed",
"in",
"the",
"inc_header",
"but",
"with",
"the",
"custom",
"destination",
"set",
"to",
"true",
"the",
"exception",
"wo... | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/UtilsView.php#L139-L193 | train |
OXID-eSales/oxideshop_ce | source/Core/UtilsView.php | UtilsView.parseThroughSmarty | public function parseThroughSmarty($sDesc, $sOxid = null, $oActView = null, $blRecompile = false)
{
if (\OxidEsales\Eshop\Core\Registry::getConfig()->isDemoShop()) {
return $sDesc;
}
startProfile("parseThroughSmarty");
if (!is_array($sDesc) && strpos($sDesc, "[{") === false) {
stopProfile("parseThroughSmarty");
return $sDesc;
}
$activeLanguageId = \OxidEsales\Eshop\Core\Registry::getLang()->getTplLanguage();
// now parse it through smarty
$smarty = clone $this->getSmarty();
// save old tpl data
$tplVars = $smarty->_tpl_vars;
$forceRecompile = $smarty->force_compile;
$smarty->force_compile = $blRecompile;
if (!$oActView) {
$oActView = oxNew(\OxidEsales\Eshop\Application\Controller\FrontendController::class);
$oActView->addGlobalParams();
}
$viewData = $oActView->getViewData();
foreach (array_keys($viewData) as $name) {
$smarty->assign($name, $viewData[$name]);
}
if (is_array($sDesc)) {
foreach ($sDesc as $name => $aData) {
$smarty->oxidcache = new \OxidEsales\Eshop\Core\Field($aData[1], \OxidEsales\Eshop\Core\Field::T_RAW);
$result[$name] = $smarty->fetch("ox:" . $aData[0] . $activeLanguageId);
}
} else {
$smarty->oxidcache = new \OxidEsales\Eshop\Core\Field($sDesc, \OxidEsales\Eshop\Core\Field::T_RAW);
$result = $smarty->fetch("ox:{$sOxid}{$activeLanguageId}");
}
// restore tpl vars for continuing smarty processing if it is in one
$smarty->_tpl_vars = $tplVars;
$smarty->force_compile = $forceRecompile;
stopProfile("parseThroughSmarty");
return $result;
} | php | public function parseThroughSmarty($sDesc, $sOxid = null, $oActView = null, $blRecompile = false)
{
if (\OxidEsales\Eshop\Core\Registry::getConfig()->isDemoShop()) {
return $sDesc;
}
startProfile("parseThroughSmarty");
if (!is_array($sDesc) && strpos($sDesc, "[{") === false) {
stopProfile("parseThroughSmarty");
return $sDesc;
}
$activeLanguageId = \OxidEsales\Eshop\Core\Registry::getLang()->getTplLanguage();
// now parse it through smarty
$smarty = clone $this->getSmarty();
// save old tpl data
$tplVars = $smarty->_tpl_vars;
$forceRecompile = $smarty->force_compile;
$smarty->force_compile = $blRecompile;
if (!$oActView) {
$oActView = oxNew(\OxidEsales\Eshop\Application\Controller\FrontendController::class);
$oActView->addGlobalParams();
}
$viewData = $oActView->getViewData();
foreach (array_keys($viewData) as $name) {
$smarty->assign($name, $viewData[$name]);
}
if (is_array($sDesc)) {
foreach ($sDesc as $name => $aData) {
$smarty->oxidcache = new \OxidEsales\Eshop\Core\Field($aData[1], \OxidEsales\Eshop\Core\Field::T_RAW);
$result[$name] = $smarty->fetch("ox:" . $aData[0] . $activeLanguageId);
}
} else {
$smarty->oxidcache = new \OxidEsales\Eshop\Core\Field($sDesc, \OxidEsales\Eshop\Core\Field::T_RAW);
$result = $smarty->fetch("ox:{$sOxid}{$activeLanguageId}");
}
// restore tpl vars for continuing smarty processing if it is in one
$smarty->_tpl_vars = $tplVars;
$smarty->force_compile = $forceRecompile;
stopProfile("parseThroughSmarty");
return $result;
} | [
"public",
"function",
"parseThroughSmarty",
"(",
"$",
"sDesc",
",",
"$",
"sOxid",
"=",
"null",
",",
"$",
"oActView",
"=",
"null",
",",
"$",
"blRecompile",
"=",
"false",
")",
"{",
"if",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Regist... | Runs long description through smarty. If you pass array of data
to process, array will be returned, if you pass string - string
will be passed as result
@param mixed $sDesc description or array of descriptions
(array( [] => array(_ident_, _value_to_process_)))
@param string $sOxid current object id
@param \OxidEsales\Eshop\Core\Controller\BaseController $oActView view data to use its view data (optional)
@param bool $blRecompile force to recompile if found in cache
@return mixed | [
"Runs",
"long",
"description",
"through",
"smarty",
".",
"If",
"you",
"pass",
"array",
"of",
"data",
"to",
"process",
"array",
"will",
"be",
"returned",
"if",
"you",
"pass",
"string",
"-",
"string",
"will",
"be",
"passed",
"as",
"result"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/UtilsView.php#L208-L260 | train |
OXID-eSales/oxideshop_ce | source/Core/UtilsView.php | UtilsView.setTemplateDir | public function setTemplateDir($templatesDirectory)
{
if ($templatesDirectory && !in_array($templatesDirectory, $this->_aTemplateDir)) {
$this->_aTemplateDir[] = $templatesDirectory;
}
} | php | public function setTemplateDir($templatesDirectory)
{
if ($templatesDirectory && !in_array($templatesDirectory, $this->_aTemplateDir)) {
$this->_aTemplateDir[] = $templatesDirectory;
}
} | [
"public",
"function",
"setTemplateDir",
"(",
"$",
"templatesDirectory",
")",
"{",
"if",
"(",
"$",
"templatesDirectory",
"&&",
"!",
"in_array",
"(",
"$",
"templatesDirectory",
",",
"$",
"this",
"->",
"_aTemplateDir",
")",
")",
"{",
"$",
"this",
"->",
"_aTempl... | Templates directory setter
@param string $templatesDirectory templates path | [
"Templates",
"directory",
"setter"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/UtilsView.php#L267-L272 | train |
OXID-eSales/oxideshop_ce | source/Core/UtilsView.php | UtilsView.getTemplateDirs | public function getTemplateDirs()
{
$config = \OxidEsales\Eshop\Core\Registry::getConfig();
// buffer for CE (main) edition templates
$mainTemplatesDirectory = $config->getTemplateDir($this->isAdmin());
// main templates directory has not much priority anymore
$this->setTemplateDir($mainTemplatesDirectory);
// out directory can have templates too
if (!$this->isAdmin()) {
$this->setTemplateDir($this->addActiveThemeId($config->getOutDir(true)));
}
return $this->_aTemplateDir;
} | php | public function getTemplateDirs()
{
$config = \OxidEsales\Eshop\Core\Registry::getConfig();
// buffer for CE (main) edition templates
$mainTemplatesDirectory = $config->getTemplateDir($this->isAdmin());
// main templates directory has not much priority anymore
$this->setTemplateDir($mainTemplatesDirectory);
// out directory can have templates too
if (!$this->isAdmin()) {
$this->setTemplateDir($this->addActiveThemeId($config->getOutDir(true)));
}
return $this->_aTemplateDir;
} | [
"public",
"function",
"getTemplateDirs",
"(",
")",
"{",
"$",
"config",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
";",
"// buffer for CE (main) edition templates",
"$",
"mainTemplatesDirectory",
"=",
"$",
... | Initializes and returns templates directory info array
@return array | [
"Initializes",
"and",
"returns",
"templates",
"directory",
"info",
"array"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/UtilsView.php#L279-L295 | train |
OXID-eSales/oxideshop_ce | source/Core/UtilsView.php | UtilsView.getTemplateCompileId | public function getTemplateCompileId()
{
$shopId = \OxidEsales\Eshop\Core\Registry::getConfig()->getShopId();
$templateDirectories = $this->getTemplateDirs();
return md5(reset($templateDirectories) . '__' . $shopId);
} | php | public function getTemplateCompileId()
{
$shopId = \OxidEsales\Eshop\Core\Registry::getConfig()->getShopId();
$templateDirectories = $this->getTemplateDirs();
return md5(reset($templateDirectories) . '__' . $shopId);
} | [
"public",
"function",
"getTemplateCompileId",
"(",
")",
"{",
"$",
"shopId",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
"getShopId",
"(",
")",
";",
"$",
"templateDirectories",
"=",
"$",
"this",... | Get template compile id.
@return string | [
"Get",
"template",
"compile",
"id",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/UtilsView.php#L302-L308 | train |
OXID-eSales/oxideshop_ce | source/Core/UtilsView.php | UtilsView.getSmartyDir | public function getSmartyDir()
{
$config = \OxidEsales\Eshop\Core\Registry::getConfig();
//check for the Smarty dir
$compileDir = $config->getConfigParam('sCompileDir');
$smartyDir = $compileDir . "/smarty/";
if (!is_dir($smartyDir)) {
@mkdir($smartyDir);
}
if (!is_writable($smartyDir)) {
$smartyDir = $compileDir;
}
return $smartyDir;
} | php | public function getSmartyDir()
{
$config = \OxidEsales\Eshop\Core\Registry::getConfig();
//check for the Smarty dir
$compileDir = $config->getConfigParam('sCompileDir');
$smartyDir = $compileDir . "/smarty/";
if (!is_dir($smartyDir)) {
@mkdir($smartyDir);
}
if (!is_writable($smartyDir)) {
$smartyDir = $compileDir;
}
return $smartyDir;
} | [
"public",
"function",
"getSmartyDir",
"(",
")",
"{",
"$",
"config",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
";",
"//check for the Smarty dir",
"$",
"compileDir",
"=",
"$",
"config",
"->",
"getConfi... | Returns a full path to Smarty compile dir
@return string | [
"Returns",
"a",
"full",
"path",
"to",
"Smarty",
"compile",
"dir"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/UtilsView.php#L315-L331 | train |
OXID-eSales/oxideshop_ce | source/Core/UtilsView.php | UtilsView._fillCommonSmartyProperties | protected function _fillCommonSmartyProperties($smarty)
{
$config = \OxidEsales\Eshop\Core\Registry::getConfig();
$smarty->left_delimiter = '[{';
$smarty->right_delimiter = '}]';
$smarty->register_resource(
'ox',
[
'ox_get_template',
'ox_get_timestamp',
'ox_get_secure',
'ox_get_trusted'
]
);
$smartyDir = $this->getSmartyDir();
$smarty->caching = false;
$smarty->compile_dir = $smartyDir;
$smarty->cache_dir = $smartyDir;
$smarty->template_dir = $this->getTemplateDirs();
$smarty->compile_id = $this->getTemplateCompileId();
$smarty->default_template_handler_func = [\OxidEsales\Eshop\Core\Registry::getUtilsView(), '_smartyDefaultTemplateHandler'];
$smarty->plugins_dir = array_merge(
$this->getModuleSmartyPluginDirectories(),
$this->getShopSmartyPluginDirectories(),
$smarty->plugins_dir
);
$coreDirectory = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('sCoreDir');
include_once $coreDirectory . 'Smarty/Plugin/prefilter.oxblock.php';
$smarty->register_prefilter('smarty_prefilter_oxblock');
$debugMode = $config->getConfigParam('iDebug');
if ($debugMode == 1 || $debugMode == 3 || $debugMode == 4) {
$smarty->debugging = true;
}
if ($debugMode == 8 && !$config->isAdmin()) {
include_once $coreDirectory . 'Smarty/Plugin/prefilter.oxtpldebug.php';
$smarty->register_prefilter('smarty_prefilter_oxtpldebug');
}
//demo shop security
if (!$config->isDemoShop()) {
$smarty->php_handling = (int) $config->getConfigParam('iSmartyPhpHandling');
$smarty->security = false;
} else {
$smarty->php_handling = SMARTY_PHP_REMOVE;
$smarty->security = true;
$smarty->security_settings['IF_FUNCS'][] = 'XML_ELEMENT_NODE';
$smarty->security_settings['IF_FUNCS'][] = 'is_int';
$smarty->security_settings['MODIFIER_FUNCS'][] = 'round';
$smarty->security_settings['MODIFIER_FUNCS'][] = 'floor';
$smarty->security_settings['MODIFIER_FUNCS'][] = 'trim';
$smarty->security_settings['MODIFIER_FUNCS'][] = 'implode';
$smarty->security_settings['MODIFIER_FUNCS'][] = 'is_array';
$smarty->security_settings['MODIFIER_FUNCS'][] = 'getimagesize';
$smarty->security_settings['ALLOW_CONSTANTS'] = true;
$smarty->secure_dir = $smarty->template_dir;
}
} | php | protected function _fillCommonSmartyProperties($smarty)
{
$config = \OxidEsales\Eshop\Core\Registry::getConfig();
$smarty->left_delimiter = '[{';
$smarty->right_delimiter = '}]';
$smarty->register_resource(
'ox',
[
'ox_get_template',
'ox_get_timestamp',
'ox_get_secure',
'ox_get_trusted'
]
);
$smartyDir = $this->getSmartyDir();
$smarty->caching = false;
$smarty->compile_dir = $smartyDir;
$smarty->cache_dir = $smartyDir;
$smarty->template_dir = $this->getTemplateDirs();
$smarty->compile_id = $this->getTemplateCompileId();
$smarty->default_template_handler_func = [\OxidEsales\Eshop\Core\Registry::getUtilsView(), '_smartyDefaultTemplateHandler'];
$smarty->plugins_dir = array_merge(
$this->getModuleSmartyPluginDirectories(),
$this->getShopSmartyPluginDirectories(),
$smarty->plugins_dir
);
$coreDirectory = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('sCoreDir');
include_once $coreDirectory . 'Smarty/Plugin/prefilter.oxblock.php';
$smarty->register_prefilter('smarty_prefilter_oxblock');
$debugMode = $config->getConfigParam('iDebug');
if ($debugMode == 1 || $debugMode == 3 || $debugMode == 4) {
$smarty->debugging = true;
}
if ($debugMode == 8 && !$config->isAdmin()) {
include_once $coreDirectory . 'Smarty/Plugin/prefilter.oxtpldebug.php';
$smarty->register_prefilter('smarty_prefilter_oxtpldebug');
}
//demo shop security
if (!$config->isDemoShop()) {
$smarty->php_handling = (int) $config->getConfigParam('iSmartyPhpHandling');
$smarty->security = false;
} else {
$smarty->php_handling = SMARTY_PHP_REMOVE;
$smarty->security = true;
$smarty->security_settings['IF_FUNCS'][] = 'XML_ELEMENT_NODE';
$smarty->security_settings['IF_FUNCS'][] = 'is_int';
$smarty->security_settings['MODIFIER_FUNCS'][] = 'round';
$smarty->security_settings['MODIFIER_FUNCS'][] = 'floor';
$smarty->security_settings['MODIFIER_FUNCS'][] = 'trim';
$smarty->security_settings['MODIFIER_FUNCS'][] = 'implode';
$smarty->security_settings['MODIFIER_FUNCS'][] = 'is_array';
$smarty->security_settings['MODIFIER_FUNCS'][] = 'getimagesize';
$smarty->security_settings['ALLOW_CONSTANTS'] = true;
$smarty->secure_dir = $smarty->template_dir;
}
} | [
"protected",
"function",
"_fillCommonSmartyProperties",
"(",
"$",
"smarty",
")",
"{",
"$",
"config",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
";",
"$",
"smarty",
"->",
"left_delimiter",
"=",
"'[{'",... | sets properties of smarty object
@param Smarty $smarty template processor object (smarty) | [
"sets",
"properties",
"of",
"smarty",
"object"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/UtilsView.php#L338-L402 | train |
OXID-eSales/oxideshop_ce | source/Core/UtilsView.php | UtilsView._smartyCompileCheck | protected function _smartyCompileCheck($smarty)
{
$config = \OxidEsales\Eshop\Core\Registry::getConfig();
$smarty->compile_check = $config->getConfigParam('blCheckTemplates');
} | php | protected function _smartyCompileCheck($smarty)
{
$config = \OxidEsales\Eshop\Core\Registry::getConfig();
$smarty->compile_check = $config->getConfigParam('blCheckTemplates');
} | [
"protected",
"function",
"_smartyCompileCheck",
"(",
"$",
"smarty",
")",
"{",
"$",
"config",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
";",
"$",
"smarty",
"->",
"compile_check",
"=",
"$",
"config",... | Sets compile check property to smarty object.
@param object $smarty template processor object (smarty) | [
"Sets",
"compile",
"check",
"property",
"to",
"smarty",
"object",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/UtilsView.php#L421-L425 | train |
OXID-eSales/oxideshop_ce | source/Core/UtilsView.php | UtilsView._smartyDefaultTemplateHandler | public function _smartyDefaultTemplateHandler($resourceType, $resourceName, &$resourceContent, &$resourceTimestamp, $smarty)
{
$config = \OxidEsales\Eshop\Core\Registry::getConfig();
if ($resourceType == 'file' && !is_readable($resourceName)) {
$resourceName = $config->getTemplatePath($resourceName, $config->isAdmin());
$resourceContent = $smarty->_read_file($resourceName);
$resourceTimestamp = filemtime($resourceName);
return is_file($resourceName) && is_readable($resourceName);
}
return false;
} | php | public function _smartyDefaultTemplateHandler($resourceType, $resourceName, &$resourceContent, &$resourceTimestamp, $smarty)
{
$config = \OxidEsales\Eshop\Core\Registry::getConfig();
if ($resourceType == 'file' && !is_readable($resourceName)) {
$resourceName = $config->getTemplatePath($resourceName, $config->isAdmin());
$resourceContent = $smarty->_read_file($resourceName);
$resourceTimestamp = filemtime($resourceName);
return is_file($resourceName) && is_readable($resourceName);
}
return false;
} | [
"public",
"function",
"_smartyDefaultTemplateHandler",
"(",
"$",
"resourceType",
",",
"$",
"resourceName",
",",
"&",
"$",
"resourceContent",
",",
"&",
"$",
"resourceTimestamp",
",",
"$",
"smarty",
")",
"{",
"$",
"config",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop"... | is called when a template cannot be obtained from its resource.
@param string $resourceType template type
@param string $resourceName template file name
@param string $resourceContent template file content
@param int $resourceTimestamp template file timestamp
@param object $smarty template processor object (smarty)
@return bool | [
"is",
"called",
"when",
"a",
"template",
"cannot",
"be",
"obtained",
"from",
"its",
"resource",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/UtilsView.php#L438-L450 | train |
OXID-eSales/oxideshop_ce | source/Core/UtilsView.php | UtilsView._getTemplateBlock | protected function _getTemplateBlock($moduleId, $fileName)
{
$pathFormatter = oxNew(ModuleTemplateBlockPathFormatter::class);
$pathFormatter->setModulesPath(\OxidEsales\Eshop\Core\Registry::getConfig()->getModulesDir());
$pathFormatter->setModuleId($moduleId);
$pathFormatter->setFileName($fileName);
$blockContentReader = oxNew(ModuleTemplateBlockContentReader::class);
return $blockContentReader->getContent($pathFormatter);
} | php | protected function _getTemplateBlock($moduleId, $fileName)
{
$pathFormatter = oxNew(ModuleTemplateBlockPathFormatter::class);
$pathFormatter->setModulesPath(\OxidEsales\Eshop\Core\Registry::getConfig()->getModulesDir());
$pathFormatter->setModuleId($moduleId);
$pathFormatter->setFileName($fileName);
$blockContentReader = oxNew(ModuleTemplateBlockContentReader::class);
return $blockContentReader->getContent($pathFormatter);
} | [
"protected",
"function",
"_getTemplateBlock",
"(",
"$",
"moduleId",
",",
"$",
"fileName",
")",
"{",
"$",
"pathFormatter",
"=",
"oxNew",
"(",
"ModuleTemplateBlockPathFormatter",
"::",
"class",
")",
";",
"$",
"pathFormatter",
"->",
"setModulesPath",
"(",
"\\",
"Ox... | Retrieve module block contents from active module block file.
@param string $moduleId active module id.
@param string $fileName module block file name.
@deprecated since v6.0.0 (2016-04-13); Use ModuleTemplateBlockContentReader::getContent().
@see getTemplateBlocks
@throws oxException if block is not found
@return string | [
"Retrieve",
"module",
"block",
"contents",
"from",
"active",
"module",
"block",
"file",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/UtilsView.php#L465-L475 | train |
OXID-eSales/oxideshop_ce | source/Core/UtilsView.php | UtilsView._getActiveModuleInfo | protected function _getActiveModuleInfo()
{
if ($this->_aActiveModuleInfo === null) {
$modulelist = oxNew(\OxidEsales\Eshop\Core\Module\ModuleList::class);
$this->_aActiveModuleInfo = $modulelist->getActiveModuleInfo();
}
return $this->_aActiveModuleInfo;
} | php | protected function _getActiveModuleInfo()
{
if ($this->_aActiveModuleInfo === null) {
$modulelist = oxNew(\OxidEsales\Eshop\Core\Module\ModuleList::class);
$this->_aActiveModuleInfo = $modulelist->getActiveModuleInfo();
}
return $this->_aActiveModuleInfo;
} | [
"protected",
"function",
"_getActiveModuleInfo",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_aActiveModuleInfo",
"===",
"null",
")",
"{",
"$",
"modulelist",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Module",
"\\",
"Modul... | Returns active module Ids
@return array | [
"Returns",
"active",
"module",
"Ids"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/UtilsView.php#L524-L532 | train |
OXID-eSales/oxideshop_ce | source/Core/UtilsView.php | UtilsView.addActiveThemeId | protected function addActiveThemeId($themePath)
{
$themeId = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('sTheme');
if ($this->isAdmin()) {
$themeId = 'admin';
}
return $themePath . $themeId . "/tpl/";
} | php | protected function addActiveThemeId($themePath)
{
$themeId = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('sTheme');
if ($this->isAdmin()) {
$themeId = 'admin';
}
return $themePath . $themeId . "/tpl/";
} | [
"protected",
"function",
"addActiveThemeId",
"(",
"$",
"themePath",
")",
"{",
"$",
"themeId",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
"getConfigParam",
"(",
"'sTheme'",
")",
";",
"if",
"(",... | Add active theme at the end of theme path to form full path to templates.
@param string $themePath
@return string | [
"Add",
"active",
"theme",
"at",
"the",
"end",
"of",
"theme",
"path",
"to",
"form",
"full",
"path",
"to",
"templates",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/UtilsView.php#L541-L549 | train |
OXID-eSales/oxideshop_ce | source/Core/UtilsView.php | UtilsView.formListOfDuplicatedBlocks | private function formListOfDuplicatedBlocks($activeBlockTemplates)
{
$templateBlocksToExchange = [];
$customThemeId = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('sCustomTheme');
foreach ($activeBlockTemplates as $activeBlockTemplate) {
if ($activeBlockTemplate['OXTHEME']) {
if ($customThemeId && $customThemeId === $activeBlockTemplate['OXTHEME']) {
$templateBlocksToExchange['custom_theme'][] = $this->prepareBlockKey($activeBlockTemplate);
} else {
$templateBlocksToExchange['theme'][] = $this->prepareBlockKey($activeBlockTemplate);
}
}
}
return $templateBlocksToExchange;
} | php | private function formListOfDuplicatedBlocks($activeBlockTemplates)
{
$templateBlocksToExchange = [];
$customThemeId = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('sCustomTheme');
foreach ($activeBlockTemplates as $activeBlockTemplate) {
if ($activeBlockTemplate['OXTHEME']) {
if ($customThemeId && $customThemeId === $activeBlockTemplate['OXTHEME']) {
$templateBlocksToExchange['custom_theme'][] = $this->prepareBlockKey($activeBlockTemplate);
} else {
$templateBlocksToExchange['theme'][] = $this->prepareBlockKey($activeBlockTemplate);
}
}
}
return $templateBlocksToExchange;
} | [
"private",
"function",
"formListOfDuplicatedBlocks",
"(",
"$",
"activeBlockTemplates",
")",
"{",
"$",
"templateBlocksToExchange",
"=",
"[",
"]",
";",
"$",
"customThemeId",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
... | Form list of blocks which has duplicates for specific theme.
@param array $activeBlockTemplates
@return array | [
"Form",
"list",
"of",
"blocks",
"which",
"has",
"duplicates",
"for",
"specific",
"theme",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/UtilsView.php#L643-L659 | train |
OXID-eSales/oxideshop_ce | source/Core/UtilsView.php | UtilsView.removeDefaultBlocks | private function removeDefaultBlocks($activeBlockTemplates, $templateBlocksToExchange)
{
$templateBlocks = [];
foreach ($activeBlockTemplates as $activeBlockTemplate) {
if (!in_array($this->prepareBlockKey($activeBlockTemplate), $templateBlocksToExchange['theme'])
|| $activeBlockTemplate['OXTHEME']
) {
$templateBlocks[] = $activeBlockTemplate;
}
}
return $templateBlocks;
} | php | private function removeDefaultBlocks($activeBlockTemplates, $templateBlocksToExchange)
{
$templateBlocks = [];
foreach ($activeBlockTemplates as $activeBlockTemplate) {
if (!in_array($this->prepareBlockKey($activeBlockTemplate), $templateBlocksToExchange['theme'])
|| $activeBlockTemplate['OXTHEME']
) {
$templateBlocks[] = $activeBlockTemplate;
}
}
return $templateBlocks;
} | [
"private",
"function",
"removeDefaultBlocks",
"(",
"$",
"activeBlockTemplates",
",",
"$",
"templateBlocksToExchange",
")",
"{",
"$",
"templateBlocks",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"activeBlockTemplates",
"as",
"$",
"activeBlockTemplate",
")",
"{",
"if"... | Remove default blocks whose have duplicate for specific theme.
@param array $activeBlockTemplates
@param array $templateBlocksToExchange
@return array | [
"Remove",
"default",
"blocks",
"whose",
"have",
"duplicate",
"for",
"specific",
"theme",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/UtilsView.php#L669-L681 | train |
OXID-eSales/oxideshop_ce | source/Core/UtilsView.php | UtilsView.removeParentBlocks | private function removeParentBlocks($templateBlocks, $templateBlocksToExchange)
{
$activeBlockTemplates = $templateBlocks;
$templateBlocks = [];
$customThemeId = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('sCustomTheme');
foreach ($activeBlockTemplates as $activeBlockTemplate) {
if (!in_array($this->prepareBlockKey($activeBlockTemplate), $templateBlocksToExchange['custom_theme'])
|| $activeBlockTemplate['OXTHEME'] === $customThemeId
) {
$templateBlocks[] = $activeBlockTemplate;
}
}
return $templateBlocks;
} | php | private function removeParentBlocks($templateBlocks, $templateBlocksToExchange)
{
$activeBlockTemplates = $templateBlocks;
$templateBlocks = [];
$customThemeId = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('sCustomTheme');
foreach ($activeBlockTemplates as $activeBlockTemplate) {
if (!in_array($this->prepareBlockKey($activeBlockTemplate), $templateBlocksToExchange['custom_theme'])
|| $activeBlockTemplate['OXTHEME'] === $customThemeId
) {
$templateBlocks[] = $activeBlockTemplate;
}
}
return $templateBlocks;
} | [
"private",
"function",
"removeParentBlocks",
"(",
"$",
"templateBlocks",
",",
"$",
"templateBlocksToExchange",
")",
"{",
"$",
"activeBlockTemplates",
"=",
"$",
"templateBlocks",
";",
"$",
"templateBlocks",
"=",
"[",
"]",
";",
"$",
"customThemeId",
"=",
"\\",
"Ox... | Remove parent theme blocks whose have duplicate for custom theme.
@param array $templateBlocks
@param array $templateBlocksToExchange
@return array | [
"Remove",
"parent",
"theme",
"blocks",
"whose",
"have",
"duplicate",
"for",
"custom",
"theme",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/UtilsView.php#L691-L705 | train |
OXID-eSales/oxideshop_ce | source/Core/UtilsView.php | UtilsView.fillTemplateBlockWithContent | private function fillTemplateBlockWithContent($blockTemplates)
{
$templateBlocksWithContent = [];
foreach ($blockTemplates as $activeBlockTemplate) {
try {
if (!is_array($templateBlocksWithContent[$activeBlockTemplate['OXBLOCKNAME']])) {
$templateBlocksWithContent[$activeBlockTemplate['OXBLOCKNAME']] = [];
}
$templateBlocksWithContent[$activeBlockTemplate['OXBLOCKNAME']][] = $this->_getTemplateBlock($activeBlockTemplate['OXMODULE'], $activeBlockTemplate['OXFILE']);
} catch (\OxidEsales\Eshop\Core\Exception\StandardException $exception) {
\OxidEsales\Eshop\Core\Registry::getLogger()->error($exception->getMessage(), [$exception]);
}
}
return $templateBlocksWithContent;
} | php | private function fillTemplateBlockWithContent($blockTemplates)
{
$templateBlocksWithContent = [];
foreach ($blockTemplates as $activeBlockTemplate) {
try {
if (!is_array($templateBlocksWithContent[$activeBlockTemplate['OXBLOCKNAME']])) {
$templateBlocksWithContent[$activeBlockTemplate['OXBLOCKNAME']] = [];
}
$templateBlocksWithContent[$activeBlockTemplate['OXBLOCKNAME']][] = $this->_getTemplateBlock($activeBlockTemplate['OXMODULE'], $activeBlockTemplate['OXFILE']);
} catch (\OxidEsales\Eshop\Core\Exception\StandardException $exception) {
\OxidEsales\Eshop\Core\Registry::getLogger()->error($exception->getMessage(), [$exception]);
}
}
return $templateBlocksWithContent;
} | [
"private",
"function",
"fillTemplateBlockWithContent",
"(",
"$",
"blockTemplates",
")",
"{",
"$",
"templateBlocksWithContent",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"blockTemplates",
"as",
"$",
"activeBlockTemplate",
")",
"{",
"try",
"{",
"if",
"(",
"!",
"i... | Fill array with template content or skip if template does not exist.
Logs error message if template does not exist.
Example of $activeBlockTemplates:
OXTEMPLATE = "requested_template_name.tpl" OXBLOCKNAME = "block_name_a"
"content_a_active"
OXTEMPLATE = "requested_template_name.tpl" OXBLOCKNAME = "block_name_b"
OXFILE = "x"
"content_b_x_default"
OXTEMPLATE = "requested_template_name.tpl" OXBLOCKNAME = "block_name_b"
OXFILE = "y"
"content_b_y_default"
Example of return:
$templateBlocks = [
block_name_a = [
0 => "content_a_active"
],
block_name_c = [
0 => "content_b_x_default",
1 => "content_b_y_default"
]
]
@param array $blockTemplates
@return array | [
"Fill",
"array",
"with",
"template",
"content",
"or",
"skip",
"if",
"template",
"does",
"not",
"exist",
".",
"Logs",
"error",
"message",
"if",
"template",
"does",
"not",
"exist",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/UtilsView.php#L740-L756 | train |
OXID-eSales/oxideshop_ce | source/Core/UtilsServer.php | UtilsServer._mustSaveToSession | protected function _mustSaveToSession()
{
if ($this->_blSaveToSession === null) {
$this->_blSaveToSession = false;
$myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
if ($sSslUrl = $myConfig->getSslShopUrl()) {
$sUrl = $myConfig->getShopUrl();
$sHost = parse_url($sUrl, PHP_URL_HOST);
$sSslHost = parse_url($sSslUrl, PHP_URL_HOST);
// testing if domains matches..
if ($sHost != $sSslHost) {
$oUtils = \OxidEsales\Eshop\Core\Registry::getUtils();
$this->_blSaveToSession = $oUtils->extractDomain($sHost) != $oUtils->extractDomain($sSslHost);
}
}
}
return $this->_blSaveToSession;
} | php | protected function _mustSaveToSession()
{
if ($this->_blSaveToSession === null) {
$this->_blSaveToSession = false;
$myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
if ($sSslUrl = $myConfig->getSslShopUrl()) {
$sUrl = $myConfig->getShopUrl();
$sHost = parse_url($sUrl, PHP_URL_HOST);
$sSslHost = parse_url($sSslUrl, PHP_URL_HOST);
// testing if domains matches..
if ($sHost != $sSslHost) {
$oUtils = \OxidEsales\Eshop\Core\Registry::getUtils();
$this->_blSaveToSession = $oUtils->extractDomain($sHost) != $oUtils->extractDomain($sSslHost);
}
}
}
return $this->_blSaveToSession;
} | [
"protected",
"function",
"_mustSaveToSession",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_blSaveToSession",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"_blSaveToSession",
"=",
"false",
";",
"$",
"myConfig",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\"... | Checks if cookie must be saved to session in order to transfer it to different domain
@return bool | [
"Checks",
"if",
"cookie",
"must",
"be",
"saved",
"to",
"session",
"in",
"order",
"to",
"transfer",
"it",
"to",
"different",
"domain"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/UtilsServer.php#L83-L104 | train |
OXID-eSales/oxideshop_ce | source/Core/UtilsServer.php | UtilsServer._getSessionCookieKey | protected function _getSessionCookieKey($blGet)
{
$blSsl = \OxidEsales\Eshop\Core\Registry::getConfig()->isSsl();
$sKey = $blSsl ? 'nossl' : 'ssl';
if ($blGet) {
$sKey = $blSsl ? 'ssl' : 'nossl';
}
return $sKey;
} | php | protected function _getSessionCookieKey($blGet)
{
$blSsl = \OxidEsales\Eshop\Core\Registry::getConfig()->isSsl();
$sKey = $blSsl ? 'nossl' : 'ssl';
if ($blGet) {
$sKey = $blSsl ? 'ssl' : 'nossl';
}
return $sKey;
} | [
"protected",
"function",
"_getSessionCookieKey",
"(",
"$",
"blGet",
")",
"{",
"$",
"blSsl",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
"isSsl",
"(",
")",
";",
"$",
"sKey",
"=",
"$",
"blSsl... | Returns session cookie key
@param bool $blGet mode - true - get, false - set cookie
@return string | [
"Returns",
"session",
"cookie",
"key"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/UtilsServer.php#L113-L123 | train |
OXID-eSales/oxideshop_ce | source/Core/UtilsServer.php | UtilsServer._saveSessionCookie | protected function _saveSessionCookie($sName, $sValue, $iExpire, $sPath, $sDomain)
{
if ($this->_mustSaveToSession()) {
$aCookieData = ['value' => $sValue, 'expire' => $iExpire, 'path' => $sPath, 'domain' => $sDomain];
$aSessionCookies = ( array ) \OxidEsales\Eshop\Core\Registry::getSession()->getVariable($this->_sSessionCookiesName);
$aSessionCookies[$this->_getSessionCookieKey(false)][$sName] = $aCookieData;
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable($this->_sSessionCookiesName, $aSessionCookies);
}
} | php | protected function _saveSessionCookie($sName, $sValue, $iExpire, $sPath, $sDomain)
{
if ($this->_mustSaveToSession()) {
$aCookieData = ['value' => $sValue, 'expire' => $iExpire, 'path' => $sPath, 'domain' => $sDomain];
$aSessionCookies = ( array ) \OxidEsales\Eshop\Core\Registry::getSession()->getVariable($this->_sSessionCookiesName);
$aSessionCookies[$this->_getSessionCookieKey(false)][$sName] = $aCookieData;
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable($this->_sSessionCookiesName, $aSessionCookies);
}
} | [
"protected",
"function",
"_saveSessionCookie",
"(",
"$",
"sName",
",",
"$",
"sValue",
",",
"$",
"iExpire",
",",
"$",
"sPath",
",",
"$",
"sDomain",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_mustSaveToSession",
"(",
")",
")",
"{",
"$",
"aCookieData",
"="... | Copies cookie info to session
@param string $sName cookie name
@param string $sValue cookie value
@param int $iExpire expiration time
@param string $sPath cookie path
@param string $sDomain cookie domain | [
"Copies",
"cookie",
"info",
"to",
"session"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/UtilsServer.php#L134-L144 | train |
OXID-eSales/oxideshop_ce | source/Core/UtilsServer.php | UtilsServer.loadSessionCookies | public function loadSessionCookies()
{
if (($aSessionCookies = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable($this->_sSessionCookiesName))) {
$sKey = $this->_getSessionCookieKey(true);
if (isset($aSessionCookies[$sKey])) {
// writing session data to cookies
foreach ($aSessionCookies[$sKey] as $sName => $aCookieData) {
$this->setOxCookie($sName, $aCookieData['value'], $aCookieData['expire'], $aCookieData['path'], $aCookieData['domain'], false);
$this->_sSessionCookies[$sName] = $aCookieData['value'];
}
// cleanup
unset($aSessionCookies[$sKey]);
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable($this->_sSessionCookiesName, $aSessionCookies);
}
}
} | php | public function loadSessionCookies()
{
if (($aSessionCookies = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable($this->_sSessionCookiesName))) {
$sKey = $this->_getSessionCookieKey(true);
if (isset($aSessionCookies[$sKey])) {
// writing session data to cookies
foreach ($aSessionCookies[$sKey] as $sName => $aCookieData) {
$this->setOxCookie($sName, $aCookieData['value'], $aCookieData['expire'], $aCookieData['path'], $aCookieData['domain'], false);
$this->_sSessionCookies[$sName] = $aCookieData['value'];
}
// cleanup
unset($aSessionCookies[$sKey]);
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable($this->_sSessionCookiesName, $aSessionCookies);
}
}
} | [
"public",
"function",
"loadSessionCookies",
"(",
")",
"{",
"if",
"(",
"(",
"$",
"aSessionCookies",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getSession",
"(",
")",
"->",
"getVariable",
"(",
"$",
"this",
"->",
"_sSession... | Stored all session cookie info to cookies | [
"Stored",
"all",
"session",
"cookie",
"info",
"to",
"cookies"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/UtilsServer.php#L149-L165 | train |
OXID-eSales/oxideshop_ce | source/Core/UtilsServer.php | UtilsServer._getCookiePath | protected function _getCookiePath($sPath)
{
if ($aCookiePaths = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('aCookiePaths')) {
// in case user wants to have shop specific setup
$sShopId = \OxidEsales\Eshop\Core\Registry::getConfig()->getShopId();
$sPath = isset($aCookiePaths[$sShopId]) ? $aCookiePaths[$sShopId] : $sPath;
}
// from php doc: .. You may also replace an argument with an empty string ("") in order to skip that argument..
return $sPath ? $sPath : "";
} | php | protected function _getCookiePath($sPath)
{
if ($aCookiePaths = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('aCookiePaths')) {
// in case user wants to have shop specific setup
$sShopId = \OxidEsales\Eshop\Core\Registry::getConfig()->getShopId();
$sPath = isset($aCookiePaths[$sShopId]) ? $aCookiePaths[$sShopId] : $sPath;
}
// from php doc: .. You may also replace an argument with an empty string ("") in order to skip that argument..
return $sPath ? $sPath : "";
} | [
"protected",
"function",
"_getCookiePath",
"(",
"$",
"sPath",
")",
"{",
"if",
"(",
"$",
"aCookiePaths",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
"getConfigParam",
"(",
"'aCookiePaths'",
")",
... | Returns cookie path. If user did not set path, or set it to null, according to php
documentation empty string will be returned, marking to skip argument. Additionally
path can be defined in config.inc.php file as "sCookiePath" param. Please check cookie
documentation for more details about current parameter
@param string $sPath user defined cookie path
@return string | [
"Returns",
"cookie",
"path",
".",
"If",
"user",
"did",
"not",
"set",
"path",
"or",
"set",
"it",
"to",
"null",
"according",
"to",
"php",
"documentation",
"empty",
"string",
"will",
"be",
"returned",
"marking",
"to",
"skip",
"argument",
".",
"Additionally",
... | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/UtilsServer.php#L177-L187 | train |
OXID-eSales/oxideshop_ce | source/Core/UtilsServer.php | UtilsServer._getCookieDomain | protected function _getCookieDomain($sDomain)
{
$sDomain = $sDomain ? $sDomain : "";
// on special cases, like separate domain for SSL, cookies must be defined on domain specific path
// please have a look at
if (!$sDomain) {
if ($aCookieDomains = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('aCookieDomains')) {
// in case user wants to have shop specific setup
$sShopId = \OxidEsales\Eshop\Core\Registry::getConfig()->getShopId();
$sDomain = isset($aCookieDomains[$sShopId]) ? $aCookieDomains[$sShopId] : $sDomain;
}
}
return $sDomain;
} | php | protected function _getCookieDomain($sDomain)
{
$sDomain = $sDomain ? $sDomain : "";
// on special cases, like separate domain for SSL, cookies must be defined on domain specific path
// please have a look at
if (!$sDomain) {
if ($aCookieDomains = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('aCookieDomains')) {
// in case user wants to have shop specific setup
$sShopId = \OxidEsales\Eshop\Core\Registry::getConfig()->getShopId();
$sDomain = isset($aCookieDomains[$sShopId]) ? $aCookieDomains[$sShopId] : $sDomain;
}
}
return $sDomain;
} | [
"protected",
"function",
"_getCookieDomain",
"(",
"$",
"sDomain",
")",
"{",
"$",
"sDomain",
"=",
"$",
"sDomain",
"?",
"$",
"sDomain",
":",
"\"\"",
";",
"// on special cases, like separate domain for SSL, cookies must be defined on domain specific path",
"// please have a look... | Returns domain that cookie available. If user did not set domain, or set it to null, according to php
documentation empty string will be returned, marking to skip argument. Additionally domain can be defined
in config.inc.php file as "sCookieDomain" param. Please check cookie documentation for more details about
current parameter
@param string $sDomain the domain that the cookie is available.
@return string | [
"Returns",
"domain",
"that",
"cookie",
"available",
".",
"If",
"user",
"did",
"not",
"set",
"domain",
"or",
"set",
"it",
"to",
"null",
"according",
"to",
"php",
"documentation",
"empty",
"string",
"will",
"be",
"returned",
"marking",
"to",
"skip",
"argument"... | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/UtilsServer.php#L199-L214 | train |
OXID-eSales/oxideshop_ce | source/Core/UtilsServer.php | UtilsServer.getRemoteAddress | public function getRemoteAddress()
{
if (isset($_SERVER["HTTP_X_FORWARDED_FOR"])) {
$sIP = $_SERVER["HTTP_X_FORWARDED_FOR"];
$sIP = preg_replace('/,.*$/', '', $sIP);
} elseif (isset($_SERVER["HTTP_CLIENT_IP"])) {
$sIP = $_SERVER["HTTP_CLIENT_IP"];
} else {
$sIP = $_SERVER["REMOTE_ADDR"];
}
return $sIP;
} | php | public function getRemoteAddress()
{
if (isset($_SERVER["HTTP_X_FORWARDED_FOR"])) {
$sIP = $_SERVER["HTTP_X_FORWARDED_FOR"];
$sIP = preg_replace('/,.*$/', '', $sIP);
} elseif (isset($_SERVER["HTTP_CLIENT_IP"])) {
$sIP = $_SERVER["HTTP_CLIENT_IP"];
} else {
$sIP = $_SERVER["REMOTE_ADDR"];
}
return $sIP;
} | [
"public",
"function",
"getRemoteAddress",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"_SERVER",
"[",
"\"HTTP_X_FORWARDED_FOR\"",
"]",
")",
")",
"{",
"$",
"sIP",
"=",
"$",
"_SERVER",
"[",
"\"HTTP_X_FORWARDED_FOR\"",
"]",
";",
"$",
"sIP",
"=",
"preg_replac... | Returns remote IP address
@return string | [
"Returns",
"remote",
"IP",
"address"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/UtilsServer.php#L243-L255 | train |
OXID-eSales/oxideshop_ce | source/Core/UtilsServer.php | UtilsServer.getServerVar | public function getServerVar($sServVar = null)
{
$sValue = null;
if (isset($_SERVER)) {
if ($sServVar && isset($_SERVER[$sServVar])) {
$sValue = $_SERVER[$sServVar];
} elseif (!$sServVar) {
$sValue = $_SERVER;
}
}
return $sValue;
} | php | public function getServerVar($sServVar = null)
{
$sValue = null;
if (isset($_SERVER)) {
if ($sServVar && isset($_SERVER[$sServVar])) {
$sValue = $_SERVER[$sServVar];
} elseif (!$sServVar) {
$sValue = $_SERVER;
}
}
return $sValue;
} | [
"public",
"function",
"getServerVar",
"(",
"$",
"sServVar",
"=",
"null",
")",
"{",
"$",
"sValue",
"=",
"null",
";",
"if",
"(",
"isset",
"(",
"$",
"_SERVER",
")",
")",
"{",
"if",
"(",
"$",
"sServVar",
"&&",
"isset",
"(",
"$",
"_SERVER",
"[",
"$",
... | returns a server constant
@param string $sServVar optional - which server var should be returned, if null returns whole $_SERVER
@return mixed | [
"returns",
"a",
"server",
"constant"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/UtilsServer.php#L264-L276 | train |
OXID-eSales/oxideshop_ce | source/Core/UtilsServer.php | UtilsServer.setUserCookie | public function setUserCookie($userName, $passwordHash, $shopId = null, $timeout = 31536000, $salt = User::USER_COOKIE_SALT)
{
$myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
$shopId = $shopId ?? $myConfig->getShopId();
$sSslUrl = $myConfig->getSslShopUrl();
if (stripos($sSslUrl, 'https') === 0) {
$blSsl = true;
} else {
$blSsl = false;
}
$this->_aUserCookie[$shopId] = $userName . '@@@' . crypt($passwordHash, $salt);
$this->setOxCookie('oxid_' . $shopId, $this->_aUserCookie[$shopId], \OxidEsales\Eshop\Core\Registry::getUtilsDate()->getTime() + $timeout, '/', null, true, $blSsl);
$this->setOxCookie('oxid_' . $shopId . '_autologin', '1', \OxidEsales\Eshop\Core\Registry::getUtilsDate()->getTime() + $timeout, '/', null, true, false);
} | php | public function setUserCookie($userName, $passwordHash, $shopId = null, $timeout = 31536000, $salt = User::USER_COOKIE_SALT)
{
$myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
$shopId = $shopId ?? $myConfig->getShopId();
$sSslUrl = $myConfig->getSslShopUrl();
if (stripos($sSslUrl, 'https') === 0) {
$blSsl = true;
} else {
$blSsl = false;
}
$this->_aUserCookie[$shopId] = $userName . '@@@' . crypt($passwordHash, $salt);
$this->setOxCookie('oxid_' . $shopId, $this->_aUserCookie[$shopId], \OxidEsales\Eshop\Core\Registry::getUtilsDate()->getTime() + $timeout, '/', null, true, $blSsl);
$this->setOxCookie('oxid_' . $shopId . '_autologin', '1', \OxidEsales\Eshop\Core\Registry::getUtilsDate()->getTime() + $timeout, '/', null, true, false);
} | [
"public",
"function",
"setUserCookie",
"(",
"$",
"userName",
",",
"$",
"passwordHash",
",",
"$",
"shopId",
"=",
"null",
",",
"$",
"timeout",
"=",
"31536000",
",",
"$",
"salt",
"=",
"User",
"::",
"USER_COOKIE_SALT",
")",
"{",
"$",
"myConfig",
"=",
"\\",
... | Sets user info into cookie
@param string $userName user name
@param string $passwordHash password hash
@param int $shopId shop ID (default null)
@param integer $timeout timeout value (default 31536000)
@param string $salt | [
"Sets",
"user",
"info",
"into",
"cookie"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/UtilsServer.php#L287-L301 | train |
OXID-eSales/oxideshop_ce | source/Core/UtilsServer.php | UtilsServer.deleteUserCookie | public function deleteUserCookie($sShopId = null)
{
$myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
$sShopId = (!$sShopId) ? \OxidEsales\Eshop\Core\Registry::getConfig()->getShopId() : $sShopId;
$sSslUrl = $myConfig->getSslShopUrl();
if (stripos($sSslUrl, 'https') === 0) {
$blSsl = true;
} else {
$blSsl = false;
}
$this->_aUserCookie[$sShopId] = '';
$this->setOxCookie('oxid_' . $sShopId, '', \OxidEsales\Eshop\Core\Registry::getUtilsDate()->getTime() - 3600, '/', null, true, $blSsl);
$this->setOxCookie('oxid_' . $sShopId . '_autologin', '0', \OxidEsales\Eshop\Core\Registry::getUtilsDate()->getTime() - 3600, '/', null, true, false);
} | php | public function deleteUserCookie($sShopId = null)
{
$myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
$sShopId = (!$sShopId) ? \OxidEsales\Eshop\Core\Registry::getConfig()->getShopId() : $sShopId;
$sSslUrl = $myConfig->getSslShopUrl();
if (stripos($sSslUrl, 'https') === 0) {
$blSsl = true;
} else {
$blSsl = false;
}
$this->_aUserCookie[$sShopId] = '';
$this->setOxCookie('oxid_' . $sShopId, '', \OxidEsales\Eshop\Core\Registry::getUtilsDate()->getTime() - 3600, '/', null, true, $blSsl);
$this->setOxCookie('oxid_' . $sShopId . '_autologin', '0', \OxidEsales\Eshop\Core\Registry::getUtilsDate()->getTime() - 3600, '/', null, true, false);
} | [
"public",
"function",
"deleteUserCookie",
"(",
"$",
"sShopId",
"=",
"null",
")",
"{",
"$",
"myConfig",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
";",
"$",
"sShopId",
"=",
"(",
"!",
"$",
"sShopI... | Deletes user cookie data
@param string $sShopId shop ID (default null) | [
"Deletes",
"user",
"cookie",
"data"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/UtilsServer.php#L308-L322 | train |
OXID-eSales/oxideshop_ce | source/Core/UtilsServer.php | UtilsServer.getUserCookie | public function getUserCookie($sShopId = null)
{
$myConfig = Registry::getConfig();
$sShopId = (!$sShopId) ? $myConfig->getShopId() : $sShopId;
// check for SSL connection
if (!$myConfig->isSsl() && $this->getOxCookie('oxid_' . $sShopId . '_autologin') == '1') {
$sSslUrl = rtrim($myConfig->getSslShopUrl(), '/') . $_SERVER['REQUEST_URI'];
if (stripos($sSslUrl, 'https') === 0) {
\OxidEsales\Eshop\Core\Registry::getUtils()->redirect($sSslUrl, true, 302);
}
}
if (array_key_exists($sShopId, $this->_aUserCookie) && $this->_aUserCookie[$sShopId] !== null) {
return $this->_aUserCookie[$sShopId] ? $this->_aUserCookie[$sShopId] : null;
}
return $this->_aUserCookie[$sShopId] = $this->getOxCookie('oxid_' . $sShopId);
} | php | public function getUserCookie($sShopId = null)
{
$myConfig = Registry::getConfig();
$sShopId = (!$sShopId) ? $myConfig->getShopId() : $sShopId;
// check for SSL connection
if (!$myConfig->isSsl() && $this->getOxCookie('oxid_' . $sShopId . '_autologin') == '1') {
$sSslUrl = rtrim($myConfig->getSslShopUrl(), '/') . $_SERVER['REQUEST_URI'];
if (stripos($sSslUrl, 'https') === 0) {
\OxidEsales\Eshop\Core\Registry::getUtils()->redirect($sSslUrl, true, 302);
}
}
if (array_key_exists($sShopId, $this->_aUserCookie) && $this->_aUserCookie[$sShopId] !== null) {
return $this->_aUserCookie[$sShopId] ? $this->_aUserCookie[$sShopId] : null;
}
return $this->_aUserCookie[$sShopId] = $this->getOxCookie('oxid_' . $sShopId);
} | [
"public",
"function",
"getUserCookie",
"(",
"$",
"sShopId",
"=",
"null",
")",
"{",
"$",
"myConfig",
"=",
"Registry",
"::",
"getConfig",
"(",
")",
";",
"$",
"sShopId",
"=",
"(",
"!",
"$",
"sShopId",
")",
"?",
"$",
"myConfig",
"->",
"getShopId",
"(",
"... | Returns cookie stored used login data
@param string $sShopId shop ID (default null)
@return string | [
"Returns",
"cookie",
"stored",
"used",
"login",
"data"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/UtilsServer.php#L331-L348 | train |
OXID-eSales/oxideshop_ce | source/Core/UtilsServer.php | UtilsServer.isTrustedClientIp | public function isTrustedClientIp()
{
$blTrusted = false;
$aTrustedIPs = ( array ) \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam("aTrustedIPs");
if (count($aTrustedIPs)) {
$blTrusted = in_array($this->getRemoteAddress(), $aTrustedIPs);
}
return $blTrusted;
} | php | public function isTrustedClientIp()
{
$blTrusted = false;
$aTrustedIPs = ( array ) \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam("aTrustedIPs");
if (count($aTrustedIPs)) {
$blTrusted = in_array($this->getRemoteAddress(), $aTrustedIPs);
}
return $blTrusted;
} | [
"public",
"function",
"isTrustedClientIp",
"(",
")",
"{",
"$",
"blTrusted",
"=",
"false",
";",
"$",
"aTrustedIPs",
"=",
"(",
"array",
")",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
"getConfigParam... | Checks if current client ip is in trusted IPs list.
IP list is defined in config file as "aTrustedIPs" parameter
@return bool | [
"Checks",
"if",
"current",
"client",
"ip",
"is",
"in",
"trusted",
"IPs",
"list",
".",
"IP",
"list",
"is",
"defined",
"in",
"config",
"file",
"as",
"aTrustedIPs",
"parameter"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/UtilsServer.php#L356-L365 | train |
OXID-eSales/oxideshop_ce | source/Core/UtilsServer.php | UtilsServer.isCurrentUrl | public function isCurrentUrl($sURL)
{
// Missing protocol, cannot proceed, assuming true.
if (!$sURL || (strpos($sURL, "http") !== 0)) {
return true;
}
$sServerHost = $this->getServerVar('HTTP_HOST');
$blIsCurrentUrl = $this->_isCurrentUrl($sURL, $sServerHost);
if (!$blIsCurrentUrl) {
$sServerHost = $this->getServerVar('HTTP_X_FORWARDED_HOST');
if ($sServerHost) {
$blIsCurrentUrl = $this->_isCurrentUrl($sURL, $sServerHost);
}
}
return $blIsCurrentUrl;
} | php | public function isCurrentUrl($sURL)
{
// Missing protocol, cannot proceed, assuming true.
if (!$sURL || (strpos($sURL, "http") !== 0)) {
return true;
}
$sServerHost = $this->getServerVar('HTTP_HOST');
$blIsCurrentUrl = $this->_isCurrentUrl($sURL, $sServerHost);
if (!$blIsCurrentUrl) {
$sServerHost = $this->getServerVar('HTTP_X_FORWARDED_HOST');
if ($sServerHost) {
$blIsCurrentUrl = $this->_isCurrentUrl($sURL, $sServerHost);
}
}
return $blIsCurrentUrl;
} | [
"public",
"function",
"isCurrentUrl",
"(",
"$",
"sURL",
")",
"{",
"// Missing protocol, cannot proceed, assuming true.",
"if",
"(",
"!",
"$",
"sURL",
"||",
"(",
"strpos",
"(",
"$",
"sURL",
",",
"\"http\"",
")",
"!==",
"0",
")",
")",
"{",
"return",
"true",
... | Compares current URL to supplied string
@param string $sURL URL
@return bool true if $sURL is equal to current page URL | [
"Compares",
"current",
"URL",
"to",
"supplied",
"string"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/UtilsServer.php#L390-L407 | train |
OXID-eSales/oxideshop_ce | source/Core/GenericImport/ImportObject/User.php | User.import | public function import($data)
{
if (isset($data['OXUSERNAME'])) {
$id = $data['OXID'];
$userName = $data['OXUSERNAME'];
$user = oxNew(\OxidEsales\Eshop\Application\Model\User::class, "core");
$user->oxuser__oxusername = new \OxidEsales\Eshop\Core\Field($userName, \OxidEsales\Eshop\Core\Field::T_RAW);
if ($user->exists($id) && $id != $user->getId()) {
throw new Exception("USER $userName already exists!");
}
}
return parent::import($data);
} | php | public function import($data)
{
if (isset($data['OXUSERNAME'])) {
$id = $data['OXID'];
$userName = $data['OXUSERNAME'];
$user = oxNew(\OxidEsales\Eshop\Application\Model\User::class, "core");
$user->oxuser__oxusername = new \OxidEsales\Eshop\Core\Field($userName, \OxidEsales\Eshop\Core\Field::T_RAW);
if ($user->exists($id) && $id != $user->getId()) {
throw new Exception("USER $userName already exists!");
}
}
return parent::import($data);
} | [
"public",
"function",
"import",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"data",
"[",
"'OXUSERNAME'",
"]",
")",
")",
"{",
"$",
"id",
"=",
"$",
"data",
"[",
"'OXID'",
"]",
";",
"$",
"userName",
"=",
"$",
"data",
"[",
"'OXUSERNAME'... | Imports user. Returns import status.
@param array $data db row array
@throws Exception If user exists with provided OXID, throw an exception.
@return string $oxid on success, bool FALSE on failure | [
"Imports",
"user",
".",
"Returns",
"import",
"status",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/GenericImport/ImportObject/User.php#L31-L46 | train |
OXID-eSales/oxideshop_ce | source/Core/StrRegular.php | StrRegular.jsonEncode | public function jsonEncode($data)
{
if (is_array($data)) {
$ret = "";
$blWasOne = false;
$blNumerical = true;
reset($data);
while ($blNumerical && $key = key($data)) {
$blNumerical = !is_string($key);
}
if ($blNumerical) {
return '[' . implode(',', array_map([$this, 'jsonEncode'], $data)) . ']';
} else {
foreach ($data as $key => $val) {
if ($blWasOne) {
$ret .= ',';
} else {
$blWasOne = true;
}
$ret .= '"' . addslashes($key) . '":' . $this->jsonEncode($val);
}
return "{" . $ret . "}";
}
} else {
return '"' . addcslashes((string) $data, "\r\n\t\"\\") . '"';
}
} | php | public function jsonEncode($data)
{
if (is_array($data)) {
$ret = "";
$blWasOne = false;
$blNumerical = true;
reset($data);
while ($blNumerical && $key = key($data)) {
$blNumerical = !is_string($key);
}
if ($blNumerical) {
return '[' . implode(',', array_map([$this, 'jsonEncode'], $data)) . ']';
} else {
foreach ($data as $key => $val) {
if ($blWasOne) {
$ret .= ',';
} else {
$blWasOne = true;
}
$ret .= '"' . addslashes($key) . '":' . $this->jsonEncode($val);
}
return "{" . $ret . "}";
}
} else {
return '"' . addcslashes((string) $data, "\r\n\t\"\\") . '"';
}
} | [
"public",
"function",
"jsonEncode",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"data",
")",
")",
"{",
"$",
"ret",
"=",
"\"\"",
";",
"$",
"blWasOne",
"=",
"false",
";",
"$",
"blNumerical",
"=",
"true",
";",
"reset",
"(",
"$",
"da... | wrapper for json encode, which does not work with non utf8 characters
@param mixed $data data to encode
@return string | [
"wrapper",
"for",
"json",
"encode",
"which",
"does",
"not",
"work",
"with",
"non",
"utf8",
"characters"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/StrRegular.php#L331-L358 | train |
OXID-eSales/oxideshop_ce | source/Application/Component/UserComponent.php | UserComponent._loadSessionUser | protected function _loadSessionUser()
{
$myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
$oUser = $this->getUser();
// no session user
if (!$oUser) {
return;
}
// this user is blocked, deny him
if ($oUser->inGroup('oxidblocked')) {
$sUrl = $myConfig->getShopHomeUrl() . 'cl=content&tpl=user_blocked.tpl';
\OxidEsales\Eshop\Core\Registry::getUtils()->redirect($sUrl, true, 302);
}
// TODO: move this to a proper place
if ($oUser->isLoadedFromCookie() && !$myConfig->getConfigParam('blPerfNoBasketSaving')) {
if ($oBasket = $this->getSession()->getBasket()) {
$oBasket->load();
$oBasket->onUpdate();
}
}
} | php | protected function _loadSessionUser()
{
$myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
$oUser = $this->getUser();
// no session user
if (!$oUser) {
return;
}
// this user is blocked, deny him
if ($oUser->inGroup('oxidblocked')) {
$sUrl = $myConfig->getShopHomeUrl() . 'cl=content&tpl=user_blocked.tpl';
\OxidEsales\Eshop\Core\Registry::getUtils()->redirect($sUrl, true, 302);
}
// TODO: move this to a proper place
if ($oUser->isLoadedFromCookie() && !$myConfig->getConfigParam('blPerfNoBasketSaving')) {
if ($oBasket = $this->getSession()->getBasket()) {
$oBasket->load();
$oBasket->onUpdate();
}
}
} | [
"protected",
"function",
"_loadSessionUser",
"(",
")",
"{",
"$",
"myConfig",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
";",
"$",
"oUser",
"=",
"$",
"this",
"->",
"getUser",
"(",
")",
";",
"// n... | Tries to load user ID from session.
@return null | [
"Tries",
"to",
"load",
"user",
"ID",
"from",
"session",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Component/UserComponent.php#L150-L173 | train |
OXID-eSales/oxideshop_ce | source/Application/Component/UserComponent.php | UserComponent.registerUser | public function registerUser()
{
// registered new user ?
if ($this->createUser() != false && $this->_blIsNewUser) {
if ($this->_blNewsSubscriptionStatus === null || $this->_blNewsSubscriptionStatus) {
return 'register?success=1';
} else {
return 'register?success=1&newslettererror=4';
}
} else {
// problems with registration ...
$this->logout();
}
} | php | public function registerUser()
{
// registered new user ?
if ($this->createUser() != false && $this->_blIsNewUser) {
if ($this->_blNewsSubscriptionStatus === null || $this->_blNewsSubscriptionStatus) {
return 'register?success=1';
} else {
return 'register?success=1&newslettererror=4';
}
} else {
// problems with registration ...
$this->logout();
}
} | [
"public",
"function",
"registerUser",
"(",
")",
"{",
"// registered new user ?",
"if",
"(",
"$",
"this",
"->",
"createUser",
"(",
")",
"!=",
"false",
"&&",
"$",
"this",
"->",
"_blIsNewUser",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_blNewsSubscriptionStatus"... | Creates new oxid user
@return string partial parameter string or null | [
"Creates",
"new",
"oxid",
"user"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Component/UserComponent.php#L554-L567 | train |
OXID-eSales/oxideshop_ce | source/Application/Component/UserComponent.php | UserComponent.deleteShippingAddress | public function deleteShippingAddress()
{
$request = oxNew(Request::class);
$addressId = $request->getRequestParameter('oxaddressid');
$address = oxNew(Address::class);
$address->load($addressId);
if ($this->canUserDeleteShippingAddress($address) && $this->getSession()->checkSessionChallenge()) {
$address->delete($addressId);
}
} | php | public function deleteShippingAddress()
{
$request = oxNew(Request::class);
$addressId = $request->getRequestParameter('oxaddressid');
$address = oxNew(Address::class);
$address->load($addressId);
if ($this->canUserDeleteShippingAddress($address) && $this->getSession()->checkSessionChallenge()) {
$address->delete($addressId);
}
} | [
"public",
"function",
"deleteShippingAddress",
"(",
")",
"{",
"$",
"request",
"=",
"oxNew",
"(",
"Request",
"::",
"class",
")",
";",
"$",
"addressId",
"=",
"$",
"request",
"->",
"getRequestParameter",
"(",
"'oxaddressid'",
")",
";",
"$",
"address",
"=",
"o... | Deletes user shipping address. | [
"Deletes",
"user",
"shipping",
"address",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Component/UserComponent.php#L572-L582 | train |
OXID-eSales/oxideshop_ce | source/Application/Component/UserComponent.php | UserComponent.canUserDeleteShippingAddress | private function canUserDeleteShippingAddress($address)
{
$canDelete = false;
$user = $this->getUser();
if ($address->oxaddress__oxuserid->value === $user->getId()) {
$canDelete = true;
}
return $canDelete;
} | php | private function canUserDeleteShippingAddress($address)
{
$canDelete = false;
$user = $this->getUser();
if ($address->oxaddress__oxuserid->value === $user->getId()) {
$canDelete = true;
}
return $canDelete;
} | [
"private",
"function",
"canUserDeleteShippingAddress",
"(",
"$",
"address",
")",
"{",
"$",
"canDelete",
"=",
"false",
";",
"$",
"user",
"=",
"$",
"this",
"->",
"getUser",
"(",
")",
";",
"if",
"(",
"$",
"address",
"->",
"oxaddress__oxuserid",
"->",
"value",... | Checks if shipping address is assigned to user.
@param Address $address
@return bool | [
"Checks",
"if",
"shipping",
"address",
"is",
"assigned",
"to",
"user",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Component/UserComponent.php#L590-L599 | train |
OXID-eSales/oxideshop_ce | source/Application/Component/UserComponent.php | UserComponent._saveInvitor | protected function _saveInvitor()
{
if (\OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('blInvitationsEnabled')) {
$this->getInvitor();
$this->setRecipient();
}
} | php | protected function _saveInvitor()
{
if (\OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('blInvitationsEnabled')) {
$this->getInvitor();
$this->setRecipient();
}
} | [
"protected",
"function",
"_saveInvitor",
"(",
")",
"{",
"if",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
"getConfigParam",
"(",
"'blInvitationsEnabled'",
")",
")",
"{",
"$",
"this",
"->",
"get... | Saves invitor ID | [
"Saves",
"invitor",
"ID"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Component/UserComponent.php#L604-L610 | train |
OXID-eSales/oxideshop_ce | source/Application/Component/UserComponent.php | UserComponent._getDelAddressData | protected function _getDelAddressData()
{
// if user company name, user name and additional info has special chars
$blShowShipAddressParameter = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('blshowshipaddress');
$blShowShipAddressVariable = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable('blshowshipaddress');
$sDeliveryAddressParameter = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('deladr', true);
$aDeladr = ($blShowShipAddressParameter || $blShowShipAddressVariable) ? $sDeliveryAddressParameter : [];
$aDelAdress = $aDeladr;
if (is_array($aDeladr)) {
// checking if data is filled
if (isset($aDeladr['oxaddress__oxsal'])) {
unset($aDeladr['oxaddress__oxsal']);
}
if (!count($aDeladr) || implode('', $aDeladr) == '') {
// resetting to avoid empty records
$aDelAdress = [];
}
}
return $aDelAdress;
} | php | protected function _getDelAddressData()
{
// if user company name, user name and additional info has special chars
$blShowShipAddressParameter = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('blshowshipaddress');
$blShowShipAddressVariable = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable('blshowshipaddress');
$sDeliveryAddressParameter = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('deladr', true);
$aDeladr = ($blShowShipAddressParameter || $blShowShipAddressVariable) ? $sDeliveryAddressParameter : [];
$aDelAdress = $aDeladr;
if (is_array($aDeladr)) {
// checking if data is filled
if (isset($aDeladr['oxaddress__oxsal'])) {
unset($aDeladr['oxaddress__oxsal']);
}
if (!count($aDeladr) || implode('', $aDeladr) == '') {
// resetting to avoid empty records
$aDelAdress = [];
}
}
return $aDelAdress;
} | [
"protected",
"function",
"_getDelAddressData",
"(",
")",
"{",
"// if user company name, user name and additional info has special chars",
"$",
"blShowShipAddressParameter",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
... | Returns delivery address from request. Before returning array is checked if
all needed data is there
@return array | [
"Returns",
"delivery",
"address",
"from",
"request",
".",
"Before",
"returning",
"array",
"is",
"checked",
"if",
"all",
"needed",
"data",
"is",
"there"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Component/UserComponent.php#L739-L760 | train |
OXID-eSales/oxideshop_ce | source/Application/Component/UserComponent.php | UserComponent._getLogoutLink | protected function _getLogoutLink()
{
$oConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
$sLogoutLink = $oConfig->isSsl() ? $oConfig->getShopSecureHomeUrl() : $oConfig->getShopHomeUrl();
$sLogoutLink .= 'cl=' . $oConfig->getRequestControllerId() . $this->getParent()->getDynUrlParams();
if ($sParam = $oConfig->getRequestParameter('anid')) {
$sLogoutLink .= '&anid=' . $sParam;
}
if ($sParam = $oConfig->getRequestParameter('cnid')) {
$sLogoutLink .= '&cnid=' . $sParam;
}
if ($sParam = $oConfig->getRequestParameter('mnid')) {
$sLogoutLink .= '&mnid=' . $sParam;
}
if ($sParam = $oConfig->getRequestParameter('tpl')) {
$sLogoutLink .= '&tpl=' . $sParam;
}
if ($sParam = $oConfig->getRequestParameter('oxloadid')) {
$sLogoutLink .= '&oxloadid=' . $sParam;
}
// @deprecated since v5.3 (2016-06-17); Listmania will be moved to an own module.
if ($sParam = $oConfig->getRequestParameter('recommid')) {
$sLogoutLink .= '&recommid=' . $sParam;
}
// END deprecated
return $sLogoutLink . '&fnc=logout';
} | php | protected function _getLogoutLink()
{
$oConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
$sLogoutLink = $oConfig->isSsl() ? $oConfig->getShopSecureHomeUrl() : $oConfig->getShopHomeUrl();
$sLogoutLink .= 'cl=' . $oConfig->getRequestControllerId() . $this->getParent()->getDynUrlParams();
if ($sParam = $oConfig->getRequestParameter('anid')) {
$sLogoutLink .= '&anid=' . $sParam;
}
if ($sParam = $oConfig->getRequestParameter('cnid')) {
$sLogoutLink .= '&cnid=' . $sParam;
}
if ($sParam = $oConfig->getRequestParameter('mnid')) {
$sLogoutLink .= '&mnid=' . $sParam;
}
if ($sParam = $oConfig->getRequestParameter('tpl')) {
$sLogoutLink .= '&tpl=' . $sParam;
}
if ($sParam = $oConfig->getRequestParameter('oxloadid')) {
$sLogoutLink .= '&oxloadid=' . $sParam;
}
// @deprecated since v5.3 (2016-06-17); Listmania will be moved to an own module.
if ($sParam = $oConfig->getRequestParameter('recommid')) {
$sLogoutLink .= '&recommid=' . $sParam;
}
// END deprecated
return $sLogoutLink . '&fnc=logout';
} | [
"protected",
"function",
"_getLogoutLink",
"(",
")",
"{",
"$",
"oConfig",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
";",
"$",
"sLogoutLink",
"=",
"$",
"oConfig",
"->",
"isSsl",
"(",
")",
"?",
"... | Returns logout link with additional params
@return string $sLogoutLink | [
"Returns",
"logout",
"link",
"with",
"additional",
"params"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Component/UserComponent.php#L767-L795 | train |
OXID-eSales/oxideshop_ce | source/Application/Component/UserComponent.php | UserComponent.getInvitor | public function getInvitor()
{
$sSu = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable('su');
if (!$sSu && ($sSuNew = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('su'))) {
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable('su', $sSuNew);
}
} | php | public function getInvitor()
{
$sSu = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable('su');
if (!$sSu && ($sSuNew = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('su'))) {
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable('su', $sSuNew);
}
} | [
"public",
"function",
"getInvitor",
"(",
")",
"{",
"$",
"sSu",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getSession",
"(",
")",
"->",
"getVariable",
"(",
"'su'",
")",
";",
"if",
"(",
"!",
"$",
"sSu",
"&&",
"(",
... | Sets invitor id to session from URL | [
"Sets",
"invitor",
"id",
"to",
"session",
"from",
"URL"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Component/UserComponent.php#L823-L830 | train |
OXID-eSales/oxideshop_ce | source/Application/Component/UserComponent.php | UserComponent.setRecipient | public function setRecipient()
{
$sRe = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable('re');
if (!$sRe && ($sReNew = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('re'))) {
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable('re', $sReNew);
}
} | php | public function setRecipient()
{
$sRe = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable('re');
if (!$sRe && ($sReNew = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('re'))) {
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable('re', $sReNew);
}
} | [
"public",
"function",
"setRecipient",
"(",
")",
"{",
"$",
"sRe",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getSession",
"(",
")",
"->",
"getVariable",
"(",
"'re'",
")",
";",
"if",
"(",
"!",
"$",
"sRe",
"&&",
"(",
... | sets from URL invitor id | [
"sets",
"from",
"URL",
"invitor",
"id"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Component/UserComponent.php#L835-L841 | train |
OXID-eSales/oxideshop_ce | source/Application/Component/UserComponent.php | UserComponent.trimAddress | private function trimAddress($address)
{
if (is_array($address)) {
$fields = oxNew(FormFields::class, $address);
$trimmer = oxNew(FormFieldsTrimmer::class);
$address = (array)$trimmer->trim($fields);
}
return $address;
} | php | private function trimAddress($address)
{
if (is_array($address)) {
$fields = oxNew(FormFields::class, $address);
$trimmer = oxNew(FormFieldsTrimmer::class);
$address = (array)$trimmer->trim($fields);
}
return $address;
} | [
"private",
"function",
"trimAddress",
"(",
"$",
"address",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"address",
")",
")",
"{",
"$",
"fields",
"=",
"oxNew",
"(",
"FormFields",
"::",
"class",
",",
"$",
"address",
")",
";",
"$",
"trimmer",
"=",
"oxNew"... | Returns trimmed address.
@param array $address
@return array | [
"Returns",
"trimmed",
"address",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Component/UserComponent.php#L868-L878 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Delivery.php | Delivery.getArticles | public function getArticles()
{
if (is_null($this->_aArtIds)) {
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$sQ = "select oxobjectid from oxobject2delivery where oxdeliveryid=" . $oDb->quote($this->getId()) . " and oxtype = 'oxarticles'";
$aArtIds = $oDb->getCol($sQ);
$this->_aArtIds = $aArtIds;
}
return $this->_aArtIds;
} | php | public function getArticles()
{
if (is_null($this->_aArtIds)) {
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$sQ = "select oxobjectid from oxobject2delivery where oxdeliveryid=" . $oDb->quote($this->getId()) . " and oxtype = 'oxarticles'";
$aArtIds = $oDb->getCol($sQ);
$this->_aArtIds = $aArtIds;
}
return $this->_aArtIds;
} | [
"public",
"function",
"getArticles",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"_aArtIds",
")",
")",
"{",
"$",
"oDb",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"DatabaseProvider",
"::",
"getDb",
"(",
")",
";",
"$"... | Collects article Ids which are assigned to current delivery
@return array | [
"Collects",
"article",
"Ids",
"which",
"are",
"assigned",
"to",
"current",
"delivery"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Delivery.php#L145-L155 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Delivery.php | Delivery.getCategories | public function getCategories()
{
if (is_null($this->_aCatIds)) {
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$sQ = "select oxobjectid from oxobject2delivery where oxdeliveryid=" . $oDb->quote($this->getId()) . " and oxtype = 'oxcategories'";
$aCatIds = $oDb->getCol($sQ);
$this->_aCatIds = $aCatIds;
}
return $this->_aCatIds;
} | php | public function getCategories()
{
if (is_null($this->_aCatIds)) {
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$sQ = "select oxobjectid from oxobject2delivery where oxdeliveryid=" . $oDb->quote($this->getId()) . " and oxtype = 'oxcategories'";
$aCatIds = $oDb->getCol($sQ);
$this->_aCatIds = $aCatIds;
}
return $this->_aCatIds;
} | [
"public",
"function",
"getCategories",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"_aCatIds",
")",
")",
"{",
"$",
"oDb",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"DatabaseProvider",
"::",
"getDb",
"(",
")",
";",
"... | Collects category Ids which are assigned to current delivery
@return array | [
"Collects",
"category",
"Ids",
"which",
"are",
"assigned",
"to",
"current",
"delivery"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Delivery.php#L162-L172 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Delivery.php | Delivery.getDeliveryPrice | public function getDeliveryPrice($dVat = null)
{
if ($this->_oPrice === null) {
// loading oxPrice object for final price calculation
$oPrice = oxNew(\OxidEsales\Eshop\Core\Price::class);
$oPrice->setNettoMode($this->_blDelVatOnTop);
$oPrice->setVat($dVat);
// if article is free shipping, price for delivery will be not calculated
if (!$this->_blFreeShipping) {
$oPrice->add($this->_getCostSum());
}
$this->setDeliveryPrice($oPrice);
}
return $this->_oPrice;
} | php | public function getDeliveryPrice($dVat = null)
{
if ($this->_oPrice === null) {
// loading oxPrice object for final price calculation
$oPrice = oxNew(\OxidEsales\Eshop\Core\Price::class);
$oPrice->setNettoMode($this->_blDelVatOnTop);
$oPrice->setVat($dVat);
// if article is free shipping, price for delivery will be not calculated
if (!$this->_blFreeShipping) {
$oPrice->add($this->_getCostSum());
}
$this->setDeliveryPrice($oPrice);
}
return $this->_oPrice;
} | [
"public",
"function",
"getDeliveryPrice",
"(",
"$",
"dVat",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_oPrice",
"===",
"null",
")",
"{",
"// loading oxPrice object for final price calculation",
"$",
"oPrice",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
... | Returns oxPrice object for delivery costs
@param double $dVat delivery vat
@return \OxidEsales\Eshop\Core\Price | [
"Returns",
"oxPrice",
"object",
"for",
"delivery",
"costs"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Delivery.php#L271-L287 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Delivery.php | Delivery._checkDeliveryAmount | protected function _checkDeliveryAmount($iAmount)
{
$blResult = false;
if ($this->getConditionType() == self::CONDITION_TYPE_PRICE) {
$oCur = \OxidEsales\Eshop\Core\Registry::getConfig()->getActShopCurrencyObject();
$iAmount /= $oCur->rate;
}
if ($iAmount >= $this->getConditionFrom() && $iAmount <= $this->getConditionTo()) {
$blResult = true;
}
return $blResult;
} | php | protected function _checkDeliveryAmount($iAmount)
{
$blResult = false;
if ($this->getConditionType() == self::CONDITION_TYPE_PRICE) {
$oCur = \OxidEsales\Eshop\Core\Registry::getConfig()->getActShopCurrencyObject();
$iAmount /= $oCur->rate;
}
if ($iAmount >= $this->getConditionFrom() && $iAmount <= $this->getConditionTo()) {
$blResult = true;
}
return $blResult;
} | [
"protected",
"function",
"_checkDeliveryAmount",
"(",
"$",
"iAmount",
")",
"{",
"$",
"blResult",
"=",
"false",
";",
"if",
"(",
"$",
"this",
"->",
"getConditionType",
"(",
")",
"==",
"self",
"::",
"CONDITION_TYPE_PRICE",
")",
"{",
"$",
"oCur",
"=",
"\\",
... | checks if amount param is ok for this delivery
@param double $iAmount amount
@return boolean | [
"checks",
"if",
"amount",
"param",
"is",
"ok",
"for",
"this",
"delivery"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Delivery.php#L449-L463 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Delivery.php | Delivery.getIdByName | public function getIdByName($sTitle)
{
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$sQ = "SELECT `oxid` FROM `" . getViewName('oxdelivery') . "` WHERE `oxtitle` = " . $oDb->quote($sTitle);
$sId = $oDb->getOne($sQ);
return $sId;
} | php | public function getIdByName($sTitle)
{
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$sQ = "SELECT `oxid` FROM `" . getViewName('oxdelivery') . "` WHERE `oxtitle` = " . $oDb->quote($sTitle);
$sId = $oDb->getOne($sQ);
return $sId;
} | [
"public",
"function",
"getIdByName",
"(",
"$",
"sTitle",
")",
"{",
"$",
"oDb",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"DatabaseProvider",
"::",
"getDb",
"(",
")",
";",
"$",
"sQ",
"=",
"\"SELECT `oxid` FROM `\"",
".",
"getViewName",
"("... | returns delivery id
@param string $sTitle delivery name
@return string | [
"returns",
"delivery",
"id"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Delivery.php#L472-L479 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Delivery.php | Delivery.getCountriesISO | public function getCountriesISO()
{
if ($this->_aCountriesISO === null) {
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$this->_aCountriesISO = [];
$sSelect = "
SELECT
`oxcountry`.`oxisoalpha2`
FROM `oxcountry`
LEFT JOIN `oxobject2delivery` ON `oxobject2delivery`.`oxobjectid` = `oxcountry`.`oxid`
WHERE `oxobject2delivery`.`oxdeliveryid` = " . $oDb->quote($this->getId()) . "
AND `oxobject2delivery`.`oxtype` = 'oxcountry'";
$rs = $oDb->getCol($sSelect);
$this->_aCountriesISO = $rs;
}
return $this->_aCountriesISO;
} | php | public function getCountriesISO()
{
if ($this->_aCountriesISO === null) {
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$this->_aCountriesISO = [];
$sSelect = "
SELECT
`oxcountry`.`oxisoalpha2`
FROM `oxcountry`
LEFT JOIN `oxobject2delivery` ON `oxobject2delivery`.`oxobjectid` = `oxcountry`.`oxid`
WHERE `oxobject2delivery`.`oxdeliveryid` = " . $oDb->quote($this->getId()) . "
AND `oxobject2delivery`.`oxtype` = 'oxcountry'";
$rs = $oDb->getCol($sSelect);
$this->_aCountriesISO = $rs;
}
return $this->_aCountriesISO;
} | [
"public",
"function",
"getCountriesISO",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_aCountriesISO",
"===",
"null",
")",
"{",
"$",
"oDb",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"DatabaseProvider",
"::",
"getDb",
"(",
")",
";",
"... | Returns array of country ISO's which are assigned to current delivery
@return array | [
"Returns",
"array",
"of",
"country",
"ISO",
"s",
"which",
"are",
"assigned",
"to",
"current",
"delivery"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Delivery.php#L486-L505 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Delivery.php | Delivery._getMultiplier | protected function _getMultiplier()
{
$dAmount = 0;
if ($this->getCalculationRule() == self::CALCULATION_RULE_ONCE_PER_CART) {
$dAmount = 1;
} elseif ($this->getCalculationRule() == self::CALCULATION_RULE_FOR_EACH_DIFFERENT_PRODUCT) {
$dAmount = $this->_iProdCnt;
} elseif ($this->getCalculationRule() == self::CALCULATION_RULE_FOR_EACH_PRODUCT) {
$dAmount = $this->_iItemCnt;
}
return $dAmount;
} | php | protected function _getMultiplier()
{
$dAmount = 0;
if ($this->getCalculationRule() == self::CALCULATION_RULE_ONCE_PER_CART) {
$dAmount = 1;
} elseif ($this->getCalculationRule() == self::CALCULATION_RULE_FOR_EACH_DIFFERENT_PRODUCT) {
$dAmount = $this->_iProdCnt;
} elseif ($this->getCalculationRule() == self::CALCULATION_RULE_FOR_EACH_PRODUCT) {
$dAmount = $this->_iItemCnt;
}
return $dAmount;
} | [
"protected",
"function",
"_getMultiplier",
"(",
")",
"{",
"$",
"dAmount",
"=",
"0",
";",
"if",
"(",
"$",
"this",
"->",
"getCalculationRule",
"(",
")",
"==",
"self",
"::",
"CALCULATION_RULE_ONCE_PER_CART",
")",
"{",
"$",
"dAmount",
"=",
"1",
";",
"}",
"el... | Calculate multiplier for price calculation
@return float|int | [
"Calculate",
"multiplier",
"for",
"price",
"calculation"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Delivery.php#L572-L585 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Delivery.php | Delivery._getCostSum | protected function _getCostSum()
{
if ($this->getAddSumType() == 'abs') {
$oCur = \OxidEsales\Eshop\Core\Registry::getConfig()->getActShopCurrencyObject();
$dPrice = $this->getAddSum() * $oCur->rate * $this->_getMultiplier();
} else {
$dPrice = $this->_dPrice / 100 * $this->getAddSum();
}
return $dPrice;
} | php | protected function _getCostSum()
{
if ($this->getAddSumType() == 'abs') {
$oCur = \OxidEsales\Eshop\Core\Registry::getConfig()->getActShopCurrencyObject();
$dPrice = $this->getAddSum() * $oCur->rate * $this->_getMultiplier();
} else {
$dPrice = $this->_dPrice / 100 * $this->getAddSum();
}
return $dPrice;
} | [
"protected",
"function",
"_getCostSum",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getAddSumType",
"(",
")",
"==",
"'abs'",
")",
"{",
"$",
"oCur",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
... | Calculate cost sum
@return float | [
"Calculate",
"cost",
"sum"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Delivery.php#L592-L602 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Delivery.php | Delivery.isDeliveryRuleFitByArticle | protected function isDeliveryRuleFitByArticle($artAmount)
{
$result = false;
if ($this->getCalculationRule() != self::CALCULATION_RULE_ONCE_PER_CART) {
if (!$this->_blFreeShipping && $this->_checkDeliveryAmount($artAmount)) {
$result = true;
}
}
return $result;
} | php | protected function isDeliveryRuleFitByArticle($artAmount)
{
$result = false;
if ($this->getCalculationRule() != self::CALCULATION_RULE_ONCE_PER_CART) {
if (!$this->_blFreeShipping && $this->_checkDeliveryAmount($artAmount)) {
$result = true;
}
}
return $result;
} | [
"protected",
"function",
"isDeliveryRuleFitByArticle",
"(",
"$",
"artAmount",
")",
"{",
"$",
"result",
"=",
"false",
";",
"if",
"(",
"$",
"this",
"->",
"getCalculationRule",
"(",
")",
"!=",
"self",
"::",
"CALCULATION_RULE_ONCE_PER_CART",
")",
"{",
"if",
"(",
... | Checks if delivery rule applies for basket because of one article's amount.
Delivery rules that are to be applied once per cart can be ruled out here.
@param integer $artAmount product amount
@return bool | [
"Checks",
"if",
"delivery",
"rule",
"applies",
"for",
"basket",
"because",
"of",
"one",
"article",
"s",
"amount",
".",
"Delivery",
"rules",
"that",
"are",
"to",
"be",
"applied",
"once",
"per",
"cart",
"can",
"be",
"ruled",
"out",
"here",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Delivery.php#L612-L622 | train |
OXID-eSales/oxideshop_ce | source/Setup/Database.php | Database.queryFile | public function queryFile($sFilename)
{
$fp = @fopen($sFilename, "r");
if (!$fp) {
/** @var Setup $oSetup */
$oSetup = $this->getInstance("Setup");
// problems with file
$oSetup->setNextStep($oSetup->getStep('STEP_DB_INFO'));
throw new Exception(sprintf($this->getInstance("Language")->getText('ERROR_OPENING_SQL_FILE'), $sFilename), Database::ERROR_OPENING_SQL_FILE);
}
$sQuery = fread($fp, filesize($sFilename));
fclose($fp);
if (version_compare($this->getDatabaseVersion(), "5") > 0) {
//disable STRICT db mode if there are set any (mysql >= 5).
$this->execSql("SET @@session.sql_mode = ''");
}
$aQueries = $this->parseQuery($sQuery);
foreach ($aQueries as $sQuery) {
$this->execSql($sQuery);
}
} | php | public function queryFile($sFilename)
{
$fp = @fopen($sFilename, "r");
if (!$fp) {
/** @var Setup $oSetup */
$oSetup = $this->getInstance("Setup");
// problems with file
$oSetup->setNextStep($oSetup->getStep('STEP_DB_INFO'));
throw new Exception(sprintf($this->getInstance("Language")->getText('ERROR_OPENING_SQL_FILE'), $sFilename), Database::ERROR_OPENING_SQL_FILE);
}
$sQuery = fread($fp, filesize($sFilename));
fclose($fp);
if (version_compare($this->getDatabaseVersion(), "5") > 0) {
//disable STRICT db mode if there are set any (mysql >= 5).
$this->execSql("SET @@session.sql_mode = ''");
}
$aQueries = $this->parseQuery($sQuery);
foreach ($aQueries as $sQuery) {
$this->execSql($sQuery);
}
} | [
"public",
"function",
"queryFile",
"(",
"$",
"sFilename",
")",
"{",
"$",
"fp",
"=",
"@",
"fopen",
"(",
"$",
"sFilename",
",",
"\"r\"",
")",
";",
"if",
"(",
"!",
"$",
"fp",
")",
"{",
"/** @var Setup $oSetup */",
"$",
"oSetup",
"=",
"$",
"this",
"->",
... | Executes queries stored in passed file
@param string $sFilename file name where queries are stored | [
"Executes",
"queries",
"stored",
"in",
"passed",
"file"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Setup/Database.php#L135-L158 | train |
OXID-eSales/oxideshop_ce | source/Setup/Database.php | Database.getConnection | public function getConnection()
{
if ($this->_oConn === null) {
$this->_oConn = $this->openDatabase(null);
}
return $this->_oConn;
} | php | public function getConnection()
{
if ($this->_oConn === null) {
$this->_oConn = $this->openDatabase(null);
}
return $this->_oConn;
} | [
"public",
"function",
"getConnection",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_oConn",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"_oConn",
"=",
"$",
"this",
"->",
"openDatabase",
"(",
"null",
")",
";",
"}",
"return",
"$",
"this",
"->",
"_o... | Returns connection resource object
@return PDO | [
"Returns",
"connection",
"resource",
"object"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Setup/Database.php#L176-L183 | train |
OXID-eSales/oxideshop_ce | source/Setup/Database.php | Database.openDatabase | public function openDatabase($aParams)
{
$aParams = (is_array($aParams) && count($aParams)) ? $aParams : $this->getInstance("Session")->getSessionParam('aDB');
if ($this->_oConn === null) {
// ok open DB
try {
$dsn = sprintf('mysql:host=%s;port=%s', $aParams['dbHost'], $aParams['dbPort']);
$this->_oConn = new PDO(
$dsn,
$aParams['dbUser'],
$aParams['dbPwd'],
[PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8']
);
$this->_oConn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$this->_oConn->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
} catch (PDOException $e) {
/** @var Setup $oSetup */
$oSetup = $this->getInstance("Setup");
$oSetup->setNextStep($oSetup->getStep('STEP_DB_INFO'));
throw new Exception($this->getInstance("Language")->getText('ERROR_DB_CONNECT') . " - " . $e->getMessage(), Database::ERROR_DB_CONNECT, $e);
}
// testing version
$oSysReq = getSystemReqCheck();
if (0 === $oSysReq->checkMysqlVersion($this->getDatabaseVersion())) {
throw new Exception($this->getInstance("Language")->getText('ERROR_MYSQL_VERSION_DOES_NOT_FIT_REQUIREMENTS'), Database::ERROR_MYSQL_VERSION_DOES_NOT_FIT_REQUIREMENTS);
}
$databaseConnectProblem = null;
try {
$this->_oConn->exec("USE `{$aParams['dbName']}`");
} catch (Exception $e) {
$databaseConnectException = new Exception($this->getInstance("Language")->getText('ERROR_COULD_NOT_CREATE_DB') . " - " . $e->getMessage(), Database::ERROR_COULD_NOT_CREATE_DB, $e);
}
if ((1 === $oSysReq->checkMysqlVersion($this->getDatabaseVersion())) && !$this->userDecidedIgnoreDBWarning()) {
throw new Exception($this->getInstance("Language")->getText('ERROR_MYSQL_VERSION_DOES_NOT_FIT_RECOMMENDATIONS'), Database::ERROR_MYSQL_VERSION_DOES_NOT_FIT_RECOMMENDATIONS);
}
if (is_a($databaseConnectException, 'Exception')) {
throw $databaseConnectException;
}
} else {
// Make sure the database is connected
$this->connectDb($aParams['dbName']);
}
return $this->_oConn;
} | php | public function openDatabase($aParams)
{
$aParams = (is_array($aParams) && count($aParams)) ? $aParams : $this->getInstance("Session")->getSessionParam('aDB');
if ($this->_oConn === null) {
// ok open DB
try {
$dsn = sprintf('mysql:host=%s;port=%s', $aParams['dbHost'], $aParams['dbPort']);
$this->_oConn = new PDO(
$dsn,
$aParams['dbUser'],
$aParams['dbPwd'],
[PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8']
);
$this->_oConn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$this->_oConn->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
} catch (PDOException $e) {
/** @var Setup $oSetup */
$oSetup = $this->getInstance("Setup");
$oSetup->setNextStep($oSetup->getStep('STEP_DB_INFO'));
throw new Exception($this->getInstance("Language")->getText('ERROR_DB_CONNECT') . " - " . $e->getMessage(), Database::ERROR_DB_CONNECT, $e);
}
// testing version
$oSysReq = getSystemReqCheck();
if (0 === $oSysReq->checkMysqlVersion($this->getDatabaseVersion())) {
throw new Exception($this->getInstance("Language")->getText('ERROR_MYSQL_VERSION_DOES_NOT_FIT_REQUIREMENTS'), Database::ERROR_MYSQL_VERSION_DOES_NOT_FIT_REQUIREMENTS);
}
$databaseConnectProblem = null;
try {
$this->_oConn->exec("USE `{$aParams['dbName']}`");
} catch (Exception $e) {
$databaseConnectException = new Exception($this->getInstance("Language")->getText('ERROR_COULD_NOT_CREATE_DB') . " - " . $e->getMessage(), Database::ERROR_COULD_NOT_CREATE_DB, $e);
}
if ((1 === $oSysReq->checkMysqlVersion($this->getDatabaseVersion())) && !$this->userDecidedIgnoreDBWarning()) {
throw new Exception($this->getInstance("Language")->getText('ERROR_MYSQL_VERSION_DOES_NOT_FIT_RECOMMENDATIONS'), Database::ERROR_MYSQL_VERSION_DOES_NOT_FIT_RECOMMENDATIONS);
}
if (is_a($databaseConnectException, 'Exception')) {
throw $databaseConnectException;
}
} else {
// Make sure the database is connected
$this->connectDb($aParams['dbName']);
}
return $this->_oConn;
} | [
"public",
"function",
"openDatabase",
"(",
"$",
"aParams",
")",
"{",
"$",
"aParams",
"=",
"(",
"is_array",
"(",
"$",
"aParams",
")",
"&&",
"count",
"(",
"$",
"aParams",
")",
")",
"?",
"$",
"aParams",
":",
"$",
"this",
"->",
"getInstance",
"(",
"\"Ses... | Opens database connection and returns connection resource object
@param array $aParams database connection parameters array
@throws Exception exception is thrown if connection failed or was unable to select database
@return object | [
"Opens",
"database",
"connection",
"and",
"returns",
"connection",
"resource",
"object"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Setup/Database.php#L194-L242 | train |
OXID-eSales/oxideshop_ce | source/Setup/Database.php | Database.parseQuery | public function parseQuery($sSQL)
{
// parses query into single pieces
$aRet = [];
$blComment = false;
$blQuote = false;
$sThisSQL = "";
$aLines = explode("\n", $sSQL);
// parse it
foreach ($aLines as $sLine) {
$iLen = strlen($sLine);
for ($i = 0; $i < $iLen; $i++) {
if (!$blQuote && ($sLine[$i] == '#' || ($sLine[0] == '-' && $sLine[1] == '-'))) {
$blComment = true;
}
// add this char to current command
if (!$blComment) {
$sThisSQL .= $sLine[$i];
}
// test if quote on
if (($sLine[$i] == '\'' && $sLine[$i - 1] != '\\')) {
$blQuote = !$blQuote; // toggle
}
// now test if command end is reached
if (!$blQuote && $sLine[$i] == ';') {
// add this
$sThisSQL = trim($sThisSQL);
if ($sThisSQL) {
$sThisSQL = str_replace("\r", "", $sThisSQL);
$aRet[] = $sThisSQL;
}
$sThisSQL = "";
}
}
// comments and quotes can't run over newlines
$blComment = false;
$blQuote = false;
}
return $aRet;
} | php | public function parseQuery($sSQL)
{
// parses query into single pieces
$aRet = [];
$blComment = false;
$blQuote = false;
$sThisSQL = "";
$aLines = explode("\n", $sSQL);
// parse it
foreach ($aLines as $sLine) {
$iLen = strlen($sLine);
for ($i = 0; $i < $iLen; $i++) {
if (!$blQuote && ($sLine[$i] == '#' || ($sLine[0] == '-' && $sLine[1] == '-'))) {
$blComment = true;
}
// add this char to current command
if (!$blComment) {
$sThisSQL .= $sLine[$i];
}
// test if quote on
if (($sLine[$i] == '\'' && $sLine[$i - 1] != '\\')) {
$blQuote = !$blQuote; // toggle
}
// now test if command end is reached
if (!$blQuote && $sLine[$i] == ';') {
// add this
$sThisSQL = trim($sThisSQL);
if ($sThisSQL) {
$sThisSQL = str_replace("\r", "", $sThisSQL);
$aRet[] = $sThisSQL;
}
$sThisSQL = "";
}
}
// comments and quotes can't run over newlines
$blComment = false;
$blQuote = false;
}
return $aRet;
} | [
"public",
"function",
"parseQuery",
"(",
"$",
"sSQL",
")",
"{",
"// parses query into single pieces",
"$",
"aRet",
"=",
"[",
"]",
";",
"$",
"blComment",
"=",
"false",
";",
"$",
"blQuote",
"=",
"false",
";",
"$",
"sThisSQL",
"=",
"\"\"",
";",
"$",
"aLines... | Parses query string into sql sentences
@param string $sSQL query string (usually reqd from *.sql file)
@return array | [
"Parses",
"query",
"string",
"into",
"sql",
"sentences"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Setup/Database.php#L381-L426 | train |
OXID-eSales/oxideshop_ce | source/Setup/Database.php | Database.writeAdminLoginData | public function writeAdminLoginData($sLoginName, $sPassword)
{
$sPassSalt = $this->getInstance("Utilities")->generateUID();
$sPassword = hash('sha512', $sPassword . $sPassSalt);
$sQ = "update oxuser set oxusername='{$sLoginName}', oxpassword='{$sPassword}', oxpasssalt='{$sPassSalt}' where OXUSERNAME='admin'";
$this->execSql($sQ);
$sQ = "update oxnewssubscribed set oxemail='{$sLoginName}' where OXEMAIL='admin'";
$this->execSql($sQ);
} | php | public function writeAdminLoginData($sLoginName, $sPassword)
{
$sPassSalt = $this->getInstance("Utilities")->generateUID();
$sPassword = hash('sha512', $sPassword . $sPassSalt);
$sQ = "update oxuser set oxusername='{$sLoginName}', oxpassword='{$sPassword}', oxpasssalt='{$sPassSalt}' where OXUSERNAME='admin'";
$this->execSql($sQ);
$sQ = "update oxnewssubscribed set oxemail='{$sLoginName}' where OXEMAIL='admin'";
$this->execSql($sQ);
} | [
"public",
"function",
"writeAdminLoginData",
"(",
"$",
"sLoginName",
",",
"$",
"sPassword",
")",
"{",
"$",
"sPassSalt",
"=",
"$",
"this",
"->",
"getInstance",
"(",
"\"Utilities\"",
")",
"->",
"generateUID",
"(",
")",
";",
"$",
"sPassword",
"=",
"hash",
"("... | Updates default admin user login name and password
@param string $sLoginName admin user login name
@param string $sPassword admin user login password | [
"Updates",
"default",
"admin",
"user",
"login",
"name",
"and",
"password"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Setup/Database.php#L434-L445 | train |
OXID-eSales/oxideshop_ce | source/Setup/Database.php | Database.addConfigValueIfShopInfoShouldBeSent | protected function addConfigValueIfShopInfoShouldBeSent($utilities, $baseShopId, $parameters, $configKey, $session)
{
$blSendShopDataToOxid = isset($parameters["blSendShopDataToOxid"]) ? $parameters["blSendShopDataToOxid"] : $session->getSessionParam('blSendShopDataToOxid');
$sID = $utilities->generateUid();
$this->execSql("delete from oxconfig where oxvarname = 'blSendShopDataToOxid'");
$this->execSql(
"insert into oxconfig (oxid, oxshopid, oxvarname, oxvartype, oxvarvalue)
values('$sID', '$baseShopId', 'blSendShopDataToOxid', 'bool', ENCODE( '$blSendShopDataToOxid', '" . $configKey->sConfigKey . "'))"
);
} | php | protected function addConfigValueIfShopInfoShouldBeSent($utilities, $baseShopId, $parameters, $configKey, $session)
{
$blSendShopDataToOxid = isset($parameters["blSendShopDataToOxid"]) ? $parameters["blSendShopDataToOxid"] : $session->getSessionParam('blSendShopDataToOxid');
$sID = $utilities->generateUid();
$this->execSql("delete from oxconfig where oxvarname = 'blSendShopDataToOxid'");
$this->execSql(
"insert into oxconfig (oxid, oxshopid, oxvarname, oxvartype, oxvarvalue)
values('$sID', '$baseShopId', 'blSendShopDataToOxid', 'bool', ENCODE( '$blSendShopDataToOxid', '" . $configKey->sConfigKey . "'))"
);
} | [
"protected",
"function",
"addConfigValueIfShopInfoShouldBeSent",
"(",
"$",
"utilities",
",",
"$",
"baseShopId",
",",
"$",
"parameters",
",",
"$",
"configKey",
",",
"$",
"session",
")",
"{",
"$",
"blSendShopDataToOxid",
"=",
"isset",
"(",
"$",
"parameters",
"[",
... | Adds config value if shop info should be set.
@param Utilities $utilities Setup utilities
@param string $baseShopId Shop id
@param array $parameters Parameters
@param Conf $configKey Config key loader
@param Session $session Setup session manager | [
"Adds",
"config",
"value",
"if",
"shop",
"info",
"should",
"be",
"set",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Setup/Database.php#L456-L466 | train |
OXID-eSales/oxideshop_ce | source/Setup/Controller/ModuleStateMapGenerator.php | ModuleStateMapGenerator.getModuleStateMap | public function getModuleStateMap()
{
$moduleStateMap = $this->convertFromSystemRequirementsInfo();
$moduleStateMap = $this->applyModuleStateHtmlClassConvertFunction($moduleStateMap);
$moduleStateMap = $this->applyModuleNameTranslateFunction($moduleStateMap);
$moduleStateMap = $this->applyModuleGroupNameTranslateFunction($moduleStateMap);
return $moduleStateMap;
} | php | public function getModuleStateMap()
{
$moduleStateMap = $this->convertFromSystemRequirementsInfo();
$moduleStateMap = $this->applyModuleStateHtmlClassConvertFunction($moduleStateMap);
$moduleStateMap = $this->applyModuleNameTranslateFunction($moduleStateMap);
$moduleStateMap = $this->applyModuleGroupNameTranslateFunction($moduleStateMap);
return $moduleStateMap;
} | [
"public",
"function",
"getModuleStateMap",
"(",
")",
"{",
"$",
"moduleStateMap",
"=",
"$",
"this",
"->",
"convertFromSystemRequirementsInfo",
"(",
")",
";",
"$",
"moduleStateMap",
"=",
"$",
"this",
"->",
"applyModuleStateHtmlClassConvertFunction",
"(",
"$",
"moduleS... | Returns module state map with all applied external functions.
In case a function is not set it will be just skipped.
@return array Module State Map in a form of
[
'Translated group name' => [
MODULE_ID_KEY => 'moduleId',
MODULE_STATE_KEY => 'moduleState',
MODULE_NAME_KEY => 'Translated module name',
MODULE_STATE_HTML_CLASS_KEY => 'html class',
],
...
] | [
"Returns",
"module",
"state",
"map",
"with",
"all",
"applied",
"external",
"functions",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Setup/Controller/ModuleStateMapGenerator.php#L68-L76 | train |
OXID-eSales/oxideshop_ce | source/Setup/Controller/ModuleStateMapGenerator.php | ModuleStateMapGenerator.applyModuleStateHtmlClassConvertFunction | private function applyModuleStateHtmlClassConvertFunction($moduleStateMap)
{
return $this->applyModuleStateMapFilterFunction(
$moduleStateMap,
$this->moduleStateHtmlClassConvertFunction,
function ($moduleData, $convertFunction) {
$moduleState = $moduleData[self::MODULE_STATE_KEY];
$moduleData[self::MODULE_STATE_HTML_CLASS_KEY] = $convertFunction($moduleState);
return $moduleData;
}
);
} | php | private function applyModuleStateHtmlClassConvertFunction($moduleStateMap)
{
return $this->applyModuleStateMapFilterFunction(
$moduleStateMap,
$this->moduleStateHtmlClassConvertFunction,
function ($moduleData, $convertFunction) {
$moduleState = $moduleData[self::MODULE_STATE_KEY];
$moduleData[self::MODULE_STATE_HTML_CLASS_KEY] = $convertFunction($moduleState);
return $moduleData;
}
);
} | [
"private",
"function",
"applyModuleStateHtmlClassConvertFunction",
"(",
"$",
"moduleStateMap",
")",
"{",
"return",
"$",
"this",
"->",
"applyModuleStateMapFilterFunction",
"(",
"$",
"moduleStateMap",
",",
"$",
"this",
"->",
"moduleStateHtmlClassConvertFunction",
",",
"func... | Apply function which converts module state into HTML class of given state.
@param array $moduleStateMap An array of format described in `getModuleStateMap`.
@return array An array of format described in `getModuleStateMap`. | [
"Apply",
"function",
"which",
"converts",
"module",
"state",
"into",
"HTML",
"class",
"of",
"given",
"state",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Setup/Controller/ModuleStateMapGenerator.php#L106-L118 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.