Set/get data into/from localStorage

@param  String       key
@param  String|void  value
@return String|null
493815
function(key, val) {
		var self   = this,
			s      = window.localStorage,
			oldkey = 'elfinder-'+(key || '')+this.id, // old key of elFinder < 2.1.6
			prefix = window.location.pathname+'-elfinder-',
			suffix = this.id,
			clrs   = [],
			retval, oldval, t, precnt, sufcnt;

		// reset this node data
		if (typeof(key) === 'undefined') {
			precnt = prefix.length;
			sufcnt = suffix.length * -1;
			$.each(s, function(key) {
				if (key.substr(0, precnt) === prefix && key.substr(sufcnt) === suffix) {
					clrs.push(key);
				}
			});
			$.each(clrs, function(i, key) {
				s.removeItem(key);
			});
			return true;
		}
		
		// new key of elFinder >= 2.1.6
		key = prefix+key+suffix;
		
		if (val === null) {
			return s.removeItem(key);
		}
		
		if (val === void(0) && !(retval = s.getItem(key)) && (oldval = s.getItem(oldkey))) {
			val = oldval;
			s.removeItem(oldkey);
		}
		
		if (val !== void(0)) {
			t = typeof val;
			if (t !== 'string' && t !== 'number') {
				val = JSON.stringify(val);
			}
			try {
				s.setItem(key, val);
			} catch (e) {
				try {
					s.clear();
					s.setItem(key, val);
				} catch (e) {
					self.debug('error', e.toString());
				}
			}
			retval = s.getItem(key);
		}

		if (retval && (retval.substr(0,1) === '{' || retval.substr(0,1) === '[')) {
			try {
				return JSON.parse(retval);
			} catch(e) {}
		}
		return retval;
	}
1320336
public static function getFromCache($key)
  {
    static::initialize();
    $v = self::$cm->getFromCache($key);
    return $v ? $v['value'] : null;
  }
1322257
public function get(string $key)
    {
        $hash =  self::findFirst([
            'conditions' => "{$this->settingsKey} = ?0 and key = ?1",
            'bind' => [$this->getSettingsKey(), $key]
        ]);

        if ($hash) {
            return $hash->value;
        }

        return null;
    }
185801
@Override
  public String get(String key) {
    Object value = conf.get(key);
    if(null != value) {
      return value.toString();
    }
    else {
      return null;
    }
  }
183566
function (key) {

      if (!browserSupportsLocalStorage || self.storageType === 'cookie') {
        if (!browserSupportsLocalStorage) {
          $rootScope.$broadcast('LocalStorageModule.notification.warning','LOCAL_STORAGE_NOT_SUPPORTED');
        }

        return getFromCookies(key);
      }

      var item = webStorage ? webStorage.getItem(deriveQualifiedKey(key)) : null;
      // angular.toJson will convert null to 'null', so a proper conversion is needed
      // FIXME not a perfect solution, since a valid 'null' string can't be stored
      if (!item || item === 'null') {
        return null;
      }

      if (item.charAt(0) === "{" || item.charAt(0) === "[") {
        return angular.fromJson(item);
      }

      return item;
    }
442976
function (key, value, callbackId) {
    const sender = this.sender
    if (!supportLocalStorage) {
      return callNotSupportFail(sender, callbackId)
    }
    if (!key || (!value && value !== 0)) {
      sender.performCallback(callbackId, {
        result: 'failed',
        data: INVALID_PARAM
      })
      return
    }
    try {
      localStorage.setItem(key, value)
      sender.performCallback(callbackId, {
        result: SUCCESS,
        data: UNDEFINED
      })
    }
    catch (e) {
      // accept any exception thrown during a storage attempt as a quota error
      callFail(sender, callbackId)
    }
  }
566149
static function get_value( $key ) {
		if( ! self::started() ){
			trigger_error("Session not started, cannot get_value", E_USER_WARNING );
			return null;
		}
		if( !is_array($key) ){
			$key = explode( '.', $key );
		}
		$Obj = self::$Session->Data;
		foreach( $key as $k ){
			if( !isset( $Obj[$k] ) ){
				return null;
			}
			$Obj = $Obj[$k];
		}
		return $Obj;
	}
600831
public function retrieve(string $key)
  {
    $file = $this->file;

    if (file_exists($file)) {
      $data = unserialize($this->decrypt(file_get_contents($file)));

      if (isset($data[$key])) {
        return $data[$key];
      }
    }

    return null;
  }
817714
public function set($key, $data = null)
    {
        if (is_array($key)) {
            $this->appendArray($key);
        } else {
            $this->appendData($key, $data);
        }

        return $this;
    }
50305
function Get($key) {
        // check the file description
        if (!$this->fd) {
            trigger_error("XDB:Get(), null db handler.", E_USER_WARNING);
            return false;
        }

        $klen = strlen($key);
        if ($klen == 0 || $klen > XDB_MAXKLEN)
            return false;

        // get the data?
        $rec = $this->_get_record($key);

        if (!isset($rec['vlen']) || $rec['vlen'] == 0)
            return false;

        return $rec['value'];
    }
380311
public static function get(string $key = null)
    {
        self::set();

        if (empty($key)) {
            return self::$config;
        }

        $keys  = explode('.', $key);
        $value = self::$config;

        foreach ($keys as $key) {
            if ( ! isset($value[$key])) {
                return null;
            }

            $value = $value[$key];
        }

        return $value;
    }
789205
public function getParsedData($key = null)
    {
        $result = null;

        if ($this->parsedData !== null && is_array($this->parsedData)) {
            if (null === $key) {
                $result = $this->parsedData;
            } else {
                $result = (isset($this->parsedData[$key])) ? $this->parsedData[$key] : null;
            }
        }

        return $result;
    }
19084
public function get_data($key=null) {
		if (! $this->is_phone()) {
			return false;
		}

		if (\is_string($key)) {
			$key = \strtolower($key);
			return $this->phone[$key] ?? false;
		}

		return $this->phone;
	}
438856
public function data(string $key, array $data = null)
    {
        $this->tryLoad($key);

        if (!\array_key_exists($key, $this->data))
        {
            $this->data[$key] = $this->get($key, $data);
        }

        return $this->data[$key];
    }
1041761
public function load($key)
    {
        if (file_exists($path = $this->path . $key)) {
            return unserialize(file_get_contents($path));
        }

        return null;
    }
36278
function getMetaData($key = null)
    {
        $data = $this->data;
        if ($key !== null)
            $data = ( isset($data[$key]) ) ? $data[$key] : null;


        return $data;
    }
1345319
protected function get($key)
    {
        $this->checkForNonEmptyKey($key);
        if (!$this->requestDataHasBeenRetrieved) {
            $this->retrieveRequestData();
        }
        if (!isset($this->cachedRequestData[$key])) {
            return null;
        }

        return $this->cachedRequestData[$key];
    }