mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-31 21:19:21 +03:00
Update PHP Facebook SDK
This commit is contained in:
parent
77fb74bc4a
commit
075e184f7d
84 changed files with 9906 additions and 7761 deletions
|
|
@ -0,0 +1,81 @@
|
|||
<?php
|
||||
|
||||
namespace RainLoop\Common;
|
||||
|
||||
class FacebookRainLoopPersistentDataHandler implements \Facebook\PersistentData\PersistentDataInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $rlUserHash;
|
||||
|
||||
/**
|
||||
* @var mixed
|
||||
*/
|
||||
private $rlAccount;
|
||||
|
||||
/**
|
||||
* @var mixed
|
||||
*/
|
||||
private $rlStorageProvaider;
|
||||
|
||||
public function __construct($rlAccount, $rlUserHash, $rlStorageProvaider)
|
||||
{
|
||||
$this->rlAccount = $rlAccount;
|
||||
$this->rlUserHash = $rlUserHash;
|
||||
$this->rlStorageProvaider = $rlStorageProvaider;
|
||||
|
||||
if (!class_exists('RainLoop\Providers\Storage\Enumerations\StorageType') || '' === $this->rlUserHash)
|
||||
{
|
||||
$this->rlStorageProvaider = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a value from a persistent data store.
|
||||
*
|
||||
* @param string $key
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function get($key)
|
||||
{
|
||||
if ($this->rlStorageProvaider)
|
||||
{
|
||||
return $this->rlStorageProvaider->Get(
|
||||
$this->rlAccount ? $this->rlAccount : null,
|
||||
$this->rlAccount ? \RainLoop\Providers\Storage\Enumerations\StorageType::USER :
|
||||
\RainLoop\Providers\Storage\Enumerations\StorageType::NOBODY,
|
||||
$this->generateSessionVariableName($key), false);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a value in the persistent data store.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function set($key, $value)
|
||||
{
|
||||
if ($this->rlStorageProvaider)
|
||||
{
|
||||
$this->rlStorageProvaider->Put(
|
||||
$this->rlAccount ? $this->rlAccount : null,
|
||||
$this->rlAccount ? \RainLoop\Providers\Storage\Enumerations\StorageType::USER :
|
||||
\RainLoop\Providers\Storage\Enumerations\StorageType::NOBODY,
|
||||
$this->generateSessionVariableName($key), $value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
* @return string
|
||||
*/
|
||||
private function generateSessionVariableName($key)
|
||||
{
|
||||
return implode('/', array('Fackebook', \md5($this->rlUserHash), 'Storage', $key));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue