Fetches a value from the active user's session data

@param string $sKeys      The key to look up in activeUser
@param string $sDelimiter If multiple fields are requested they'll be joined by this string

@return mixed
436681
public function activeUser($sKeys = '', $sDelimiter = ' ')
    {
        //  Only look for a value if we're logged in
        if (!$this->isLoggedIn()) {
            return false;
        }

        // --------------------------------------------------------------------------

        //  If $sKeys is false just return the user object in its entirety
        if (empty($sKeys)) {
            return $this->activeUser;
        }

        // --------------------------------------------------------------------------

        //  If only one key is being requested then don't do anything fancy
        if (strpos($sKeys, ',') === false) {

            $val = isset($this->activeUser->{trim($sKeys)}) ? $this->activeUser->{trim($sKeys)} : null;

        } else {

            //  More than one key
            $aKeys = explode(',', $sKeys);
            $aKeys = array_filter($aKeys);
            $aOut  = [];

            foreach ($aKeys as $sKey) {

                //  If something is found, use that.
                if (isset($this->activeUser->{trim($sKey)})) {
                    $aOut[] = $this->activeUser->{trim($sKey)};
                }
            }

            //  If nothing was found, just return null
            if (empty($aOut)) {
                $val = null;
            } else {
                $val = implode($sDelimiter, $aOut);
            }
        }

        return $val;
    }
1231935
private function getVarValue($sKey, $aVars)
    {
        foreach ($aVars as $aVar) {
            if ($sKey == $aVar['key']) {
                return $aVar['value'];
            }
        }

        return null;
    }
602355
public function delete(string $sKey): bool
    {
        if (array_key_exists($sKey, $this->aCookies) && setcookie($sKey, '', 1)) {
            unset($this->aCookies[$sKey]);
            return true;
        }

        return false;
    }
1092969
private static function getFunctionNameAndParameter($sKey) : array
  {
    preg_match_all("/\((.*?)\)/", $sKey, $aParam);

    return [
      str_replace($aParam[0][0], '', $sKey), 
      preg_replace('/^["\'](.*)["\']$/m', '$1', $aParam[1][0]) // remove quotes
    ];
  }
653698
public function getData($sKey = null)
    {
        if (is_null($sKey)) {
            return $this->aData;
        } elseif (array_key_exists($sKey, $this->aData)) {
            return $this->aData[$sKey];
        } else {
            return null;
        }
    }
743522
public function clear($sKey)
    {
        if (empty($sKey)) {
            return;
        }

        $this->clearDefaultStorageValue($sKey);

        //Get auth user object
        $obUser = UserHelper::instance()->getUser();
        if (empty($obUser)) {
            return;
        }

        $obUser->$sKey = null;
        $obUser->save();
    }
1225991
public function getUrl(string $sKey = null): string
    {
        $sUrl = rtrim($this->sUrl, '/');
        $sUrl .= $sKey ? '/' . $sKey : '';
        return $sUrl;
    }
1278632
public function get($sKey = null, $sGrouping = 'app', $bForceRefresh = false)
    {
        if (!isset($this->aSettings[$sGrouping]) || $bForceRefresh) {

            $oDb = Factory::service('Database');
            $oDb->where('grouping', $sGrouping);
            $aSettings = $oDb->get($this->sTable)->result();

            $this->aSettings[$sGrouping] = [];

            foreach ($aSettings as $oSetting) {

                $sValue = $oSetting->value;

                if (!empty($oSetting->is_encrypted)) {
                    $oEncrypt = Factory::service('Encrypt');
                    $sValue   = $oEncrypt->decode($sValue);
                }

                $this->aSettings[$sGrouping][$oSetting->key] = json_decode($sValue);
            }
        }

        // --------------------------------------------------------------------------

        if (empty($sKey)) {

            return $this->aSettings[$sGrouping];

        } else {

            return isset($this->aSettings[$sGrouping][$sKey]) ? $this->aSettings[$sGrouping][$sKey] : null;
        }
    }
