idx
int64
0
60.3k
question
stringlengths
101
6.21k
target
stringlengths
7
803
38,000
public function getArticleUser ( ) { if ( $ this -> _oUser === null ) { $ this -> _oUser = $ this -> getUser ( ) ; } return $ this -> _oUser ; }
Returns article user
38,001
protected function _applyParentVat ( $ oPrice ) { if ( ( $ oParent = $ this -> getParent ( ) ) && ! \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'bl_perfCalcVatOnlyForBasketOrder' ) ) { $ oParent -> applyVats ( $ oPrice ) ; } }
apply parent article VAT to given price
38,002
public function getFPrice ( ) { $ sPrice = null ; if ( ( $ oPrice = $ this -> getPrice ( ) ) ) { $ sPrice = \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> formatCurrency ( $ oPrice -> getBruttoPrice ( ) ) ; } return $ sPrice ; }
Returns formated product price .
38,003
public function inCategory ( $ sCatNid ) { $ blIn = false ; if ( ( $ oParent = $ this -> getParent ( ) ) ) { $ blIn = $ oParent -> inCategory ( $ sCatNid ) ; } return $ blIn ; }
Checks if article is assigned to category
38,004
public function getActCatType ( ) { $ sType = false ; $ aData = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( "aSeoData" ) ; if ( $ aData && isset ( $ aData [ "oxparams" ] ) ) { $ oStr = getStr ( ) ; $ iEndPos = $ oStr -> strpos ( $ aData [ "oxparams" ] , "#" ) ; $ sType = $ oStr -> substr ( $ aData [ "oxparams" ] , 0 , $ iEndPos ) ; } elseif ( $ aList = $ this -> getSelectionList ( ) ) { reset ( $ aList ) ; $ sType = key ( $ aList ) ; } return $ sType ; }
Returns active selection type - oxcategory oxmanufacturer oxvendor
38,005
protected function _getCategoryList ( $ oArticle ) { $ sMainCatId = false ; if ( $ oMainCat = $ oArticle -> getCategory ( ) ) { $ sMainCatId = $ oMainCat -> getId ( ) ; } $ aCatList = [ ] ; $ iLang = $ this -> getEditLang ( ) ; $ sView = getViewName ( 'oxobject2category' ) ; $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: FETCH_MODE_ASSOC ) ; $ sSqlForPriceCategories = $ oArticle -> getSqlForPriceCategories ( 'oxid' ) ; $ sQuotesArticleId = $ oDb -> quote ( $ oArticle -> getId ( ) ) ; $ sQ = "select oxobject2category.oxcatnid as oxid from {$sView} as oxobject2category " . "where oxobject2category.oxobjectid=" . $ sQuotesArticleId . " union " . $ sSqlForPriceCategories ; $ oRs = $ oDb -> select ( $ sQ ) ; if ( $ oRs != false && $ oRs -> count ( ) > 0 ) { while ( ! $ oRs -> EOF ) { $ oCat = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Category :: class ) ; if ( $ oCat -> loadInLang ( $ iLang , current ( $ oRs -> fields ) ) ) { if ( $ sMainCatId == $ oCat -> getId ( ) ) { $ sSuffix = \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> translateString ( '(main category)' , $ this -> getEditLang ( ) ) ; $ sTitleField = 'oxcategories__oxtitle' ; $ sTitle = $ oCat -> $ sTitleField -> getRawValue ( ) . " " . $ sSuffix ; $ oCat -> $ sTitleField = new \ OxidEsales \ Eshop \ Core \ Field ( $ sTitle , \ OxidEsales \ Eshop \ Core \ Field :: T_RAW ) ; } $ aCatList [ ] = $ oCat ; } $ oRs -> fetchRow ( ) ; } } return $ aCatList ; }
Returns array of product categories
38,006
protected function _getVendorList ( $ oArticle ) { if ( $ oArticle -> oxarticles__oxvendorid -> value ) { $ oVendor = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Vendor :: class ) ; if ( $ oVendor -> loadInLang ( $ this -> getEditLang ( ) , $ oArticle -> oxarticles__oxvendorid -> value ) ) { return [ $ oVendor ] ; } } }
Returns array containing product vendor object
38,007
protected function _getManufacturerList ( $ oArticle ) { if ( $ oArticle -> oxarticles__oxmanufacturerid -> value ) { $ oManufacturer = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Manufacturer :: class ) ; if ( $ oManufacturer -> loadInLang ( $ this -> getEditLang ( ) , $ oArticle -> oxarticles__oxmanufacturerid -> value ) ) { return [ $ oManufacturer ] ; } } }
Returns array containing product manufacturer object
38,008
public function getActCategory ( ) { $ oCat = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Category :: class ) ; return ( $ oCat -> load ( $ this -> getActCatId ( ) ) ) ? $ oCat : null ; }
Returns active category object used for seo url getter
38,009
public function getActVendor ( ) { $ oVendor = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Vendor :: class ) ; return ( $ this -> getActCatType ( ) == 'oxvendor' && $ oVendor -> load ( $ this -> getActCatId ( ) ) ) ? $ oVendor : null ; }
Returns active vendor object if available
38,010
public function getActManufacturer ( ) { $ oManufacturer = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Manufacturer :: class ) ; $ blLoaded = $ this -> getActCatType ( ) == 'oxmanufacturer' && $ oManufacturer -> load ( $ this -> getActCatId ( ) ) ; return ( $ blLoaded ) ? $ oManufacturer : null ; }
Returns active manufacturer object if available
38,011
public function getClassName ( $ classAlias ) { $ className = $ classAlias ; if ( array_key_exists ( $ classAlias , $ this -> classMap ) ) { $ className = $ this -> classMap [ $ classAlias ] ; } return $ className ; }
Returns real class name from given alias . If class alias is not found given class alias is thought to be a real class and is returned .
38,012
public function getClassAliasName ( $ className ) { $ className = ltrim ( $ className , '\\' ) ; $ classAlias = array_search ( $ className , $ this -> classMap ) ; if ( $ classAlias === false ) { $ classAlias = null ; } return $ classAlias ; }
Method returns class alias by given class name .
38,013
protected function preAssignObject ( $ shopObject , $ data , $ allowCustomShopId ) { $ data = parent :: preAssignObject ( $ shopObject , $ data , $ allowCustomShopId ) ; $ persParamValues = @ unserialize ( $ data [ 'OXPERSPARAM' ] ) ; if ( ! is_array ( $ persParamValues ) ) { $ persParamValues = explode ( "|" , $ data [ 'OXPERSPARAM' ] ) ; $ data [ 'OXPERSPARAM' ] = serialize ( $ persParamValues ) ; } if ( array_key_exists ( 'OXORDERSHOPID' , $ data ) ) { $ data [ 'OXORDERSHOPID' ] = $ this -> getOrderShopId ( $ data [ 'OXORDERSHOPID' ] ) ; } return $ data ; }
issued before saving an object . can modify aData for saving
38,014
private function _filterFields ( $ aFields , $ sPrefix ) { $ aAllowed = [ ] ; foreach ( $ aFields as $ sKey => $ sValue ) { if ( strpos ( $ sValue , $ sPrefix ) === 0 ) { $ aAllowed [ ] = $ aFields [ $ sKey ] ; } } return $ aAllowed ; }
Removes delivery fields from fields list .
38,015
protected function getCategoryToRender ( ) { $ config = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ this -> _blIsCat = false ; if ( 'oxmore' == $ config -> getRequestParameter ( 'cnid' ) ) { $ this -> _sThisTemplate = $ this -> _sThisMoreTemplate ; $ category = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Category :: class ) ; $ category -> oxcategories__oxactive = new \ OxidEsales \ Eshop \ Core \ Field ( 1 , \ OxidEsales \ Eshop \ Core \ Field :: T_RAW ) ; $ this -> setActiveCategory ( $ category ) ; } elseif ( ( $ category = $ this -> getActiveCategory ( ) ) ) { $ this -> _blIsCat = true ; $ this -> _blBargainAction = true ; } return $ category ; }
Returns category which should be rendered . In case of more categories page is viewed sets more categories template sets empty category as active category and returns it .
38,016
public function executefilter ( ) { $ baseLanguageId = \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> getBaseLanguage ( ) ; $ attributeFilter = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'attrfilter' , true ) ; $ activeCategory = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'cnid' ) ; if ( ! empty ( $ attributeFilter ) ) { $ sessionFilter = \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> getVariable ( 'session_attrfilter' ) ; $ sessionFilter [ $ activeCategory ] = null ; $ sessionFilter [ $ activeCategory ] [ $ baseLanguageId ] = $ attributeFilter ; \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> setVariable ( 'session_attrfilter' , $ sessionFilter ) ; } }
Stores chosen category filter into session .
38,017
public function resetFilter ( ) { $ activeCategory = Registry :: getConfig ( ) -> getRequestParameter ( 'cnid' ) ; $ sessionFilter = Registry :: getSession ( ) -> getVariable ( 'session_attrfilter' ) ; unset ( $ sessionFilter [ $ activeCategory ] ) ; Registry :: getSession ( ) -> setVariable ( 'session_attrfilter' , $ sessionFilter ) ; }
Reset filter .
38,018
protected function _loadArticles ( $ category ) { $ config = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ numberOfCategoryArticles = ( int ) $ config -> getConfigParam ( 'iNrofCatArticles' ) ; $ numberOfCategoryArticles = $ numberOfCategoryArticles ? $ numberOfCategoryArticles : 1 ; $ articleList = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ ArticleList :: class ) ; $ articleList -> setSqlLimit ( $ numberOfCategoryArticles * $ this -> _getRequestPageNr ( ) , $ numberOfCategoryArticles ) ; $ articleList -> setCustomSorting ( $ this -> getSortingSql ( $ this -> getSortIdent ( ) ) ) ; if ( $ category -> isPriceCategory ( ) ) { $ priceFrom = $ category -> oxcategories__oxpricefrom -> value ; $ priceTo = $ category -> oxcategories__oxpriceto -> value ; $ this -> _iAllArtCnt = $ articleList -> loadPriceArticles ( $ priceFrom , $ priceTo , $ category ) ; } else { $ sessionFilter = \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> getVariable ( 'session_attrfilter' ) ; $ activeCategoryId = $ category -> getId ( ) ; $ this -> _iAllArtCnt = $ articleList -> loadCategoryArticles ( $ activeCategoryId , $ sessionFilter ) ; } $ this -> _iCntPages = ceil ( $ this -> _iAllArtCnt / $ numberOfCategoryArticles ) ; return $ articleList ; }
Loads and returns article list of active category .
38,019
protected function _getListDisplayType ( ) { $ listDisplayType = \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> getVariable ( 'ldtype' ) ; if ( is_null ( $ listDisplayType ) ) { $ listDisplayType = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'sDefaultListDisplayType' ) ; } return $ listDisplayType ; }
Get list display type
38,020
protected function _prepareMetaDescription ( $ meta , $ length = 1024 , $ descriptionTag = false ) { $ description = '' ; if ( $ activeCategory = $ this -> getActiveCategory ( ) ) { if ( ( $ parentCategory = $ activeCategory -> getParentCategory ( ) ) ) { $ description .= " {$parentCategory->oxcategories__oxtitle->value} -" ; } $ description .= " {$activeCategory->oxcategories__oxtitle->value}." ; } if ( ( $ suffix = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getActiveShop ( ) -> oxshops__oxtitleprefix -> value ) ) { $ description .= " {$suffix}" ; } $ description = getStr ( ) -> html_entity_decode ( $ description ) ; $ description = getStr ( ) -> strip_tags ( $ description ) ; $ description = getStr ( ) -> cleanStr ( $ description ) ; $ description = getStr ( ) -> htmlspecialchars ( $ description ) ; return trim ( $ description ) ; }
Returns current view meta description data .
38,021
protected function _collectMetaKeyword ( $ keywords ) { $ maxTextLength = 60 ; $ text = '' ; if ( count ( $ articleList = $ this -> getArticleList ( ) ) ) { $ stringModifier = getStr ( ) ; foreach ( $ articleList as $ article ) { $ description = $ stringModifier -> strip_tags ( trim ( $ stringModifier -> strtolower ( $ article -> getLongDescription ( ) -> value ) ) ) ; $ description = $ stringModifier -> preg_replace ( "/\./" , " " , $ description ) ; if ( $ stringModifier -> strlen ( $ description ) > $ maxTextLength ) { $ midText = $ stringModifier -> substr ( $ description , 0 , $ maxTextLength ) ; $ description = $ stringModifier -> substr ( $ midText , 0 , ( $ stringModifier -> strlen ( $ midText ) - $ stringModifier -> strpos ( strrev ( $ midText ) , ' ' ) ) ) ; } if ( $ text ) { $ text .= ', ' ; } $ text .= $ description ; } } if ( ! $ keywords ) { $ keywords = $ this -> _getCatPathString ( ) ; } if ( $ keywords ) { $ text = "{$keywords}, {$text}" ; } return parent :: _prepareMetaKeyword ( $ text ) ; }
Creates a string of keyword filtered by the function prepareMetaDescription and without any duplicates additional the admin defined strings are removed
38,022
protected function _addPageNrParam ( $ url , $ currentPage , $ languageId = null ) { if ( \ OxidEsales \ Eshop \ Core \ Registry :: getUtils ( ) -> seoIsActive ( ) && ( $ category = $ this -> getActiveCategory ( ) ) ) { if ( $ currentPage ) { $ url = $ category -> getBaseSeoLink ( $ languageId , $ currentPage ) ; } } else { $ url = parent :: _addPageNrParam ( $ url , $ currentPage , $ languageId ) ; } return $ url ; }
Adds page number parameter to current Url and returns formatted url
38,023
public function getTitlePageSuffix ( ) { if ( ( $ activePage = $ this -> getActPage ( ) ) ) { return \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> translateString ( 'PAGE' ) . " " . ( $ activePage + 1 ) ; } }
Returns title page suffix used in template
38,024
public function getAttributes ( ) { $ this -> _aAttributes = false ; if ( ( $ category = $ this -> getActiveCategory ( ) ) ) { $ attributes = $ category -> getAttributes ( ) ; if ( count ( $ attributes ) ) { $ this -> _aAttributes = $ attributes ; } } return $ this -> _aAttributes ; }
Template variable getter . Returns array of attribute values we do have here in this category
38,025
public function getCatTreePath ( ) { if ( $ this -> _sCatTreePath === null ) { $ this -> _sCatTreePath = false ; if ( $ categoryTree = $ this -> getCategoryTree ( ) ) { $ this -> _sCatTreePath = $ categoryTree -> getPath ( ) ; } } return $ this -> _sCatTreePath ; }
Template variable getter . Returns category path
38,026
public function hasVisibleSubCats ( ) { if ( $ this -> _blHasVisibleSubCats === null ) { $ this -> _blHasVisibleSubCats = false ; if ( $ activeCategory = $ this -> getActiveCategory ( ) ) { $ this -> _blHasVisibleSubCats = $ activeCategory -> getHasVisibleSubCats ( ) ; } } return $ this -> _blHasVisibleSubCats ; }
Template variable getter . Returns true if category has active subcategories .
38,027
public function getSubCatList ( ) { if ( $ this -> _aSubCatList === null ) { $ this -> _aSubCatList = [ ] ; if ( $ activeCategory = $ this -> getActiveCategory ( ) ) { $ this -> _aSubCatList = $ activeCategory -> getSubCats ( ) ; } } return $ this -> _aSubCatList ; }
Template variable getter . Returns list of subcategories .
38,028
public function getTitle ( ) { if ( $ this -> _sCatTitle === null ) { $ this -> _sCatTitle = false ; if ( $ this -> getCategoryId ( ) == 'oxmore' ) { $ language = \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) ; $ baseLanguageId = $ language -> getBaseLanguage ( ) ; $ this -> _sCatTitle = $ language -> translateString ( 'CATEGORY_OVERVIEW' , $ baseLanguageId , false ) ; } elseif ( ( $ category = $ this -> getActiveCategory ( ) ) ) { $ this -> _sCatTitle = $ category -> oxcategories__oxtitle -> value ; } } return $ this -> _sCatTitle ; }
Template variable getter . Returns category title .
38,029
public function getActiveCategory ( ) { if ( $ this -> _oActCategory === null ) { $ this -> _oActCategory = false ; $ category = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Category :: class ) ; if ( $ category -> load ( $ this -> getCategoryId ( ) ) ) { $ this -> _oActCategory = $ category ; } } return $ this -> _oActCategory ; }
Template variable getter . Returns active search
38,030
public function getAddUrlParams ( ) { $ sAddParams = parent :: getAddUrlParams ( ) ; $ sAddParams .= ( $ sAddParams ? '&' : '' ) . "listtype={$this->_sListType}" ; $ oConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; if ( $ sParam = $ oConfig -> getRequestParameter ( 'searchparam' , true ) ) { $ sAddParams .= "&searchparam=" . rawurlencode ( $ sParam ) ; } if ( $ sParam = $ oConfig -> getRequestParameter ( 'searchcnid' ) ) { $ sAddParams .= "&searchcnid=$sParam" ; } if ( $ sParam = rawurldecode ( $ oConfig -> getRequestParameter ( 'searchvendor' ) ) ) { $ sAddParams .= "&searchvendor=$sParam" ; } if ( $ sParam = rawurldecode ( $ oConfig -> getRequestParameter ( 'searchmanufacturer' ) ) ) { $ sAddParams .= "&searchmanufacturer=$sParam" ; } return $ sAddParams ; }
Returns additional URL parameters which must be added to list products urls
38,031
protected function _isSearchClass ( ) { if ( $ this -> _blSearchClass === null ) { $ this -> _blSearchClass = false ; if ( 'search' == strtolower ( \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestControllerId ( ) ) ) { $ this -> _blSearchClass = true ; } } return $ this -> _blSearchClass ; }
Template variable getter . Returns similar recommendation lists
38,032
public function getSearchCatId ( ) { if ( $ this -> _sSearchCatId === null ) { $ this -> _sSearchCatId = false ; if ( $ this -> _isSearchClass ( ) ) { $ this -> _sSearchCatId = rawurldecode ( \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'searchcnid' ) ) ; } } return $ this -> _sSearchCatId ; }
Template variable getter . Returns searched category id
38,033
public function getSearchVendor ( ) { if ( $ this -> _sSearchVendor === null ) { $ this -> _sSearchVendor = false ; if ( $ this -> _isSearchClass ( ) ) { $ this -> _sSearchVendor = rawurldecode ( \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'searchvendor' ) ) ; } } return $ this -> _sSearchVendor ; }
Template variable getter . Returns searched vendor id
38,034
public function getSearchManufacturer ( ) { if ( $ this -> _sSearchManufacturer === null ) { $ this -> _sSearchManufacturer = false ; if ( $ this -> _isSearchClass ( ) ) { $ sManufacturerParameter = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'searchmanufacturer' ) ; $ this -> _sSearchManufacturer = rawurldecode ( $ sManufacturerParameter ) ; } } return $ this -> _sSearchManufacturer ; }
Template variable getter . Returns searched Manufacturer id
38,035
public function getTitle ( ) { $ sTitle = '' ; $ sTitle .= $ this -> getArticleCount ( ) ; $ iBaseLanguage = \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> getBaseLanguage ( ) ; $ sTitle .= ' ' . \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> translateString ( 'HITS_FOR' , $ iBaseLanguage , false ) ; $ sTitle .= ' "' . $ this -> getSearchParamForHtml ( ) . '"' ; return $ sTitle ; }
Return page title
38,036
public function setLanguage ( $ iLanguage = null ) { if ( ! isset ( $ iLanguage ) ) { $ this -> _iLanguage = \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> getBaseLanguage ( ) ; } else { $ this -> _iLanguage = $ iLanguage ; } }
Search language setter . If no param is passed will be taken default shop language
38,037
public function getSearchArticles ( $ sSearchParamForQuery = false , $ sInitialSearchCat = false , $ sInitialSearchVendor = false , $ sInitialSearchManufacturer = false , $ sSortBy = false ) { $ this -> iActPage = ( int ) \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'pgNr' ) ; $ this -> iActPage = ( $ this -> iActPage < 0 ) ? 0 : $ this -> iActPage ; $ iNrofCatArticles = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'iNrofCatArticles' ) ; $ iNrofCatArticles = $ iNrofCatArticles ? $ iNrofCatArticles : 10 ; $ oArtList = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ ArticleList :: class ) ; $ oArtList -> setSqlLimit ( $ iNrofCatArticles * $ this -> iActPage , $ iNrofCatArticles ) ; $ sSelect = $ this -> _getSearchSelect ( $ sSearchParamForQuery , $ sInitialSearchCat , $ sInitialSearchVendor , $ sInitialSearchManufacturer , $ sSortBy ) ; if ( $ sSelect ) { $ oArtList -> selectString ( $ sSelect ) ; } return $ oArtList ; }
Returns a list of articles according to search parameters . Returns matched
38,038
public function getSearchArticleCount ( $ sSearchParamForQuery = false , $ sInitialSearchCat = false , $ sInitialSearchVendor = false , $ sInitialSearchManufacturer = false ) { $ iCnt = 0 ; $ sSelect = $ this -> _getSearchSelect ( $ sSearchParamForQuery , $ sInitialSearchCat , $ sInitialSearchVendor , $ sInitialSearchManufacturer , false ) ; if ( $ sSelect ) { $ sPartial = substr ( $ sSelect , strpos ( $ sSelect , ' from ' ) ) ; $ sSelect = "select count( " . getViewName ( 'oxarticles' , $ this -> _iLanguage ) . ".oxid ) $sPartial " ; $ iCnt = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) -> getOne ( $ sSelect ) ; } return $ iCnt ; }
Returns the amount of articles according to search parameters .
38,039
protected function getSearchField ( $ table , $ field ) { if ( $ field == 'oxlongdesc' ) { $ searchField = getViewName ( 'oxartextends' , $ this -> _iLanguage ) . ".{$field}" ; } else { $ searchField = "{$table}.{$field}" ; } return $ searchField ; }
Get search field name . Needed in case of searching for data in table oxartextends or its views .
38,040
public function addUserToUGroup ( ) { $ aAddUsers = $ this -> _getActionIds ( 'oxuser.oxid' ) ; $ soxId = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'synchoxid' ) ; if ( \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'all' ) ) { $ sUserTable = $ this -> _getViewName ( 'oxuser' ) ; $ aAddUsers = $ this -> _getAll ( $ this -> _addFilter ( "select $sUserTable.oxid " . $ this -> _getQuery ( ) ) ) ; } if ( $ soxId && $ soxId != "-1" && is_array ( $ aAddUsers ) ) { foreach ( $ aAddUsers as $ sAdduser ) { $ oNewGroup = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Object2Group :: class ) ; $ oNewGroup -> oxobject2group__oxobjectid = new \ OxidEsales \ Eshop \ Core \ Field ( $ sAdduser ) ; $ oNewGroup -> oxobject2group__oxgroupsid = new \ OxidEsales \ Eshop \ Core \ Field ( $ soxId ) ; $ oNewGroup -> save ( ) ; } } }
Adds User to group
38,041
public function assignValuesFromText ( $ sIn , $ dVat = null ) { $ aRet = [ ] ; $ aPieces = explode ( '@@' , $ sIn ) ; foreach ( $ aPieces as $ sVal ) { if ( $ sVal ) { $ aName = explode ( '__' , $ sVal ) ; if ( isset ( $ aName [ 0 ] ) && isset ( $ aName [ 1 ] ) ) { $ aRet [ ] = $ this -> _fillExplodeArray ( $ aName , $ dVat ) ; } } } return $ aRet ; }
Takes a string and assign all values returns array with values .
38,042
public function assignValuesToText ( $ aIn ) { $ sRet = "" ; reset ( $ aIn ) ; foreach ( $ aIn as $ sKey => $ sVal ) { $ sRet .= $ sKey ; $ sRet .= "__" ; $ sRet .= $ sVal ; $ sRet .= "@@" ; } return $ sRet ; }
Takes an array and builds again a string . Returns string with values .
38,043
public function currency2Float ( $ sValue ) { $ fRet = $ sValue ; $ iPos = strrpos ( $ sValue , "." ) ; if ( $ iPos && ( ( strlen ( $ sValue ) - 1 - $ iPos ) < 2 + 1 ) ) { $ fRet = substr_replace ( $ fRet , "," , $ iPos , 1 ) ; } $ fRet = str_replace ( [ " " , "." ] , "" , $ fRet ) ; return ( float ) str_replace ( "," , "." , $ fRet ) ; }
Returns formatted currency string according to formatting standards .
38,044
public function string2Float ( $ sValue ) { $ fRet = str_replace ( " " , "" , $ sValue ) ; $ iCommaPos = strpos ( $ fRet , "," ) ; $ iDotPos = strpos ( $ fRet , "." ) ; if ( ! $ iDotPos xor ! $ iCommaPos ) { if ( substr_count ( $ fRet , "," ) > 1 || substr_count ( $ fRet , "." ) > 1 ) { $ fRet = str_replace ( [ "," , "." ] , "" , $ fRet ) ; } else { $ fRet = str_replace ( "," , "." , $ fRet ) ; } } else { if ( $ iDotPos < $ iCommaPos ) { $ fRet = str_replace ( "." , "" , $ fRet ) ; $ fRet = str_replace ( "," , "." , $ fRet ) ; } } return ( float ) str_replace ( [ " " , "," ] , "" , $ fRet ) ; }
Returns formatted float according to formatting standards .
38,045
public function isSearchEngine ( $ sClient = null ) { if ( is_null ( $ this -> _blIsSe ) ) { $ this -> setSearchEngine ( null , $ sClient ) ; } return $ this -> _blIsSe ; }
Checks if current web client is Search Engine . Returns true on success .
38,046
public function setSearchEngine ( $ blIsSe = null , $ sClient = null ) { if ( isset ( $ blIsSe ) ) { $ this -> _blIsSe = $ blIsSe ; return ; } startProfile ( "isSearchEngine" ) ; $ myConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ blIsSe = false ; if ( ! ( $ myConfig -> getConfigParam ( 'iDebug' ) && $ this -> isAdmin ( ) ) ) { $ aRobots = $ myConfig -> getConfigParam ( 'aRobots' ) ; $ aRobots = is_array ( $ aRobots ) ? $ aRobots : [ ] ; $ aRobotsExcept = $ myConfig -> getConfigParam ( 'aRobotsExcept' ) ; $ aRobotsExcept = is_array ( $ aRobotsExcept ) ? $ aRobotsExcept : [ ] ; $ sClient = $ sClient ? $ sClient : strtolower ( getenv ( 'HTTP_USER_AGENT' ) ) ; $ blIsSe = false ; $ aRobots = array_merge ( $ aRobots , $ aRobotsExcept ) ; foreach ( $ aRobots as $ sRobot ) { if ( strpos ( $ sClient , $ sRobot ) !== false ) { $ blIsSe = true ; break ; } } } $ this -> _blIsSe = $ blIsSe ; stopProfile ( "isSearchEngine" ) ; }
Sets if current web client is Search Engine .
38,047
public function loadAdminProfile ( $ aInterfaceProfiles ) { if ( is_array ( $ aInterfaceProfiles ) ) { $ sPrevProfile = \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsServer ( ) -> getOxCookie ( 'oxidadminprofile' ) ; if ( isset ( $ sPrevProfile ) ) { $ aPrevProfile = @ explode ( "@" , trim ( $ sPrevProfile ) ) ; } $ aProfiles = [ ] ; foreach ( $ aInterfaceProfiles as $ iPos => $ sProfile ) { $ aProfileSettings = [ $ iPos , $ sProfile ] ; $ aProfiles [ ] = $ aProfileSettings ; } if ( isset ( $ aPrevProfile [ 0 ] ) && isset ( $ aProfiles [ $ aPrevProfile [ 0 ] ] ) ) { $ aProfiles [ $ aPrevProfile [ 0 ] ] [ 2 ] = 1 ; } \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> setVariable ( "aAdminProfiles" , $ aProfiles ) ; return $ aProfiles ; } return null ; }
Parses profile configuration loads stored info in cookie
38,048
public function fRound ( $ sVal , $ oCur = null ) { startProfile ( 'fround' ) ; $ iCurPrecision = $ this -> _iCurPrecision ; if ( is_null ( $ iCurPrecision ) ) { if ( ! $ oCur ) { $ oCur = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getActShopCurrencyObject ( ) ; } $ iCurPrecision = $ oCur -> decimal ; $ this -> _iCurPrecision = $ iCurPrecision ; } static $ dprez = null ; if ( ! $ dprez ) { $ prez = @ ini_get ( "precision" ) ; if ( ! $ prez || $ prez > 12 ) { $ prez = 12 ; } $ dprez = pow ( 10 , - $ prez ) ; } stopProfile ( 'fround' ) ; $ sVal = ( float ) $ sVal ; return round ( $ sVal + $ dprez * ( $ sVal >= 0 ? 1 : - 1 ) , $ iCurPrecision ) ; }
Rounds the value to currency cents . This method does NOT format the number .
38,049
public function toStaticCache ( $ sName , $ sContent , $ sKey = null ) { if ( $ sKey ) { $ this -> _aStaticCache [ $ sName ] [ $ sKey ] = $ sContent ; } else { $ this -> _aStaticCache [ $ sName ] = $ sContent ; } }
Stores something into static cache to avoid double loading
38,050
public function cleanStaticCache ( $ sCacheName = null ) { if ( $ sCacheName ) { unset ( $ this -> _aStaticCache [ $ sCacheName ] ) ; } else { $ this -> _aStaticCache = null ; } }
Cleans all or specific data from static cache
38,051
public function toPhpFileCache ( $ sKey , $ mContents ) { if ( is_array ( $ mContents ) && ( $ sCachePath = $ this -> getCacheFilePath ( $ sKey , false , 'php' ) ) ) { $ this -> setCacheMeta ( $ sKey , [ "serialize" => false , "cachepath" => $ sCachePath ] ) ; $ this -> toFileCache ( $ sKey , $ mContents ) ; } }
Generates php file which could later be loaded as include instead of parsed data . Currently this method supports simple arrays only .
38,052
public function fromPhpFileCache ( $ sKey ) { $ this -> setCacheMeta ( $ sKey , [ "include" => true , "cachepath" => $ this -> getCacheFilePath ( $ sKey , false , 'php' ) ] ) ; return $ this -> fromFileCache ( $ sKey ) ; }
Includes cached php file and loads stored contents .
38,053
public function getCacheMeta ( $ sKey ) { return isset ( $ this -> _aFileCacheMeta [ $ sKey ] ) ? $ this -> _aFileCacheMeta [ $ sKey ] : false ; }
If available returns cache meta data array
38,054
public function fromFileCache ( $ sKey ) { if ( ! array_key_exists ( $ sKey , $ this -> _aFileCacheContents ) ) { $ sRes = null ; $ aMeta = $ this -> getCacheMeta ( $ sKey ) ; $ blInclude = isset ( $ aMeta [ "include" ] ) ? $ aMeta [ "include" ] : false ; $ sCachePath = isset ( $ aMeta [ "cachepath" ] ) ? $ aMeta [ "cachepath" ] : $ this -> getCacheFilePath ( $ sKey ) ; $ this -> _lockFile ( $ sCachePath , $ sKey , LOCK_SH ) ; clearstatcache ( ) ; if ( is_readable ( $ sCachePath ) ) { $ sRes = $ blInclude ? $ this -> _includeFile ( $ sCachePath ) : $ this -> _readFile ( $ sCachePath ) ; } if ( isset ( $ sRes [ 'ttl' ] ) && $ sRes [ 'ttl' ] != 0 ) { $ iTimestamp = $ sRes [ 'timestamp' ] ; $ iTtl = $ sRes [ 'ttl' ] ; $ iTime = \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsDate ( ) -> getTime ( ) ; if ( $ iTime > $ iTimestamp + $ iTtl ) { return null ; } } $ this -> _releaseFile ( $ sKey , LOCK_SH ) ; $ this -> _aFileCacheContents [ $ sKey ] = $ sRes ; } return $ this -> _aFileCacheContents [ $ sKey ] [ 'content' ] ; }
Fetches contents from file cache .
38,055
protected function _processCache ( $ sKey , $ mContents ) { $ aCacheMeta = $ this -> getCacheMeta ( $ sKey ) ; $ blSerialize = isset ( $ aCacheMeta [ "serialize" ] ) ? $ aCacheMeta [ "serialize" ] : true ; if ( $ blSerialize ) { $ mContents = serialize ( $ mContents ) ; } else { $ mContents = "<?php\n//automatically generated file\n//" . date ( "Y-m-d H:i:s" ) . "\n\n\$_aCacheContents = " . var_export ( $ mContents , true ) . "\n?>" ; } return $ mContents ; }
Serializes or writes php array for class file cache
38,056
public function commitFileCache ( ) { if ( ! empty ( $ this -> _aLockedFileHandles [ LOCK_EX ] ) ) { startProfile ( "!__SAVING CACHE__! (warning)" ) ; foreach ( $ this -> _aLockedFileHandles [ LOCK_EX ] as $ sKey => $ rHandle ) { if ( $ rHandle !== false && isset ( $ this -> _aFileCacheContents [ $ sKey ] ) ) { ftruncate ( $ rHandle , 0 ) ; fwrite ( $ rHandle , $ this -> _processCache ( $ sKey , $ this -> _aFileCacheContents [ $ sKey ] ) ) ; $ this -> _releaseFile ( $ sKey ) ; } } stopProfile ( "!__SAVING CACHE__! (warning)" ) ; $ this -> _aFileCacheContents = [ ] ; } }
Writes all cache contents to file at once . This method was introduced due to possible race conditions . Cache is cleaned up after commit
38,057
protected function _lockFile ( $ sFilePath , $ sIdent , $ iLockMode = LOCK_EX ) { $ rHandle = isset ( $ this -> _aLockedFileHandles [ $ iLockMode ] [ $ sIdent ] ) ? $ this -> _aLockedFileHandles [ $ iLockMode ] [ $ sIdent ] : null ; if ( $ rHandle === null ) { $ blLocked = false ; $ rHandle = @ fopen ( $ sFilePath , "a+" ) ; if ( $ rHandle !== false ) { if ( flock ( $ rHandle , $ iLockMode | LOCK_NB ) ) { if ( $ iLockMode === LOCK_EX ) { $ blLocked = ftruncate ( $ rHandle , 0 ) ; } else { $ blLocked = fseek ( $ rHandle , 0 ) === 0 ; } } if ( ! $ blLocked ) { fclose ( $ rHandle ) ; $ rHandle = false ; } } if ( ! $ blLocked && $ iLockMode === LOCK_EX ) { if ( count ( $ this -> _aLockedFileHandles ) == 0 ) { clearstatcache ( ) ; } if ( ! ( file_exists ( $ sFilePath ) && ! filesize ( $ sFilePath ) && abs ( time ( ) - filectime ( $ sFilePath ) < 40 ) ) ) { $ rHandle = @ fopen ( $ sFilePath , "w" ) ; } } $ this -> _aLockedFileHandles [ $ iLockMode ] [ $ sIdent ] = $ rHandle ; } return $ rHandle ; }
Locks cache file and returns its handle on success or false on failure
38,058
protected function _releaseFile ( $ sIdent , $ iLockMode = LOCK_EX ) { $ blSuccess = true ; if ( isset ( $ this -> _aLockedFileHandles [ $ iLockMode ] [ $ sIdent ] ) && $ this -> _aLockedFileHandles [ $ iLockMode ] [ $ sIdent ] !== false ) { $ blSuccess = flock ( $ this -> _aLockedFileHandles [ $ iLockMode ] [ $ sIdent ] , LOCK_UN ) && fclose ( $ this -> _aLockedFileHandles [ $ iLockMode ] [ $ sIdent ] ) ; unset ( $ this -> _aLockedFileHandles [ $ iLockMode ] [ $ sIdent ] ) ; } return $ blSuccess ; }
Releases file lock and returns release state
38,059
public function resetTemplateCache ( $ aTemplates ) { $ sSmartyDir = \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsView ( ) -> getSmartyDir ( ) ; $ aFiles = glob ( $ sSmartyDir . '*' ) ; if ( is_array ( $ aFiles ) && is_array ( $ aTemplates ) && count ( $ aTemplates ) ) { foreach ( $ aTemplates as & $ sTemplate ) { $ sTemplate = preg_quote ( basename ( strtolower ( $ sTemplate ) , '.tpl' ) ) ; } $ sPattern = sprintf ( "/%%(%s)\.tpl\.php$/i" , implode ( '|' , $ aTemplates ) ) ; $ aFiles = preg_grep ( $ sPattern , $ aFiles ) ; if ( is_array ( $ aFiles ) ) { foreach ( $ aFiles as $ sFile ) { @ unlink ( $ sFile ) ; } } } }
Removes smarty template cache for given templates
38,060
public function resetLanguageCache ( ) { $ aFiles = glob ( $ this -> getCacheFilePath ( null , true ) . '*' ) ; if ( is_array ( $ aFiles ) ) { $ sPattern = $ this -> _sLanguageCachePattern ; $ aFiles = preg_grep ( $ sPattern , $ aFiles ) ; foreach ( $ aFiles as $ sFile ) { @ unlink ( $ sFile ) ; } } }
Removes language constant cache
38,061
public function resetMenuCache ( ) { $ aFiles = glob ( $ this -> getCacheFilePath ( null , true ) . '*' ) ; if ( is_array ( $ aFiles ) ) { $ sPattern = $ this -> _sMenuCachePattern ; $ aFiles = preg_grep ( $ sPattern , $ aFiles ) ; foreach ( $ aFiles as $ sFile ) { @ unlink ( $ sFile ) ; } } }
Removes admin menu cache
38,062
public function canPreview ( ) { $ blCan = null ; if ( ( $ sPrevId = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'preview' ) ) && ( $ sAdminSid = \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsServer ( ) -> getOxCookie ( 'admin_sid' ) ) ) { $ sTable = getViewName ( 'oxuser' ) ; $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ sQ = "select 1 from $sTable where MD5( CONCAT( " . $ oDb -> quote ( $ sAdminSid ) . ", {$sTable}.oxid, {$sTable}.oxpassword, {$sTable}.oxrights ) ) = " . \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) -> quote ( $ sPrevId ) ; $ blCan = ( bool ) $ oDb -> getOne ( $ sQ ) ; } return $ blCan ; }
Checks if preview mode is ON
38,063
public function getPreviewId ( ) { $ sAdminSid = \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsServer ( ) -> getOxCookie ( 'admin_sid' ) ; if ( ( $ oUser = $ this -> getUser ( ) ) ) { return md5 ( $ sAdminSid . $ oUser -> getId ( ) . $ oUser -> oxuser__oxpassword -> value . $ oUser -> oxuser__oxrights -> value ) ; } }
Returns id which is used for product preview in shop during administration
38,064
public function checkAccessRights ( ) { $ myConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ blIsAuth = false ; $ sUserID = \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> getVariable ( "auth" ) ; \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> setVariable ( "malladmin" , 0 ) ; \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> setVariable ( "blIsAdmin" , 0 ) ; \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> deleteVariable ( "blIsAdmin" ) ; $ myConfig -> setConfigParam ( 'blMallAdmin' , false ) ; $ myConfig -> setConfigParam ( 'blAllowInheritedEdit' , false ) ; if ( $ sUserID ) { $ sRights = $ this -> fetchRightsForUser ( $ sUserID ) ; if ( $ sRights != "user" ) { if ( $ sRights == "malladmin" ) { \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> setVariable ( "malladmin" , 1 ) ; $ myConfig -> setConfigParam ( 'blMallAdmin' , true ) ; $ myConfig -> setConfigParam ( 'blAllowSharedEdit' , true ) ; $ sShop = \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> getVariable ( "actshop" ) ; if ( ! isset ( $ sShop ) ) { \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> setVariable ( "actshop" , $ myConfig -> getBaseShopId ( ) ) ; } $ blIsAuth = true ; } else { $ sShopID = $ this -> fetchShopAdminById ( $ sRights ) ; if ( isset ( $ sShopID ) && $ sShopID ) { \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> setVariable ( "actshop" , $ sRights ) ; \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> setVariable ( "currentadminshop" , $ sRights ) ; \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> setVariable ( "shp" , $ sRights ) ; if ( 'chshp' == \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'fnc' ) ) { $ blIsAuth = false ; } else { $ blIsAuth = true ; $ aShopIdVars = [ 'actshop' , 'shp' , 'currentadminshop' ] ; foreach ( $ aShopIdVars as $ sShopIdVar ) { if ( $ sGotShop = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( $ sShopIdVar ) ) { if ( $ sGotShop != $ sRights ) { $ blIsAuth = false ; break ; } } } } } } \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> setVariable ( "blIsAdmin" , 1 ) ; } } return $ blIsAuth ; }
This function checks if logged in user has access to admin or not
38,065
protected function fetchRightsForUser ( $ userOxId ) { $ database = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; return $ database -> getOne ( "select oxrights from oxuser where oxid = " . $ database -> quote ( $ userOxId ) ) ; }
Fetch the rights for the user given by its oxid
38,066
protected function fetchShopAdminById ( $ oxId ) { $ database = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; return $ database -> getOne ( "select oxid from oxshops where oxid = " . $ database -> quote ( $ oxId ) ) ; }
Fetch the oxId from the oxshops table .
38,067
public function seoIsActive ( $ blReset = false , $ sShopId = null , $ iActLang = null ) { if ( ! is_null ( $ this -> _blSeoIsActive ) && ! $ blReset ) { return $ this -> _blSeoIsActive ; } $ myConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; if ( ( $ this -> _blSeoIsActive = $ myConfig -> getConfigParam ( 'blSeoMode' ) ) === null ) { $ this -> _blSeoIsActive = true ; $ aSeoModes = $ myConfig -> getconfigParam ( 'aSeoModes' ) ; $ sActShopId = $ sShopId ? $ sShopId : $ myConfig -> getActiveShop ( ) -> getId ( ) ; $ iActLang = $ iActLang ? $ iActLang : ( int ) \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> getBaseLanguage ( ) ; if ( is_array ( $ aSeoModes ) && isset ( $ aSeoModes [ $ sActShopId ] ) && isset ( $ aSeoModes [ $ sActShopId ] [ $ iActLang ] ) ) { $ this -> _blSeoIsActive = ( bool ) $ aSeoModes [ $ sActShopId ] [ $ iActLang ] ; } } return $ this -> _blSeoIsActive ; }
Checks if Seo mode should be used
38,068
protected function _simpleRedirect ( $ sUrl , $ sHeaderCode ) { $ oHeader = oxNew ( \ OxidEsales \ Eshop \ Core \ Header :: class ) ; $ oHeader -> setHeader ( $ sHeaderCode ) ; $ oHeader -> setHeader ( "Location: $sUrl" ) ; $ oHeader -> setHeader ( "Connection: close" ) ; $ oHeader -> sendHeader ( ) ; }
redirects browser to given url nothing else done just header send may be used for redirection in case of an exception or similar things
38,069
public function redirect ( $ sUrl , $ blAddRedirectParam = true , $ iHeaderCode = 302 ) { if ( $ blAddRedirectParam && \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'redirected' ) ) { return ; } if ( $ blAddRedirectParam ) { $ sUrl = $ this -> _addUrlParameters ( $ sUrl , [ 'redirected' => 1 ] ) ; } $ sUrl = str_ireplace ( "&amp;" , "&" , $ sUrl ) ; switch ( $ iHeaderCode ) { case 301 : $ sHeaderCode = "HTTP/1.1 301 Moved Permanently" ; break ; case 500 : $ sHeaderCode = "HTTP/1.1 500 Internal Server Error" ; break ; case 302 : default : $ sHeaderCode = "HTTP/1.1 302 Found" ; } $ this -> _simpleRedirect ( $ sUrl , $ sHeaderCode ) ; try { $ this -> getSession ( ) -> freeze ( ) ; } catch ( \ OxidEsales \ Eshop \ Core \ Exception \ StandardException $ exception ) { \ OxidEsales \ Eshop \ Core \ Registry :: getLogger ( ) -> error ( $ exception -> getMessage ( ) , [ $ exception ] ) ; } $ this -> showMessageAndExit ( '' ) ; }
redirect user to the specified URL
38,070
protected function prepareToExit ( ) { $ this -> getSession ( ) -> freeze ( ) ; $ this -> commitFileCache ( ) ; $ this -> dispatchEvent ( new \ OxidEsales \ EshopCommunity \ Internal \ ShopEvents \ ApplicationExitEvent ( ) ) ; if ( $ this -> isSearchEngine ( ) ) { $ header = \ OxidEsales \ Eshop \ Core \ Registry :: get ( \ OxidEsales \ Eshop \ Core \ Header :: class ) ; $ header -> setNonCacheable ( ) ; } $ header = \ OxidEsales \ Eshop \ Core \ Registry :: get ( \ OxidEsales \ Eshop \ Core \ Header :: class ) ; $ header -> sendHeader ( ) ; }
helper with commands to run before exit action
38,071
protected function _addUrlParameters ( $ sUrl , $ aParams ) { $ sDelimiter = ( ( getStr ( ) -> strpos ( $ sUrl , '?' ) !== false ) ) ? '&' : '?' ; foreach ( $ aParams as $ sName => $ sVal ) { $ sUrl = $ sUrl . $ sDelimiter . $ sName . '=' . $ sVal ; $ sDelimiter = '&' ; } return $ sUrl ; }
adds the given parameters at the end of the given url
38,072
public function oxMimeContentType ( $ sFileName ) { $ sFileName = strtolower ( $ sFileName ) ; $ iLastDot = strrpos ( $ sFileName , '.' ) ; if ( $ iLastDot !== false ) { $ sType = substr ( $ sFileName , $ iLastDot + 1 ) ; switch ( $ sType ) { case 'gif' : $ sType = 'image/gif' ; break ; case 'jpeg' : case 'jpg' : $ sType = 'image/jpeg' ; break ; case 'png' : $ sType = 'image/png' ; break ; default : $ sType = false ; break ; } } return $ sType ; }
returns manually set mime types
38,073
public function logger ( $ sText , $ blNewline = false ) { $ myConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; if ( $ myConfig -> getConfigParam ( 'iDebug' ) == - 2 ) { if ( gettype ( $ sText ) != 'string' ) { $ sText = var_export ( $ sText , true ) ; } $ logMessage = "----------------------------------------------\n{$sText}" . ( ( $ blNewline ) ? "\n" : "" ) . "\n" ; $ logger = Registry :: getLogger ( ) ; $ logger -> debug ( $ logMessage ) ; } }
Processes logging .
38,074
public function getLangCache ( $ sCacheName ) { $ aLangCache = null ; $ sFilePath = $ this -> getCacheFilePath ( $ sCacheName ) ; if ( file_exists ( $ sFilePath ) && is_readable ( $ sFilePath ) ) { include $ sFilePath ; } return $ aLangCache ; }
Tries to load lang cache array from cache file
38,075
public function setLangCache ( $ sCacheName , $ aLangCache ) { $ sCache = "<?php\n\$aLangCache = " . var_export ( $ aLangCache , true ) . ";\n?>" ; $ sFileName = $ this -> getCacheFilePath ( $ sCacheName ) ; $ cacheDirectory = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'sCompileDir' ) ; $ tmpFile = $ cacheDirectory . basename ( $ sFileName ) . uniqid ( '.temp' , true ) . '.txt' ; $ blRes = file_put_contents ( $ tmpFile , $ sCache , LOCK_EX ) ; rename ( $ tmpFile , $ sFileName ) ; return $ blRes ; }
Writes language array to file cache
38,076
public function extractDomain ( $ sHost ) { $ oStr = getStr ( ) ; if ( ! $ oStr -> preg_match ( '/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/' , $ sHost ) && ( $ iLastDot = strrpos ( $ sHost , '.' ) ) !== false ) { $ iLen = $ oStr -> strlen ( $ sHost ) ; if ( ( $ iNextDot = strrpos ( $ sHost , '.' , ( $ iLen - $ iLastDot + 1 ) * - 1 ) ) !== false ) { $ sHost = trim ( $ oStr -> substr ( $ sHost , $ iNextDot ) , '.' ) ; } } return $ sHost ; }
Extracts domain name from given host
38,077
protected function _getQuery ( ) { $ sGroupTable = $ this -> _getViewName ( 'oxgroups' ) ; $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ sDeldId = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'oxid' ) ; $ sSynchDelId = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'synchoxid' ) ; if ( ! $ sDeldId ) { $ sQAdd = " from $sGroupTable where 1 " ; } else { $ sQAdd = " from $sGroupTable left join oxobject2group on oxobject2group.oxgroupsid=$sGroupTable.oxid " ; $ sQAdd .= " where oxobject2group.oxobjectid = " . $ oDb -> quote ( $ sDeldId ) ; } if ( $ sSynchDelId && $ sSynchDelId != $ sDeldId ) { $ sQAdd .= " and $sGroupTable.oxid not in ( select $sGroupTable.oxid from $sGroupTable left join oxobject2group on oxobject2group.oxgroupsid=$sGroupTable.oxid " ; $ sQAdd .= " where oxobject2group.oxobjectid = " . $ oDb -> quote ( $ sSynchDelId ) . " ) " ; } return $ sQAdd ; }
Returns SQL query for data to fetch
38,078
public function indexAction ( $ page = 1 ) { $ reader = $ this -> getAuditReader ( ) ; $ revisions = $ reader -> findRevisionHistory ( 20 , 20 * ( $ page - 1 ) ) ; return $ this -> render ( 'SimpleThingsEntityAuditBundle:Audit:index.html.twig' , array ( 'revisions' => $ revisions , ) ) ; }
Renders a paginated list of revisions .
38,079
public function viewEntityAction ( $ className , $ id ) { $ ids = explode ( ',' , $ id ) ; $ revisions = $ this -> getAuditReader ( ) -> findRevisions ( $ className , $ ids ) ; return $ this -> render ( 'SimpleThingsEntityAuditBundle:Audit:view_entity.html.twig' , array ( 'id' => $ id , 'className' => $ className , 'revisions' => $ revisions , ) ) ; }
Lists revisions for the supplied entity .
38,080
public function viewDetailAction ( $ className , $ id , $ rev ) { $ ids = explode ( ',' , $ id ) ; $ entity = $ this -> getAuditReader ( ) -> find ( $ className , $ ids , $ rev ) ; $ data = $ this -> getAuditReader ( ) -> getEntityValues ( $ className , $ entity ) ; krsort ( $ data ) ; return $ this -> render ( 'SimpleThingsEntityAuditBundle:Audit:view_detail.html.twig' , array ( 'id' => $ id , 'rev' => $ rev , 'className' => $ className , 'entity' => $ entity , 'data' => $ data , ) ) ; }
Shows the data for an entity at the specified revision .
38,081
public function fileSize ( $ size , bool $ binary = true ) : string { if ( $ size > 0 ) { if ( $ binary === true ) { $ base = 1024 ; $ terms = [ 'byte' , 'KiB' , 'MiB' , 'GiB' , 'TiB' , 'PiB' , 'EiB' , 'ZiB' , 'YiB' ] ; } else { $ base = 1000 ; $ terms = [ 'byte' , 'KB' , 'MB' , 'GB' , 'TB' , 'PB' , 'EB' , 'ZB' , 'YB' ] ; } $ e = floor ( log ( $ size , $ base ) ) ; return round ( $ size / ( $ base ** $ e ) , 2 ) . ' ' . $ terms [ $ e ] ; } return '0 byte' ; }
Returns a human friendly file size .
38,082
public function day ( DateTimeInterface $ dateTime , string $ dateFormat = 'Y-m-d, H:i' ) : string { if ( $ dateTime -> format ( 'Y-m-d' ) === date ( 'Y-m-d' ) ) { return $ this -> i18n -> get ( 'humanizer.today' ) ; } elseif ( $ dateTime -> format ( 'Y-m-d' ) === date ( 'Y-m-d' , time ( ) - ( 60 * 60 * 24 ) ) ) { return $ this -> i18n -> get ( 'humanizer.yesterday' ) ; } elseif ( $ dateTime -> format ( 'Y-m-d' ) === date ( 'Y-m-d' , time ( ) + ( 60 * 60 * 24 ) ) ) { return $ this -> i18n -> get ( 'humanizer.tomorrow' ) ; } else { return $ dateTime -> format ( $ dateFormat ) ; } }
Returns a human friendly representation of the date .
38,083
public function time ( DateTimeInterface $ dateTime , string $ dateFormat = 'Y-m-d, H:i' , string $ clockFormat = ', H:i' ) : string { $ diff = time ( ) - $ dateTime -> getTimestamp ( ) ; if ( $ diff < 0 ) { $ diff = abs ( $ diff ) ; if ( $ diff < 120 ) { return $ this -> i18n -> get ( 'humanizer.in_minute' ) ; } elseif ( $ diff < 3600 ) { return $ this -> i18n -> get ( 'humanizer.in_minutes' , [ $ diff / 60 ] ) ; } elseif ( $ dateTime -> format ( 'Y-m-d' ) === date ( 'Y-m-d' ) ) { return $ this -> i18n -> get ( 'humanizer.today' ) . ( ! empty ( $ clockFormat ) ? $ dateTime -> format ( $ clockFormat ) : '' ) ; } elseif ( $ dateTime -> format ( 'Y-m-d' ) === date ( 'Y-m-d' , time ( ) + ( 60 * 60 * 24 ) ) ) { return $ this -> i18n -> get ( 'humanizer.tomorrow' ) . ( ! empty ( $ clockFormat ) ? $ dateTime -> format ( $ clockFormat ) : '' ) ; } } else { if ( $ diff < 120 ) { return $ this -> i18n -> get ( 'humanizer.minute_ago' ) ; } elseif ( $ diff < 3600 ) { return $ this -> i18n -> get ( 'humanizer.minutes_ago' , [ $ diff / 60 ] ) ; } elseif ( $ dateTime -> format ( 'Y-m-d' ) === date ( 'Y-m-d' ) ) { return $ this -> i18n -> get ( 'humanizer.today' ) . ( ! empty ( $ clockFormat ) ? $ dateTime -> format ( $ clockFormat ) : '' ) ; } elseif ( $ dateTime -> format ( 'Y-m-d' ) === date ( 'Y-m-d' , time ( ) - ( 60 * 60 * 24 ) ) ) { return $ this -> i18n -> get ( 'humanizer.yesterday' ) . ( ! empty ( $ clockFormat ) ? $ dateTime -> format ( $ clockFormat ) : '' ) ; } } return $ dateTime -> format ( $ dateFormat ) ; }
Returns a human friendly representation of the time .
38,084
public function getConnection ( ) : Connection { if ( empty ( static :: $ connectionManager ) ) { static :: $ connectionManager = Application :: instance ( ) -> getContainer ( ) -> get ( 'database' ) ; } return static :: $ connectionManager -> connection ( $ this -> connectionName ) ; }
Returns the connection of the model .
38,085
protected function getDateFormat ( ) : string { static $ dateFormat ; if ( $ dateFormat === null ) { $ dateFormat = $ this -> builder ( ) -> getCompiler ( ) -> getDateFormat ( ) ; } return $ dateFormat ; }
Gets the date format from the query builder compiler .
38,086
protected function registerTraits ( ) : void { if ( ! isset ( static :: $ traitHooks [ static :: class ] ) ) { static :: $ traitHooks [ static :: class ] = [ ] ; static :: $ traitCasts [ static :: class ] = [ ] ; foreach ( ClassInspector :: getTraits ( static :: class ) as $ trait ) { if ( method_exists ( $ this , $ getter = 'get' . $ this -> getClassShortName ( $ trait ) . 'Hooks' ) ) { static :: $ traitHooks [ static :: class ] = array_merge_recursive ( static :: $ traitHooks [ static :: class ] , $ this -> $ getter ( ) ) ; } if ( method_exists ( $ this , $ getter = 'get' . $ this -> getClassShortName ( $ trait ) . 'Casts' ) ) { static :: $ traitCasts [ static :: class ] += $ this -> $ getter ( ) ; } } } $ this -> cast += static :: $ traitCasts [ static :: class ] ; }
Registers traits .
38,087
public function getHooks ( string $ event ) : array { return isset ( static :: $ traitHooks [ static :: class ] [ $ event ] ) ? $ this -> bindHooks ( static :: $ traitHooks [ static :: class ] [ $ event ] ) : [ ] ; }
Returns hooks for the chosen event .
38,088
protected function getClassShortName ( ? string $ className = null ) : string { $ class = $ className ?? static :: class ; $ pos = strrpos ( $ class , '\\' ) ; if ( $ pos === false ) { return $ class ; } return substr ( $ class , $ pos + 1 ) ; }
Returns the short name of a class .
38,089
public function getTable ( ) : string { if ( empty ( $ this -> tableName ) ) { $ this -> tableName = Str :: pluralize ( Str :: camel2underscored ( $ this -> getClassShortName ( ) ) ) ; } return $ this -> tableName ; }
Returns the table name of the model .
38,090
public function getForeignKey ( ) : string { if ( empty ( $ this -> foreignKeyName ) ) { $ this -> foreignKeyName = Str :: camel2underscored ( $ this -> getClassShortName ( ) ) . '_id' ; } return $ this -> foreignKeyName ; }
Returns the foreign key of the table .
38,091
public function include ( $ includes ) { $ model = $ this ; ( function ( ) use ( $ includes , $ model ) : void { $ this -> including ( $ includes ) -> loadIncludes ( [ $ model ] ) ; } ) -> bindTo ( $ this -> builder ( ) , Query :: class ) ( ) ; return $ this ; }
Eager loads relations on the model .
38,092
protected function cast ( string $ name , $ value ) { if ( isset ( $ this -> cast [ $ name ] ) && $ value !== null ) { switch ( $ this -> cast [ $ name ] ) { case 'int' : return ( int ) $ value ; case 'float' : return ( float ) $ value ; case 'bool' : return $ value === 'f' ? false : ( bool ) $ value ; case 'date' : return ( $ value instanceof DateTimeInterface ) ? $ value : Time :: createFromFormat ( $ this -> getDateFormat ( ) , $ value ) ; case 'string' : return ( string ) $ value ; default : throw new RuntimeException ( vsprintf ( 'Unsupported type [ %s ].' , [ $ this -> cast [ $ name ] ] ) ) ; } } return $ value ; }
Cast value to the appropriate type .
38,093
public function setRawColumnValue ( string $ name , $ value ) : void { $ this -> columns [ $ name ] = $ this -> cast ( $ name , $ value ) ; }
Sets a raw column value .
38,094
public function setColumnValue ( string $ name , $ value ) : void { $ value = $ this -> cast ( $ name , $ value ) ; if ( method_exists ( $ this , $ name . 'Mutator' ) ) { $ this -> columns [ $ name ] = $ this -> { $ name . 'Mutator' } ( $ value ) ; } else { $ this -> columns [ $ name ] = $ value ; } }
Sets a column value .
38,095
public function getColumnValue ( string $ name ) { if ( method_exists ( $ this , $ name . 'Accessor' ) ) { return $ this -> { $ name . 'Accessor' } ( $ this -> columns [ $ name ] ) ; } return $ this -> columns [ $ name ] ; }
Returns a column value .
38,096
public function getValue ( string $ name ) { if ( array_key_exists ( $ name , $ this -> columns ) ) { return $ this -> getColumnValue ( $ name ) ; } elseif ( array_key_exists ( $ name , $ this -> related ) ) { return $ this -> related [ $ name ] ; } elseif ( $ this -> isRelation ( $ name ) ) { return $ this -> related [ $ name ] = $ this -> $ name ( ) -> getRelated ( ) ; } throw new RuntimeException ( vsprintf ( 'Unknown column or relation [ %s ].' , [ $ name ] ) ) ; }
Gets a column value or relation .
38,097
protected function setColumValues ( array $ columns , bool $ raw ) : void { if ( $ raw ) { if ( empty ( $ this -> cast ) ) { $ this -> columns = $ columns ; } else { foreach ( $ columns as $ column => $ value ) { $ this -> setRawColumnValue ( $ column , $ value ) ; } } } else { foreach ( $ columns as $ column => $ value ) { $ this -> setColumnValue ( $ column , $ value ) ; } } }
Sets column values .
38,098
public function assign ( array $ columns , bool $ raw = false , bool $ whitelist = true ) { if ( $ whitelist && ! empty ( $ this -> assignable ) ) { $ columns = array_intersect_key ( $ columns , array_flip ( $ this -> assignable ) ) ; } if ( $ this -> isPersisted && isset ( $ columns [ $ this -> primaryKey ] ) ) { unset ( $ columns [ $ this -> primaryKey ] ) ; } $ this -> setColumValues ( $ columns , $ raw ) ; return $ this ; }
Assigns the column values to the model .
38,099
public function __isset ( string $ name ) { if ( isset ( $ this -> columns [ $ name ] ) || isset ( $ this -> related [ $ name ] ) ) { return true ; } return $ this -> isRelation ( $ name ) && $ this -> getValue ( $ name ) !== null ; }
Checks if a column or relation is set using overloading .