idx
int64
0
60.3k
question
stringlengths
101
6.21k
target
stringlengths
7
803
36,900
protected function getConfigurationKey ( ) { if ( Registry :: instanceExists ( \ OxidEsales \ Eshop \ Core \ ConfigFile :: class ) ) { $ config = Registry :: get ( \ OxidEsales \ Eshop \ Core \ ConfigFile :: class ) ; } else { $ config = new \ OxidEsales \ Eshop \ Core \ ConfigFile ( getShopBasePath ( ) . '/config.inc.php' ) ; Registry :: set ( \ OxidEsales \ Eshop \ Core \ ConfigFile :: class , $ config ) ; } return $ config -> getVar ( 'sConfigKey' ) ? : Config :: DEFAULT_CONFIG_KEY ; }
Returns configuration key . This method is independent from oxConfig functionality .
36,901
protected function getModuleVarFromDB ( $ name ) { $ masterDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getMaster ( ) ; $ shopId = $ this -> getShopIdCalculator ( ) -> getShopId ( ) ; $ configKey = $ this -> getConfigurationKey ( ) ; $ query = "SELECT DECODE( oxvarvalue , ? ) FROM oxconfig WHERE oxvarname = ? AND oxshopid = ?" ; $ value = $ masterDb -> getOne ( $ query , [ $ configKey , $ name , $ shopId ] ) ; return unserialize ( $ value ) ; }
Returns shop module variable value directly from database .
36,902
public function renderPlainTextEditor ( $ width , $ height , $ objectValue , $ fieldName ) { if ( strpos ( $ width , '%' ) === false ) { $ width .= 'px' ; } if ( strpos ( $ height , '%' ) === false ) { $ height .= 'px' ; } $ disabledTextEditor = $ this -> isTextEditorDisabled ( ) ? 'disabled ' : '' ; return "<textarea ${disabledTextEditor}id='editor_{$fieldName}' name='$fieldName' style='width:{$width}; height:{$height};'>{$objectValue}</textarea>" ; }
Returns simple textarea element filled with object text to edit .
36,903
public function save ( ) { parent :: save ( ) ; $ soxId = $ this -> getEditObjectId ( ) ; $ aParams = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( "editval" ) ; if ( ! isset ( $ aParams [ 'oxpayments__oxactive' ] ) ) { $ aParams [ 'oxpayments__oxactive' ] = 0 ; } if ( ! isset ( $ aParams [ 'oxpayments__oxchecked' ] ) ) { $ aParams [ 'oxpayments__oxchecked' ] = 0 ; } $ oPayment = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Payment :: class ) ; if ( $ soxId != "-1" ) { $ oPayment -> loadInLang ( $ this -> _iEditLang , $ soxId ) ; } else { $ aParams [ 'oxpayments__oxid' ] = null ; } $ oPayment -> setLanguage ( 0 ) ; $ oPayment -> assign ( $ aParams ) ; $ aRules = ( array ) \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( "oxpayments__oxaddsumrules" ) ; if ( empty ( $ aRules ) ) { $ this -> _aViewData [ "noticeoxaddsumrules" ] = 1 ; } $ oPayment -> oxpayments__oxaddsumrules = new \ OxidEsales \ Eshop \ Core \ Field ( array_sum ( $ aRules ) ) ; if ( ! is_array ( $ this -> _aFieldArray ) ) { $ this -> _aFieldArray = \ OxidEsales \ Eshop \ Core \ Registry :: getUtils ( ) -> assignValuesFromText ( $ oPayment -> oxpayments__oxvaldesc -> value ) ; } $ sValdesc = "" ; foreach ( $ this -> _aFieldArray as $ oField ) { $ sValdesc .= $ oField -> name . "__@@" ; } $ oPayment -> oxpayments__oxvaldesc = new \ OxidEsales \ Eshop \ Core \ Field ( $ sValdesc , \ OxidEsales \ Eshop \ Core \ Field :: T_RAW ) ; $ oPayment -> setLanguage ( $ this -> _iEditLang ) ; $ oPayment -> save ( ) ; $ this -> setEditObjectId ( $ oPayment -> getId ( ) ) ; }
Saves payment parameters changes .
36,904
public function getBaseLanguage ( ) { if ( $ this -> _iBaseLanguageId === null ) { $ myConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ blAdmin = $ this -> isAdmin ( ) ; if ( $ blAdmin && ( ( $ iSeLang = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'changelang' ) ) !== null ) ) { $ this -> _iBaseLanguageId = $ iSeLang ; } if ( is_null ( $ this -> _iBaseLanguageId ) ) { $ this -> _iBaseLanguageId = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'lang' ) ; } $ aLanguageUrls = $ myConfig -> getConfigParam ( 'aLanguageURLs' ) ; if ( ! $ blAdmin && is_array ( $ aLanguageUrls ) ) { foreach ( $ aLanguageUrls as $ iId => $ sUrl ) { if ( $ sUrl && $ myConfig -> isCurrentUrl ( $ sUrl ) ) { $ this -> _iBaseLanguageId = $ iId ; break ; } } } if ( is_null ( $ this -> _iBaseLanguageId ) ) { $ this -> _iBaseLanguageId = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'language' ) ; if ( ! isset ( $ this -> _iBaseLanguageId ) ) { $ this -> _iBaseLanguageId = \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> getVariable ( 'language' ) ; } } if ( is_null ( $ this -> _iBaseLanguageId ) && ! $ blAdmin && ! \ OxidEsales \ Eshop \ Core \ Registry :: getUtils ( ) -> isSearchEngine ( ) ) { $ this -> _iBaseLanguageId = \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsServer ( ) -> getOxCookie ( 'language' ) ; if ( is_null ( $ this -> _iBaseLanguageId ) ) { $ this -> _iBaseLanguageId = $ this -> detectLanguageByBrowser ( ) ; } } if ( is_null ( $ this -> _iBaseLanguageId ) ) { $ this -> _iBaseLanguageId = $ myConfig -> getConfigParam ( 'sDefaultLang' ) ; } $ this -> _iBaseLanguageId = ( int ) $ this -> _iBaseLanguageId ; $ this -> _iBaseLanguageId = $ this -> validateLanguage ( $ this -> _iBaseLanguageId ) ; \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsServer ( ) -> setOxCookie ( 'language' , $ this -> _iBaseLanguageId ) ; } return $ this -> _iBaseLanguageId ; }
Returns active shop language id
36,905
public function getObjectTplLanguage ( ) { if ( $ this -> _iObjectTplLanguageId === null ) { $ this -> _iObjectTplLanguageId = $ this -> getTplLanguage ( ) ; if ( $ this -> isAdmin ( ) ) { $ aLanguages = $ this -> getAdminTplLanguageArray ( ) ; if ( ! isset ( $ aLanguages [ $ this -> _iObjectTplLanguageId ] ) || $ aLanguages [ $ this -> _iObjectTplLanguageId ] -> active == 0 ) { $ this -> _iObjectTplLanguageId = key ( $ aLanguages ) ; } } } return $ this -> _iObjectTplLanguageId ; }
Returns language id used to load objects according to current template language
36,906
public function getTplLanguage ( ) { if ( $ this -> _iTplLanguageId === null ) { $ iSessLang = \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> getVariable ( 'tpllanguage' ) ; $ this -> _iTplLanguageId = $ this -> isAdmin ( ) ? $ this -> setTplLanguage ( $ iSessLang ) : $ this -> getBaseLanguage ( ) ; } return $ this -> _iTplLanguageId ; }
Returns active shop templates language id If it is not an admin area template language id is same as base shop language id
36,907
public function getEditLanguage ( ) { if ( $ this -> _iEditLanguageId === null ) { if ( ! $ this -> isAdmin ( ) ) { $ this -> _iEditLanguageId = $ this -> getBaseLanguage ( ) ; } else { $ iLang = null ; if ( "saveinnlang" == \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getActiveView ( ) -> getFncName ( ) ) { $ iLang = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( "new_lang" ) ; } $ iLang = ( $ iLang === null ) ? \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'editlanguage' ) : $ iLang ; $ iLang = ( $ iLang === null ) ? \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> getVariable ( 'editlanguage' ) : $ iLang ; $ iLang = ( $ iLang === null ) ? $ this -> getBaseLanguage ( ) : $ iLang ; $ this -> _iEditLanguageId = $ this -> validateLanguage ( $ iLang ) ; \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> setVariable ( 'editlanguage' , $ this -> _iEditLanguageId ) ; } } return $ this -> _iEditLanguageId ; }
Returns editing object working language id
36,908
public function getLanguageArray ( $ iLanguage = null , $ blOnlyActive = false , $ blSort = false ) { $ myConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; if ( is_null ( $ iLanguage ) ) { $ iLanguage = $ this -> _iBaseLanguageId ; } $ aLanguages = [ ] ; $ aConfLanguages = $ myConfig -> getConfigParam ( 'aLanguages' ) ; $ aLangParams = $ myConfig -> getConfigParam ( 'aLanguageParams' ) ; if ( is_array ( $ aConfLanguages ) ) { $ i = 0 ; reset ( $ aConfLanguages ) ; foreach ( $ aConfLanguages as $ key => $ val ) { if ( $ blOnlyActive && is_array ( $ aLangParams ) ) { if ( ! $ aLangParams [ $ key ] [ 'active' ] ) { $ i ++ ; continue ; } } if ( $ val ) { $ oLang = new stdClass ( ) ; $ oLang -> id = isset ( $ aLangParams [ $ key ] [ 'baseId' ] ) ? $ aLangParams [ $ key ] [ 'baseId' ] : $ i ; $ oLang -> oxid = $ key ; $ oLang -> abbr = $ key ; $ oLang -> name = $ val ; if ( is_array ( $ aLangParams ) ) { $ oLang -> active = $ aLangParams [ $ key ] [ 'active' ] ; $ oLang -> sort = $ aLangParams [ $ key ] [ 'sort' ] ; } $ oLang -> selected = ( isset ( $ iLanguage ) && $ oLang -> id == $ iLanguage ) ? 1 : 0 ; $ aLanguages [ $ oLang -> id ] = $ oLang ; } ++ $ i ; } } if ( $ blSort && is_array ( $ aLangParams ) ) { uasort ( $ aLanguages , [ $ this , '_sortLanguagesCallback' ] ) ; } return $ aLanguages ; }
Returns array of available languages .
36,909
public function getAdminTplLanguageArray ( ) { if ( $ this -> _aAdminTplLanguageArray === null ) { $ myConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ aLangArray = $ this -> getLanguageArray ( ) ; $ this -> _aAdminTplLanguageArray = [ ] ; $ sSourceDir = $ myConfig -> getAppDir ( ) . 'views/admin/' ; foreach ( $ aLangArray as $ iLangKey => $ oLang ) { $ sFilePath = "{$sSourceDir}{$oLang->abbr}/lang.php" ; if ( file_exists ( $ sFilePath ) && is_readable ( $ sFilePath ) ) { $ this -> _aAdminTplLanguageArray [ $ iLangKey ] = $ oLang ; } } } reset ( $ this -> _aAdminTplLanguageArray ) ; return $ this -> _aAdminTplLanguageArray ; }
Returns languages array containing possible admin template translations
36,910
public function getLanguageAbbr ( $ iLanguage = null ) { if ( $ this -> _aLangAbbr === null ) { $ this -> _aLangAbbr = $ this -> getLanguageIds ( ) ; } $ iLanguage = isset ( $ iLanguage ) ? ( int ) $ iLanguage : $ this -> getBaseLanguage ( ) ; if ( isset ( $ this -> _aLangAbbr [ $ iLanguage ] ) ) { $ iLanguage = $ this -> _aLangAbbr [ $ iLanguage ] ; } return $ iLanguage ; }
Returns selected language abbreviation
36,911
public function translateString ( $ sStringToTranslate , $ iLang = null , $ blAdminMode = null ) { $ this -> setIsTranslated ( ) ; $ aLang = $ this -> _getLangTranslationArray ( $ iLang , $ blAdminMode ) ; if ( isset ( $ aLang [ $ sStringToTranslate ] ) ) { return $ aLang [ $ sStringToTranslate ] ; } $ aMap = $ this -> _getLanguageMap ( $ iLang , $ blAdminMode ) ; if ( isset ( $ aMap [ $ sStringToTranslate ] , $ aLang [ $ aMap [ $ sStringToTranslate ] ] ) ) { return $ aLang [ $ aMap [ $ sStringToTranslate ] ] ; } if ( count ( $ this -> _aAdditionalLangFiles ) ) { $ aLang = $ this -> _getLangTranslationArray ( $ iLang , $ blAdminMode , $ this -> _aAdditionalLangFiles ) ; if ( isset ( $ aLang [ $ sStringToTranslate ] ) ) { return $ aLang [ $ sStringToTranslate ] ; } } $ this -> setIsTranslated ( false ) ; if ( ! $ this -> isTranslated ( ) ) { Registry :: getLogger ( ) -> warning ( "translation for $sStringToTranslate not found" , compact ( 'iLang' , 'blAdminMode' ) ) ; } return $ sStringToTranslate ; }
Searches for translation string in file and on success returns translation otherwise returns initial string .
36,912
public function formatCurrency ( $ dValue , $ oActCur = null ) { if ( ! $ oActCur ) { $ oActCur = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getActShopCurrencyObject ( ) ; } $ sValue = \ OxidEsales \ Eshop \ Core \ Registry :: getUtils ( ) -> fRound ( $ dValue , $ oActCur ) ; return number_format ( ( double ) $ sValue , $ oActCur -> decimal , $ oActCur -> dec , $ oActCur -> thousand ) ; }
Returns formatted number according to active currency formatting standards .
36,913
public function formatVat ( $ dValue , $ oActCur = null ) { $ iDecPos = 0 ; $ sValue = ( string ) $ dValue ; $ oStr = getStr ( ) ; if ( ( $ iDotPos = $ oStr -> strpos ( $ sValue , '.' ) ) !== false ) { $ iDecPos = $ oStr -> strlen ( $ oStr -> substr ( $ sValue , $ iDotPos + 1 ) ) ; } $ oActCur = $ oActCur ? $ oActCur : \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getActShopCurrencyObject ( ) ; $ iDecPos = ( $ iDecPos < $ oActCur -> decimal ) ? $ iDecPos : $ oActCur -> decimal ; return number_format ( ( double ) $ dValue , $ iDecPos , $ oActCur -> dec , $ oActCur -> thousand ) ; }
Returns formatted vat value according to formatting standards .
36,914
public function getLanguageTag ( $ iLanguage = null ) { if ( ! isset ( $ iLanguage ) ) { $ iLanguage = $ this -> getBaseLanguage ( ) ; } $ iLanguage = ( int ) $ iLanguage ; return ( $ iLanguage ) ? "_$iLanguage" : "" ; }
According to user configuration forms and return language prefix .
36,915
public function validateLanguage ( $ iLang = null ) { $ aLanguages = $ this -> getLanguageArray ( null , ! $ this -> isAdmin ( ) ) ; if ( ! isset ( $ aLanguages [ $ iLang ] ) && is_array ( $ aLanguages ) ) { $ oLang = current ( $ aLanguages ) ; if ( isset ( $ oLang -> id ) ) { $ iLang = $ oLang -> id ; } } return ( int ) $ iLang ; }
Validate language id . If not valid id returns default value
36,916
public function setBaseLanguage ( $ iLang = null ) { if ( is_null ( $ iLang ) ) { $ iLang = $ this -> getBaseLanguage ( ) ; } else { $ this -> _iBaseLanguageId = ( int ) $ iLang ; } \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> setVariable ( 'language' , $ iLang ) ; }
Set base shop language
36,917
public function setTplLanguage ( $ iLang = null ) { $ this -> _iTplLanguageId = isset ( $ iLang ) ? ( int ) $ iLang : $ this -> getBaseLanguage ( ) ; if ( $ this -> isAdmin ( ) ) { $ aLanguages = $ this -> getAdminTplLanguageArray ( ) ; if ( ! isset ( $ aLanguages [ $ this -> _iTplLanguageId ] ) ) { $ this -> _iTplLanguageId = key ( $ aLanguages ) ; } } \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> setVariable ( 'tpllanguage' , $ this -> _iTplLanguageId ) ; return $ this -> _iTplLanguageId ; }
Validates and sets templates language id
36,918
protected function _recodeLangArray ( $ aLangArray , $ sCharset , $ blRecodeKeys = false ) { $ newEncoding = $ this -> getTranslationsExpectedEncoding ( ) ; if ( $ sCharset == $ newEncoding ) { return $ aLangArray ; } if ( $ blRecodeKeys ) { $ aLangArray = $ this -> _recodeLangArrayWithKeys ( $ aLangArray , $ sCharset , $ newEncoding ) ; } else { $ this -> _recodeLangArrayValues ( $ aLangArray , $ sCharset , $ newEncoding ) ; } return $ aLangArray ; }
Goes through language array and recodes its values if encoding does not fit with needed one . Returns recoded data
36,919
protected function _recodeLangArrayValues ( & $ aLangArray , $ sCharset , $ newEncoding ) { foreach ( $ aLangArray as $ sItemKey => & $ sValue ) { $ sValue = iconv ( $ sCharset , $ newEncoding , $ sValue ) ; } }
Goes through language array and recodes its values .
36,920
protected function _recodeLangArrayWithKeys ( $ aLangArray , $ sCharset , $ newEncoding ) { $ aLangs = [ ] ; foreach ( $ aLangArray as $ sItemKey => $ sValue ) { $ sItemKey = iconv ( $ sCharset , $ newEncoding , $ sItemKey ) ; $ aLangs [ $ sItemKey ] = iconv ( $ sCharset , $ newEncoding , $ sValue ) ; } return $ aLangs ; }
Goes through language array and recodes its values and keys . Returns recoded data
36,921
protected function _getLangFilesPathArray ( $ iLang ) { $ oConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ aLangFiles = [ ] ; $ sAppDir = $ oConfig -> getAppDir ( ) ; $ sLang = \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> getLanguageAbbr ( $ iLang ) ; $ sTheme = $ oConfig -> getConfigParam ( "sTheme" ) ; $ aModulePaths = $ this -> _getActiveModuleInfo ( ) ; $ sGenericPath = $ sAppDir . 'translations/' . $ sLang ; if ( $ sGenericPath ) { $ aLangFiles [ ] = $ sGenericPath . "/lang.php" ; $ aLangFiles = $ this -> _appendLangFile ( $ aLangFiles , $ sGenericPath ) ; } if ( $ sTheme ) { $ sThemePath = $ sAppDir . 'views/' . $ sTheme . '/' . $ sLang ; $ aLangFiles [ ] = $ sThemePath . "/lang.php" ; $ aLangFiles = $ this -> _appendLangFile ( $ aLangFiles , $ sThemePath ) ; } $ aLangFiles = array_merge ( $ aLangFiles , $ this -> getCustomThemeLanguageFiles ( $ iLang ) ) ; $ aLangFiles = $ this -> _appendModuleLangFiles ( $ aLangFiles , $ aModulePaths , $ sLang ) ; $ aLangFiles = $ this -> _appendCustomLangFiles ( $ aLangFiles , $ sLang ) ; return count ( $ aLangFiles ) ? $ aLangFiles : false ; }
Returns array with paths where frontend language files are stored
36,922
protected function getCustomThemeLanguageFiles ( $ language ) { $ oConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ sCustomTheme = $ oConfig -> getConfigParam ( "sCustomTheme" ) ; $ sAppDir = $ oConfig -> getAppDir ( ) ; $ sLang = \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> getLanguageAbbr ( $ language ) ; $ aLangFiles = [ ] ; if ( $ sCustomTheme ) { $ sCustPath = $ sAppDir . 'views/' . $ sCustomTheme . '/' . $ sLang ; $ aLangFiles [ ] = $ sCustPath . "/lang.php" ; $ aLangFiles = $ this -> _appendLangFile ( $ aLangFiles , $ sCustPath ) ; } return $ aLangFiles ; }
Returns custom theme language files .
36,923
protected function _getAdminLangFilesPathArray ( $ iLang ) { $ oConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ aLangFiles = [ ] ; $ sAppDir = $ oConfig -> getAppDir ( ) ; $ sLang = \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> getLanguageAbbr ( $ iLang ) ; $ aModulePaths = [ ] ; $ aModulePaths = array_merge ( $ aModulePaths , $ this -> _getActiveModuleInfo ( ) ) ; $ aModulePaths = array_merge ( $ aModulePaths , $ this -> _getDisabledModuleInfo ( ) ) ; $ sAdminPath = $ sAppDir . 'views/admin/' . $ sLang ; $ aLangFiles [ ] = $ sAdminPath . "/lang.php" ; $ aLangFiles [ ] = $ sAppDir . 'translations/' . $ sLang . '/translit_lang.php' ; $ aLangFiles = $ this -> _appendLangFile ( $ aLangFiles , $ sAdminPath ) ; $ sThemePath = $ sAppDir . 'views/*/' . $ sLang ; $ aLangFiles = $ this -> _appendLangFile ( $ aLangFiles , $ sThemePath , "options" ) ; $ aLangFiles = $ this -> _appendModuleLangFiles ( $ aLangFiles , $ aModulePaths , $ sLang , true ) ; $ aLangFiles = $ this -> _appendCustomLangFiles ( $ aLangFiles , $ sLang , true ) ; return count ( $ aLangFiles ) ? $ aLangFiles : false ; }
Returns array with paths where admin language files are stored
36,924
protected function _appendLangFile ( $ aLangFiles , $ sFullPath , $ sFilePattern = "lang" ) { $ aFiles = glob ( $ sFullPath . "/*_{$sFilePattern}.php" ) ; if ( is_array ( $ aFiles ) && count ( $ aFiles ) ) { foreach ( $ aFiles as $ sFile ) { if ( ! strpos ( $ sFile , 'cust_lang.php' ) ) { $ aLangFiles [ ] = $ sFile ; } } } return $ aLangFiles ; }
Appends lang or options files if exists except custom lang files
36,925
protected function _appendCustomLangFiles ( $ aLangFiles , $ sLang , $ blForAdmin = false ) { $ oConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ sAppDir = $ oConfig -> getAppDir ( ) ; $ sTheme = $ oConfig -> getConfigParam ( "sTheme" ) ; $ sCustomTheme = $ oConfig -> getConfigParam ( "sCustomTheme" ) ; if ( $ blForAdmin ) { $ aLangFiles [ ] = $ sAppDir . 'views/admin/' . $ sLang . '/cust_lang.php' ; } else { if ( $ sTheme ) { $ aLangFiles [ ] = $ sAppDir . 'views/' . $ sTheme . '/' . $ sLang . '/cust_lang.php' ; } if ( $ sCustomTheme ) { $ aLangFiles [ ] = $ sAppDir . 'views/' . $ sCustomTheme . '/' . $ sLang . '/cust_lang.php' ; } } return $ aLangFiles ; }
Appends Custom language files cust_lang . php
36,926
protected function _appendModuleLangFiles ( $ aLangFiles , $ aModulePaths , $ sLang , $ blForAdmin = false ) { if ( is_array ( $ aModulePaths ) ) { foreach ( $ aModulePaths as $ sPath ) { $ moduleTranslationPathFinder = $ this -> getModuleTranslationPathFinder ( ) ; $ sFullPath = $ moduleTranslationPathFinder -> findTranslationPath ( $ sLang , $ blForAdmin , $ sPath ) ; $ aLangFiles = $ this -> _appendLangFile ( $ aLangFiles , $ sFullPath ) ; if ( $ blForAdmin ) { $ aLangFiles [ ] = $ sFullPath . '/module_options.php' ; } } } return $ aLangFiles ; }
Appends module lang or options files if exists
36,927
protected function _getLangFileCacheName ( $ blAdmin , $ iLang , $ aLangFiles = null ) { $ myConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ sLangFilesIdent = '_default' ; if ( is_array ( $ aLangFiles ) && $ aLangFiles ) { $ sLangFilesIdent = '_' . md5 ( implode ( '+' , $ aLangFiles ) ) ; } return "langcache_" . ( ( int ) $ blAdmin ) . "_{$iLang}_" . $ myConfig -> getShopId ( ) . "_" . $ myConfig -> getConfigParam ( 'sTheme' ) . $ sLangFilesIdent ; }
Returns language cache file name
36,928
protected function _getLanguageFileData ( $ blAdmin = false , $ iLang = 0 , $ aLangFiles = null ) { $ myUtils = \ OxidEsales \ Eshop \ Core \ Registry :: getUtils ( ) ; $ sCacheName = $ this -> _getLangFileCacheName ( $ blAdmin , $ iLang , $ aLangFiles ) ; $ aLangCache = $ myUtils -> getLangCache ( $ sCacheName ) ; if ( ! $ aLangCache && $ aLangFiles === null ) { if ( $ blAdmin ) { $ aLangFiles = $ this -> _getAdminLangFilesPathArray ( $ iLang ) ; } else { $ aLangFiles = $ this -> _getLangFilesPathArray ( $ iLang ) ; } } if ( ! $ aLangCache && $ aLangFiles ) { $ aLangCache = [ ] ; $ sBaseCharset = $ this -> getTranslationsExpectedEncoding ( ) ; $ aLang = [ ] ; $ aLangSeoReplaceChars = [ ] ; foreach ( $ aLangFiles as $ sLangFile ) { if ( file_exists ( $ sLangFile ) && is_readable ( $ sLangFile ) ) { $ aSeoReplaceChars = null ; include $ sLangFile ; $ aLang = array_merge ( [ 'charset' => 'UTF-8' ] , $ aLang ) ; if ( isset ( $ aSeoReplaceChars ) && is_array ( $ aSeoReplaceChars ) ) { $ aLangSeoReplaceChars = array_merge ( $ aLangSeoReplaceChars , $ aSeoReplaceChars ) ; } $ aLangCache = array_merge ( $ aLangCache , $ aLang ) ; } } $ aLangCache [ 'charset' ] = $ sBaseCharset ; $ aLangCache [ '_aSeoReplaceChars' ] = $ aLangSeoReplaceChars ; $ myUtils -> setLangCache ( $ sCacheName , $ aLangCache ) ; } return $ aLangCache ; }
Returns language cache array
36,929
protected function _getLanguageMap ( $ iLang , $ blAdmin = null ) { $ blAdmin = isset ( $ blAdmin ) ? $ blAdmin : $ this -> isAdmin ( ) ; $ sKey = $ iLang . ( ( int ) $ blAdmin ) ; if ( ! isset ( $ this -> _aLangMap [ $ sKey ] ) ) { $ this -> _aLangMap [ $ sKey ] = [ ] ; $ myConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ sMapFile = '' ; $ sParentMapFile = $ myConfig -> getAppDir ( ) . '/views/' . ( $ blAdmin ? 'admin' : $ myConfig -> getConfigParam ( "sTheme" ) ) . '/' . \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> getLanguageAbbr ( $ iLang ) . '/map.php' ; $ sCustomThemeMapFile = $ myConfig -> getAppDir ( ) . '/views/' . ( $ blAdmin ? 'admin' : $ myConfig -> getConfigParam ( "sCustomTheme" ) ) . '/' . \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> getLanguageAbbr ( $ iLang ) . '/map.php' ; if ( file_exists ( $ sCustomThemeMapFile ) && is_readable ( $ sCustomThemeMapFile ) ) { $ sMapFile = $ sCustomThemeMapFile ; } elseif ( file_exists ( $ sParentMapFile ) && is_readable ( $ sParentMapFile ) ) { $ sMapFile = $ sParentMapFile ; } if ( $ sMapFile ) { include $ sMapFile ; $ this -> _aLangMap [ $ sKey ] = $ aMap ; } } return $ this -> _aLangMap [ $ sKey ] ; }
Returns language map array
36,930
protected function _getCacheLanguageId ( $ blAdmin , $ iLang = null ) { $ iLang = ( $ iLang === null && $ blAdmin ) ? $ this -> getTplLanguage ( ) : $ iLang ; if ( ! isset ( $ iLang ) ) { $ iLang = $ this -> getBaseLanguage ( ) ; if ( ! isset ( $ iLang ) ) { $ iLang = 0 ; } } return ( int ) $ iLang ; }
Returns current language cache language id
36,931
protected function _getLangTranslationArray ( $ iLang = null , $ blAdmin = null , $ aLangFiles = null ) { startProfile ( "_getLangTranslationArray" ) ; $ blAdmin = isset ( $ blAdmin ) ? $ blAdmin : $ this -> isAdmin ( ) ; $ iLang = $ this -> _getCacheLanguageId ( $ blAdmin , $ iLang ) ; $ sCacheName = $ this -> _getLangFileCacheName ( $ blAdmin , $ iLang , $ aLangFiles ) ; if ( ! isset ( $ this -> _aLangCache [ $ sCacheName ] ) ) { $ this -> _aLangCache [ $ sCacheName ] = [ ] ; } if ( ! isset ( $ this -> _aLangCache [ $ sCacheName ] [ $ iLang ] ) ) { $ this -> _aLangCache [ $ sCacheName ] [ $ iLang ] = $ this -> _getLanguageFileData ( $ blAdmin , $ iLang , $ aLangFiles ) ; } stopProfile ( "_getLangTranslationArray" ) ; return ( isset ( $ this -> _aLangCache [ $ sCacheName ] [ $ iLang ] ) ? $ this -> _aLangCache [ $ sCacheName ] [ $ iLang ] : [ ] ) ; }
get language array from lang translation file
36,932
public function getUrlLang ( $ iLang = null ) { if ( ! $ this -> isAdmin ( ) ) { $ iLang = isset ( $ iLang ) ? $ iLang : $ this -> getBaseLanguage ( ) ; return $ this -> getName ( ) . "=" . $ iLang ; } }
Returns url language parameter
36,933
public function detectLanguageByBrowser ( ) { $ sBrowserLanguage = $ this -> _getBrowserLanguage ( ) ; if ( ! is_null ( $ sBrowserLanguage ) ) { $ aLanguages = $ this -> getLanguageArray ( null , true ) ; foreach ( $ aLanguages as $ oLang ) { if ( $ oLang -> abbr == $ sBrowserLanguage ) { return $ oLang -> id ; } } } }
Detect language by user browser settings . Returns language ID if detected otherwise returns null .
36,934
public function getMultiLangTables ( ) { $ aTables = [ "oxarticles" , "oxartextends" , "oxattribute" , "oxcategories" , "oxcontents" , "oxcountry" , "oxdelivery" , "oxdiscount" , "oxgroups" , "oxlinks" , "oxnews" , "oxobject2attribute" , "oxpayments" , "oxselectlist" , "oxshops" , "oxactions" , "oxwrapping" , "oxdeliveryset" , "oxvendor" , "oxmanufacturers" , "oxmediaurls" , "oxstates" ] ; $ aMultiLangTables = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'aMultiLangTables' ) ; if ( is_array ( $ aMultiLangTables ) ) { $ aTables = array_merge ( $ aTables , $ aMultiLangTables ) ; } return $ aTables ; }
Returns all multi language tables
36,935
public function getSeoReplaceChars ( $ iLang ) { $ aSeoReplaceChars = $ this -> translateString ( '_aSeoReplaceChars' , $ iLang ) ; if ( ! is_array ( $ aSeoReplaceChars ) ) { $ aSeoReplaceChars = [ ] ; } return $ aSeoReplaceChars ; }
Get SEO spec . chars replacement list for current language
36,936
protected function _getDisabledModuleInfo ( ) { if ( $ this -> _aDisabledModuleInfo === null ) { $ oModuleList = oxNew ( \ OxidEsales \ Eshop \ Core \ Module \ ModuleList :: class ) ; $ this -> _aDisabledModuleInfo = $ oModuleList -> getDisabledModuleInfo ( ) ; } return $ this -> _aDisabledModuleInfo ; }
Returns active module Ids with paths
36,937
public function getLanguageIds ( $ iShopId = null ) { if ( empty ( $ iShopId ) || $ iShopId == \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getShopId ( ) ) { $ aLanguages = $ this -> getActiveShopLanguageIds ( ) ; } else { $ aLanguages = $ this -> _getLanguageIdsFromDatabase ( $ iShopId ) ; } return $ aLanguages ; }
Get current Shop language ids .
36,938
protected function _selectLanguageParamValues ( $ sParamName , $ sShopId = null ) { $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: FETCH_MODE_ASSOC ) ; $ oConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ sQuery = " select " . $ oConfig -> getDecodeValueQuery ( ) . " as oxvarvalue from oxconfig where oxvarname = '{$sParamName}' " ; if ( ! empty ( $ sShopId ) ) { $ sQuery .= " and oxshopid = '{$sShopId}' limit 1" ; } return $ oDb -> getAll ( $ sQuery ) ; }
Returns array of all config values of given paramName
36,939
protected function _getLanguageIdsFromLanguageParamsArray ( $ aLanguageParams ) { $ aLanguages = [ ] ; foreach ( $ aLanguageParams as $ sAbbr => $ aValue ) { $ iBaseId = ( int ) $ aValue [ 'baseId' ] ; $ aLanguages [ $ iBaseId ] = $ sAbbr ; } return $ aLanguages ; }
gets language code array from aLanguageParams array
36,940
protected function getModuleTranslationPathFinder ( ) { if ( is_null ( $ this -> moduleTranslationPathFinder ) ) { $ this -> moduleTranslationPathFinder = oxNew ( \ OxidEsales \ Eshop \ Core \ Module \ ModuleTranslationPathFinder :: class ) ; } return $ this -> moduleTranslationPathFinder ; }
Getter for the module translation path finder .
36,941
public function addArticle ( $ articleId ) { $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ sQ = "select max(oxsort) from oxactions2article where oxactionid = " . $ oDb -> quote ( $ this -> getId ( ) ) . " and oxshopid = '" . $ this -> getShopId ( ) . "'" ; $ iSort = ( ( int ) $ oDb -> getOne ( $ sQ ) ) + 1 ; $ oNewGroup = oxNew ( \ OxidEsales \ Eshop \ Core \ Model \ BaseModel :: class ) ; $ oNewGroup -> init ( 'oxactions2article' ) ; $ oNewGroup -> oxactions2article__oxshopid = new \ OxidEsales \ Eshop \ Core \ Field ( $ this -> getShopId ( ) ) ; $ oNewGroup -> oxactions2article__oxactionid = new \ OxidEsales \ Eshop \ Core \ Field ( $ this -> getId ( ) ) ; $ oNewGroup -> oxactions2article__oxartid = new \ OxidEsales \ Eshop \ Core \ Field ( $ articleId ) ; $ oNewGroup -> oxactions2article__oxsort = new \ OxidEsales \ Eshop \ Core \ Field ( $ iSort ) ; $ oNewGroup -> save ( ) ; }
Adds an article to this actions
36,942
public function removeArticle ( $ articleId ) { $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ sDelete = "delete from oxactions2article where oxactionid = " . $ oDb -> quote ( $ this -> getId ( ) ) . " and oxartid = " . $ oDb -> quote ( $ articleId ) . " and oxshopid = '" . $ this -> getShopId ( ) . "'" ; $ iRemovedArticles = $ oDb -> execute ( $ sDelete ) ; return ( bool ) $ iRemovedArticles ; }
Removes an article from this actions
36,943
public function delete ( $ articleId = null ) { $ articleId = $ articleId ? $ articleId : $ this -> getId ( ) ; if ( ! $ articleId ) { return false ; } $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ sDelete = "delete from oxactions2article where oxactionid = " . $ oDb -> quote ( $ articleId ) . " and oxshopid = '" . $ this -> getShopId ( ) . "'" ; $ oDb -> execute ( $ sDelete ) ; return parent :: delete ( $ articleId ) ; }
Removes article action returns true on success . For performance - you can not load action object - just pass action ID .
36,944
public function getTimeLeft ( ) { $ iNow = \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsDate ( ) -> getTime ( ) ; $ iFrom = strtotime ( $ this -> oxactions__oxactiveto -> value ) ; return $ iFrom - $ iNow ; }
return time left until finished
36,945
public function getTimeUntilStart ( ) { $ iNow = \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsDate ( ) -> getTime ( ) ; $ iFrom = strtotime ( $ this -> oxactions__oxactivefrom -> value ) ; return $ iFrom - $ iNow ; }
return time left until start
36,946
public function start ( ) { $ this -> oxactions__oxactivefrom = new \ OxidEsales \ Eshop \ Core \ Field ( date ( 'Y-m-d H:i:s' , \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsDate ( ) -> getTime ( ) ) ) ; if ( $ this -> oxactions__oxactiveto -> value && ( $ this -> oxactions__oxactiveto -> value != '0000-00-00 00:00:00' ) ) { $ iNow = \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsDate ( ) -> getTime ( ) ; $ iTo = strtotime ( $ this -> oxactions__oxactiveto -> value ) ; if ( $ iNow > $ iTo ) { $ this -> oxactions__oxactiveto = new \ OxidEsales \ Eshop \ Core \ Field ( '0000-00-00 00:00:00' ) ; } } $ this -> save ( ) ; }
start the promotion NOW!
36,947
public function stop ( ) { $ this -> oxactions__oxactiveto = new \ OxidEsales \ Eshop \ Core \ Field ( date ( 'Y-m-d H:i:s' , \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsDate ( ) -> getTime ( ) ) ) ; $ this -> save ( ) ; }
stop the promotion NOW!
36,948
public function isRunning ( ) { if ( ! ( $ this -> oxactions__oxactive -> value && $ this -> oxactions__oxtype -> value == 2 && $ this -> oxactions__oxactivefrom -> value != '0000-00-00 00:00:00' ) ) { return false ; } $ iNow = \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsDate ( ) -> getTime ( ) ; $ iFrom = strtotime ( $ this -> oxactions__oxactivefrom -> value ) ; if ( $ iNow < $ iFrom ) { return false ; } if ( $ this -> oxactions__oxactiveto -> value != '0000-00-00 00:00:00' ) { $ iTo = strtotime ( $ this -> oxactions__oxactiveto -> value ) ; if ( $ iNow > $ iTo ) { return false ; } } return true ; }
check if this action is active
36,949
public function getBannerArticle ( ) { $ sArtId = $ this -> fetchBannerArticleId ( ) ; if ( $ sArtId ) { $ oArticle = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Article :: class ) ; if ( $ this -> isAdmin ( ) ) { $ oArticle -> setLanguage ( \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> getEditLanguage ( ) ) ; } if ( $ oArticle -> load ( $ sArtId ) ) { return $ oArticle ; } } return null ; }
return assigned banner article
36,950
protected function fetchBannerArticleId ( ) { $ database = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ articleId = $ database -> getOne ( 'select oxobjectid from oxobject2action ' . 'where oxactionid=' . $ database -> quote ( $ this -> getId ( ) ) . ' and oxclass="oxarticle"' ) ; return $ articleId ; }
Fetch the oxobjectid of the article corresponding this action .
36,951
public function getBannerPictureUrl ( ) { if ( isset ( $ this -> oxactions__oxpic ) && $ this -> oxactions__oxpic -> value ) { $ sPromoDir = \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsFile ( ) -> normalizeDir ( \ OxidEsales \ Eshop \ Core \ UtilsFile :: PROMO_PICTURE_DIR ) ; return \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getPictureUrl ( $ sPromoDir . $ this -> oxactions__oxpic -> value , false ) ; } }
Returns assigned banner article picture url
36,952
public function getBannerLink ( ) { $ sUrl = null ; if ( isset ( $ this -> oxactions__oxlink ) && $ this -> oxactions__oxlink -> value ) { $ oUtilsUlr = \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsUrl ( ) ; $ sUrl = $ oUtilsUlr -> addShopHost ( $ this -> oxactions__oxlink -> value ) ; $ sUrl = $ oUtilsUlr -> processUrl ( $ sUrl ) ; } else { if ( $ oArticle = $ this -> getBannerArticle ( ) ) { $ sUrl = $ oArticle -> getLink ( ) ; } } return $ sUrl ; }
Returns assigned banner link . If no link is defined and article is assigned to banner article link will be returned .
36,953
public function getAllRDFaDeliveries ( ) { $ aRDFaDeliveries = [ ] ; $ aAssignedRDFaDeliveries = $ this -> getAssignedRDFaDeliveries ( ) ; foreach ( $ this -> _aRDFaDeliveries as $ sName => $ iType ) { $ oDelivery = new stdClass ( ) ; $ oDelivery -> name = $ sName ; $ oDelivery -> type = $ iType ; $ oDelivery -> checked = in_array ( $ sName , $ aAssignedRDFaDeliveries ) ; $ aRDFaDeliveries [ ] = $ oDelivery ; } return $ aRDFaDeliveries ; }
Returns an array including all available RDFa deliveries .
36,954
public function getClassNameById ( $ classId ) { $ className = $ this -> getClassNameFromShopMap ( $ classId ) ; if ( empty ( $ className ) ) { $ className = $ this -> getClassNameFromModuleMap ( $ classId ) ; } return $ className ; }
Map argument classId to related className .
36,955
public function getIdByClassName ( $ className ) { $ classId = $ this -> getClassIdFromShopMap ( $ className ) ; if ( empty ( $ classId ) ) { $ classId = $ this -> getClassIdFromModuleMap ( $ className ) ; } return $ classId ; }
Map argument className to related classId .
36,956
protected function getClassNameFromShopMap ( $ classId ) { $ shopControllerMapProvider = $ this -> getShopControllerMapProvider ( ) ; $ idToNameMap = $ shopControllerMapProvider -> getControllerMap ( ) ; $ className = $ this -> arrayLookup ( $ classId , $ idToNameMap ) ; return $ className ; }
Get class name from shop controller provider .
36,957
protected function getClassNameFromModuleMap ( $ classId ) { $ moduleControllerMapProvider = $ this -> getModuleControllerMapProvider ( ) ; $ idToNameMap = $ moduleControllerMapProvider -> getControllerMap ( ) ; $ className = $ this -> arrayLookup ( $ classId , $ idToNameMap ) ; return $ className ; }
Get class name from module controller provider .
36,958
protected function getClassIdFromShopMap ( $ className ) { $ shopControllerMapProvider = $ this -> getShopControllerMapProvider ( ) ; $ idToNameMap = $ shopControllerMapProvider -> getControllerMap ( ) ; $ classId = $ this -> arrayLookup ( $ className , array_flip ( $ idToNameMap ) ) ; return $ classId ; }
Get class id from shop controller provider .
36,959
protected function getClassIdFromModuleMap ( $ className ) { $ moduleControllerMapProvider = $ this -> getModuleControllerMapProvider ( ) ; $ idToNameMap = $ moduleControllerMapProvider -> getControllerMap ( ) ; $ classId = $ this -> arrayLookup ( $ className , array_flip ( $ idToNameMap ) ) ; return $ classId ; }
Get class id from module controller provider .
36,960
protected function getShopControllerMapProvider ( ) { if ( is_null ( $ this -> shopControllerMapProvider ) ) { $ this -> shopControllerMapProvider = oxNew ( \ OxidEsales \ Eshop \ Core \ Routing \ ShopControllerMapProvider :: class ) ; } return $ this -> shopControllerMapProvider ; }
Getter for ShopControllerMapProvider object
36,961
protected function getModuleControllerMapProvider ( ) { if ( is_null ( $ this -> moduleControllerMapProvider ) ) { $ this -> moduleControllerMapProvider = oxNew ( \ OxidEsales \ Eshop \ Core \ Routing \ ModuleControllerMapProvider :: class ) ; } return $ this -> moduleControllerMapProvider ; }
Getter for ModuleControllerMapProvider object
36,962
public function set ( $ value ) { $ value = $ this -> toLowercase ( $ value ) ; $ this -> getConfig ( ) -> saveShopConfVar ( 'aarr' , self :: STORAGE_KEY , $ value ) ; }
Set the stored controller value from the oxconfig .
36,963
public function add ( $ moduleId , $ controllers ) { $ controllerMap = $ this -> get ( ) ; $ controllerMap [ $ moduleId ] = $ controllers ; $ this -> set ( $ controllerMap ) ; }
Add the controllers for the module given by its ID to the storage .
36,964
public function remove ( $ moduleId ) { $ controllerMap = $ this -> get ( ) ; unset ( $ controllerMap [ strtolower ( $ moduleId ) ] ) ; $ this -> set ( $ controllerMap ) ; }
Delete the controllers for the module given by its ID from the storage .
36,965
private function toLowercase ( $ modulesControllers ) { $ result = [ ] ; if ( ! is_null ( $ modulesControllers ) ) { foreach ( $ modulesControllers as $ moduleId => $ controllers ) { $ result [ strtolower ( $ moduleId ) ] = $ this -> controllerKeysToLowercase ( $ controllers ) ; } } return $ result ; }
Change the module IDs and the controller keys to lower case .
36,966
public function getCategoryUri ( $ oCat , $ iLang = null , $ blRegenerate = false ) { startProfile ( __FUNCTION__ ) ; $ sCatId = $ oCat -> getId ( ) ; if ( $ oCat -> oxcategories__oxextlink -> value ) { $ sSeoUrl = null ; } else { if ( ! isset ( $ iLang ) ) { $ iLang = $ oCat -> getLanguage ( ) ; } $ aCacheMap = [ ] ; $ aStdLinks = [ ] ; while ( $ oCat && ! ( $ sSeoUrl = $ this -> _categoryUrlLoader ( $ oCat , $ iLang ) ) ) { if ( $ iLang != $ oCat -> getLanguage ( ) ) { $ sId = $ oCat -> getId ( ) ; $ oCat = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Category :: class ) ; $ oCat -> loadInLang ( $ iLang , $ sId ) ; } $ sTitle = $ this -> _prepareTitle ( $ oCat -> oxcategories__oxtitle -> value , false , $ oCat -> getLanguage ( ) ) ; foreach ( array_keys ( $ aCacheMap ) as $ id ) { $ aCacheMap [ $ id ] = $ sTitle . '/' . $ aCacheMap [ $ id ] ; } $ aCacheMap [ $ oCat -> getId ( ) ] = $ sTitle ; $ aStdLinks [ $ oCat -> getId ( ) ] = $ oCat -> getBaseStdLink ( $ iLang ) ; $ oCat = $ oCat -> getParentCategory ( ) ; } foreach ( $ aCacheMap as $ sId => $ sUri ) { $ this -> _aCatCache [ $ sId . '_' . $ iLang ] = $ this -> _processSeoUrl ( $ sSeoUrl . $ sUri . '/' , $ sId , $ iLang ) ; $ this -> _saveToDb ( 'oxcategory' , $ sId , $ aStdLinks [ $ sId ] , $ this -> _aCatCache [ $ sId . '_' . $ iLang ] , $ iLang ) ; } $ sSeoUrl = $ this -> _aCatCache [ $ sCatId . '_' . $ iLang ] ; } stopProfile ( __FUNCTION__ ) ; return $ sSeoUrl ; }
Returns SEO uri for passed category
36,967
public function getCategoryPageUrl ( $ category , $ pageNumber , $ languageId = null , $ isFixed = null ) { if ( ! isset ( $ languageId ) ) { $ languageId = $ category -> getLanguage ( ) ; } $ stdUrl = $ category -> getBaseStdLink ( $ languageId ) ; $ parameters = null ; $ stdUrl = $ this -> _trimUrl ( $ stdUrl , $ languageId ) ; $ seoUrl = $ this -> getCategoryUri ( $ category , $ languageId ) ; if ( $ isFixed === null ) { $ isFixed = $ this -> _isFixed ( 'oxcategory' , $ category -> getId ( ) , $ languageId ) ; } return $ this -> assembleFullPageUrl ( $ category , 'oxcategory' , $ stdUrl , $ seoUrl , $ pageNumber , $ parameters , $ languageId , $ isFixed ) ; }
Returns category SEO url for specified page
36,968
public function markRelatedAsExpired ( $ oCategory ) { $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ sIdQuoted = $ oDb -> quote ( $ oCategory -> getId ( ) ) ; $ aCatInfo = $ oDb -> getAll ( "select oxrootid, oxleft, oxright from oxcategories where oxid = $sIdQuoted limit 1" ) ; $ sCatRootIdQuoted = $ oDb -> quote ( $ aCatInfo [ 0 ] [ 0 ] ) ; $ sQ = "update oxseo as seo1, (select oxid from oxcategories where oxrootid={$sCatRootIdQuoted} and oxleft > " . ( ( int ) $ aCatInfo [ 0 ] [ 1 ] ) . " and oxright < " . ( ( int ) $ aCatInfo [ 0 ] [ 2 ] ) . ") as seo2 set seo1.oxexpired = '1' where seo1.oxtype = 'oxcategory' and seo1.oxobjectid = seo2.oxid" ; $ oDb -> execute ( $ sQ ) ; $ sQ = "update oxseo as seo1, (select o2c.oxobjectid as id from oxcategories as cat left join oxobject2category" . " as o2c on o2c.oxcatnid=cat.oxid where cat.oxrootid={$sCatRootIdQuoted} and cat.oxleft >= " . ( ( int ) $ aCatInfo [ 0 ] [ 1 ] ) . " and cat.oxright <= " . ( ( int ) $ aCatInfo [ 0 ] [ 2 ] ) . ") as seo2 " . "set seo1.oxexpired = '1' where seo1.oxtype = 'oxarticle' and seo1.oxobjectid = seo2.id " . "and seo1.oxfixed = 0" ; $ oDb -> execute ( $ sQ ) ; }
Marks related to category objects as expired
36,969
public function onDeleteCategory ( $ oCategory ) { $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ sIdQuoted = $ oDb -> quote ( $ oCategory -> getId ( ) ) ; $ oDb -> execute ( "update oxseo, (select oxseourl from oxseo where oxobjectid = $sIdQuoted and oxtype = 'oxcategory') as test set oxseo.oxexpired=1 where oxseo.oxseourl like concat(test.oxseourl, '%') and (oxtype = 'oxcategory' or oxtype = 'oxarticle')" ) ; $ oDb -> execute ( "delete from oxseo where oxseo.oxtype = 'oxarticle' and oxseo.oxparams = $sIdQuoted" ) ; $ oDb -> execute ( "delete from oxseo where oxobjectid = $sIdQuoted and oxtype = 'oxcategory'" ) ; $ oDb -> execute ( "delete from oxobject2seodata where oxobjectid = $sIdQuoted" ) ; $ oDb -> execute ( "delete from oxseohistory where oxobjectid = $sIdQuoted" ) ; }
deletes Category seo entries
36,970
public function getViewId ( ) { if ( ! isset ( $ this -> _sViewId ) ) { $ this -> _sViewId = parent :: getViewId ( ) . '|' . \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'oxcid' ) ; } return $ this -> _sViewId ; }
Returns prefix ID used by template engine .
36,971
protected function _canShowContent ( $ sContentIdent ) { return ! ( $ this -> isEnabledPrivateSales ( ) && ! $ this -> getUser ( ) && ! in_array ( $ sContentIdent , $ this -> _aPsAllowedContents ) ) ; }
Checks if content can be shown
36,972
public function getContentCategory ( ) { if ( $ this -> _oContentCat === null ) { $ this -> _oContentCat = false ; if ( ( $ oContent = $ this -> getContent ( ) ) && $ oContent -> oxcontents__oxtype -> value == 2 ) { $ this -> _oContentCat = $ oContent ; } } return $ this -> _oContentCat ; }
If current content is assigned to category returns its object
36,973
public function showPlainTemplate ( ) { $ blPlain = ( bool ) \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'plain' ) ; if ( $ blPlain === false ) { $ oUser = $ this -> getUser ( ) ; if ( $ this -> isEnabledPrivateSales ( ) && ( ! $ oUser || ( $ oUser && ! $ oUser -> isTermsAccepted ( ) ) ) ) { $ blPlain = true ; } } return ( bool ) $ blPlain ; }
Returns true if user forces to display plain template or if private sales switched ON and user is not logged in
36,974
public function getContentId ( ) { if ( $ this -> _sContentId === null ) { $ sContentId = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'oxcid' ) ; $ sLoadId = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'oxloadid' ) ; $ this -> _sContentId = false ; $ oContent = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Content :: class ) ; if ( $ sLoadId ) { $ blRes = $ oContent -> loadByIdent ( $ sLoadId ) ; } elseif ( $ sContentId ) { $ blRes = $ oContent -> load ( $ sContentId ) ; } else { $ blRes = $ oContent -> loadByIdent ( 'oximpressum' ) ; } if ( $ blRes && $ oContent -> oxcontents__oxactive -> value ) { $ this -> _sContentId = $ oContent -> oxcontents__oxid -> value ; $ this -> _oContent = $ oContent ; } } return $ this -> _sContentId ; }
Template variable getter . Returns active content id . If no content id specified uses impressum content id
36,975
protected function _getTplName ( ) { $ sTplName = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'tpl' ) ; if ( $ sTplName ) { $ sTplName = basename ( $ sTplName ) ; if ( ! getStr ( ) -> preg_match ( "/\.tpl$/" , $ sTplName ) ) { $ sTplName = null ; } else { $ sTplName = 'message/' . $ sTplName ; } } return $ sTplName ; }
Returns name of template
36,976
public function getTitle ( ) { if ( $ this -> _sContentTitle === null ) { $ oContent = $ this -> getContent ( ) ; $ this -> _sContentTitle = $ oContent -> oxcontents__oxtitle -> value ; } return $ this -> _sContentTitle ; }
Template variable getter . Returns tag title
36,977
public function getBusinessEntityExtends ( ) { $ myConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ aExtends = [ ] ; foreach ( $ this -> _aBusinessEntityExtends as $ sExtend ) { $ aExtends [ $ sExtend ] = $ myConfig -> getConfigParam ( $ sExtend ) ; } return $ aExtends ; }
Gets extended business entity data
36,978
public function getDeliveryChargeSpecs ( ) { $ aDeliveryChargeSpecs = [ ] ; $ oDeliveryChargeSpecs = $ this -> getDeliveryList ( ) ; foreach ( $ oDeliveryChargeSpecs as $ oDeliveryChargeSpec ) { if ( $ oDeliveryChargeSpec -> oxdelivery__oxaddsumtype -> value == "abs" ) { $ oDelSets = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ DeliverySetList :: class ) ; $ oDelSets -> loadRDFaDeliverySetList ( $ oDeliveryChargeSpec -> getId ( ) ) ; $ oDeliveryChargeSpec -> deliverysetmethods = $ oDelSets ; $ aDeliveryChargeSpecs [ ] = $ oDeliveryChargeSpec ; } } return $ aDeliveryChargeSpecs ; }
Returns delivery methods with assigned deliverysets .
36,979
public function getDeliveryList ( ) { if ( $ this -> _oDelList === null ) { $ this -> _oDelList = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ DeliveryList :: class ) ; $ this -> _oDelList -> getList ( ) ; } return $ this -> _oDelList ; }
Template variable getter . Returns delivery list
36,980
public function getRdfaPriceValidity ( ) { $ iDays = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'iRDFaPriceValidity' ) ; $ iFrom = \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsDate ( ) -> getTime ( ) ; $ iThrough = $ iFrom + ( $ iDays * 24 * 60 * 60 ) ; $ oPriceValidity = [ ] ; $ oPriceValidity [ 'validfrom' ] = date ( 'Y-m-d\TH:i:s' , $ iFrom ) . "Z" ; $ oPriceValidity [ 'validthrough' ] = date ( 'Y-m-d\TH:i:s' , $ iThrough ) . "Z" ; return $ oPriceValidity ; }
Returns rdfa VAT
36,981
public function getParsedContent ( ) { $ oUtilsView = \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsView ( ) ; return $ oUtilsView -> parseThroughSmarty ( $ this -> getContent ( ) -> oxcontents__oxcontent -> value , $ this -> getContent ( ) -> getId ( ) , null , true ) ; }
Returns content parsed through smarty
36,982
public function getLinksList ( ) { if ( $ this -> _oLinksList === null ) { $ this -> _oLinksList = false ; $ oLinksList = oxNew ( \ OxidEsales \ Eshop \ Core \ Model \ ListModel :: class ) ; $ oLinksList -> init ( "oxlinks" ) ; $ oLinksList -> getList ( ) ; $ this -> _oLinksList = $ oLinksList ; } return $ this -> _oLinksList ; }
Template variable getter . Returns links list
36,983
public function getProduct ( ) { if ( ( $ sActProduct = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'anid' ) ) ) { $ oParentView = $ this -> getParent ( ) ; if ( ( $ oProduct = $ oParentView -> getViewProduct ( ) ) ) { return $ oProduct ; } else { $ oProduct = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Article :: class ) ; if ( $ oProduct -> load ( $ sActProduct ) ) { $ oParentView -> setViewProduct ( $ oProduct ) ; return $ oProduct ; } } } }
get active article
36,984
protected function _getActCat ( ) { $ sActManufacturer = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'mnid' ) ; $ sActCat = $ sActManufacturer ? null : \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'cnid' ) ; $ oProduct = $ this -> getProduct ( ) ; if ( $ oProduct ) { $ myConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ sActManufacturer = $ myConfig -> getConfigParam ( 'bl_perfLoadManufacturerTree' ) ? $ sActManufacturer : null ; $ sActVendor = ( getStr ( ) -> preg_match ( '/^v_.?/i' , $ sActCat ) ) ? $ sActCat : null ; $ sActCat = $ this -> _addAdditionalParams ( $ oProduct , $ sActCat , $ sActManufacturer , $ sActVendor ) ; } if ( $ sActCat === null && ! $ oProduct && ! $ sActManufacturer ) { $ sActCat = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getActiveShop ( ) -> oxshops__oxdefcat -> value ; if ( $ sActCat == 'oxrootid' ) { $ sActCat = null ; } } return $ sActCat ; }
get active category id
36,985
protected function _loadCategoryTree ( $ sActCat ) { $ oCategoryTree = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ CategoryList :: class ) ; $ oCategoryTree -> buildTree ( $ sActCat ) ; $ oParentView = $ this -> getParent ( ) ; $ oParentView -> setCategoryTree ( $ oCategoryTree ) ; $ this -> setCategoryTree ( $ oCategoryTree ) ; $ oParentView -> setActiveCategory ( $ oCategoryTree -> getClickCat ( ) ) ; }
Category tree loader
36,986
protected function _loadManufacturerTree ( $ sActManufacturer ) { $ myConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; if ( $ myConfig -> getConfigParam ( 'bl_perfLoadManufacturerTree' ) ) { $ oManufacturerTree = $ this -> getManufacturerList ( ) ; $ shopHomeURL = $ myConfig -> getShopHomeUrl ( ) ; $ oManufacturerTree -> buildManufacturerTree ( 'manufacturerlist' , $ sActManufacturer , $ shopHomeURL ) ; $ oParentView = $ this -> getParent ( ) ; $ oParentView -> setManufacturerTree ( $ oManufacturerTree ) ; $ this -> setManufacturerTree ( $ oManufacturerTree ) ; if ( ( $ oManufacturer = $ oManufacturerTree -> getClickManufacturer ( ) ) ) { $ oParentView -> setActManufacturer ( $ oManufacturer ) ; } } }
Manufacturer tree loader
36,987
public function getIconUrl ( ) { if ( $ this -> _sIconUrl === null || $ this -> _blSsl != \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> isSsl ( ) ) { $ this -> _sIconUrl = $ this -> getArticle ( ) -> getIconUrl ( ) ; } return $ this -> _sIconUrl ; }
Returns article icon picture url
36,988
public function getArticle ( $ blCheckProduct = false , $ sProductId = null , $ blDisableLazyLoading = false ) { if ( $ this -> _oArticle === null || ( ! $ this -> _oArticle -> isOrderArticle ( ) && $ blDisableLazyLoading ) ) { $ sProductId = $ sProductId ? $ sProductId : $ this -> _sProductId ; if ( ! $ sProductId ) { $ oEx = oxNew ( \ OxidEsales \ Eshop \ Core \ Exception \ ArticleException :: class ) ; $ oEx -> setMessage ( 'EXCEPTION_ARTICLE_NOPRODUCTID' ) ; throw $ oEx ; } $ this -> _oArticle = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Article :: class ) ; if ( $ blDisableLazyLoading ) { $ this -> _oArticle -> modifyCacheKey ( '_allviews' ) ; $ this -> _oArticle -> disableLazyLoading ( ) ; } $ this -> _oArticle -> setNoVariantLoading ( true ) ; $ this -> _oArticle -> setLoadParentData ( true ) ; if ( ! $ this -> _oArticle -> load ( $ sProductId ) ) { $ oEx = oxNew ( \ OxidEsales \ Eshop \ Core \ Exception \ NoArticleException :: class ) ; $ oLang = \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) ; $ oEx -> setMessage ( sprintf ( $ oLang -> translateString ( 'ERROR_MESSAGE_ARTICLE_ARTICLE_DOES_NOT_EXIST' , $ oLang -> getBaseLanguage ( ) ) , $ sProductId ) ) ; $ oEx -> setArticleNr ( $ sProductId ) ; $ oEx -> setProductId ( $ sProductId ) ; throw $ oEx ; } if ( $ blCheckProduct && ! $ this -> _oArticle -> isVisible ( ) ) { $ oEx = oxNew ( \ OxidEsales \ Eshop \ Core \ Exception \ NoArticleException :: class ) ; $ oLang = \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) ; $ oEx -> setMessage ( sprintf ( $ oLang -> translateString ( 'ERROR_MESSAGE_ARTICLE_ARTICLE_DOES_NOT_EXIST' , $ oLang -> getBaseLanguage ( ) ) , $ this -> _oArticle -> oxarticles__oxartnum -> value ) ) ; $ oEx -> setArticleNr ( $ sProductId ) ; $ oEx -> setProductId ( $ sProductId ) ; throw $ oEx ; } if ( $ blCheckProduct && ! $ this -> _oArticle -> isBuyable ( ) ) { $ oEx = oxNew ( \ OxidEsales \ Eshop \ Core \ Exception \ ArticleInputException :: class ) ; $ oEx -> setMessage ( 'ERROR_MESSAGE_ARTICLE_ARTICLE_NOT_BUYABLE' ) ; $ oEx -> setArticleNr ( $ sProductId ) ; $ oEx -> setProductId ( $ sProductId ) ; throw $ oEx ; } } return $ this -> _oArticle ; }
Retrieves the article . Throws an exception if article does not exist is not buyable or visible .
36,989
public function getTitle ( ) { if ( $ this -> _sTitle === null || $ this -> getLanguageId ( ) != \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> getBaseLanguage ( ) ) { $ oArticle = $ this -> getArticle ( ) ; $ this -> _sTitle = $ oArticle -> oxarticles__oxtitle -> value ; if ( $ oArticle -> oxarticles__oxvarselect -> value ) { $ this -> _sTitle = $ this -> _sTitle . ', ' . $ this -> getVarSelect ( ) ; } } return $ this -> _sTitle ; }
Returns product title
36,990
public function getLink ( ) { if ( $ this -> _sLink === null || $ this -> getLanguageId ( ) != \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> getBaseLanguage ( ) ) { $ this -> _sLink = \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsUrl ( ) -> cleanUrl ( $ this -> getArticle ( ) -> getLink ( ) , [ 'force_sid' ] ) ; } return $ this -> getSession ( ) -> processUrl ( $ this -> _sLink ) ; }
Returns product details URL
36,991
public function getWrapping ( ) { $ oWrap = null ; if ( $ sWrapId = $ this -> getWrappingId ( ) ) { $ oWrap = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Wrapping :: class ) ; $ oWrap -> load ( $ sWrapId ) ; } return $ oWrap ; }
Returns basket item wrapping object
36,992
public function getFRegularUnitPrice ( ) { return \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> formatCurrency ( $ this -> getRegularUnitPrice ( ) -> getPrice ( ) ) ; }
Returns formatted regular unit price
36,993
public function getFUnitPrice ( ) { return \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> formatCurrency ( $ this -> getUnitPrice ( ) -> getPrice ( ) ) ; }
Returns formatted unit price
36,994
public function getVarSelect ( ) { if ( $ this -> _sVarSelect === null || $ this -> getLanguageId ( ) != \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> getBaseLanguage ( ) ) { $ oArticle = $ this -> getArticle ( ) ; $ sVarSelectValue = $ oArticle -> oxarticles__oxvarselect -> value ; $ this -> _sVarSelect = ( ! empty ( $ sVarSelectValue ) || $ sVarSelectValue === '0' ) ? $ sVarSelectValue : '' ; } return $ this -> _sVarSelect ; }
Returns varselect value
36,995
public function setLanguageId ( $ iLanguageId ) { $ iOldLang = $ this -> _iLanguageId ; $ this -> _iLanguageId = $ iLanguageId ; if ( $ iOldLang !== null && $ iOldLang != $ iLanguageId ) { try { $ this -> _setArticle ( $ this -> getProductId ( ) ) ; } catch ( \ OxidEsales \ Eshop \ Core \ Exception \ NoArticleException $ oEx ) { \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsView ( ) -> addErrorToDisplay ( $ oEx ) ; } catch ( \ OxidEsales \ Eshop \ Core \ Exception \ ArticleInputException $ oEx ) { \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsView ( ) -> addErrorToDisplay ( $ oEx ) ; } } }
Set language Id reload basket content on language change .
36,996
public function convertToFormattedDbDate ( ) { $ this -> setValue ( \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsDate ( ) -> formatDBDate ( $ this -> rawValue ) , self :: T_RAW ) ; }
Converts to formatted db date
36,997
protected function _initValue ( $ value = null , $ type = self :: T_TEXT ) { switch ( $ type ) { case self :: T_TEXT : $ this -> rawValue = $ value ; break ; case self :: T_RAW : $ this -> value = $ value ; break ; } }
Initial field value
36,998
public function setValue ( $ value = null , $ type = self :: T_TEXT ) { unset ( $ this -> rawValue ) ; unset ( $ this -> value ) ; $ this -> _initValue ( $ value , $ type ) ; }
Sets field value and type
36,999
public function save ( ) { parent :: save ( ) ; $ soxId = $ this -> getEditObjectId ( ) ; $ aParams = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( "editval" ) ; $ oCategory = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Category :: class ) ; $ iCatLang = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( "catlang" ) ; $ iCatLang = $ iCatLang ? $ iCatLang : 0 ; if ( $ soxId != "-1" ) { $ oCategory -> loadInLang ( $ iCatLang , $ soxId ) ; } else { $ aParams [ 'oxcategories__oxid' ] = null ; } if ( $ oCategory -> isDerived ( ) ) { return ; } $ oCategory -> setLanguage ( 0 ) ; $ oCategory -> assign ( $ aParams ) ; $ oCategory -> setLanguage ( $ iCatLang ) ; $ oCategory -> save ( ) ; $ this -> setEditObjectId ( $ oCategory -> getId ( ) ) ; }
Saves category description text to DB .