991265
public function loadRDFaDeliverySetList($sDelId = null)
    {
        $sTable = getViewName('oxdeliveryset');
        if ($sDelId) {
            $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
            $sSubSql = "( select $sTable.* from $sTable left join oxdel2delset on oxdel2delset.oxdelsetid=$sTable.oxid where " . $this->getBaseObject()->getSqlActiveSnippet() . " and oxdel2delset.oxdelid = " . $oDb->quote($sDelId) . " ) as $sTable";
        } else {
            $sSubSql = $sTable;
        }
        $sQ = "select $sTable.*, oxobject2delivery.oxobjectid from $sSubSql left join (select oxobject2delivery.* from oxobject2delivery where oxobject2delivery.oxtype = 'rdfadeliveryset' ) as oxobject2delivery on oxobject2delivery.oxdeliveryid=$sTable.oxid where " . $this->getBaseObject()->getSqlActiveSnippet() . " ";
        $this->selectString($sQ);
    }
1107507
protected function getCache($sKey, $bReturnValue = true)
    {
        if (!static::$CACHING_ENABLED) {
            return false;
        } elseif (empty($sKey)) {
            return false;
        }

        $sCacheKey = $this->getCachePrefix() . $sKey;
        foreach ($this->aCache as $iIndex => $oCacheItem) {
            if (in_array($sCacheKey, $oCacheItem->key)) {
                return $bReturnValue ? $oCacheItem->value : $iIndex;
            }
        }

        return null;
    }
185172
public static function sDecode($string = '', $skey = 'wenzi' , $mix = array('#b1'=>'+' , '#b2'=>'/' , '@A' => ' ')) {
        $string = base64_decode( $string , TRUE  );
        if($mix){
            $arrayKey = array_keys($mix);
            $arrayValue = array_values($mix);
            $string = str_replace($arrayKey,$arrayValue , $string);
        }
        $strlen = strlen($string);
        $skLen = strlen($skey);
        $str = '';
        for($i=0; $i < $strlen ; $i++){
            $sI =  $i % $skLen;
            $str .= $string[$i] ^ $skey[$sI];
        }

        return base64_decode($str , true);
    }
