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/Controller/Admin/ActionsArticleAjax.php
ActionsArticleAjax.setActionArticle
public function setActionArticle() { $sArticleId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('oxarticleid'); $sActionId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('oxid'); $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(); $oDb->Execute( 'delete from oxobject2action ' . 'where oxactionid=' . $oDb->quote($sActionId) . ' and oxclass = "oxarticle"' ); $oObject2Promotion = oxNew(\OxidEsales\Eshop\Core\Model\BaseModel::class); $oObject2Promotion->init('oxobject2action'); $oObject2Promotion->oxobject2action__oxactionid = new \OxidEsales\Eshop\Core\Field($sActionId); $oObject2Promotion->oxobject2action__oxobjectid = new \OxidEsales\Eshop\Core\Field($sArticleId); $oObject2Promotion->oxobject2action__oxclass = new \OxidEsales\Eshop\Core\Field("oxarticle"); $oObject2Promotion->save(); }
php
public function setActionArticle() { $sArticleId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('oxarticleid'); $sActionId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('oxid'); $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(); $oDb->Execute( 'delete from oxobject2action ' . 'where oxactionid=' . $oDb->quote($sActionId) . ' and oxclass = "oxarticle"' ); $oObject2Promotion = oxNew(\OxidEsales\Eshop\Core\Model\BaseModel::class); $oObject2Promotion->init('oxobject2action'); $oObject2Promotion->oxobject2action__oxactionid = new \OxidEsales\Eshop\Core\Field($sActionId); $oObject2Promotion->oxobject2action__oxobjectid = new \OxidEsales\Eshop\Core\Field($sArticleId); $oObject2Promotion->oxobject2action__oxclass = new \OxidEsales\Eshop\Core\Field("oxarticle"); $oObject2Promotion->save(); }
[ "public", "function", "setActionArticle", "(", ")", "{", "$", "sArticleId", "=", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "Registry", "::", "getConfig", "(", ")", "->", "getRequestParameter", "(", "'oxarticleid'", ")", ";", "$", "sActionId", "=...
Set article assignment
[ "Set", "article", "assignment" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ActionsArticleAjax.php#L119-L137
train
OXID-eSales/oxideshop_ce
source/Core/Database/Adapter/Doctrine/Database.php
Database.getPdoMysqlConnectionParameters
protected function getPdoMysqlConnectionParameters(array $connectionParameters) { $pdoMysqlConnectionParameters = [ 'driver' => 'pdo_mysql', 'host' => $connectionParameters['databaseHost'], 'dbname' => $connectionParameters['databaseName'], 'user' => $connectionParameters['databaseUser'], 'password' => $connectionParameters['databasePassword'], 'port' => $connectionParameters['databasePort'], ]; $this->addDriverOptions($pdoMysqlConnectionParameters); $this->addConnectionCharset( $pdoMysqlConnectionParameters, $connectionParameters['connectionCharset'] ); return $pdoMysqlConnectionParameters; }
php
protected function getPdoMysqlConnectionParameters(array $connectionParameters) { $pdoMysqlConnectionParameters = [ 'driver' => 'pdo_mysql', 'host' => $connectionParameters['databaseHost'], 'dbname' => $connectionParameters['databaseName'], 'user' => $connectionParameters['databaseUser'], 'password' => $connectionParameters['databasePassword'], 'port' => $connectionParameters['databasePort'], ]; $this->addDriverOptions($pdoMysqlConnectionParameters); $this->addConnectionCharset( $pdoMysqlConnectionParameters, $connectionParameters['connectionCharset'] ); return $pdoMysqlConnectionParameters; }
[ "protected", "function", "getPdoMysqlConnectionParameters", "(", "array", "$", "connectionParameters", ")", "{", "$", "pdoMysqlConnectionParameters", "=", "[", "'driver'", "=>", "'pdo_mysql'", ",", "'host'", "=>", "$", "connectionParameters", "[", "'databaseHost'", "]",...
Get the connection parameters for the doctrine pdo_mysql driver The pdo_mysql driver accepts an array with the following keys user (string): Username to use when connecting to the database. password (string): Password to use when connecting to the database. host (string): Hostname of the database to connect to. port (integer): Port of the database to connect to. dbname (string): Name of the database/schema to connect to. charset (string): The charset used when connecting to the database. unix_socket (string): Name of the socket used to connect to the database. host/port and unix_socket are mutually exclusive. Currently only host/port is supported by this database adapter @param array $connectionParameters The parameters to connect to the database using the doctrine pdo_mysql driver @return array
[ "Get", "the", "connection", "parameters", "for", "the", "doctrine", "pdo_mysql", "driver" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Database/Adapter/Doctrine/Database.php#L178-L196
train
OXID-eSales/oxideshop_ce
source/Core/Database/Adapter/Doctrine/Database.php
Database.addConnectionCharset
protected function addConnectionCharset(array &$existingParameters, $connectionCharset) { $sanitizedCharset = trim(strtolower((string) $connectionCharset)); if (!empty($sanitizedCharset)) { $existingParameters['charset'] = $sanitizedCharset; } }
php
protected function addConnectionCharset(array &$existingParameters, $connectionCharset) { $sanitizedCharset = trim(strtolower((string) $connectionCharset)); if (!empty($sanitizedCharset)) { $existingParameters['charset'] = $sanitizedCharset; } }
[ "protected", "function", "addConnectionCharset", "(", "array", "&", "$", "existingParameters", ",", "$", "connectionCharset", ")", "{", "$", "sanitizedCharset", "=", "trim", "(", "strtolower", "(", "(", "string", ")", "$", "connectionCharset", ")", ")", ";", "...
Determine the charset to be used when connecting to the database. Please be aware that different database drivers may need different options/values for setting the charset or may not support setting charset at all. See http://doctrine-orm.readthedocs.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connection-details for details. Take into account that the character set must be set either on the server level, or within the database connection itself (depending on the driver) for it to affect PDO::quote(). @param array $existingParameters @param string $connectionCharset
[ "Determine", "the", "charset", "to", "be", "used", "when", "connecting", "to", "the", "database", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Database/Adapter/Doctrine/Database.php#L236-L243
train
OXID-eSales/oxideshop_ce
source/Core/Database/Adapter/Doctrine/Database.php
Database.getOne
public function getOne($query, $parameters = []) { // @deprecated since v6.0 (2016-04-13); Backward compatibility for v5.3.0. $parameters = $this->assureParameterIsAnArray($parameters); // END deprecated if ($this->doesStatementProduceOutput($query)) { try { return $this->getConnection()->fetchColumn($query, $parameters); } catch (DBALException $exception) { $exception = $this->convertException($exception); $this->handleException($exception); } catch (PDOException $exception) { $exception = $this->convertException($exception); $this->handleException($exception); } } else { \OxidEsales\Eshop\Core\Registry::getLogger()->warning('Given statement does not produce output and was not executed', [debug_backtrace()]); } return false; }
php
public function getOne($query, $parameters = []) { // @deprecated since v6.0 (2016-04-13); Backward compatibility for v5.3.0. $parameters = $this->assureParameterIsAnArray($parameters); // END deprecated if ($this->doesStatementProduceOutput($query)) { try { return $this->getConnection()->fetchColumn($query, $parameters); } catch (DBALException $exception) { $exception = $this->convertException($exception); $this->handleException($exception); } catch (PDOException $exception) { $exception = $this->convertException($exception); $this->handleException($exception); } } else { \OxidEsales\Eshop\Core\Registry::getLogger()->warning('Given statement does not produce output and was not executed', [debug_backtrace()]); } return false; }
[ "public", "function", "getOne", "(", "$", "query", ",", "$", "parameters", "=", "[", "]", ")", "{", "// @deprecated since v6.0 (2016-04-13); Backward compatibility for v5.3.0.", "$", "parameters", "=", "$", "this", "->", "assureParameterIsAnArray", "(", "$", "paramete...
Get the first value of the first row of the result set of a given sql SELECT or SHOW statement. Returns false for any other statement. NOTE: Although you might pass any SELECT or SHOW statement to this method, try to limit the result of the statement to one single row, as the rest of the rows is simply discarded. @param string $query The sql SELECT or SHOW statement. @param array $parameters Array of parameters for the given sql statement. @return string|false Returns a string for SELECT or SHOW statements and FALSE for any other statement.
[ "Get", "the", "first", "value", "of", "the", "first", "row", "of", "the", "result", "set", "of", "a", "given", "sql", "SELECT", "or", "SHOW", "statement", ".", "Returns", "false", "for", "any", "other", "statement", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Database/Adapter/Doctrine/Database.php#L294-L315
train
OXID-eSales/oxideshop_ce
source/Core/Database/Adapter/Doctrine/Database.php
Database.getRow
public function getRow($query, $parameters = []) { // @deprecated since v6.0 (2016-04-13); Backward compatibility for v5.3.0. $parameters = $this->assureParameterIsAnArray($parameters); // END deprecated try { $resultSet = $this->select($query, $parameters); $result = $resultSet->fields; } catch (\OxidEsales\Eshop\Core\Exception\DatabaseErrorException $exception) { /** Only log exception, do not re-throw here, as legacy code expects this behavior */ $this->logException($exception); $result = []; } catch (PDOException $exception) { /** Only log exception, do not re-throw here, as legacy code expects this behavior */ $exception = $this->convertException($exception); $this->logException($exception); $result = []; } if (false == $result) { $result = []; } return $result; }
php
public function getRow($query, $parameters = []) { // @deprecated since v6.0 (2016-04-13); Backward compatibility for v5.3.0. $parameters = $this->assureParameterIsAnArray($parameters); // END deprecated try { $resultSet = $this->select($query, $parameters); $result = $resultSet->fields; } catch (\OxidEsales\Eshop\Core\Exception\DatabaseErrorException $exception) { /** Only log exception, do not re-throw here, as legacy code expects this behavior */ $this->logException($exception); $result = []; } catch (PDOException $exception) { /** Only log exception, do not re-throw here, as legacy code expects this behavior */ $exception = $this->convertException($exception); $this->logException($exception); $result = []; } if (false == $result) { $result = []; } return $result; }
[ "public", "function", "getRow", "(", "$", "query", ",", "$", "parameters", "=", "[", "]", ")", "{", "// @deprecated since v6.0 (2016-04-13); Backward compatibility for v5.3.0.", "$", "parameters", "=", "$", "this", "->", "assureParameterIsAnArray", "(", "$", "paramete...
Get an array with the values of the first row of a given sql SELECT or SHOW statement . Returns an empty array for any other statement. The returned value depends on the fetch mode. @see DatabaseInterface::setFetchMode() for how to set the fetch mode The keys of the array may be numeric, strings or both, depending on the FETCH_MODE_* of the connection. Set the desired fetch mode with DatabaseInterface::setFetchMode() before calling this method. NOTE: Although you might pass any SELECT or SHOW statement to this method, try to limit the result of the statement to one single row, as the rest of the rows is simply discarded. IMPORTANT: You are strongly encouraged to use prepared statements like this: $result = DatabaseProvider::getDb->getOne( 'SELECT ´id´ FROM ´mytable´ WHERE ´id´ = ? LIMIT 0, 1', array($id1) ); If you do not use prepared statements, you MUST quote variables the values with quote(), otherwise you create a SQL injection vulnerability. @param string $query The sql select statement to be executed. @param array $parameters Array of parameters, for the given sql statement. @return array The row, we selected with the given sql statement.
[ "Get", "an", "array", "with", "the", "values", "of", "the", "first", "row", "of", "a", "given", "sql", "SELECT", "or", "SHOW", "statement", ".", "Returns", "an", "empty", "array", "for", "any", "other", "statement", ".", "The", "returned", "value", "depe...
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Database/Adapter/Doctrine/Database.php#L344-L369
train
OXID-eSales/oxideshop_ce
source/Core/Database/Adapter/Doctrine/Database.php
Database.quote
public function quote($value) { try { $result = $this->getConnection()->quote($value); } catch (DBALException $exception) { $exception = $this->convertException($exception); $this->handleException($exception); } catch (PDOException $exception) { $exception = $this->convertException($exception); $this->handleException($exception); } return $result; }
php
public function quote($value) { try { $result = $this->getConnection()->quote($value); } catch (DBALException $exception) { $exception = $this->convertException($exception); $this->handleException($exception); } catch (PDOException $exception) { $exception = $this->convertException($exception); $this->handleException($exception); } return $result; }
[ "public", "function", "quote", "(", "$", "value", ")", "{", "try", "{", "$", "result", "=", "$", "this", "->", "getConnection", "(", ")", "->", "quote", "(", "$", "value", ")", ";", "}", "catch", "(", "DBALException", "$", "exception", ")", "{", "$...
Quote a string or a numeric value in a way, that it might be used as a value in a sql statement. Returns false for values that cannot be quoted. NOTE: It is not safe to use the return value of this function in a query. There will be no risk of SQL injection, but when the statement is executed and the value could not have been quoted, a DatabaseException is thrown. You are strongly encouraged to always use prepared statements instead of quoting the values on your own. E.g. use $resultSet = DatabaseProvider::getDb->select( 'SELECT * FROM ´mytable´ WHERE ´id´ = ? OR ´id´ = ?', array($id1, $id2) ); instead of $resultSet = DatabaseProvider::getDb->select( 'SELECT * FROM ´mytable´ WHERE ´id´ = ' . DatabaseProvider::getDb->quote($id1) . ' OR ´id´ = ' . DatabaseProvider::getDb->quote($id1) ); @param mixed $value The string or numeric value to be quoted. @return false|string The given string or numeric value converted to a string surrounded by single quotes or set to false, if the value could not have been quoted.
[ "Quote", "a", "string", "or", "a", "numeric", "value", "in", "a", "way", "that", "it", "might", "be", "used", "as", "a", "value", "in", "a", "sql", "statement", ".", "Returns", "false", "for", "values", "that", "cannot", "be", "quoted", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Database/Adapter/Doctrine/Database.php#L422-L435
train
OXID-eSales/oxideshop_ce
source/Core/Database/Adapter/Doctrine/Database.php
Database.quoteArray
public function quoteArray($array) { $result = []; foreach ($array as $key => $item) { $result[$key] = $this->quote($item); } return $result; }
php
public function quoteArray($array) { $result = []; foreach ($array as $key => $item) { $result[$key] = $this->quote($item); } return $result; }
[ "public", "function", "quoteArray", "(", "$", "array", ")", "{", "$", "result", "=", "[", "]", ";", "foreach", "(", "$", "array", "as", "$", "key", "=>", "$", "item", ")", "{", "$", "result", "[", "$", "key", "]", "=", "$", "this", "->", "quote...
Quote every value in a given array in a way, that it might be used as a value in a sql statement and return the result as a new array. Numeric values will be converted to strings which quotes. The keys and their order of the returned array will be the same as of the input array. NOTE: It is not safe to use the return value of this function in a query. There will be no risk of SQL injection, but when the statement is executed and the value could not have been quoted, a DatabaseException is thrown. You are strongly encouraged to always use prepared statements instead of quoting the values on your own. @param array $array The strings to quote as an array. @return array Array with all string and numeric values quoted with single quotes or set to false, if the value could not have been quoted.
[ "Quote", "every", "value", "in", "a", "given", "array", "in", "a", "way", "that", "it", "might", "be", "used", "as", "a", "value", "in", "a", "sql", "statement", "and", "return", "the", "result", "as", "a", "new", "array", ".", "Numeric", "values", "...
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Database/Adapter/Doctrine/Database.php#L450-L459
train
OXID-eSales/oxideshop_ce
source/Core/Database/Adapter/Doctrine/Database.php
Database.setTransactionIsolationLevel
public function setTransactionIsolationLevel($level) { $result = false; $availableLevels = array_keys($this->transactionIsolationLevelMap); if (!in_array(strtoupper($level), $availableLevels)) { throw new \InvalidArgumentException(); } try { if (in_array(strtoupper($level), $availableLevels)) { $result = $this->execute('SET SESSION TRANSACTION ISOLATION LEVEL ' . $level); } } catch (DBALException $exception) { $exception = $this->convertException($exception); $this->handleException($exception); } catch (PDOException $exception) { $exception = $this->convertException($exception); $this->handleException($exception); } return $result; }
php
public function setTransactionIsolationLevel($level) { $result = false; $availableLevels = array_keys($this->transactionIsolationLevelMap); if (!in_array(strtoupper($level), $availableLevels)) { throw new \InvalidArgumentException(); } try { if (in_array(strtoupper($level), $availableLevels)) { $result = $this->execute('SET SESSION TRANSACTION ISOLATION LEVEL ' . $level); } } catch (DBALException $exception) { $exception = $this->convertException($exception); $this->handleException($exception); } catch (PDOException $exception) { $exception = $this->convertException($exception); $this->handleException($exception); } return $result; }
[ "public", "function", "setTransactionIsolationLevel", "(", "$", "level", ")", "{", "$", "result", "=", "false", ";", "$", "availableLevels", "=", "array_keys", "(", "$", "this", "->", "transactionIsolationLevelMap", ")", ";", "if", "(", "!", "in_array", "(", ...
Set the transaction isolation level. Allowed values 'READ UNCOMMITTED', 'READ COMMITTED', 'REPEATABLE READ' and 'SERIALIZABLE'. NOTE: Currently the transaction isolation level is set on the database session and not globally. Setting the transaction isolation level globally requires root privileges in MySQL an this application should not be executed with root privileges. If you need to set the transaction isolation level globally, ask your database administrator to do so, This method is MySQL specific, as we use the MySQL syntax for setting the transaction isolation level. @see Doctrine::transactionIsolationLevelMap @param string $level The transaction isolation level @throws \InvalidArgumentException|DatabaseErrorException * @return bool|integer
[ "Set", "the", "transaction", "isolation", "level", ".", "Allowed", "values", "READ", "UNCOMMITTED", "READ", "COMMITTED", "REPEATABLE", "READ", "and", "SERIALIZABLE", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Database/Adapter/Doctrine/Database.php#L527-L549
train
OXID-eSales/oxideshop_ce
source/Core/Database/Adapter/Doctrine/Database.php
Database.select
public function select($query, $parameters = []) { // @deprecated since v6.0 (2016-04-13); Backward compatibility for v5.3.0. $parameters = $this->assureParameterIsAnArray($parameters); // END deprecated $result = null; try { /** * Be aware that Connection::executeQuery is a method specifically for READ operations only. * This is especially important in master-slave Connection */ /** @var \Doctrine\DBAL\Driver\Statement $statement Statement is prepared and executed by executeQuery() */ $statement = $this->getConnection()->executeQuery($query, $parameters); $result = new \OxidEsales\Eshop\Core\Database\Adapter\Doctrine\ResultSet($statement); } catch (DBALException $exception) { $exception = $this->convertException($exception); $this->handleException($exception); } catch (PDOException $exception) { $exception = $this->convertException($exception); $this->handleException($exception); } return $result; }
php
public function select($query, $parameters = []) { // @deprecated since v6.0 (2016-04-13); Backward compatibility for v5.3.0. $parameters = $this->assureParameterIsAnArray($parameters); // END deprecated $result = null; try { /** * Be aware that Connection::executeQuery is a method specifically for READ operations only. * This is especially important in master-slave Connection */ /** @var \Doctrine\DBAL\Driver\Statement $statement Statement is prepared and executed by executeQuery() */ $statement = $this->getConnection()->executeQuery($query, $parameters); $result = new \OxidEsales\Eshop\Core\Database\Adapter\Doctrine\ResultSet($statement); } catch (DBALException $exception) { $exception = $this->convertException($exception); $this->handleException($exception); } catch (PDOException $exception) { $exception = $this->convertException($exception); $this->handleException($exception); } return $result; }
[ "public", "function", "select", "(", "$", "query", ",", "$", "parameters", "=", "[", "]", ")", "{", "// @deprecated since v6.0 (2016-04-13); Backward compatibility for v5.3.0.", "$", "parameters", "=", "$", "this", "->", "assureParameterIsAnArray", "(", "$", "paramete...
Return the results of a given sql SELECT or SHOW statement as a ResultSet. Throws an exception for any other statement. The values of first row of the result may be via resultSet's fields property. This property is an array, which keys may be numeric, strings or both, depending on the FETCH_MODE_* of the connection. All further rows can be accessed via the specific methods of ResultSet. IMPORTANT: You are strongly encouraged to use prepared statements like this: $resultSet = DatabaseProvider::getDb->select( 'SELECT * FROM ´mytable´ WHERE ´id´ = ? OR ´id´ = ?', array($id1, $id2) ); If you do not use prepared statements, you MUST quote variables the values with quote(), otherwise you create a SQL injection vulnerability. @param string $query The sql select statement to be executed. @param array $parameters The parameters array for the given query. @throws DatabaseErrorException The exception, that can occur while executing the sql statement. @return \OxidEsales\Eshop\Core\Database\Adapter\ResultSetInterface The result of the given query.
[ "Return", "the", "results", "of", "a", "given", "sql", "SELECT", "or", "SHOW", "statement", "as", "a", "ResultSet", ".", "Throws", "an", "exception", "for", "any", "other", "statement", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Database/Adapter/Doctrine/Database.php#L605-L631
train
OXID-eSales/oxideshop_ce
source/Core/Database/Adapter/Doctrine/Database.php
Database.selectLimit
public function selectLimit($query, $rowCount = -1, $offset = 0, $parameters = []) { /** * Parameter validation. * At the moment there will be no InvalidArgumentException thrown on non numeric values as this may break * too many things. */ if (!is_numeric($rowCount) || !is_numeric($offset)) { trigger_error( 'Parameters rowCount and offset have to be numeric in DatabaseInterface::selectLimit(). ' . 'Please fix your code as this error may trigger an exception in future versions of OXID eShop.', E_USER_DEPRECATED ); } if (0 > $offset) { throw new \InvalidArgumentException('Argument $offset must not be smaller than zero.'); } /** * Cast the parameters limit and offset to integer in in order to avoid SQL injection. */ $rowCount = (int) $rowCount; $offset = (int) $offset; $limitClause = ''; if ($rowCount >= 0 && $offset >= 0) { $limitClause = "LIMIT $rowCount OFFSET $offset"; } return $this->select($query . " $limitClause ", $parameters); }
php
public function selectLimit($query, $rowCount = -1, $offset = 0, $parameters = []) { /** * Parameter validation. * At the moment there will be no InvalidArgumentException thrown on non numeric values as this may break * too many things. */ if (!is_numeric($rowCount) || !is_numeric($offset)) { trigger_error( 'Parameters rowCount and offset have to be numeric in DatabaseInterface::selectLimit(). ' . 'Please fix your code as this error may trigger an exception in future versions of OXID eShop.', E_USER_DEPRECATED ); } if (0 > $offset) { throw new \InvalidArgumentException('Argument $offset must not be smaller than zero.'); } /** * Cast the parameters limit and offset to integer in in order to avoid SQL injection. */ $rowCount = (int) $rowCount; $offset = (int) $offset; $limitClause = ''; if ($rowCount >= 0 && $offset >= 0) { $limitClause = "LIMIT $rowCount OFFSET $offset"; } return $this->select($query . " $limitClause ", $parameters); }
[ "public", "function", "selectLimit", "(", "$", "query", ",", "$", "rowCount", "=", "-", "1", ",", "$", "offset", "=", "0", ",", "$", "parameters", "=", "[", "]", ")", "{", "/**\n * Parameter validation.\n * At the moment there will be no InvalidArgum...
Return the results of a given sql SELECT or SHOW statement limited by a LIMIT clause as a ResultSet. Throws an exception for any other statement. The values of first row of the result may be via resultSet's fields property. This property is an array, which keys may be numeric, strings or both, depending on the FETCH_MODE_* of the connection. All further rows can be accessed via the specific methods of ResultSet. IMPORTANT: You are strongly encouraged to use prepared statements like this: $resultSet = DatabaseProvider::getDb->selectLimit( 'SELECT * FROM ´mytable´ WHERE ´id´ = ? OR ´id´ = ?', $rowCount, $offset, array($id1, $id2) ); If you do not use prepared statements, you MUST quote variables the values with quote(), otherwise you create a SQL injection vulnerability. Be aware that only a few database vendors have the LIMIT clause as known from MySQL. The Doctrine Query Builder should be used here. @param string $query The sql select statement to be executed. @param int $rowCount Maximum number of rows to return @param int $offset Offset of the first row to return @param array $parameters The parameters array. @throws DatabaseErrorException The exception, that can occur while executing the sql statement. @throws \InvalidArgumentException The exception for invalid $offset. @return \OxidEsales\Eshop\Core\Database\Adapter\ResultSetInterface The result of the given query.
[ "Return", "the", "results", "of", "a", "given", "sql", "SELECT", "or", "SHOW", "statement", "limited", "by", "a", "LIMIT", "clause", "as", "a", "ResultSet", ".", "Throws", "an", "exception", "for", "any", "other", "statement", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Database/Adapter/Doctrine/Database.php#L666-L697
train
OXID-eSales/oxideshop_ce
source/Core/Database/Adapter/Doctrine/Database.php
Database.getCol
public function getCol($query, $parameters = []) { // @deprecated since v6.0 (2016-04-13); Backward compatibility for v5.3.0. $parameters = $this->assureParameterIsAnArray($parameters); // END deprecated $result = []; try { $rows = $this->getConnection()->fetchAll($query, $parameters); foreach ($rows as $row) { // cause there is no doctrine equivalent, we take this little detour and restructure the result $columnNames = array_keys($row); $columnName = $columnNames[0]; $result[] = $row[$columnName]; } } catch (DBALException $exception) { $exception = $this->convertException($exception); $this->handleException($exception); } catch (PDOException $exception) { $exception = $this->convertException($exception); $this->handleException($exception); } return $result; }
php
public function getCol($query, $parameters = []) { // @deprecated since v6.0 (2016-04-13); Backward compatibility for v5.3.0. $parameters = $this->assureParameterIsAnArray($parameters); // END deprecated $result = []; try { $rows = $this->getConnection()->fetchAll($query, $parameters); foreach ($rows as $row) { // cause there is no doctrine equivalent, we take this little detour and restructure the result $columnNames = array_keys($row); $columnName = $columnNames[0]; $result[] = $row[$columnName]; } } catch (DBALException $exception) { $exception = $this->convertException($exception); $this->handleException($exception); } catch (PDOException $exception) { $exception = $this->convertException($exception); $this->handleException($exception); } return $result; }
[ "public", "function", "getCol", "(", "$", "query", ",", "$", "parameters", "=", "[", "]", ")", "{", "// @deprecated since v6.0 (2016-04-13); Backward compatibility for v5.3.0.", "$", "parameters", "=", "$", "this", "->", "assureParameterIsAnArray", "(", "$", "paramete...
Return the first column of all rows of the results of a given sql SELECT or SHOW statement as an numeric array. Throws an exception for any other statement. IMPORTANT: You are strongly encouraged to use prepared statements like this: $result = DatabaseProvider::getDb->getRow( 'SELECT * FROM ´mytable´ WHERE ´id´ = ? LIMIT 0, 1', array($id1) ); If you do not use prepared statements, you MUST quote variables the values with quote(), otherwise you create a SQL injection vulnerability. @param string $query The sql select statement to be executed. @param array $parameters The parameters array. @throws DatabaseErrorException @return array The values of the first column of a corresponding sql query.
[ "Return", "the", "first", "column", "of", "all", "rows", "of", "the", "results", "of", "a", "given", "sql", "SELECT", "or", "SHOW", "statement", "as", "an", "numeric", "array", ".", "Throws", "an", "exception", "for", "any", "other", "statement", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Database/Adapter/Doctrine/Database.php#L719-L745
train
OXID-eSales/oxideshop_ce
source/Core/Database/Adapter/Doctrine/Database.php
Database.assureParameterIsAnArray
private function assureParameterIsAnArray($parameter) { /** If $parameter evaluates to true and it is not an array throw an InvalidArgumentException */ if ($parameter && !is_array($parameter)) { throw new \InvalidArgumentException(); } /** If $parameter evaluates to false and it is not an array convert it into an array */ if (!is_array($parameter)) { $parameter = []; } return $parameter; }
php
private function assureParameterIsAnArray($parameter) { /** If $parameter evaluates to true and it is not an array throw an InvalidArgumentException */ if ($parameter && !is_array($parameter)) { throw new \InvalidArgumentException(); } /** If $parameter evaluates to false and it is not an array convert it into an array */ if (!is_array($parameter)) { $parameter = []; } return $parameter; }
[ "private", "function", "assureParameterIsAnArray", "(", "$", "parameter", ")", "{", "/** If $parameter evaluates to true and it is not an array throw an InvalidArgumentException */", "if", "(", "$", "parameter", "&&", "!", "is_array", "(", "$", "parameter", ")", ")", "{", ...
Sanitize the given parameter to be an array. In v5.3.0 in many places in the code false is passed instead of an empty array. This methods work like this: Anything that evaluates to true and is not an array will cause an exception to be thrown. Anything that evaluates to false will be converted into an empty array. An non empty array will be returned as such. @param bool|array $parameter The parameter we want to be an array. @throws \InvalidArgumentException @deprecated since v6.0 (2016-04-13); Backward compatibility for v5.3.0. @return array The original array or an empty array, if false was passed.
[ "Sanitize", "the", "given", "parameter", "to", "be", "an", "array", ".", "In", "v5", ".", "3", ".", "0", "in", "many", "places", "in", "the", "code", "false", "is", "passed", "instead", "of", "an", "empty", "array", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Database/Adapter/Doctrine/Database.php#L818-L831
train
OXID-eSales/oxideshop_ce
source/Core/Database/Adapter/Doctrine/Database.php
Database.doesStatementProduceOutput
private function doesStatementProduceOutput($query) { $allowedCommands = [ // Data Manipulation Statements 'SELECT', // Commands for Prepared Statements 'EXECUTE', // Statements for Condition Handling 'GET', // Database Administration Statements 'SHOW', 'CHECKSUM', // MySQL Utility Statements 'DESCRIBE', 'EXPLAIN', 'HELP', ]; $command = $this->getFirstCommandInStatement($query); return in_array($command, $allowedCommands); }
php
private function doesStatementProduceOutput($query) { $allowedCommands = [ // Data Manipulation Statements 'SELECT', // Commands for Prepared Statements 'EXECUTE', // Statements for Condition Handling 'GET', // Database Administration Statements 'SHOW', 'CHECKSUM', // MySQL Utility Statements 'DESCRIBE', 'EXPLAIN', 'HELP', ]; $command = $this->getFirstCommandInStatement($query); return in_array($command, $allowedCommands); }
[ "private", "function", "doesStatementProduceOutput", "(", "$", "query", ")", "{", "$", "allowedCommands", "=", "[", "// Data Manipulation Statements", "'SELECT'", ",", "// Commands for Prepared Statements", "'EXECUTE'", ",", "// Statements for Condition Handling", "'GET'", ",...
Return true, if the given SQL statement is a statement that may produce any output. There are two kinds of SQL statements. One class produces output like "SELECT * FROM `countries` ORDER BY `iso_code`DESC" Which returns something like: +----------+----------------------------------------+ | iso_code | name | +----------+----------------------------------------+ | AF | Afghanistan | | AL | Albania | | AS | American Samoa | The other class does not produce any output like "UPDATE countries SET (`name` = 'United States of America') WHERE iso_code = 'US'" @param string $query The query we want to check. @return bool Return true, if the given SQL statement is a statement that may produce any output
[ "Return", "true", "if", "the", "given", "SQL", "statement", "is", "a", "statement", "that", "may", "produce", "any", "output", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Database/Adapter/Doctrine/Database.php#L854-L874
train
OXID-eSales/oxideshop_ce
source/Core/Database/Adapter/Doctrine/Database.php
Database.logException
protected function logException(\Exception $exception) { /** The exception has to be converted into an instance of oxException in order to be logged like this */ $exception = $this->convertException($exception); \OxidEsales\Eshop\Core\Registry::getLogger()->error($exception->getMessage(), [$exception]); }
php
protected function logException(\Exception $exception) { /** The exception has to be converted into an instance of oxException in order to be logged like this */ $exception = $this->convertException($exception); \OxidEsales\Eshop\Core\Registry::getLogger()->error($exception->getMessage(), [$exception]); }
[ "protected", "function", "logException", "(", "\\", "Exception", "$", "exception", ")", "{", "/** The exception has to be converted into an instance of oxException in order to be logged like this */", "$", "exception", "=", "$", "this", "->", "convertException", "(", "$", "ex...
Log a given Exception the log file using the standard eShop logging mechanism. Use this function whenever a exception is caught and not re-thrown. @param \Exception $exception
[ "Log", "a", "given", "Exception", "the", "log", "file", "using", "the", "standard", "eShop", "logging", "mechanism", ".", "Use", "this", "function", "whenever", "a", "exception", "is", "caught", "and", "not", "re", "-", "thrown", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Database/Adapter/Doctrine/Database.php#L966-L971
train
OXID-eSales/oxideshop_ce
source/Core/Database/Adapter/Doctrine/Database.php
Database.getAll
public function getAll($query, $parameters = []) { $result = []; $statement = null; // @deprecated since v6.0 (2016-04-13); Backward compatibility for v5.3.0. $parameters = $this->assureParameterIsAnArray($parameters); // END deprecated try { $statement = $this->getConnection()->executeQuery($query, $parameters); } catch (DBALException $exception) { $exception = $this->convertException($exception); $this->handleException($exception); } catch (PDOException $exception) { $exception = $this->convertException($exception); $this->handleException($exception); } if ($this->doesStatementProduceOutput($query)) { $result = $statement->fetchAll(); } else { \OxidEsales\Eshop\Core\Registry::getLogger()->warning('Given statement does not produce output and was not executed', [debug_backtrace()]); } return $result; }
php
public function getAll($query, $parameters = []) { $result = []; $statement = null; // @deprecated since v6.0 (2016-04-13); Backward compatibility for v5.3.0. $parameters = $this->assureParameterIsAnArray($parameters); // END deprecated try { $statement = $this->getConnection()->executeQuery($query, $parameters); } catch (DBALException $exception) { $exception = $this->convertException($exception); $this->handleException($exception); } catch (PDOException $exception) { $exception = $this->convertException($exception); $this->handleException($exception); } if ($this->doesStatementProduceOutput($query)) { $result = $statement->fetchAll(); } else { \OxidEsales\Eshop\Core\Registry::getLogger()->warning('Given statement does not produce output and was not executed', [debug_backtrace()]); } return $result; }
[ "public", "function", "getAll", "(", "$", "query", ",", "$", "parameters", "=", "[", "]", ")", "{", "$", "result", "=", "[", "]", ";", "$", "statement", "=", "null", ";", "// @deprecated since v6.0 (2016-04-13); Backward compatibility for v5.3.0.", "$", "paramet...
Get an multi-dimensional array of arrays with the values of the all rows of a given sql SELECT or SHOW statement. Returns an empty array for any other statement. The keys of the first level array are numeric. The keys of the second level arrays may be numeric, strings or both, depending on the FETCH_MODE_* of the connection. Set the desired fetch mode with DatabaseInterface::setFetchMode() before calling this method. IMPORTANT: You are strongly encouraged to use prepared statements like this: $result = DatabaseProvider::getDb->getAll( 'SELECT * FROM ´mytable´ WHERE ´id´ = ? OR ´id´ = ? LIMIT 0, 1', array($id1, $id2) ); If you do not use prepared statements, you MUST quote variables the values with quote(), otherwise you create a SQL injection vulnerability. @param string $query If parameters are given, the "?" in the string will be replaced by the values in the array @param array $parameters Array of parameters, for the given sql statement. @see DatabaseInterface::setFetchMode() @see Doctrine::$fetchMode @throws DatabaseErrorException @throws \InvalidArgumentException @return array
[ "Get", "an", "multi", "-", "dimensional", "array", "of", "arrays", "with", "the", "values", "of", "the", "all", "rows", "of", "a", "given", "sql", "SELECT", "or", "SHOW", "statement", ".", "Returns", "an", "empty", "array", "for", "any", "other", "statem...
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Database/Adapter/Doctrine/Database.php#L1001-L1027
train
OXID-eSales/oxideshop_ce
source/Core/Database/Adapter/Doctrine/Database.php
Database.getLastInsertId
public function getLastInsertId() { try { $lastInsertId = $this->getConnection()->lastInsertId(); } catch (DBALException $exception) { $exception = $this->convertException($exception); $this->handleException($exception); } catch (PDOException $exception) { $exception = $this->convertException($exception); $this->handleException($exception); } return $lastInsertId; }
php
public function getLastInsertId() { try { $lastInsertId = $this->getConnection()->lastInsertId(); } catch (DBALException $exception) { $exception = $this->convertException($exception); $this->handleException($exception); } catch (PDOException $exception) { $exception = $this->convertException($exception); $this->handleException($exception); } return $lastInsertId; }
[ "public", "function", "getLastInsertId", "(", ")", "{", "try", "{", "$", "lastInsertId", "=", "$", "this", "->", "getConnection", "(", ")", "->", "lastInsertId", "(", ")", ";", "}", "catch", "(", "DBALException", "$", "exception", ")", "{", "$", "excepti...
Return string representing the row ID of the last row that was inserted into the database. Returns 0 for tables without autoincrement field. @return string|int Row ID
[ "Return", "string", "representing", "the", "row", "ID", "of", "the", "last", "row", "that", "was", "inserted", "into", "the", "database", ".", "Returns", "0", "for", "tables", "without", "autoincrement", "field", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Database/Adapter/Doctrine/Database.php#L1036-L1049
train
OXID-eSales/oxideshop_ce
source/Core/Database/Adapter/Doctrine/Database.php
Database.isRollbackOnly
public function isRollbackOnly() { try { $isRollbackOnly = $this->connection->isRollbackOnly(); } catch (DBALException $exception) { $exception = $this->convertException($exception); $this->handleException($exception); } catch (PDOException $exception) { $exception = $this->convertException($exception); $this->handleException($exception); } return $isRollbackOnly; }
php
public function isRollbackOnly() { try { $isRollbackOnly = $this->connection->isRollbackOnly(); } catch (DBALException $exception) { $exception = $this->convertException($exception); $this->handleException($exception); } catch (PDOException $exception) { $exception = $this->convertException($exception); $this->handleException($exception); } return $isRollbackOnly; }
[ "public", "function", "isRollbackOnly", "(", ")", "{", "try", "{", "$", "isRollbackOnly", "=", "$", "this", "->", "connection", "->", "isRollbackOnly", "(", ")", ";", "}", "catch", "(", "DBALException", "$", "exception", ")", "{", "$", "exception", "=", ...
Return true, if the connection is marked rollbackOnly. Doctrine manages nested transaction the following way: If any of the inner transactions is rolled back, all the outer transactions will have to be rolled back also. For that reason the connection will be marked as rollbackOnly and any commitTransaction will throw an exception. @return bool
[ "Return", "true", "if", "the", "connection", "is", "marked", "rollbackOnly", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Database/Adapter/Doctrine/Database.php#L1173-L1186
train
OXID-eSales/oxideshop_ce
source/Core/Database/Adapter/Doctrine/Database.php
Database.isTransactionActive
public function isTransactionActive() { try { $isTransactionActive = $this->connection->isTransactionActive(); } catch (DBALException $exception) { $exception = $this->convertException($exception); $this->handleException($exception); } catch (PDOException $exception) { $exception = $this->convertException($exception); $this->handleException($exception); } return $isTransactionActive; }
php
public function isTransactionActive() { try { $isTransactionActive = $this->connection->isTransactionActive(); } catch (DBALException $exception) { $exception = $this->convertException($exception); $this->handleException($exception); } catch (PDOException $exception) { $exception = $this->convertException($exception); $this->handleException($exception); } return $isTransactionActive; }
[ "public", "function", "isTransactionActive", "(", ")", "{", "try", "{", "$", "isTransactionActive", "=", "$", "this", "->", "connection", "->", "isTransactionActive", "(", ")", ";", "}", "catch", "(", "DBALException", "$", "exception", ")", "{", "$", "except...
Checks whether a transaction is currently active. @return boolean TRUE if a transaction is currently active, FALSE otherwise.
[ "Checks", "whether", "a", "transaction", "is", "currently", "active", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Database/Adapter/Doctrine/Database.php#L1193-L1206
train
OXID-eSales/oxideshop_ce
source/Core/Database/Adapter/Doctrine/Database.php
Database.getMetaColumnValueByKey
protected function getMetaColumnValueByKey(array $column, $key) { if (array_key_exists('Field', $column)) { $keyMap = [ 'Field' => 'Field', 'Type' => 'Type', 'Null' => 'Null', 'Key' => 'Key', 'Default' => 'Default', 'Extra' => 'Extra', 'Comment' => 'Comment', 'CharacterSet' => 'CharacterSet', 'Collation' => 'Collation', ]; } else { $keyMap = [ 'Field' => 0, 'Type' => 1, 'Null' => 2, 'Key' => 3, 'Default' => 4, 'Extra' => 5, 'Comment' => 6, 'CharacterSet' => 7, 'Collation' => 8, ]; } $result = $column[$keyMap[$key]]; return $result; }
php
protected function getMetaColumnValueByKey(array $column, $key) { if (array_key_exists('Field', $column)) { $keyMap = [ 'Field' => 'Field', 'Type' => 'Type', 'Null' => 'Null', 'Key' => 'Key', 'Default' => 'Default', 'Extra' => 'Extra', 'Comment' => 'Comment', 'CharacterSet' => 'CharacterSet', 'Collation' => 'Collation', ]; } else { $keyMap = [ 'Field' => 0, 'Type' => 1, 'Null' => 2, 'Key' => 3, 'Default' => 4, 'Extra' => 5, 'Comment' => 6, 'CharacterSet' => 7, 'Collation' => 8, ]; } $result = $column[$keyMap[$key]]; return $result; }
[ "protected", "function", "getMetaColumnValueByKey", "(", "array", "$", "column", ",", "$", "key", ")", "{", "if", "(", "array_key_exists", "(", "'Field'", ",", "$", "column", ")", ")", "{", "$", "keyMap", "=", "[", "'Field'", "=>", "'Field'", ",", "'Type...
Get the value of a meta column key. @param array $column The meta column, where the value has to be fetched. @param string $key The key to fetch. @return mixed
[ "Get", "the", "value", "of", "a", "meta", "column", "key", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Database/Adapter/Doctrine/Database.php#L1216-L1247
train
OXID-eSales/oxideshop_ce
source/Core/Database/Adapter/Doctrine/Database.php
Database.getColumnMaxLengthAndScale
protected function getColumnMaxLengthAndScale(array $column, $assignedType) { /** @var int $maxLength The max length of a field. For floating point type or fixed point type fields the precision of the field */ $maxLength = -1; /** @var int $scale The scale of floating point type or fixed point type fields */ $scale = -1; /** @var string $mySqlType E.g. "CHAR(4)" or "DECIMAL(5,2)" or "tinyint(1) unsigned" */ $mySqlType = $this->getMetaColumnValueByKey($column, 'Type'); /** Get the maximum display width for the type */ /** Match Precision an scale E.g DECIMAL(5,2) */ if (preg_match("/^(.+)\((\d+),(\d+)/", $mySqlType, $matches)) { if (is_numeric($matches[2])) { $maxLength = $matches[2]; } if (is_numeric($matches[3])) { $scale = $matches[3]; } /** Match max length E.g CHAR(4) */ } elseif (preg_match("/^(.+)\((\d+)/", $mySqlType, $matches)) { if (is_numeric($matches[2])) { $maxLength = $matches[2]; } /** * Match List type E.g. SET('A', 'B', 'CDE) * In this case the length will be the string length of the longest element */ } elseif (preg_match("/^(enum|set)\((.*)\)$/i", strtolower($mySqlType), $matches)) { if ($matches[2]) { $pieces = explode(",", $matches[2]); /** The array values contain 2 quotes, so we have to subtract 2 from the strlen */ $maxLength = max(array_map("strlen", $pieces)) - 2; if ($maxLength <= 0) { $maxLength = 1; } } } /** Numeric types, which may have a maximum length */ $integerTypes = ['INTEGER', 'INT', 'SMALLINT', 'TINYINT', 'MEDIUMINT', 'BIGINT']; $fixedPointTypes = ['DECIMAL', 'NUMERIC']; $floatingPointTypes = ['FLOAT', 'DOUBLE']; /** Text types, which may have a maximum length */ $textTypes = ['CHAR', 'VARCHAR']; /** Date types, which may have a maximum length */ $dateTypes = ['YEAR']; $assignedType = strtoupper($assignedType); if (( in_array($assignedType, $integerTypes) || in_array($assignedType, $fixedPointTypes) || in_array($assignedType, $floatingPointTypes) || in_array($assignedType, $textTypes) || in_array($assignedType, $dateTypes) ) && -1 == $maxLength ) { /** * @todo: If the assigned type is one of the following and maxLength is -1, then, if applicable the default max length ot that type should be assigned. */ } return [(int) $maxLength, (int) $scale]; }
php
protected function getColumnMaxLengthAndScale(array $column, $assignedType) { /** @var int $maxLength The max length of a field. For floating point type or fixed point type fields the precision of the field */ $maxLength = -1; /** @var int $scale The scale of floating point type or fixed point type fields */ $scale = -1; /** @var string $mySqlType E.g. "CHAR(4)" or "DECIMAL(5,2)" or "tinyint(1) unsigned" */ $mySqlType = $this->getMetaColumnValueByKey($column, 'Type'); /** Get the maximum display width for the type */ /** Match Precision an scale E.g DECIMAL(5,2) */ if (preg_match("/^(.+)\((\d+),(\d+)/", $mySqlType, $matches)) { if (is_numeric($matches[2])) { $maxLength = $matches[2]; } if (is_numeric($matches[3])) { $scale = $matches[3]; } /** Match max length E.g CHAR(4) */ } elseif (preg_match("/^(.+)\((\d+)/", $mySqlType, $matches)) { if (is_numeric($matches[2])) { $maxLength = $matches[2]; } /** * Match List type E.g. SET('A', 'B', 'CDE) * In this case the length will be the string length of the longest element */ } elseif (preg_match("/^(enum|set)\((.*)\)$/i", strtolower($mySqlType), $matches)) { if ($matches[2]) { $pieces = explode(",", $matches[2]); /** The array values contain 2 quotes, so we have to subtract 2 from the strlen */ $maxLength = max(array_map("strlen", $pieces)) - 2; if ($maxLength <= 0) { $maxLength = 1; } } } /** Numeric types, which may have a maximum length */ $integerTypes = ['INTEGER', 'INT', 'SMALLINT', 'TINYINT', 'MEDIUMINT', 'BIGINT']; $fixedPointTypes = ['DECIMAL', 'NUMERIC']; $floatingPointTypes = ['FLOAT', 'DOUBLE']; /** Text types, which may have a maximum length */ $textTypes = ['CHAR', 'VARCHAR']; /** Date types, which may have a maximum length */ $dateTypes = ['YEAR']; $assignedType = strtoupper($assignedType); if (( in_array($assignedType, $integerTypes) || in_array($assignedType, $fixedPointTypes) || in_array($assignedType, $floatingPointTypes) || in_array($assignedType, $textTypes) || in_array($assignedType, $dateTypes) ) && -1 == $maxLength ) { /** * @todo: If the assigned type is one of the following and maxLength is -1, then, if applicable the default max length ot that type should be assigned. */ } return [(int) $maxLength, (int) $scale]; }
[ "protected", "function", "getColumnMaxLengthAndScale", "(", "array", "$", "column", ",", "$", "assignedType", ")", "{", "/** @var int $maxLength The max length of a field. For floating point type or fixed point type fields the precision of the field */", "$", "maxLength", "=", "-", ...
Get the maximal length of a given column of a given type. @param array $column The meta column for which the may length has to be found. @param string $assignedType The type of the column. @return int[] The maximal length and the scale (in case of DECIMAL type). Both variables are -1 in case of no value can be found.
[ "Get", "the", "maximal", "length", "of", "a", "given", "column", "of", "a", "given", "type", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Database/Adapter/Doctrine/Database.php#L1259-L1324
train
OXID-eSales/oxideshop_ce
source/Core/Database/Adapter/Doctrine/Database.php
Database.getFirstCommandInStatement
protected function getFirstCommandInStatement($query) { $sqlComments = '@(([\'"]).*?[^\\\]\2)|((?:\#|--).*?$|/\*(?:[^/*]|/(?!\*)|\*(?!/)|(?R))*\*\/)\s*|(?<=;)\s+@ms'; $uncommentedQuery = preg_replace($sqlComments, '$1', $query); $command = strtoupper( trim( explode(' ', trim($uncommentedQuery))[0] ) ); return $command; }
php
protected function getFirstCommandInStatement($query) { $sqlComments = '@(([\'"]).*?[^\\\]\2)|((?:\#|--).*?$|/\*(?:[^/*]|/(?!\*)|\*(?!/)|(?R))*\*\/)\s*|(?<=;)\s+@ms'; $uncommentedQuery = preg_replace($sqlComments, '$1', $query); $command = strtoupper( trim( explode(' ', trim($uncommentedQuery))[0] ) ); return $command; }
[ "protected", "function", "getFirstCommandInStatement", "(", "$", "query", ")", "{", "$", "sqlComments", "=", "'@(([\\'\"]).*?[^\\\\\\]\\2)|((?:\\#|--).*?$|/\\*(?:[^/*]|/(?!\\*)|\\*(?!/)|(?R))*\\*\\/)\\s*|(?<=;)\\s+@ms'", ";", "$", "uncommentedQuery", "=", "preg_replace", "(", "$"...
This method strips SQL comments and whitespaces to find the first effective SQL command in a giver statement @param string $query The query to extract the command from @return string The first effective SQL command
[ "This", "method", "strips", "SQL", "comments", "and", "whitespaces", "to", "find", "the", "first", "effective", "SQL", "command", "in", "a", "giver", "statement" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Database/Adapter/Doctrine/Database.php#L1333-L1345
train
OXID-eSales/oxideshop_ce
source/Core/Database/Adapter/Doctrine/Database.php
Database.ensureConnectionIsEstablished
protected function ensureConnectionIsEstablished($connection) { if (!$this->isConnectionEstablished($connection)) { $message = $this->createConnectionErrorMessage($connection); throw new ConnectionException($message); } }
php
protected function ensureConnectionIsEstablished($connection) { if (!$this->isConnectionEstablished($connection)) { $message = $this->createConnectionErrorMessage($connection); throw new ConnectionException($message); } }
[ "protected", "function", "ensureConnectionIsEstablished", "(", "$", "connection", ")", "{", "if", "(", "!", "$", "this", "->", "isConnectionEstablished", "(", "$", "connection", ")", ")", "{", "$", "message", "=", "$", "this", "->", "createConnectionErrorMessage...
Ensure, that the given connection is established successful. @param \Doctrine\DBAL\Connection $connection The connection we want to ensure, if it is established. @throws \Exception If we are not connected correctly to the database.
[ "Ensure", "that", "the", "given", "connection", "is", "established", "successful", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Database/Adapter/Doctrine/Database.php#L1354-L1361
train
OXID-eSales/oxideshop_ce
source/Core/Database/Adapter/Doctrine/Database.php
Database.getConnectionFromDriverManager
protected function getConnectionFromDriverManager() { $configuration = new Configuration(); $connectionParameters = $this->getConnectionParameters(); return DriverManager::getConnection($connectionParameters, $configuration); }
php
protected function getConnectionFromDriverManager() { $configuration = new Configuration(); $connectionParameters = $this->getConnectionParameters(); return DriverManager::getConnection($connectionParameters, $configuration); }
[ "protected", "function", "getConnectionFromDriverManager", "(", ")", "{", "$", "configuration", "=", "new", "Configuration", "(", ")", ";", "$", "connectionParameters", "=", "$", "this", "->", "getConnectionParameters", "(", ")", ";", "return", "DriverManager", ":...
Get the connection from the Doctrine DBAL DriverManager. @throws DBALException @return Connection The connection to the database.
[ "Get", "the", "connection", "from", "the", "Doctrine", "DBAL", "DriverManager", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Database/Adapter/Doctrine/Database.php#L1382-L1388
train
OXID-eSales/oxideshop_ce
source/Core/Database/Adapter/Doctrine/Database.php
Database.createConnectionErrorMessage
protected function createConnectionErrorMessage($connection) { $message = 'Not connected to database. dsn: ' . $connection->getDriver()->getName() . '://' . '****:****@' . $connection->getHost() . ':' . $connection->getPort() . '/' . $connection->getDatabase(); return $message; }
php
protected function createConnectionErrorMessage($connection) { $message = 'Not connected to database. dsn: ' . $connection->getDriver()->getName() . '://' . '****:****@' . $connection->getHost() . ':' . $connection->getPort() . '/' . $connection->getDatabase(); return $message; }
[ "protected", "function", "createConnectionErrorMessage", "(", "$", "connection", ")", "{", "$", "message", "=", "'Not connected to database. dsn: '", ".", "$", "connection", "->", "getDriver", "(", ")", "->", "getName", "(", ")", ".", "'://'", ".", "'****:****@'",...
Create the message we want to throw, if there was a connection error. @param Connection $connection The connection. @return string The message we want throw if there was a connection error.
[ "Create", "the", "message", "we", "want", "to", "throw", "if", "there", "was", "a", "connection", "error", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Database/Adapter/Doctrine/Database.php#L1397-L1408
train
OXID-eSales/oxideshop_ce
source/Application/Controller/ContactController.php
ContactController.send
public function send() { $contactFormBridge = $this->getContainer()->get(ContactFormBridgeInterface::class); $form = $contactFormBridge->getContactForm(); $form->handleRequest($this->getMappedContactFormRequest()); if ($form->isValid()) { $this->sendContactMail( $form->email->getValue(), $form->subject->getValue(), $contactFormBridge->getContactFormMessage($form) ); } else { foreach ($form->getErrors() as $error) { Registry::getUtilsView()->addErrorToDisplay($error); } return false; } }
php
public function send() { $contactFormBridge = $this->getContainer()->get(ContactFormBridgeInterface::class); $form = $contactFormBridge->getContactForm(); $form->handleRequest($this->getMappedContactFormRequest()); if ($form->isValid()) { $this->sendContactMail( $form->email->getValue(), $form->subject->getValue(), $contactFormBridge->getContactFormMessage($form) ); } else { foreach ($form->getErrors() as $error) { Registry::getUtilsView()->addErrorToDisplay($error); } return false; } }
[ "public", "function", "send", "(", ")", "{", "$", "contactFormBridge", "=", "$", "this", "->", "getContainer", "(", ")", "->", "get", "(", "ContactFormBridgeInterface", "::", "class", ")", ";", "$", "form", "=", "$", "contactFormBridge", "->", "getContactFor...
Composes and sends user written message, returns false if some parameters are missing. @return bool
[ "Composes", "and", "sends", "user", "written", "message", "returns", "false", "if", "some", "parameters", "are", "missing", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/ContactController.php#L92-L112
train
OXID-eSales/oxideshop_ce
source/Application/Controller/ContactController.php
ContactController.getUserData
public function getUserData() { if ($this->_oUserData === null) { $this->_oUserData = Registry::getConfig()->getRequestParameter('editval'); } return $this->_oUserData; }
php
public function getUserData() { if ($this->_oUserData === null) { $this->_oUserData = Registry::getConfig()->getRequestParameter('editval'); } return $this->_oUserData; }
[ "public", "function", "getUserData", "(", ")", "{", "if", "(", "$", "this", "->", "_oUserData", "===", "null", ")", "{", "$", "this", "->", "_oUserData", "=", "Registry", "::", "getConfig", "(", ")", "->", "getRequestParameter", "(", "'editval'", ")", ";...
Template variable getter. Returns entered user data @return object
[ "Template", "variable", "getter", ".", "Returns", "entered", "user", "data" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/ContactController.php#L119-L126
train
OXID-eSales/oxideshop_ce
source/Application/Controller/ContactController.php
ContactController.getContactSubject
public function getContactSubject() { if ($this->_sContactSubject === null) { $this->_sContactSubject = Registry::getConfig()->getRequestParameter('c_subject'); } return $this->_sContactSubject; }
php
public function getContactSubject() { if ($this->_sContactSubject === null) { $this->_sContactSubject = Registry::getConfig()->getRequestParameter('c_subject'); } return $this->_sContactSubject; }
[ "public", "function", "getContactSubject", "(", ")", "{", "if", "(", "$", "this", "->", "_sContactSubject", "===", "null", ")", "{", "$", "this", "->", "_sContactSubject", "=", "Registry", "::", "getConfig", "(", ")", "->", "getRequestParameter", "(", "'c_su...
Template variable getter. Returns entered contact subject @return object
[ "Template", "variable", "getter", ".", "Returns", "entered", "contact", "subject" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/ContactController.php#L133-L140
train
OXID-eSales/oxideshop_ce
source/Application/Controller/ContactController.php
ContactController.getContactMessage
public function getContactMessage() { if ($this->_sContactMessage === null) { $this->_sContactMessage = Registry::getConfig()->getRequestParameter('c_message'); } return $this->_sContactMessage; }
php
public function getContactMessage() { if ($this->_sContactMessage === null) { $this->_sContactMessage = Registry::getConfig()->getRequestParameter('c_message'); } return $this->_sContactMessage; }
[ "public", "function", "getContactMessage", "(", ")", "{", "if", "(", "$", "this", "->", "_sContactMessage", "===", "null", ")", "{", "$", "this", "->", "_sContactMessage", "=", "Registry", "::", "getConfig", "(", ")", "->", "getRequestParameter", "(", "'c_me...
Template variable getter. Returns entered message @return object
[ "Template", "variable", "getter", ".", "Returns", "entered", "message" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/ContactController.php#L147-L154
train
OXID-eSales/oxideshop_ce
source/Application/Controller/ContactController.php
ContactController.sendContactMail
private function sendContactMail($email, $subject, $message) { $mailer = oxNew(Email::class); if ($mailer->sendContactMail($email, $subject, $message)) { $this->_blContactSendStatus = 1; } else { Registry::getUtilsView()->addErrorToDisplay('ERROR_MESSAGE_CHECK_EMAIL'); } }
php
private function sendContactMail($email, $subject, $message) { $mailer = oxNew(Email::class); if ($mailer->sendContactMail($email, $subject, $message)) { $this->_blContactSendStatus = 1; } else { Registry::getUtilsView()->addErrorToDisplay('ERROR_MESSAGE_CHECK_EMAIL'); } }
[ "private", "function", "sendContactMail", "(", "$", "email", ",", "$", "subject", ",", "$", "message", ")", "{", "$", "mailer", "=", "oxNew", "(", "Email", "::", "class", ")", ";", "if", "(", "$", "mailer", "->", "sendContactMail", "(", "$", "email", ...
Send a contact mail. @param string $email @param string $subject @param string $message
[ "Send", "a", "contact", "mail", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/ContactController.php#L222-L231
train
OXID-eSales/oxideshop_ce
source/Application/Model/PaymentList.php
PaymentList._getFilterSelect
protected function _getFilterSelect($sShipSetId, $dPrice, $oUser) { $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(); $sBoni = ($oUser && $oUser->oxuser__oxboni->value) ? $oUser->oxuser__oxboni->value : 0; $sTable = getViewName('oxpayments'); $sQ = "select {$sTable}.* from ( select distinct {$sTable}.* from {$sTable} "; $sQ .= "left join oxobject2group ON oxobject2group.oxobjectid = {$sTable}.oxid "; $sQ .= "inner join oxobject2payment ON oxobject2payment.oxobjectid = " . $oDb->quote($sShipSetId) . " and oxobject2payment.oxpaymentid = {$sTable}.oxid "; $sQ .= "where {$sTable}.oxactive='1' "; $sQ .= " and {$sTable}.oxfromboni <= " . $oDb->quote($sBoni) . " and {$sTable}.oxfromamount <= " . $oDb->quote($dPrice) . " and {$sTable}.oxtoamount >= " . $oDb->quote($dPrice); // defining initial filter parameters $sGroupIds = ''; $sCountryId = $this->getCountryId($oUser); // checking for current session user which gives additional restrictions for user itself, users group and country if ($oUser) { // user groups ( maybe would be better to fetch by function \OxidEsales\Eshop\Application\Model\User::getUserGroups() ? ) foreach ($oUser->getUserGroups() as $oGroup) { if ($sGroupIds) { $sGroupIds .= ', '; } $sGroupIds .= "'" . $oGroup->getId() . "'"; } } $sGroupTable = getViewName('oxgroups'); $sCountryTable = getViewName('oxcountry'); $sCountrySql = $sCountryId ? "exists( select 1 from oxobject2payment as s1 where s1.oxpaymentid={$sTable}.OXID and s1.oxtype='oxcountry' and s1.OXOBJECTID=" . $oDb->quote($sCountryId) . " limit 1 )" : '0'; $sGroupSql = $sGroupIds ? "exists( select 1 from oxobject2group as s3 where s3.OXOBJECTID={$sTable}.OXID and s3.OXGROUPSID in ( {$sGroupIds} ) limit 1 )" : '0'; $sQ .= " order by {$sTable}.oxsort asc ) as $sTable where ( select if( exists( select 1 from oxobject2payment as ss1, $sCountryTable where $sCountryTable.oxid=ss1.oxobjectid and ss1.oxpaymentid={$sTable}.OXID and ss1.oxtype='oxcountry' limit 1 ), {$sCountrySql}, 1) && if( exists( select 1 from oxobject2group as ss3, $sGroupTable where $sGroupTable.oxid=ss3.oxgroupsid and ss3.OXOBJECTID={$sTable}.OXID limit 1 ), {$sGroupSql}, 1) ) order by {$sTable}.oxsort asc "; return $sQ; }
php
protected function _getFilterSelect($sShipSetId, $dPrice, $oUser) { $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(); $sBoni = ($oUser && $oUser->oxuser__oxboni->value) ? $oUser->oxuser__oxboni->value : 0; $sTable = getViewName('oxpayments'); $sQ = "select {$sTable}.* from ( select distinct {$sTable}.* from {$sTable} "; $sQ .= "left join oxobject2group ON oxobject2group.oxobjectid = {$sTable}.oxid "; $sQ .= "inner join oxobject2payment ON oxobject2payment.oxobjectid = " . $oDb->quote($sShipSetId) . " and oxobject2payment.oxpaymentid = {$sTable}.oxid "; $sQ .= "where {$sTable}.oxactive='1' "; $sQ .= " and {$sTable}.oxfromboni <= " . $oDb->quote($sBoni) . " and {$sTable}.oxfromamount <= " . $oDb->quote($dPrice) . " and {$sTable}.oxtoamount >= " . $oDb->quote($dPrice); // defining initial filter parameters $sGroupIds = ''; $sCountryId = $this->getCountryId($oUser); // checking for current session user which gives additional restrictions for user itself, users group and country if ($oUser) { // user groups ( maybe would be better to fetch by function \OxidEsales\Eshop\Application\Model\User::getUserGroups() ? ) foreach ($oUser->getUserGroups() as $oGroup) { if ($sGroupIds) { $sGroupIds .= ', '; } $sGroupIds .= "'" . $oGroup->getId() . "'"; } } $sGroupTable = getViewName('oxgroups'); $sCountryTable = getViewName('oxcountry'); $sCountrySql = $sCountryId ? "exists( select 1 from oxobject2payment as s1 where s1.oxpaymentid={$sTable}.OXID and s1.oxtype='oxcountry' and s1.OXOBJECTID=" . $oDb->quote($sCountryId) . " limit 1 )" : '0'; $sGroupSql = $sGroupIds ? "exists( select 1 from oxobject2group as s3 where s3.OXOBJECTID={$sTable}.OXID and s3.OXGROUPSID in ( {$sGroupIds} ) limit 1 )" : '0'; $sQ .= " order by {$sTable}.oxsort asc ) as $sTable where ( select if( exists( select 1 from oxobject2payment as ss1, $sCountryTable where $sCountryTable.oxid=ss1.oxobjectid and ss1.oxpaymentid={$sTable}.OXID and ss1.oxtype='oxcountry' limit 1 ), {$sCountrySql}, 1) && if( exists( select 1 from oxobject2group as ss3, $sGroupTable where $sGroupTable.oxid=ss3.oxgroupsid and ss3.OXOBJECTID={$sTable}.OXID limit 1 ), {$sGroupSql}, 1) ) order by {$sTable}.oxsort asc "; return $sQ; }
[ "protected", "function", "_getFilterSelect", "(", "$", "sShipSetId", ",", "$", "dPrice", ",", "$", "oUser", ")", "{", "$", "oDb", "=", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "DatabaseProvider", "::", "getDb", "(", ")", ";", "$", "sBoni", ...
Creates payment list filter SQL to load current state payment list @param string $sShipSetId user chosen delivery set @param double $dPrice basket products price @param \OxidEsales\Eshop\Application\Model\User $oUser session user object @return string
[ "Creates", "payment", "list", "filter", "SQL", "to", "load", "current", "state", "payment", "list" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/PaymentList.php#L56-L100
train
OXID-eSales/oxideshop_ce
source/Application/Model/PaymentList.php
PaymentList.getCountryId
public function getCountryId($oUser) { $sCountryId = null; if ($oUser) { $sCountryId = $oUser->getActiveCountry(); } if (!$sCountryId) { $sCountryId = $this->_sHomeCountry; } return $sCountryId; }
php
public function getCountryId($oUser) { $sCountryId = null; if ($oUser) { $sCountryId = $oUser->getActiveCountry(); } if (!$sCountryId) { $sCountryId = $this->_sHomeCountry; } return $sCountryId; }
[ "public", "function", "getCountryId", "(", "$", "oUser", ")", "{", "$", "sCountryId", "=", "null", ";", "if", "(", "$", "oUser", ")", "{", "$", "sCountryId", "=", "$", "oUser", "->", "getActiveCountry", "(", ")", ";", "}", "if", "(", "!", "$", "sCo...
Returns user country id for for payment selection @param \OxidEsales\Eshop\Application\Model\User $oUser oxuser object @return string
[ "Returns", "user", "country", "id", "for", "for", "payment", "selection" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/PaymentList.php#L109-L121
train
OXID-eSales/oxideshop_ce
source/Application/Model/PaymentList.php
PaymentList.getPaymentList
public function getPaymentList($sShipSetId, $dPrice, $oUser = null) { $this->selectString($this->_getFilterSelect($sShipSetId, $dPrice, $oUser)); return $this->_aArray; }
php
public function getPaymentList($sShipSetId, $dPrice, $oUser = null) { $this->selectString($this->_getFilterSelect($sShipSetId, $dPrice, $oUser)); return $this->_aArray; }
[ "public", "function", "getPaymentList", "(", "$", "sShipSetId", ",", "$", "dPrice", ",", "$", "oUser", "=", "null", ")", "{", "$", "this", "->", "selectString", "(", "$", "this", "->", "_getFilterSelect", "(", "$", "sShipSetId", ",", "$", "dPrice", ",", ...
Loads and returns list of user payments. @param string $sShipSetId user chosen delivery set @param double $dPrice basket product price excl. discount @param \OxidEsales\Eshop\Application\Model\User $oUser session user object @return array
[ "Loads", "and", "returns", "list", "of", "user", "payments", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/PaymentList.php#L132-L137
train
OXID-eSales/oxideshop_ce
source/Application/Model/PaymentList.php
PaymentList.loadRDFaPaymentList
public function loadRDFaPaymentList($dPrice = null) { $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC); $sTable = getViewName('oxpayments'); $sQ = "select $sTable.*, oxobject2payment.oxobjectid from $sTable left join (select oxobject2payment.* from oxobject2payment where oxobject2payment.oxtype = 'rdfapayment') as oxobject2payment on oxobject2payment.oxpaymentid=$sTable.oxid "; $sQ .= "where $sTable.oxactive = 1 "; if ($dPrice !== null) { $sQ .= "and $sTable.oxfromamount <= " . $oDb->quote($dPrice) . " and $sTable.oxtoamount >= " . $oDb->quote($dPrice); } $rs = $oDb->select($sQ); if ($rs != false && $rs->count() > 0) { $oSaved = clone $this->getBaseObject(); while (!$rs->EOF) { $oListObject = clone $oSaved; $this->_assignElement($oListObject, $rs->fields); $this->_aArray[] = $oListObject; $rs->fetchRow(); } } }
php
public function loadRDFaPaymentList($dPrice = null) { $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC); $sTable = getViewName('oxpayments'); $sQ = "select $sTable.*, oxobject2payment.oxobjectid from $sTable left join (select oxobject2payment.* from oxobject2payment where oxobject2payment.oxtype = 'rdfapayment') as oxobject2payment on oxobject2payment.oxpaymentid=$sTable.oxid "; $sQ .= "where $sTable.oxactive = 1 "; if ($dPrice !== null) { $sQ .= "and $sTable.oxfromamount <= " . $oDb->quote($dPrice) . " and $sTable.oxtoamount >= " . $oDb->quote($dPrice); } $rs = $oDb->select($sQ); if ($rs != false && $rs->count() > 0) { $oSaved = clone $this->getBaseObject(); while (!$rs->EOF) { $oListObject = clone $oSaved; $this->_assignElement($oListObject, $rs->fields); $this->_aArray[] = $oListObject; $rs->fetchRow(); } } }
[ "public", "function", "loadRDFaPaymentList", "(", "$", "dPrice", "=", "null", ")", "{", "$", "oDb", "=", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "DatabaseProvider", "::", "getDb", "(", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", ...
Loads payments mapped to a predefined GoodRelations payment method. @param double $dPrice product price
[ "Loads", "payments", "mapped", "to", "a", "predefined", "GoodRelations", "payment", "method", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/PaymentList.php#L156-L175
train
OXID-eSales/oxideshop_ce
source/Application/Controller/Admin/CategoryOrderAjax.php
CategoryOrderAjax.removeCatOrderArticle
public function removeCatOrderArticle() { $aRemoveArt = $this->_getActionIds('oxarticles.oxid'); $soxId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('oxid'); $aSkipArt = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable('neworder_sess'); if (is_array($aRemoveArt) && is_array($aSkipArt)) { foreach ($aRemoveArt as $sRem) { if (($iKey = array_search($sRem, $aSkipArt)) !== false) { unset($aSkipArt[$iKey]); } } \OxidEsales\Eshop\Core\Registry::getSession()->setVariable('neworder_sess', $aSkipArt); $sArticleTable = $this->_getViewName('oxarticles'); $sO2CView = $this->_getViewName('oxobject2category'); // checking if all articles were moved from one $sSelect = "select 1 from $sArticleTable left join $sO2CView on $sArticleTable.oxid=$sO2CView.oxobjectid "; $sSelect .= "where $sO2CView.oxcatnid = '$soxId' and $sArticleTable.oxparentid = '' and $sArticleTable.oxid "; $sSelect .= "not in ( " . implode(", ", \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quoteArray($aSkipArt)) . " ) "; // simply echoing "1" if some items found, and 0 if nothing was found // We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804). echo (int) \OxidEsales\Eshop\Core\DatabaseProvider::getMaster()->getOne($sSelect); } }
php
public function removeCatOrderArticle() { $aRemoveArt = $this->_getActionIds('oxarticles.oxid'); $soxId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('oxid'); $aSkipArt = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable('neworder_sess'); if (is_array($aRemoveArt) && is_array($aSkipArt)) { foreach ($aRemoveArt as $sRem) { if (($iKey = array_search($sRem, $aSkipArt)) !== false) { unset($aSkipArt[$iKey]); } } \OxidEsales\Eshop\Core\Registry::getSession()->setVariable('neworder_sess', $aSkipArt); $sArticleTable = $this->_getViewName('oxarticles'); $sO2CView = $this->_getViewName('oxobject2category'); // checking if all articles were moved from one $sSelect = "select 1 from $sArticleTable left join $sO2CView on $sArticleTable.oxid=$sO2CView.oxobjectid "; $sSelect .= "where $sO2CView.oxcatnid = '$soxId' and $sArticleTable.oxparentid = '' and $sArticleTable.oxid "; $sSelect .= "not in ( " . implode(", ", \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quoteArray($aSkipArt)) . " ) "; // simply echoing "1" if some items found, and 0 if nothing was found // We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804). echo (int) \OxidEsales\Eshop\Core\DatabaseProvider::getMaster()->getOne($sSelect); } }
[ "public", "function", "removeCatOrderArticle", "(", ")", "{", "$", "aRemoveArt", "=", "$", "this", "->", "_getActionIds", "(", "'oxarticles.oxid'", ")", ";", "$", "soxId", "=", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "Registry", "::", "getConf...
Removes article from list for sorting in category
[ "Removes", "article", "from", "list", "for", "sorting", "in", "category" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/CategoryOrderAjax.php#L101-L127
train
OXID-eSales/oxideshop_ce
source/Application/Controller/Admin/CategoryOrderAjax.php
CategoryOrderAjax.addCatOrderArticle
public function addCatOrderArticle() { $aAddArticle = $this->_getActionIds('oxarticles.oxid'); $soxId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('synchoxid'); $aOrdArt = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable('neworder_sess'); if (!is_array($aOrdArt)) { $aOrdArt = []; } if (is_array($aAddArticle)) { // storing newly ordered article seq. foreach ($aAddArticle as $sAdd) { if (array_search($sAdd, $aOrdArt) === false) { $aOrdArt[] = $sAdd; } } \OxidEsales\Eshop\Core\Registry::getSession()->setVariable('neworder_sess', $aOrdArt); $sArticleTable = $this->_getViewName('oxarticles'); $sO2CView = $this->_getViewName('oxobject2category'); // checking if all articles were moved from one $sSelect = "select 1 from $sArticleTable left join $sO2CView on $sArticleTable.oxid=$sO2CView.oxobjectid "; $sSelect .= "where $sO2CView.oxcatnid = '$soxId' and $sArticleTable.oxparentid = '' and $sArticleTable.oxid "; $sSelect .= "not in ( " . implode(", ", \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quoteArray($aOrdArt)) . " ) "; // simply echoing "1" if some items found, and 0 if nothing was found // We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804). echo (int) \OxidEsales\Eshop\Core\DatabaseProvider::getMaster()->getOne($sSelect); } }
php
public function addCatOrderArticle() { $aAddArticle = $this->_getActionIds('oxarticles.oxid'); $soxId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('synchoxid'); $aOrdArt = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable('neworder_sess'); if (!is_array($aOrdArt)) { $aOrdArt = []; } if (is_array($aAddArticle)) { // storing newly ordered article seq. foreach ($aAddArticle as $sAdd) { if (array_search($sAdd, $aOrdArt) === false) { $aOrdArt[] = $sAdd; } } \OxidEsales\Eshop\Core\Registry::getSession()->setVariable('neworder_sess', $aOrdArt); $sArticleTable = $this->_getViewName('oxarticles'); $sO2CView = $this->_getViewName('oxobject2category'); // checking if all articles were moved from one $sSelect = "select 1 from $sArticleTable left join $sO2CView on $sArticleTable.oxid=$sO2CView.oxobjectid "; $sSelect .= "where $sO2CView.oxcatnid = '$soxId' and $sArticleTable.oxparentid = '' and $sArticleTable.oxid "; $sSelect .= "not in ( " . implode(", ", \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quoteArray($aOrdArt)) . " ) "; // simply echoing "1" if some items found, and 0 if nothing was found // We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804). echo (int) \OxidEsales\Eshop\Core\DatabaseProvider::getMaster()->getOne($sSelect); } }
[ "public", "function", "addCatOrderArticle", "(", ")", "{", "$", "aAddArticle", "=", "$", "this", "->", "_getActionIds", "(", "'oxarticles.oxid'", ")", ";", "$", "soxId", "=", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "Registry", "::", "getConfig...
Adds article to list for sorting in category
[ "Adds", "article", "to", "list", "for", "sorting", "in", "category" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/CategoryOrderAjax.php#L132-L163
train
OXID-eSales/oxideshop_ce
source/Application/Controller/Admin/CategoryOrderAjax.php
CategoryOrderAjax.saveNewOrder
public function saveNewOrder() { $oCategory = oxNew(\OxidEsales\Eshop\Application\Model\Category::class); $sId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("oxid"); if ($oCategory->load($sId)) { //Disable editing for derived items if ($oCategory->isDerived()) { return; } $this->resetContentCache(); $aNewOrder = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable("neworder_sess"); if (is_array($aNewOrder) && count($aNewOrder)) { $sO2CView = $this->_getViewName('oxobject2category'); $sSelect = "select * from $sO2CView where $sO2CView.oxcatnid='" . $oCategory->getId() . "' and $sO2CView.oxobjectid in (" . implode(", ", \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quoteArray($aNewOrder)) . " )"; $oList = oxNew(\OxidEsales\Eshop\Core\Model\ListModel::class); $oList->init("oxbase", "oxobject2category"); $oList->selectString($sSelect); // setting new position foreach ($oList as $oObj) { if (($iNewPos = array_search($oObj->oxobject2category__oxobjectid->value, $aNewOrder)) !== false) { $oObj->oxobject2category__oxpos->setValue($iNewPos); $oObj->save(); } } \OxidEsales\Eshop\Core\Registry::getSession()->setVariable('neworder_sess', null); } $this->onCategoryChange($sId); } }
php
public function saveNewOrder() { $oCategory = oxNew(\OxidEsales\Eshop\Application\Model\Category::class); $sId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("oxid"); if ($oCategory->load($sId)) { //Disable editing for derived items if ($oCategory->isDerived()) { return; } $this->resetContentCache(); $aNewOrder = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable("neworder_sess"); if (is_array($aNewOrder) && count($aNewOrder)) { $sO2CView = $this->_getViewName('oxobject2category'); $sSelect = "select * from $sO2CView where $sO2CView.oxcatnid='" . $oCategory->getId() . "' and $sO2CView.oxobjectid in (" . implode(", ", \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quoteArray($aNewOrder)) . " )"; $oList = oxNew(\OxidEsales\Eshop\Core\Model\ListModel::class); $oList->init("oxbase", "oxobject2category"); $oList->selectString($sSelect); // setting new position foreach ($oList as $oObj) { if (($iNewPos = array_search($oObj->oxobject2category__oxobjectid->value, $aNewOrder)) !== false) { $oObj->oxobject2category__oxpos->setValue($iNewPos); $oObj->save(); } } \OxidEsales\Eshop\Core\Registry::getSession()->setVariable('neworder_sess', null); } $this->onCategoryChange($sId); } }
[ "public", "function", "saveNewOrder", "(", ")", "{", "$", "oCategory", "=", "oxNew", "(", "\\", "OxidEsales", "\\", "Eshop", "\\", "Application", "\\", "Model", "\\", "Category", "::", "class", ")", ";", "$", "sId", "=", "\\", "OxidEsales", "\\", "Eshop"...
Saves category articles ordering. @return null
[ "Saves", "category", "articles", "ordering", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/CategoryOrderAjax.php#L170-L203
train
OXID-eSales/oxideshop_ce
source/Core/CreditCardValidator.php
CreditCardValidator._isValidType
protected function _isValidType($type, $number) { // testing if card type is known and matches pattern if (isset($this->_aCardsInfo[$type])) { return preg_match($this->_aCardsInfo[$type], $number); } return true; }
php
protected function _isValidType($type, $number) { // testing if card type is known and matches pattern if (isset($this->_aCardsInfo[$type])) { return preg_match($this->_aCardsInfo[$type], $number); } return true; }
[ "protected", "function", "_isValidType", "(", "$", "type", ",", "$", "number", ")", "{", "// testing if card type is known and matches pattern", "if", "(", "isset", "(", "$", "this", "->", "_aCardsInfo", "[", "$", "type", "]", ")", ")", "{", "return", "preg_ma...
Checks credit card type. Returns TRUE if card is valid @param string $type credit card type @param string $number credit card number @return bool
[ "Checks", "credit", "card", "type", ".", "Returns", "TRUE", "if", "card", "is", "valid" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/CreditCardValidator.php#L40-L48
train
OXID-eSales/oxideshop_ce
source/Core/CreditCardValidator.php
CreditCardValidator._isExpired
protected function _isExpired($date) { if ($date) { $years = substr($date, 2, 2); $month = substr($date, 0, 2); $day = date("t", mktime(11, 59, 59, $month, 1, $years)); $expDate = mktime(23, 59, 59, $month, $day, $years); if (time() > $expDate) { return true; } } return false; }
php
protected function _isExpired($date) { if ($date) { $years = substr($date, 2, 2); $month = substr($date, 0, 2); $day = date("t", mktime(11, 59, 59, $month, 1, $years)); $expDate = mktime(23, 59, 59, $month, $day, $years); if (time() > $expDate) { return true; } } return false; }
[ "protected", "function", "_isExpired", "(", "$", "date", ")", "{", "if", "(", "$", "date", ")", "{", "$", "years", "=", "substr", "(", "$", "date", ",", "2", ",", "2", ")", ";", "$", "month", "=", "substr", "(", "$", "date", ",", "0", ",", "2...
Checks credit card expiration date. Returns TRUE if card is not expired @param string $date credit card type @return bool
[ "Checks", "credit", "card", "expiration", "date", ".", "Returns", "TRUE", "if", "card", "is", "not", "expired" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/CreditCardValidator.php#L57-L71
train
OXID-eSales/oxideshop_ce
source/Core/CreditCardValidator.php
CreditCardValidator._isValidNumer
protected function _isValidNumer($number) { $valid = false; if (($length = strlen($number))) { $modSum = 0; $mod = $length % 2; // Luhn algorithm for ($pos = 0; $pos < $length; $pos++) { // taking digit to check.. $currDigit = ( int ) $number{$pos}; // multiplying if needed.. $addValue = (($pos % 2 == $mod) ? 2 : 1) * $currDigit; // adding prepared current digit $modSum += ($addValue > 9) ? $addValue - 9 : $addValue; } $valid = ($modSum % 10) == 0; } return $valid; }
php
protected function _isValidNumer($number) { $valid = false; if (($length = strlen($number))) { $modSum = 0; $mod = $length % 2; // Luhn algorithm for ($pos = 0; $pos < $length; $pos++) { // taking digit to check.. $currDigit = ( int ) $number{$pos}; // multiplying if needed.. $addValue = (($pos % 2 == $mod) ? 2 : 1) * $currDigit; // adding prepared current digit $modSum += ($addValue > 9) ? $addValue - 9 : $addValue; } $valid = ($modSum % 10) == 0; } return $valid; }
[ "protected", "function", "_isValidNumer", "(", "$", "number", ")", "{", "$", "valid", "=", "false", ";", "if", "(", "(", "$", "length", "=", "strlen", "(", "$", "number", ")", ")", ")", "{", "$", "modSum", "=", "0", ";", "$", "mod", "=", "$", "...
checks credit card number. Returns TRUE if card number is valid @param string $number credit card number @return bool
[ "checks", "credit", "card", "number", ".", "Returns", "TRUE", "if", "card", "number", "is", "valid" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/CreditCardValidator.php#L80-L103
train
OXID-eSales/oxideshop_ce
source/Core/CreditCardValidator.php
CreditCardValidator.isValidCard
public function isValidCard($number, $type = "", $date = "") { // cleanup $number = preg_replace("/[^0-9]/", "", $number); return (!$this->_isExpired($date) && $this->_isValidType($type, $number) && $this->_isValidNumer($number)); }
php
public function isValidCard($number, $type = "", $date = "") { // cleanup $number = preg_replace("/[^0-9]/", "", $number); return (!$this->_isExpired($date) && $this->_isValidType($type, $number) && $this->_isValidNumer($number)); }
[ "public", "function", "isValidCard", "(", "$", "number", ",", "$", "type", "=", "\"\"", ",", "$", "date", "=", "\"\"", ")", "{", "// cleanup", "$", "number", "=", "preg_replace", "(", "\"/[^0-9]/\"", ",", "\"\"", ",", "$", "number", ")", ";", "return",...
Checks if provided credit card information is valid. Returns TRUE if valid @param object $number credit card number @param string $type credit card type [optional] @param string $date card expiration date [optional] @return bool
[ "Checks", "if", "provided", "credit", "card", "information", "is", "valid", ".", "Returns", "TRUE", "if", "valid" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/CreditCardValidator.php#L114-L120
train
OXID-eSales/oxideshop_ce
source/Application/Controller/UserController.php
UserController.getShowNoRegOption
public function getShowNoRegOption() { if ($this->_blShowNoRegOpt === null) { $this->_blShowNoRegOpt = !\OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('blOrderDisWithoutReg'); } return $this->_blShowNoRegOpt; }
php
public function getShowNoRegOption() { if ($this->_blShowNoRegOpt === null) { $this->_blShowNoRegOpt = !\OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('blOrderDisWithoutReg'); } return $this->_blShowNoRegOpt; }
[ "public", "function", "getShowNoRegOption", "(", ")", "{", "if", "(", "$", "this", "->", "_blShowNoRegOpt", "===", "null", ")", "{", "$", "this", "->", "_blShowNoRegOpt", "=", "!", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "Registry", "::", ...
Template variable getter. Returns reverse option blOrderDisWithoutReg @return bool
[ "Template", "variable", "getter", ".", "Returns", "reverse", "option", "blOrderDisWithoutReg" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/UserController.php#L107-L114
train
OXID-eSales/oxideshop_ce
source/Application/Controller/UserController.php
UserController.getLoginOption
public function getLoginOption() { if ($this->_iOption === null) { // passing user chosen option value to display correct content $option = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('option'); // if user chosen "Option 2"" - we should show user details only if he is authorized if ($option == 2 && !$this->getUser()) { $option = 0; } $this->_iOption = $option; } return $this->_iOption; }
php
public function getLoginOption() { if ($this->_iOption === null) { // passing user chosen option value to display correct content $option = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('option'); // if user chosen "Option 2"" - we should show user details only if he is authorized if ($option == 2 && !$this->getUser()) { $option = 0; } $this->_iOption = $option; } return $this->_iOption; }
[ "public", "function", "getLoginOption", "(", ")", "{", "if", "(", "$", "this", "->", "_iOption", "===", "null", ")", "{", "// passing user chosen option value to display correct content", "$", "option", "=", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", ...
Template variable getter. Returns user login option @return integer
[ "Template", "variable", "getter", ".", "Returns", "user", "login", "option" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/UserController.php#L121-L134
train
OXID-eSales/oxideshop_ce
source/Application/Controller/UserController.php
UserController.isNewsSubscribed
public function isNewsSubscribed() { if ($this->_blNewsSubscribed === null) { if (($isSubscribedToNews = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('blnewssubscribed')) === null) { $isSubscribedToNews = false; } if (($user = $this->getUser())) { $isSubscribedToNews = $user->getNewsSubscription()->getOptInStatus(); } $this->_blNewsSubscribed = $isSubscribedToNews; } if (is_null($this->_blNewsSubscribed)) { $this->_blNewsSubscribed = false; } return $this->_blNewsSubscribed; }
php
public function isNewsSubscribed() { if ($this->_blNewsSubscribed === null) { if (($isSubscribedToNews = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('blnewssubscribed')) === null) { $isSubscribedToNews = false; } if (($user = $this->getUser())) { $isSubscribedToNews = $user->getNewsSubscription()->getOptInStatus(); } $this->_blNewsSubscribed = $isSubscribedToNews; } if (is_null($this->_blNewsSubscribed)) { $this->_blNewsSubscribed = false; } return $this->_blNewsSubscribed; }
[ "public", "function", "isNewsSubscribed", "(", ")", "{", "if", "(", "$", "this", "->", "_blNewsSubscribed", "===", "null", ")", "{", "if", "(", "(", "$", "isSubscribedToNews", "=", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "Registry", "::", ...
Template variable getter. Returns if user subscribed for newsletter @return bool
[ "Template", "variable", "getter", ".", "Returns", "if", "user", "subscribed", "for", "newsletter" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/UserController.php#L164-L181
train
OXID-eSales/oxideshop_ce
source/Application/Controller/UserController.php
UserController.isDownloadableProductWarning
public function isDownloadableProductWarning() { $basket = $this->getSession()->getBasket(); if ($basket && \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam("blEnableDownloads")) { if ($basket->hasDownloadableProducts()) { return true; } } return false; }
php
public function isDownloadableProductWarning() { $basket = $this->getSession()->getBasket(); if ($basket && \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam("blEnableDownloads")) { if ($basket->hasDownloadableProducts()) { return true; } } return false; }
[ "public", "function", "isDownloadableProductWarning", "(", ")", "{", "$", "basket", "=", "$", "this", "->", "getSession", "(", ")", "->", "getBasket", "(", ")", ";", "if", "(", "$", "basket", "&&", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", ...
Returns warning message if user want to buy downloadable product without registration. @return bool
[ "Returns", "warning", "message", "if", "user", "want", "to", "buy", "downloadable", "product", "without", "registration", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/UserController.php#L227-L237
train
OXID-eSales/oxideshop_ce
source/Application/Controller/Admin/ThemeConfiguration.php
ThemeConfiguration._getModuleForConfigVars
protected function _getModuleForConfigVars() { if ($this->_sTheme === null) { $this->_sTheme = $this->getEditObjectId(); } return \OxidEsales\Eshop\Core\Config::OXMODULE_THEME_PREFIX . $this->_sTheme; }
php
protected function _getModuleForConfigVars() { if ($this->_sTheme === null) { $this->_sTheme = $this->getEditObjectId(); } return \OxidEsales\Eshop\Core\Config::OXMODULE_THEME_PREFIX . $this->_sTheme; }
[ "protected", "function", "_getModuleForConfigVars", "(", ")", "{", "if", "(", "$", "this", "->", "_sTheme", "===", "null", ")", "{", "$", "this", "->", "_sTheme", "=", "$", "this", "->", "getEditObjectId", "(", ")", ";", "}", "return", "\\", "OxidEsales"...
return theme filter for config variables @return string
[ "return", "theme", "filter", "for", "config", "variables" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ThemeConfiguration.php#L69-L76
train
OXID-eSales/oxideshop_ce
source/Application/Controller/VendorListController.php
VendorListController._loadArticles
protected function _loadArticles($oVendor) { $sVendorId = $oVendor->getId(); // load only articles which we show on screen $iNrOfCatArticles = (int) \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('iNrofCatArticles'); $iNrOfCatArticles = $iNrOfCatArticles ? $iNrOfCatArticles : 1; $oArtList = oxNew(\OxidEsales\Eshop\Application\Model\ArticleList::class); $oArtList->setSqlLimit($iNrOfCatArticles * $this->_getRequestPageNr(), $iNrOfCatArticles); $oArtList->setCustomSorting($this->getSortingSql($this->getSortIdent())); // load the articles $this->_iAllArtCnt = $oArtList->loadVendorArticles($sVendorId, $oVendor); // counting pages $this->_iCntPages = ceil($this->_iAllArtCnt / $iNrOfCatArticles); return [$oArtList, $this->_iAllArtCnt]; }
php
protected function _loadArticles($oVendor) { $sVendorId = $oVendor->getId(); // load only articles which we show on screen $iNrOfCatArticles = (int) \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('iNrofCatArticles'); $iNrOfCatArticles = $iNrOfCatArticles ? $iNrOfCatArticles : 1; $oArtList = oxNew(\OxidEsales\Eshop\Application\Model\ArticleList::class); $oArtList->setSqlLimit($iNrOfCatArticles * $this->_getRequestPageNr(), $iNrOfCatArticles); $oArtList->setCustomSorting($this->getSortingSql($this->getSortIdent())); // load the articles $this->_iAllArtCnt = $oArtList->loadVendorArticles($sVendorId, $oVendor); // counting pages $this->_iCntPages = ceil($this->_iAllArtCnt / $iNrOfCatArticles); return [$oArtList, $this->_iAllArtCnt]; }
[ "protected", "function", "_loadArticles", "(", "$", "oVendor", ")", "{", "$", "sVendorId", "=", "$", "oVendor", "->", "getId", "(", ")", ";", "// load only articles which we show on screen", "$", "iNrOfCatArticles", "=", "(", "int", ")", "\\", "OxidEsales", "\\"...
Loads and returns article list of active vendor. @param object $oVendor vendor object @return array
[ "Loads", "and", "returns", "article", "list", "of", "active", "vendor", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/VendorListController.php#L134-L153
train
OXID-eSales/oxideshop_ce
source/Application/Controller/VendorListController.php
VendorListController.hasVisibleSubCats
public function hasVisibleSubCats() { if ($this->_blVisibleSubCats === null) { $this->_blVisibleSubCats = false; if (($this->_getVendorId() && $oVendorTree = $this->getVendorTree())) { if (($oVendor = $this->getActVendor())) { if ($oVendor->getId() == 'root') { $this->_blVisibleSubCats = $oVendorTree->count(); $this->_oSubCatList = $oVendorTree; } } } } return $this->_blVisibleSubCats; }
php
public function hasVisibleSubCats() { if ($this->_blVisibleSubCats === null) { $this->_blVisibleSubCats = false; if (($this->_getVendorId() && $oVendorTree = $this->getVendorTree())) { if (($oVendor = $this->getActVendor())) { if ($oVendor->getId() == 'root') { $this->_blVisibleSubCats = $oVendorTree->count(); $this->_oSubCatList = $oVendorTree; } } } } return $this->_blVisibleSubCats; }
[ "public", "function", "hasVisibleSubCats", "(", ")", "{", "if", "(", "$", "this", "->", "_blVisibleSubCats", "===", "null", ")", "{", "$", "this", "->", "_blVisibleSubCats", "=", "false", ";", "if", "(", "(", "$", "this", "->", "_getVendorId", "(", ")", ...
Returns if vendor has visible sub-cats and load them. @return bool
[ "Returns", "if", "vendor", "has", "visible", "sub", "-", "cats", "and", "load", "them", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/VendorListController.php#L210-L225
train
OXID-eSales/oxideshop_ce
source/Application/Controller/VendorListController.php
VendorListController.getSubCatList
public function getSubCatList() { if ($this->_oSubCatList === null) { $this->_oSubCatList = []; if ($this->hasVisibleSubCats()) { return $this->_oSubCatList; } } return $this->_oSubCatList; }
php
public function getSubCatList() { if ($this->_oSubCatList === null) { $this->_oSubCatList = []; if ($this->hasVisibleSubCats()) { return $this->_oSubCatList; } } return $this->_oSubCatList; }
[ "public", "function", "getSubCatList", "(", ")", "{", "if", "(", "$", "this", "->", "_oSubCatList", "===", "null", ")", "{", "$", "this", "->", "_oSubCatList", "=", "[", "]", ";", "if", "(", "$", "this", "->", "hasVisibleSubCats", "(", ")", ")", "{",...
Returns vendor subcategories @return array
[ "Returns", "vendor", "subcategories" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/VendorListController.php#L232-L242
train
OXID-eSales/oxideshop_ce
source/Application/Controller/VendorListController.php
VendorListController.getArticleList
public function getArticleList() { if ($this->_aArticleList === null) { $this->_aArticleList = []; if (($oVendor = $this->getActVendor()) && ($oVendor->getId() != 'root')) { list($aArticleList, $iAllArtCnt) = $this->_loadArticles($oVendor); if ($iAllArtCnt) { $this->_aArticleList = $aArticleList; } } } return $this->_aArticleList; }
php
public function getArticleList() { if ($this->_aArticleList === null) { $this->_aArticleList = []; if (($oVendor = $this->getActVendor()) && ($oVendor->getId() != 'root')) { list($aArticleList, $iAllArtCnt) = $this->_loadArticles($oVendor); if ($iAllArtCnt) { $this->_aArticleList = $aArticleList; } } } return $this->_aArticleList; }
[ "public", "function", "getArticleList", "(", ")", "{", "if", "(", "$", "this", "->", "_aArticleList", "===", "null", ")", "{", "$", "this", "->", "_aArticleList", "=", "[", "]", ";", "if", "(", "(", "$", "oVendor", "=", "$", "this", "->", "getActVend...
Get vendor article list @return array
[ "Get", "vendor", "article", "list" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/VendorListController.php#L249-L262
train
OXID-eSales/oxideshop_ce
source/Application/Controller/VendorListController.php
VendorListController.getTitle
public function getTitle() { if ($this->_sCatTitle === null) { $this->_sCatTitle = ''; if ($oVendor = $this->getActVendor()) { $this->_sCatTitle = $oVendor->oxvendor__oxtitle->value; } } return $this->_sCatTitle; }
php
public function getTitle() { if ($this->_sCatTitle === null) { $this->_sCatTitle = ''; if ($oVendor = $this->getActVendor()) { $this->_sCatTitle = $oVendor->oxvendor__oxtitle->value; } } return $this->_sCatTitle; }
[ "public", "function", "getTitle", "(", ")", "{", "if", "(", "$", "this", "->", "_sCatTitle", "===", "null", ")", "{", "$", "this", "->", "_sCatTitle", "=", "''", ";", "if", "(", "$", "oVendor", "=", "$", "this", "->", "getActVendor", "(", ")", ")",...
Return vendor title @return string
[ "Return", "vendor", "title" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/VendorListController.php#L269-L279
train
OXID-eSales/oxideshop_ce
source/Application/Controller/VendorListController.php
VendorListController.getActiveCategory
public function getActiveCategory() { if ($this->_oActCategory === null) { $this->_oActCategory = false; if (($this->_getVendorId() && $oVendorTree = $this->getVendorTree())) { if ($oVendor = $this->getActVendor()) { $this->_oActCategory = $oVendor; } } } return $this->_oActCategory; }
php
public function getActiveCategory() { if ($this->_oActCategory === null) { $this->_oActCategory = false; if (($this->_getVendorId() && $oVendorTree = $this->getVendorTree())) { if ($oVendor = $this->getActVendor()) { $this->_oActCategory = $oVendor; } } } return $this->_oActCategory; }
[ "public", "function", "getActiveCategory", "(", ")", "{", "if", "(", "$", "this", "->", "_oActCategory", "===", "null", ")", "{", "$", "this", "->", "_oActCategory", "=", "false", ";", "if", "(", "(", "$", "this", "->", "_getVendorId", "(", ")", "&&", ...
Template variable getter. Returns active vendor @return object
[ "Template", "variable", "getter", ".", "Returns", "active", "vendor" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/VendorListController.php#L308-L320
train
OXID-eSales/oxideshop_ce
source/Application/Controller/VendorListController.php
VendorListController.getVendorTree
public function getVendorTree() { if ($this->_getVendorId() && $this->_oVendorTree === null) { /** @var \OxidEsales\Eshop\Application\Model\VendorList $oVendorTree */ $oVendorTree = oxNew(\OxidEsales\Eshop\Application\Model\VendorList::class); $oVendorTree->buildVendorTree( 'vendorlist', $this->getActVendor()->getId(), \OxidEsales\Eshop\Core\Registry::getConfig()->getShopHomeUrl() ); $this->_oVendorTree = $oVendorTree; } return $this->_oVendorTree; }
php
public function getVendorTree() { if ($this->_getVendorId() && $this->_oVendorTree === null) { /** @var \OxidEsales\Eshop\Application\Model\VendorList $oVendorTree */ $oVendorTree = oxNew(\OxidEsales\Eshop\Application\Model\VendorList::class); $oVendorTree->buildVendorTree( 'vendorlist', $this->getActVendor()->getId(), \OxidEsales\Eshop\Core\Registry::getConfig()->getShopHomeUrl() ); $this->_oVendorTree = $oVendorTree; } return $this->_oVendorTree; }
[ "public", "function", "getVendorTree", "(", ")", "{", "if", "(", "$", "this", "->", "_getVendorId", "(", ")", "&&", "$", "this", "->", "_oVendorTree", "===", "null", ")", "{", "/** @var \\OxidEsales\\Eshop\\Application\\Model\\VendorList $oVendorTree */", "$", "oVen...
Returns vendor tree @return \OxidEsales\Eshop\Application\Model\VendorList
[ "Returns", "vendor", "tree" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/VendorListController.php#L439-L453
train
OXID-eSales/oxideshop_ce
source/Core/Model/BaseModel.php
BaseModel.oxClone
public function oxClone($object) { $classVariables = get_object_vars($object); foreach ($classVariables as $name => $value) { if (is_object($object->$name)) { $this->$name = clone $object->$name; } else { $this->$name = $object->$name; } } }
php
public function oxClone($object) { $classVariables = get_object_vars($object); foreach ($classVariables as $name => $value) { if (is_object($object->$name)) { $this->$name = clone $object->$name; } else { $this->$name = $object->$name; } } }
[ "public", "function", "oxClone", "(", "$", "object", ")", "{", "$", "classVariables", "=", "get_object_vars", "(", "$", "object", ")", ";", "foreach", "(", "$", "classVariables", "as", "$", "name", "=>", "$", "value", ")", "{", "if", "(", "is_object", ...
Clone this object - similar to Copy Constructor. @param object $object Object to copy
[ "Clone", "this", "object", "-", "similar", "to", "Copy", "Constructor", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Model/BaseModel.php#L386-L396
train
OXID-eSales/oxideshop_ce
source/Core/Model/BaseModel.php
BaseModel._setUpdateSeoOnFieldChange
protected function _setUpdateSeoOnFieldChange($fieldName) { if ($this->getId() && in_array($fieldName, $this->getFieldNames())) { $database = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(); $tableName = $this->getCoreTableName(); $quotedOxid = $database->quote($this->getId()); $title = $database->getOne("select `{$fieldName}` from `{$tableName}` where `oxid` = {$quotedOxid}"); $fieldValue = "{$tableName}__{$fieldName}"; $currentTime = $this->$fieldValue->value; if ($title == $currentTime) { $this->setUpdateSeo(false); } } }
php
protected function _setUpdateSeoOnFieldChange($fieldName) { if ($this->getId() && in_array($fieldName, $this->getFieldNames())) { $database = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(); $tableName = $this->getCoreTableName(); $quotedOxid = $database->quote($this->getId()); $title = $database->getOne("select `{$fieldName}` from `{$tableName}` where `oxid` = {$quotedOxid}"); $fieldValue = "{$tableName}__{$fieldName}"; $currentTime = $this->$fieldValue->value; if ($title == $currentTime) { $this->setUpdateSeo(false); } } }
[ "protected", "function", "_setUpdateSeoOnFieldChange", "(", "$", "fieldName", ")", "{", "if", "(", "$", "this", "->", "getId", "(", ")", "&&", "in_array", "(", "$", "fieldName", ",", "$", "this", "->", "getFieldNames", "(", ")", ")", ")", "{", "$", "da...
Checks whether certain field has changed, and sets update seo flag if needed. It can only set the value to false, so it allows for multiple calls to the method, and if atleast one requires seo update, other checks won't override that. @param string $fieldName Field name that will be checked
[ "Checks", "whether", "certain", "field", "has", "changed", "and", "sets", "update", "seo", "flag", "if", "needed", ".", "It", "can", "only", "set", "the", "value", "to", "false", "so", "it", "allows", "for", "multiple", "calls", "to", "the", "method", "a...
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Model/BaseModel.php#L425-L439
train
OXID-eSales/oxideshop_ce
source/Core/Model/BaseModel.php
BaseModel.init
public function init($tableName = null, $forceAllFields = false) { if ($tableName) { $this->_sCoreTable = $tableName; } // reset view table $this->_sViewTable = false; if (count($this->_aFieldNames) <= 1) { $this->_initDataStructure($forceAllFields); } }
php
public function init($tableName = null, $forceAllFields = false) { if ($tableName) { $this->_sCoreTable = $tableName; } // reset view table $this->_sViewTable = false; if (count($this->_aFieldNames) <= 1) { $this->_initDataStructure($forceAllFields); } }
[ "public", "function", "init", "(", "$", "tableName", "=", "null", ",", "$", "forceAllFields", "=", "false", ")", "{", "if", "(", "$", "tableName", ")", "{", "$", "this", "->", "_sCoreTable", "=", "$", "tableName", ";", "}", "// reset view table", "$", ...
Sets the names to main and view tables, loads metadata of each table. @param string $tableName Name of DB object table @param bool $forceAllFields Forces initialisation of all fields overriding lazy loading functionality
[ "Sets", "the", "names", "to", "main", "and", "view", "tables", "loads", "metadata", "of", "each", "table", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Model/BaseModel.php#L447-L459
train
OXID-eSales/oxideshop_ce
source/Core/Model/BaseModel.php
BaseModel.assign
public function assign($dbRecord) { if (!is_array($dbRecord)) { return; } foreach ($dbRecord as $name => $value) { $this->_setFieldData($name, $value); } $oxidField = $this->_getFieldLongName('oxid'); if ($this->$oxidField instanceof Field) { $this->_sOXID = $this->$oxidField->value; } }
php
public function assign($dbRecord) { if (!is_array($dbRecord)) { return; } foreach ($dbRecord as $name => $value) { $this->_setFieldData($name, $value); } $oxidField = $this->_getFieldLongName('oxid'); if ($this->$oxidField instanceof Field) { $this->_sOXID = $this->$oxidField->value; } }
[ "public", "function", "assign", "(", "$", "dbRecord", ")", "{", "if", "(", "!", "is_array", "(", "$", "dbRecord", ")", ")", "{", "return", ";", "}", "foreach", "(", "$", "dbRecord", "as", "$", "name", "=>", "$", "value", ")", "{", "$", "this", "-...
Assigns DB field values to object fields. Returns true on success. @param array $dbRecord Associative data values array @return null
[ "Assigns", "DB", "field", "values", "to", "object", "fields", ".", "Returns", "true", "on", "success", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Model/BaseModel.php#L468-L482
train
OXID-eSales/oxideshop_ce
source/Core/Model/BaseModel.php
BaseModel.setId
public function setId($oxid = null) { if ($oxid) { $this->_sOXID = $oxid; } else { if ($this->getCoreTableName() == 'oxobject2category') { $objectId = $this->oxobject2category__oxobjectid; $categoryId = $this->oxobject2category__oxcatnid; $shopID = $this->oxobject2category__oxshopid; $this->_sOXID = md5($objectId . $categoryId . $shopID); } else { $this->_sOXID = \OxidEsales\Eshop\Core\Registry::getUtilsObject()->generateUID(); } } $idFieldName = $this->getCoreTableName() . '__oxid'; $this->$idFieldName = new Field($this->_sOXID, Field::T_RAW); return $this->_sOXID; }
php
public function setId($oxid = null) { if ($oxid) { $this->_sOXID = $oxid; } else { if ($this->getCoreTableName() == 'oxobject2category') { $objectId = $this->oxobject2category__oxobjectid; $categoryId = $this->oxobject2category__oxcatnid; $shopID = $this->oxobject2category__oxshopid; $this->_sOXID = md5($objectId . $categoryId . $shopID); } else { $this->_sOXID = \OxidEsales\Eshop\Core\Registry::getUtilsObject()->generateUID(); } } $idFieldName = $this->getCoreTableName() . '__oxid'; $this->$idFieldName = new Field($this->_sOXID, Field::T_RAW); return $this->_sOXID; }
[ "public", "function", "setId", "(", "$", "oxid", "=", "null", ")", "{", "if", "(", "$", "oxid", ")", "{", "$", "this", "->", "_sOXID", "=", "$", "oxid", ";", "}", "else", "{", "if", "(", "$", "this", "->", "getCoreTableName", "(", ")", "==", "'...
Sets unique object id @param string $oxid Record ID @return string
[ "Sets", "unique", "object", "id" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Model/BaseModel.php#L521-L540
train
OXID-eSales/oxideshop_ce
source/Core/Model/BaseModel.php
BaseModel.assignRecord
public function assignRecord($select) { $record = $this->getRecordByQuery($select); if ($record != false && $record->count() > 0) { $this->assign($record->fields); return true; } return false; }
php
public function assignRecord($select) { $record = $this->getRecordByQuery($select); if ($record != false && $record->count() > 0) { $this->assign($record->fields); return true; } return false; }
[ "public", "function", "assignRecord", "(", "$", "select", ")", "{", "$", "record", "=", "$", "this", "->", "getRecordByQuery", "(", "$", "select", ")", ";", "if", "(", "$", "record", "!=", "false", "&&", "$", "record", "->", "count", "(", ")", ">", ...
Performs SQL query, assigns record field values to object. Returns true on success. @param string $select SQL statement @return bool
[ "Performs", "SQL", "query", "assigns", "record", "field", "values", "to", "object", ".", "Returns", "true", "on", "success", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Model/BaseModel.php#L720-L730
train
OXID-eSales/oxideshop_ce
source/Core/Model/BaseModel.php
BaseModel.getSelectFields
public function getSelectFields($forceCoreTableUsage = null) { $selectFields = []; $viewName = $this->getViewName($forceCoreTableUsage); foreach ($this->_aFieldNames as $key => $field) { if ($viewName) { $selectFields[] = "`$viewName`.`$key`"; } else { $selectFields[] = ".`$key`"; } } return implode(', ', $selectFields); }
php
public function getSelectFields($forceCoreTableUsage = null) { $selectFields = []; $viewName = $this->getViewName($forceCoreTableUsage); foreach ($this->_aFieldNames as $key => $field) { if ($viewName) { $selectFields[] = "`$viewName`.`$key`"; } else { $selectFields[] = ".`$key`"; } } return implode(', ', $selectFields); }
[ "public", "function", "getSelectFields", "(", "$", "forceCoreTableUsage", "=", "null", ")", "{", "$", "selectFields", "=", "[", "]", ";", "$", "viewName", "=", "$", "this", "->", "getViewName", "(", "$", "forceCoreTableUsage", ")", ";", "foreach", "(", "$"...
Function builds the field list used in select. @param bool $forceCoreTableUsage (optional) use core views @return string
[ "Function", "builds", "the", "field", "list", "used", "in", "select", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Model/BaseModel.php#L765-L780
train
OXID-eSales/oxideshop_ce
source/Core/Model/BaseModel.php
BaseModel.exists
public function exists($oxid = null) { if (!$oxid) { $oxid = $this->getId(); } if (!$oxid) { return false; } $viewName = $this->getCoreTableName(); $database = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC); $query = "select {$this->_sExistKey} from {$viewName} where {$this->_sExistKey} = " . $database->quote($oxid); return ( bool ) $database->getOne($query); }
php
public function exists($oxid = null) { if (!$oxid) { $oxid = $this->getId(); } if (!$oxid) { return false; } $viewName = $this->getCoreTableName(); $database = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC); $query = "select {$this->_sExistKey} from {$viewName} where {$this->_sExistKey} = " . $database->quote($oxid); return ( bool ) $database->getOne($query); }
[ "public", "function", "exists", "(", "$", "oxid", "=", "null", ")", "{", "if", "(", "!", "$", "oxid", ")", "{", "$", "oxid", "=", "$", "this", "->", "getId", "(", ")", ";", "}", "if", "(", "!", "$", "oxid", ")", "{", "return", "false", ";", ...
Checks if this object exists, returns true on success. @param string $oxid Object ID(default null) @return bool
[ "Checks", "if", "this", "object", "exists", "returns", "true", "on", "success", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Model/BaseModel.php#L901-L915
train
OXID-eSales/oxideshop_ce
source/Core/Model/BaseModel.php
BaseModel._addField
protected function _addField($fieldName, $fieldStatus, $type = null, $length = null) { //preparation $fieldName = strtolower($fieldName); //adding field names element $this->_aFieldNames[$fieldName] = $fieldStatus; //already set? $fieldLongName = $this->_getFieldLongName($fieldName); if ($this->isPropertyLoaded($fieldLongName)) { return; } //defining the field $field = false; if (isset($type)) { $field = new Field(); $field->fldtype = $type; //T2008-01-29 //can't clone as the fields are objects and are not fully cloned $this->_blIsSimplyClonable = false; } if (isset($length)) { if (!$field) { $field = new Field(); } $field->fldmax_length = $length; $this->_blIsSimplyClonable = false; } $this->$fieldLongName = $field; }
php
protected function _addField($fieldName, $fieldStatus, $type = null, $length = null) { //preparation $fieldName = strtolower($fieldName); //adding field names element $this->_aFieldNames[$fieldName] = $fieldStatus; //already set? $fieldLongName = $this->_getFieldLongName($fieldName); if ($this->isPropertyLoaded($fieldLongName)) { return; } //defining the field $field = false; if (isset($type)) { $field = new Field(); $field->fldtype = $type; //T2008-01-29 //can't clone as the fields are objects and are not fully cloned $this->_blIsSimplyClonable = false; } if (isset($length)) { if (!$field) { $field = new Field(); } $field->fldmax_length = $length; $this->_blIsSimplyClonable = false; } $this->$fieldLongName = $field; }
[ "protected", "function", "_addField", "(", "$", "fieldName", ",", "$", "fieldStatus", ",", "$", "type", "=", "null", ",", "$", "length", "=", "null", ")", "{", "//preparation", "$", "fieldName", "=", "strtolower", "(", "$", "fieldName", ")", ";", "//addi...
Adds additional field to meta structure @param string $fieldName Field name @param int $fieldStatus Field name status. In derived classes it indicates multi language status. @param string $type Field type @param string $length Field Length @return null
[ "Adds", "additional", "field", "to", "meta", "structure" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Model/BaseModel.php#L1171-L1205
train
OXID-eSales/oxideshop_ce
source/Core/Model/BaseModel.php
BaseModel._canFieldBeNull
protected function _canFieldBeNull($fieldName) { $metaData = $this->_getAllFields(); foreach ($metaData as $metaInfo) { if (strcasecmp($metaInfo->name, $fieldName) == 0) { return !$metaInfo->not_null; } } return false; }
php
protected function _canFieldBeNull($fieldName) { $metaData = $this->_getAllFields(); foreach ($metaData as $metaInfo) { if (strcasecmp($metaInfo->name, $fieldName) == 0) { return !$metaInfo->not_null; } } return false; }
[ "protected", "function", "_canFieldBeNull", "(", "$", "fieldName", ")", "{", "$", "metaData", "=", "$", "this", "->", "_getAllFields", "(", ")", ";", "foreach", "(", "$", "metaData", "as", "$", "metaInfo", ")", "{", "if", "(", "strcasecmp", "(", "$", "...
check if db field can be null @param string $fieldName db field name @return bool
[ "check", "if", "db", "field", "can", "be", "null" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Model/BaseModel.php#L1278-L1288
train
OXID-eSales/oxideshop_ce
source/Core/Model/BaseModel.php
BaseModel._getFieldDefaultValue
protected function _getFieldDefaultValue($fieldName) { $metaData = $this->_getAllFields(); foreach ($metaData as $metaInfo) { if (strcasecmp($metaInfo->name, $fieldName) == 0) { return property_exists($metaInfo, 'default_value') ? $metaInfo->default_value : null; } } return false; }
php
protected function _getFieldDefaultValue($fieldName) { $metaData = $this->_getAllFields(); foreach ($metaData as $metaInfo) { if (strcasecmp($metaInfo->name, $fieldName) == 0) { return property_exists($metaInfo, 'default_value') ? $metaInfo->default_value : null; } } return false; }
[ "protected", "function", "_getFieldDefaultValue", "(", "$", "fieldName", ")", "{", "$", "metaData", "=", "$", "this", "->", "_getAllFields", "(", ")", ";", "foreach", "(", "$", "metaData", "as", "$", "metaInfo", ")", "{", "if", "(", "strcasecmp", "(", "$...
returns default field value @param string $fieldName db field name @return mixed
[ "returns", "default", "field", "value" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Model/BaseModel.php#L1297-L1307
train
OXID-eSales/oxideshop_ce
source/Core/Model/BaseModel.php
BaseModel._getUpdateFieldValue
protected function _getUpdateFieldValue($fieldName, $field) { $fieldValue = null; if ($field instanceof Field) { $fieldValue = $field->getRawValue(); } elseif (isset($field->value)) { $fieldValue = $field->value; } $database = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(); //Check if this field value is null AND it can be null according if not returning default value if ((null === $fieldValue)) { if ($this->_canFieldBeNull($fieldName)) { return 'null'; } elseif ($fieldValue = $this->_getFieldDefaultValue($fieldName)) { return $database->quote($fieldValue); } } return $database->quote($fieldValue); }
php
protected function _getUpdateFieldValue($fieldName, $field) { $fieldValue = null; if ($field instanceof Field) { $fieldValue = $field->getRawValue(); } elseif (isset($field->value)) { $fieldValue = $field->value; } $database = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(); //Check if this field value is null AND it can be null according if not returning default value if ((null === $fieldValue)) { if ($this->_canFieldBeNull($fieldName)) { return 'null'; } elseif ($fieldValue = $this->_getFieldDefaultValue($fieldName)) { return $database->quote($fieldValue); } } return $database->quote($fieldValue); }
[ "protected", "function", "_getUpdateFieldValue", "(", "$", "fieldName", ",", "$", "field", ")", "{", "$", "fieldValue", "=", "null", ";", "if", "(", "$", "field", "instanceof", "Field", ")", "{", "$", "fieldValue", "=", "$", "field", "->", "getRawValue", ...
returns quoted field value for using in update statement @param string $fieldName name of field @param Field $field field object @return string
[ "returns", "quoted", "field", "value", "for", "using", "in", "update", "statement" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Model/BaseModel.php#L1317-L1337
train
OXID-eSales/oxideshop_ce
source/Core/Model/BaseModel.php
BaseModel._update
protected function _update() { //do not allow derived item update if (!$this->allowDerivedUpdate()) { return false; } if (!$this->getId()) { $exception = oxNew(\OxidEsales\Eshop\Core\Exception\ObjectException::class); $exception->setMessage('EXCEPTION_OBJECT_OXIDNOTSET'); $exception->setObject($this); throw $exception; } $coreTableName = $this->getCoreTableName(); $idKey = \OxidEsales\Eshop\Core\Registry::getUtils()->getArrFldName($coreTableName . '.oxid'); $this->$idKey = new Field($this->getId(), Field::T_RAW); $database = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(); $updateQuery = "update {$coreTableName} set " . $this->_getUpdateFields() . " where {$coreTableName}.oxid = " . $database->quote($this->getId()); $this->beforeUpdate(); $this->executeDatabaseQuery($updateQuery); return true; }
php
protected function _update() { //do not allow derived item update if (!$this->allowDerivedUpdate()) { return false; } if (!$this->getId()) { $exception = oxNew(\OxidEsales\Eshop\Core\Exception\ObjectException::class); $exception->setMessage('EXCEPTION_OBJECT_OXIDNOTSET'); $exception->setObject($this); throw $exception; } $coreTableName = $this->getCoreTableName(); $idKey = \OxidEsales\Eshop\Core\Registry::getUtils()->getArrFldName($coreTableName . '.oxid'); $this->$idKey = new Field($this->getId(), Field::T_RAW); $database = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(); $updateQuery = "update {$coreTableName} set " . $this->_getUpdateFields() . " where {$coreTableName}.oxid = " . $database->quote($this->getId()); $this->beforeUpdate(); $this->executeDatabaseQuery($updateQuery); return true; }
[ "protected", "function", "_update", "(", ")", "{", "//do not allow derived item update", "if", "(", "!", "$", "this", "->", "allowDerivedUpdate", "(", ")", ")", "{", "return", "false", ";", "}", "if", "(", "!", "$", "this", "->", "getId", "(", ")", ")", ...
Update this Object into the database, this function only works on the main table, it will not save any dependent tables, which might be loaded through oxList. @throws oxObjectException Throws on failure inserting @throws DatabaseException On database errors @return bool Will always return true. On failure an exception is thrown.
[ "Update", "this", "Object", "into", "the", "database", "this", "function", "only", "works", "on", "the", "main", "table", "it", "will", "not", "save", "any", "dependent", "tables", "which", "might", "be", "loaded", "through", "oxList", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Model/BaseModel.php#L1391-L1417
train
OXID-eSales/oxideshop_ce
source/Core/Model/BaseModel.php
BaseModel._insert
protected function _insert() { $myConfig = \OxidEsales\Eshop\Core\Registry::getConfig(); $myUtils = \OxidEsales\Eshop\Core\Registry::getUtils(); // let's get a new ID if (!$this->getId()) { $this->setId(); } $idKey = $myUtils->getArrFldName($this->getCoreTableName() . '.oxid'); $this->$idKey = new Field($this->getId(), Field::T_RAW); $insertSql = "Insert into {$this->getCoreTableName()} set "; $shopIdField = $myUtils->getArrFldName($this->getCoreTableName() . '.oxshopid'); if ($this->isPropertyLoaded($shopIdField) && (!$this->isPropertyField($shopIdField) || !$this->$shopIdField->value) ) { $this->$shopIdField = new Field( $myConfig->getShopId(), Field::T_RAW ); } $insertSql .= $this->_getUpdateFields($this->getUseSkipSaveFields()); return $result = (bool) $this->executeDatabaseQuery($insertSql); }
php
protected function _insert() { $myConfig = \OxidEsales\Eshop\Core\Registry::getConfig(); $myUtils = \OxidEsales\Eshop\Core\Registry::getUtils(); // let's get a new ID if (!$this->getId()) { $this->setId(); } $idKey = $myUtils->getArrFldName($this->getCoreTableName() . '.oxid'); $this->$idKey = new Field($this->getId(), Field::T_RAW); $insertSql = "Insert into {$this->getCoreTableName()} set "; $shopIdField = $myUtils->getArrFldName($this->getCoreTableName() . '.oxshopid'); if ($this->isPropertyLoaded($shopIdField) && (!$this->isPropertyField($shopIdField) || !$this->$shopIdField->value) ) { $this->$shopIdField = new Field( $myConfig->getShopId(), Field::T_RAW ); } $insertSql .= $this->_getUpdateFields($this->getUseSkipSaveFields()); return $result = (bool) $this->executeDatabaseQuery($insertSql); }
[ "protected", "function", "_insert", "(", ")", "{", "$", "myConfig", "=", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "Registry", "::", "getConfig", "(", ")", ";", "$", "myUtils", "=", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "R...
Insert this Object into the database, this function only works on the main table, it will not save any dependent tables, which might be loaded through oxlist. @return bool
[ "Insert", "this", "Object", "into", "the", "database", "this", "function", "only", "works", "on", "the", "main", "table", "it", "will", "not", "save", "any", "dependent", "tables", "which", "might", "be", "loaded", "through", "oxlist", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Model/BaseModel.php#L1440-L1468
train
OXID-eSales/oxideshop_ce
source/Core/Model/BaseModel.php
BaseModel._isDisabledFieldCache
protected function _isDisabledFieldCache() { $class = get_class($this); if (isset(self::$_blDisableFieldCaching[$class]) && self::$_blDisableFieldCaching[$class]) { return true; } return false; }
php
protected function _isDisabledFieldCache() { $class = get_class($this); if (isset(self::$_blDisableFieldCaching[$class]) && self::$_blDisableFieldCaching[$class]) { return true; } return false; }
[ "protected", "function", "_isDisabledFieldCache", "(", ")", "{", "$", "class", "=", "get_class", "(", "$", "this", ")", ";", "if", "(", "isset", "(", "self", "::", "$", "_blDisableFieldCaching", "[", "$", "class", "]", ")", "&&", "self", "::", "$", "_b...
Checks if current class disables field caching. This method is primary used in unit tests. @return bool
[ "Checks", "if", "current", "class", "disables", "field", "caching", ".", "This", "method", "is", "primary", "used", "in", "unit", "tests", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Model/BaseModel.php#L1476-L1484
train
OXID-eSales/oxideshop_ce
source/Core/Model/BaseModel.php
BaseModel.getFieldNames
public function getFieldNames() { $fieldNames = $this->_aFieldNames; if (!$this->isAdmin() && $this->_blUseLazyLoading) { $fieldNames = $this->_getNonCachedFieldNames(true); } return array_keys($fieldNames); }
php
public function getFieldNames() { $fieldNames = $this->_aFieldNames; if (!$this->isAdmin() && $this->_blUseLazyLoading) { $fieldNames = $this->_getNonCachedFieldNames(true); } return array_keys($fieldNames); }
[ "public", "function", "getFieldNames", "(", ")", "{", "$", "fieldNames", "=", "$", "this", "->", "_aFieldNames", ";", "if", "(", "!", "$", "this", "->", "isAdmin", "(", ")", "&&", "$", "this", "->", "_blUseLazyLoading", ")", "{", "$", "fieldNames", "="...
Returns array with object field names @return array
[ "Returns", "array", "with", "object", "field", "names" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Model/BaseModel.php#L1540-L1549
train
OXID-eSales/oxideshop_ce
source/Core/ViewHelper/JavaScriptRegistrator.php
JavaScriptRegistrator.addSnippet
public function addSnippet($script, $isDynamic = false) { $config = \OxidEsales\Eshop\Core\Registry::getConfig(); $suffix = $isDynamic ? '_dynamic' : ''; $scriptsParameterName = static::SNIPPETS_PARAMETER_NAME . $suffix; $scripts = (array) $config->getGlobalParameter($scriptsParameterName); $script = trim($script); if (!in_array($script, $scripts)) { $scripts[] = $script; } $config->setGlobalParameter($scriptsParameterName, $scripts); }
php
public function addSnippet($script, $isDynamic = false) { $config = \OxidEsales\Eshop\Core\Registry::getConfig(); $suffix = $isDynamic ? '_dynamic' : ''; $scriptsParameterName = static::SNIPPETS_PARAMETER_NAME . $suffix; $scripts = (array) $config->getGlobalParameter($scriptsParameterName); $script = trim($script); if (!in_array($script, $scripts)) { $scripts[] = $script; } $config->setGlobalParameter($scriptsParameterName, $scripts); }
[ "public", "function", "addSnippet", "(", "$", "script", ",", "$", "isDynamic", "=", "false", ")", "{", "$", "config", "=", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "Registry", "::", "getConfig", "(", ")", ";", "$", "suffix", "=", "$", "...
Register JavaScript code snippet for rendering. @param string $script @param bool $isDynamic
[ "Register", "JavaScript", "code", "snippet", "for", "rendering", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/ViewHelper/JavaScriptRegistrator.php#L23-L34
train
OXID-eSales/oxideshop_ce
source/Core/SubShopSpecificFileCache.php
SubShopSpecificFileCache.getCacheFileName
protected function getCacheFileName($key) { $name = strtolower(basename($key)); $shopId = strtolower(basename($this->getShopIdCalculator()->getShopId())); return parent::CACHE_FILE_PREFIX . ".$shopId.$name.txt"; }
php
protected function getCacheFileName($key) { $name = strtolower(basename($key)); $shopId = strtolower(basename($this->getShopIdCalculator()->getShopId())); return parent::CACHE_FILE_PREFIX . ".$shopId.$name.txt"; }
[ "protected", "function", "getCacheFileName", "(", "$", "key", ")", "{", "$", "name", "=", "strtolower", "(", "basename", "(", "$", "key", ")", ")", ";", "$", "shopId", "=", "strtolower", "(", "basename", "(", "$", "this", "->", "getShopIdCalculator", "("...
Returns shopId which should be used for cache file name generation. @param string $key @return string
[ "Returns", "shopId", "which", "should", "be", "used", "for", "cache", "file", "name", "generation", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/SubShopSpecificFileCache.php#L35-L41
train
OXID-eSales/oxideshop_ce
source/Application/Controller/Admin/DeliverySetPaymentAjax.php
DeliverySetPaymentAjax.addPayToSet
public function addPayToSet() { $aChosenSets = $this->_getActionIds('oxpayments.oxid'); $soxId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('synchoxid'); // adding if (\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('all')) { $sPayTable = $this->_getViewName('oxpayments'); $aChosenSets = $this->_getAll($this->_addFilter("select $sPayTable.oxid " . $this->_getQuery())); } if ($soxId && $soxId != "-1" && is_array($aChosenSets)) { // 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 ($aChosenSets as $sChosenSet) { // check if we have this entry already in // We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804). $sID = $database->getOne("select oxid from oxobject2payment where oxpaymentid = " . $database->quote($sChosenSet) . " and oxobjectid = " . $database->quote($soxId) . " and oxtype = 'oxdelset'"); if (!isset($sID) || !$sID) { $oObject = oxNew(\OxidEsales\Eshop\Core\Model\BaseModel::class); $oObject->init('oxobject2payment'); $oObject->oxobject2payment__oxpaymentid = new \OxidEsales\Eshop\Core\Field($sChosenSet); $oObject->oxobject2payment__oxobjectid = new \OxidEsales\Eshop\Core\Field($soxId); $oObject->oxobject2payment__oxtype = new \OxidEsales\Eshop\Core\Field("oxdelset"); $oObject->save(); } } } }
php
public function addPayToSet() { $aChosenSets = $this->_getActionIds('oxpayments.oxid'); $soxId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('synchoxid'); // adding if (\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('all')) { $sPayTable = $this->_getViewName('oxpayments'); $aChosenSets = $this->_getAll($this->_addFilter("select $sPayTable.oxid " . $this->_getQuery())); } if ($soxId && $soxId != "-1" && is_array($aChosenSets)) { // 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 ($aChosenSets as $sChosenSet) { // check if we have this entry already in // We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804). $sID = $database->getOne("select oxid from oxobject2payment where oxpaymentid = " . $database->quote($sChosenSet) . " and oxobjectid = " . $database->quote($soxId) . " and oxtype = 'oxdelset'"); if (!isset($sID) || !$sID) { $oObject = oxNew(\OxidEsales\Eshop\Core\Model\BaseModel::class); $oObject->init('oxobject2payment'); $oObject->oxobject2payment__oxpaymentid = new \OxidEsales\Eshop\Core\Field($sChosenSet); $oObject->oxobject2payment__oxobjectid = new \OxidEsales\Eshop\Core\Field($soxId); $oObject->oxobject2payment__oxtype = new \OxidEsales\Eshop\Core\Field("oxdelset"); $oObject->save(); } } } }
[ "public", "function", "addPayToSet", "(", ")", "{", "$", "aChosenSets", "=", "$", "this", "->", "_getActionIds", "(", "'oxpayments.oxid'", ")", ";", "$", "soxId", "=", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "Registry", "::", "getConfig", "(...
Adds this payments to this set @throws Exception
[ "Adds", "this", "payments", "to", "this", "set" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/DeliverySetPaymentAjax.php#L86-L113
train
OXID-eSales/oxideshop_ce
source/Application/Controller/Admin/DeliverySetUsersAjax.php
DeliverySetUsersAjax.addUserToSet
public function addUserToSet() { $aChosenUsr = $this->_getActionIds('oxuser.oxid'); $soxId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('synchoxid'); // adding if (\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('all')) { $sUserTable = $this->_getViewName('oxuser'); $aChosenUsr = $this->_getAll($this->_addFilter("select $sUserTable.oxid " . $this->_getQuery())); } if ($soxId && $soxId != "-1" && is_array($aChosenUsr)) { foreach ($aChosenUsr as $sChosenUsr) { $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($sChosenUsr); $oObject2Delivery->oxobject2delivery__oxtype = new \OxidEsales\Eshop\Core\Field("oxdelsetu"); $oObject2Delivery->save(); } } }
php
public function addUserToSet() { $aChosenUsr = $this->_getActionIds('oxuser.oxid'); $soxId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('synchoxid'); // adding if (\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('all')) { $sUserTable = $this->_getViewName('oxuser'); $aChosenUsr = $this->_getAll($this->_addFilter("select $sUserTable.oxid " . $this->_getQuery())); } if ($soxId && $soxId != "-1" && is_array($aChosenUsr)) { foreach ($aChosenUsr as $sChosenUsr) { $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($sChosenUsr); $oObject2Delivery->oxobject2delivery__oxtype = new \OxidEsales\Eshop\Core\Field("oxdelsetu"); $oObject2Delivery->save(); } } }
[ "public", "function", "addUserToSet", "(", ")", "{", "$", "aChosenUsr", "=", "$", "this", "->", "_getActionIds", "(", "'oxuser.oxid'", ")", ";", "$", "soxId", "=", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "Registry", "::", "getConfig", "(", ...
Adds users for delivery sets config
[ "Adds", "users", "for", "delivery", "sets", "config" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/DeliverySetUsersAjax.php#L111-L131
train
OXID-eSales/oxideshop_ce
source/Application/Model/Category.php
Category.load
public function load($sOXID) { $aData = $this->_loadFromDb($sOXID); if ($aData) { $this->assign($aData); $this->_isLoaded = true; return true; } return false; }
php
public function load($sOXID) { $aData = $this->_loadFromDb($sOXID); if ($aData) { $this->assign($aData); $this->_isLoaded = true; return true; } return false; }
[ "public", "function", "load", "(", "$", "sOXID", ")", "{", "$", "aData", "=", "$", "this", "->", "_loadFromDb", "(", "$", "sOXID", ")", ";", "if", "(", "$", "aData", ")", "{", "$", "this", "->", "assign", "(", "$", "aData", ")", ";", "$", "this...
Load category data @param string $sOXID id @return bool
[ "Load", "category", "data" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Category.php#L229-L240
train
OXID-eSales/oxideshop_ce
source/Application/Model/Category.php
Category.assign
public function assign($dbRecord) { $this->_iNrOfArticles = null; //clear seo urls $this->_aSeoUrls = []; return parent::assign($dbRecord); }
php
public function assign($dbRecord) { $this->_iNrOfArticles = null; //clear seo urls $this->_aSeoUrls = []; return parent::assign($dbRecord); }
[ "public", "function", "assign", "(", "$", "dbRecord", ")", "{", "$", "this", "->", "_iNrOfArticles", "=", "null", ";", "//clear seo urls", "$", "this", "->", "_aSeoUrls", "=", "[", "]", ";", "return", "parent", "::", "assign", "(", "$", "dbRecord", ")", ...
Loads and assigns object data from DB. @param mixed $dbRecord database record array @return null
[ "Loads", "and", "assigns", "object", "data", "from", "DB", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Category.php#L249-L257
train
OXID-eSales/oxideshop_ce
source/Application/Model/Category.php
Category.delete
public function delete($sOXID = null) { if (!$this->getId()) { $this->load($sOXID); } $sOXID = isset($sOXID) ? $sOXID : $this->getId(); $myConfig = \OxidEsales\Eshop\Core\Registry::getConfig(); $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(); $blRet = false; if ($this->oxcategories__oxright->value == ($this->oxcategories__oxleft->value + 1)) { $myUtilsPic = \OxidEsales\Eshop\Core\Registry::getUtilsPic(); $sDir = $myConfig->getPictureDir(false); // only delete empty categories // #1173M - not all pic are deleted, after article is removed $myUtilsPic->safePictureDelete($this->oxcategories__oxthumb->value, $sDir . \OxidEsales\Eshop\Core\Registry::getUtilsFile()->getImageDirByType('TC'), 'oxcategories', 'oxthumb'); $myUtilsPic->safePictureDelete($this->oxcategories__oxicon->value, $sDir . \OxidEsales\Eshop\Core\Registry::getUtilsFile()->getImageDirByType('CICO'), 'oxcategories', 'oxicon'); $myUtilsPic->safePictureDelete($this->oxcategories__oxpromoicon->value, $sDir . \OxidEsales\Eshop\Core\Registry::getUtilsFile()->getImageDirByType('PICO'), 'oxcategories', 'oxpromoicon'); $sAdd = " and oxshopid = '" . $this->getShopId() . "' "; $oDb->execute( "UPDATE oxcategories SET OXLEFT = OXLEFT - 2 WHERE OXROOTID = " . $oDb->quote($this->oxcategories__oxrootid->value) . " AND OXLEFT > " . ((int) $this->oxcategories__oxleft->value) . $sAdd ); $oDb->execute( "UPDATE oxcategories SET OXRIGHT = OXRIGHT - 2 WHERE OXROOTID = " . $oDb->quote($this->oxcategories__oxrootid->value) . " AND OXRIGHT > " . ((int) $this->oxcategories__oxright->value) . $sAdd ); // delete entry $blRet = parent::delete($sOXID); $sOxidQuoted = $oDb->quote($sOXID); // delete links to articles $oDb->execute("delete from oxobject2category where oxobject2category.oxcatnid=$sOxidQuoted "); // #657 ADDITIONAL delete links to attributes $oDb->execute("delete from oxcategory2attribute where oxcategory2attribute.oxobjectid=$sOxidQuoted "); // A. removing assigned: // - deliveries $oDb->execute("delete from oxobject2delivery where oxobject2delivery.oxobjectid=$sOxidQuoted "); // - discounts $oDb->execute("delete from oxobject2discount where oxobject2discount.oxobjectid=$sOxidQuoted "); \OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Application\Model\SeoEncoderCategory::class)->onDeleteCategory($this); } return $blRet; }
php
public function delete($sOXID = null) { if (!$this->getId()) { $this->load($sOXID); } $sOXID = isset($sOXID) ? $sOXID : $this->getId(); $myConfig = \OxidEsales\Eshop\Core\Registry::getConfig(); $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(); $blRet = false; if ($this->oxcategories__oxright->value == ($this->oxcategories__oxleft->value + 1)) { $myUtilsPic = \OxidEsales\Eshop\Core\Registry::getUtilsPic(); $sDir = $myConfig->getPictureDir(false); // only delete empty categories // #1173M - not all pic are deleted, after article is removed $myUtilsPic->safePictureDelete($this->oxcategories__oxthumb->value, $sDir . \OxidEsales\Eshop\Core\Registry::getUtilsFile()->getImageDirByType('TC'), 'oxcategories', 'oxthumb'); $myUtilsPic->safePictureDelete($this->oxcategories__oxicon->value, $sDir . \OxidEsales\Eshop\Core\Registry::getUtilsFile()->getImageDirByType('CICO'), 'oxcategories', 'oxicon'); $myUtilsPic->safePictureDelete($this->oxcategories__oxpromoicon->value, $sDir . \OxidEsales\Eshop\Core\Registry::getUtilsFile()->getImageDirByType('PICO'), 'oxcategories', 'oxpromoicon'); $sAdd = " and oxshopid = '" . $this->getShopId() . "' "; $oDb->execute( "UPDATE oxcategories SET OXLEFT = OXLEFT - 2 WHERE OXROOTID = " . $oDb->quote($this->oxcategories__oxrootid->value) . " AND OXLEFT > " . ((int) $this->oxcategories__oxleft->value) . $sAdd ); $oDb->execute( "UPDATE oxcategories SET OXRIGHT = OXRIGHT - 2 WHERE OXROOTID = " . $oDb->quote($this->oxcategories__oxrootid->value) . " AND OXRIGHT > " . ((int) $this->oxcategories__oxright->value) . $sAdd ); // delete entry $blRet = parent::delete($sOXID); $sOxidQuoted = $oDb->quote($sOXID); // delete links to articles $oDb->execute("delete from oxobject2category where oxobject2category.oxcatnid=$sOxidQuoted "); // #657 ADDITIONAL delete links to attributes $oDb->execute("delete from oxcategory2attribute where oxcategory2attribute.oxobjectid=$sOxidQuoted "); // A. removing assigned: // - deliveries $oDb->execute("delete from oxobject2delivery where oxobject2delivery.oxobjectid=$sOxidQuoted "); // - discounts $oDb->execute("delete from oxobject2discount where oxobject2discount.oxobjectid=$sOxidQuoted "); \OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Application\Model\SeoEncoderCategory::class)->onDeleteCategory($this); } return $blRet; }
[ "public", "function", "delete", "(", "$", "sOXID", "=", "null", ")", "{", "if", "(", "!", "$", "this", "->", "getId", "(", ")", ")", "{", "$", "this", "->", "load", "(", "$", "sOXID", ")", ";", "}", "$", "sOXID", "=", "isset", "(", "$", "sOXI...
Delete empty categories, returns true on success. @param string $sOXID Object ID @return bool
[ "Delete", "empty", "categories", "returns", "true", "on", "success", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Category.php#L266-L322
train
OXID-eSales/oxideshop_ce
source/Application/Model/Category.php
Category.setSubCats
public function setSubCats($aCats) { $this->_aSubCats = $aCats; foreach ($aCats as $oCat) { // keeping ref. to parent $oCat->setParentCategory($this); if ($oCat->getIsVisible()) { $this->setHasVisibleSubCats(true); } } }
php
public function setSubCats($aCats) { $this->_aSubCats = $aCats; foreach ($aCats as $oCat) { // keeping ref. to parent $oCat->setParentCategory($this); if ($oCat->getIsVisible()) { $this->setHasVisibleSubCats(true); } } }
[ "public", "function", "setSubCats", "(", "$", "aCats", ")", "{", "$", "this", "->", "_aSubCats", "=", "$", "aCats", ";", "foreach", "(", "$", "aCats", "as", "$", "oCat", ")", "{", "// keeping ref. to parent", "$", "oCat", "->", "setParentCategory", "(", ...
Sets an array of sub categories, also handles parent hasVisibleSubCats @param array $aCats array of categories
[ "Sets", "an", "array", "of", "sub", "categories", "also", "handles", "parent", "hasVisibleSubCats" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Category.php#L351-L363
train
OXID-eSales/oxideshop_ce
source/Application/Model/Category.php
Category.setSubCat
public function setSubCat($oCat, $sKey = null) { if ($sKey) { $this->_aSubCats[$sKey] = $oCat; } else { $this->_aSubCats[] = $oCat; } // keeping ref. to parent $oCat->setParentCategory($this); if ($oCat->getIsVisible()) { $this->setHasVisibleSubCats(true); } }
php
public function setSubCat($oCat, $sKey = null) { if ($sKey) { $this->_aSubCats[$sKey] = $oCat; } else { $this->_aSubCats[] = $oCat; } // keeping ref. to parent $oCat->setParentCategory($this); if ($oCat->getIsVisible()) { $this->setHasVisibleSubCats(true); } }
[ "public", "function", "setSubCat", "(", "$", "oCat", ",", "$", "sKey", "=", "null", ")", "{", "if", "(", "$", "sKey", ")", "{", "$", "this", "->", "_aSubCats", "[", "$", "sKey", "]", "=", "$", "oCat", ";", "}", "else", "{", "$", "this", "->", ...
sets a single category, handles sorting and parent hasVisibleSubCats @param \OxidEsales\Eshop\Application\Model\Category $oCat the category @param string $sKey (optional, default=null) the key for that category, without a key, the category is just added to the array
[ "sets", "a", "single", "category", "handles", "sorting", "and", "parent", "hasVisibleSubCats" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Category.php#L372-L386
train
OXID-eSales/oxideshop_ce
source/Application/Model/Category.php
Category.setContentCat
public function setContentCat($oContent, $sKey = null) { if ($sKey) { $this->_aContentCats[$sKey] = $oContent; } else { $this->_aContentCats[] = $oContent; } }
php
public function setContentCat($oContent, $sKey = null) { if ($sKey) { $this->_aContentCats[$sKey] = $oContent; } else { $this->_aContentCats[] = $oContent; } }
[ "public", "function", "setContentCat", "(", "$", "oContent", ",", "$", "sKey", "=", "null", ")", "{", "if", "(", "$", "sKey", ")", "{", "$", "this", "->", "_aContentCats", "[", "$", "sKey", "]", "=", "$", "oContent", ";", "}", "else", "{", "$", "...
sets a single category @param \OxidEsales\Eshop\Application\Model\Category $oContent the category @param string $sKey optional, the key for that category, without a key, the category is just added to the array
[ "sets", "a", "single", "category" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Category.php#L415-L422
train
OXID-eSales/oxideshop_ce
source/Application/Model/Category.php
Category.getNrOfArticles
public function getNrOfArticles() { $myConfig = \OxidEsales\Eshop\Core\Registry::getConfig(); if (!isset($this->_iNrOfArticles) && !$this->isAdmin() && ( $myConfig->getConfigParam('bl_perfShowActionCatArticleCnt') || $myConfig->getConfigParam('blDontShowEmptyCategories') ) ) { if ($this->isPriceCategory()) { $this->_iNrOfArticles = \OxidEsales\Eshop\Core\Registry::getUtilsCount()->getPriceCatArticleCount($this->getId(), $this->oxcategories__oxpricefrom->value, $this->oxcategories__oxpriceto->value); } else { $this->_iNrOfArticles = \OxidEsales\Eshop\Core\Registry::getUtilsCount()->getCatArticleCount($this->getId()); } } return (int) $this->_iNrOfArticles; }
php
public function getNrOfArticles() { $myConfig = \OxidEsales\Eshop\Core\Registry::getConfig(); if (!isset($this->_iNrOfArticles) && !$this->isAdmin() && ( $myConfig->getConfigParam('bl_perfShowActionCatArticleCnt') || $myConfig->getConfigParam('blDontShowEmptyCategories') ) ) { if ($this->isPriceCategory()) { $this->_iNrOfArticles = \OxidEsales\Eshop\Core\Registry::getUtilsCount()->getPriceCatArticleCount($this->getId(), $this->oxcategories__oxpricefrom->value, $this->oxcategories__oxpriceto->value); } else { $this->_iNrOfArticles = \OxidEsales\Eshop\Core\Registry::getUtilsCount()->getCatArticleCount($this->getId()); } } return (int) $this->_iNrOfArticles; }
[ "public", "function", "getNrOfArticles", "(", ")", "{", "$", "myConfig", "=", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "Registry", "::", "getConfig", "(", ")", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "_iNrOfArticles", ")", "...
returns number or articles in category @return integer
[ "returns", "number", "or", "articles", "in", "category" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Category.php#L429-L448
train
OXID-eSales/oxideshop_ce
source/Application/Model/Category.php
Category.getIsVisible
public function getIsVisible() { if (!isset($this->_blIsVisible)) { if (\OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('blDontShowEmptyCategories')) { $blEmpty = ($this->getNrOfArticles() < 1) && !$this->getHasVisibleSubCats(); } else { $blEmpty = false; } $this->_blIsVisible = !($blEmpty || $this->oxcategories__oxhidden->value); } return $this->_blIsVisible; }
php
public function getIsVisible() { if (!isset($this->_blIsVisible)) { if (\OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('blDontShowEmptyCategories')) { $blEmpty = ($this->getNrOfArticles() < 1) && !$this->getHasVisibleSubCats(); } else { $blEmpty = false; } $this->_blIsVisible = !($blEmpty || $this->oxcategories__oxhidden->value); } return $this->_blIsVisible; }
[ "public", "function", "getIsVisible", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "_blIsVisible", ")", ")", "{", "if", "(", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "Registry", "::", "getConfig", "(", ")", "->", "get...
returns the visibility of a category, handles hidden and empty categories @return bool
[ "returns", "the", "visibility", "of", "a", "category", "handles", "hidden", "and", "empty", "categories" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Category.php#L465-L478
train
OXID-eSales/oxideshop_ce
source/Application/Model/Category.php
Category.getPictureUrl
public function getPictureUrl() { if ($this->_sDynImageDir === null) { $sThisShop = $this->oxcategories__oxshopid->value; $this->_sDynImageDir = \OxidEsales\Eshop\Core\Registry::getConfig()->getPictureUrl(null, false, null, null, $sThisShop); } return $this->_sDynImageDir; }
php
public function getPictureUrl() { if ($this->_sDynImageDir === null) { $sThisShop = $this->oxcategories__oxshopid->value; $this->_sDynImageDir = \OxidEsales\Eshop\Core\Registry::getConfig()->getPictureUrl(null, false, null, null, $sThisShop); } return $this->_sDynImageDir; }
[ "public", "function", "getPictureUrl", "(", ")", "{", "if", "(", "$", "this", "->", "_sDynImageDir", "===", "null", ")", "{", "$", "sThisShop", "=", "$", "this", "->", "oxcategories__oxshopid", "->", "value", ";", "$", "this", "->", "_sDynImageDir", "=", ...
Returns dyn image dir @return string
[ "Returns", "dyn", "image", "dir" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Category.php#L495-L503
train
OXID-eSales/oxideshop_ce
source/Application/Model/Category.php
Category.getBaseSeoLink
public function getBaseSeoLink($iLang, $iPage = 0) { $oEncoder = \OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Application\Model\SeoEncoderCategory::class); if (!$iPage) { return $oEncoder->getCategoryUrl($this, $iLang); } return $oEncoder->getCategoryPageUrl($this, $iPage, $iLang); }
php
public function getBaseSeoLink($iLang, $iPage = 0) { $oEncoder = \OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Application\Model\SeoEncoderCategory::class); if (!$iPage) { return $oEncoder->getCategoryUrl($this, $iLang); } return $oEncoder->getCategoryPageUrl($this, $iPage, $iLang); }
[ "public", "function", "getBaseSeoLink", "(", "$", "iLang", ",", "$", "iPage", "=", "0", ")", "{", "$", "oEncoder", "=", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "Registry", "::", "get", "(", "\\", "OxidEsales", "\\", "Eshop", "\\", "Appli...
Returns raw category seo url @param int $iLang language id @param int $iPage page number [optional] @return string
[ "Returns", "raw", "category", "seo", "url" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Category.php#L513-L521
train
OXID-eSales/oxideshop_ce
source/Application/Model/Category.php
Category.setLink
public function setLink($sLink) { $iLang = $this->getLanguage(); if (\OxidEsales\Eshop\Core\Registry::getUtils()->seoIsActive()) { $this->_aSeoUrls[$iLang] = $sLink; } else { $this->_aStdUrls[$iLang] = $sLink; } }
php
public function setLink($sLink) { $iLang = $this->getLanguage(); if (\OxidEsales\Eshop\Core\Registry::getUtils()->seoIsActive()) { $this->_aSeoUrls[$iLang] = $sLink; } else { $this->_aStdUrls[$iLang] = $sLink; } }
[ "public", "function", "setLink", "(", "$", "sLink", ")", "{", "$", "iLang", "=", "$", "this", "->", "getLanguage", "(", ")", ";", "if", "(", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "Registry", "::", "getUtils", "(", ")", "->", "seoIsAc...
sets the url of the category @param string $sLink category url
[ "sets", "the", "url", "of", "the", "category" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Category.php#L554-L562
train
OXID-eSales/oxideshop_ce
source/Application/Model/Category.php
Category.getStdLink
public function getStdLink($iLang = null, $aParams = []) { if (isset($this->oxcategories__oxextlink) && $this->oxcategories__oxextlink->value) { return \OxidEsales\Eshop\Core\Registry::getUtilsUrl()->processUrl($this->oxcategories__oxextlink->value, true); } if ($iLang === null) { $iLang = $this->getLanguage(); } if (!isset($this->_aStdUrls[$iLang])) { $this->_aStdUrls[$iLang] = $this->getBaseStdLink($iLang); } return \OxidEsales\Eshop\Core\Registry::getUtilsUrl()->processUrl($this->_aStdUrls[$iLang], true, $aParams, $iLang); }
php
public function getStdLink($iLang = null, $aParams = []) { if (isset($this->oxcategories__oxextlink) && $this->oxcategories__oxextlink->value) { return \OxidEsales\Eshop\Core\Registry::getUtilsUrl()->processUrl($this->oxcategories__oxextlink->value, true); } if ($iLang === null) { $iLang = $this->getLanguage(); } if (!isset($this->_aStdUrls[$iLang])) { $this->_aStdUrls[$iLang] = $this->getBaseStdLink($iLang); } return \OxidEsales\Eshop\Core\Registry::getUtilsUrl()->processUrl($this->_aStdUrls[$iLang], true, $aParams, $iLang); }
[ "public", "function", "getStdLink", "(", "$", "iLang", "=", "null", ",", "$", "aParams", "=", "[", "]", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "oxcategories__oxextlink", ")", "&&", "$", "this", "->", "oxcategories__oxextlink", "->", "value...
Returns standard URL to category @param int $iLang language @param array $aParams additional params to use [optional] @return string
[ "Returns", "standard", "URL", "to", "category" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Category.php#L626-L641
train
OXID-eSales/oxideshop_ce
source/Application/Model/Category.php
Category.getHasSubCats
public function getHasSubCats() { if (!isset($this->_blHasSubCats)) { $this->_blHasSubCats = $this->oxcategories__oxright->value > $this->oxcategories__oxleft->value + 1; } return $this->_blHasSubCats; }
php
public function getHasSubCats() { if (!isset($this->_blHasSubCats)) { $this->_blHasSubCats = $this->oxcategories__oxright->value > $this->oxcategories__oxleft->value + 1; } return $this->_blHasSubCats; }
[ "public", "function", "getHasSubCats", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "_blHasSubCats", ")", ")", "{", "$", "this", "->", "_blHasSubCats", "=", "$", "this", "->", "oxcategories__oxright", "->", "value", ">", "$", "this", ...
returns if a category has sub categories @return bool
[ "returns", "if", "a", "category", "has", "sub", "categories" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Category.php#L668-L675
train
OXID-eSales/oxideshop_ce
source/Application/Model/Category.php
Category.setHasVisibleSubCats
public function setHasVisibleSubCats($blHasVisibleSubcats) { if ($blHasVisibleSubcats && !$this->_blHasVisibleSubCats) { unset($this->_blIsVisible); if ($this->_oParent instanceof \OxidEsales\Eshop\Application\Model\Category) { $this->_oParent->setHasVisibleSubCats(true); } } $this->_blHasVisibleSubCats = $blHasVisibleSubcats; }
php
public function setHasVisibleSubCats($blHasVisibleSubcats) { if ($blHasVisibleSubcats && !$this->_blHasVisibleSubCats) { unset($this->_blIsVisible); if ($this->_oParent instanceof \OxidEsales\Eshop\Application\Model\Category) { $this->_oParent->setHasVisibleSubCats(true); } } $this->_blHasVisibleSubCats = $blHasVisibleSubcats; }
[ "public", "function", "setHasVisibleSubCats", "(", "$", "blHasVisibleSubcats", ")", "{", "if", "(", "$", "blHasVisibleSubcats", "&&", "!", "$", "this", "->", "_blHasVisibleSubCats", ")", "{", "unset", "(", "$", "this", "->", "_blIsVisible", ")", ";", "if", "...
sets the state of has visible sub categories for the category @param bool $blHasVisibleSubcats marker if category has visible subcategories
[ "sets", "the", "state", "of", "has", "visible", "sub", "categories", "for", "the", "category" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Category.php#L696-L705
train
OXID-eSales/oxideshop_ce
source/Application/Model/Category.php
Category.getAttributes
public function getAttributes() { $sActCat = $this->getId(); $sKey = md5($sActCat . serialize(\OxidEsales\Eshop\Core\Registry::getSession()->getVariable('session_attrfilter'))); if (!isset(self::$_aCatAttributes[$sKey])) { $oAttrList = oxNew(\OxidEsales\Eshop\Application\Model\AttributeList::class); $oAttrList->getCategoryAttributes($sActCat, $this->getLanguage()); self::$_aCatAttributes[$sKey] = $oAttrList; } return self::$_aCatAttributes[$sKey]; }
php
public function getAttributes() { $sActCat = $this->getId(); $sKey = md5($sActCat . serialize(\OxidEsales\Eshop\Core\Registry::getSession()->getVariable('session_attrfilter'))); if (!isset(self::$_aCatAttributes[$sKey])) { $oAttrList = oxNew(\OxidEsales\Eshop\Application\Model\AttributeList::class); $oAttrList->getCategoryAttributes($sActCat, $this->getLanguage()); self::$_aCatAttributes[$sKey] = $oAttrList; } return self::$_aCatAttributes[$sKey]; }
[ "public", "function", "getAttributes", "(", ")", "{", "$", "sActCat", "=", "$", "this", "->", "getId", "(", ")", ";", "$", "sKey", "=", "md5", "(", "$", "sActCat", ".", "serialize", "(", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "Registr...
Loads and returns attribute list associated with this category @return oxAttributeList
[ "Loads", "and", "returns", "attribute", "list", "associated", "with", "this", "category" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Category.php#L712-L724
train
OXID-eSales/oxideshop_ce
source/Application/Model/Category.php
Category.getCatInLang
public function getCatInLang($oActCategory = null) { $oCategoryInDefaultLanguage = oxNew(\OxidEsales\Eshop\Application\Model\Category::class); if ($this->isPriceCategory()) { // get it in base language $oCategoryInDefaultLanguage->loadInLang(0, $this->getId()); } else { $oCategoryInDefaultLanguage->loadInLang(0, $oActCategory->getId()); } return $oCategoryInDefaultLanguage; }
php
public function getCatInLang($oActCategory = null) { $oCategoryInDefaultLanguage = oxNew(\OxidEsales\Eshop\Application\Model\Category::class); if ($this->isPriceCategory()) { // get it in base language $oCategoryInDefaultLanguage->loadInLang(0, $this->getId()); } else { $oCategoryInDefaultLanguage->loadInLang(0, $oActCategory->getId()); } return $oCategoryInDefaultLanguage; }
[ "public", "function", "getCatInLang", "(", "$", "oActCategory", "=", "null", ")", "{", "$", "oCategoryInDefaultLanguage", "=", "oxNew", "(", "\\", "OxidEsales", "\\", "Eshop", "\\", "Application", "\\", "Model", "\\", "Category", "::", "class", ")", ";", "if...
Loads and returns category in base language @param object $oActCategory active category @return object
[ "Loads", "and", "returns", "category", "in", "base", "language" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Category.php#L733-L744
train
OXID-eSales/oxideshop_ce
source/Application/Model/Category.php
Category.getRootId
public static function getRootId($sCategoryId) { if (!isset($sCategoryId)) { return; } $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(); return $oDb->getOne('select oxrootid from ' . getViewName('oxcategories') . ' where oxid = ' . $oDb->quote($sCategoryId)); }
php
public static function getRootId($sCategoryId) { if (!isset($sCategoryId)) { return; } $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(); return $oDb->getOne('select oxrootid from ' . getViewName('oxcategories') . ' where oxid = ' . $oDb->quote($sCategoryId)); }
[ "public", "static", "function", "getRootId", "(", "$", "sCategoryId", ")", "{", "if", "(", "!", "isset", "(", "$", "sCategoryId", ")", ")", "{", "return", ";", "}", "$", "oDb", "=", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "DatabaseProvid...
Returns root category id of a child category @param string $sCategoryId category id @return integer
[ "Returns", "root", "category", "id", "of", "a", "child", "category" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Category.php#L790-L798
train
OXID-eSales/oxideshop_ce
source/Application/Model/Category.php
Category.getIconUrl
public function getIconUrl() { if (($sIcon = $this->oxcategories__oxicon->value)) { $oConfig = \OxidEsales\Eshop\Core\Registry::getConfig(); $sSize = $oConfig->getConfigParam('sCatIconsize'); if (!isset($sSize)) { $sSize = $oConfig->getConfigParam('sIconsize'); } return \OxidEsales\Eshop\Core\Registry::getPictureHandler()->getPicUrl("category/icon/", $sIcon, $sSize); } }
php
public function getIconUrl() { if (($sIcon = $this->oxcategories__oxicon->value)) { $oConfig = \OxidEsales\Eshop\Core\Registry::getConfig(); $sSize = $oConfig->getConfigParam('sCatIconsize'); if (!isset($sSize)) { $sSize = $oConfig->getConfigParam('sIconsize'); } return \OxidEsales\Eshop\Core\Registry::getPictureHandler()->getPicUrl("category/icon/", $sIcon, $sSize); } }
[ "public", "function", "getIconUrl", "(", ")", "{", "if", "(", "(", "$", "sIcon", "=", "$", "this", "->", "oxcategories__oxicon", "->", "value", ")", ")", "{", "$", "oConfig", "=", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "Registry", "::",...
Returns category icon picture url if exist, false - if not @return mixed
[ "Returns", "category", "icon", "picture", "url", "if", "exist", "false", "-", "if", "not" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Category.php#L1004-L1015
train
OXID-eSales/oxideshop_ce
source/Application/Model/Category.php
Category.getThumbUrl
public function getThumbUrl() { if (($sIcon = $this->oxcategories__oxthumb->value)) { $sSize = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('sCatThumbnailsize'); return \OxidEsales\Eshop\Core\Registry::getPictureHandler()->getPicUrl("category/thumb/", $sIcon, $sSize); } }
php
public function getThumbUrl() { if (($sIcon = $this->oxcategories__oxthumb->value)) { $sSize = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('sCatThumbnailsize'); return \OxidEsales\Eshop\Core\Registry::getPictureHandler()->getPicUrl("category/thumb/", $sIcon, $sSize); } }
[ "public", "function", "getThumbUrl", "(", ")", "{", "if", "(", "(", "$", "sIcon", "=", "$", "this", "->", "oxcategories__oxthumb", "->", "value", ")", ")", "{", "$", "sSize", "=", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "Registry", "::",...
Returns category thumbnail picture url if exist, false - if not @return mixed
[ "Returns", "category", "thumbnail", "picture", "url", "if", "exist", "false", "-", "if", "not" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Category.php#L1022-L1029
train
OXID-eSales/oxideshop_ce
source/Application/Model/Category.php
Category.getPromotionIconUrl
public function getPromotionIconUrl() { if (($sIcon = $this->oxcategories__oxpromoicon->value)) { $sSize = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('sCatPromotionsize'); return \OxidEsales\Eshop\Core\Registry::getPictureHandler()->getPicUrl("category/promo_icon/", $sIcon, $sSize); } }
php
public function getPromotionIconUrl() { if (($sIcon = $this->oxcategories__oxpromoicon->value)) { $sSize = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('sCatPromotionsize'); return \OxidEsales\Eshop\Core\Registry::getPictureHandler()->getPicUrl("category/promo_icon/", $sIcon, $sSize); } }
[ "public", "function", "getPromotionIconUrl", "(", ")", "{", "if", "(", "(", "$", "sIcon", "=", "$", "this", "->", "oxcategories__oxpromoicon", "->", "value", ")", ")", "{", "$", "sSize", "=", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "Regist...
Returns category promotion icon picture url if exist, false - if not @return mixed
[ "Returns", "category", "promotion", "icon", "picture", "url", "if", "exist", "false", "-", "if", "not" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Category.php#L1036-L1043
train
OXID-eSales/oxideshop_ce
source/Application/Model/Category.php
Category.isTopCategory
public function isTopCategory() { if ($this->_blTopCategory == null) { $this->_blTopCategory = $this->oxcategories__oxparentid->value == 'oxrootid'; } return $this->_blTopCategory; }
php
public function isTopCategory() { if ($this->_blTopCategory == null) { $this->_blTopCategory = $this->oxcategories__oxparentid->value == 'oxrootid'; } return $this->_blTopCategory; }
[ "public", "function", "isTopCategory", "(", ")", "{", "if", "(", "$", "this", "->", "_blTopCategory", "==", "null", ")", "{", "$", "this", "->", "_blTopCategory", "=", "$", "this", "->", "oxcategories__oxparentid", "->", "value", "==", "'oxrootid'", ";", "...
Returns true if category parentid is 'oxrootid' @return bool
[ "Returns", "true", "if", "category", "parentid", "is", "oxrootid" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Category.php#L1067-L1074
train
OXID-eSales/oxideshop_ce
source/Application/Model/Category.php
Category.getFieldFromSubCategories
public function getFieldFromSubCategories($sField = 'OXID', $sOXID = null) { if (!$sOXID) { $sOXID = $this->getId(); } if (!$sOXID) { return false; } $sTable = $this->getViewName(); $sField = "`{$sTable}`.`{$sField}`"; $sSql = "SELECT $sField FROM `{$sTable}` WHERE `OXROOTID` = ? AND `OXPARENTID` != 'oxrootid'"; $aResult = \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->getCol($sSql, [$sOXID]); return $aResult; }
php
public function getFieldFromSubCategories($sField = 'OXID', $sOXID = null) { if (!$sOXID) { $sOXID = $this->getId(); } if (!$sOXID) { return false; } $sTable = $this->getViewName(); $sField = "`{$sTable}`.`{$sField}`"; $sSql = "SELECT $sField FROM `{$sTable}` WHERE `OXROOTID` = ? AND `OXPARENTID` != 'oxrootid'"; $aResult = \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->getCol($sSql, [$sOXID]); return $aResult; }
[ "public", "function", "getFieldFromSubCategories", "(", "$", "sField", "=", "'OXID'", ",", "$", "sOXID", "=", "null", ")", "{", "if", "(", "!", "$", "sOXID", ")", "{", "$", "sOXID", "=", "$", "this", "->", "getId", "(", ")", ";", "}", "if", "(", ...
Gets one field from all of subcategories. Default is set to 'OXID' @param string $sField field to be retrieved from each subcategory @param string $sOXID Cetegory ID @return array
[ "Gets", "one", "field", "from", "all", "of", "subcategories", ".", "Default", "is", "set", "to", "OXID" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Category.php#L1130-L1145
train
OXID-eSales/oxideshop_ce
source/Application/Controller/RegisterController.php
RegisterController.confirmRegistration
public function confirmRegistration() { $oUser = oxNew(\OxidEsales\Eshop\Application\Model\User::class); if ($oUser->loadUserByUpdateId($this->getUpdateId())) { // resetting update key parameter $oUser->setUpdateKey(true); // saving .. $oUser->oxuser__oxactive = new \OxidEsales\Eshop\Core\Field(1); $oUser->save(); // forcing user login \OxidEsales\Eshop\Core\Registry::getSession()->setVariable('usr', $oUser->getId()); // redirecting to confirmation page return 'register?confirmstate=1'; } else { // confirmation failed \OxidEsales\Eshop\Core\Registry::getUtilsView()->addErrorToDisplay('REGISTER_ERRLINKEXPIRED', false, true); // redirecting to confirmation page return 'account'; } }
php
public function confirmRegistration() { $oUser = oxNew(\OxidEsales\Eshop\Application\Model\User::class); if ($oUser->loadUserByUpdateId($this->getUpdateId())) { // resetting update key parameter $oUser->setUpdateKey(true); // saving .. $oUser->oxuser__oxactive = new \OxidEsales\Eshop\Core\Field(1); $oUser->save(); // forcing user login \OxidEsales\Eshop\Core\Registry::getSession()->setVariable('usr', $oUser->getId()); // redirecting to confirmation page return 'register?confirmstate=1'; } else { // confirmation failed \OxidEsales\Eshop\Core\Registry::getUtilsView()->addErrorToDisplay('REGISTER_ERRLINKEXPIRED', false, true); // redirecting to confirmation page return 'account'; } }
[ "public", "function", "confirmRegistration", "(", ")", "{", "$", "oUser", "=", "oxNew", "(", "\\", "OxidEsales", "\\", "Eshop", "\\", "Application", "\\", "Model", "\\", "User", "::", "class", ")", ";", "if", "(", "$", "oUser", "->", "loadUserByUpdateId", ...
Registration confirmation functionality. If registration succeded - redirects to success page, if not - returns exception informing about expired confirmation link @return mixed
[ "Registration", "confirmation", "functionality", ".", "If", "registration", "succeded", "-", "redirects", "to", "success", "page", "if", "not", "-", "returns", "exception", "informing", "about", "expired", "confirmation", "link" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/RegisterController.php#L114-L137
train
OXID-eSales/oxideshop_ce
source/Core/Smarty/Plugin/Emos.php
Emos.addSearch
public function addSearch($sQueryString, $iNumberOfHits) { // #4018: The emospro.search string is URL-encoded forwarded to econda instead of URL-escaped $this->_searchQuery = $this->_emos_DataFormat($sQueryString); $this->_searchNumberOfHits = $iNumberOfHits; }
php
public function addSearch($sQueryString, $iNumberOfHits) { // #4018: The emospro.search string is URL-encoded forwarded to econda instead of URL-escaped $this->_searchQuery = $this->_emos_DataFormat($sQueryString); $this->_searchNumberOfHits = $iNumberOfHits; }
[ "public", "function", "addSearch", "(", "$", "sQueryString", ",", "$", "iNumberOfHits", ")", "{", "// #4018: The emospro.search string is URL-encoded forwarded to econda instead of URL-escaped", "$", "this", "->", "_searchQuery", "=", "$", "this", "->", "_emos_DataFormat", ...
sets search tracking @param string $sQueryString query string @param int $iNumberOfHits number of hits
[ "sets", "search", "tracking" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Smarty/Plugin/Emos.php#L320-L325
train
OXID-eSales/oxideshop_ce
source/Core/Smarty/Plugin/Emos.php
Emos.addEmosBasketPageArray
public function addEmosBasketPageArray($aBasket) { if (!is_array($aBasket)) { return; } $aBasketItems = []; foreach ($aBasket as $oItem) { $oItem = $this->_emos_ItemFormat($oItem); $aBasketItems[] = ["buy", $oItem->productId, $oItem->productName, $oItem->price, $oItem->productGroup, $oItem->quantity, $oItem->variant1, $oItem->variant2, $oItem->variant3 ]; } $this->_ecEvent = $aBasketItems; }
php
public function addEmosBasketPageArray($aBasket) { if (!is_array($aBasket)) { return; } $aBasketItems = []; foreach ($aBasket as $oItem) { $oItem = $this->_emos_ItemFormat($oItem); $aBasketItems[] = ["buy", $oItem->productId, $oItem->productName, $oItem->price, $oItem->productGroup, $oItem->quantity, $oItem->variant1, $oItem->variant2, $oItem->variant3 ]; } $this->_ecEvent = $aBasketItems; }
[ "public", "function", "addEmosBasketPageArray", "(", "$", "aBasket", ")", "{", "if", "(", "!", "is_array", "(", "$", "aBasket", ")", ")", "{", "return", ";", "}", "$", "aBasketItems", "=", "[", "]", ";", "foreach", "(", "$", "aBasket", "as", "$", "oI...
adds a emosBasket Page Array to the preScript @param array $aBasket basket items @return null
[ "adds", "a", "emosBasket", "Page", "Array", "to", "the", "preScript" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Smarty/Plugin/Emos.php#L380-L395
train
OXID-eSales/oxideshop_ce
source/Core/Smarty/Plugin/Emos.php
Emos._setEmosBillingArray
protected function _setEmosBillingArray($sBillingId = "", $sCustomerNumber = "", $iTotal = 0, $sCountry = "", $sCip = "", $sCity = "") { /******************* prepare data *************************************/ /* md5 the customer id to fullfill requirements of german datenschutzgeesetz */ $sCustomerNumber = md5($sCustomerNumber); $sCountry = $this->_emos_DataFormat($sCountry); $sCip = $this->_emos_DataFormat($sCip) ; $sCity = $this->_emos_DataFormat($sCity); /* get a / separated location stzring for later drilldown */ $ort = ""; if ($sCountry) { $ort .= "$sCountry/"; } if ($sCip) { $ort .= getStr()->substr($sCip, 0, 1)."/".getStr()->substr($sCip, 0, 2)."/"; } if ($sCity) { $ort .= "$sCity/"; } if ($sCip) { $ort.=$sCip; } $this->_billing = [$sBillingId, $sCustomerNumber, $ort, $iTotal]; }
php
protected function _setEmosBillingArray($sBillingId = "", $sCustomerNumber = "", $iTotal = 0, $sCountry = "", $sCip = "", $sCity = "") { /******************* prepare data *************************************/ /* md5 the customer id to fullfill requirements of german datenschutzgeesetz */ $sCustomerNumber = md5($sCustomerNumber); $sCountry = $this->_emos_DataFormat($sCountry); $sCip = $this->_emos_DataFormat($sCip) ; $sCity = $this->_emos_DataFormat($sCity); /* get a / separated location stzring for later drilldown */ $ort = ""; if ($sCountry) { $ort .= "$sCountry/"; } if ($sCip) { $ort .= getStr()->substr($sCip, 0, 1)."/".getStr()->substr($sCip, 0, 2)."/"; } if ($sCity) { $ort .= "$sCity/"; } if ($sCip) { $ort.=$sCip; } $this->_billing = [$sBillingId, $sCustomerNumber, $ort, $iTotal]; }
[ "protected", "function", "_setEmosBillingArray", "(", "$", "sBillingId", "=", "\"\"", ",", "$", "sCustomerNumber", "=", "\"\"", ",", "$", "iTotal", "=", "0", ",", "$", "sCountry", "=", "\"\"", ",", "$", "sCip", "=", "\"\"", ",", "$", "sCity", "=", "\"\...
set a emosBillingArray @param string $sBillingId billing id @param string $sCustomerNumber customer number @param int $iTotal total number @param string $sCountry customer country title @param string $sCip customer ip @param string $sCity customer city title
[ "set", "a", "emosBillingArray" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Smarty/Plugin/Emos.php#L452-L481
train
OXID-eSales/oxideshop_ce
source/Core/Smarty/Plugin/Emos.php
Emos._prepareScript
public function _prepareScript() { $this->_sPrescript = '<script type="text/javascript">window.emosTrackVersion = 2;</script>' . $this->_br; $this->_sIncScript .= "<script type=\"text/javascript\" " . "src=\"" . $this->_sPathToFile . $this->_sScriptFileName . "\">" . "</script>" . $this->_br; $this->_sPostscript = '<script type="text/javascript"><!--' . $this->_br; $this->_sPostscript .= $this->_tab . 'var emospro = {};' . $this->_br; $this->_sPostscript .= $this->_addJsFormat("content", $this->_content); $this->_sPostscript .= $this->_addJsFormat("orderProcess", $this->_orderProcess); $this->_sPostscript .= $this->_addJsFormat("siteid", $this->_siteid); $this->_sPostscript .= $this->_addJsFormat("langid", $this->_langid); $this->_sPostscript .= $this->_addJsFormat("countryid", $this->_countryid); $this->_sPostscript .= $this->_addJsFormat("pageId", $this->_pageid); $this->_sPostscript .= $this->_addJsFormat("scontact", $this->_scontact); $this->_sPostscript .= $this->_addJsFormat("download", $this->_download); $this->_sPostscript .= $this->_addJsFormat("billing", [$this->_billing]); $this->_sPostscript .= $this->_addJsFormat("search", [[$this->_searchQuery, $this->_searchNumberOfHits]]); $this->_sPostscript .= $this->_addJsFormat("register", [[$this->_registerUser, $this->_registerResult]]); $this->_sPostscript .= $this->_addJsFormat("login", [[$this->_loginUser, $this->_loginResult]]); $this->_sPostscript .= $this->_addJsFormat("ec_Event", $this->_ecEvent); $this->_sPostscript .= $this->_tab . 'window.emosPropertiesEvent(emospro);' . $this->_br; $this->_sPostscript .= '//-->' . $this->_br . '</script>' . $this->_br; }
php
public function _prepareScript() { $this->_sPrescript = '<script type="text/javascript">window.emosTrackVersion = 2;</script>' . $this->_br; $this->_sIncScript .= "<script type=\"text/javascript\" " . "src=\"" . $this->_sPathToFile . $this->_sScriptFileName . "\">" . "</script>" . $this->_br; $this->_sPostscript = '<script type="text/javascript"><!--' . $this->_br; $this->_sPostscript .= $this->_tab . 'var emospro = {};' . $this->_br; $this->_sPostscript .= $this->_addJsFormat("content", $this->_content); $this->_sPostscript .= $this->_addJsFormat("orderProcess", $this->_orderProcess); $this->_sPostscript .= $this->_addJsFormat("siteid", $this->_siteid); $this->_sPostscript .= $this->_addJsFormat("langid", $this->_langid); $this->_sPostscript .= $this->_addJsFormat("countryid", $this->_countryid); $this->_sPostscript .= $this->_addJsFormat("pageId", $this->_pageid); $this->_sPostscript .= $this->_addJsFormat("scontact", $this->_scontact); $this->_sPostscript .= $this->_addJsFormat("download", $this->_download); $this->_sPostscript .= $this->_addJsFormat("billing", [$this->_billing]); $this->_sPostscript .= $this->_addJsFormat("search", [[$this->_searchQuery, $this->_searchNumberOfHits]]); $this->_sPostscript .= $this->_addJsFormat("register", [[$this->_registerUser, $this->_registerResult]]); $this->_sPostscript .= $this->_addJsFormat("login", [[$this->_loginUser, $this->_loginResult]]); $this->_sPostscript .= $this->_addJsFormat("ec_Event", $this->_ecEvent); $this->_sPostscript .= $this->_tab . 'window.emosPropertiesEvent(emospro);' . $this->_br; $this->_sPostscript .= '//-->' . $this->_br . '</script>' . $this->_br; }
[ "public", "function", "_prepareScript", "(", ")", "{", "$", "this", "->", "_sPrescript", "=", "'<script type=\"text/javascript\">window.emosTrackVersion = 2;</script>'", ".", "$", "this", "->", "_br", ";", "$", "this", "->", "_sIncScript", ".=", "\"<script type=\\\"text...
formats up the connector script in a Econda ver 2 JS format
[ "formats", "up", "the", "connector", "script", "in", "a", "Econda", "ver", "2", "JS", "format" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Smarty/Plugin/Emos.php#L567-L596
train
OXID-eSales/oxideshop_ce
source/Core/Smarty/Plugin/Emos.php
Emos._addJsFormat
protected function _addJsFormat($sVarName, $mContents) { //get the first non array $mContents element $mVal = $mContents; while (is_array($mVal)) { $mVal = $mVal[0]; } if (is_null($mVal)) { return; } $sEncoded = $this->_jsEncode(($mContents)); return $this->_tab . 'emospro.' . $sVarName . ' = ' . $sEncoded . ';' . $this->_br; }
php
protected function _addJsFormat($sVarName, $mContents) { //get the first non array $mContents element $mVal = $mContents; while (is_array($mVal)) { $mVal = $mVal[0]; } if (is_null($mVal)) { return; } $sEncoded = $this->_jsEncode(($mContents)); return $this->_tab . 'emospro.' . $sVarName . ' = ' . $sEncoded . ';' . $this->_br; }
[ "protected", "function", "_addJsFormat", "(", "$", "sVarName", ",", "$", "mContents", ")", "{", "//get the first non array $mContents element", "$", "mVal", "=", "$", "mContents", ";", "while", "(", "is_array", "(", "$", "mVal", ")", ")", "{", "$", "mVal", "...
Formats a line in JS format @param string $sVarName Variable name @param mixed $mContents Variable value @return string
[ "Formats", "a", "line", "in", "JS", "format" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Smarty/Plugin/Emos.php#L606-L621
train