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
aimeos/ai-controller-jobs
controller/common/src/Controller/Common/Product/Import/Csv/Processor/Catalog/Standard.php
Standard.getListItems
protected function getListItems( $prodid, array $types ) { if( empty( $types ) ) { return []; } $manager = \Aimeos\MShop::create( $this->getContext(), 'catalog/lists' ); $search = $manager->createSearch()->setSlice( 0, 0x7FFFFFFF ); $expr = []; foreach( $types as $type ) { $expr[] = $search->compare( '==', 'catalog.lists.key', 'product|' . $type . '|' . $prodid ); } return $manager->searchItems( $search->setConditions( $search->combine( '||', $expr ) ) ); }
php
protected function getListItems( $prodid, array $types ) { if( empty( $types ) ) { return []; } $manager = \Aimeos\MShop::create( $this->getContext(), 'catalog/lists' ); $search = $manager->createSearch()->setSlice( 0, 0x7FFFFFFF ); $expr = []; foreach( $types as $type ) { $expr[] = $search->compare( '==', 'catalog.lists.key', 'product|' . $type . '|' . $prodid ); } return $manager->searchItems( $search->setConditions( $search->combine( '||', $expr ) ) ); }
[ "protected", "function", "getListItems", "(", "$", "prodid", ",", "array", "$", "types", ")", "{", "if", "(", "empty", "(", "$", "types", ")", ")", "{", "return", "[", "]", ";", "}", "$", "manager", "=", "\\", "Aimeos", "\\", "MShop", "::", "create...
Returns the catalog list items for the given category and product ID @param string $prodid Unique product ID @param array $types List of catalog list types @return array List of catalog list items
[ "Returns", "the", "catalog", "list", "items", "for", "the", "given", "category", "and", "product", "ID" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/common/src/Controller/Common/Product/Import/Csv/Processor/Catalog/Standard.php#L243-L258
train
pr-of-it/t4
framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/ErrorHandler/Base.php
CKFinder_Connector_ErrorHandler_Base.throwError
public function throwError($number, $text = false) { if ($this->_catchAllErrors || in_array($number, $this->_skipErrorsArray)) { return false; } $_xml =& CKFinder_Connector_Core_Factory::getInstance("Core_Xml"); $_xml->raiseError($number,$text); exit; }
php
public function throwError($number, $text = false) { if ($this->_catchAllErrors || in_array($number, $this->_skipErrorsArray)) { return false; } $_xml =& CKFinder_Connector_Core_Factory::getInstance("Core_Xml"); $_xml->raiseError($number,$text); exit; }
[ "public", "function", "throwError", "(", "$", "number", ",", "$", "text", "=", "false", ")", "{", "if", "(", "$", "this", "->", "_catchAllErrors", "||", "in_array", "(", "$", "number", ",", "$", "this", "->", "_skipErrorsArray", ")", ")", "{", "return"...
Throw connector error, return true if error has been thrown, false if error has been catched @param int $number @param string $text @access public
[ "Throw", "connector", "error", "return", "true", "if", "error", "has", "been", "thrown", "false", "if", "error", "has", "been", "catched" ]
8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada
https://github.com/pr-of-it/t4/blob/8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada/framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/ErrorHandler/Base.php#L75-L85
train
pr-of-it/t4
framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Core/FolderHandler.php
CKFinder_Connector_Core_FolderHandler.&
public function &getResourceTypeConfig() { if (!isset($this->_resourceTypeConfig)) { $_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config"); $this->_resourceTypeConfig = $_config->getResourceTypeConfig($this->_resourceTypeName); } if (is_null($this->_resourceTypeConfig)) { $connector =& CKFinder_Connector_Core_Factory::getInstance("Core_Connector"); $oErrorHandler =& $connector->getErrorHandler(); $oErrorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_TYPE); } return $this->_resourceTypeConfig; }
php
public function &getResourceTypeConfig() { if (!isset($this->_resourceTypeConfig)) { $_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config"); $this->_resourceTypeConfig = $_config->getResourceTypeConfig($this->_resourceTypeName); } if (is_null($this->_resourceTypeConfig)) { $connector =& CKFinder_Connector_Core_Factory::getInstance("Core_Connector"); $oErrorHandler =& $connector->getErrorHandler(); $oErrorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_TYPE); } return $this->_resourceTypeConfig; }
[ "public", "function", "&", "getResourceTypeConfig", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "_resourceTypeConfig", ")", ")", "{", "$", "_config", "=", "&", "CKFinder_Connector_Core_Factory", "::", "getInstance", "(", "\"Core_Config\"", ...
Get resource type config @return CKFinder_Connector_Core_ResourceTypeConfig @access public
[ "Get", "resource", "type", "config" ]
8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada
https://github.com/pr-of-it/t4/blob/8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada/framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Core/FolderHandler.php#L128-L142
train
pr-of-it/t4
framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Core/FolderHandler.php
CKFinder_Connector_Core_FolderHandler.getServerPath
public function getServerPath() { if (is_null($this->_serverPath)) { $this->_resourceTypeConfig = $this->getResourceTypeConfig(); $this->_serverPath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_resourceTypeConfig->getDirectory(), ltrim($this->_clientPath, "/")); } return $this->_serverPath; }
php
public function getServerPath() { if (is_null($this->_serverPath)) { $this->_resourceTypeConfig = $this->getResourceTypeConfig(); $this->_serverPath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_resourceTypeConfig->getDirectory(), ltrim($this->_clientPath, "/")); } return $this->_serverPath; }
[ "public", "function", "getServerPath", "(", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "_serverPath", ")", ")", "{", "$", "this", "->", "_resourceTypeConfig", "=", "$", "this", "->", "getResourceTypeConfig", "(", ")", ";", "$", "this", "->",...
Get server path @return string @access public
[ "Get", "server", "path" ]
8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada
https://github.com/pr-of-it/t4/blob/8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada/framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Core/FolderHandler.php#L196-L204
train
pr-of-it/t4
framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Core/FolderHandler.php
CKFinder_Connector_Core_FolderHandler.getThumbsServerPath
public function getThumbsServerPath() { if (is_null($this->_thumbsServerPath)) { $this->_resourceTypeConfig = $this->getResourceTypeConfig(); $_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config"); $_thumbnailsConfig = $_config->getThumbnailsConfig(); // Get the resource type directory. $this->_thumbsServerPath = CKFinder_Connector_Utils_FileSystem::combinePaths($_thumbnailsConfig->getDirectory(), $this->_resourceTypeConfig->getName()); // Return the resource type directory combined with the required path. $this->_thumbsServerPath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_thumbsServerPath, ltrim($this->_clientPath, '/')); if (!is_dir($this->_thumbsServerPath)) { if(!CKFinder_Connector_Utils_FileSystem::createDirectoryRecursively($this->_thumbsServerPath)) { /** * @todo Ckfinder_Connector_Utils_Xml::raiseError(); perhaps we should return error * */ } } } return $this->_thumbsServerPath; }
php
public function getThumbsServerPath() { if (is_null($this->_thumbsServerPath)) { $this->_resourceTypeConfig = $this->getResourceTypeConfig(); $_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config"); $_thumbnailsConfig = $_config->getThumbnailsConfig(); // Get the resource type directory. $this->_thumbsServerPath = CKFinder_Connector_Utils_FileSystem::combinePaths($_thumbnailsConfig->getDirectory(), $this->_resourceTypeConfig->getName()); // Return the resource type directory combined with the required path. $this->_thumbsServerPath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_thumbsServerPath, ltrim($this->_clientPath, '/')); if (!is_dir($this->_thumbsServerPath)) { if(!CKFinder_Connector_Utils_FileSystem::createDirectoryRecursively($this->_thumbsServerPath)) { /** * @todo Ckfinder_Connector_Utils_Xml::raiseError(); perhaps we should return error * */ } } } return $this->_thumbsServerPath; }
[ "public", "function", "getThumbsServerPath", "(", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "_thumbsServerPath", ")", ")", "{", "$", "this", "->", "_resourceTypeConfig", "=", "$", "this", "->", "getResourceTypeConfig", "(", ")", ";", "$", "_c...
Get server path to thumbnails directory @access public @return string
[ "Get", "server", "path", "to", "thumbnails", "directory" ]
8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada
https://github.com/pr-of-it/t4/blob/8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada/framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Core/FolderHandler.php#L212-L237
train
pr-of-it/t4
framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Core/FolderHandler.php
CKFinder_Connector_Core_FolderHandler.getAclMask
public function getAclMask() { $_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config"); $_aclConfig = $_config->getAccessControlConfig(); if ($this->_aclMask == -1) { $this->_aclMask = $_aclConfig->getComputedMask($this->_resourceTypeName, $this->_clientPath); } return $this->_aclMask; }
php
public function getAclMask() { $_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config"); $_aclConfig = $_config->getAccessControlConfig(); if ($this->_aclMask == -1) { $this->_aclMask = $_aclConfig->getComputedMask($this->_resourceTypeName, $this->_clientPath); } return $this->_aclMask; }
[ "public", "function", "getAclMask", "(", ")", "{", "$", "_config", "=", "&", "CKFinder_Connector_Core_Factory", "::", "getInstance", "(", "\"Core_Config\"", ")", ";", "$", "_aclConfig", "=", "$", "_config", "->", "getAccessControlConfig", "(", ")", ";", "if", ...
Get ACL Mask @return int @access public
[ "Get", "ACL", "Mask" ]
8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada
https://github.com/pr-of-it/t4/blob/8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada/framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Core/FolderHandler.php#L245-L255
train
aimeos/ai-controller-jobs
controller/common/src/Controller/Common/Common/Import/Xml/Processor/Lists/Product/Standard.php
Standard.getItems
protected function getItems( \DomNodeList $nodes ) { $codes = $map = []; $manager = \Aimeos\MShop::create( $this->getContext(), 'product' ); foreach( $nodes as $node ) { if( $node->nodeName === 'productitem' && ( $attr = $node->attributes->getNamedItem( 'ref' ) ) !== null ) { $codes[$attr->nodeValue] = null; } } $search = $manager->createSearch()->setSlice( 0, count( $codes ) ); $search->setConditions( $search->compare( '==', 'product.code', array_keys( $codes ) ) ); foreach( $manager->searchItems( $search, [] ) as $item ) { $map[$item->getCode()] = $item; } return $map; }
php
protected function getItems( \DomNodeList $nodes ) { $codes = $map = []; $manager = \Aimeos\MShop::create( $this->getContext(), 'product' ); foreach( $nodes as $node ) { if( $node->nodeName === 'productitem' && ( $attr = $node->attributes->getNamedItem( 'ref' ) ) !== null ) { $codes[$attr->nodeValue] = null; } } $search = $manager->createSearch()->setSlice( 0, count( $codes ) ); $search->setConditions( $search->compare( '==', 'product.code', array_keys( $codes ) ) ); foreach( $manager->searchItems( $search, [] ) as $item ) { $map[$item->getCode()] = $item; } return $map; }
[ "protected", "function", "getItems", "(", "\\", "DomNodeList", "$", "nodes", ")", "{", "$", "codes", "=", "$", "map", "=", "[", "]", ";", "$", "manager", "=", "\\", "Aimeos", "\\", "MShop", "::", "create", "(", "$", "this", "->", "getContext", "(", ...
Returns the product items for the given nodes @param \DomNodeList $nodes List of XML product item nodes @return \Aimeos\MShop\Product\Item\Iface[] Associative list of product items with codes as keys
[ "Returns", "the", "product", "items", "for", "the", "given", "nodes" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/common/src/Controller/Common/Common/Import/Xml/Processor/Lists/Product/Standard.php#L100-L120
train
pr-of-it/t4
framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/CommandHandler/CommandHandlerBase.php
CKFinder_Connector_CommandHandler_CommandHandlerBase.getFolderHandler
public function getFolderHandler() { if (is_null($this->_currentFolder)) { $this->_currentFolder =& CKFinder_Connector_Core_Factory::getInstance("Core_FolderHandler"); } return $this->_currentFolder; }
php
public function getFolderHandler() { if (is_null($this->_currentFolder)) { $this->_currentFolder =& CKFinder_Connector_Core_Factory::getInstance("Core_FolderHandler"); } return $this->_currentFolder; }
[ "public", "function", "getFolderHandler", "(", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "_currentFolder", ")", ")", "{", "$", "this", "->", "_currentFolder", "=", "&", "CKFinder_Connector_Core_Factory", "::", "getInstance", "(", "\"Core_FolderHand...
Get Folder Handler @access public @return CKFinder_Connector_Core_FolderHandler
[ "Get", "Folder", "Handler" ]
8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada
https://github.com/pr-of-it/t4/blob/8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada/framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/CommandHandler/CommandHandlerBase.php#L67-L74
train
aimeos/ai-controller-jobs
controller/common/src/Controller/Common/Common/Import/Xml/Traits.php
Traits.getProcessor
protected function getProcessor( $type, $domain ) { if( !isset( $this->processors[$domain][$type] ) ) { $this->processors[$domain][$type] = $this->createProcessor( $type, $domain ); } return $this->processors[$domain][$type]; }
php
protected function getProcessor( $type, $domain ) { if( !isset( $this->processors[$domain][$type] ) ) { $this->processors[$domain][$type] = $this->createProcessor( $type, $domain ); } return $this->processors[$domain][$type]; }
[ "protected", "function", "getProcessor", "(", "$", "type", ",", "$", "domain", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "processors", "[", "$", "domain", "]", "[", "$", "type", "]", ")", ")", "{", "$", "this", "->", "processors", ...
Returns the processor object for adding the product related information @param string $type Type of the processor @param string $domain Name of the domain that is imported @return \Aimeos\Controller\Common\Common\Import\Xml\Processor\Iface Processor object
[ "Returns", "the", "processor", "object", "for", "adding", "the", "product", "related", "information" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/common/src/Controller/Common/Common/Import/Xml/Traits.php#L40-L47
train
aimeos/ai-controller-jobs
controller/common/src/Controller/Common/Common/Import/Xml/Traits.php
Traits.createProcessor
protected function createProcessor( $type, $domain ) { $context = $this->getContext(); $config = $context->getConfig(); $parts = explode( '/', $type ); foreach( $parts as $part ) { if( ctype_alnum( $part ) === false ) { $msg = sprintf( 'Invalid characters in processor type "%1$s"', $type ); throw new \Aimeos\Controller\Common\Exception( $msg ); } } if( ctype_alnum( $domain ) === false ) { $msg = sprintf( 'Invalid characters in data domain name "%1$s"', $domain ); throw new \Aimeos\Controller\Common\Exception( $msg ); } $name = $config->get( 'controller/common/' . $domain . '/import/xml/processor/' . $type . '/name', 'Standard' ); if( ctype_alnum( $name ) === false ) { $msg = sprintf( 'Invalid characters in processor name "%1$s"', $name ); throw new \Aimeos\Controller\Common\Exception( $msg ); } $segment = str_replace( '/', '\\', ucwords( $type, '/' ) ) . '\\' . $name; $classname = '\\Aimeos\\Controller\\Common\\Common\\Import\\Xml\\Processor\\' . $segment; if( class_exists( $classname ) === false ) { $classname = '\\Aimeos\\Controller\\Common\\' . ucfirst( $domain ) . '\\Import\\Xml\\Processor\\' . $segment; if( class_exists( $classname ) === false ){ throw new \Aimeos\Controller\Common\Exception( sprintf( 'Class "%1$s" not found', $classname ) ); } } $iface = \Aimeos\Controller\Common\Common\Import\Xml\Processor\Iface::class; return \Aimeos\MW\Common\Base::checkClass( $iface, new $classname( $context ) ); }
php
protected function createProcessor( $type, $domain ) { $context = $this->getContext(); $config = $context->getConfig(); $parts = explode( '/', $type ); foreach( $parts as $part ) { if( ctype_alnum( $part ) === false ) { $msg = sprintf( 'Invalid characters in processor type "%1$s"', $type ); throw new \Aimeos\Controller\Common\Exception( $msg ); } } if( ctype_alnum( $domain ) === false ) { $msg = sprintf( 'Invalid characters in data domain name "%1$s"', $domain ); throw new \Aimeos\Controller\Common\Exception( $msg ); } $name = $config->get( 'controller/common/' . $domain . '/import/xml/processor/' . $type . '/name', 'Standard' ); if( ctype_alnum( $name ) === false ) { $msg = sprintf( 'Invalid characters in processor name "%1$s"', $name ); throw new \Aimeos\Controller\Common\Exception( $msg ); } $segment = str_replace( '/', '\\', ucwords( $type, '/' ) ) . '\\' . $name; $classname = '\\Aimeos\\Controller\\Common\\Common\\Import\\Xml\\Processor\\' . $segment; if( class_exists( $classname ) === false ) { $classname = '\\Aimeos\\Controller\\Common\\' . ucfirst( $domain ) . '\\Import\\Xml\\Processor\\' . $segment; if( class_exists( $classname ) === false ){ throw new \Aimeos\Controller\Common\Exception( sprintf( 'Class "%1$s" not found', $classname ) ); } } $iface = \Aimeos\Controller\Common\Common\Import\Xml\Processor\Iface::class; return \Aimeos\MW\Common\Base::checkClass( $iface, new $classname( $context ) ); }
[ "protected", "function", "createProcessor", "(", "$", "type", ",", "$", "domain", ")", "{", "$", "context", "=", "$", "this", "->", "getContext", "(", ")", ";", "$", "config", "=", "$", "context", "->", "getConfig", "(", ")", ";", "$", "parts", "=", ...
Creates a new processor object of the given type @param string $type Type of the processor @param string $domain Name of the domain that is imported @return \Aimeos\Controller\Common\Common\Import\Xml\Processor\Iface Processor object @throws \Aimeos\Controller\Common\Exception If type is invalid or processor isn't found
[ "Creates", "a", "new", "processor", "object", "of", "the", "given", "type" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/common/src/Controller/Common/Common/Import/Xml/Traits.php#L58-L101
train
pr-of-it/t4
framework/Fs/Helpers.php
Helpers.mkDir
public static function mkDir($dirName, $mode = 0777) { if (file_exists($dirName) && is_dir($dirName)) { return @chmod($dirName, $mode); } $result = @mkdir($dirName, $mode, true); if (false === $result) { throw new Exception('Can not create dir ' . $dirName); } return true; }
php
public static function mkDir($dirName, $mode = 0777) { if (file_exists($dirName) && is_dir($dirName)) { return @chmod($dirName, $mode); } $result = @mkdir($dirName, $mode, true); if (false === $result) { throw new Exception('Can not create dir ' . $dirName); } return true; }
[ "public", "static", "function", "mkDir", "(", "$", "dirName", ",", "$", "mode", "=", "0777", ")", "{", "if", "(", "file_exists", "(", "$", "dirName", ")", "&&", "is_dir", "(", "$", "dirName", ")", ")", "{", "return", "@", "chmod", "(", "$", "dirNam...
Creates directory by absolute path @param string $dirName Directory path @param int $mode Access mode @return bool @throws \T4\Fs\Exception
[ "Creates", "directory", "by", "absolute", "path" ]
8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada
https://github.com/pr-of-it/t4/blob/8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada/framework/Fs/Helpers.php#L74-L84
train
pr-of-it/t4
framework/Fs/Helpers.php
Helpers.dirMTime
public static function dirMTime($path) { clearstatcache(); return max( array_map( function ($f) { return filemtime($f); }, self::listDirRecursive($path) ), filemtime($path) ); }
php
public static function dirMTime($path) { clearstatcache(); return max( array_map( function ($f) { return filemtime($f); }, self::listDirRecursive($path) ), filemtime($path) ); }
[ "public", "static", "function", "dirMTime", "(", "$", "path", ")", "{", "clearstatcache", "(", ")", ";", "return", "max", "(", "array_map", "(", "function", "(", "$", "f", ")", "{", "return", "filemtime", "(", "$", "f", ")", ";", "}", ",", "self", ...
Max filemtime at path recursive @param string $path @return int
[ "Max", "filemtime", "at", "path", "recursive" ]
8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada
https://github.com/pr-of-it/t4/blob/8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada/framework/Fs/Helpers.php#L186-L198
train
pr-of-it/t4
framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Core/Hooks.php
CKFinder_Connector_Core_Hooks._printCallback
public static function _printCallback($callback) { if (is_array($callback)) { if (is_object($callback[0])) { $className = get_class($callback[0]); } else { $className = strval($callback[0]); } $functionName = $className . '::' . strval($callback[1]); } else { $functionName = strval($callback); } return $functionName; }
php
public static function _printCallback($callback) { if (is_array($callback)) { if (is_object($callback[0])) { $className = get_class($callback[0]); } else { $className = strval($callback[0]); } $functionName = $className . '::' . strval($callback[1]); } else { $functionName = strval($callback); } return $functionName; }
[ "public", "static", "function", "_printCallback", "(", "$", "callback", ")", "{", "if", "(", "is_array", "(", "$", "callback", ")", ")", "{", "if", "(", "is_object", "(", "$", "callback", "[", "0", "]", ")", ")", "{", "$", "className", "=", "get_clas...
Print user friendly name of a callback @param mixed $callback @return string
[ "Print", "user", "friendly", "name", "of", "a", "callback" ]
8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada
https://github.com/pr-of-it/t4/blob/8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada/framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Core/Hooks.php#L158-L172
train
aimeos/ai-controller-jobs
controller/common/src/Controller/Common/Product/Import/Csv/Processor/Base.php
Base.getObject
protected function getObject() { if( $this->object === null ) { throw new \Aimeos\Controller\Jobs\Exception( 'No processor object available' ); } return $this->object; }
php
protected function getObject() { if( $this->object === null ) { throw new \Aimeos\Controller\Jobs\Exception( 'No processor object available' ); } return $this->object; }
[ "protected", "function", "getObject", "(", ")", "{", "if", "(", "$", "this", "->", "object", "===", "null", ")", "{", "throw", "new", "\\", "Aimeos", "\\", "Controller", "\\", "Jobs", "\\", "Exception", "(", "'No processor object available'", ")", ";", "}"...
Returns the decorated processor object @return \Aimeos\Controller\Common\Product\Import\Csv\Processor\Iface Processor object @throws \Aimeos\Controller\Jobs\Exception If no processor object is available
[ "Returns", "the", "decorated", "processor", "object" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/common/src/Controller/Common/Product/Import/Csv/Processor/Base.php#L93-L100
train
pr-of-it/t4
framework/Dbal/QueryBuilder.php
QueryBuilder.with
public function with(string $modelClass, string $relationPath) { $relationNames = explode('.', $relationPath); foreach ($relationNames as $index => $relationName) { $relation = $modelClass::getRelation($relationName); if (empty($relation)) { throw new \BadMethodCallException('Relation does not exists!'); } if ($relation['type'] !== \T4\Orm\Model::BELONGS_TO) { throw new \InvalidArgumentException('Only Belongs to relations are supported!'); } /** @var \T4\Orm\Model $relationClass */ $relationClass = $relation['model']; $relationParents = array_slice($relationNames, 0, $index); $aliasPointed = empty($relationParents) ? $relationName : implode('.',$relationParents) . '.' . $relationName; $relationPathUnderscored = implode('_', $relationParents); $aliasUnderscored = empty($relationParents) ? $relationName : $relationPathUnderscored . '_' . $relationName; $select = []; $columnNames = array_keys($relationClass::getColumns()); foreach ($columnNames as $columnName) { $select["$aliasPointed.$columnName"] = "$aliasUnderscored.$columnName"; } $this->select($select); if (empty($this->joins) || empty(array_filter($this->joins, function($join) use ($aliasUnderscored) { return $join['alias'] == $aliasUnderscored; }))) { $this->join($relationClass::getTableName(), $aliasUnderscored . '.' . $relationClass::PK . ' = ' . ($relationPathUnderscored ?: 't1') . '.' . $modelClass::getRelationLinkName($relation), 'left', $aliasUnderscored); } $modelClass = $relationClass; } return $this; }
php
public function with(string $modelClass, string $relationPath) { $relationNames = explode('.', $relationPath); foreach ($relationNames as $index => $relationName) { $relation = $modelClass::getRelation($relationName); if (empty($relation)) { throw new \BadMethodCallException('Relation does not exists!'); } if ($relation['type'] !== \T4\Orm\Model::BELONGS_TO) { throw new \InvalidArgumentException('Only Belongs to relations are supported!'); } /** @var \T4\Orm\Model $relationClass */ $relationClass = $relation['model']; $relationParents = array_slice($relationNames, 0, $index); $aliasPointed = empty($relationParents) ? $relationName : implode('.',$relationParents) . '.' . $relationName; $relationPathUnderscored = implode('_', $relationParents); $aliasUnderscored = empty($relationParents) ? $relationName : $relationPathUnderscored . '_' . $relationName; $select = []; $columnNames = array_keys($relationClass::getColumns()); foreach ($columnNames as $columnName) { $select["$aliasPointed.$columnName"] = "$aliasUnderscored.$columnName"; } $this->select($select); if (empty($this->joins) || empty(array_filter($this->joins, function($join) use ($aliasUnderscored) { return $join['alias'] == $aliasUnderscored; }))) { $this->join($relationClass::getTableName(), $aliasUnderscored . '.' . $relationClass::PK . ' = ' . ($relationPathUnderscored ?: 't1') . '.' . $modelClass::getRelationLinkName($relation), 'left', $aliasUnderscored); } $modelClass = $relationClass; } return $this; }
[ "public", "function", "with", "(", "string", "$", "modelClass", ",", "string", "$", "relationPath", ")", "{", "$", "relationNames", "=", "explode", "(", "'.'", ",", "$", "relationPath", ")", ";", "foreach", "(", "$", "relationNames", "as", "$", "index", ...
Joins data from BelongsTo model relation @param string|\T4\Orm\Model $modelClass @param string $relationPath point-splitted relation chain @return self @throws \BadMethodCallException @throws \InvalidArgumentException
[ "Joins", "data", "from", "BelongsTo", "model", "relation" ]
8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada
https://github.com/pr-of-it/t4/blob/8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada/framework/Dbal/QueryBuilder.php#L170-L202
train
aimeos/ai-controller-jobs
controller/common/src/Controller/Common/Subscription/Process/Processor/Base.php
Base.renew
public function renew( \Aimeos\MShop\Subscription\Item\Iface $subscription, \Aimeos\MShop\Order\Item\Iface $order ) { }
php
public function renew( \Aimeos\MShop\Subscription\Item\Iface $subscription, \Aimeos\MShop\Order\Item\Iface $order ) { }
[ "public", "function", "renew", "(", "\\", "Aimeos", "\\", "MShop", "\\", "Subscription", "\\", "Item", "\\", "Iface", "$", "subscription", ",", "\\", "Aimeos", "\\", "MShop", "\\", "Order", "\\", "Item", "\\", "Iface", "$", "order", ")", "{", "}" ]
Processes the subscription renewal @param \Aimeos\MShop\Subscription\Item\Iface $subscription Subscription item @param \Aimeos\MShop\Order\Item\Iface $order Order invoice item
[ "Processes", "the", "subscription", "renewal" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/common/src/Controller/Common/Subscription/Process/Processor/Base.php#L63-L65
train
aimeos/ai-controller-jobs
controller/common/src/Controller/Common/Product/Import/Csv/Processor/Property/Standard.php
Standard.process
public function process( \Aimeos\MShop\Product\Item\Iface $product, array $data ) { $manager = \Aimeos\MShop::create( $this->getContext(), 'product/property' ); $propMap = []; $items = $product->getPropertyItems( null, false ); $map = $this->getMappedChunk( $data, $this->getMapping() ); foreach( $items as $item ) { $propMap[$item->getValue()][$item->getType()] = $item; } foreach( $map as $list ) { if( ( $value = $this->getValue( $list, 'product.property.value' ) ) === null ) { continue; } if( ( $type = $this->getValue( $list, 'product.property.type' ) ) && !isset( $this->types[$type] ) ) { $msg = sprintf( 'Invalid type "%1$s" (%2$s)', $type, 'product property' ); throw new \Aimeos\Controller\Common\Exception( $msg ); } if( isset( $propMap[$value][$type] ) ) { $item = $propMap[$value][$type]; unset( $items[$item->getId()] ); } else { $item = $manager->createItem()->setType( $type ); } $product->addPropertyItem( $item->fromArray( $list ) ); } $product->deletePropertyItems( $items ); return $this->getObject()->process( $product, $data ); }
php
public function process( \Aimeos\MShop\Product\Item\Iface $product, array $data ) { $manager = \Aimeos\MShop::create( $this->getContext(), 'product/property' ); $propMap = []; $items = $product->getPropertyItems( null, false ); $map = $this->getMappedChunk( $data, $this->getMapping() ); foreach( $items as $item ) { $propMap[$item->getValue()][$item->getType()] = $item; } foreach( $map as $list ) { if( ( $value = $this->getValue( $list, 'product.property.value' ) ) === null ) { continue; } if( ( $type = $this->getValue( $list, 'product.property.type' ) ) && !isset( $this->types[$type] ) ) { $msg = sprintf( 'Invalid type "%1$s" (%2$s)', $type, 'product property' ); throw new \Aimeos\Controller\Common\Exception( $msg ); } if( isset( $propMap[$value][$type] ) ) { $item = $propMap[$value][$type]; unset( $items[$item->getId()] ); } else { $item = $manager->createItem()->setType( $type ); } $product->addPropertyItem( $item->fromArray( $list ) ); } $product->deletePropertyItems( $items ); return $this->getObject()->process( $product, $data ); }
[ "public", "function", "process", "(", "\\", "Aimeos", "\\", "MShop", "\\", "Product", "\\", "Item", "\\", "Iface", "$", "product", ",", "array", "$", "data", ")", "{", "$", "manager", "=", "\\", "Aimeos", "\\", "MShop", "::", "create", "(", "$", "thi...
Saves the product property related data to the storage @param \Aimeos\MShop\Product\Item\Iface $product Product item with associated items @param array $data List of CSV fields with position as key and data as value @return array List of data which hasn't been imported
[ "Saves", "the", "product", "property", "related", "data", "to", "the", "storage" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/common/src/Controller/Common/Product/Import/Csv/Processor/Property/Standard.php#L66-L106
train
aimeos/ai-controller-jobs
controller/jobs/src/Controller/Jobs/Subscription/Process/Renew/Standard.php
Standard.addBasketAddresses
protected function addBasketAddresses( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Order\Item\Base\Iface $newBasket, array $addresses ) { foreach( $addresses as $type => $orderAddresses ) { foreach( $orderAddresses as $orderAddress ) { $newBasket->addAddress( $orderAddress, $type ); } } return $newBasket; }
php
protected function addBasketAddresses( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Order\Item\Base\Iface $newBasket, array $addresses ) { foreach( $addresses as $type => $orderAddresses ) { foreach( $orderAddresses as $orderAddress ) { $newBasket->addAddress( $orderAddress, $type ); } } return $newBasket; }
[ "protected", "function", "addBasketAddresses", "(", "\\", "Aimeos", "\\", "MShop", "\\", "Context", "\\", "Item", "\\", "Iface", "$", "context", ",", "\\", "Aimeos", "\\", "MShop", "\\", "Order", "\\", "Item", "\\", "Base", "\\", "Iface", "$", "newBasket",...
Adds the given addresses to the basket @param \Aimeos\MShop\Context\Item\Iface Context object @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object to add the addresses to @param array $addresses Associative list of type as key and address object implementing \Aimeos\MShop\Order\Item\Base\Address\Iface as value @return \Aimeos\MShop\Order\Item\Base\Iface Order with addresses added
[ "Adds", "the", "given", "addresses", "to", "the", "basket" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/jobs/src/Controller/Jobs/Subscription/Process/Renew/Standard.php#L135-L146
train
aimeos/ai-controller-jobs
controller/jobs/src/Controller/Jobs/Subscription/Process/Renew/Standard.php
Standard.addBasketCoupons
protected function addBasketCoupons( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Order\Item\Base\Iface $basket, array $codes ) { /** controller/jobs/subcription/process/renew/standard/use-coupons * Applies the coupons of the previous order also to the new one * * Reuse coupon codes added to the basket by the customer the first time * again in new subcription orders. If they have any effect depends on * the codes still being active (status, time frame and count) and the * decorators added to the coupon providers in the admin interface. * * @param boolean True to reuse coupon codes, false to remove coupons * @category Developer * @category User * @since 2018.10 */ if( $context->getConfig()->get( 'controller/jobs/subcription/process/renew/standard/use-coupons', false ) ) { foreach( $codes as $code ) { try { $basket->addCoupon( $code ); } catch( \Aimeos\MShop\Plugin\Provider\Exception $e ) { $basket->deleteCoupon( $code ); } } } return $basket; }
php
protected function addBasketCoupons( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Order\Item\Base\Iface $basket, array $codes ) { /** controller/jobs/subcription/process/renew/standard/use-coupons * Applies the coupons of the previous order also to the new one * * Reuse coupon codes added to the basket by the customer the first time * again in new subcription orders. If they have any effect depends on * the codes still being active (status, time frame and count) and the * decorators added to the coupon providers in the admin interface. * * @param boolean True to reuse coupon codes, false to remove coupons * @category Developer * @category User * @since 2018.10 */ if( $context->getConfig()->get( 'controller/jobs/subcription/process/renew/standard/use-coupons', false ) ) { foreach( $codes as $code ) { try { $basket->addCoupon( $code ); } catch( \Aimeos\MShop\Plugin\Provider\Exception $e ) { $basket->deleteCoupon( $code ); } } } return $basket; }
[ "protected", "function", "addBasketCoupons", "(", "\\", "Aimeos", "\\", "MShop", "\\", "Context", "\\", "Item", "\\", "Iface", "$", "context", ",", "\\", "Aimeos", "\\", "MShop", "\\", "Order", "\\", "Item", "\\", "Base", "\\", "Iface", "$", "basket", ",...
Adds the given coupon codes to basket if enabled @param \Aimeos\MShop\Context\Item\Iface Context object @param \Aimeos\MShop\Order\Item\Base\Iface $basket Order including product and addresses @param array $codes List of coupon codes that should be added to the given basket @return \Aimeos\MShop\Order\Item\Base\Iface Basket, maybe with coupons added
[ "Adds", "the", "given", "coupon", "codes", "to", "basket", "if", "enabled" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/jobs/src/Controller/Jobs/Subscription/Process/Renew/Standard.php#L157-L186
train
aimeos/ai-controller-jobs
controller/jobs/src/Controller/Jobs/Subscription/Process/Renew/Standard.php
Standard.addBasketProducts
protected function addBasketProducts( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Order\Item\Base\Iface $newBasket, array $orderProducts, $orderProductId ) { foreach( $orderProducts as $orderProduct ) { if( $orderProduct->getId() == $orderProductId ) { foreach( $orderProduct->getAttributeItems() as $attrItem ) { $attrItem->setId( null ); } $newBasket->addProduct( $orderProduct->setId( null ) ); } } return $newBasket; }
php
protected function addBasketProducts( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Order\Item\Base\Iface $newBasket, array $orderProducts, $orderProductId ) { foreach( $orderProducts as $orderProduct ) { if( $orderProduct->getId() == $orderProductId ) { foreach( $orderProduct->getAttributeItems() as $attrItem ) { $attrItem->setId( null ); } $newBasket->addProduct( $orderProduct->setId( null ) ); } } return $newBasket; }
[ "protected", "function", "addBasketProducts", "(", "\\", "Aimeos", "\\", "MShop", "\\", "Context", "\\", "Item", "\\", "Iface", "$", "context", ",", "\\", "Aimeos", "\\", "MShop", "\\", "Order", "\\", "Item", "\\", "Base", "\\", "Iface", "$", "newBasket", ...
Adds the given products to the basket @param \Aimeos\MShop\Context\Item\Iface Context object @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object to add the products to @param \Aimeos\MShop\Order\Item\Base\Product\Iface[] $orderProducts List of product items @param string $orderProductId Unique ID of the ordered subscription product @return \Aimeos\MShop\Order\Item\Base\Iface Order with products added
[ "Adds", "the", "given", "products", "to", "the", "basket" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/jobs/src/Controller/Jobs/Subscription/Process/Renew/Standard.php#L198-L213
train
aimeos/ai-controller-jobs
controller/jobs/src/Controller/Jobs/Subscription/Process/Renew/Standard.php
Standard.addBasketServices
protected function addBasketServices( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Order\Item\Base\Iface $newBasket, array $services ) { $type = \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT; if( isset( $services[$type] ) ) { foreach( $services[$type] as $orderService ) { $newBasket->addService( $orderService, $type ); } } $type = \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_DELIVERY; $serviceManager = \Aimeos\MShop::create( $context, 'service' ); $orderServiceManager = \Aimeos\MShop::create( $context, 'order/base/service' ); $search = $serviceManager->createSearch( true ); $search->setSortations( [$search->sort( '+', 'service.position' )] ); $search->setConditions( $search->compare( '==', 'service.type', $type ) ); foreach( $serviceManager->searchItems( $search, ['media', 'price', 'text'] ) as $item ) { $provider = $serviceManager->getProvider( $item, $item->getType() ); if( $provider->isAvailable( $newBasket ) === true ) { $orderServiceItem = $orderServiceManager->createItem()->copyFrom( $item ); return $newBasket->addService( $orderServiceItem, $type ); } } return $newBasket; }
php
protected function addBasketServices( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Order\Item\Base\Iface $newBasket, array $services ) { $type = \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT; if( isset( $services[$type] ) ) { foreach( $services[$type] as $orderService ) { $newBasket->addService( $orderService, $type ); } } $type = \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_DELIVERY; $serviceManager = \Aimeos\MShop::create( $context, 'service' ); $orderServiceManager = \Aimeos\MShop::create( $context, 'order/base/service' ); $search = $serviceManager->createSearch( true ); $search->setSortations( [$search->sort( '+', 'service.position' )] ); $search->setConditions( $search->compare( '==', 'service.type', $type ) ); foreach( $serviceManager->searchItems( $search, ['media', 'price', 'text'] ) as $item ) { $provider = $serviceManager->getProvider( $item, $item->getType() ); if( $provider->isAvailable( $newBasket ) === true ) { $orderServiceItem = $orderServiceManager->createItem()->copyFrom( $item ); return $newBasket->addService( $orderServiceItem, $type ); } } return $newBasket; }
[ "protected", "function", "addBasketServices", "(", "\\", "Aimeos", "\\", "MShop", "\\", "Context", "\\", "Item", "\\", "Iface", "$", "context", ",", "\\", "Aimeos", "\\", "MShop", "\\", "Order", "\\", "Item", "\\", "Base", "\\", "Iface", "$", "newBasket", ...
Adds a matching delivery and payment service to the basket @param \Aimeos\MShop\Context\Item\Iface Context object @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object to add the services to @param array $services Associative list of type as key and list of service objects implementing \Aimeos\MShop\Order\Item\Base\Service\Iface as values @return \Aimeos\MShop\Order\Item\Base\Iface Order with delivery and payment service added
[ "Adds", "a", "matching", "delivery", "and", "payment", "service", "to", "the", "basket" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/jobs/src/Controller/Jobs/Subscription/Process/Renew/Standard.php#L224-L257
train
aimeos/ai-controller-jobs
controller/jobs/src/Controller/Jobs/Subscription/Process/Renew/Standard.php
Standard.createContext
protected function createContext( $baseId ) { $context = clone $this->getContext(); $manager = \Aimeos\MShop::create( $context, 'order/base' ); $baseItem = $manager->getItem( $baseId ); $locale = $baseItem->getLocale(); $level = \Aimeos\MShop\Locale\Manager\Base::SITE_ALL; $manager = \Aimeos\MShop::create( $context, 'locale' ); $locale = $manager->bootstrap( $baseItem->getSiteCode(), $locale->getLanguageId(), $locale->getCurrencyId(), false, $level ); $context->setLocale( $locale ); try { $manager = \Aimeos\MShop::create( $context, 'customer' ); $customerItem = $manager->getItem( $baseItem->getCustomerId(), ['customer/group'] ); $context->setUserId( $baseItem->getCustomerId() ); $context->setGroupIds( $customerItem->getGroups() ); } catch( \Exception $e ) {} // Subscription without account return $context; }
php
protected function createContext( $baseId ) { $context = clone $this->getContext(); $manager = \Aimeos\MShop::create( $context, 'order/base' ); $baseItem = $manager->getItem( $baseId ); $locale = $baseItem->getLocale(); $level = \Aimeos\MShop\Locale\Manager\Base::SITE_ALL; $manager = \Aimeos\MShop::create( $context, 'locale' ); $locale = $manager->bootstrap( $baseItem->getSiteCode(), $locale->getLanguageId(), $locale->getCurrencyId(), false, $level ); $context->setLocale( $locale ); try { $manager = \Aimeos\MShop::create( $context, 'customer' ); $customerItem = $manager->getItem( $baseItem->getCustomerId(), ['customer/group'] ); $context->setUserId( $baseItem->getCustomerId() ); $context->setGroupIds( $customerItem->getGroups() ); } catch( \Exception $e ) {} // Subscription without account return $context; }
[ "protected", "function", "createContext", "(", "$", "baseId", ")", "{", "$", "context", "=", "clone", "$", "this", "->", "getContext", "(", ")", ";", "$", "manager", "=", "\\", "Aimeos", "\\", "MShop", "::", "create", "(", "$", "context", ",", "'order/...
Creates a new context based on the order and the customer the subscription belongs to @param string $baseId Unique order base ID @return \Aimeos\MShop\Context\Item\Iface New context object
[ "Creates", "a", "new", "context", "based", "on", "the", "order", "and", "the", "customer", "the", "subscription", "belongs", "to" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/jobs/src/Controller/Jobs/Subscription/Process/Renew/Standard.php#L266-L292
train
aimeos/ai-controller-jobs
controller/jobs/src/Controller/Jobs/Subscription/Process/Renew/Standard.php
Standard.createOrderBase
protected function createOrderBase( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Subscription\Item\Iface $subscription ) { $manager = \Aimeos\MShop::create( $context, 'order/base' ); $basket = $manager->load( $subscription->getOrderBaseId() ); $newBasket = $manager->createItem()->setCustomerId( $basket->getCustomerId() ); $newBasket = $this->addBasketProducts( $context, $newBasket, $basket->getProducts(), $subscription->getOrderProductId() ); $newBasket = $this->addBasketAddresses( $context, $newBasket, $basket->getAddresses() ); $newBasket = $this->addBasketServices( $context, $newBasket, $basket->getServices() ); $newBasket = $this->addBasketCoupons( $context, $newBasket, array_keys( $basket->getCoupons() ) ); return $manager->store( $newBasket ); }
php
protected function createOrderBase( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Subscription\Item\Iface $subscription ) { $manager = \Aimeos\MShop::create( $context, 'order/base' ); $basket = $manager->load( $subscription->getOrderBaseId() ); $newBasket = $manager->createItem()->setCustomerId( $basket->getCustomerId() ); $newBasket = $this->addBasketProducts( $context, $newBasket, $basket->getProducts(), $subscription->getOrderProductId() ); $newBasket = $this->addBasketAddresses( $context, $newBasket, $basket->getAddresses() ); $newBasket = $this->addBasketServices( $context, $newBasket, $basket->getServices() ); $newBasket = $this->addBasketCoupons( $context, $newBasket, array_keys( $basket->getCoupons() ) ); return $manager->store( $newBasket ); }
[ "protected", "function", "createOrderBase", "(", "\\", "Aimeos", "\\", "MShop", "\\", "Context", "\\", "Item", "\\", "Iface", "$", "context", ",", "\\", "Aimeos", "\\", "MShop", "\\", "Subscription", "\\", "Item", "\\", "Iface", "$", "subscription", ")", "...
Creates and stores a new order for the subscribed product @param \Aimeos\MShop\Context\Item\Iface Context object @param \Aimeos\MShop\Subscription\Item\Iface $subscription Subscription item with order base ID and order product ID @return \Aimeos\MShop\Order\Item\Base\Iface Complete order with product, addresses and services saved to the storage
[ "Creates", "and", "stores", "a", "new", "order", "for", "the", "subscribed", "product" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/jobs/src/Controller/Jobs/Subscription/Process/Renew/Standard.php#L302-L315
train
aimeos/ai-controller-jobs
controller/jobs/src/Controller/Jobs/Subscription/Process/Renew/Standard.php
Standard.createOrderInvoice
protected function createOrderInvoice( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Order\Item\Base\Iface $basket ) { $manager = \Aimeos\MShop::create( $context, 'order' ); $item = $manager->createItem(); $item->setBaseId( $basket->getId() ); $item->setType( 'subscription' ); return $manager->saveItem( $item ); }
php
protected function createOrderInvoice( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Order\Item\Base\Iface $basket ) { $manager = \Aimeos\MShop::create( $context, 'order' ); $item = $manager->createItem(); $item->setBaseId( $basket->getId() ); $item->setType( 'subscription' ); return $manager->saveItem( $item ); }
[ "protected", "function", "createOrderInvoice", "(", "\\", "Aimeos", "\\", "MShop", "\\", "Context", "\\", "Item", "\\", "Iface", "$", "context", ",", "\\", "Aimeos", "\\", "MShop", "\\", "Order", "\\", "Item", "\\", "Base", "\\", "Iface", "$", "basket", ...
Creates and stores a new invoice for the given order basket @param \Aimeos\MShop\Context\Item\Iface Context object @param \Aimeos\MShop\Order\Item\Base\Iface $basket Complete order with product, addresses and services saved to the storage @return \Aimeos\MShop\Order\Item\Iface New invoice item associated to the order saved to the storage
[ "Creates", "and", "stores", "a", "new", "invoice", "for", "the", "given", "order", "basket" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/jobs/src/Controller/Jobs/Subscription/Process/Renew/Standard.php#L325-L334
train
aimeos/ai-controller-jobs
controller/jobs/src/Controller/Jobs/Subscription/Process/Renew/Standard.php
Standard.createPayment
protected function createPayment( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Order\Item\Base\Iface $basket, \Aimeos\MShop\Order\Item\Iface $invoice ) { $manager = \Aimeos\MShop::create( $context, 'service' ); foreach( $basket->getService( \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT ) as $service ) { $item = $manager->getItem( $service->getServiceId() ); $provider = $manager->getProvider( $item, 'payment' ); $provider->repay( $invoice ); } }
php
protected function createPayment( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Order\Item\Base\Iface $basket, \Aimeos\MShop\Order\Item\Iface $invoice ) { $manager = \Aimeos\MShop::create( $context, 'service' ); foreach( $basket->getService( \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT ) as $service ) { $item = $manager->getItem( $service->getServiceId() ); $provider = $manager->getProvider( $item, 'payment' ); $provider->repay( $invoice ); } }
[ "protected", "function", "createPayment", "(", "\\", "Aimeos", "\\", "MShop", "\\", "Context", "\\", "Item", "\\", "Iface", "$", "context", ",", "\\", "Aimeos", "\\", "MShop", "\\", "Order", "\\", "Item", "\\", "Base", "\\", "Iface", "$", "basket", ",", ...
Creates a new payment for the given order and invoice @param \Aimeos\MShop\Context\Item\Iface Context object @param \Aimeos\MShop\Order\Item\Base\Iface $basket Complete order with product, addresses and services @param \Aimeos\MShop\Order\Item\Iface New invoice item associated to the order
[ "Creates", "a", "new", "payment", "for", "the", "given", "order", "and", "invoice" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/jobs/src/Controller/Jobs/Subscription/Process/Renew/Standard.php#L344-L356
train
aimeos/ai-controller-jobs
controller/jobs/src/Controller/Jobs/Catalog/Import/Csv/Standard.php
Standard.getCatalogMap
protected function getCatalogMap( array $domains ) { $map = []; $manager = \Aimeos\MShop::create( $this->getContext(), 'catalog' ); $search = $manager->createSearch()->setSlice( 0, 0x7fffffff ); foreach( $manager->searchItems( $search, $domains ) as $item ) { $map[$item->getCode()] = $item; } return $map; }
php
protected function getCatalogMap( array $domains ) { $map = []; $manager = \Aimeos\MShop::create( $this->getContext(), 'catalog' ); $search = $manager->createSearch()->setSlice( 0, 0x7fffffff ); foreach( $manager->searchItems( $search, $domains ) as $item ) { $map[$item->getCode()] = $item; } return $map; }
[ "protected", "function", "getCatalogMap", "(", "array", "$", "domains", ")", "{", "$", "map", "=", "[", "]", ";", "$", "manager", "=", "\\", "Aimeos", "\\", "MShop", "::", "create", "(", "$", "this", "->", "getContext", "(", ")", ",", "'catalog'", ")...
Returns the catalog items building the tree as list @param array $domains List of domain names whose items should be fetched too @return array Associative list of catalog codes as keys and items implementing \Aimeos\MShop\Catalog\Item\Iface as values
[ "Returns", "the", "catalog", "items", "building", "the", "tree", "as", "list" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/jobs/src/Controller/Jobs/Catalog/Import/Csv/Standard.php#L507-L518
train
aimeos/ai-controller-jobs
controller/jobs/src/Controller/Jobs/Catalog/Import/Csv/Standard.php
Standard.getParentId
protected function getParentId( array $catalogMap, array $map, $code ) { if( !isset( $map['catalog.parent'] ) ) { $msg = sprintf( 'Required column "%1$s" not found for code "%2$s"', 'catalog.parent', $code ); throw new \Aimeos\Controller\Jobs\Exception( $msg ); } $parent = trim( $map['catalog.parent'] ); if( $parent != '' && !isset( $catalogMap[$parent] ) ) { $msg = sprintf( 'Parent node for code "%1$s" not found', $parent ); throw new \Aimeos\Controller\Jobs\Exception( $msg ); } return ( $parent != '' ? $catalogMap[$parent]->getId() : null ); }
php
protected function getParentId( array $catalogMap, array $map, $code ) { if( !isset( $map['catalog.parent'] ) ) { $msg = sprintf( 'Required column "%1$s" not found for code "%2$s"', 'catalog.parent', $code ); throw new \Aimeos\Controller\Jobs\Exception( $msg ); } $parent = trim( $map['catalog.parent'] ); if( $parent != '' && !isset( $catalogMap[$parent] ) ) { $msg = sprintf( 'Parent node for code "%1$s" not found', $parent ); throw new \Aimeos\Controller\Jobs\Exception( $msg ); } return ( $parent != '' ? $catalogMap[$parent]->getId() : null ); }
[ "protected", "function", "getParentId", "(", "array", "$", "catalogMap", ",", "array", "$", "map", ",", "$", "code", ")", "{", "if", "(", "!", "isset", "(", "$", "map", "[", "'catalog.parent'", "]", ")", ")", "{", "$", "msg", "=", "sprintf", "(", "...
Returns the parent ID of the catalog node for the given code @param array $catalogMap Associative list of catalog items with codes as keys and items implementing \Aimeos\MShop\Catalog\Item\Iface as values @param array $map Associative list of catalog item key/value pairs @param string $code Catalog item code of the parent category @return string|null ID of the parent category or null for top level nodes
[ "Returns", "the", "parent", "ID", "of", "the", "catalog", "node", "for", "the", "given", "code" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/jobs/src/Controller/Jobs/Catalog/Import/Csv/Standard.php#L529-L546
train
aimeos/ai-controller-jobs
controller/jobs/src/Controller/Jobs/Catalog/Import/Csv/Standard.php
Standard.import
protected function import( array &$catalogMap, array $data, array $mapping, \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Iface $processor, $strict ) { $errors = 0; $context = $this->getContext(); $manager = \Aimeos\MShop::create( $context, 'catalog' ); foreach( $data as $code => $list ) { $manager->begin(); try { $code = trim( $code ); if( isset( $catalogMap[$code] ) ) { $item = $catalogMap[$code]; } else { $item = $manager->createItem(); } $map = $this->getMappedChunk( $list, $mapping ); if( isset( $map[0] ) ) { $map = $map[0]; // there can only be one chunk for the base catalog data $parentid = $this->getParentId( $catalogMap, $map, $code ); $item->fromArray( $map, true ); if( isset( $catalogMap[$code] ) ) { $manager->moveItem( $item->getId(), $item->getParentId(), $parentid ); $item = $manager->saveItem( $item ); } else { $item = $manager->insertItem( $item, $parentid ); } $list = $processor->process( $item, $list ); $catalogMap[$code] = $item; $manager->saveItem( $item ); } $manager->commit(); } catch( \Exception $e ) { $manager->rollback(); $msg = sprintf( 'Unable to import catalog with code "%1$s": %2$s', $code, $e->getMessage() ); $context->getLogger()->log( $msg ); $errors++; } if( $strict && !empty( $list ) ) { $context->getLogger()->log( 'Not imported: ' . print_r( $list, true ) ); } } return $errors; }
php
protected function import( array &$catalogMap, array $data, array $mapping, \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Iface $processor, $strict ) { $errors = 0; $context = $this->getContext(); $manager = \Aimeos\MShop::create( $context, 'catalog' ); foreach( $data as $code => $list ) { $manager->begin(); try { $code = trim( $code ); if( isset( $catalogMap[$code] ) ) { $item = $catalogMap[$code]; } else { $item = $manager->createItem(); } $map = $this->getMappedChunk( $list, $mapping ); if( isset( $map[0] ) ) { $map = $map[0]; // there can only be one chunk for the base catalog data $parentid = $this->getParentId( $catalogMap, $map, $code ); $item->fromArray( $map, true ); if( isset( $catalogMap[$code] ) ) { $manager->moveItem( $item->getId(), $item->getParentId(), $parentid ); $item = $manager->saveItem( $item ); } else { $item = $manager->insertItem( $item, $parentid ); } $list = $processor->process( $item, $list ); $catalogMap[$code] = $item; $manager->saveItem( $item ); } $manager->commit(); } catch( \Exception $e ) { $manager->rollback(); $msg = sprintf( 'Unable to import catalog with code "%1$s": %2$s', $code, $e->getMessage() ); $context->getLogger()->log( $msg ); $errors++; } if( $strict && !empty( $list ) ) { $context->getLogger()->log( 'Not imported: ' . print_r( $list, true ) ); } } return $errors; }
[ "protected", "function", "import", "(", "array", "&", "$", "catalogMap", ",", "array", "$", "data", ",", "array", "$", "mapping", ",", "\\", "Aimeos", "\\", "Controller", "\\", "Common", "\\", "Catalog", "\\", "Import", "\\", "Csv", "\\", "Processor", "\...
Imports the CSV data and creates new categories or updates existing ones @param array &$catalogMap Associative list of catalog items with codes as keys and items implementing \Aimeos\MShop\Catalog\Item\Iface as values @param array $data Associative list of import data as index/value pairs @param array $mapping Associative list of positions and domain item keys @param \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Iface $processor Processor object @param boolean $strict Log columns not mapped or silently ignore them @return integer Number of catalogs that couldn't be imported @throws \Aimeos\Controller\Jobs\Exception
[ "Imports", "the", "CSV", "data", "and", "creates", "new", "categories", "or", "updates", "existing", "ones" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/jobs/src/Controller/Jobs/Catalog/Import/Csv/Standard.php#L560-L623
train
aimeos/ai-controller-jobs
controller/jobs/src/Controller/Jobs/Stock/Import/Csv/Standard.php
Standard.getStockItems
protected function getStockItems( array $codes, array $types ) { $map = []; $manager = \Aimeos\MShop::create( $this->getContext(), 'stock' ); $search = $manager->createSearch()->setSlice( 0, 10000 ); $search->setConditions( $search->combine( '&&', [ $search->compare( '==', 'stock.productcode', $codes ), $search->compare( '==', 'stock.type', $types ) ] ) ); foreach( $manager->searchItems( $search ) as $item ) { $map[$item->getProductCode()][$item->getType()] = $item; } return $map; }
php
protected function getStockItems( array $codes, array $types ) { $map = []; $manager = \Aimeos\MShop::create( $this->getContext(), 'stock' ); $search = $manager->createSearch()->setSlice( 0, 10000 ); $search->setConditions( $search->combine( '&&', [ $search->compare( '==', 'stock.productcode', $codes ), $search->compare( '==', 'stock.type', $types ) ] ) ); foreach( $manager->searchItems( $search ) as $item ) { $map[$item->getProductCode()][$item->getType()] = $item; } return $map; }
[ "protected", "function", "getStockItems", "(", "array", "$", "codes", ",", "array", "$", "types", ")", "{", "$", "map", "=", "[", "]", ";", "$", "manager", "=", "\\", "Aimeos", "\\", "MShop", "::", "create", "(", "$", "this", "->", "getContext", "(",...
Returns the stock items for the given codes and types @param array $codes List of stock codes @param array $types List of stock types @return array Multi-dimensional array of code/type/item map
[ "Returns", "the", "stock", "items", "for", "the", "given", "codes", "and", "types" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/jobs/src/Controller/Jobs/Stock/Import/Csv/Standard.php#L285-L301
train
aimeos/ai-controller-jobs
controller/jobs/src/Controller/Jobs/Stock/Import/Csv/Standard.php
Standard.importStocks
protected function importStocks( \Aimeos\MW\Container\Content\Iface $content, $maxcnt ) { $total = 0; $manager = \Aimeos\MShop::create( $this->getContext(), 'stock' ); do { $count = 0; $codes = $data = $items = $types = []; while( $content->valid() && $count < $maxcnt ) { $row = $content->current(); $content->next(); if( $row[0] == '' ) { continue; } $type = $this->getValue( $row, 2, 'default' ); $types[$type] = null; $codes[] = $row[0]; $row[2] = $type; $data[] = $row; $count++; } if( $count === 0 ) { break; } $items = []; $map = $this->getStockItems( $codes, array_keys( $types ) ); foreach( $data as $entry ) { $code = $entry[0]; $type = $entry[2]; if( isset( $map[$code][$type] ) ) { $item = $map[$code][$type]; } else { $item = $manager->createItem(); } $items[] = $item->setProductCode( $code )->setType( $type ) ->setStocklevel( $this->getValue( $entry, 1 ) ) ->setDateBack( $this->getValue( $entry, 3 ) ); unset( $map[$code][$type] ); } $manager->saveItems( $items ); unset( $items ); $total += $count; } while( $count > 0 ); return $total; }
php
protected function importStocks( \Aimeos\MW\Container\Content\Iface $content, $maxcnt ) { $total = 0; $manager = \Aimeos\MShop::create( $this->getContext(), 'stock' ); do { $count = 0; $codes = $data = $items = $types = []; while( $content->valid() && $count < $maxcnt ) { $row = $content->current(); $content->next(); if( $row[0] == '' ) { continue; } $type = $this->getValue( $row, 2, 'default' ); $types[$type] = null; $codes[] = $row[0]; $row[2] = $type; $data[] = $row; $count++; } if( $count === 0 ) { break; } $items = []; $map = $this->getStockItems( $codes, array_keys( $types ) ); foreach( $data as $entry ) { $code = $entry[0]; $type = $entry[2]; if( isset( $map[$code][$type] ) ) { $item = $map[$code][$type]; } else { $item = $manager->createItem(); } $items[] = $item->setProductCode( $code )->setType( $type ) ->setStocklevel( $this->getValue( $entry, 1 ) ) ->setDateBack( $this->getValue( $entry, 3 ) ); unset( $map[$code][$type] ); } $manager->saveItems( $items ); unset( $items ); $total += $count; } while( $count > 0 ); return $total; }
[ "protected", "function", "importStocks", "(", "\\", "Aimeos", "\\", "MW", "\\", "Container", "\\", "Content", "\\", "Iface", "$", "content", ",", "$", "maxcnt", ")", "{", "$", "total", "=", "0", ";", "$", "manager", "=", "\\", "Aimeos", "\\", "MShop", ...
Imports the CSV data and creates new stocks or updates existing ones @param \Aimeos\MW\Container\Content\Iface $content Content object @return integer Number of imported stocks
[ "Imports", "the", "CSV", "data", "and", "creates", "new", "stocks", "or", "updates", "existing", "ones" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/jobs/src/Controller/Jobs/Stock/Import/Csv/Standard.php#L310-L371
train
aimeos/ai-controller-jobs
controller/common/src/Controller/Common/Product/Import/Csv/Cache/Attribute/Standard.php
Standard.set
public function set( \Aimeos\MShop\Common\Item\Iface $item ) { $code = $item->getCode(); if( !isset( $this->attributes[$code] ) || !is_array( $this->attributes[$code] ) ) { $this->attributes[$code] = []; } $this->attributes[$code][$item->getType()] = $item; }
php
public function set( \Aimeos\MShop\Common\Item\Iface $item ) { $code = $item->getCode(); if( !isset( $this->attributes[$code] ) || !is_array( $this->attributes[$code] ) ) { $this->attributes[$code] = []; } $this->attributes[$code][$item->getType()] = $item; }
[ "public", "function", "set", "(", "\\", "Aimeos", "\\", "MShop", "\\", "Common", "\\", "Item", "\\", "Iface", "$", "item", ")", "{", "$", "code", "=", "$", "item", "->", "getCode", "(", ")", ";", "if", "(", "!", "isset", "(", "$", "this", "->", ...
Adds the attribute item to the cache @param \Aimeos\MShop\Common\Item\Iface $item Attribute object
[ "Adds", "the", "attribute", "item", "to", "the", "cache" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/common/src/Controller/Common/Product/Import/Csv/Cache/Attribute/Standard.php#L93-L102
train
pr-of-it/t4
framework/Mvc/Extensions/Ckfinder/lib/plugins/fileeditor/plugin.php
CKFinder_Connector_CommandHandler_FileEditor.buildXml
function buildXml() { if (empty($_POST['CKFinderCommand']) || $_POST['CKFinderCommand'] != 'true') { $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST); } $this->checkConnector(); $this->checkRequest(); // Saving empty file is equal to deleting a file, that's why FILE_DELETE permissions are required if (!$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FILE_DELETE)) { $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED); } if (!isset($_POST["fileName"])) { $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_NAME); } if (!isset($_POST["content"])) { $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST); } $fileName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($_POST["fileName"]); $resourceTypeInfo = $this->_currentFolder->getResourceTypeConfig(); if (!$resourceTypeInfo->checkExtension($fileName)) { $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_EXTENSION); } if (!CKFinder_Connector_Utils_FileSystem::checkFileName($fileName) || $resourceTypeInfo->checkIsHiddenFile($fileName)) { $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST); } $filePath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getServerPath(), $fileName); if (!file_exists($filePath) || !is_file($filePath)) { $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_FILE_NOT_FOUND); } if (!is_writable(dirname($filePath))) { $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED); } $fp = @fopen($filePath, 'wb'); if ($fp === false || !flock($fp, LOCK_EX)) { $result = false; } else { $result = fwrite($fp, $_POST["content"]); flock($fp, LOCK_UN); fclose($fp); } if ($result === false) { $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED); } }
php
function buildXml() { if (empty($_POST['CKFinderCommand']) || $_POST['CKFinderCommand'] != 'true') { $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST); } $this->checkConnector(); $this->checkRequest(); // Saving empty file is equal to deleting a file, that's why FILE_DELETE permissions are required if (!$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FILE_DELETE)) { $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED); } if (!isset($_POST["fileName"])) { $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_NAME); } if (!isset($_POST["content"])) { $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST); } $fileName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($_POST["fileName"]); $resourceTypeInfo = $this->_currentFolder->getResourceTypeConfig(); if (!$resourceTypeInfo->checkExtension($fileName)) { $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_EXTENSION); } if (!CKFinder_Connector_Utils_FileSystem::checkFileName($fileName) || $resourceTypeInfo->checkIsHiddenFile($fileName)) { $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST); } $filePath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getServerPath(), $fileName); if (!file_exists($filePath) || !is_file($filePath)) { $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_FILE_NOT_FOUND); } if (!is_writable(dirname($filePath))) { $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED); } $fp = @fopen($filePath, 'wb'); if ($fp === false || !flock($fp, LOCK_EX)) { $result = false; } else { $result = fwrite($fp, $_POST["content"]); flock($fp, LOCK_UN); fclose($fp); } if ($result === false) { $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED); } }
[ "function", "buildXml", "(", ")", "{", "if", "(", "empty", "(", "$", "_POST", "[", "'CKFinderCommand'", "]", ")", "||", "$", "_POST", "[", "'CKFinderCommand'", "]", "!=", "'true'", ")", "{", "$", "this", "->", "_errorHandler", "->", "throwError", "(", ...
handle request and build XML @access protected
[ "handle", "request", "and", "build", "XML" ]
8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada
https://github.com/pr-of-it/t4/blob/8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada/framework/Mvc/Extensions/Ckfinder/lib/plugins/fileeditor/plugin.php#L28-L82
train
pr-of-it/t4
framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Core/Connector.php
CKFinder_Connector_Core_Connector.&
public function &getErrorHandler() { $_errorHandler = $this->_registry->get("errorHandler"); $oErrorHandler =& CKFinder_Connector_Core_Factory::getInstance($_errorHandler); return $oErrorHandler; }
php
public function &getErrorHandler() { $_errorHandler = $this->_registry->get("errorHandler"); $oErrorHandler =& CKFinder_Connector_Core_Factory::getInstance($_errorHandler); return $oErrorHandler; }
[ "public", "function", "&", "getErrorHandler", "(", ")", "{", "$", "_errorHandler", "=", "$", "this", "->", "_registry", "->", "get", "(", "\"errorHandler\"", ")", ";", "$", "oErrorHandler", "=", "&", "CKFinder_Connector_Core_Factory", "::", "getInstance", "(", ...
Get error handler @access public @return CKFinder_Connector_ErrorHandler_Base|CKFinder_Connector_ErrorHandler_FileUpload|CKFinder_Connector_ErrorHandler_Http
[ "Get", "error", "handler" ]
8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada
https://github.com/pr-of-it/t4/blob/8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada/framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Core/Connector.php#L115-L120
train
pr-of-it/t4
framework/Mvc/Extensions/Ckfinder/lib/plugins/zip/plugin.php
CKFinder_Connector_CommandHandler_Unzip.appendErrorNode
protected function appendErrorNode($oErrorsNode, $errorCode=0, $name, $type=null, $path=null) { $oErrorNode = new CKFinder_Connector_Utils_XmlNode("Error"); $oErrorNode->addAttribute("code", $errorCode); $oErrorNode->addAttribute("name", CKFinder_Connector_Utils_FileSystem::convertToConnectorEncoding($name)); if ( $type ){ $oErrorNode->addAttribute("type", $type); } if ( $path ){ $oErrorNode->addAttribute("folder", $path); } $oErrorsNode->addChild($oErrorNode); }
php
protected function appendErrorNode($oErrorsNode, $errorCode=0, $name, $type=null, $path=null) { $oErrorNode = new CKFinder_Connector_Utils_XmlNode("Error"); $oErrorNode->addAttribute("code", $errorCode); $oErrorNode->addAttribute("name", CKFinder_Connector_Utils_FileSystem::convertToConnectorEncoding($name)); if ( $type ){ $oErrorNode->addAttribute("type", $type); } if ( $path ){ $oErrorNode->addAttribute("folder", $path); } $oErrorsNode->addChild($oErrorNode); }
[ "protected", "function", "appendErrorNode", "(", "$", "oErrorsNode", ",", "$", "errorCode", "=", "0", ",", "$", "name", ",", "$", "type", "=", "null", ",", "$", "path", "=", "null", ")", "{", "$", "oErrorNode", "=", "new", "CKFinder_Connector_Utils_XmlNode...
Add error node to the list @param obj $oErrorsNode @param int $errorCode @param string $name @param string $type @param string $path
[ "Add", "error", "node", "to", "the", "list" ]
8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada
https://github.com/pr-of-it/t4/blob/8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada/framework/Mvc/Extensions/Ckfinder/lib/plugins/zip/plugin.php#L196-L208
train
pr-of-it/t4
framework/Mvc/Extensions/Ckfinder/lib/plugins/zip/plugin.php
CKFinder_Connector_CommandHandler_Unzip.appendUnzippedNode
protected function appendUnzippedNode($oUnzippedNodes, $name, $action='ok') { $oUnzippedNode = new CKFinder_Connector_Utils_XmlNode("File"); $oUnzippedNode->addAttribute("name", CKFinder_Connector_Utils_FileSystem::convertToConnectorEncoding($name)); $oUnzippedNode->addAttribute("action", $action ); $oUnzippedNodes->addChild($oUnzippedNode); }
php
protected function appendUnzippedNode($oUnzippedNodes, $name, $action='ok') { $oUnzippedNode = new CKFinder_Connector_Utils_XmlNode("File"); $oUnzippedNode->addAttribute("name", CKFinder_Connector_Utils_FileSystem::convertToConnectorEncoding($name)); $oUnzippedNode->addAttribute("action", $action ); $oUnzippedNodes->addChild($oUnzippedNode); }
[ "protected", "function", "appendUnzippedNode", "(", "$", "oUnzippedNodes", ",", "$", "name", ",", "$", "action", "=", "'ok'", ")", "{", "$", "oUnzippedNode", "=", "new", "CKFinder_Connector_Utils_XmlNode", "(", "\"File\"", ")", ";", "$", "oUnzippedNode", "->", ...
Add unzipped node to the list @param obj $oUnzippedNodes @param string $name @param string $action
[ "Add", "unzipped", "node", "to", "the", "list" ]
8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada
https://github.com/pr-of-it/t4/blob/8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada/framework/Mvc/Extensions/Ckfinder/lib/plugins/zip/plugin.php#L216-L222
train
pr-of-it/t4
framework/Mvc/Extensions/Ckfinder/lib/plugins/zip/plugin.php
CKFinder_Connector_CommandHandler_Unzip.extractTo
protected function extractTo($extractPath, $extractClientPath, $filePathInfo, $sFileName, $originalFileName) { $sfilePathInfo = pathinfo($extractPath.$sFileName); $extractClientPathDir = $filePathInfo['dirname']; if ( $filePathInfo['dirname'] == '.' ){ $extractClientPathDir = ''; } $folderPath = CKFinder_Connector_Utils_FileSystem::combinePaths($extractClientPath,$extractClientPathDir); $_aclConfig = $this->_config->getAccessControlConfig(); $aclMask = $_aclConfig->getComputedMask($this->_currentFolder->getResourceTypeName(),$folderPath); $canCreateFolder = (($aclMask & CKFINDER_CONNECTOR_ACL_FOLDER_CREATE ) == CKFINDER_CONNECTOR_ACL_FOLDER_CREATE ); // create sub-directory of zip archive if ( empty($sfilePathInfo['extension']) ) { $fileStat = $this->zip->statName($originalFileName); $isDir = false; if ( $fileStat && empty($fileStat['size']) ){ $isDir = true; } if( !empty($sfilePathInfo['dirname']) && !empty($sfilePathInfo['basename']) && !file_exists($sfilePathInfo['dirname'].'/'.$sfilePathInfo['basename']) ) { if ( !$canCreateFolder ){ return; } if ( $isDir ) { CKFinder_Connector_Utils_FileSystem::createDirectoryRecursively( $sfilePathInfo['dirname'].'/'.$sfilePathInfo['basename'] ); return; } else { CKFinder_Connector_Utils_FileSystem::createDirectoryRecursively( $sfilePathInfo['dirname']); } } else { return; } } // extract file if ( !file_exists($sfilePathInfo['dirname']) ){ if ( !$canCreateFolder ){ $this->errorCode = CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED; $this->appendErrorNode($this->skippedFilesNode, $this->errorCode, $originalFileName ); return; } CKFinder_Connector_Utils_FileSystem::createDirectoryRecursively($sfilePathInfo['dirname']); } $isAuthorized = (($aclMask & CKFINDER_CONNECTOR_ACL_FILE_UPLOAD ) == CKFINDER_CONNECTOR_ACL_FILE_UPLOAD ); if ( !$isAuthorized ){ $this->errorCode = CKFINDER_CONNECTOR_ERROR_COPY_FAILED; $this->appendErrorNode($this->skippedFilesNode, $this->errorCode, $originalFileName); return; } if ( copy('zip://'.$this->filePath.'#'.$originalFileName, $extractPath.$sFileName) ) { $this->appendUnzippedNode($this->unzippedNodes,$originalFileName); // chmod extracted file if ( is_file($extractPath.$sFileName) && ( $perms = $this->_config->getChmodFiles()) ) { $oldumask = umask(0); chmod( $extractPath.$sFileName, $perms ); umask( $oldumask ); } } // file extraction failed, add to skipped else { $this->errorCode = CKFINDER_CONNECTOR_ERROR_COPY_FAILED; $this->appendErrorNode($this->skippedFilesNode, $this->errorCode, $originalFileName); } }
php
protected function extractTo($extractPath, $extractClientPath, $filePathInfo, $sFileName, $originalFileName) { $sfilePathInfo = pathinfo($extractPath.$sFileName); $extractClientPathDir = $filePathInfo['dirname']; if ( $filePathInfo['dirname'] == '.' ){ $extractClientPathDir = ''; } $folderPath = CKFinder_Connector_Utils_FileSystem::combinePaths($extractClientPath,$extractClientPathDir); $_aclConfig = $this->_config->getAccessControlConfig(); $aclMask = $_aclConfig->getComputedMask($this->_currentFolder->getResourceTypeName(),$folderPath); $canCreateFolder = (($aclMask & CKFINDER_CONNECTOR_ACL_FOLDER_CREATE ) == CKFINDER_CONNECTOR_ACL_FOLDER_CREATE ); // create sub-directory of zip archive if ( empty($sfilePathInfo['extension']) ) { $fileStat = $this->zip->statName($originalFileName); $isDir = false; if ( $fileStat && empty($fileStat['size']) ){ $isDir = true; } if( !empty($sfilePathInfo['dirname']) && !empty($sfilePathInfo['basename']) && !file_exists($sfilePathInfo['dirname'].'/'.$sfilePathInfo['basename']) ) { if ( !$canCreateFolder ){ return; } if ( $isDir ) { CKFinder_Connector_Utils_FileSystem::createDirectoryRecursively( $sfilePathInfo['dirname'].'/'.$sfilePathInfo['basename'] ); return; } else { CKFinder_Connector_Utils_FileSystem::createDirectoryRecursively( $sfilePathInfo['dirname']); } } else { return; } } // extract file if ( !file_exists($sfilePathInfo['dirname']) ){ if ( !$canCreateFolder ){ $this->errorCode = CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED; $this->appendErrorNode($this->skippedFilesNode, $this->errorCode, $originalFileName ); return; } CKFinder_Connector_Utils_FileSystem::createDirectoryRecursively($sfilePathInfo['dirname']); } $isAuthorized = (($aclMask & CKFINDER_CONNECTOR_ACL_FILE_UPLOAD ) == CKFINDER_CONNECTOR_ACL_FILE_UPLOAD ); if ( !$isAuthorized ){ $this->errorCode = CKFINDER_CONNECTOR_ERROR_COPY_FAILED; $this->appendErrorNode($this->skippedFilesNode, $this->errorCode, $originalFileName); return; } if ( copy('zip://'.$this->filePath.'#'.$originalFileName, $extractPath.$sFileName) ) { $this->appendUnzippedNode($this->unzippedNodes,$originalFileName); // chmod extracted file if ( is_file($extractPath.$sFileName) && ( $perms = $this->_config->getChmodFiles()) ) { $oldumask = umask(0); chmod( $extractPath.$sFileName, $perms ); umask( $oldumask ); } } // file extraction failed, add to skipped else { $this->errorCode = CKFINDER_CONNECTOR_ERROR_COPY_FAILED; $this->appendErrorNode($this->skippedFilesNode, $this->errorCode, $originalFileName); } }
[ "protected", "function", "extractTo", "(", "$", "extractPath", ",", "$", "extractClientPath", ",", "$", "filePathInfo", ",", "$", "sFileName", ",", "$", "originalFileName", ")", "{", "$", "sfilePathInfo", "=", "pathinfo", "(", "$", "extractPath", ".", "$", "...
Extract one file from zip archive @param string $extractPath @param string $extractClientPath @param array $filePathInfo @param string $sFileName @param string $originalFileName
[ "Extract", "one", "file", "from", "zip", "archive" ]
8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada
https://github.com/pr-of-it/t4/blob/8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada/framework/Mvc/Extensions/Ckfinder/lib/plugins/zip/plugin.php#L233-L301
train
pr-of-it/t4
framework/Mvc/Extensions/Ckfinder/lib/plugins/zip/plugin.php
CKFinder_Connector_CommandHandler_CreateZip.getConfig
protected function getConfig(){ $config = array(); $config['zipMaxSize'] = 'default'; if (isset($GLOBALS['config']['ZipMaxSize']) && (string)$GLOBALS['config']['ZipMaxSize']!='default' ){ $config['zipMaxSize'] = CKFinder_Connector_Utils_Misc::returnBytes((string)$GLOBALS['config']['ZipMaxSize']); } return $config; }
php
protected function getConfig(){ $config = array(); $config['zipMaxSize'] = 'default'; if (isset($GLOBALS['config']['ZipMaxSize']) && (string)$GLOBALS['config']['ZipMaxSize']!='default' ){ $config['zipMaxSize'] = CKFinder_Connector_Utils_Misc::returnBytes((string)$GLOBALS['config']['ZipMaxSize']); } return $config; }
[ "protected", "function", "getConfig", "(", ")", "{", "$", "config", "=", "array", "(", ")", ";", "$", "config", "[", "'zipMaxSize'", "]", "=", "'default'", ";", "if", "(", "isset", "(", "$", "GLOBALS", "[", "'config'", "]", "[", "'ZipMaxSize'", "]", ...
Get private zip plugin config @access protected @return array
[ "Get", "private", "zip", "plugin", "config" ]
8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada
https://github.com/pr-of-it/t4/blob/8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada/framework/Mvc/Extensions/Ckfinder/lib/plugins/zip/plugin.php#L519-L528
train
pr-of-it/t4
framework/Mvc/Extensions/Ckfinder/lib/plugins/zip/plugin.php
CKFinder_Connector_CommandHandler_CreateZip.checkOneFile
protected function checkOneFile($file) { $resourceTypeInfo = $this->_currentFolder->getResourceTypeConfig(); $_aclConfig = $this->_config->getAccessControlConfig(); $directory = str_replace('\\','/', $resourceTypeInfo->getDirectory()); $fileName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($file->getFilename()); if ($this->_config->forceAscii()) { $fileName = CKFinder_Connector_Utils_FileSystem::convertToAscii($fileName); } $pathName = str_replace('\\','/', pathinfo($file->getPathname(), PATHINFO_DIRNAME) ); $pathName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($pathName); // acl $aclMask = $_aclConfig->getComputedMask($this->_currentFolder->getResourceTypeName(), str_ireplace($directory,'',$pathName)); $isAuthorized = (($aclMask & CKFINDER_CONNECTOR_ACL_FILE_VIEW) == CKFINDER_CONNECTOR_ACL_FILE_VIEW); if ( !$isAuthorized ){ return false; } // if it is a folder fileName represents the dir if ( $file->isDir() && ( !CKFinder_Connector_Utils_FileSystem::checkFolderPath($fileName) || $resourceTypeInfo->checkIsHiddenPath($fileName) ) ){ return false; } // folder name if ( !CKFinder_Connector_Utils_FileSystem::checkFolderPath($pathName) ){ return false; } // is hidden if ( $resourceTypeInfo->checkIsHiddenPath($pathName) || $resourceTypeInfo->checkIsHiddenFile($fileName) ){ return false; } // extension if ( !$resourceTypeInfo->checkExtension($fileName) || !CKFinder_Connector_Utils_FileSystem::checkFileName($fileName) ){ return false; } return true; }
php
protected function checkOneFile($file) { $resourceTypeInfo = $this->_currentFolder->getResourceTypeConfig(); $_aclConfig = $this->_config->getAccessControlConfig(); $directory = str_replace('\\','/', $resourceTypeInfo->getDirectory()); $fileName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($file->getFilename()); if ($this->_config->forceAscii()) { $fileName = CKFinder_Connector_Utils_FileSystem::convertToAscii($fileName); } $pathName = str_replace('\\','/', pathinfo($file->getPathname(), PATHINFO_DIRNAME) ); $pathName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($pathName); // acl $aclMask = $_aclConfig->getComputedMask($this->_currentFolder->getResourceTypeName(), str_ireplace($directory,'',$pathName)); $isAuthorized = (($aclMask & CKFINDER_CONNECTOR_ACL_FILE_VIEW) == CKFINDER_CONNECTOR_ACL_FILE_VIEW); if ( !$isAuthorized ){ return false; } // if it is a folder fileName represents the dir if ( $file->isDir() && ( !CKFinder_Connector_Utils_FileSystem::checkFolderPath($fileName) || $resourceTypeInfo->checkIsHiddenPath($fileName) ) ){ return false; } // folder name if ( !CKFinder_Connector_Utils_FileSystem::checkFolderPath($pathName) ){ return false; } // is hidden if ( $resourceTypeInfo->checkIsHiddenPath($pathName) || $resourceTypeInfo->checkIsHiddenFile($fileName) ){ return false; } // extension if ( !$resourceTypeInfo->checkExtension($fileName) || !CKFinder_Connector_Utils_FileSystem::checkFileName($fileName) ){ return false; } return true; }
[ "protected", "function", "checkOneFile", "(", "$", "file", ")", "{", "$", "resourceTypeInfo", "=", "$", "this", "->", "_currentFolder", "->", "getResourceTypeConfig", "(", ")", ";", "$", "_aclConfig", "=", "$", "this", "->", "_config", "->", "getAccessControlC...
Checks given file for security @param SplFileInfo $file @access protected @return bool
[ "Checks", "given", "file", "for", "security" ]
8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada
https://github.com/pr-of-it/t4/blob/8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada/framework/Mvc/Extensions/Ckfinder/lib/plugins/zip/plugin.php#L537-L577
train
pr-of-it/t4
framework/Mvc/Extensions/Ckfinder/lib/plugins/zip/plugin.php
CKFinder_Connector_CommandHandler_CreateZip.getFilesRecursively
protected function getFilesRecursively( $directory, $zipMaxSize ) { $allFiles = array(); $_zipFilesSize = 0; $serverPath = str_replace('\\','/',$directory); foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory), RecursiveIteratorIterator::CHILD_FIRST) as $file ) { if ( !$this->checkOneFile($file) ){ continue; } if ( !empty($zipMaxSize) ){ clearstatcache(); $_zipFilesSize += $file->getSize(); if ( $_zipFilesSize > $zipMaxSize ) { $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_CREATED_FILE_TOO_BIG); } } $pathName = str_replace('\\','/',$file->getPathname()); if ( $file->isDir() ){ // skip dot folders on unix systems ( do not try to use isDot() as $file is not a DirectoryIterator obj ) if ( in_array($file->getFilename(),array('..','.')) ){ continue; } if ($pathName != rtrim($serverPath,'/')){ $allFiles[ ltrim(str_ireplace(rtrim($serverPath,'/'),'',$pathName),'/') ] = ''; } } else { $allFiles[$pathName] = str_ireplace($serverPath,'',$pathName); } } return $allFiles; }
php
protected function getFilesRecursively( $directory, $zipMaxSize ) { $allFiles = array(); $_zipFilesSize = 0; $serverPath = str_replace('\\','/',$directory); foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory), RecursiveIteratorIterator::CHILD_FIRST) as $file ) { if ( !$this->checkOneFile($file) ){ continue; } if ( !empty($zipMaxSize) ){ clearstatcache(); $_zipFilesSize += $file->getSize(); if ( $_zipFilesSize > $zipMaxSize ) { $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_CREATED_FILE_TOO_BIG); } } $pathName = str_replace('\\','/',$file->getPathname()); if ( $file->isDir() ){ // skip dot folders on unix systems ( do not try to use isDot() as $file is not a DirectoryIterator obj ) if ( in_array($file->getFilename(),array('..','.')) ){ continue; } if ($pathName != rtrim($serverPath,'/')){ $allFiles[ ltrim(str_ireplace(rtrim($serverPath,'/'),'',$pathName),'/') ] = ''; } } else { $allFiles[$pathName] = str_ireplace($serverPath,'',$pathName); } } return $allFiles; }
[ "protected", "function", "getFilesRecursively", "(", "$", "directory", ",", "$", "zipMaxSize", ")", "{", "$", "allFiles", "=", "array", "(", ")", ";", "$", "_zipFilesSize", "=", "0", ";", "$", "serverPath", "=", "str_replace", "(", "'\\\\'", ",", "'/'", ...
Get list of all files in given directory, including sub-directories @param string $directory @param int $zipMaxSize Maximum zip file size @return array $allFiles
[ "Get", "list", "of", "all", "files", "in", "given", "directory", "including", "sub", "-", "directories" ]
8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada
https://github.com/pr-of-it/t4/blob/8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada/framework/Mvc/Extensions/Ckfinder/lib/plugins/zip/plugin.php#L586-L618
train
pr-of-it/t4
framework/Mvc/Extensions/Ckfinder/lib/plugins/zip/plugin.php
CKFinder_Connector_CommandHandler_DownloadZip.sendZipFile
protected function sendZipFile() { if (!function_exists('ob_list_handlers') || ob_list_handlers()) { @ob_end_clean(); } header("Content-Encoding: none"); $this->checkConnector(); $this->checkRequest(); // empty wystarczy if ( empty($_GET['FileName']) ){ $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_FILE_NOT_FOUND); } $resourceTypeInfo = $this->_currentFolder->getResourceTypeConfig(); $hash = $resourceTypeInfo->getHash(); if ( $hash !== $_GET['hash'] || $hash !== substr($_GET['FileName'],16,16) ){ $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST); } if (!$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FILE_VIEW)) { $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED); } $fileName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding(trim($_GET['FileName'])); if (!CKFinder_Connector_Utils_FileSystem::checkFileName($fileName)) { $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST); } if ( strtolower(pathinfo($fileName, PATHINFO_EXTENSION)) !== 'zip'){ $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_EXTENSION); } $dest_dir = CKFinder_Connector_Utils_FileSystem::getTmpDir(); $filePath = CKFinder_Connector_Utils_FileSystem::combinePaths($dest_dir,$fileName); if ( !file_exists($filePath) || !is_file($filePath)) { $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_FILE_NOT_FOUND); } if (!is_readable($filePath)) { $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED); } $zipFileName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding(trim($_GET['ZipName'])); if (!CKFinder_Connector_Utils_FileSystem::checkFileName($zipFileName)) { $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST); } $fileFilename = pathinfo($zipFileName,PATHINFO_BASENAME ); header("Content-Encoding: none"); header("Cache-Control: cache, must-revalidate"); header("Pragma: public"); header("Expires: 0"); $user_agent = !empty($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ""; $encodedName = str_replace("\"", "\\\"", $fileFilename); if (strpos($user_agent, "MSIE") !== false) { $encodedName = str_replace(array("+", "%2E"), array(" ", "."), urlencode($encodedName)); } header("Content-type: application/octet-stream; name=\"" . $fileFilename . "\""); header("Content-Disposition: attachment; filename=\"" . $encodedName. "\""); header("Content-Length: " . filesize($filePath)); CKFinder_Connector_Utils_FileSystem::sendFile($filePath); exit; }
php
protected function sendZipFile() { if (!function_exists('ob_list_handlers') || ob_list_handlers()) { @ob_end_clean(); } header("Content-Encoding: none"); $this->checkConnector(); $this->checkRequest(); // empty wystarczy if ( empty($_GET['FileName']) ){ $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_FILE_NOT_FOUND); } $resourceTypeInfo = $this->_currentFolder->getResourceTypeConfig(); $hash = $resourceTypeInfo->getHash(); if ( $hash !== $_GET['hash'] || $hash !== substr($_GET['FileName'],16,16) ){ $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST); } if (!$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FILE_VIEW)) { $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED); } $fileName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding(trim($_GET['FileName'])); if (!CKFinder_Connector_Utils_FileSystem::checkFileName($fileName)) { $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST); } if ( strtolower(pathinfo($fileName, PATHINFO_EXTENSION)) !== 'zip'){ $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_EXTENSION); } $dest_dir = CKFinder_Connector_Utils_FileSystem::getTmpDir(); $filePath = CKFinder_Connector_Utils_FileSystem::combinePaths($dest_dir,$fileName); if ( !file_exists($filePath) || !is_file($filePath)) { $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_FILE_NOT_FOUND); } if (!is_readable($filePath)) { $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED); } $zipFileName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding(trim($_GET['ZipName'])); if (!CKFinder_Connector_Utils_FileSystem::checkFileName($zipFileName)) { $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST); } $fileFilename = pathinfo($zipFileName,PATHINFO_BASENAME ); header("Content-Encoding: none"); header("Cache-Control: cache, must-revalidate"); header("Pragma: public"); header("Expires: 0"); $user_agent = !empty($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ""; $encodedName = str_replace("\"", "\\\"", $fileFilename); if (strpos($user_agent, "MSIE") !== false) { $encodedName = str_replace(array("+", "%2E"), array(" ", "."), urlencode($encodedName)); } header("Content-type: application/octet-stream; name=\"" . $fileFilename . "\""); header("Content-Disposition: attachment; filename=\"" . $encodedName. "\""); header("Content-Length: " . filesize($filePath)); CKFinder_Connector_Utils_FileSystem::sendFile($filePath); exit; }
[ "protected", "function", "sendZipFile", "(", ")", "{", "if", "(", "!", "function_exists", "(", "'ob_list_handlers'", ")", "||", "ob_list_handlers", "(", ")", ")", "{", "@", "ob_end_clean", "(", ")", ";", "}", "header", "(", "\"Content-Encoding: none\"", ")", ...
Sends generated zip file to the user
[ "Sends", "generated", "zip", "file", "to", "the", "user" ]
8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada
https://github.com/pr-of-it/t4/blob/8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada/framework/Mvc/Extensions/Ckfinder/lib/plugins/zip/plugin.php#L857-L921
train
pr-of-it/t4
framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Utils/XmlNode.php
Ckfinder_Connector_Utils_XmlNode.asUTF8
public function asUTF8($string) { if (CKFinder_Connector_Utils_Misc::isValidUTF8($string)) { return $string; } $ret = ""; for ($i = 0; $i < strlen($string); $i++) { $ret .= CKFinder_Connector_Utils_Misc::isValidUTF8($string[$i]) ? $string[$i] : "?"; } return $ret; }
php
public function asUTF8($string) { if (CKFinder_Connector_Utils_Misc::isValidUTF8($string)) { return $string; } $ret = ""; for ($i = 0; $i < strlen($string); $i++) { $ret .= CKFinder_Connector_Utils_Misc::isValidUTF8($string[$i]) ? $string[$i] : "?"; } return $ret; }
[ "public", "function", "asUTF8", "(", "$", "string", ")", "{", "if", "(", "CKFinder_Connector_Utils_Misc", "::", "isValidUTF8", "(", "$", "string", ")", ")", "{", "return", "$", "string", ";", "}", "$", "ret", "=", "\"\"", ";", "for", "(", "$", "i", "...
Checks whether the string is valid UTF8 @param string $string
[ "Checks", "whether", "the", "string", "is", "valid", "UTF8" ]
8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada
https://github.com/pr-of-it/t4/blob/8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada/framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Utils/XmlNode.php#L146-L158
train
pr-of-it/t4
framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Utils/XmlNode.php
Ckfinder_Connector_Utils_XmlNode.asXML
public function asXML() { $ret = "<" . $this->_name; //print Attributes if (sizeof($this->_attributes)>0) { foreach ($this->_attributes as $_name => $_value) { $ret .= " " . $_name . '="' . $this->asUTF8(htmlspecialchars($_value)) . '"'; } } //if there is nothing more todo, close empty tag and exit if (is_null($this->_value) && !sizeof($this->_childNodes)) { $ret .= " />"; return $ret; } //close opening tag $ret .= ">"; //print value if (!is_null($this->_value)) { $ret .= $this->asUTF8(htmlspecialchars($this->_value)); } //print child nodes if (sizeof($this->_childNodes)>0) { foreach ($this->_childNodes as $_node) { $ret .= $_node->asXml(); } } $ret .= "</" . $this->_name . ">"; return $ret; }
php
public function asXML() { $ret = "<" . $this->_name; //print Attributes if (sizeof($this->_attributes)>0) { foreach ($this->_attributes as $_name => $_value) { $ret .= " " . $_name . '="' . $this->asUTF8(htmlspecialchars($_value)) . '"'; } } //if there is nothing more todo, close empty tag and exit if (is_null($this->_value) && !sizeof($this->_childNodes)) { $ret .= " />"; return $ret; } //close opening tag $ret .= ">"; //print value if (!is_null($this->_value)) { $ret .= $this->asUTF8(htmlspecialchars($this->_value)); } //print child nodes if (sizeof($this->_childNodes)>0) { foreach ($this->_childNodes as $_node) { $ret .= $_node->asXml(); } } $ret .= "</" . $this->_name . ">"; return $ret; }
[ "public", "function", "asXML", "(", ")", "{", "$", "ret", "=", "\"<\"", ".", "$", "this", "->", "_name", ";", "//print Attributes", "if", "(", "sizeof", "(", "$", "this", "->", "_attributes", ")", ">", "0", ")", "{", "foreach", "(", "$", "this", "-...
Return a well-formed XML string based on Ckfinder_Connector_Utils_XmlNode element @return string @access public
[ "Return", "a", "well", "-", "formed", "XML", "string", "based", "on", "Ckfinder_Connector_Utils_XmlNode", "element" ]
8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada
https://github.com/pr-of-it/t4/blob/8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada/framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Utils/XmlNode.php#L166-L201
train
pr-of-it/t4
framework/Core/Config.php
Config.save
public function save() { $str = $this->prepareForSave($this->toArray()); if (empty($this->__path)) { throw new Exception('Empty path for config save'); } file_put_contents($this->__path, '<?php' . PHP_EOL . PHP_EOL . 'return ' . $str . ';'); return $this; }
php
public function save() { $str = $this->prepareForSave($this->toArray()); if (empty($this->__path)) { throw new Exception('Empty path for config save'); } file_put_contents($this->__path, '<?php' . PHP_EOL . PHP_EOL . 'return ' . $str . ';'); return $this; }
[ "public", "function", "save", "(", ")", "{", "$", "str", "=", "$", "this", "->", "prepareForSave", "(", "$", "this", "->", "toArray", "(", ")", ")", ";", "if", "(", "empty", "(", "$", "this", "->", "__path", ")", ")", "{", "throw", "new", "Except...
Saves config file @return $this @throws \T4\Core\Exception
[ "Saves", "config", "file" ]
8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada
https://github.com/pr-of-it/t4/blob/8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada/framework/Core/Config.php#L70-L78
train
pr-of-it/t4
framework/Core/Config.php
Config.prepareForSave
protected function prepareForSave(array $data) : string { $str = var_export($data, true); $str = preg_replace(['~^(\s*)array\s*\($~im', '~^(\s*)\)(\,?)$~im', '~\s+$~im'], ['$1[', '$1]$2', ''], $str); return $str; }
php
protected function prepareForSave(array $data) : string { $str = var_export($data, true); $str = preg_replace(['~^(\s*)array\s*\($~im', '~^(\s*)\)(\,?)$~im', '~\s+$~im'], ['$1[', '$1]$2', ''], $str); return $str; }
[ "protected", "function", "prepareForSave", "(", "array", "$", "data", ")", ":", "string", "{", "$", "str", "=", "var_export", "(", "$", "data", ",", "true", ")", ";", "$", "str", "=", "preg_replace", "(", "[", "'~^(\\s*)array\\s*\\($~im'", ",", "'~^(\\s*)\...
Prepares array representation for save in PHP file @param array $data @return string
[ "Prepares", "array", "representation", "for", "save", "in", "PHP", "file" ]
8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada
https://github.com/pr-of-it/t4/blob/8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada/framework/Core/Config.php#L98-L103
train
aimeos/ai-controller-jobs
controller/common/src/Controller/Common/Product/Import/Csv/Cache/Product/Standard.php
Standard.get
public function get( $code, $type = null ) { if( isset( $this->prodmap[$code] ) ) { return $this->prodmap[$code]; } $manager = \Aimeos\MShop::create( $this->getContext(), 'product' ); $search = $manager->createSearch(); $search->setConditions( $search->compare( '==', 'product.code', $code ) ); $result = $manager->searchItems( $search ); if( ( $item = reset( $result ) ) !== false ) { $this->prodmap[$code] = $item->getId(); return $this->prodmap[$code]; } }
php
public function get( $code, $type = null ) { if( isset( $this->prodmap[$code] ) ) { return $this->prodmap[$code]; } $manager = \Aimeos\MShop::create( $this->getContext(), 'product' ); $search = $manager->createSearch(); $search->setConditions( $search->compare( '==', 'product.code', $code ) ); $result = $manager->searchItems( $search ); if( ( $item = reset( $result ) ) !== false ) { $this->prodmap[$code] = $item->getId(); return $this->prodmap[$code]; } }
[ "public", "function", "get", "(", "$", "code", ",", "$", "type", "=", "null", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "prodmap", "[", "$", "code", "]", ")", ")", "{", "return", "$", "this", "->", "prodmap", "[", "$", "code", "]", ...
Returns the product ID for the given code @param string $code Product code @param string|null $type Attribute type @return string|null Product ID or null if not found
[ "Returns", "the", "product", "ID", "for", "the", "given", "code" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/common/src/Controller/Common/Product/Import/Csv/Cache/Product/Standard.php#L45-L63
train
aimeos/ai-controller-jobs
controller/common/src/Controller/Common/Product/Import/Csv/Cache/Product/Standard.php
Standard.set
public function set( \Aimeos\MShop\Common\Item\Iface $item ) { $this->prodmap[$item->getCode()] = $item->getId(); }
php
public function set( \Aimeos\MShop\Common\Item\Iface $item ) { $this->prodmap[$item->getCode()] = $item->getId(); }
[ "public", "function", "set", "(", "\\", "Aimeos", "\\", "MShop", "\\", "Common", "\\", "Item", "\\", "Iface", "$", "item", ")", "{", "$", "this", "->", "prodmap", "[", "$", "item", "->", "getCode", "(", ")", "]", "=", "$", "item", "->", "getId", ...
Adds the product ID to the cache @param \Aimeos\MShop\Common\Item\Iface $item Product object
[ "Adds", "the", "product", "ID", "to", "the", "cache" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/common/src/Controller/Common/Product/Import/Csv/Cache/Product/Standard.php#L71-L74
train
pr-of-it/t4
framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Core/Config.php
CKFinder_Connector_Core_Config.getHideFoldersRegex
public function getHideFoldersRegex() { static $folderRegex; if (!isset($folderRegex)) { if (is_array($this->_hideFolders) && $this->_hideFolders) { $folderRegex = join("|", $this->_hideFolders); $folderRegex = strtr($folderRegex, array("?" => "__QMK__", "*" => "__AST__", "|" => "__PIP__")); $folderRegex = preg_quote($folderRegex, "/"); $folderRegex = strtr($folderRegex, array("__QMK__" => ".", "__AST__" => ".*", "__PIP__" => "|")); $folderRegex = "/^(?:" . $folderRegex . ")$/uim"; } else { $folderRegex = ""; } } return $folderRegex; }
php
public function getHideFoldersRegex() { static $folderRegex; if (!isset($folderRegex)) { if (is_array($this->_hideFolders) && $this->_hideFolders) { $folderRegex = join("|", $this->_hideFolders); $folderRegex = strtr($folderRegex, array("?" => "__QMK__", "*" => "__AST__", "|" => "__PIP__")); $folderRegex = preg_quote($folderRegex, "/"); $folderRegex = strtr($folderRegex, array("__QMK__" => ".", "__AST__" => ".*", "__PIP__" => "|")); $folderRegex = "/^(?:" . $folderRegex . ")$/uim"; } else { $folderRegex = ""; } } return $folderRegex; }
[ "public", "function", "getHideFoldersRegex", "(", ")", "{", "static", "$", "folderRegex", ";", "if", "(", "!", "isset", "(", "$", "folderRegex", ")", ")", "{", "if", "(", "is_array", "(", "$", "this", "->", "_hideFolders", ")", "&&", "$", "this", "->",...
Get regular expression to hide folders @access public @return array
[ "Get", "regular", "expression", "to", "hide", "folders" ]
8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada
https://github.com/pr-of-it/t4/blob/8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada/framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Core/Config.php#L273-L291
train
pr-of-it/t4
framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Core/Config.php
CKFinder_Connector_Core_Config.getHideFilesRegex
public function getHideFilesRegex() { static $fileRegex; if (!isset($fileRegex)) { if (is_array($this->_hideFiles) && $this->_hideFiles) { $fileRegex = join("|", $this->_hideFiles); $fileRegex = strtr($fileRegex, array("?" => "__QMK__", "*" => "__AST__", "|" => "__PIP__")); $fileRegex = preg_quote($fileRegex, "/"); $fileRegex = strtr($fileRegex, array("__QMK__" => ".", "__AST__" => ".*", "__PIP__" => "|")); $fileRegex = "/^(?:" . $fileRegex . ")$/uim"; } else { $fileRegex = ""; } } return $fileRegex; }
php
public function getHideFilesRegex() { static $fileRegex; if (!isset($fileRegex)) { if (is_array($this->_hideFiles) && $this->_hideFiles) { $fileRegex = join("|", $this->_hideFiles); $fileRegex = strtr($fileRegex, array("?" => "__QMK__", "*" => "__AST__", "|" => "__PIP__")); $fileRegex = preg_quote($fileRegex, "/"); $fileRegex = strtr($fileRegex, array("__QMK__" => ".", "__AST__" => ".*", "__PIP__" => "|")); $fileRegex = "/^(?:" . $fileRegex . ")$/uim"; } else { $fileRegex = ""; } } return $fileRegex; }
[ "public", "function", "getHideFilesRegex", "(", ")", "{", "static", "$", "fileRegex", ";", "if", "(", "!", "isset", "(", "$", "fileRegex", ")", ")", "{", "if", "(", "is_array", "(", "$", "this", "->", "_hideFiles", ")", "&&", "$", "this", "->", "_hid...
Get regular expression to hide files @access public @return array
[ "Get", "regular", "expression", "to", "hide", "files" ]
8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada
https://github.com/pr-of-it/t4/blob/8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada/framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Core/Config.php#L299-L317
train
pr-of-it/t4
framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Core/Config.php
CKFinder_Connector_Core_Config.&
public function &getResourceTypeConfig($resourceTypeName) { $_null = null; if (isset($this->_resourceTypeConfigCache[$resourceTypeName])) { return $this->_resourceTypeConfigCache[$resourceTypeName]; } if (!isset($GLOBALS['config']['ResourceType']) || !is_array($GLOBALS['config']['ResourceType'])) { return $_null; } reset($GLOBALS['config']['ResourceType']); while (list($_key,$_resourceTypeNode) = each($GLOBALS['config']['ResourceType'])) { if ($_resourceTypeNode['name'] === $resourceTypeName) { $this->_resourceTypeConfigCache[$resourceTypeName] = new CKFinder_Connector_Core_ResourceTypeConfig($_resourceTypeNode); return $this->_resourceTypeConfigCache[$resourceTypeName]; } } return $_null; }
php
public function &getResourceTypeConfig($resourceTypeName) { $_null = null; if (isset($this->_resourceTypeConfigCache[$resourceTypeName])) { return $this->_resourceTypeConfigCache[$resourceTypeName]; } if (!isset($GLOBALS['config']['ResourceType']) || !is_array($GLOBALS['config']['ResourceType'])) { return $_null; } reset($GLOBALS['config']['ResourceType']); while (list($_key,$_resourceTypeNode) = each($GLOBALS['config']['ResourceType'])) { if ($_resourceTypeNode['name'] === $resourceTypeName) { $this->_resourceTypeConfigCache[$resourceTypeName] = new CKFinder_Connector_Core_ResourceTypeConfig($_resourceTypeNode); return $this->_resourceTypeConfigCache[$resourceTypeName]; } } return $_null; }
[ "public", "function", "&", "getResourceTypeConfig", "(", "$", "resourceTypeName", ")", "{", "$", "_null", "=", "null", ";", "if", "(", "isset", "(", "$", "this", "->", "_resourceTypeConfigCache", "[", "$", "resourceTypeName", "]", ")", ")", "{", "return", ...
Get resourceTypeName config @param string $resourceTypeName @return CKFinder_Connector_Core_ResourceTypeConfig|null @access public
[ "Get", "resourceTypeName", "config" ]
8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada
https://github.com/pr-of-it/t4/blob/8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada/framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Core/Config.php#L425-L447
train
pr-of-it/t4
framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Core/Config.php
CKFinder_Connector_Core_Config.&
public function &getThumbnailsConfig() { if (!isset($this->_thumbnailsConfigCache)) { $this->_thumbnailsConfigCache = new CKFinder_Connector_Core_ThumbnailsConfig(isset($GLOBALS['config']['Thumbnails']) ? $GLOBALS['config']['Thumbnails'] : array()); } return $this->_thumbnailsConfigCache; }
php
public function &getThumbnailsConfig() { if (!isset($this->_thumbnailsConfigCache)) { $this->_thumbnailsConfigCache = new CKFinder_Connector_Core_ThumbnailsConfig(isset($GLOBALS['config']['Thumbnails']) ? $GLOBALS['config']['Thumbnails'] : array()); } return $this->_thumbnailsConfigCache; }
[ "public", "function", "&", "getThumbnailsConfig", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "_thumbnailsConfigCache", ")", ")", "{", "$", "this", "->", "_thumbnailsConfigCache", "=", "new", "CKFinder_Connector_Core_ThumbnailsConfig", "(", "...
Get thumbnails config @access public @return CKFinder_Connector_Core_ThumbnailsConfig
[ "Get", "thumbnails", "config" ]
8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada
https://github.com/pr-of-it/t4/blob/8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada/framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Core/Config.php#L455-L462
train
pr-of-it/t4
framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Core/Config.php
CKFinder_Connector_Core_Config.&
public function &getImagesConfig() { if (!isset($this->_imagesConfigCache)) { $this->_imagesConfigCache = new CKFinder_Connector_Core_ImagesConfig(isset($GLOBALS['config']['Images']) ? $GLOBALS['config']['Images'] : array()); } return $this->_imagesConfigCache; }
php
public function &getImagesConfig() { if (!isset($this->_imagesConfigCache)) { $this->_imagesConfigCache = new CKFinder_Connector_Core_ImagesConfig(isset($GLOBALS['config']['Images']) ? $GLOBALS['config']['Images'] : array()); } return $this->_imagesConfigCache; }
[ "public", "function", "&", "getImagesConfig", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "_imagesConfigCache", ")", ")", "{", "$", "this", "->", "_imagesConfigCache", "=", "new", "CKFinder_Connector_Core_ImagesConfig", "(", "isset", "(", ...
Get images config @access public @return CKFinder_Connector_Core_ImagesConfig
[ "Get", "images", "config" ]
8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada
https://github.com/pr-of-it/t4/blob/8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada/framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Core/Config.php#L470-L477
train
pr-of-it/t4
framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Core/Config.php
CKFinder_Connector_Core_Config.&
public function &getAccessControlConfig() { if (!isset($this->_accessControlConfigCache)) { $this->_accessControlConfigCache = new CKFinder_Connector_Core_AccessControlConfig(isset($GLOBALS['config']['AccessControl']) ? $GLOBALS['config']['AccessControl'] : array()); } return $this->_accessControlConfigCache; }
php
public function &getAccessControlConfig() { if (!isset($this->_accessControlConfigCache)) { $this->_accessControlConfigCache = new CKFinder_Connector_Core_AccessControlConfig(isset($GLOBALS['config']['AccessControl']) ? $GLOBALS['config']['AccessControl'] : array()); } return $this->_accessControlConfigCache; }
[ "public", "function", "&", "getAccessControlConfig", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "_accessControlConfigCache", ")", ")", "{", "$", "this", "->", "_accessControlConfigCache", "=", "new", "CKFinder_Connector_Core_AccessControlConfig"...
Get access control config @access public @return CKFinder_Connector_Core_AccessControlConfig
[ "Get", "access", "control", "config" ]
8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada
https://github.com/pr-of-it/t4/blob/8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada/framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Core/Config.php#L485-L492
train
pr-of-it/t4
framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Core/Config.php
CKFinder_Connector_Core_Config.getResourceTypeNames
public function getResourceTypeNames() { if (!isset($GLOBALS['config']['ResourceType']) || !is_array($GLOBALS['config']['ResourceType'])) { return array(); } $_names = array(); foreach ($GLOBALS['config']['ResourceType'] as $key => $_resourceType) { if (isset($_resourceType['name'])) { $_names[] = (string)$_resourceType['name']; } } return $_names; }
php
public function getResourceTypeNames() { if (!isset($GLOBALS['config']['ResourceType']) || !is_array($GLOBALS['config']['ResourceType'])) { return array(); } $_names = array(); foreach ($GLOBALS['config']['ResourceType'] as $key => $_resourceType) { if (isset($_resourceType['name'])) { $_names[] = (string)$_resourceType['name']; } } return $_names; }
[ "public", "function", "getResourceTypeNames", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "GLOBALS", "[", "'config'", "]", "[", "'ResourceType'", "]", ")", "||", "!", "is_array", "(", "$", "GLOBALS", "[", "'config'", "]", "[", "'ResourceType'", "]"...
Get all resource type names defined in config @return array @access public
[ "Get", "all", "resource", "type", "names", "defined", "in", "config" ]
8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada
https://github.com/pr-of-it/t4/blob/8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada/framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Core/Config.php#L569-L583
train
aimeos/ai-controller-jobs
controller/common/src/Controller/Common/Product/Import/Csv/Processor/Attribute/Standard.php
Standard.process
public function process( \Aimeos\MShop\Product\Item\Iface $product, array $data ) { $context = $this->getContext(); $listManager = \Aimeos\MShop::create( $context, 'product/lists' ); $separator = $context->getConfig()->get( 'controller/common/product/import/csv/separator', "\n" ); $listMap = []; $map = $this->getMappedChunk( $data, $this->getMapping() ); $listItems = $product->getListItems( 'attribute', $this->listTypes ); foreach( $listItems as $listItem ) { if( ( $refItem = $listItem->getRefItem() ) !== null ) { $listMap[$refItem->getCode()][$listItem->getType()] = $listItem; } } foreach( $map as $pos => $list ) { if( $this->checkEntry( $list ) === false ) { continue; } $codes = explode( $separator, $this->getValue( $list, 'attribute.code', '' ) ); foreach( $codes as $code ) { $code = trim( $code ); $listtype = $this->getValue( $list, 'product.lists.type', 'default' ); if( isset( $listMap[$code][$listtype] ) ) { $listItem = $listMap[$code][$listtype]; unset( $listItems[$listItem->getId()] ); } else { $listItem = $listManager->createItem()->setType( $listtype ); } $listItem = $listItem->setPosition( $pos )->fromArray( $list ); $attrItem = $this->getAttributeItem( $code, $this->getValue( $list, 'attribute.type' ) ); $attrItem = $attrItem->setCode( $code )->fromArray( $list ); $product->addListItem( 'attribute', $listItem, $attrItem ); } } $product->deleteListItems( $listItems ); return $this->getObject()->process( $product, $data ); }
php
public function process( \Aimeos\MShop\Product\Item\Iface $product, array $data ) { $context = $this->getContext(); $listManager = \Aimeos\MShop::create( $context, 'product/lists' ); $separator = $context->getConfig()->get( 'controller/common/product/import/csv/separator', "\n" ); $listMap = []; $map = $this->getMappedChunk( $data, $this->getMapping() ); $listItems = $product->getListItems( 'attribute', $this->listTypes ); foreach( $listItems as $listItem ) { if( ( $refItem = $listItem->getRefItem() ) !== null ) { $listMap[$refItem->getCode()][$listItem->getType()] = $listItem; } } foreach( $map as $pos => $list ) { if( $this->checkEntry( $list ) === false ) { continue; } $codes = explode( $separator, $this->getValue( $list, 'attribute.code', '' ) ); foreach( $codes as $code ) { $code = trim( $code ); $listtype = $this->getValue( $list, 'product.lists.type', 'default' ); if( isset( $listMap[$code][$listtype] ) ) { $listItem = $listMap[$code][$listtype]; unset( $listItems[$listItem->getId()] ); } else { $listItem = $listManager->createItem()->setType( $listtype ); } $listItem = $listItem->setPosition( $pos )->fromArray( $list ); $attrItem = $this->getAttributeItem( $code, $this->getValue( $list, 'attribute.type' ) ); $attrItem = $attrItem->setCode( $code )->fromArray( $list ); $product->addListItem( 'attribute', $listItem, $attrItem ); } } $product->deleteListItems( $listItems ); return $this->getObject()->process( $product, $data ); }
[ "public", "function", "process", "(", "\\", "Aimeos", "\\", "MShop", "\\", "Product", "\\", "Item", "\\", "Iface", "$", "product", ",", "array", "$", "data", ")", "{", "$", "context", "=", "$", "this", "->", "getContext", "(", ")", ";", "$", "listMan...
Saves the attribute related data to the storage @param \Aimeos\MShop\Product\Item\Iface $product Product item with associated items @param array $data List of CSV fields with position as key and data as value @return array List of data which hasn't been imported
[ "Saves", "the", "attribute", "related", "data", "to", "the", "storage" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/common/src/Controller/Common/Product/Import/Csv/Processor/Attribute/Standard.php#L113-L165
train
antonmedv/purephp
src/Command/DeleteCommand.php
DeleteCommand.run
public function run($arguments, ConnectionInterface $connection) { list($name) = $arguments; if (isset($this->server[$name])) { unset($this->server[$name]); return true; } else { return false; } }
php
public function run($arguments, ConnectionInterface $connection) { list($name) = $arguments; if (isset($this->server[$name])) { unset($this->server[$name]); return true; } else { return false; } }
[ "public", "function", "run", "(", "$", "arguments", ",", "ConnectionInterface", "$", "connection", ")", "{", "list", "(", "$", "name", ")", "=", "$", "arguments", ";", "if", "(", "isset", "(", "$", "this", "->", "server", "[", "$", "name", "]", ")", ...
Run delete storage command. @param array $arguments @param ConnectionInterface $connection @return bool
[ "Run", "delete", "storage", "command", "." ]
05aa6b44cea9b0457ec1e5e67e8278cd89d47f21
https://github.com/antonmedv/purephp/blob/05aa6b44cea9b0457ec1e5e67e8278cd89d47f21/src/Command/DeleteCommand.php#L35-L45
train
pr-of-it/t4
framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Utils/Security.php
CKFinder_Connector_Utils_Security.getRidOfMagicQuotes
public function getRidOfMagicQuotes() { if (CKFINDER_CONNECTOR_PHP_MODE<6 && get_magic_quotes_gpc()) { if (!empty($_GET)) { $this->stripQuotes($_GET); } if (!empty($_POST)) { $this->stripQuotes($_POST); } if (!empty($_COOKIE)) { $this->stripQuotes($_COOKIE); } if (!empty($_FILES)) { while (list($k,$v) = each($_FILES)) { if (isset($_FILES[$k]['name'])) { $this->stripQuotes($_FILES[$k]['name']); } } } } }
php
public function getRidOfMagicQuotes() { if (CKFINDER_CONNECTOR_PHP_MODE<6 && get_magic_quotes_gpc()) { if (!empty($_GET)) { $this->stripQuotes($_GET); } if (!empty($_POST)) { $this->stripQuotes($_POST); } if (!empty($_COOKIE)) { $this->stripQuotes($_COOKIE); } if (!empty($_FILES)) { while (list($k,$v) = each($_FILES)) { if (isset($_FILES[$k]['name'])) { $this->stripQuotes($_FILES[$k]['name']); } } } } }
[ "public", "function", "getRidOfMagicQuotes", "(", ")", "{", "if", "(", "CKFINDER_CONNECTOR_PHP_MODE", "<", "6", "&&", "get_magic_quotes_gpc", "(", ")", ")", "{", "if", "(", "!", "empty", "(", "$", "_GET", ")", ")", "{", "$", "this", "->", "stripQuotes", ...
Strip quotes from global arrays @access public
[ "Strip", "quotes", "from", "global", "arrays" ]
8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada
https://github.com/pr-of-it/t4/blob/8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada/framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Utils/Security.php#L33-L53
train
pr-of-it/t4
framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Utils/Security.php
CKFinder_Connector_Utils_Security.stripQuotes
public function stripQuotes(&$var, $depth=0, $howDeep=5) { if (is_array($var)) { if ($depth++<$howDeep) { while (list($k,$v) = each($var)) { $this->stripQuotes($var[$k], $depth, $howDeep); } } } else { $var = stripslashes($var); } }
php
public function stripQuotes(&$var, $depth=0, $howDeep=5) { if (is_array($var)) { if ($depth++<$howDeep) { while (list($k,$v) = each($var)) { $this->stripQuotes($var[$k], $depth, $howDeep); } } } else { $var = stripslashes($var); } }
[ "public", "function", "stripQuotes", "(", "&", "$", "var", ",", "$", "depth", "=", "0", ",", "$", "howDeep", "=", "5", ")", "{", "if", "(", "is_array", "(", "$", "var", ")", ")", "{", "if", "(", "$", "depth", "++", "<", "$", "howDeep", ")", "...
Strip quotes from variable @access public @param mixed $var @param int $depth current depth @param int $howDeep maximum depth
[ "Strip", "quotes", "from", "variable" ]
8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada
https://github.com/pr-of-it/t4/blob/8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada/framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Utils/Security.php#L63-L74
train
aimeos/ai-controller-jobs
controller/jobs/src/Controller/Jobs/Catalog/Import/Xml/Standard.php
Standard.importNode
protected function importNode( \DomElement $node, $domains, $parentid, array &$map ) { $manager = \Aimeos\MShop::create( $this->getContext(), 'catalog' ); if( ( $attr = $node->attributes->getNamedItem( 'ref' ) ) !== null ) { try { $item = $manager->findItem( $attr->nodeValue, $domains ); $manager->moveItem( $item->getId(), $item->getParentId(), $parentid ); $item = $this->process( $item, $node ); $currentid = $manager->saveItem( $item )->getId(); unset( $item ); $tree = $manager->getTree( $currentid, [], \Aimeos\MW\Tree\Manager\Base::LEVEL_LIST ); foreach( $tree->getChildren() as $child ) { $map[$child->getCode()] = $child->getId(); } return $currentid; } catch( \Aimeos\MShop\Exception $e ) {} // not found, create new } $item = $this->process( $manager->createItem(), $node ); return $manager->insertItem( $item, $parentid )->getId(); }
php
protected function importNode( \DomElement $node, $domains, $parentid, array &$map ) { $manager = \Aimeos\MShop::create( $this->getContext(), 'catalog' ); if( ( $attr = $node->attributes->getNamedItem( 'ref' ) ) !== null ) { try { $item = $manager->findItem( $attr->nodeValue, $domains ); $manager->moveItem( $item->getId(), $item->getParentId(), $parentid ); $item = $this->process( $item, $node ); $currentid = $manager->saveItem( $item )->getId(); unset( $item ); $tree = $manager->getTree( $currentid, [], \Aimeos\MW\Tree\Manager\Base::LEVEL_LIST ); foreach( $tree->getChildren() as $child ) { $map[$child->getCode()] = $child->getId(); } return $currentid; } catch( \Aimeos\MShop\Exception $e ) {} // not found, create new } $item = $this->process( $manager->createItem(), $node ); return $manager->insertItem( $item, $parentid )->getId(); }
[ "protected", "function", "importNode", "(", "\\", "DomElement", "$", "node", ",", "$", "domains", ",", "$", "parentid", ",", "array", "&", "$", "map", ")", "{", "$", "manager", "=", "\\", "Aimeos", "\\", "MShop", "::", "create", "(", "$", "this", "->...
Imports a single category node @param \DomElement $node DOM node of "catalogitem" element @param string[] $domains List of domain names whose referenced items will be updated in the catalog items @param string|null $parentid ID of the parent catalog node @param array &$map Will contain the associative list of code/ID pairs of the child categories @return string Catalog ID of the imported category
[ "Imports", "a", "single", "category", "node" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/jobs/src/Controller/Jobs/Catalog/Import/Xml/Standard.php#L215-L243
train
aimeos/ai-controller-jobs
controller/jobs/src/Controller/Jobs/Catalog/Import/Xml/Standard.php
Standard.importTree
protected function importTree( \XMLReader $xml, array $domains, $parentid = null, array $map = [] ) { $total = 0; $childMap = []; $currentid = $parentid; while( $xml->read() === true ) { if( $xml->nodeType === \XMLReader::ELEMENT && $xml->name === 'catalogitem' ) { if( ( $node = $xml->expand() ) === false ) { $msg = sprintf( 'Expanding "%1$s" node failed', 'catalogitem' ); throw new \Aimeos\Controller\Jobs\Exception( $msg ); } if( ( $attr = $node->attributes->getNamedItem( 'ref' ) ) !== null ) { unset( $map[$attr->nodeValue] ); } $currentid = $this->importNode( $node, $domains, $parentid, $childMap ); $total++; } elseif( $xml->nodeType === \XMLReader::ELEMENT && $xml->name === 'catalog' ) { $this->importTree( $xml, $domains, $currentid, $childMap ); $childMap = []; } elseif( $xml->nodeType === \XMLReader::END_ELEMENT && $xml->name === 'catalog' ) { \Aimeos\MShop::create( $this->getContext(), 'catalog' )->deleteItems( $map ); break; } } }
php
protected function importTree( \XMLReader $xml, array $domains, $parentid = null, array $map = [] ) { $total = 0; $childMap = []; $currentid = $parentid; while( $xml->read() === true ) { if( $xml->nodeType === \XMLReader::ELEMENT && $xml->name === 'catalogitem' ) { if( ( $node = $xml->expand() ) === false ) { $msg = sprintf( 'Expanding "%1$s" node failed', 'catalogitem' ); throw new \Aimeos\Controller\Jobs\Exception( $msg ); } if( ( $attr = $node->attributes->getNamedItem( 'ref' ) ) !== null ) { unset( $map[$attr->nodeValue] ); } $currentid = $this->importNode( $node, $domains, $parentid, $childMap ); $total++; } elseif( $xml->nodeType === \XMLReader::ELEMENT && $xml->name === 'catalog' ) { $this->importTree( $xml, $domains, $currentid, $childMap ); $childMap = []; } elseif( $xml->nodeType === \XMLReader::END_ELEMENT && $xml->name === 'catalog' ) { \Aimeos\MShop::create( $this->getContext(), 'catalog' )->deleteItems( $map ); break; } } }
[ "protected", "function", "importTree", "(", "\\", "XMLReader", "$", "xml", ",", "array", "$", "domains", ",", "$", "parentid", "=", "null", ",", "array", "$", "map", "=", "[", "]", ")", "{", "$", "total", "=", "0", ";", "$", "childMap", "=", "[", ...
Imports the catalog document @param \XMLReader $xml Catalog document to import @param string[] $domains List of domain names whose referenced items will be updated in the catalog items @param string|null $parentid ID of the parent catalog node @param array $map Associative list of catalog code as keys and category ID as values
[ "Imports", "the", "catalog", "document" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/jobs/src/Controller/Jobs/Catalog/Import/Xml/Standard.php#L254-L288
train
antonmedv/purephp
src/Server.php
Server.run
public function run() { $this->log("Server listening on {$this->host}:{$this->port}"); $this->socket->listen($this->port, $this->host); $this->loop->run(); }
php
public function run() { $this->log("Server listening on {$this->host}:{$this->port}"); $this->socket->listen($this->port, $this->host); $this->loop->run(); }
[ "public", "function", "run", "(", ")", "{", "$", "this", "->", "log", "(", "\"Server listening on {$this->host}:{$this->port}\"", ")", ";", "$", "this", "->", "socket", "->", "listen", "(", "$", "this", "->", "port", ",", "$", "this", "->", "host", ")", ...
Start event loop.
[ "Start", "event", "loop", "." ]
05aa6b44cea9b0457ec1e5e67e8278cd89d47f21
https://github.com/antonmedv/purephp/blob/05aa6b44cea9b0457ec1e5e67e8278cd89d47f21/src/Server.php#L75-L80
train
antonmedv/purephp
src/Server.php
Server.onConnection
public function onConnection(ConnectionInterface $connection) { $this->log('New connection from ' . $connection->getRemoteAddress()); $buffer = ''; $connection->on('data', function ($data) use (&$buffer, &$connection) { $buffer .= $data; if (strpos($buffer, Client::END_OF_COMMAND)) { $chunks = explode(Client::END_OF_COMMAND, $buffer); $count = count($chunks); $buffer = $chunks[$count - 1]; for ($i = 0; $i < $count - 1; $i++) { $command = json_decode($chunks[$i], true); $this->runCommand($command, $connection); } } }); }
php
public function onConnection(ConnectionInterface $connection) { $this->log('New connection from ' . $connection->getRemoteAddress()); $buffer = ''; $connection->on('data', function ($data) use (&$buffer, &$connection) { $buffer .= $data; if (strpos($buffer, Client::END_OF_COMMAND)) { $chunks = explode(Client::END_OF_COMMAND, $buffer); $count = count($chunks); $buffer = $chunks[$count - 1]; for ($i = 0; $i < $count - 1; $i++) { $command = json_decode($chunks[$i], true); $this->runCommand($command, $connection); } } }); }
[ "public", "function", "onConnection", "(", "ConnectionInterface", "$", "connection", ")", "{", "$", "this", "->", "log", "(", "'New connection from '", ".", "$", "connection", "->", "getRemoteAddress", "(", ")", ")", ";", "$", "buffer", "=", "''", ";", "$", ...
On every new connection add event handler to receive commands from clients. @param ConnectionInterface $connection
[ "On", "every", "new", "connection", "add", "event", "handler", "to", "receive", "commands", "from", "clients", "." ]
05aa6b44cea9b0457ec1e5e67e8278cd89d47f21
https://github.com/antonmedv/purephp/blob/05aa6b44cea9b0457ec1e5e67e8278cd89d47f21/src/Server.php#L87-L106
train
antonmedv/purephp
src/Server.php
Server.runCommand
private function runCommand($arguments, ConnectionInterface $connection) { try { $commandClass = array_shift($arguments); if (null !== $this->getLogger()) { $this->log( 'Command from ' . $connection->getRemoteAddress() . ": [$commandClass] " . join(', ', array_map('json_encode', $arguments)) ); } if (isset($this->commands[$commandClass])) { $command = $this->commands[$commandClass]; } else { if (!class_exists($commandClass)) { throw new \RuntimeException("Command class `$commandClass` does not found."); } $command = new $commandClass($this); if (!$command instanceof Command\CommandInterface) { throw new \RuntimeException("Every command must implement Command\\CommandInterface."); } $this->commands[$commandClass] = $command; } $result = $command->run($arguments, $connection); $result = [self::RESULT, $result]; } catch (\Exception $e) { $result = [self::EXCEPTION, get_class($e), $e->getMessage()]; $this->log('Exception: ' . $e->getMessage()); } $connection->write(json_encode($result) . self::END_OF_RESULT); }
php
private function runCommand($arguments, ConnectionInterface $connection) { try { $commandClass = array_shift($arguments); if (null !== $this->getLogger()) { $this->log( 'Command from ' . $connection->getRemoteAddress() . ": [$commandClass] " . join(', ', array_map('json_encode', $arguments)) ); } if (isset($this->commands[$commandClass])) { $command = $this->commands[$commandClass]; } else { if (!class_exists($commandClass)) { throw new \RuntimeException("Command class `$commandClass` does not found."); } $command = new $commandClass($this); if (!$command instanceof Command\CommandInterface) { throw new \RuntimeException("Every command must implement Command\\CommandInterface."); } $this->commands[$commandClass] = $command; } $result = $command->run($arguments, $connection); $result = [self::RESULT, $result]; } catch (\Exception $e) { $result = [self::EXCEPTION, get_class($e), $e->getMessage()]; $this->log('Exception: ' . $e->getMessage()); } $connection->write(json_encode($result) . self::END_OF_RESULT); }
[ "private", "function", "runCommand", "(", "$", "arguments", ",", "ConnectionInterface", "$", "connection", ")", "{", "try", "{", "$", "commandClass", "=", "array_shift", "(", "$", "arguments", ")", ";", "if", "(", "null", "!==", "$", "this", "->", "getLogg...
Detect and run command received from client. @param array $arguments @param ConnectionInterface $connection
[ "Detect", "and", "run", "command", "received", "from", "client", "." ]
05aa6b44cea9b0457ec1e5e67e8278cd89d47f21
https://github.com/antonmedv/purephp/blob/05aa6b44cea9b0457ec1e5e67e8278cd89d47f21/src/Server.php#L113-L156
train
aimeos/ai-controller-jobs
controller/jobs/src/Controller/Jobs/Attribute/Import/Xml/Standard.php
Standard.getItems
protected function getItems( array $nodes, array $ref ) { $keys = []; foreach( $nodes as $node ) { if( ( $attr = $node->attributes->getNamedItem( 'ref' ) ) !== null ) { $keys[] = $attr->nodeValue; } } $manager = \Aimeos\MShop::create( $this->getContext(), 'attribute' ); $search = $manager->createSearch()->setSlice( 0, count( $keys ) ); $search->setConditions( $search->compare( '==', 'attribute.key', $keys ) ); return $manager->searchItems( $search, $ref ); }
php
protected function getItems( array $nodes, array $ref ) { $keys = []; foreach( $nodes as $node ) { if( ( $attr = $node->attributes->getNamedItem( 'ref' ) ) !== null ) { $keys[] = $attr->nodeValue; } } $manager = \Aimeos\MShop::create( $this->getContext(), 'attribute' ); $search = $manager->createSearch()->setSlice( 0, count( $keys ) ); $search->setConditions( $search->compare( '==', 'attribute.key', $keys ) ); return $manager->searchItems( $search, $ref ); }
[ "protected", "function", "getItems", "(", "array", "$", "nodes", ",", "array", "$", "ref", ")", "{", "$", "keys", "=", "[", "]", ";", "foreach", "(", "$", "nodes", "as", "$", "node", ")", "{", "if", "(", "(", "$", "attr", "=", "$", "node", "->"...
Returns the attribute items for the given nodes @param \DomElement[] $nodes List of XML attribute item nodes @param string[] $ref Domain names of referenced items that should be fetched too @return \Aimeos\MShop\Attribute\Item\Iface[] Associative list of attribute items with IDs as keys
[ "Returns", "the", "attribute", "items", "for", "the", "given", "nodes" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/jobs/src/Controller/Jobs/Attribute/Import/Xml/Standard.php#L134-L150
train
aimeos/ai-controller-jobs
controller/jobs/src/Controller/Jobs/Product/Export/Sitemap/Standard.php
Standard.addItems
protected function addItems( \Aimeos\MW\Container\Content\Iface $content, array $items ) { $config = $this->getContext()->getConfig(); /** controller/jobs/product/export/sitemap/changefreq * Change frequency of the products * * Depending on how often the product content changes (e.g. price updates) * and the site map files are generated you can give search engines a * hint how often they should reindex your site. The site map schema * allows a few pre-defined strings for the change frequency: * * always * * hourly * * daily * * weekly * * monthly * * yearly * * never * * More information can be found at * {@link http://www.sitemaps.org/protocol.html#xmlTagDefinitions sitemap.org} * * @param string One of the pre-defined strings (see description) * @since 2015.01 * @category User * @category Developer * @see controller/jobs/product/export/sitemap/container/options * @see controller/jobs/product/export/sitemap/location * @see controller/jobs/product/export/sitemap/max-items * @see controller/jobs/product/export/sitemap/max-query */ $changefreq = $config->get( 'controller/jobs/product/export/sitemap/changefreq', 'daily' ); /** controller/jobs/product/export/sitemap/standard/template-items * Relative path to the XML items template of the product site map job controller. * * The template file contains the XML code and processing instructions * to generate the site map files. The configuration string is the path * to the template file relative to the templates directory (usually in * controller/jobs/templates). * * You can overwrite the template file configuration in extensions and * provide alternative templates. These alternative templates should be * named like the default one but with the string "standard" replaced by * an unique name. You may use the name of your project for this. If * you've implemented an alternative client class as well, "standard" * should be replaced by the name of the new class. * * @param string Relative path to the template creating XML code for the site map items * @since 2015.01 * @category Developer * @see controller/jobs/product/export/sitemap/standard/template-header * @see controller/jobs/product/export/sitemap/standard/template-footer * @see controller/jobs/product/export/sitemap/standard/template-index */ $tplconf = 'controller/jobs/product/export/sitemap/standard/template-items'; $default = 'product/export/sitemap-items-body-standard'; $context = $this->getContext(); $view = $context->getView(); $view->siteItems = $items; $view->siteFreq = $changefreq; $content->add( $view->render( $context->getConfig()->get( $tplconf, $default ) ) ); }
php
protected function addItems( \Aimeos\MW\Container\Content\Iface $content, array $items ) { $config = $this->getContext()->getConfig(); /** controller/jobs/product/export/sitemap/changefreq * Change frequency of the products * * Depending on how often the product content changes (e.g. price updates) * and the site map files are generated you can give search engines a * hint how often they should reindex your site. The site map schema * allows a few pre-defined strings for the change frequency: * * always * * hourly * * daily * * weekly * * monthly * * yearly * * never * * More information can be found at * {@link http://www.sitemaps.org/protocol.html#xmlTagDefinitions sitemap.org} * * @param string One of the pre-defined strings (see description) * @since 2015.01 * @category User * @category Developer * @see controller/jobs/product/export/sitemap/container/options * @see controller/jobs/product/export/sitemap/location * @see controller/jobs/product/export/sitemap/max-items * @see controller/jobs/product/export/sitemap/max-query */ $changefreq = $config->get( 'controller/jobs/product/export/sitemap/changefreq', 'daily' ); /** controller/jobs/product/export/sitemap/standard/template-items * Relative path to the XML items template of the product site map job controller. * * The template file contains the XML code and processing instructions * to generate the site map files. The configuration string is the path * to the template file relative to the templates directory (usually in * controller/jobs/templates). * * You can overwrite the template file configuration in extensions and * provide alternative templates. These alternative templates should be * named like the default one but with the string "standard" replaced by * an unique name. You may use the name of your project for this. If * you've implemented an alternative client class as well, "standard" * should be replaced by the name of the new class. * * @param string Relative path to the template creating XML code for the site map items * @since 2015.01 * @category Developer * @see controller/jobs/product/export/sitemap/standard/template-header * @see controller/jobs/product/export/sitemap/standard/template-footer * @see controller/jobs/product/export/sitemap/standard/template-index */ $tplconf = 'controller/jobs/product/export/sitemap/standard/template-items'; $default = 'product/export/sitemap-items-body-standard'; $context = $this->getContext(); $view = $context->getView(); $view->siteItems = $items; $view->siteFreq = $changefreq; $content->add( $view->render( $context->getConfig()->get( $tplconf, $default ) ) ); }
[ "protected", "function", "addItems", "(", "\\", "Aimeos", "\\", "MW", "\\", "Container", "\\", "Content", "\\", "Iface", "$", "content", ",", "array", "$", "items", ")", "{", "$", "config", "=", "$", "this", "->", "getContext", "(", ")", "->", "getConf...
Adds the given products to the content object for the site map file @param \Aimeos\MW\Container\Content\Iface $content File content object @param \Aimeos\MShop\Product\Item\Iface[] $items List of product items
[ "Adds", "the", "given", "products", "to", "the", "content", "object", "for", "the", "site", "map", "file" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/jobs/src/Controller/Jobs/Product/Export/Sitemap/Standard.php#L68-L133
train
aimeos/ai-controller-jobs
controller/jobs/src/Controller/Jobs/Product/Export/Sitemap/Standard.php
Standard.getConfig
protected function getConfig( $name, $default = null ) { $config = $this->getContext()->getConfig(); switch( $name ) { case 'domains': /** controller/jobs/product/export/sitemap/domains * List of associated items from other domains that should be fetched for the sitemap * * Products consist not only of the base data but also of texts, media * files, prices, attrbutes and other details. Those information is * associated to the products via their lists. Using the "domains" option * you can make more or less associated items available in the template. * * @param array List of domain names * @since 2018.07 * @category Developer * @category User * @see controller/jobs/product/export/sitemap/container/options * @see controller/jobs/product/export/sitemap/location * @see controller/jobs/product/export/sitemap/max-items * @see controller/jobs/product/export/sitemap/max-query * @see controller/jobs/product/export/sitemap/changefreq */ return $config->get( 'controller/jobs/product/export/sitemap/domains', $default ); case 'max-items': /** controller/jobs/product/export/sitemap/max-items * Maximum number of products per site map * * Each site map file must not contain more than 50,000 links and it's * size must be less than 10MB. If your product URLs are rather long * and one of your site map files is bigger than 10MB, you should set * the number of products per file to a smaller value until each file * is less than 10MB. * * More details about site maps can be found at * {@link http://www.sitemaps.org/protocol.html sitemaps.org} * * @param integer Number of products per file * @since 2015.01 * @category Developer * @category User * @see controller/jobs/product/export/sitemap/container/options * @see controller/jobs/product/export/sitemap/location * @see controller/jobs/product/export/sitemap/max-query * @see controller/jobs/product/export/sitemap/changefreq * @see controller/jobs/product/export/sitemap/domains */ return $config->get( 'controller/jobs/product/export/sitemap/max-items', 50000 ); case 'max-query': /** controller/jobs/product/export/sitemap/max-query * Maximum number of products per query * * The products are fetched from the database in bunches for efficient * retrieval. The higher the value, the lower the total time the database * is busy finding the records. Higher values also means that record * updates in the tables need to wait longer and the memory consumption * of the PHP process is higher. * * Note: The value of max-query must be smaller than or equal to * {@see controller/jobs/product/export/sitemap/max-items max-items} * * @param integer Number of products per query * @since 2015.01 * @category Developer * @see controller/jobs/product/export/sitemap/container/options * @see controller/jobs/product/export/sitemap/location * @see controller/jobs/product/export/sitemap/max-items * @see controller/jobs/product/export/sitemap/changefreq * @see controller/jobs/product/export/sitemap/domains */ return $config->get( 'controller/jobs/product/export/sitemap/max-query', 1000 ); } return $default; }
php
protected function getConfig( $name, $default = null ) { $config = $this->getContext()->getConfig(); switch( $name ) { case 'domains': /** controller/jobs/product/export/sitemap/domains * List of associated items from other domains that should be fetched for the sitemap * * Products consist not only of the base data but also of texts, media * files, prices, attrbutes and other details. Those information is * associated to the products via their lists. Using the "domains" option * you can make more or less associated items available in the template. * * @param array List of domain names * @since 2018.07 * @category Developer * @category User * @see controller/jobs/product/export/sitemap/container/options * @see controller/jobs/product/export/sitemap/location * @see controller/jobs/product/export/sitemap/max-items * @see controller/jobs/product/export/sitemap/max-query * @see controller/jobs/product/export/sitemap/changefreq */ return $config->get( 'controller/jobs/product/export/sitemap/domains', $default ); case 'max-items': /** controller/jobs/product/export/sitemap/max-items * Maximum number of products per site map * * Each site map file must not contain more than 50,000 links and it's * size must be less than 10MB. If your product URLs are rather long * and one of your site map files is bigger than 10MB, you should set * the number of products per file to a smaller value until each file * is less than 10MB. * * More details about site maps can be found at * {@link http://www.sitemaps.org/protocol.html sitemaps.org} * * @param integer Number of products per file * @since 2015.01 * @category Developer * @category User * @see controller/jobs/product/export/sitemap/container/options * @see controller/jobs/product/export/sitemap/location * @see controller/jobs/product/export/sitemap/max-query * @see controller/jobs/product/export/sitemap/changefreq * @see controller/jobs/product/export/sitemap/domains */ return $config->get( 'controller/jobs/product/export/sitemap/max-items', 50000 ); case 'max-query': /** controller/jobs/product/export/sitemap/max-query * Maximum number of products per query * * The products are fetched from the database in bunches for efficient * retrieval. The higher the value, the lower the total time the database * is busy finding the records. Higher values also means that record * updates in the tables need to wait longer and the memory consumption * of the PHP process is higher. * * Note: The value of max-query must be smaller than or equal to * {@see controller/jobs/product/export/sitemap/max-items max-items} * * @param integer Number of products per query * @since 2015.01 * @category Developer * @see controller/jobs/product/export/sitemap/container/options * @see controller/jobs/product/export/sitemap/location * @see controller/jobs/product/export/sitemap/max-items * @see controller/jobs/product/export/sitemap/changefreq * @see controller/jobs/product/export/sitemap/domains */ return $config->get( 'controller/jobs/product/export/sitemap/max-query', 1000 ); } return $default; }
[ "protected", "function", "getConfig", "(", "$", "name", ",", "$", "default", "=", "null", ")", "{", "$", "config", "=", "$", "this", "->", "getContext", "(", ")", "->", "getConfig", "(", ")", ";", "switch", "(", "$", "name", ")", "{", "case", "'dom...
Returns the configuration value for the given name @param string $name One of "domain", "max-items" or "max-query" @param mixed $default Default value if name is unknown @return mixed Configuration value
[ "Returns", "the", "configuration", "value", "for", "the", "given", "name" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/jobs/src/Controller/Jobs/Product/Export/Sitemap/Standard.php#L402-L480
train
aimeos/ai-controller-jobs
controller/jobs/src/Controller/Jobs/Customer/Import/Xml/Standard.php
Standard.process
protected function process( \Aimeos\MShop\Customer\Item\Iface $item, \DomElement $node ) { $list = []; foreach( $node->attributes as $attr ) { $list[$attr->nodeName] = $attr->nodeValue; } foreach( $node->childNodes as $tag ) { if( in_array( $tag->nodeName, ['address', 'lists', 'property', 'group'] ) ) { $item = $this->getProcessor( $tag->nodeName, 'customer' )->process( $item, $tag ); } else { $list[$tag->nodeName] = $tag->nodeValue; } } return $item->fromArray( $list, true ); }
php
protected function process( \Aimeos\MShop\Customer\Item\Iface $item, \DomElement $node ) { $list = []; foreach( $node->attributes as $attr ) { $list[$attr->nodeName] = $attr->nodeValue; } foreach( $node->childNodes as $tag ) { if( in_array( $tag->nodeName, ['address', 'lists', 'property', 'group'] ) ) { $item = $this->getProcessor( $tag->nodeName, 'customer' )->process( $item, $tag ); } else { $list[$tag->nodeName] = $tag->nodeValue; } } return $item->fromArray( $list, true ); }
[ "protected", "function", "process", "(", "\\", "Aimeos", "\\", "MShop", "\\", "Customer", "\\", "Item", "\\", "Iface", "$", "item", ",", "\\", "DomElement", "$", "node", ")", "{", "$", "list", "=", "[", "]", ";", "foreach", "(", "$", "node", "->", ...
Updates the customer item and its referenced items using the given DOM node @param \Aimeos\MShop\Customer\Item\Iface $item Customer item object to update @param \DomElement $node DOM node used for updateding the customer item @return \Aimeos\MShop\Customer\Item\Iface $item Updated customer item object
[ "Updates", "the", "customer", "item", "and", "its", "referenced", "items", "using", "the", "given", "DOM", "node" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/jobs/src/Controller/Jobs/Customer/Import/Xml/Standard.php#L294-L312
train
aimeos/ai-controller-jobs
controller/jobs/src/Controller/Jobs/Coupon/Import/Csv/Code/Standard.php
Standard.import
protected function import( array $items, array $data, $couponId, \Aimeos\Controller\Common\Coupon\Import\Csv\Processor\Iface $processor ) { $errors = 0; $context = $this->getContext(); $manager = \Aimeos\MShop::create( $context, 'coupon/code' ); foreach( $data as $code => $list ) { $manager->begin(); try { if( isset( $items[$code] ) ) { $item = $items[$code]; } else { $item = $manager->createItem(); } $item->setParentId( $couponId ); $list = $processor->process( $item, $list ); $manager->commit(); } catch( \Exception $e ) { $manager->rollback(); $msg = sprintf( 'Unable to import coupon with code "%1$s": %2$s', $code, $e->getMessage() ); $context->getLogger()->log( $msg ); $errors++; } } return $errors; }
php
protected function import( array $items, array $data, $couponId, \Aimeos\Controller\Common\Coupon\Import\Csv\Processor\Iface $processor ) { $errors = 0; $context = $this->getContext(); $manager = \Aimeos\MShop::create( $context, 'coupon/code' ); foreach( $data as $code => $list ) { $manager->begin(); try { if( isset( $items[$code] ) ) { $item = $items[$code]; } else { $item = $manager->createItem(); } $item->setParentId( $couponId ); $list = $processor->process( $item, $list ); $manager->commit(); } catch( \Exception $e ) { $manager->rollback(); $msg = sprintf( 'Unable to import coupon with code "%1$s": %2$s', $code, $e->getMessage() ); $context->getLogger()->log( $msg ); $errors++; } } return $errors; }
[ "protected", "function", "import", "(", "array", "$", "items", ",", "array", "$", "data", ",", "$", "couponId", ",", "\\", "Aimeos", "\\", "Controller", "\\", "Common", "\\", "Coupon", "\\", "Import", "\\", "Csv", "\\", "Processor", "\\", "Iface", "$", ...
Imports the CSV data and creates new coupons or updates existing ones @param \Aimeos\MShop\Coupon\Item\Code\Iface[] $items List of coupons code items @param array $data Associative list of import data as index/value pairs @param string $couponId ID of the coupon item the coupon code should be added to @param \Aimeos\Controller\Common\Coupon\Import\Csv\Processor\Iface $processor Processor object @return integer Number of coupons that couldn't be imported @throws \Aimeos\Controller\Jobs\Exception
[ "Imports", "the", "CSV", "data", "and", "creates", "new", "coupons", "or", "updates", "existing", "ones" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/jobs/src/Controller/Jobs/Coupon/Import/Csv/Code/Standard.php#L278-L314
train
aimeos/ai-controller-jobs
controller/common/src/Controller/Common/Coupon/Import/Csv/Base.php
Base.getData
protected function getData( \Aimeos\MW\Container\Content\Iface $content, $maxcnt, $codePos ) { $count = 0; $data = []; while( $content->valid() && $count++ < $maxcnt ) { $row = $content->current(); $data[$row[$codePos]] = $row; $content->next(); } return $data; }
php
protected function getData( \Aimeos\MW\Container\Content\Iface $content, $maxcnt, $codePos ) { $count = 0; $data = []; while( $content->valid() && $count++ < $maxcnt ) { $row = $content->current(); $data[$row[$codePos]] = $row; $content->next(); } return $data; }
[ "protected", "function", "getData", "(", "\\", "Aimeos", "\\", "MW", "\\", "Container", "\\", "Content", "\\", "Iface", "$", "content", ",", "$", "maxcnt", ",", "$", "codePos", ")", "{", "$", "count", "=", "0", ";", "$", "data", "=", "[", "]", ";",...
Returns the rows from the CSV file up to the maximum count @param \Aimeos\MW\Container\Content\Iface $content CSV content object @param integer $maxcnt Maximum number of rows that should be retrieved at once @param integer $codePos Column position which contains the unique coupon code (starting from 0) @return array List of arrays with coupon codes as keys and list of values from the CSV file
[ "Returns", "the", "rows", "from", "the", "CSV", "file", "up", "to", "the", "maximum", "count" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/common/src/Controller/Common/Coupon/Import/Csv/Base.php#L54-L67
train
aimeos/ai-controller-jobs
controller/common/src/Controller/Common/Coupon/Import/Csv/Base.php
Base.getMappedChunk
protected function getMappedChunk( array &$data, array $mapping ) { $idx = 0; $map = []; foreach( $mapping as $pos => $key ) { if( isset( $map[$idx][$key] ) ) { $idx++; } if( isset( $data[$pos] ) ) { $map[$idx][$key] = $data[$pos]; unset( $data[$pos] ); } } return $map; }
php
protected function getMappedChunk( array &$data, array $mapping ) { $idx = 0; $map = []; foreach( $mapping as $pos => $key ) { if( isset( $map[$idx][$key] ) ) { $idx++; } if( isset( $data[$pos] ) ) { $map[$idx][$key] = $data[$pos]; unset( $data[$pos] ); } } return $map; }
[ "protected", "function", "getMappedChunk", "(", "array", "&", "$", "data", ",", "array", "$", "mapping", ")", "{", "$", "idx", "=", "0", ";", "$", "map", "=", "[", "]", ";", "foreach", "(", "$", "mapping", "as", "$", "pos", "=>", "$", "key", ")",...
Returns the mapped data from the CSV line @param array $data List of CSV fields with position as key and domain item key as value (mapped data is removed) @param array $mapping List of domain item keys with the CSV field position as key @return array List of associative arrays containing the chunked properties
[ "Returns", "the", "mapped", "data", "from", "the", "CSV", "line" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/common/src/Controller/Common/Coupon/Import/Csv/Base.php#L101-L120
train
aimeos/ai-controller-jobs
controller/common/src/Controller/Common/Coupon/Import/Csv/Base.php
Base.getProcessors
protected function getProcessors( array $mappings ) { $context = $this->getContext(); $config = $context->getConfig(); $object = new \Aimeos\Controller\Common\Coupon\Import\Csv\Processor\Done( $context, [] ); foreach( $mappings as $type => $mapping ) { if( ctype_alnum( $type ) === false ) { $classname = is_string( $type ) ? '\\Aimeos\\Controller\\Common\\Coupon\\Import\\Csv\\Processor\\' . $type : '<not a string>'; throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); } $name = $config->get( 'controller/common/coupon/import/csv/processor/' . $type . '/name', 'Standard' ); if( ctype_alnum( $name ) === false ) { $classname = is_string( $name ) ? '\\Aimeos\\Controller\\Common\\Coupon\\Import\\Csv\\Processor\\' . $type . '\\' . $name : '<not a string>'; throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); } $classname = '\\Aimeos\\Controller\\Common\\Coupon\\Import\\Csv\\Processor\\' . ucfirst( $type ) . '\\' . $name; if( class_exists( $classname ) === false ) { throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Class "%1$s" not found', $classname ) ); } $object = new $classname( $context, $mapping, $object ); \Aimeos\MW\Common\Base::checkClass( '\\Aimeos\\Controller\\Common\\Coupon\\Import\\Csv\\Processor\\Iface', $object ); } return $object; }
php
protected function getProcessors( array $mappings ) { $context = $this->getContext(); $config = $context->getConfig(); $object = new \Aimeos\Controller\Common\Coupon\Import\Csv\Processor\Done( $context, [] ); foreach( $mappings as $type => $mapping ) { if( ctype_alnum( $type ) === false ) { $classname = is_string( $type ) ? '\\Aimeos\\Controller\\Common\\Coupon\\Import\\Csv\\Processor\\' . $type : '<not a string>'; throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); } $name = $config->get( 'controller/common/coupon/import/csv/processor/' . $type . '/name', 'Standard' ); if( ctype_alnum( $name ) === false ) { $classname = is_string( $name ) ? '\\Aimeos\\Controller\\Common\\Coupon\\Import\\Csv\\Processor\\' . $type . '\\' . $name : '<not a string>'; throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); } $classname = '\\Aimeos\\Controller\\Common\\Coupon\\Import\\Csv\\Processor\\' . ucfirst( $type ) . '\\' . $name; if( class_exists( $classname ) === false ) { throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Class "%1$s" not found', $classname ) ); } $object = new $classname( $context, $mapping, $object ); \Aimeos\MW\Common\Base::checkClass( '\\Aimeos\\Controller\\Common\\Coupon\\Import\\Csv\\Processor\\Iface', $object ); } return $object; }
[ "protected", "function", "getProcessors", "(", "array", "$", "mappings", ")", "{", "$", "context", "=", "$", "this", "->", "getContext", "(", ")", ";", "$", "config", "=", "$", "context", "->", "getConfig", "(", ")", ";", "$", "object", "=", "new", "...
Returns the processor object for saving the coupon related information @param array $mappings Associative list of processor types as keys and index/data mappings as values @return \Aimeos\Controller\Common\Coupon\Import\Csv\Processor\Iface Processor object
[ "Returns", "the", "processor", "object", "for", "saving", "the", "coupon", "related", "information" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/common/src/Controller/Common/Coupon/Import/Csv/Base.php#L129-L163
train
aimeos/ai-controller-jobs
controller/jobs/src/Controller/Jobs/Catalog/Export/Sitemap/Standard.php
Standard.createContent
protected function createContent( \Aimeos\MW\Container\Iface $container, $filenum ) { /** controller/jobs/catalog/export/sitemap/standard/template-header * Relative path to the XML site map header template of the catalog site map job controller. * * The template file contains the XML code and processing instructions * to generate the site map header. The configuration string is the path * to the template file relative to the templates directory (usually in * controller/jobs/templates). * * You can overwrite the template file configuration in extensions and * provide alternative templates. These alternative templates should be * named like the default one but with the string "standard" replaced by * an unique name. You may use the name of your project for this. If * you've implemented an alternative client class as well, "standard" * should be replaced by the name of the new class. * * @param string Relative path to the template creating XML code for the site map header * @since 2019.02 * @category Developer * @see controller/jobs/catalog/export/sitemap/standard/template-items * @see controller/jobs/catalog/export/sitemap/standard/template-footer * @see controller/jobs/catalog/export/sitemap/standard/template-index */ $tplconf = 'controller/jobs/catalog/export/sitemap/standard/template-header'; $default = 'catalog/export/sitemap-items-header-standard'; $context = $this->getContext(); $view = $context->getView(); $content = $container->create( $this->getFilename( $filenum ) ); $content->add( $view->render( $context->getConfig()->get( $tplconf, $default ) ) ); $container->add( $content ); return $content; }
php
protected function createContent( \Aimeos\MW\Container\Iface $container, $filenum ) { /** controller/jobs/catalog/export/sitemap/standard/template-header * Relative path to the XML site map header template of the catalog site map job controller. * * The template file contains the XML code and processing instructions * to generate the site map header. The configuration string is the path * to the template file relative to the templates directory (usually in * controller/jobs/templates). * * You can overwrite the template file configuration in extensions and * provide alternative templates. These alternative templates should be * named like the default one but with the string "standard" replaced by * an unique name. You may use the name of your project for this. If * you've implemented an alternative client class as well, "standard" * should be replaced by the name of the new class. * * @param string Relative path to the template creating XML code for the site map header * @since 2019.02 * @category Developer * @see controller/jobs/catalog/export/sitemap/standard/template-items * @see controller/jobs/catalog/export/sitemap/standard/template-footer * @see controller/jobs/catalog/export/sitemap/standard/template-index */ $tplconf = 'controller/jobs/catalog/export/sitemap/standard/template-header'; $default = 'catalog/export/sitemap-items-header-standard'; $context = $this->getContext(); $view = $context->getView(); $content = $container->create( $this->getFilename( $filenum ) ); $content->add( $view->render( $context->getConfig()->get( $tplconf, $default ) ) ); $container->add( $content ); return $content; }
[ "protected", "function", "createContent", "(", "\\", "Aimeos", "\\", "MW", "\\", "Container", "\\", "Iface", "$", "container", ",", "$", "filenum", ")", "{", "/** controller/jobs/catalog/export/sitemap/standard/template-header\n\t\t * Relative path to the XML site map header te...
Creates a new site map content object @param \Aimeos\MW\Container\Iface $container Container object @param integer $filenum New file number @return \Aimeos\MW\Container\Content\Iface New content object
[ "Creates", "a", "new", "site", "map", "content", "object" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/jobs/src/Controller/Jobs/Catalog/Export/Sitemap/Standard.php#L218-L253
train
aimeos/ai-controller-jobs
controller/jobs/src/Controller/Jobs/Catalog/Export/Sitemap/Standard.php
Standard.closeContent
protected function closeContent( \Aimeos\MW\Container\Content\Iface $content ) { /** controller/jobs/catalog/export/sitemap/standard/template-footer * Relative path to the XML site map footer template of the catalog site map job controller. * * The template file contains the XML code and processing instructions * to generate the site map footer. The configuration string is the path * to the template file relative to the templates directory (usually in * controller/jobs/templates). * * You can overwrite the template file configuration in extensions and * provide alternative templates. These alternative templates should be * named like the default one but with the string "standard" replaced by * an unique name. You may use the name of your project for this. If * you've implemented an alternative client class as well, "standard" * should be replaced by the name of the new class. * * @param string Relative path to the template creating XML code for the site map footer * @since 2019.02 * @category Developer * @see controller/jobs/catalog/export/sitemap/standard/template-header * @see controller/jobs/catalog/export/sitemap/standard/template-items * @see controller/jobs/catalog/export/sitemap/standard/template-index */ $tplconf = 'controller/jobs/catalog/export/sitemap/standard/template-footer'; $default = 'catalog/export/sitemap-items-footer-standard'; $context = $this->getContext(); $view = $context->getView(); $content->add( $view->render( $context->getConfig()->get( $tplconf, $default ) ) ); }
php
protected function closeContent( \Aimeos\MW\Container\Content\Iface $content ) { /** controller/jobs/catalog/export/sitemap/standard/template-footer * Relative path to the XML site map footer template of the catalog site map job controller. * * The template file contains the XML code and processing instructions * to generate the site map footer. The configuration string is the path * to the template file relative to the templates directory (usually in * controller/jobs/templates). * * You can overwrite the template file configuration in extensions and * provide alternative templates. These alternative templates should be * named like the default one but with the string "standard" replaced by * an unique name. You may use the name of your project for this. If * you've implemented an alternative client class as well, "standard" * should be replaced by the name of the new class. * * @param string Relative path to the template creating XML code for the site map footer * @since 2019.02 * @category Developer * @see controller/jobs/catalog/export/sitemap/standard/template-header * @see controller/jobs/catalog/export/sitemap/standard/template-items * @see controller/jobs/catalog/export/sitemap/standard/template-index */ $tplconf = 'controller/jobs/catalog/export/sitemap/standard/template-footer'; $default = 'catalog/export/sitemap-items-footer-standard'; $context = $this->getContext(); $view = $context->getView(); $content->add( $view->render( $context->getConfig()->get( $tplconf, $default ) ) ); }
[ "protected", "function", "closeContent", "(", "\\", "Aimeos", "\\", "MW", "\\", "Container", "\\", "Content", "\\", "Iface", "$", "content", ")", "{", "/** controller/jobs/catalog/export/sitemap/standard/template-footer\n\t\t * Relative path to the XML site map footer template of...
Closes the site map content object @param \Aimeos\MW\Container\Content\Iface $content
[ "Closes", "the", "site", "map", "content", "object" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/jobs/src/Controller/Jobs/Catalog/Export/Sitemap/Standard.php#L261-L292
train
aimeos/ai-controller-jobs
controller/jobs/src/Controller/Jobs/Catalog/Export/Sitemap/Standard.php
Standard.createSitemapIndex
protected function createSitemapIndex( \Aimeos\MW\Container\Iface $container, array $files ) { /** controller/jobs/catalog/export/sitemap/standard/template-index * Relative path to the XML site map index template of the catalog site map job controller. * * The template file contains the XML code and processing instructions * to generate the site map index files. The configuration string is the path * to the template file relative to the templates directory (usually in * controller/jobs/templates). * * You can overwrite the template file configuration in extensions and * provide alternative templates. These alternative templates should be * named like the default one but with the string "standard" replaced by * an unique name. You may use the name of your project for this. If * you've implemented an alternative client class as well, "standard" * should be replaced by the name of the new class. * * @param string Relative path to the template creating XML code for the site map index * @since 2019.02 * @category Developer * @see controller/jobs/catalog/export/sitemap/standard/template-header * @see controller/jobs/catalog/export/sitemap/standard/template-items * @see controller/jobs/catalog/export/sitemap/standard/template-footer */ $tplconf = 'controller/jobs/catalog/export/sitemap/standard/template-index'; $default = 'catalog/export/sitemap-index-standard'; $context = $this->getContext(); $view = $context->getView(); $view->siteFiles = $files; $content = $container->create( 'aimeos-catalog-sitemap-index.xml' ); $content->add( $view->render( $context->getConfig()->get( $tplconf, $default ) ) ); $container->add( $content ); }
php
protected function createSitemapIndex( \Aimeos\MW\Container\Iface $container, array $files ) { /** controller/jobs/catalog/export/sitemap/standard/template-index * Relative path to the XML site map index template of the catalog site map job controller. * * The template file contains the XML code and processing instructions * to generate the site map index files. The configuration string is the path * to the template file relative to the templates directory (usually in * controller/jobs/templates). * * You can overwrite the template file configuration in extensions and * provide alternative templates. These alternative templates should be * named like the default one but with the string "standard" replaced by * an unique name. You may use the name of your project for this. If * you've implemented an alternative client class as well, "standard" * should be replaced by the name of the new class. * * @param string Relative path to the template creating XML code for the site map index * @since 2019.02 * @category Developer * @see controller/jobs/catalog/export/sitemap/standard/template-header * @see controller/jobs/catalog/export/sitemap/standard/template-items * @see controller/jobs/catalog/export/sitemap/standard/template-footer */ $tplconf = 'controller/jobs/catalog/export/sitemap/standard/template-index'; $default = 'catalog/export/sitemap-index-standard'; $context = $this->getContext(); $view = $context->getView(); $view->siteFiles = $files; $content = $container->create( 'aimeos-catalog-sitemap-index.xml' ); $content->add( $view->render( $context->getConfig()->get( $tplconf, $default ) ) ); $container->add( $content ); }
[ "protected", "function", "createSitemapIndex", "(", "\\", "Aimeos", "\\", "MW", "\\", "Container", "\\", "Iface", "$", "container", ",", "array", "$", "files", ")", "{", "/** controller/jobs/catalog/export/sitemap/standard/template-index\n\t\t * Relative path to the XML site ...
Adds the content for the site map index file @param \Aimeos\MW\Container\Iface $container File container object @param array $files List of generated site map file names
[ "Adds", "the", "content", "for", "the", "site", "map", "index", "file" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/jobs/src/Controller/Jobs/Catalog/Export/Sitemap/Standard.php#L301-L336
train
aimeos/ai-controller-jobs
controller/common/src/Controller/Common/Product/Import/Csv/Base.php
Base.convertData
protected function convertData( array $convlist, array $data ) { foreach( $convlist as $idx => $converter ) { foreach( $data as $code => $list ) { if( isset( $list[$idx] ) ) { $data[$code][$idx] = $converter->translate( $list[$idx] ); } } } return $data; }
php
protected function convertData( array $convlist, array $data ) { foreach( $convlist as $idx => $converter ) { foreach( $data as $code => $list ) { if( isset( $list[$idx] ) ) { $data[$code][$idx] = $converter->translate( $list[$idx] ); } } } return $data; }
[ "protected", "function", "convertData", "(", "array", "$", "convlist", ",", "array", "$", "data", ")", "{", "foreach", "(", "$", "convlist", "as", "$", "idx", "=>", "$", "converter", ")", "{", "foreach", "(", "$", "data", "as", "$", "code", "=>", "$"...
Converts the CSV field data using the available converter objects @param array $convlist Associative list of CSV field indexes and converter objects @param array $data Associative list of product codes and lists of CSV field indexes and their data @return array Associative list of CSV field indexes and their converted data
[ "Converts", "the", "CSV", "field", "data", "using", "the", "available", "converter", "objects" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/common/src/Controller/Common/Product/Import/Csv/Base.php#L30-L43
train
aimeos/ai-controller-jobs
controller/common/src/Controller/Common/Product/Import/Csv/Base.php
Base.getCache
protected function getCache( $type, $name = null ) { $context = $this->getContext(); $config = $context->getConfig(); if( ctype_alnum( $type ) === false ) { $classname = is_string( $name ) ? '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\' . $type : '<not a string>'; throw new \Aimeos\Controller\Common\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); } if( $name === null ) { $name = $config->get( 'controller/common/product/import/csv/cache/' . $type . '/name', 'Standard' ); } if( ctype_alnum( $name ) === false ) { $classname = is_string( $name ) ? '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\' . $type . '\\' . $name : '<not a string>'; throw new \Aimeos\Controller\Common\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); } $classname = '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\' . ucfirst( $type ) . '\\' . $name; if( class_exists( $classname ) === false ) { throw new \Aimeos\Controller\Common\Exception( sprintf( 'Class "%1$s" not found', $classname ) ); } $object = new $classname( $context ); \Aimeos\MW\Common\Base::checkClass( '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\Iface', $object ); return $object; }
php
protected function getCache( $type, $name = null ) { $context = $this->getContext(); $config = $context->getConfig(); if( ctype_alnum( $type ) === false ) { $classname = is_string( $name ) ? '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\' . $type : '<not a string>'; throw new \Aimeos\Controller\Common\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); } if( $name === null ) { $name = $config->get( 'controller/common/product/import/csv/cache/' . $type . '/name', 'Standard' ); } if( ctype_alnum( $name ) === false ) { $classname = is_string( $name ) ? '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\' . $type . '\\' . $name : '<not a string>'; throw new \Aimeos\Controller\Common\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); } $classname = '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\' . ucfirst( $type ) . '\\' . $name; if( class_exists( $classname ) === false ) { throw new \Aimeos\Controller\Common\Exception( sprintf( 'Class "%1$s" not found', $classname ) ); } $object = new $classname( $context ); \Aimeos\MW\Common\Base::checkClass( '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\Iface', $object ); return $object; }
[ "protected", "function", "getCache", "(", "$", "type", ",", "$", "name", "=", "null", ")", "{", "$", "context", "=", "$", "this", "->", "getContext", "(", ")", ";", "$", "config", "=", "$", "context", "->", "getConfig", "(", ")", ";", "if", "(", ...
Returns the cache object for the given type @param string $type Type of the cached data @param string|null Name of the cache implementation @return \Aimeos\Controller\Common\Product\Import\Csv\Cache\Iface Cache object
[ "Returns", "the", "cache", "object", "for", "the", "given", "type" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/common/src/Controller/Common/Product/Import/Csv/Base.php#L53-L85
train
aimeos/ai-controller-jobs
controller/common/src/Controller/Common/Product/Import/Csv/Base.php
Base.getConverterList
protected function getConverterList( array $convmap ) { $convlist = []; foreach( $convmap as $idx => $name ) { $convlist[$idx] = \Aimeos\MW\Convert\Factory::createConverter( $name ); } return $convlist; }
php
protected function getConverterList( array $convmap ) { $convlist = []; foreach( $convmap as $idx => $name ) { $convlist[$idx] = \Aimeos\MW\Convert\Factory::createConverter( $name ); } return $convlist; }
[ "protected", "function", "getConverterList", "(", "array", "$", "convmap", ")", "{", "$", "convlist", "=", "[", "]", ";", "foreach", "(", "$", "convmap", "as", "$", "idx", "=>", "$", "name", ")", "{", "$", "convlist", "[", "$", "idx", "]", "=", "\\...
Returns the list of converter objects based on the given converter map @param array $convmap List of converter names for the values at the position in the CSV file @return array Associative list of positions and converter objects
[ "Returns", "the", "list", "of", "converter", "objects", "based", "on", "the", "given", "converter", "map" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/common/src/Controller/Common/Product/Import/Csv/Base.php#L94-L103
train
aimeos/ai-controller-jobs
controller/common/src/Controller/Common/Product/Import/Csv/Base.php
Base.getProducts
protected function getProducts( array $codes, array $domains ) { $result = []; $manager = \Aimeos\MShop::create( $this->getContext(), 'product' ); $search = $manager->createSearch(); $search->setConditions( $search->compare( '==', 'product.code', $codes ) ); $search->setSlice( 0, count( $codes ) ); foreach( $manager->searchItems( $search, $domains ) as $item ) { $result[$item->getCode()] = $item; } return $result; }
php
protected function getProducts( array $codes, array $domains ) { $result = []; $manager = \Aimeos\MShop::create( $this->getContext(), 'product' ); $search = $manager->createSearch(); $search->setConditions( $search->compare( '==', 'product.code', $codes ) ); $search->setSlice( 0, count( $codes ) ); foreach( $manager->searchItems( $search, $domains ) as $item ) { $result[$item->getCode()] = $item; } return $result; }
[ "protected", "function", "getProducts", "(", "array", "$", "codes", ",", "array", "$", "domains", ")", "{", "$", "result", "=", "[", "]", ";", "$", "manager", "=", "\\", "Aimeos", "\\", "MShop", "::", "create", "(", "$", "this", "->", "getContext", "...
Returns the product items for the given codes @param array $codes List of product codes @param array $domains List of domains whose items should be fetched too @return array Associative list of product codes as key and product items as value
[ "Returns", "the", "product", "items", "for", "the", "given", "codes" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/common/src/Controller/Common/Product/Import/Csv/Base.php#L293-L307
train
aimeos/ai-controller-jobs
controller/jobs/src/Controller/Jobs/Subscription/Export/Csv/Standard.php
Standard.addJob
protected function addJob( $context, $path ) { $manager = \Aimeos\MAdmin::create( $context, 'job' ); $item = $manager->createItem(); $item->setResult( ['file' => $path] ); $item->setLabel( $path ); $manager->saveItem( $item, false ); }
php
protected function addJob( $context, $path ) { $manager = \Aimeos\MAdmin::create( $context, 'job' ); $item = $manager->createItem(); $item->setResult( ['file' => $path] ); $item->setLabel( $path ); $manager->saveItem( $item, false ); }
[ "protected", "function", "addJob", "(", "$", "context", ",", "$", "path", ")", "{", "$", "manager", "=", "\\", "Aimeos", "\\", "MAdmin", "::", "create", "(", "$", "context", ",", "'job'", ")", ";", "$", "item", "=", "$", "manager", "->", "createItem"...
Creates a new job entry for the exported file @param \Aimeos\MShop\Context\Item\Iface $context Context item @param string $path Absolute path to the exported file
[ "Creates", "a", "new", "job", "entry", "for", "the", "exported", "file" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/jobs/src/Controller/Jobs/Subscription/Export/Csv/Standard.php#L142-L151
train
aimeos/ai-controller-jobs
controller/jobs/src/Controller/Jobs/Subscription/Export/Csv/Standard.php
Standard.getContainer
protected function getContainer() { $config = $this->getContext()->getConfig(); /** controller/jobs/subscription/export/csv/location * Temporary file or directory where the content is stored which should be exported * * The path can point to any supported container format as long as the * content is in CSV format, e.g. * * Directory container / CSV file * * Zip container / compressed CSV file * * PHPExcel container / PHPExcel sheet * * @param string Absolute file or directory path * @since 2018.04 * @category Developer * @category User * @see controller/jobs/subscription/export/csv/container/type * @see controller/jobs/subscription/export/csv/container/content * @see controller/jobs/subscription/export/csv/container/options */ $location = $config->get( 'controller/jobs/subscription/export/csv/location', sys_get_temp_dir() ); /** controller/jobs/subscription/export/csv/container/type * Nave of the container type to read the data from * * The container type tells the exporter how it should retrieve the data. * There are currently three container types that support the necessary * CSV content: * * Directory * * Zip * * PHPExcel * * '''Note:''' For the PHPExcel container, you need to install the * "ai-container" extension. * * @param string Container type name * @since 2015.05 * @category Developer * @category User * @see controller/jobs/subscription/export/csv/location * @see controller/jobs/subscription/export/csv/container/content * @see controller/jobs/subscription/export/csv/container/options */ $container = $config->get( 'controller/jobs/subscription/export/csv/container/type', 'Directory' ); /** controller/jobs/subscription/export/csv/container/content * Name of the content type inside the container to read the data from * * The content type must always be a CSV-like format and there are * currently two format types that are supported: * * CSV * * PHPExcel * * '''Note:''' for the PHPExcel content type, you need to install the * "ai-container" extension. * * @param array Content type name * @since 2015.05 * @category Developer * @category User * @see controller/jobs/subscription/export/csv/location * @see controller/jobs/subscription/export/csv/container/type * @see controller/jobs/subscription/export/csv/container/options */ $content = $config->get( 'controller/jobs/subscription/export/csv/container/content', 'CSV' ); /** controller/jobs/subscription/export/csv/container/options * List of file container options for the subscription export files * * Some container/content type allow you to hand over additional settings * for configuration. Please have a look at the article about * {@link http://aimeos.org/docs/Developers/Utility/Create_and_read_files container/content files} * for more information. * * @param array Associative list of option name/value pairs * @since 2015.05 * @category Developer * @category User * @see controller/jobs/subscription/export/csv/location * @see controller/jobs/subscription/export/csv/container/content * @see controller/jobs/subscription/export/csv/container/type */ $options = $config->get( 'controller/jobs/subscription/export/csv/container/options', [] ); return \Aimeos\MW\Container\Factory::getContainer( $location, $container, $content, $options ); }
php
protected function getContainer() { $config = $this->getContext()->getConfig(); /** controller/jobs/subscription/export/csv/location * Temporary file or directory where the content is stored which should be exported * * The path can point to any supported container format as long as the * content is in CSV format, e.g. * * Directory container / CSV file * * Zip container / compressed CSV file * * PHPExcel container / PHPExcel sheet * * @param string Absolute file or directory path * @since 2018.04 * @category Developer * @category User * @see controller/jobs/subscription/export/csv/container/type * @see controller/jobs/subscription/export/csv/container/content * @see controller/jobs/subscription/export/csv/container/options */ $location = $config->get( 'controller/jobs/subscription/export/csv/location', sys_get_temp_dir() ); /** controller/jobs/subscription/export/csv/container/type * Nave of the container type to read the data from * * The container type tells the exporter how it should retrieve the data. * There are currently three container types that support the necessary * CSV content: * * Directory * * Zip * * PHPExcel * * '''Note:''' For the PHPExcel container, you need to install the * "ai-container" extension. * * @param string Container type name * @since 2015.05 * @category Developer * @category User * @see controller/jobs/subscription/export/csv/location * @see controller/jobs/subscription/export/csv/container/content * @see controller/jobs/subscription/export/csv/container/options */ $container = $config->get( 'controller/jobs/subscription/export/csv/container/type', 'Directory' ); /** controller/jobs/subscription/export/csv/container/content * Name of the content type inside the container to read the data from * * The content type must always be a CSV-like format and there are * currently two format types that are supported: * * CSV * * PHPExcel * * '''Note:''' for the PHPExcel content type, you need to install the * "ai-container" extension. * * @param array Content type name * @since 2015.05 * @category Developer * @category User * @see controller/jobs/subscription/export/csv/location * @see controller/jobs/subscription/export/csv/container/type * @see controller/jobs/subscription/export/csv/container/options */ $content = $config->get( 'controller/jobs/subscription/export/csv/container/content', 'CSV' ); /** controller/jobs/subscription/export/csv/container/options * List of file container options for the subscription export files * * Some container/content type allow you to hand over additional settings * for configuration. Please have a look at the article about * {@link http://aimeos.org/docs/Developers/Utility/Create_and_read_files container/content files} * for more information. * * @param array Associative list of option name/value pairs * @since 2015.05 * @category Developer * @category User * @see controller/jobs/subscription/export/csv/location * @see controller/jobs/subscription/export/csv/container/content * @see controller/jobs/subscription/export/csv/container/type */ $options = $config->get( 'controller/jobs/subscription/export/csv/container/options', [] ); return \Aimeos\MW\Container\Factory::getContainer( $location, $container, $content, $options ); }
[ "protected", "function", "getContainer", "(", ")", "{", "$", "config", "=", "$", "this", "->", "getContext", "(", ")", "->", "getConfig", "(", ")", ";", "/** controller/jobs/subscription/export/csv/location\n\t\t * Temporary file or directory where the content is stored which...
Opens and returns the container which includes the subscription data @return \Aimeos\MW\Container\Iface Container object
[ "Opens", "and", "returns", "the", "container", "which", "includes", "the", "subscription", "data" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/jobs/src/Controller/Jobs/Subscription/Export/Csv/Standard.php#L159-L245
train
aimeos/ai-controller-jobs
controller/jobs/src/Controller/Jobs/Subscription/Export/Csv/Standard.php
Standard.export
protected function export( array $processors, $msg, $maxcnt ) { $lcontext = $this->getLocaleContext( $msg ); $baseRef = ['order/base/address', 'order/base/product']; $manager = \Aimeos\MShop::create( $lcontext, 'subscription' ); $baseManager = \Aimeos\MShop::create( $lcontext, 'order/base' ); $container = $this->getContainer(); $content = $container->create( 'subscription-export_' . date( 'Y-m-d_H-i-s' ) ); $search = $this->initCriteria( $manager->createSearch()->setSlice( 0, 0x7fffffff ), $msg ); $start = 0; do { $baseIds = []; $search->setSlice( $start, $maxcnt ); $items = $manager->searchItems( $search ); foreach( $items as $item ) { $baseIds[] = $item->getOrderBaseId(); } $baseSearch = $baseManager->createSearch(); $baseSearch->setConditions( $baseSearch->compare( '==', 'order.base.id', $baseIds ) ); $baseSearch->setSlice( 0, count( $baseIds ) ); $baseItems = $baseManager->searchItems( $baseSearch, $baseRef ); foreach( $items as $id => $item ) { foreach( $processors as $type => $processor ) { foreach( $processor->process( $item, $baseItems[$item->getOrderBaseId()] ) as $line ) { $content->add( [0 => $type, 1 => $id] + $line ); } } } $count = count( $items ); $start += $count; } while( $count === $search->getSliceSize() ); $path = $content->getResource(); $container->add( $content ); $container->close(); $path = $this->moveFile( $lcontext, $path ); $this->addJob( $lcontext, $path ); }
php
protected function export( array $processors, $msg, $maxcnt ) { $lcontext = $this->getLocaleContext( $msg ); $baseRef = ['order/base/address', 'order/base/product']; $manager = \Aimeos\MShop::create( $lcontext, 'subscription' ); $baseManager = \Aimeos\MShop::create( $lcontext, 'order/base' ); $container = $this->getContainer(); $content = $container->create( 'subscription-export_' . date( 'Y-m-d_H-i-s' ) ); $search = $this->initCriteria( $manager->createSearch()->setSlice( 0, 0x7fffffff ), $msg ); $start = 0; do { $baseIds = []; $search->setSlice( $start, $maxcnt ); $items = $manager->searchItems( $search ); foreach( $items as $item ) { $baseIds[] = $item->getOrderBaseId(); } $baseSearch = $baseManager->createSearch(); $baseSearch->setConditions( $baseSearch->compare( '==', 'order.base.id', $baseIds ) ); $baseSearch->setSlice( 0, count( $baseIds ) ); $baseItems = $baseManager->searchItems( $baseSearch, $baseRef ); foreach( $items as $id => $item ) { foreach( $processors as $type => $processor ) { foreach( $processor->process( $item, $baseItems[$item->getOrderBaseId()] ) as $line ) { $content->add( [0 => $type, 1 => $id] + $line ); } } } $count = count( $items ); $start += $count; } while( $count === $search->getSliceSize() ); $path = $content->getResource(); $container->add( $content ); $container->close(); $path = $this->moveFile( $lcontext, $path ); $this->addJob( $lcontext, $path ); }
[ "protected", "function", "export", "(", "array", "$", "processors", ",", "$", "msg", ",", "$", "maxcnt", ")", "{", "$", "lcontext", "=", "$", "this", "->", "getLocaleContext", "(", "$", "msg", ")", ";", "$", "baseRef", "=", "[", "'order/base/address'", ...
Exports the subscriptions and returns the exported file name @param Aimeos\Controller\Common\Subscription\Export\Csv\Processor\Iface[] List of processor objects @param array $msg Message data passed from the frontend @param integer $maxcnt Maximum number of retrieved subscriptions at once @return string Path of the file containing the exported data
[ "Exports", "the", "subscriptions", "and", "returns", "the", "exported", "file", "name" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/jobs/src/Controller/Jobs/Subscription/Export/Csv/Standard.php#L256-L306
train
aimeos/ai-controller-jobs
controller/jobs/src/Controller/Jobs/Subscription/Export/Csv/Standard.php
Standard.getLocaleContext
protected function getLocaleContext( array $msg ) { $lcontext = clone $this->getContext(); $manager = \Aimeos\MShop::create( $lcontext, 'locale' ); $sitecode = ( isset( $msg['sitecode'] ) ? $msg['sitecode'] : 'default' ); $localeItem = $manager->bootstrap( $sitecode, '', '', false, \Aimeos\MShop\Locale\Manager\Base::SITE_ONE ); return $lcontext->setLocale( $localeItem ); }
php
protected function getLocaleContext( array $msg ) { $lcontext = clone $this->getContext(); $manager = \Aimeos\MShop::create( $lcontext, 'locale' ); $sitecode = ( isset( $msg['sitecode'] ) ? $msg['sitecode'] : 'default' ); $localeItem = $manager->bootstrap( $sitecode, '', '', false, \Aimeos\MShop\Locale\Manager\Base::SITE_ONE ); return $lcontext->setLocale( $localeItem ); }
[ "protected", "function", "getLocaleContext", "(", "array", "$", "msg", ")", "{", "$", "lcontext", "=", "clone", "$", "this", "->", "getContext", "(", ")", ";", "$", "manager", "=", "\\", "Aimeos", "\\", "MShop", "::", "create", "(", "$", "lcontext", ",...
Returns a new context including the locale from the message data @param array $msg Message data including a "sitecode" value @return \Aimeos\MShop\Context\Item\Iface New context item with updated locale
[ "Returns", "a", "new", "context", "including", "the", "locale", "from", "the", "message", "data" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/jobs/src/Controller/Jobs/Subscription/Export/Csv/Standard.php#L315-L324
train
aimeos/ai-controller-jobs
controller/jobs/src/Controller/Jobs/Subscription/Export/Csv/Standard.php
Standard.initCriteria
protected function initCriteria( \Aimeos\MW\Criteria\Iface $criteria, array $msg ) { if( isset( $msg['filter'] ) ) { $criteria->setConditions( $criteria->toConditions( $msg['filter'] ) ); } if( isset( $msg['sort'] ) ) { $criteria->setSortations( $criteria->toSortations( $msg['sort'] ) ); } return $criteria; }
php
protected function initCriteria( \Aimeos\MW\Criteria\Iface $criteria, array $msg ) { if( isset( $msg['filter'] ) ) { $criteria->setConditions( $criteria->toConditions( $msg['filter'] ) ); } if( isset( $msg['sort'] ) ) { $criteria->setSortations( $criteria->toSortations( $msg['sort'] ) ); } return $criteria; }
[ "protected", "function", "initCriteria", "(", "\\", "Aimeos", "\\", "MW", "\\", "Criteria", "\\", "Iface", "$", "criteria", ",", "array", "$", "msg", ")", "{", "if", "(", "isset", "(", "$", "msg", "[", "'filter'", "]", ")", ")", "{", "$", "criteria",...
Initializes the search criteria @param \Aimeos\MW\Criteria\Iface $criteria New criteria object @param array $msg Message data @return \Aimeos\MW\Criteria\Iface Initialized criteria object
[ "Initializes", "the", "search", "criteria" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/jobs/src/Controller/Jobs/Subscription/Export/Csv/Standard.php#L334-L345
train
aimeos/ai-controller-jobs
controller/jobs/src/Controller/Jobs/Subscription/Export/Csv/Standard.php
Standard.moveFile
protected function moveFile( $context, $path ) { $filename = basename( $path ); $context->getFileSystemManager()->get( 'fs-admin' )->writef( $filename, $path ); unlink( $path ); return $filename; }
php
protected function moveFile( $context, $path ) { $filename = basename( $path ); $context->getFileSystemManager()->get( 'fs-admin' )->writef( $filename, $path ); unlink( $path ); return $filename; }
[ "protected", "function", "moveFile", "(", "$", "context", ",", "$", "path", ")", "{", "$", "filename", "=", "basename", "(", "$", "path", ")", ";", "$", "context", "->", "getFileSystemManager", "(", ")", "->", "get", "(", "'fs-admin'", ")", "->", "writ...
Moves the exported file to the final storage @param \Aimeos\MShop\Context\Item\Iface $context Context item @param string $path Absolute path to the exported file @return string Relative path of the file in the storage
[ "Moves", "the", "exported", "file", "to", "the", "final", "storage" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/jobs/src/Controller/Jobs/Subscription/Export/Csv/Standard.php#L355-L362
train
aimeos/ai-controller-jobs
controller/common/src/Controller/Common/Subscription/Process/Processor/Cgroup/Standard.php
Standard.begin
public function begin( \Aimeos\MShop\Subscription\Item\Iface $subscription ) { if( empty( $this->groupIds ) ) { return; } $context = $this->getContext(); $manager = \Aimeos\MShop::create( $context, 'customer' ); $baseManager = \Aimeos\MShop::create( $context, 'order/base' ); $baseItem = $baseManager->getItem( $subscription->getOrderBaseId() ); $item = $manager->getItem( $baseItem->getCustomerId(), ['customer/group'] ); $item->setGroups( array_unique( array_merge( $item->getGroups(), $this->groupIds ) ) ); $manager->saveItem( $item ); }
php
public function begin( \Aimeos\MShop\Subscription\Item\Iface $subscription ) { if( empty( $this->groupIds ) ) { return; } $context = $this->getContext(); $manager = \Aimeos\MShop::create( $context, 'customer' ); $baseManager = \Aimeos\MShop::create( $context, 'order/base' ); $baseItem = $baseManager->getItem( $subscription->getOrderBaseId() ); $item = $manager->getItem( $baseItem->getCustomerId(), ['customer/group'] ); $item->setGroups( array_unique( array_merge( $item->getGroups(), $this->groupIds ) ) ); $manager->saveItem( $item ); }
[ "public", "function", "begin", "(", "\\", "Aimeos", "\\", "MShop", "\\", "Subscription", "\\", "Item", "\\", "Iface", "$", "subscription", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "groupIds", ")", ")", "{", "return", ";", "}", "$", "cont...
Processes the initial subscription @param \Aimeos\MShop\Subscription\Item\Iface $subscription Subscription item
[ "Processes", "the", "initial", "subscription" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/common/src/Controller/Common/Subscription/Process/Processor/Cgroup/Standard.php#L69-L85
train
aimeos/ai-controller-jobs
controller/jobs/src/Controller/Jobs/Product/Bought/Standard.php
Standard.getSuggestions
protected function getSuggestions( $id, $prodIds, $count, $total, $maxItems, $minSupport, $minConfidence, $date ) { $refIds = []; $context = $this->getContext(); $catalogListManager = \Aimeos\MShop::create( $context, 'catalog/lists' ); $baseProductManager = \Aimeos\MShop::create( $context, 'order/base/product' ); $search = $baseProductManager->createSearch(); $func = $search->createFunction( 'order.base.product.count', array( (string) $id ) ); $expr = array( $search->compare( '==', 'order.base.product.productid', $prodIds ), $search->compare( '>', 'order.base.product.ctime', $date ), $search->compare( '==', $func, 1 ), ); $search->setConditions( $search->combine( '&&', $expr ) ); $relativeCounts = $baseProductManager->aggregate( $search, 'order.base.product.productid' ); $search = $catalogListManager->createSearch(); $expr = array( $search->compare( '==', 'catalog.lists.refid', array_keys( $relativeCounts ) ), $search->compare( '==', 'catalog.lists.domain', 'product' ), ); $search->setConditions( $search->combine( '&&', $expr ) ); foreach( $catalogListManager->searchItems( $search ) as $listItem ) { $refIds[$listItem->getRefId()] = true; } unset( $relativeCounts[$id] ); $supportA = $count / $total; $products = []; foreach( $relativeCounts as $prodId => $relCnt ) { if( !isset( $refIds[$prodId] ) ) { continue; } $supportAB = $relCnt / $total; if( $supportAB > $minSupport && ( $conf = ( $supportAB / $supportA ) ) > $minConfidence ) { $products[$prodId] = $conf; } } arsort( $products ); return array_keys( array_slice( $products, 0, $maxItems, true ) ); }
php
protected function getSuggestions( $id, $prodIds, $count, $total, $maxItems, $minSupport, $minConfidence, $date ) { $refIds = []; $context = $this->getContext(); $catalogListManager = \Aimeos\MShop::create( $context, 'catalog/lists' ); $baseProductManager = \Aimeos\MShop::create( $context, 'order/base/product' ); $search = $baseProductManager->createSearch(); $func = $search->createFunction( 'order.base.product.count', array( (string) $id ) ); $expr = array( $search->compare( '==', 'order.base.product.productid', $prodIds ), $search->compare( '>', 'order.base.product.ctime', $date ), $search->compare( '==', $func, 1 ), ); $search->setConditions( $search->combine( '&&', $expr ) ); $relativeCounts = $baseProductManager->aggregate( $search, 'order.base.product.productid' ); $search = $catalogListManager->createSearch(); $expr = array( $search->compare( '==', 'catalog.lists.refid', array_keys( $relativeCounts ) ), $search->compare( '==', 'catalog.lists.domain', 'product' ), ); $search->setConditions( $search->combine( '&&', $expr ) ); foreach( $catalogListManager->searchItems( $search ) as $listItem ) { $refIds[$listItem->getRefId()] = true; } unset( $relativeCounts[$id] ); $supportA = $count / $total; $products = []; foreach( $relativeCounts as $prodId => $relCnt ) { if( !isset( $refIds[$prodId] ) ) { continue; } $supportAB = $relCnt / $total; if( $supportAB > $minSupport && ( $conf = ( $supportAB / $supportA ) ) > $minConfidence ) { $products[$prodId] = $conf; } } arsort( $products ); return array_keys( array_slice( $products, 0, $maxItems, true ) ); }
[ "protected", "function", "getSuggestions", "(", "$", "id", ",", "$", "prodIds", ",", "$", "count", ",", "$", "total", ",", "$", "maxItems", ",", "$", "minSupport", ",", "$", "minConfidence", ",", "$", "date", ")", "{", "$", "refIds", "=", "[", "]", ...
Returns the IDs of the suggested products. @param string $id Product ID to calculate the suggestions for @param string[] $prodIds List of product IDs to create suggestions for @param integer $count Number of ordered products @param integer $total Total number of orders @param integer $maxItems Maximum number of suggestions @param float $minSupport Minium support value for calculating the suggested products @param float $minConfidence Minium confidence value for calculating the suggested products @param string $date Date in YYYY-MM-DD HH:mm:ss format after which orders should be used for calculations @return array List of suggested product IDs as key and their confidence as value
[ "Returns", "the", "IDs", "of", "the", "suggested", "products", "." ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/jobs/src/Controller/Jobs/Product/Bought/Standard.php#L206-L259
train
aimeos/ai-controller-jobs
controller/jobs/src/Controller/Jobs/Product/Bought/Standard.php
Standard.addListItems
protected function addListItems( $productId, array $productIds ) { if( empty( $productIds ) ) { return; } $manager = \Aimeos\MShop::create( $this->getContext(), 'product/lists' ); $item = $manager->createItem(); foreach( $productIds as $pos => $refid ) { $item->setId( null ); $item->setParentId( $productId ); $item->setDomain( 'product' ); $item->setType( 'bought-together' ); $item->setPosition( $pos ); $item->setRefId( $refid ); $item->setStatus( 1 ); $manager->saveItem( $item, false ); } }
php
protected function addListItems( $productId, array $productIds ) { if( empty( $productIds ) ) { return; } $manager = \Aimeos\MShop::create( $this->getContext(), 'product/lists' ); $item = $manager->createItem(); foreach( $productIds as $pos => $refid ) { $item->setId( null ); $item->setParentId( $productId ); $item->setDomain( 'product' ); $item->setType( 'bought-together' ); $item->setPosition( $pos ); $item->setRefId( $refid ); $item->setStatus( 1 ); $manager->saveItem( $item, false ); } }
[ "protected", "function", "addListItems", "(", "$", "productId", ",", "array", "$", "productIds", ")", "{", "if", "(", "empty", "(", "$", "productIds", ")", ")", "{", "return", ";", "}", "$", "manager", "=", "\\", "Aimeos", "\\", "MShop", "::", "create"...
Adds products as referenced products to the product list. @param string $productId Unique ID of the product the given products should be referenced to @param array $productIds List of position as key and product ID as value
[ "Adds", "products", "as", "referenced", "products", "to", "the", "product", "list", "." ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/jobs/src/Controller/Jobs/Product/Bought/Standard.php#L268-L289
train
aimeos/ai-controller-jobs
controller/jobs/src/Controller/Jobs/Product/Bought/Standard.php
Standard.removeListItems
protected function removeListItems( $productId ) { $manager = \Aimeos\MShop::create( $this->getContext(), 'product/lists' ); $search = $manager->createSearch(); $expr = array( $search->compare( '==', 'product.lists.parentid', $productId ), $search->compare( '==', 'product.lists.domain', 'product' ), $search->compare( '==', 'product.lists.type', 'bought-together' ), ); $search->setConditions( $search->combine( '&&', $expr ) ); $listItems = $manager->searchItems( $search ); $manager->deleteItems( array_keys( $listItems ) ); }
php
protected function removeListItems( $productId ) { $manager = \Aimeos\MShop::create( $this->getContext(), 'product/lists' ); $search = $manager->createSearch(); $expr = array( $search->compare( '==', 'product.lists.parentid', $productId ), $search->compare( '==', 'product.lists.domain', 'product' ), $search->compare( '==', 'product.lists.type', 'bought-together' ), ); $search->setConditions( $search->combine( '&&', $expr ) ); $listItems = $manager->searchItems( $search ); $manager->deleteItems( array_keys( $listItems ) ); }
[ "protected", "function", "removeListItems", "(", "$", "productId", ")", "{", "$", "manager", "=", "\\", "Aimeos", "\\", "MShop", "::", "create", "(", "$", "this", "->", "getContext", "(", ")", ",", "'product/lists'", ")", ";", "$", "search", "=", "$", ...
Remove all suggested products from product list. @param string $productId Unique ID of the product the references should be removed from
[ "Remove", "all", "suggested", "products", "from", "product", "list", "." ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/jobs/src/Controller/Jobs/Product/Bought/Standard.php#L297-L312
train
aimeos/ai-controller-jobs
controller/jobs/src/Controller/Jobs/Subscription/Process/Base.php
Base.getProcessors
protected function getProcessors( array $pnames ) { $list = []; $context = $this->getContext(); $config = $context->getConfig(); foreach( $pnames as $pname ) { if( ctype_alnum( $pname ) === false ) { $classname = is_string( $pname ) ? '\\Aimeos\\Controller\\Common\\Subscription\\Process\\Processor\\' . $pname : '<not a string>'; throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); } $name = $config->get( 'controller/common/subscription/process/processor/' . $pname . '/name', 'Standard' ); if( ctype_alnum( $name ) === false ) { $classname = is_string( $name ) ? '\\Aimeos\\Controller\\Common\\Subscription\\Process\\Processor\\' . $pname . '\\' . $name : '<not a string>'; throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); } $classname = '\\Aimeos\\Controller\\Common\\Subscription\\Process\\Processor\\' . ucfirst( $pname ) . '\\' . $name; if( class_exists( $classname ) === false ) { throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Class "%1$s" not found', $classname ) ); } $object = new $classname( $context ); \Aimeos\MW\Common\Base::checkClass( '\\Aimeos\\Controller\\Common\\Subscription\\Process\\Processor\\Iface', $object ); $list[$pname] = $object; } return $list; }
php
protected function getProcessors( array $pnames ) { $list = []; $context = $this->getContext(); $config = $context->getConfig(); foreach( $pnames as $pname ) { if( ctype_alnum( $pname ) === false ) { $classname = is_string( $pname ) ? '\\Aimeos\\Controller\\Common\\Subscription\\Process\\Processor\\' . $pname : '<not a string>'; throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); } $name = $config->get( 'controller/common/subscription/process/processor/' . $pname . '/name', 'Standard' ); if( ctype_alnum( $name ) === false ) { $classname = is_string( $name ) ? '\\Aimeos\\Controller\\Common\\Subscription\\Process\\Processor\\' . $pname . '\\' . $name : '<not a string>'; throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); } $classname = '\\Aimeos\\Controller\\Common\\Subscription\\Process\\Processor\\' . ucfirst( $pname ) . '\\' . $name; if( class_exists( $classname ) === false ) { throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Class "%1$s" not found', $classname ) ); } $object = new $classname( $context ); \Aimeos\MW\Common\Base::checkClass( '\\Aimeos\\Controller\\Common\\Subscription\\Process\\Processor\\Iface', $object ); $list[$pname] = $object; } return $list; }
[ "protected", "function", "getProcessors", "(", "array", "$", "pnames", ")", "{", "$", "list", "=", "[", "]", ";", "$", "context", "=", "$", "this", "->", "getContext", "(", ")", ";", "$", "config", "=", "$", "context", "->", "getConfig", "(", ")", ...
Returns the processor object for managing the subscription resources @param array $pnames List of processor names @return \Aimeos\Controller\Common\Subscription\Export\Csv\Processor\Iface Processor object
[ "Returns", "the", "processor", "object", "for", "managing", "the", "subscription", "resources" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/jobs/src/Controller/Jobs/Subscription/Process/Base.php#L30-L66
train
pr-of-it/t4
framework/Mvc/Router.php
Router.splitRequestPath
protected function splitRequestPath($path) { // Domain part extract $parts = explode('!', $path); if (count($parts) > 1) { $domain = $parts[0]; $path = $parts[1]; } else { $domain = null; } $parts = parse_url($path); $basePath = !empty($parts['path']) ? $parts['path'] : '/'; if (empty($basePath)) { $extension = null; } else { $extension = pathinfo($basePath, PATHINFO_EXTENSION); $basePath = preg_replace('~\.' . $extension . '$~', '', $basePath); } if (!in_array($extension, $this->allowedExtensions)) { $extension = ''; } return new Route([ 'domain' => $domain, 'basepath' => $basePath, 'extension' => $extension, ]); }
php
protected function splitRequestPath($path) { // Domain part extract $parts = explode('!', $path); if (count($parts) > 1) { $domain = $parts[0]; $path = $parts[1]; } else { $domain = null; } $parts = parse_url($path); $basePath = !empty($parts['path']) ? $parts['path'] : '/'; if (empty($basePath)) { $extension = null; } else { $extension = pathinfo($basePath, PATHINFO_EXTENSION); $basePath = preg_replace('~\.' . $extension . '$~', '', $basePath); } if (!in_array($extension, $this->allowedExtensions)) { $extension = ''; } return new Route([ 'domain' => $domain, 'basepath' => $basePath, 'extension' => $extension, ]); }
[ "protected", "function", "splitRequestPath", "(", "$", "path", ")", "{", "// Domain part extract", "$", "parts", "=", "explode", "(", "'!'", ",", "$", "path", ")", ";", "if", "(", "count", "(", "$", "parts", ")", ">", "1", ")", "{", "$", "domain", "=...
Splits canonical request path into domain, path and extension @param string $path @return \T4\Mvc\Route
[ "Splits", "canonical", "request", "path", "into", "domain", "path", "and", "extension" ]
8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada
https://github.com/pr-of-it/t4/blob/8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada/framework/Mvc/Router.php#L103-L133
train
pr-of-it/t4
framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Core/ResourceTypeConfig.php
CKFinder_Connector_Core_ResourceTypeConfig.checkExtension
public function checkExtension(&$fileName, $renameIfRequired = true) { if (strpos($fileName, '.') === false) { return true; } if (is_null($this->_config)) { $this->_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config"); } if ($this->_config->getCheckDoubleExtension()) { $pieces = explode('.', $fileName); // First, check the last extension (ex. in file.php.jpg, the "jpg"). if ( !$this->checkSingleExtension( $pieces[sizeof($pieces)-1] ) ) { return false; } if ($renameIfRequired) { // Check the other extensions, rebuilding the file name. If an extension is // not allowed, replace the dot with an underscore. $fileName = $pieces[0] ; for ($i=1; $i<sizeof($pieces)-1; $i++) { $fileName .= $this->checkSingleExtension( $pieces[$i] ) ? '.' : '_' ; $fileName .= $pieces[$i]; } // Add the last extension to the final name. $fileName .= '.' . $pieces[sizeof($pieces)-1] ; } } else { // Check only the last extension (ex. in file.php.jpg, only "jpg"). return $this->checkSingleExtension( substr($fileName, strrpos($fileName,'.')+1) ); } return true; }
php
public function checkExtension(&$fileName, $renameIfRequired = true) { if (strpos($fileName, '.') === false) { return true; } if (is_null($this->_config)) { $this->_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config"); } if ($this->_config->getCheckDoubleExtension()) { $pieces = explode('.', $fileName); // First, check the last extension (ex. in file.php.jpg, the "jpg"). if ( !$this->checkSingleExtension( $pieces[sizeof($pieces)-1] ) ) { return false; } if ($renameIfRequired) { // Check the other extensions, rebuilding the file name. If an extension is // not allowed, replace the dot with an underscore. $fileName = $pieces[0] ; for ($i=1; $i<sizeof($pieces)-1; $i++) { $fileName .= $this->checkSingleExtension( $pieces[$i] ) ? '.' : '_' ; $fileName .= $pieces[$i]; } // Add the last extension to the final name. $fileName .= '.' . $pieces[sizeof($pieces)-1] ; } } else { // Check only the last extension (ex. in file.php.jpg, only "jpg"). return $this->checkSingleExtension( substr($fileName, strrpos($fileName,'.')+1) ); } return true; }
[ "public", "function", "checkExtension", "(", "&", "$", "fileName", ",", "$", "renameIfRequired", "=", "true", ")", "{", "if", "(", "strpos", "(", "$", "fileName", ",", "'.'", ")", "===", "false", ")", "{", "return", "true", ";", "}", "if", "(", "is_n...
Check extension, return true if file name is valid. Return false if extension is on denied list. If allowed extensions are defined, return false if extension isn't on allowed list. @access public @param string $extension extension @param boolean $renameIfRequired whether try to rename file or not @return boolean
[ "Check", "extension", "return", "true", "if", "file", "name", "is", "valid", ".", "Return", "false", "if", "extension", "is", "on", "denied", "list", ".", "If", "allowed", "extensions", "are", "defined", "return", "false", "if", "extension", "isn", "t", "o...
8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada
https://github.com/pr-of-it/t4/blob/8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada/framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Core/ResourceTypeConfig.php#L228-L265
train
pr-of-it/t4
framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Core/ResourceTypeConfig.php
CKFinder_Connector_Core_ResourceTypeConfig.checkIsHiddenFolder
public function checkIsHiddenFolder($folderName) { if (is_null($this->_config)) { $this->_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config"); } $regex = $this->_config->getHideFoldersRegex(); if ($regex) { return preg_match($regex, $folderName); } return false; }
php
public function checkIsHiddenFolder($folderName) { if (is_null($this->_config)) { $this->_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config"); } $regex = $this->_config->getHideFoldersRegex(); if ($regex) { return preg_match($regex, $folderName); } return false; }
[ "public", "function", "checkIsHiddenFolder", "(", "$", "folderName", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "_config", ")", ")", "{", "$", "this", "->", "_config", "=", "&", "CKFinder_Connector_Core_Factory", "::", "getInstance", "(", "\"Cor...
Check given folder name Return true if folder name matches hidden folder names list @param string $folderName @access public @return boolean
[ "Check", "given", "folder", "name", "Return", "true", "if", "folder", "name", "matches", "hidden", "folder", "names", "list" ]
8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada
https://github.com/pr-of-it/t4/blob/8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada/framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Core/ResourceTypeConfig.php#L275-L287
train
pr-of-it/t4
framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Core/ResourceTypeConfig.php
CKFinder_Connector_Core_ResourceTypeConfig.checkIsHiddenFile
public function checkIsHiddenFile($fileName) { if (is_null($this->_config)) { $this->_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config"); } $regex = $this->_config->getHideFilesRegex(); if ($regex) { return preg_match($regex, $fileName); } return false; }
php
public function checkIsHiddenFile($fileName) { if (is_null($this->_config)) { $this->_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config"); } $regex = $this->_config->getHideFilesRegex(); if ($regex) { return preg_match($regex, $fileName); } return false; }
[ "public", "function", "checkIsHiddenFile", "(", "$", "fileName", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "_config", ")", ")", "{", "$", "this", "->", "_config", "=", "&", "CKFinder_Connector_Core_Factory", "::", "getInstance", "(", "\"Core_Co...
Check given file name Return true if file name matches hidden file names list @param string $fileName @access public @return boolean
[ "Check", "given", "file", "name", "Return", "true", "if", "file", "name", "matches", "hidden", "file", "names", "list" ]
8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada
https://github.com/pr-of-it/t4/blob/8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada/framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Core/ResourceTypeConfig.php#L297-L309
train
pr-of-it/t4
framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Core/ResourceTypeConfig.php
CKFinder_Connector_Core_ResourceTypeConfig.checkIsHiddenPath
public function checkIsHiddenPath($path) { $_clientPathParts = explode("/", trim($path, "/")); if ($_clientPathParts) { foreach ($_clientPathParts as $_part) { if ($this->checkIsHiddenFolder($_part)) { return true; } } } return false; }
php
public function checkIsHiddenPath($path) { $_clientPathParts = explode("/", trim($path, "/")); if ($_clientPathParts) { foreach ($_clientPathParts as $_part) { if ($this->checkIsHiddenFolder($_part)) { return true; } } } return false; }
[ "public", "function", "checkIsHiddenPath", "(", "$", "path", ")", "{", "$", "_clientPathParts", "=", "explode", "(", "\"/\"", ",", "trim", "(", "$", "path", ",", "\"/\"", ")", ")", ";", "if", "(", "$", "_clientPathParts", ")", "{", "foreach", "(", "$",...
Check given path Return true if path contains folder name that matches hidden folder names list @param string $folderName @access public @return boolean
[ "Check", "given", "path", "Return", "true", "if", "path", "contains", "folder", "name", "that", "matches", "hidden", "folder", "names", "list" ]
8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada
https://github.com/pr-of-it/t4/blob/8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada/framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Core/ResourceTypeConfig.php#L319-L331
train
pr-of-it/t4
framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Core/ResourceTypeConfig.php
CKFinder_Connector_Core_ResourceTypeConfig.checkSingleExtension
public function checkSingleExtension($extension) { $extension = strtolower(ltrim($extension,'.')); if (sizeof($this->_deniedExtensions)) { if (in_array($extension, $this->_deniedExtensions)) { return false; } } if (sizeof($this->_allowedExtensions)) { return in_array($extension, $this->_allowedExtensions); } return true; }
php
public function checkSingleExtension($extension) { $extension = strtolower(ltrim($extension,'.')); if (sizeof($this->_deniedExtensions)) { if (in_array($extension, $this->_deniedExtensions)) { return false; } } if (sizeof($this->_allowedExtensions)) { return in_array($extension, $this->_allowedExtensions); } return true; }
[ "public", "function", "checkSingleExtension", "(", "$", "extension", ")", "{", "$", "extension", "=", "strtolower", "(", "ltrim", "(", "$", "extension", ",", "'.'", ")", ")", ";", "if", "(", "sizeof", "(", "$", "this", "->", "_deniedExtensions", ")", ")"...
Check if extension is allowed Return true if the extension is allowed. @param string $extension @access public @return boolean
[ "Check", "if", "extension", "is", "allowed", "Return", "true", "if", "the", "extension", "is", "allowed", "." ]
8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada
https://github.com/pr-of-it/t4/blob/8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada/framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Core/ResourceTypeConfig.php#L341-L356
train
aimeos/ai-controller-jobs
controller/jobs/src/Controller/Jobs/Product/Export/Standard.php
Standard.createContainer
protected function createContainer() { $config = $this->getContext()->getConfig(); /** controller/jobs/product/export/location * Directory where the generated site maps should be placed into * * You have to configure a directory for the generated files on your * server that is writeable by the process generating the files, e.g. * * /var/www/your/export/path * * @param string Absolute directory to store the exported files into * @since 2015.01 * @category Developer * @category User * @see controller/jobs/product/export/standard/container/options * @see controller/jobs/product/export/max-items * @see controller/jobs/product/export/max-query */ $location = $config->get( 'controller/jobs/product/export/location' ); /** controller/jobs/product/export/standard/container/type * List of file container options for the export files * * The generated files are stored using container/content objects from * the core. * * @param string Container name * @since 2015.01 * @category Developer * @see controller/jobs/product/export/standard/container/content * @see controller/jobs/product/export/standard/container/options * @see controller/jobs/product/export/location * @see controller/jobs/product/export/max-items * @see controller/jobs/product/export/max-query */ $container = $config->get( 'controller/jobs/product/export/standard/container/type', 'Directory' ); /** controller/jobs/product/export/standard/container/content * List of file container options for the export files * * The generated files are stored using container/content objects from * the core. * * @param array Associative list of option name/value pairs * @since 2015.01 * @category Developer * @see controller/jobs/product/export/standard/container/type * @see controller/jobs/product/export/standard/container/options * @see controller/jobs/product/export/location * @see controller/jobs/product/export/max-items * @see controller/jobs/product/export/max-query */ $content = $config->get( 'controller/jobs/product/export/standard/container/content', 'Binary' ); /** controller/jobs/product/export/standard/container/options * List of file container options for the export files * * The generated files are stored using container/content objects from * the core. * * @param array Associative list of option name/value pairs * @since 2015.01 * @category Developer * @see controller/jobs/product/export/standard/container/type * @see controller/jobs/product/export/standard/container/content * @see controller/jobs/product/export/location * @see controller/jobs/product/export/max-items * @see controller/jobs/product/export/max-query */ $options = $config->get( 'controller/jobs/product/export/standard/container/options', [] ); if( $location === null ) { $msg = sprintf( 'Required configuration for "%1$s" is missing', 'controller/jobs/product/export/location' ); throw new \Aimeos\Controller\Jobs\Exception( $msg ); } return \Aimeos\MW\Container\Factory::getContainer( $location, $container, $content, $options ); }
php
protected function createContainer() { $config = $this->getContext()->getConfig(); /** controller/jobs/product/export/location * Directory where the generated site maps should be placed into * * You have to configure a directory for the generated files on your * server that is writeable by the process generating the files, e.g. * * /var/www/your/export/path * * @param string Absolute directory to store the exported files into * @since 2015.01 * @category Developer * @category User * @see controller/jobs/product/export/standard/container/options * @see controller/jobs/product/export/max-items * @see controller/jobs/product/export/max-query */ $location = $config->get( 'controller/jobs/product/export/location' ); /** controller/jobs/product/export/standard/container/type * List of file container options for the export files * * The generated files are stored using container/content objects from * the core. * * @param string Container name * @since 2015.01 * @category Developer * @see controller/jobs/product/export/standard/container/content * @see controller/jobs/product/export/standard/container/options * @see controller/jobs/product/export/location * @see controller/jobs/product/export/max-items * @see controller/jobs/product/export/max-query */ $container = $config->get( 'controller/jobs/product/export/standard/container/type', 'Directory' ); /** controller/jobs/product/export/standard/container/content * List of file container options for the export files * * The generated files are stored using container/content objects from * the core. * * @param array Associative list of option name/value pairs * @since 2015.01 * @category Developer * @see controller/jobs/product/export/standard/container/type * @see controller/jobs/product/export/standard/container/options * @see controller/jobs/product/export/location * @see controller/jobs/product/export/max-items * @see controller/jobs/product/export/max-query */ $content = $config->get( 'controller/jobs/product/export/standard/container/content', 'Binary' ); /** controller/jobs/product/export/standard/container/options * List of file container options for the export files * * The generated files are stored using container/content objects from * the core. * * @param array Associative list of option name/value pairs * @since 2015.01 * @category Developer * @see controller/jobs/product/export/standard/container/type * @see controller/jobs/product/export/standard/container/content * @see controller/jobs/product/export/location * @see controller/jobs/product/export/max-items * @see controller/jobs/product/export/max-query */ $options = $config->get( 'controller/jobs/product/export/standard/container/options', [] ); if( $location === null ) { $msg = sprintf( 'Required configuration for "%1$s" is missing', 'controller/jobs/product/export/location' ); throw new \Aimeos\Controller\Jobs\Exception( $msg ); } return \Aimeos\MW\Container\Factory::getContainer( $location, $container, $content, $options ); }
[ "protected", "function", "createContainer", "(", ")", "{", "$", "config", "=", "$", "this", "->", "getContext", "(", ")", "->", "getConfig", "(", ")", ";", "/** controller/jobs/product/export/location\n\t\t * Directory where the generated site maps should be placed into\n\t\t...
Creates a new container for the site map file @return \Aimeos\MW\Container\Iface Container object
[ "Creates", "a", "new", "container", "for", "the", "site", "map", "file" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/jobs/src/Controller/Jobs/Product/Export/Standard.php#L106-L186
train
aimeos/ai-controller-jobs
controller/jobs/src/Controller/Jobs/Product/Export/Standard.php
Standard.export
protected function export( \Aimeos\MW\Container\Iface $container, $default = true ) { $domains = array( 'attribute', 'media', 'price', 'product', 'text' ); $domains = $this->getConfig( 'domains', $domains ); $maxItems = $this->getConfig( 'max-items', 10000 ); $maxQuery = $this->getConfig( 'max-query', 1000 ); $start = 0; $filenum = 1; $names = []; $manager = \Aimeos\MShop::create( $this->getContext(), 'product' ); $search = $manager->createSearch( $default ); $search->setSortations( array( $search->sort( '+', 'product.id' ) ) ); $search->setSlice( 0, $maxQuery ); $content = $this->createContent( $container, $filenum ); $names[] = $content->getResource(); do { $items = $manager->searchItems( $search, $domains ); $free = $maxItems * $filenum - $start; $count = count( $items ); if( $free < $count ) { $this->addItems( $content, array_slice( $items, 0, $free, true ) ); $items = array_slice( $items, $free, null, true ); $this->closeContent( $content ); $content = $this->createContent( $container, ++$filenum ); $names[] = $content->getResource(); } $this->addItems( $content, $items ); $start += $count; $search->setSlice( $start, $maxQuery ); } while( $count >= $search->getSliceSize() ); $this->closeContent( $content ); return $names; }
php
protected function export( \Aimeos\MW\Container\Iface $container, $default = true ) { $domains = array( 'attribute', 'media', 'price', 'product', 'text' ); $domains = $this->getConfig( 'domains', $domains ); $maxItems = $this->getConfig( 'max-items', 10000 ); $maxQuery = $this->getConfig( 'max-query', 1000 ); $start = 0; $filenum = 1; $names = []; $manager = \Aimeos\MShop::create( $this->getContext(), 'product' ); $search = $manager->createSearch( $default ); $search->setSortations( array( $search->sort( '+', 'product.id' ) ) ); $search->setSlice( 0, $maxQuery ); $content = $this->createContent( $container, $filenum ); $names[] = $content->getResource(); do { $items = $manager->searchItems( $search, $domains ); $free = $maxItems * $filenum - $start; $count = count( $items ); if( $free < $count ) { $this->addItems( $content, array_slice( $items, 0, $free, true ) ); $items = array_slice( $items, $free, null, true ); $this->closeContent( $content ); $content = $this->createContent( $container, ++$filenum ); $names[] = $content->getResource(); } $this->addItems( $content, $items ); $start += $count; $search->setSlice( $start, $maxQuery ); } while( $count >= $search->getSliceSize() ); $this->closeContent( $content ); return $names; }
[ "protected", "function", "export", "(", "\\", "Aimeos", "\\", "MW", "\\", "Container", "\\", "Iface", "$", "container", ",", "$", "default", "=", "true", ")", "{", "$", "domains", "=", "array", "(", "'attribute'", ",", "'media'", ",", "'price'", ",", "...
Exports the products into the given container @param \Aimeos\MW\Container\Iface $container Container object @param boolean $default True to filter exported products by default criteria @return array List of content (file) names
[ "Exports", "the", "products", "into", "the", "given", "container" ]
e4a2fc47850f72907afff68858a2be5865fa4664
https://github.com/aimeos/ai-controller-jobs/blob/e4a2fc47850f72907afff68858a2be5865fa4664/controller/jobs/src/Controller/Jobs/Product/Export/Standard.php#L280-L326
train
pr-of-it/t4
framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Utils/FileSystem.php
CKFinder_Connector_Utils_FileSystem.getFileNameWithoutExtension
public static function getFileNameWithoutExtension($fileName, $shortExtensionMode = TRUE) { $dotPos = $shortExtensionMode ? strrpos( $fileName, '.' ) : strpos( $fileName, '.' ); if (false === $dotPos) { return $fileName; } return substr($fileName, 0, $dotPos); }
php
public static function getFileNameWithoutExtension($fileName, $shortExtensionMode = TRUE) { $dotPos = $shortExtensionMode ? strrpos( $fileName, '.' ) : strpos( $fileName, '.' ); if (false === $dotPos) { return $fileName; } return substr($fileName, 0, $dotPos); }
[ "public", "static", "function", "getFileNameWithoutExtension", "(", "$", "fileName", ",", "$", "shortExtensionMode", "=", "TRUE", ")", "{", "$", "dotPos", "=", "$", "shortExtensionMode", "?", "strrpos", "(", "$", "fileName", ",", "'.'", ")", ":", "strpos", "...
Return file name without extension @static @access public @param string $fileName @param boolean $shortExtensionMode If set to false, extension is everything after a first dot @return string
[ "Return", "file", "name", "without", "extension" ]
8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada
https://github.com/pr-of-it/t4/blob/8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada/framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Utils/FileSystem.php#L199-L207
train
pr-of-it/t4
framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Utils/FileSystem.php
CKFinder_Connector_Utils_FileSystem.readfileChunked
public static function readfileChunked($filename) { $chunksize = 1024 * 10; // how many bytes per chunk $handle = fopen($filename, 'rb'); if ($handle === false) { return false; } while (!feof($handle)) { echo fread($handle, $chunksize); @ob_flush(); flush(); @set_time_limit(8); } fclose($handle); return true; }
php
public static function readfileChunked($filename) { $chunksize = 1024 * 10; // how many bytes per chunk $handle = fopen($filename, 'rb'); if ($handle === false) { return false; } while (!feof($handle)) { echo fread($handle, $chunksize); @ob_flush(); flush(); @set_time_limit(8); } fclose($handle); return true; }
[ "public", "static", "function", "readfileChunked", "(", "$", "filename", ")", "{", "$", "chunksize", "=", "1024", "*", "10", ";", "// how many bytes per chunk", "$", "handle", "=", "fopen", "(", "$", "filename", ",", "'rb'", ")", ";", "if", "(", "$", "ha...
Read file, split it into small chunks and send it to the browser @static @access public @param string $filename @return boolean
[ "Read", "file", "split", "it", "into", "small", "chunks", "and", "send", "it", "to", "the", "browser" ]
8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada
https://github.com/pr-of-it/t4/blob/8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada/framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Utils/FileSystem.php#L236-L252
train
pr-of-it/t4
framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Utils/FileSystem.php
CKFinder_Connector_Utils_FileSystem.secureFileName
public static function secureFileName($fileName) { $_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config"); $fileName = str_replace(array(":", "*", "?", "|", "/"), "_", $fileName); if ( $_config->getDisallowUnsafeCharacters() ) { $fileName = str_replace(";", "_", $fileName); } if ($_config->forceAscii()) { $fileName = CKFinder_Connector_Utils_FileSystem::convertToAscii($fileName); } return $fileName; }
php
public static function secureFileName($fileName) { $_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config"); $fileName = str_replace(array(":", "*", "?", "|", "/"), "_", $fileName); if ( $_config->getDisallowUnsafeCharacters() ) { $fileName = str_replace(";", "_", $fileName); } if ($_config->forceAscii()) { $fileName = CKFinder_Connector_Utils_FileSystem::convertToAscii($fileName); } return $fileName; }
[ "public", "static", "function", "secureFileName", "(", "$", "fileName", ")", "{", "$", "_config", "=", "&", "CKFinder_Connector_Core_Factory", "::", "getInstance", "(", "\"Core_Config\"", ")", ";", "$", "fileName", "=", "str_replace", "(", "array", "(", "\":\"",...
Secure file name from unsafe characters @param string $fileName @access public @static @return string $fileName
[ "Secure", "file", "name", "from", "unsafe", "characters" ]
8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada
https://github.com/pr-of-it/t4/blob/8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada/framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Utils/FileSystem.php#L338-L351
train
pr-of-it/t4
framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Utils/FileSystem.php
CKFinder_Connector_Utils_FileSystem.convertToFilesystemEncoding
public static function convertToFilesystemEncoding($fileName) { $_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config"); $encoding = $_config->getFilesystemEncoding(); if (is_null($encoding) || strcasecmp($encoding, "UTF-8") == 0 || strcasecmp($encoding, "UTF8") == 0) { return $fileName; } if (!function_exists("iconv")) { if (strcasecmp($encoding, "ISO-8859-1") == 0 || strcasecmp($encoding, "ISO8859-1") == 0 || strcasecmp($encoding, "Latin1") == 0) { return str_replace("\0", "_", utf8_decode($fileName)); } else if (function_exists('mb_convert_encoding')) { /** * @todo check whether charset is supported - mb_list_encodings */ $encoded = @mb_convert_encoding($fileName, $encoding, 'UTF-8'); if (@mb_strlen($fileName, "UTF-8") != @mb_strlen($encoded, $encoding)) { return str_replace("\0", "_", preg_replace("/[^[:ascii:]]/u","_",$fileName)); } else { return str_replace("\0", "_", $encoded); } } else { return str_replace("\0", "_", preg_replace("/[^[:ascii:]]/u","_",$fileName)); } } $converted = @iconv("UTF-8", $encoding . "//IGNORE//TRANSLIT", $fileName); if ($converted === false) { return str_replace("\0", "_", preg_replace("/[^[:ascii:]]/u","_",$fileName)); } return $converted; }
php
public static function convertToFilesystemEncoding($fileName) { $_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config"); $encoding = $_config->getFilesystemEncoding(); if (is_null($encoding) || strcasecmp($encoding, "UTF-8") == 0 || strcasecmp($encoding, "UTF8") == 0) { return $fileName; } if (!function_exists("iconv")) { if (strcasecmp($encoding, "ISO-8859-1") == 0 || strcasecmp($encoding, "ISO8859-1") == 0 || strcasecmp($encoding, "Latin1") == 0) { return str_replace("\0", "_", utf8_decode($fileName)); } else if (function_exists('mb_convert_encoding')) { /** * @todo check whether charset is supported - mb_list_encodings */ $encoded = @mb_convert_encoding($fileName, $encoding, 'UTF-8'); if (@mb_strlen($fileName, "UTF-8") != @mb_strlen($encoded, $encoding)) { return str_replace("\0", "_", preg_replace("/[^[:ascii:]]/u","_",$fileName)); } else { return str_replace("\0", "_", $encoded); } } else { return str_replace("\0", "_", preg_replace("/[^[:ascii:]]/u","_",$fileName)); } } $converted = @iconv("UTF-8", $encoding . "//IGNORE//TRANSLIT", $fileName); if ($converted === false) { return str_replace("\0", "_", preg_replace("/[^[:ascii:]]/u","_",$fileName)); } return $converted; }
[ "public", "static", "function", "convertToFilesystemEncoding", "(", "$", "fileName", ")", "{", "$", "_config", "=", "&", "CKFinder_Connector_Core_Factory", "::", "getInstance", "(", "\"Core_Config\"", ")", ";", "$", "encoding", "=", "$", "_config", "->", "getFiles...
Convert file name from UTF-8 to system encoding @static @access public @param string $fileName @return string
[ "Convert", "file", "name", "from", "UTF", "-", "8", "to", "system", "encoding" ]
8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada
https://github.com/pr-of-it/t4/blob/8a8133e0b3abca9d7718fbdcf65b70c2d85b5ada/framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Utils/FileSystem.php#L361-L394
train