1020042
function(sEntitySetName, sKeys) {
					sKeys = decodeURIComponent(sKeys);
					var oFoundEntry;
					var oEntitySet = that._mEntitySets[sEntitySetName];
					var aKeys = oEntitySet.keys;
					// split keys
					var aRequestedKeys = sKeys.split(',');

					// check number of keys to be equal to the entity keys and validates keys type for quotations
					if (aRequestedKeys.length !== aKeys.length) {
						that._logAndThrowMockServerCustomError(400, that._oErrorMessages.INVALID_KEY_PREDICATE_QUANTITY);
					}
					that._isRequestedKeysValid(oEntitySet, aRequestedKeys);
					if (aRequestedKeys.length === 1 && !aRequestedKeys[0].split('=')[1]) {
						aRequestedKeys = [aKeys[0] + "=" + aRequestedKeys[0]];
					}
					jQuery.each(that._oMockdata[sEntitySetName], function(iIndex, oEntry) {
						// check each key for existence and value
						for (var i = 0; i < aRequestedKeys.length; i++) {
							var aKeyVal = aRequestedKeys[i].split('=');
							var sKey = that._trim(aKeyVal[0]);
							//key doesn't match, continue to next entry
							if (!aKeys || aKeys.indexOf(sKey) === -1) {
								return true; // = continue
							}

							var sNewValue = that._trim(aKeyVal[1]);
							var sOrigiValue = oEntry[sKey];

							switch (oEntitySet.keysType[sKey]) {
								case "Edm.String":
									sNewValue = sNewValue.replace(/^\'|\'$/g, '');
									break;
								case "Edm.Time":
								case "Edm.DateTime":
									sOrigiValue = that._getDateTime(sOrigiValue);
									break;
								case "Edm.Int16":
								case "Edm.Int32":
									//case "Edm.Int64": In ODataModel this type is represented as a string. (https://openui5.hana.ondemand.com/docs/api/symbols/sap.ui.model.odata.type.Int64.html)
								case "Edm.Decimal":
								case "Edm.Byte":
								case "Edm.Double":
								case "Edm.Single":
								case "Edm.SByte":
									if (!that._isValidNumber(sNewValue)) {
										//TODO check better handling
										return false; // = break
									}
									sNewValue = parseFloat(sNewValue);
									break;
								case "Edm.Guid":
									sNewValue = sNewValue.replace(/^guid\'|\'$/g, '');
									break;
								case "Edm.Boolean":
									if (["true", "false"].indexOf(sNewValue) === -1) {
										that._logAndThrowMockServerCustomError(400, that._oErrorMessages.INVALID_KEY_TYPE, sKey);
									}
									sNewValue = sNewValue === "true";
									break;
								case "Edm.Binary":
								case "Edm.DateTimeOffset":
								default:
									sNewValue = sNewValue;
							}

							//value doesn't match, continue to next entry
							if (sOrigiValue !== sNewValue) {
								return true; // = continue
							}
						}
						oFoundEntry = {
							index: iIndex,
							entry: oEntry
						};
						return false; // = break
					});
					return oFoundEntry;
				}
248303
public static function GetActiveDiscountList($sFilter = null, $sOrder = '`shop_discount`.`position`')
    {
        static $aActiveDiscountList = array();
        $aKey = array('sFilter' => $sFilter, 'sOrder' => $sOrder);
        $sKey = TCacheManager::GetKey($aKey);
        if (!array_key_exists($sKey, $aActiveDiscountList)) {
            $now = MySqlLegacySupport::getInstance()->real_escape_string(date('Y-m-d H:i:s'));
            if (!empty($sOrder)) {
                $sOrder = "ORDER BY {$sOrder}";
            }
            if (is_null($sFilter)) {
                $sFilter = '';
            } else {
                $sFilter = " AND ({$sFilter})";
            }
            $query = "SELECT *
                    FROM `shop_discount`
                   WHERE `shop_discount`.`active` = '1'
                     AND (`shop_discount`.`active_from` <= '{$now}' AND (`shop_discount`.`active_to` >= '{$now}' || `shop_discount`.`active_to` = '0000-00-00 00:00:00'))
                         {$sFilter}
                         {$sOrder}
                 ";
            $aActiveDiscountList[$sKey] = parent::GetList($query);
            $aActiveDiscountList[$sKey]->bAllowItemCache = true;
        } else {
            $aActiveDiscountList[$sKey]->GoToStart();
        }

        return $aActiveDiscountList[$sKey];
    }
604823
protected function getDefaultStorageValue($sKey, $sDefaultValue = null)
    {
        if (empty($this->obDefaultStorage)) {
            return $sDefaultValue;
        }

        return $this->obDefaultStorage->get($sKey, $sDefaultValue);
    }
967282
public function retrieveById($identifier) {
        if (!$this->isValidIdentifierValue($identifier)) {
            return null;
        }
        /** @var RecordInterface $user */
        $user = $this->createEmptyUserRecord()->fromPrimaryKey($identifier, [], $this->getRelationsToFetch());

        return $this->validateUser($user, null);
    }
779606
protected static function getNameAndId($mNameId, &$sName, &$sId)
    {
        if (is_array($mNameId))
        {
            $sName = $mNameId[0];
            $sId = !empty($mNameId[1]) ? $mNameId[1] : null;
        }
        else {
            $sName = $sId = $mNameId;
        }
    }
472817
protected function setCache($sKey, $mValue)
    {
        if (!static::$CACHING_ENABLED) {
            return false;
        } elseif (empty($sKey)) {
            return false;
        }

        // --------------------------------------------------------------------------

        //  Test we're not near memory limit
        if (function_exists('ini_get')) {
            $sMemoryLimit = ini_get('memory_limit_cat');
            if ($sMemoryLimit !== false) {
                $sLastChar = strtoupper($sMemoryLimit[strlen($sMemoryLimit) - 1]);
                switch ($sLastChar) {
                    // The 'G' modifier is available since PHP 5.1.0
                    case 'G':
                        $sMemoryLimit *= 1024;
                    /* falls through */
                    case 'M':
                        $sMemoryLimit *= 1024;
                    /* falls through */
                    case 'K':
                        $sMemoryLimit *= 1024;
                }

                $fPercentage = (memory_get_usage() / $sMemoryLimit) * 100;
                if ($fPercentage > 90) {
                    $this->clearCache();
                }
            }
        }

        // --------------------------------------------------------------------------

        //  Prep the key, the key should have a prefix unique to this model
        $iCacheIndex = $this->getCache($sKey, false);
        if (!is_null($iCacheIndex)) {
            $this->aCache[$iCacheIndex]->value = $mValue;
        } else {
            $sCacheKey      = $this->getCachePrefix() . $sKey;
            $this->aCache[] = (object) [
                'key'   => [$sCacheKey],
                'value' => $mValue,
            ];
        }

        // --------------------------------------------------------------------------

        return true;
    }