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/Diagnostics.php | Diagnostics.getPhpSelection | public function getPhpSelection()
{
$aPhpIniParams = [
'allow_url_fopen',
'display_errors',
'file_uploads',
'max_execution_time',
'memory_limit',
'post_max_size',
'register_globals',
'upload_max_filesize',
];
$aPhpIniConf = [];
foreach ($aPhpIniParams as $sParam) {
$sValue = ini_get($sParam);
$aPhpIniConf[$sParam] = $sValue;
}
return $aPhpIniConf;
} | php | public function getPhpSelection()
{
$aPhpIniParams = [
'allow_url_fopen',
'display_errors',
'file_uploads',
'max_execution_time',
'memory_limit',
'post_max_size',
'register_globals',
'upload_max_filesize',
];
$aPhpIniConf = [];
foreach ($aPhpIniParams as $sParam) {
$sValue = ini_get($sParam);
$aPhpIniConf[$sParam] = $sValue;
}
return $aPhpIniConf;
} | [
"public",
"function",
"getPhpSelection",
"(",
")",
"{",
"$",
"aPhpIniParams",
"=",
"[",
"'allow_url_fopen'",
",",
"'display_errors'",
",",
"'file_uploads'",
",",
"'max_execution_time'",
",",
"'memory_limit'",
",",
"'post_max_size'",
",",
"'register_globals'",
",",
"'u... | Picks some pre-selected PHP configuration settings and returns them.
@return array | [
"Picks",
"some",
"pre",
"-",
"selected",
"PHP",
"configuration",
"settings",
"and",
"returns",
"them",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Diagnostics.php#L155-L176 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Diagnostics.php | Diagnostics._getVirtualizationSystem | protected function _getVirtualizationSystem()
{
$sSystemType = '';
if ($this->isExecAllowed()) {
//VMWare
@$sDeviceList = $this->_getDeviceList('vmware');
if ($sDeviceList) {
$sSystemType = 'VMWare';
unset($sDeviceList);
}
//VirtualBox
@$sDeviceList = $this->_getDeviceList('VirtualBox');
if ($sDeviceList) {
$sSystemType = 'VirtualBox';
unset($sDeviceList);
}
}
return $sSystemType;
} | php | protected function _getVirtualizationSystem()
{
$sSystemType = '';
if ($this->isExecAllowed()) {
//VMWare
@$sDeviceList = $this->_getDeviceList('vmware');
if ($sDeviceList) {
$sSystemType = 'VMWare';
unset($sDeviceList);
}
//VirtualBox
@$sDeviceList = $this->_getDeviceList('VirtualBox');
if ($sDeviceList) {
$sSystemType = 'VirtualBox';
unset($sDeviceList);
}
}
return $sSystemType;
} | [
"protected",
"function",
"_getVirtualizationSystem",
"(",
")",
"{",
"$",
"sSystemType",
"=",
"''",
";",
"if",
"(",
"$",
"this",
"->",
"isExecAllowed",
"(",
")",
")",
"{",
"//VMWare",
"@",
"$",
"sDeviceList",
"=",
"$",
"this",
"->",
"_getDeviceList",
"(",
... | Tries to find out which VM is used
@return string | [
"Tries",
"to",
"find",
"out",
"which",
"VM",
"is",
"used"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Diagnostics.php#L267-L288 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Diagnostics.php | Diagnostics._getMySqlServerInfo | protected function _getMySqlServerInfo()
{
$aResult = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC)->getRow("SHOW VARIABLES LIKE 'version'");
return $aResult['Value'];
} | php | protected function _getMySqlServerInfo()
{
$aResult = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC)->getRow("SHOW VARIABLES LIKE 'version'");
return $aResult['Value'];
} | [
"protected",
"function",
"_getMySqlServerInfo",
"(",
")",
"{",
"$",
"aResult",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"DatabaseProvider",
"::",
"getDb",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"DatabaseProvider",
"::",
... | Returns MySQL server Information
@return string | [
"Returns",
"MySQL",
"server",
"Information"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Diagnostics.php#L408-L413 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/DeliverySetList.php | DeliverySetList._getList | protected function _getList($oUser = null, $sCountryId = null)
{
// checking for current session user which gives additional restrictions for user itself, users group and country
if ($oUser === null) {
$oUser = $this->getUser();
} else {
//set user
$this->setUser($oUser);
}
$sUserId = $oUser ? $oUser->getId() : '';
if ($sUserId !== $this->_sUserId || $sCountryId !== $this->_sCountryId) {
// choosing delivery country if it is not set yet
if (!$sCountryId) {
if ($oUser) {
$sCountryId = $oUser->getActiveCountry();
} else {
$sCountryId = $this->_sHomeCountry;
}
}
$this->selectString($this->_getFilterSelect($oUser, $sCountryId));
$this->_sUserId = $sUserId;
$this->_sCountryId = $sCountryId;
}
$this->rewind();
return $this;
} | php | protected function _getList($oUser = null, $sCountryId = null)
{
// checking for current session user which gives additional restrictions for user itself, users group and country
if ($oUser === null) {
$oUser = $this->getUser();
} else {
//set user
$this->setUser($oUser);
}
$sUserId = $oUser ? $oUser->getId() : '';
if ($sUserId !== $this->_sUserId || $sCountryId !== $this->_sCountryId) {
// choosing delivery country if it is not set yet
if (!$sCountryId) {
if ($oUser) {
$sCountryId = $oUser->getActiveCountry();
} else {
$sCountryId = $this->_sHomeCountry;
}
}
$this->selectString($this->_getFilterSelect($oUser, $sCountryId));
$this->_sUserId = $sUserId;
$this->_sCountryId = $sCountryId;
}
$this->rewind();
return $this;
} | [
"protected",
"function",
"_getList",
"(",
"$",
"oUser",
"=",
"null",
",",
"$",
"sCountryId",
"=",
"null",
")",
"{",
"// checking for current session user which gives additional restrictions for user itself, users group and country",
"if",
"(",
"$",
"oUser",
"===",
"null",
... | Returns active delivery set list
Loads all active delivery sets in list. Additionally
checks if set has user customized parameters like
assigned users, countries or user groups. Performs
additional filtering according to these parameters
@param \OxidEsales\Eshop\Application\Model\User $oUser user object
@param string $sCountryId user country id
@return array | [
"Returns",
"active",
"delivery",
"set",
"list"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/DeliverySetList.php#L82-L112 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/DeliverySetList.php | DeliverySetList._getFilterSelect | protected function _getFilterSelect($oUser, $sCountryId)
{
$sTable = getViewName('oxdeliveryset');
$sQ = "select $sTable.* from $sTable ";
$sQ .= "where " . $this->getBaseObject()->getSqlActiveSnippet() . ' ';
// defining initial filter parameters
$sUserId = null;
$aGroupIds = [];
// checking for current session user which gives additional restrictions for user itself, users group and country
if ($oUser) {
// user ID
$sUserId = $oUser->getId();
// user groups ( maybe would be better to fetch by function \OxidEsales\Eshop\Application\Model\User::getUserGroups() ? )
$aGroupIds = $oUser->getUserGroups();
}
$aIds = [];
if (count($aGroupIds)) {
foreach ($aGroupIds as $oGroup) {
$aIds[] = $oGroup->getId();
}
}
$sUserTable = getViewName('oxuser');
$sGroupTable = getViewName('oxgroups');
$sCountryTable = getViewName('oxcountry');
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$sCountrySql = $sCountryId ? "EXISTS(select oxobject2delivery.oxid from oxobject2delivery where oxobject2delivery.oxdeliveryid=$sTable.OXID and oxobject2delivery.oxtype='oxdelset' and oxobject2delivery.OXOBJECTID=" . $oDb->quote($sCountryId) . ")" : '0';
$sUserSql = $sUserId ? "EXISTS(select oxobject2delivery.oxid from oxobject2delivery where oxobject2delivery.oxdeliveryid=$sTable.OXID and oxobject2delivery.oxtype='oxdelsetu' and oxobject2delivery.OXOBJECTID=" . $oDb->quote($sUserId) . ")" : '0';
$sGroupSql = count($aIds) ? "EXISTS(select oxobject2delivery.oxid from oxobject2delivery where oxobject2delivery.oxdeliveryid=$sTable.OXID and oxobject2delivery.oxtype='oxdelsetg' and oxobject2delivery.OXOBJECTID in (" . implode(', ', \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quoteArray($aIds)) . ") )" : '0';
$sQ .= "and (
select
if(EXISTS(select 1 from oxobject2delivery, $sCountryTable where $sCountryTable.oxid=oxobject2delivery.oxobjectid and oxobject2delivery.oxdeliveryid=$sTable.OXID and oxobject2delivery.oxtype='oxdelset' LIMIT 1),
$sCountrySql,
1) &&
if(EXISTS(select 1 from oxobject2delivery, $sUserTable where $sUserTable.oxid=oxobject2delivery.oxobjectid and oxobject2delivery.oxdeliveryid=$sTable.OXID and oxobject2delivery.oxtype='oxdelsetu' LIMIT 1),
$sUserSql,
1) &&
if(EXISTS(select 1 from oxobject2delivery, $sGroupTable where $sGroupTable.oxid=oxobject2delivery.oxobjectid and oxobject2delivery.oxdeliveryid=$sTable.OXID and oxobject2delivery.oxtype='oxdelsetg' LIMIT 1),
$sGroupSql,
1)
)";
//order by
$sQ .= " order by $sTable.oxpos";
return $sQ;
} | php | protected function _getFilterSelect($oUser, $sCountryId)
{
$sTable = getViewName('oxdeliveryset');
$sQ = "select $sTable.* from $sTable ";
$sQ .= "where " . $this->getBaseObject()->getSqlActiveSnippet() . ' ';
// defining initial filter parameters
$sUserId = null;
$aGroupIds = [];
// checking for current session user which gives additional restrictions for user itself, users group and country
if ($oUser) {
// user ID
$sUserId = $oUser->getId();
// user groups ( maybe would be better to fetch by function \OxidEsales\Eshop\Application\Model\User::getUserGroups() ? )
$aGroupIds = $oUser->getUserGroups();
}
$aIds = [];
if (count($aGroupIds)) {
foreach ($aGroupIds as $oGroup) {
$aIds[] = $oGroup->getId();
}
}
$sUserTable = getViewName('oxuser');
$sGroupTable = getViewName('oxgroups');
$sCountryTable = getViewName('oxcountry');
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$sCountrySql = $sCountryId ? "EXISTS(select oxobject2delivery.oxid from oxobject2delivery where oxobject2delivery.oxdeliveryid=$sTable.OXID and oxobject2delivery.oxtype='oxdelset' and oxobject2delivery.OXOBJECTID=" . $oDb->quote($sCountryId) . ")" : '0';
$sUserSql = $sUserId ? "EXISTS(select oxobject2delivery.oxid from oxobject2delivery where oxobject2delivery.oxdeliveryid=$sTable.OXID and oxobject2delivery.oxtype='oxdelsetu' and oxobject2delivery.OXOBJECTID=" . $oDb->quote($sUserId) . ")" : '0';
$sGroupSql = count($aIds) ? "EXISTS(select oxobject2delivery.oxid from oxobject2delivery where oxobject2delivery.oxdeliveryid=$sTable.OXID and oxobject2delivery.oxtype='oxdelsetg' and oxobject2delivery.OXOBJECTID in (" . implode(', ', \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quoteArray($aIds)) . ") )" : '0';
$sQ .= "and (
select
if(EXISTS(select 1 from oxobject2delivery, $sCountryTable where $sCountryTable.oxid=oxobject2delivery.oxobjectid and oxobject2delivery.oxdeliveryid=$sTable.OXID and oxobject2delivery.oxtype='oxdelset' LIMIT 1),
$sCountrySql,
1) &&
if(EXISTS(select 1 from oxobject2delivery, $sUserTable where $sUserTable.oxid=oxobject2delivery.oxobjectid and oxobject2delivery.oxdeliveryid=$sTable.OXID and oxobject2delivery.oxtype='oxdelsetu' LIMIT 1),
$sUserSql,
1) &&
if(EXISTS(select 1 from oxobject2delivery, $sGroupTable where $sGroupTable.oxid=oxobject2delivery.oxobjectid and oxobject2delivery.oxdeliveryid=$sTable.OXID and oxobject2delivery.oxtype='oxdelsetg' LIMIT 1),
$sGroupSql,
1)
)";
//order by
$sQ .= " order by $sTable.oxpos";
return $sQ;
} | [
"protected",
"function",
"_getFilterSelect",
"(",
"$",
"oUser",
",",
"$",
"sCountryId",
")",
"{",
"$",
"sTable",
"=",
"getViewName",
"(",
"'oxdeliveryset'",
")",
";",
"$",
"sQ",
"=",
"\"select $sTable.* from $sTable \"",
";",
"$",
"sQ",
".=",
"\"where \"",
"."... | Creates delivery set list filter SQL to load current state delivery set list
@param \OxidEsales\Eshop\Application\Model\User $oUser user object
@param string $sCountryId user country id
@return string | [
"Creates",
"delivery",
"set",
"list",
"filter",
"SQL",
"to",
"load",
"current",
"state",
"delivery",
"set",
"list"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/DeliverySetList.php#L123-L176 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/DeliverySetList.php | DeliverySetList.getDeliverySetList | public function getDeliverySetList($oUser, $sCountryId, $sDelSet = null)
{
$this->_getList($oUser, $sCountryId);
// if there is already chosen delivery set we must start checking from it
$aList = $this->_aArray;
if ($sDelSet && isset($aList[$sDelSet])) {
//set it as first element
$oDelSet = $aList[$sDelSet];
unset($aList[$sDelSet]);
$aList = array_merge([$sDelSet => $oDelSet], $aList);
}
return $aList;
} | php | public function getDeliverySetList($oUser, $sCountryId, $sDelSet = null)
{
$this->_getList($oUser, $sCountryId);
// if there is already chosen delivery set we must start checking from it
$aList = $this->_aArray;
if ($sDelSet && isset($aList[$sDelSet])) {
//set it as first element
$oDelSet = $aList[$sDelSet];
unset($aList[$sDelSet]);
$aList = array_merge([$sDelSet => $oDelSet], $aList);
}
return $aList;
} | [
"public",
"function",
"getDeliverySetList",
"(",
"$",
"oUser",
",",
"$",
"sCountryId",
",",
"$",
"sDelSet",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"_getList",
"(",
"$",
"oUser",
",",
"$",
"sCountryId",
")",
";",
"// if there is already chosen delivery set w... | Creates current state delivery set list
@param \OxidEsales\Eshop\Application\Model\User $oUser user object
@param string $sCountryId user country id
@param string $sDelSet preferred delivery set ID (optional)
@return array | [
"Creates",
"current",
"state",
"delivery",
"set",
"list"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/DeliverySetList.php#L187-L202 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/DeliverySetList.php | DeliverySetList.loadRDFaDeliverySetList | public function loadRDFaDeliverySetList($sDelId = null)
{
$sTable = getViewName('oxdeliveryset');
if ($sDelId) {
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$sSubSql = "( select $sTable.* from $sTable left join oxdel2delset on oxdel2delset.oxdelsetid=$sTable.oxid where " . $this->getBaseObject()->getSqlActiveSnippet() . " and oxdel2delset.oxdelid = " . $oDb->quote($sDelId) . " ) as $sTable";
} else {
$sSubSql = $sTable;
}
$sQ = "select $sTable.*, oxobject2delivery.oxobjectid from $sSubSql left join (select oxobject2delivery.* from oxobject2delivery where oxobject2delivery.oxtype = 'rdfadeliveryset' ) as oxobject2delivery on oxobject2delivery.oxdeliveryid=$sTable.oxid where " . $this->getBaseObject()->getSqlActiveSnippet() . " ";
$this->selectString($sQ);
} | php | public function loadRDFaDeliverySetList($sDelId = null)
{
$sTable = getViewName('oxdeliveryset');
if ($sDelId) {
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$sSubSql = "( select $sTable.* from $sTable left join oxdel2delset on oxdel2delset.oxdelsetid=$sTable.oxid where " . $this->getBaseObject()->getSqlActiveSnippet() . " and oxdel2delset.oxdelid = " . $oDb->quote($sDelId) . " ) as $sTable";
} else {
$sSubSql = $sTable;
}
$sQ = "select $sTable.*, oxobject2delivery.oxobjectid from $sSubSql left join (select oxobject2delivery.* from oxobject2delivery where oxobject2delivery.oxtype = 'rdfadeliveryset' ) as oxobject2delivery on oxobject2delivery.oxdeliveryid=$sTable.oxid where " . $this->getBaseObject()->getSqlActiveSnippet() . " ";
$this->selectString($sQ);
} | [
"public",
"function",
"loadRDFaDeliverySetList",
"(",
"$",
"sDelId",
"=",
"null",
")",
"{",
"$",
"sTable",
"=",
"getViewName",
"(",
"'oxdeliveryset'",
")",
";",
"if",
"(",
"$",
"sDelId",
")",
"{",
"$",
"oDb",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",... | Loads delivery set mapped to a
predefined GoodRelations delivery method.
@param string $sDelId delivery set id | [
"Loads",
"delivery",
"set",
"mapped",
"to",
"a",
"predefined",
"GoodRelations",
"delivery",
"method",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/DeliverySetList.php#L305-L316 | train |
OXID-eSales/oxideshop_ce | source/Core/Exception/ExceptionHandler.php | ExceptionHandler.handleUncaughtException | public function handleUncaughtException(\Throwable $exception)
{
try {
Registry::getLogger()->error(
$exception->getMessage(),
[$exception]
);
} catch (\Throwable $loggerException) {
/**
* Logger is broken because of exception.
* Throw original exception in order to show the root cause of a problem.
*/
}
if ($this->_iDebug || defined('OXID_PHP_UNIT')) {
throw $exception;
} else {
$this->displayOfflinePage();
$this->exitApplication();
}
} | php | public function handleUncaughtException(\Throwable $exception)
{
try {
Registry::getLogger()->error(
$exception->getMessage(),
[$exception]
);
} catch (\Throwable $loggerException) {
/**
* Logger is broken because of exception.
* Throw original exception in order to show the root cause of a problem.
*/
}
if ($this->_iDebug || defined('OXID_PHP_UNIT')) {
throw $exception;
} else {
$this->displayOfflinePage();
$this->exitApplication();
}
} | [
"public",
"function",
"handleUncaughtException",
"(",
"\\",
"Throwable",
"$",
"exception",
")",
"{",
"try",
"{",
"Registry",
"::",
"getLogger",
"(",
")",
"->",
"error",
"(",
"$",
"exception",
"->",
"getMessage",
"(",
")",
",",
"[",
"$",
"exception",
"]",
... | Handler for uncaught exceptions. As this is the las resort no fancy business logic should be applied here.
@param \Throwable $exception exception object
@throws \Throwable | [
"Handler",
"for",
"uncaught",
"exceptions",
".",
"As",
"this",
"is",
"the",
"las",
"resort",
"no",
"fancy",
"business",
"logic",
"should",
"be",
"applied",
"here",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Exception/ExceptionHandler.php#L69-L89 | train |
OXID-eSales/oxideshop_ce | source/Core/Exception/ExceptionHandler.php | ExceptionHandler.handleDatabaseException | public function handleDatabaseException(\OxidEsales\Eshop\Core\Exception\DatabaseException $exception)
{
$this->handleUncaughtException($exception);
} | php | public function handleDatabaseException(\OxidEsales\Eshop\Core\Exception\DatabaseException $exception)
{
$this->handleUncaughtException($exception);
} | [
"public",
"function",
"handleDatabaseException",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Exception",
"\\",
"DatabaseException",
"$",
"exception",
")",
"{",
"$",
"this",
"->",
"handleUncaughtException",
"(",
"$",
"exception",
")",
";",
"}"
] | Report the exception and in case that iDebug is not set, redirect to maintenance page.
Special methods are used here as the normal exception handling routines always need a database connection and
this would create a loop.
@param \OxidEsales\Eshop\Core\Exception\DatabaseException $exception Exception to handle | [
"Report",
"the",
"exception",
"and",
"in",
"case",
"that",
"iDebug",
"is",
"not",
"set",
"redirect",
"to",
"maintenance",
"page",
".",
"Special",
"methods",
"are",
"used",
"here",
"as",
"the",
"normal",
"exception",
"handling",
"routines",
"always",
"need",
... | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Exception/ExceptionHandler.php#L98-L101 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/ShopViewValidator.php | ShopViewValidator._getAllViews | protected function _getAllViews()
{
if (empty($this->_aAllViews)) {
$this->_aAllViews = \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->getCol("SHOW TABLES LIKE 'oxv\_%'");
}
return $this->_aAllViews;
} | php | protected function _getAllViews()
{
if (empty($this->_aAllViews)) {
$this->_aAllViews = \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->getCol("SHOW TABLES LIKE 'oxv\_%'");
}
return $this->_aAllViews;
} | [
"protected",
"function",
"_getAllViews",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"_aAllViews",
")",
")",
"{",
"$",
"this",
"->",
"_aAllViews",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"DatabaseProvider",
"::",
"getDb... | Returns list of all shop views
@return array | [
"Returns",
"list",
"of",
"all",
"shop",
"views"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/ShopViewValidator.php#L141-L148 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/ShopViewValidator.php | ShopViewValidator._isCurrentShopView | protected function _isCurrentShopView($sViewName)
{
$blResult = false;
$blEndsWithShopId = preg_match("/[_]([0-9]+)$/", $sViewName, $aMatchEndsWithShopId);
$blContainsShopId = preg_match("/[_]([0-9]+)[_]/", $sViewName, $aMatchContainsShopId);
if ((!$blEndsWithShopId && !$blContainsShopId) ||
($blEndsWithShopId && $aMatchEndsWithShopId[1] == $this->getShopId()) ||
($blContainsShopId && $aMatchContainsShopId[1] == $this->getShopId())
) {
$blResult = true;
}
return $blResult;
} | php | protected function _isCurrentShopView($sViewName)
{
$blResult = false;
$blEndsWithShopId = preg_match("/[_]([0-9]+)$/", $sViewName, $aMatchEndsWithShopId);
$blContainsShopId = preg_match("/[_]([0-9]+)[_]/", $sViewName, $aMatchContainsShopId);
if ((!$blEndsWithShopId && !$blContainsShopId) ||
($blEndsWithShopId && $aMatchEndsWithShopId[1] == $this->getShopId()) ||
($blContainsShopId && $aMatchContainsShopId[1] == $this->getShopId())
) {
$blResult = true;
}
return $blResult;
} | [
"protected",
"function",
"_isCurrentShopView",
"(",
"$",
"sViewName",
")",
"{",
"$",
"blResult",
"=",
"false",
";",
"$",
"blEndsWithShopId",
"=",
"preg_match",
"(",
"\"/[_]([0-9]+)$/\"",
",",
"$",
"sViewName",
",",
"$",
"aMatchEndsWithShopId",
")",
";",
"$",
"... | Checks if given view name belongs to current subshop or is general view
@param string $sViewName View name
@return bool | [
"Checks",
"if",
"given",
"view",
"name",
"belongs",
"to",
"current",
"subshop",
"or",
"is",
"general",
"view"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/ShopViewValidator.php#L157-L172 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/ShopViewValidator.php | ShopViewValidator._getShopViews | protected function _getShopViews()
{
if (empty($this->_aShopViews)) {
$this->_aShopViews = [];
$aAllViews = $this->_getAllViews();
foreach ($aAllViews as $sView) {
if ($this->_isCurrentShopView($sView)) {
$this->_aShopViews[] = $sView;
}
}
}
return $this->_aShopViews;
} | php | protected function _getShopViews()
{
if (empty($this->_aShopViews)) {
$this->_aShopViews = [];
$aAllViews = $this->_getAllViews();
foreach ($aAllViews as $sView) {
if ($this->_isCurrentShopView($sView)) {
$this->_aShopViews[] = $sView;
}
}
}
return $this->_aShopViews;
} | [
"protected",
"function",
"_getShopViews",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"_aShopViews",
")",
")",
"{",
"$",
"this",
"->",
"_aShopViews",
"=",
"[",
"]",
";",
"$",
"aAllViews",
"=",
"$",
"this",
"->",
"_getAllViews",
"(",
")... | Returns list of shop specific views currently in database
@return array | [
"Returns",
"list",
"of",
"shop",
"specific",
"views",
"currently",
"in",
"database"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/ShopViewValidator.php#L180-L194 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/ShopViewValidator.php | ShopViewValidator._getValidShopViews | protected function _getValidShopViews()
{
if (empty($this->_aValidShopViews)) {
$aTables = $this->getShopTables();
$this->_aValidShopViews = [];
foreach ($aTables as $sTable) {
$this->prepareShopTableViewNames($sTable);
}
}
return $this->_aValidShopViews;
} | php | protected function _getValidShopViews()
{
if (empty($this->_aValidShopViews)) {
$aTables = $this->getShopTables();
$this->_aValidShopViews = [];
foreach ($aTables as $sTable) {
$this->prepareShopTableViewNames($sTable);
}
}
return $this->_aValidShopViews;
} | [
"protected",
"function",
"_getValidShopViews",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"_aValidShopViews",
")",
")",
"{",
"$",
"aTables",
"=",
"$",
"this",
"->",
"getShopTables",
"(",
")",
";",
"$",
"this",
"->",
"_aValidShopViews",
"=... | Returns list of valid shop views
@return array | [
"Returns",
"list",
"of",
"valid",
"shop",
"views"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/ShopViewValidator.php#L201-L213 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/ShopViewValidator.php | ShopViewValidator.getInvalidViews | public function getInvalidViews()
{
$aInvalidViews = [];
$aShopViews = $this->_getShopViews();
foreach ($aShopViews as $sView) {
if (!$this->_isViewValid($sView)) {
$aInvalidViews[] = $sView;
}
}
return $aInvalidViews;
} | php | public function getInvalidViews()
{
$aInvalidViews = [];
$aShopViews = $this->_getShopViews();
foreach ($aShopViews as $sView) {
if (!$this->_isViewValid($sView)) {
$aInvalidViews[] = $sView;
}
}
return $aInvalidViews;
} | [
"public",
"function",
"getInvalidViews",
"(",
")",
"{",
"$",
"aInvalidViews",
"=",
"[",
"]",
";",
"$",
"aShopViews",
"=",
"$",
"this",
"->",
"_getShopViews",
"(",
")",
";",
"foreach",
"(",
"$",
"aShopViews",
"as",
"$",
"sView",
")",
"{",
"if",
"(",
"... | Returns list of invalid views
@return array | [
"Returns",
"list",
"of",
"invalid",
"views"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/ShopViewValidator.php#L260-L272 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/ListComponentAjax.php | ListComponentAjax.processRequest | public function processRequest($function = null)
{
if ($function) {
$this->$function();
$this->dispatchEvent(new AfterRequestProcessedEvent);
} else {
$sQAdd = $this->_getQuery();
// formatting SQL queries
$sQ = $this->_getDataQuery($sQAdd);
$sCountQ = $this->_getCountQuery($sQAdd);
$this->_outputResponse($this->_getData($sCountQ, $sQ));
}
} | php | public function processRequest($function = null)
{
if ($function) {
$this->$function();
$this->dispatchEvent(new AfterRequestProcessedEvent);
} else {
$sQAdd = $this->_getQuery();
// formatting SQL queries
$sQ = $this->_getDataQuery($sQAdd);
$sCountQ = $this->_getCountQuery($sQAdd);
$this->_outputResponse($this->_getData($sCountQ, $sQ));
}
} | [
"public",
"function",
"processRequest",
"(",
"$",
"function",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"function",
")",
"{",
"$",
"this",
"->",
"$",
"function",
"(",
")",
";",
"$",
"this",
"->",
"dispatchEvent",
"(",
"new",
"AfterRequestProcessedEvent",
")... | AJAX call processor function
@param string $function name of action to execute (optional) | [
"AJAX",
"call",
"processor",
"function"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ListComponentAjax.php#L140-L154 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/ListComponentAjax.php | ListComponentAjax._getSortCol | protected function _getSortCol()
{
$aVisibleNames = $this->_getVisibleColNames();
$iCol = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('sort');
$iCol = $iCol ? (( int ) str_replace('_', '', $iCol)) : 0;
$iCol = (!isset($aVisibleNames[$iCol])) ? 0 : $iCol;
return $iCol;
} | php | protected function _getSortCol()
{
$aVisibleNames = $this->_getVisibleColNames();
$iCol = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('sort');
$iCol = $iCol ? (( int ) str_replace('_', '', $iCol)) : 0;
$iCol = (!isset($aVisibleNames[$iCol])) ? 0 : $iCol;
return $iCol;
} | [
"protected",
"function",
"_getSortCol",
"(",
")",
"{",
"$",
"aVisibleNames",
"=",
"$",
"this",
"->",
"_getVisibleColNames",
"(",
")",
";",
"$",
"iCol",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"... | Returns column id to sort
@return int | [
"Returns",
"column",
"id",
"to",
"sort"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ListComponentAjax.php#L161-L169 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/ListComponentAjax.php | ListComponentAjax._getColNames | protected function _getColNames($sId = null)
{
if ($sId === null) {
$sId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('cmpid');
}
if ($sId && isset($this->_aColumns[$sId])) {
return $this->_aColumns[$sId];
}
return $this->_aColumns;
} | php | protected function _getColNames($sId = null)
{
if ($sId === null) {
$sId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('cmpid');
}
if ($sId && isset($this->_aColumns[$sId])) {
return $this->_aColumns[$sId];
}
return $this->_aColumns;
} | [
"protected",
"function",
"_getColNames",
"(",
"$",
"sId",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"sId",
"===",
"null",
")",
"{",
"$",
"sId",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
... | Returns array of cotainer DB cols which must be loaded. If id is not
passed - all possible containers cols will be returned
@param string $sId container id (optional)
@return array | [
"Returns",
"array",
"of",
"cotainer",
"DB",
"cols",
"which",
"must",
"be",
"loaded",
".",
"If",
"id",
"is",
"not",
"passed",
"-",
"all",
"possible",
"containers",
"cols",
"will",
"be",
"returned"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ListComponentAjax.php#L180-L191 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/ListComponentAjax.php | ListComponentAjax._getIdentColNames | protected function _getIdentColNames()
{
$aColNames = $this->_getColNames();
$aCols = [];
foreach ($aColNames as $iKey => $aCol) {
// ident ?
if ($aCol[4]) {
$aCols[$iKey] = $aCol;
}
}
return $aCols;
} | php | protected function _getIdentColNames()
{
$aColNames = $this->_getColNames();
$aCols = [];
foreach ($aColNames as $iKey => $aCol) {
// ident ?
if ($aCol[4]) {
$aCols[$iKey] = $aCol;
}
}
return $aCols;
} | [
"protected",
"function",
"_getIdentColNames",
"(",
")",
"{",
"$",
"aColNames",
"=",
"$",
"this",
"->",
"_getColNames",
"(",
")",
";",
"$",
"aCols",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"aColNames",
"as",
"$",
"iKey",
"=>",
"$",
"aCol",
")",
"{",
... | Returns array of identifiers which are used as identifiers for specific actions
in AJAX and further in this processor class
@return array | [
"Returns",
"array",
"of",
"identifiers",
"which",
"are",
"used",
"as",
"identifiers",
"for",
"specific",
"actions",
"in",
"AJAX",
"and",
"further",
"in",
"this",
"processor",
"class"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ListComponentAjax.php#L199-L211 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/ListComponentAjax.php | ListComponentAjax._getVisibleColNames | protected function _getVisibleColNames()
{
$aColNames = $this->_getColNames();
$aUserCols = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('aCols');
$aVisibleCols = [];
// user defined some cols to load ?
if (is_array($aUserCols)) {
foreach ($aUserCols as $iKey => $sCol) {
$iCol = ( int ) str_replace('_', '', $sCol);
if (isset($aColNames[$iCol]) && !$aColNames[$iCol][4]) {
$aVisibleCols[$iCol] = $aColNames[$iCol];
}
}
}
// no user defined valid cols ? setting defauls ..
if (!count($aVisibleCols)) {
foreach ($aColNames as $sName => $aCol) {
// visible ?
if ($aCol[1] && !$aColNames[$sName][4]) {
$aVisibleCols[$sName] = $aCol;
}
}
}
return $aVisibleCols;
} | php | protected function _getVisibleColNames()
{
$aColNames = $this->_getColNames();
$aUserCols = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('aCols');
$aVisibleCols = [];
// user defined some cols to load ?
if (is_array($aUserCols)) {
foreach ($aUserCols as $iKey => $sCol) {
$iCol = ( int ) str_replace('_', '', $sCol);
if (isset($aColNames[$iCol]) && !$aColNames[$iCol][4]) {
$aVisibleCols[$iCol] = $aColNames[$iCol];
}
}
}
// no user defined valid cols ? setting defauls ..
if (!count($aVisibleCols)) {
foreach ($aColNames as $sName => $aCol) {
// visible ?
if ($aCol[1] && !$aColNames[$sName][4]) {
$aVisibleCols[$sName] = $aCol;
}
}
}
return $aVisibleCols;
} | [
"protected",
"function",
"_getVisibleColNames",
"(",
")",
"{",
"$",
"aColNames",
"=",
"$",
"this",
"->",
"_getColNames",
"(",
")",
";",
"$",
"aUserCols",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
... | Returns array of col names which are requested by AJAX call and will be fetched from DB
@return array | [
"Returns",
"array",
"of",
"col",
"names",
"which",
"are",
"requested",
"by",
"AJAX",
"call",
"and",
"will",
"be",
"fetched",
"from",
"DB"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ListComponentAjax.php#L218-L245 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/ListComponentAjax.php | ListComponentAjax._getQueryCols | protected function _getQueryCols()
{
$sQ = $this->_buildColsQuery($this->_getVisibleColNames(), false) . ", ";
$sQ .= $this->_buildColsQuery($this->_getIdentColNames());
return " $sQ ";
} | php | protected function _getQueryCols()
{
$sQ = $this->_buildColsQuery($this->_getVisibleColNames(), false) . ", ";
$sQ .= $this->_buildColsQuery($this->_getIdentColNames());
return " $sQ ";
} | [
"protected",
"function",
"_getQueryCols",
"(",
")",
"{",
"$",
"sQ",
"=",
"$",
"this",
"->",
"_buildColsQuery",
"(",
"$",
"this",
"->",
"_getVisibleColNames",
"(",
")",
",",
"false",
")",
".",
"\", \"",
";",
"$",
"sQ",
".=",
"$",
"this",
"->",
"_buildCo... | Formats and returns chunk of SQL query string with definition of
fields to load from DB
@return string | [
"Formats",
"and",
"returns",
"chunk",
"of",
"SQL",
"query",
"string",
"with",
"definition",
"of",
"fields",
"to",
"load",
"from",
"DB"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ListComponentAjax.php#L253-L259 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/ListComponentAjax.php | ListComponentAjax._buildColsQuery | protected function _buildColsQuery($aIdentCols, $blIdentCols = true)
{
$sQ = '';
foreach ($aIdentCols as $iCnt => $aCol) {
if ($sQ) {
$sQ .= ', ';
}
$sViewTable = $this->_getViewName($aCol[1]);
if (!$blIdentCols && $this->_isExtendedColumn($aCol[0])) {
$sQ .= $this->_getExtendedColQuery($sViewTable, $aCol[0], $iCnt);
} else {
$sQ .= $sViewTable . '.' . $aCol[0] . ' as _' . $iCnt;
}
}
return $sQ;
} | php | protected function _buildColsQuery($aIdentCols, $blIdentCols = true)
{
$sQ = '';
foreach ($aIdentCols as $iCnt => $aCol) {
if ($sQ) {
$sQ .= ', ';
}
$sViewTable = $this->_getViewName($aCol[1]);
if (!$blIdentCols && $this->_isExtendedColumn($aCol[0])) {
$sQ .= $this->_getExtendedColQuery($sViewTable, $aCol[0], $iCnt);
} else {
$sQ .= $sViewTable . '.' . $aCol[0] . ' as _' . $iCnt;
}
}
return $sQ;
} | [
"protected",
"function",
"_buildColsQuery",
"(",
"$",
"aIdentCols",
",",
"$",
"blIdentCols",
"=",
"true",
")",
"{",
"$",
"sQ",
"=",
"''",
";",
"foreach",
"(",
"$",
"aIdentCols",
"as",
"$",
"iCnt",
"=>",
"$",
"aCol",
")",
"{",
"if",
"(",
"$",
"sQ",
... | Builds column selection query
@param array $aIdentCols columns
@param bool $blIdentCols if true, means ident columns part is build
@return string | [
"Builds",
"column",
"selection",
"query"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ListComponentAjax.php#L269-L286 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/ListComponentAjax.php | ListComponentAjax._getLimit | protected function _getLimit($iStart)
{
$iLimit = (int) \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("results");
$iLimit = $iLimit ? $iLimit : $this->_iSqlLimit;
return " limit $iStart, $iLimit ";
} | php | protected function _getLimit($iStart)
{
$iLimit = (int) \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("results");
$iLimit = $iLimit ? $iLimit : $this->_iSqlLimit;
return " limit $iStart, $iLimit ";
} | [
"protected",
"function",
"_getLimit",
"(",
"$",
"iStart",
")",
"{",
"$",
"iLimit",
"=",
"(",
"int",
")",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
"getRequestParameter",
"(",
"\"results\"",
")",
... | Returns part of SQL query for limiting number of entries from DB
@param int $iStart start position
@return string | [
"Returns",
"part",
"of",
"SQL",
"query",
"for",
"limiting",
"number",
"of",
"entries",
"from",
"DB"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ListComponentAjax.php#L340-L346 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/ListComponentAjax.php | ListComponentAjax._getFilter | protected function _getFilter()
{
$sQ = '';
$oConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
$aFilter = $oConfig->getRequestParameter('aFilter');
if (is_array($aFilter) && count($aFilter)) {
$aCols = $this->_getVisibleColNames();
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$oStr = getStr();
foreach ($aFilter as $sCol => $sValue) {
// skipping empty filters
if ($sValue === '') {
continue;
}
$iCol = (int) str_replace('_', '', $sCol);
if (isset($aCols[$iCol])) {
if ($sQ) {
$sQ .= ' and ';
}
// escaping special characters
$sValue = str_replace(['%', '_'], ['\%', '\_'], $sValue);
// possibility to search in the middle ..
$sValue = $oStr->preg_replace('/^\*/', '%', $sValue);
$sQ .= $this->_getViewName($aCols[$iCol][1]) . '.' . $aCols[$iCol][0];
$sQ .= ' like ' . $oDb->Quote('%' . $sValue . '%') . ' ';
}
}
}
return $sQ;
} | php | protected function _getFilter()
{
$sQ = '';
$oConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
$aFilter = $oConfig->getRequestParameter('aFilter');
if (is_array($aFilter) && count($aFilter)) {
$aCols = $this->_getVisibleColNames();
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$oStr = getStr();
foreach ($aFilter as $sCol => $sValue) {
// skipping empty filters
if ($sValue === '') {
continue;
}
$iCol = (int) str_replace('_', '', $sCol);
if (isset($aCols[$iCol])) {
if ($sQ) {
$sQ .= ' and ';
}
// escaping special characters
$sValue = str_replace(['%', '_'], ['\%', '\_'], $sValue);
// possibility to search in the middle ..
$sValue = $oStr->preg_replace('/^\*/', '%', $sValue);
$sQ .= $this->_getViewName($aCols[$iCol][1]) . '.' . $aCols[$iCol][0];
$sQ .= ' like ' . $oDb->Quote('%' . $sValue . '%') . ' ';
}
}
}
return $sQ;
} | [
"protected",
"function",
"_getFilter",
"(",
")",
"{",
"$",
"sQ",
"=",
"''",
";",
"$",
"oConfig",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
";",
"$",
"aFilter",
"=",
"$",
"oConfig",
"->",
"get... | Returns part of SQL query for filtering DB data
@return string | [
"Returns",
"part",
"of",
"SQL",
"query",
"for",
"filtering",
"DB",
"data"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ListComponentAjax.php#L353-L388 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/ListComponentAjax.php | ListComponentAjax._getAll | protected function _getAll($sQ)
{
$aReturn = [];
$rs = \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->select($sQ);
if ($rs != false && $rs->count() > 0) {
while (!$rs->EOF) {
$aReturn[] = $rs->fields[0];
$rs->fetchRow();
}
}
return $aReturn;
} | php | protected function _getAll($sQ)
{
$aReturn = [];
$rs = \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->select($sQ);
if ($rs != false && $rs->count() > 0) {
while (!$rs->EOF) {
$aReturn[] = $rs->fields[0];
$rs->fetchRow();
}
}
return $aReturn;
} | [
"protected",
"function",
"_getAll",
"(",
"$",
"sQ",
")",
"{",
"$",
"aReturn",
"=",
"[",
"]",
";",
"$",
"rs",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"DatabaseProvider",
"::",
"getDb",
"(",
")",
"->",
"select",
"(",
"$",
"sQ",
")... | Returns DB records as plain indexed array
@param string $sQ SQL query
@return array | [
"Returns",
"DB",
"records",
"as",
"plain",
"indexed",
"array"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ListComponentAjax.php#L413-L425 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/ListComponentAjax.php | ListComponentAjax._getSortDir | protected function _getSortDir()
{
$sDir = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('dir');
if (!in_array($sDir, $this->_aPosDir)) {
$sDir = $this->_aPosDir[0];
}
return $sDir;
} | php | protected function _getSortDir()
{
$sDir = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('dir');
if (!in_array($sDir, $this->_aPosDir)) {
$sDir = $this->_aPosDir[0];
}
return $sDir;
} | [
"protected",
"function",
"_getSortDir",
"(",
")",
"{",
"$",
"sDir",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
"getRequestParameter",
"(",
"'dir'",
")",
";",
"if",
"(",
"!",
"in_array",
"(",... | Checks user input and returns SQL sorting direction key
@return string | [
"Checks",
"user",
"input",
"and",
"returns",
"SQL",
"sorting",
"direction",
"key"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ListComponentAjax.php#L432-L440 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/ListComponentAjax.php | ListComponentAjax._getTotalCount | protected function _getTotalCount($sQ)
{
// TODO: implement caching here
// we can cache total count ...
// $sCountCacheKey = md5( $sQ );
// 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($sQ);
} | php | protected function _getTotalCount($sQ)
{
// TODO: implement caching here
// we can cache total count ...
// $sCountCacheKey = md5( $sQ );
// 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($sQ);
} | [
"protected",
"function",
"_getTotalCount",
"(",
"$",
"sQ",
")",
"{",
"// TODO: implement caching here",
"// we can cache total count ...",
"// $sCountCacheKey = md5( $sQ );",
"// We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804).",
"r... | Returns amount of records which can be found according to passed SQL query
@param string $sQ SQL query
@return int | [
"Returns",
"amount",
"of",
"records",
"which",
"can",
"be",
"found",
"according",
"to",
"passed",
"SQL",
"query"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ListComponentAjax.php#L459-L469 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/ListComponentAjax.php | ListComponentAjax._getViewName | protected function _getViewName($sTable)
{
return getViewName($sTable, \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('editlanguage'));
} | php | protected function _getViewName($sTable)
{
return getViewName($sTable, \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('editlanguage'));
} | [
"protected",
"function",
"_getViewName",
"(",
"$",
"sTable",
")",
"{",
"return",
"getViewName",
"(",
"$",
"sTable",
",",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
"getRequestParameter",
"(",
"'editl... | Return the view name of the given table if a view exists, otherwise the table name itself
@param string $sTable table name
@return string | [
"Return",
"the",
"view",
"name",
"of",
"the",
"given",
"table",
"if",
"a",
"view",
"exists",
"otherwise",
"the",
"table",
"name",
"itself"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ListComponentAjax.php#L511-L514 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/ListComponentAjax.php | ListComponentAjax._getData | protected function _getData($sCountQ, $sQ)
{
$sQ = $this->_addFilter($sQ);
$sCountQ = $this->_addFilter($sCountQ);
$aResponse['startIndex'] = $iStart = $this->_getStartIndex();
$aResponse['sort'] = '_' . $this->_getSortCol();
$aResponse['dir'] = $this->_getSortDir();
$iDebug = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('iDebug');
if ($iDebug) {
$aResponse['countsql'] = $sCountQ;
}
$aResponse['records'] = [];
// skip further execution if no records were found ...
if (($iTotal = $this->_getTotalCount($sCountQ))) {
$sQ .= $this->_getSorting();
$sQ .= $this->_getLimit($iStart);
if ($iDebug) {
$aResponse['datasql'] = $sQ;
}
$aResponse['records'] = $this->_getDataFields($sQ);
}
$aResponse['totalRecords'] = $iTotal;
return $aResponse;
} | php | protected function _getData($sCountQ, $sQ)
{
$sQ = $this->_addFilter($sQ);
$sCountQ = $this->_addFilter($sCountQ);
$aResponse['startIndex'] = $iStart = $this->_getStartIndex();
$aResponse['sort'] = '_' . $this->_getSortCol();
$aResponse['dir'] = $this->_getSortDir();
$iDebug = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('iDebug');
if ($iDebug) {
$aResponse['countsql'] = $sCountQ;
}
$aResponse['records'] = [];
// skip further execution if no records were found ...
if (($iTotal = $this->_getTotalCount($sCountQ))) {
$sQ .= $this->_getSorting();
$sQ .= $this->_getLimit($iStart);
if ($iDebug) {
$aResponse['datasql'] = $sQ;
}
$aResponse['records'] = $this->_getDataFields($sQ);
}
$aResponse['totalRecords'] = $iTotal;
return $aResponse;
} | [
"protected",
"function",
"_getData",
"(",
"$",
"sCountQ",
",",
"$",
"sQ",
")",
"{",
"$",
"sQ",
"=",
"$",
"this",
"->",
"_addFilter",
"(",
"$",
"sQ",
")",
";",
"$",
"sCountQ",
"=",
"$",
"this",
"->",
"_addFilter",
"(",
"$",
"sCountQ",
")",
";",
"$... | Formats data array which later will be processed by _outputResponse method
@param string $sCountQ count query
@param string $sQ data load query
@return array | [
"Formats",
"data",
"array",
"which",
"later",
"will",
"be",
"processed",
"by",
"_outputResponse",
"method"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ListComponentAjax.php#L524-L555 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/ListComponentAjax.php | ListComponentAjax.resetArtSeoUrl | public function resetArtSeoUrl($aArtIds, $aCatIds = null)
{
if (empty($aArtIds)) {
return;
}
if (!is_array($aArtIds)) {
$aArtIds = [$aArtIds];
}
$sShopId = \OxidEsales\Eshop\Core\Registry::getConfig()->getShopId();
foreach ($aArtIds as $sArtId) {
/** @var \OxidEsales\Eshop\Core\SeoEncoder $oSeoEncoder */
\OxidEsales\Eshop\Core\Registry::getSeoEncoder()->markAsExpired($sArtId, $sShopId, 1, null, "oxtype='oxarticle'");
}
} | php | public function resetArtSeoUrl($aArtIds, $aCatIds = null)
{
if (empty($aArtIds)) {
return;
}
if (!is_array($aArtIds)) {
$aArtIds = [$aArtIds];
}
$sShopId = \OxidEsales\Eshop\Core\Registry::getConfig()->getShopId();
foreach ($aArtIds as $sArtId) {
/** @var \OxidEsales\Eshop\Core\SeoEncoder $oSeoEncoder */
\OxidEsales\Eshop\Core\Registry::getSeoEncoder()->markAsExpired($sArtId, $sShopId, 1, null, "oxtype='oxarticle'");
}
} | [
"public",
"function",
"resetArtSeoUrl",
"(",
"$",
"aArtIds",
",",
"$",
"aCatIds",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"aArtIds",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"is_array",
"(",
"$",
"aArtIds",
")",
")",
"{",
"... | Marks article seo url as expired
@param array $aArtIds article id's
@param array $aCatIds ids if categories, which must be removed from oxseo
@return null | [
"Marks",
"article",
"seo",
"url",
"as",
"expired"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ListComponentAjax.php#L565-L580 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/ListComponentAjax.php | ListComponentAjax.resetCounter | public function resetCounter($sCounterType, $sValue = null)
{
$blDeleteCacheOnLogout = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('blClearCacheOnLogout');
if (!$blDeleteCacheOnLogout) {
$myUtilsCount = \OxidEsales\Eshop\Core\Registry::getUtilsCount();
switch ($sCounterType) {
case 'priceCatArticle':
$myUtilsCount->resetPriceCatArticleCount($sValue);
break;
case 'catArticle':
$myUtilsCount->resetCatArticleCount($sValue);
break;
case 'vendorArticle':
$myUtilsCount->resetVendorArticleCount($sValue);
break;
case 'manufacturerArticle':
$myUtilsCount->resetManufacturerArticleCount($sValue);
break;
}
$this->_resetContentCache();
}
} | php | public function resetCounter($sCounterType, $sValue = null)
{
$blDeleteCacheOnLogout = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('blClearCacheOnLogout');
if (!$blDeleteCacheOnLogout) {
$myUtilsCount = \OxidEsales\Eshop\Core\Registry::getUtilsCount();
switch ($sCounterType) {
case 'priceCatArticle':
$myUtilsCount->resetPriceCatArticleCount($sValue);
break;
case 'catArticle':
$myUtilsCount->resetCatArticleCount($sValue);
break;
case 'vendorArticle':
$myUtilsCount->resetVendorArticleCount($sValue);
break;
case 'manufacturerArticle':
$myUtilsCount->resetManufacturerArticleCount($sValue);
break;
}
$this->_resetContentCache();
}
} | [
"public",
"function",
"resetCounter",
"(",
"$",
"sCounterType",
",",
"$",
"sValue",
"=",
"null",
")",
"{",
"$",
"blDeleteCacheOnLogout",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
"getConfigPara... | Resets counters values from cache. Resets price category articles, category articles,
vendor articles, manufacturer articles count.
@param string $sCounterType counter type
@param string $sValue reset value | [
"Resets",
"counters",
"values",
"from",
"cache",
".",
"Resets",
"price",
"category",
"articles",
"category",
"articles",
"vendor",
"articles",
"manufacturer",
"articles",
"count",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ListComponentAjax.php#L603-L626 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/NewsletterController.php | NewsletterController.addme | public function addme()
{
// user exists ?
$oUser = oxNew(\OxidEsales\Eshop\Application\Model\User::class);
if ($oUser->load(\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('uid'))) {
$sConfirmCode = md5($oUser->oxuser__oxusername->value . $oUser->oxuser__oxpasssalt->value);
// is confirm code ok?
if (\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('confirm') == $sConfirmCode) {
$oUser->getNewsSubscription()->setOptInStatus(1);
$oUser->addToGroup('oxidnewsletter');
$this->_iNewsletterStatus = 2;
}
}
} | php | public function addme()
{
// user exists ?
$oUser = oxNew(\OxidEsales\Eshop\Application\Model\User::class);
if ($oUser->load(\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('uid'))) {
$sConfirmCode = md5($oUser->oxuser__oxusername->value . $oUser->oxuser__oxpasssalt->value);
// is confirm code ok?
if (\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('confirm') == $sConfirmCode) {
$oUser->getNewsSubscription()->setOptInStatus(1);
$oUser->addToGroup('oxidnewsletter');
$this->_iNewsletterStatus = 2;
}
}
} | [
"public",
"function",
"addme",
"(",
")",
"{",
"// user exists ?",
"$",
"oUser",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Application",
"\\",
"Model",
"\\",
"User",
"::",
"class",
")",
";",
"if",
"(",
"$",
"oUser",
"->",
"load",
"(",... | Loads user and Adds him to newsletter group.
Template variables:
<b>success</b> | [
"Loads",
"user",
"and",
"Adds",
"him",
"to",
"newsletter",
"group",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/NewsletterController.php#L165-L178 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/NewsletterController.php | NewsletterController.removeme | public function removeme()
{
// existing user ?
$oUser = oxNew(\OxidEsales\Eshop\Application\Model\User::class);
if ($oUser->load(\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('uid'))) {
$oUser->getNewsSubscription()->setOptInStatus(0);
// removing from group ..
$oUser->removeFromGroup('oxidnewsletter');
$this->_iNewsletterStatus = 3;
}
} | php | public function removeme()
{
// existing user ?
$oUser = oxNew(\OxidEsales\Eshop\Application\Model\User::class);
if ($oUser->load(\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('uid'))) {
$oUser->getNewsSubscription()->setOptInStatus(0);
// removing from group ..
$oUser->removeFromGroup('oxidnewsletter');
$this->_iNewsletterStatus = 3;
}
} | [
"public",
"function",
"removeme",
"(",
")",
"{",
"// existing user ?",
"$",
"oUser",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Application",
"\\",
"Model",
"\\",
"User",
"::",
"class",
")",
";",
"if",
"(",
"$",
"oUser",
"->",
"load",
... | Loads user and removes him from newsletter group. | [
"Loads",
"user",
"and",
"removes",
"him",
"from",
"newsletter",
"group",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/NewsletterController.php#L183-L195 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/NewsletterController.php | NewsletterController.getTopStartActionArticles | public function getTopStartActionArticles()
{
if ($this->_oActionArticles === null) {
$this->_oActionArticles = false;
if (\OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('bl_perfLoadAktion')) {
$oArtList = oxNew(\OxidEsales\Eshop\Application\Model\ArticleList::class);
$oArtList->loadActionArticles('OXTOPSTART');
if ($oArtList->count()) {
$this->_oTopArticle = $oArtList->current();
$this->_oActionArticles = $oArtList;
}
}
}
return $this->_oActionArticles;
} | php | public function getTopStartActionArticles()
{
if ($this->_oActionArticles === null) {
$this->_oActionArticles = false;
if (\OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('bl_perfLoadAktion')) {
$oArtList = oxNew(\OxidEsales\Eshop\Application\Model\ArticleList::class);
$oArtList->loadActionArticles('OXTOPSTART');
if ($oArtList->count()) {
$this->_oTopArticle = $oArtList->current();
$this->_oActionArticles = $oArtList;
}
}
}
return $this->_oActionArticles;
} | [
"public",
"function",
"getTopStartActionArticles",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_oActionArticles",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"_oActionArticles",
"=",
"false",
";",
"if",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core... | Template variable getter. Returns action articlelist
@return object | [
"Template",
"variable",
"getter",
".",
"Returns",
"action",
"articlelist"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/NewsletterController.php#L210-L225 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/NewsletterController.php | NewsletterController.getTopStartArticle | public function getTopStartArticle()
{
if ($this->_oTopArticle === null) {
$this->_oTopArticle = false;
if ($this->getTopStartActionArticles()) {
return $this->_oTopArticle;
}
}
return $this->_oTopArticle;
} | php | public function getTopStartArticle()
{
if ($this->_oTopArticle === null) {
$this->_oTopArticle = false;
if ($this->getTopStartActionArticles()) {
return $this->_oTopArticle;
}
}
return $this->_oTopArticle;
} | [
"public",
"function",
"getTopStartArticle",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_oTopArticle",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"_oTopArticle",
"=",
"false",
";",
"if",
"(",
"$",
"this",
"->",
"getTopStartActionArticles",
"(",
")",
"... | Template variable getter. Returns top start article
@return object | [
"Template",
"variable",
"getter",
".",
"Returns",
"top",
"start",
"article"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/NewsletterController.php#L232-L242 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/NewsletterController.php | NewsletterController.getHomeCountryId | public function getHomeCountryId()
{
if ($this->_sHomeCountryId === null) {
$this->_sHomeCountryId = false;
$aHomeCountry = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('aHomeCountry');
if (is_array($aHomeCountry)) {
$this->_sHomeCountryId = current($aHomeCountry);
}
}
return $this->_sHomeCountryId;
} | php | public function getHomeCountryId()
{
if ($this->_sHomeCountryId === null) {
$this->_sHomeCountryId = false;
$aHomeCountry = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('aHomeCountry');
if (is_array($aHomeCountry)) {
$this->_sHomeCountryId = current($aHomeCountry);
}
}
return $this->_sHomeCountryId;
} | [
"public",
"function",
"getHomeCountryId",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_sHomeCountryId",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"_sHomeCountryId",
"=",
"false",
";",
"$",
"aHomeCountry",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
... | Template variable getter. Returns country id
@return string | [
"Template",
"variable",
"getter",
".",
"Returns",
"country",
"id"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/NewsletterController.php#L249-L260 | train |
OXID-eSales/oxideshop_ce | source/Core/Smarty/Plugin/EmosAdapter.php | EmosAdapter.getEmos | public function getEmos()
{
if ($this->_oEmos === null) {
$this->_oEmos = new Emos($this->_getScriptPath());
// make output more readable
$this->_oEmos->prettyPrint();
//$this->_oEmos->setSid( $this->getSession()->getId() );
// set page id
$this->_oEmos->addPageId($this->_getEmosPageId($this->_getTplName()));
// language id
$this->_oEmos->addLangId(\OxidEsales\Eshop\Core\Registry::getLang()->getBaseLanguage());
// set site ID
$this->_oEmos->addSiteId(\OxidEsales\Eshop\Core\Registry::getConfig()->getShopId());
}
return $this->_oEmos;
} | php | public function getEmos()
{
if ($this->_oEmos === null) {
$this->_oEmos = new Emos($this->_getScriptPath());
// make output more readable
$this->_oEmos->prettyPrint();
//$this->_oEmos->setSid( $this->getSession()->getId() );
// set page id
$this->_oEmos->addPageId($this->_getEmosPageId($this->_getTplName()));
// language id
$this->_oEmos->addLangId(\OxidEsales\Eshop\Core\Registry::getLang()->getBaseLanguage());
// set site ID
$this->_oEmos->addSiteId(\OxidEsales\Eshop\Core\Registry::getConfig()->getShopId());
}
return $this->_oEmos;
} | [
"public",
"function",
"getEmos",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_oEmos",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"_oEmos",
"=",
"new",
"Emos",
"(",
"$",
"this",
"->",
"_getScriptPath",
"(",
")",
")",
";",
"// make output more readabl... | Returns new emos controller object
@return \OxidEsales\Eshop\Core\Smarty\Plugin\Emos | [
"Returns",
"new",
"emos",
"controller",
"object"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Smarty/Plugin/EmosAdapter.php#L132-L152 | train |
OXID-eSales/oxideshop_ce | source/Core/Smarty/Plugin/EmosAdapter.php | EmosAdapter.getCode | public function getCode($aParams, $oSmarty)
{
$oEmos = $this->getEmos();
$this->_setControllerInfo($oEmos, $aParams, $oSmarty);
$this->_setBasketActionsInfo($oEmos);
return "\n" . $oEmos->toString();
} | php | public function getCode($aParams, $oSmarty)
{
$oEmos = $this->getEmos();
$this->_setControllerInfo($oEmos, $aParams, $oSmarty);
$this->_setBasketActionsInfo($oEmos);
return "\n" . $oEmos->toString();
} | [
"public",
"function",
"getCode",
"(",
"$",
"aParams",
",",
"$",
"oSmarty",
")",
"{",
"$",
"oEmos",
"=",
"$",
"this",
"->",
"getEmos",
"(",
")",
";",
"$",
"this",
"->",
"_setControllerInfo",
"(",
"$",
"oEmos",
",",
"$",
"aParams",
",",
"$",
"oSmarty",... | Builds JS code for current view tracking functionality
@param array $aParams plugin parameters
@param smarty $oSmarty template engine object
@return string | [
"Builds",
"JS",
"code",
"for",
"current",
"view",
"tracking",
"functionality"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Smarty/Plugin/EmosAdapter.php#L162-L171 | train |
OXID-eSales/oxideshop_ce | source/Core/Smarty/Plugin/EmosAdapter.php | EmosAdapter._convertToUtf | protected function _convertToUtf($sContent)
{
$myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
if (!$myConfig->isUtf()) {
$sContent = iconv(\OxidEsales\Eshop\Core\Registry::getLang()->translateString('charset'), 'UTF-8', $sContent);
}
return $sContent;
} | php | protected function _convertToUtf($sContent)
{
$myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
if (!$myConfig->isUtf()) {
$sContent = iconv(\OxidEsales\Eshop\Core\Registry::getLang()->translateString('charset'), 'UTF-8', $sContent);
}
return $sContent;
} | [
"protected",
"function",
"_convertToUtf",
"(",
"$",
"sContent",
")",
"{",
"$",
"myConfig",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
";",
"if",
"(",
"!",
"$",
"myConfig",
"->",
"isUtf",
"(",
")... | Checks whether shop is in utf, if not - iconv string for using with econda json_encode
@deprecated since 6.0 (2016-12-07) As the shop installation is utf-8, this method will be removed.
@param string $sContent
@return string | [
"Checks",
"whether",
"shop",
"is",
"in",
"utf",
"if",
"not",
"-",
"iconv",
"string",
"for",
"using",
"with",
"econda",
"json_encode"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Smarty/Plugin/EmosAdapter.php#L204-L212 | train |
OXID-eSales/oxideshop_ce | source/Core/Smarty/Plugin/EmosAdapter.php | EmosAdapter._prepareProductTitle | protected function _prepareProductTitle($oProduct)
{
$sTitle = $oProduct->oxarticles__oxtitle->value;
if ($oProduct->oxarticles__oxvarselect->value) {
$sTitle .= " " . $oProduct->oxarticles__oxvarselect->value;
}
return $sTitle;
} | php | protected function _prepareProductTitle($oProduct)
{
$sTitle = $oProduct->oxarticles__oxtitle->value;
if ($oProduct->oxarticles__oxvarselect->value) {
$sTitle .= " " . $oProduct->oxarticles__oxvarselect->value;
}
return $sTitle;
} | [
"protected",
"function",
"_prepareProductTitle",
"(",
"$",
"oProduct",
")",
"{",
"$",
"sTitle",
"=",
"$",
"oProduct",
"->",
"oxarticles__oxtitle",
"->",
"value",
";",
"if",
"(",
"$",
"oProduct",
"->",
"oxarticles__oxvarselect",
"->",
"value",
")",
"{",
"$",
... | Returns formatted product title
@param \OxidEsales\Eshop\Application\Model\Article $oProduct product which title must be prepared
@return string | [
"Returns",
"formatted",
"product",
"title"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Smarty/Plugin/EmosAdapter.php#L222-L230 | train |
OXID-eSales/oxideshop_ce | source/Core/Smarty/Plugin/EmosAdapter.php | EmosAdapter._convProd2EmosItem | protected function _convProd2EmosItem($oProduct, $sCatPath = "NULL", $iQty = 1)
{
$oItem = $this->_getNewEmosItem();
$sProductId = (isset($oProduct->oxarticles__oxartnum->value) && $oProduct->oxarticles__oxartnum->value) ? $oProduct->oxarticles__oxartnum->value : $oProduct->getId();
$oItem->productId = $sProductId;
$oItem->productName = $this->_prepareProductTitle($oProduct);
// #810A
$oCur = \OxidEsales\Eshop\Core\Registry::getConfig()->getActShopCurrencyObject();
$oItem->price = $oProduct->getPrice()->getBruttoPrice() * (1 / $oCur->rate);
$oItem->productGroup = "{$sCatPath}/{$oProduct->oxarticles__oxtitle->value}";
$oItem->quantity = $iQty;
// #3452: Add brands to econda tracking
$oItem->variant1 = $oProduct->getVendor() ? $oProduct->getVendor()->getTitle() : "NULL";
$oItem->variant2 = $oProduct->getManufacturer() ? $oProduct->getManufacturer()->getTitle() : "NULL";
$oItem->variant3 = $oProduct->getId();
return $oItem;
} | php | protected function _convProd2EmosItem($oProduct, $sCatPath = "NULL", $iQty = 1)
{
$oItem = $this->_getNewEmosItem();
$sProductId = (isset($oProduct->oxarticles__oxartnum->value) && $oProduct->oxarticles__oxartnum->value) ? $oProduct->oxarticles__oxartnum->value : $oProduct->getId();
$oItem->productId = $sProductId;
$oItem->productName = $this->_prepareProductTitle($oProduct);
// #810A
$oCur = \OxidEsales\Eshop\Core\Registry::getConfig()->getActShopCurrencyObject();
$oItem->price = $oProduct->getPrice()->getBruttoPrice() * (1 / $oCur->rate);
$oItem->productGroup = "{$sCatPath}/{$oProduct->oxarticles__oxtitle->value}";
$oItem->quantity = $iQty;
// #3452: Add brands to econda tracking
$oItem->variant1 = $oProduct->getVendor() ? $oProduct->getVendor()->getTitle() : "NULL";
$oItem->variant2 = $oProduct->getManufacturer() ? $oProduct->getManufacturer()->getTitle() : "NULL";
$oItem->variant3 = $oProduct->getId();
return $oItem;
} | [
"protected",
"function",
"_convProd2EmosItem",
"(",
"$",
"oProduct",
",",
"$",
"sCatPath",
"=",
"\"NULL\"",
",",
"$",
"iQty",
"=",
"1",
")",
"{",
"$",
"oItem",
"=",
"$",
"this",
"->",
"_getNewEmosItem",
"(",
")",
";",
"$",
"sProductId",
"=",
"(",
"isse... | Converts a oxarticle object to an EMOS_Item
@param \OxidEsales\Eshop\Application\Model\Article $oProduct article to convert
@param string $sCatPath category path
@param int $iQty buyable amount
@return EMOS_Item | [
"Converts",
"a",
"oxarticle",
"object",
"to",
"an",
"EMOS_Item"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Smarty/Plugin/EmosAdapter.php#L241-L260 | train |
OXID-eSales/oxideshop_ce | source/Core/Smarty/Plugin/EmosAdapter.php | EmosAdapter._getEmosCatPath | protected function _getEmosCatPath()
{
// #4016: econda: json function returns null if title has an umlaut
if ($this->_sEmosCatPath === null) {
$aCatTitle = [];
if ($aCatPath = \OxidEsales\Eshop\Core\Registry::getConfig()->getActiveView()->getBreadCrumb()) {
foreach ($aCatPath as $aCatPathParts) {
$aCatTitle[] = $aCatPathParts['title'];
}
}
$this->_sEmosCatPath = (count($aCatTitle) ? strip_tags(implode('/', $aCatTitle)) : 'NULL');
}
return $this->_sEmosCatPath;
} | php | protected function _getEmosCatPath()
{
// #4016: econda: json function returns null if title has an umlaut
if ($this->_sEmosCatPath === null) {
$aCatTitle = [];
if ($aCatPath = \OxidEsales\Eshop\Core\Registry::getConfig()->getActiveView()->getBreadCrumb()) {
foreach ($aCatPath as $aCatPathParts) {
$aCatTitle[] = $aCatPathParts['title'];
}
}
$this->_sEmosCatPath = (count($aCatTitle) ? strip_tags(implode('/', $aCatTitle)) : 'NULL');
}
return $this->_sEmosCatPath;
} | [
"protected",
"function",
"_getEmosCatPath",
"(",
")",
"{",
"// #4016: econda: json function returns null if title has an umlaut",
"if",
"(",
"$",
"this",
"->",
"_sEmosCatPath",
"===",
"null",
")",
"{",
"$",
"aCatTitle",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"aCatPat... | Returns current view category path
@return string | [
"Returns",
"current",
"view",
"category",
"path"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Smarty/Plugin/EmosAdapter.php#L297-L311 | train |
OXID-eSales/oxideshop_ce | source/Core/Smarty/Plugin/EmosAdapter.php | EmosAdapter._getBasketProductCatPath | protected function _getBasketProductCatPath($oArticle)
{
$sCatPath = '';
if ($oCategory = $oArticle->getCategory()) {
$sTable = $oCategory->getViewName();
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC);
$sQ = "select {$sTable}.oxtitle as oxtitle from {$sTable}
where {$sTable}.oxleft <= " . $oDb->quote($oCategory->oxcategories__oxleft->value) . " and
{$sTable}.oxright >= " . $oDb->quote($oCategory->oxcategories__oxright->value) . " and
{$sTable}.oxrootid = " . $oDb->quote($oCategory->oxcategories__oxrootid->value) . "
order by {$sTable}.oxleft";
$oRs = $oDb->select($sQ);
if ($oRs != false && $oRs->count() > 0) {
while (!$oRs->EOF) {
if ($sCatPath) {
$sCatPath .= '/';
}
$sCatPath .= strip_tags($oRs->fields['oxtitle']);
$oRs->fetchRow();
}
}
}
return $sCatPath;
} | php | protected function _getBasketProductCatPath($oArticle)
{
$sCatPath = '';
if ($oCategory = $oArticle->getCategory()) {
$sTable = $oCategory->getViewName();
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC);
$sQ = "select {$sTable}.oxtitle as oxtitle from {$sTable}
where {$sTable}.oxleft <= " . $oDb->quote($oCategory->oxcategories__oxleft->value) . " and
{$sTable}.oxright >= " . $oDb->quote($oCategory->oxcategories__oxright->value) . " and
{$sTable}.oxrootid = " . $oDb->quote($oCategory->oxcategories__oxrootid->value) . "
order by {$sTable}.oxleft";
$oRs = $oDb->select($sQ);
if ($oRs != false && $oRs->count() > 0) {
while (!$oRs->EOF) {
if ($sCatPath) {
$sCatPath .= '/';
}
$sCatPath .= strip_tags($oRs->fields['oxtitle']);
$oRs->fetchRow();
}
}
}
return $sCatPath;
} | [
"protected",
"function",
"_getBasketProductCatPath",
"(",
"$",
"oArticle",
")",
"{",
"$",
"sCatPath",
"=",
"''",
";",
"if",
"(",
"$",
"oCategory",
"=",
"$",
"oArticle",
"->",
"getCategory",
"(",
")",
")",
"{",
"$",
"sTable",
"=",
"$",
"oCategory",
"->",
... | Builds basket product category path
@param \OxidEsales\Eshop\Application\Model\Article $oArticle article to build category id
@return string | [
"Builds",
"basket",
"product",
"category",
"path"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Smarty/Plugin/EmosAdapter.php#L320-L345 | train |
OXID-eSales/oxideshop_ce | source/Core/Smarty/Plugin/EmosAdapter.php | EmosAdapter._getEmosPageId | protected function _getEmosPageId($sTplName)
{
$sPageId = \OxidEsales\Eshop\Core\Registry::getConfig()->getShopId() .
$this->_getEmosCl() .
$sTplName .
\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('cnid') .
\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('anid') .
\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('option');
return md5($sPageId);
} | php | protected function _getEmosPageId($sTplName)
{
$sPageId = \OxidEsales\Eshop\Core\Registry::getConfig()->getShopId() .
$this->_getEmosCl() .
$sTplName .
\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('cnid') .
\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('anid') .
\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('option');
return md5($sPageId);
} | [
"protected",
"function",
"_getEmosPageId",
"(",
"$",
"sTplName",
")",
"{",
"$",
"sPageId",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
"getShopId",
"(",
")",
".",
"$",
"this",
"->",
"_getEmos... | generates a unique id for the current page
@param string $sTplName current view template name
@return string | [
"generates",
"a",
"unique",
"id",
"for",
"the",
"current",
"page"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Smarty/Plugin/EmosAdapter.php#L354-L364 | train |
OXID-eSales/oxideshop_ce | source/Core/Smarty/Plugin/EmosAdapter.php | EmosAdapter._getTplName | protected function _getTplName()
{
if (!($sCurrTpl = basename(( string )\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('tpl')))) {
// in case template was not defined in request
$sCurrTpl = \OxidEsales\Eshop\Core\Registry::getConfig()->getActiveView()->getTemplateName();
}
return $sCurrTpl;
} | php | protected function _getTplName()
{
if (!($sCurrTpl = basename(( string )\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('tpl')))) {
// in case template was not defined in request
$sCurrTpl = \OxidEsales\Eshop\Core\Registry::getConfig()->getActiveView()->getTemplateName();
}
return $sCurrTpl;
} | [
"protected",
"function",
"_getTplName",
"(",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"sCurrTpl",
"=",
"basename",
"(",
"(",
"string",
")",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
"getRequestParame... | Returns active view template name
@return string | [
"Returns",
"active",
"view",
"template",
"name"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Smarty/Plugin/EmosAdapter.php#L371-L379 | train |
OXID-eSales/oxideshop_ce | source/Core/Smarty/Plugin/EmosAdapter.php | EmosAdapter._setUserRegistration | private function _setUserRegistration($oEmos, $oUser)
{
$iError = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('newslettererror');
$iSuccess = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('success');
if ($iError && $iError < 0) {
$oEmos->addRegister($oUser ? $oUser->getId() : 'NULL', abs($iError));
}
if ($iSuccess && $iSuccess > 0 && $oUser) {
$oEmos->addRegister($oUser->getId(), 0);
}
} | php | private function _setUserRegistration($oEmos, $oUser)
{
$iError = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('newslettererror');
$iSuccess = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('success');
if ($iError && $iError < 0) {
$oEmos->addRegister($oUser ? $oUser->getId() : 'NULL', abs($iError));
}
if ($iSuccess && $iSuccess > 0 && $oUser) {
$oEmos->addRegister($oUser->getId(), 0);
}
} | [
"private",
"function",
"_setUserRegistration",
"(",
"$",
"oEmos",
",",
"$",
"oUser",
")",
"{",
"$",
"iError",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
"getRequestParameter",
"(",
"'newslettere... | Sets user registration action to Emos.
@param \OxidEsales\Eshop\Core\Smarty\Plugin\Emos $oEmos
@param \OxidEsales\Eshop\Application\Model\User $oUser | [
"Sets",
"user",
"registration",
"action",
"to",
"Emos",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Smarty/Plugin/EmosAdapter.php#L590-L602 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/FileCollector.php | FileCollector.addFile | public function addFile($sFile)
{
if (empty($sFile)) {
throw new Exception('Parameter $sFile is empty!');
}
if (empty($this->_sBaseDirectory)) {
throw new Exception('Base directory is not set, please use setter setBaseDirectory!');
}
if (is_file($this->_sBaseDirectory . $sFile)) {
$this->_aFiles[] = $sFile;
return true;
}
return false;
} | php | public function addFile($sFile)
{
if (empty($sFile)) {
throw new Exception('Parameter $sFile is empty!');
}
if (empty($this->_sBaseDirectory)) {
throw new Exception('Base directory is not set, please use setter setBaseDirectory!');
}
if (is_file($this->_sBaseDirectory . $sFile)) {
$this->_aFiles[] = $sFile;
return true;
}
return false;
} | [
"public",
"function",
"addFile",
"(",
"$",
"sFile",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"sFile",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'Parameter $sFile is empty!'",
")",
";",
"}",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"_sBaseDire... | Add one file to collection if it exists
@param string $sFile file name to add to collection
@throws Exception
@return null | [
"Add",
"one",
"file",
"to",
"collection",
"if",
"it",
"exists"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/FileCollector.php#L62-L79 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/FileCollector.php | FileCollector.addDirectoryFiles | public function addDirectoryFiles($sFolder, $aExtensions = [], $blRecursive = false)
{
if (empty($sFolder)) {
throw new Exception('Parameter $sFolder is empty!');
}
if (empty($this->_sBaseDirectory)) {
throw new Exception('Base directory is not set, please use setter setBaseDirectory!');
}
$aCurrentList = [];
if (!is_dir($this->_sBaseDirectory . $sFolder)) {
return;
}
$handle = opendir($this->_sBaseDirectory . $sFolder);
while ($sFile = readdir($handle)) {
if ($sFile != "." && $sFile != "..") {
if (is_dir($this->_sBaseDirectory . $sFolder . $sFile)) {
if ($blRecursive) {
$aResultList = $this->addDirectoryFiles($sFolder . $sFile . '/', $aExtensions, $blRecursive);
if (is_array($aResultList)) {
$aCurrentList = array_merge($aCurrentList, $aResultList);
}
}
} else {
$sExt = substr(strrchr($sFile, '.'), 1);
if ((!empty($aExtensions) && is_array($aExtensions) && in_array($sExt, $aExtensions)) ||
(empty($aExtensions))
) {
$this->addFile($sFolder . $sFile);
}
}
}
}
closedir($handle);
} | php | public function addDirectoryFiles($sFolder, $aExtensions = [], $blRecursive = false)
{
if (empty($sFolder)) {
throw new Exception('Parameter $sFolder is empty!');
}
if (empty($this->_sBaseDirectory)) {
throw new Exception('Base directory is not set, please use setter setBaseDirectory!');
}
$aCurrentList = [];
if (!is_dir($this->_sBaseDirectory . $sFolder)) {
return;
}
$handle = opendir($this->_sBaseDirectory . $sFolder);
while ($sFile = readdir($handle)) {
if ($sFile != "." && $sFile != "..") {
if (is_dir($this->_sBaseDirectory . $sFolder . $sFile)) {
if ($blRecursive) {
$aResultList = $this->addDirectoryFiles($sFolder . $sFile . '/', $aExtensions, $blRecursive);
if (is_array($aResultList)) {
$aCurrentList = array_merge($aCurrentList, $aResultList);
}
}
} else {
$sExt = substr(strrchr($sFile, '.'), 1);
if ((!empty($aExtensions) && is_array($aExtensions) && in_array($sExt, $aExtensions)) ||
(empty($aExtensions))
) {
$this->addFile($sFolder . $sFile);
}
}
}
}
closedir($handle);
} | [
"public",
"function",
"addDirectoryFiles",
"(",
"$",
"sFolder",
",",
"$",
"aExtensions",
"=",
"[",
"]",
",",
"$",
"blRecursive",
"=",
"false",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"sFolder",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'Paramet... | browse all folders and sub-folders after files which have given extensions
@param string $sFolder which is explored
@param array $aExtensions list of extensions to scan - if empty all files are taken
@param boolean $blRecursive should directories be checked in recursive manner
@throws exception
@return null | [
"browse",
"all",
"folders",
"and",
"sub",
"-",
"folders",
"after",
"files",
"which",
"have",
"given",
"extensions"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/FileCollector.php#L92-L132 | train |
OXID-eSales/oxideshop_ce | source/Application/Component/Widget/VendorList.php | VendorList.getVendorlist | public function getVendorlist()
{
if ($this->_aVendorlist === null) {
$oVendorTree = oxNew(\OxidEsales\Eshop\Application\Model\VendorList::class);
$oVendorTree->buildVendorTree('vendorlist', null, \OxidEsales\Eshop\Core\Registry::getConfig()->getShopHomeUrl());
$this->_aVendorlist = $oVendorTree;
}
return $this->_aVendorlist;
} | php | public function getVendorlist()
{
if ($this->_aVendorlist === null) {
$oVendorTree = oxNew(\OxidEsales\Eshop\Application\Model\VendorList::class);
$oVendorTree->buildVendorTree('vendorlist', null, \OxidEsales\Eshop\Core\Registry::getConfig()->getShopHomeUrl());
$this->_aVendorlist = $oVendorTree;
}
return $this->_aVendorlist;
} | [
"public",
"function",
"getVendorlist",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_aVendorlist",
"===",
"null",
")",
"{",
"$",
"oVendorTree",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Application",
"\\",
"Model",
"\\",
"VendorList",
... | Template variable getter. Returns vendorlist for search
@return array | [
"Template",
"variable",
"getter",
".",
"Returns",
"vendorlist",
"for",
"search"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Component/Widget/VendorList.php#L27-L36 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/ActionsMainAjax.php | ActionsMainAjax.removeArtFromAct | public function removeArtFromAct()
{
$aChosenArt = $this->_getActionIds('oxactions2article.oxid');
$sOxid = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('oxid');
$this->_getOxRssFeed()->removeCacheFile($sOxid);
if (\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('all')) {
$sQ = parent::_addFilter("delete oxactions2article.* " . $this->_getQuery());
\OxidEsales\Eshop\Core\DatabaseProvider::getDb()->Execute($sQ);
} elseif (is_array($aChosenArt)) {
$sChosenArticles = implode(", ", \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quoteArray($aChosenArt));
$sQ = "delete from oxactions2article where oxactions2article.oxid in (" . $sChosenArticles . ") ";
\OxidEsales\Eshop\Core\DatabaseProvider::getDb()->Execute($sQ);
}
} | php | public function removeArtFromAct()
{
$aChosenArt = $this->_getActionIds('oxactions2article.oxid');
$sOxid = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('oxid');
$this->_getOxRssFeed()->removeCacheFile($sOxid);
if (\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('all')) {
$sQ = parent::_addFilter("delete oxactions2article.* " . $this->_getQuery());
\OxidEsales\Eshop\Core\DatabaseProvider::getDb()->Execute($sQ);
} elseif (is_array($aChosenArt)) {
$sChosenArticles = implode(", ", \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quoteArray($aChosenArt));
$sQ = "delete from oxactions2article where oxactions2article.oxid in (" . $sChosenArticles . ") ";
\OxidEsales\Eshop\Core\DatabaseProvider::getDb()->Execute($sQ);
}
} | [
"public",
"function",
"removeArtFromAct",
"(",
")",
"{",
"$",
"aChosenArt",
"=",
"$",
"this",
"->",
"_getActionIds",
"(",
"'oxactions2article.oxid'",
")",
";",
"$",
"sOxid",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getCo... | Removes article from Promotions list | [
"Removes",
"article",
"from",
"Promotions",
"list"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ActionsMainAjax.php#L142-L157 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/ActionsMainAjax.php | ActionsMainAjax.addArtToAct | public function addArtToAct()
{
$myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
$aArticles = $this->_getActionIds('oxarticles.oxid');
$soxId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('synchoxid');
$this->_getOxRssFeed()->removeCacheFile($soxId);
if (\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('all')) {
$sArtTable = $this->_getViewName('oxarticles');
$aArticles = $this->_getAll($this->_addFilter("select $sArtTable.oxid " . $this->_getQuery()));
}
// We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804 and ESDEV-3822).
$database = \OxidEsales\Eshop\Core\DatabaseProvider::getMaster();
$sArtTable = $this->_getViewName('oxarticles');
$sQ = "select max(oxactions2article.oxsort) from oxactions2article join {$sArtTable} " .
"on {$sArtTable}.oxid=oxactions2article.oxartid " .
"where oxactions2article.oxactionid = " . $database->quote($soxId) .
" and oxactions2article.oxshopid = '" . $myConfig->getShopId() .
"'and $sArtTable.oxid is not null";
$iSort = ((int) $database->getOne($sQ)) + 1;
$articleAdded = false;
if ($soxId && $soxId != "-1" && is_array($aArticles)) {
$sShopId = $myConfig->getShopId();
foreach ($aArticles as $sAdd) {
$oNewGroup = oxNew(\OxidEsales\Eshop\Core\Model\BaseModel::class);
$oNewGroup->init('oxactions2article');
$oNewGroup->oxactions2article__oxshopid = new \OxidEsales\Eshop\Core\Field($sShopId);
$oNewGroup->oxactions2article__oxactionid = new \OxidEsales\Eshop\Core\Field($soxId);
$oNewGroup->oxactions2article__oxartid = new \OxidEsales\Eshop\Core\Field($sAdd);
$oNewGroup->oxactions2article__oxsort = new \OxidEsales\Eshop\Core\Field($iSort++);
$oNewGroup->save();
}
$articleAdded = true;
}
return $articleAdded;
} | php | public function addArtToAct()
{
$myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
$aArticles = $this->_getActionIds('oxarticles.oxid');
$soxId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('synchoxid');
$this->_getOxRssFeed()->removeCacheFile($soxId);
if (\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('all')) {
$sArtTable = $this->_getViewName('oxarticles');
$aArticles = $this->_getAll($this->_addFilter("select $sArtTable.oxid " . $this->_getQuery()));
}
// We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804 and ESDEV-3822).
$database = \OxidEsales\Eshop\Core\DatabaseProvider::getMaster();
$sArtTable = $this->_getViewName('oxarticles');
$sQ = "select max(oxactions2article.oxsort) from oxactions2article join {$sArtTable} " .
"on {$sArtTable}.oxid=oxactions2article.oxartid " .
"where oxactions2article.oxactionid = " . $database->quote($soxId) .
" and oxactions2article.oxshopid = '" . $myConfig->getShopId() .
"'and $sArtTable.oxid is not null";
$iSort = ((int) $database->getOne($sQ)) + 1;
$articleAdded = false;
if ($soxId && $soxId != "-1" && is_array($aArticles)) {
$sShopId = $myConfig->getShopId();
foreach ($aArticles as $sAdd) {
$oNewGroup = oxNew(\OxidEsales\Eshop\Core\Model\BaseModel::class);
$oNewGroup->init('oxactions2article');
$oNewGroup->oxactions2article__oxshopid = new \OxidEsales\Eshop\Core\Field($sShopId);
$oNewGroup->oxactions2article__oxactionid = new \OxidEsales\Eshop\Core\Field($soxId);
$oNewGroup->oxactions2article__oxartid = new \OxidEsales\Eshop\Core\Field($sAdd);
$oNewGroup->oxactions2article__oxsort = new \OxidEsales\Eshop\Core\Field($iSort++);
$oNewGroup->save();
}
$articleAdded = true;
}
return $articleAdded;
} | [
"public",
"function",
"addArtToAct",
"(",
")",
"{",
"$",
"myConfig",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
";",
"$",
"aArticles",
"=",
"$",
"this",
"->",
"_getActionIds",
"(",
"'oxarticles.oxid... | Adds article to Promotions list
@return bool Whether any article was added to action.
@throws Exception | [
"Adds",
"article",
"to",
"Promotions",
"list"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ActionsMainAjax.php#L166-L206 | train |
OXID-eSales/oxideshop_ce | source/Core/ViewHelper/JavaScriptRenderer.php | JavaScriptRenderer.render | public function render($widget, $forceRender, $isDynamic = false)
{
$config = \OxidEsales\Eshop\Core\Registry::getConfig();
$output = '';
$suffix = $isDynamic ? '_dynamic' : '';
$filesParameterName = \OxidEsales\Eshop\Core\ViewHelper\JavaScriptRegistrator::FILES_PARAMETER_NAME . $suffix;
$scriptsParameterName = \OxidEsales\Eshop\Core\ViewHelper\JavaScriptRegistrator::SNIPPETS_PARAMETER_NAME . $suffix;
$isAjaxRequest = $this->isAjaxRequest();
$forceRender = $this->shouldForceRender($forceRender, $isAjaxRequest);
if (!$widget || $forceRender) {
if (!$isAjaxRequest) {
$files = $this->prepareFilesForRendering($config->getGlobalParameter($filesParameterName), $widget);
$output .= $this->formFilesOutput($files, $widget);
$config->setGlobalParameter($filesParameterName, null);
if ($widget) {
$dynamicIncludes = (array)$config->getGlobalParameter(\OxidEsales\Eshop\Core\ViewHelper\JavaScriptRegistrator::FILES_PARAMETER_NAME . '_dynamic');
$output .= $this->formFilesOutput($dynamicIncludes, $widget);
$config->setGlobalParameter(\OxidEsales\Eshop\Core\ViewHelper\JavaScriptRegistrator::FILES_PARAMETER_NAME . '_dynamic', null);
}
}
// Form output for adds.
$snippets = (array)$config->getGlobalParameter($scriptsParameterName);
$scriptOutput = $this->formSnippetsOutput($snippets, $widget, $isAjaxRequest);
$config->setGlobalParameter($scriptsParameterName, null);
if ($widget) {
$dynamicScripts = (array) $config->getGlobalParameter(\OxidEsales\Eshop\Core\ViewHelper\JavaScriptRegistrator::SNIPPETS_PARAMETER_NAME . '_dynamic');
$scriptOutput .= $this->formSnippetsOutput($dynamicScripts, $widget, $isAjaxRequest);
$config->setGlobalParameter(\OxidEsales\Eshop\Core\ViewHelper\JavaScriptRegistrator::SNIPPETS_PARAMETER_NAME . '_dynamic', null);
}
$output .= $this->enclose($scriptOutput, $widget, $isAjaxRequest);
}
return $output;
} | php | public function render($widget, $forceRender, $isDynamic = false)
{
$config = \OxidEsales\Eshop\Core\Registry::getConfig();
$output = '';
$suffix = $isDynamic ? '_dynamic' : '';
$filesParameterName = \OxidEsales\Eshop\Core\ViewHelper\JavaScriptRegistrator::FILES_PARAMETER_NAME . $suffix;
$scriptsParameterName = \OxidEsales\Eshop\Core\ViewHelper\JavaScriptRegistrator::SNIPPETS_PARAMETER_NAME . $suffix;
$isAjaxRequest = $this->isAjaxRequest();
$forceRender = $this->shouldForceRender($forceRender, $isAjaxRequest);
if (!$widget || $forceRender) {
if (!$isAjaxRequest) {
$files = $this->prepareFilesForRendering($config->getGlobalParameter($filesParameterName), $widget);
$output .= $this->formFilesOutput($files, $widget);
$config->setGlobalParameter($filesParameterName, null);
if ($widget) {
$dynamicIncludes = (array)$config->getGlobalParameter(\OxidEsales\Eshop\Core\ViewHelper\JavaScriptRegistrator::FILES_PARAMETER_NAME . '_dynamic');
$output .= $this->formFilesOutput($dynamicIncludes, $widget);
$config->setGlobalParameter(\OxidEsales\Eshop\Core\ViewHelper\JavaScriptRegistrator::FILES_PARAMETER_NAME . '_dynamic', null);
}
}
// Form output for adds.
$snippets = (array)$config->getGlobalParameter($scriptsParameterName);
$scriptOutput = $this->formSnippetsOutput($snippets, $widget, $isAjaxRequest);
$config->setGlobalParameter($scriptsParameterName, null);
if ($widget) {
$dynamicScripts = (array) $config->getGlobalParameter(\OxidEsales\Eshop\Core\ViewHelper\JavaScriptRegistrator::SNIPPETS_PARAMETER_NAME . '_dynamic');
$scriptOutput .= $this->formSnippetsOutput($dynamicScripts, $widget, $isAjaxRequest);
$config->setGlobalParameter(\OxidEsales\Eshop\Core\ViewHelper\JavaScriptRegistrator::SNIPPETS_PARAMETER_NAME . '_dynamic', null);
}
$output .= $this->enclose($scriptOutput, $widget, $isAjaxRequest);
}
return $output;
} | [
"public",
"function",
"render",
"(",
"$",
"widget",
",",
"$",
"forceRender",
",",
"$",
"isDynamic",
"=",
"false",
")",
"{",
"$",
"config",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
";",
"$",
... | Renders all registered JavaScript snippets and files.
@param string $widget Widget name
@param bool $forceRender Force rendering of scripts.
@param bool $isDynamic Force rendering of scripts.
@return string | [
"Renders",
"all",
"registered",
"JavaScript",
"snippets",
"and",
"files",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/ViewHelper/JavaScriptRenderer.php#L23-L59 | train |
OXID-eSales/oxideshop_ce | source/Core/ViewHelper/JavaScriptRenderer.php | JavaScriptRenderer.formFilesOutput | protected function formFilesOutput($includes, $widget)
{
if (!count($includes)) {
return '';
}
ksort($includes); // Sort by priority.
$usedSources = [];
$widgets = [];
$widgetTemplate = "WidgetsHandler.registerFile('%s', '%s');";
$scriptTemplate = '<script type="text/javascript" src="%s"></script>';
foreach ($includes as $priority) {
foreach ($priority as $source) {
if (!in_array($source, $usedSources)) {
$widgets[] = sprintf(($widget ? $widgetTemplate : $scriptTemplate), $source, $widget);
$usedSources[] = $source;
}
}
}
$output = implode(PHP_EOL, $widgets);
if ($widget && !empty($output)) {
$output = <<<JS
<script type='text/javascript'>
window.addEventListener('load', function() {
$output
}, false)
</script>
JS;
}
return $output;
} | php | protected function formFilesOutput($includes, $widget)
{
if (!count($includes)) {
return '';
}
ksort($includes); // Sort by priority.
$usedSources = [];
$widgets = [];
$widgetTemplate = "WidgetsHandler.registerFile('%s', '%s');";
$scriptTemplate = '<script type="text/javascript" src="%s"></script>';
foreach ($includes as $priority) {
foreach ($priority as $source) {
if (!in_array($source, $usedSources)) {
$widgets[] = sprintf(($widget ? $widgetTemplate : $scriptTemplate), $source, $widget);
$usedSources[] = $source;
}
}
}
$output = implode(PHP_EOL, $widgets);
if ($widget && !empty($output)) {
$output = <<<JS
<script type='text/javascript'>
window.addEventListener('load', function() {
$output
}, false)
</script>
JS;
}
return $output;
} | [
"protected",
"function",
"formFilesOutput",
"(",
"$",
"includes",
",",
"$",
"widget",
")",
"{",
"if",
"(",
"!",
"count",
"(",
"$",
"includes",
")",
")",
"{",
"return",
"''",
";",
"}",
"ksort",
"(",
"$",
"includes",
")",
";",
"// Sort by priority.",
"$"... | Form output for includes.
@param array $includes String files to include.
@param string $widget Widget name.
@return string | [
"Form",
"output",
"for",
"includes",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/ViewHelper/JavaScriptRenderer.php#L105-L136 | train |
OXID-eSales/oxideshop_ce | source/Core/ViewHelper/JavaScriptRenderer.php | JavaScriptRenderer.formSnippetsOutput | protected function formSnippetsOutput($scripts, $widgetName, $ajaxRequest)
{
$preparedScripts = [];
foreach ($scripts as $script) {
if ($widgetName && !$ajaxRequest) {
$sanitizedScript = $this->sanitize($script);
$script = "WidgetsHandler.registerFunction('$sanitizedScript', '$widgetName');";
}
$preparedScripts[] = $script;
}
return implode(PHP_EOL, $preparedScripts);
} | php | protected function formSnippetsOutput($scripts, $widgetName, $ajaxRequest)
{
$preparedScripts = [];
foreach ($scripts as $script) {
if ($widgetName && !$ajaxRequest) {
$sanitizedScript = $this->sanitize($script);
$script = "WidgetsHandler.registerFunction('$sanitizedScript', '$widgetName');";
}
$preparedScripts[] = $script;
}
return implode(PHP_EOL, $preparedScripts);
} | [
"protected",
"function",
"formSnippetsOutput",
"(",
"$",
"scripts",
",",
"$",
"widgetName",
",",
"$",
"ajaxRequest",
")",
"{",
"$",
"preparedScripts",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"scripts",
"as",
"$",
"script",
")",
"{",
"if",
"(",
"$",
"w... | Forms how javascript should look like when output.
If varnish is active, javascript should be passed to WidgetsHandler instead of direct call.
@param array $scripts Scripts to execute (from add).
@param string $widgetName Widget name.
@param bool $ajaxRequest Is ajax request.
@return string | [
"Forms",
"how",
"javascript",
"should",
"look",
"like",
"when",
"output",
".",
"If",
"varnish",
"is",
"active",
"javascript",
"should",
"be",
"passed",
"to",
"WidgetsHandler",
"instead",
"of",
"direct",
"call",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/ViewHelper/JavaScriptRenderer.php#L148-L160 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/AdminController.php | AdminController._addNavigationHistory | protected function _addNavigationHistory($sNode)
{
$myUtilsServer = \OxidEsales\Eshop\Core\Registry::getUtilsServer();
// store navigation history
$aHistory = explode('|', $myUtilsServer->getOxCookie('oxidadminhistory'));
if (!is_array($aHistory)) {
$aHistory = [];
}
if (!in_array($sNode, $aHistory)) {
$aHistory[] = $sNode;
}
$myUtilsServer->setOxCookie('oxidadminhistory', implode('|', $aHistory));
} | php | protected function _addNavigationHistory($sNode)
{
$myUtilsServer = \OxidEsales\Eshop\Core\Registry::getUtilsServer();
// store navigation history
$aHistory = explode('|', $myUtilsServer->getOxCookie('oxidadminhistory'));
if (!is_array($aHistory)) {
$aHistory = [];
}
if (!in_array($sNode, $aHistory)) {
$aHistory[] = $sNode;
}
$myUtilsServer->setOxCookie('oxidadminhistory', implode('|', $aHistory));
} | [
"protected",
"function",
"_addNavigationHistory",
"(",
"$",
"sNode",
")",
"{",
"$",
"myUtilsServer",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getUtilsServer",
"(",
")",
";",
"// store navigation history",
"$",
"aHistory",
"=... | Store navigation history parameters to cookie
@param string $sNode active view id | [
"Store",
"navigation",
"history",
"parameters",
"to",
"cookie"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/AdminController.php#L257-L272 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/AdminController.php | AdminController._getMaxUploadFileInfo | protected function _getMaxUploadFileInfo($iMaxFileSize, $blFormatted = false)
{
$iMaxFileSize = $iMaxFileSize ? $iMaxFileSize : '2M';
// processing config
$iMaxFileSize = trim($iMaxFileSize);
$sParam = strtolower($iMaxFileSize{strlen($iMaxFileSize) - 1});
switch ($sParam) {
case 'g':
$iMaxFileSize *= 1024;
// no break
case 'm':
$iMaxFileSize *= 1024;
// no break
case 'k':
$iMaxFileSize *= 1024;
}
// formatting
$aMarkers = ['KB', 'MB', 'GB'];
$sFormattedMaxSize = '';
$iSize = floor($iMaxFileSize / 1024);
while ($iSize && current($aMarkers)) {
$sFormattedMaxSize = $iSize . " " . current($aMarkers);
$iSize = floor($iSize / 1024);
next($aMarkers);
}
return [$iMaxFileSize, $sFormattedMaxSize];
} | php | protected function _getMaxUploadFileInfo($iMaxFileSize, $blFormatted = false)
{
$iMaxFileSize = $iMaxFileSize ? $iMaxFileSize : '2M';
// processing config
$iMaxFileSize = trim($iMaxFileSize);
$sParam = strtolower($iMaxFileSize{strlen($iMaxFileSize) - 1});
switch ($sParam) {
case 'g':
$iMaxFileSize *= 1024;
// no break
case 'm':
$iMaxFileSize *= 1024;
// no break
case 'k':
$iMaxFileSize *= 1024;
}
// formatting
$aMarkers = ['KB', 'MB', 'GB'];
$sFormattedMaxSize = '';
$iSize = floor($iMaxFileSize / 1024);
while ($iSize && current($aMarkers)) {
$sFormattedMaxSize = $iSize . " " . current($aMarkers);
$iSize = floor($iSize / 1024);
next($aMarkers);
}
return [$iMaxFileSize, $sFormattedMaxSize];
} | [
"protected",
"function",
"_getMaxUploadFileInfo",
"(",
"$",
"iMaxFileSize",
",",
"$",
"blFormatted",
"=",
"false",
")",
"{",
"$",
"iMaxFileSize",
"=",
"$",
"iMaxFileSize",
"?",
"$",
"iMaxFileSize",
":",
"'2M'",
";",
"// processing config",
"$",
"iMaxFileSize",
"... | Returns maximum allowed size of upload file and formatted size equivalent
@param int $iMaxFileSize recommended maximum size of file (normalu value is taken from php ini, otherwise sets 2MB)
@param bool $blFormatted Return formated
@return array | [
"Returns",
"maximum",
"allowed",
"size",
"of",
"upload",
"file",
"and",
"formatted",
"size",
"equivalent"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/AdminController.php#L330-L360 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/AdminController.php | AdminController._getCountryByCode | protected function _getCountryByCode($sCountryCode)
{
//default country
$sCountry = 'international';
if (!empty($sCountryCode)) {
$aLangIds = \OxidEsales\Eshop\Core\Registry::getLang()->getLanguageIds();
$iEnglishId = array_search("en", $aLangIds);
if (false !== $iEnglishId) {
$sViewName = getViewName("oxcountry", $iEnglishId);
$sQ = "select oxtitle from {$sViewName} where oxisoalpha2 = " . \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quote($sCountryCode);
// Value does not change that often, reading from slave is ok here (see ESDEV-3804 and ESDEV-3822).
$sCountryName = \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->getOne($sQ);
if ($sCountryName) {
$sCountry = $sCountryName;
}
} else {
// handling when english language is deleted
switch ($sCountryCode) {
case 'de':
return 'germany';
default:
return 'international';
}
}
}
return strtolower($sCountry);
} | php | protected function _getCountryByCode($sCountryCode)
{
//default country
$sCountry = 'international';
if (!empty($sCountryCode)) {
$aLangIds = \OxidEsales\Eshop\Core\Registry::getLang()->getLanguageIds();
$iEnglishId = array_search("en", $aLangIds);
if (false !== $iEnglishId) {
$sViewName = getViewName("oxcountry", $iEnglishId);
$sQ = "select oxtitle from {$sViewName} where oxisoalpha2 = " . \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quote($sCountryCode);
// Value does not change that often, reading from slave is ok here (see ESDEV-3804 and ESDEV-3822).
$sCountryName = \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->getOne($sQ);
if ($sCountryName) {
$sCountry = $sCountryName;
}
} else {
// handling when english language is deleted
switch ($sCountryCode) {
case 'de':
return 'germany';
default:
return 'international';
}
}
}
return strtolower($sCountry);
} | [
"protected",
"function",
"_getCountryByCode",
"(",
"$",
"sCountryCode",
")",
"{",
"//default country",
"$",
"sCountry",
"=",
"'international'",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"sCountryCode",
")",
")",
"{",
"$",
"aLangIds",
"=",
"\\",
"OxidEsales",
"... | Get english country name by country iso alpha 2 code
@param string $sCountryCode Country code
@return boolean | [
"Get",
"english",
"country",
"name",
"by",
"country",
"iso",
"alpha",
"2",
"code"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/AdminController.php#L441-L469 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/AdminController.php | AdminController._authorize | protected function _authorize()
{
return ( bool ) (
$this->getSession()->checkSessionChallenge()
&& count(\OxidEsales\Eshop\Core\Registry::getUtilsServer()->getOxCookie())
&& \OxidEsales\Eshop\Core\Registry::getUtils()->checkAccessRights()
);
} | php | protected function _authorize()
{
return ( bool ) (
$this->getSession()->checkSessionChallenge()
&& count(\OxidEsales\Eshop\Core\Registry::getUtilsServer()->getOxCookie())
&& \OxidEsales\Eshop\Core\Registry::getUtils()->checkAccessRights()
);
} | [
"protected",
"function",
"_authorize",
"(",
")",
"{",
"return",
"(",
"bool",
")",
"(",
"$",
"this",
"->",
"getSession",
"(",
")",
"->",
"checkSessionChallenge",
"(",
")",
"&&",
"count",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registr... | performs authorization of admin user
@return boolean | [
"performs",
"authorization",
"of",
"admin",
"user"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/AdminController.php#L476-L483 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/AdminController.php | AdminController.getNavigation | public function getNavigation()
{
if (self::$_oNaviTree == null) {
self::$_oNaviTree = oxNew(\OxidEsales\Eshop\Application\Controller\Admin\NavigationTree::class);
}
return self::$_oNaviTree;
} | php | public function getNavigation()
{
if (self::$_oNaviTree == null) {
self::$_oNaviTree = oxNew(\OxidEsales\Eshop\Application\Controller\Admin\NavigationTree::class);
}
return self::$_oNaviTree;
} | [
"public",
"function",
"getNavigation",
"(",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"_oNaviTree",
"==",
"null",
")",
"{",
"self",
"::",
"$",
"_oNaviTree",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Application",
"\\",
"Controller",
"\\"... | Returns navigation object
@return oxnavigationtree | [
"Returns",
"navigation",
"object"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/AdminController.php#L490-L497 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/AdminController.php | AdminController.getViewId | public function getViewId()
{
$viewId = is_null($this->viewId) ? strtolower($this->getControllerKey()) : $this->viewId;
return $this->getNavigation()->getClassId($viewId);
} | php | public function getViewId()
{
$viewId = is_null($this->viewId) ? strtolower($this->getControllerKey()) : $this->viewId;
return $this->getNavigation()->getClassId($viewId);
} | [
"public",
"function",
"getViewId",
"(",
")",
"{",
"$",
"viewId",
"=",
"is_null",
"(",
"$",
"this",
"->",
"viewId",
")",
"?",
"strtolower",
"(",
"$",
"this",
"->",
"getControllerKey",
"(",
")",
")",
":",
"$",
"this",
"->",
"viewId",
";",
"return",
"$"... | Current view ID getter helps to identify navigation position
@return string | [
"Current",
"view",
"ID",
"getter",
"helps",
"to",
"identify",
"navigation",
"position"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/AdminController.php#L504-L508 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/AdminController.php | AdminController.resetSeoData | public function resetSeoData($sShopId)
{
$aTypes = ['oxarticle', 'oxcategory', 'oxvendor', 'oxcontent', 'dynamic', 'oxmanufacturer'];
$oEncoder = \OxidEsales\Eshop\Core\Registry::getSeoEncoder();
foreach ($aTypes as $sType) {
$oEncoder->markAsExpired(null, $sShopId, 1, null, "oxtype = '{$sType}'");
}
} | php | public function resetSeoData($sShopId)
{
$aTypes = ['oxarticle', 'oxcategory', 'oxvendor', 'oxcontent', 'dynamic', 'oxmanufacturer'];
$oEncoder = \OxidEsales\Eshop\Core\Registry::getSeoEncoder();
foreach ($aTypes as $sType) {
$oEncoder->markAsExpired(null, $sShopId, 1, null, "oxtype = '{$sType}'");
}
} | [
"public",
"function",
"resetSeoData",
"(",
"$",
"sShopId",
")",
"{",
"$",
"aTypes",
"=",
"[",
"'oxarticle'",
",",
"'oxcategory'",
",",
"'oxvendor'",
",",
"'oxcontent'",
",",
"'dynamic'",
",",
"'oxmanufacturer'",
"]",
";",
"$",
"oEncoder",
"=",
"\\",
"OxidEsa... | Marks seo entires as expired.
@param string $sShopId Shop id | [
"Marks",
"seo",
"entires",
"as",
"expired",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/AdminController.php#L525-L532 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/AdminController.php | AdminController.getControllerKey | protected function getControllerKey()
{
$actualClass = get_class($this);
$controllerKey = \OxidEsales\Eshop\Core\Registry::getControllerClassNameResolver()->getIdByClassName($actualClass);
if (is_null($controllerKey)) {
//we might not have found a class key because class is a module chain extended class
$controllerKey = \OxidEsales\Eshop\Core\Registry::getControllerClassNameResolver()->getIdByClassName($this->getShopParentClass());
}
return $controllerKey;
} | php | protected function getControllerKey()
{
$actualClass = get_class($this);
$controllerKey = \OxidEsales\Eshop\Core\Registry::getControllerClassNameResolver()->getIdByClassName($actualClass);
if (is_null($controllerKey)) {
//we might not have found a class key because class is a module chain extended class
$controllerKey = \OxidEsales\Eshop\Core\Registry::getControllerClassNameResolver()->getIdByClassName($this->getShopParentClass());
}
return $controllerKey;
} | [
"protected",
"function",
"getControllerKey",
"(",
")",
"{",
"$",
"actualClass",
"=",
"get_class",
"(",
"$",
"this",
")",
";",
"$",
"controllerKey",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getControllerClassNameResolver",
... | Get controller key also for chain extended class.
@return null|string | [
"Get",
"controller",
"key",
"also",
"for",
"chain",
"extended",
"class",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/AdminController.php#L586-L595 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/AdminController.php | AdminController.getShopParentClass | protected function getShopParentClass()
{
$className = get_class($this); //actual class, might be shop class chain extended by module
while ($className && !\OxidEsales\Eshop\Core\NamespaceInformationProvider::classBelongsToShopUnifiedNamespace($className)) {
$className = get_parent_class($className);
}
return $className;
} | php | protected function getShopParentClass()
{
$className = get_class($this); //actual class, might be shop class chain extended by module
while ($className && !\OxidEsales\Eshop\Core\NamespaceInformationProvider::classBelongsToShopUnifiedNamespace($className)) {
$className = get_parent_class($className);
}
return $className;
} | [
"protected",
"function",
"getShopParentClass",
"(",
")",
"{",
"$",
"className",
"=",
"get_class",
"(",
"$",
"this",
")",
";",
"//actual class, might be shop class chain extended by module",
"while",
"(",
"$",
"className",
"&&",
"!",
"\\",
"OxidEsales",
"\\",
"Eshop"... | Method to figure out \OxidEsales\Eshop class.
@return string | [
"Method",
"to",
"figure",
"out",
"\\",
"OxidEsales",
"\\",
"Eshop",
"class",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/AdminController.php#L602-L609 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Discount.php | Discount.save | public function save()
{
// Auto assign oxsort, if it is null
$oxsort = $this->oxdiscount__oxsort->value;
if (is_null($oxsort)) {
$shopId = $this->oxdiscount__oxshopid->value;
$newSort = $this->getNextOxsort($shopId);
$this->oxdiscount__oxsort = new \oxField($newSort, \OxidEsales\Eshop\Core\Field::T_RAW);
}
// Validate oxsort before saving
if (!is_numeric($this->oxdiscount__oxsort->value)) {
$exception = oxNew(\OxidEsales\Eshop\Core\Exception\InputException::class);
$exception->setMessage('DISCOUNT_ERROR_OXSORT_NOT_A_NUMBER');
throw $exception;
}
try {
$saveStatus = parent::save();
} catch (\OxidEsales\Eshop\Core\Exception\StandardException $exception) {
if ($exception->getCode() == \OxidEsales\Eshop\Core\Database\Adapter\Doctrine\Database::DUPLICATE_KEY_ERROR_CODE && false !== strpos($exception->getMessage(), 'UNIQ_OXSORT')) {
$exception = oxNew(\OxidEsales\Eshop\Core\Exception\InputException::class);
$exception->setMessage('DISCOUNT_ERROR_OXSORT_NOT_UNIQUE');
}
throw $exception;
}
return $saveStatus;
} | php | public function save()
{
// Auto assign oxsort, if it is null
$oxsort = $this->oxdiscount__oxsort->value;
if (is_null($oxsort)) {
$shopId = $this->oxdiscount__oxshopid->value;
$newSort = $this->getNextOxsort($shopId);
$this->oxdiscount__oxsort = new \oxField($newSort, \OxidEsales\Eshop\Core\Field::T_RAW);
}
// Validate oxsort before saving
if (!is_numeric($this->oxdiscount__oxsort->value)) {
$exception = oxNew(\OxidEsales\Eshop\Core\Exception\InputException::class);
$exception->setMessage('DISCOUNT_ERROR_OXSORT_NOT_A_NUMBER');
throw $exception;
}
try {
$saveStatus = parent::save();
} catch (\OxidEsales\Eshop\Core\Exception\StandardException $exception) {
if ($exception->getCode() == \OxidEsales\Eshop\Core\Database\Adapter\Doctrine\Database::DUPLICATE_KEY_ERROR_CODE && false !== strpos($exception->getMessage(), 'UNIQ_OXSORT')) {
$exception = oxNew(\OxidEsales\Eshop\Core\Exception\InputException::class);
$exception->setMessage('DISCOUNT_ERROR_OXSORT_NOT_UNIQUE');
}
throw $exception;
}
return $saveStatus;
} | [
"public",
"function",
"save",
"(",
")",
"{",
"// Auto assign oxsort, if it is null",
"$",
"oxsort",
"=",
"$",
"this",
"->",
"oxdiscount__oxsort",
"->",
"value",
";",
"if",
"(",
"is_null",
"(",
"$",
"oxsort",
")",
")",
"{",
"$",
"shopId",
"=",
"$",
"this",
... | Save the discount.
Assigns a value to oxsort, if it was null
Does input validation before saving the discount.
Returns saving status
@throws \oxInputException
@throws StandardException
@return bool | [
"Save",
"the",
"discount",
".",
"Assigns",
"a",
"value",
"to",
"oxsort",
"if",
"it",
"was",
"null",
"Does",
"input",
"validation",
"before",
"saving",
"the",
"discount",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Discount.php#L98-L128 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Discount.php | Discount.isForArticle | public function isForArticle($oArticle)
{
// item discounts may only be applied for basket
if ($this->oxdiscount__oxaddsumtype->value == 'itm') {
return false;
}
if ($this->oxdiscount__oxamount->value || $this->oxdiscount__oxprice->value) {
return false;
}
if ($this->oxdiscount__oxpriceto->value && ($this->oxdiscount__oxpriceto->value < $oArticle->getBasePrice())) {
return false;
}
if ($this->isGlobalDiscount()) {
return true;
}
$sArticleId = $oArticle->getProductId();
if (!isset($this->_aHasArticleDiscounts[$sArticleId])) {
$blResult = $this->_isArticleAssigned($oArticle) || $this->_isCategoriesAssigned($oArticle->getCategoryIds());
$this->_aHasArticleDiscounts[$sArticleId] = $blResult;
}
return $this->_aHasArticleDiscounts[$sArticleId];
} | php | public function isForArticle($oArticle)
{
// item discounts may only be applied for basket
if ($this->oxdiscount__oxaddsumtype->value == 'itm') {
return false;
}
if ($this->oxdiscount__oxamount->value || $this->oxdiscount__oxprice->value) {
return false;
}
if ($this->oxdiscount__oxpriceto->value && ($this->oxdiscount__oxpriceto->value < $oArticle->getBasePrice())) {
return false;
}
if ($this->isGlobalDiscount()) {
return true;
}
$sArticleId = $oArticle->getProductId();
if (!isset($this->_aHasArticleDiscounts[$sArticleId])) {
$blResult = $this->_isArticleAssigned($oArticle) || $this->_isCategoriesAssigned($oArticle->getCategoryIds());
$this->_aHasArticleDiscounts[$sArticleId] = $blResult;
}
return $this->_aHasArticleDiscounts[$sArticleId];
} | [
"public",
"function",
"isForArticle",
"(",
"$",
"oArticle",
")",
"{",
"// item discounts may only be applied for basket",
"if",
"(",
"$",
"this",
"->",
"oxdiscount__oxaddsumtype",
"->",
"value",
"==",
"'itm'",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"$... | Checks if discount applies for article
@param \OxidEsales\Eshop\Application\Model\Article $oArticle article object
@return bool | [
"Checks",
"if",
"discount",
"applies",
"for",
"article"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Discount.php#L157-L185 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Discount.php | Discount.isForBasketItem | public function isForBasketItem($oArticle)
{
if ($this->oxdiscount__oxamount->value == 0 && $this->oxdiscount__oxprice->value == 0) {
return false;
}
// skipping bundle discounts
if ($this->oxdiscount__oxaddsumtype->value == 'itm') {
return false;
}
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
// check if this article is assigned
$sQ = "select 1 from oxobject2discount where oxdiscountid = " . $oDb->quote($this->oxdiscount__oxid->value) . " and oxtype = 'oxarticles' ";
$sQ .= $this->_getProductCheckQuery($oArticle);
if (!($blOk = ( bool ) $oDb->getOne($sQ))) {
// checking article category
$blOk = $this->_checkForArticleCategories($oArticle);
}
return $blOk;
} | php | public function isForBasketItem($oArticle)
{
if ($this->oxdiscount__oxamount->value == 0 && $this->oxdiscount__oxprice->value == 0) {
return false;
}
// skipping bundle discounts
if ($this->oxdiscount__oxaddsumtype->value == 'itm') {
return false;
}
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
// check if this article is assigned
$sQ = "select 1 from oxobject2discount where oxdiscountid = " . $oDb->quote($this->oxdiscount__oxid->value) . " and oxtype = 'oxarticles' ";
$sQ .= $this->_getProductCheckQuery($oArticle);
if (!($blOk = ( bool ) $oDb->getOne($sQ))) {
// checking article category
$blOk = $this->_checkForArticleCategories($oArticle);
}
return $blOk;
} | [
"public",
"function",
"isForBasketItem",
"(",
"$",
"oArticle",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"oxdiscount__oxamount",
"->",
"value",
"==",
"0",
"&&",
"$",
"this",
"->",
"oxdiscount__oxprice",
"->",
"value",
"==",
"0",
")",
"{",
"return",
"false",
... | Checks if discount is setup for some basket item
@param object $oArticle basket item
@return bool | [
"Checks",
"if",
"discount",
"is",
"setup",
"for",
"some",
"basket",
"item"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Discount.php#L194-L216 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Discount.php | Discount.isForBasket | public function isForBasket($oBasket)
{
// initial configuration check
if ($this->oxdiscount__oxamount->value == 0 && $this->oxdiscount__oxprice->value == 0) {
return false;
}
$oSummary = $oBasket->getBasketSummary();
// amounts check
if ($this->oxdiscount__oxamount->value && ($oSummary->iArticleCount < $this->oxdiscount__oxamount->value || $oSummary->iArticleCount > $this->oxdiscount__oxamountto->value)) {
return false;
// price check
} elseif ($this->oxdiscount__oxprice->value) {
$dRate = $oBasket->getBasketCurrency()->rate;
if ($oSummary->dArticleDiscountablePrice < $this->oxdiscount__oxprice->value * $dRate || $oSummary->dArticleDiscountablePrice > $this->oxdiscount__oxpriceto->value * $dRate) {
return false;
}
}
// oxobject2discount configuration check
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$sQ = 'select 1 from oxobject2discount where oxdiscountid = ' . $oDb->quote($this->oxdiscount__oxid->value) . ' and oxtype in ("oxarticles", "oxcategories" ) ';
return !((bool) $oDb->getOne($sQ));
} | php | public function isForBasket($oBasket)
{
// initial configuration check
if ($this->oxdiscount__oxamount->value == 0 && $this->oxdiscount__oxprice->value == 0) {
return false;
}
$oSummary = $oBasket->getBasketSummary();
// amounts check
if ($this->oxdiscount__oxamount->value && ($oSummary->iArticleCount < $this->oxdiscount__oxamount->value || $oSummary->iArticleCount > $this->oxdiscount__oxamountto->value)) {
return false;
// price check
} elseif ($this->oxdiscount__oxprice->value) {
$dRate = $oBasket->getBasketCurrency()->rate;
if ($oSummary->dArticleDiscountablePrice < $this->oxdiscount__oxprice->value * $dRate || $oSummary->dArticleDiscountablePrice > $this->oxdiscount__oxpriceto->value * $dRate) {
return false;
}
}
// oxobject2discount configuration check
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$sQ = 'select 1 from oxobject2discount where oxdiscountid = ' . $oDb->quote($this->oxdiscount__oxid->value) . ' and oxtype in ("oxarticles", "oxcategories" ) ';
return !((bool) $oDb->getOne($sQ));
} | [
"public",
"function",
"isForBasket",
"(",
"$",
"oBasket",
")",
"{",
"// initial configuration check",
"if",
"(",
"$",
"this",
"->",
"oxdiscount__oxamount",
"->",
"value",
"==",
"0",
"&&",
"$",
"this",
"->",
"oxdiscount__oxprice",
"->",
"value",
"==",
"0",
")",... | Checks if discount is setup for whole basket
@param object $oBasket basket object
@return bool | [
"Checks",
"if",
"discount",
"is",
"setup",
"for",
"whole",
"basket"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Discount.php#L284-L308 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Discount.php | Discount.isForBundleItem | public function isForBundleItem($oArticle)
{
if ($this->oxdiscount__oxaddsumtype->value != 'itm') {
return false;
}
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$sQ = "select 1 from oxobject2discount where oxdiscountid=" . $oDb->quote($this->getId());
$sQ .= $this->_getProductCheckQuery($oArticle);
if (!($blOk = (bool) $oDb->getOne($sQ))) {
// additional checks for amounts and other dependencies
$blOk = $this->_checkForArticleCategories($oArticle);
}
return $blOk;
} | php | public function isForBundleItem($oArticle)
{
if ($this->oxdiscount__oxaddsumtype->value != 'itm') {
return false;
}
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$sQ = "select 1 from oxobject2discount where oxdiscountid=" . $oDb->quote($this->getId());
$sQ .= $this->_getProductCheckQuery($oArticle);
if (!($blOk = (bool) $oDb->getOne($sQ))) {
// additional checks for amounts and other dependencies
$blOk = $this->_checkForArticleCategories($oArticle);
}
return $blOk;
} | [
"public",
"function",
"isForBundleItem",
"(",
"$",
"oArticle",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"oxdiscount__oxaddsumtype",
"->",
"value",
"!=",
"'itm'",
")",
"{",
"return",
"false",
";",
"}",
"$",
"oDb",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\... | Checks if discount type is bundle discount
@param object $oArticle article object
@return bool | [
"Checks",
"if",
"discount",
"type",
"is",
"bundle",
"discount"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Discount.php#L317-L332 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Discount.php | Discount.getAbsValue | public function getAbsValue($dPrice, $dAmount = 1)
{
if ($this->oxdiscount__oxaddsumtype->value == '%') {
return $dPrice * ($this->oxdiscount__oxaddsum->value / 100);
} else {
$oCur = \OxidEsales\Eshop\Core\Registry::getConfig()->getActShopCurrencyObject();
return $this->oxdiscount__oxaddsum->value * $dAmount * $oCur->rate;
}
} | php | public function getAbsValue($dPrice, $dAmount = 1)
{
if ($this->oxdiscount__oxaddsumtype->value == '%') {
return $dPrice * ($this->oxdiscount__oxaddsum->value / 100);
} else {
$oCur = \OxidEsales\Eshop\Core\Registry::getConfig()->getActShopCurrencyObject();
return $this->oxdiscount__oxaddsum->value * $dAmount * $oCur->rate;
}
} | [
"public",
"function",
"getAbsValue",
"(",
"$",
"dPrice",
",",
"$",
"dAmount",
"=",
"1",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"oxdiscount__oxaddsumtype",
"->",
"value",
"==",
"'%'",
")",
"{",
"return",
"$",
"dPrice",
"*",
"(",
"$",
"this",
"->",
"o... | Returns absolute discount value
@param float $dPrice item price
@param float|int $dAmount item amount, interpretted only when discount is absolute (default 1)
@return float | [
"Returns",
"absolute",
"discount",
"value"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Discount.php#L358-L367 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Discount.php | Discount.getPercentage | public function getPercentage($dPrice)
{
if ($this->getAddSumType() == 'abs' && $dPrice > 0) {
return $this->getAddSum() / $dPrice * 100;
} else {
return $this->getAddSum();
}
} | php | public function getPercentage($dPrice)
{
if ($this->getAddSumType() == 'abs' && $dPrice > 0) {
return $this->getAddSum() / $dPrice * 100;
} else {
return $this->getAddSum();
}
} | [
"public",
"function",
"getPercentage",
"(",
"$",
"dPrice",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getAddSumType",
"(",
")",
"==",
"'abs'",
"&&",
"$",
"dPrice",
">",
"0",
")",
"{",
"return",
"$",
"this",
"->",
"getAddSum",
"(",
")",
"/",
"$",
"dPr... | Return discount percent
@param double $dPrice - price from which calculates discount
@return double | [
"Return",
"discount",
"percent"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Discount.php#L376-L383 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Discount.php | Discount.getAddSum | public function getAddSum()
{
if ($this->oxdiscount__oxaddsumtype->value == 'abs') {
$oCur = \OxidEsales\Eshop\Core\Registry::getConfig()->getActShopCurrencyObject();
return $this->oxdiscount__oxaddsum->value * $oCur->rate;
} else {
return $this->oxdiscount__oxaddsum->value;
}
} | php | public function getAddSum()
{
if ($this->oxdiscount__oxaddsumtype->value == 'abs') {
$oCur = \OxidEsales\Eshop\Core\Registry::getConfig()->getActShopCurrencyObject();
return $this->oxdiscount__oxaddsum->value * $oCur->rate;
} else {
return $this->oxdiscount__oxaddsum->value;
}
} | [
"public",
"function",
"getAddSum",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"oxdiscount__oxaddsumtype",
"->",
"value",
"==",
"'abs'",
")",
"{",
"$",
"oCur",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(... | Return add sum in abs type discount with efected currency rate;
Return discount percent value in other way;
@return double | [
"Return",
"add",
"sum",
"in",
"abs",
"type",
"discount",
"with",
"efected",
"currency",
"rate",
";",
"Return",
"discount",
"percent",
"value",
"in",
"other",
"way",
";"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Discount.php#L391-L400 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Discount.php | Discount.getBundleAmount | public function getBundleAmount($dAmount)
{
$dItemAmount = $this->oxdiscount__oxitmamount->value;
// Multiplying bundled articles count, if allowed
if ($this->oxdiscount__oxitmmultiple->value && $this->oxdiscount__oxamount->value > 0) {
$dItemAmount = floor($dAmount / $this->oxdiscount__oxamount->value) * $this->oxdiscount__oxitmamount->value;
}
return $dItemAmount;
} | php | public function getBundleAmount($dAmount)
{
$dItemAmount = $this->oxdiscount__oxitmamount->value;
// Multiplying bundled articles count, if allowed
if ($this->oxdiscount__oxitmmultiple->value && $this->oxdiscount__oxamount->value > 0) {
$dItemAmount = floor($dAmount / $this->oxdiscount__oxamount->value) * $this->oxdiscount__oxitmamount->value;
}
return $dItemAmount;
} | [
"public",
"function",
"getBundleAmount",
"(",
"$",
"dAmount",
")",
"{",
"$",
"dItemAmount",
"=",
"$",
"this",
"->",
"oxdiscount__oxitmamount",
"->",
"value",
";",
"// Multiplying bundled articles count, if allowed",
"if",
"(",
"$",
"this",
"->",
"oxdiscount__oxitmmult... | Returns amount of items to bundle
@param double $dAmount item amount
@return double | [
"Returns",
"amount",
"of",
"items",
"to",
"bundle"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Discount.php#L419-L429 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Discount.php | Discount.getSimpleDiscount | public function getSimpleDiscount()
{
$oDiscount = new stdClass();
$oDiscount->sOXID = $this->getId();
$oDiscount->sDiscount = $this->oxdiscount__oxtitle->value;
$oDiscount->sType = $this->oxdiscount__oxaddsumtype->value;
return $oDiscount;
} | php | public function getSimpleDiscount()
{
$oDiscount = new stdClass();
$oDiscount->sOXID = $this->getId();
$oDiscount->sDiscount = $this->oxdiscount__oxtitle->value;
$oDiscount->sType = $this->oxdiscount__oxaddsumtype->value;
return $oDiscount;
} | [
"public",
"function",
"getSimpleDiscount",
"(",
")",
"{",
"$",
"oDiscount",
"=",
"new",
"stdClass",
"(",
")",
";",
"$",
"oDiscount",
"->",
"sOXID",
"=",
"$",
"this",
"->",
"getId",
"(",
")",
";",
"$",
"oDiscount",
"->",
"sDiscount",
"=",
"$",
"this",
... | Returns compact discount object which is used in oxbasket
@return stdClass | [
"Returns",
"compact",
"discount",
"object",
"which",
"is",
"used",
"in",
"oxbasket"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Discount.php#L436-L444 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Discount.php | Discount._checkForArticleCategories | protected function _checkForArticleCategories($oArticle)
{
// check if article is in some assigned category
$aCatIds = $oArticle->getCategoryIds();
if (!$aCatIds || !count($aCatIds)) {
// no categories are set for article, so no discounts from categories..
return false;
}
$sCatIds = "(" . implode(",", \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quoteArray($aCatIds)) . ")";
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
// getOne appends limit 1, so this one should be fast enough
$sQ = "select oxobjectid from oxobject2discount where oxdiscountid = " . $oDb->quote($this->oxdiscount__oxid->value) . " and oxobjectid in $sCatIds and oxtype = 'oxcategories'";
return $oDb->getOne($sQ);
} | php | protected function _checkForArticleCategories($oArticle)
{
// check if article is in some assigned category
$aCatIds = $oArticle->getCategoryIds();
if (!$aCatIds || !count($aCatIds)) {
// no categories are set for article, so no discounts from categories..
return false;
}
$sCatIds = "(" . implode(",", \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quoteArray($aCatIds)) . ")";
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
// getOne appends limit 1, so this one should be fast enough
$sQ = "select oxobjectid from oxobject2discount where oxdiscountid = " . $oDb->quote($this->oxdiscount__oxid->value) . " and oxobjectid in $sCatIds and oxtype = 'oxcategories'";
return $oDb->getOne($sQ);
} | [
"protected",
"function",
"_checkForArticleCategories",
"(",
"$",
"oArticle",
")",
"{",
"// check if article is in some assigned category",
"$",
"aCatIds",
"=",
"$",
"oArticle",
"->",
"getCategoryIds",
"(",
")",
";",
"if",
"(",
"!",
"$",
"aCatIds",
"||",
"!",
"coun... | Checks if discount may be applied according amounts info
@param object $oArticle article object to chesk
@return bool | [
"Checks",
"if",
"discount",
"may",
"be",
"applied",
"according",
"amounts",
"info"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Discount.php#L488-L504 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Discount.php | Discount._isArticleAssigned | protected function _isArticleAssigned($oArticle)
{
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$sDiscountIdQuoted = $oDb->quote($this->oxdiscount__oxid->value);
$sQ = "select 1
from oxobject2discount
where oxdiscountid = {$sDiscountIdQuoted} and oxtype = 'oxarticles' ";
$sQ .= $this->_getProductCheckQuery($oArticle);
return $oDb->getOne($sQ) ? true : false;
} | php | protected function _isArticleAssigned($oArticle)
{
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$sDiscountIdQuoted = $oDb->quote($this->oxdiscount__oxid->value);
$sQ = "select 1
from oxobject2discount
where oxdiscountid = {$sDiscountIdQuoted} and oxtype = 'oxarticles' ";
$sQ .= $this->_getProductCheckQuery($oArticle);
return $oDb->getOne($sQ) ? true : false;
} | [
"protected",
"function",
"_isArticleAssigned",
"(",
"$",
"oArticle",
")",
"{",
"$",
"oDb",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"DatabaseProvider",
"::",
"getDb",
"(",
")",
";",
"$",
"sDiscountIdQuoted",
"=",
"$",
"oDb",
"->",
"quote... | Checks whether this article is assigned to discount
@param \OxidEsales\Eshop\Application\Model\Article $oArticle
@return bool | [
"Checks",
"whether",
"this",
"article",
"is",
"assigned",
"to",
"discount"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Discount.php#L534-L545 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Discount.php | Discount._isCategoriesAssigned | protected function _isCategoriesAssigned($aCategoryIds)
{
if (empty($aCategoryIds)) {
return false;
}
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$sDiscountIdQuoted = $oDb->quote($this->oxdiscount__oxid->value);
$sCategoryIds = "(" . implode(",", \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quoteArray($aCategoryIds)) . ")";
$sQ = "select 1
from oxobject2discount
where oxdiscountid = {$sDiscountIdQuoted} and oxobjectid in {$sCategoryIds} and oxtype = 'oxcategories'";
return $oDb->getOne($sQ) ? true : false;
} | php | protected function _isCategoriesAssigned($aCategoryIds)
{
if (empty($aCategoryIds)) {
return false;
}
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$sDiscountIdQuoted = $oDb->quote($this->oxdiscount__oxid->value);
$sCategoryIds = "(" . implode(",", \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quoteArray($aCategoryIds)) . ")";
$sQ = "select 1
from oxobject2discount
where oxdiscountid = {$sDiscountIdQuoted} and oxobjectid in {$sCategoryIds} and oxtype = 'oxcategories'";
return $oDb->getOne($sQ) ? true : false;
} | [
"protected",
"function",
"_isCategoriesAssigned",
"(",
"$",
"aCategoryIds",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"aCategoryIds",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"oDb",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Datab... | Checks whether categories are assigned to discount
@param array $aCategoryIds
@return bool | [
"Checks",
"whether",
"categories",
"are",
"assigned",
"to",
"discount"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Discount.php#L554-L569 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/DeliveryMainAjax.php | DeliveryMainAjax.addCountryToDel | public function addCountryToDel()
{
$aChosenCntr = $this->_getActionIds('oxcountry.oxid');
$soxId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('synchoxid');
// adding
if (\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('all')) {
$sCountryTable = $this->_getViewName('oxcountry');
$aChosenCntr = $this->_getAll($this->_addFilter("select $sCountryTable.oxid " . $this->_getQuery()));
}
if ($soxId && $soxId != "-1" && is_array($aChosenCntr)) {
foreach ($aChosenCntr as $sChosenCntr) {
$oObject2Delivery = oxNew(\OxidEsales\Eshop\Core\Model\BaseModel::class);
$oObject2Delivery->init('oxobject2delivery');
$oObject2Delivery->oxobject2delivery__oxdeliveryid = new \OxidEsales\Eshop\Core\Field($soxId);
$oObject2Delivery->oxobject2delivery__oxobjectid = new \OxidEsales\Eshop\Core\Field($sChosenCntr);
$oObject2Delivery->oxobject2delivery__oxtype = new \OxidEsales\Eshop\Core\Field('oxcountry');
$oObject2Delivery->save();
}
}
} | php | public function addCountryToDel()
{
$aChosenCntr = $this->_getActionIds('oxcountry.oxid');
$soxId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('synchoxid');
// adding
if (\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('all')) {
$sCountryTable = $this->_getViewName('oxcountry');
$aChosenCntr = $this->_getAll($this->_addFilter("select $sCountryTable.oxid " . $this->_getQuery()));
}
if ($soxId && $soxId != "-1" && is_array($aChosenCntr)) {
foreach ($aChosenCntr as $sChosenCntr) {
$oObject2Delivery = oxNew(\OxidEsales\Eshop\Core\Model\BaseModel::class);
$oObject2Delivery->init('oxobject2delivery');
$oObject2Delivery->oxobject2delivery__oxdeliveryid = new \OxidEsales\Eshop\Core\Field($soxId);
$oObject2Delivery->oxobject2delivery__oxobjectid = new \OxidEsales\Eshop\Core\Field($sChosenCntr);
$oObject2Delivery->oxobject2delivery__oxtype = new \OxidEsales\Eshop\Core\Field('oxcountry');
$oObject2Delivery->save();
}
}
} | [
"public",
"function",
"addCountryToDel",
"(",
")",
"{",
"$",
"aChosenCntr",
"=",
"$",
"this",
"->",
"_getActionIds",
"(",
"'oxcountry.oxid'",
")",
";",
"$",
"soxId",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
... | Adds chosen countries to delivery list | [
"Adds",
"chosen",
"countries",
"to",
"delivery",
"list"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/DeliveryMainAjax.php#L89-L110 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/DeliveryArticlesAjax.php | DeliveryArticlesAjax.addArtToDel | public function addArtToDel()
{
$aChosenArt = $this->_getActionIds('oxarticles.oxid');
$soxId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('synchoxid');
// adding
if (\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('all')) {
$sArtTable = $this->_getViewName('oxarticles');
$aChosenArt = $this->_getAll($this->_addFilter("select $sArtTable.oxid " . $this->_getQuery()));
}
if ($soxId && $soxId != "-1" && is_array($aChosenArt)) {
foreach ($aChosenArt as $sChosenArt) {
$oObject2Delivery = oxNew(\OxidEsales\Eshop\Core\Model\BaseModel::class);
$oObject2Delivery->init('oxobject2delivery');
$oObject2Delivery->oxobject2delivery__oxdeliveryid = new \OxidEsales\Eshop\Core\Field($soxId);
$oObject2Delivery->oxobject2delivery__oxobjectid = new \OxidEsales\Eshop\Core\Field($sChosenArt);
$oObject2Delivery->oxobject2delivery__oxtype = new \OxidEsales\Eshop\Core\Field("oxarticles");
$oObject2Delivery->save();
}
}
} | php | public function addArtToDel()
{
$aChosenArt = $this->_getActionIds('oxarticles.oxid');
$soxId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('synchoxid');
// adding
if (\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('all')) {
$sArtTable = $this->_getViewName('oxarticles');
$aChosenArt = $this->_getAll($this->_addFilter("select $sArtTable.oxid " . $this->_getQuery()));
}
if ($soxId && $soxId != "-1" && is_array($aChosenArt)) {
foreach ($aChosenArt as $sChosenArt) {
$oObject2Delivery = oxNew(\OxidEsales\Eshop\Core\Model\BaseModel::class);
$oObject2Delivery->init('oxobject2delivery');
$oObject2Delivery->oxobject2delivery__oxdeliveryid = new \OxidEsales\Eshop\Core\Field($soxId);
$oObject2Delivery->oxobject2delivery__oxobjectid = new \OxidEsales\Eshop\Core\Field($sChosenArt);
$oObject2Delivery->oxobject2delivery__oxtype = new \OxidEsales\Eshop\Core\Field("oxarticles");
$oObject2Delivery->save();
}
}
} | [
"public",
"function",
"addArtToDel",
"(",
")",
"{",
"$",
"aChosenArt",
"=",
"$",
"this",
"->",
"_getActionIds",
"(",
"'oxarticles.oxid'",
")",
";",
"$",
"soxId",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"("... | Adds article to delivery configuration | [
"Adds",
"article",
"to",
"delivery",
"configuration"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/DeliveryArticlesAjax.php#L128-L149 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/OrderAddress.php | OrderAddress._processAddress | protected function _processAddress($aData, $sTypeToProcess, $aIgnore)
{
// empty address fields?
$blEmpty = true;
// here we will store names of fields which needs to be cleaned up
$aFields = [];
foreach ($aData as $sName => $sValue) {
// if field type matches..
if (strpos($sName, $sTypeToProcess) !== false) {
// storing which fields must be unset..
$aFields[] = $sName;
// ignoring whats need to be ignored and testing values
if (!in_array($sName, $aIgnore) && $sValue) {
// something was found - means leaving as is..
$blEmpty = false;
break;
}
}
}
// cleanup if empty
if ($blEmpty) {
foreach ($aFields as $sName) {
$aData[$sName] = "";
}
}
return $aData;
} | php | protected function _processAddress($aData, $sTypeToProcess, $aIgnore)
{
// empty address fields?
$blEmpty = true;
// here we will store names of fields which needs to be cleaned up
$aFields = [];
foreach ($aData as $sName => $sValue) {
// if field type matches..
if (strpos($sName, $sTypeToProcess) !== false) {
// storing which fields must be unset..
$aFields[] = $sName;
// ignoring whats need to be ignored and testing values
if (!in_array($sName, $aIgnore) && $sValue) {
// something was found - means leaving as is..
$blEmpty = false;
break;
}
}
}
// cleanup if empty
if ($blEmpty) {
foreach ($aFields as $sName) {
$aData[$sName] = "";
}
}
return $aData;
} | [
"protected",
"function",
"_processAddress",
"(",
"$",
"aData",
",",
"$",
"sTypeToProcess",
",",
"$",
"aIgnore",
")",
"{",
"// empty address fields?",
"$",
"blEmpty",
"=",
"true",
";",
"// here we will store names of fields which needs to be cleaned up",
"$",
"aFields",
... | Iterates through data array, checks if specified fields are filled
in, cleanups not needed data
@param array $aData data to process
@param string $sTypeToProcess data type to process e.g. "oxorder__oxdel"
@param array $aIgnore fields which must be ignored while processing
@return null | [
"Iterates",
"through",
"data",
"array",
"checks",
"if",
"specified",
"fields",
"are",
"filled",
"in",
"cleanups",
"not",
"needed",
"data"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/OrderAddress.php#L56-L87 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/OrderAddress.php | OrderAddress.save | public function save()
{
parent::save();
$soxId = $this->getEditObjectId();
$aParams = (array) \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("editval");
$oOrder = oxNew(\OxidEsales\Eshop\Application\Model\Order::class);
if ($soxId != "-1") {
$oOrder->load($soxId);
} else {
$aParams['oxorder__oxid'] = null;
}
$aParams = $this->_processAddress($aParams, "oxorder__oxdel", ["oxorder__oxdelsal"]);
$oOrder->assign($aParams);
$oOrder->save();
// set oxid if inserted
$this->setEditObjectId($oOrder->getId());
} | php | public function save()
{
parent::save();
$soxId = $this->getEditObjectId();
$aParams = (array) \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("editval");
$oOrder = oxNew(\OxidEsales\Eshop\Application\Model\Order::class);
if ($soxId != "-1") {
$oOrder->load($soxId);
} else {
$aParams['oxorder__oxid'] = null;
}
$aParams = $this->_processAddress($aParams, "oxorder__oxdel", ["oxorder__oxdelsal"]);
$oOrder->assign($aParams);
$oOrder->save();
// set oxid if inserted
$this->setEditObjectId($oOrder->getId());
} | [
"public",
"function",
"save",
"(",
")",
"{",
"parent",
"::",
"save",
"(",
")",
";",
"$",
"soxId",
"=",
"$",
"this",
"->",
"getEditObjectId",
"(",
")",
";",
"$",
"aParams",
"=",
"(",
"array",
")",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\... | Saves ordering address information. | [
"Saves",
"ordering",
"address",
"information",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/OrderAddress.php#L92-L112 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/ActionsGroupsAjax.php | ActionsGroupsAjax.addPromotionGroup | public function addPromotionGroup()
{
$aChosenGroup = $this->_getActionIds('oxgroups.oxid');
$soxId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('synchoxid');
if (\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('all')) {
$sGroupTable = $this->_getViewName('oxgroups');
$aChosenGroup = $this->_getAll($this->_addFilter("select $sGroupTable.oxid " . $this->_getQuery()));
}
$promotionAdded = false;
if ($soxId && $soxId != "-1" && is_array($aChosenGroup)) {
foreach ($aChosenGroup as $sChosenGroup) {
$oObject2Promotion = oxNew(\OxidEsales\Eshop\Core\Model\BaseModel::class);
$oObject2Promotion->init('oxobject2action');
$oObject2Promotion->oxobject2action__oxactionid = new \OxidEsales\Eshop\Core\Field($soxId);
$oObject2Promotion->oxobject2action__oxobjectid = new \OxidEsales\Eshop\Core\Field($sChosenGroup);
$oObject2Promotion->oxobject2action__oxclass = new \OxidEsales\Eshop\Core\Field("oxgroups");
$oObject2Promotion->save();
}
$promotionAdded = true;
}
return $promotionAdded;
} | php | public function addPromotionGroup()
{
$aChosenGroup = $this->_getActionIds('oxgroups.oxid');
$soxId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('synchoxid');
if (\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('all')) {
$sGroupTable = $this->_getViewName('oxgroups');
$aChosenGroup = $this->_getAll($this->_addFilter("select $sGroupTable.oxid " . $this->_getQuery()));
}
$promotionAdded = false;
if ($soxId && $soxId != "-1" && is_array($aChosenGroup)) {
foreach ($aChosenGroup as $sChosenGroup) {
$oObject2Promotion = oxNew(\OxidEsales\Eshop\Core\Model\BaseModel::class);
$oObject2Promotion->init('oxobject2action');
$oObject2Promotion->oxobject2action__oxactionid = new \OxidEsales\Eshop\Core\Field($soxId);
$oObject2Promotion->oxobject2action__oxobjectid = new \OxidEsales\Eshop\Core\Field($sChosenGroup);
$oObject2Promotion->oxobject2action__oxclass = new \OxidEsales\Eshop\Core\Field("oxgroups");
$oObject2Promotion->save();
}
$promotionAdded = true;
}
return $promotionAdded;
} | [
"public",
"function",
"addPromotionGroup",
"(",
")",
"{",
"$",
"aChosenGroup",
"=",
"$",
"this",
"->",
"_getActionIds",
"(",
"'oxgroups.oxid'",
")",
";",
"$",
"soxId",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",... | Adds user group to promotion
@return bool Whether at least one promotion was added. | [
"Adds",
"user",
"group",
"to",
"promotion"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ActionsGroupsAjax.php#L91-L116 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/DownloadController.php | DownloadController.render | public function render()
{
$sFileOrderId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('sorderfileid');
if ($sFileOrderId) {
$oArticleFile = oxNew(\OxidEsales\Eshop\Application\Model\File::class);
try {
/** @var \OxidEsales\Eshop\Application\Model\OrderFile $oOrderFile */
$oOrderFile = oxNew(\OxidEsales\Eshop\Application\Model\OrderFile::class);
if ($oOrderFile->load($sFileOrderId)) {
$sFileId = $oOrderFile->getFileId();
$blLoadedAndExists = $oArticleFile->load($sFileId) && $oArticleFile->exist();
if ($sFileId && $blLoadedAndExists && $oOrderFile->processOrderFile()) {
$oArticleFile->download();
} else {
$sError = "ERROR_MESSAGE_FILE_DOESNOT_EXIST";
}
}
} catch (\OxidEsales\Eshop\Core\Exception\StandardException $oEx) {
$sError = "ERROR_MESSAGE_FILE_DOWNLOAD_FAILED";
}
} else {
$sError = "ERROR_MESSAGE_WRONG_DOWNLOAD_LINK";
}
if ($sError) {
$oEx = new \OxidEsales\Eshop\Core\Exception\ExceptionToDisplay();
$oEx->setMessage($sError);
\OxidEsales\Eshop\Core\Registry::getUtilsView()->addErrorToDisplay($oEx, false);
\OxidEsales\Eshop\Core\Registry::getUtils()->redirect(\OxidEsales\Eshop\Core\Registry::getConfig()->getShopUrl() . 'index.php?cl=account_downloads');
}
} | php | public function render()
{
$sFileOrderId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('sorderfileid');
if ($sFileOrderId) {
$oArticleFile = oxNew(\OxidEsales\Eshop\Application\Model\File::class);
try {
/** @var \OxidEsales\Eshop\Application\Model\OrderFile $oOrderFile */
$oOrderFile = oxNew(\OxidEsales\Eshop\Application\Model\OrderFile::class);
if ($oOrderFile->load($sFileOrderId)) {
$sFileId = $oOrderFile->getFileId();
$blLoadedAndExists = $oArticleFile->load($sFileId) && $oArticleFile->exist();
if ($sFileId && $blLoadedAndExists && $oOrderFile->processOrderFile()) {
$oArticleFile->download();
} else {
$sError = "ERROR_MESSAGE_FILE_DOESNOT_EXIST";
}
}
} catch (\OxidEsales\Eshop\Core\Exception\StandardException $oEx) {
$sError = "ERROR_MESSAGE_FILE_DOWNLOAD_FAILED";
}
} else {
$sError = "ERROR_MESSAGE_WRONG_DOWNLOAD_LINK";
}
if ($sError) {
$oEx = new \OxidEsales\Eshop\Core\Exception\ExceptionToDisplay();
$oEx->setMessage($sError);
\OxidEsales\Eshop\Core\Registry::getUtilsView()->addErrorToDisplay($oEx, false);
\OxidEsales\Eshop\Core\Registry::getUtils()->redirect(\OxidEsales\Eshop\Core\Registry::getConfig()->getShopUrl() . 'index.php?cl=account_downloads');
}
} | [
"public",
"function",
"render",
"(",
")",
"{",
"$",
"sFileOrderId",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
"getRequestParameter",
"(",
"'sorderfileid'",
")",
";",
"if",
"(",
"$",
"sFileOrd... | Checks if given token is valid, formats HTTP headers,
and outputs file to buffer.
If token is not valid, redirects to start page. | [
"Checks",
"if",
"given",
"token",
"is",
"valid",
"formats",
"HTTP",
"headers",
"and",
"outputs",
"file",
"to",
"buffer",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/DownloadController.php#L34-L64 | train |
OXID-eSales/oxideshop_ce | source/Core/SepaIBANValidator.php | SepaIBANValidator.isValidCodeLengths | public function isValidCodeLengths($aCodeLengths)
{
$blValid = false;
if ($this->_isNotEmptyArray($aCodeLengths)) {
$blValid = $this->_isEachCodeLengthValid($aCodeLengths);
}
return $blValid;
} | php | public function isValidCodeLengths($aCodeLengths)
{
$blValid = false;
if ($this->_isNotEmptyArray($aCodeLengths)) {
$blValid = $this->_isEachCodeLengthValid($aCodeLengths);
}
return $blValid;
} | [
"public",
"function",
"isValidCodeLengths",
"(",
"$",
"aCodeLengths",
")",
"{",
"$",
"blValid",
"=",
"false",
";",
"if",
"(",
"$",
"this",
"->",
"_isNotEmptyArray",
"(",
"$",
"aCodeLengths",
")",
")",
"{",
"$",
"blValid",
"=",
"$",
"this",
"->",
"_isEach... | Validation of IBAN registry
@param array $aCodeLengths
@return bool | [
"Validation",
"of",
"IBAN",
"registry"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/SepaIBANValidator.php#L48-L56 | train |
OXID-eSales/oxideshop_ce | source/Core/SepaIBANValidator.php | SepaIBANValidator.setCodeLengths | public function setCodeLengths($aCodeLengths)
{
if ($this->isValidCodeLengths($aCodeLengths)) {
$this->_aCodeLengths = $aCodeLengths;
return true;
} else {
return false;
}
} | php | public function setCodeLengths($aCodeLengths)
{
if ($this->isValidCodeLengths($aCodeLengths)) {
$this->_aCodeLengths = $aCodeLengths;
return true;
} else {
return false;
}
} | [
"public",
"function",
"setCodeLengths",
"(",
"$",
"aCodeLengths",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isValidCodeLengths",
"(",
"$",
"aCodeLengths",
")",
")",
"{",
"$",
"this",
"->",
"_aCodeLengths",
"=",
"$",
"aCodeLengths",
";",
"return",
"true",
";... | Set IBAN Registry
@param array $aCodeLengths
@return bool | [
"Set",
"IBAN",
"Registry"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/SepaIBANValidator.php#L65-L74 | train |
OXID-eSales/oxideshop_ce | source/Core/SepaIBANValidator.php | SepaIBANValidator._isLengthValid | protected function _isLengthValid($sIBAN)
{
$iActualLength = getStr()->strlen($sIBAN);
$iCorrectLength = $this->_getLengthForCountry($sIBAN);
return !is_null($iCorrectLength) && $iActualLength === $iCorrectLength;
} | php | protected function _isLengthValid($sIBAN)
{
$iActualLength = getStr()->strlen($sIBAN);
$iCorrectLength = $this->_getLengthForCountry($sIBAN);
return !is_null($iCorrectLength) && $iActualLength === $iCorrectLength;
} | [
"protected",
"function",
"_isLengthValid",
"(",
"$",
"sIBAN",
")",
"{",
"$",
"iActualLength",
"=",
"getStr",
"(",
")",
"->",
"strlen",
"(",
"$",
"sIBAN",
")",
";",
"$",
"iCorrectLength",
"=",
"$",
"this",
"->",
"_getLengthForCountry",
"(",
"$",
"sIBAN",
... | Check if the total IBAN length is correct as per country. If not, the IBAN is invalid.
@param string $sIBAN IBAN
@return bool | [
"Check",
"if",
"the",
"total",
"IBAN",
"length",
"is",
"correct",
"as",
"per",
"country",
".",
"If",
"not",
"the",
"IBAN",
"is",
"invalid",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/SepaIBANValidator.php#L94-L101 | train |
OXID-eSales/oxideshop_ce | source/Core/SepaIBANValidator.php | SepaIBANValidator._getLengthForCountry | protected function _getLengthForCountry($sIBAN)
{
$aIBANRegistry = $this->getCodeLengths();
$sCountryCode = getStr()->substr($sIBAN, 0, 2);
$iCorrectLength = (isset($aIBANRegistry[$sCountryCode])) ? $aIBANRegistry[$sCountryCode] : null;
return $iCorrectLength;
} | php | protected function _getLengthForCountry($sIBAN)
{
$aIBANRegistry = $this->getCodeLengths();
$sCountryCode = getStr()->substr($sIBAN, 0, 2);
$iCorrectLength = (isset($aIBANRegistry[$sCountryCode])) ? $aIBANRegistry[$sCountryCode] : null;
return $iCorrectLength;
} | [
"protected",
"function",
"_getLengthForCountry",
"(",
"$",
"sIBAN",
")",
"{",
"$",
"aIBANRegistry",
"=",
"$",
"this",
"->",
"getCodeLengths",
"(",
")",
";",
"$",
"sCountryCode",
"=",
"getStr",
"(",
")",
"->",
"substr",
"(",
"$",
"sIBAN",
",",
"0",
",",
... | Gets length for country.
@param string $sIBAN IBAN
@return null | [
"Gets",
"length",
"for",
"country",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/SepaIBANValidator.php#L111-L120 | train |
OXID-eSales/oxideshop_ce | source/Core/SepaIBANValidator.php | SepaIBANValidator._isAlgorithmValid | protected function _isAlgorithmValid($sIBAN)
{
$sIBAN = $this->_moveInitialCharactersToEnd($sIBAN);
$sIBAN = $this->_replaceLettersToNumbers($sIBAN);
return $this->_isIBANChecksumValid($sIBAN);
} | php | protected function _isAlgorithmValid($sIBAN)
{
$sIBAN = $this->_moveInitialCharactersToEnd($sIBAN);
$sIBAN = $this->_replaceLettersToNumbers($sIBAN);
return $this->_isIBANChecksumValid($sIBAN);
} | [
"protected",
"function",
"_isAlgorithmValid",
"(",
"$",
"sIBAN",
")",
"{",
"$",
"sIBAN",
"=",
"$",
"this",
"->",
"_moveInitialCharactersToEnd",
"(",
"$",
"sIBAN",
")",
";",
"$",
"sIBAN",
"=",
"$",
"this",
"->",
"_replaceLettersToNumbers",
"(",
"$",
"sIBAN",
... | Checks if IBAN is valid according to checksum algorithm
@param string $sIBAN IBAN
@return bool | [
"Checks",
"if",
"IBAN",
"is",
"valid",
"according",
"to",
"checksum",
"algorithm"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/SepaIBANValidator.php#L129-L136 | train |
OXID-eSales/oxideshop_ce | source/Core/SepaIBANValidator.php | SepaIBANValidator._moveInitialCharactersToEnd | protected function _moveInitialCharactersToEnd($sIBAN)
{
$oStr = getStr();
$sInitialChars = $oStr->substr($sIBAN, 0, 4);
$sIBAN = $oStr->substr($sIBAN, 4);
return $sIBAN . $sInitialChars;
} | php | protected function _moveInitialCharactersToEnd($sIBAN)
{
$oStr = getStr();
$sInitialChars = $oStr->substr($sIBAN, 0, 4);
$sIBAN = $oStr->substr($sIBAN, 4);
return $sIBAN . $sInitialChars;
} | [
"protected",
"function",
"_moveInitialCharactersToEnd",
"(",
"$",
"sIBAN",
")",
"{",
"$",
"oStr",
"=",
"getStr",
"(",
")",
";",
"$",
"sInitialChars",
"=",
"$",
"oStr",
"->",
"substr",
"(",
"$",
"sIBAN",
",",
"0",
",",
"4",
")",
";",
"$",
"sIBAN",
"="... | Move the four initial characters to the end of the string.
@param string $sIBAN IBAN
@return string | [
"Move",
"the",
"four",
"initial",
"characters",
"to",
"the",
"end",
"of",
"the",
"string",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/SepaIBANValidator.php#L145-L153 | train |
OXID-eSales/oxideshop_ce | source/Core/SepaIBANValidator.php | SepaIBANValidator._isEachCodeLengthValid | protected function _isEachCodeLengthValid($aCodeLengths)
{
$blValid = true;
foreach ($aCodeLengths as $sCountryAbbr => $iLength) {
if (!$this->_isCodeLengthKeyValid($sCountryAbbr) ||
!$this->_isCodeLengthValueValid($iLength)
) {
$blValid = false;
break;
}
}
return $blValid;
} | php | protected function _isEachCodeLengthValid($aCodeLengths)
{
$blValid = true;
foreach ($aCodeLengths as $sCountryAbbr => $iLength) {
if (!$this->_isCodeLengthKeyValid($sCountryAbbr) ||
!$this->_isCodeLengthValueValid($iLength)
) {
$blValid = false;
break;
}
}
return $blValid;
} | [
"protected",
"function",
"_isEachCodeLengthValid",
"(",
"$",
"aCodeLengths",
")",
"{",
"$",
"blValid",
"=",
"true",
";",
"foreach",
"(",
"$",
"aCodeLengths",
"as",
"$",
"sCountryAbbr",
"=>",
"$",
"iLength",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_... | Checks if each code length is valid.
@param array $aCodeLengths Code lengths
@return bool | [
"Checks",
"if",
"each",
"code",
"length",
"is",
"valid",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/SepaIBANValidator.php#L231-L245 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/SelectListMainAjax.php | SelectListMainAjax.addArtToSel | public function addArtToSel()
{
$aAddArticle = $this->_getActionIds('oxarticles.oxid');
$soxId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('synchoxid');
if (\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('all')) {
$sArtTable = $this->_getViewName('oxarticles');
$aAddArticle = $this->_getAll(parent::_addFilter("select $sArtTable.oxid " . $this->_getQuery()));
}
if ($soxId && $soxId != "-1" && is_array($aAddArticle)) {
// We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804 and ESDEV-3822).
$database = \OxidEsales\Eshop\Core\DatabaseProvider::getMaster();
foreach ($aAddArticle as $sAdd) {
$oNewGroup = oxNew(\OxidEsales\Eshop\Core\Model\BaseModel::class);
$oNewGroup->init("oxobject2selectlist");
$oNewGroup->oxobject2selectlist__oxobjectid = new \OxidEsales\Eshop\Core\Field($sAdd);
$oNewGroup->oxobject2selectlist__oxselnid = new \OxidEsales\Eshop\Core\Field($soxId);
$oNewGroup->oxobject2selectlist__oxsort = new \OxidEsales\Eshop\Core\Field(( int ) $database->getOne("select max(oxsort) + 1 from oxobject2selectlist where oxobjectid = " . $database->quote($sAdd) . " "));
$oNewGroup->save();
$this->onArticleAddToSelectionList($sAdd);
}
}
} | php | public function addArtToSel()
{
$aAddArticle = $this->_getActionIds('oxarticles.oxid');
$soxId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('synchoxid');
if (\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('all')) {
$sArtTable = $this->_getViewName('oxarticles');
$aAddArticle = $this->_getAll(parent::_addFilter("select $sArtTable.oxid " . $this->_getQuery()));
}
if ($soxId && $soxId != "-1" && is_array($aAddArticle)) {
// We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804 and ESDEV-3822).
$database = \OxidEsales\Eshop\Core\DatabaseProvider::getMaster();
foreach ($aAddArticle as $sAdd) {
$oNewGroup = oxNew(\OxidEsales\Eshop\Core\Model\BaseModel::class);
$oNewGroup->init("oxobject2selectlist");
$oNewGroup->oxobject2selectlist__oxobjectid = new \OxidEsales\Eshop\Core\Field($sAdd);
$oNewGroup->oxobject2selectlist__oxselnid = new \OxidEsales\Eshop\Core\Field($soxId);
$oNewGroup->oxobject2selectlist__oxsort = new \OxidEsales\Eshop\Core\Field(( int ) $database->getOne("select max(oxsort) + 1 from oxobject2selectlist where oxobjectid = " . $database->quote($sAdd) . " "));
$oNewGroup->save();
$this->onArticleAddToSelectionList($sAdd);
}
}
} | [
"public",
"function",
"addArtToSel",
"(",
")",
"{",
"$",
"aAddArticle",
"=",
"$",
"this",
"->",
"_getActionIds",
"(",
"'oxarticles.oxid'",
")",
";",
"$",
"soxId",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(... | Adds article to Selection list
@throws Exception | [
"Adds",
"article",
"to",
"Selection",
"list"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/SelectListMainAjax.php#L122-L146 | train |
OXID-eSales/oxideshop_ce | source/Setup/Core.php | Core.getInstance | public function getInstance($sInstanceName)
{
if (strpos($sInstanceName, '\\') === false) {
$sInstanceName = $this->getClass($sInstanceName);
}
if (!isset(Core::$_aInstances[$sInstanceName])) {
Core::$_aInstances[$sInstanceName] = new $sInstanceName();
}
return Core::$_aInstances[$sInstanceName];
} | php | public function getInstance($sInstanceName)
{
if (strpos($sInstanceName, '\\') === false) {
$sInstanceName = $this->getClass($sInstanceName);
}
if (!isset(Core::$_aInstances[$sInstanceName])) {
Core::$_aInstances[$sInstanceName] = new $sInstanceName();
}
return Core::$_aInstances[$sInstanceName];
} | [
"public",
"function",
"getInstance",
"(",
"$",
"sInstanceName",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"sInstanceName",
",",
"'\\\\'",
")",
"===",
"false",
")",
"{",
"$",
"sInstanceName",
"=",
"$",
"this",
"->",
"getClass",
"(",
"$",
"sInstanceName",
"... | Returns requested instance object
@param string $sInstanceName instance name
@return Core | [
"Returns",
"requested",
"instance",
"object"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Setup/Core.php#L32-L42 | train |
OXID-eSales/oxideshop_ce | source/Setup/Core.php | Core.getClass | protected function getClass($sInstanceName)
{
$facts = new Facts();
$class = 'OxidEsales\\EshopCommunity\\Setup\\' . $sInstanceName;
$classEnterprise = '\\OxidEsales\\EshopEnterprise\\'.EditionPathProvider::SETUP_DIRECTORY.'\\'.$sInstanceName;
$classProfessional = '\\OxidEsales\\EshopProfessional\\'.EditionPathProvider::SETUP_DIRECTORY.'\\'.$sInstanceName;
if (($facts->isProfessional() || $facts->isEnterprise()) && $this->classExists($classProfessional)) {
$class = $classProfessional;
}
if ($facts->isEnterprise() && $this->classExists($classEnterprise)) {
$class = $classEnterprise;
}
return $class;
} | php | protected function getClass($sInstanceName)
{
$facts = new Facts();
$class = 'OxidEsales\\EshopCommunity\\Setup\\' . $sInstanceName;
$classEnterprise = '\\OxidEsales\\EshopEnterprise\\'.EditionPathProvider::SETUP_DIRECTORY.'\\'.$sInstanceName;
$classProfessional = '\\OxidEsales\\EshopProfessional\\'.EditionPathProvider::SETUP_DIRECTORY.'\\'.$sInstanceName;
if (($facts->isProfessional() || $facts->isEnterprise()) && $this->classExists($classProfessional)) {
$class = $classProfessional;
}
if ($facts->isEnterprise() && $this->classExists($classEnterprise)) {
$class = $classEnterprise;
}
return $class;
} | [
"protected",
"function",
"getClass",
"(",
"$",
"sInstanceName",
")",
"{",
"$",
"facts",
"=",
"new",
"Facts",
"(",
")",
";",
"$",
"class",
"=",
"'OxidEsales\\\\EshopCommunity\\\\Setup\\\\'",
".",
"$",
"sInstanceName",
";",
"$",
"classEnterprise",
"=",
"'\\\\OxidE... | Methods returns class according edition.
@param string $sInstanceName
@return string | [
"Methods",
"returns",
"class",
"according",
"edition",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Setup/Core.php#L76-L91 | train |
OXID-eSales/oxideshop_ce | source/Setup/Core.php | Core.userDecidedOverwriteDB | protected function userDecidedOverwriteDB()
{
$userDecidedOverwriteDatabase = false;
$overwriteCheck = $this->getUtilitiesInstance()->getRequestVar("ow", "get");
$session = $this->getSessionInstance();
if (isset($overwriteCheck) || $session->getSessionParam('blOverwrite')) {
$userDecidedOverwriteDatabase = true;
}
return $userDecidedOverwriteDatabase;
} | php | protected function userDecidedOverwriteDB()
{
$userDecidedOverwriteDatabase = false;
$overwriteCheck = $this->getUtilitiesInstance()->getRequestVar("ow", "get");
$session = $this->getSessionInstance();
if (isset($overwriteCheck) || $session->getSessionParam('blOverwrite')) {
$userDecidedOverwriteDatabase = true;
}
return $userDecidedOverwriteDatabase;
} | [
"protected",
"function",
"userDecidedOverwriteDB",
"(",
")",
"{",
"$",
"userDecidedOverwriteDatabase",
"=",
"false",
";",
"$",
"overwriteCheck",
"=",
"$",
"this",
"->",
"getUtilitiesInstance",
"(",
")",
"->",
"getRequestVar",
"(",
"\"ow\"",
",",
"\"get\"",
")",
... | Return true if user already decided to overwrite database.
@return bool | [
"Return",
"true",
"if",
"user",
"already",
"decided",
"to",
"overwrite",
"database",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Setup/Core.php#L138-L150 | train |
OXID-eSales/oxideshop_ce | source/Setup/Core.php | Core.userDecidedIgnoreDBWarning | protected function userDecidedIgnoreDBWarning()
{
$userDecidedIgnoreDBWarning = false;
$overwriteCheck = $this->getUtilitiesInstance()->getRequestVar("owrec", "get");
$session = $this->getSessionInstance();
if (isset($overwriteCheck) || $session->getSessionParam('blIgnoreDbRecommendations')) {
$userDecidedIgnoreDBWarning = true;
}
return $userDecidedIgnoreDBWarning;
} | php | protected function userDecidedIgnoreDBWarning()
{
$userDecidedIgnoreDBWarning = false;
$overwriteCheck = $this->getUtilitiesInstance()->getRequestVar("owrec", "get");
$session = $this->getSessionInstance();
if (isset($overwriteCheck) || $session->getSessionParam('blIgnoreDbRecommendations')) {
$userDecidedIgnoreDBWarning = true;
}
return $userDecidedIgnoreDBWarning;
} | [
"protected",
"function",
"userDecidedIgnoreDBWarning",
"(",
")",
"{",
"$",
"userDecidedIgnoreDBWarning",
"=",
"false",
";",
"$",
"overwriteCheck",
"=",
"$",
"this",
"->",
"getUtilitiesInstance",
"(",
")",
"->",
"getRequestVar",
"(",
"\"owrec\"",
",",
"\"get\"",
")... | Return true if user already decided to ignore database recommended version related warnings.
@return bool | [
"Return",
"true",
"if",
"user",
"already",
"decided",
"to",
"ignore",
"database",
"recommended",
"version",
"related",
"warnings",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Setup/Core.php#L157-L169 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/PriceAlarmList.php | PriceAlarmList._buildSelectString | protected function _buildSelectString($oListObject = null)
{
$sViewName = getViewName("oxarticles", (int) \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam("sDefaultLang"));
$sSql = "select oxpricealarm.*, {$sViewName}.oxtitle AS articletitle, ";
$sSql .= "oxuser.oxlname as userlname, oxuser.oxfname as userfname ";
$sSql .= "from oxpricealarm left join {$sViewName} on {$sViewName}.oxid = oxpricealarm.oxartid ";
$sSql .= "left join oxuser on oxuser.oxid = oxpricealarm.oxuserid WHERE 1 ";
return $sSql;
} | php | protected function _buildSelectString($oListObject = null)
{
$sViewName = getViewName("oxarticles", (int) \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam("sDefaultLang"));
$sSql = "select oxpricealarm.*, {$sViewName}.oxtitle AS articletitle, ";
$sSql .= "oxuser.oxlname as userlname, oxuser.oxfname as userfname ";
$sSql .= "from oxpricealarm left join {$sViewName} on {$sViewName}.oxid = oxpricealarm.oxartid ";
$sSql .= "left join oxuser on oxuser.oxid = oxpricealarm.oxuserid WHERE 1 ";
return $sSql;
} | [
"protected",
"function",
"_buildSelectString",
"(",
"$",
"oListObject",
"=",
"null",
")",
"{",
"$",
"sViewName",
"=",
"getViewName",
"(",
"\"oxarticles\"",
",",
"(",
"int",
")",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getCon... | Modifying SQL query to load additional article and customer data
@param object $oListObject list main object
@return string | [
"Modifying",
"SQL",
"query",
"to",
"load",
"additional",
"article",
"and",
"customer",
"data"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/PriceAlarmList.php#L44-L53 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/PriceAlarmList.php | PriceAlarmList.buildWhere | public function buildWhere()
{
$this->_aWhere = parent::buildWhere();
$sViewName = getViewName("oxpricealarm");
$sArtViewName = getViewName("oxarticles");
// updating price fields values for correct search in DB
if (isset($this->_aWhere[$sViewName . '.oxprice'])) {
$sPriceParam = (double) str_replace(['%', ','], ['', '.'], $this->_aWhere[$sViewName . '.oxprice']);
$this->_aWhere[$sViewName . '.oxprice'] = '%' . $sPriceParam . '%';
}
if (isset($this->_aWhere[$sArtViewName . '.oxprice'])) {
$sPriceParam = (double) str_replace(['%', ','], ['', '.'], $this->_aWhere[$sArtViewName . '.oxprice']);
$this->_aWhere[$sArtViewName . '.oxprice'] = '%' . $sPriceParam . '%';
}
return $this->_aWhere;
} | php | public function buildWhere()
{
$this->_aWhere = parent::buildWhere();
$sViewName = getViewName("oxpricealarm");
$sArtViewName = getViewName("oxarticles");
// updating price fields values for correct search in DB
if (isset($this->_aWhere[$sViewName . '.oxprice'])) {
$sPriceParam = (double) str_replace(['%', ','], ['', '.'], $this->_aWhere[$sViewName . '.oxprice']);
$this->_aWhere[$sViewName . '.oxprice'] = '%' . $sPriceParam . '%';
}
if (isset($this->_aWhere[$sArtViewName . '.oxprice'])) {
$sPriceParam = (double) str_replace(['%', ','], ['', '.'], $this->_aWhere[$sArtViewName . '.oxprice']);
$this->_aWhere[$sArtViewName . '.oxprice'] = '%' . $sPriceParam . '%';
}
return $this->_aWhere;
} | [
"public",
"function",
"buildWhere",
"(",
")",
"{",
"$",
"this",
"->",
"_aWhere",
"=",
"parent",
"::",
"buildWhere",
"(",
")",
";",
"$",
"sViewName",
"=",
"getViewName",
"(",
"\"oxpricealarm\"",
")",
";",
"$",
"sArtViewName",
"=",
"getViewName",
"(",
"\"oxa... | Builds and returns array of SQL WHERE conditions
@return array | [
"Builds",
"and",
"returns",
"array",
"of",
"SQL",
"WHERE",
"conditions"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/PriceAlarmList.php#L60-L78 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/OxidStartController.php | OxidStartController.appInit | public function appInit()
{
$this->pageStart();
if ('oxstart' == \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestControllerId() || $this->isAdmin()) {
return;
}
$oSystemEventHandler = $this->_getSystemEventHandler();
$oSystemEventHandler->onShopStart();
} | php | public function appInit()
{
$this->pageStart();
if ('oxstart' == \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestControllerId() || $this->isAdmin()) {
return;
}
$oSystemEventHandler = $this->_getSystemEventHandler();
$oSystemEventHandler->onShopStart();
} | [
"public",
"function",
"appInit",
"(",
")",
"{",
"$",
"this",
"->",
"pageStart",
"(",
")",
";",
"if",
"(",
"'oxstart'",
"==",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
"getRequestControllerId",
"... | Initializes globals and environment vars
@return null | [
"Initializes",
"globals",
"and",
"environment",
"vars"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/OxidStartController.php#L21-L31 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/OxidStartController.php | OxidStartController.render | public function render()
{
parent::render();
$errorNumber = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('execerror');
$templates = $this->getErrorTemplates();
if (array_key_exists($errorNumber, $templates)) {
return $templates[$errorNumber];
} else {
return 'message/err_unknown.tpl';
}
} | php | public function render()
{
parent::render();
$errorNumber = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('execerror');
$templates = $this->getErrorTemplates();
if (array_key_exists($errorNumber, $templates)) {
return $templates[$errorNumber];
} else {
return 'message/err_unknown.tpl';
}
} | [
"public",
"function",
"render",
"(",
")",
"{",
"parent",
"::",
"render",
"(",
")",
";",
"$",
"errorNumber",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
"getRequestParameter",
"(",
"'execerror'"... | Renders error screen
@return string | [
"Renders",
"error",
"screen"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/OxidStartController.php#L38-L50 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/OxidStartController.php | OxidStartController.pageStart | public function pageStart()
{
$config = \OxidEsales\Eshop\Core\Registry::getConfig();
$config->setConfigParam('iMaxMandates', $config->getConfigParam('IMS'));
$config->setConfigParam('iMaxArticles', $config->getConfigParam('IMA'));
} | php | public function pageStart()
{
$config = \OxidEsales\Eshop\Core\Registry::getConfig();
$config->setConfigParam('iMaxMandates', $config->getConfigParam('IMS'));
$config->setConfigParam('iMaxArticles', $config->getConfigParam('IMA'));
} | [
"public",
"function",
"pageStart",
"(",
")",
"{",
"$",
"config",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
";",
"$",
"config",
"->",
"setConfigParam",
"(",
"'iMaxMandates'",
",",
"$",
"config",
"... | Creates and starts session object, sets default currency. | [
"Creates",
"and",
"starts",
"session",
"object",
"sets",
"default",
"currency",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/OxidStartController.php#L55-L61 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/OxidStartController.php | OxidStartController.pageClose | public function pageClose()
{
$systemEventHandler = $this->_getSystemEventHandler();
$systemEventHandler->onShopEnd();
$mySession = $this->getSession();
if (isset($mySession)) {
$mySession->freeze();
}
//commit file cache
\OxidEsales\Eshop\Core\Registry::getUtils()->commitFileCache();
} | php | public function pageClose()
{
$systemEventHandler = $this->_getSystemEventHandler();
$systemEventHandler->onShopEnd();
$mySession = $this->getSession();
if (isset($mySession)) {
$mySession->freeze();
}
//commit file cache
\OxidEsales\Eshop\Core\Registry::getUtils()->commitFileCache();
} | [
"public",
"function",
"pageClose",
"(",
")",
"{",
"$",
"systemEventHandler",
"=",
"$",
"this",
"->",
"_getSystemEventHandler",
"(",
")",
";",
"$",
"systemEventHandler",
"->",
"onShopEnd",
"(",
")",
";",
"$",
"mySession",
"=",
"$",
"this",
"->",
"getSession",... | Finalizes the script. | [
"Finalizes",
"the",
"script",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/OxidStartController.php#L66-L79 | train |
OXID-eSales/oxideshop_ce | source/Application/Component/Widget/ServiceMenu.php | ServiceMenu.getCompareItems | public function getCompareItems($blJson = false)
{
$oCompare = oxNew(\OxidEsales\Eshop\Application\Controller\CompareController::class);
$aCompareItems = $oCompare->getCompareItems();
if ($blJson) {
$aCompareItems = json_encode($aCompareItems);
}
return $aCompareItems;
} | php | public function getCompareItems($blJson = false)
{
$oCompare = oxNew(\OxidEsales\Eshop\Application\Controller\CompareController::class);
$aCompareItems = $oCompare->getCompareItems();
if ($blJson) {
$aCompareItems = json_encode($aCompareItems);
}
return $aCompareItems;
} | [
"public",
"function",
"getCompareItems",
"(",
"$",
"blJson",
"=",
"false",
")",
"{",
"$",
"oCompare",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Application",
"\\",
"Controller",
"\\",
"CompareController",
"::",
"class",
")",
";",
"$",
"a... | Template variable getter. Returns comparison article list.
@param bool $blJson return json encoded array
@return array | [
"Template",
"variable",
"getter",
".",
"Returns",
"comparison",
"article",
"list",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Component/Widget/ServiceMenu.php#L38-L48 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.