idx
int64
0
60.3k
question
stringlengths
101
6.21k
target
stringlengths
7
803
35,800
public function taskDelete ( ) { $ tasks = self :: taskFileLoad ( ) ; if ( isset ( $ tasks [ $ this -> task_id ] ) ) { unset ( $ tasks [ $ this -> task_id ] ) ; return self :: taskFileSave ( $ tasks ) ; } return false ; }
Deletes the task
35,801
public function taskSave ( ) { $ taskId = $ this -> getTaskId ( ) ; $ tasks = self :: taskFileLoad ( ) ; if ( empty ( $ taskId ) ) { $ task_ids = array_keys ( $ tasks ) ; $ this -> setTaskId ( array_pop ( $ task_ids ) + 1 ) ; $ this -> setTs ( date ( 'Y-m-d H:i:s' ) ) ; } $ tasks [ $ this -> getTaskId ( ) ] = $ this ; ...
Saves the task
35,802
public static function loadController ( $ class_name ) { foreach ( self :: $ class_folders as $ f ) { $ f = rtrim ( $ f , '/' ) ; $ filename = $ f . '/' . $ class_name . '.php' ; if ( file_exists ( $ filename ) ) { require_once $ filename ; if ( class_exists ( $ class_name ) ) { return true ; } else { throw new TaskMan...
Looks for and loads required class via require_once
35,803
public static function getControllerMethods ( $ class ) { if ( ! class_exists ( $ class ) ) { throw new TaskManagerException ( 'class ' . $ class . ' not found' ) ; } $ class_methods = get_class_methods ( $ class ) ; if ( $ parent_class = get_parent_class ( $ class ) ) { $ parent_class_methods = get_class_methods ( $ p...
Returns all public methods for requested class
35,804
protected static function getControllersList ( $ paths , $ namespaces_list ) { $ controllers = array ( ) ; foreach ( $ paths as $ p_index => $ p ) { if ( ! file_exists ( $ p ) ) { throw new TaskManagerException ( 'folder ' . $ p . ' does not exist' ) ; } $ files = scandir ( $ p ) ; foreach ( $ files as $ f ) { if ( pre...
Returns names of all php files in directories
35,805
public static function getAllMethods ( $ folder , $ namespace = array ( ) ) { self :: setClassFolder ( $ folder ) ; $ namespaces_list = is_array ( $ namespace ) ? $ namespace : array ( $ namespace ) ; $ methods = array ( ) ; $ controllers = self :: getControllersList ( self :: $ class_folders , $ namespaces_list ) ; fo...
Scan folders for classes and return all their public methods
35,806
public static function editTask ( $ task , $ time , $ command , $ status = TaskInterface :: TASK_STATUS_ACTIVE , $ comment = null ) { if ( ! $ validated_command = self :: validateCommand ( $ command ) ) { return $ task ; } $ task -> setStatus ( $ status ) ; $ task -> setCommand ( $ validated_command ) ; $ task -> setTi...
Edit and save TaskInterface object
35,807
public static function validateCommand ( $ command ) { try { list ( $ class , $ method , $ args ) = self :: parseCommand ( $ command ) ; } catch ( TaskManagerException $ e ) { return false ; } $ args = array_map ( function ( $ elem ) { return trim ( $ elem ) ; } , $ args ) ; return $ class . '::' . $ method . '(' . tri...
Checks if the command is correct and removes spaces
35,808
public static function parseCommand ( $ command ) { if ( preg_match ( '/([\w\\\\]+)::(\w+)\((.*)\)/' , $ command , $ match ) ) { $ params = explode ( ',' , $ match [ 3 ] ) ; if ( ( 1 == count ( $ params ) ) && ( '' == $ params [ 0 ] ) ) { $ params [ 0 ] = null ; } return array ( $ match [ 1 ] , $ match [ 2 ] , $ params...
Parses command and returns an array which contains class method and arguments of the command
35,809
public static function parseCrontab ( $ cron , $ task_class ) { $ cron_array = explode ( PHP_EOL , $ cron ) ; $ comment = null ; $ result = array ( ) ; foreach ( $ cron_array as $ c ) { $ c = trim ( $ c ) ; if ( empty ( $ c ) ) { continue ; } $ r = array ( $ c ) ; if ( preg_match ( self :: CRON_LINE_REGEXP , $ c , $ ma...
Parses each line of crontab content and creates new TaskInterface objects
35,810
private static function createTaskWithCrontabLine ( $ task_class , $ matches , $ comment ) { $ task = $ task_class :: createNew ( ) ; $ task -> setTime ( trim ( $ matches [ 2 ] ) ) ; $ arguments = str_replace ( ' ' , ',' , trim ( $ matches [ 5 ] ) ) ; $ command = ucfirst ( $ matches [ 3 ] ) . '::' . $ matches [ 4 ] . '...
Creates new TaskInterface object from parsed crontab line
35,811
public static function getTaskCrontabLine ( $ task , $ path , $ php_bin , $ input_file ) { $ str = '' ; $ comment = $ task -> getComment ( ) ; if ( ! empty ( $ comment ) ) { $ str .= '#' . $ comment . PHP_EOL ; } if ( TaskInterface :: TASK_STATUS_ACTIVE != $ task -> getStatus ( ) ) { $ str .= '#' ; } list ( $ class , $...
Formats task for export into crontab file
35,812
public static function checkAndRunTasks ( $ tasks ) { $ date = date ( 'Y-m-d H:i:s' ) ; foreach ( $ tasks as $ t ) { if ( TaskInterface :: TASK_STATUS_ACTIVE != $ t -> getStatus ( ) ) { continue ; } try { $ cron = CronExpression :: factory ( $ t -> getTime ( ) ) ; if ( $ cron -> isDue ( $ date ) ) { self :: runTask ( $...
Runs active tasks if current time matches with time expression
35,813
public static function getRunDates ( $ time , $ count = 10 ) { try { $ cron = CronExpression :: factory ( $ time ) ; $ dates = $ cron -> getMultipleRunDates ( $ count ) ; } catch ( \ Exception $ e ) { return array ( ) ; } return $ dates ; }
Returns next run dates for time expression
35,814
public static function runTask ( $ task ) { $ run = $ task -> createTaskRun ( ) ; $ run -> setTaskId ( $ task -> getTaskId ( ) ) ; $ run -> setTs ( date ( 'Y-m-d H:i:s' ) ) ; $ run -> setStatus ( TaskRunInterface :: RUN_STATUS_STARTED ) ; $ run -> saveTaskRun ( ) ; $ run_final_status = TaskRunInterface :: RUN_STATUS_CO...
Runs task and returns output
35,815
public static function parseAndRunCommand ( $ command ) { try { list ( $ class , $ method , $ args ) = TaskManager :: parseCommand ( $ command ) ; if ( ! class_exists ( $ class ) ) { TaskLoader :: loadController ( $ class ) ; } $ obj = new $ class ( ) ; if ( ! method_exists ( $ obj , $ method ) ) { throw new TaskManage...
Parses given command creates new class object and calls its method via call_user_func_array
35,816
public function saveTaskRun ( ) { if ( ! class_exists ( 'Monolog\Logger' ) ) { return false ; } $ logger = new Logger ( 'cron_logger' ) ; $ logger -> pushHandler ( new RotatingFileHandler ( $ this -> logs_folder . $ this -> log_name ) ) ; $ task = TaskFile :: taskGet ( $ this -> task_id ) ; if ( self :: RUN_STATUS_STAR...
Writes log in file . Do NOT actually saves the task run
35,817
protected function createResponseWithLowerCaseContent ( Response $ response ) { $ lowercaseContent = strtolower ( $ response -> getContent ( ) ) ; return Response :: create ( $ lowercaseContent ) ; }
Make the content of the given response lowercase .
35,818
private function convertToColumn ( array & $ match ) : void { if ( $ this -> persistenceStrategy instanceof MariaDBIndexedPersistenceStrategy ) { $ indexedColumns = $ this -> persistenceStrategy -> indexedMetadataFields ( ) ; if ( \ in_array ( $ match [ 'field' ] , \ array_keys ( $ indexedColumns ) , true ) ) { $ match...
Convert metadata fields into indexed columns
35,819
private function extractSchema ( string $ ident ) : ? string { if ( false === ( $ pos = \ strpos ( $ ident , '.' ) ) ) { return null ; } return \ substr ( $ ident , 0 , $ pos ) ; }
Extracts schema name as string before the first dot .
35,820
public function configure ( array $ options = array ( ) ) { if ( isset ( $ options [ 'host' ] ) ) { $ this -> host = $ options [ 'host' ] ; } if ( isset ( $ options [ 'port' ] ) ) { if ( ! is_numeric ( $ options [ 'port' ] ) || is_float ( $ options [ 'port' ] ) || $ options [ 'port' ] < 0 || $ options [ 'port' ] > 6553...
Initialize Connection Details
35,821
public function increment ( $ metrics , $ delta = 1 , $ sampleRate = 1 , array $ tags = [ ] ) { $ metrics = ( array ) $ metrics ; $ data = array ( ) ; if ( $ sampleRate < 1 ) { foreach ( $ metrics as $ metric ) { if ( ( mt_rand ( ) / mt_getrandmax ( ) ) <= $ sampleRate ) { $ data [ $ metric ] = $ delta . '|c|@' . $ sam...
Increment a metric
35,822
public function decrement ( $ metrics , $ delta = 1 , $ sampleRate = 1 , array $ tags = [ ] ) { return $ this -> increment ( $ metrics , 0 - $ delta , $ sampleRate , $ tags ) ; }
Decrement a metric
35,823
public function endTiming ( $ metric , array $ tags = array ( ) ) { $ timer_start = $ this -> metricTiming [ $ metric ] ; $ timer_end = microtime ( true ) ; $ time = round ( ( $ timer_end - $ timer_start ) * 1000 , 4 ) ; return $ this -> timing ( $ metric , $ time , $ tags ) ; }
End timing the given metric and record
35,824
public function timings ( $ metrics ) { $ data = [ ] ; foreach ( $ metrics as $ metric => $ timing ) { $ data [ $ metric ] = $ timing . '|ms' ; } return $ this -> send ( $ data ) ; }
Send multiple timing metrics at once
35,825
protected function send ( array $ data , array $ tags = array ( ) ) { $ tagsData = $ this -> serializeTags ( array_replace ( $ this -> tags , $ tags ) ) ; try { $ socket = $ this -> getSocket ( ) ; $ messages = array ( ) ; $ prefix = $ this -> namespace ? $ this -> namespace . '.' : '' ; foreach ( $ data as $ key => $ ...
Send Data to StatsD Server
35,826
public function getCheckoutEndpoint ( $ service ) { if ( $ service -> getClient ( ) -> getConfig ( ) -> get ( 'endpointCheckout' ) == null ) { $ logger = $ service -> getClient ( ) -> getLogger ( ) ; $ msg = "Please provide your unique live url prefix on the setEnvironment() call on the Client or provide endpointChecko...
Return Checkout endpoint
35,827
public function setEnvironment ( $ environment , $ liveEndpointUrlPrefix = null ) { if ( $ environment == \ Adyen \ Environment :: TEST ) { $ this -> config -> set ( 'environment' , \ Adyen \ Environment :: TEST ) ; $ this -> config -> set ( 'endpoint' , self :: ENDPOINT_TEST ) ; $ this -> config -> set ( 'endpointDire...
Set environment to connect to test or live platform of Adyen For live please specify the unique identifier .
35,828
public function setExternalPlatform ( $ name , $ version , $ integrator = "" ) { $ this -> config -> set ( 'externalPlatform' , array ( 'name' => $ name , 'version' => $ version , 'integrator' => $ integrator ) ) ; }
Set external platform name version and integrator
35,829
public function request ( $ params ) { if ( $ this -> service -> getClient ( ) -> getConfig ( ) -> getInputType ( ) == 'json' ) { $ params = json_decode ( $ params , true ) ; if ( $ params === null && json_last_error ( ) !== JSON_ERROR_NONE ) { $ msg = 'The parameters in the request expect valid JSON but JSON error cod...
Do the request to the Http Client
35,830
private function addDefaultParametersToRequest ( $ params ) { if ( ! isset ( $ params [ 'merchantAccount' ] ) && $ this -> service -> getClient ( ) -> getConfig ( ) -> getMerchantAccount ( ) ) { $ params [ 'merchantAccount' ] = $ this -> service -> getClient ( ) -> getConfig ( ) -> getMerchantAccount ( ) ; } return $ p...
Fill expected but missing parameters with default data
35,831
private function handleApplicationInfoInRequest ( $ params ) { if ( $ this -> allowApplicationInfo ) { $ params [ 'applicationInfo' ] [ 'adyenLibrary' ] [ 'name' ] = $ this -> service -> getClient ( ) -> getLibraryName ( ) ; $ params [ 'applicationInfo' ] [ 'adyenLibrary' ] [ 'version' ] = $ this -> service -> getClien...
If allowApplicationInfo is true then it adds applicationInfo to request otherwise removes from the request
35,832
public function requestJson ( \ Adyen \ Service $ service , $ requestUrl , $ params ) { $ client = $ service -> getClient ( ) ; $ config = $ client -> getConfig ( ) ; $ logger = $ client -> getLogger ( ) ; $ username = $ config -> getUsername ( ) ; $ password = $ config -> getPassword ( ) ; $ xApiKey = $ config -> getX...
Json API request to Adyen
35,833
public function requestPost ( \ Adyen \ Service $ service , $ requestUrl , $ params ) { $ client = $ service -> getClient ( ) ; $ config = $ client -> getConfig ( ) ; $ logger = $ client -> getLogger ( ) ; $ username = $ config -> getUsername ( ) ; $ password = $ config -> getPassword ( ) ; $ logger -> info ( "Request ...
Request to Adyen with query string used for Directory Lookup
35,834
protected function handleCurlError ( $ url , $ errno , $ message , $ logger ) { switch ( $ errno ) { case CURLE_OK : $ msg = "Probably your Web Service username and/or password is incorrect" ; break ; case CURLE_COULDNT_RESOLVE_HOST : case CURLE_OPERATION_TIMEOUTED : $ msg = "Could not connect to Adyen ($url). Please ...
Handle Curl exceptions
35,835
protected function handleResultError ( $ result , $ logger ) { $ decodeResult = json_decode ( $ result , true ) ; if ( isset ( $ decodeResult [ 'message' ] ) && isset ( $ decodeResult [ 'errorCode' ] ) ) { $ logger -> error ( $ decodeResult [ 'errorCode' ] . ': ' . $ decodeResult [ 'message' ] ) ; throw new \ Adyen \ A...
Handle result errors from Adyen
35,836
private function logRequest ( \ Psr \ Log \ LoggerInterface $ logger , $ requestUrl , $ params ) { $ logger -> info ( "Request url to Adyen: " . $ requestUrl ) ; if ( isset ( $ params [ "additionalData" ] ) && isset ( $ params [ "additionalData" ] [ "card.encrypted.json" ] ) ) { $ params [ "additionalData" ] [ "card.en...
Logs the API request removing sensitive data
35,837
protected function curlRequest ( $ ch ) { $ result = curl_exec ( $ ch ) ; $ httpStatus = curl_getinfo ( $ ch , CURLINFO_HTTP_CODE ) ; return array ( $ result , $ httpStatus ) ; }
Execute curl return the result and the http response code
35,838
protected function curlError ( $ ch ) { $ errno = curl_errno ( $ ch ) ; $ message = curl_error ( $ ch ) ; return array ( $ errno , $ message ) ; }
Retrieve curl error number and message
35,839
public function loadManufacturerList ( ) { $ oBaseObject = $ this -> getBaseObject ( ) ; $ sFieldList = $ oBaseObject -> getSelectFields ( ) ; $ sViewName = $ oBaseObject -> getViewName ( ) ; $ this -> getBaseObject ( ) -> setShowArticleCnt ( $ this -> _blShowManufacturerArticleCnt ) ; $ sWhere = '' ; if ( ! $ this -> ...
Loads simple manufacturer list
35,840
public function buildManufacturerTree ( $ sLinkTarget , $ sActCat , $ sShopHomeUrl ) { $ this -> loadManufacturerList ( ) ; $ this -> _oRoot = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Manufacturer :: class ) ; $ this -> _oRoot -> load ( "root" ) ; $ this -> _addCategoryFields ( $ this -> _oRoot ) ; $ this -...
Creates fake root for manufacturer tree and ads category list fileds for each manufacturer item
35,841
protected function _addCategoryFields ( $ oManufacturer ) { $ oManufacturer -> oxcategories__oxid = new \ OxidEsales \ Eshop \ Core \ Field ( $ oManufacturer -> oxmanufacturers__oxid -> value ) ; $ oManufacturer -> oxcategories__oxicon = $ oManufacturer -> oxmanufacturers__oxicon ; $ oManufacturer -> oxcategories__oxti...
Adds category specific fields to manufacturer object
35,842
protected function _seoSetManufacturerData ( ) { if ( \ OxidEsales \ Eshop \ Core \ Registry :: getUtils ( ) -> seoIsActive ( ) && ! $ this -> isAdmin ( ) ) { $ oEncoder = \ OxidEsales \ Eshop \ Core \ Registry :: get ( \ OxidEsales \ Eshop \ Application \ Model \ SeoEncoderManufacturer :: class ) ; if ( $ this -> _oRo...
Processes manufacturer category URLs
35,843
public function save ( ) { parent :: save ( ) ; $ soxId = $ this -> getEditObjectId ( ) ; if ( $ this -> _allowAdminEdit ( $ soxId ) ) { $ aParams = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( "editval" ) ; if ( ! isset ( $ aParams [ 'oxuser__oxactive' ] ) ) { $ aParams [ 'oxuser__o...
Saves main user parameters .
35,844
public function getFullFieldNames ( $ tableName , $ fieldNames ) { $ combinedFields = [ ] ; $ tablePrefix = strtolower ( $ tableName ) . '__' ; foreach ( $ fieldNames as $ fieldName ) { $ fieldName = strtolower ( $ fieldName ) ; $ fieldNameWithoutTableName = str_replace ( $ tablePrefix , '' , $ fieldName ) ; $ combined...
Return field names with and without table name as a prefix .
35,845
public function setHomeCountry ( $ sHomeCountry ) { if ( is_array ( $ sHomeCountry ) ) { $ this -> _sHomeCountry = current ( $ sHomeCountry ) ; } else { $ this -> _sHomeCountry = $ sHomeCountry ; } }
Home country setter
35,846
public function getDeliveryList ( $ oBasket , $ oUser = null , $ sDelCountry = null , $ sDelSet = null ) { $ aSkipDeliveries = [ ] ; $ aFittingDelSets = [ ] ; $ aDelSetList = \ OxidEsales \ Eshop \ Core \ Registry :: get ( \ OxidEsales \ Eshop \ Application \ Model \ DeliverySetList :: class ) -> getDeliverySetList ( $...
Loads and returns list of deliveries .
35,847
public function hasDeliveries ( $ oBasket , $ oUser , $ sDelCountry , $ sDeliverySetId ) { $ blHas = false ; $ this -> _getList ( $ oUser , $ sDelCountry , $ sDeliverySetId ) ; foreach ( $ this as $ oDelivery ) { if ( $ oDelivery -> isForBasket ( $ oBasket ) ) { $ blHas = true ; break ; } } return $ blHas ; }
Checks if deliveries in list fits for current basket and delivery set
35,848
public function loadDeliveryListForProduct ( $ oProduct ) { $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ dPrice = $ oDb -> quote ( $ oProduct -> getPrice ( ) -> getBruttoPrice ( ) ) ; $ dSize = $ oDb -> quote ( $ oProduct -> getSize ( ) ) ; $ dWeight = $ oDb -> quote ( $ oProduct -> getWeight...
Load oxDeliveryList for product
35,849
protected function _getEditValue ( $ oObject , $ sField ) { $ sEditObjectValue = '' ; if ( $ oObject ) { $ oDescField = $ oObject -> getLongDescription ( ) ; $ sEditObjectValue = $ this -> _processEditValue ( $ oDescField -> getRawValue ( ) ) ; } return $ sEditObjectValue ; }
Returns string which must be edited by editor
35,850
protected function _processLongDesc ( $ sValue ) { $ sValue = str_replace ( '&amp;nbsp;' , '&nbsp;' , $ sValue ) ; $ sValue = str_replace ( '&amp;' , '&' , $ sValue ) ; $ sValue = str_replace ( '&quot;' , '"' , $ sValue ) ; $ sValue = str_replace ( '&lang=' , '&amp;lang=' , $ sValue ) ; $ sValue = str_replace ( '<p>&nb...
Fixes html broken by html editor
35,851
protected function _resetCategoriesCounter ( $ sArticleId ) { $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ sQ = "select oxcatnid from oxobject2category where oxobjectid = " . $ oDb -> quote ( $ sArticleId ) ; $ oRs = $ oDb -> select ( $ sQ ) ; if ( $ oRs !== false && $ oRs -> count ( ) > 0 ) ...
Resets article categories counters
35,852
public function addToCategory ( $ sCatID , $ sOXID ) { $ base = oxNew ( \ OxidEsales \ Eshop \ Core \ Model \ BaseModel :: class ) ; $ base -> init ( "oxobject2category" ) ; $ base -> oxobject2category__oxtime = new \ OxidEsales \ Eshop \ Core \ Field ( 0 ) ; $ base -> oxobject2category__oxobjectid = new \ OxidEsales \...
Add article to category .
35,853
protected function _copyCategories ( $ sOldId , $ newArticleId ) { $ myUtilsObject = \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsObject ( ) ; $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ sO2CView = getViewName ( 'oxobject2category' ) ; $ sQ = "select oxcatnid, oxtime from {$sO2CView} wh...
Copying category assignments
35,854
protected function _copyAttributes ( $ sOldId , $ sNewId ) { $ myUtilsObject = \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsObject ( ) ; $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ sQ = "select oxid from oxobject2attribute where oxobjectid = " . $ oDb -> quote ( $ sOldId ) ; $ oRs = $ o...
Copying attributes assignments
35,855
protected function _copySelectlists ( $ sOldId , $ sNewId ) { $ myUtilsObject = \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsObject ( ) ; $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ sQ = "select oxselnid from oxobject2selectlist where oxobjectid = " . $ oDb -> quote ( $ sOldId ) ; $ oRs...
Copying selectlists assignments
35,856
protected function _copyAccessoires ( $ sOldId , $ sNewId ) { $ myUtilsObject = \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsObject ( ) ; $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ sQ = "select oxobjectid from oxaccessoire2article where oxarticlenid= " . $ oDb -> quote ( $ sOldId ) ; $...
Copying accessoires assignments
35,857
protected function _copyStaffelpreis ( $ sOldId , $ sNewId ) { $ sShopId = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getShopId ( ) ; $ oPriceList = oxNew ( \ OxidEsales \ Eshop \ Core \ Model \ ListModel :: class ) ; $ oPriceList -> init ( "oxbase" , "oxprice2article" ) ; $ sQ = "select * from oxprice2...
Copying staffelpreis assignments
35,858
protected function _copyArtExtends ( $ sOldId , $ sNewId ) { $ oExt = oxNew ( \ OxidEsales \ Eshop \ Core \ Model \ BaseModel :: class ) ; $ oExt -> init ( "oxartextends" ) ; $ oExt -> load ( $ sOldId ) ; $ oExt -> setId ( $ sNewId ) ; $ oExt -> save ( ) ; }
Copying article extends
35,859
protected function _formJumpList ( $ oArticle , $ oParentArticle ) { $ aJumpList = [ ] ; $ sOxIdField = 'oxarticles__oxid' ; if ( isset ( $ oParentArticle ) ) { $ aJumpList [ ] = [ $ oParentArticle -> $ sOxIdField -> value , $ this -> _getTitle ( $ oParentArticle ) ] ; $ sEditLanguageParameter = \ OxidEsales \ Eshop \ ...
Function forms article variants jump list .
35,860
protected function _getTitle ( $ oObj ) { $ sTitle = $ oObj -> oxarticles__oxtitle -> value ; if ( ! strlen ( $ sTitle ) ) { $ sTitle = $ oObj -> oxarticles__oxvarselect -> value ; } return $ sTitle ; }
Returns formed variant title
35,861
protected function formQueryForCopyingToCategory ( $ newArticleId , $ sUid , $ sCatId , $ sTime ) { $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; return "insert into oxobject2category (oxid, oxobjectid, oxcatnid, oxtime) " . "VALUES (" . $ oDb -> quote ( $ sUid ) . ", " . $ oDb -> quote ( $ newA...
Forms query which is used for adding article to category .
35,862
public static function getDb ( $ fetchMode = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: FETCH_MODE_NUM ) { if ( null === static :: $ db ) { $ databaseFactory = static :: getInstance ( ) ; static :: $ db = $ databaseFactory -> createDatabase ( ) ; $ databaseFactory -> onPostConnect ( ) ; } static :: $ db -> setFe...
Return the database connection instance as a singleton .
35,863
public function getTableDescription ( $ tableName ) { if ( ! isset ( self :: $ tblDescCache [ $ tableName ] ) ) { self :: $ tblDescCache [ $ tableName ] = $ this -> fetchTableDescription ( $ tableName ) ; } return self :: $ tblDescCache [ $ tableName ] ; }
Extracts and returns table metadata from DB .
35,864
protected function createDatabase ( ) { $ configFile = $ this -> fetchConfigFile ( ) ; $ this -> validateConfigFile ( $ configFile ) ; $ this -> setConfigFile ( $ configFile ) ; $ connectionParameters = $ this -> getConnectionParameters ( ) ; $ databaseAdapter = new DatabaseAdapter ( ) ; $ databaseAdapter -> setConnect...
Creates database connection and returns it .
35,865
protected function getConnectionParameters ( ) { $ databaseDriver = $ this -> getConfigParam ( 'dbType' ) ; $ databaseHost = $ this -> getConfigParam ( 'dbHost' ) ; $ databasePort = ( int ) $ this -> getConfigParam ( 'dbPort' ) ; if ( ! $ databasePort ) { $ databasePort = 3306 ; } $ databaseName = $ this -> getConfigPa...
Get all parameters needed to connect to the database .
35,866
protected function isDatabaseConfigured ( \ OxidEsales \ Eshop \ Core \ ConfigFile $ config ) { $ isValid = true ; if ( false !== strpos ( $ config -> getVar ( 'dbHost' ) , '<' ) ) { $ isValid = false ; } return $ isValid ; }
Return false if the database connection has not been configured in the eShop configuration file .
35,867
public function getRequiredModules ( ) { if ( $ this -> _aRequiredModules == null ) { $ aRequiredPHPExtensions = [ 'php_xml' , 'j_son' , 'i_conv' , 'tokenizer' , 'mysql_connect' , 'gd_info' , 'mb_string' , 'curl' , 'bc_math' , 'open_ssl' , 'soap' , ] ; $ aRequiredPHPConfigs = [ 'allow_url_fopen' , 'request_uri' , 'ini_...
Sets system required modules
35,868
public function checkServerPermissions ( $ sPath = null , $ iMinPerm = 777 ) { clearstatcache ( ) ; $ sPath = $ sPath ? $ sPath : getShopBasePath ( ) ; $ sFullPath = $ sPath . "config.inc.php" ; if ( ! is_readable ( $ sFullPath ) || ( $ this -> isAdmin ( ) && is_writable ( $ sFullPath ) ) || ( ! $ this -> isAdmin ( ) &...
Checks if permissions on servers are correctly setup
35,869
protected function _getShopHostInfoFromServerVars ( ) { $ sScript = $ _SERVER [ 'SCRIPT_NAME' ] ; $ iPort = ( int ) $ _SERVER [ 'SERVER_PORT' ] ; $ blSsl = ( isset ( $ _SERVER [ 'HTTPS' ] ) && ( $ _SERVER [ 'HTTPS' ] == 'on' ) ) ; if ( ! $ iPort ) { $ iPort = $ blSsl ? 443 : 80 ; } $ sScript = rtrim ( dirname ( dirname...
returns host port base dir ssl information as assotiative array false on error takes this info from _SERVER variable
35,870
public function checkModRewrite ( ) { $ iModStat = null ; $ aHostInfo = $ this -> _getShopHostInfo ( ) ; $ iModStat = $ this -> _checkModRewrite ( $ aHostInfo ) ; $ aSSLHostInfo = $ this -> _getShopSSLHostInfo ( ) ; if ( 0 != $ iModStat && $ aSSLHostInfo ) { $ iSSLModStat = $ this -> _checkModRewrite ( $ aSSLHostInfo )...
Checks if mod_rewrite extension is loaded . Checks for all address .
35,871
protected function _checkModRewrite ( $ aHostInfo ) { $ sHostname = ( $ aHostInfo [ 'ssl' ] ? 'ssl://' : '' ) . $ aHostInfo [ 'host' ] ; if ( $ rFp = @ fsockopen ( $ sHostname , $ aHostInfo [ 'port' ] , $ iErrNo , $ sErrStr , 10 ) ) { $ sReq = "POST {$aHostInfo['dir']}oxseo.php?mod_rewrite_module_is=off HTTP/1.1\r\n" ;...
Checks if mod_rewrite extension is loaded . Checks for one address .
35,872
public function checkFsockopen ( ) { $ result = 1 ; $ iErrNo = 0 ; $ sErrStr = '' ; if ( $ oRes = @ fsockopen ( 'www.example.com' , 80 , $ iErrNo , $ sErrStr , 10 ) ) { $ result = 2 ; fclose ( $ oRes ) ; } return $ result ; }
Check if fsockopen on port 80 possible
35,873
public function checkPhpVersion ( ) { $ requirementFits = null ; $ minimalRequiredVersion = '7.0.0' ; $ minimalRecommendedVersion = '7.0.0' ; $ maximalRecommendedVersion = '7.1.9999' ; $ installedPhpVersion = $ this -> getPhpVersion ( ) ; if ( version_compare ( $ installedPhpVersion , $ minimalRequiredVersion , '<' ) )...
Checks supported PHP versions .
35,874
public function checkMysqlVersion ( $ installedVersion = null ) { $ requirementFits = null ; $ minimalRequiredVersion = '5.5.0' ; $ maximalRequiredVersion = '5.7.9999' ; if ( $ installedVersion === null ) { $ resultContainingDatabaseVersion = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) -> getRow ( "SHOW...
Checks if current mysql version matches requirements
35,875
public function checkGdInfo ( ) { $ iModStat = extension_loaded ( 'gd' ) ? 1 : 0 ; $ iModStat = function_exists ( 'imagecreatetruecolor' ) ? 2 : $ iModStat ; $ iModStat = function_exists ( 'imagecreatefromgif' ) ? $ iModStat : 0 ; $ iModStat = function_exists ( 'imagecreatefromjpeg' ) ? $ iModStat : 0 ; $ iModStat = fu...
Checks if GDlib extension is loaded
35,876
public function checkMemoryLimit ( $ sMemLimit = null ) { if ( $ sMemLimit === null ) { $ sMemLimit = @ ini_get ( 'memory_limit' ) ; } if ( $ sMemLimit ) { $ sDefLimit = $ this -> _getMinimumMemoryLimit ( ) ; $ sRecLimit = $ this -> _getRecommendMemoryLimit ( ) ; $ iMemLimit = $ this -> _getBytes ( $ sMemLimit ) ; if (...
Checks memory limit .
35,877
public function checkFileUploads ( ) { $ dUploadFile = - 1 ; $ sFileUploads = @ ini_get ( 'file_uploads' ) ; if ( $ sFileUploads !== false ) { if ( $ sFileUploads && ( $ sFileUploads == '1' || strtolower ( $ sFileUploads ) == 'on' ) ) { $ dUploadFile = 2 ; } else { $ dUploadFile = 1 ; } } return $ dUploadFile ; }
Checks if php_admin_flag file_uploads is ON
35,878
public function getSysReqStatus ( ) { if ( $ this -> _blSysReqStatus == null ) { $ this -> _blSysReqStatus = true ; $ this -> getSystemInfo ( ) ; $ this -> checkCollation ( ) ; } return $ this -> _blSysReqStatus ; }
Checks system requirements status
35,879
public static function filter ( $ systemRequirementsInfo , $ filterFunction ) { $ iterator = static :: iterateThroughSystemRequirementsInfo ( $ systemRequirementsInfo ) ; foreach ( $ iterator as list ( $ groupId , $ moduleId , $ moduleState ) ) { $ systemRequirementsInfo [ $ groupId ] [ $ moduleId ] = $ filterFunction ...
Apply given filter function to all iterations of SystemRequirementInfo array .
35,880
public function getModuleInfo ( $ sModule = null ) { if ( $ sModule ) { $ iModStat = null ; $ sCheckFunction = "check" . str_replace ( " " , "" , ucwords ( str_replace ( "_" , " " , $ sModule ) ) ) ; $ iModStat = $ this -> $ sCheckFunction ( ) ; return $ iModStat ; } }
Returns passed module state
35,881
public static function canSetupContinue ( $ systemRequirementsInfo ) { $ iterator = static :: iterateThroughSystemRequirementsInfo ( $ systemRequirementsInfo ) ; foreach ( $ iterator as list ( $ groupId , $ moduleId , $ moduleState ) ) { if ( $ moduleState === static :: MODULE_STATUS_BLOCKS_SETUP ) { return false ; } }...
Returns true if given module state is acceptable for setup process to continue .
35,882
protected function _getBytes ( $ sBytes ) { $ sBytes = trim ( $ sBytes ) ; $ sLast = strtolower ( $ sBytes [ strlen ( $ sBytes ) - 1 ] ) ; switch ( $ sLast ) { case 'g' : $ sBytes *= 1024 ; case 'm' : $ sBytes *= 1024 ; case 'k' : $ sBytes *= 1024 ; break ; } return $ sBytes ; }
Parses and calculates given string form byte size value
35,883
protected function _checkTemplateBlock ( $ sTemplate , $ sBlockName ) { $ sTplFile = Registry :: getConfig ( ) -> getTemplatePath ( $ sTemplate , false ) ; if ( ! $ sTplFile || ! file_exists ( $ sTplFile ) ) { $ sTplFile = Registry :: getConfig ( ) -> getTemplatePath ( $ sTemplate , true ) ; if ( ! $ sTplFile || ! file...
check if given template contains the given block
35,884
protected function fetchBlockRecords ( ) { $ activeThemeId = oxNew ( \ OxidEsales \ Eshop \ Core \ Theme :: class ) -> getActiveThemeId ( ) ; $ config = Registry :: getConfig ( ) ; $ database = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: FETCH_MODE_ASSOC )...
Fetch the active template blocks for the active shop and the active theme .
35,885
public function loadOrderFiles ( $ sOrderId ) { $ oOrderFile = $ this -> getBaseObject ( ) ; $ sFields = $ oOrderFile -> getSelectFields ( ) ; $ sShopId = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getShopId ( ) ; $ oOrderFile -> addFieldName ( 'oxorderfiles__oxarticletitle' ) ; $ oOrderFile -> addField...
Returns oxorderfiles list
35,886
public function loadAttributesByIds ( $ aIds ) { if ( ! count ( $ aIds ) ) { return ; } $ sAttrViewName = getViewName ( 'oxattribute' ) ; $ sViewName = getViewName ( 'oxobject2attribute' ) ; $ oxObjectIdsSql = implode ( ',' , \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) -> quoteArray ( $ aIds ) ) ; $ sSe...
Load all attributes by article Id s
35,887
protected function _createAttributeListFromSql ( $ sSelect ) { $ aAttributes = [ ] ; $ rs = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) -> select ( $ sSelect ) ; if ( $ rs != false && $ rs -> count ( ) > 0 ) { while ( ! $ rs -> EOF ) { if ( ! isset ( $ aAttributes [ $ rs -> fields [ 0 ] ] ) ) { $ aAttri...
Fills array with keys and products with value
35,888
public function loadAttributes ( $ sArticleId , $ sParentId = null ) { if ( $ sArticleId ) { $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: FETCH_MODE_ASSOC ) ; $ sAttrViewName = getViewName ( 'oxattribute' ) ; $ sViewName = getViewName ( 'oxobject2at...
Load attributes by article Id
35,889
public function getCategoryAttributes ( $ sCategoryId , $ iLang ) { $ aSessionFilter = \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> getVariable ( 'session_attrfilter' ) ; $ oArtList = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ ArticleList :: class ) ; $ oArtList -> loadCategoryIDs ( $ sCategory...
get category attributes by category Id
35,890
protected function _mergeAttributes ( $ aAttributes , $ aParentAttributes ) { if ( count ( $ aParentAttributes ) ) { $ aAttrIds = [ ] ; foreach ( $ aAttributes as $ aAttribute ) { $ aAttrIds [ ] = $ aAttribute [ 'OXID' ] ; } foreach ( $ aParentAttributes as $ aAttribute ) { if ( ! in_array ( $ aAttribute [ 'OXID' ] , $...
Merge attribute arrays
35,891
public function load ( $ sUserId ) { $ sViewName = getViewName ( 'oxcountry' ) ; $ oBaseObject = $ this -> getBaseObject ( ) ; $ sSelectFields = $ oBaseObject -> getSelectFields ( ) ; $ sSelect = " SELECT {$sSelectFields}, `oxcountry`.`oxtitle` AS oxcountry FROM oxaddress LE...
Selects and loads all address for particular user .
35,892
public function deleteEntry ( ) { $ myConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ sOxId = $ this -> getEditObjectId ( ) ; $ aLangData [ 'params' ] = $ myConfig -> getConfigParam ( 'aLanguageParams' ) ; $ aLangData [ 'lang' ] = $ myConfig -> getConfigParam ( 'aLanguages' ) ; $ aLangData [ 'urls'...
Checks for Malladmin rights
35,893
protected function _getLanguagesList ( ) { $ aLangParams = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'aLanguageParams' ) ; $ aLanguages = \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> getLanguageArray ( ) ; $ sDefaultLang = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig...
Collects shop languages list .
35,894
protected function _sortLanguagesCallback ( $ oLang1 , $ oLang2 ) { $ sSortParam = $ this -> _sDefSortField ; $ sVal1 = is_string ( $ oLang1 -> $ sSortParam ) ? strtolower ( $ oLang1 -> $ sSortParam ) : $ oLang1 -> $ sSortParam ; $ sVal2 = is_string ( $ oLang2 -> $ sSortParam ) ? strtolower ( $ oLang2 -> $ sSortParam )...
Callback function for sorting languages objects . Sorts array according sort parameter
35,895
protected function _resetMultiLangDbFields ( $ iLangId ) { $ iLangId = ( int ) $ iLangId ; if ( $ iLangId ) { \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) -> startTransaction ( ) ; try { $ oDbMeta = oxNew ( \ OxidEsales \ Eshop \ Core \ DbMetaDataHandler :: class ) ; $ oDbMeta -> resetLanguage ( $ iLangI...
Resets all multilanguage fields with specific language id to default value in all tables .
35,896
public function deleteRating ( $ userId , $ ratingId ) { $ rating = $ this -> getRatingById ( $ ratingId ) ; $ this -> validateUserPermissionsToManageRating ( $ rating , $ userId ) ; $ rating = $ this -> disableSubShopDeleteProtectionForRating ( $ rating ) ; $ rating -> delete ( ) ; }
Delete a Rating .
35,897
public function nextTick ( $ iCnt ) { $ iExportedItems = $ iCnt ; $ blContinue = false ; if ( $ oArticle = $ this -> getOneArticle ( $ iCnt , $ blContinue ) ) { $ myConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ oSmarty = \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsView ( ) -> getSmarty ( ) ...
Does Export line by line on position iCnt
35,898
protected function getSubscribedUserIdByEmail ( $ email ) { $ database = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ sEmailAddressQuoted = $ database -> quote ( $ email ) ; $ userOxid = $ database -> getOne ( "select oxid from oxnewssubscribed where oxemail = {$sEmailAddressQuoted} " ) ; return $ us...
Get subscribed user id by email .
35,899
public function loadFromUserId ( $ sOxUserId ) { $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ sOxId = $ oDb -> getOne ( "select oxid from oxnewssubscribed where oxuserid = {$oDb->quote($sOxUserId)} and oxshopid = {$oDb->quote(\OxidEsales\Eshop\Core\Registry::getConfig()->getShopId())}" ) ; re...
Loader which loads news subscription according to subscribers oxid