@@ -116,7 +116,7 @@ |
||
| 116 | 116 | */ |
| 117 | 117 | public function getFrom() |
| 118 | 118 | { |
| 119 | - return $this->getProperty('from', GraphUser::className()); |
|
| 119 | + return $this->getProperty('from', GraphUser::className()); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | /** |
@@ -32,74 +32,74 @@ |
||
| 32 | 32 | class GraphLocation extends GraphObject |
| 33 | 33 | { |
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * Returns the street component of the location |
|
| 37 | - * |
|
| 38 | - * @return string|null |
|
| 39 | - */ |
|
| 40 | - public function getStreet() |
|
| 41 | - { |
|
| 35 | + /** |
|
| 36 | + * Returns the street component of the location |
|
| 37 | + * |
|
| 38 | + * @return string|null |
|
| 39 | + */ |
|
| 40 | + public function getStreet() |
|
| 41 | + { |
|
| 42 | 42 | return $this->getProperty('street'); |
| 43 | - } |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * Returns the city component of the location |
|
| 47 | - * |
|
| 48 | - * @return string|null |
|
| 49 | - */ |
|
| 50 | - public function getCity() |
|
| 51 | - { |
|
| 45 | + /** |
|
| 46 | + * Returns the city component of the location |
|
| 47 | + * |
|
| 48 | + * @return string|null |
|
| 49 | + */ |
|
| 50 | + public function getCity() |
|
| 51 | + { |
|
| 52 | 52 | return $this->getProperty('city'); |
| 53 | - } |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * Returns the state component of the location |
|
| 57 | - * |
|
| 58 | - * @return string|null |
|
| 59 | - */ |
|
| 60 | - public function getState() |
|
| 61 | - { |
|
| 55 | + /** |
|
| 56 | + * Returns the state component of the location |
|
| 57 | + * |
|
| 58 | + * @return string|null |
|
| 59 | + */ |
|
| 60 | + public function getState() |
|
| 61 | + { |
|
| 62 | 62 | return $this->getProperty('state'); |
| 63 | - } |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | - /** |
|
| 66 | - * Returns the country component of the location |
|
| 67 | - * |
|
| 68 | - * @return string|null |
|
| 69 | - */ |
|
| 70 | - public function getCountry() |
|
| 71 | - { |
|
| 65 | + /** |
|
| 66 | + * Returns the country component of the location |
|
| 67 | + * |
|
| 68 | + * @return string|null |
|
| 69 | + */ |
|
| 70 | + public function getCountry() |
|
| 71 | + { |
|
| 72 | 72 | return $this->getProperty('country'); |
| 73 | - } |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - /** |
|
| 76 | - * Returns the zipcode component of the location |
|
| 77 | - * |
|
| 78 | - * @return string|null |
|
| 79 | - */ |
|
| 80 | - public function getZip() |
|
| 81 | - { |
|
| 75 | + /** |
|
| 76 | + * Returns the zipcode component of the location |
|
| 77 | + * |
|
| 78 | + * @return string|null |
|
| 79 | + */ |
|
| 80 | + public function getZip() |
|
| 81 | + { |
|
| 82 | 82 | return $this->getProperty('zip'); |
| 83 | - } |
|
| 83 | + } |
|
| 84 | 84 | |
| 85 | - /** |
|
| 86 | - * Returns the latitude component of the location |
|
| 87 | - * |
|
| 88 | - * @return float|null |
|
| 89 | - */ |
|
| 90 | - public function getLatitude() |
|
| 91 | - { |
|
| 85 | + /** |
|
| 86 | + * Returns the latitude component of the location |
|
| 87 | + * |
|
| 88 | + * @return float|null |
|
| 89 | + */ |
|
| 90 | + public function getLatitude() |
|
| 91 | + { |
|
| 92 | 92 | return $this->getProperty('latitude'); |
| 93 | - } |
|
| 93 | + } |
|
| 94 | 94 | |
| 95 | - /** |
|
| 96 | - * Returns the street component of the location |
|
| 97 | - * |
|
| 98 | - * @return float|null |
|
| 99 | - */ |
|
| 100 | - public function getLongitude() |
|
| 101 | - { |
|
| 95 | + /** |
|
| 96 | + * Returns the street component of the location |
|
| 97 | + * |
|
| 98 | + * @return float|null |
|
| 99 | + */ |
|
| 100 | + public function getLongitude() |
|
| 101 | + { |
|
| 102 | 102 | return $this->getProperty('longitude'); |
| 103 | - } |
|
| 103 | + } |
|
| 104 | 104 | |
| 105 | 105 | } |
| 106 | 106 | \ No newline at end of file |
@@ -36,202 +36,202 @@ discard block |
||
| 36 | 36 | class FacebookRequest |
| 37 | 37 | { |
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * @const string Version number of the Facebook PHP SDK. |
|
| 41 | - */ |
|
| 42 | - const VERSION = '4.0.15'; |
|
| 43 | - |
|
| 44 | - /** |
|
| 45 | - * @const string Default Graph API version for requests |
|
| 46 | - */ |
|
| 47 | - const GRAPH_API_VERSION = 'v2.2'; |
|
| 48 | - |
|
| 49 | - /** |
|
| 50 | - * @const string Graph API URL |
|
| 51 | - */ |
|
| 52 | - const BASE_GRAPH_URL = 'https://graph.facebook.com'; |
|
| 53 | - |
|
| 54 | - /** |
|
| 55 | - * @var FacebookSession The session used for this request |
|
| 56 | - */ |
|
| 57 | - private $session; |
|
| 58 | - |
|
| 59 | - /** |
|
| 60 | - * @var string The HTTP method for the request |
|
| 61 | - */ |
|
| 62 | - private $method; |
|
| 63 | - |
|
| 64 | - /** |
|
| 65 | - * @var string The path for the request |
|
| 66 | - */ |
|
| 67 | - private $path; |
|
| 68 | - |
|
| 69 | - /** |
|
| 70 | - * @var array The parameters for the request |
|
| 71 | - */ |
|
| 72 | - private $params; |
|
| 73 | - |
|
| 74 | - /** |
|
| 75 | - * @var string The Graph API version for the request |
|
| 76 | - */ |
|
| 77 | - private $version; |
|
| 78 | - |
|
| 79 | - /** |
|
| 80 | - * @var string ETag sent with the request |
|
| 81 | - */ |
|
| 82 | - private $etag; |
|
| 83 | - |
|
| 84 | - /** |
|
| 85 | - * @var FacebookHttpable HTTP client handler |
|
| 86 | - */ |
|
| 87 | - private static $httpClientHandler; |
|
| 88 | - |
|
| 89 | - /** |
|
| 90 | - * @var int The number of calls that have been made to Graph. |
|
| 91 | - */ |
|
| 92 | - public static $requestCount = 0; |
|
| 93 | - |
|
| 94 | - /** |
|
| 95 | - * getSession - Returns the associated FacebookSession. |
|
| 96 | - * |
|
| 97 | - * @return FacebookSession |
|
| 98 | - */ |
|
| 99 | - public function getSession() |
|
| 100 | - { |
|
| 39 | + /** |
|
| 40 | + * @const string Version number of the Facebook PHP SDK. |
|
| 41 | + */ |
|
| 42 | + const VERSION = '4.0.15'; |
|
| 43 | + |
|
| 44 | + /** |
|
| 45 | + * @const string Default Graph API version for requests |
|
| 46 | + */ |
|
| 47 | + const GRAPH_API_VERSION = 'v2.2'; |
|
| 48 | + |
|
| 49 | + /** |
|
| 50 | + * @const string Graph API URL |
|
| 51 | + */ |
|
| 52 | + const BASE_GRAPH_URL = 'https://graph.facebook.com'; |
|
| 53 | + |
|
| 54 | + /** |
|
| 55 | + * @var FacebookSession The session used for this request |
|
| 56 | + */ |
|
| 57 | + private $session; |
|
| 58 | + |
|
| 59 | + /** |
|
| 60 | + * @var string The HTTP method for the request |
|
| 61 | + */ |
|
| 62 | + private $method; |
|
| 63 | + |
|
| 64 | + /** |
|
| 65 | + * @var string The path for the request |
|
| 66 | + */ |
|
| 67 | + private $path; |
|
| 68 | + |
|
| 69 | + /** |
|
| 70 | + * @var array The parameters for the request |
|
| 71 | + */ |
|
| 72 | + private $params; |
|
| 73 | + |
|
| 74 | + /** |
|
| 75 | + * @var string The Graph API version for the request |
|
| 76 | + */ |
|
| 77 | + private $version; |
|
| 78 | + |
|
| 79 | + /** |
|
| 80 | + * @var string ETag sent with the request |
|
| 81 | + */ |
|
| 82 | + private $etag; |
|
| 83 | + |
|
| 84 | + /** |
|
| 85 | + * @var FacebookHttpable HTTP client handler |
|
| 86 | + */ |
|
| 87 | + private static $httpClientHandler; |
|
| 88 | + |
|
| 89 | + /** |
|
| 90 | + * @var int The number of calls that have been made to Graph. |
|
| 91 | + */ |
|
| 92 | + public static $requestCount = 0; |
|
| 93 | + |
|
| 94 | + /** |
|
| 95 | + * getSession - Returns the associated FacebookSession. |
|
| 96 | + * |
|
| 97 | + * @return FacebookSession |
|
| 98 | + */ |
|
| 99 | + public function getSession() |
|
| 100 | + { |
|
| 101 | 101 | return $this->session; |
| 102 | - } |
|
| 103 | - |
|
| 104 | - /** |
|
| 105 | - * getPath - Returns the associated path. |
|
| 106 | - * |
|
| 107 | - * @return string |
|
| 108 | - */ |
|
| 109 | - public function getPath() |
|
| 110 | - { |
|
| 102 | + } |
|
| 103 | + |
|
| 104 | + /** |
|
| 105 | + * getPath - Returns the associated path. |
|
| 106 | + * |
|
| 107 | + * @return string |
|
| 108 | + */ |
|
| 109 | + public function getPath() |
|
| 110 | + { |
|
| 111 | 111 | return $this->path; |
| 112 | - } |
|
| 113 | - |
|
| 114 | - /** |
|
| 115 | - * getParameters - Returns the associated parameters. |
|
| 116 | - * |
|
| 117 | - * @return array |
|
| 118 | - */ |
|
| 119 | - public function getParameters() |
|
| 120 | - { |
|
| 112 | + } |
|
| 113 | + |
|
| 114 | + /** |
|
| 115 | + * getParameters - Returns the associated parameters. |
|
| 116 | + * |
|
| 117 | + * @return array |
|
| 118 | + */ |
|
| 119 | + public function getParameters() |
|
| 120 | + { |
|
| 121 | 121 | return $this->params; |
| 122 | - } |
|
| 123 | - |
|
| 124 | - /** |
|
| 125 | - * getMethod - Returns the associated method. |
|
| 126 | - * |
|
| 127 | - * @return string |
|
| 128 | - */ |
|
| 129 | - public function getMethod() |
|
| 130 | - { |
|
| 122 | + } |
|
| 123 | + |
|
| 124 | + /** |
|
| 125 | + * getMethod - Returns the associated method. |
|
| 126 | + * |
|
| 127 | + * @return string |
|
| 128 | + */ |
|
| 129 | + public function getMethod() |
|
| 130 | + { |
|
| 131 | 131 | return $this->method; |
| 132 | - } |
|
| 133 | - |
|
| 134 | - /** |
|
| 135 | - * getETag - Returns the ETag sent with the request. |
|
| 136 | - * |
|
| 137 | - * @return string |
|
| 138 | - */ |
|
| 139 | - public function getETag() |
|
| 140 | - { |
|
| 132 | + } |
|
| 133 | + |
|
| 134 | + /** |
|
| 135 | + * getETag - Returns the ETag sent with the request. |
|
| 136 | + * |
|
| 137 | + * @return string |
|
| 138 | + */ |
|
| 139 | + public function getETag() |
|
| 140 | + { |
|
| 141 | 141 | return $this->etag; |
| 142 | - } |
|
| 143 | - |
|
| 144 | - /** |
|
| 145 | - * setHttpClientHandler - Returns an instance of the HTTP client |
|
| 146 | - * handler |
|
| 147 | - * |
|
| 148 | - * @param \Facebook\HttpClients\FacebookHttpable |
|
| 149 | - */ |
|
| 150 | - public static function setHttpClientHandler(FacebookHttpable $handler) |
|
| 151 | - { |
|
| 142 | + } |
|
| 143 | + |
|
| 144 | + /** |
|
| 145 | + * setHttpClientHandler - Returns an instance of the HTTP client |
|
| 146 | + * handler |
|
| 147 | + * |
|
| 148 | + * @param \Facebook\HttpClients\FacebookHttpable |
|
| 149 | + */ |
|
| 150 | + public static function setHttpClientHandler(FacebookHttpable $handler) |
|
| 151 | + { |
|
| 152 | 152 | static::$httpClientHandler = $handler; |
| 153 | - } |
|
| 154 | - |
|
| 155 | - /** |
|
| 156 | - * getHttpClientHandler - Returns an instance of the HTTP client |
|
| 157 | - * data handler |
|
| 158 | - * |
|
| 159 | - * @return FacebookHttpable |
|
| 160 | - */ |
|
| 161 | - public static function getHttpClientHandler() |
|
| 162 | - { |
|
| 153 | + } |
|
| 154 | + |
|
| 155 | + /** |
|
| 156 | + * getHttpClientHandler - Returns an instance of the HTTP client |
|
| 157 | + * data handler |
|
| 158 | + * |
|
| 159 | + * @return FacebookHttpable |
|
| 160 | + */ |
|
| 161 | + public static function getHttpClientHandler() |
|
| 162 | + { |
|
| 163 | 163 | if (static::$httpClientHandler) { |
| 164 | - return static::$httpClientHandler; |
|
| 164 | + return static::$httpClientHandler; |
|
| 165 | 165 | } |
| 166 | 166 | return function_exists('curl_init') ? new FacebookCurlHttpClient() : new FacebookStreamHttpClient(); |
| 167 | - } |
|
| 168 | - |
|
| 169 | - /** |
|
| 170 | - * FacebookRequest - Returns a new request using the given session. optional |
|
| 171 | - * parameters hash will be sent with the request. This object is |
|
| 172 | - * immutable. |
|
| 173 | - * |
|
| 174 | - * @param FacebookSession $session |
|
| 175 | - * @param string $method |
|
| 176 | - * @param string $path |
|
| 177 | - * @param array|null $parameters |
|
| 178 | - * @param string|null $version |
|
| 179 | - * @param string|null $etag |
|
| 180 | - */ |
|
| 181 | - public function __construct( |
|
| 167 | + } |
|
| 168 | + |
|
| 169 | + /** |
|
| 170 | + * FacebookRequest - Returns a new request using the given session. optional |
|
| 171 | + * parameters hash will be sent with the request. This object is |
|
| 172 | + * immutable. |
|
| 173 | + * |
|
| 174 | + * @param FacebookSession $session |
|
| 175 | + * @param string $method |
|
| 176 | + * @param string $path |
|
| 177 | + * @param array|null $parameters |
|
| 178 | + * @param string|null $version |
|
| 179 | + * @param string|null $etag |
|
| 180 | + */ |
|
| 181 | + public function __construct( |
|
| 182 | 182 | FacebookSession $session, $method, $path, $parameters = null, $version = null, $etag = null |
| 183 | - ) |
|
| 184 | - { |
|
| 183 | + ) |
|
| 184 | + { |
|
| 185 | 185 | $this->session = $session; |
| 186 | 186 | $this->method = $method; |
| 187 | 187 | $this->path = $path; |
| 188 | 188 | if ($version) { |
| 189 | - $this->version = $version; |
|
| 189 | + $this->version = $version; |
|
| 190 | 190 | } else { |
| 191 | - $this->version = static::GRAPH_API_VERSION; |
|
| 191 | + $this->version = static::GRAPH_API_VERSION; |
|
| 192 | 192 | } |
| 193 | 193 | $this->etag = $etag; |
| 194 | 194 | |
| 195 | 195 | $params = ($parameters ?: array()); |
| 196 | 196 | if ($session |
| 197 | 197 | && !isset($params["access_token"])) { |
| 198 | - $params["access_token"] = $session->getToken(); |
|
| 198 | + $params["access_token"] = $session->getToken(); |
|
| 199 | 199 | } |
| 200 | 200 | if (FacebookSession::useAppSecretProof() |
| 201 | 201 | && !isset($params["appsecret_proof"])) { |
| 202 | - $params["appsecret_proof"] = $this->getAppSecretProof( |
|
| 202 | + $params["appsecret_proof"] = $this->getAppSecretProof( |
|
| 203 | 203 | $params["access_token"] |
| 204 | - ); |
|
| 204 | + ); |
|
| 205 | 205 | } |
| 206 | 206 | $this->params = $params; |
| 207 | - } |
|
| 208 | - |
|
| 209 | - /** |
|
| 210 | - * Returns the base Graph URL. |
|
| 211 | - * |
|
| 212 | - * @return string |
|
| 213 | - */ |
|
| 214 | - protected function getRequestURL() |
|
| 215 | - { |
|
| 207 | + } |
|
| 208 | + |
|
| 209 | + /** |
|
| 210 | + * Returns the base Graph URL. |
|
| 211 | + * |
|
| 212 | + * @return string |
|
| 213 | + */ |
|
| 214 | + protected function getRequestURL() |
|
| 215 | + { |
|
| 216 | 216 | return static::BASE_GRAPH_URL . '/' . $this->version . $this->path; |
| 217 | - } |
|
| 218 | - |
|
| 219 | - /** |
|
| 220 | - * execute - Makes the request to Facebook and returns the result. |
|
| 221 | - * |
|
| 222 | - * @return FacebookResponse |
|
| 223 | - * |
|
| 224 | - * @throws FacebookSDKException |
|
| 225 | - * @throws FacebookRequestException |
|
| 226 | - */ |
|
| 227 | - public function execute() |
|
| 228 | - { |
|
| 217 | + } |
|
| 218 | + |
|
| 219 | + /** |
|
| 220 | + * execute - Makes the request to Facebook and returns the result. |
|
| 221 | + * |
|
| 222 | + * @return FacebookResponse |
|
| 223 | + * |
|
| 224 | + * @throws FacebookSDKException |
|
| 225 | + * @throws FacebookRequestException |
|
| 226 | + */ |
|
| 227 | + public function execute() |
|
| 228 | + { |
|
| 229 | 229 | $url = $this->getRequestURL(); |
| 230 | 230 | $params = $this->getParameters(); |
| 231 | 231 | |
| 232 | 232 | if ($this->method === "GET") { |
| 233 | - $url = self::appendParamsToUrl($url, $params); |
|
| 234 | - $params = array(); |
|
| 233 | + $url = self::appendParamsToUrl($url, $params); |
|
| 234 | + $params = array(); |
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | $connection = self::getHttpClientHandler(); |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | |
| 241 | 241 | // ETag |
| 242 | 242 | if (isset($this->etag)) { |
| 243 | - $connection->addRequestHeader('If-None-Match', $this->etag); |
|
| 243 | + $connection->addRequestHeader('If-None-Match', $this->etag); |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | // Should throw `FacebookSDKException` exception on HTTP client error. |
@@ -256,49 +256,49 @@ discard block |
||
| 256 | 256 | |
| 257 | 257 | $decodedResult = json_decode($result); |
| 258 | 258 | if ($decodedResult === null) { |
| 259 | - $out = array(); |
|
| 260 | - parse_str($result, $out); |
|
| 261 | - return new FacebookResponse($this, $out, $result, $etagHit, $etagReceived); |
|
| 259 | + $out = array(); |
|
| 260 | + parse_str($result, $out); |
|
| 261 | + return new FacebookResponse($this, $out, $result, $etagHit, $etagReceived); |
|
| 262 | 262 | } |
| 263 | 263 | if (isset($decodedResult->error)) { |
| 264 | - throw FacebookRequestException::create( |
|
| 264 | + throw FacebookRequestException::create( |
|
| 265 | 265 | $result, |
| 266 | 266 | $decodedResult->error, |
| 267 | 267 | $connection->getResponseHttpStatusCode() |
| 268 | - ); |
|
| 268 | + ); |
|
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | return new FacebookResponse($this, $decodedResult, $result, $etagHit, $etagReceived); |
| 272 | - } |
|
| 273 | - |
|
| 274 | - /** |
|
| 275 | - * Generate and return the appsecret_proof value for an access_token |
|
| 276 | - * |
|
| 277 | - * @param string $token |
|
| 278 | - * |
|
| 279 | - * @return string |
|
| 280 | - */ |
|
| 281 | - public function getAppSecretProof($token) |
|
| 282 | - { |
|
| 272 | + } |
|
| 273 | + |
|
| 274 | + /** |
|
| 275 | + * Generate and return the appsecret_proof value for an access_token |
|
| 276 | + * |
|
| 277 | + * @param string $token |
|
| 278 | + * |
|
| 279 | + * @return string |
|
| 280 | + */ |
|
| 281 | + public function getAppSecretProof($token) |
|
| 282 | + { |
|
| 283 | 283 | return hash_hmac('sha256', $token, FacebookSession::_getTargetAppSecret()); |
| 284 | - } |
|
| 285 | - |
|
| 286 | - /** |
|
| 287 | - * appendParamsToUrl - Gracefully appends params to the URL. |
|
| 288 | - * |
|
| 289 | - * @param string $url |
|
| 290 | - * @param array $params |
|
| 291 | - * |
|
| 292 | - * @return string |
|
| 293 | - */ |
|
| 294 | - public static function appendParamsToUrl($url, $params = array()) |
|
| 295 | - { |
|
| 284 | + } |
|
| 285 | + |
|
| 286 | + /** |
|
| 287 | + * appendParamsToUrl - Gracefully appends params to the URL. |
|
| 288 | + * |
|
| 289 | + * @param string $url |
|
| 290 | + * @param array $params |
|
| 291 | + * |
|
| 292 | + * @return string |
|
| 293 | + */ |
|
| 294 | + public static function appendParamsToUrl($url, $params = array()) |
|
| 295 | + { |
|
| 296 | 296 | if (!$params) { |
| 297 | - return $url; |
|
| 297 | + return $url; |
|
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | if (strpos($url, '?') === false) { |
| 301 | - return $url . '?' . http_build_query($params, null, '&'); |
|
| 301 | + return $url . '?' . http_build_query($params, null, '&'); |
|
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | list($path, $query_string) = explode('?', $url, 2); |
@@ -308,6 +308,6 @@ discard block |
||
| 308 | 308 | $params = array_merge($params, $query_array); |
| 309 | 309 | |
| 310 | 310 | return $path . '?' . http_build_query($params, null, '&'); |
| 311 | - } |
|
| 311 | + } |
|
| 312 | 312 | |
| 313 | 313 | } |
@@ -32,104 +32,104 @@ |
||
| 32 | 32 | class GraphUser extends GraphObject |
| 33 | 33 | { |
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * Returns the ID for the user as a string if present. |
|
| 37 | - * |
|
| 38 | - * @return string|null |
|
| 39 | - */ |
|
| 40 | - public function getId() |
|
| 41 | - { |
|
| 35 | + /** |
|
| 36 | + * Returns the ID for the user as a string if present. |
|
| 37 | + * |
|
| 38 | + * @return string|null |
|
| 39 | + */ |
|
| 40 | + public function getId() |
|
| 41 | + { |
|
| 42 | 42 | return $this->getProperty('id'); |
| 43 | - } |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * Returns the name for the user as a string if present. |
|
| 47 | - * |
|
| 48 | - * @return string|null |
|
| 49 | - */ |
|
| 50 | - public function getName() |
|
| 51 | - { |
|
| 45 | + /** |
|
| 46 | + * Returns the name for the user as a string if present. |
|
| 47 | + * |
|
| 48 | + * @return string|null |
|
| 49 | + */ |
|
| 50 | + public function getName() |
|
| 51 | + { |
|
| 52 | 52 | return $this->getProperty('name'); |
| 53 | - } |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - public function getEmail() |
|
| 56 | - { |
|
| 55 | + public function getEmail() |
|
| 56 | + { |
|
| 57 | 57 | return $this->getProperty('email'); |
| 58 | - } |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - * Returns the first name for the user as a string if present. |
|
| 62 | - * |
|
| 63 | - * @return string|null |
|
| 64 | - */ |
|
| 65 | - public function getFirstName() |
|
| 66 | - { |
|
| 60 | + /** |
|
| 61 | + * Returns the first name for the user as a string if present. |
|
| 62 | + * |
|
| 63 | + * @return string|null |
|
| 64 | + */ |
|
| 65 | + public function getFirstName() |
|
| 66 | + { |
|
| 67 | 67 | return $this->getProperty('first_name'); |
| 68 | - } |
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | - /** |
|
| 71 | - * Returns the middle name for the user as a string if present. |
|
| 72 | - * |
|
| 73 | - * @return string|null |
|
| 74 | - */ |
|
| 75 | - public function getMiddleName() |
|
| 76 | - { |
|
| 70 | + /** |
|
| 71 | + * Returns the middle name for the user as a string if present. |
|
| 72 | + * |
|
| 73 | + * @return string|null |
|
| 74 | + */ |
|
| 75 | + public function getMiddleName() |
|
| 76 | + { |
|
| 77 | 77 | return $this->getProperty('middle_name'); |
| 78 | - } |
|
| 78 | + } |
|
| 79 | 79 | |
| 80 | - /** |
|
| 81 | - * Returns the last name for the user as a string if present. |
|
| 82 | - * |
|
| 83 | - * @return string|null |
|
| 84 | - */ |
|
| 85 | - public function getLastName() |
|
| 86 | - { |
|
| 80 | + /** |
|
| 81 | + * Returns the last name for the user as a string if present. |
|
| 82 | + * |
|
| 83 | + * @return string|null |
|
| 84 | + */ |
|
| 85 | + public function getLastName() |
|
| 86 | + { |
|
| 87 | 87 | return $this->getProperty('last_name'); |
| 88 | - } |
|
| 88 | + } |
|
| 89 | 89 | |
| 90 | - /** |
|
| 91 | - * Returns the gender for the user as a string if present. |
|
| 92 | - * |
|
| 93 | - * @return string|null |
|
| 94 | - */ |
|
| 95 | - public function getGender() |
|
| 96 | - { |
|
| 90 | + /** |
|
| 91 | + * Returns the gender for the user as a string if present. |
|
| 92 | + * |
|
| 93 | + * @return string|null |
|
| 94 | + */ |
|
| 95 | + public function getGender() |
|
| 96 | + { |
|
| 97 | 97 | return $this->getProperty('gender'); |
| 98 | - } |
|
| 98 | + } |
|
| 99 | 99 | |
| 100 | - /** |
|
| 101 | - * Returns the Facebook URL for the user as a string if available. |
|
| 102 | - * |
|
| 103 | - * @return string|null |
|
| 104 | - */ |
|
| 105 | - public function getLink() |
|
| 106 | - { |
|
| 100 | + /** |
|
| 101 | + * Returns the Facebook URL for the user as a string if available. |
|
| 102 | + * |
|
| 103 | + * @return string|null |
|
| 104 | + */ |
|
| 105 | + public function getLink() |
|
| 106 | + { |
|
| 107 | 107 | return $this->getProperty('link'); |
| 108 | - } |
|
| 108 | + } |
|
| 109 | 109 | |
| 110 | - /** |
|
| 111 | - * Returns the users birthday, if available. |
|
| 112 | - * |
|
| 113 | - * @return \DateTime|null |
|
| 114 | - */ |
|
| 115 | - public function getBirthday() |
|
| 116 | - { |
|
| 110 | + /** |
|
| 111 | + * Returns the users birthday, if available. |
|
| 112 | + * |
|
| 113 | + * @return \DateTime|null |
|
| 114 | + */ |
|
| 115 | + public function getBirthday() |
|
| 116 | + { |
|
| 117 | 117 | $value = $this->getProperty('birthday'); |
| 118 | 118 | if ($value) { |
| 119 | - return new \DateTime($value); |
|
| 119 | + return new \DateTime($value); |
|
| 120 | 120 | } |
| 121 | 121 | return null; |
| 122 | - } |
|
| 122 | + } |
|
| 123 | 123 | |
| 124 | - /** |
|
| 125 | - * Returns the current location of the user as a FacebookGraphLocation |
|
| 126 | - * if available. |
|
| 127 | - * |
|
| 128 | - * @return GraphLocation|null |
|
| 129 | - */ |
|
| 130 | - public function getLocation() |
|
| 131 | - { |
|
| 124 | + /** |
|
| 125 | + * Returns the current location of the user as a FacebookGraphLocation |
|
| 126 | + * if available. |
|
| 127 | + * |
|
| 128 | + * @return GraphLocation|null |
|
| 129 | + */ |
|
| 130 | + public function getLocation() |
|
| 131 | + { |
|
| 132 | 132 | return $this->getProperty('location', GraphLocation::className()); |
| 133 | - } |
|
| 133 | + } |
|
| 134 | 134 | |
| 135 | 135 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | |
| 31 | 31 | if (version_compare(PHP_VERSION, '5.4.0', '<')) { |
| 32 | - throw new Exception('The Facebook SDK v4 requires PHP version 5.4 or higher.'); |
|
| 32 | + throw new Exception('The Facebook SDK v4 requires PHP version 5.4 or higher.'); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | /** |
@@ -42,29 +42,29 @@ discard block |
||
| 42 | 42 | */ |
| 43 | 43 | spl_autoload_register(function ($class) |
| 44 | 44 | { |
| 45 | - // project-specific namespace prefix |
|
| 46 | - $prefix = 'Facebook\\'; |
|
| 45 | + // project-specific namespace prefix |
|
| 46 | + $prefix = 'Facebook\\'; |
|
| 47 | 47 | |
| 48 | - // base directory for the namespace prefix |
|
| 49 | - $base_dir = defined('FACEBOOK_SDK_V4_SRC_DIR') ? FACEBOOK_SDK_V4_SRC_DIR : __DIR__ . '/src/Facebook/'; |
|
| 48 | + // base directory for the namespace prefix |
|
| 49 | + $base_dir = defined('FACEBOOK_SDK_V4_SRC_DIR') ? FACEBOOK_SDK_V4_SRC_DIR : __DIR__ . '/src/Facebook/'; |
|
| 50 | 50 | |
| 51 | - // does the class use the namespace prefix? |
|
| 52 | - $len = strlen($prefix); |
|
| 53 | - if (strncmp($prefix, $class, $len) !== 0) { |
|
| 51 | + // does the class use the namespace prefix? |
|
| 52 | + $len = strlen($prefix); |
|
| 53 | + if (strncmp($prefix, $class, $len) !== 0) { |
|
| 54 | 54 | // no, move to the next registered autoloader |
| 55 | 55 | return; |
| 56 | - } |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - // get the relative class name |
|
| 59 | - $relative_class = substr($class, $len); |
|
| 58 | + // get the relative class name |
|
| 59 | + $relative_class = substr($class, $len); |
|
| 60 | 60 | |
| 61 | - // replace the namespace prefix with the base directory, replace namespace |
|
| 62 | - // separators with directory separators in the relative class name, append |
|
| 63 | - // with .php |
|
| 64 | - $file = $base_dir . str_replace('\\', '/', $relative_class) . '.php'; |
|
| 61 | + // replace the namespace prefix with the base directory, replace namespace |
|
| 62 | + // separators with directory separators in the relative class name, append |
|
| 63 | + // with .php |
|
| 64 | + $file = $base_dir . str_replace('\\', '/', $relative_class) . '.php'; |
|
| 65 | 65 | |
| 66 | - // if the file exists, require it |
|
| 67 | - if (file_exists($file)) { |
|
| 66 | + // if the file exists, require it |
|
| 67 | + if (file_exists($file)) { |
|
| 68 | 68 | require $file; |
| 69 | - } |
|
| 69 | + } |
|
| 70 | 70 | }); |
| 71 | 71 | \ No newline at end of file |
@@ -28,14 +28,14 @@ |
||
| 28 | 28 | $loginLdapSucces = ldap_login($login, $password); |
| 29 | 29 | |
| 30 | 30 | if ($loginLdapSucces) { |
| 31 | - $loginFailed = false; |
|
| 32 | - $uidReset = true; |
|
| 33 | - $_user['user_id'] = $uData['user_id']; |
|
| 34 | - Session::write('_uid',$_uid); |
|
| 31 | + $loginFailed = false; |
|
| 32 | + $uidReset = true; |
|
| 33 | + $_user['user_id'] = $uData['user_id']; |
|
| 34 | + Session::write('_uid',$_uid); |
|
| 35 | 35 | // Jand: copied from event_login in events.lib.php to enable login statistics: |
| 36 | - Event::event_login($uData['user_id']); |
|
| 36 | + Event::event_login($uData['user_id']); |
|
| 37 | 37 | } else { |
| 38 | - $loginFailed = true; |
|
| 39 | - unset($_user['user_id']); |
|
| 40 | - $uidReset = false; |
|
| 38 | + $loginFailed = true; |
|
| 39 | + unset($_user['user_id']); |
|
| 40 | + $uidReset = false; |
|
| 41 | 41 | } |
@@ -17,10 +17,10 @@ |
||
| 17 | 17 | { |
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | - * Store for User objects. Interact with the database. |
|
| 21 | - * |
|
| 22 | - * @return UserStore |
|
| 23 | - */ |
|
| 20 | + * Store for User objects. Interact with the database. |
|
| 21 | + * |
|
| 22 | + * @return UserStore |
|
| 23 | + */ |
|
| 24 | 24 | public static function store() |
| 25 | 25 | { |
| 26 | 26 | static $result = false; |
@@ -17,10 +17,10 @@ |
||
| 17 | 17 | { |
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | - * Store for Admin objects. Interact with the database. |
|
| 21 | - * |
|
| 22 | - * @return AdminStore |
|
| 23 | - */ |
|
| 20 | + * Store for Admin objects. Interact with the database. |
|
| 21 | + * |
|
| 22 | + * @return AdminStore |
|
| 23 | + */ |
|
| 24 | 24 | public static function store() |
| 25 | 25 | { |
| 26 | 26 | static $result = false; |
@@ -53,10 +53,10 @@ |
||
| 53 | 53 | $table_header[] = array('tag', true); |
| 54 | 54 | $table_header[] = array('attributes', false); |
| 55 | 55 | foreach ($tags as $tag => & $attributes) { |
| 56 | - $row = array(); |
|
| 57 | - $row[] = '<kbd>'.$tag.'</kbd>'; |
|
| 58 | - $row[] = '<kbd> '.implode(', ', array_keys($attributes)).'</kbd>'; |
|
| 59 | - $table_data[] = $row; |
|
| 56 | + $row = array(); |
|
| 57 | + $row[] = '<kbd>'.$tag.'</kbd>'; |
|
| 58 | + $row[] = '<kbd> '.implode(', ', array_keys($attributes)).'</kbd>'; |
|
| 59 | + $table_data[] = $row; |
|
| 60 | 60 | } |
| 61 | 61 | Display::display_sortable_table($table_header, $table_data, array(), array(), array('fullpage' => intval($_GET['fullpage']))); |
| 62 | 62 | ?> |