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
MUlt1mate/cron-manager
examples/file_storage/models/TaskFile.php
TaskFile.taskDelete
public function taskDelete() { $tasks = self::taskFileLoad(); if (isset($tasks[$this->task_id])) { unset($tasks[$this->task_id]); return self::taskFileSave($tasks); } return false; }
php
public function taskDelete() { $tasks = self::taskFileLoad(); if (isset($tasks[$this->task_id])) { unset($tasks[$this->task_id]); return self::taskFileSave($tasks); } return false; }
[ "public", "function", "taskDelete", "(", ")", "{", "$", "tasks", "=", "self", "::", "taskFileLoad", "(", ")", ";", "if", "(", "isset", "(", "$", "tasks", "[", "$", "this", "->", "task_id", "]", ")", ")", "{", "unset", "(", "$", "tasks", "[", "$",...
Deletes the task @return mixed
[ "Deletes", "the", "task" ]
ccea814d338a0b5edf0e2008ebfe07038090ca5a
https://github.com/MUlt1mate/cron-manager/blob/ccea814d338a0b5edf0e2008ebfe07038090ca5a/examples/file_storage/models/TaskFile.php#L103-L113
train
MUlt1mate/cron-manager
examples/file_storage/models/TaskFile.php
TaskFile.taskSave
public function taskSave() { $taskId = $this->getTaskId(); $tasks = self::taskFileLoad(); if (empty($taskId)) { $task_ids = array_keys($tasks); $this->setTaskId(array_pop($task_ids) + 1); $this->setTs(date('Y-m-d H:i:s')); } $tasks[$this->getTaskId()] = $this; return $this->taskFileSave($tasks); }
php
public function taskSave() { $taskId = $this->getTaskId(); $tasks = self::taskFileLoad(); if (empty($taskId)) { $task_ids = array_keys($tasks); $this->setTaskId(array_pop($task_ids) + 1); $this->setTs(date('Y-m-d H:i:s')); } $tasks[$this->getTaskId()] = $this; return $this->taskFileSave($tasks); }
[ "public", "function", "taskSave", "(", ")", "{", "$", "taskId", "=", "$", "this", "->", "getTaskId", "(", ")", ";", "$", "tasks", "=", "self", "::", "taskFileLoad", "(", ")", ";", "if", "(", "empty", "(", "$", "taskId", ")", ")", "{", "$", "task_...
Saves the task @return mixed
[ "Saves", "the", "task" ]
ccea814d338a0b5edf0e2008ebfe07038090ca5a
https://github.com/MUlt1mate/cron-manager/blob/ccea814d338a0b5edf0e2008ebfe07038090ca5a/examples/file_storage/models/TaskFile.php#L119-L131
train
MUlt1mate/cron-manager
src/TaskLoader.php
TaskLoader.loadController
public static function loadController($class_name) { foreach (self::$class_folders as $f) { $f = rtrim($f, '/'); $filename = $f . '/' . $class_name . '.php'; if (file_exists($filename)) { require_once $filename; if (class_exists($class_name)) { return true; } else { throw new TaskManagerException('file found but class ' . $class_name . ' not loaded'); } } } throw new TaskManagerException('class ' . $class_name . ' not found'); }
php
public static function loadController($class_name) { foreach (self::$class_folders as $f) { $f = rtrim($f, '/'); $filename = $f . '/' . $class_name . '.php'; if (file_exists($filename)) { require_once $filename; if (class_exists($class_name)) { return true; } else { throw new TaskManagerException('file found but class ' . $class_name . ' not loaded'); } } } throw new TaskManagerException('class ' . $class_name . ' not found'); }
[ "public", "static", "function", "loadController", "(", "$", "class_name", ")", "{", "foreach", "(", "self", "::", "$", "class_folders", "as", "$", "f", ")", "{", "$", "f", "=", "rtrim", "(", "$", "f", ",", "'/'", ")", ";", "$", "filename", "=", "$"...
Looks for and loads required class via require_once @param $class_name @return bool @throws TaskManagerException
[ "Looks", "for", "and", "loads", "required", "class", "via", "require_once" ]
ccea814d338a0b5edf0e2008ebfe07038090ca5a
https://github.com/MUlt1mate/cron-manager/blob/ccea814d338a0b5edf0e2008ebfe07038090ca5a/src/TaskLoader.php#L26-L42
train
MUlt1mate/cron-manager
src/TaskLoader.php
TaskLoader.getControllerMethods
public static function getControllerMethods($class) { if (!class_exists($class)) { throw new TaskManagerException('class ' . $class . ' not found'); } $class_methods = get_class_methods($class); if ($parent_class = get_parent_class($class)) { $parent_class_methods = get_class_methods($parent_class); return array_diff($class_methods, $parent_class_methods); } return $class_methods; }
php
public static function getControllerMethods($class) { if (!class_exists($class)) { throw new TaskManagerException('class ' . $class . ' not found'); } $class_methods = get_class_methods($class); if ($parent_class = get_parent_class($class)) { $parent_class_methods = get_class_methods($parent_class); return array_diff($class_methods, $parent_class_methods); } return $class_methods; }
[ "public", "static", "function", "getControllerMethods", "(", "$", "class", ")", "{", "if", "(", "!", "class_exists", "(", "$", "class", ")", ")", "{", "throw", "new", "TaskManagerException", "(", "'class '", ".", "$", "class", ".", "' not found'", ")", ";"...
Returns all public methods for requested class @param string $class @return array @throws TaskManagerException
[ "Returns", "all", "public", "methods", "for", "requested", "class" ]
ccea814d338a0b5edf0e2008ebfe07038090ca5a
https://github.com/MUlt1mate/cron-manager/blob/ccea814d338a0b5edf0e2008ebfe07038090ca5a/src/TaskLoader.php#L50-L61
train
MUlt1mate/cron-manager
src/TaskLoader.php
TaskLoader.getControllersList
protected static function getControllersList($paths, $namespaces_list) { $controllers = array(); foreach ($paths as $p_index => $p) { if (!file_exists($p)) { throw new TaskManagerException('folder ' . $p . ' does not exist'); } $files = scandir($p); foreach ($files as $f) { if (preg_match('/^([A-Z]\w+)\.php$/', $f, $match)) { $namespace = isset($namespaces_list[$p_index]) ? $namespaces_list[$p_index] : ''; $controllers[] = $namespace . $match[1]; } } } return $controllers; }
php
protected static function getControllersList($paths, $namespaces_list) { $controllers = array(); foreach ($paths as $p_index => $p) { if (!file_exists($p)) { throw new TaskManagerException('folder ' . $p . ' does not exist'); } $files = scandir($p); foreach ($files as $f) { if (preg_match('/^([A-Z]\w+)\.php$/', $f, $match)) { $namespace = isset($namespaces_list[$p_index]) ? $namespaces_list[$p_index] : ''; $controllers[] = $namespace . $match[1]; } } } return $controllers; }
[ "protected", "static", "function", "getControllersList", "(", "$", "paths", ",", "$", "namespaces_list", ")", "{", "$", "controllers", "=", "array", "(", ")", ";", "foreach", "(", "$", "paths", "as", "$", "p_index", "=>", "$", "p", ")", "{", "if", "(",...
Returns names of all php files in directories @param array $paths @param $namespaces_list @return array @throws TaskManagerException
[ "Returns", "names", "of", "all", "php", "files", "in", "directories" ]
ccea814d338a0b5edf0e2008ebfe07038090ca5a
https://github.com/MUlt1mate/cron-manager/blob/ccea814d338a0b5edf0e2008ebfe07038090ca5a/src/TaskLoader.php#L70-L86
train
MUlt1mate/cron-manager
src/TaskLoader.php
TaskLoader.getAllMethods
public static function getAllMethods($folder, $namespace = array()) { self::setClassFolder($folder); $namespaces_list = is_array($namespace) ? $namespace : array($namespace); $methods = array(); $controllers = self::getControllersList(self::$class_folders, $namespaces_list); foreach ($controllers as $c) { if (!class_exists($c)) { self::loadController($c); } $methods[$c] = self::getControllerMethods($c); } return $methods; }
php
public static function getAllMethods($folder, $namespace = array()) { self::setClassFolder($folder); $namespaces_list = is_array($namespace) ? $namespace : array($namespace); $methods = array(); $controllers = self::getControllersList(self::$class_folders, $namespaces_list); foreach ($controllers as $c) { if (!class_exists($c)) { self::loadController($c); } $methods[$c] = self::getControllerMethods($c); } return $methods; }
[ "public", "static", "function", "getAllMethods", "(", "$", "folder", ",", "$", "namespace", "=", "array", "(", ")", ")", "{", "self", "::", "setClassFolder", "(", "$", "folder", ")", ";", "$", "namespaces_list", "=", "is_array", "(", "$", "namespace", ")...
Scan folders for classes and return all their public methods @param string|array $folder @param string|array $namespace @return array @throws TaskManagerException
[ "Scan", "folders", "for", "classes", "and", "return", "all", "their", "public", "methods" ]
ccea814d338a0b5edf0e2008ebfe07038090ca5a
https://github.com/MUlt1mate/cron-manager/blob/ccea814d338a0b5edf0e2008ebfe07038090ca5a/src/TaskLoader.php#L95-L110
train
MUlt1mate/cron-manager
src/TaskManager.php
TaskManager.editTask
public static function editTask($task, $time, $command, $status = TaskInterface::TASK_STATUS_ACTIVE, $comment = null) { if (!$validated_command = self::validateCommand($command)) { return $task; } $task->setStatus($status); $task->setCommand($validated_command); $task->setTime($time); if (isset($comment)) { $task->setComment($comment); } $task->setTsUpdated(date('Y-m-d H:i:s')); $task->taskSave(); return $task; }
php
public static function editTask($task, $time, $command, $status = TaskInterface::TASK_STATUS_ACTIVE, $comment = null) { if (!$validated_command = self::validateCommand($command)) { return $task; } $task->setStatus($status); $task->setCommand($validated_command); $task->setTime($time); if (isset($comment)) { $task->setComment($comment); } $task->setTsUpdated(date('Y-m-d H:i:s')); $task->taskSave(); return $task; }
[ "public", "static", "function", "editTask", "(", "$", "task", ",", "$", "time", ",", "$", "command", ",", "$", "status", "=", "TaskInterface", "::", "TASK_STATUS_ACTIVE", ",", "$", "comment", "=", "null", ")", "{", "if", "(", "!", "$", "validated_command...
Edit and save TaskInterface object @param TaskInterface $task @param string $time @param string $command @param string $status @param string $comment @return TaskInterface
[ "Edit", "and", "save", "TaskInterface", "object" ]
ccea814d338a0b5edf0e2008ebfe07038090ca5a
https://github.com/MUlt1mate/cron-manager/blob/ccea814d338a0b5edf0e2008ebfe07038090ca5a/src/TaskManager.php#L27-L43
train
MUlt1mate/cron-manager
src/TaskManager.php
TaskManager.validateCommand
public static function validateCommand($command) { try { list($class, $method, $args) = self::parseCommand($command); } catch (TaskManagerException $e) { return false; } $args = array_map(function ($elem) { return trim($elem); }, $args); return $class . '::' . $method . '(' . trim(implode(',', $args), ',') . ')'; }
php
public static function validateCommand($command) { try { list($class, $method, $args) = self::parseCommand($command); } catch (TaskManagerException $e) { return false; } $args = array_map(function ($elem) { return trim($elem); }, $args); return $class . '::' . $method . '(' . trim(implode(',', $args), ',') . ')'; }
[ "public", "static", "function", "validateCommand", "(", "$", "command", ")", "{", "try", "{", "list", "(", "$", "class", ",", "$", "method", ",", "$", "args", ")", "=", "self", "::", "parseCommand", "(", "$", "command", ")", ";", "}", "catch", "(", ...
Checks if the command is correct and removes spaces @param string $command @return string|false
[ "Checks", "if", "the", "command", "is", "correct", "and", "removes", "spaces" ]
ccea814d338a0b5edf0e2008ebfe07038090ca5a
https://github.com/MUlt1mate/cron-manager/blob/ccea814d338a0b5edf0e2008ebfe07038090ca5a/src/TaskManager.php#L50-L61
train
MUlt1mate/cron-manager
src/TaskManager.php
TaskManager.parseCommand
public static function parseCommand($command) { if (preg_match('/([\w\\\\]+)::(\w+)\((.*)\)/', $command, $match)) { $params = explode(',', $match[3]); if ((1 == count($params)) && ('' == $params[0])) { //prevents to pass an empty string $params[0] = null; } return array( $match[1], $match[2], $params ); } throw new TaskManagerException('Command not recognized'); }
php
public static function parseCommand($command) { if (preg_match('/([\w\\\\]+)::(\w+)\((.*)\)/', $command, $match)) { $params = explode(',', $match[3]); if ((1 == count($params)) && ('' == $params[0])) { //prevents to pass an empty string $params[0] = null; } return array( $match[1], $match[2], $params ); } throw new TaskManagerException('Command not recognized'); }
[ "public", "static", "function", "parseCommand", "(", "$", "command", ")", "{", "if", "(", "preg_match", "(", "'/([\\w\\\\\\\\]+)::(\\w+)\\((.*)\\)/'", ",", "$", "command", ",", "$", "match", ")", ")", "{", "$", "params", "=", "explode", "(", "','", ",", "$...
Parses command and returns an array which contains class, method and arguments of the command @param string $command @return array @throws TaskManagerException
[ "Parses", "command", "and", "returns", "an", "array", "which", "contains", "class", "method", "and", "arguments", "of", "the", "command" ]
ccea814d338a0b5edf0e2008ebfe07038090ca5a
https://github.com/MUlt1mate/cron-manager/blob/ccea814d338a0b5edf0e2008ebfe07038090ca5a/src/TaskManager.php#L69-L85
train
MUlt1mate/cron-manager
src/TaskManager.php
TaskManager.parseCrontab
public static function parseCrontab($cron, $task_class) { $cron_array = explode(PHP_EOL, $cron); $comment = null; $result = array(); foreach ($cron_array as $c) { $c = trim($c); if (empty($c)) { continue; } $r = array($c); if (preg_match(self::CRON_LINE_REGEXP, $c, $matches)) { try { CronExpression::factory($matches[2]); } catch (\Exception $e) { $r[1] = 'Time expression is not valid'; $r[2] = $matches[2]; $result[] = $r; continue; } $task = self::createTaskWithCrontabLine($task_class, $matches, $comment); $r [1] = 'Saved'; $r [2] = $task; $comment = null; } elseif (preg_match('/#([\w\d\s]+)/i', $c, $matches)) { $comment = trim($matches[1]); $r [1] = 'Comment'; $r [2] = $comment; } else { $r [1] = 'Not matched'; } $result[] = $r; } return $result; }
php
public static function parseCrontab($cron, $task_class) { $cron_array = explode(PHP_EOL, $cron); $comment = null; $result = array(); foreach ($cron_array as $c) { $c = trim($c); if (empty($c)) { continue; } $r = array($c); if (preg_match(self::CRON_LINE_REGEXP, $c, $matches)) { try { CronExpression::factory($matches[2]); } catch (\Exception $e) { $r[1] = 'Time expression is not valid'; $r[2] = $matches[2]; $result[] = $r; continue; } $task = self::createTaskWithCrontabLine($task_class, $matches, $comment); $r [1] = 'Saved'; $r [2] = $task; $comment = null; } elseif (preg_match('/#([\w\d\s]+)/i', $c, $matches)) { $comment = trim($matches[1]); $r [1] = 'Comment'; $r [2] = $comment; } else { $r [1] = 'Not matched'; } $result[] = $r; } return $result; }
[ "public", "static", "function", "parseCrontab", "(", "$", "cron", ",", "$", "task_class", ")", "{", "$", "cron_array", "=", "explode", "(", "PHP_EOL", ",", "$", "cron", ")", ";", "$", "comment", "=", "null", ";", "$", "result", "=", "array", "(", ")"...
Parses each line of crontab content and creates new TaskInterface objects @param string $cron @param TaskInterface $task_class @return array
[ "Parses", "each", "line", "of", "crontab", "content", "and", "creates", "new", "TaskInterface", "objects" ]
ccea814d338a0b5edf0e2008ebfe07038090ca5a
https://github.com/MUlt1mate/cron-manager/blob/ccea814d338a0b5edf0e2008ebfe07038090ca5a/src/TaskManager.php#L93-L130
train
MUlt1mate/cron-manager
src/TaskManager.php
TaskManager.createTaskWithCrontabLine
private static function createTaskWithCrontabLine($task_class, $matches, $comment) { $task = $task_class::createNew(); $task->setTime(trim($matches[2])); $arguments = str_replace(' ', ',', trim($matches[5])); $command = ucfirst($matches[3]) . '::' . $matches[4] . '(' . $arguments . ')'; $task->setCommand($command); if (!empty($comment)) { $task->setComment($comment); } //$output = $matches[7]; $status = empty($matches[1]) ? TaskInterface::TASK_STATUS_ACTIVE : TaskInterface::TASK_STATUS_INACTIVE; $task->setStatus($status); $task->setTs(date('Y-m-d H:i:s')); $task->taskSave(); return $task; }
php
private static function createTaskWithCrontabLine($task_class, $matches, $comment) { $task = $task_class::createNew(); $task->setTime(trim($matches[2])); $arguments = str_replace(' ', ',', trim($matches[5])); $command = ucfirst($matches[3]) . '::' . $matches[4] . '(' . $arguments . ')'; $task->setCommand($command); if (!empty($comment)) { $task->setComment($comment); } //$output = $matches[7]; $status = empty($matches[1]) ? TaskInterface::TASK_STATUS_ACTIVE : TaskInterface::TASK_STATUS_INACTIVE; $task->setStatus($status); $task->setTs(date('Y-m-d H:i:s')); $task->taskSave(); return $task; }
[ "private", "static", "function", "createTaskWithCrontabLine", "(", "$", "task_class", ",", "$", "matches", ",", "$", "comment", ")", "{", "$", "task", "=", "$", "task_class", "::", "createNew", "(", ")", ";", "$", "task", "->", "setTime", "(", "trim", "(...
Creates new TaskInterface object from parsed crontab line @param TaskInterface $task_class @param array $matches @param string $comment @return TaskInterface
[ "Creates", "new", "TaskInterface", "object", "from", "parsed", "crontab", "line" ]
ccea814d338a0b5edf0e2008ebfe07038090ca5a
https://github.com/MUlt1mate/cron-manager/blob/ccea814d338a0b5edf0e2008ebfe07038090ca5a/src/TaskManager.php#L139-L155
train
MUlt1mate/cron-manager
src/TaskManager.php
TaskManager.getTaskCrontabLine
public static function getTaskCrontabLine($task, $path, $php_bin, $input_file) { $str = ''; $comment = $task->getComment(); if (!empty($comment)) { $str .= '#' . $comment . PHP_EOL; } if (TaskInterface::TASK_STATUS_ACTIVE != $task->getStatus()) { $str .= '#'; } list($class, $method, $args) = self::parseCommand($task->getCommand()); $exec_cmd = $php_bin . ' ' . $input_file . ' ' . $class . ' ' . $method . ' ' . implode(' ', $args); $str .= $task->getTime() . ' cd ' . $path . '; ' . $exec_cmd . ' 2>&1 > /dev/null'; return $str . PHP_EOL; }
php
public static function getTaskCrontabLine($task, $path, $php_bin, $input_file) { $str = ''; $comment = $task->getComment(); if (!empty($comment)) { $str .= '#' . $comment . PHP_EOL; } if (TaskInterface::TASK_STATUS_ACTIVE != $task->getStatus()) { $str .= '#'; } list($class, $method, $args) = self::parseCommand($task->getCommand()); $exec_cmd = $php_bin . ' ' . $input_file . ' ' . $class . ' ' . $method . ' ' . implode(' ', $args); $str .= $task->getTime() . ' cd ' . $path . '; ' . $exec_cmd . ' 2>&1 > /dev/null'; return $str . PHP_EOL; }
[ "public", "static", "function", "getTaskCrontabLine", "(", "$", "task", ",", "$", "path", ",", "$", "php_bin", ",", "$", "input_file", ")", "{", "$", "str", "=", "''", ";", "$", "comment", "=", "$", "task", "->", "getComment", "(", ")", ";", "if", ...
Formats task for export into crontab file @param TaskInterface $task @param string $path @param string $php_bin @param string $input_file @return string @throws TaskManagerException
[ "Formats", "task", "for", "export", "into", "crontab", "file" ]
ccea814d338a0b5edf0e2008ebfe07038090ca5a
https://github.com/MUlt1mate/cron-manager/blob/ccea814d338a0b5edf0e2008ebfe07038090ca5a/src/TaskManager.php#L166-L180
train
MUlt1mate/cron-manager
src/TaskRunner.php
TaskRunner.checkAndRunTasks
public static function checkAndRunTasks($tasks) { $date = date('Y-m-d H:i:s'); foreach ($tasks as $t) { /** * @var TaskInterface $t */ if (TaskInterface::TASK_STATUS_ACTIVE != $t->getStatus()) { continue; } try { $cron = CronExpression::factory($t->getTime()); if ($cron->isDue($date)) { self::runTask($t); } } catch (\Exception $e) { echo 'Caught an exception: ' . get_class($e) . ': ' . PHP_EOL . $e->getMessage() . PHP_EOL; } } }
php
public static function checkAndRunTasks($tasks) { $date = date('Y-m-d H:i:s'); foreach ($tasks as $t) { /** * @var TaskInterface $t */ if (TaskInterface::TASK_STATUS_ACTIVE != $t->getStatus()) { continue; } try { $cron = CronExpression::factory($t->getTime()); if ($cron->isDue($date)) { self::runTask($t); } } catch (\Exception $e) { echo 'Caught an exception: ' . get_class($e) . ': ' . PHP_EOL . $e->getMessage() . PHP_EOL; } } }
[ "public", "static", "function", "checkAndRunTasks", "(", "$", "tasks", ")", "{", "$", "date", "=", "date", "(", "'Y-m-d H:i:s'", ")", ";", "foreach", "(", "$", "tasks", "as", "$", "t", ")", "{", "/**\n * @var TaskInterface $t\n */", "if",...
Runs active tasks if current time matches with time expression @param array $tasks
[ "Runs", "active", "tasks", "if", "current", "time", "matches", "with", "time", "expression" ]
ccea814d338a0b5edf0e2008ebfe07038090ca5a
https://github.com/MUlt1mate/cron-manager/blob/ccea814d338a0b5edf0e2008ebfe07038090ca5a/src/TaskRunner.php#L20-L41
train
MUlt1mate/cron-manager
src/TaskRunner.php
TaskRunner.getRunDates
public static function getRunDates($time, $count = 10) { try { $cron = CronExpression::factory($time); $dates = $cron->getMultipleRunDates($count); } catch (\Exception $e) { return array(); } return $dates; }
php
public static function getRunDates($time, $count = 10) { try { $cron = CronExpression::factory($time); $dates = $cron->getMultipleRunDates($count); } catch (\Exception $e) { return array(); } return $dates; }
[ "public", "static", "function", "getRunDates", "(", "$", "time", ",", "$", "count", "=", "10", ")", "{", "try", "{", "$", "cron", "=", "CronExpression", "::", "factory", "(", "$", "time", ")", ";", "$", "dates", "=", "$", "cron", "->", "getMultipleRu...
Returns next run dates for time expression @param string $time @param int $count @return array
[ "Returns", "next", "run", "dates", "for", "time", "expression" ]
ccea814d338a0b5edf0e2008ebfe07038090ca5a
https://github.com/MUlt1mate/cron-manager/blob/ccea814d338a0b5edf0e2008ebfe07038090ca5a/src/TaskRunner.php#L49-L58
train
MUlt1mate/cron-manager
src/TaskRunner.php
TaskRunner.runTask
public static function runTask($task) { $run = $task->createTaskRun(); $run->setTaskId($task->getTaskId()); $run->setTs(date('Y-m-d H:i:s')); $run->setStatus(TaskRunInterface::RUN_STATUS_STARTED); $run->saveTaskRun(); $run_final_status = TaskRunInterface::RUN_STATUS_COMPLETED; ob_start(); $time_begin = microtime(true); $result = self::parseAndRunCommand($task->getCommand()); if (!$result) { $run_final_status = TaskRunInterface::RUN_STATUS_ERROR; } $output = ob_get_clean(); $run->setOutput($output); $time_end = microtime(true); $time = round(($time_end - $time_begin), 2); $run->setExecutionTime($time); $run->setStatus($run_final_status); $run->saveTaskRun(); return $output; }
php
public static function runTask($task) { $run = $task->createTaskRun(); $run->setTaskId($task->getTaskId()); $run->setTs(date('Y-m-d H:i:s')); $run->setStatus(TaskRunInterface::RUN_STATUS_STARTED); $run->saveTaskRun(); $run_final_status = TaskRunInterface::RUN_STATUS_COMPLETED; ob_start(); $time_begin = microtime(true); $result = self::parseAndRunCommand($task->getCommand()); if (!$result) { $run_final_status = TaskRunInterface::RUN_STATUS_ERROR; } $output = ob_get_clean(); $run->setOutput($output); $time_end = microtime(true); $time = round(($time_end - $time_begin), 2); $run->setExecutionTime($time); $run->setStatus($run_final_status); $run->saveTaskRun(); return $output; }
[ "public", "static", "function", "runTask", "(", "$", "task", ")", "{", "$", "run", "=", "$", "task", "->", "createTaskRun", "(", ")", ";", "$", "run", "->", "setTaskId", "(", "$", "task", "->", "getTaskId", "(", ")", ")", ";", "$", "run", "->", "...
Runs task and returns output @param TaskInterface $task @return string
[ "Runs", "task", "and", "returns", "output" ]
ccea814d338a0b5edf0e2008ebfe07038090ca5a
https://github.com/MUlt1mate/cron-manager/blob/ccea814d338a0b5edf0e2008ebfe07038090ca5a/src/TaskRunner.php#L65-L92
train
MUlt1mate/cron-manager
src/TaskRunner.php
TaskRunner.parseAndRunCommand
public static function parseAndRunCommand($command) { try { list($class, $method, $args) = TaskManager::parseCommand($command); if (!class_exists($class)) { TaskLoader::loadController($class); } $obj = new $class(); if (!method_exists($obj, $method)) { throw new TaskManagerException('method ' . $method . ' not found in class ' . $class); } return call_user_func_array(array($obj, $method), $args); } catch (\Exception $e) { echo 'Caught an exception: ' . get_class($e) . ': ' . PHP_EOL . $e->getMessage() . PHP_EOL; return false; } }
php
public static function parseAndRunCommand($command) { try { list($class, $method, $args) = TaskManager::parseCommand($command); if (!class_exists($class)) { TaskLoader::loadController($class); } $obj = new $class(); if (!method_exists($obj, $method)) { throw new TaskManagerException('method ' . $method . ' not found in class ' . $class); } return call_user_func_array(array($obj, $method), $args); } catch (\Exception $e) { echo 'Caught an exception: ' . get_class($e) . ': ' . PHP_EOL . $e->getMessage() . PHP_EOL; return false; } }
[ "public", "static", "function", "parseAndRunCommand", "(", "$", "command", ")", "{", "try", "{", "list", "(", "$", "class", ",", "$", "method", ",", "$", "args", ")", "=", "TaskManager", "::", "parseCommand", "(", "$", "command", ")", ";", "if", "(", ...
Parses given command, creates new class object and calls its method via call_user_func_array @param string $command @return mixed
[ "Parses", "given", "command", "creates", "new", "class", "object", "and", "calls", "its", "method", "via", "call_user_func_array" ]
ccea814d338a0b5edf0e2008ebfe07038090ca5a
https://github.com/MUlt1mate/cron-manager/blob/ccea814d338a0b5edf0e2008ebfe07038090ca5a/src/TaskRunner.php#L99-L117
train
MUlt1mate/cron-manager
examples/file_storage/models/TaskRunFile.php
TaskRunFile.saveTaskRun
public function saveTaskRun() { //if monolog not found does nothing if (!class_exists('Monolog\Logger')) { return false; } $logger = new Logger('cron_logger'); $logger->pushHandler(new RotatingFileHandler($this->logs_folder . $this->log_name)); $task = TaskFile::taskGet($this->task_id); if (self::RUN_STATUS_STARTED == $this->status) { $message = 'task ' . $task->getCommand() . ' just started'; } else { $message = 'task ' . $task->getCommand() . ' ended with status ' . $this->status . ', execution time ' . $this->execution_time . ', output: ' . PHP_EOL . $this->output; } return $logger->addNotice($message); }
php
public function saveTaskRun() { //if monolog not found does nothing if (!class_exists('Monolog\Logger')) { return false; } $logger = new Logger('cron_logger'); $logger->pushHandler(new RotatingFileHandler($this->logs_folder . $this->log_name)); $task = TaskFile::taskGet($this->task_id); if (self::RUN_STATUS_STARTED == $this->status) { $message = 'task ' . $task->getCommand() . ' just started'; } else { $message = 'task ' . $task->getCommand() . ' ended with status ' . $this->status . ', execution time ' . $this->execution_time . ', output: ' . PHP_EOL . $this->output; } return $logger->addNotice($message); }
[ "public", "function", "saveTaskRun", "(", ")", "{", "//if monolog not found does nothing", "if", "(", "!", "class_exists", "(", "'Monolog\\Logger'", ")", ")", "{", "return", "false", ";", "}", "$", "logger", "=", "new", "Logger", "(", "'cron_logger'", ")", ";"...
Writes log in file. Do NOT actually saves the task run @return bool
[ "Writes", "log", "in", "file", ".", "Do", "NOT", "actually", "saves", "the", "task", "run" ]
ccea814d338a0b5edf0e2008ebfe07038090ca5a
https://github.com/MUlt1mate/cron-manager/blob/ccea814d338a0b5edf0e2008ebfe07038090ca5a/examples/file_storage/models/TaskRunFile.php#L36-L52
train
spatie/laravel-pjax
src/Middleware/FilterIfPjax.php
FilterIfPjax.createResponseWithLowerCaseContent
protected function createResponseWithLowerCaseContent(Response $response) { $lowercaseContent = strtolower($response->getContent()); return Response::create($lowercaseContent); }
php
protected function createResponseWithLowerCaseContent(Response $response) { $lowercaseContent = strtolower($response->getContent()); return Response::create($lowercaseContent); }
[ "protected", "function", "createResponseWithLowerCaseContent", "(", "Response", "$", "response", ")", "{", "$", "lowercaseContent", "=", "strtolower", "(", "$", "response", "->", "getContent", "(", ")", ")", ";", "return", "Response", "::", "create", "(", "$", ...
Make the content of the given response lowercase. @param \Illuminate\Http\Response $response @return \Illuminate\Http\Response
[ "Make", "the", "content", "of", "the", "given", "response", "lowercase", "." ]
9e4288fe3b08b89103c64911e28ce6d7fc06cd96
https://github.com/spatie/laravel-pjax/blob/9e4288fe3b08b89103c64911e28ce6d7fc06cd96/src/Middleware/FilterIfPjax.php#L147-L152
train
prooph/pdo-event-store
src/MariaDbEventStore.php
MariaDbEventStore.convertToColumn
private function convertToColumn(array &$match): void { if ($this->persistenceStrategy instanceof MariaDBIndexedPersistenceStrategy) { $indexedColumns = $this->persistenceStrategy->indexedMetadataFields(); if (\in_array($match['field'], \array_keys($indexedColumns), true)) { $match['field'] = $indexedColumns[$match['field']]; $match['fieldType'] = FieldType::MESSAGE_PROPERTY(); } } }
php
private function convertToColumn(array &$match): void { if ($this->persistenceStrategy instanceof MariaDBIndexedPersistenceStrategy) { $indexedColumns = $this->persistenceStrategy->indexedMetadataFields(); if (\in_array($match['field'], \array_keys($indexedColumns), true)) { $match['field'] = $indexedColumns[$match['field']]; $match['fieldType'] = FieldType::MESSAGE_PROPERTY(); } } }
[ "private", "function", "convertToColumn", "(", "array", "&", "$", "match", ")", ":", "void", "{", "if", "(", "$", "this", "->", "persistenceStrategy", "instanceof", "MariaDBIndexedPersistenceStrategy", ")", "{", "$", "indexedColumns", "=", "$", "this", "->", "...
Convert metadata fields into indexed columns @example `_aggregate__id` => `aggregate_id`
[ "Convert", "metadata", "fields", "into", "indexed", "columns" ]
01b2cf3d30c1d01a7ad87cc00eb968de97c9c79a
https://github.com/prooph/pdo-event-store/blob/01b2cf3d30c1d01a7ad87cc00eb968de97c9c79a/src/MariaDbEventStore.php#L848-L857
train
prooph/pdo-event-store
src/Util/PostgresHelper.php
PostgresHelper.extractSchema
private function extractSchema(string $ident): ?string { if (false === ($pos = \strpos($ident, '.'))) { return null; } return \substr($ident, 0, $pos); }
php
private function extractSchema(string $ident): ?string { if (false === ($pos = \strpos($ident, '.'))) { return null; } return \substr($ident, 0, $pos); }
[ "private", "function", "extractSchema", "(", "string", "$", "ident", ")", ":", "?", "string", "{", "if", "(", "false", "===", "(", "$", "pos", "=", "\\", "strpos", "(", "$", "ident", ",", "'.'", ")", ")", ")", "{", "return", "null", ";", "}", "re...
Extracts schema name as string before the first dot. @param string $ident @return string|null
[ "Extracts", "schema", "name", "as", "string", "before", "the", "first", "dot", "." ]
01b2cf3d30c1d01a7ad87cc00eb968de97c9c79a
https://github.com/prooph/pdo-event-store/blob/01b2cf3d30c1d01a7ad87cc00eb968de97c9c79a/src/Util/PostgresHelper.php#L44-L51
train
thephpleague/statsd
src/Client.php
Client.configure
public function configure(array $options = array()) { if (isset($options['host'])) { $this->host = $options['host']; } if (isset($options['port'])) { if (!is_numeric($options['port']) || is_float($options['port']) || $options['port'] < 0 || $options['port'] > 65535) { throw new ConfigurationException($this, 'Port is out of range'); } $this->port = $options['port']; } if (isset($options['namespace'])) { $this->namespace = $options['namespace']; } if (isset($options['timeout'])) { $this->timeout = $options['timeout']; } if (isset($options['throwConnectionExceptions'])) { $this->throwConnectionExceptions = $options['throwConnectionExceptions']; } if (isset($options['tags'])) { $this->tags = $options['tags']; } return $this; }
php
public function configure(array $options = array()) { if (isset($options['host'])) { $this->host = $options['host']; } if (isset($options['port'])) { if (!is_numeric($options['port']) || is_float($options['port']) || $options['port'] < 0 || $options['port'] > 65535) { throw new ConfigurationException($this, 'Port is out of range'); } $this->port = $options['port']; } if (isset($options['namespace'])) { $this->namespace = $options['namespace']; } if (isset($options['timeout'])) { $this->timeout = $options['timeout']; } if (isset($options['throwConnectionExceptions'])) { $this->throwConnectionExceptions = $options['throwConnectionExceptions']; } if (isset($options['tags'])) { $this->tags = $options['tags']; } return $this; }
[ "public", "function", "configure", "(", "array", "$", "options", "=", "array", "(", ")", ")", "{", "if", "(", "isset", "(", "$", "options", "[", "'host'", "]", ")", ")", "{", "$", "this", "->", "host", "=", "$", "options", "[", "'host'", "]", ";"...
Initialize Connection Details @param array $options Configuration options @return Client This instance @throws ConfigurationException If port is invalid
[ "Initialize", "Connection", "Details" ]
c6290ef6c7528b7b739b26ce6aedf81ee6a4a2ac
https://github.com/thephpleague/statsd/blob/c6290ef6c7528b7b739b26ce6aedf81ee6a4a2ac/src/Client.php#L131-L160
train
thephpleague/statsd
src/Client.php
Client.increment
public function increment($metrics, $delta = 1, $sampleRate = 1, array $tags = []) { $metrics = (array) $metrics; $data = array(); if ($sampleRate < 1) { foreach ($metrics as $metric) { if ((mt_rand() / mt_getrandmax()) <= $sampleRate) { $data[$metric] = $delta . '|c|@' . $sampleRate; } } } else { foreach ($metrics as $metric) { $data[$metric] = $delta . '|c'; } } return $this->send($data, $tags); }
php
public function increment($metrics, $delta = 1, $sampleRate = 1, array $tags = []) { $metrics = (array) $metrics; $data = array(); if ($sampleRate < 1) { foreach ($metrics as $metric) { if ((mt_rand() / mt_getrandmax()) <= $sampleRate) { $data[$metric] = $delta . '|c|@' . $sampleRate; } } } else { foreach ($metrics as $metric) { $data[$metric] = $delta . '|c'; } } return $this->send($data, $tags); }
[ "public", "function", "increment", "(", "$", "metrics", ",", "$", "delta", "=", "1", ",", "$", "sampleRate", "=", "1", ",", "array", "$", "tags", "=", "[", "]", ")", "{", "$", "metrics", "=", "(", "array", ")", "$", "metrics", ";", "$", "data", ...
Increment a metric @param string|array $metrics Metric(s) to increment @param int $delta Value to decrement the metric by @param int $sampleRate Sample rate of metric @param array $tags A list of metric tags values @return $this @throws ConnectionException
[ "Increment", "a", "metric" ]
c6290ef6c7528b7b739b26ce6aedf81ee6a4a2ac
https://github.com/thephpleague/statsd/blob/c6290ef6c7528b7b739b26ce6aedf81ee6a4a2ac/src/Client.php#L212-L228
train
thephpleague/statsd
src/Client.php
Client.decrement
public function decrement($metrics, $delta = 1, $sampleRate = 1, array $tags = []) { return $this->increment($metrics, 0 - $delta, $sampleRate, $tags); }
php
public function decrement($metrics, $delta = 1, $sampleRate = 1, array $tags = []) { return $this->increment($metrics, 0 - $delta, $sampleRate, $tags); }
[ "public", "function", "decrement", "(", "$", "metrics", ",", "$", "delta", "=", "1", ",", "$", "sampleRate", "=", "1", ",", "array", "$", "tags", "=", "[", "]", ")", "{", "return", "$", "this", "->", "increment", "(", "$", "metrics", ",", "0", "-...
Decrement a metric @param string|array $metrics Metric(s) to decrement @param int $delta Value to increment the metric by @param int $sampleRate Sample rate of metric @param array $tags A list of metric tags values @return $this @throws ConnectionException
[ "Decrement", "a", "metric" ]
c6290ef6c7528b7b739b26ce6aedf81ee6a4a2ac
https://github.com/thephpleague/statsd/blob/c6290ef6c7528b7b739b26ce6aedf81ee6a4a2ac/src/Client.php#L240-L243
train
thephpleague/statsd
src/Client.php
Client.endTiming
public function endTiming($metric, array $tags = array()) { $timer_start = $this->metricTiming[$metric]; $timer_end = microtime(true); $time = round(($timer_end - $timer_start) * 1000, 4); return $this->timing($metric, $time, $tags); }
php
public function endTiming($metric, array $tags = array()) { $timer_start = $this->metricTiming[$metric]; $timer_end = microtime(true); $time = round(($timer_end - $timer_start) * 1000, 4); return $this->timing($metric, $time, $tags); }
[ "public", "function", "endTiming", "(", "$", "metric", ",", "array", "$", "tags", "=", "array", "(", ")", ")", "{", "$", "timer_start", "=", "$", "this", "->", "metricTiming", "[", "$", "metric", "]", ";", "$", "timer_end", "=", "microtime", "(", "tr...
End timing the given metric and record @param string $metric Metric to time @param array $tags A list of metric tags values @return $this @throws ConnectionException
[ "End", "timing", "the", "given", "metric", "and", "record" ]
c6290ef6c7528b7b739b26ce6aedf81ee6a4a2ac
https://github.com/thephpleague/statsd/blob/c6290ef6c7528b7b739b26ce6aedf81ee6a4a2ac/src/Client.php#L263-L269
train
thephpleague/statsd
src/Client.php
Client.timings
public function timings($metrics) { // add |ms to values $data = []; foreach ($metrics as $metric => $timing) { $data[$metric] = $timing.'|ms'; } return $this->send($data); }
php
public function timings($metrics) { // add |ms to values $data = []; foreach ($metrics as $metric => $timing) { $data[$metric] = $timing.'|ms'; } return $this->send($data); }
[ "public", "function", "timings", "(", "$", "metrics", ")", "{", "// add |ms to values", "$", "data", "=", "[", "]", ";", "foreach", "(", "$", "metrics", "as", "$", "metric", "=>", "$", "timing", ")", "{", "$", "data", "[", "$", "metric", "]", "=", ...
Send multiple timing metrics at once @param array $metrics key value map of metric name -> timing value @return Client @throws ConnectionException
[ "Send", "multiple", "timing", "metrics", "at", "once" ]
c6290ef6c7528b7b739b26ce6aedf81ee6a4a2ac
https://github.com/thephpleague/statsd/blob/c6290ef6c7528b7b739b26ce6aedf81ee6a4a2ac/src/Client.php#L295-L304
train
thephpleague/statsd
src/Client.php
Client.send
protected function send(array $data, array $tags = array()) { $tagsData = $this->serializeTags(array_replace($this->tags, $tags)); try { $socket = $this->getSocket(); $messages = array(); $prefix = $this->namespace ? $this->namespace . '.' : ''; foreach ($data as $key => $value) { $messages[] = $prefix . $key . ':' . $value . $tagsData; } $this->message = implode("\n", $messages); @fwrite($socket, $this->message); fflush($socket); } catch (ConnectionException $e) { if ($this->throwConnectionExceptions) { throw $e; } else { trigger_error( sprintf('StatsD server connection failed (udp://%s:%d)', $this->host, $this->port), E_USER_WARNING ); } } return $this; }
php
protected function send(array $data, array $tags = array()) { $tagsData = $this->serializeTags(array_replace($this->tags, $tags)); try { $socket = $this->getSocket(); $messages = array(); $prefix = $this->namespace ? $this->namespace . '.' : ''; foreach ($data as $key => $value) { $messages[] = $prefix . $key . ':' . $value . $tagsData; } $this->message = implode("\n", $messages); @fwrite($socket, $this->message); fflush($socket); } catch (ConnectionException $e) { if ($this->throwConnectionExceptions) { throw $e; } else { trigger_error( sprintf('StatsD server connection failed (udp://%s:%d)', $this->host, $this->port), E_USER_WARNING ); } } return $this; }
[ "protected", "function", "send", "(", "array", "$", "data", ",", "array", "$", "tags", "=", "array", "(", ")", ")", "{", "$", "tagsData", "=", "$", "this", "->", "serializeTags", "(", "array_replace", "(", "$", "this", "->", "tags", ",", "$", "tags",...
Send Data to StatsD Server @param array $data A list of messages to send to the server @param array $tags A list of tags to send to the server @return $this @throws ConnectionException If there is a connection problem with the host
[ "Send", "Data", "to", "StatsD", "Server" ]
c6290ef6c7528b7b739b26ce6aedf81ee6a4a2ac
https://github.com/thephpleague/statsd/blob/c6290ef6c7528b7b739b26ce6aedf81ee6a4a2ac/src/Client.php#L402-L428
train
Adyen/adyen-php-api-library
src/Adyen/Service/AbstractCheckoutResource.php
AbstractCheckoutResource.getCheckoutEndpoint
public function getCheckoutEndpoint($service) { // check if endpoint is set if ($service->getClient()->getConfig()->get('endpointCheckout') == null) { $logger = $service->getClient()->getLogger(); $msg = "Please provide your unique live url prefix on the setEnvironment() call on the Client or provide endpointCheckout in your config object."; $logger->error($msg); throw new \Adyen\AdyenException($msg); } return $service->getClient()->getConfig()->get('endpointCheckout'); }
php
public function getCheckoutEndpoint($service) { // check if endpoint is set if ($service->getClient()->getConfig()->get('endpointCheckout') == null) { $logger = $service->getClient()->getLogger(); $msg = "Please provide your unique live url prefix on the setEnvironment() call on the Client or provide endpointCheckout in your config object."; $logger->error($msg); throw new \Adyen\AdyenException($msg); } return $service->getClient()->getConfig()->get('endpointCheckout'); }
[ "public", "function", "getCheckoutEndpoint", "(", "$", "service", ")", "{", "// check if endpoint is set", "if", "(", "$", "service", "->", "getClient", "(", ")", "->", "getConfig", "(", ")", "->", "get", "(", "'endpointCheckout'", ")", "==", "null", ")", "{...
Return Checkout endpoint @param $service @return mixed @throws \Adyen\AdyenException
[ "Return", "Checkout", "endpoint" ]
93e14be0c1782e9bc23189905fb51206a95633bf
https://github.com/Adyen/adyen-php-api-library/blob/93e14be0c1782e9bc23189905fb51206a95633bf/src/Adyen/Service/AbstractCheckoutResource.php#L14-L25
train
Adyen/adyen-php-api-library
src/Adyen/Client.php
Client.setEnvironment
public function setEnvironment($environment, $liveEndpointUrlPrefix = null) { if ($environment == \Adyen\Environment::TEST) { $this->config->set('environment', \Adyen\Environment::TEST); $this->config->set('endpoint', self::ENDPOINT_TEST); $this->config->set('endpointDirectorylookup', self::ENDPOINT_TEST_DIRECTORY_LOOKUP); $this->config->set('endpointTerminalCloud', self::ENDPOINT_TERMINAL_CLOUD_TEST); $this->config->set('endpointCheckout', self::ENDPOINT_CHECKOUT_TEST); $this->config->set('endpointNotification', self::ENDPOINT_NOTIFICATION_TEST); $this->config->set('endpointAccount', self::ENDPOINT_ACCOUNT_TEST); $this->config->set('endpointFund', self::ENDPOINT_FUND_TEST); } elseif ($environment == \Adyen\Environment::LIVE) { $this->config->set('environment', \Adyen\Environment::LIVE); $this->config->set('endpointDirectorylookup', self::ENDPOINT_LIVE_DIRECTORY_LOOKUP); $this->config->set('endpointTerminalCloud', self::ENDPOINT_TERMINAL_CLOUD_LIVE); $this->config->set('endpointNotification', self::ENDPOINT_NOTIFICATION_LIVE); $this->config->set('endpointAccount', self::ENDPOINT_ACCOUNT_LIVE); $this->config->set('endpointFund', self::ENDPOINT_FUND_LIVE); if ($liveEndpointUrlPrefix) { $this->config->set('endpoint', self::ENDPOINT_PROTOCOL . $liveEndpointUrlPrefix . self::ENDPOINT_LIVE_SUFFIX); $this->config->set('endpointCheckout', self::ENDPOINT_PROTOCOL . $liveEndpointUrlPrefix . self::ENDPOINT_CHECKOUT_LIVE_SUFFIX); } else { $this->config->set('endpoint', self::ENDPOINT_LIVE); $this->config->set('endpointCheckout', null); // not supported please specify unique identifier } } else { // environment does not exist $msg = "This environment does not exist, use " . \Adyen\Environment::TEST . ' or ' . \Adyen\Environment::LIVE; throw new \Adyen\AdyenException($msg); } }
php
public function setEnvironment($environment, $liveEndpointUrlPrefix = null) { if ($environment == \Adyen\Environment::TEST) { $this->config->set('environment', \Adyen\Environment::TEST); $this->config->set('endpoint', self::ENDPOINT_TEST); $this->config->set('endpointDirectorylookup', self::ENDPOINT_TEST_DIRECTORY_LOOKUP); $this->config->set('endpointTerminalCloud', self::ENDPOINT_TERMINAL_CLOUD_TEST); $this->config->set('endpointCheckout', self::ENDPOINT_CHECKOUT_TEST); $this->config->set('endpointNotification', self::ENDPOINT_NOTIFICATION_TEST); $this->config->set('endpointAccount', self::ENDPOINT_ACCOUNT_TEST); $this->config->set('endpointFund', self::ENDPOINT_FUND_TEST); } elseif ($environment == \Adyen\Environment::LIVE) { $this->config->set('environment', \Adyen\Environment::LIVE); $this->config->set('endpointDirectorylookup', self::ENDPOINT_LIVE_DIRECTORY_LOOKUP); $this->config->set('endpointTerminalCloud', self::ENDPOINT_TERMINAL_CLOUD_LIVE); $this->config->set('endpointNotification', self::ENDPOINT_NOTIFICATION_LIVE); $this->config->set('endpointAccount', self::ENDPOINT_ACCOUNT_LIVE); $this->config->set('endpointFund', self::ENDPOINT_FUND_LIVE); if ($liveEndpointUrlPrefix) { $this->config->set('endpoint', self::ENDPOINT_PROTOCOL . $liveEndpointUrlPrefix . self::ENDPOINT_LIVE_SUFFIX); $this->config->set('endpointCheckout', self::ENDPOINT_PROTOCOL . $liveEndpointUrlPrefix . self::ENDPOINT_CHECKOUT_LIVE_SUFFIX); } else { $this->config->set('endpoint', self::ENDPOINT_LIVE); $this->config->set('endpointCheckout', null); // not supported please specify unique identifier } } else { // environment does not exist $msg = "This environment does not exist, use " . \Adyen\Environment::TEST . ' or ' . \Adyen\Environment::LIVE; throw new \Adyen\AdyenException($msg); } }
[ "public", "function", "setEnvironment", "(", "$", "environment", ",", "$", "liveEndpointUrlPrefix", "=", "null", ")", "{", "if", "(", "$", "environment", "==", "\\", "Adyen", "\\", "Environment", "::", "TEST", ")", "{", "$", "this", "->", "config", "->", ...
Set environment to connect to test or live platform of Adyen For live please specify the unique identifier. @param string $environment @param null $liveEndpointUrlPrefix Provide the unique live url prefix from the "API URLs and Response" menu in the Adyen Customer Area @throws AdyenException
[ "Set", "environment", "to", "connect", "to", "test", "or", "live", "platform", "of", "Adyen", "For", "live", "please", "specify", "the", "unique", "identifier", "." ]
93e14be0c1782e9bc23189905fb51206a95633bf
https://github.com/Adyen/adyen-php-api-library/blob/93e14be0c1782e9bc23189905fb51206a95633bf/src/Adyen/Client.php#L120-L153
train
Adyen/adyen-php-api-library
src/Adyen/Client.php
Client.setExternalPlatform
public function setExternalPlatform($name, $version, $integrator = "") { $this->config->set('externalPlatform', array('name' => $name, 'version' => $version, 'integrator' => $integrator)); }
php
public function setExternalPlatform($name, $version, $integrator = "") { $this->config->set('externalPlatform', array('name' => $name, 'version' => $version, 'integrator' => $integrator)); }
[ "public", "function", "setExternalPlatform", "(", "$", "name", ",", "$", "version", ",", "$", "integrator", "=", "\"\"", ")", "{", "$", "this", "->", "config", "->", "set", "(", "'externalPlatform'", ",", "array", "(", "'name'", "=>", "$", "name", ",", ...
Set external platform name, version and integrator @param string $name @param string $version @param string $integrator
[ "Set", "external", "platform", "name", "version", "and", "integrator" ]
93e14be0c1782e9bc23189905fb51206a95633bf
https://github.com/Adyen/adyen-php-api-library/blob/93e14be0c1782e9bc23189905fb51206a95633bf/src/Adyen/Client.php#L198-L202
train
Adyen/adyen-php-api-library
src/Adyen/Service/AbstractResource.php
AbstractResource.request
public function request($params) { // convert to PHP Array if type is inputType is json if ($this->service->getClient()->getConfig()->getInputType() == 'json') { $params = json_decode($params, true); if ($params === null && json_last_error() !== JSON_ERROR_NONE) { $msg = 'The parameters in the request expect valid JSON but JSON error code found: ' . json_last_error(); $this->service->getClient()->getLogger()->error($msg); throw new \Adyen\AdyenException($msg); } } if (!is_array($params)) { $msg = 'The parameter is not valid array'; $this->service->getClient()->getLogger()->error($msg); throw new \Adyen\AdyenException($msg); } $params = $this->addDefaultParametersToRequest($params); $params = $this->handleApplicationInfoInRequest($params); $curlClient = $this->service->getClient()->getHttpClient(); return $curlClient->requestJson($this->service, $this->endpoint, $params); }
php
public function request($params) { // convert to PHP Array if type is inputType is json if ($this->service->getClient()->getConfig()->getInputType() == 'json') { $params = json_decode($params, true); if ($params === null && json_last_error() !== JSON_ERROR_NONE) { $msg = 'The parameters in the request expect valid JSON but JSON error code found: ' . json_last_error(); $this->service->getClient()->getLogger()->error($msg); throw new \Adyen\AdyenException($msg); } } if (!is_array($params)) { $msg = 'The parameter is not valid array'; $this->service->getClient()->getLogger()->error($msg); throw new \Adyen\AdyenException($msg); } $params = $this->addDefaultParametersToRequest($params); $params = $this->handleApplicationInfoInRequest($params); $curlClient = $this->service->getClient()->getHttpClient(); return $curlClient->requestJson($this->service, $this->endpoint, $params); }
[ "public", "function", "request", "(", "$", "params", ")", "{", "// convert to PHP Array if type is inputType is json", "if", "(", "$", "this", "->", "service", "->", "getClient", "(", ")", "->", "getConfig", "(", ")", "->", "getInputType", "(", ")", "==", "'js...
Do the request to the Http Client @param $params @return mixed @throws \Adyen\AdyenException
[ "Do", "the", "request", "to", "the", "Http", "Client" ]
93e14be0c1782e9bc23189905fb51206a95633bf
https://github.com/Adyen/adyen-php-api-library/blob/93e14be0c1782e9bc23189905fb51206a95633bf/src/Adyen/Service/AbstractResource.php#L43-L67
train
Adyen/adyen-php-api-library
src/Adyen/Service/AbstractResource.php
AbstractResource.addDefaultParametersToRequest
private function addDefaultParametersToRequest($params) { // check if merchantAccount is setup in client and request is missing merchantAccount then add it if (!isset($params['merchantAccount']) && $this->service->getClient()->getConfig()->getMerchantAccount()) { $params['merchantAccount'] = $this->service->getClient()->getConfig()->getMerchantAccount(); } return $params; }
php
private function addDefaultParametersToRequest($params) { // check if merchantAccount is setup in client and request is missing merchantAccount then add it if (!isset($params['merchantAccount']) && $this->service->getClient()->getConfig()->getMerchantAccount()) { $params['merchantAccount'] = $this->service->getClient()->getConfig()->getMerchantAccount(); } return $params; }
[ "private", "function", "addDefaultParametersToRequest", "(", "$", "params", ")", "{", "// check if merchantAccount is setup in client and request is missing merchantAccount then add it", "if", "(", "!", "isset", "(", "$", "params", "[", "'merchantAccount'", "]", ")", "&&", ...
Fill expected but missing parameters with default data @param $params @return mixed
[ "Fill", "expected", "but", "missing", "parameters", "with", "default", "data" ]
93e14be0c1782e9bc23189905fb51206a95633bf
https://github.com/Adyen/adyen-php-api-library/blob/93e14be0c1782e9bc23189905fb51206a95633bf/src/Adyen/Service/AbstractResource.php#L93-L101
train
Adyen/adyen-php-api-library
src/Adyen/Service/AbstractResource.php
AbstractResource.handleApplicationInfoInRequest
private function handleApplicationInfoInRequest($params) { // Only add if allowed if ($this->allowApplicationInfo) { // add/overwrite applicationInfo adyenLibrary even if it's already set $params['applicationInfo']['adyenLibrary']['name'] = $this->service->getClient()->getLibraryName(); $params['applicationInfo']['adyenLibrary']['version'] = $this->service->getClient()->getLibraryVersion(); if ($adyenPaymentSource = $this->service->getClient()->getConfig()->getAdyenPaymentSource()) { $params['applicationInfo']['adyenPaymentSource']['version'] = $adyenPaymentSource['version']; $params['applicationInfo']['adyenPaymentSource']['name'] = $adyenPaymentSource['name']; } if ($externalPlatform = $this->service->getClient()->getConfig()->getExternalPlatform()) { $params['applicationInfo']['externalPlatform']['version'] = $externalPlatform['version']; $params['applicationInfo']['externalPlatform']['name'] = $externalPlatform['name']; if (!empty($externalPlatform['integrator'])) { $params['applicationInfo']['externalPlatform']['integrator'] = $externalPlatform['integrator']; } } } else { // remove if exists if (isset($params['applicationInfo'])) { unset($params['applicationInfo']); } } return $params; }
php
private function handleApplicationInfoInRequest($params) { // Only add if allowed if ($this->allowApplicationInfo) { // add/overwrite applicationInfo adyenLibrary even if it's already set $params['applicationInfo']['adyenLibrary']['name'] = $this->service->getClient()->getLibraryName(); $params['applicationInfo']['adyenLibrary']['version'] = $this->service->getClient()->getLibraryVersion(); if ($adyenPaymentSource = $this->service->getClient()->getConfig()->getAdyenPaymentSource()) { $params['applicationInfo']['adyenPaymentSource']['version'] = $adyenPaymentSource['version']; $params['applicationInfo']['adyenPaymentSource']['name'] = $adyenPaymentSource['name']; } if ($externalPlatform = $this->service->getClient()->getConfig()->getExternalPlatform()) { $params['applicationInfo']['externalPlatform']['version'] = $externalPlatform['version']; $params['applicationInfo']['externalPlatform']['name'] = $externalPlatform['name']; if (!empty($externalPlatform['integrator'])) { $params['applicationInfo']['externalPlatform']['integrator'] = $externalPlatform['integrator']; } } } else { // remove if exists if (isset($params['applicationInfo'])) { unset($params['applicationInfo']); } } return $params; }
[ "private", "function", "handleApplicationInfoInRequest", "(", "$", "params", ")", "{", "// Only add if allowed", "if", "(", "$", "this", "->", "allowApplicationInfo", ")", "{", "// add/overwrite applicationInfo adyenLibrary even if it's already set", "$", "params", "[", "'a...
If allowApplicationInfo is true then it adds applicationInfo to request otherwise removes from the request @param $params @return mixed
[ "If", "allowApplicationInfo", "is", "true", "then", "it", "adds", "applicationInfo", "to", "request", "otherwise", "removes", "from", "the", "request" ]
93e14be0c1782e9bc23189905fb51206a95633bf
https://github.com/Adyen/adyen-php-api-library/blob/93e14be0c1782e9bc23189905fb51206a95633bf/src/Adyen/Service/AbstractResource.php#L110-L140
train
Adyen/adyen-php-api-library
src/Adyen/HttpClient/CurlClient.php
CurlClient.requestJson
public function requestJson(\Adyen\Service $service, $requestUrl, $params) { $client = $service->getClient(); $config = $client->getConfig(); $logger = $client->getLogger(); $username = $config->getUsername(); $password = $config->getPassword(); $xApiKey = $config->getXApiKey(); $jsonRequest = json_encode($params); // log the request $this->logRequest($logger, $requestUrl, $params); //Initiate cURL. $ch = curl_init($requestUrl); //Tell cURL that we want to send a POST request. curl_setopt($ch, CURLOPT_POST, 1); //Attach our encoded JSON string to the POST fields. curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonRequest); //create a custom User-Agent $userAgent = $config->get('applicationName') . " " . \Adyen\Client::USER_AGENT_SUFFIX . $client->getLibraryVersion(); //Set the content type to application/json and use the defined userAgent $headers = array( 'Content-Type: application/json', 'User-Agent: ' . $userAgent ); // set authorisation credentials according to support & availability if (!empty($xApiKey)) { //Set the content type to application/json and use the defined userAgent along with the x-api-key $headers[] = 'x-api-key: ' . $xApiKey; } elseif ($service->requiresApiKey()) { $msg = "Please provide a valid Checkout API Key"; throw new \Adyen\AdyenException($msg); } else { //Set the basic auth credentials curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $password); } //Set the timeout if ($config->getTimeout() != null) { curl_setopt($ch, CURLOPT_TIMEOUT, $config->getTimeout()); } //Set the headers curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); // return the result curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //Execute the request list($result, $httpStatus) = $this->curlRequest($ch); // log the raw response $logger->info("JSON Response is: " . $result); // Get errors list($errno, $message) = $this->curlError($ch); curl_close($ch); // result not 200 throw error if ($httpStatus != 200 && $result) { $this->handleResultError($result, $logger); } elseif (!$result) { $this->handleCurlError($requestUrl, $errno, $message, $logger); } // result in array or json if ($config->getOutputType() == 'array') { // transform to PHP Array $result = json_decode($result, true); // log the array result $logger->info('Params in response from Adyen:' . print_r($result, 1)); } return $result; }
php
public function requestJson(\Adyen\Service $service, $requestUrl, $params) { $client = $service->getClient(); $config = $client->getConfig(); $logger = $client->getLogger(); $username = $config->getUsername(); $password = $config->getPassword(); $xApiKey = $config->getXApiKey(); $jsonRequest = json_encode($params); // log the request $this->logRequest($logger, $requestUrl, $params); //Initiate cURL. $ch = curl_init($requestUrl); //Tell cURL that we want to send a POST request. curl_setopt($ch, CURLOPT_POST, 1); //Attach our encoded JSON string to the POST fields. curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonRequest); //create a custom User-Agent $userAgent = $config->get('applicationName') . " " . \Adyen\Client::USER_AGENT_SUFFIX . $client->getLibraryVersion(); //Set the content type to application/json and use the defined userAgent $headers = array( 'Content-Type: application/json', 'User-Agent: ' . $userAgent ); // set authorisation credentials according to support & availability if (!empty($xApiKey)) { //Set the content type to application/json and use the defined userAgent along with the x-api-key $headers[] = 'x-api-key: ' . $xApiKey; } elseif ($service->requiresApiKey()) { $msg = "Please provide a valid Checkout API Key"; throw new \Adyen\AdyenException($msg); } else { //Set the basic auth credentials curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $password); } //Set the timeout if ($config->getTimeout() != null) { curl_setopt($ch, CURLOPT_TIMEOUT, $config->getTimeout()); } //Set the headers curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); // return the result curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //Execute the request list($result, $httpStatus) = $this->curlRequest($ch); // log the raw response $logger->info("JSON Response is: " . $result); // Get errors list($errno, $message) = $this->curlError($ch); curl_close($ch); // result not 200 throw error if ($httpStatus != 200 && $result) { $this->handleResultError($result, $logger); } elseif (!$result) { $this->handleCurlError($requestUrl, $errno, $message, $logger); } // result in array or json if ($config->getOutputType() == 'array') { // transform to PHP Array $result = json_decode($result, true); // log the array result $logger->info('Params in response from Adyen:' . print_r($result, 1)); } return $result; }
[ "public", "function", "requestJson", "(", "\\", "Adyen", "\\", "Service", "$", "service", ",", "$", "requestUrl", ",", "$", "params", ")", "{", "$", "client", "=", "$", "service", "->", "getClient", "(", ")", ";", "$", "config", "=", "$", "client", "...
Json API request to Adyen @param \Adyen\Service $service @param $requestUrl @param $params @return mixed @throws \Adyen\AdyenException
[ "Json", "API", "request", "to", "Adyen" ]
93e14be0c1782e9bc23189905fb51206a95633bf
https://github.com/Adyen/adyen-php-api-library/blob/93e14be0c1782e9bc23189905fb51206a95633bf/src/Adyen/HttpClient/CurlClient.php#L16-L102
train
Adyen/adyen-php-api-library
src/Adyen/HttpClient/CurlClient.php
CurlClient.requestPost
public function requestPost(\Adyen\Service $service, $requestUrl, $params) { $client = $service->getClient(); $config = $client->getConfig(); $logger = $client->getLogger(); $username = $config->getUsername(); $password = $config->getPassword(); // log the requestUr, params and json request $logger->info("Request url to Adyen: " . $requestUrl); $logger->info('Params in request to Adyen:' . print_r($params, 1)); //Initiate cURL. $ch = curl_init($requestUrl); //Tell cURL that we want to send a POST request. curl_setopt($ch, CURLOPT_POST, 1); // set authorisation curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $password); curl_setopt($ch, CURLOPT_POST, count($params)); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params)); // set a custom User-Agent $userAgent = $config->get('applicationName') . " " . \Adyen\Client::USER_AGENT_SUFFIX . $client->getLibraryVersion(); //Set the content type to application/json and use the defined userAgent $headers = array( 'Content-Type: application/x-www-form-urlencoded', 'User-Agent: ' . $userAgent ); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); // return the result curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //Execute the request list($result, $httpStatus) = $this->curlRequest($ch); // log the raw response $logger->info("JSON Response is: " . $result); // Get errors list($errno, $message) = $this->curlError($ch); curl_close($ch); if ($httpStatus != 200 && $result) { $this->handleResultError($result, $logger); } elseif (!$result) { $this->handleCurlError($requestUrl, $errno, $message, $logger); } // result in array or json if ($config->getOutputType() == 'array') { // transform to PHP Array $result = json_decode($result, true); if (!$result) { $msg = "The result is empty, looks like your request is invalid"; $logger->error($msg); throw new \Adyen\AdyenException($msg); } // log the array result $logger->info('Params in response from Adyen:' . print_r($result, 1)); } return $result; }
php
public function requestPost(\Adyen\Service $service, $requestUrl, $params) { $client = $service->getClient(); $config = $client->getConfig(); $logger = $client->getLogger(); $username = $config->getUsername(); $password = $config->getPassword(); // log the requestUr, params and json request $logger->info("Request url to Adyen: " . $requestUrl); $logger->info('Params in request to Adyen:' . print_r($params, 1)); //Initiate cURL. $ch = curl_init($requestUrl); //Tell cURL that we want to send a POST request. curl_setopt($ch, CURLOPT_POST, 1); // set authorisation curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $password); curl_setopt($ch, CURLOPT_POST, count($params)); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params)); // set a custom User-Agent $userAgent = $config->get('applicationName') . " " . \Adyen\Client::USER_AGENT_SUFFIX . $client->getLibraryVersion(); //Set the content type to application/json and use the defined userAgent $headers = array( 'Content-Type: application/x-www-form-urlencoded', 'User-Agent: ' . $userAgent ); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); // return the result curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //Execute the request list($result, $httpStatus) = $this->curlRequest($ch); // log the raw response $logger->info("JSON Response is: " . $result); // Get errors list($errno, $message) = $this->curlError($ch); curl_close($ch); if ($httpStatus != 200 && $result) { $this->handleResultError($result, $logger); } elseif (!$result) { $this->handleCurlError($requestUrl, $errno, $message, $logger); } // result in array or json if ($config->getOutputType() == 'array') { // transform to PHP Array $result = json_decode($result, true); if (!$result) { $msg = "The result is empty, looks like your request is invalid"; $logger->error($msg); throw new \Adyen\AdyenException($msg); } // log the array result $logger->info('Params in response from Adyen:' . print_r($result, 1)); } return $result; }
[ "public", "function", "requestPost", "(", "\\", "Adyen", "\\", "Service", "$", "service", ",", "$", "requestUrl", ",", "$", "params", ")", "{", "$", "client", "=", "$", "service", "->", "getClient", "(", ")", ";", "$", "config", "=", "$", "client", "...
Request to Adyen with query string used for Directory Lookup @param \Adyen\Service $service @param $requestUrl @param $params @return mixed @throws \Adyen\AdyenException
[ "Request", "to", "Adyen", "with", "query", "string", "used", "for", "Directory", "Lookup" ]
93e14be0c1782e9bc23189905fb51206a95633bf
https://github.com/Adyen/adyen-php-api-library/blob/93e14be0c1782e9bc23189905fb51206a95633bf/src/Adyen/HttpClient/CurlClient.php#L113-L184
train
Adyen/adyen-php-api-library
src/Adyen/HttpClient/CurlClient.php
CurlClient.handleCurlError
protected function handleCurlError($url, $errno, $message, $logger) { switch ($errno) { case CURLE_OK: $msg = "Probably your Web Service username and/or password is incorrect"; break; case CURLE_COULDNT_RESOLVE_HOST: case CURLE_OPERATION_TIMEOUTED: $msg = "Could not connect to Adyen ($url). Please check your " . "internet connection and try again."; break; case CURLE_SSL_CACERT: case CURLE_SSL_PEER_CERTIFICATE: $msg = "Could not verify Adyen's SSL certificate. Please make sure " . "that your network is not intercepting certificates. " . "(Try going to $url in your browser.) " . "If this problem persists,"; break; default: $msg = "Unexpected error communicating with Adyen."; } $msg .= "\n(Network error [errno $errno]: $message)"; $logger->error($msg); throw new \Adyen\ConnectionException($msg, $errno); }
php
protected function handleCurlError($url, $errno, $message, $logger) { switch ($errno) { case CURLE_OK: $msg = "Probably your Web Service username and/or password is incorrect"; break; case CURLE_COULDNT_RESOLVE_HOST: case CURLE_OPERATION_TIMEOUTED: $msg = "Could not connect to Adyen ($url). Please check your " . "internet connection and try again."; break; case CURLE_SSL_CACERT: case CURLE_SSL_PEER_CERTIFICATE: $msg = "Could not verify Adyen's SSL certificate. Please make sure " . "that your network is not intercepting certificates. " . "(Try going to $url in your browser.) " . "If this problem persists,"; break; default: $msg = "Unexpected error communicating with Adyen."; } $msg .= "\n(Network error [errno $errno]: $message)"; $logger->error($msg); throw new \Adyen\ConnectionException($msg, $errno); }
[ "protected", "function", "handleCurlError", "(", "$", "url", ",", "$", "errno", ",", "$", "message", ",", "$", "logger", ")", "{", "switch", "(", "$", "errno", ")", "{", "case", "CURLE_OK", ":", "$", "msg", "=", "\"Probably your Web Service username and/or p...
Handle Curl exceptions @param $url @param $errno @param $message @param $logger @throws \Adyen\ConnectionException
[ "Handle", "Curl", "exceptions" ]
93e14be0c1782e9bc23189905fb51206a95633bf
https://github.com/Adyen/adyen-php-api-library/blob/93e14be0c1782e9bc23189905fb51206a95633bf/src/Adyen/HttpClient/CurlClient.php#L196-L220
train
Adyen/adyen-php-api-library
src/Adyen/HttpClient/CurlClient.php
CurlClient.handleResultError
protected function handleResultError($result, $logger) { $decodeResult = json_decode($result, true); if (isset($decodeResult['message']) && isset($decodeResult['errorCode'])) { $logger->error($decodeResult['errorCode'] . ': ' . $decodeResult['message']); throw new \Adyen\AdyenException($decodeResult['message'], $decodeResult['errorCode'], null, $decodeResult['status'], $decodeResult['errorType']); } $logger->error($result); throw new \Adyen\AdyenException($result); }
php
protected function handleResultError($result, $logger) { $decodeResult = json_decode($result, true); if (isset($decodeResult['message']) && isset($decodeResult['errorCode'])) { $logger->error($decodeResult['errorCode'] . ': ' . $decodeResult['message']); throw new \Adyen\AdyenException($decodeResult['message'], $decodeResult['errorCode'], null, $decodeResult['status'], $decodeResult['errorType']); } $logger->error($result); throw new \Adyen\AdyenException($result); }
[ "protected", "function", "handleResultError", "(", "$", "result", ",", "$", "logger", ")", "{", "$", "decodeResult", "=", "json_decode", "(", "$", "result", ",", "true", ")", ";", "if", "(", "isset", "(", "$", "decodeResult", "[", "'message'", "]", ")", ...
Handle result errors from Adyen @param $result @param $logger @throws \Adyen\AdyenException
[ "Handle", "result", "errors", "from", "Adyen" ]
93e14be0c1782e9bc23189905fb51206a95633bf
https://github.com/Adyen/adyen-php-api-library/blob/93e14be0c1782e9bc23189905fb51206a95633bf/src/Adyen/HttpClient/CurlClient.php#L229-L239
train
Adyen/adyen-php-api-library
src/Adyen/HttpClient/CurlClient.php
CurlClient.logRequest
private function logRequest(\Psr\Log\LoggerInterface $logger, $requestUrl, $params) { // log the requestUr, params and json request $logger->info("Request url to Adyen: " . $requestUrl); if (isset($params["additionalData"]) && isset($params["additionalData"]["card.encrypted.json"])) { $params["additionalData"]["card.encrypted.json"] = "*"; } if (isset($params["card"]) && isset($params["card"]["number"])) { $params["card"]["number"] = "*"; $params["card"]["cvc"] = "*"; } $logger->info('JSON Request to Adyen:' . json_encode($params)); }
php
private function logRequest(\Psr\Log\LoggerInterface $logger, $requestUrl, $params) { // log the requestUr, params and json request $logger->info("Request url to Adyen: " . $requestUrl); if (isset($params["additionalData"]) && isset($params["additionalData"]["card.encrypted.json"])) { $params["additionalData"]["card.encrypted.json"] = "*"; } if (isset($params["card"]) && isset($params["card"]["number"])) { $params["card"]["number"] = "*"; $params["card"]["cvc"] = "*"; } $logger->info('JSON Request to Adyen:' . json_encode($params)); }
[ "private", "function", "logRequest", "(", "\\", "Psr", "\\", "Log", "\\", "LoggerInterface", "$", "logger", ",", "$", "requestUrl", ",", "$", "params", ")", "{", "// log the requestUr, params and json request", "$", "logger", "->", "info", "(", "\"Request url to A...
Logs the API request, removing sensitive data @param \Psr\Log\LoggerInterface $logger @param $requestUrl @param $params
[ "Logs", "the", "API", "request", "removing", "sensitive", "data" ]
93e14be0c1782e9bc23189905fb51206a95633bf
https://github.com/Adyen/adyen-php-api-library/blob/93e14be0c1782e9bc23189905fb51206a95633bf/src/Adyen/HttpClient/CurlClient.php#L248-L260
train
Adyen/adyen-php-api-library
src/Adyen/HttpClient/CurlClient.php
CurlClient.curlRequest
protected function curlRequest($ch) { $result = curl_exec($ch); $httpStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE); return array($result, $httpStatus); }
php
protected function curlRequest($ch) { $result = curl_exec($ch); $httpStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE); return array($result, $httpStatus); }
[ "protected", "function", "curlRequest", "(", "$", "ch", ")", "{", "$", "result", "=", "curl_exec", "(", "$", "ch", ")", ";", "$", "httpStatus", "=", "curl_getinfo", "(", "$", "ch", ",", "CURLINFO_HTTP_CODE", ")", ";", "return", "array", "(", "$", "resu...
Execute curl, return the result and the http response code @param $ch @return array
[ "Execute", "curl", "return", "the", "result", "and", "the", "http", "response", "code" ]
93e14be0c1782e9bc23189905fb51206a95633bf
https://github.com/Adyen/adyen-php-api-library/blob/93e14be0c1782e9bc23189905fb51206a95633bf/src/Adyen/HttpClient/CurlClient.php#L268-L273
train
Adyen/adyen-php-api-library
src/Adyen/HttpClient/CurlClient.php
CurlClient.curlError
protected function curlError($ch) { $errno = curl_errno($ch); $message = curl_error($ch); return array($errno, $message); }
php
protected function curlError($ch) { $errno = curl_errno($ch); $message = curl_error($ch); return array($errno, $message); }
[ "protected", "function", "curlError", "(", "$", "ch", ")", "{", "$", "errno", "=", "curl_errno", "(", "$", "ch", ")", ";", "$", "message", "=", "curl_error", "(", "$", "ch", ")", ";", "return", "array", "(", "$", "errno", ",", "$", "message", ")", ...
Retrieve curl error number and message @param $ch @return array
[ "Retrieve", "curl", "error", "number", "and", "message" ]
93e14be0c1782e9bc23189905fb51206a95633bf
https://github.com/Adyen/adyen-php-api-library/blob/93e14be0c1782e9bc23189905fb51206a95633bf/src/Adyen/HttpClient/CurlClient.php#L281-L286
train
OXID-eSales/oxideshop_ce
source/Application/Model/ManufacturerList.php
ManufacturerList.loadManufacturerList
public function loadManufacturerList() { $oBaseObject = $this->getBaseObject(); $sFieldList = $oBaseObject->getSelectFields(); $sViewName = $oBaseObject->getViewName(); $this->getBaseObject()->setShowArticleCnt($this->_blShowManufacturerArticleCnt); $sWhere = ''; if (!$this->isAdmin()) { $sWhere = $oBaseObject->getSqlActiveSnippet(); $sWhere = $sWhere ? " where $sWhere and " : ' where '; $sWhere .= "{$sViewName}.oxtitle != '' "; } $sSelect = "select {$sFieldList} from {$sViewName} {$sWhere} order by {$sViewName}.oxtitle"; $this->selectString($sSelect); }
php
public function loadManufacturerList() { $oBaseObject = $this->getBaseObject(); $sFieldList = $oBaseObject->getSelectFields(); $sViewName = $oBaseObject->getViewName(); $this->getBaseObject()->setShowArticleCnt($this->_blShowManufacturerArticleCnt); $sWhere = ''; if (!$this->isAdmin()) { $sWhere = $oBaseObject->getSqlActiveSnippet(); $sWhere = $sWhere ? " where $sWhere and " : ' where '; $sWhere .= "{$sViewName}.oxtitle != '' "; } $sSelect = "select {$sFieldList} from {$sViewName} {$sWhere} order by {$sViewName}.oxtitle"; $this->selectString($sSelect); }
[ "public", "function", "loadManufacturerList", "(", ")", "{", "$", "oBaseObject", "=", "$", "this", "->", "getBaseObject", "(", ")", ";", "$", "sFieldList", "=", "$", "oBaseObject", "->", "getSelectFields", "(", ")", ";", "$", "sViewName", "=", "$", "oBaseO...
Loads simple manufacturer list
[ "Loads", "simple", "manufacturer", "list" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/ManufacturerList.php#L69-L86
train
OXID-eSales/oxideshop_ce
source/Application/Model/ManufacturerList.php
ManufacturerList.buildManufacturerTree
public function buildManufacturerTree($sLinkTarget, $sActCat, $sShopHomeUrl) { //Load manufacturer list $this->loadManufacturerList(); //Create fake manufacturer root category $this->_oRoot = oxNew(\OxidEsales\Eshop\Application\Model\Manufacturer::class); $this->_oRoot->load("root"); //category fields $this->_addCategoryFields($this->_oRoot); $this->_aPath[] = $this->_oRoot; foreach ($this as $sVndId => $oManufacturer) { // storing active manufacturer object if ((string)$sVndId === $sActCat) { $this->setClickManufacturer($oManufacturer); } $this->_addCategoryFields($oManufacturer); if ($sActCat == $oManufacturer->oxmanufacturers__oxid->value) { $this->_aPath[] = $oManufacturer; } } $this->_seoSetManufacturerData(); }
php
public function buildManufacturerTree($sLinkTarget, $sActCat, $sShopHomeUrl) { //Load manufacturer list $this->loadManufacturerList(); //Create fake manufacturer root category $this->_oRoot = oxNew(\OxidEsales\Eshop\Application\Model\Manufacturer::class); $this->_oRoot->load("root"); //category fields $this->_addCategoryFields($this->_oRoot); $this->_aPath[] = $this->_oRoot; foreach ($this as $sVndId => $oManufacturer) { // storing active manufacturer object if ((string)$sVndId === $sActCat) { $this->setClickManufacturer($oManufacturer); } $this->_addCategoryFields($oManufacturer); if ($sActCat == $oManufacturer->oxmanufacturers__oxid->value) { $this->_aPath[] = $oManufacturer; } } $this->_seoSetManufacturerData(); }
[ "public", "function", "buildManufacturerTree", "(", "$", "sLinkTarget", ",", "$", "sActCat", ",", "$", "sShopHomeUrl", ")", "{", "//Load manufacturer list", "$", "this", "->", "loadManufacturerList", "(", ")", ";", "//Create fake manufacturer root category", "$", "thi...
Creates fake root for manufacturer tree, and ads category list fileds for each manufacturer item @param string $sLinkTarget Name of class, responsible for category rendering @param string $sActCat Active category @param string $sShopHomeUrl base shop url ($myConfig->getShopHomeUrl())
[ "Creates", "fake", "root", "for", "manufacturer", "tree", "and", "ads", "category", "list", "fileds", "for", "each", "manufacturer", "item" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/ManufacturerList.php#L95-L122
train
OXID-eSales/oxideshop_ce
source/Application/Model/ManufacturerList.php
ManufacturerList._addCategoryFields
protected function _addCategoryFields($oManufacturer) { $oManufacturer->oxcategories__oxid = new \OxidEsales\Eshop\Core\Field($oManufacturer->oxmanufacturers__oxid->value); $oManufacturer->oxcategories__oxicon = $oManufacturer->oxmanufacturers__oxicon; $oManufacturer->oxcategories__oxtitle = $oManufacturer->oxmanufacturers__oxtitle; $oManufacturer->oxcategories__oxdesc = $oManufacturer->oxmanufacturers__oxshortdesc; $oManufacturer->setIsVisible(true); $oManufacturer->setHasVisibleSubCats(false); }
php
protected function _addCategoryFields($oManufacturer) { $oManufacturer->oxcategories__oxid = new \OxidEsales\Eshop\Core\Field($oManufacturer->oxmanufacturers__oxid->value); $oManufacturer->oxcategories__oxicon = $oManufacturer->oxmanufacturers__oxicon; $oManufacturer->oxcategories__oxtitle = $oManufacturer->oxmanufacturers__oxtitle; $oManufacturer->oxcategories__oxdesc = $oManufacturer->oxmanufacturers__oxshortdesc; $oManufacturer->setIsVisible(true); $oManufacturer->setHasVisibleSubCats(false); }
[ "protected", "function", "_addCategoryFields", "(", "$", "oManufacturer", ")", "{", "$", "oManufacturer", "->", "oxcategories__oxid", "=", "new", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "Field", "(", "$", "oManufacturer", "->", "oxmanufacturers__oxi...
Adds category specific fields to manufacturer object @param object $oManufacturer manufacturer object
[ "Adds", "category", "specific", "fields", "to", "manufacturer", "object" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/ManufacturerList.php#L149-L158
train
OXID-eSales/oxideshop_ce
source/Application/Model/ManufacturerList.php
ManufacturerList._seoSetManufacturerData
protected function _seoSetManufacturerData() { // only when SEO id on and in front end if (\OxidEsales\Eshop\Core\Registry::getUtils()->seoIsActive() && !$this->isAdmin()) { $oEncoder = \OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Application\Model\SeoEncoderManufacturer::class); // preparing root manufacturer category if ($this->_oRoot) { $oEncoder->getManufacturerUrl($this->_oRoot); } // encoding manufacturer category foreach ($this as $sVndId => $value) { $oEncoder->getManufacturerUrl($this->_aArray[$sVndId]); } } }
php
protected function _seoSetManufacturerData() { // only when SEO id on and in front end if (\OxidEsales\Eshop\Core\Registry::getUtils()->seoIsActive() && !$this->isAdmin()) { $oEncoder = \OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Application\Model\SeoEncoderManufacturer::class); // preparing root manufacturer category if ($this->_oRoot) { $oEncoder->getManufacturerUrl($this->_oRoot); } // encoding manufacturer category foreach ($this as $sVndId => $value) { $oEncoder->getManufacturerUrl($this->_aArray[$sVndId]); } } }
[ "protected", "function", "_seoSetManufacturerData", "(", ")", "{", "// only when SEO id on and in front end", "if", "(", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "Registry", "::", "getUtils", "(", ")", "->", "seoIsActive", "(", ")", "&&", "!", "$",...
Processes manufacturer category URLs
[ "Processes", "manufacturer", "category", "URLs" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/ManufacturerList.php#L183-L199
train
OXID-eSales/oxideshop_ce
source/Application/Controller/Admin/UserMain.php
UserMain.save
public function save() { parent::save(); //allow admin information edit only for MALL admins $soxId = $this->getEditObjectId(); if ($this->_allowAdminEdit($soxId)) { $aParams = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("editval"); // checkbox handling if (!isset($aParams['oxuser__oxactive'])) { $aParams['oxuser__oxactive'] = 0; } $oUser = oxNew(\OxidEsales\Eshop\Application\Model\User::class); if ($soxId != "-1") { $oUser->load($soxId); } else { $aParams['oxuser__oxid'] = null; } //setting new password if (($sNewPass = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("newPassword"))) { $oUser->setPassword($sNewPass); } //FS#2167 V checks for already used email if ($oUser->checkIfEmailExists($aParams['oxuser__oxusername'])) { $this->_sSaveError = 'EXCEPTION_USER_USEREXISTS'; return; } $oUser->assign($aParams); //seting shop id for ONLY for new created user if ($soxId == "-1") { $this->onUserCreation($oUser); } // A. changing field type to save birth date correctly $oUser->oxuser__oxbirthdate->fldtype = 'char'; try { $oUser->save(); // set oxid if inserted $this->setEditObjectId($oUser->getId()); } catch (Exception $oExcp) { $this->_sSaveError = $oExcp->getMessage(); } } }
php
public function save() { parent::save(); //allow admin information edit only for MALL admins $soxId = $this->getEditObjectId(); if ($this->_allowAdminEdit($soxId)) { $aParams = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("editval"); // checkbox handling if (!isset($aParams['oxuser__oxactive'])) { $aParams['oxuser__oxactive'] = 0; } $oUser = oxNew(\OxidEsales\Eshop\Application\Model\User::class); if ($soxId != "-1") { $oUser->load($soxId); } else { $aParams['oxuser__oxid'] = null; } //setting new password if (($sNewPass = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("newPassword"))) { $oUser->setPassword($sNewPass); } //FS#2167 V checks for already used email if ($oUser->checkIfEmailExists($aParams['oxuser__oxusername'])) { $this->_sSaveError = 'EXCEPTION_USER_USEREXISTS'; return; } $oUser->assign($aParams); //seting shop id for ONLY for new created user if ($soxId == "-1") { $this->onUserCreation($oUser); } // A. changing field type to save birth date correctly $oUser->oxuser__oxbirthdate->fldtype = 'char'; try { $oUser->save(); // set oxid if inserted $this->setEditObjectId($oUser->getId()); } catch (Exception $oExcp) { $this->_sSaveError = $oExcp->getMessage(); } } }
[ "public", "function", "save", "(", ")", "{", "parent", "::", "save", "(", ")", ";", "//allow admin information edit only for MALL admins", "$", "soxId", "=", "$", "this", "->", "getEditObjectId", "(", ")", ";", "if", "(", "$", "this", "->", "_allowAdminEdit", ...
Saves main user parameters. @return mixed
[ "Saves", "main", "user", "parameters", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/UserMain.php#L106-L158
train
OXID-eSales/oxideshop_ce
source/Core/Model/FieldNameHelper.php
FieldNameHelper.getFullFieldNames
public function getFullFieldNames($tableName, $fieldNames) { $combinedFields = []; $tablePrefix = strtolower($tableName) . '__'; foreach ($fieldNames as $fieldName) { $fieldName = strtolower($fieldName); $fieldNameWithoutTableName = str_replace($tablePrefix, '', $fieldName); $combinedFields[] = $fieldNameWithoutTableName; if (strpos($fieldName, $tablePrefix) !== 0) { $fieldName = $tablePrefix . $fieldName; } $combinedFields[] = $fieldName; } return $combinedFields; }
php
public function getFullFieldNames($tableName, $fieldNames) { $combinedFields = []; $tablePrefix = strtolower($tableName) . '__'; foreach ($fieldNames as $fieldName) { $fieldName = strtolower($fieldName); $fieldNameWithoutTableName = str_replace($tablePrefix, '', $fieldName); $combinedFields[] = $fieldNameWithoutTableName; if (strpos($fieldName, $tablePrefix) !== 0) { $fieldName = $tablePrefix . $fieldName; } $combinedFields[] = $fieldName; } return $combinedFields; }
[ "public", "function", "getFullFieldNames", "(", "$", "tableName", ",", "$", "fieldNames", ")", "{", "$", "combinedFields", "=", "[", "]", ";", "$", "tablePrefix", "=", "strtolower", "(", "$", "tableName", ")", ".", "'__'", ";", "foreach", "(", "$", "fiel...
Return field names with and without table name as a prefix. @param string $tableName @param array $fieldNames @return array
[ "Return", "field", "names", "with", "and", "without", "table", "name", "as", "a", "prefix", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Model/FieldNameHelper.php#L25-L43
train
OXID-eSales/oxideshop_ce
source/Application/Model/DeliveryList.php
DeliveryList.setHomeCountry
public function setHomeCountry($sHomeCountry) { if (is_array($sHomeCountry)) { $this->_sHomeCountry = current($sHomeCountry); } else { $this->_sHomeCountry = $sHomeCountry; } }
php
public function setHomeCountry($sHomeCountry) { if (is_array($sHomeCountry)) { $this->_sHomeCountry = current($sHomeCountry); } else { $this->_sHomeCountry = $sHomeCountry; } }
[ "public", "function", "setHomeCountry", "(", "$", "sHomeCountry", ")", "{", "if", "(", "is_array", "(", "$", "sHomeCountry", ")", ")", "{", "$", "this", "->", "_sHomeCountry", "=", "current", "(", "$", "sHomeCountry", ")", ";", "}", "else", "{", "$", "...
Home country setter @param string $sHomeCountry home country id
[ "Home", "country", "setter" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/DeliveryList.php#L78-L85
train
OXID-eSales/oxideshop_ce
source/Application/Model/DeliveryList.php
DeliveryList.getDeliveryList
public function getDeliveryList($oBasket, $oUser = null, $sDelCountry = null, $sDelSet = null) { // ids of deliveries that does not fit for us to skip double check $aSkipDeliveries = []; $aFittingDelSets = []; $aDelSetList = \OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Application\Model\DeliverySetList::class)->getDeliverySetList($oUser, $sDelCountry, $sDelSet); // must choose right delivery set to use its delivery list foreach ($aDelSetList as $sDeliverySetId => $oDeliverySet) { // loading delivery list to check if some of them fits $aDeliveries = $this->_getList($oUser, $sDelCountry, $sDeliverySetId); $blDelFound = false; foreach ($aDeliveries as $sDeliveryId => $oDelivery) { // skipping that was checked and didn't fit before if (in_array($sDeliveryId, $aSkipDeliveries)) { continue; } $aSkipDeliveries[] = $sDeliveryId; if ($oDelivery->isForBasket($oBasket)) { // delivery fits conditions $this->_aDeliveries[$sDeliveryId] = $aDeliveries[$sDeliveryId]; $blDelFound = true; // removing from unfitting list array_pop($aSkipDeliveries); // maybe checked "Stop processing after first match" ? if ($oDelivery->oxdelivery__oxfinalize->value) { break; } } } // found delivery set and deliveries that fits if ($blDelFound) { if ($this->_blCollectFittingDeliveriesSets) { // collect only deliveries sets that fits deliveries $aFittingDelSets[$sDeliverySetId] = $oDeliverySet; } else { // return collected fitting deliveries \OxidEsales\Eshop\Core\Registry::getSession()->setVariable('sShipSet', $sDeliverySetId); return $this->_aDeliveries; } } } //return deliveries sets if found if ($this->_blCollectFittingDeliveriesSets && count($aFittingDelSets)) { //resetting getting delivery sets list instead of deliveries before return $this->_blCollectFittingDeliveriesSets = false; //reset cache and list $this->setUser(null); $this->clear(); return $aFittingDelSets; } // nothing what fits was found return []; }
php
public function getDeliveryList($oBasket, $oUser = null, $sDelCountry = null, $sDelSet = null) { // ids of deliveries that does not fit for us to skip double check $aSkipDeliveries = []; $aFittingDelSets = []; $aDelSetList = \OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Application\Model\DeliverySetList::class)->getDeliverySetList($oUser, $sDelCountry, $sDelSet); // must choose right delivery set to use its delivery list foreach ($aDelSetList as $sDeliverySetId => $oDeliverySet) { // loading delivery list to check if some of them fits $aDeliveries = $this->_getList($oUser, $sDelCountry, $sDeliverySetId); $blDelFound = false; foreach ($aDeliveries as $sDeliveryId => $oDelivery) { // skipping that was checked and didn't fit before if (in_array($sDeliveryId, $aSkipDeliveries)) { continue; } $aSkipDeliveries[] = $sDeliveryId; if ($oDelivery->isForBasket($oBasket)) { // delivery fits conditions $this->_aDeliveries[$sDeliveryId] = $aDeliveries[$sDeliveryId]; $blDelFound = true; // removing from unfitting list array_pop($aSkipDeliveries); // maybe checked "Stop processing after first match" ? if ($oDelivery->oxdelivery__oxfinalize->value) { break; } } } // found delivery set and deliveries that fits if ($blDelFound) { if ($this->_blCollectFittingDeliveriesSets) { // collect only deliveries sets that fits deliveries $aFittingDelSets[$sDeliverySetId] = $oDeliverySet; } else { // return collected fitting deliveries \OxidEsales\Eshop\Core\Registry::getSession()->setVariable('sShipSet', $sDeliverySetId); return $this->_aDeliveries; } } } //return deliveries sets if found if ($this->_blCollectFittingDeliveriesSets && count($aFittingDelSets)) { //resetting getting delivery sets list instead of deliveries before return $this->_blCollectFittingDeliveriesSets = false; //reset cache and list $this->setUser(null); $this->clear(); return $aFittingDelSets; } // nothing what fits was found return []; }
[ "public", "function", "getDeliveryList", "(", "$", "oBasket", ",", "$", "oUser", "=", "null", ",", "$", "sDelCountry", "=", "null", ",", "$", "sDelSet", "=", "null", ")", "{", "// ids of deliveries that does not fit for us to skip double check", "$", "aSkipDeliverie...
Loads and returns list of deliveries. Process: - first checks if delivery loading is enabled in config - $myConfig->bl_perfLoadDelivery is TRUE; - loads delivery set list by calling this::GetDeliverySetList(...); - checks if there is any active (eg. chosen delivery set in order process etc) delivery set defined and if its set - rearranges delivery set list by storing active set at the beginning in the list. - goes through delivery sets and loads its deliveries, checks if any delivery fits. By checking calculates and stores conditional amounts: oDelivery->iItemCnt - items in basket that fits this delivery oDelivery->iProdCnt - products in basket that fits this delivery oDelivery->dPrice - price of products that fits this delivery - returns a list of deliveries. NOTICE: for performance reasons deliveries is cached in $myConfig->aDeliveryList. @param object $oBasket basket object @param \OxidEsales\Eshop\Application\Model\User $oUser session user @param string $sDelCountry user country id @param string $sDelSet delivery set id @return array
[ "Loads", "and", "returns", "list", "of", "deliveries", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/DeliveryList.php#L226-L290
train
OXID-eSales/oxideshop_ce
source/Application/Model/DeliveryList.php
DeliveryList.hasDeliveries
public function hasDeliveries($oBasket, $oUser, $sDelCountry, $sDeliverySetId) { $blHas = false; // loading delivery list to check if some of them fits $this->_getList($oUser, $sDelCountry, $sDeliverySetId); foreach ($this as $oDelivery) { if ($oDelivery->isForBasket($oBasket)) { $blHas = true; break; } } return $blHas; }
php
public function hasDeliveries($oBasket, $oUser, $sDelCountry, $sDeliverySetId) { $blHas = false; // loading delivery list to check if some of them fits $this->_getList($oUser, $sDelCountry, $sDeliverySetId); foreach ($this as $oDelivery) { if ($oDelivery->isForBasket($oBasket)) { $blHas = true; break; } } return $blHas; }
[ "public", "function", "hasDeliveries", "(", "$", "oBasket", ",", "$", "oUser", ",", "$", "sDelCountry", ",", "$", "sDeliverySetId", ")", "{", "$", "blHas", "=", "false", ";", "// loading delivery list to check if some of them fits", "$", "this", "->", "_getList", ...
Checks if deliveries in list fits for current basket and delivery set @param \OxidEsales\Eshop\Application\Model\Basket $oBasket shop basket @param \OxidEsales\Eshop\Application\Model\User $oUser session user @param string $sDelCountry delivery country @param string $sDeliverySetId delivery set id to check its relation to delivery list @return bool
[ "Checks", "if", "deliveries", "in", "list", "fits", "for", "current", "basket", "and", "delivery", "set" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/DeliveryList.php#L302-L316
train
OXID-eSales/oxideshop_ce
source/Application/Model/DeliveryList.php
DeliveryList.loadDeliveryListForProduct
public function loadDeliveryListForProduct($oProduct) { $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(); $dPrice = $oDb->quote($oProduct->getPrice()->getBruttoPrice()); $dSize = $oDb->quote($oProduct->getSize()); $dWeight = $oDb->quote($oProduct->getWeight()); $sTable = getViewName('oxdelivery'); $sQ = "select $sTable.* from $sTable"; $sQ .= " where " . $this->getBaseObject()->getSqlActiveSnippet(); $sQ .= " and ($sTable.oxdeltype != 'a' || ( $sTable.oxparam <= 1 && $sTable.oxparamend >= 1))"; if ($dPrice) { $sQ .= " and ($sTable.oxdeltype != 'p' || ( $sTable.oxparam <= $dPrice && $sTable.oxparamend >= $dPrice))"; } if ($dSize) { $sQ .= " and ($sTable.oxdeltype != 's' || ( $sTable.oxparam <= $dSize && $sTable.oxparamend >= $dSize))"; } if ($dWeight) { $sQ .= " and ($sTable.oxdeltype != 'w' || ( $sTable.oxparam <= $dWeight && $sTable.oxparamend >= $dWeight))"; } $this->selectString($sQ); }
php
public function loadDeliveryListForProduct($oProduct) { $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(); $dPrice = $oDb->quote($oProduct->getPrice()->getBruttoPrice()); $dSize = $oDb->quote($oProduct->getSize()); $dWeight = $oDb->quote($oProduct->getWeight()); $sTable = getViewName('oxdelivery'); $sQ = "select $sTable.* from $sTable"; $sQ .= " where " . $this->getBaseObject()->getSqlActiveSnippet(); $sQ .= " and ($sTable.oxdeltype != 'a' || ( $sTable.oxparam <= 1 && $sTable.oxparamend >= 1))"; if ($dPrice) { $sQ .= " and ($sTable.oxdeltype != 'p' || ( $sTable.oxparam <= $dPrice && $sTable.oxparamend >= $dPrice))"; } if ($dSize) { $sQ .= " and ($sTable.oxdeltype != 's' || ( $sTable.oxparam <= $dSize && $sTable.oxparamend >= $dSize))"; } if ($dWeight) { $sQ .= " and ($sTable.oxdeltype != 'w' || ( $sTable.oxparam <= $dWeight && $sTable.oxparamend >= $dWeight))"; } $this->selectString($sQ); }
[ "public", "function", "loadDeliveryListForProduct", "(", "$", "oProduct", ")", "{", "$", "oDb", "=", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "DatabaseProvider", "::", "getDb", "(", ")", ";", "$", "dPrice", "=", "$", "oDb", "->", "quote", "...
Load oxDeliveryList for product @param object $oProduct oxArticle object
[ "Load", "oxDeliveryList", "for", "product" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/DeliveryList.php#L360-L382
train
OXID-eSales/oxideshop_ce
source/Application/Controller/Admin/ArticleMain.php
ArticleMain._getEditValue
protected function _getEditValue($oObject, $sField) { $sEditObjectValue = ''; if ($oObject) { $oDescField = $oObject->getLongDescription(); $sEditObjectValue = $this->_processEditValue($oDescField->getRawValue()); } return $sEditObjectValue; }
php
protected function _getEditValue($oObject, $sField) { $sEditObjectValue = ''; if ($oObject) { $oDescField = $oObject->getLongDescription(); $sEditObjectValue = $this->_processEditValue($oDescField->getRawValue()); } return $sEditObjectValue; }
[ "protected", "function", "_getEditValue", "(", "$", "oObject", ",", "$", "sField", ")", "{", "$", "sEditObjectValue", "=", "''", ";", "if", "(", "$", "oObject", ")", "{", "$", "oDescField", "=", "$", "oObject", "->", "getLongDescription", "(", ")", ";", ...
Returns string which must be edited by editor @param \OxidEsales\Eshop\Core\Model\BaseModel $oObject object with field will be used for editing @param string $sField name of editable field @return string
[ "Returns", "string", "which", "must", "be", "edited", "by", "editor" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ArticleMain.php#L113-L122
train
OXID-eSales/oxideshop_ce
source/Application/Controller/Admin/ArticleMain.php
ArticleMain._processLongDesc
protected function _processLongDesc($sValue) { // TODO: the code below is redundant, optimize it, assignments should go smooth without conversions // hack, if editor screws up text, htmledit tends to do so $sValue = str_replace('&amp;nbsp;', '&nbsp;', $sValue); $sValue = str_replace('&amp;', '&', $sValue); $sValue = str_replace('&quot;', '"', $sValue); $sValue = str_replace('&lang=', '&amp;lang=', $sValue); $sValue = str_replace('<p>&nbsp;</p>', '', $sValue); $sValue = str_replace('<p>&nbsp; </p>', '', $sValue); return $sValue; }
php
protected function _processLongDesc($sValue) { // TODO: the code below is redundant, optimize it, assignments should go smooth without conversions // hack, if editor screws up text, htmledit tends to do so $sValue = str_replace('&amp;nbsp;', '&nbsp;', $sValue); $sValue = str_replace('&amp;', '&', $sValue); $sValue = str_replace('&quot;', '"', $sValue); $sValue = str_replace('&lang=', '&amp;lang=', $sValue); $sValue = str_replace('<p>&nbsp;</p>', '', $sValue); $sValue = str_replace('<p>&nbsp; </p>', '', $sValue); return $sValue; }
[ "protected", "function", "_processLongDesc", "(", "$", "sValue", ")", "{", "// TODO: the code below is redundant, optimize it, assignments should go smooth without conversions", "// hack, if editor screws up text, htmledit tends to do so", "$", "sValue", "=", "str_replace", "(", "'&amp...
Fixes html broken by html editor @param string $sValue value to fix @return string
[ "Fixes", "html", "broken", "by", "html", "editor" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ArticleMain.php#L214-L226
train
OXID-eSales/oxideshop_ce
source/Application/Controller/Admin/ArticleMain.php
ArticleMain._resetCategoriesCounter
protected function _resetCategoriesCounter($sArticleId) { $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(); $sQ = "select oxcatnid from oxobject2category where oxobjectid = " . $oDb->quote($sArticleId); $oRs = $oDb->select($sQ); if ($oRs !== false && $oRs->count() > 0) { while (!$oRs->EOF) { $this->resetCounter("catArticle", $oRs->fields[0]); $oRs->fetchRow(); } } }
php
protected function _resetCategoriesCounter($sArticleId) { $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(); $sQ = "select oxcatnid from oxobject2category where oxobjectid = " . $oDb->quote($sArticleId); $oRs = $oDb->select($sQ); if ($oRs !== false && $oRs->count() > 0) { while (!$oRs->EOF) { $this->resetCounter("catArticle", $oRs->fields[0]); $oRs->fetchRow(); } } }
[ "protected", "function", "_resetCategoriesCounter", "(", "$", "sArticleId", ")", "{", "$", "oDb", "=", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "DatabaseProvider", "::", "getDb", "(", ")", ";", "$", "sQ", "=", "\"select oxcatnid from oxobject2categ...
Resets article categories counters @param string $sArticleId Article id
[ "Resets", "article", "categories", "counters" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ArticleMain.php#L233-L244
train
OXID-eSales/oxideshop_ce
source/Application/Controller/Admin/ArticleMain.php
ArticleMain.addToCategory
public function addToCategory($sCatID, $sOXID) { $base = oxNew(\OxidEsales\Eshop\Core\Model\BaseModel::class); $base->init("oxobject2category"); $base->oxobject2category__oxtime = new \OxidEsales\Eshop\Core\Field(0); $base->oxobject2category__oxobjectid = new \OxidEsales\Eshop\Core\Field($sOXID); $base->oxobject2category__oxcatnid = new \OxidEsales\Eshop\Core\Field($sCatID); $base = $this->updateBase($base); $base->save(); }
php
public function addToCategory($sCatID, $sOXID) { $base = oxNew(\OxidEsales\Eshop\Core\Model\BaseModel::class); $base->init("oxobject2category"); $base->oxobject2category__oxtime = new \OxidEsales\Eshop\Core\Field(0); $base->oxobject2category__oxobjectid = new \OxidEsales\Eshop\Core\Field($sOXID); $base->oxobject2category__oxcatnid = new \OxidEsales\Eshop\Core\Field($sCatID); $base = $this->updateBase($base); $base->save(); }
[ "public", "function", "addToCategory", "(", "$", "sCatID", ",", "$", "sOXID", ")", "{", "$", "base", "=", "oxNew", "(", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "Model", "\\", "BaseModel", "::", "class", ")", ";", "$", "base", "->", "in...
Add article to category. @param string $sCatID Category id @param string $sOXID Article id
[ "Add", "article", "to", "category", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ArticleMain.php#L252-L263
train
OXID-eSales/oxideshop_ce
source/Application/Controller/Admin/ArticleMain.php
ArticleMain._copyCategories
protected function _copyCategories($sOldId, $newArticleId) { $myUtilsObject = \OxidEsales\Eshop\Core\Registry::getUtilsObject(); $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(); $sO2CView = getViewName('oxobject2category'); $sQ = "select oxcatnid, oxtime from {$sO2CView} where oxobjectid = " . $oDb->quote($sOldId); $oRs = $oDb->select($sQ); if ($oRs !== false && $oRs->count() > 0) { while (!$oRs->EOF) { $uniqueId = $myUtilsObject->generateUid(); $sCatId = $oRs->fields[0]; $sTime = $oRs->fields[1]; $sSql = $this->formQueryForCopyingToCategory($newArticleId, $uniqueId, $sCatId, $sTime); $oDb->execute($sSql); $oRs->fetchRow(); } } }
php
protected function _copyCategories($sOldId, $newArticleId) { $myUtilsObject = \OxidEsales\Eshop\Core\Registry::getUtilsObject(); $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(); $sO2CView = getViewName('oxobject2category'); $sQ = "select oxcatnid, oxtime from {$sO2CView} where oxobjectid = " . $oDb->quote($sOldId); $oRs = $oDb->select($sQ); if ($oRs !== false && $oRs->count() > 0) { while (!$oRs->EOF) { $uniqueId = $myUtilsObject->generateUid(); $sCatId = $oRs->fields[0]; $sTime = $oRs->fields[1]; $sSql = $this->formQueryForCopyingToCategory($newArticleId, $uniqueId, $sCatId, $sTime); $oDb->execute($sSql); $oRs->fetchRow(); } } }
[ "protected", "function", "_copyCategories", "(", "$", "sOldId", ",", "$", "newArticleId", ")", "{", "$", "myUtilsObject", "=", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "Registry", "::", "getUtilsObject", "(", ")", ";", "$", "oDb", "=", "\\", ...
Copying category assignments @param string $sOldId Id from old article @param string $newArticleId Id from new article
[ "Copying", "category", "assignments" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ArticleMain.php#L371-L389
train
OXID-eSales/oxideshop_ce
source/Application/Controller/Admin/ArticleMain.php
ArticleMain._copyAttributes
protected function _copyAttributes($sOldId, $sNewId) { $myUtilsObject = \OxidEsales\Eshop\Core\Registry::getUtilsObject(); $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(); $sQ = "select oxid from oxobject2attribute where oxobjectid = " . $oDb->quote($sOldId); $oRs = $oDb->select($sQ); if ($oRs !== false && $oRs->count() > 0) { while (!$oRs->EOF) { // #1055A $oAttr = oxNew(\OxidEsales\Eshop\Core\Model\BaseModel::class); $oAttr->init("oxobject2attribute"); $oAttr->load($oRs->fields[0]); $oAttr->setId($myUtilsObject->generateUID()); $oAttr->oxobject2attribute__oxobjectid->setValue($sNewId); $oAttr->save(); $oRs->fetchRow(); } } }
php
protected function _copyAttributes($sOldId, $sNewId) { $myUtilsObject = \OxidEsales\Eshop\Core\Registry::getUtilsObject(); $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(); $sQ = "select oxid from oxobject2attribute where oxobjectid = " . $oDb->quote($sOldId); $oRs = $oDb->select($sQ); if ($oRs !== false && $oRs->count() > 0) { while (!$oRs->EOF) { // #1055A $oAttr = oxNew(\OxidEsales\Eshop\Core\Model\BaseModel::class); $oAttr->init("oxobject2attribute"); $oAttr->load($oRs->fields[0]); $oAttr->setId($myUtilsObject->generateUID()); $oAttr->oxobject2attribute__oxobjectid->setValue($sNewId); $oAttr->save(); $oRs->fetchRow(); } } }
[ "protected", "function", "_copyAttributes", "(", "$", "sOldId", ",", "$", "sNewId", ")", "{", "$", "myUtilsObject", "=", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "Registry", "::", "getUtilsObject", "(", ")", ";", "$", "oDb", "=", "\\", "Oxi...
Copying attributes assignments @param string $sOldId Id from old article @param string $sNewId Id from new article
[ "Copying", "attributes", "assignments" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ArticleMain.php#L397-L416
train
OXID-eSales/oxideshop_ce
source/Application/Controller/Admin/ArticleMain.php
ArticleMain._copySelectlists
protected function _copySelectlists($sOldId, $sNewId) { $myUtilsObject = \OxidEsales\Eshop\Core\Registry::getUtilsObject(); $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(); $sQ = "select oxselnid from oxobject2selectlist where oxobjectid = " . $oDb->quote($sOldId); $oRs = $oDb->select($sQ); if ($oRs !== false && $oRs->count() > 0) { while (!$oRs->EOF) { $sUid = $myUtilsObject->generateUID(); $sId = $oRs->fields[0]; $sSql = "insert into oxobject2selectlist (oxid, oxobjectid, oxselnid) " . "VALUES (" . $oDb->quote($sUid) . ", " . $oDb->quote($sNewId) . ", " . $oDb->quote($sId) . ") "; $oDb->execute($sSql); $oRs->fetchRow(); } } }
php
protected function _copySelectlists($sOldId, $sNewId) { $myUtilsObject = \OxidEsales\Eshop\Core\Registry::getUtilsObject(); $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(); $sQ = "select oxselnid from oxobject2selectlist where oxobjectid = " . $oDb->quote($sOldId); $oRs = $oDb->select($sQ); if ($oRs !== false && $oRs->count() > 0) { while (!$oRs->EOF) { $sUid = $myUtilsObject->generateUID(); $sId = $oRs->fields[0]; $sSql = "insert into oxobject2selectlist (oxid, oxobjectid, oxselnid) " . "VALUES (" . $oDb->quote($sUid) . ", " . $oDb->quote($sNewId) . ", " . $oDb->quote($sId) . ") "; $oDb->execute($sSql); $oRs->fetchRow(); } } }
[ "protected", "function", "_copySelectlists", "(", "$", "sOldId", ",", "$", "sNewId", ")", "{", "$", "myUtilsObject", "=", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "Registry", "::", "getUtilsObject", "(", ")", ";", "$", "oDb", "=", "\\", "Ox...
Copying selectlists assignments @param string $sOldId Id from old article @param string $sNewId Id from new article
[ "Copying", "selectlists", "assignments" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ArticleMain.php#L452-L469
train
OXID-eSales/oxideshop_ce
source/Application/Controller/Admin/ArticleMain.php
ArticleMain._copyAccessoires
protected function _copyAccessoires($sOldId, $sNewId) { $myUtilsObject = \OxidEsales\Eshop\Core\Registry::getUtilsObject(); $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(); $sQ = "select oxobjectid from oxaccessoire2article where oxarticlenid= " . $oDb->quote($sOldId); $oRs = $oDb->select($sQ); if ($oRs !== false && $oRs->count() > 0) { while (!$oRs->EOF) { $sUId = $myUtilsObject->generateUid(); $sId = $oRs->fields[0]; $sSql = "insert into oxaccessoire2article (oxid, oxobjectid, oxarticlenid) " . "VALUES (" . $oDb->quote($sUId) . ", " . $oDb->quote($sId) . ", " . $oDb->quote($sNewId) . ") "; $oDb->execute($sSql); $oRs->fetchRow(); } } }
php
protected function _copyAccessoires($sOldId, $sNewId) { $myUtilsObject = \OxidEsales\Eshop\Core\Registry::getUtilsObject(); $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(); $sQ = "select oxobjectid from oxaccessoire2article where oxarticlenid= " . $oDb->quote($sOldId); $oRs = $oDb->select($sQ); if ($oRs !== false && $oRs->count() > 0) { while (!$oRs->EOF) { $sUId = $myUtilsObject->generateUid(); $sId = $oRs->fields[0]; $sSql = "insert into oxaccessoire2article (oxid, oxobjectid, oxarticlenid) " . "VALUES (" . $oDb->quote($sUId) . ", " . $oDb->quote($sId) . ", " . $oDb->quote($sNewId) . ") "; $oDb->execute($sSql); $oRs->fetchRow(); } } }
[ "protected", "function", "_copyAccessoires", "(", "$", "sOldId", ",", "$", "sNewId", ")", "{", "$", "myUtilsObject", "=", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "Registry", "::", "getUtilsObject", "(", ")", ";", "$", "oDb", "=", "\\", "Ox...
Copying accessoires assignments @param string $sOldId Id from old article @param string $sNewId Id from new article
[ "Copying", "accessoires", "assignments" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ArticleMain.php#L502-L519
train
OXID-eSales/oxideshop_ce
source/Application/Controller/Admin/ArticleMain.php
ArticleMain._copyStaffelpreis
protected function _copyStaffelpreis($sOldId, $sNewId) { $sShopId = \OxidEsales\Eshop\Core\Registry::getConfig()->getShopId(); $oPriceList = oxNew(\OxidEsales\Eshop\Core\Model\ListModel::class); $oPriceList->init("oxbase", "oxprice2article"); $sQ = "select * from oxprice2article where oxartid = '{$sOldId}' and oxshopid = '{$sShopId}' " . "and (oxamount > 0 or oxamountto > 0) order by oxamount "; $oPriceList->selectString($sQ); if ($oPriceList->count()) { foreach ($oPriceList as $oItem) { $oItem->oxprice2article__oxid->setValue($oItem->setId()); $oItem->oxprice2article__oxartid->setValue($sNewId); $oItem->save(); } } }
php
protected function _copyStaffelpreis($sOldId, $sNewId) { $sShopId = \OxidEsales\Eshop\Core\Registry::getConfig()->getShopId(); $oPriceList = oxNew(\OxidEsales\Eshop\Core\Model\ListModel::class); $oPriceList->init("oxbase", "oxprice2article"); $sQ = "select * from oxprice2article where oxartid = '{$sOldId}' and oxshopid = '{$sShopId}' " . "and (oxamount > 0 or oxamountto > 0) order by oxamount "; $oPriceList->selectString($sQ); if ($oPriceList->count()) { foreach ($oPriceList as $oItem) { $oItem->oxprice2article__oxid->setValue($oItem->setId()); $oItem->oxprice2article__oxartid->setValue($sNewId); $oItem->save(); } } }
[ "protected", "function", "_copyStaffelpreis", "(", "$", "sOldId", ",", "$", "sNewId", ")", "{", "$", "sShopId", "=", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "Registry", "::", "getConfig", "(", ")", "->", "getShopId", "(", ")", ";", "$", ...
Copying staffelpreis assignments @param string $sOldId Id from old article @param string $sNewId Id from new article
[ "Copying", "staffelpreis", "assignments" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ArticleMain.php#L527-L542
train
OXID-eSales/oxideshop_ce
source/Application/Controller/Admin/ArticleMain.php
ArticleMain._copyArtExtends
protected function _copyArtExtends($sOldId, $sNewId) { $oExt = oxNew(\OxidEsales\Eshop\Core\Model\BaseModel::class); $oExt->init("oxartextends"); $oExt->load($sOldId); $oExt->setId($sNewId); $oExt->save(); }
php
protected function _copyArtExtends($sOldId, $sNewId) { $oExt = oxNew(\OxidEsales\Eshop\Core\Model\BaseModel::class); $oExt->init("oxartextends"); $oExt->load($sOldId); $oExt->setId($sNewId); $oExt->save(); }
[ "protected", "function", "_copyArtExtends", "(", "$", "sOldId", ",", "$", "sNewId", ")", "{", "$", "oExt", "=", "oxNew", "(", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "Model", "\\", "BaseModel", "::", "class", ")", ";", "$", "oExt", "->",...
Copying article extends @param string $sOldId Id from old article @param string $sNewId Id from new article
[ "Copying", "article", "extends" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ArticleMain.php#L550-L557
train
OXID-eSales/oxideshop_ce
source/Application/Controller/Admin/ArticleMain.php
ArticleMain._formJumpList
protected function _formJumpList($oArticle, $oParentArticle) { $aJumpList = []; //fetching parent article variants $sOxIdField = 'oxarticles__oxid'; if (isset($oParentArticle)) { $aJumpList[] = [$oParentArticle->$sOxIdField->value, $this->_getTitle($oParentArticle)]; $sEditLanguageParameter = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("editlanguage"); $oParentVariants = $oParentArticle->getAdminVariants($sEditLanguageParameter); if ($oParentVariants->count()) { foreach ($oParentVariants as $oVar) { $aJumpList[] = [$oVar->$sOxIdField->value, " - " . $this->_getTitle($oVar)]; if ($oVar->$sOxIdField->value == $oArticle->$sOxIdField->value) { $oVariants = $oArticle->getAdminVariants($sEditLanguageParameter); if ($oVariants->count()) { foreach ($oVariants as $oVVar) { $aJumpList[] = [$oVVar->$sOxIdField->value, " -- " . $this->_getTitle($oVVar)]; } } } } } } else { $aJumpList[] = [$oArticle->$sOxIdField->value, $this->_getTitle($oArticle)]; //fetching this article variants data $oVariants = $oArticle->getAdminVariants(\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("editlanguage")); if ($oVariants && $oVariants->count()) { foreach ($oVariants as $oVar) { $aJumpList[] = [$oVar->$sOxIdField->value, " - " . $this->_getTitle($oVar)]; } } } if (count($aJumpList) > 1) { $this->_aViewData["thisvariantlist"] = $aJumpList; } }
php
protected function _formJumpList($oArticle, $oParentArticle) { $aJumpList = []; //fetching parent article variants $sOxIdField = 'oxarticles__oxid'; if (isset($oParentArticle)) { $aJumpList[] = [$oParentArticle->$sOxIdField->value, $this->_getTitle($oParentArticle)]; $sEditLanguageParameter = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("editlanguage"); $oParentVariants = $oParentArticle->getAdminVariants($sEditLanguageParameter); if ($oParentVariants->count()) { foreach ($oParentVariants as $oVar) { $aJumpList[] = [$oVar->$sOxIdField->value, " - " . $this->_getTitle($oVar)]; if ($oVar->$sOxIdField->value == $oArticle->$sOxIdField->value) { $oVariants = $oArticle->getAdminVariants($sEditLanguageParameter); if ($oVariants->count()) { foreach ($oVariants as $oVVar) { $aJumpList[] = [$oVVar->$sOxIdField->value, " -- " . $this->_getTitle($oVVar)]; } } } } } } else { $aJumpList[] = [$oArticle->$sOxIdField->value, $this->_getTitle($oArticle)]; //fetching this article variants data $oVariants = $oArticle->getAdminVariants(\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("editlanguage")); if ($oVariants && $oVariants->count()) { foreach ($oVariants as $oVar) { $aJumpList[] = [$oVar->$sOxIdField->value, " - " . $this->_getTitle($oVar)]; } } } if (count($aJumpList) > 1) { $this->_aViewData["thisvariantlist"] = $aJumpList; } }
[ "protected", "function", "_formJumpList", "(", "$", "oArticle", ",", "$", "oParentArticle", ")", "{", "$", "aJumpList", "=", "[", "]", ";", "//fetching parent article variants", "$", "sOxIdField", "=", "'oxarticles__oxid'", ";", "if", "(", "isset", "(", "$", "...
Function forms article variants jump list. @param object $oArticle article object @param object $oParentArticle article parent object
[ "Function", "forms", "article", "variants", "jump", "list", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ArticleMain.php#L586-L621
train
OXID-eSales/oxideshop_ce
source/Application/Controller/Admin/ArticleMain.php
ArticleMain._getTitle
protected function _getTitle($oObj) { $sTitle = $oObj->oxarticles__oxtitle->value; if (!strlen($sTitle)) { $sTitle = $oObj->oxarticles__oxvarselect->value; } return $sTitle; }
php
protected function _getTitle($oObj) { $sTitle = $oObj->oxarticles__oxtitle->value; if (!strlen($sTitle)) { $sTitle = $oObj->oxarticles__oxvarselect->value; } return $sTitle; }
[ "protected", "function", "_getTitle", "(", "$", "oObj", ")", "{", "$", "sTitle", "=", "$", "oObj", "->", "oxarticles__oxtitle", "->", "value", ";", "if", "(", "!", "strlen", "(", "$", "sTitle", ")", ")", "{", "$", "sTitle", "=", "$", "oObj", "->", ...
Returns formed variant title @param object $oObj product object @return string
[ "Returns", "formed", "variant", "title" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ArticleMain.php#L630-L638
train
OXID-eSales/oxideshop_ce
source/Application/Controller/Admin/ArticleMain.php
ArticleMain.formQueryForCopyingToCategory
protected function formQueryForCopyingToCategory($newArticleId, $sUid, $sCatId, $sTime) { $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(); return "insert into oxobject2category (oxid, oxobjectid, oxcatnid, oxtime) " . "VALUES (" . $oDb->quote($sUid) . ", " . $oDb->quote($newArticleId) . ", " . $oDb->quote($sCatId) . ", " . $oDb->quote($sTime) . ") "; }
php
protected function formQueryForCopyingToCategory($newArticleId, $sUid, $sCatId, $sTime) { $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(); return "insert into oxobject2category (oxid, oxobjectid, oxcatnid, oxtime) " . "VALUES (" . $oDb->quote($sUid) . ", " . $oDb->quote($newArticleId) . ", " . $oDb->quote($sCatId) . ", " . $oDb->quote($sTime) . ") "; }
[ "protected", "function", "formQueryForCopyingToCategory", "(", "$", "newArticleId", ",", "$", "sUid", ",", "$", "sCatId", ",", "$", "sTime", ")", "{", "$", "oDb", "=", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "DatabaseProvider", "::", "getDb", ...
Forms query which is used for adding article to category. @param string $newArticleId @param string $sUid @param string $sCatId @param string $sTime @return string
[ "Forms", "query", "which", "is", "used", "for", "adding", "article", "to", "category", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ArticleMain.php#L704-L710
train
OXID-eSales/oxideshop_ce
source/Core/DatabaseProvider.php
DatabaseProvider.getDb
public static function getDb($fetchMode = \OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_NUM) { if (null === static::$db) { $databaseFactory = static::getInstance(); static::$db = $databaseFactory->createDatabase(); /** Post connect actions will be taken only once per connection */ $databaseFactory->onPostConnect(); } /** The following actions be taken on each call to getDb */ static::$db->setFetchMode($fetchMode); return static::$db; }
php
public static function getDb($fetchMode = \OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_NUM) { if (null === static::$db) { $databaseFactory = static::getInstance(); static::$db = $databaseFactory->createDatabase(); /** Post connect actions will be taken only once per connection */ $databaseFactory->onPostConnect(); } /** The following actions be taken on each call to getDb */ static::$db->setFetchMode($fetchMode); return static::$db; }
[ "public", "static", "function", "getDb", "(", "$", "fetchMode", "=", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "DatabaseProvider", "::", "FETCH_MODE_NUM", ")", "{", "if", "(", "null", "===", "static", "::", "$", "db", ")", "{", "$", "databas...
Return the database connection instance as a singleton. @param int $fetchMode The fetch mode. Default is numeric (0). @throws DatabaseConnectionException Error while initiating connection to DB. @return DatabaseInterface
[ "Return", "the", "database", "connection", "instance", "as", "a", "singleton", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/DatabaseProvider.php#L92-L106
train
OXID-eSales/oxideshop_ce
source/Core/DatabaseProvider.php
DatabaseProvider.getTableDescription
public function getTableDescription($tableName) { // simple cache if (!isset(self::$tblDescCache[$tableName])) { self::$tblDescCache[$tableName] = $this->fetchTableDescription($tableName); } return self::$tblDescCache[$tableName]; }
php
public function getTableDescription($tableName) { // simple cache if (!isset(self::$tblDescCache[$tableName])) { self::$tblDescCache[$tableName] = $this->fetchTableDescription($tableName); } return self::$tblDescCache[$tableName]; }
[ "public", "function", "getTableDescription", "(", "$", "tableName", ")", "{", "// simple cache", "if", "(", "!", "isset", "(", "self", "::", "$", "tblDescCache", "[", "$", "tableName", "]", ")", ")", "{", "self", "::", "$", "tblDescCache", "[", "$", "tab...
Extracts and returns table metadata from DB. @param string $tableName Name of table to invest. @return array
[ "Extracts", "and", "returns", "table", "metadata", "from", "DB", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/DatabaseProvider.php#L143-L151
train
OXID-eSales/oxideshop_ce
source/Core/DatabaseProvider.php
DatabaseProvider.createDatabase
protected function createDatabase() { /** Call to fetchConfigFile redirects to setup wizard, if shop has not been configured. */ $configFile = $this->fetchConfigFile(); /** Validate the configuration file */ $this->validateConfigFile($configFile); /** Set config file to be able to read shop configuration within the class */ $this->setConfigFile($configFile); /** @var array $connectionParameters Parameters needed for the database connection */ $connectionParameters = $this->getConnectionParameters(); $databaseAdapter = new DatabaseAdapter(); $databaseAdapter->setConnectionParameters($connectionParameters); $databaseAdapter->connect(); return $databaseAdapter; }
php
protected function createDatabase() { /** Call to fetchConfigFile redirects to setup wizard, if shop has not been configured. */ $configFile = $this->fetchConfigFile(); /** Validate the configuration file */ $this->validateConfigFile($configFile); /** Set config file to be able to read shop configuration within the class */ $this->setConfigFile($configFile); /** @var array $connectionParameters Parameters needed for the database connection */ $connectionParameters = $this->getConnectionParameters(); $databaseAdapter = new DatabaseAdapter(); $databaseAdapter->setConnectionParameters($connectionParameters); $databaseAdapter->connect(); return $databaseAdapter; }
[ "protected", "function", "createDatabase", "(", ")", "{", "/** Call to fetchConfigFile redirects to setup wizard, if shop has not been configured. */", "$", "configFile", "=", "$", "this", "->", "fetchConfigFile", "(", ")", ";", "/** Validate the configuration file */", "$", "t...
Creates database connection and returns it. @throws DatabaseConnectionException @throws DatabaseNotConfiguredException @return DatabaseInterface
[ "Creates", "database", "connection", "and", "returns", "it", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/DatabaseProvider.php#L182-L201
train
OXID-eSales/oxideshop_ce
source/Core/DatabaseProvider.php
DatabaseProvider.getConnectionParameters
protected function getConnectionParameters() { /** Collect the parameters, that are necessary to initialize the database connection: */ /** * @var string $databaseDriver At the moment the database adapter uses always 'pdo_mysql'. */ $databaseDriver = $this->getConfigParam('dbType'); /** * @var string $databaseHost The database host to connect to. * Be aware, that the connection between the MySQL client and the server is unencrypted. */ $databaseHost = $this->getConfigParam('dbHost'); /** * @var integer $databasePort TCP port to connect to. */ $databasePort = (int) $this->getConfigParam('dbPort'); if (!$databasePort) { $databasePort = 3306; } /** * @var string $databaseName The name of the database or scheme to connect to. */ $databaseName = $this->getConfigParam('dbName'); /** * @var string $databaseUser The user id of the database user. */ $databaseUser = $this->getConfigParam('dbUser'); /** * @var string $databasePassword The password of the database user. */ $databasePassword = $this->getConfigParam('dbPwd'); $connectionParameters = [ 'default' => [ 'databaseDriver' => $databaseDriver, 'databaseHost' => $databaseHost, 'databasePort' => $databasePort, 'databaseName' => $databaseName, 'databaseUser' => $databaseUser, 'databasePassword' => $databasePassword, ] ]; /** * The charset has to be set during the connection to the database. */ $charset = (string) $this->getConfigParam('dbCharset'); //backwards compatibility with old config files. if (null == $charset) { $charset = 'utf8'; } $connectionParameters['default'] = array_merge($connectionParameters['default'], ['connectionCharset' => $charset]); return $connectionParameters; }
php
protected function getConnectionParameters() { /** Collect the parameters, that are necessary to initialize the database connection: */ /** * @var string $databaseDriver At the moment the database adapter uses always 'pdo_mysql'. */ $databaseDriver = $this->getConfigParam('dbType'); /** * @var string $databaseHost The database host to connect to. * Be aware, that the connection between the MySQL client and the server is unencrypted. */ $databaseHost = $this->getConfigParam('dbHost'); /** * @var integer $databasePort TCP port to connect to. */ $databasePort = (int) $this->getConfigParam('dbPort'); if (!$databasePort) { $databasePort = 3306; } /** * @var string $databaseName The name of the database or scheme to connect to. */ $databaseName = $this->getConfigParam('dbName'); /** * @var string $databaseUser The user id of the database user. */ $databaseUser = $this->getConfigParam('dbUser'); /** * @var string $databasePassword The password of the database user. */ $databasePassword = $this->getConfigParam('dbPwd'); $connectionParameters = [ 'default' => [ 'databaseDriver' => $databaseDriver, 'databaseHost' => $databaseHost, 'databasePort' => $databasePort, 'databaseName' => $databaseName, 'databaseUser' => $databaseUser, 'databasePassword' => $databasePassword, ] ]; /** * The charset has to be set during the connection to the database. */ $charset = (string) $this->getConfigParam('dbCharset'); //backwards compatibility with old config files. if (null == $charset) { $charset = 'utf8'; } $connectionParameters['default'] = array_merge($connectionParameters['default'], ['connectionCharset' => $charset]); return $connectionParameters; }
[ "protected", "function", "getConnectionParameters", "(", ")", "{", "/** Collect the parameters, that are necessary to initialize the database connection: */", "/**\n * @var string $databaseDriver At the moment the database adapter uses always 'pdo_mysql'.\n */", "$", "databaseDrive...
Get all parameters needed to connect to the database. @return array
[ "Get", "all", "parameters", "needed", "to", "connect", "to", "the", "database", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/DatabaseProvider.php#L257-L313
train
OXID-eSales/oxideshop_ce
source/Core/DatabaseProvider.php
DatabaseProvider.isDatabaseConfigured
protected function isDatabaseConfigured(\OxidEsales\Eshop\Core\ConfigFile $config) { $isValid = true; // If the shop has not been configured yet the hostname has the format '<dbHost>' if (false !== strpos($config->getVar('dbHost'), '<')) { $isValid = false; } return $isValid; }
php
protected function isDatabaseConfigured(\OxidEsales\Eshop\Core\ConfigFile $config) { $isValid = true; // If the shop has not been configured yet the hostname has the format '<dbHost>' if (false !== strpos($config->getVar('dbHost'), '<')) { $isValid = false; } return $isValid; }
[ "protected", "function", "isDatabaseConfigured", "(", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "ConfigFile", "$", "config", ")", "{", "$", "isValid", "=", "true", ";", "// If the shop has not been configured yet the hostname has the format '<dbHost>'", "if",...
Return false if the database connection has not been configured in the eShop configuration file. @param ConfigFile $config @return bool
[ "Return", "false", "if", "the", "database", "connection", "has", "not", "been", "configured", "in", "the", "eShop", "configuration", "file", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/DatabaseProvider.php#L334-L344
train
OXID-eSales/oxideshop_ce
source/Core/SystemRequirements.php
SystemRequirements.getRequiredModules
public function getRequiredModules() { if ($this->_aRequiredModules == null) { $aRequiredPHPExtensions = [ 'php_xml', 'j_son', 'i_conv', 'tokenizer', 'mysql_connect', 'gd_info', 'mb_string', 'curl', 'bc_math', 'open_ssl', 'soap', ]; $aRequiredPHPConfigs = [ 'allow_url_fopen', 'request_uri', 'ini_set', 'memory_limit', 'unicode_support', 'file_uploads', 'session_autostart', ]; $aRequiredServerConfigs = [ 'php_version', 'mod_rewrite', 'server_permissions' ]; if ($this->isAdmin()) { $aRequiredServerConfigs[] = 'mysql_version'; } $this->_aRequiredModules = array_fill_keys($aRequiredServerConfigs, 'server_config') + array_fill_keys($aRequiredPHPConfigs, 'php_config') + array_fill_keys($aRequiredPHPExtensions, 'php_extennsions') ; } return $this->_aRequiredModules; }
php
public function getRequiredModules() { if ($this->_aRequiredModules == null) { $aRequiredPHPExtensions = [ 'php_xml', 'j_son', 'i_conv', 'tokenizer', 'mysql_connect', 'gd_info', 'mb_string', 'curl', 'bc_math', 'open_ssl', 'soap', ]; $aRequiredPHPConfigs = [ 'allow_url_fopen', 'request_uri', 'ini_set', 'memory_limit', 'unicode_support', 'file_uploads', 'session_autostart', ]; $aRequiredServerConfigs = [ 'php_version', 'mod_rewrite', 'server_permissions' ]; if ($this->isAdmin()) { $aRequiredServerConfigs[] = 'mysql_version'; } $this->_aRequiredModules = array_fill_keys($aRequiredServerConfigs, 'server_config') + array_fill_keys($aRequiredPHPConfigs, 'php_config') + array_fill_keys($aRequiredPHPExtensions, 'php_extennsions') ; } return $this->_aRequiredModules; }
[ "public", "function", "getRequiredModules", "(", ")", "{", "if", "(", "$", "this", "->", "_aRequiredModules", "==", "null", ")", "{", "$", "aRequiredPHPExtensions", "=", "[", "'php_xml'", ",", "'j_son'", ",", "'i_conv'", ",", "'tokenizer'", ",", "'mysql_connec...
Sets system required modules @return array
[ "Sets", "system", "required", "modules" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/SystemRequirements.php#L190-L233
train
OXID-eSales/oxideshop_ce
source/Core/SystemRequirements.php
SystemRequirements.checkServerPermissions
public function checkServerPermissions($sPath = null, $iMinPerm = 777) { clearstatcache(); $sPath = $sPath ? $sPath : getShopBasePath(); // special config file check $sFullPath = $sPath . "config.inc.php"; if (!is_readable($sFullPath) || ($this->isAdmin() && is_writable($sFullPath)) || (!$this->isAdmin() && !is_writable($sFullPath)) ) { return 0; } $sTmp = "$sPath/tmp/"; $config = new \OxidEsales\Eshop\Core\ConfigFile(getShopBasePath() . "/config.inc.php"); $sCfgTmp = $config->getVar('sCompileDir'); if ($sCfgTmp && strpos($sCfgTmp, '<sCompileDir') === false) { $sTmp = $sCfgTmp; } $aPathsToCheck = [ $sPath . 'out/pictures/promo/', $sPath . 'out/pictures/master/', $sPath . 'out/pictures/generated/', $sPath . 'out/pictures/media/', // @deprecated, use out/media instead $sPath . 'out/media/', $sPath . 'log/', $sTmp ]; $iModStat = 2; $sPathToCheck = reset($aPathsToCheck); while ($sPathToCheck) { // missing file/folder? if (!file_exists($sPathToCheck)) { $iModStat = 0; break; } if (is_dir($sPathToCheck)) { // adding subfolders $aSubF = glob($sPathToCheck . "*", GLOB_ONLYDIR); if (is_array($aSubF)) { foreach ($aSubF as $sNewFolder) { $aPathsToCheck[] = $sNewFolder . "/"; } } } // testing if file permissions >= $iMinPerm if (!is_readable($sPathToCheck) || !is_writable($sPathToCheck)) { $iModStat = 0; break; } $sPathToCheck = next($aPathsToCheck); } return $iModStat; }
php
public function checkServerPermissions($sPath = null, $iMinPerm = 777) { clearstatcache(); $sPath = $sPath ? $sPath : getShopBasePath(); // special config file check $sFullPath = $sPath . "config.inc.php"; if (!is_readable($sFullPath) || ($this->isAdmin() && is_writable($sFullPath)) || (!$this->isAdmin() && !is_writable($sFullPath)) ) { return 0; } $sTmp = "$sPath/tmp/"; $config = new \OxidEsales\Eshop\Core\ConfigFile(getShopBasePath() . "/config.inc.php"); $sCfgTmp = $config->getVar('sCompileDir'); if ($sCfgTmp && strpos($sCfgTmp, '<sCompileDir') === false) { $sTmp = $sCfgTmp; } $aPathsToCheck = [ $sPath . 'out/pictures/promo/', $sPath . 'out/pictures/master/', $sPath . 'out/pictures/generated/', $sPath . 'out/pictures/media/', // @deprecated, use out/media instead $sPath . 'out/media/', $sPath . 'log/', $sTmp ]; $iModStat = 2; $sPathToCheck = reset($aPathsToCheck); while ($sPathToCheck) { // missing file/folder? if (!file_exists($sPathToCheck)) { $iModStat = 0; break; } if (is_dir($sPathToCheck)) { // adding subfolders $aSubF = glob($sPathToCheck . "*", GLOB_ONLYDIR); if (is_array($aSubF)) { foreach ($aSubF as $sNewFolder) { $aPathsToCheck[] = $sNewFolder . "/"; } } } // testing if file permissions >= $iMinPerm if (!is_readable($sPathToCheck) || !is_writable($sPathToCheck)) { $iModStat = 0; break; } $sPathToCheck = next($aPathsToCheck); } return $iModStat; }
[ "public", "function", "checkServerPermissions", "(", "$", "sPath", "=", "null", ",", "$", "iMinPerm", "=", "777", ")", "{", "clearstatcache", "(", ")", ";", "$", "sPath", "=", "$", "sPath", "?", "$", "sPath", ":", "getShopBasePath", "(", ")", ";", "// ...
Checks if permissions on servers are correctly setup @param string $sPath check path [optional] @param int $iMinPerm min permission level, default 777 [optional] @return int
[ "Checks", "if", "permissions", "on", "servers", "are", "correctly", "setup" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/SystemRequirements.php#L263-L322
train
OXID-eSales/oxideshop_ce
source/Core/SystemRequirements.php
SystemRequirements._getShopHostInfoFromServerVars
protected function _getShopHostInfoFromServerVars() { // got here from setup dir $sScript = $_SERVER['SCRIPT_NAME']; $iPort = (int) $_SERVER['SERVER_PORT']; $blSsl = (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on')); if (!$iPort) { $iPort = $blSsl ? 443 : 80; } $sScript = rtrim(dirname(dirname($sScript)), '/') . '/'; return [ 'host' => $_SERVER['HTTP_HOST'], 'port' => $iPort, 'dir' => $sScript, 'ssl' => $blSsl, ]; }
php
protected function _getShopHostInfoFromServerVars() { // got here from setup dir $sScript = $_SERVER['SCRIPT_NAME']; $iPort = (int) $_SERVER['SERVER_PORT']; $blSsl = (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on')); if (!$iPort) { $iPort = $blSsl ? 443 : 80; } $sScript = rtrim(dirname(dirname($sScript)), '/') . '/'; return [ 'host' => $_SERVER['HTTP_HOST'], 'port' => $iPort, 'dir' => $sScript, 'ssl' => $blSsl, ]; }
[ "protected", "function", "_getShopHostInfoFromServerVars", "(", ")", "{", "// got here from setup dir", "$", "sScript", "=", "$", "_SERVER", "[", "'SCRIPT_NAME'", "]", ";", "$", "iPort", "=", "(", "int", ")", "$", "_SERVER", "[", "'SERVER_PORT'", "]", ";", "$"...
returns host, port, base dir, ssl information as assotiative array, false on error takes this info from _SERVER variable @return array
[ "returns", "host", "port", "base", "dir", "ssl", "information", "as", "assotiative", "array", "false", "on", "error", "takes", "this", "info", "from", "_SERVER", "variable" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/SystemRequirements.php#L389-L406
train
OXID-eSales/oxideshop_ce
source/Core/SystemRequirements.php
SystemRequirements.checkModRewrite
public function checkModRewrite() { $iModStat = null; $aHostInfo = $this->_getShopHostInfo(); $iModStat = $this->_checkModRewrite($aHostInfo); $aSSLHostInfo = $this->_getShopSSLHostInfo(); // Don't need to check if mod status is already failed. if (0 != $iModStat && $aSSLHostInfo) { $iSSLModStat = $this->_checkModRewrite($aSSLHostInfo); // Send if failed, even if couldn't check another if (0 == $iSSLModStat) { return 0; } elseif (1 == $iSSLModStat || 1 == $iModStat) { return 1; } return min($iModStat, $iSSLModStat); } return $iModStat; }
php
public function checkModRewrite() { $iModStat = null; $aHostInfo = $this->_getShopHostInfo(); $iModStat = $this->_checkModRewrite($aHostInfo); $aSSLHostInfo = $this->_getShopSSLHostInfo(); // Don't need to check if mod status is already failed. if (0 != $iModStat && $aSSLHostInfo) { $iSSLModStat = $this->_checkModRewrite($aSSLHostInfo); // Send if failed, even if couldn't check another if (0 == $iSSLModStat) { return 0; } elseif (1 == $iSSLModStat || 1 == $iModStat) { return 1; } return min($iModStat, $iSSLModStat); } return $iModStat; }
[ "public", "function", "checkModRewrite", "(", ")", "{", "$", "iModStat", "=", "null", ";", "$", "aHostInfo", "=", "$", "this", "->", "_getShopHostInfo", "(", ")", ";", "$", "iModStat", "=", "$", "this", "->", "_checkModRewrite", "(", "$", "aHostInfo", ")...
Checks if mod_rewrite extension is loaded. Checks for all address. @return integer
[ "Checks", "if", "mod_rewrite", "extension", "is", "loaded", ".", "Checks", "for", "all", "address", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/SystemRequirements.php#L443-L465
train
OXID-eSales/oxideshop_ce
source/Core/SystemRequirements.php
SystemRequirements._checkModRewrite
protected function _checkModRewrite($aHostInfo) { $sHostname = ($aHostInfo['ssl'] ? 'ssl://' : '') . $aHostInfo['host']; if ($rFp = @fsockopen($sHostname, $aHostInfo['port'], $iErrNo, $sErrStr, 10)) { $sReq = "POST {$aHostInfo['dir']}oxseo.php?mod_rewrite_module_is=off HTTP/1.1\r\n"; $sReq .= "Host: {$aHostInfo['host']}\r\n"; $sReq .= "User-Agent: OXID eShop setup\r\n"; $sReq .= "Content-Type: application/x-www-form-urlencoded\r\n"; $sReq .= "Content-Length: 0\r\n"; // empty post $sReq .= "Connection: close\r\n\r\n"; $sOut = ''; fwrite($rFp, $sReq); while (!feof($rFp)) { $sOut .= fgets($rFp, 100); } fclose($rFp); $iModStat = (strpos($sOut, 'mod_rewrite_on') !== false) ? 2 : 0; } else { if (function_exists('apache_get_modules')) { // it does not assure that mod_rewrite is enabled on current host, so setting 1 $iModStat = in_array('mod_rewrite', apache_get_modules()) ? 1 : 0; } else { $iModStat = -1; } } return $iModStat; }
php
protected function _checkModRewrite($aHostInfo) { $sHostname = ($aHostInfo['ssl'] ? 'ssl://' : '') . $aHostInfo['host']; if ($rFp = @fsockopen($sHostname, $aHostInfo['port'], $iErrNo, $sErrStr, 10)) { $sReq = "POST {$aHostInfo['dir']}oxseo.php?mod_rewrite_module_is=off HTTP/1.1\r\n"; $sReq .= "Host: {$aHostInfo['host']}\r\n"; $sReq .= "User-Agent: OXID eShop setup\r\n"; $sReq .= "Content-Type: application/x-www-form-urlencoded\r\n"; $sReq .= "Content-Length: 0\r\n"; // empty post $sReq .= "Connection: close\r\n\r\n"; $sOut = ''; fwrite($rFp, $sReq); while (!feof($rFp)) { $sOut .= fgets($rFp, 100); } fclose($rFp); $iModStat = (strpos($sOut, 'mod_rewrite_on') !== false) ? 2 : 0; } else { if (function_exists('apache_get_modules')) { // it does not assure that mod_rewrite is enabled on current host, so setting 1 $iModStat = in_array('mod_rewrite', apache_get_modules()) ? 1 : 0; } else { $iModStat = -1; } } return $iModStat; }
[ "protected", "function", "_checkModRewrite", "(", "$", "aHostInfo", ")", "{", "$", "sHostname", "=", "(", "$", "aHostInfo", "[", "'ssl'", "]", "?", "'ssl://'", ":", "''", ")", ".", "$", "aHostInfo", "[", "'host'", "]", ";", "if", "(", "$", "rFp", "="...
Checks if mod_rewrite extension is loaded. Checks for one address. @param array $aHostInfo host info to open socket @return integer
[ "Checks", "if", "mod_rewrite", "extension", "is", "loaded", ".", "Checks", "for", "one", "address", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/SystemRequirements.php#L475-L504
train
OXID-eSales/oxideshop_ce
source/Core/SystemRequirements.php
SystemRequirements.checkFsockopen
public function checkFsockopen() { $result = 1; $iErrNo = 0; $sErrStr = ''; if ($oRes = @fsockopen('www.example.com', 80, $iErrNo, $sErrStr, 10)) { $result = 2; fclose($oRes); } return $result; }
php
public function checkFsockopen() { $result = 1; $iErrNo = 0; $sErrStr = ''; if ($oRes = @fsockopen('www.example.com', 80, $iErrNo, $sErrStr, 10)) { $result = 2; fclose($oRes); } return $result; }
[ "public", "function", "checkFsockopen", "(", ")", "{", "$", "result", "=", "1", ";", "$", "iErrNo", "=", "0", ";", "$", "sErrStr", "=", "''", ";", "if", "(", "$", "oRes", "=", "@", "fsockopen", "(", "'www.example.com'", ",", "80", ",", "$", "iErrNo...
Check if fsockopen on port 80 possible @return integer
[ "Check", "if", "fsockopen", "on", "port", "80", "possible" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/SystemRequirements.php#L527-L537
train
OXID-eSales/oxideshop_ce
source/Core/SystemRequirements.php
SystemRequirements.checkPhpVersion
public function checkPhpVersion() { $requirementFits = null; $minimalRequiredVersion = '7.0.0'; $minimalRecommendedVersion = '7.0.0'; $maximalRecommendedVersion = '7.1.9999'; $installedPhpVersion = $this->getPhpVersion(); if (version_compare($installedPhpVersion, $minimalRequiredVersion, '<')) { $requirementFits = static::MODULE_STATUS_BLOCKS_SETUP; } if (is_null($requirementFits) && version_compare($installedPhpVersion, $minimalRecommendedVersion, '>=') && version_compare($installedPhpVersion, $maximalRecommendedVersion, '<=')) { $requirementFits = static::MODULE_STATUS_OK; } if (is_null($requirementFits)) { $requirementFits = static::MODULE_STATUS_FITS_MINIMUM_REQUIREMENTS; } return $requirementFits; }
php
public function checkPhpVersion() { $requirementFits = null; $minimalRequiredVersion = '7.0.0'; $minimalRecommendedVersion = '7.0.0'; $maximalRecommendedVersion = '7.1.9999'; $installedPhpVersion = $this->getPhpVersion(); if (version_compare($installedPhpVersion, $minimalRequiredVersion, '<')) { $requirementFits = static::MODULE_STATUS_BLOCKS_SETUP; } if (is_null($requirementFits) && version_compare($installedPhpVersion, $minimalRecommendedVersion, '>=') && version_compare($installedPhpVersion, $maximalRecommendedVersion, '<=')) { $requirementFits = static::MODULE_STATUS_OK; } if (is_null($requirementFits)) { $requirementFits = static::MODULE_STATUS_FITS_MINIMUM_REQUIREMENTS; } return $requirementFits; }
[ "public", "function", "checkPhpVersion", "(", ")", "{", "$", "requirementFits", "=", "null", ";", "$", "minimalRequiredVersion", "=", "'7.0.0'", ";", "$", "minimalRecommendedVersion", "=", "'7.0.0'", ";", "$", "maximalRecommendedVersion", "=", "'7.1.9999'", ";", "...
Checks supported PHP versions. @return integer
[ "Checks", "supported", "PHP", "versions", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/SystemRequirements.php#L544-L569
train
OXID-eSales/oxideshop_ce
source/Core/SystemRequirements.php
SystemRequirements.checkMysqlVersion
public function checkMysqlVersion($installedVersion = null) { $requirementFits = null; $minimalRequiredVersion = '5.5.0'; $maximalRequiredVersion = '5.7.9999'; if ($installedVersion === null) { $resultContainingDatabaseVersion = \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->getRow("SHOW VARIABLES LIKE 'version'"); $installedVersion = $resultContainingDatabaseVersion[1]; } if (version_compare($installedVersion, $minimalRequiredVersion, '<')) { $requirementFits = static::MODULE_STATUS_BLOCKS_SETUP; } /** * There is a bug in MySQL 5.6,* which under certain conditions affects OXID eShop Enterprise Edition. * Version MySQL 5.6.* in neither recommended nor supported by OXID eSales. * See https://bugs.mysql.com/bug.php?id=79203 */ if (is_null($requirementFits) && version_compare($installedVersion, '5.6.0', '>=') && version_compare($installedVersion, '5.7.0', '<') ) { $requirementFits = static::MODULE_STATUS_FITS_MINIMUM_REQUIREMENTS; } if (is_null($requirementFits) && version_compare($installedVersion, $minimalRequiredVersion, '>=') && version_compare($installedVersion, $maximalRequiredVersion, '<=') ) { $requirementFits = static::MODULE_STATUS_OK; } if (is_null($requirementFits)) { $requirementFits = static::MODULE_STATUS_FITS_MINIMUM_REQUIREMENTS; } return $requirementFits; }
php
public function checkMysqlVersion($installedVersion = null) { $requirementFits = null; $minimalRequiredVersion = '5.5.0'; $maximalRequiredVersion = '5.7.9999'; if ($installedVersion === null) { $resultContainingDatabaseVersion = \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->getRow("SHOW VARIABLES LIKE 'version'"); $installedVersion = $resultContainingDatabaseVersion[1]; } if (version_compare($installedVersion, $minimalRequiredVersion, '<')) { $requirementFits = static::MODULE_STATUS_BLOCKS_SETUP; } /** * There is a bug in MySQL 5.6,* which under certain conditions affects OXID eShop Enterprise Edition. * Version MySQL 5.6.* in neither recommended nor supported by OXID eSales. * See https://bugs.mysql.com/bug.php?id=79203 */ if (is_null($requirementFits) && version_compare($installedVersion, '5.6.0', '>=') && version_compare($installedVersion, '5.7.0', '<') ) { $requirementFits = static::MODULE_STATUS_FITS_MINIMUM_REQUIREMENTS; } if (is_null($requirementFits) && version_compare($installedVersion, $minimalRequiredVersion, '>=') && version_compare($installedVersion, $maximalRequiredVersion, '<=') ) { $requirementFits = static::MODULE_STATUS_OK; } if (is_null($requirementFits)) { $requirementFits = static::MODULE_STATUS_FITS_MINIMUM_REQUIREMENTS; } return $requirementFits; }
[ "public", "function", "checkMysqlVersion", "(", "$", "installedVersion", "=", "null", ")", "{", "$", "requirementFits", "=", "null", ";", "$", "minimalRequiredVersion", "=", "'5.5.0'", ";", "$", "maximalRequiredVersion", "=", "'5.7.9999'", ";", "if", "(", "$", ...
Checks if current mysql version matches requirements @param string $installedVersion MySQL version @return int
[ "Checks", "if", "current", "mysql", "version", "matches", "requirements" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/SystemRequirements.php#L679-L719
train
OXID-eSales/oxideshop_ce
source/Core/SystemRequirements.php
SystemRequirements.checkGdInfo
public function checkGdInfo() { $iModStat = extension_loaded('gd') ? 1 : 0; $iModStat = function_exists('imagecreatetruecolor') ? 2 : $iModStat; $iModStat = function_exists('imagecreatefromgif') ? $iModStat : 0; $iModStat = function_exists('imagecreatefromjpeg') ? $iModStat : 0; $iModStat = function_exists('imagecreatefrompng') ? $iModStat : 0; return $iModStat; }
php
public function checkGdInfo() { $iModStat = extension_loaded('gd') ? 1 : 0; $iModStat = function_exists('imagecreatetruecolor') ? 2 : $iModStat; $iModStat = function_exists('imagecreatefromgif') ? $iModStat : 0; $iModStat = function_exists('imagecreatefromjpeg') ? $iModStat : 0; $iModStat = function_exists('imagecreatefrompng') ? $iModStat : 0; return $iModStat; }
[ "public", "function", "checkGdInfo", "(", ")", "{", "$", "iModStat", "=", "extension_loaded", "(", "'gd'", ")", "?", "1", ":", "0", ";", "$", "iModStat", "=", "function_exists", "(", "'imagecreatetruecolor'", ")", "?", "2", ":", "$", "iModStat", ";", "$"...
Checks if GDlib extension is loaded @return integer
[ "Checks", "if", "GDlib", "extension", "is", "loaded" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/SystemRequirements.php#L726-L735
train
OXID-eSales/oxideshop_ce
source/Core/SystemRequirements.php
SystemRequirements.checkMemoryLimit
public function checkMemoryLimit($sMemLimit = null) { if ($sMemLimit === null) { $sMemLimit = @ini_get('memory_limit'); } if ($sMemLimit) { $sDefLimit = $this->_getMinimumMemoryLimit(); $sRecLimit = $this->_getRecommendMemoryLimit(); $iMemLimit = $this->_getBytes($sMemLimit); if ($iMemLimit === '-1') { // -1 is equivalent to no memory limit $iModStat = 2; } else { $iModStat = ($iMemLimit >= $this->_getBytes($sDefLimit)) ? 1 : 0; $iModStat = $iModStat ? (($iMemLimit >= $this->_getBytes($sRecLimit)) ? 2 : $iModStat) : $iModStat; } } else { $iModStat = -1; } return $iModStat; }
php
public function checkMemoryLimit($sMemLimit = null) { if ($sMemLimit === null) { $sMemLimit = @ini_get('memory_limit'); } if ($sMemLimit) { $sDefLimit = $this->_getMinimumMemoryLimit(); $sRecLimit = $this->_getRecommendMemoryLimit(); $iMemLimit = $this->_getBytes($sMemLimit); if ($iMemLimit === '-1') { // -1 is equivalent to no memory limit $iModStat = 2; } else { $iModStat = ($iMemLimit >= $this->_getBytes($sDefLimit)) ? 1 : 0; $iModStat = $iModStat ? (($iMemLimit >= $this->_getBytes($sRecLimit)) ? 2 : $iModStat) : $iModStat; } } else { $iModStat = -1; } return $iModStat; }
[ "public", "function", "checkMemoryLimit", "(", "$", "sMemLimit", "=", "null", ")", "{", "if", "(", "$", "sMemLimit", "===", "null", ")", "{", "$", "sMemLimit", "=", "@", "ini_get", "(", "'memory_limit'", ")", ";", "}", "if", "(", "$", "sMemLimit", ")",...
Checks memory limit. @param string $sMemLimit memory limit to compare with requirements @return integer
[ "Checks", "memory", "limit", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/SystemRequirements.php#L754-L778
train
OXID-eSales/oxideshop_ce
source/Core/SystemRequirements.php
SystemRequirements.checkFileUploads
public function checkFileUploads() { $dUploadFile = -1; $sFileUploads = @ini_get('file_uploads'); if ($sFileUploads !== false) { if ($sFileUploads && ($sFileUploads == '1' || strtolower($sFileUploads) == 'on')) { $dUploadFile = 2; } else { $dUploadFile = 1; } } return $dUploadFile; }
php
public function checkFileUploads() { $dUploadFile = -1; $sFileUploads = @ini_get('file_uploads'); if ($sFileUploads !== false) { if ($sFileUploads && ($sFileUploads == '1' || strtolower($sFileUploads) == 'on')) { $dUploadFile = 2; } else { $dUploadFile = 1; } } return $dUploadFile; }
[ "public", "function", "checkFileUploads", "(", ")", "{", "$", "dUploadFile", "=", "-", "1", ";", "$", "sFileUploads", "=", "@", "ini_get", "(", "'file_uploads'", ")", ";", "if", "(", "$", "sFileUploads", "!==", "false", ")", "{", "if", "(", "$", "sFile...
Checks if php_admin_flag file_uploads is ON @return integer
[ "Checks", "if", "php_admin_flag", "file_uploads", "is", "ON" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/SystemRequirements.php#L856-L869
train
OXID-eSales/oxideshop_ce
source/Core/SystemRequirements.php
SystemRequirements.getSysReqStatus
public function getSysReqStatus() { if ($this->_blSysReqStatus == null) { $this->_blSysReqStatus = true; $this->getSystemInfo(); $this->checkCollation(); } return $this->_blSysReqStatus; }
php
public function getSysReqStatus() { if ($this->_blSysReqStatus == null) { $this->_blSysReqStatus = true; $this->getSystemInfo(); $this->checkCollation(); } return $this->_blSysReqStatus; }
[ "public", "function", "getSysReqStatus", "(", ")", "{", "if", "(", "$", "this", "->", "_blSysReqStatus", "==", "null", ")", "{", "$", "this", "->", "_blSysReqStatus", "=", "true", ";", "$", "this", "->", "getSystemInfo", "(", ")", ";", "$", "this", "->...
Checks system requirements status @return bool
[ "Checks", "system", "requirements", "status" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/SystemRequirements.php#L876-L885
train
OXID-eSales/oxideshop_ce
source/Core/SystemRequirements.php
SystemRequirements.filter
public static function filter($systemRequirementsInfo, $filterFunction) { $iterator = static::iterateThroughSystemRequirementsInfo($systemRequirementsInfo); foreach ($iterator as list($groupId, $moduleId, $moduleState)) { $systemRequirementsInfo[$groupId][$moduleId] = $filterFunction($groupId, $moduleId, $moduleState); } return $systemRequirementsInfo; }
php
public static function filter($systemRequirementsInfo, $filterFunction) { $iterator = static::iterateThroughSystemRequirementsInfo($systemRequirementsInfo); foreach ($iterator as list($groupId, $moduleId, $moduleState)) { $systemRequirementsInfo[$groupId][$moduleId] = $filterFunction($groupId, $moduleId, $moduleState); } return $systemRequirementsInfo; }
[ "public", "static", "function", "filter", "(", "$", "systemRequirementsInfo", ",", "$", "filterFunction", ")", "{", "$", "iterator", "=", "static", "::", "iterateThroughSystemRequirementsInfo", "(", "$", "systemRequirementsInfo", ")", ";", "foreach", "(", "$", "it...
Apply given filter function to all iterations of SystemRequirementInfo array. @param array $systemRequirementsInfo @param \Closure $filterFunction Filter function used for the update of actual values; Function will receive the same arguments as provided from `iterateThroughSystemRequirementsInfo` method. @return array An array which is in the same format as the main input argument but with updated data.
[ "Apply", "given", "filter", "function", "to", "all", "iterations", "of", "SystemRequirementInfo", "array", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/SystemRequirements.php#L928-L937
train
OXID-eSales/oxideshop_ce
source/Core/SystemRequirements.php
SystemRequirements.getModuleInfo
public function getModuleInfo($sModule = null) { if ($sModule) { $iModStat = null; $sCheckFunction = "check" . str_replace(" ", "", ucwords(str_replace("_", " ", $sModule))); $iModStat = $this->$sCheckFunction(); return $iModStat; } }
php
public function getModuleInfo($sModule = null) { if ($sModule) { $iModStat = null; $sCheckFunction = "check" . str_replace(" ", "", ucwords(str_replace("_", " ", $sModule))); $iModStat = $this->$sCheckFunction(); return $iModStat; } }
[ "public", "function", "getModuleInfo", "(", "$", "sModule", "=", "null", ")", "{", "if", "(", "$", "sModule", ")", "{", "$", "iModStat", "=", "null", ";", "$", "sCheckFunction", "=", "\"check\"", ".", "str_replace", "(", "\" \"", ",", "\"\"", ",", "ucw...
Returns passed module state @param string $sModule module name to check @return integer $iModStat
[ "Returns", "passed", "module", "state" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/SystemRequirements.php#L946-L955
train
OXID-eSales/oxideshop_ce
source/Core/SystemRequirements.php
SystemRequirements.canSetupContinue
public static function canSetupContinue($systemRequirementsInfo) { $iterator = static::iterateThroughSystemRequirementsInfo($systemRequirementsInfo); foreach ($iterator as list($groupId, $moduleId, $moduleState)) { if ($moduleState === static::MODULE_STATUS_BLOCKS_SETUP) { return false; } } return true; }
php
public static function canSetupContinue($systemRequirementsInfo) { $iterator = static::iterateThroughSystemRequirementsInfo($systemRequirementsInfo); foreach ($iterator as list($groupId, $moduleId, $moduleState)) { if ($moduleState === static::MODULE_STATUS_BLOCKS_SETUP) { return false; } } return true; }
[ "public", "static", "function", "canSetupContinue", "(", "$", "systemRequirementsInfo", ")", "{", "$", "iterator", "=", "static", "::", "iterateThroughSystemRequirementsInfo", "(", "$", "systemRequirementsInfo", ")", ";", "foreach", "(", "$", "iterator", "as", "list...
Returns true if given module state is acceptable for setup process to continue. @param array $systemRequirementsInfo @return bool
[ "Returns", "true", "if", "given", "module", "state", "is", "acceptable", "for", "setup", "process", "to", "continue", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/SystemRequirements.php#L963-L974
train
OXID-eSales/oxideshop_ce
source/Core/SystemRequirements.php
SystemRequirements._getBytes
protected function _getBytes($sBytes) { $sBytes = trim($sBytes); $sLast = strtolower($sBytes[strlen($sBytes) - 1]); switch ($sLast) { // The 'G' modifier is available since PHP 5.1.0 // gigabytes case 'g': $sBytes *= 1024; // megabytes case 'm': $sBytes *= 1024; // kilobytes case 'k': $sBytes *= 1024; break; } return $sBytes; }
php
protected function _getBytes($sBytes) { $sBytes = trim($sBytes); $sLast = strtolower($sBytes[strlen($sBytes) - 1]); switch ($sLast) { // The 'G' modifier is available since PHP 5.1.0 // gigabytes case 'g': $sBytes *= 1024; // megabytes case 'm': $sBytes *= 1024; // kilobytes case 'k': $sBytes *= 1024; break; } return $sBytes; }
[ "protected", "function", "_getBytes", "(", "$", "sBytes", ")", "{", "$", "sBytes", "=", "trim", "(", "$", "sBytes", ")", ";", "$", "sLast", "=", "strtolower", "(", "$", "sBytes", "[", "strlen", "(", "$", "sBytes", ")", "-", "1", "]", ")", ";", "s...
Parses and calculates given string form byte size value @param string $sBytes string form byte value (64M, 32K etc) @return int
[ "Parses", "and", "calculates", "given", "string", "form", "byte", "size", "value" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/SystemRequirements.php#L1022-L1041
train
OXID-eSales/oxideshop_ce
source/Core/SystemRequirements.php
SystemRequirements._checkTemplateBlock
protected function _checkTemplateBlock($sTemplate, $sBlockName) { $sTplFile = Registry::getConfig()->getTemplatePath($sTemplate, false); if (!$sTplFile || !file_exists($sTplFile)) { // check if file is in admin theme $sTplFile = Registry::getConfig()->getTemplatePath($sTemplate, true); if (!$sTplFile || !file_exists($sTplFile)) { return false; } } $sFile = file_get_contents($sTplFile); $sBlockNameQuoted = preg_quote($sBlockName, '/'); return (bool) preg_match('/\[\{\s*block\s+name\s*=\s*([\'"])' . $sBlockNameQuoted . '\1\s*\}\]/is', $sFile); }
php
protected function _checkTemplateBlock($sTemplate, $sBlockName) { $sTplFile = Registry::getConfig()->getTemplatePath($sTemplate, false); if (!$sTplFile || !file_exists($sTplFile)) { // check if file is in admin theme $sTplFile = Registry::getConfig()->getTemplatePath($sTemplate, true); if (!$sTplFile || !file_exists($sTplFile)) { return false; } } $sFile = file_get_contents($sTplFile); $sBlockNameQuoted = preg_quote($sBlockName, '/'); return (bool) preg_match('/\[\{\s*block\s+name\s*=\s*([\'"])' . $sBlockNameQuoted . '\1\s*\}\]/is', $sFile); }
[ "protected", "function", "_checkTemplateBlock", "(", "$", "sTemplate", ",", "$", "sBlockName", ")", "{", "$", "sTplFile", "=", "Registry", "::", "getConfig", "(", ")", "->", "getTemplatePath", "(", "$", "sTemplate", ",", "false", ")", ";", "if", "(", "!", ...
check if given template contains the given block @param string $sTemplate template file name @param string $sBlockName block name @see getMissingTemplateBlocks @return bool
[ "check", "if", "given", "template", "contains", "the", "given", "block" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/SystemRequirements.php#L1053-L1068
train
OXID-eSales/oxideshop_ce
source/Core/SystemRequirements.php
SystemRequirements.fetchBlockRecords
protected function fetchBlockRecords() { $activeThemeId = oxNew(\OxidEsales\Eshop\Core\Theme::class)->getActiveThemeId(); $config = Registry::getConfig(); $database = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC); $query = "select * from oxtplblocks where oxactive=1 and oxshopid=? and oxtheme in ('', ?)"; return $database->select($query, [$config->getShopId(), $activeThemeId]); }
php
protected function fetchBlockRecords() { $activeThemeId = oxNew(\OxidEsales\Eshop\Core\Theme::class)->getActiveThemeId(); $config = Registry::getConfig(); $database = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC); $query = "select * from oxtplblocks where oxactive=1 and oxshopid=? and oxtheme in ('', ?)"; return $database->select($query, [$config->getShopId(), $activeThemeId]); }
[ "protected", "function", "fetchBlockRecords", "(", ")", "{", "$", "activeThemeId", "=", "oxNew", "(", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "Theme", "::", "class", ")", "->", "getActiveThemeId", "(", ")", ";", "$", "config", "=", "Registry...
Fetch the active template blocks for the active shop and the active theme. @todo extract oxtplblocks query to ModuleTemplateBlockRepository @return ResultSetInterface The active template blocks for the active shop and the active theme.
[ "Fetch", "the", "active", "template", "blocks", "for", "the", "active", "shop", "and", "the", "active", "theme", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/SystemRequirements.php#L1120-L1129
train
OXID-eSales/oxideshop_ce
source/Application/Model/OrderFileList.php
OrderFileList.loadOrderFiles
public function loadOrderFiles($sOrderId) { $oOrderFile = $this->getBaseObject(); $sFields = $oOrderFile->getSelectFields(); $sShopId = \OxidEsales\Eshop\Core\Registry::getConfig()->getShopId(); $oOrderFile->addFieldName('oxorderfiles__oxarticletitle'); $oOrderFile->addFieldName('oxorderfiles__oxarticleartnum'); $sSql = "SELECT " . $sFields . " , `oxorderarticles`.`oxtitle` AS `oxorderfiles__oxarticletitle`, `oxorderarticles`.`oxartnum` AS `oxorderfiles__oxarticleartnum`, `oxfiles`.`oxpurchasedonly` AS `oxorderfiles__oxpurchasedonly` FROM `oxorderfiles` LEFT JOIN `oxorderarticles` ON `oxorderarticles`.`oxid` = `oxorderfiles`.`oxorderarticleid` LEFT JOIN `oxfiles` ON `oxfiles`.`oxid` = `oxorderfiles`.`oxfileid` WHERE `oxorderfiles`.`oxorderid` = '" . $sOrderId . "' AND `oxorderfiles`.`oxshopid` = '" . $sShopId . "' AND `oxorderarticles`.`oxstorno` = 0"; $this->selectString($sSql); }
php
public function loadOrderFiles($sOrderId) { $oOrderFile = $this->getBaseObject(); $sFields = $oOrderFile->getSelectFields(); $sShopId = \OxidEsales\Eshop\Core\Registry::getConfig()->getShopId(); $oOrderFile->addFieldName('oxorderfiles__oxarticletitle'); $oOrderFile->addFieldName('oxorderfiles__oxarticleartnum'); $sSql = "SELECT " . $sFields . " , `oxorderarticles`.`oxtitle` AS `oxorderfiles__oxarticletitle`, `oxorderarticles`.`oxartnum` AS `oxorderfiles__oxarticleartnum`, `oxfiles`.`oxpurchasedonly` AS `oxorderfiles__oxpurchasedonly` FROM `oxorderfiles` LEFT JOIN `oxorderarticles` ON `oxorderarticles`.`oxid` = `oxorderfiles`.`oxorderarticleid` LEFT JOIN `oxfiles` ON `oxfiles`.`oxid` = `oxorderfiles`.`oxfileid` WHERE `oxorderfiles`.`oxorderid` = '" . $sOrderId . "' AND `oxorderfiles`.`oxshopid` = '" . $sShopId . "' AND `oxorderarticles`.`oxstorno` = 0"; $this->selectString($sSql); }
[ "public", "function", "loadOrderFiles", "(", "$", "sOrderId", ")", "{", "$", "oOrderFile", "=", "$", "this", "->", "getBaseObject", "(", ")", ";", "$", "sFields", "=", "$", "oOrderFile", "->", "getSelectFields", "(", ")", ";", "$", "sShopId", "=", "\\", ...
Returns oxorderfiles list @param string $sOrderId - order id
[ "Returns", "oxorderfiles", "list" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/OrderFileList.php#L63-L83
train
OXID-eSales/oxideshop_ce
source/Application/Model/AttributeList.php
AttributeList.loadAttributesByIds
public function loadAttributesByIds($aIds) { if (!count($aIds)) { return; } $sAttrViewName = getViewName('oxattribute'); $sViewName = getViewName('oxobject2attribute'); $oxObjectIdsSql = implode(',', \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quoteArray($aIds)); $sSelect = "select $sAttrViewName.oxid, $sAttrViewName.oxtitle, {$sViewName}.oxvalue, {$sViewName}.oxobjectid "; $sSelect .= "from {$sViewName} left join $sAttrViewName on $sAttrViewName.oxid = {$sViewName}.oxattrid "; $sSelect .= "where {$sViewName}.oxobjectid in ( " . $oxObjectIdsSql . " ) "; $sSelect .= "order by {$sViewName}.oxpos, $sAttrViewName.oxpos"; return $this->_createAttributeListFromSql($sSelect); }
php
public function loadAttributesByIds($aIds) { if (!count($aIds)) { return; } $sAttrViewName = getViewName('oxattribute'); $sViewName = getViewName('oxobject2attribute'); $oxObjectIdsSql = implode(',', \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quoteArray($aIds)); $sSelect = "select $sAttrViewName.oxid, $sAttrViewName.oxtitle, {$sViewName}.oxvalue, {$sViewName}.oxobjectid "; $sSelect .= "from {$sViewName} left join $sAttrViewName on $sAttrViewName.oxid = {$sViewName}.oxattrid "; $sSelect .= "where {$sViewName}.oxobjectid in ( " . $oxObjectIdsSql . " ) "; $sSelect .= "order by {$sViewName}.oxpos, $sAttrViewName.oxpos"; return $this->_createAttributeListFromSql($sSelect); }
[ "public", "function", "loadAttributesByIds", "(", "$", "aIds", ")", "{", "if", "(", "!", "count", "(", "$", "aIds", ")", ")", "{", "return", ";", "}", "$", "sAttrViewName", "=", "getViewName", "(", "'oxattribute'", ")", ";", "$", "sViewName", "=", "get...
Load all attributes by article Id's @param array $aIds article id's @return array $aAttributes;
[ "Load", "all", "attributes", "by", "article", "Id", "s" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/AttributeList.php#L34-L51
train
OXID-eSales/oxideshop_ce
source/Application/Model/AttributeList.php
AttributeList._createAttributeListFromSql
protected function _createAttributeListFromSql($sSelect) { $aAttributes = []; $rs = \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->select($sSelect); if ($rs != false && $rs->count() > 0) { while (!$rs->EOF) { if (!isset($aAttributes[$rs->fields[0]])) { $aAttributes[$rs->fields[0]] = new stdClass(); } $aAttributes[$rs->fields[0]]->title = $rs->fields[1]; if (!isset($aAttributes[$rs->fields[0]]->aProd[$rs->fields[3]])) { $aAttributes[$rs->fields[0]]->aProd[$rs->fields[3]] = new stdClass(); } $aAttributes[$rs->fields[0]]->aProd[$rs->fields[3]]->value = $rs->fields[2]; $rs->fetchRow(); } } return $aAttributes; }
php
protected function _createAttributeListFromSql($sSelect) { $aAttributes = []; $rs = \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->select($sSelect); if ($rs != false && $rs->count() > 0) { while (!$rs->EOF) { if (!isset($aAttributes[$rs->fields[0]])) { $aAttributes[$rs->fields[0]] = new stdClass(); } $aAttributes[$rs->fields[0]]->title = $rs->fields[1]; if (!isset($aAttributes[$rs->fields[0]]->aProd[$rs->fields[3]])) { $aAttributes[$rs->fields[0]]->aProd[$rs->fields[3]] = new stdClass(); } $aAttributes[$rs->fields[0]]->aProd[$rs->fields[3]]->value = $rs->fields[2]; $rs->fetchRow(); } } return $aAttributes; }
[ "protected", "function", "_createAttributeListFromSql", "(", "$", "sSelect", ")", "{", "$", "aAttributes", "=", "[", "]", ";", "$", "rs", "=", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "DatabaseProvider", "::", "getDb", "(", ")", "->", "select...
Fills array with keys and products with value @param string $sSelect SQL select @return array $aAttributes
[ "Fills", "array", "with", "keys", "and", "products", "with", "value" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/AttributeList.php#L60-L80
train
OXID-eSales/oxideshop_ce
source/Application/Model/AttributeList.php
AttributeList.loadAttributes
public function loadAttributes($sArticleId, $sParentId = null) { if ($sArticleId) { $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC); $sAttrViewName = getViewName('oxattribute'); $sViewName = getViewName('oxobject2attribute'); $sSelect = "select {$sAttrViewName}.`oxid`, {$sAttrViewName}.`oxtitle`, o2a.`oxvalue` from {$sViewName} as o2a "; $sSelect .= "left join {$sAttrViewName} on {$sAttrViewName}.oxid = o2a.oxattrid "; $sSelect .= "where o2a.oxobjectid = '%s' and o2a.oxvalue != '' "; $sSelect .= "order by o2a.oxpos, {$sAttrViewName}.oxpos"; $aAttributes = $oDb->getAll(sprintf($sSelect, $sArticleId)); if ($sParentId) { $aParentAttributes = $oDb->getAll(sprintf($sSelect, $sParentId)); $aAttributes = $this->_mergeAttributes($aAttributes, $aParentAttributes); } $this->assignArray($aAttributes); } }
php
public function loadAttributes($sArticleId, $sParentId = null) { if ($sArticleId) { $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC); $sAttrViewName = getViewName('oxattribute'); $sViewName = getViewName('oxobject2attribute'); $sSelect = "select {$sAttrViewName}.`oxid`, {$sAttrViewName}.`oxtitle`, o2a.`oxvalue` from {$sViewName} as o2a "; $sSelect .= "left join {$sAttrViewName} on {$sAttrViewName}.oxid = o2a.oxattrid "; $sSelect .= "where o2a.oxobjectid = '%s' and o2a.oxvalue != '' "; $sSelect .= "order by o2a.oxpos, {$sAttrViewName}.oxpos"; $aAttributes = $oDb->getAll(sprintf($sSelect, $sArticleId)); if ($sParentId) { $aParentAttributes = $oDb->getAll(sprintf($sSelect, $sParentId)); $aAttributes = $this->_mergeAttributes($aAttributes, $aParentAttributes); } $this->assignArray($aAttributes); } }
[ "public", "function", "loadAttributes", "(", "$", "sArticleId", ",", "$", "sParentId", "=", "null", ")", "{", "if", "(", "$", "sArticleId", ")", "{", "$", "oDb", "=", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "DatabaseProvider", "::", "getDb...
Load attributes by article Id @param string $sArticleId article id @param string $sParentId article parent id
[ "Load", "attributes", "by", "article", "Id" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/AttributeList.php#L88-L110
train
OXID-eSales/oxideshop_ce
source/Application/Model/AttributeList.php
AttributeList.getCategoryAttributes
public function getCategoryAttributes($sCategoryId, $iLang) { $aSessionFilter = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable('session_attrfilter'); $oArtList = oxNew(\OxidEsales\Eshop\Application\Model\ArticleList::class); $oArtList->loadCategoryIDs($sCategoryId, $aSessionFilter); // Only if we have articles if (count($oArtList) > 0) { $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(); $sArtIds = ''; foreach (array_keys($oArtList->getArray()) as $sId) { if ($sArtIds) { $sArtIds .= ','; } $sArtIds .= $oDb->quote($sId); } $sActCatQuoted = $oDb->quote($sCategoryId); $sAttTbl = getViewName('oxattribute', $iLang); $sO2ATbl = getViewName('oxobject2attribute', $iLang); $sC2ATbl = getViewName('oxcategory2attribute', $iLang); $sSelect = "SELECT DISTINCT att.oxid, att.oxtitle, o2a.oxvalue " . "FROM $sAttTbl as att, $sO2ATbl as o2a ,$sC2ATbl as c2a " . "WHERE att.oxid = o2a.oxattrid AND c2a.oxobjectid = $sActCatQuoted AND c2a.oxattrid = att.oxid AND o2a.oxvalue !='' AND o2a.oxobjectid IN ($sArtIds) " . "ORDER BY c2a.oxsort , att.oxpos, att.oxtitle, o2a.oxvalue"; $rs = $oDb->select($sSelect); if ($rs != false && $rs->count() > 0) { while (!$rs->EOF && list($sAttId, $sAttTitle, $sAttValue) = $rs->fields) { if (!$this->offsetExists($sAttId)) { $oAttribute = oxNew(\OxidEsales\Eshop\Application\Model\Attribute::class); $oAttribute->setTitle($sAttTitle); $this->offsetSet($sAttId, $oAttribute); $iLang = \OxidEsales\Eshop\Core\Registry::getLang()->getBaseLanguage(); if (isset($aSessionFilter[$sCategoryId][$iLang][$sAttId])) { $oAttribute->setActiveValue($aSessionFilter[$sCategoryId][$iLang][$sAttId]); } } else { $oAttribute = $this->offsetGet($sAttId); } $oAttribute->addValue($sAttValue); $rs->fetchRow(); } } } return $this; }
php
public function getCategoryAttributes($sCategoryId, $iLang) { $aSessionFilter = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable('session_attrfilter'); $oArtList = oxNew(\OxidEsales\Eshop\Application\Model\ArticleList::class); $oArtList->loadCategoryIDs($sCategoryId, $aSessionFilter); // Only if we have articles if (count($oArtList) > 0) { $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(); $sArtIds = ''; foreach (array_keys($oArtList->getArray()) as $sId) { if ($sArtIds) { $sArtIds .= ','; } $sArtIds .= $oDb->quote($sId); } $sActCatQuoted = $oDb->quote($sCategoryId); $sAttTbl = getViewName('oxattribute', $iLang); $sO2ATbl = getViewName('oxobject2attribute', $iLang); $sC2ATbl = getViewName('oxcategory2attribute', $iLang); $sSelect = "SELECT DISTINCT att.oxid, att.oxtitle, o2a.oxvalue " . "FROM $sAttTbl as att, $sO2ATbl as o2a ,$sC2ATbl as c2a " . "WHERE att.oxid = o2a.oxattrid AND c2a.oxobjectid = $sActCatQuoted AND c2a.oxattrid = att.oxid AND o2a.oxvalue !='' AND o2a.oxobjectid IN ($sArtIds) " . "ORDER BY c2a.oxsort , att.oxpos, att.oxtitle, o2a.oxvalue"; $rs = $oDb->select($sSelect); if ($rs != false && $rs->count() > 0) { while (!$rs->EOF && list($sAttId, $sAttTitle, $sAttValue) = $rs->fields) { if (!$this->offsetExists($sAttId)) { $oAttribute = oxNew(\OxidEsales\Eshop\Application\Model\Attribute::class); $oAttribute->setTitle($sAttTitle); $this->offsetSet($sAttId, $oAttribute); $iLang = \OxidEsales\Eshop\Core\Registry::getLang()->getBaseLanguage(); if (isset($aSessionFilter[$sCategoryId][$iLang][$sAttId])) { $oAttribute->setActiveValue($aSessionFilter[$sCategoryId][$iLang][$sAttId]); } } else { $oAttribute = $this->offsetGet($sAttId); } $oAttribute->addValue($sAttValue); $rs->fetchRow(); } } } return $this; }
[ "public", "function", "getCategoryAttributes", "(", "$", "sCategoryId", ",", "$", "iLang", ")", "{", "$", "aSessionFilter", "=", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "Registry", "::", "getSession", "(", ")", "->", "getVariable", "(", "'sess...
get category attributes by category Id @param string $sCategoryId category Id @param integer $iLang language No @return object;
[ "get", "category", "attributes", "by", "category", "Id" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/AttributeList.php#L150-L202
train
OXID-eSales/oxideshop_ce
source/Application/Model/AttributeList.php
AttributeList._mergeAttributes
protected function _mergeAttributes($aAttributes, $aParentAttributes) { if (count($aParentAttributes)) { $aAttrIds = []; foreach ($aAttributes as $aAttribute) { $aAttrIds[] = $aAttribute['OXID']; } foreach ($aParentAttributes as $aAttribute) { if (!in_array($aAttribute['OXID'], $aAttrIds)) { $aAttributes[] = $aAttribute; } } } return $aAttributes; }
php
protected function _mergeAttributes($aAttributes, $aParentAttributes) { if (count($aParentAttributes)) { $aAttrIds = []; foreach ($aAttributes as $aAttribute) { $aAttrIds[] = $aAttribute['OXID']; } foreach ($aParentAttributes as $aAttribute) { if (!in_array($aAttribute['OXID'], $aAttrIds)) { $aAttributes[] = $aAttribute; } } } return $aAttributes; }
[ "protected", "function", "_mergeAttributes", "(", "$", "aAttributes", ",", "$", "aParentAttributes", ")", "{", "if", "(", "count", "(", "$", "aParentAttributes", ")", ")", "{", "$", "aAttrIds", "=", "[", "]", ";", "foreach", "(", "$", "aAttributes", "as", ...
Merge attribute arrays @param array $aAttributes array of attributes @param array $aParentAttributes array of parent article attributes @return array $aAttributes
[ "Merge", "attribute", "arrays" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/AttributeList.php#L212-L229
train
OXID-eSales/oxideshop_ce
source/Application/Model/UserAddressList.php
UserAddressList.load
public function load($sUserId) { $sViewName = getViewName('oxcountry'); $oBaseObject = $this->getBaseObject(); $sSelectFields = $oBaseObject->getSelectFields(); $sSelect = " SELECT {$sSelectFields}, `oxcountry`.`oxtitle` AS oxcountry FROM oxaddress LEFT JOIN {$sViewName} AS oxcountry ON oxaddress.oxcountryid = oxcountry.oxid WHERE oxaddress.oxuserid = " . \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quote($sUserId); $this->selectString($sSelect); }
php
public function load($sUserId) { $sViewName = getViewName('oxcountry'); $oBaseObject = $this->getBaseObject(); $sSelectFields = $oBaseObject->getSelectFields(); $sSelect = " SELECT {$sSelectFields}, `oxcountry`.`oxtitle` AS oxcountry FROM oxaddress LEFT JOIN {$sViewName} AS oxcountry ON oxaddress.oxcountryid = oxcountry.oxid WHERE oxaddress.oxuserid = " . \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quote($sUserId); $this->selectString($sSelect); }
[ "public", "function", "load", "(", "$", "sUserId", ")", "{", "$", "sViewName", "=", "getViewName", "(", "'oxcountry'", ")", ";", "$", "oBaseObject", "=", "$", "this", "->", "getBaseObject", "(", ")", ";", "$", "sSelectFields", "=", "$", "oBaseObject", "-...
Selects and loads all address for particular user. @param string $sUserId user id
[ "Selects", "and", "loads", "all", "address", "for", "particular", "user", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/UserAddressList.php#L29-L41
train
OXID-eSales/oxideshop_ce
source/Application/Controller/Admin/LanguageList.php
LanguageList.deleteEntry
public function deleteEntry() { $myConfig = \OxidEsales\Eshop\Core\Registry::getConfig(); $sOxId = $this->getEditObjectId(); $aLangData['params'] = $myConfig->getConfigParam('aLanguageParams'); $aLangData['lang'] = $myConfig->getConfigParam('aLanguages'); $aLangData['urls'] = $myConfig->getConfigParam('aLanguageURLs'); $aLangData['sslUrls'] = $myConfig->getConfigParam('aLanguageSSLURLs'); $iBaseId = (int) $aLangData['params'][$sOxId]['baseId']; // preventing deleting main language with base id = 0 if ($iBaseId == 0) { $oEx = oxNew(\OxidEsales\Eshop\Core\Exception\ExceptionToDisplay::class); $oEx->setMessage('LANGUAGE_DELETINGMAINLANG_WARNING'); \OxidEsales\Eshop\Core\Registry::getUtilsView()->addErrorToDisplay($oEx); return; } // unsetting selected lang from languages arrays unset($aLangData['params'][$sOxId]); unset($aLangData['lang'][$sOxId]); unset($aLangData['urls'][$iBaseId]); unset($aLangData['sslUrls'][$iBaseId]); //saving languages info back to DB $myConfig->saveShopConfVar('aarr', 'aLanguageParams', $aLangData['params']); $myConfig->saveShopConfVar('aarr', 'aLanguages', $aLangData['lang']); $myConfig->saveShopConfVar('arr', 'aLanguageURLs', $aLangData['urls']); $myConfig->saveShopConfVar('arr', 'aLanguageSSLURLs', $aLangData['sslUrls']); //if deleted language was default, setting defalt lang to 0 if ($iBaseId == $myConfig->getConfigParam('sDefaultLang')) { $myConfig->saveShopConfVar('str', 'sDefaultLang', 0); } }
php
public function deleteEntry() { $myConfig = \OxidEsales\Eshop\Core\Registry::getConfig(); $sOxId = $this->getEditObjectId(); $aLangData['params'] = $myConfig->getConfigParam('aLanguageParams'); $aLangData['lang'] = $myConfig->getConfigParam('aLanguages'); $aLangData['urls'] = $myConfig->getConfigParam('aLanguageURLs'); $aLangData['sslUrls'] = $myConfig->getConfigParam('aLanguageSSLURLs'); $iBaseId = (int) $aLangData['params'][$sOxId]['baseId']; // preventing deleting main language with base id = 0 if ($iBaseId == 0) { $oEx = oxNew(\OxidEsales\Eshop\Core\Exception\ExceptionToDisplay::class); $oEx->setMessage('LANGUAGE_DELETINGMAINLANG_WARNING'); \OxidEsales\Eshop\Core\Registry::getUtilsView()->addErrorToDisplay($oEx); return; } // unsetting selected lang from languages arrays unset($aLangData['params'][$sOxId]); unset($aLangData['lang'][$sOxId]); unset($aLangData['urls'][$iBaseId]); unset($aLangData['sslUrls'][$iBaseId]); //saving languages info back to DB $myConfig->saveShopConfVar('aarr', 'aLanguageParams', $aLangData['params']); $myConfig->saveShopConfVar('aarr', 'aLanguages', $aLangData['lang']); $myConfig->saveShopConfVar('arr', 'aLanguageURLs', $aLangData['urls']); $myConfig->saveShopConfVar('arr', 'aLanguageSSLURLs', $aLangData['sslUrls']); //if deleted language was default, setting defalt lang to 0 if ($iBaseId == $myConfig->getConfigParam('sDefaultLang')) { $myConfig->saveShopConfVar('str', 'sDefaultLang', 0); } }
[ "public", "function", "deleteEntry", "(", ")", "{", "$", "myConfig", "=", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "Registry", "::", "getConfig", "(", ")", ";", "$", "sOxId", "=", "$", "this", "->", "getEditObjectId", "(", ")", ";", "$", ...
Checks for Malladmin rights @return null
[ "Checks", "for", "Malladmin", "rights" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/LanguageList.php#L37-L74
train
OXID-eSales/oxideshop_ce
source/Application/Controller/Admin/LanguageList.php
LanguageList._getLanguagesList
protected function _getLanguagesList() { $aLangParams = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('aLanguageParams'); $aLanguages = \OxidEsales\Eshop\Core\Registry::getLang()->getLanguageArray(); $sDefaultLang = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('sDefaultLang'); foreach ($aLanguages as $sKey => $sValue) { $sOxId = $sValue->oxid; $aLanguages[$sKey]->active = (!isset($aLangParams[$sOxId]["active"])) ? 1 : $aLangParams[$sOxId]["active"]; $aLanguages[$sKey]->default = ($aLangParams[$sOxId]["baseId"] == $sDefaultLang) ? true : false; $aLanguages[$sKey]->sort = $aLangParams[$sOxId]["sort"]; } if (is_array($aLangParams)) { $aSorting = $this->getListSorting(); if (is_array($aSorting)) { foreach ($aSorting as $aFieldSorting) { foreach ($aFieldSorting as $sField => $sDir) { $this->_sDefSortField = $sField; $this->_sDefSortOrder = $sDir; if ($sField == 'active') { //reverting sort order for field 'active' $this->_sDefSortOrder = 'desc'; } break 2; } } } uasort($aLanguages, [$this, '_sortLanguagesCallback']); } return $aLanguages; }
php
protected function _getLanguagesList() { $aLangParams = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('aLanguageParams'); $aLanguages = \OxidEsales\Eshop\Core\Registry::getLang()->getLanguageArray(); $sDefaultLang = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('sDefaultLang'); foreach ($aLanguages as $sKey => $sValue) { $sOxId = $sValue->oxid; $aLanguages[$sKey]->active = (!isset($aLangParams[$sOxId]["active"])) ? 1 : $aLangParams[$sOxId]["active"]; $aLanguages[$sKey]->default = ($aLangParams[$sOxId]["baseId"] == $sDefaultLang) ? true : false; $aLanguages[$sKey]->sort = $aLangParams[$sOxId]["sort"]; } if (is_array($aLangParams)) { $aSorting = $this->getListSorting(); if (is_array($aSorting)) { foreach ($aSorting as $aFieldSorting) { foreach ($aFieldSorting as $sField => $sDir) { $this->_sDefSortField = $sField; $this->_sDefSortOrder = $sDir; if ($sField == 'active') { //reverting sort order for field 'active' $this->_sDefSortOrder = 'desc'; } break 2; } } } uasort($aLanguages, [$this, '_sortLanguagesCallback']); } return $aLanguages; }
[ "protected", "function", "_getLanguagesList", "(", ")", "{", "$", "aLangParams", "=", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "Registry", "::", "getConfig", "(", ")", "->", "getConfigParam", "(", "'aLanguageParams'", ")", ";", "$", "aLanguages",...
Collects shop languages list. @return array
[ "Collects", "shop", "languages", "list", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/LanguageList.php#L95-L130
train
OXID-eSales/oxideshop_ce
source/Application/Controller/Admin/LanguageList.php
LanguageList._sortLanguagesCallback
protected function _sortLanguagesCallback($oLang1, $oLang2) { $sSortParam = $this->_sDefSortField; $sVal1 = is_string($oLang1->$sSortParam) ? strtolower($oLang1->$sSortParam) : $oLang1->$sSortParam; $sVal2 = is_string($oLang2->$sSortParam) ? strtolower($oLang2->$sSortParam) : $oLang2->$sSortParam; if ($this->_sDefSortOrder == 'asc') { return ($sVal1 < $sVal2) ? -1 : 1; } else { return ($sVal1 > $sVal2) ? -1 : 1; } }
php
protected function _sortLanguagesCallback($oLang1, $oLang2) { $sSortParam = $this->_sDefSortField; $sVal1 = is_string($oLang1->$sSortParam) ? strtolower($oLang1->$sSortParam) : $oLang1->$sSortParam; $sVal2 = is_string($oLang2->$sSortParam) ? strtolower($oLang2->$sSortParam) : $oLang2->$sSortParam; if ($this->_sDefSortOrder == 'asc') { return ($sVal1 < $sVal2) ? -1 : 1; } else { return ($sVal1 > $sVal2) ? -1 : 1; } }
[ "protected", "function", "_sortLanguagesCallback", "(", "$", "oLang1", ",", "$", "oLang2", ")", "{", "$", "sSortParam", "=", "$", "this", "->", "_sDefSortField", ";", "$", "sVal1", "=", "is_string", "(", "$", "oLang1", "->", "$", "sSortParam", ")", "?", ...
Callback function for sorting languages objects. Sorts array according 'sort' parameter @param object $oLang1 language object @param object $oLang2 language object @return bool
[ "Callback", "function", "for", "sorting", "languages", "objects", ".", "Sorts", "array", "according", "sort", "parameter" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/LanguageList.php#L141-L152
train
OXID-eSales/oxideshop_ce
source/Application/Controller/Admin/LanguageList.php
LanguageList._resetMultiLangDbFields
protected function _resetMultiLangDbFields($iLangId) { $iLangId = (int) $iLangId; //skipping reseting language with id = 0 if ($iLangId) { \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->startTransaction(); try { $oDbMeta = oxNew(\OxidEsales\Eshop\Core\DbMetaDataHandler::class); $oDbMeta->resetLanguage($iLangId); \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->commitTransaction(); } catch (Exception $oEx) { // if exception, rollBack everything \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->rollbackTransaction(); //show warning $oEx = oxNew(\OxidEsales\Eshop\Core\Exception\ExceptionToDisplay::class); $oEx->setMessage('LANGUAGE_ERROR_RESETING_MULTILANG_FIELDS'); \OxidEsales\Eshop\Core\Registry::getUtilsView()->addErrorToDisplay($oEx); } } }
php
protected function _resetMultiLangDbFields($iLangId) { $iLangId = (int) $iLangId; //skipping reseting language with id = 0 if ($iLangId) { \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->startTransaction(); try { $oDbMeta = oxNew(\OxidEsales\Eshop\Core\DbMetaDataHandler::class); $oDbMeta->resetLanguage($iLangId); \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->commitTransaction(); } catch (Exception $oEx) { // if exception, rollBack everything \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->rollbackTransaction(); //show warning $oEx = oxNew(\OxidEsales\Eshop\Core\Exception\ExceptionToDisplay::class); $oEx->setMessage('LANGUAGE_ERROR_RESETING_MULTILANG_FIELDS'); \OxidEsales\Eshop\Core\Registry::getUtilsView()->addErrorToDisplay($oEx); } } }
[ "protected", "function", "_resetMultiLangDbFields", "(", "$", "iLangId", ")", "{", "$", "iLangId", "=", "(", "int", ")", "$", "iLangId", ";", "//skipping reseting language with id = 0", "if", "(", "$", "iLangId", ")", "{", "\\", "OxidEsales", "\\", "Eshop", "\...
Resets all multilanguage fields with specific language id to default value in all tables. @param string $iLangId language ID
[ "Resets", "all", "multilanguage", "fields", "with", "specific", "language", "id", "to", "default", "value", "in", "all", "tables", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/LanguageList.php#L160-L183
train
OXID-eSales/oxideshop_ce
source/Internal/Review/Bridge/UserRatingBridge.php
UserRatingBridge.deleteRating
public function deleteRating($userId, $ratingId) { $rating = $this->getRatingById($ratingId); $this->validateUserPermissionsToManageRating($rating, $userId); $rating = $this->disableSubShopDeleteProtectionForRating($rating); $rating->delete(); }
php
public function deleteRating($userId, $ratingId) { $rating = $this->getRatingById($ratingId); $this->validateUserPermissionsToManageRating($rating, $userId); $rating = $this->disableSubShopDeleteProtectionForRating($rating); $rating->delete(); }
[ "public", "function", "deleteRating", "(", "$", "userId", ",", "$", "ratingId", ")", "{", "$", "rating", "=", "$", "this", "->", "getRatingById", "(", "$", "ratingId", ")", ";", "$", "this", "->", "validateUserPermissionsToManageRating", "(", "$", "rating", ...
Delete a Rating. @param string $userId @param string $ratingId @throws RatingPermissionException
[ "Delete", "a", "Rating", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Internal/Review/Bridge/UserRatingBridge.php#L43-L51
train
OXID-eSales/oxideshop_ce
source/Application/Controller/Admin/GenericExportDo.php
GenericExportDo.nextTick
public function nextTick($iCnt) { $iExportedItems = $iCnt; $blContinue = false; if ($oArticle = $this->getOneArticle($iCnt, $blContinue)) { $myConfig = \OxidEsales\Eshop\Core\Registry::getConfig(); $oSmarty = \OxidEsales\Eshop\Core\Registry::getUtilsView()->getSmarty(); $oSmarty->assign("sCustomHeader", \OxidEsales\Eshop\Core\Registry::getSession()->getVariable("sExportCustomHeader")); $oSmarty->assign("linenr", $iCnt); $oSmarty->assign("article", $oArticle); $oSmarty->assign("spr", $myConfig->getConfigParam('sCSVSign')); $oSmarty->assign("encl", $myConfig->getConfigParam('sGiCsvFieldEncloser')); $this->write($oSmarty->fetch("genexport.tpl", $this->getViewId())); return ++$iExportedItems; } return $blContinue; }
php
public function nextTick($iCnt) { $iExportedItems = $iCnt; $blContinue = false; if ($oArticle = $this->getOneArticle($iCnt, $blContinue)) { $myConfig = \OxidEsales\Eshop\Core\Registry::getConfig(); $oSmarty = \OxidEsales\Eshop\Core\Registry::getUtilsView()->getSmarty(); $oSmarty->assign("sCustomHeader", \OxidEsales\Eshop\Core\Registry::getSession()->getVariable("sExportCustomHeader")); $oSmarty->assign("linenr", $iCnt); $oSmarty->assign("article", $oArticle); $oSmarty->assign("spr", $myConfig->getConfigParam('sCSVSign')); $oSmarty->assign("encl", $myConfig->getConfigParam('sGiCsvFieldEncloser')); $this->write($oSmarty->fetch("genexport.tpl", $this->getViewId())); return ++$iExportedItems; } return $blContinue; }
[ "public", "function", "nextTick", "(", "$", "iCnt", ")", "{", "$", "iExportedItems", "=", "$", "iCnt", ";", "$", "blContinue", "=", "false", ";", "if", "(", "$", "oArticle", "=", "$", "this", "->", "getOneArticle", "(", "$", "iCnt", ",", "$", "blCont...
Does Export line by line on position iCnt @param integer $iCnt export position @return bool
[ "Does", "Export", "line", "by", "line", "on", "position", "iCnt" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/GenericExportDo.php#L51-L69
train
OXID-eSales/oxideshop_ce
source/Application/Model/NewsSubscribed.php
NewsSubscribed.getSubscribedUserIdByEmail
protected function getSubscribedUserIdByEmail($email) { $database = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(); $sEmailAddressQuoted = $database->quote($email); $userOxid = $database->getOne("select oxid from oxnewssubscribed where oxemail = {$sEmailAddressQuoted} "); return $userOxid; }
php
protected function getSubscribedUserIdByEmail($email) { $database = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(); $sEmailAddressQuoted = $database->quote($email); $userOxid = $database->getOne("select oxid from oxnewssubscribed where oxemail = {$sEmailAddressQuoted} "); return $userOxid; }
[ "protected", "function", "getSubscribedUserIdByEmail", "(", "$", "email", ")", "{", "$", "database", "=", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "DatabaseProvider", "::", "getDb", "(", ")", ";", "$", "sEmailAddressQuoted", "=", "$", "database",...
Get subscribed user id by email. @param string $email @return string
[ "Get", "subscribed", "user", "id", "by", "email", "." ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/NewsSubscribed.php#L91-L98
train
OXID-eSales/oxideshop_ce
source/Application/Model/NewsSubscribed.php
NewsSubscribed.loadFromUserId
public function loadFromUserId($sOxUserId) { $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(); $sOxId = $oDb->getOne("select oxid from oxnewssubscribed where oxuserid = {$oDb->quote($sOxUserId)} and oxshopid = {$oDb->quote(\OxidEsales\Eshop\Core\Registry::getConfig()->getShopId())}"); return $this->load($sOxId); }
php
public function loadFromUserId($sOxUserId) { $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(); $sOxId = $oDb->getOne("select oxid from oxnewssubscribed where oxuserid = {$oDb->quote($sOxUserId)} and oxshopid = {$oDb->quote(\OxidEsales\Eshop\Core\Registry::getConfig()->getShopId())}"); return $this->load($sOxId); }
[ "public", "function", "loadFromUserId", "(", "$", "sOxUserId", ")", "{", "$", "oDb", "=", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "DatabaseProvider", "::", "getDb", "(", ")", ";", "$", "sOxId", "=", "$", "oDb", "->", "getOne", "(", "\"se...
Loader which loads news subscription according to subscribers oxid @param string $sOxUserId subscribers oxid @return bool
[ "Loader", "which", "loads", "news", "subscription", "according", "to", "subscribers", "oxid" ]
acd72f4a7c5c7340d70b191e081e4a24b74887cc
https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/NewsSubscribed.php#L107-L113
train