This repository was archived by the owner on Nov 9, 2017. It is now read-only.
forked from kriswallsmith/FacebookBundle
-
Notifications
You must be signed in to change notification settings - Fork 135
Expand file tree
/
Copy pathFacebookSessionPersistenceProxy.php
More file actions
160 lines (130 loc) · 3.78 KB
/
FacebookSessionPersistenceProxy.php
File metadata and controls
160 lines (130 loc) · 3.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<?php
namespace FOS\FacebookBundle\Facebook;
use Symfony\Component\HttpFoundation\Session;
/**
* @author Leszek Prabucki <leszek.prabucki@gmail.com>
*/
class FacebookSessionPersistenceProxy implements FacebookInterface
{
/**
* @var Symfony\Component\HttpFoundation\Session
*/
protected $session = null;
/**
* @var string
*/
protected $prefix = '';
/**
* @var array
*/
protected $config = array();
/**
* @var FOS\FacebookBundle\Facebook\FacebookSessionPersistence
*/
private $sessionPersistence = null;
/**
* @param array $config the application configuration.
* @param Symfony\Component\HttpFoundation\Session
* @param string
*/
public function __construct($config, Session $session, $prefix = null)
{
$this->config = $config;
$this->session = $session;
$this->prefix = $prefix;
}
public function getUser()
{
return $this->getSessionPersistence()->getUser();
}
public function getAppId()
{
return $this->getSessionPersistence()->getAppId();
}
public function setAppId($appId)
{
return $this->getSessionPersistence()->setAppId($appId);
}
public function getAppSecret()
{
return $this->getSessionPersistence()->getAppSecret();
}
public function setAppSecret($secret)
{
return $this->getSessionPersistence()->setAppSecret($secret);
}
public function getApiSecret()
{
return $this->getSessionPersistence()->getApiSecret();
}
public function setApiSecret($secret)
{
return $this->getSessionPersistence()->setApiSecret($secret);
}
public function setFileUploadSupport($supported)
{
return $this->getSessionPersistence()->setFileUploadSupport($supported);
}
public function getFileUploadSupport()
{
return $this->getSessionPersistence()->getFileUploadSupport();
}
public function useFileUploadSupport()
{
return $this->getSessionPersistence()->useFileUploadSupport();
}
public function getAccessToken()
{
return $this->getSessionPersistence()->getAccessToken();
}
public function setAccessToken($token)
{
return $this->getSessionPersistence()->setAccessToken($token);
}
public function getSignedRequest()
{
return $this->getSessionPersistence()->getSignedRequest();
}
public function getLoginUrl($params = array())
{
return $this->getSessionPersistence()->getLoginUrl($params);
}
public function getLogoutUrl($params = array())
{
return $this->getSessionPersistence()->getLogoutUrl($params);
}
public function getLoginStatusUrl($params = array())
{
return $this->getSessionPersistence()->getLoginStatusUrl($params);
}
public function api()
{
$args = func_get_args();
return call_user_func_array(array($this->getSessionPersistence(), 'api'), $args);
}
public function destroySession()
{
return $this->getSessionPersistence()->destroySession();
}
public function setSessionPersistence(FacebookInterface $sessionPersistence)
{
$this->sessionPersistence = $sessionPersistence;
}
/**
* @return FOS\FacebookBundle\Facebook\FacebookSessionPersistence
*/
protected function getSessionPersistence()
{
if (!$this->sessionPersistence) {
$this->sessionPersistence = $this->createSessionPersistence();
}
return $this->sessionPersistence;
}
/**
* @return FOS\FacebookBundle\Facebook\FacebookSessionPersistence
*/
protected function createSessionPersistence()
{
return new FacebookSessionPersistence($this->config, $this->session, $this->prefix);
}
}