Version Description
Download this release
Release Info
Developer | diegoquinteiro |
Plugin | Instant Articles for WP |
Version | 3.2.2 |
Comparing to | |
See all releases |
Code changes from version 3.2.1 to 3.2.2
- css/instant-articles-settings-wizard.css +0 -3
- facebook-instant-articles.php +2 -2
- meta-box/meta-box-template.php +1 -1
- readme.txt +1 -1
- vendor/autoload.php +1 -1
- vendor/composer/autoload_real.php +7 -7
- vendor/composer/autoload_static.php +4 -4
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/SocialEmbedTest.php +0 -96
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/CMS/WPTransformerTest.php +0 -98
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/CMS/wp-ia.xml +0 -202
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/CMS/wp-rules.json +0 -606
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/CMS/wp.html +0 -221
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/wp-rules.json +0 -270
- vendor/facebook/php-sdk-v4/LICENSE +0 -19
- vendor/facebook/php-sdk-v4/composer.json +0 -41
- vendor/facebook/php-sdk-v4/src/Facebook/Authentication/AccessToken.php +0 -160
- vendor/facebook/php-sdk-v4/src/Facebook/Authentication/AccessTokenMetadata.php +0 -390
- vendor/facebook/php-sdk-v4/src/Facebook/Authentication/OAuth2Client.php +0 -292
- vendor/facebook/php-sdk-v4/src/Facebook/Exceptions/FacebookAuthenticationException.php +0 -33
- vendor/facebook/php-sdk-v4/src/Facebook/Exceptions/FacebookAuthorizationException.php +0 -33
- vendor/facebook/php-sdk-v4/src/Facebook/Exceptions/FacebookClientException.php +0 -33
- vendor/facebook/php-sdk-v4/src/Facebook/Exceptions/FacebookOtherException.php +0 -33
- vendor/facebook/php-sdk-v4/src/Facebook/Exceptions/FacebookResponseException.php +0 -214
- vendor/facebook/php-sdk-v4/src/Facebook/Exceptions/FacebookResumableUploadException.php +0 -33
- vendor/facebook/php-sdk-v4/src/Facebook/Exceptions/FacebookSDKException.php +0 -33
- vendor/facebook/php-sdk-v4/src/Facebook/Exceptions/FacebookServerException.php +0 -33
- vendor/facebook/php-sdk-v4/src/Facebook/Exceptions/FacebookThrottleException.php +0 -33
- vendor/facebook/php-sdk-v4/src/Facebook/Facebook.php +0 -614
- vendor/facebook/php-sdk-v4/src/Facebook/FacebookApp.php +0 -110
- vendor/facebook/php-sdk-v4/src/Facebook/FacebookBatchRequest.php +0 -303
- vendor/facebook/php-sdk-v4/src/Facebook/FacebookBatchResponse.php +0 -174
- vendor/facebook/php-sdk-v4/src/Facebook/FacebookClient.php +0 -250
- vendor/facebook/php-sdk-v4/src/Facebook/FacebookRequest.php +0 -534
- vendor/facebook/php-sdk-v4/src/Facebook/FacebookResponse.php +0 -410
- vendor/facebook/php-sdk-v4/src/Facebook/FileUpload/FacebookFile.php +0 -169
- vendor/facebook/php-sdk-v4/src/Facebook/FileUpload/FacebookResumableUploader.php +0 -167
- vendor/facebook/php-sdk-v4/src/Facebook/FileUpload/FacebookTransferChunk.php +0 -133
- vendor/facebook/php-sdk-v4/src/Facebook/FileUpload/FacebookVideo.php +0 -33
- vendor/facebook/php-sdk-v4/src/Facebook/FileUpload/Mimetypes.php +0 -987
- vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/Birthday.php +0 -85
- vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/Collection.php +0 -242
- vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphAchievement.php +0 -113
- vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphAlbum.php +0 -183
- vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphApplication.php +0 -43
- vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphCoverPhoto.php +0 -72
- vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphEdge.php +0 -238
- vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphEvent.php +0 -242
- vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphGroup.php +0 -170
- vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphList.php +0 -36
- vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphLocation.php +0 -102
- vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphNode.php +0 -197
- vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphNodeFactory.php +0 -392
- vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphObject.php +0 -36
- vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphObjectFactory.php +0 -88
- vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphPage.php +0 -125
- vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphPicture.php +0 -72
- vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphSessionInfo.php +0 -102
- vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphUser.php +0 -172
- vendor/facebook/php-sdk-v4/src/Facebook/Helpers/FacebookCanvasHelper.php +0 -52
- vendor/facebook/php-sdk-v4/src/Facebook/Helpers/FacebookJavaScriptHelper.php +0 -42
- vendor/facebook/php-sdk-v4/src/Facebook/Helpers/FacebookPageTabHelper.php +0 -95
- vendor/facebook/php-sdk-v4/src/Facebook/Helpers/FacebookRedirectLoginHelper.php +0 -333
- vendor/facebook/php-sdk-v4/src/Facebook/Helpers/FacebookSignedRequestFromInputHelper.php +0 -166
- vendor/facebook/php-sdk-v4/src/Facebook/Http/GraphRawResponse.php +0 -137
- vendor/facebook/php-sdk-v4/src/Facebook/Http/RequestBodyInterface.php +0 -39
- vendor/facebook/php-sdk-v4/src/Facebook/Http/RequestBodyMultipart.php +0 -170
- vendor/facebook/php-sdk-v4/src/Facebook/Http/RequestBodyUrlEncoded.php +0 -55
- vendor/facebook/php-sdk-v4/src/Facebook/HttpClients/FacebookCurl.php +0 -129
- vendor/facebook/php-sdk-v4/src/Facebook/HttpClients/FacebookCurlHttpClient.php +0 -163
- vendor/facebook/php-sdk-v4/src/Facebook/HttpClients/FacebookGuzzleHttpClient.php +0 -97
- vendor/facebook/php-sdk-v4/src/Facebook/HttpClients/FacebookHttpClientInterface.php +0 -47
- vendor/facebook/php-sdk-v4/src/Facebook/HttpClients/FacebookStream.php +0 -80
- vendor/facebook/php-sdk-v4/src/Facebook/HttpClients/FacebookStreamHttpClient.php +0 -94
- vendor/facebook/php-sdk-v4/src/Facebook/HttpClients/HttpClientsFactory.php +0 -99
- vendor/facebook/php-sdk-v4/src/Facebook/HttpClients/certs/DigiCertHighAssuranceEVRootCA.pem +0 -23
- vendor/facebook/php-sdk-v4/src/Facebook/PersistentData/FacebookMemoryPersistentDataHandler.php +0 -53
- vendor/facebook/php-sdk-v4/src/Facebook/PersistentData/FacebookSessionPersistentDataHandler.php +0 -76
- vendor/facebook/php-sdk-v4/src/Facebook/PersistentData/PersistentDataFactory.php +0 -65
- vendor/facebook/php-sdk-v4/src/Facebook/PersistentData/PersistentDataInterface.php +0 -49
- vendor/facebook/php-sdk-v4/src/Facebook/PseudoRandomString/McryptPseudoRandomStringGenerator.php +0 -68
- vendor/facebook/php-sdk-v4/src/Facebook/PseudoRandomString/OpenSslPseudoRandomStringGenerator.php +0 -67
- vendor/facebook/php-sdk-v4/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorFactory.php +0 -93
- vendor/facebook/php-sdk-v4/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorInterface.php +0 -45
- vendor/facebook/php-sdk-v4/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorTrait.php +0 -58
- vendor/facebook/php-sdk-v4/src/Facebook/PseudoRandomString/UrandomPseudoRandomStringGenerator.php +0 -89
- vendor/facebook/php-sdk-v4/src/Facebook/SignedRequest.php +0 -326
- vendor/facebook/php-sdk-v4/src/Facebook/Url/FacebookUrlDetectionHandler.php +0 -182
- vendor/facebook/php-sdk-v4/src/Facebook/Url/FacebookUrlManipulator.php +0 -167
- vendor/facebook/php-sdk-v4/src/Facebook/Url/UrlDetectionInterface.php +0 -39
- vendor/facebook/php-sdk-v4/src/Facebook/autoload.php +0 -81
- vendor/facebook/php-sdk-v4/src/Facebook/polyfills.php +0 -49
css/instant-articles-settings-wizard.css
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
.instant-articles-inline-form input[name='submit'] {
|
2 |
-
display: inline;
|
3 |
-
}
|
|
|
|
|
|
facebook-instant-articles.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Description: Add support for Instant Articles for Facebook to your WordPress site.
|
5 |
* Author: Automattic, Dekode, Facebook
|
6 |
* Author URI: https://vip.wordpress.com/plugins/instant-articles/
|
7 |
-
* Version: 3.2.
|
8 |
* Text Domain: instant-articles
|
9 |
* License: GPLv2
|
10 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -61,7 +61,7 @@ if ( version_compare( PHP_VERSION, '5.4', '<' ) ) {
|
|
61 |
|
62 |
defined( 'ABSPATH' ) || die( 'Shame on you' );
|
63 |
|
64 |
-
define( 'IA_PLUGIN_VERSION', '3.2.
|
65 |
define( 'IA_PLUGIN_PATH_FULL', __FILE__ );
|
66 |
define( 'IA_PLUGIN_PATH', plugin_basename( __FILE__ ) );
|
67 |
define( 'IA_PLUGIN_FILE_BASENAME', pathinfo( __FILE__, PATHINFO_FILENAME ) );
|
4 |
* Description: Add support for Instant Articles for Facebook to your WordPress site.
|
5 |
* Author: Automattic, Dekode, Facebook
|
6 |
* Author URI: https://vip.wordpress.com/plugins/instant-articles/
|
7 |
+
* Version: 3.2.2
|
8 |
* Text Domain: instant-articles
|
9 |
* License: GPLv2
|
10 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
61 |
|
62 |
defined( 'ABSPATH' ) || die( 'Shame on you' );
|
63 |
|
64 |
+
define( 'IA_PLUGIN_VERSION', '3.2.2' );
|
65 |
define( 'IA_PLUGIN_PATH_FULL', __FILE__ );
|
66 |
define( 'IA_PLUGIN_PATH', plugin_basename( __FILE__ ) );
|
67 |
define( 'IA_PLUGIN_FILE_BASENAME', pathinfo( __FILE__, PATHINFO_FILENAME ) );
|
meta-box/meta-box-template.php
CHANGED
@@ -18,7 +18,7 @@ use Facebook\InstantArticles\Client\ServerMessage;
|
|
18 |
</a>
|
19 |
<?php endif; ?>
|
20 |
|
21 |
-
<?php if ( ! $
|
22 |
<p>
|
23 |
<b>
|
24 |
<span class="dashicons dashicons-no-alt"></span>
|
18 |
</a>
|
19 |
<?php endif; ?>
|
20 |
|
21 |
+
<?php if ( ! $should_submit_post ) : ?>
|
22 |
<p>
|
23 |
<b>
|
24 |
<span class="dashicons dashicons-no-alt"></span>
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: trrine, olethomas, bjornjohansen, dekode, automattic, facebook
|
|
3 |
Tags: instant articles, facebook, mobile
|
4 |
Requires at least: 4.3
|
5 |
Tested up to: 4.6
|
6 |
-
Stable tag: 3.2.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
3 |
Tags: instant articles, facebook, mobile
|
4 |
Requires at least: 4.3
|
5 |
Tested up to: 4.6
|
6 |
+
Stable tag: 3.2.2
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
vendor/autoload.php
CHANGED
@@ -4,4 +4,4 @@
|
|
4 |
|
5 |
require_once __DIR__ . '/composer' . '/autoload_real.php';
|
6 |
|
7 |
-
return
|
4 |
|
5 |
require_once __DIR__ . '/composer' . '/autoload_real.php';
|
6 |
|
7 |
+
return ComposerAutoloaderInitfa8bfc5d2717dd9298c7d3347cfeea3b::getLoader();
|
vendor/composer/autoload_real.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
-
class
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
@@ -19,15 +19,15 @@ class ComposerAutoloaderInitaeb01722e65852ffc8e599ee34208923
|
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
-
spl_autoload_register(array('
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
-
spl_autoload_unregister(array('
|
25 |
|
26 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION');
|
27 |
if ($useStaticLoader) {
|
28 |
require_once __DIR__ . '/autoload_static.php';
|
29 |
|
30 |
-
call_user_func(\Composer\Autoload\
|
31 |
} else {
|
32 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
foreach ($map as $namespace => $path) {
|
@@ -48,19 +48,19 @@ class ComposerAutoloaderInitaeb01722e65852ffc8e599ee34208923
|
|
48 |
$loader->register(true);
|
49 |
|
50 |
if ($useStaticLoader) {
|
51 |
-
$includeFiles = Composer\Autoload\
|
52 |
} else {
|
53 |
$includeFiles = require __DIR__ . '/autoload_files.php';
|
54 |
}
|
55 |
foreach ($includeFiles as $fileIdentifier => $file) {
|
56 |
-
|
57 |
}
|
58 |
|
59 |
return $loader;
|
60 |
}
|
61 |
}
|
62 |
|
63 |
-
function
|
64 |
{
|
65 |
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
66 |
require $file;
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
+
class ComposerAutoloaderInitfa8bfc5d2717dd9298c7d3347cfeea3b
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInitfa8bfc5d2717dd9298c7d3347cfeea3b', 'loadClassLoader'), true, true);
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInitfa8bfc5d2717dd9298c7d3347cfeea3b', 'loadClassLoader'));
|
25 |
|
26 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION');
|
27 |
if ($useStaticLoader) {
|
28 |
require_once __DIR__ . '/autoload_static.php';
|
29 |
|
30 |
+
call_user_func(\Composer\Autoload\ComposerStaticInitfa8bfc5d2717dd9298c7d3347cfeea3b::getInitializer($loader));
|
31 |
} else {
|
32 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
foreach ($map as $namespace => $path) {
|
48 |
$loader->register(true);
|
49 |
|
50 |
if ($useStaticLoader) {
|
51 |
+
$includeFiles = Composer\Autoload\ComposerStaticInitfa8bfc5d2717dd9298c7d3347cfeea3b::$files;
|
52 |
} else {
|
53 |
$includeFiles = require __DIR__ . '/autoload_files.php';
|
54 |
}
|
55 |
foreach ($includeFiles as $fileIdentifier => $file) {
|
56 |
+
composerRequirefa8bfc5d2717dd9298c7d3347cfeea3b($fileIdentifier, $file);
|
57 |
}
|
58 |
|
59 |
return $loader;
|
60 |
}
|
61 |
}
|
62 |
|
63 |
+
function composerRequirefa8bfc5d2717dd9298c7d3347cfeea3b($fileIdentifier, $file)
|
64 |
{
|
65 |
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
66 |
require $file;
|
vendor/composer/autoload_static.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
-
class
|
8 |
{
|
9 |
public static $files = array (
|
10 |
'c65d09b6820da036953a371c8c73a9b1' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/polyfills.php',
|
@@ -122,9 +122,9 @@ class ComposerStaticInitaeb01722e65852ffc8e599ee34208923
|
|
122 |
public static function getInitializer(ClassLoader $loader)
|
123 |
{
|
124 |
return \Closure::bind(function () use ($loader) {
|
125 |
-
$loader->prefixLengthsPsr4 =
|
126 |
-
$loader->prefixDirsPsr4 =
|
127 |
-
$loader->classMap =
|
128 |
|
129 |
}, null, ClassLoader::class);
|
130 |
}
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
+
class ComposerStaticInitfa8bfc5d2717dd9298c7d3347cfeea3b
|
8 |
{
|
9 |
public static $files = array (
|
10 |
'c65d09b6820da036953a371c8c73a9b1' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/polyfills.php',
|
122 |
public static function getInitializer(ClassLoader $loader)
|
123 |
{
|
124 |
return \Closure::bind(function () use ($loader) {
|
125 |
+
$loader->prefixLengthsPsr4 = ComposerStaticInitfa8bfc5d2717dd9298c7d3347cfeea3b::$prefixLengthsPsr4;
|
126 |
+
$loader->prefixDirsPsr4 = ComposerStaticInitfa8bfc5d2717dd9298c7d3347cfeea3b::$prefixDirsPsr4;
|
127 |
+
$loader->classMap = ComposerStaticInitfa8bfc5d2717dd9298c7d3347cfeea3b::$classMap;
|
128 |
|
129 |
}, null, ClassLoader::class);
|
130 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/SocialEmbedTest.php
DELETED
@@ -1,96 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright (c) 2016-present, Facebook, Inc.
|
4 |
-
* All rights reserved.
|
5 |
-
*
|
6 |
-
* This source code is licensed under the license found in the
|
7 |
-
* LICENSE file in the root directory of this source tree.
|
8 |
-
*/
|
9 |
-
namespace Facebook\InstantArticles\Elements;
|
10 |
-
|
11 |
-
class SocialEmbedTest extends \PHPUnit_Framework_TestCase
|
12 |
-
{
|
13 |
-
public function testRenderEmpty()
|
14 |
-
{
|
15 |
-
$social_embed = SocialEmbed::create();
|
16 |
-
|
17 |
-
$expected = '';
|
18 |
-
|
19 |
-
$rendered = $social_embed->render();
|
20 |
-
$this->assertEquals($expected, $rendered);
|
21 |
-
}
|
22 |
-
|
23 |
-
public function testRenderBasic()
|
24 |
-
{
|
25 |
-
$social_embed =
|
26 |
-
SocialEmbed::create()
|
27 |
-
->withSource('http://foo.com');
|
28 |
-
|
29 |
-
$expected =
|
30 |
-
'<figure class="op-interactive">'.
|
31 |
-
'<iframe src="http://foo.com"></iframe>'.
|
32 |
-
'</figure>';
|
33 |
-
|
34 |
-
$rendered = $social_embed->render();
|
35 |
-
$this->assertEquals($expected, $rendered);
|
36 |
-
}
|
37 |
-
|
38 |
-
public function testRenderBasicWithCaption()
|
39 |
-
{
|
40 |
-
$social_embed =
|
41 |
-
SocialEmbed::create()
|
42 |
-
->withSource('http://foo.com')
|
43 |
-
->withCaption(
|
44 |
-
Caption::create()
|
45 |
-
->appendText('Some caption to the embed')
|
46 |
-
);
|
47 |
-
|
48 |
-
$expected =
|
49 |
-
'<figure class="op-interactive">'.
|
50 |
-
'<iframe src="http://foo.com"></iframe>'.
|
51 |
-
'<figcaption>Some caption to the embed</figcaption>'.
|
52 |
-
'</figure>';
|
53 |
-
|
54 |
-
$rendered = $social_embed->render();
|
55 |
-
$this->assertEquals($expected, $rendered);
|
56 |
-
}
|
57 |
-
|
58 |
-
public function testRenderInline()
|
59 |
-
{
|
60 |
-
$inline =
|
61 |
-
'<h1>Some custom code</h1>'.
|
62 |
-
'<script>alert("test & more test");</script>';
|
63 |
-
|
64 |
-
$social_embed =
|
65 |
-
SocialEmbed::create()
|
66 |
-
->withHTML($inline);
|
67 |
-
|
68 |
-
$expected =
|
69 |
-
'<figure class="op-interactive">'.
|
70 |
-
'<iframe>'.
|
71 |
-
'<h1>Some custom code</h1>'.
|
72 |
-
'<script>alert("test & more test");</script>'.
|
73 |
-
'</iframe>'.
|
74 |
-
'</figure>';
|
75 |
-
|
76 |
-
$rendered = $social_embed->render();
|
77 |
-
$this->assertEquals($expected, $rendered);
|
78 |
-
}
|
79 |
-
|
80 |
-
public function testRenderWithWidthAndHeight()
|
81 |
-
{
|
82 |
-
$social_embed =
|
83 |
-
SocialEmbed::create()
|
84 |
-
->withSource('http://foo.com')
|
85 |
-
->withWidth(640)
|
86 |
-
->withHeight(480);
|
87 |
-
|
88 |
-
$expected =
|
89 |
-
'<figure class="op-interactive">'.
|
90 |
-
'<iframe src="http://foo.com" width="640" height="480"></iframe>'.
|
91 |
-
'</figure>';
|
92 |
-
|
93 |
-
$rendered = $social_embed->render();
|
94 |
-
$this->assertEquals($expected, $rendered);
|
95 |
-
}
|
96 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/CMS/WPTransformerTest.php
DELETED
@@ -1,98 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright (c) 2016-present, Facebook, Inc.
|
4 |
-
* All rights reserved.
|
5 |
-
*
|
6 |
-
* This source code is licensed under the license found in the
|
7 |
-
* LICENSE file in the root directory of this source tree.
|
8 |
-
*/
|
9 |
-
namespace Facebook\InstantArticles\Transformer\CMS;
|
10 |
-
|
11 |
-
use Facebook\InstantArticles\Transformer\Transformer;
|
12 |
-
use Facebook\InstantArticles\Elements\InstantArticle;
|
13 |
-
use Facebook\InstantArticles\Elements\Header;
|
14 |
-
use Facebook\InstantArticles\Elements\Time;
|
15 |
-
use Facebook\InstantArticles\Elements\Author;
|
16 |
-
|
17 |
-
class WPTransformerTest extends \PHPUnit_Framework_TestCase
|
18 |
-
{
|
19 |
-
protected function setUp()
|
20 |
-
{
|
21 |
-
\Logger::configure(
|
22 |
-
[
|
23 |
-
'rootLogger' => [
|
24 |
-
'appenders' => ['facebook-instantarticles-transformer']
|
25 |
-
],
|
26 |
-
'appenders' => [
|
27 |
-
'facebook-instantarticles-transformer' => [
|
28 |
-
'class' => 'LoggerAppenderConsole',
|
29 |
-
'threshold' => 'INFO',
|
30 |
-
'layout' => [
|
31 |
-
'class' => 'LoggerLayoutSimple'
|
32 |
-
]
|
33 |
-
]
|
34 |
-
]
|
35 |
-
]
|
36 |
-
);
|
37 |
-
}
|
38 |
-
|
39 |
-
public function testTransformerLikeWPContent()
|
40 |
-
{
|
41 |
-
$json_file = file_get_contents(__DIR__ . '/wp-rules.json');
|
42 |
-
|
43 |
-
$instant_article = InstantArticle::create();
|
44 |
-
$transformer = new Transformer();
|
45 |
-
$transformer->loadRules($json_file);
|
46 |
-
|
47 |
-
$html_file = file_get_contents(__DIR__ . '/wp.html');
|
48 |
-
|
49 |
-
libxml_use_internal_errors(true);
|
50 |
-
$document = new \DOMDocument();
|
51 |
-
$document->loadHTML($html_file);
|
52 |
-
libxml_use_internal_errors(false);
|
53 |
-
|
54 |
-
$instant_article
|
55 |
-
->withCanonicalURL('http://localhost/article')
|
56 |
-
->withHeader(
|
57 |
-
Header::create()
|
58 |
-
->withTitle('Peace on <b>earth</b>')
|
59 |
-
->addAuthor(Author::create()->withName('bill'))
|
60 |
-
->withPublishTime(Time::create(Time::PUBLISHED)->withDatetime(
|
61 |
-
\DateTime::createFromFormat(
|
62 |
-
'j-M-Y G:i:s',
|
63 |
-
'12-Apr-2016 19:46:51'
|
64 |
-
)
|
65 |
-
))
|
66 |
-
);
|
67 |
-
|
68 |
-
$transformer->transform($instant_article, $document);
|
69 |
-
$instant_article->addMetaProperty('op:generator:version', '1.0.0');
|
70 |
-
$instant_article->addMetaProperty('op:generator:transformer:version', '1.0.0');
|
71 |
-
$result = $instant_article->render('', true)."\n";
|
72 |
-
$expected = file_get_contents(__DIR__ . '/wp-ia.xml');
|
73 |
-
|
74 |
-
$this->assertEquals($expected, $result);
|
75 |
-
// there must be 3 warnings related to <img> inside <li> that is not supported by IA
|
76 |
-
// And 1 warning related to the getter
|
77 |
-
$this->assertEquals(4, count($transformer->getWarnings()));
|
78 |
-
}
|
79 |
-
|
80 |
-
public function testTitleTransformedWithBold()
|
81 |
-
{
|
82 |
-
$transformer = new Transformer();
|
83 |
-
$json_file = file_get_contents(__DIR__ . '/wp-rules.json');
|
84 |
-
$transformer->loadRules($json_file);
|
85 |
-
|
86 |
-
$title_html_string = '<?xml encoding="utf-8" ?><h1>Title <b>in bold</b></h1>';
|
87 |
-
|
88 |
-
libxml_use_internal_errors(true);
|
89 |
-
$document = new \DOMDocument();
|
90 |
-
$document->loadHtml($title_html_string);
|
91 |
-
libxml_use_internal_errors(false);
|
92 |
-
|
93 |
-
$header = Header::create();
|
94 |
-
$transformer->transform($header, $document);
|
95 |
-
|
96 |
-
$this->assertEquals('<h1>Title <b>in bold</b></h1>', $header->getTitle()->render());
|
97 |
-
}
|
98 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/CMS/wp-ia.xml
DELETED
@@ -1,202 +0,0 @@
|
|
1 |
-
<html>
|
2 |
-
<head>
|
3 |
-
<link rel="canonical" href="http://localhost/article"/>
|
4 |
-
<meta charset="utf-8"/>
|
5 |
-
<meta property="op:generator" content="facebook-instant-articles-sdk-php"/>
|
6 |
-
<meta property="op:generator:version" content="1.0.0"/>
|
7 |
-
<meta property="op:generator:transformer" content="facebook-instant-articles-sdk-php"/>
|
8 |
-
<meta property="op:generator:transformer:version" content="1.0.0"/>
|
9 |
-
<meta property="op:markup_version" content="v1.0"/>
|
10 |
-
</head>
|
11 |
-
<body>
|
12 |
-
<article>
|
13 |
-
<header>
|
14 |
-
<h1>Peace on <b>earth</b></h1>
|
15 |
-
<time class="op-published" datetime="2016-04-12T19:46:51+00:00">April 12th, 7:46pm</time>
|
16 |
-
<address><a>bill</a></address>
|
17 |
-
</header>
|
18 |
-
<p>Yes, peace is good for everybody!<br/>
|
19 |
-
Man kind.</p>
|
20 |
-
<figure>
|
21 |
-
<img src="http://example.com/image0.jpg"/>
|
22 |
-
</figure>
|
23 |
-
<p>Some text after img.</p>
|
24 |
-
<p>Some text before img</p>
|
25 |
-
<figure>
|
26 |
-
<img src="http://example.com/image1.jpg"/>
|
27 |
-
</figure>
|
28 |
-
<p>Some text before img</p>
|
29 |
-
<figure>
|
30 |
-
<img src="http://example.com/image2.jpg"/>
|
31 |
-
</figure>
|
32 |
-
<p> and some after img.</p>
|
33 |
-
<figure class="op-interactive">
|
34 |
-
<iframe src="http://example.com/0/" class="no-margin" width="300" height="200"></iframe>
|
35 |
-
</figure>
|
36 |
-
<p>Some text before iframe</p>
|
37 |
-
<figure class="op-interactive">
|
38 |
-
<iframe src="http://example.com/1/" class="no-margin" width="300" height="200"></iframe>
|
39 |
-
</figure>
|
40 |
-
<figure class="op-interactive">
|
41 |
-
<iframe src="http://example.com/2/" class="no-margin" width="300" height="200"></iframe>
|
42 |
-
</figure>
|
43 |
-
<p> some after iframe.</p>
|
44 |
-
<p>Some text before iframe</p>
|
45 |
-
<figure class="op-interactive">
|
46 |
-
<iframe src="http://example.com/3/" class="no-margin" width="300" height="200"></iframe>
|
47 |
-
</figure>
|
48 |
-
<p> and some after iframe.</p>
|
49 |
-
<figure class="op-interactive">
|
50 |
-
<iframe src="http://example.com/loose/with_url" class="no-margin" width="300" height="200"></iframe>
|
51 |
-
</figure>
|
52 |
-
<figure class="op-interactive">
|
53 |
-
<iframe class="no-margin">
|
54 |
-
<div>
|
55 |
-
<h1>Iframe loose without url</h1>
|
56 |
-
</div>
|
57 |
-
</iframe>
|
58 |
-
</figure>
|
59 |
-
<figure class="op-interactive">
|
60 |
-
<iframe class="no-margin">
|
61 |
-
<div>
|
62 |
-
<h1>some embed here</h1>
|
63 |
-
</div>
|
64 |
-
</iframe>
|
65 |
-
</figure>
|
66 |
-
<figure class="op-interactive">
|
67 |
-
<iframe class="no-margin">
|
68 |
-
<div>
|
69 |
-
<h1>some embed here</h1>
|
70 |
-
</div>
|
71 |
-
</iframe>
|
72 |
-
</figure>
|
73 |
-
<figure class="op-interactive">
|
74 |
-
<iframe class="no-margin">
|
75 |
-
<div>some content</div>
|
76 |
-
<script>alert('hi & hello to you @ testing!');</script></iframe>
|
77 |
-
</figure>
|
78 |
-
<figure class="op-interactive">
|
79 |
-
<iframe src="http://example.com/4/" class="no-margin" width="300" height="200"></iframe>
|
80 |
-
</figure>
|
81 |
-
<figure class="op-interactive">
|
82 |
-
<iframe class="no-margin">
|
83 |
-
<div>some content</div>
|
84 |
-
<script>alert('hi & hello to you @ testing!');</script></iframe>
|
85 |
-
</figure>
|
86 |
-
<figure class="op-interactive">
|
87 |
-
<iframe src="http://example.com/4/" class="no-margin" width="300" height="200"></iframe>
|
88 |
-
</figure>
|
89 |
-
<figure class="op-interactive">
|
90 |
-
<iframe class="no-margin">
|
91 |
-
<div>some content</div>
|
92 |
-
<script>alert('hi & hello to you @ testing!');</script></iframe>
|
93 |
-
</figure>
|
94 |
-
<figure class="op-interactive">
|
95 |
-
<iframe class="no-margin" height="200">
|
96 |
-
<table width="200" height="200">
|
97 |
-
<thead><td>header 1</td>
|
98 |
-
<td>header 2</td>
|
99 |
-
</thead>
|
100 |
-
<tbody>
|
101 |
-
<tr><td>Line 1 column 1</td>
|
102 |
-
<td>Line 1 column 2</td>
|
103 |
-
</tr>
|
104 |
-
<tr><td>Line 2 column 1</td>
|
105 |
-
<td>Line 2 column 2</td>
|
106 |
-
</tr>
|
107 |
-
</tbody>
|
108 |
-
</table>
|
109 |
-
</iframe>
|
110 |
-
</figure>
|
111 |
-
<ul>
|
112 |
-
<li>Some text on li before img</li>
|
113 |
-
<li>Some text on li before imgand after img</li>
|
114 |
-
<li>Some text after img</li>
|
115 |
-
</ul>
|
116 |
-
<figure class="op-slideshow">
|
117 |
-
<figure>
|
118 |
-
<img src="http://example.com/img0.jpg"/>
|
119 |
-
</figure>
|
120 |
-
<figure>
|
121 |
-
<img src="http://example.com/img1.jpg"/>
|
122 |
-
</figure>
|
123 |
-
<figure>
|
124 |
-
<img src="http://example.com/img2.jpg"/>
|
125 |
-
<figcaption>Image 2</figcaption>
|
126 |
-
</figure>
|
127 |
-
<figure>
|
128 |
-
<img src="http://example.com/img3.jpg"/>
|
129 |
-
<figcaption>Image 3</figcaption>
|
130 |
-
</figure>
|
131 |
-
<figure>
|
132 |
-
<img src="http://example.com/img4.jpg"/>
|
133 |
-
</figure>
|
134 |
-
</figure>
|
135 |
-
<figure class="op-slideshow">
|
136 |
-
<figure>
|
137 |
-
<img src="http://example.com/img1.jpg"/>
|
138 |
-
<figcaption> Image 1 </figcaption>
|
139 |
-
</figure>
|
140 |
-
<figure>
|
141 |
-
<img src="http://example.com/img2.jpg"/>
|
142 |
-
<figcaption> Image 2 </figcaption>
|
143 |
-
</figure>
|
144 |
-
<figure>
|
145 |
-
<img src="http://example.com/img3.jpg"/>
|
146 |
-
<figcaption> Image 3 </figcaption>
|
147 |
-
</figure>
|
148 |
-
</figure>
|
149 |
-
<figure class="op-interactive">
|
150 |
-
<iframe class="no-margin">
|
151 |
-
<blockquote class="instagram-media" data-instgrm-captioned="" data-instgrm-version="6" style=" background:#FFF; border:0; border-radius:3px; box-shadow:0 0 1px 0 rgba(0,0,0,0.5),0 1px 10px 0 rgba(0,0,0,0.15); margin: 1px; max-width:658px; padding:0; width:99.375%; width:-webkit-calc(100% - 2px); width:calc(100% - 2px);">
|
152 |
-
<div style="padding:8px;">
|
153 |
-
<div style=" background:#F8F8F8; line-height:0; margin-top:40px; padding:62.5% 0; text-align:center; width:100%;">
|
154 |
-
<div style=" background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAsCAMAAAApWqozAAAAGFBMVEUiIiI9PT0eHh4gIB4hIBkcHBwcHBwcHBydr+JQAAAACHRSTlMABA4YHyQsM5jtaMwAAADfSURBVDjL7ZVBEgMhCAQBAf//42xcNbpAqakcM0ftUmFAAIBE81IqBJdS3lS6zs3bIpB9WED3YYXFPmHRfT8sgyrCP1x8uEUxLMzNWElFOYCV6mHWWwMzdPEKHlhLw7NWJqkHc4uIZphavDzA2JPzUDsBZziNae2S6owH8xPmX8G7zzgKEOPUoYHvGz1TBCxMkd3kwNVbU0gKHkx+iZILf77IofhrY1nYFnB/lQPb79drWOyJVa/DAvg9B/rLB4cC+Nqgdz/TvBbBnr6GBReqn/nRmDgaQEej7WhonozjF+Y2I/fZou/qAAAAAElFTkSuQmCC); display:block; height:44px; margin:0 auto -44px; position:relative; top:-22px; width:44px;"></div>
|
155 |
-
</div>
|
156 |
-
<p style=" margin:8px 0 0 0; padding:0 4px;">
|
157 |
-
<a href="https://www.instagram.com/p/BAXbKP1POQe/" style=" color:#000; font-family:Arial,sans-serif; font-size:14px; font-style:normal; font-weight:normal; line-height:17px; text-decoration:none; word-wrap:break-word;" target="_blank">ð¸ @natthaponwuttipetch</a>
|
158 |
-
</p>
|
159 |
-
<p style=" color:#c9c8cd; font-family:Arial,sans-serif; font-size:14px; line-height:17px; margin-bottom:0; margin-top:8px; overflow:hidden; padding:8px 0 7px; text-align:center; text-overflow:ellipsis; white-space:nowrap;">
|
160 |
-
A photo posted by Ann Hathairat Vidhyaphum (@annvidh) on <time style=" font-family:Arial,sans-serif; font-size:14px; line-height:17px;" datetime="2016-01-10T16:56:06+00:00">Jan 10, 2016 at 8:56am PST</time></p>
|
161 |
-
</div>
|
162 |
-
</blockquote>
|
163 |
-
<script async="" defer="defer" src="//platform.instagram.com/en_US/embeds.js"></script>
|
164 |
-
</iframe>
|
165 |
-
</figure>
|
166 |
-
<figure>
|
167 |
-
<img src="http://example.com/img.jpg"/>
|
168 |
-
<figcaption>blue eyes</figcaption>
|
169 |
-
</figure>
|
170 |
-
<figure class="op-interactive">
|
171 |
-
<iframe class="no-margin">
|
172 |
-
<h1>Sibling content</h1>
|
173 |
-
<div>sibling body</div></iframe>
|
174 |
-
</figure>
|
175 |
-
<p>Standard paragraph that <b>shouldn't</b> lie within the interactive block.</p>
|
176 |
-
<figure class="op-interactive">
|
177 |
-
<iframe class="no-margin">
|
178 |
-
<p>Extra markup</p>
|
179 |
-
<div class="fb-post" data-href="https://www.facebook.com/some-page/posts/some-post"></div>
|
180 |
-
</iframe>
|
181 |
-
</figure>
|
182 |
-
<figure class="op-slideshow">
|
183 |
-
<figure>
|
184 |
-
<img src="http://example.com/konservnye-banki-osobenno-lyubyat-yaponcy-810x471.jpg"/>
|
185 |
-
<figcaption>Caption Img 1</figcaption>
|
186 |
-
</figure>
|
187 |
-
<figure>
|
188 |
-
<img src="http://example.com/a-vot-chto-vnutri.jpg"/>
|
189 |
-
<figcaption>Alternative text </figcaption>
|
190 |
-
</figure>
|
191 |
-
<figure>
|
192 |
-
<img src="http://example.com/brelok-s-bezopasnostyu-vsegda-s-soboj.jpg"/>
|
193 |
-
<figcaption>Caption img 3</figcaption>
|
194 |
-
</figure>
|
195 |
-
</figure>
|
196 |
-
<figure>
|
197 |
-
<img src="http://example.com/image.jpg"/>
|
198 |
-
<figcaption>caption</figcaption>
|
199 |
-
</figure>
|
200 |
-
</article>
|
201 |
-
</body>
|
202 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/CMS/wp-rules.json
DELETED
@@ -1,606 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"rules":
|
3 |
-
[{
|
4 |
-
"class": "TextNodeRule"
|
5 |
-
}, {
|
6 |
-
"class": "PassThroughRule",
|
7 |
-
"selector": "html"
|
8 |
-
}, {
|
9 |
-
"class": "PassThroughRule",
|
10 |
-
"selector": "head"
|
11 |
-
}, {
|
12 |
-
"class": "PassThroughRule",
|
13 |
-
"selector": "body"
|
14 |
-
}, {
|
15 |
-
"class": "PassThroughRule",
|
16 |
-
"selector" : "code"
|
17 |
-
},{
|
18 |
-
"class": "PassThroughRule",
|
19 |
-
"selector" : "del"
|
20 |
-
},{
|
21 |
-
"class": "PassThroughRule",
|
22 |
-
"selector" : "mark"
|
23 |
-
}, {
|
24 |
-
"class": "PassThroughRule",
|
25 |
-
"selector" : "span"
|
26 |
-
}, {
|
27 |
-
"class": "ParagraphRule",
|
28 |
-
"selector": "p"
|
29 |
-
}, {
|
30 |
-
"class": "LineBreakRule",
|
31 |
-
"selector": "br"
|
32 |
-
}, {
|
33 |
-
"class": "AnchorRule",
|
34 |
-
"selector": "a",
|
35 |
-
"properties": {
|
36 |
-
"anchor.href": {
|
37 |
-
"type": "string",
|
38 |
-
"selector": "a",
|
39 |
-
"attribute": "href"
|
40 |
-
},
|
41 |
-
"anchor.rel": {
|
42 |
-
"type": "string",
|
43 |
-
"selector": "a",
|
44 |
-
"attribute": "rel"
|
45 |
-
}
|
46 |
-
}
|
47 |
-
}, {
|
48 |
-
"class": "BoldRule",
|
49 |
-
"selector": "b"
|
50 |
-
}, {
|
51 |
-
"class": "BoldRule",
|
52 |
-
"selector": "strong"
|
53 |
-
}, {
|
54 |
-
"class": "ItalicRule",
|
55 |
-
"selector": "i"
|
56 |
-
}, {
|
57 |
-
"class": "ItalicRule",
|
58 |
-
"selector": "em"
|
59 |
-
}, {
|
60 |
-
"class": "BlockquoteRule",
|
61 |
-
"selector": "blockquote"
|
62 |
-
}, {
|
63 |
-
"class": "PassThroughRule",
|
64 |
-
"selector": "blockquote p"
|
65 |
-
}, {
|
66 |
-
"class": "ImageInsideParagraphRule",
|
67 |
-
"selector": "img",
|
68 |
-
"properties": {
|
69 |
-
"image.url": {
|
70 |
-
"type": "string",
|
71 |
-
"selector": "img",
|
72 |
-
"attribute": "src"
|
73 |
-
}
|
74 |
-
}
|
75 |
-
},{
|
76 |
-
"class": "ImageRule",
|
77 |
-
"selector": "img",
|
78 |
-
"properties": {
|
79 |
-
"image.url": {
|
80 |
-
"type": "string",
|
81 |
-
"selector": "img",
|
82 |
-
"attribute": "src"
|
83 |
-
}
|
84 |
-
}
|
85 |
-
}, {
|
86 |
-
"class": "ListItemRule",
|
87 |
-
"selector" : "li"
|
88 |
-
}, {
|
89 |
-
"class": "ListElementRule",
|
90 |
-
"selector" : "ul"
|
91 |
-
}, {
|
92 |
-
"class": "ListElementRule",
|
93 |
-
"selector" : "ol"
|
94 |
-
}, {
|
95 |
-
"class": "BlockquoteRule",
|
96 |
-
"selector" : "blockquote"
|
97 |
-
}, {
|
98 |
-
"class": "H1Rule",
|
99 |
-
"selector" : "h1",
|
100 |
-
"properties" : {
|
101 |
-
"h1.class" : {
|
102 |
-
"type" : "string",
|
103 |
-
"selector" : "link",
|
104 |
-
"attribute": "class"
|
105 |
-
}
|
106 |
-
}
|
107 |
-
}, {
|
108 |
-
"class": "H1Rule",
|
109 |
-
"selector" : "title"
|
110 |
-
}, {
|
111 |
-
"class": "H2Rule",
|
112 |
-
"selector" : "h2",
|
113 |
-
"properties" : {
|
114 |
-
"h2.class" : {
|
115 |
-
"type" : "string",
|
116 |
-
"selector" : "link",
|
117 |
-
"attribute": "class"
|
118 |
-
}
|
119 |
-
}
|
120 |
-
}, {
|
121 |
-
"class": "H2Rule",
|
122 |
-
"selector" : "h3,h4,h5,h6"
|
123 |
-
}, {
|
124 |
-
"class": "InteractiveRule",
|
125 |
-
"selector" : "blockquote.instagram-media",
|
126 |
-
"properties" : {
|
127 |
-
"interactive.iframe" : {
|
128 |
-
"type" : "multiple",
|
129 |
-
"children": [
|
130 |
-
{
|
131 |
-
"type": "element",
|
132 |
-
"selector": "blockquote"
|
133 |
-
}, {
|
134 |
-
"type": "next-sibling-element-of",
|
135 |
-
"selector": "blockquote"
|
136 |
-
}
|
137 |
-
]
|
138 |
-
}
|
139 |
-
}
|
140 |
-
}, {
|
141 |
-
"class": "InteractiveRule",
|
142 |
-
"selector" : "iframe",
|
143 |
-
"properties" : {
|
144 |
-
"interactive.url" : {
|
145 |
-
"type" : "string",
|
146 |
-
"selector" : "iframe",
|
147 |
-
"attribute": "src"
|
148 |
-
},
|
149 |
-
"interactive.width" : {
|
150 |
-
"type" : "int",
|
151 |
-
"selector" : "iframe",
|
152 |
-
"attribute": "width"
|
153 |
-
},
|
154 |
-
"interactive.height" : {
|
155 |
-
"type" : "int",
|
156 |
-
"selector" : "iframe",
|
157 |
-
"attribute": "height"
|
158 |
-
},
|
159 |
-
"interactive.iframe" : {
|
160 |
-
"type" : "children",
|
161 |
-
"selector" : "iframe"
|
162 |
-
}
|
163 |
-
}
|
164 |
-
}, {
|
165 |
-
"class": "InteractiveRule",
|
166 |
-
"selector" : "div.embed",
|
167 |
-
"properties" : {
|
168 |
-
"interactive.iframe" : {
|
169 |
-
"type" : "children",
|
170 |
-
"selector" : "div.embed"
|
171 |
-
},
|
172 |
-
"interactive.height" : {
|
173 |
-
"type" : "int",
|
174 |
-
"selector" : "iframe",
|
175 |
-
"attribute": "height"
|
176 |
-
},
|
177 |
-
"interactive.width" : {
|
178 |
-
"type" : "int",
|
179 |
-
"selector" : "iframe",
|
180 |
-
"attribute": "width"
|
181 |
-
}
|
182 |
-
}
|
183 |
-
}, {
|
184 |
-
"class": "InteractiveRule",
|
185 |
-
"selector" : "div.interactive",
|
186 |
-
"properties" : {
|
187 |
-
"interactive.iframe" : {
|
188 |
-
"type" : "children",
|
189 |
-
"selector" : "div.interactive"
|
190 |
-
},
|
191 |
-
"interactive.height" : {
|
192 |
-
"type" : "int",
|
193 |
-
"selector" : "iframe",
|
194 |
-
"attribute": "height"
|
195 |
-
},
|
196 |
-
"interactive.width" : {
|
197 |
-
"type" : "int",
|
198 |
-
"selector" : "iframe",
|
199 |
-
"attribute": "width"
|
200 |
-
}
|
201 |
-
}
|
202 |
-
}, {
|
203 |
-
"class": "InteractiveRule",
|
204 |
-
"selector" : "//div[@class='embed' and iframe]",
|
205 |
-
"properties" : {
|
206 |
-
"interactive.url" : {
|
207 |
-
"type" : "string",
|
208 |
-
"selector" : "iframe",
|
209 |
-
"attribute": "src"
|
210 |
-
},
|
211 |
-
"interactive.iframe" : {
|
212 |
-
"type" : "children",
|
213 |
-
"selector" : "iframe",
|
214 |
-
"attribute": "src"
|
215 |
-
},
|
216 |
-
"interactive.width" : {
|
217 |
-
"type" : "int",
|
218 |
-
"selector" : "iframe",
|
219 |
-
"attribute": "width"
|
220 |
-
},
|
221 |
-
"interactive.height" : {
|
222 |
-
"type" : "int",
|
223 |
-
"selector" : "iframe",
|
224 |
-
"attribute": "height"
|
225 |
-
}
|
226 |
-
}
|
227 |
-
}, {
|
228 |
-
"class": "InteractiveRule",
|
229 |
-
"selector" : "//div[@class='interactive' and iframe]",
|
230 |
-
"properties" : {
|
231 |
-
"interactive.url" : {
|
232 |
-
"type" : "string",
|
233 |
-
"selector" : "iframe",
|
234 |
-
"attribute": "src"
|
235 |
-
},
|
236 |
-
"interactive.iframe" : {
|
237 |
-
"type" : "children",
|
238 |
-
"selector" : "iframe"
|
239 |
-
},
|
240 |
-
"interactive.height" : {
|
241 |
-
"type" : "int",
|
242 |
-
"selector" : "iframe",
|
243 |
-
"attribute": "height"
|
244 |
-
},
|
245 |
-
"interactive.width" : {
|
246 |
-
"type" : "int",
|
247 |
-
"selector" : "iframe",
|
248 |
-
"attribute": "width"
|
249 |
-
}
|
250 |
-
}
|
251 |
-
}, {
|
252 |
-
"class": "InteractiveRule",
|
253 |
-
"selector" : "table",
|
254 |
-
"properties" : {
|
255 |
-
"interactive.iframe" : {
|
256 |
-
"type" : "element",
|
257 |
-
"selector" : "table"
|
258 |
-
},
|
259 |
-
"interactive.height" : {
|
260 |
-
"type" : "int",
|
261 |
-
"selector" : "table",
|
262 |
-
"attribute": "height"
|
263 |
-
},
|
264 |
-
"interactive.width" : {
|
265 |
-
"type" : "int",
|
266 |
-
"selector" : "iframe",
|
267 |
-
"attribute": "width"
|
268 |
-
}
|
269 |
-
}
|
270 |
-
}, {
|
271 |
-
"class": "InteractiveRule",
|
272 |
-
"selector" : "div.fb-post",
|
273 |
-
"properties" : {
|
274 |
-
"interactive.iframe" : {
|
275 |
-
"type": "multiple",
|
276 |
-
"children": [
|
277 |
-
{
|
278 |
-
"type": "fragment",
|
279 |
-
"fragment": "<p>Extra markup</p>"
|
280 |
-
},
|
281 |
-
{
|
282 |
-
"type" : "element",
|
283 |
-
"selector" : "div.fb-post"
|
284 |
-
}
|
285 |
-
]
|
286 |
-
}
|
287 |
-
}
|
288 |
-
}, {
|
289 |
-
"class": "InteractiveInsideParagraphRule",
|
290 |
-
"selector" : "iframe",
|
291 |
-
"properties" : {
|
292 |
-
"interactive.url" : {
|
293 |
-
"type" : "string",
|
294 |
-
"selector" : "iframe",
|
295 |
-
"attribute": "src"
|
296 |
-
},
|
297 |
-
"interactive.height" : {
|
298 |
-
"type" : "int",
|
299 |
-
"selector" : "iframe",
|
300 |
-
"attribute": "height"
|
301 |
-
},
|
302 |
-
"interactive.width" : {
|
303 |
-
"type" : "int",
|
304 |
-
"selector" : "iframe",
|
305 |
-
"attribute": "width"
|
306 |
-
}
|
307 |
-
}
|
308 |
-
},{
|
309 |
-
"class": "InteractiveInsideParagraphRule",
|
310 |
-
"selector" : "div.embed",
|
311 |
-
"properties" : {
|
312 |
-
"interactive.iframe" : {
|
313 |
-
"type" : "children",
|
314 |
-
"selector" : "div.embed"
|
315 |
-
},
|
316 |
-
"interactive.height" : {
|
317 |
-
"type" : "int",
|
318 |
-
"selector" : "iframe",
|
319 |
-
"attribute": "height"
|
320 |
-
},
|
321 |
-
"interactive.width" : {
|
322 |
-
"type" : "int",
|
323 |
-
"selector" : "iframe",
|
324 |
-
"attribute": "width"
|
325 |
-
}
|
326 |
-
}
|
327 |
-
}, {
|
328 |
-
"class": "InteractiveInsideParagraphRule",
|
329 |
-
"selector" : "div.interactive",
|
330 |
-
"properties" : {
|
331 |
-
"interactive.iframe" : {
|
332 |
-
"type" : "children",
|
333 |
-
"selector" : "div.interactive"
|
334 |
-
},
|
335 |
-
"interactive.height" : {
|
336 |
-
"type" : "int",
|
337 |
-
"selector" : "iframe",
|
338 |
-
"attribute": "height"
|
339 |
-
},
|
340 |
-
"interactive.width" : {
|
341 |
-
"type" : "int",
|
342 |
-
"selector" : "iframe",
|
343 |
-
"attribute": "width"
|
344 |
-
}
|
345 |
-
}
|
346 |
-
}, {
|
347 |
-
"class": "InteractiveInsideParagraphRule",
|
348 |
-
"selector" : "//div[@class='embed' and iframe]",
|
349 |
-
"properties" : {
|
350 |
-
"interactive.url" : {
|
351 |
-
"type" : "string",
|
352 |
-
"selector" : "iframe",
|
353 |
-
"attribute": "src"
|
354 |
-
},
|
355 |
-
"interactive.iframe" : {
|
356 |
-
"type" : "children",
|
357 |
-
"selector" : "iframe",
|
358 |
-
"attribute": "src"
|
359 |
-
},
|
360 |
-
"interactive.width" : {
|
361 |
-
"type" : "int",
|
362 |
-
"selector" : "iframe",
|
363 |
-
"attribute": "width"
|
364 |
-
},
|
365 |
-
"interactive.height" : {
|
366 |
-
"type" : "int",
|
367 |
-
"selector" : "iframe",
|
368 |
-
"attribute": "height"
|
369 |
-
}
|
370 |
-
}
|
371 |
-
}, {
|
372 |
-
"class": "InteractiveInsideParagraphRule",
|
373 |
-
"selector" : "//div[@class='interactive' and iframe]",
|
374 |
-
"properties" : {
|
375 |
-
"interactive.url" : {
|
376 |
-
"type" : "string",
|
377 |
-
"selector" : "iframe",
|
378 |
-
"attribute": "src"
|
379 |
-
},
|
380 |
-
"interactive.iframe" : {
|
381 |
-
"type" : "children",
|
382 |
-
"selector" : "iframe",
|
383 |
-
"attribute": "src"
|
384 |
-
},
|
385 |
-
"interactive.height" : {
|
386 |
-
"type" : "int",
|
387 |
-
"selector" : "iframe",
|
388 |
-
"attribute": "height"
|
389 |
-
},
|
390 |
-
"interactive.width" : {
|
391 |
-
"type" : "int",
|
392 |
-
"selector" : "iframe",
|
393 |
-
"attribute": "width"
|
394 |
-
}
|
395 |
-
}
|
396 |
-
}, {
|
397 |
-
"class": "InteractiveInsideParagraphRule",
|
398 |
-
"selector" : "table",
|
399 |
-
"properties" : {
|
400 |
-
"interactive.iframe" : {
|
401 |
-
"type" : "element",
|
402 |
-
"selector" : "table"
|
403 |
-
},
|
404 |
-
"interactive.height" : {
|
405 |
-
"type" : "int",
|
406 |
-
"selector" : "table",
|
407 |
-
"attribute": "height"
|
408 |
-
},
|
409 |
-
"interactive.width" : {
|
410 |
-
"type" : "int",
|
411 |
-
"selector" : "table",
|
412 |
-
"attribute": "width"
|
413 |
-
}
|
414 |
-
}
|
415 |
-
}, {
|
416 |
-
"class": "SlideshowImageRule",
|
417 |
-
"selector" : "figure",
|
418 |
-
"properties" : {
|
419 |
-
"image.url" : {
|
420 |
-
"type" : "string",
|
421 |
-
"selector" : "img",
|
422 |
-
"attribute": "src"
|
423 |
-
},
|
424 |
-
"caption.title" : {
|
425 |
-
"type" : "string",
|
426 |
-
"selector" : "figcaption"
|
427 |
-
}
|
428 |
-
}
|
429 |
-
}, {
|
430 |
-
"class": "SlideshowRule",
|
431 |
-
"selector" : "div.gallery"
|
432 |
-
}, {
|
433 |
-
"class": "CaptionRule",
|
434 |
-
"selector" : "figcaption"
|
435 |
-
}, {
|
436 |
-
"class": "CaptionRule",
|
437 |
-
"selector" : "p.wp-caption-text"
|
438 |
-
}, {
|
439 |
-
"class": "ImageRule",
|
440 |
-
"selector" : "figure",
|
441 |
-
"properties" : {
|
442 |
-
"image.url" : {
|
443 |
-
"type" : "string",
|
444 |
-
"selector" : "img",
|
445 |
-
"attribute": "src"
|
446 |
-
}
|
447 |
-
}
|
448 |
-
}, {
|
449 |
-
"class": "VideoRule",
|
450 |
-
"selector" : "div.wp-video",
|
451 |
-
"containsChild": "video",
|
452 |
-
"properties" : {
|
453 |
-
"video.url" : {
|
454 |
-
"type" : "string",
|
455 |
-
"selector" : "source",
|
456 |
-
"attribute": "src"
|
457 |
-
},
|
458 |
-
"video.type" : {
|
459 |
-
"type" : "string",
|
460 |
-
"selector" : "source",
|
461 |
-
"attribute": "type"
|
462 |
-
}
|
463 |
-
}
|
464 |
-
},
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
{
|
469 |
-
"class" : "IgnoreRule",
|
470 |
-
"selector" : "p.jetpack-slideshow-noscript"
|
471 |
-
},
|
472 |
-
{
|
473 |
-
"class": "CaptionRule",
|
474 |
-
"selector" : "div.wp-caption-text"
|
475 |
-
},
|
476 |
-
{
|
477 |
-
"class" : "PassThroughRule",
|
478 |
-
"selector" : "div.gallery-row"
|
479 |
-
},
|
480 |
-
{
|
481 |
-
"class" : "PassThroughRule",
|
482 |
-
"selector" : "div.tiled-gallery p"
|
483 |
-
},
|
484 |
-
{
|
485 |
-
"class" : "PassThroughRule",
|
486 |
-
"selector" : "div.gallery-row p"
|
487 |
-
},
|
488 |
-
{
|
489 |
-
"class" : "PassThroughRule",
|
490 |
-
"selector" : "div.gallery-group p"
|
491 |
-
},
|
492 |
-
{
|
493 |
-
"class" : "PassThroughRule",
|
494 |
-
"selector" : "div.gallery-group"
|
495 |
-
},
|
496 |
-
{
|
497 |
-
"class": "ImageRule",
|
498 |
-
"selector" : "div.wp-caption",
|
499 |
-
"properties" : {
|
500 |
-
"image.url" : {
|
501 |
-
"type" : "string",
|
502 |
-
"selector" : "img",
|
503 |
-
"attribute": "src"
|
504 |
-
}
|
505 |
-
}
|
506 |
-
},
|
507 |
-
{
|
508 |
-
"class": "SlideshowImageRule",
|
509 |
-
"selector" : "div.tiled-gallery-item",
|
510 |
-
"properties" : {
|
511 |
-
"image.url" : {
|
512 |
-
"type" : "string",
|
513 |
-
"selector" : "img",
|
514 |
-
"attribute": "data-orig-file"
|
515 |
-
},
|
516 |
-
"caption.title" : {
|
517 |
-
"type" : "string",
|
518 |
-
"selector" : "div.tiled-gallery-caption"
|
519 |
-
}
|
520 |
-
}
|
521 |
-
},
|
522 |
-
{
|
523 |
-
"class": "SlideshowRule",
|
524 |
-
"selector" : "div.tiled-gallery"
|
525 |
-
},
|
526 |
-
{
|
527 |
-
"class": "SlideshowRule",
|
528 |
-
"selector" : "div.tiled-gallery"
|
529 |
-
},
|
530 |
-
{
|
531 |
-
"class": "Compat\\JetpackSlideshowRule",
|
532 |
-
"selector" : "div.jetpack-slideshow",
|
533 |
-
"properties": {
|
534 |
-
"jetpack.data-gallery": {
|
535 |
-
"type": "json",
|
536 |
-
"selector": "div.jetpack-slideshow",
|
537 |
-
"attribute": "data-gallery"
|
538 |
-
}
|
539 |
-
}
|
540 |
-
},
|
541 |
-
{
|
542 |
-
"class": "CaptionRule",
|
543 |
-
"selector" : "div.tiled-gallery-caption"
|
544 |
-
},
|
545 |
-
{
|
546 |
-
"class" : "PassThroughRule",
|
547 |
-
"selector" : "div.vce-gallery-big"
|
548 |
-
},
|
549 |
-
{
|
550 |
-
"class" : "PassThroughRule",
|
551 |
-
"selector" : "div.vce-gallery-small"
|
552 |
-
},
|
553 |
-
{
|
554 |
-
"class" : "IgnoreRule",
|
555 |
-
"selector" : "div.vce-gallery-slider"
|
556 |
-
},
|
557 |
-
{
|
558 |
-
"class": "SlideshowImageRule",
|
559 |
-
"selector" : "div.big-gallery-item",
|
560 |
-
"properties" : {
|
561 |
-
"image.url" : {
|
562 |
-
"type" : "string",
|
563 |
-
"selector" : "img",
|
564 |
-
"attribute": "src"
|
565 |
-
},
|
566 |
-
"caption.title" : {
|
567 |
-
"type" : "string",
|
568 |
-
"selector" : "figcaption.wp-caption-text"
|
569 |
-
}
|
570 |
-
}
|
571 |
-
},
|
572 |
-
|
573 |
-
|
574 |
-
{
|
575 |
-
"class": "ImageInsideParagraphRule",
|
576 |
-
"selector": "figure.wp-caption",
|
577 |
-
"properties": {
|
578 |
-
"image.url": {
|
579 |
-
"type": "string",
|
580 |
-
"selector": "img",
|
581 |
-
"attribute": "src"
|
582 |
-
}
|
583 |
-
}
|
584 |
-
},
|
585 |
-
|
586 |
-
{
|
587 |
-
"class": "InteractiveRule",
|
588 |
-
"selector" : "iframe.sibling",
|
589 |
-
"properties" : {
|
590 |
-
"interactive.iframe" : {
|
591 |
-
"type" : "multiple",
|
592 |
-
"children": [
|
593 |
-
{
|
594 |
-
"type": "children",
|
595 |
-
"selector": "iframe"
|
596 |
-
}, {
|
597 |
-
"type": "next-sibling-element-of",
|
598 |
-
"selector": "iframe",
|
599 |
-
"sibling.selector": "script"
|
600 |
-
}
|
601 |
-
]
|
602 |
-
}
|
603 |
-
}
|
604 |
-
}
|
605 |
-
]
|
606 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/CMS/wp.html
DELETED
@@ -1,221 +0,0 @@
|
|
1 |
-
<!DOCTYPE html>
|
2 |
-
<html>
|
3 |
-
<body>
|
4 |
-
<p>Yes, peace is good for everybody!<br>
|
5 |
-
Man kind.</p>
|
6 |
-
<p><img src="http://example.com/image0.jpg" />Some text after img.</p>
|
7 |
-
<p>Some text before img<img src="http://example.com/image1.jpg" /></p>
|
8 |
-
<p>Some text before img<img src="http://example.com/image2.jpg" /> and some after img.</p>
|
9 |
-
<p><iframe width="300" height="200" src="http://example.com/0/"/></p>
|
10 |
-
<p>Some text before iframe<iframe width="300" height="200" src="http://example.com/1/"/></p>
|
11 |
-
<p><iframe width="300" height="200" src="http://example.com/2/"></iframe> some after iframe.</p>
|
12 |
-
<p>Some text before iframe<iframe width="300" height="200" src="http://example.com/3/"/> and some after iframe.</p>
|
13 |
-
<iframe width="300" height="200" src="http://example.com/loose/with_url"></iframe>
|
14 |
-
<iframe>
|
15 |
-
<div>
|
16 |
-
<h1>Iframe loose without url</h1>
|
17 |
-
</div>
|
18 |
-
</iframe>
|
19 |
-
<div class="embed">
|
20 |
-
<div>
|
21 |
-
<h1>some embed here</h1>
|
22 |
-
</div>
|
23 |
-
</div>
|
24 |
-
<div class="interactive">
|
25 |
-
<div>
|
26 |
-
<h1>some embed here</h1>
|
27 |
-
</div>
|
28 |
-
</div>
|
29 |
-
<div class="interactive">
|
30 |
-
<iframe>
|
31 |
-
<div>some content</div>
|
32 |
-
<script>alert('hi & hello to you @ testing!');</script>
|
33 |
-
</iframe>
|
34 |
-
</div>
|
35 |
-
<div class="interactive">
|
36 |
-
<iframe width="300" height="200" src="http://example.com/4/"></iframe>
|
37 |
-
</div>
|
38 |
-
<div class="interactive">
|
39 |
-
<iframe>
|
40 |
-
<div>some content</div>
|
41 |
-
<script>alert('hi & hello to you @ testing!');</script>
|
42 |
-
</iframe>
|
43 |
-
</div>
|
44 |
-
<div class="embed">
|
45 |
-
<iframe width="300" height="200" src="http://example.com/4/"></iframe>
|
46 |
-
</div>
|
47 |
-
<div class="embed">
|
48 |
-
<iframe>
|
49 |
-
<div>some content</div>
|
50 |
-
<script>alert('hi & hello to you @ testing!');</script>
|
51 |
-
</iframe>
|
52 |
-
</div>
|
53 |
-
<table width="200" height="200">
|
54 |
-
<thead>
|
55 |
-
<td>header 1</td>
|
56 |
-
<td>header 2</td>
|
57 |
-
</thead>
|
58 |
-
<tbody>
|
59 |
-
<tr>
|
60 |
-
<td>Line 1 column 1</td>
|
61 |
-
<td>Line 1 column 2</td>
|
62 |
-
</tr>
|
63 |
-
<tr>
|
64 |
-
<td>Line 2 column 1</td>
|
65 |
-
<td>Line 2 column 2</td>
|
66 |
-
</tr>
|
67 |
-
</tbody>
|
68 |
-
</table>
|
69 |
-
<ul>
|
70 |
-
<li>Some text on li before img<img src="http://example.com/image.jpg" width="600" height="360"/></li>
|
71 |
-
<li>Some text on li before img<img src="http://example.com/image.jpg" width="600" height="360"/>and after img</li>
|
72 |
-
<li><img src="http://example.com/image.jpg" width="600" height="360"/>Some text after img</li>
|
73 |
-
</ul>
|
74 |
-
<p class="jetpack-slideshow-noscript robots-nocontent">This slideshow requires JavaScript.</p>
|
75 |
-
<div
|
76 |
-
class="slideshow-window jetpack-slideshow slideshow-black"
|
77 |
-
data-trans="fade" data-autostart="1"
|
78 |
-
data-gallery="[{"src":"http:\/\/example.com/img0.jpg","id":"434","title":"img0","alt":"","caption":"","itemprop":"image"},{"src":"http:\/\/example.com\/img1.jpg","id":"474","title":"img1","alt":"","caption":"","itemprop":"image"},{"src":"http:\/\/example.com\/img2.jpg","id":"470","title":"img2","alt":"","caption":"Image 2","itemprop":"image"},{"src":"http:\/\/example.com\/img3.jpg","id":"466","title":"Image 3","alt":"","caption":"Image 3","itemprop":"image"},{"src":"http:\/\/example.com\/img4.jpg","id":"462","title":"img4","alt":"","caption":"","itemprop":"image"}]"
|
79 |
-
itemscope itemtype="http://schema.org/ImageGallery">
|
80 |
-
</div>
|
81 |
-
|
82 |
-
<div class="tiled-gallery type-rectangular tiled-gallery-unresized" >
|
83 |
-
<div class="gallery-row">
|
84 |
-
<div class="gallery-group images-1">
|
85 |
-
<div class="tiled-gallery-item tiled-gallery-item-large">
|
86 |
-
<a href="http://www.diegoquinteiro.com/15-razoes-para-ser-contra-o-impeachment/forum/">
|
87 |
-
<meta itemprop="width" content="318">
|
88 |
-
<meta itemprop="height" content="211">
|
89 |
-
<img data-orig-file="http://example.com/img1.jpg"
|
90 |
-
data-image-meta="{"aperture":"0","credit":"","camera":"","caption":"","created_timestamp":"0","copyright":"","focal_length":"0","iso":"0","shutter_speed":"0","title":"","orientation":"0"}" data-image-title="Forum" data-image-description="" data-medium-file="http://http://example.com/img1.jpg" data-large-file="http://example.com/img1.jpg" src="http://example.com/img1.jpg?resize=318%2C211"
|
91 |
-
width="318" height="211" data-original-width="318" data-original-height="211" title="Forum" alt="riots" style="width: 318px; height: 211px;" />
|
92 |
-
</a>
|
93 |
-
<div class="tiled-gallery-caption" itemprop="caption description"> Image 1 </div>
|
94 |
-
</p>
|
95 |
-
</div>
|
96 |
-
</p>
|
97 |
-
</div>
|
98 |
-
<p> <!-- close group -->
|
99 |
-
<div class="gallery-group images-2">
|
100 |
-
<div class="tiled-gallery-item tiled-gallery-item-small" itemprop="associatedMedia">
|
101 |
-
<a href="http://example.com/link" border="0" itemprop="url">
|
102 |
-
<meta itemprop="width" content="174">
|
103 |
-
<meta itemprop="height" content="109">
|
104 |
-
<img data-attachment-id="519" data-orig-file="http://example.com/img2.jpg" data-orig-size="2078,1310" data-comments-opened="" data-image-meta="{"aperture":"0","credit":"","camera":"","caption":"","created_timestamp":"0","copyright":"","focal_length":"0","iso":"0","shutter_speed":"0","title":"","orientation":"0"}" data-image-title="Chaplin – Fábrica" data-image-description="" data-medium-file="http://example.com/img2.jpg" data-large-file="http://example.com/img2.jpg" src="http://example.com/img2.jpg?resize=174%2C109" width="174" height="109" data-original-width="174" data-original-height="109" itemprop="http://schema.org/image" title="Image Title" alt="chaplin" style="width: 174px; height: 109px;" />
|
105 |
-
</a>
|
106 |
-
<div class="tiled-gallery-caption" itemprop="caption description"> Image 2 </div>
|
107 |
-
</p>
|
108 |
-
</div>
|
109 |
-
<div class="tiled-gallery-item tiled-gallery-item-small" itemprop="associatedMedia">
|
110 |
-
<a href="http://example.com/link" border="0" itemprop="url">
|
111 |
-
<meta itemprop="width" content="174">
|
112 |
-
<meta itemprop="height" content="98">
|
113 |
-
<img data-attachment-id="532" data-orig-file="http://example.com/img3.jpg" data-image-meta="{"aperture":"0","credit":"","camera":"","caption":"","created_timestamp":"0","copyright":"","focal_length":"0","iso":"0","shutter_speed":"0","title":"","orientation":"0"}" data-image-title="highlight image" data-image-description="" data-medium-file="http://www.diegoquinteiro.com/wp-content/uploads/2016/06/highlight-image-300x169.jpg" data-large-file="http://www.diegoquinteiro.com/wp-content/uploads/2016/06/highlight-image-1024x576.jpg" src="http://i1.wp.com/www.diegoquinteiro.com/wp-content/uploads/2016/06/highlight-image.jpg?resize=174%2C98" width="174" height="98" data-original-width="174" data-original-height="98" itemprop="http://schema.org/image" title="highlight image" alt="Dog cat" style="width: 174px; height: 98px;" />
|
114 |
-
</a>
|
115 |
-
<div class="tiled-gallery-caption" itemprop="caption description"> Image 3 </div>
|
116 |
-
</p>
|
117 |
-
</div>
|
118 |
-
</p>
|
119 |
-
</div>
|
120 |
-
<p> <!-- close group -->
|
121 |
-
</div>
|
122 |
-
<p> <!-- close row -->
|
123 |
-
</div>
|
124 |
-
<blockquote class="instagram-media" data-instgrm-captioned data-instgrm-version="6" style=" background:#FFF; border:0; border-radius:3px; box-shadow:0 0 1px 0 rgba(0,0,0,0.5),0 1px 10px 0 rgba(0,0,0,0.15); margin: 1px; max-width:658px; padding:0; width:99.375%; width:-webkit-calc(100% - 2px); width:calc(100% - 2px);">
|
125 |
-
<div style="padding:8px;">
|
126 |
-
<div style=" background:#F8F8F8; line-height:0; margin-top:40px; padding:62.5% 0; text-align:center; width:100%;">
|
127 |
-
<div style=" background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAsCAMAAAApWqozAAAAGFBMVEUiIiI9PT0eHh4gIB4hIBkcHBwcHBwcHBydr+JQAAAACHRSTlMABA4YHyQsM5jtaMwAAADfSURBVDjL7ZVBEgMhCAQBAf//42xcNbpAqakcM0ftUmFAAIBE81IqBJdS3lS6zs3bIpB9WED3YYXFPmHRfT8sgyrCP1x8uEUxLMzNWElFOYCV6mHWWwMzdPEKHlhLw7NWJqkHc4uIZphavDzA2JPzUDsBZziNae2S6owH8xPmX8G7zzgKEOPUoYHvGz1TBCxMkd3kwNVbU0gKHkx+iZILf77IofhrY1nYFnB/lQPb79drWOyJVa/DAvg9B/rLB4cC+Nqgdz/TvBbBnr6GBReqn/nRmDgaQEej7WhonozjF+Y2I/fZou/qAAAAAElFTkSuQmCC); display:block; height:44px; margin:0 auto -44px; position:relative; top:-22px; width:44px;"></div>
|
128 |
-
</div>
|
129 |
-
<p style=" margin:8px 0 0 0; padding:0 4px;">
|
130 |
-
<a href="https://www.instagram.com/p/BAXbKP1POQe/" style=" color:#000; font-family:Arial,sans-serif; font-size:14px; font-style:normal; font-weight:normal; line-height:17px; text-decoration:none; word-wrap:break-word;" target="_blank">📸 @natthaponwuttipetch</a>
|
131 |
-
</p>
|
132 |
-
<p style=" color:#c9c8cd; font-family:Arial,sans-serif; font-size:14px; line-height:17px; margin-bottom:0; margin-top:8px; overflow:hidden; padding:8px 0 7px; text-align:center; text-overflow:ellipsis; white-space:nowrap;">
|
133 |
-
A photo posted by Ann Hathairat Vidhyaphum (@annvidh) on <time style=" font-family:Arial,sans-serif; font-size:14px; line-height:17px;" datetime="2016-01-10T16:56:06+00:00">Jan 10, 2016 at 8:56am PST</time>
|
134 |
-
</p>
|
135 |
-
</div>
|
136 |
-
</blockquote>
|
137 |
-
<script async defer src="//platform.instagram.com/en_US/embeds.js"></script>
|
138 |
-
<p>
|
139 |
-
<figure style="width: 1280px" class="wp-caption alignnone">
|
140 |
-
<img src="http://example.com/img.jpg" width="1280" height="740" class />
|
141 |
-
<br />
|
142 |
-
<figcaption class="wp-caption-text">blue eyes</figcaption>
|
143 |
-
</figure>
|
144 |
-
</p>
|
145 |
-
<iframe class="sibling">
|
146 |
-
<h1>Sibling content</h1>
|
147 |
-
<div>sibling body</div></iframe>
|
148 |
-
<script src="//sibling.com/brother.js"></script>
|
149 |
-
<p>Standard paragraph that <b>shouldn't</b> lie within the interactive block.</p>
|
150 |
-
<div class="fb-post" data-href="https://www.facebook.com/some-page/posts/some-post"></div>
|
151 |
-
|
152 |
-
<div id="gallery-3" class="vce-gallery gallery galleryid-15219 gallery-columns-3 gallery-size-vce-lay-b">
|
153 |
-
<div class="vce-gallery-big">
|
154 |
-
<div class="big-gallery-item item-0">
|
155 |
-
<div class="gallery-icon">
|
156 |
-
<a href="http://example.com/konservnye-banki-osobenno-lyubyat-yaponcy.jpg"><img width="810" height="471" src="http://example.com/konservnye-banki-osobenno-lyubyat-yaponcy-810x471.jpg" class="attachment-vce-lay-a size-vce-lay-a" alt="Caption Img 1" srcset="http://example.com/konservnye-banki-osobenno-lyubyat-yaponcy-810x471.jpg 810w, http://example.com/konservnye-banki-osobenno-lyubyat-yaponcy-300x174.jpg 300w, http://example.com/konservnye-banki-osobenno-lyubyat-yaponcy-768x447.jpg 768w, http://example.com/konservnye-banki-osobenno-lyubyat-yaponcy.jpg 860w" sizes="(max-width: 810px) 100vw, 810px"></a>
|
157 |
-
</div>
|
158 |
-
<figcaption class="wp-caption-text gallery-caption">Caption Img 1</figcaption>
|
159 |
-
</div>
|
160 |
-
<div class="big-gallery-item item-1" style="display:none;">
|
161 |
-
<div class="gallery-icon">
|
162 |
-
<a href="http://example.com/a-vot-chto-vnutri.jpg">
|
163 |
-
<img width="699" height="443" src="http://example.com/a-vot-chto-vnutri.jpg" class="attachment-vce-lay-a size-vce-lay-a" alt="Alternative text" srcset="http://example.com/a-vot-chto-vnutri.jpg 699w, http://example.com/a-vot-chto-vnutri-300x190.jpg 300w" sizes="(max-width: 699px) 100vw, 699px">
|
164 |
-
</a>
|
165 |
-
</div>
|
166 |
-
<figcaption class="wp-caption-text gallery-caption">Alternative text </figcaption>
|
167 |
-
</div>
|
168 |
-
<div class="big-gallery-item item-2" style="display:none;">
|
169 |
-
<div class="gallery-icon">
|
170 |
-
<a href="http://example.com/brelok-s-bezopasnostyu-vsegda-s-soboj.jpg">
|
171 |
-
<img width="700" height="467" src="http://example.com/brelok-s-bezopasnostyu-vsegda-s-soboj.jpg" class="attachment-vce-lay-a size-vce-lay-a" alt="Caption img 3" srcset="http://example.com/brelok-s-bezopasnostyu-vsegda-s-soboj.jpg 700w, http://example.com/brelok-s-bezopasnostyu-vsegda-s-soboj-300x200.jpg 300w" sizes="(max-width: 700px) 100vw, 700px">
|
172 |
-
</a>
|
173 |
-
</div>
|
174 |
-
<figcaption class="wp-caption-text gallery-caption">Caption img 3</figcaption>
|
175 |
-
</div>
|
176 |
-
</div>
|
177 |
-
<div class="vce-gallery-slider owl-carousel owl-theme owl-loaded owl-text-select-on" data-columns="3">
|
178 |
-
<div class="owl-stage-outer">
|
179 |
-
<div class="owl-stage" style="transform: translate3d(-761px, 0px, 0px); transition: 0s; width: 3551.34px;">
|
180 |
-
<div class="owl-item active" style="width: 252.667px; margin-right: 1px;">
|
181 |
-
<figure class="gallery-item" data-item="0">
|
182 |
-
<div class="gallery-icon landscape">
|
183 |
-
<a href="http://example.com/konservnye-banki-osobenno-lyubyat-yaponcy.jpg"><img width="375" height="195" src="http://example.com/konservnye-banki-osobenno-lyubyat-yaponcy-375x195.jpg" class="attachment-vce-lay-b size-vce-lay-b" alt="Caption Img 1"></a>
|
184 |
-
</div>
|
185 |
-
</figure>
|
186 |
-
</div>
|
187 |
-
<div class="owl-item active" style="width: 252.667px; margin-right: 1px;">
|
188 |
-
<figure class="gallery-item" data-item="1">
|
189 |
-
<div class="gallery-icon landscape">
|
190 |
-
<a href="http://example.com/a-vot-chto-vnutri.jpg"><img width="375" height="195" src="http://example.com/a-vot-chto-vnutri-375x195.jpg" class="attachment-vce-lay-b size-vce-lay-b" alt="Alternative text"></a>
|
191 |
-
</div>
|
192 |
-
</figure>
|
193 |
-
</div>
|
194 |
-
<div class="owl-item active" style="width: 252.667px; margin-right: 1px;">
|
195 |
-
<figure class="gallery-item" data-item="2">
|
196 |
-
<div class="gallery-icon landscape">
|
197 |
-
<a href="http://example.com/brelok-s-bezopasnostyu-vsegda-s-soboj.jpg"><img width="375" height="195" src="http://example.com/brelok-s-bezopasnostyu-vsegda-s-soboj-375x195.jpg" class="attachment-vce-lay-b size-vce-lay-b" alt="Caption img 3"></a>
|
198 |
-
</div>
|
199 |
-
</figure>
|
200 |
-
</div>
|
201 |
-
</div>
|
202 |
-
</div>
|
203 |
-
<div class="owl-controls">
|
204 |
-
<div class="owl-nav">
|
205 |
-
<div class="owl-prev" style=""><i class="fa fa-angle-left"></i></div>
|
206 |
-
<div class="owl-next" style=""><i class="fa fa-angle-right"></i></div>
|
207 |
-
</div>
|
208 |
-
<div class="owl-dots" style="">
|
209 |
-
<div class="owl-dot active"><span></span></div>
|
210 |
-
<div class="owl-dot"><span></span></div>
|
211 |
-
<div class="owl-dot"><span></span></div>
|
212 |
-
</div>
|
213 |
-
</div>
|
214 |
-
</div>
|
215 |
-
</div>
|
216 |
-
<div id="attachment_22553" style="width: 800px" class="wp-caption alignnone">
|
217 |
-
<img class="wp-image-22553 size-large" src="http://example.com/image.jpg" alt="alt text" width="800" height="552" srcset="http://example.com/image-800.jpg 800w, http://example.com/image-400.jpg 400w, http://example.com/image-768.jpg 768w" sizes="(max-width: 800px) 100vw, 800px" />
|
218 |
-
<p class="wp-caption-text">caption</p>
|
219 |
-
</div>
|
220 |
-
</body>
|
221 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/wp-rules.json
DELETED
@@ -1,270 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"rules":
|
3 |
-
[{
|
4 |
-
"class": "TextNodeRule"
|
5 |
-
}, {
|
6 |
-
"class": "PassThroughRule",
|
7 |
-
"selector": "html"
|
8 |
-
}, {
|
9 |
-
"class": "PassThroughRule",
|
10 |
-
"selector": "head"
|
11 |
-
}, {
|
12 |
-
"class": "PassThroughRule",
|
13 |
-
"selector": "body"
|
14 |
-
}, {
|
15 |
-
"class": "PassThroughRule",
|
16 |
-
"selector" : "code"
|
17 |
-
},{
|
18 |
-
"class": "PassThroughRule",
|
19 |
-
"selector" : "del"
|
20 |
-
}, {
|
21 |
-
"class": "PassThroughRule",
|
22 |
-
"selector" : "span"
|
23 |
-
}, {
|
24 |
-
"class": "ParagraphRule",
|
25 |
-
"selector": "p"
|
26 |
-
}, {
|
27 |
-
"class": "LineBreakRule",
|
28 |
-
"selector": "br"
|
29 |
-
}, {
|
30 |
-
"class": "AnchorRule",
|
31 |
-
"selector": "a",
|
32 |
-
"properties": {
|
33 |
-
"anchor.href": {
|
34 |
-
"type": "string",
|
35 |
-
"selector": "a",
|
36 |
-
"attribute": "href"
|
37 |
-
},
|
38 |
-
"anchor.rel": {
|
39 |
-
"type": "string",
|
40 |
-
"selector": "a",
|
41 |
-
"attribute": "rel"
|
42 |
-
}
|
43 |
-
}
|
44 |
-
}, {
|
45 |
-
"class": "BoldRule",
|
46 |
-
"selector": "b"
|
47 |
-
}, {
|
48 |
-
"class": "BoldRule",
|
49 |
-
"selector": "strong"
|
50 |
-
}, {
|
51 |
-
"class": "ItalicRule",
|
52 |
-
"selector": "i"
|
53 |
-
}, {
|
54 |
-
"class": "ItalicRule",
|
55 |
-
"selector": "em"
|
56 |
-
}, {
|
57 |
-
"class": "BlockquoteRule",
|
58 |
-
"selector": "blockquote"
|
59 |
-
}, {
|
60 |
-
"class": "PassThroughRule",
|
61 |
-
"selector": "blockquote p"
|
62 |
-
}, {
|
63 |
-
"class": "ImageRule",
|
64 |
-
"selector": "//p[img]",
|
65 |
-
"properties": {
|
66 |
-
"image.url": {
|
67 |
-
"type": "string",
|
68 |
-
"selector": "img",
|
69 |
-
"attribute": "src"
|
70 |
-
}
|
71 |
-
}
|
72 |
-
},{
|
73 |
-
"class": "ImageRule",
|
74 |
-
"selector": "img",
|
75 |
-
"properties": {
|
76 |
-
"image.url": {
|
77 |
-
"type": "string",
|
78 |
-
"selector": "img",
|
79 |
-
"attribute": "src"
|
80 |
-
}
|
81 |
-
}
|
82 |
-
}, {
|
83 |
-
"class": "ListItemRule",
|
84 |
-
"selector" : "li"
|
85 |
-
}, {
|
86 |
-
"class": "ListElementRule",
|
87 |
-
"selector" : "ul"
|
88 |
-
}, {
|
89 |
-
"class": "ListElementRule",
|
90 |
-
"selector" : "ol"
|
91 |
-
}, {
|
92 |
-
"class": "BlockquoteRule",
|
93 |
-
"selector" : "blockquote"
|
94 |
-
}, {
|
95 |
-
"class": "H1Rule",
|
96 |
-
"selector" : "h1",
|
97 |
-
"properties" : {
|
98 |
-
"h1.class" : {
|
99 |
-
"type" : "string",
|
100 |
-
"selector" : "link",
|
101 |
-
"attribute": "class"
|
102 |
-
}
|
103 |
-
}
|
104 |
-
}, {
|
105 |
-
"class": "H1Rule",
|
106 |
-
"selector" : "title"
|
107 |
-
}, {
|
108 |
-
"class": "H2Rule",
|
109 |
-
"selector" : "h2",
|
110 |
-
"properties" : {
|
111 |
-
"h2.class" : {
|
112 |
-
"type" : "string",
|
113 |
-
"selector" : "link",
|
114 |
-
"attribute": "class"
|
115 |
-
}
|
116 |
-
}
|
117 |
-
}, {
|
118 |
-
"class": "H2Rule",
|
119 |
-
"selector" : "h3,h4,h5,h6"
|
120 |
-
}, {
|
121 |
-
"class": "SocialEmbedRule",
|
122 |
-
"selector" : "iframe",
|
123 |
-
"properties" : {
|
124 |
-
"socialembed.url" : {
|
125 |
-
"type" : "string",
|
126 |
-
"selector" : "iframe",
|
127 |
-
"attribute": "src"
|
128 |
-
},
|
129 |
-
"socialembed.iframe" : {
|
130 |
-
"type" : "children",
|
131 |
-
"selector" : "iframe"
|
132 |
-
},
|
133 |
-
"socialembed.caption" : {
|
134 |
-
"type" : "element",
|
135 |
-
"selector" : "figcaption"
|
136 |
-
}
|
137 |
-
}
|
138 |
-
}, {
|
139 |
-
"class": "SocialEmbedRule",
|
140 |
-
"selector" : "//p[iframe]",
|
141 |
-
"properties" : {
|
142 |
-
"socialembed.url" : {
|
143 |
-
"type" : "string",
|
144 |
-
"selector" : "iframe",
|
145 |
-
"attribute": "src"
|
146 |
-
},
|
147 |
-
"socialembed.iframe" : {
|
148 |
-
"type" : "children",
|
149 |
-
"selector" : "iframe"
|
150 |
-
},
|
151 |
-
"socialembed.caption" : {
|
152 |
-
"type" : "element",
|
153 |
-
"selector" : "figcaption"
|
154 |
-
}
|
155 |
-
}
|
156 |
-
}, {
|
157 |
-
"class": "SocialEmbedRule",
|
158 |
-
"selector" : "div.embed",
|
159 |
-
"properties" : {
|
160 |
-
"socialembed.iframe" : {
|
161 |
-
"type" : "children",
|
162 |
-
"selector" : "div.embed"
|
163 |
-
}
|
164 |
-
}
|
165 |
-
}, {
|
166 |
-
"class": "InteractiveRule",
|
167 |
-
"selector" : "div.interactive",
|
168 |
-
"properties" : {
|
169 |
-
"interactive.iframe" : {
|
170 |
-
"type" : "children",
|
171 |
-
"selector" : "div.interactive"
|
172 |
-
},
|
173 |
-
"interactive.height" : {
|
174 |
-
"type" : "int",
|
175 |
-
"selector" : "iframe",
|
176 |
-
"attribute": "height"
|
177 |
-
},
|
178 |
-
"interactive.iframe" : {
|
179 |
-
"type" : "children",
|
180 |
-
"selector" : "iframe"
|
181 |
-
}
|
182 |
-
}
|
183 |
-
}, {
|
184 |
-
"class": "SocialEmbedRule",
|
185 |
-
"selector" : "//div[@class='embed' and iframe]",
|
186 |
-
"properties" : {
|
187 |
-
"socialembed.url" : {
|
188 |
-
"type" : "string",
|
189 |
-
"selector" : "iframe",
|
190 |
-
"attribute": "src"
|
191 |
-
}
|
192 |
-
}
|
193 |
-
}, {
|
194 |
-
"class": "InteractiveRule",
|
195 |
-
"selector" : "//div[@class='interactive' and iframe]",
|
196 |
-
"properties" : {
|
197 |
-
"interactive.url" : {
|
198 |
-
"type" : "string",
|
199 |
-
"selector" : "iframe",
|
200 |
-
"attribute": "src"
|
201 |
-
}
|
202 |
-
}
|
203 |
-
}, {
|
204 |
-
"class": "ImageRule",
|
205 |
-
"selector": "//p[a[img]]|//a[img]",
|
206 |
-
"properties": {
|
207 |
-
"image.url": {
|
208 |
-
"type": "string",
|
209 |
-
"selector": "img",
|
210 |
-
"attribute": "src"
|
211 |
-
}
|
212 |
-
}
|
213 |
-
}, {
|
214 |
-
"class": "SlideshowImageRule",
|
215 |
-
"selector" : "figure",
|
216 |
-
"properties" : {
|
217 |
-
"image.url" : {
|
218 |
-
"type" : "string",
|
219 |
-
"selector" : "img",
|
220 |
-
"attribute": "src"
|
221 |
-
},
|
222 |
-
"caption.title" : {
|
223 |
-
"type" : "string",
|
224 |
-
"selector" : "figcaption"
|
225 |
-
}
|
226 |
-
}
|
227 |
-
}, {
|
228 |
-
"class": "SlideshowRule",
|
229 |
-
"selector" : "div.gallery"
|
230 |
-
}, {
|
231 |
-
"class": "CaptionRule",
|
232 |
-
"selector" : "figcaption"
|
233 |
-
},
|
234 |
-
{
|
235 |
-
"class": "ImageRule",
|
236 |
-
"selector" : "figure",
|
237 |
-
"properties" : {
|
238 |
-
"image.url" : {
|
239 |
-
"type" : "string",
|
240 |
-
"selector" : "img",
|
241 |
-
"attribute": "src"
|
242 |
-
}
|
243 |
-
}
|
244 |
-
}, {
|
245 |
-
"class": "VideoRule",
|
246 |
-
"selector" : "div.wp-video",
|
247 |
-
"containsChild": "video",
|
248 |
-
"properties" : {
|
249 |
-
"video.url" : {
|
250 |
-
"type" : "string",
|
251 |
-
"selector" : "source",
|
252 |
-
"attribute": "src"
|
253 |
-
},
|
254 |
-
"video.type" : {
|
255 |
-
"type" : "string",
|
256 |
-
"selector" : "source",
|
257 |
-
"attribute": "type"
|
258 |
-
}
|
259 |
-
}
|
260 |
-
}, {
|
261 |
-
"class": "InteractiveRule",
|
262 |
-
"selector" : "table",
|
263 |
-
"properties" : {
|
264 |
-
"interactive.iframe" : {
|
265 |
-
"type" : "element",
|
266 |
-
"selector" : "table"
|
267 |
-
}
|
268 |
-
}
|
269 |
-
}]
|
270 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/LICENSE
DELETED
@@ -1,19 +0,0 @@
|
|
1 |
-
Copyright 2016 Facebook, Inc.
|
2 |
-
|
3 |
-
You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
4 |
-
use, copy, modify, and distribute this software in source code or binary
|
5 |
-
form for use in connection with the web services and APIs provided by
|
6 |
-
Facebook.
|
7 |
-
|
8 |
-
As with any software that integrates with the Facebook platform, your use
|
9 |
-
of this software is subject to the Facebook Developer Principles and
|
10 |
-
Policies [http://developers.facebook.com/policy/]. This copyright notice
|
11 |
-
shall be included in all copies or substantial portions of the software.
|
12 |
-
|
13 |
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
16 |
-
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
18 |
-
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
19 |
-
DEALINGS IN THE SOFTWARE.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/composer.json
DELETED
@@ -1,41 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"name": "facebook/php-sdk-v4",
|
3 |
-
"description": "Facebook SDK for PHP",
|
4 |
-
"keywords": ["facebook", "sdk"],
|
5 |
-
"type": "library",
|
6 |
-
"homepage": "https://github.com/facebook/facebook-php-sdk-v4",
|
7 |
-
"license": "Facebook Platform",
|
8 |
-
"authors": [
|
9 |
-
{
|
10 |
-
"name": "Facebook",
|
11 |
-
"homepage": "https://github.com/facebook/facebook-php-sdk-v4/contributors"
|
12 |
-
}
|
13 |
-
],
|
14 |
-
"require": {
|
15 |
-
"php": "^5.4|^7.0"
|
16 |
-
},
|
17 |
-
"require-dev": {
|
18 |
-
"phpunit/phpunit": "~4.0",
|
19 |
-
"mockery/mockery": "~0.8",
|
20 |
-
"guzzlehttp/guzzle": "~5.0"
|
21 |
-
},
|
22 |
-
"suggest": {
|
23 |
-
"guzzlehttp/guzzle": "Allows for implementation of the Guzzle HTTP client"
|
24 |
-
},
|
25 |
-
"autoload": {
|
26 |
-
"psr-4": {
|
27 |
-
"Facebook\\": "src/Facebook/"
|
28 |
-
},
|
29 |
-
"files": ["src/Facebook/polyfills.php"]
|
30 |
-
},
|
31 |
-
"autoload-dev": {
|
32 |
-
"psr-4": {
|
33 |
-
"Facebook\\Tests\\": "tests/"
|
34 |
-
}
|
35 |
-
},
|
36 |
-
"extra": {
|
37 |
-
"branch-alias": {
|
38 |
-
"dev-master": "5.x-dev"
|
39 |
-
}
|
40 |
-
}
|
41 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/Authentication/AccessToken.php
DELETED
@@ -1,160 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\Authentication;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Class AccessToken
|
28 |
-
*
|
29 |
-
* @package Facebook
|
30 |
-
*/
|
31 |
-
class AccessToken
|
32 |
-
{
|
33 |
-
/**
|
34 |
-
* The access token value.
|
35 |
-
*
|
36 |
-
* @var string
|
37 |
-
*/
|
38 |
-
protected $value = '';
|
39 |
-
|
40 |
-
/**
|
41 |
-
* Date when token expires.
|
42 |
-
*
|
43 |
-
* @var \DateTime|null
|
44 |
-
*/
|
45 |
-
protected $expiresAt;
|
46 |
-
|
47 |
-
/**
|
48 |
-
* Create a new access token entity.
|
49 |
-
*
|
50 |
-
* @param string $accessToken
|
51 |
-
* @param int $expiresAt
|
52 |
-
*/
|
53 |
-
public function __construct($accessToken, $expiresAt = 0)
|
54 |
-
{
|
55 |
-
$this->value = $accessToken;
|
56 |
-
if ($expiresAt) {
|
57 |
-
$this->setExpiresAtFromTimeStamp($expiresAt);
|
58 |
-
}
|
59 |
-
}
|
60 |
-
|
61 |
-
/**
|
62 |
-
* Generate an app secret proof to sign a request to Graph.
|
63 |
-
*
|
64 |
-
* @param string $appSecret The app secret.
|
65 |
-
*
|
66 |
-
* @return string
|
67 |
-
*/
|
68 |
-
public function getAppSecretProof($appSecret)
|
69 |
-
{
|
70 |
-
return hash_hmac('sha256', $this->value, $appSecret);
|
71 |
-
}
|
72 |
-
|
73 |
-
/**
|
74 |
-
* Getter for expiresAt.
|
75 |
-
*
|
76 |
-
* @return \DateTime|null
|
77 |
-
*/
|
78 |
-
public function getExpiresAt()
|
79 |
-
{
|
80 |
-
return $this->expiresAt;
|
81 |
-
}
|
82 |
-
|
83 |
-
/**
|
84 |
-
* Determines whether or not this is an app access token.
|
85 |
-
*
|
86 |
-
* @return bool
|
87 |
-
*/
|
88 |
-
public function isAppAccessToken()
|
89 |
-
{
|
90 |
-
return strpos($this->value, '|') !== false;
|
91 |
-
}
|
92 |
-
|
93 |
-
/**
|
94 |
-
* Determines whether or not this is a long-lived token.
|
95 |
-
*
|
96 |
-
* @return bool
|
97 |
-
*/
|
98 |
-
public function isLongLived()
|
99 |
-
{
|
100 |
-
if ($this->expiresAt) {
|
101 |
-
return $this->expiresAt->getTimestamp() > time() + (60 * 60 * 2);
|
102 |
-
}
|
103 |
-
|
104 |
-
if ($this->isAppAccessToken()) {
|
105 |
-
return true;
|
106 |
-
}
|
107 |
-
|
108 |
-
return false;
|
109 |
-
}
|
110 |
-
|
111 |
-
/**
|
112 |
-
* Checks the expiration of the access token.
|
113 |
-
*
|
114 |
-
* @return boolean|null
|
115 |
-
*/
|
116 |
-
public function isExpired()
|
117 |
-
{
|
118 |
-
if ($this->getExpiresAt() instanceof \DateTime) {
|
119 |
-
return $this->getExpiresAt()->getTimestamp() < time();
|
120 |
-
}
|
121 |
-
|
122 |
-
if ($this->isAppAccessToken()) {
|
123 |
-
return false;
|
124 |
-
}
|
125 |
-
|
126 |
-
return null;
|
127 |
-
}
|
128 |
-
|
129 |
-
/**
|
130 |
-
* Returns the access token as a string.
|
131 |
-
*
|
132 |
-
* @return string
|
133 |
-
*/
|
134 |
-
public function getValue()
|
135 |
-
{
|
136 |
-
return $this->value;
|
137 |
-
}
|
138 |
-
|
139 |
-
/**
|
140 |
-
* Returns the access token as a string.
|
141 |
-
*
|
142 |
-
* @return string
|
143 |
-
*/
|
144 |
-
public function __toString()
|
145 |
-
{
|
146 |
-
return $this->getValue();
|
147 |
-
}
|
148 |
-
|
149 |
-
/**
|
150 |
-
* Setter for expires_at.
|
151 |
-
*
|
152 |
-
* @param int $timeStamp
|
153 |
-
*/
|
154 |
-
protected function setExpiresAtFromTimeStamp($timeStamp)
|
155 |
-
{
|
156 |
-
$dt = new \DateTime();
|
157 |
-
$dt->setTimestamp($timeStamp);
|
158 |
-
$this->expiresAt = $dt;
|
159 |
-
}
|
160 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/Authentication/AccessTokenMetadata.php
DELETED
@@ -1,390 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\Authentication;
|
25 |
-
|
26 |
-
use Facebook\Exceptions\FacebookSDKException;
|
27 |
-
|
28 |
-
/**
|
29 |
-
* Class AccessTokenMetadata
|
30 |
-
*
|
31 |
-
* Represents metadata from an access token.
|
32 |
-
*
|
33 |
-
* @package Facebook
|
34 |
-
* @see https://developers.facebook.com/docs/graph-api/reference/debug_token
|
35 |
-
*/
|
36 |
-
class AccessTokenMetadata
|
37 |
-
{
|
38 |
-
/**
|
39 |
-
* The access token metadata.
|
40 |
-
*
|
41 |
-
* @var array
|
42 |
-
*/
|
43 |
-
protected $metadata = [];
|
44 |
-
|
45 |
-
/**
|
46 |
-
* Properties that should be cast as DateTime objects.
|
47 |
-
*
|
48 |
-
* @var array
|
49 |
-
*/
|
50 |
-
protected static $dateProperties = ['expires_at', 'issued_at'];
|
51 |
-
|
52 |
-
/**
|
53 |
-
* @param array $metadata
|
54 |
-
*
|
55 |
-
* @throws FacebookSDKException
|
56 |
-
*/
|
57 |
-
public function __construct(array $metadata)
|
58 |
-
{
|
59 |
-
if (!isset($metadata['data'])) {
|
60 |
-
throw new FacebookSDKException('Unexpected debug token response data.', 401);
|
61 |
-
}
|
62 |
-
|
63 |
-
$this->metadata = $metadata['data'];
|
64 |
-
|
65 |
-
$this->castTimestampsToDateTime();
|
66 |
-
}
|
67 |
-
|
68 |
-
/**
|
69 |
-
* Returns a value from the metadata.
|
70 |
-
*
|
71 |
-
* @param string $field The property to retrieve.
|
72 |
-
* @param mixed $default The default to return if the property doesn't exist.
|
73 |
-
*
|
74 |
-
* @return mixed
|
75 |
-
*/
|
76 |
-
public function getField($field, $default = null)
|
77 |
-
{
|
78 |
-
if (isset($this->metadata[$field])) {
|
79 |
-
return $this->metadata[$field];
|
80 |
-
}
|
81 |
-
|
82 |
-
return $default;
|
83 |
-
}
|
84 |
-
|
85 |
-
/**
|
86 |
-
* Returns a value from the metadata.
|
87 |
-
*
|
88 |
-
* @param string $field The property to retrieve.
|
89 |
-
* @param mixed $default The default to return if the property doesn't exist.
|
90 |
-
*
|
91 |
-
* @return mixed
|
92 |
-
*
|
93 |
-
* @deprecated 5.0.0 getProperty() has been renamed to getField()
|
94 |
-
* @todo v6: Remove this method
|
95 |
-
*/
|
96 |
-
public function getProperty($field, $default = null)
|
97 |
-
{
|
98 |
-
return $this->getField($field, $default);
|
99 |
-
}
|
100 |
-
|
101 |
-
/**
|
102 |
-
* Returns a value from a child property in the metadata.
|
103 |
-
*
|
104 |
-
* @param string $parentField The parent property.
|
105 |
-
* @param string $field The property to retrieve.
|
106 |
-
* @param mixed $default The default to return if the property doesn't exist.
|
107 |
-
*
|
108 |
-
* @return mixed
|
109 |
-
*/
|
110 |
-
public function getChildProperty($parentField, $field, $default = null)
|
111 |
-
{
|
112 |
-
if (!isset($this->metadata[$parentField])) {
|
113 |
-
return $default;
|
114 |
-
}
|
115 |
-
|
116 |
-
if (!isset($this->metadata[$parentField][$field])) {
|
117 |
-
return $default;
|
118 |
-
}
|
119 |
-
|
120 |
-
return $this->metadata[$parentField][$field];
|
121 |
-
}
|
122 |
-
|
123 |
-
/**
|
124 |
-
* Returns a value from the error metadata.
|
125 |
-
*
|
126 |
-
* @param string $field The property to retrieve.
|
127 |
-
* @param mixed $default The default to return if the property doesn't exist.
|
128 |
-
*
|
129 |
-
* @return mixed
|
130 |
-
*/
|
131 |
-
public function getErrorProperty($field, $default = null)
|
132 |
-
{
|
133 |
-
return $this->getChildProperty('error', $field, $default);
|
134 |
-
}
|
135 |
-
|
136 |
-
/**
|
137 |
-
* Returns a value from the "metadata" metadata. *Brain explodes*
|
138 |
-
*
|
139 |
-
* @param string $field The property to retrieve.
|
140 |
-
* @param mixed $default The default to return if the property doesn't exist.
|
141 |
-
*
|
142 |
-
* @return mixed
|
143 |
-
*/
|
144 |
-
public function getMetadataProperty($field, $default = null)
|
145 |
-
{
|
146 |
-
return $this->getChildProperty('metadata', $field, $default);
|
147 |
-
}
|
148 |
-
|
149 |
-
/**
|
150 |
-
* The ID of the application this access token is for.
|
151 |
-
*
|
152 |
-
* @return string|null
|
153 |
-
*/
|
154 |
-
public function getAppId()
|
155 |
-
{
|
156 |
-
return $this->getField('app_id');
|
157 |
-
}
|
158 |
-
|
159 |
-
/**
|
160 |
-
* Name of the application this access token is for.
|
161 |
-
*
|
162 |
-
* @return string|null
|
163 |
-
*/
|
164 |
-
public function getApplication()
|
165 |
-
{
|
166 |
-
return $this->getField('application');
|
167 |
-
}
|
168 |
-
|
169 |
-
/**
|
170 |
-
* Any error that a request to the graph api
|
171 |
-
* would return due to the access token.
|
172 |
-
*
|
173 |
-
* @return bool|null
|
174 |
-
*/
|
175 |
-
public function isError()
|
176 |
-
{
|
177 |
-
return $this->getField('error') !== null;
|
178 |
-
}
|
179 |
-
|
180 |
-
/**
|
181 |
-
* The error code for the error.
|
182 |
-
*
|
183 |
-
* @return int|null
|
184 |
-
*/
|
185 |
-
public function getErrorCode()
|
186 |
-
{
|
187 |
-
return $this->getErrorProperty('code');
|
188 |
-
}
|
189 |
-
|
190 |
-
/**
|
191 |
-
* The error message for the error.
|
192 |
-
*
|
193 |
-
* @return string|null
|
194 |
-
*/
|
195 |
-
public function getErrorMessage()
|
196 |
-
{
|
197 |
-
return $this->getErrorProperty('message');
|
198 |
-
}
|
199 |
-
|
200 |
-
/**
|
201 |
-
* The error subcode for the error.
|
202 |
-
*
|
203 |
-
* @return int|null
|
204 |
-
*/
|
205 |
-
public function getErrorSubcode()
|
206 |
-
{
|
207 |
-
return $this->getErrorProperty('subcode');
|
208 |
-
}
|
209 |
-
|
210 |
-
/**
|
211 |
-
* DateTime when this access token expires.
|
212 |
-
*
|
213 |
-
* @return \DateTime|null
|
214 |
-
*/
|
215 |
-
public function getExpiresAt()
|
216 |
-
{
|
217 |
-
return $this->getField('expires_at');
|
218 |
-
}
|
219 |
-
|
220 |
-
/**
|
221 |
-
* Whether the access token is still valid or not.
|
222 |
-
*
|
223 |
-
* @return boolean|null
|
224 |
-
*/
|
225 |
-
public function getIsValid()
|
226 |
-
{
|
227 |
-
return $this->getField('is_valid');
|
228 |
-
}
|
229 |
-
|
230 |
-
/**
|
231 |
-
* DateTime when this access token was issued.
|
232 |
-
*
|
233 |
-
* Note that the issued_at field is not returned
|
234 |
-
* for short-lived access tokens.
|
235 |
-
*
|
236 |
-
* @see https://developers.facebook.com/docs/facebook-login/access-tokens#debug
|
237 |
-
*
|
238 |
-
* @return \DateTime|null
|
239 |
-
*/
|
240 |
-
public function getIssuedAt()
|
241 |
-
{
|
242 |
-
return $this->getField('issued_at');
|
243 |
-
}
|
244 |
-
|
245 |
-
/**
|
246 |
-
* General metadata associated with the access token.
|
247 |
-
* Can contain data like 'sso', 'auth_type', 'auth_nonce'.
|
248 |
-
*
|
249 |
-
* @return array|null
|
250 |
-
*/
|
251 |
-
public function getMetadata()
|
252 |
-
{
|
253 |
-
return $this->getField('metadata');
|
254 |
-
}
|
255 |
-
|
256 |
-
/**
|
257 |
-
* The 'sso' child property from the 'metadata' parent property.
|
258 |
-
*
|
259 |
-
* @return string|null
|
260 |
-
*/
|
261 |
-
public function getSso()
|
262 |
-
{
|
263 |
-
return $this->getMetadataProperty('sso');
|
264 |
-
}
|
265 |
-
|
266 |
-
/**
|
267 |
-
* The 'auth_type' child property from the 'metadata' parent property.
|
268 |
-
*
|
269 |
-
* @return string|null
|
270 |
-
*/
|
271 |
-
public function getAuthType()
|
272 |
-
{
|
273 |
-
return $this->getMetadataProperty('auth_type');
|
274 |
-
}
|
275 |
-
|
276 |
-
/**
|
277 |
-
* The 'auth_nonce' child property from the 'metadata' parent property.
|
278 |
-
*
|
279 |
-
* @return string|null
|
280 |
-
*/
|
281 |
-
public function getAuthNonce()
|
282 |
-
{
|
283 |
-
return $this->getMetadataProperty('auth_nonce');
|
284 |
-
}
|
285 |
-
|
286 |
-
/**
|
287 |
-
* For impersonated access tokens, the ID of
|
288 |
-
* the page this token contains.
|
289 |
-
*
|
290 |
-
* @return string|null
|
291 |
-
*/
|
292 |
-
public function getProfileId()
|
293 |
-
{
|
294 |
-
return $this->getField('profile_id');
|
295 |
-
}
|
296 |
-
|
297 |
-
/**
|
298 |
-
* List of permissions that the user has granted for
|
299 |
-
* the app in this access token.
|
300 |
-
*
|
301 |
-
* @return array
|
302 |
-
*/
|
303 |
-
public function getScopes()
|
304 |
-
{
|
305 |
-
return $this->getField('scopes');
|
306 |
-
}
|
307 |
-
|
308 |
-
/**
|
309 |
-
* The ID of the user this access token is for.
|
310 |
-
*
|
311 |
-
* @return string|null
|
312 |
-
*/
|
313 |
-
public function getUserId()
|
314 |
-
{
|
315 |
-
return $this->getField('user_id');
|
316 |
-
}
|
317 |
-
|
318 |
-
/**
|
319 |
-
* Ensures the app ID from the access token
|
320 |
-
* metadata is what we expect.
|
321 |
-
*
|
322 |
-
* @param string $appId
|
323 |
-
*
|
324 |
-
* @throws FacebookSDKException
|
325 |
-
*/
|
326 |
-
public function validateAppId($appId)
|
327 |
-
{
|
328 |
-
if ($this->getAppId() !== $appId) {
|
329 |
-
throw new FacebookSDKException('Access token metadata contains unexpected app ID.', 401);
|
330 |
-
}
|
331 |
-
}
|
332 |
-
|
333 |
-
/**
|
334 |
-
* Ensures the user ID from the access token
|
335 |
-
* metadata is what we expect.
|
336 |
-
*
|
337 |
-
* @param string $userId
|
338 |
-
*
|
339 |
-
* @throws FacebookSDKException
|
340 |
-
*/
|
341 |
-
public function validateUserId($userId)
|
342 |
-
{
|
343 |
-
if ($this->getUserId() !== $userId) {
|
344 |
-
throw new FacebookSDKException('Access token metadata contains unexpected user ID.', 401);
|
345 |
-
}
|
346 |
-
}
|
347 |
-
|
348 |
-
/**
|
349 |
-
* Ensures the access token has not expired yet.
|
350 |
-
*
|
351 |
-
* @throws FacebookSDKException
|
352 |
-
*/
|
353 |
-
public function validateExpiration()
|
354 |
-
{
|
355 |
-
if (!$this->getExpiresAt() instanceof \DateTime) {
|
356 |
-
return;
|
357 |
-
}
|
358 |
-
|
359 |
-
if ($this->getExpiresAt()->getTimestamp() < time()) {
|
360 |
-
throw new FacebookSDKException('Inspection of access token metadata shows that the access token has expired.', 401);
|
361 |
-
}
|
362 |
-
}
|
363 |
-
|
364 |
-
/**
|
365 |
-
* Converts a unix timestamp into a DateTime entity.
|
366 |
-
*
|
367 |
-
* @param int $timestamp
|
368 |
-
*
|
369 |
-
* @return \DateTime
|
370 |
-
*/
|
371 |
-
private function convertTimestampToDateTime($timestamp)
|
372 |
-
{
|
373 |
-
$dt = new \DateTime();
|
374 |
-
$dt->setTimestamp($timestamp);
|
375 |
-
|
376 |
-
return $dt;
|
377 |
-
}
|
378 |
-
|
379 |
-
/**
|
380 |
-
* Casts the unix timestamps as DateTime entities.
|
381 |
-
*/
|
382 |
-
private function castTimestampsToDateTime()
|
383 |
-
{
|
384 |
-
foreach (static::$dateProperties as $key) {
|
385 |
-
if (isset($this->metadata[$key]) && $this->metadata[$key] !== 0) {
|
386 |
-
$this->metadata[$key] = $this->convertTimestampToDateTime($this->metadata[$key]);
|
387 |
-
}
|
388 |
-
}
|
389 |
-
}
|
390 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/Authentication/OAuth2Client.php
DELETED
@@ -1,292 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\Authentication;
|
25 |
-
|
26 |
-
use Facebook\Facebook;
|
27 |
-
use Facebook\FacebookApp;
|
28 |
-
use Facebook\FacebookRequest;
|
29 |
-
use Facebook\FacebookResponse;
|
30 |
-
use Facebook\FacebookClient;
|
31 |
-
use Facebook\Exceptions\FacebookResponseException;
|
32 |
-
use Facebook\Exceptions\FacebookSDKException;
|
33 |
-
|
34 |
-
/**
|
35 |
-
* Class OAuth2Client
|
36 |
-
*
|
37 |
-
* @package Facebook
|
38 |
-
*/
|
39 |
-
class OAuth2Client
|
40 |
-
{
|
41 |
-
/**
|
42 |
-
* @const string The base authorization URL.
|
43 |
-
*/
|
44 |
-
const BASE_AUTHORIZATION_URL = 'https://www.facebook.com';
|
45 |
-
|
46 |
-
/**
|
47 |
-
* The FacebookApp entity.
|
48 |
-
*
|
49 |
-
* @var FacebookApp
|
50 |
-
*/
|
51 |
-
protected $app;
|
52 |
-
|
53 |
-
/**
|
54 |
-
* The Facebook client.
|
55 |
-
*
|
56 |
-
* @var FacebookClient
|
57 |
-
*/
|
58 |
-
protected $client;
|
59 |
-
|
60 |
-
/**
|
61 |
-
* The version of the Graph API to use.
|
62 |
-
*
|
63 |
-
* @var string
|
64 |
-
*/
|
65 |
-
protected $graphVersion;
|
66 |
-
|
67 |
-
/**
|
68 |
-
* The last request sent to Graph.
|
69 |
-
*
|
70 |
-
* @var FacebookRequest|null
|
71 |
-
*/
|
72 |
-
protected $lastRequest;
|
73 |
-
|
74 |
-
/**
|
75 |
-
* @param FacebookApp $app
|
76 |
-
* @param FacebookClient $client
|
77 |
-
* @param string|null $graphVersion The version of the Graph API to use.
|
78 |
-
*/
|
79 |
-
public function __construct(FacebookApp $app, FacebookClient $client, $graphVersion = null)
|
80 |
-
{
|
81 |
-
$this->app = $app;
|
82 |
-
$this->client = $client;
|
83 |
-
$this->graphVersion = $graphVersion ?: Facebook::DEFAULT_GRAPH_VERSION;
|
84 |
-
}
|
85 |
-
|
86 |
-
/**
|
87 |
-
* Returns the last FacebookRequest that was sent.
|
88 |
-
* Useful for debugging and testing.
|
89 |
-
*
|
90 |
-
* @return FacebookRequest|null
|
91 |
-
*/
|
92 |
-
public function getLastRequest()
|
93 |
-
{
|
94 |
-
return $this->lastRequest;
|
95 |
-
}
|
96 |
-
|
97 |
-
/**
|
98 |
-
* Get the metadata associated with the access token.
|
99 |
-
*
|
100 |
-
* @param AccessToken|string $accessToken The access token to debug.
|
101 |
-
*
|
102 |
-
* @return AccessTokenMetadata
|
103 |
-
*/
|
104 |
-
public function debugToken($accessToken)
|
105 |
-
{
|
106 |
-
$accessToken = $accessToken instanceof AccessToken ? $accessToken->getValue() : $accessToken;
|
107 |
-
$params = ['input_token' => $accessToken];
|
108 |
-
|
109 |
-
$this->lastRequest = new FacebookRequest(
|
110 |
-
$this->app,
|
111 |
-
$this->app->getAccessToken(),
|
112 |
-
'GET',
|
113 |
-
'/debug_token',
|
114 |
-
$params,
|
115 |
-
null,
|
116 |
-
$this->graphVersion
|
117 |
-
);
|
118 |
-
$response = $this->client->sendRequest($this->lastRequest);
|
119 |
-
$metadata = $response->getDecodedBody();
|
120 |
-
|
121 |
-
return new AccessTokenMetadata($metadata);
|
122 |
-
}
|
123 |
-
|
124 |
-
/**
|
125 |
-
* Generates an authorization URL to begin the process of authenticating a user.
|
126 |
-
*
|
127 |
-
* @param string $redirectUrl The callback URL to redirect to.
|
128 |
-
* @param array $scope An array of permissions to request.
|
129 |
-
* @param string $state The CSPRNG-generated CSRF value.
|
130 |
-
* @param array $params An array of parameters to generate URL.
|
131 |
-
* @param string $separator The separator to use in http_build_query().
|
132 |
-
*
|
133 |
-
* @return string
|
134 |
-
*/
|
135 |
-
public function getAuthorizationUrl($redirectUrl, $state, array $scope = [], array $params = [], $separator = '&')
|
136 |
-
{
|
137 |
-
$params += [
|
138 |
-
'client_id' => $this->app->getId(),
|
139 |
-
'state' => $state,
|
140 |
-
'response_type' => 'code',
|
141 |
-
'sdk' => 'php-sdk-' . Facebook::VERSION,
|
142 |
-
'redirect_uri' => $redirectUrl,
|
143 |
-
'scope' => implode(',', $scope)
|
144 |
-
];
|
145 |
-
|
146 |
-
return static::BASE_AUTHORIZATION_URL . '/' . $this->graphVersion . '/dialog/oauth?' . http_build_query($params, null, $separator);
|
147 |
-
}
|
148 |
-
|
149 |
-
/**
|
150 |
-
* Get a valid access token from a code.
|
151 |
-
*
|
152 |
-
* @param string $code
|
153 |
-
* @param string $redirectUri
|
154 |
-
*
|
155 |
-
* @return AccessToken
|
156 |
-
*
|
157 |
-
* @throws FacebookSDKException
|
158 |
-
*/
|
159 |
-
public function getAccessTokenFromCode($code, $redirectUri = '')
|
160 |
-
{
|
161 |
-
$params = [
|
162 |
-
'code' => $code,
|
163 |
-
'redirect_uri' => $redirectUri,
|
164 |
-
];
|
165 |
-
|
166 |
-
return $this->requestAnAccessToken($params);
|
167 |
-
}
|
168 |
-
|
169 |
-
/**
|
170 |
-
* Exchanges a short-lived access token with a long-lived access token.
|
171 |
-
*
|
172 |
-
* @param AccessToken|string $accessToken
|
173 |
-
*
|
174 |
-
* @return AccessToken
|
175 |
-
*
|
176 |
-
* @throws FacebookSDKException
|
177 |
-
*/
|
178 |
-
public function getLongLivedAccessToken($accessToken)
|
179 |
-
{
|
180 |
-
$accessToken = $accessToken instanceof AccessToken ? $accessToken->getValue() : $accessToken;
|
181 |
-
$params = [
|
182 |
-
'grant_type' => 'fb_exchange_token',
|
183 |
-
'fb_exchange_token' => $accessToken,
|
184 |
-
];
|
185 |
-
|
186 |
-
return $this->requestAnAccessToken($params);
|
187 |
-
}
|
188 |
-
|
189 |
-
/**
|
190 |
-
* Get a valid code from an access token.
|
191 |
-
*
|
192 |
-
* @param AccessToken|string $accessToken
|
193 |
-
* @param string $redirectUri
|
194 |
-
*
|
195 |
-
* @return AccessToken
|
196 |
-
*
|
197 |
-
* @throws FacebookSDKException
|
198 |
-
*/
|
199 |
-
public function getCodeFromLongLivedAccessToken($accessToken, $redirectUri = '')
|
200 |
-
{
|
201 |
-
$params = [
|
202 |
-
'redirect_uri' => $redirectUri,
|
203 |
-
];
|
204 |
-
|
205 |
-
$response = $this->sendRequestWithClientParams('/oauth/client_code', $params, $accessToken);
|
206 |
-
$data = $response->getDecodedBody();
|
207 |
-
|
208 |
-
if (!isset($data['code'])) {
|
209 |
-
throw new FacebookSDKException('Code was not returned from Graph.', 401);
|
210 |
-
}
|
211 |
-
|
212 |
-
return $data['code'];
|
213 |
-
}
|
214 |
-
|
215 |
-
/**
|
216 |
-
* Send a request to the OAuth endpoint.
|
217 |
-
*
|
218 |
-
* @param array $params
|
219 |
-
*
|
220 |
-
* @return AccessToken
|
221 |
-
*
|
222 |
-
* @throws FacebookSDKException
|
223 |
-
*/
|
224 |
-
protected function requestAnAccessToken(array $params)
|
225 |
-
{
|
226 |
-
$response = $this->sendRequestWithClientParams('/oauth/access_token', $params);
|
227 |
-
$data = $response->getDecodedBody();
|
228 |
-
|
229 |
-
if (!isset($data['access_token'])) {
|
230 |
-
throw new FacebookSDKException('Access token was not returned from Graph.', 401);
|
231 |
-
}
|
232 |
-
|
233 |
-
// Graph returns two different key names for expiration time
|
234 |
-
// on the same endpoint. Doh! :/
|
235 |
-
$expiresAt = 0;
|
236 |
-
if (isset($data['expires'])) {
|
237 |
-
// For exchanging a short lived token with a long lived token.
|
238 |
-
// The expiration time in seconds will be returned as "expires".
|
239 |
-
$expiresAt = time() + $data['expires'];
|
240 |
-
} elseif (isset($data['expires_in'])) {
|
241 |
-
// For exchanging a code for a short lived access token.
|
242 |
-
// The expiration time in seconds will be returned as "expires_in".
|
243 |
-
// See: https://developers.facebook.com/docs/facebook-login/access-tokens#long-via-code
|
244 |
-
$expiresAt = time() + $data['expires_in'];
|
245 |
-
}
|
246 |
-
|
247 |
-
return new AccessToken($data['access_token'], $expiresAt);
|
248 |
-
}
|
249 |
-
|
250 |
-
/**
|
251 |
-
* Send a request to Graph with an app access token.
|
252 |
-
*
|
253 |
-
* @param string $endpoint
|
254 |
-
* @param array $params
|
255 |
-
* @param AccessToken|string|null $accessToken
|
256 |
-
*
|
257 |
-
* @return FacebookResponse
|
258 |
-
*
|
259 |
-
* @throws FacebookResponseException
|
260 |
-
*/
|
261 |
-
protected function sendRequestWithClientParams($endpoint, array $params, $accessToken = null)
|
262 |
-
{
|
263 |
-
$params += $this->getClientParams();
|
264 |
-
|
265 |
-
$accessToken = $accessToken ?: $this->app->getAccessToken();
|
266 |
-
|
267 |
-
$this->lastRequest = new FacebookRequest(
|
268 |
-
$this->app,
|
269 |
-
$accessToken,
|
270 |
-
'GET',
|
271 |
-
$endpoint,
|
272 |
-
$params,
|
273 |
-
null,
|
274 |
-
$this->graphVersion
|
275 |
-
);
|
276 |
-
|
277 |
-
return $this->client->sendRequest($this->lastRequest);
|
278 |
-
}
|
279 |
-
|
280 |
-
/**
|
281 |
-
* Returns the client_* params for OAuth requests.
|
282 |
-
*
|
283 |
-
* @return array
|
284 |
-
*/
|
285 |
-
protected function getClientParams()
|
286 |
-
{
|
287 |
-
return [
|
288 |
-
'client_id' => $this->app->getId(),
|
289 |
-
'client_secret' => $this->app->getSecret(),
|
290 |
-
];
|
291 |
-
}
|
292 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/Exceptions/FacebookAuthenticationException.php
DELETED
@@ -1,33 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\Exceptions;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Class FacebookAuthenticationException
|
28 |
-
*
|
29 |
-
* @package Facebook
|
30 |
-
*/
|
31 |
-
class FacebookAuthenticationException extends FacebookSDKException
|
32 |
-
{
|
33 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/Exceptions/FacebookAuthorizationException.php
DELETED
@@ -1,33 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\Exceptions;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Class FacebookAuthorizationException
|
28 |
-
*
|
29 |
-
* @package Facebook
|
30 |
-
*/
|
31 |
-
class FacebookAuthorizationException extends FacebookSDKException
|
32 |
-
{
|
33 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/Exceptions/FacebookClientException.php
DELETED
@@ -1,33 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\Exceptions;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Class FacebookClientException
|
28 |
-
*
|
29 |
-
* @package Facebook
|
30 |
-
*/
|
31 |
-
class FacebookClientException extends FacebookSDKException
|
32 |
-
{
|
33 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/Exceptions/FacebookOtherException.php
DELETED
@@ -1,33 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\Exceptions;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Class FacebookOtherException
|
28 |
-
*
|
29 |
-
* @package Facebook
|
30 |
-
*/
|
31 |
-
class FacebookOtherException extends FacebookSDKException
|
32 |
-
{
|
33 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/Exceptions/FacebookResponseException.php
DELETED
@@ -1,214 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\Exceptions;
|
25 |
-
|
26 |
-
use Facebook\FacebookResponse;
|
27 |
-
|
28 |
-
/**
|
29 |
-
* Class FacebookResponseException
|
30 |
-
*
|
31 |
-
* @package Facebook
|
32 |
-
*/
|
33 |
-
class FacebookResponseException extends FacebookSDKException
|
34 |
-
{
|
35 |
-
/**
|
36 |
-
* @var FacebookResponse The response that threw the exception.
|
37 |
-
*/
|
38 |
-
protected $response;
|
39 |
-
|
40 |
-
/**
|
41 |
-
* @var array Decoded response.
|
42 |
-
*/
|
43 |
-
protected $responseData;
|
44 |
-
|
45 |
-
/**
|
46 |
-
* Creates a FacebookResponseException.
|
47 |
-
*
|
48 |
-
* @param FacebookResponse $response The response that threw the exception.
|
49 |
-
* @param FacebookSDKException $previousException The more detailed exception.
|
50 |
-
*/
|
51 |
-
public function __construct(FacebookResponse $response, FacebookSDKException $previousException = null)
|
52 |
-
{
|
53 |
-
$this->response = $response;
|
54 |
-
$this->responseData = $response->getDecodedBody();
|
55 |
-
|
56 |
-
$errorMessage = $this->get('message', 'Unknown error from Graph.');
|
57 |
-
$errorCode = $this->get('code', -1);
|
58 |
-
|
59 |
-
parent::__construct($errorMessage, $errorCode, $previousException);
|
60 |
-
}
|
61 |
-
|
62 |
-
/**
|
63 |
-
* A factory for creating the appropriate exception based on the response from Graph.
|
64 |
-
*
|
65 |
-
* @param FacebookResponse $response The response that threw the exception.
|
66 |
-
*
|
67 |
-
* @return FacebookResponseException
|
68 |
-
*/
|
69 |
-
public static function create(FacebookResponse $response)
|
70 |
-
{
|
71 |
-
$data = $response->getDecodedBody();
|
72 |
-
|
73 |
-
if (!isset($data['error']['code']) && isset($data['code'])) {
|
74 |
-
$data = ['error' => $data];
|
75 |
-
}
|
76 |
-
|
77 |
-
$code = isset($data['error']['code']) ? $data['error']['code'] : null;
|
78 |
-
$message = isset($data['error']['message']) ? $data['error']['message'] : 'Unknown error from Graph.';
|
79 |
-
|
80 |
-
if (isset($data['error']['error_subcode'])) {
|
81 |
-
switch ($data['error']['error_subcode']) {
|
82 |
-
// Other authentication issues
|
83 |
-
case 458:
|
84 |
-
case 459:
|
85 |
-
case 460:
|
86 |
-
case 463:
|
87 |
-
case 464:
|
88 |
-
case 467:
|
89 |
-
return new static($response, new FacebookAuthenticationException($message, $code));
|
90 |
-
// Video upload resumable error
|
91 |
-
case 1363030:
|
92 |
-
case 1363019:
|
93 |
-
case 1363037:
|
94 |
-
case 1363033:
|
95 |
-
case 1363021:
|
96 |
-
case 1363041:
|
97 |
-
return new static($response, new FacebookResumableUploadException($message, $code));
|
98 |
-
}
|
99 |
-
}
|
100 |
-
|
101 |
-
switch ($code) {
|
102 |
-
// Login status or token expired, revoked, or invalid
|
103 |
-
case 100:
|
104 |
-
case 102:
|
105 |
-
case 190:
|
106 |
-
return new static($response, new FacebookAuthenticationException($message, $code));
|
107 |
-
|
108 |
-
// Server issue, possible downtime
|
109 |
-
case 1:
|
110 |
-
case 2:
|
111 |
-
return new static($response, new FacebookServerException($message, $code));
|
112 |
-
|
113 |
-
// API Throttling
|
114 |
-
case 4:
|
115 |
-
case 17:
|
116 |
-
case 341:
|
117 |
-
return new static($response, new FacebookThrottleException($message, $code));
|
118 |
-
|
119 |
-
// Duplicate Post
|
120 |
-
case 506:
|
121 |
-
return new static($response, new FacebookClientException($message, $code));
|
122 |
-
}
|
123 |
-
|
124 |
-
// Missing Permissions
|
125 |
-
if ($code == 10 || ($code >= 200 && $code <= 299)) {
|
126 |
-
return new static($response, new FacebookAuthorizationException($message, $code));
|
127 |
-
}
|
128 |
-
|
129 |
-
// OAuth authentication error
|
130 |
-
if (isset($data['error']['type']) && $data['error']['type'] === 'OAuthException') {
|
131 |
-
return new static($response, new FacebookAuthenticationException($message, $code));
|
132 |
-
}
|
133 |
-
|
134 |
-
// All others
|
135 |
-
return new static($response, new FacebookOtherException($message, $code));
|
136 |
-
}
|
137 |
-
|
138 |
-
/**
|
139 |
-
* Checks isset and returns that or a default value.
|
140 |
-
*
|
141 |
-
* @param string $key
|
142 |
-
* @param mixed $default
|
143 |
-
*
|
144 |
-
* @return mixed
|
145 |
-
*/
|
146 |
-
private function get($key, $default = null)
|
147 |
-
{
|
148 |
-
if (isset($this->responseData['error'][$key])) {
|
149 |
-
return $this->responseData['error'][$key];
|
150 |
-
}
|
151 |
-
|
152 |
-
return $default;
|
153 |
-
}
|
154 |
-
|
155 |
-
/**
|
156 |
-
* Returns the HTTP status code
|
157 |
-
*
|
158 |
-
* @return int
|
159 |
-
*/
|
160 |
-
public function getHttpStatusCode()
|
161 |
-
{
|
162 |
-
return $this->response->getHttpStatusCode();
|
163 |
-
}
|
164 |
-
|
165 |
-
/**
|
166 |
-
* Returns the sub-error code
|
167 |
-
*
|
168 |
-
* @return int
|
169 |
-
*/
|
170 |
-
public function getSubErrorCode()
|
171 |
-
{
|
172 |
-
return $this->get('error_subcode', -1);
|
173 |
-
}
|
174 |
-
|
175 |
-
/**
|
176 |
-
* Returns the error type
|
177 |
-
*
|
178 |
-
* @return string
|
179 |
-
*/
|
180 |
-
public function getErrorType()
|
181 |
-
{
|
182 |
-
return $this->get('type', '');
|
183 |
-
}
|
184 |
-
|
185 |
-
/**
|
186 |
-
* Returns the raw response used to create the exception.
|
187 |
-
*
|
188 |
-
* @return string
|
189 |
-
*/
|
190 |
-
public function getRawResponse()
|
191 |
-
{
|
192 |
-
return $this->response->getBody();
|
193 |
-
}
|
194 |
-
|
195 |
-
/**
|
196 |
-
* Returns the decoded response used to create the exception.
|
197 |
-
*
|
198 |
-
* @return array
|
199 |
-
*/
|
200 |
-
public function getResponseData()
|
201 |
-
{
|
202 |
-
return $this->responseData;
|
203 |
-
}
|
204 |
-
|
205 |
-
/**
|
206 |
-
* Returns the response entity used to create the exception.
|
207 |
-
*
|
208 |
-
* @return FacebookResponse
|
209 |
-
*/
|
210 |
-
public function getResponse()
|
211 |
-
{
|
212 |
-
return $this->response;
|
213 |
-
}
|
214 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/Exceptions/FacebookResumableUploadException.php
DELETED
@@ -1,33 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\Exceptions;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Class FacebookResumableUploadException
|
28 |
-
*
|
29 |
-
* @package Facebook
|
30 |
-
*/
|
31 |
-
class FacebookResumableUploadException extends FacebookSDKException
|
32 |
-
{
|
33 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/Exceptions/FacebookSDKException.php
DELETED
@@ -1,33 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\Exceptions;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Class FacebookSDKException
|
28 |
-
*
|
29 |
-
* @package Facebook
|
30 |
-
*/
|
31 |
-
class FacebookSDKException extends \Exception
|
32 |
-
{
|
33 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/Exceptions/FacebookServerException.php
DELETED
@@ -1,33 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\Exceptions;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Class FacebookServerException
|
28 |
-
*
|
29 |
-
* @package Facebook
|
30 |
-
*/
|
31 |
-
class FacebookServerException extends FacebookSDKException
|
32 |
-
{
|
33 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/Exceptions/FacebookThrottleException.php
DELETED
@@ -1,33 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\Exceptions;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Class FacebookThrottleException
|
28 |
-
*
|
29 |
-
* @package Facebook
|
30 |
-
*/
|
31 |
-
class FacebookThrottleException extends FacebookSDKException
|
32 |
-
{
|
33 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/Facebook.php
DELETED
@@ -1,614 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook;
|
25 |
-
|
26 |
-
use Facebook\Authentication\AccessToken;
|
27 |
-
use Facebook\Authentication\OAuth2Client;
|
28 |
-
use Facebook\FileUpload\FacebookFile;
|
29 |
-
use Facebook\FileUpload\FacebookResumableUploader;
|
30 |
-
use Facebook\FileUpload\FacebookTransferChunk;
|
31 |
-
use Facebook\FileUpload\FacebookVideo;
|
32 |
-
use Facebook\GraphNodes\GraphEdge;
|
33 |
-
use Facebook\Url\UrlDetectionInterface;
|
34 |
-
use Facebook\Url\FacebookUrlDetectionHandler;
|
35 |
-
use Facebook\PseudoRandomString\PseudoRandomStringGeneratorFactory;
|
36 |
-
use Facebook\PseudoRandomString\PseudoRandomStringGeneratorInterface;
|
37 |
-
use Facebook\HttpClients\HttpClientsFactory;
|
38 |
-
use Facebook\PersistentData\PersistentDataFactory;
|
39 |
-
use Facebook\PersistentData\PersistentDataInterface;
|
40 |
-
use Facebook\Helpers\FacebookCanvasHelper;
|
41 |
-
use Facebook\Helpers\FacebookJavaScriptHelper;
|
42 |
-
use Facebook\Helpers\FacebookPageTabHelper;
|
43 |
-
use Facebook\Helpers\FacebookRedirectLoginHelper;
|
44 |
-
use Facebook\Exceptions\FacebookSDKException;
|
45 |
-
|
46 |
-
/**
|
47 |
-
* Class Facebook
|
48 |
-
*
|
49 |
-
* @package Facebook
|
50 |
-
*/
|
51 |
-
class Facebook
|
52 |
-
{
|
53 |
-
/**
|
54 |
-
* @const string Version number of the Facebook PHP SDK.
|
55 |
-
*/
|
56 |
-
const VERSION = '5.3.1';
|
57 |
-
|
58 |
-
/**
|
59 |
-
* @const string Default Graph API version for requests.
|
60 |
-
*/
|
61 |
-
const DEFAULT_GRAPH_VERSION = 'v2.7';
|
62 |
-
|
63 |
-
/**
|
64 |
-
* @const string The name of the environment variable that contains the app ID.
|
65 |
-
*/
|
66 |
-
const APP_ID_ENV_NAME = 'FACEBOOK_APP_ID';
|
67 |
-
|
68 |
-
/**
|
69 |
-
* @const string The name of the environment variable that contains the app secret.
|
70 |
-
*/
|
71 |
-
const APP_SECRET_ENV_NAME = 'FACEBOOK_APP_SECRET';
|
72 |
-
|
73 |
-
/**
|
74 |
-
* @var FacebookApp The FacebookApp entity.
|
75 |
-
*/
|
76 |
-
protected $app;
|
77 |
-
|
78 |
-
/**
|
79 |
-
* @var FacebookClient The Facebook client service.
|
80 |
-
*/
|
81 |
-
protected $client;
|
82 |
-
|
83 |
-
/**
|
84 |
-
* @var OAuth2Client The OAuth 2.0 client service.
|
85 |
-
*/
|
86 |
-
protected $oAuth2Client;
|
87 |
-
|
88 |
-
/**
|
89 |
-
* @var UrlDetectionInterface|null The URL detection handler.
|
90 |
-
*/
|
91 |
-
protected $urlDetectionHandler;
|
92 |
-
|
93 |
-
/**
|
94 |
-
* @var PseudoRandomStringGeneratorInterface|null The cryptographically secure pseudo-random string generator.
|
95 |
-
*/
|
96 |
-
protected $pseudoRandomStringGenerator;
|
97 |
-
|
98 |
-
/**
|
99 |
-
* @var AccessToken|null The default access token to use with requests.
|
100 |
-
*/
|
101 |
-
protected $defaultAccessToken;
|
102 |
-
|
103 |
-
/**
|
104 |
-
* @var string|null The default Graph version we want to use.
|
105 |
-
*/
|
106 |
-
protected $defaultGraphVersion;
|
107 |
-
|
108 |
-
/**
|
109 |
-
* @var PersistentDataInterface|null The persistent data handler.
|
110 |
-
*/
|
111 |
-
protected $persistentDataHandler;
|
112 |
-
|
113 |
-
/**
|
114 |
-
* @var FacebookResponse|FacebookBatchResponse|null Stores the last request made to Graph.
|
115 |
-
*/
|
116 |
-
protected $lastResponse;
|
117 |
-
|
118 |
-
/**
|
119 |
-
* Instantiates a new Facebook super-class object.
|
120 |
-
*
|
121 |
-
* @param array $config
|
122 |
-
*
|
123 |
-
* @throws FacebookSDKException
|
124 |
-
*/
|
125 |
-
public function __construct(array $config = [])
|
126 |
-
{
|
127 |
-
$config = array_merge([
|
128 |
-
'app_id' => getenv(static::APP_ID_ENV_NAME),
|
129 |
-
'app_secret' => getenv(static::APP_SECRET_ENV_NAME),
|
130 |
-
'default_graph_version' => static::DEFAULT_GRAPH_VERSION,
|
131 |
-
'enable_beta_mode' => false,
|
132 |
-
'http_client_handler' => null,
|
133 |
-
'persistent_data_handler' => null,
|
134 |
-
'pseudo_random_string_generator' => null,
|
135 |
-
'url_detection_handler' => null,
|
136 |
-
], $config);
|
137 |
-
|
138 |
-
if (!$config['app_id']) {
|
139 |
-
throw new FacebookSDKException('Required "app_id" key not supplied in config and could not find fallback environment variable "' . static::APP_ID_ENV_NAME . '"');
|
140 |
-
}
|
141 |
-
if (!$config['app_secret']) {
|
142 |
-
throw new FacebookSDKException('Required "app_secret" key not supplied in config and could not find fallback environment variable "' . static::APP_SECRET_ENV_NAME . '"');
|
143 |
-
}
|
144 |
-
|
145 |
-
$this->app = new FacebookApp($config['app_id'], $config['app_secret']);
|
146 |
-
$this->client = new FacebookClient(
|
147 |
-
HttpClientsFactory::createHttpClient($config['http_client_handler']),
|
148 |
-
$config['enable_beta_mode']
|
149 |
-
);
|
150 |
-
$this->pseudoRandomStringGenerator = PseudoRandomStringGeneratorFactory::createPseudoRandomStringGenerator(
|
151 |
-
$config['pseudo_random_string_generator']
|
152 |
-
);
|
153 |
-
$this->setUrlDetectionHandler($config['url_detection_handler'] ?: new FacebookUrlDetectionHandler());
|
154 |
-
$this->persistentDataHandler = PersistentDataFactory::createPersistentDataHandler(
|
155 |
-
$config['persistent_data_handler']
|
156 |
-
);
|
157 |
-
|
158 |
-
if (isset($config['default_access_token'])) {
|
159 |
-
$this->setDefaultAccessToken($config['default_access_token']);
|
160 |
-
}
|
161 |
-
|
162 |
-
// @todo v6: Throw an InvalidArgumentException if "default_graph_version" is not set
|
163 |
-
$this->defaultGraphVersion = $config['default_graph_version'];
|
164 |
-
}
|
165 |
-
|
166 |
-
/**
|
167 |
-
* Returns the FacebookApp entity.
|
168 |
-
*
|
169 |
-
* @return FacebookApp
|
170 |
-
*/
|
171 |
-
public function getApp()
|
172 |
-
{
|
173 |
-
return $this->app;
|
174 |
-
}
|
175 |
-
|
176 |
-
/**
|
177 |
-
* Returns the FacebookClient service.
|
178 |
-
*
|
179 |
-
* @return FacebookClient
|
180 |
-
*/
|
181 |
-
public function getClient()
|
182 |
-
{
|
183 |
-
return $this->client;
|
184 |
-
}
|
185 |
-
|
186 |
-
/**
|
187 |
-
* Returns the OAuth 2.0 client service.
|
188 |
-
*
|
189 |
-
* @return OAuth2Client
|
190 |
-
*/
|
191 |
-
public function getOAuth2Client()
|
192 |
-
{
|
193 |
-
if (!$this->oAuth2Client instanceof OAuth2Client) {
|
194 |
-
$app = $this->getApp();
|
195 |
-
$client = $this->getClient();
|
196 |
-
$this->oAuth2Client = new OAuth2Client($app, $client, $this->defaultGraphVersion);
|
197 |
-
}
|
198 |
-
|
199 |
-
return $this->oAuth2Client;
|
200 |
-
}
|
201 |
-
|
202 |
-
/**
|
203 |
-
* Returns the last response returned from Graph.
|
204 |
-
*
|
205 |
-
* @return FacebookResponse|FacebookBatchResponse|null
|
206 |
-
*/
|
207 |
-
public function getLastResponse()
|
208 |
-
{
|
209 |
-
return $this->lastResponse;
|
210 |
-
}
|
211 |
-
|
212 |
-
/**
|
213 |
-
* Returns the URL detection handler.
|
214 |
-
*
|
215 |
-
* @return UrlDetectionInterface
|
216 |
-
*/
|
217 |
-
public function getUrlDetectionHandler()
|
218 |
-
{
|
219 |
-
return $this->urlDetectionHandler;
|
220 |
-
}
|
221 |
-
|
222 |
-
/**
|
223 |
-
* Changes the URL detection handler.
|
224 |
-
*
|
225 |
-
* @param UrlDetectionInterface $urlDetectionHandler
|
226 |
-
*/
|
227 |
-
private function setUrlDetectionHandler(UrlDetectionInterface $urlDetectionHandler)
|
228 |
-
{
|
229 |
-
$this->urlDetectionHandler = $urlDetectionHandler;
|
230 |
-
}
|
231 |
-
|
232 |
-
/**
|
233 |
-
* Returns the default AccessToken entity.
|
234 |
-
*
|
235 |
-
* @return AccessToken|null
|
236 |
-
*/
|
237 |
-
public function getDefaultAccessToken()
|
238 |
-
{
|
239 |
-
return $this->defaultAccessToken;
|
240 |
-
}
|
241 |
-
|
242 |
-
/**
|
243 |
-
* Sets the default access token to use with requests.
|
244 |
-
*
|
245 |
-
* @param AccessToken|string $accessToken The access token to save.
|
246 |
-
*
|
247 |
-
* @throws \InvalidArgumentException
|
248 |
-
*/
|
249 |
-
public function setDefaultAccessToken($accessToken)
|
250 |
-
{
|
251 |
-
if (is_string($accessToken)) {
|
252 |
-
$this->defaultAccessToken = new AccessToken($accessToken);
|
253 |
-
|
254 |
-
return;
|
255 |
-
}
|
256 |
-
|
257 |
-
if ($accessToken instanceof AccessToken) {
|
258 |
-
$this->defaultAccessToken = $accessToken;
|
259 |
-
|
260 |
-
return;
|
261 |
-
}
|
262 |
-
|
263 |
-
throw new \InvalidArgumentException('The default access token must be of type "string" or Facebook\AccessToken');
|
264 |
-
}
|
265 |
-
|
266 |
-
/**
|
267 |
-
* Returns the default Graph version.
|
268 |
-
*
|
269 |
-
* @return string
|
270 |
-
*/
|
271 |
-
public function getDefaultGraphVersion()
|
272 |
-
{
|
273 |
-
return $this->defaultGraphVersion;
|
274 |
-
}
|
275 |
-
|
276 |
-
/**
|
277 |
-
* Returns the redirect login helper.
|
278 |
-
*
|
279 |
-
* @return FacebookRedirectLoginHelper
|
280 |
-
*/
|
281 |
-
public function getRedirectLoginHelper()
|
282 |
-
{
|
283 |
-
return new FacebookRedirectLoginHelper(
|
284 |
-
$this->getOAuth2Client(),
|
285 |
-
$this->persistentDataHandler,
|
286 |
-
$this->urlDetectionHandler,
|
287 |
-
$this->pseudoRandomStringGenerator
|
288 |
-
);
|
289 |
-
}
|
290 |
-
|
291 |
-
/**
|
292 |
-
* Returns the JavaScript helper.
|
293 |
-
*
|
294 |
-
* @return FacebookJavaScriptHelper
|
295 |
-
*/
|
296 |
-
public function getJavaScriptHelper()
|
297 |
-
{
|
298 |
-
return new FacebookJavaScriptHelper($this->app, $this->client, $this->defaultGraphVersion);
|
299 |
-
}
|
300 |
-
|
301 |
-
/**
|
302 |
-
* Returns the canvas helper.
|
303 |
-
*
|
304 |
-
* @return FacebookCanvasHelper
|
305 |
-
*/
|
306 |
-
public function getCanvasHelper()
|
307 |
-
{
|
308 |
-
return new FacebookCanvasHelper($this->app, $this->client, $this->defaultGraphVersion);
|
309 |
-
}
|
310 |
-
|
311 |
-
/**
|
312 |
-
* Returns the page tab helper.
|
313 |
-
*
|
314 |
-
* @return FacebookPageTabHelper
|
315 |
-
*/
|
316 |
-
public function getPageTabHelper()
|
317 |
-
{
|
318 |
-
return new FacebookPageTabHelper($this->app, $this->client, $this->defaultGraphVersion);
|
319 |
-
}
|
320 |
-
|
321 |
-
/**
|
322 |
-
* Sends a GET request to Graph and returns the result.
|
323 |
-
*
|
324 |
-
* @param string $endpoint
|
325 |
-
* @param AccessToken|string|null $accessToken
|
326 |
-
* @param string|null $eTag
|
327 |
-
* @param string|null $graphVersion
|
328 |
-
*
|
329 |
-
* @return FacebookResponse
|
330 |
-
*
|
331 |
-
* @throws FacebookSDKException
|
332 |
-
*/
|
333 |
-
public function get($endpoint, $accessToken = null, $eTag = null, $graphVersion = null)
|
334 |
-
{
|
335 |
-
return $this->sendRequest(
|
336 |
-
'GET',
|
337 |
-
$endpoint,
|
338 |
-
$params = [],
|
339 |
-
$accessToken,
|
340 |
-
$eTag,
|
341 |
-
$graphVersion
|
342 |
-
);
|
343 |
-
}
|
344 |
-
|
345 |
-
/**
|
346 |
-
* Sends a POST request to Graph and returns the result.
|
347 |
-
*
|
348 |
-
* @param string $endpoint
|
349 |
-
* @param array $params
|
350 |
-
* @param AccessToken|string|null $accessToken
|
351 |
-
* @param string|null $eTag
|
352 |
-
* @param string|null $graphVersion
|
353 |
-
*
|
354 |
-
* @return FacebookResponse
|
355 |
-
*
|
356 |
-
* @throws FacebookSDKException
|
357 |
-
*/
|
358 |
-
public function post($endpoint, array $params = [], $accessToken = null, $eTag = null, $graphVersion = null)
|
359 |
-
{
|
360 |
-
return $this->sendRequest(
|
361 |
-
'POST',
|
362 |
-
$endpoint,
|
363 |
-
$params,
|
364 |
-
$accessToken,
|
365 |
-
$eTag,
|
366 |
-
$graphVersion
|
367 |
-
);
|
368 |
-
}
|
369 |
-
|
370 |
-
/**
|
371 |
-
* Sends a DELETE request to Graph and returns the result.
|
372 |
-
*
|
373 |
-
* @param string $endpoint
|
374 |
-
* @param array $params
|
375 |
-
* @param AccessToken|string|null $accessToken
|
376 |
-
* @param string|null $eTag
|
377 |
-
* @param string|null $graphVersion
|
378 |
-
*
|
379 |
-
* @return FacebookResponse
|
380 |
-
*
|
381 |
-
* @throws FacebookSDKException
|
382 |
-
*/
|
383 |
-
public function delete($endpoint, array $params = [], $accessToken = null, $eTag = null, $graphVersion = null)
|
384 |
-
{
|
385 |
-
return $this->sendRequest(
|
386 |
-
'DELETE',
|
387 |
-
$endpoint,
|
388 |
-
$params,
|
389 |
-
$accessToken,
|
390 |
-
$eTag,
|
391 |
-
$graphVersion
|
392 |
-
);
|
393 |
-
}
|
394 |
-
|
395 |
-
/**
|
396 |
-
* Sends a request to Graph for the next page of results.
|
397 |
-
*
|
398 |
-
* @param GraphEdge $graphEdge The GraphEdge to paginate over.
|
399 |
-
*
|
400 |
-
* @return GraphEdge|null
|
401 |
-
*
|
402 |
-
* @throws FacebookSDKException
|
403 |
-
*/
|
404 |
-
public function next(GraphEdge $graphEdge)
|
405 |
-
{
|
406 |
-
return $this->getPaginationResults($graphEdge, 'next');
|
407 |
-
}
|
408 |
-
|
409 |
-
/**
|
410 |
-
* Sends a request to Graph for the previous page of results.
|
411 |
-
*
|
412 |
-
* @param GraphEdge $graphEdge The GraphEdge to paginate over.
|
413 |
-
*
|
414 |
-
* @return GraphEdge|null
|
415 |
-
*
|
416 |
-
* @throws FacebookSDKException
|
417 |
-
*/
|
418 |
-
public function previous(GraphEdge $graphEdge)
|
419 |
-
{
|
420 |
-
return $this->getPaginationResults($graphEdge, 'previous');
|
421 |
-
}
|
422 |
-
|
423 |
-
/**
|
424 |
-
* Sends a request to Graph for the next page of results.
|
425 |
-
*
|
426 |
-
* @param GraphEdge $graphEdge The GraphEdge to paginate over.
|
427 |
-
* @param string $direction The direction of the pagination: next|previous.
|
428 |
-
*
|
429 |
-
* @return GraphEdge|null
|
430 |
-
*
|
431 |
-
* @throws FacebookSDKException
|
432 |
-
*/
|
433 |
-
public function getPaginationResults(GraphEdge $graphEdge, $direction)
|
434 |
-
{
|
435 |
-
$paginationRequest = $graphEdge->getPaginationRequest($direction);
|
436 |
-
if (!$paginationRequest) {
|
437 |
-
return null;
|
438 |
-
}
|
439 |
-
|
440 |
-
$this->lastResponse = $this->client->sendRequest($paginationRequest);
|
441 |
-
|
442 |
-
// Keep the same GraphNode subclass
|
443 |
-
$subClassName = $graphEdge->getSubClassName();
|
444 |
-
$graphEdge = $this->lastResponse->getGraphEdge($subClassName, false);
|
445 |
-
|
446 |
-
return count($graphEdge) > 0 ? $graphEdge : null;
|
447 |
-
}
|
448 |
-
|
449 |
-
/**
|
450 |
-
* Sends a request to Graph and returns the result.
|
451 |
-
*
|
452 |
-
* @param string $method
|
453 |
-
* @param string $endpoint
|
454 |
-
* @param array $params
|
455 |
-
* @param AccessToken|string|null $accessToken
|
456 |
-
* @param string|null $eTag
|
457 |
-
* @param string|null $graphVersion
|
458 |
-
*
|
459 |
-
* @return FacebookResponse
|
460 |
-
*
|
461 |
-
* @throws FacebookSDKException
|
462 |
-
*/
|
463 |
-
public function sendRequest($method, $endpoint, array $params = [], $accessToken = null, $eTag = null, $graphVersion = null)
|
464 |
-
{
|
465 |
-
$accessToken = $accessToken ?: $this->defaultAccessToken;
|
466 |
-
$graphVersion = $graphVersion ?: $this->defaultGraphVersion;
|
467 |
-
$request = $this->request($method, $endpoint, $params, $accessToken, $eTag, $graphVersion);
|
468 |
-
|
469 |
-
return $this->lastResponse = $this->client->sendRequest($request);
|
470 |
-
}
|
471 |
-
|
472 |
-
/**
|
473 |
-
* Sends a batched request to Graph and returns the result.
|
474 |
-
*
|
475 |
-
* @param array $requests
|
476 |
-
* @param AccessToken|string|null $accessToken
|
477 |
-
* @param string|null $graphVersion
|
478 |
-
*
|
479 |
-
* @return FacebookBatchResponse
|
480 |
-
*
|
481 |
-
* @throws FacebookSDKException
|
482 |
-
*/
|
483 |
-
public function sendBatchRequest(array $requests, $accessToken = null, $graphVersion = null)
|
484 |
-
{
|
485 |
-
$accessToken = $accessToken ?: $this->defaultAccessToken;
|
486 |
-
$graphVersion = $graphVersion ?: $this->defaultGraphVersion;
|
487 |
-
$batchRequest = new FacebookBatchRequest(
|
488 |
-
$this->app,
|
489 |
-
$requests,
|
490 |
-
$accessToken,
|
491 |
-
$graphVersion
|
492 |
-
);
|
493 |
-
|
494 |
-
return $this->lastResponse = $this->client->sendBatchRequest($batchRequest);
|
495 |
-
}
|
496 |
-
|
497 |
-
/**
|
498 |
-
* Instantiates a new FacebookRequest entity.
|
499 |
-
*
|
500 |
-
* @param string $method
|
501 |
-
* @param string $endpoint
|
502 |
-
* @param array $params
|
503 |
-
* @param AccessToken|string|null $accessToken
|
504 |
-
* @param string|null $eTag
|
505 |
-
* @param string|null $graphVersion
|
506 |
-
*
|
507 |
-
* @return FacebookRequest
|
508 |
-
*
|
509 |
-
* @throws FacebookSDKException
|
510 |
-
*/
|
511 |
-
public function request($method, $endpoint, array $params = [], $accessToken = null, $eTag = null, $graphVersion = null)
|
512 |
-
{
|
513 |
-
$accessToken = $accessToken ?: $this->defaultAccessToken;
|
514 |
-
$graphVersion = $graphVersion ?: $this->defaultGraphVersion;
|
515 |
-
|
516 |
-
return new FacebookRequest(
|
517 |
-
$this->app,
|
518 |
-
$accessToken,
|
519 |
-
$method,
|
520 |
-
$endpoint,
|
521 |
-
$params,
|
522 |
-
$eTag,
|
523 |
-
$graphVersion
|
524 |
-
);
|
525 |
-
}
|
526 |
-
|
527 |
-
/**
|
528 |
-
* Factory to create FacebookFile's.
|
529 |
-
*
|
530 |
-
* @param string $pathToFile
|
531 |
-
*
|
532 |
-
* @return FacebookFile
|
533 |
-
*
|
534 |
-
* @throws FacebookSDKException
|
535 |
-
*/
|
536 |
-
public function fileToUpload($pathToFile)
|
537 |
-
{
|
538 |
-
return new FacebookFile($pathToFile);
|
539 |
-
}
|
540 |
-
|
541 |
-
/**
|
542 |
-
* Factory to create FacebookVideo's.
|
543 |
-
*
|
544 |
-
* @param string $pathToFile
|
545 |
-
*
|
546 |
-
* @return FacebookVideo
|
547 |
-
*
|
548 |
-
* @throws FacebookSDKException
|
549 |
-
*/
|
550 |
-
public function videoToUpload($pathToFile)
|
551 |
-
{
|
552 |
-
return new FacebookVideo($pathToFile);
|
553 |
-
}
|
554 |
-
|
555 |
-
/**
|
556 |
-
* Upload a video in chunks.
|
557 |
-
*
|
558 |
-
* @param int $target The id of the target node before the /videos edge.
|
559 |
-
* @param string $pathToFile The full path to the file.
|
560 |
-
* @param array $metadata The metadata associated with the video file.
|
561 |
-
* @param string|null $accessToken The access token.
|
562 |
-
* @param int $maxTransferTries The max times to retry a failed upload chunk.
|
563 |
-
* @param string|null $graphVersion The Graph API version to use.
|
564 |
-
*
|
565 |
-
* @return array
|
566 |
-
*
|
567 |
-
* @throws FacebookSDKException
|
568 |
-
*/
|
569 |
-
public function uploadVideo($target, $pathToFile, $metadata = [], $accessToken = null, $maxTransferTries = 5, $graphVersion = null)
|
570 |
-
{
|
571 |
-
$accessToken = $accessToken ?: $this->defaultAccessToken;
|
572 |
-
$graphVersion = $graphVersion ?: $this->defaultGraphVersion;
|
573 |
-
|
574 |
-
$uploader = new FacebookResumableUploader($this->app, $this->client, $accessToken, $graphVersion);
|
575 |
-
$endpoint = '/'.$target.'/videos';
|
576 |
-
$file = $this->videoToUpload($pathToFile);
|
577 |
-
$chunk = $uploader->start($endpoint, $file);
|
578 |
-
|
579 |
-
do {
|
580 |
-
$chunk = $this->maxTriesTransfer($uploader, $endpoint, $chunk, $maxTransferTries);
|
581 |
-
} while (!$chunk->isLastChunk());
|
582 |
-
|
583 |
-
return [
|
584 |
-
'video_id' => $chunk->getVideoId(),
|
585 |
-
'success' => $uploader->finish($endpoint, $chunk->getUploadSessionId(), $metadata),
|
586 |
-
];
|
587 |
-
}
|
588 |
-
|
589 |
-
/**
|
590 |
-
* Attempts to upload a chunk of a file in $retryCountdown tries.
|
591 |
-
*
|
592 |
-
* @param FacebookResumableUploader $uploader
|
593 |
-
* @param string $endpoint
|
594 |
-
* @param FacebookTransferChunk $chunk
|
595 |
-
* @param int $retryCountdown
|
596 |
-
*
|
597 |
-
* @return FacebookTransferChunk
|
598 |
-
*
|
599 |
-
* @throws FacebookSDKException
|
600 |
-
*/
|
601 |
-
private function maxTriesTransfer(FacebookResumableUploader $uploader, $endpoint, FacebookTransferChunk $chunk, $retryCountdown)
|
602 |
-
{
|
603 |
-
$newChunk = $uploader->transfer($endpoint, $chunk, $retryCountdown < 1);
|
604 |
-
|
605 |
-
if ($newChunk !== $chunk) {
|
606 |
-
return $newChunk;
|
607 |
-
}
|
608 |
-
|
609 |
-
$retryCountdown--;
|
610 |
-
|
611 |
-
// If transfer() returned the same chunk entity, the transfer failed but is resumable.
|
612 |
-
return $this->maxTriesTransfer($uploader, $endpoint, $chunk, $retryCountdown);
|
613 |
-
}
|
614 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/FacebookApp.php
DELETED
@@ -1,110 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook;
|
25 |
-
|
26 |
-
use Facebook\Authentication\AccessToken;
|
27 |
-
use Facebook\Exceptions\FacebookSDKException;
|
28 |
-
|
29 |
-
class FacebookApp implements \Serializable
|
30 |
-
{
|
31 |
-
/**
|
32 |
-
* @var string The app ID.
|
33 |
-
*/
|
34 |
-
protected $id;
|
35 |
-
|
36 |
-
/**
|
37 |
-
* @var string The app secret.
|
38 |
-
*/
|
39 |
-
protected $secret;
|
40 |
-
|
41 |
-
/**
|
42 |
-
* @param string $id
|
43 |
-
* @param string $secret
|
44 |
-
*
|
45 |
-
* @throws FacebookSDKException
|
46 |
-
*/
|
47 |
-
public function __construct($id, $secret)
|
48 |
-
{
|
49 |
-
if (!is_string($id)
|
50 |
-
// Keeping this for BC. Integers greater than PHP_INT_MAX will make is_int() return false
|
51 |
-
&& !is_int($id)) {
|
52 |
-
throw new FacebookSDKException('The "app_id" must be formatted as a string since many app ID\'s are greater than PHP_INT_MAX on some systems.');
|
53 |
-
}
|
54 |
-
// We cast as a string in case a valid int was set on a 64-bit system and this is unserialised on a 32-bit system
|
55 |
-
$this->id = (string) $id;
|
56 |
-
$this->secret = $secret;
|
57 |
-
}
|
58 |
-
|
59 |
-
/**
|
60 |
-
* Returns the app ID.
|
61 |
-
*
|
62 |
-
* @return string
|
63 |
-
*/
|
64 |
-
public function getId()
|
65 |
-
{
|
66 |
-
return $this->id;
|
67 |
-
}
|
68 |
-
|
69 |
-
/**
|
70 |
-
* Returns the app secret.
|
71 |
-
*
|
72 |
-
* @return string
|
73 |
-
*/
|
74 |
-
public function getSecret()
|
75 |
-
{
|
76 |
-
return $this->secret;
|
77 |
-
}
|
78 |
-
|
79 |
-
/**
|
80 |
-
* Returns an app access token.
|
81 |
-
*
|
82 |
-
* @return AccessToken
|
83 |
-
*/
|
84 |
-
public function getAccessToken()
|
85 |
-
{
|
86 |
-
return new AccessToken($this->id . '|' . $this->secret);
|
87 |
-
}
|
88 |
-
|
89 |
-
/**
|
90 |
-
* Serializes the FacebookApp entity as a string.
|
91 |
-
*
|
92 |
-
* @return string
|
93 |
-
*/
|
94 |
-
public function serialize()
|
95 |
-
{
|
96 |
-
return implode('|', [$this->id, $this->secret]);
|
97 |
-
}
|
98 |
-
|
99 |
-
/**
|
100 |
-
* Unserializes a string as a FacebookApp entity.
|
101 |
-
*
|
102 |
-
* @param string $serialized
|
103 |
-
*/
|
104 |
-
public function unserialize($serialized)
|
105 |
-
{
|
106 |
-
list($id, $secret) = explode('|', $serialized);
|
107 |
-
|
108 |
-
$this->__construct($id, $secret);
|
109 |
-
}
|
110 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/FacebookBatchRequest.php
DELETED
@@ -1,303 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook;
|
25 |
-
|
26 |
-
use ArrayIterator;
|
27 |
-
use IteratorAggregate;
|
28 |
-
use ArrayAccess;
|
29 |
-
use Facebook\Authentication\AccessToken;
|
30 |
-
use Facebook\Exceptions\FacebookSDKException;
|
31 |
-
|
32 |
-
/**
|
33 |
-
* Class BatchRequest
|
34 |
-
*
|
35 |
-
* @package Facebook
|
36 |
-
*/
|
37 |
-
class FacebookBatchRequest extends FacebookRequest implements IteratorAggregate, ArrayAccess
|
38 |
-
{
|
39 |
-
/**
|
40 |
-
* @var array An array of FacebookRequest entities to send.
|
41 |
-
*/
|
42 |
-
protected $requests;
|
43 |
-
|
44 |
-
/**
|
45 |
-
* @var array An array of files to upload.
|
46 |
-
*/
|
47 |
-
protected $attachedFiles;
|
48 |
-
|
49 |
-
/**
|
50 |
-
* Creates a new Request entity.
|
51 |
-
*
|
52 |
-
* @param FacebookApp|null $app
|
53 |
-
* @param array $requests
|
54 |
-
* @param AccessToken|string|null $accessToken
|
55 |
-
* @param string|null $graphVersion
|
56 |
-
*/
|
57 |
-
public function __construct(FacebookApp $app = null, array $requests = [], $accessToken = null, $graphVersion = null)
|
58 |
-
{
|
59 |
-
parent::__construct($app, $accessToken, 'POST', '', [], null, $graphVersion);
|
60 |
-
|
61 |
-
$this->add($requests);
|
62 |
-
}
|
63 |
-
|
64 |
-
/**
|
65 |
-
* A a new request to the array.
|
66 |
-
*
|
67 |
-
* @param FacebookRequest|array $request
|
68 |
-
* @param string|null $name
|
69 |
-
*
|
70 |
-
* @return FacebookBatchRequest
|
71 |
-
*
|
72 |
-
* @throws \InvalidArgumentException
|
73 |
-
*/
|
74 |
-
public function add($request, $name = null)
|
75 |
-
{
|
76 |
-
if (is_array($request)) {
|
77 |
-
foreach ($request as $key => $req) {
|
78 |
-
$this->add($req, $key);
|
79 |
-
}
|
80 |
-
|
81 |
-
return $this;
|
82 |
-
}
|
83 |
-
|
84 |
-
if (!$request instanceof FacebookRequest) {
|
85 |
-
throw new \InvalidArgumentException('Argument for add() must be of type array or FacebookRequest.');
|
86 |
-
}
|
87 |
-
|
88 |
-
$this->addFallbackDefaults($request);
|
89 |
-
$requestToAdd = [
|
90 |
-
'name' => $name,
|
91 |
-
'request' => $request,
|
92 |
-
];
|
93 |
-
|
94 |
-
// File uploads
|
95 |
-
$attachedFiles = $this->extractFileAttachments($request);
|
96 |
-
if ($attachedFiles) {
|
97 |
-
$requestToAdd['attached_files'] = $attachedFiles;
|
98 |
-
}
|
99 |
-
$this->requests[] = $requestToAdd;
|
100 |
-
|
101 |
-
return $this;
|
102 |
-
}
|
103 |
-
|
104 |
-
/**
|
105 |
-
* Ensures that the FacebookApp and access token fall back when missing.
|
106 |
-
*
|
107 |
-
* @param FacebookRequest $request
|
108 |
-
*
|
109 |
-
* @throws FacebookSDKException
|
110 |
-
*/
|
111 |
-
public function addFallbackDefaults(FacebookRequest $request)
|
112 |
-
{
|
113 |
-
if (!$request->getApp()) {
|
114 |
-
$app = $this->getApp();
|
115 |
-
if (!$app) {
|
116 |
-
throw new FacebookSDKException('Missing FacebookApp on FacebookRequest and no fallback detected on FacebookBatchRequest.');
|
117 |
-
}
|
118 |
-
$request->setApp($app);
|
119 |
-
}
|
120 |
-
|
121 |
-
if (!$request->getAccessToken()) {
|
122 |
-
$accessToken = $this->getAccessToken();
|
123 |
-
if (!$accessToken) {
|
124 |
-
throw new FacebookSDKException('Missing access token on FacebookRequest and no fallback detected on FacebookBatchRequest.');
|
125 |
-
}
|
126 |
-
$request->setAccessToken($accessToken);
|
127 |
-
}
|
128 |
-
}
|
129 |
-
|
130 |
-
/**
|
131 |
-
* Extracts the files from a request.
|
132 |
-
*
|
133 |
-
* @param FacebookRequest $request
|
134 |
-
*
|
135 |
-
* @return string|null
|
136 |
-
*
|
137 |
-
* @throws FacebookSDKException
|
138 |
-
*/
|
139 |
-
public function extractFileAttachments(FacebookRequest $request)
|
140 |
-
{
|
141 |
-
if (!$request->containsFileUploads()) {
|
142 |
-
return null;
|
143 |
-
}
|
144 |
-
|
145 |
-
$files = $request->getFiles();
|
146 |
-
$fileNames = [];
|
147 |
-
foreach ($files as $file) {
|
148 |
-
$fileName = uniqid();
|
149 |
-
$this->addFile($fileName, $file);
|
150 |
-
$fileNames[] = $fileName;
|
151 |
-
}
|
152 |
-
|
153 |
-
$request->resetFiles();
|
154 |
-
|
155 |
-
// @TODO Does Graph support multiple uploads on one endpoint?
|
156 |
-
return implode(',', $fileNames);
|
157 |
-
}
|
158 |
-
|
159 |
-
/**
|
160 |
-
* Return the FacebookRequest entities.
|
161 |
-
*
|
162 |
-
* @return array
|
163 |
-
*/
|
164 |
-
public function getRequests()
|
165 |
-
{
|
166 |
-
return $this->requests;
|
167 |
-
}
|
168 |
-
|
169 |
-
/**
|
170 |
-
* Prepares the requests to be sent as a batch request.
|
171 |
-
*
|
172 |
-
* @return string
|
173 |
-
*/
|
174 |
-
public function prepareRequestsForBatch()
|
175 |
-
{
|
176 |
-
$this->validateBatchRequestCount();
|
177 |
-
|
178 |
-
$params = [
|
179 |
-
'batch' => $this->convertRequestsToJson(),
|
180 |
-
'include_headers' => true,
|
181 |
-
];
|
182 |
-
$this->setParams($params);
|
183 |
-
}
|
184 |
-
|
185 |
-
/**
|
186 |
-
* Converts the requests into a JSON(P) string.
|
187 |
-
*
|
188 |
-
* @return string
|
189 |
-
*/
|
190 |
-
public function convertRequestsToJson()
|
191 |
-
{
|
192 |
-
$requests = [];
|
193 |
-
foreach ($this->requests as $request) {
|
194 |
-
$attachedFiles = isset($request['attached_files']) ? $request['attached_files'] : null;
|
195 |
-
$requests[] = $this->requestEntityToBatchArray($request['request'], $request['name'], $attachedFiles);
|
196 |
-
}
|
197 |
-
|
198 |
-
return json_encode($requests);
|
199 |
-
}
|
200 |
-
|
201 |
-
/**
|
202 |
-
* Validate the request count before sending them as a batch.
|
203 |
-
*
|
204 |
-
* @throws FacebookSDKException
|
205 |
-
*/
|
206 |
-
public function validateBatchRequestCount()
|
207 |
-
{
|
208 |
-
$batchCount = count($this->requests);
|
209 |
-
if ($batchCount === 0) {
|
210 |
-
throw new FacebookSDKException('There are no batch requests to send.');
|
211 |
-
} elseif ($batchCount > 50) {
|
212 |
-
// Per: https://developers.facebook.com/docs/graph-api/making-multiple-requests#limits
|
213 |
-
throw new FacebookSDKException('You cannot send more than 50 batch requests at a time.');
|
214 |
-
}
|
215 |
-
}
|
216 |
-
|
217 |
-
/**
|
218 |
-
* Converts a Request entity into an array that is batch-friendly.
|
219 |
-
*
|
220 |
-
* @param FacebookRequest $request The request entity to convert.
|
221 |
-
* @param string|null $requestName The name of the request.
|
222 |
-
* @param string|null $attachedFiles Names of files associated with the request.
|
223 |
-
*
|
224 |
-
* @return array
|
225 |
-
*/
|
226 |
-
public function requestEntityToBatchArray(FacebookRequest $request, $requestName = null, $attachedFiles = null)
|
227 |
-
{
|
228 |
-
$compiledHeaders = [];
|
229 |
-
$headers = $request->getHeaders();
|
230 |
-
foreach ($headers as $name => $value) {
|
231 |
-
$compiledHeaders[] = $name . ': ' . $value;
|
232 |
-
}
|
233 |
-
|
234 |
-
$batch = [
|
235 |
-
'headers' => $compiledHeaders,
|
236 |
-
'method' => $request->getMethod(),
|
237 |
-
'relative_url' => $request->getUrl(),
|
238 |
-
];
|
239 |
-
|
240 |
-
// Since file uploads are moved to the root request of a batch request,
|
241 |
-
// the child requests will always be URL-encoded.
|
242 |
-
$body = $request->getUrlEncodedBody()->getBody();
|
243 |
-
if ($body) {
|
244 |
-
$batch['body'] = $body;
|
245 |
-
}
|
246 |
-
|
247 |
-
if (isset($requestName)) {
|
248 |
-
$batch['name'] = $requestName;
|
249 |
-
}
|
250 |
-
|
251 |
-
if (isset($attachedFiles)) {
|
252 |
-
$batch['attached_files'] = $attachedFiles;
|
253 |
-
}
|
254 |
-
|
255 |
-
// @TODO Add support for "omit_response_on_success"
|
256 |
-
// @TODO Add support for "depends_on"
|
257 |
-
// @TODO Add support for JSONP with "callback"
|
258 |
-
|
259 |
-
return $batch;
|
260 |
-
}
|
261 |
-
|
262 |
-
/**
|
263 |
-
* Get an iterator for the items.
|
264 |
-
*
|
265 |
-
* @return ArrayIterator
|
266 |
-
*/
|
267 |
-
public function getIterator()
|
268 |
-
{
|
269 |
-
return new ArrayIterator($this->requests);
|
270 |
-
}
|
271 |
-
|
272 |
-
/**
|
273 |
-
* @inheritdoc
|
274 |
-
*/
|
275 |
-
public function offsetSet($offset, $value)
|
276 |
-
{
|
277 |
-
$this->add($value, $offset);
|
278 |
-
}
|
279 |
-
|
280 |
-
/**
|
281 |
-
* @inheritdoc
|
282 |
-
*/
|
283 |
-
public function offsetExists($offset)
|
284 |
-
{
|
285 |
-
return isset($this->requests[$offset]);
|
286 |
-
}
|
287 |
-
|
288 |
-
/**
|
289 |
-
* @inheritdoc
|
290 |
-
*/
|
291 |
-
public function offsetUnset($offset)
|
292 |
-
{
|
293 |
-
unset($this->requests[$offset]);
|
294 |
-
}
|
295 |
-
|
296 |
-
/**
|
297 |
-
* @inheritdoc
|
298 |
-
*/
|
299 |
-
public function offsetGet($offset)
|
300 |
-
{
|
301 |
-
return isset($this->requests[$offset]) ? $this->requests[$offset] : null;
|
302 |
-
}
|
303 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/FacebookBatchResponse.php
DELETED
@@ -1,174 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook;
|
25 |
-
|
26 |
-
use ArrayIterator;
|
27 |
-
use IteratorAggregate;
|
28 |
-
use ArrayAccess;
|
29 |
-
|
30 |
-
/**
|
31 |
-
* Class FacebookBatchResponse
|
32 |
-
*
|
33 |
-
* @package Facebook
|
34 |
-
*/
|
35 |
-
class FacebookBatchResponse extends FacebookResponse implements IteratorAggregate, ArrayAccess
|
36 |
-
{
|
37 |
-
/**
|
38 |
-
* @var FacebookBatchRequest The original entity that made the batch request.
|
39 |
-
*/
|
40 |
-
protected $batchRequest;
|
41 |
-
|
42 |
-
/**
|
43 |
-
* @var array An array of FacebookResponse entities.
|
44 |
-
*/
|
45 |
-
protected $responses = [];
|
46 |
-
|
47 |
-
/**
|
48 |
-
* Creates a new Response entity.
|
49 |
-
*
|
50 |
-
* @param FacebookBatchRequest $batchRequest
|
51 |
-
* @param FacebookResponse $response
|
52 |
-
*/
|
53 |
-
public function __construct(FacebookBatchRequest $batchRequest, FacebookResponse $response)
|
54 |
-
{
|
55 |
-
$this->batchRequest = $batchRequest;
|
56 |
-
|
57 |
-
$request = $response->getRequest();
|
58 |
-
$body = $response->getBody();
|
59 |
-
$httpStatusCode = $response->getHttpStatusCode();
|
60 |
-
$headers = $response->getHeaders();
|
61 |
-
parent::__construct($request, $body, $httpStatusCode, $headers);
|
62 |
-
|
63 |
-
$responses = $response->getDecodedBody();
|
64 |
-
$this->setResponses($responses);
|
65 |
-
}
|
66 |
-
|
67 |
-
/**
|
68 |
-
* Returns an array of FacebookResponse entities.
|
69 |
-
*
|
70 |
-
* @return array
|
71 |
-
*/
|
72 |
-
public function getResponses()
|
73 |
-
{
|
74 |
-
return $this->responses;
|
75 |
-
}
|
76 |
-
|
77 |
-
/**
|
78 |
-
* The main batch response will be an array of requests so
|
79 |
-
* we need to iterate over all the responses.
|
80 |
-
*
|
81 |
-
* @param array $responses
|
82 |
-
*/
|
83 |
-
public function setResponses(array $responses)
|
84 |
-
{
|
85 |
-
$this->responses = [];
|
86 |
-
|
87 |
-
foreach ($responses as $key => $graphResponse) {
|
88 |
-
$this->addResponse($key, $graphResponse);
|
89 |
-
}
|
90 |
-
}
|
91 |
-
|
92 |
-
/**
|
93 |
-
* Add a response to the list.
|
94 |
-
*
|
95 |
-
* @param int $key
|
96 |
-
* @param array|null $response
|
97 |
-
*/
|
98 |
-
public function addResponse($key, $response)
|
99 |
-
{
|
100 |
-
$originalRequestName = isset($this->batchRequest[$key]['name']) ? $this->batchRequest[$key]['name'] : $key;
|
101 |
-
$originalRequest = isset($this->batchRequest[$key]['request']) ? $this->batchRequest[$key]['request'] : null;
|
102 |
-
|
103 |
-
$httpResponseBody = isset($response['body']) ? $response['body'] : null;
|
104 |
-
$httpResponseCode = isset($response['code']) ? $response['code'] : null;
|
105 |
-
// @TODO With PHP 5.5 support, this becomes array_column($response['headers'], 'value', 'name')
|
106 |
-
$httpResponseHeaders = isset($response['headers']) ? $this->normalizeBatchHeaders($response['headers']) : [];
|
107 |
-
|
108 |
-
$this->responses[$originalRequestName] = new FacebookResponse(
|
109 |
-
$originalRequest,
|
110 |
-
$httpResponseBody,
|
111 |
-
$httpResponseCode,
|
112 |
-
$httpResponseHeaders
|
113 |
-
);
|
114 |
-
}
|
115 |
-
|
116 |
-
/**
|
117 |
-
* @inheritdoc
|
118 |
-
*/
|
119 |
-
public function getIterator()
|
120 |
-
{
|
121 |
-
return new ArrayIterator($this->responses);
|
122 |
-
}
|
123 |
-
|
124 |
-
/**
|
125 |
-
* @inheritdoc
|
126 |
-
*/
|
127 |
-
public function offsetSet($offset, $value)
|
128 |
-
{
|
129 |
-
$this->addResponse($offset, $value);
|
130 |
-
}
|
131 |
-
|
132 |
-
/**
|
133 |
-
* @inheritdoc
|
134 |
-
*/
|
135 |
-
public function offsetExists($offset)
|
136 |
-
{
|
137 |
-
return isset($this->responses[$offset]);
|
138 |
-
}
|
139 |
-
|
140 |
-
/**
|
141 |
-
* @inheritdoc
|
142 |
-
*/
|
143 |
-
public function offsetUnset($offset)
|
144 |
-
{
|
145 |
-
unset($this->responses[$offset]);
|
146 |
-
}
|
147 |
-
|
148 |
-
/**
|
149 |
-
* @inheritdoc
|
150 |
-
*/
|
151 |
-
public function offsetGet($offset)
|
152 |
-
{
|
153 |
-
return isset($this->responses[$offset]) ? $this->responses[$offset] : null;
|
154 |
-
}
|
155 |
-
|
156 |
-
/**
|
157 |
-
* Converts the batch header array into a standard format.
|
158 |
-
* @TODO replace with array_column() when PHP 5.5 is supported.
|
159 |
-
*
|
160 |
-
* @param array $batchHeaders
|
161 |
-
*
|
162 |
-
* @return array
|
163 |
-
*/
|
164 |
-
private function normalizeBatchHeaders(array $batchHeaders)
|
165 |
-
{
|
166 |
-
$headers = [];
|
167 |
-
|
168 |
-
foreach ($batchHeaders as $header) {
|
169 |
-
$headers[$header['name']] = $header['value'];
|
170 |
-
}
|
171 |
-
|
172 |
-
return $headers;
|
173 |
-
}
|
174 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/FacebookClient.php
DELETED
@@ -1,250 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook;
|
25 |
-
|
26 |
-
use Facebook\HttpClients\FacebookHttpClientInterface;
|
27 |
-
use Facebook\HttpClients\FacebookCurlHttpClient;
|
28 |
-
use Facebook\HttpClients\FacebookStreamHttpClient;
|
29 |
-
use Facebook\Exceptions\FacebookSDKException;
|
30 |
-
|
31 |
-
/**
|
32 |
-
* Class FacebookClient
|
33 |
-
*
|
34 |
-
* @package Facebook
|
35 |
-
*/
|
36 |
-
class FacebookClient
|
37 |
-
{
|
38 |
-
/**
|
39 |
-
* @const string Production Graph API URL.
|
40 |
-
*/
|
41 |
-
const BASE_GRAPH_URL = 'https://graph.facebook.com';
|
42 |
-
|
43 |
-
/**
|
44 |
-
* @const string Graph API URL for video uploads.
|
45 |
-
*/
|
46 |
-
const BASE_GRAPH_VIDEO_URL = 'https://graph-video.facebook.com';
|
47 |
-
|
48 |
-
/**
|
49 |
-
* @const string Beta Graph API URL.
|
50 |
-
*/
|
51 |
-
const BASE_GRAPH_URL_BETA = 'https://graph.beta.facebook.com';
|
52 |
-
|
53 |
-
/**
|
54 |
-
* @const string Beta Graph API URL for video uploads.
|
55 |
-
*/
|
56 |
-
const BASE_GRAPH_VIDEO_URL_BETA = 'https://graph-video.beta.facebook.com';
|
57 |
-
|
58 |
-
/**
|
59 |
-
* @const int The timeout in seconds for a normal request.
|
60 |
-
*/
|
61 |
-
const DEFAULT_REQUEST_TIMEOUT = 60;
|
62 |
-
|
63 |
-
/**
|
64 |
-
* @const int The timeout in seconds for a request that contains file uploads.
|
65 |
-
*/
|
66 |
-
const DEFAULT_FILE_UPLOAD_REQUEST_TIMEOUT = 3600;
|
67 |
-
|
68 |
-
/**
|
69 |
-
* @const int The timeout in seconds for a request that contains video uploads.
|
70 |
-
*/
|
71 |
-
const DEFAULT_VIDEO_UPLOAD_REQUEST_TIMEOUT = 7200;
|
72 |
-
|
73 |
-
/**
|
74 |
-
* @var bool Toggle to use Graph beta url.
|
75 |
-
*/
|
76 |
-
protected $enableBetaMode = false;
|
77 |
-
|
78 |
-
/**
|
79 |
-
* @var FacebookHttpClientInterface HTTP client handler.
|
80 |
-
*/
|
81 |
-
protected $httpClientHandler;
|
82 |
-
|
83 |
-
/**
|
84 |
-
* @var int The number of calls that have been made to Graph.
|
85 |
-
*/
|
86 |
-
public static $requestCount = 0;
|
87 |
-
|
88 |
-
/**
|
89 |
-
* Instantiates a new FacebookClient object.
|
90 |
-
*
|
91 |
-
* @param FacebookHttpClientInterface|null $httpClientHandler
|
92 |
-
* @param boolean $enableBeta
|
93 |
-
*/
|
94 |
-
public function __construct(FacebookHttpClientInterface $httpClientHandler = null, $enableBeta = false)
|
95 |
-
{
|
96 |
-
$this->httpClientHandler = $httpClientHandler ?: $this->detectHttpClientHandler();
|
97 |
-
$this->enableBetaMode = $enableBeta;
|
98 |
-
}
|
99 |
-
|
100 |
-
/**
|
101 |
-
* Sets the HTTP client handler.
|
102 |
-
*
|
103 |
-
* @param FacebookHttpClientInterface $httpClientHandler
|
104 |
-
*/
|
105 |
-
public function setHttpClientHandler(FacebookHttpClientInterface $httpClientHandler)
|
106 |
-
{
|
107 |
-
$this->httpClientHandler = $httpClientHandler;
|
108 |
-
}
|
109 |
-
|
110 |
-
/**
|
111 |
-
* Returns the HTTP client handler.
|
112 |
-
*
|
113 |
-
* @return FacebookHttpClientInterface
|
114 |
-
*/
|
115 |
-
public function getHttpClientHandler()
|
116 |
-
{
|
117 |
-
return $this->httpClientHandler;
|
118 |
-
}
|
119 |
-
|
120 |
-
/**
|
121 |
-
* Detects which HTTP client handler to use.
|
122 |
-
*
|
123 |
-
* @return FacebookHttpClientInterface
|
124 |
-
*/
|
125 |
-
public function detectHttpClientHandler()
|
126 |
-
{
|
127 |
-
return extension_loaded('curl') ? new FacebookCurlHttpClient() : new FacebookStreamHttpClient();
|
128 |
-
}
|
129 |
-
|
130 |
-
/**
|
131 |
-
* Toggle beta mode.
|
132 |
-
*
|
133 |
-
* @param boolean $betaMode
|
134 |
-
*/
|
135 |
-
public function enableBetaMode($betaMode = true)
|
136 |
-
{
|
137 |
-
$this->enableBetaMode = $betaMode;
|
138 |
-
}
|
139 |
-
|
140 |
-
/**
|
141 |
-
* Returns the base Graph URL.
|
142 |
-
*
|
143 |
-
* @param boolean $postToVideoUrl Post to the video API if videos are being uploaded.
|
144 |
-
*
|
145 |
-
* @return string
|
146 |
-
*/
|
147 |
-
public function getBaseGraphUrl($postToVideoUrl = false)
|
148 |
-
{
|
149 |
-
if ($postToVideoUrl) {
|
150 |
-
return $this->enableBetaMode ? static::BASE_GRAPH_VIDEO_URL_BETA : static::BASE_GRAPH_VIDEO_URL;
|
151 |
-
}
|
152 |
-
|
153 |
-
return $this->enableBetaMode ? static::BASE_GRAPH_URL_BETA : static::BASE_GRAPH_URL;
|
154 |
-
}
|
155 |
-
|
156 |
-
/**
|
157 |
-
* Prepares the request for sending to the client handler.
|
158 |
-
*
|
159 |
-
* @param FacebookRequest $request
|
160 |
-
*
|
161 |
-
* @return array
|
162 |
-
*/
|
163 |
-
public function prepareRequestMessage(FacebookRequest $request)
|
164 |
-
{
|
165 |
-
$postToVideoUrl = $request->containsVideoUploads();
|
166 |
-
$url = $this->getBaseGraphUrl($postToVideoUrl) . $request->getUrl();
|
167 |
-
|
168 |
-
// If we're sending files they should be sent as multipart/form-data
|
169 |
-
if ($request->containsFileUploads()) {
|
170 |
-
$requestBody = $request->getMultipartBody();
|
171 |
-
$request->setHeaders([
|
172 |
-
'Content-Type' => 'multipart/form-data; boundary=' . $requestBody->getBoundary(),
|
173 |
-
]);
|
174 |
-
} else {
|
175 |
-
$requestBody = $request->getUrlEncodedBody();
|
176 |
-
$request->setHeaders([
|
177 |
-
'Content-Type' => 'application/x-www-form-urlencoded',
|
178 |
-
]);
|
179 |
-
}
|
180 |
-
|
181 |
-
return [
|
182 |
-
$url,
|
183 |
-
$request->getMethod(),
|
184 |
-
$request->getHeaders(),
|
185 |
-
$requestBody->getBody(),
|
186 |
-
];
|
187 |
-
}
|
188 |
-
|
189 |
-
/**
|
190 |
-
* Makes the request to Graph and returns the result.
|
191 |
-
*
|
192 |
-
* @param FacebookRequest $request
|
193 |
-
*
|
194 |
-
* @return FacebookResponse
|
195 |
-
*
|
196 |
-
* @throws FacebookSDKException
|
197 |
-
*/
|
198 |
-
public function sendRequest(FacebookRequest $request)
|
199 |
-
{
|
200 |
-
if (get_class($request) === 'Facebook\FacebookRequest') {
|
201 |
-
$request->validateAccessToken();
|
202 |
-
}
|
203 |
-
|
204 |
-
list($url, $method, $headers, $body) = $this->prepareRequestMessage($request);
|
205 |
-
|
206 |
-
// Since file uploads can take a while, we need to give more time for uploads
|
207 |
-
$timeOut = static::DEFAULT_REQUEST_TIMEOUT;
|
208 |
-
if ($request->containsFileUploads()) {
|
209 |
-
$timeOut = static::DEFAULT_FILE_UPLOAD_REQUEST_TIMEOUT;
|
210 |
-
} elseif ($request->containsVideoUploads()) {
|
211 |
-
$timeOut = static::DEFAULT_VIDEO_UPLOAD_REQUEST_TIMEOUT;
|
212 |
-
}
|
213 |
-
|
214 |
-
// Should throw `FacebookSDKException` exception on HTTP client error.
|
215 |
-
// Don't catch to allow it to bubble up.
|
216 |
-
$rawResponse = $this->httpClientHandler->send($url, $method, $body, $headers, $timeOut);
|
217 |
-
|
218 |
-
static::$requestCount++;
|
219 |
-
|
220 |
-
$returnResponse = new FacebookResponse(
|
221 |
-
$request,
|
222 |
-
$rawResponse->getBody(),
|
223 |
-
$rawResponse->getHttpResponseCode(),
|
224 |
-
$rawResponse->getHeaders()
|
225 |
-
);
|
226 |
-
|
227 |
-
if ($returnResponse->isError()) {
|
228 |
-
throw $returnResponse->getThrownException();
|
229 |
-
}
|
230 |
-
|
231 |
-
return $returnResponse;
|
232 |
-
}
|
233 |
-
|
234 |
-
/**
|
235 |
-
* Makes a batched request to Graph and returns the result.
|
236 |
-
*
|
237 |
-
* @param FacebookBatchRequest $request
|
238 |
-
*
|
239 |
-
* @return FacebookBatchResponse
|
240 |
-
*
|
241 |
-
* @throws FacebookSDKException
|
242 |
-
*/
|
243 |
-
public function sendBatchRequest(FacebookBatchRequest $request)
|
244 |
-
{
|
245 |
-
$request->prepareRequestsForBatch();
|
246 |
-
$facebookResponse = $this->sendRequest($request);
|
247 |
-
|
248 |
-
return new FacebookBatchResponse($request, $facebookResponse);
|
249 |
-
}
|
250 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/FacebookRequest.php
DELETED
@@ -1,534 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook;
|
25 |
-
|
26 |
-
use Facebook\Authentication\AccessToken;
|
27 |
-
use Facebook\Url\FacebookUrlManipulator;
|
28 |
-
use Facebook\FileUpload\FacebookFile;
|
29 |
-
use Facebook\FileUpload\FacebookVideo;
|
30 |
-
use Facebook\Http\RequestBodyMultipart;
|
31 |
-
use Facebook\Http\RequestBodyUrlEncoded;
|
32 |
-
use Facebook\Exceptions\FacebookSDKException;
|
33 |
-
|
34 |
-
/**
|
35 |
-
* Class Request
|
36 |
-
*
|
37 |
-
* @package Facebook
|
38 |
-
*/
|
39 |
-
class FacebookRequest
|
40 |
-
{
|
41 |
-
/**
|
42 |
-
* @var FacebookApp The Facebook app entity.
|
43 |
-
*/
|
44 |
-
protected $app;
|
45 |
-
|
46 |
-
/**
|
47 |
-
* @var string|null The access token to use for this request.
|
48 |
-
*/
|
49 |
-
protected $accessToken;
|
50 |
-
|
51 |
-
/**
|
52 |
-
* @var string The HTTP method for this request.
|
53 |
-
*/
|
54 |
-
protected $method;
|
55 |
-
|
56 |
-
/**
|
57 |
-
* @var string The Graph endpoint for this request.
|
58 |
-
*/
|
59 |
-
protected $endpoint;
|
60 |
-
|
61 |
-
/**
|
62 |
-
* @var array The headers to send with this request.
|
63 |
-
*/
|
64 |
-
protected $headers = [];
|
65 |
-
|
66 |
-
/**
|
67 |
-
* @var array The parameters to send with this request.
|
68 |
-
*/
|
69 |
-
protected $params = [];
|
70 |
-
|
71 |
-
/**
|
72 |
-
* @var array The files to send with this request.
|
73 |
-
*/
|
74 |
-
protected $files = [];
|
75 |
-
|
76 |
-
/**
|
77 |
-
* @var string ETag to send with this request.
|
78 |
-
*/
|
79 |
-
protected $eTag;
|
80 |
-
|
81 |
-
/**
|
82 |
-
* @var string Graph version to use for this request.
|
83 |
-
*/
|
84 |
-
protected $graphVersion;
|
85 |
-
|
86 |
-
/**
|
87 |
-
* Creates a new Request entity.
|
88 |
-
*
|
89 |
-
* @param FacebookApp|null $app
|
90 |
-
* @param AccessToken|string|null $accessToken
|
91 |
-
* @param string|null $method
|
92 |
-
* @param string|null $endpoint
|
93 |
-
* @param array|null $params
|
94 |
-
* @param string|null $eTag
|
95 |
-
* @param string|null $graphVersion
|
96 |
-
*/
|
97 |
-
public function __construct(FacebookApp $app = null, $accessToken = null, $method = null, $endpoint = null, array $params = [], $eTag = null, $graphVersion = null)
|
98 |
-
{
|
99 |
-
$this->setApp($app);
|
100 |
-
$this->setAccessToken($accessToken);
|
101 |
-
$this->setMethod($method);
|
102 |
-
$this->setEndpoint($endpoint);
|
103 |
-
$this->setParams($params);
|
104 |
-
$this->setETag($eTag);
|
105 |
-
$this->graphVersion = $graphVersion ?: Facebook::DEFAULT_GRAPH_VERSION;
|
106 |
-
}
|
107 |
-
|
108 |
-
/**
|
109 |
-
* Set the access token for this request.
|
110 |
-
*
|
111 |
-
* @param AccessToken|string
|
112 |
-
*
|
113 |
-
* @return FacebookRequest
|
114 |
-
*/
|
115 |
-
public function setAccessToken($accessToken)
|
116 |
-
{
|
117 |
-
$this->accessToken = $accessToken;
|
118 |
-
if ($accessToken instanceof AccessToken) {
|
119 |
-
$this->accessToken = $accessToken->getValue();
|
120 |
-
}
|
121 |
-
|
122 |
-
return $this;
|
123 |
-
}
|
124 |
-
|
125 |
-
/**
|
126 |
-
* Sets the access token with one harvested from a URL or POST params.
|
127 |
-
*
|
128 |
-
* @param string $accessToken The access token.
|
129 |
-
*
|
130 |
-
* @return FacebookRequest
|
131 |
-
*
|
132 |
-
* @throws FacebookSDKException
|
133 |
-
*/
|
134 |
-
public function setAccessTokenFromParams($accessToken)
|
135 |
-
{
|
136 |
-
$existingAccessToken = $this->getAccessToken();
|
137 |
-
if (!$existingAccessToken) {
|
138 |
-
$this->setAccessToken($accessToken);
|
139 |
-
} elseif ($accessToken !== $existingAccessToken) {
|
140 |
-
throw new FacebookSDKException('Access token mismatch. The access token provided in the FacebookRequest and the one provided in the URL or POST params do not match.');
|
141 |
-
}
|
142 |
-
|
143 |
-
return $this;
|
144 |
-
}
|
145 |
-
|
146 |
-
/**
|
147 |
-
* Return the access token for this request.
|
148 |
-
*
|
149 |
-
* @return string|null
|
150 |
-
*/
|
151 |
-
public function getAccessToken()
|
152 |
-
{
|
153 |
-
return $this->accessToken;
|
154 |
-
}
|
155 |
-
|
156 |
-
/**
|
157 |
-
* Return the access token for this request as an AccessToken entity.
|
158 |
-
*
|
159 |
-
* @return AccessToken|null
|
160 |
-
*/
|
161 |
-
public function getAccessTokenEntity()
|
162 |
-
{
|
163 |
-
return $this->accessToken ? new AccessToken($this->accessToken) : null;
|
164 |
-
}
|
165 |
-
|
166 |
-
/**
|
167 |
-
* Set the FacebookApp entity used for this request.
|
168 |
-
*
|
169 |
-
* @param FacebookApp|null $app
|
170 |
-
*/
|
171 |
-
public function setApp(FacebookApp $app = null)
|
172 |
-
{
|
173 |
-
$this->app = $app;
|
174 |
-
}
|
175 |
-
|
176 |
-
/**
|
177 |
-
* Return the FacebookApp entity used for this request.
|
178 |
-
*
|
179 |
-
* @return FacebookApp
|
180 |
-
*/
|
181 |
-
public function getApp()
|
182 |
-
{
|
183 |
-
return $this->app;
|
184 |
-
}
|
185 |
-
|
186 |
-
/**
|
187 |
-
* Generate an app secret proof to sign this request.
|
188 |
-
*
|
189 |
-
* @return string|null
|
190 |
-
*/
|
191 |
-
public function getAppSecretProof()
|
192 |
-
{
|
193 |
-
if (!$accessTokenEntity = $this->getAccessTokenEntity()) {
|
194 |
-
return null;
|
195 |
-
}
|
196 |
-
|
197 |
-
return $accessTokenEntity->getAppSecretProof($this->app->getSecret());
|
198 |
-
}
|
199 |
-
|
200 |
-
/**
|
201 |
-
* Validate that an access token exists for this request.
|
202 |
-
*
|
203 |
-
* @throws FacebookSDKException
|
204 |
-
*/
|
205 |
-
public function validateAccessToken()
|
206 |
-
{
|
207 |
-
$accessToken = $this->getAccessToken();
|
208 |
-
if (!$accessToken) {
|
209 |
-
throw new FacebookSDKException('You must provide an access token.');
|
210 |
-
}
|
211 |
-
}
|
212 |
-
|
213 |
-
/**
|
214 |
-
* Set the HTTP method for this request.
|
215 |
-
*
|
216 |
-
* @param string
|
217 |
-
*/
|
218 |
-
public function setMethod($method)
|
219 |
-
{
|
220 |
-
$this->method = strtoupper($method);
|
221 |
-
}
|
222 |
-
|
223 |
-
/**
|
224 |
-
* Return the HTTP method for this request.
|
225 |
-
*
|
226 |
-
* @return string
|
227 |
-
*/
|
228 |
-
public function getMethod()
|
229 |
-
{
|
230 |
-
return $this->method;
|
231 |
-
}
|
232 |
-
|
233 |
-
/**
|
234 |
-
* Validate that the HTTP method is set.
|
235 |
-
*
|
236 |
-
* @throws FacebookSDKException
|
237 |
-
*/
|
238 |
-
public function validateMethod()
|
239 |
-
{
|
240 |
-
if (!$this->method) {
|
241 |
-
throw new FacebookSDKException('HTTP method not specified.');
|
242 |
-
}
|
243 |
-
|
244 |
-
if (!in_array($this->method, ['GET', 'POST', 'DELETE'])) {
|
245 |
-
throw new FacebookSDKException('Invalid HTTP method specified.');
|
246 |
-
}
|
247 |
-
}
|
248 |
-
|
249 |
-
/**
|
250 |
-
* Set the endpoint for this request.
|
251 |
-
*
|
252 |
-
* @param string
|
253 |
-
*
|
254 |
-
* @return FacebookRequest
|
255 |
-
*
|
256 |
-
* @throws FacebookSDKException
|
257 |
-
*/
|
258 |
-
public function setEndpoint($endpoint)
|
259 |
-
{
|
260 |
-
// Harvest the access token from the endpoint to keep things in sync
|
261 |
-
$params = FacebookUrlManipulator::getParamsAsArray($endpoint);
|
262 |
-
if (isset($params['access_token'])) {
|
263 |
-
$this->setAccessTokenFromParams($params['access_token']);
|
264 |
-
}
|
265 |
-
|
266 |
-
// Clean the token & app secret proof from the endpoint.
|
267 |
-
$filterParams = ['access_token', 'appsecret_proof'];
|
268 |
-
$this->endpoint = FacebookUrlManipulator::removeParamsFromUrl($endpoint, $filterParams);
|
269 |
-
|
270 |
-
return $this;
|
271 |
-
}
|
272 |
-
|
273 |
-
/**
|
274 |
-
* Return the endpoint for this request.
|
275 |
-
*
|
276 |
-
* @return string
|
277 |
-
*/
|
278 |
-
public function getEndpoint()
|
279 |
-
{
|
280 |
-
// For batch requests, this will be empty
|
281 |
-
return $this->endpoint;
|
282 |
-
}
|
283 |
-
|
284 |
-
/**
|
285 |
-
* Generate and return the headers for this request.
|
286 |
-
*
|
287 |
-
* @return array
|
288 |
-
*/
|
289 |
-
public function getHeaders()
|
290 |
-
{
|
291 |
-
$headers = static::getDefaultHeaders();
|
292 |
-
|
293 |
-
if ($this->eTag) {
|
294 |
-
$headers['If-None-Match'] = $this->eTag;
|
295 |
-
}
|
296 |
-
|
297 |
-
return array_merge($this->headers, $headers);
|
298 |
-
}
|
299 |
-
|
300 |
-
/**
|
301 |
-
* Set the headers for this request.
|
302 |
-
*
|
303 |
-
* @param array $headers
|
304 |
-
*/
|
305 |
-
public function setHeaders(array $headers)
|
306 |
-
{
|
307 |
-
$this->headers = array_merge($this->headers, $headers);
|
308 |
-
}
|
309 |
-
|
310 |
-
/**
|
311 |
-
* Sets the eTag value.
|
312 |
-
*
|
313 |
-
* @param string $eTag
|
314 |
-
*/
|
315 |
-
public function setETag($eTag)
|
316 |
-
{
|
317 |
-
$this->eTag = $eTag;
|
318 |
-
}
|
319 |
-
|
320 |
-
/**
|
321 |
-
* Set the params for this request.
|
322 |
-
*
|
323 |
-
* @param array $params
|
324 |
-
*
|
325 |
-
* @return FacebookRequest
|
326 |
-
*
|
327 |
-
* @throws FacebookSDKException
|
328 |
-
*/
|
329 |
-
public function setParams(array $params = [])
|
330 |
-
{
|
331 |
-
if (isset($params['access_token'])) {
|
332 |
-
$this->setAccessTokenFromParams($params['access_token']);
|
333 |
-
}
|
334 |
-
|
335 |
-
// Don't let these buggers slip in.
|
336 |
-
unset($params['access_token'], $params['appsecret_proof']);
|
337 |
-
|
338 |
-
// @TODO Refactor code above with this
|
339 |
-
//$params = $this->sanitizeAuthenticationParams($params);
|
340 |
-
$params = $this->sanitizeFileParams($params);
|
341 |
-
$this->dangerouslySetParams($params);
|
342 |
-
|
343 |
-
return $this;
|
344 |
-
}
|
345 |
-
|
346 |
-
/**
|
347 |
-
* Set the params for this request without filtering them first.
|
348 |
-
*
|
349 |
-
* @param array $params
|
350 |
-
*
|
351 |
-
* @return FacebookRequest
|
352 |
-
*/
|
353 |
-
public function dangerouslySetParams(array $params = [])
|
354 |
-
{
|
355 |
-
$this->params = array_merge($this->params, $params);
|
356 |
-
|
357 |
-
return $this;
|
358 |
-
}
|
359 |
-
|
360 |
-
/**
|
361 |
-
* Iterate over the params and pull out the file uploads.
|
362 |
-
*
|
363 |
-
* @param array $params
|
364 |
-
*
|
365 |
-
* @return array
|
366 |
-
*/
|
367 |
-
public function sanitizeFileParams(array $params)
|
368 |
-
{
|
369 |
-
foreach ($params as $key => $value) {
|
370 |
-
if ($value instanceof FacebookFile) {
|
371 |
-
$this->addFile($key, $value);
|
372 |
-
unset($params[$key]);
|
373 |
-
}
|
374 |
-
}
|
375 |
-
|
376 |
-
return $params;
|
377 |
-
}
|
378 |
-
|
379 |
-
/**
|
380 |
-
* Add a file to be uploaded.
|
381 |
-
*
|
382 |
-
* @param string $key
|
383 |
-
* @param FacebookFile $file
|
384 |
-
*/
|
385 |
-
public function addFile($key, FacebookFile $file)
|
386 |
-
{
|
387 |
-
$this->files[$key] = $file;
|
388 |
-
}
|
389 |
-
|
390 |
-
/**
|
391 |
-
* Removes all the files from the upload queue.
|
392 |
-
*/
|
393 |
-
public function resetFiles()
|
394 |
-
{
|
395 |
-
$this->files = [];
|
396 |
-
}
|
397 |
-
|
398 |
-
/**
|
399 |
-
* Get the list of files to be uploaded.
|
400 |
-
*
|
401 |
-
* @return array
|
402 |
-
*/
|
403 |
-
public function getFiles()
|
404 |
-
{
|
405 |
-
return $this->files;
|
406 |
-
}
|
407 |
-
|
408 |
-
/**
|
409 |
-
* Let's us know if there is a file upload with this request.
|
410 |
-
*
|
411 |
-
* @return boolean
|
412 |
-
*/
|
413 |
-
public function containsFileUploads()
|
414 |
-
{
|
415 |
-
return !empty($this->files);
|
416 |
-
}
|
417 |
-
|
418 |
-
/**
|
419 |
-
* Let's us know if there is a video upload with this request.
|
420 |
-
*
|
421 |
-
* @return boolean
|
422 |
-
*/
|
423 |
-
public function containsVideoUploads()
|
424 |
-
{
|
425 |
-
foreach ($this->files as $file) {
|
426 |
-
if ($file instanceof FacebookVideo) {
|
427 |
-
return true;
|
428 |
-
}
|
429 |
-
}
|
430 |
-
|
431 |
-
return false;
|
432 |
-
}
|
433 |
-
|
434 |
-
/**
|
435 |
-
* Returns the body of the request as multipart/form-data.
|
436 |
-
*
|
437 |
-
* @return RequestBodyMultipart
|
438 |
-
*/
|
439 |
-
public function getMultipartBody()
|
440 |
-
{
|
441 |
-
$params = $this->getPostParams();
|
442 |
-
|
443 |
-
return new RequestBodyMultipart($params, $this->files);
|
444 |
-
}
|
445 |
-
|
446 |
-
/**
|
447 |
-
* Returns the body of the request as URL-encoded.
|
448 |
-
*
|
449 |
-
* @return RequestBodyUrlEncoded
|
450 |
-
*/
|
451 |
-
public function getUrlEncodedBody()
|
452 |
-
{
|
453 |
-
$params = $this->getPostParams();
|
454 |
-
|
455 |
-
return new RequestBodyUrlEncoded($params);
|
456 |
-
}
|
457 |
-
|
458 |
-
/**
|
459 |
-
* Generate and return the params for this request.
|
460 |
-
*
|
461 |
-
* @return array
|
462 |
-
*/
|
463 |
-
public function getParams()
|
464 |
-
{
|
465 |
-
$params = $this->params;
|
466 |
-
|
467 |
-
$accessToken = $this->getAccessToken();
|
468 |
-
if ($accessToken) {
|
469 |
-
$params['access_token'] = $accessToken;
|
470 |
-
$params['appsecret_proof'] = $this->getAppSecretProof();
|
471 |
-
}
|
472 |
-
|
473 |
-
return $params;
|
474 |
-
}
|
475 |
-
|
476 |
-
/**
|
477 |
-
* Only return params on POST requests.
|
478 |
-
*
|
479 |
-
* @return array
|
480 |
-
*/
|
481 |
-
public function getPostParams()
|
482 |
-
{
|
483 |
-
if ($this->getMethod() === 'POST') {
|
484 |
-
return $this->getParams();
|
485 |
-
}
|
486 |
-
|
487 |
-
return [];
|
488 |
-
}
|
489 |
-
|
490 |
-
/**
|
491 |
-
* The graph version used for this request.
|
492 |
-
*
|
493 |
-
* @return string
|
494 |
-
*/
|
495 |
-
public function getGraphVersion()
|
496 |
-
{
|
497 |
-
return $this->graphVersion;
|
498 |
-
}
|
499 |
-
|
500 |
-
/**
|
501 |
-
* Generate and return the URL for this request.
|
502 |
-
*
|
503 |
-
* @return string
|
504 |
-
*/
|
505 |
-
public function getUrl()
|
506 |
-
{
|
507 |
-
$this->validateMethod();
|
508 |
-
|
509 |
-
$graphVersion = FacebookUrlManipulator::forceSlashPrefix($this->graphVersion);
|
510 |
-
$endpoint = FacebookUrlManipulator::forceSlashPrefix($this->getEndpoint());
|
511 |
-
|
512 |
-
$url = $graphVersion . $endpoint;
|
513 |
-
|
514 |
-
if ($this->getMethod() !== 'POST') {
|
515 |
-
$params = $this->getParams();
|
516 |
-
$url = FacebookUrlManipulator::appendParamsToUrl($url, $params);
|
517 |
-
}
|
518 |
-
|
519 |
-
return $url;
|
520 |
-
}
|
521 |
-
|
522 |
-
/**
|
523 |
-
* Return the default headers that every request should use.
|
524 |
-
*
|
525 |
-
* @return array
|
526 |
-
*/
|
527 |
-
public static function getDefaultHeaders()
|
528 |
-
{
|
529 |
-
return [
|
530 |
-
'User-Agent' => 'fb-php-' . Facebook::VERSION,
|
531 |
-
'Accept-Encoding' => '*',
|
532 |
-
];
|
533 |
-
}
|
534 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/FacebookResponse.php
DELETED
@@ -1,410 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook;
|
25 |
-
|
26 |
-
use Facebook\GraphNodes\GraphNodeFactory;
|
27 |
-
use Facebook\Exceptions\FacebookResponseException;
|
28 |
-
use Facebook\Exceptions\FacebookSDKException;
|
29 |
-
|
30 |
-
/**
|
31 |
-
* Class FacebookResponse
|
32 |
-
*
|
33 |
-
* @package Facebook
|
34 |
-
*/
|
35 |
-
class FacebookResponse
|
36 |
-
{
|
37 |
-
/**
|
38 |
-
* @var int The HTTP status code response from Graph.
|
39 |
-
*/
|
40 |
-
protected $httpStatusCode;
|
41 |
-
|
42 |
-
/**
|
43 |
-
* @var array The headers returned from Graph.
|
44 |
-
*/
|
45 |
-
protected $headers;
|
46 |
-
|
47 |
-
/**
|
48 |
-
* @var string The raw body of the response from Graph.
|
49 |
-
*/
|
50 |
-
protected $body;
|
51 |
-
|
52 |
-
/**
|
53 |
-
* @var array The decoded body of the Graph response.
|
54 |
-
*/
|
55 |
-
protected $decodedBody = [];
|
56 |
-
|
57 |
-
/**
|
58 |
-
* @var FacebookRequest The original request that returned this response.
|
59 |
-
*/
|
60 |
-
protected $request;
|
61 |
-
|
62 |
-
/**
|
63 |
-
* @var FacebookSDKException The exception thrown by this request.
|
64 |
-
*/
|
65 |
-
protected $thrownException;
|
66 |
-
|
67 |
-
/**
|
68 |
-
* Creates a new Response entity.
|
69 |
-
*
|
70 |
-
* @param FacebookRequest $request
|
71 |
-
* @param string|null $body
|
72 |
-
* @param int|null $httpStatusCode
|
73 |
-
* @param array|null $headers
|
74 |
-
*/
|
75 |
-
public function __construct(FacebookRequest $request, $body = null, $httpStatusCode = null, array $headers = [])
|
76 |
-
{
|
77 |
-
$this->request = $request;
|
78 |
-
$this->body = $body;
|
79 |
-
$this->httpStatusCode = $httpStatusCode;
|
80 |
-
$this->headers = $headers;
|
81 |
-
|
82 |
-
$this->decodeBody();
|
83 |
-
}
|
84 |
-
|
85 |
-
/**
|
86 |
-
* Return the original request that returned this response.
|
87 |
-
*
|
88 |
-
* @return FacebookRequest
|
89 |
-
*/
|
90 |
-
public function getRequest()
|
91 |
-
{
|
92 |
-
return $this->request;
|
93 |
-
}
|
94 |
-
|
95 |
-
/**
|
96 |
-
* Return the FacebookApp entity used for this response.
|
97 |
-
*
|
98 |
-
* @return FacebookApp
|
99 |
-
*/
|
100 |
-
public function getApp()
|
101 |
-
{
|
102 |
-
return $this->request->getApp();
|
103 |
-
}
|
104 |
-
|
105 |
-
/**
|
106 |
-
* Return the access token that was used for this response.
|
107 |
-
*
|
108 |
-
* @return string|null
|
109 |
-
*/
|
110 |
-
public function getAccessToken()
|
111 |
-
{
|
112 |
-
return $this->request->getAccessToken();
|
113 |
-
}
|
114 |
-
|
115 |
-
/**
|
116 |
-
* Return the HTTP status code for this response.
|
117 |
-
*
|
118 |
-
* @return int
|
119 |
-
*/
|
120 |
-
public function getHttpStatusCode()
|
121 |
-
{
|
122 |
-
return $this->httpStatusCode;
|
123 |
-
}
|
124 |
-
|
125 |
-
/**
|
126 |
-
* Return the HTTP headers for this response.
|
127 |
-
*
|
128 |
-
* @return array
|
129 |
-
*/
|
130 |
-
public function getHeaders()
|
131 |
-
{
|
132 |
-
return $this->headers;
|
133 |
-
}
|
134 |
-
|
135 |
-
/**
|
136 |
-
* Return the raw body response.
|
137 |
-
*
|
138 |
-
* @return string
|
139 |
-
*/
|
140 |
-
public function getBody()
|
141 |
-
{
|
142 |
-
return $this->body;
|
143 |
-
}
|
144 |
-
|
145 |
-
/**
|
146 |
-
* Return the decoded body response.
|
147 |
-
*
|
148 |
-
* @return array
|
149 |
-
*/
|
150 |
-
public function getDecodedBody()
|
151 |
-
{
|
152 |
-
return $this->decodedBody;
|
153 |
-
}
|
154 |
-
|
155 |
-
/**
|
156 |
-
* Get the app secret proof that was used for this response.
|
157 |
-
*
|
158 |
-
* @return string|null
|
159 |
-
*/
|
160 |
-
public function getAppSecretProof()
|
161 |
-
{
|
162 |
-
return $this->request->getAppSecretProof();
|
163 |
-
}
|
164 |
-
|
165 |
-
/**
|
166 |
-
* Get the ETag associated with the response.
|
167 |
-
*
|
168 |
-
* @return string|null
|
169 |
-
*/
|
170 |
-
public function getETag()
|
171 |
-
{
|
172 |
-
return isset($this->headers['ETag']) ? $this->headers['ETag'] : null;
|
173 |
-
}
|
174 |
-
|
175 |
-
/**
|
176 |
-
* Get the version of Graph that returned this response.
|
177 |
-
*
|
178 |
-
* @return string|null
|
179 |
-
*/
|
180 |
-
public function getGraphVersion()
|
181 |
-
{
|
182 |
-
return isset($this->headers['Facebook-API-Version']) ? $this->headers['Facebook-API-Version'] : null;
|
183 |
-
}
|
184 |
-
|
185 |
-
/**
|
186 |
-
* Returns true if Graph returned an error message.
|
187 |
-
*
|
188 |
-
* @return boolean
|
189 |
-
*/
|
190 |
-
public function isError()
|
191 |
-
{
|
192 |
-
return isset($this->decodedBody['error']);
|
193 |
-
}
|
194 |
-
|
195 |
-
/**
|
196 |
-
* Throws the exception.
|
197 |
-
*
|
198 |
-
* @throws FacebookSDKException
|
199 |
-
*/
|
200 |
-
public function throwException()
|
201 |
-
{
|
202 |
-
throw $this->thrownException;
|
203 |
-
}
|
204 |
-
|
205 |
-
/**
|
206 |
-
* Instantiates an exception to be thrown later.
|
207 |
-
*/
|
208 |
-
public function makeException()
|
209 |
-
{
|
210 |
-
$this->thrownException = FacebookResponseException::create($this);
|
211 |
-
}
|
212 |
-
|
213 |
-
/**
|
214 |
-
* Returns the exception that was thrown for this request.
|
215 |
-
*
|
216 |
-
* @return FacebookResponseException|null
|
217 |
-
*/
|
218 |
-
public function getThrownException()
|
219 |
-
{
|
220 |
-
return $this->thrownException;
|
221 |
-
}
|
222 |
-
|
223 |
-
/**
|
224 |
-
* Convert the raw response into an array if possible.
|
225 |
-
*
|
226 |
-
* Graph will return 2 types of responses:
|
227 |
-
* - JSON(P)
|
228 |
-
* Most responses from Graph are JSON(P)
|
229 |
-
* - application/x-www-form-urlencoded key/value pairs
|
230 |
-
* Happens on the `/oauth/access_token` endpoint when exchanging
|
231 |
-
* a short-lived access token for a long-lived access token
|
232 |
-
* - And sometimes nothing :/ but that'd be a bug.
|
233 |
-
*/
|
234 |
-
public function decodeBody()
|
235 |
-
{
|
236 |
-
$this->decodedBody = json_decode($this->body, true);
|
237 |
-
|
238 |
-
if ($this->decodedBody === null) {
|
239 |
-
$this->decodedBody = [];
|
240 |
-
parse_str($this->body, $this->decodedBody);
|
241 |
-
} elseif (is_bool($this->decodedBody)) {
|
242 |
-
// Backwards compatibility for Graph < 2.1.
|
243 |
-
// Mimics 2.1 responses.
|
244 |
-
// @TODO Remove this after Graph 2.0 is no longer supported
|
245 |
-
$this->decodedBody = ['success' => $this->decodedBody];
|
246 |
-
} elseif (is_numeric($this->decodedBody)) {
|
247 |
-
$this->decodedBody = ['id' => $this->decodedBody];
|
248 |
-
}
|
249 |
-
|
250 |
-
if (!is_array($this->decodedBody)) {
|
251 |
-
$this->decodedBody = [];
|
252 |
-
}
|
253 |
-
|
254 |
-
if ($this->isError()) {
|
255 |
-
$this->makeException();
|
256 |
-
}
|
257 |
-
}
|
258 |
-
|
259 |
-
/**
|
260 |
-
* Instantiate a new GraphObject from response.
|
261 |
-
*
|
262 |
-
* @param string|null $subclassName The GraphNode subclass to cast to.
|
263 |
-
*
|
264 |
-
* @return \Facebook\GraphNodes\GraphObject
|
265 |
-
*
|
266 |
-
* @throws FacebookSDKException
|
267 |
-
*
|
268 |
-
* @deprecated 5.0.0 getGraphObject() has been renamed to getGraphNode()
|
269 |
-
* @todo v6: Remove this method
|
270 |
-
*/
|
271 |
-
public function getGraphObject($subclassName = null)
|
272 |
-
{
|
273 |
-
return $this->getGraphNode($subclassName);
|
274 |
-
}
|
275 |
-
|
276 |
-
/**
|
277 |
-
* Instantiate a new GraphNode from response.
|
278 |
-
*
|
279 |
-
* @param string|null $subclassName The GraphNode subclass to cast to.
|
280 |
-
*
|
281 |
-
* @return \Facebook\GraphNodes\GraphNode
|
282 |
-
*
|
283 |
-
* @throws FacebookSDKException
|
284 |
-
*/
|
285 |
-
public function getGraphNode($subclassName = null)
|
286 |
-
{
|
287 |
-
$factory = new GraphNodeFactory($this);
|
288 |
-
|
289 |
-
return $factory->makeGraphNode($subclassName);
|
290 |
-
}
|
291 |
-
|
292 |
-
/**
|
293 |
-
* Convenience method for creating a GraphAlbum collection.
|
294 |
-
*
|
295 |
-
* @return \Facebook\GraphNodes\GraphAlbum
|
296 |
-
*
|
297 |
-
* @throws FacebookSDKException
|
298 |
-
*/
|
299 |
-
public function getGraphAlbum()
|
300 |
-
{
|
301 |
-
$factory = new GraphNodeFactory($this);
|
302 |
-
|
303 |
-
return $factory->makeGraphAlbum();
|
304 |
-
}
|
305 |
-
|
306 |
-
/**
|
307 |
-
* Convenience method for creating a GraphPage collection.
|
308 |
-
*
|
309 |
-
* @return \Facebook\GraphNodes\GraphPage
|
310 |
-
*
|
311 |
-
* @throws FacebookSDKException
|
312 |
-
*/
|
313 |
-
public function getGraphPage()
|
314 |
-
{
|
315 |
-
$factory = new GraphNodeFactory($this);
|
316 |
-
|
317 |
-
return $factory->makeGraphPage();
|
318 |
-
}
|
319 |
-
|
320 |
-
/**
|
321 |
-
* Convenience method for creating a GraphSessionInfo collection.
|
322 |
-
*
|
323 |
-
* @return \Facebook\GraphNodes\GraphSessionInfo
|
324 |
-
*
|
325 |
-
* @throws FacebookSDKException
|
326 |
-
*/
|
327 |
-
public function getGraphSessionInfo()
|
328 |
-
{
|
329 |
-
$factory = new GraphNodeFactory($this);
|
330 |
-
|
331 |
-
return $factory->makeGraphSessionInfo();
|
332 |
-
}
|
333 |
-
|
334 |
-
/**
|
335 |
-
* Convenience method for creating a GraphUser collection.
|
336 |
-
*
|
337 |
-
* @return \Facebook\GraphNodes\GraphUser
|
338 |
-
*
|
339 |
-
* @throws FacebookSDKException
|
340 |
-
*/
|
341 |
-
public function getGraphUser()
|
342 |
-
{
|
343 |
-
$factory = new GraphNodeFactory($this);
|
344 |
-
|
345 |
-
return $factory->makeGraphUser();
|
346 |
-
}
|
347 |
-
|
348 |
-
/**
|
349 |
-
* Convenience method for creating a GraphEvent collection.
|
350 |
-
*
|
351 |
-
* @return \Facebook\GraphNodes\GraphEvent
|
352 |
-
*
|
353 |
-
* @throws FacebookSDKException
|
354 |
-
*/
|
355 |
-
public function getGraphEvent()
|
356 |
-
{
|
357 |
-
$factory = new GraphNodeFactory($this);
|
358 |
-
|
359 |
-
return $factory->makeGraphEvent();
|
360 |
-
}
|
361 |
-
|
362 |
-
/**
|
363 |
-
* Convenience method for creating a GraphGroup collection.
|
364 |
-
*
|
365 |
-
* @return \Facebook\GraphNodes\GraphGroup
|
366 |
-
*
|
367 |
-
* @throws FacebookSDKException
|
368 |
-
*/
|
369 |
-
public function getGraphGroup()
|
370 |
-
{
|
371 |
-
$factory = new GraphNodeFactory($this);
|
372 |
-
|
373 |
-
return $factory->makeGraphGroup();
|
374 |
-
}
|
375 |
-
|
376 |
-
/**
|
377 |
-
* Instantiate a new GraphList from response.
|
378 |
-
*
|
379 |
-
* @param string|null $subclassName The GraphNode subclass to cast list items to.
|
380 |
-
* @param boolean $auto_prefix Toggle to auto-prefix the subclass name.
|
381 |
-
*
|
382 |
-
* @return \Facebook\GraphNodes\GraphList
|
383 |
-
*
|
384 |
-
* @throws FacebookSDKException
|
385 |
-
*
|
386 |
-
* @deprecated 5.0.0 getGraphList() has been renamed to getGraphEdge()
|
387 |
-
* @todo v6: Remove this method
|
388 |
-
*/
|
389 |
-
public function getGraphList($subclassName = null, $auto_prefix = true)
|
390 |
-
{
|
391 |
-
return $this->getGraphEdge($subclassName, $auto_prefix);
|
392 |
-
}
|
393 |
-
|
394 |
-
/**
|
395 |
-
* Instantiate a new GraphEdge from response.
|
396 |
-
*
|
397 |
-
* @param string|null $subclassName The GraphNode subclass to cast list items to.
|
398 |
-
* @param boolean $auto_prefix Toggle to auto-prefix the subclass name.
|
399 |
-
*
|
400 |
-
* @return \Facebook\GraphNodes\GraphEdge
|
401 |
-
*
|
402 |
-
* @throws FacebookSDKException
|
403 |
-
*/
|
404 |
-
public function getGraphEdge($subclassName = null, $auto_prefix = true)
|
405 |
-
{
|
406 |
-
$factory = new GraphNodeFactory($this);
|
407 |
-
|
408 |
-
return $factory->makeGraphEdge($subclassName, $auto_prefix);
|
409 |
-
}
|
410 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/FileUpload/FacebookFile.php
DELETED
@@ -1,169 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\FileUpload;
|
25 |
-
|
26 |
-
use Facebook\Exceptions\FacebookSDKException;
|
27 |
-
|
28 |
-
/**
|
29 |
-
* Class FacebookFile
|
30 |
-
*
|
31 |
-
* @package Facebook
|
32 |
-
*/
|
33 |
-
class FacebookFile
|
34 |
-
{
|
35 |
-
/**
|
36 |
-
* @var string The path to the file on the system.
|
37 |
-
*/
|
38 |
-
protected $path;
|
39 |
-
|
40 |
-
/**
|
41 |
-
* @var int The maximum bytes to read. Defaults to -1 (read all the remaining buffer).
|
42 |
-
*/
|
43 |
-
private $maxLength;
|
44 |
-
|
45 |
-
/**
|
46 |
-
* @var int Seek to the specified offset before reading. If this number is negative, no seeking will occur and reading will start from the current position.
|
47 |
-
*/
|
48 |
-
private $offset;
|
49 |
-
|
50 |
-
/**
|
51 |
-
* @var resource The stream pointing to the file.
|
52 |
-
*/
|
53 |
-
protected $stream;
|
54 |
-
|
55 |
-
/**
|
56 |
-
* Creates a new FacebookFile entity.
|
57 |
-
*
|
58 |
-
* @param string $filePath
|
59 |
-
* @param int $maxLength
|
60 |
-
* @param int $offset
|
61 |
-
*
|
62 |
-
* @throws FacebookSDKException
|
63 |
-
*/
|
64 |
-
public function __construct($filePath, $maxLength = -1, $offset = -1)
|
65 |
-
{
|
66 |
-
$this->path = $filePath;
|
67 |
-
$this->maxLength = $maxLength;
|
68 |
-
$this->offset = $offset;
|
69 |
-
$this->open();
|
70 |
-
}
|
71 |
-
|
72 |
-
/**
|
73 |
-
* Closes the stream when destructed.
|
74 |
-
*/
|
75 |
-
public function __destruct()
|
76 |
-
{
|
77 |
-
$this->close();
|
78 |
-
}
|
79 |
-
|
80 |
-
/**
|
81 |
-
* Opens a stream for the file.
|
82 |
-
*
|
83 |
-
* @throws FacebookSDKException
|
84 |
-
*/
|
85 |
-
public function open()
|
86 |
-
{
|
87 |
-
if (!$this->isRemoteFile($this->path) && !is_readable($this->path)) {
|
88 |
-
throw new FacebookSDKException('Failed to create FacebookFile entity. Unable to read resource: ' . $this->path . '.');
|
89 |
-
}
|
90 |
-
|
91 |
-
$this->stream = fopen($this->path, 'r');
|
92 |
-
|
93 |
-
if (!$this->stream) {
|
94 |
-
throw new FacebookSDKException('Failed to create FacebookFile entity. Unable to open resource: ' . $this->path . '.');
|
95 |
-
}
|
96 |
-
}
|
97 |
-
|
98 |
-
/**
|
99 |
-
* Stops the file stream.
|
100 |
-
*/
|
101 |
-
public function close()
|
102 |
-
{
|
103 |
-
if (is_resource($this->stream)) {
|
104 |
-
fclose($this->stream);
|
105 |
-
}
|
106 |
-
}
|
107 |
-
|
108 |
-
/**
|
109 |
-
* Return the contents of the file.
|
110 |
-
*
|
111 |
-
* @return string
|
112 |
-
*/
|
113 |
-
public function getContents()
|
114 |
-
{
|
115 |
-
return stream_get_contents($this->stream, $this->maxLength, $this->offset);
|
116 |
-
}
|
117 |
-
|
118 |
-
/**
|
119 |
-
* Return the name of the file.
|
120 |
-
*
|
121 |
-
* @return string
|
122 |
-
*/
|
123 |
-
public function getFileName()
|
124 |
-
{
|
125 |
-
return basename($this->path);
|
126 |
-
}
|
127 |
-
|
128 |
-
/**
|
129 |
-
* Return the path of the file.
|
130 |
-
*
|
131 |
-
* @return string
|
132 |
-
*/
|
133 |
-
public function getFilePath()
|
134 |
-
{
|
135 |
-
return $this->path;
|
136 |
-
}
|
137 |
-
|
138 |
-
/**
|
139 |
-
* Return the size of the file.
|
140 |
-
*
|
141 |
-
* @return int
|
142 |
-
*/
|
143 |
-
public function getSize()
|
144 |
-
{
|
145 |
-
return filesize($this->path);
|
146 |
-
}
|
147 |
-
|
148 |
-
/**
|
149 |
-
* Return the mimetype of the file.
|
150 |
-
*
|
151 |
-
* @return string
|
152 |
-
*/
|
153 |
-
public function getMimetype()
|
154 |
-
{
|
155 |
-
return Mimetypes::getInstance()->fromFilename($this->path) ?: 'text/plain';
|
156 |
-
}
|
157 |
-
|
158 |
-
/**
|
159 |
-
* Returns true if the path to the file is remote.
|
160 |
-
*
|
161 |
-
* @param string $pathToFile
|
162 |
-
*
|
163 |
-
* @return boolean
|
164 |
-
*/
|
165 |
-
protected function isRemoteFile($pathToFile)
|
166 |
-
{
|
167 |
-
return preg_match('/^(https?|ftp):\/\/.*/', $pathToFile) === 1;
|
168 |
-
}
|
169 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/FileUpload/FacebookResumableUploader.php
DELETED
@@ -1,167 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\FileUpload;
|
25 |
-
|
26 |
-
use Facebook\Authentication\AccessToken;
|
27 |
-
use Facebook\Exceptions\FacebookResponseException;
|
28 |
-
use Facebook\Exceptions\FacebookResumableUploadException;
|
29 |
-
use Facebook\Exceptions\FacebookSDKException;
|
30 |
-
use Facebook\FacebookApp;
|
31 |
-
use Facebook\FacebookClient;
|
32 |
-
use Facebook\FacebookRequest;
|
33 |
-
|
34 |
-
/**
|
35 |
-
* Class FacebookResumableUploader
|
36 |
-
*
|
37 |
-
* @package Facebook
|
38 |
-
*/
|
39 |
-
class FacebookResumableUploader
|
40 |
-
{
|
41 |
-
/**
|
42 |
-
* @var FacebookApp
|
43 |
-
*/
|
44 |
-
protected $app;
|
45 |
-
|
46 |
-
/**
|
47 |
-
* @var string
|
48 |
-
*/
|
49 |
-
protected $accessToken;
|
50 |
-
|
51 |
-
/**
|
52 |
-
* @var FacebookClient The Facebook client service.
|
53 |
-
*/
|
54 |
-
protected $client;
|
55 |
-
|
56 |
-
/**
|
57 |
-
* @var string Graph version to use for this request.
|
58 |
-
*/
|
59 |
-
protected $graphVersion;
|
60 |
-
|
61 |
-
/**
|
62 |
-
* @param FacebookApp $app
|
63 |
-
* @param FacebookClient $client
|
64 |
-
* @param AccessToken|string|null $accessToken
|
65 |
-
* @param string $graphVersion
|
66 |
-
*/
|
67 |
-
public function __construct(FacebookApp $app, FacebookClient $client, $accessToken, $graphVersion)
|
68 |
-
{
|
69 |
-
$this->app = $app;
|
70 |
-
$this->client = $client;
|
71 |
-
$this->accessToken = $accessToken;
|
72 |
-
$this->graphVersion = $graphVersion;
|
73 |
-
}
|
74 |
-
|
75 |
-
/**
|
76 |
-
* Upload by chunks - start phase
|
77 |
-
*
|
78 |
-
* @param string $endpoint
|
79 |
-
* @param FacebookFile $file
|
80 |
-
*
|
81 |
-
* @return FacebookTransferChunk
|
82 |
-
*
|
83 |
-
* @throws FacebookSDKException
|
84 |
-
*/
|
85 |
-
public function start($endpoint, FacebookFile $file)
|
86 |
-
{
|
87 |
-
$params = [
|
88 |
-
'upload_phase' => 'start',
|
89 |
-
'file_size' => $file->getSize(),
|
90 |
-
];
|
91 |
-
$response = $this->sendUploadRequest($endpoint, $params);
|
92 |
-
|
93 |
-
return new FacebookTransferChunk($file, $response['upload_session_id'], $response['video_id'], $response['start_offset'], $response['end_offset']);
|
94 |
-
}
|
95 |
-
|
96 |
-
/**
|
97 |
-
* Upload by chunks - transfer phase
|
98 |
-
*
|
99 |
-
* @param string $endpoint
|
100 |
-
* @param FacebookTransferChunk $chunk
|
101 |
-
* @param boolean $allowToThrow
|
102 |
-
*
|
103 |
-
* @return FacebookTransferChunk
|
104 |
-
*
|
105 |
-
* @throws FacebookResponseException
|
106 |
-
*/
|
107 |
-
public function transfer($endpoint, FacebookTransferChunk $chunk, $allowToThrow = false)
|
108 |
-
{
|
109 |
-
$params = [
|
110 |
-
'upload_phase' => 'transfer',
|
111 |
-
'upload_session_id' => $chunk->getUploadSessionId(),
|
112 |
-
'start_offset' => $chunk->getStartOffset(),
|
113 |
-
'video_file_chunk' => $chunk->getPartialFile(),
|
114 |
-
];
|
115 |
-
|
116 |
-
try {
|
117 |
-
$response = $this->sendUploadRequest($endpoint, $params);
|
118 |
-
} catch (FacebookResponseException $e) {
|
119 |
-
$preException = $e->getPrevious();
|
120 |
-
if ($allowToThrow || !$preException instanceof FacebookResumableUploadException) {
|
121 |
-
throw $e;
|
122 |
-
}
|
123 |
-
|
124 |
-
// Return the same chunk entity so it can be retried.
|
125 |
-
return $chunk;
|
126 |
-
}
|
127 |
-
|
128 |
-
return new FacebookTransferChunk($chunk->getFile(), $chunk->getUploadSessionId(), $chunk->getVideoId(), $response['start_offset'], $response['end_offset']);
|
129 |
-
}
|
130 |
-
|
131 |
-
/**
|
132 |
-
* Upload by chunks - finish phase
|
133 |
-
*
|
134 |
-
* @param string $endpoint
|
135 |
-
* @param string $uploadSessionId
|
136 |
-
* @param array $metadata The metadata associated with the file.
|
137 |
-
*
|
138 |
-
* @return boolean
|
139 |
-
*
|
140 |
-
* @throws FacebookSDKException
|
141 |
-
*/
|
142 |
-
public function finish($endpoint, $uploadSessionId, $metadata = [])
|
143 |
-
{
|
144 |
-
$params = array_merge($metadata, [
|
145 |
-
'upload_phase' => 'finish',
|
146 |
-
'upload_session_id' => $uploadSessionId,
|
147 |
-
]);
|
148 |
-
$response = $this->sendUploadRequest($endpoint, $params);
|
149 |
-
|
150 |
-
return $response['success'];
|
151 |
-
}
|
152 |
-
|
153 |
-
/**
|
154 |
-
* Helper to make a FacebookRequest and send it.
|
155 |
-
*
|
156 |
-
* @param string $endpoint The endpoint to POST to.
|
157 |
-
* @param array $params The params to send with the request.
|
158 |
-
*
|
159 |
-
* @return array
|
160 |
-
*/
|
161 |
-
private function sendUploadRequest($endpoint, $params = [])
|
162 |
-
{
|
163 |
-
$request = new FacebookRequest($this->app, $this->accessToken, 'POST', $endpoint, $params, null, $this->graphVersion);
|
164 |
-
|
165 |
-
return $this->client->sendRequest($request)->getDecodedBody();
|
166 |
-
}
|
167 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/FileUpload/FacebookTransferChunk.php
DELETED
@@ -1,133 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\FileUpload;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Class FacebookTransferChunk
|
28 |
-
*
|
29 |
-
* @package Facebook
|
30 |
-
*/
|
31 |
-
class FacebookTransferChunk
|
32 |
-
{
|
33 |
-
/**
|
34 |
-
* @var FacebookFile The file to chunk during upload.
|
35 |
-
*/
|
36 |
-
private $file;
|
37 |
-
|
38 |
-
/**
|
39 |
-
* @var int The ID of the upload session.
|
40 |
-
*/
|
41 |
-
private $uploadSessionId;
|
42 |
-
|
43 |
-
/**
|
44 |
-
* @var int Start byte position of the next file chunk.
|
45 |
-
*/
|
46 |
-
private $startOffset;
|
47 |
-
|
48 |
-
/**
|
49 |
-
* @var int End byte position of the next file chunk.
|
50 |
-
*/
|
51 |
-
private $endOffset;
|
52 |
-
|
53 |
-
/**
|
54 |
-
* @var int The ID of the video.
|
55 |
-
*/
|
56 |
-
private $videoId;
|
57 |
-
|
58 |
-
/**
|
59 |
-
* @param FacebookFile $file
|
60 |
-
* @param int $uploadSessionId
|
61 |
-
* @param int $videoId
|
62 |
-
* @param int $startOffset
|
63 |
-
* @param int $endOffset
|
64 |
-
*/
|
65 |
-
public function __construct(FacebookFile $file, $uploadSessionId, $videoId, $startOffset, $endOffset)
|
66 |
-
{
|
67 |
-
$this->file = $file;
|
68 |
-
$this->uploadSessionId = $uploadSessionId;
|
69 |
-
$this->videoId = $videoId;
|
70 |
-
$this->startOffset = $startOffset;
|
71 |
-
$this->endOffset = $endOffset;
|
72 |
-
}
|
73 |
-
|
74 |
-
/**
|
75 |
-
* Return the file entity.
|
76 |
-
*
|
77 |
-
* @return FacebookFile
|
78 |
-
*/
|
79 |
-
public function getFile()
|
80 |
-
{
|
81 |
-
return $this->file;
|
82 |
-
}
|
83 |
-
|
84 |
-
/**
|
85 |
-
* Return a FacebookFile entity with partial content.
|
86 |
-
*
|
87 |
-
* @return FacebookFile
|
88 |
-
*/
|
89 |
-
public function getPartialFile()
|
90 |
-
{
|
91 |
-
$maxLength = $this->endOffset - $this->startOffset;
|
92 |
-
|
93 |
-
return new FacebookFile($this->file->getFilePath(), $maxLength, $this->startOffset);
|
94 |
-
}
|
95 |
-
|
96 |
-
/**
|
97 |
-
* Return upload session Id
|
98 |
-
*
|
99 |
-
* @return int
|
100 |
-
*/
|
101 |
-
public function getUploadSessionId()
|
102 |
-
{
|
103 |
-
return $this->uploadSessionId;
|
104 |
-
}
|
105 |
-
|
106 |
-
/**
|
107 |
-
* Check whether is the last chunk
|
108 |
-
*
|
109 |
-
* @return bool
|
110 |
-
*/
|
111 |
-
public function isLastChunk()
|
112 |
-
{
|
113 |
-
return $this->startOffset === $this->endOffset;
|
114 |
-
}
|
115 |
-
|
116 |
-
/**
|
117 |
-
* @return int
|
118 |
-
*/
|
119 |
-
public function getStartOffset()
|
120 |
-
{
|
121 |
-
return $this->startOffset;
|
122 |
-
}
|
123 |
-
|
124 |
-
/**
|
125 |
-
* Get uploaded video Id
|
126 |
-
*
|
127 |
-
* @return int
|
128 |
-
*/
|
129 |
-
public function getVideoId()
|
130 |
-
{
|
131 |
-
return $this->videoId;
|
132 |
-
}
|
133 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/FileUpload/FacebookVideo.php
DELETED
@@ -1,33 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\FileUpload;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Class FacebookVideo
|
28 |
-
*
|
29 |
-
* @package Facebook
|
30 |
-
*/
|
31 |
-
class FacebookVideo extends FacebookFile
|
32 |
-
{
|
33 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/FileUpload/Mimetypes.php
DELETED
@@ -1,987 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\FileUpload;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Provides mappings of file extensions to mimetypes
|
28 |
-
*
|
29 |
-
* Taken from Guzzle
|
30 |
-
*
|
31 |
-
* @see https://github.com/guzzle/guzzle/blob/master/src/Mimetypes.php
|
32 |
-
*
|
33 |
-
* @link http://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x/conf/mime.types
|
34 |
-
*/
|
35 |
-
class Mimetypes
|
36 |
-
{
|
37 |
-
/** @var self */
|
38 |
-
protected static $instance;
|
39 |
-
|
40 |
-
/** @var array Mapping of extension to mimetype */
|
41 |
-
protected $mimetypes = [
|
42 |
-
'3dml' => 'text/vnd.in3d.3dml',
|
43 |
-
'3g2' => 'video/3gpp2',
|
44 |
-
'3gp' => 'video/3gpp',
|
45 |
-
'7z' => 'application/x-7z-compressed',
|
46 |
-
'aab' => 'application/x-authorware-bin',
|
47 |
-
'aac' => 'audio/x-aac',
|
48 |
-
'aam' => 'application/x-authorware-map',
|
49 |
-
'aas' => 'application/x-authorware-seg',
|
50 |
-
'abw' => 'application/x-abiword',
|
51 |
-
'ac' => 'application/pkix-attr-cert',
|
52 |
-
'acc' => 'application/vnd.americandynamics.acc',
|
53 |
-
'ace' => 'application/x-ace-compressed',
|
54 |
-
'acu' => 'application/vnd.acucobol',
|
55 |
-
'acutc' => 'application/vnd.acucorp',
|
56 |
-
'adp' => 'audio/adpcm',
|
57 |
-
'aep' => 'application/vnd.audiograph',
|
58 |
-
'afm' => 'application/x-font-type1',
|
59 |
-
'afp' => 'application/vnd.ibm.modcap',
|
60 |
-
'ahead' => 'application/vnd.ahead.space',
|
61 |
-
'ai' => 'application/postscript',
|
62 |
-
'aif' => 'audio/x-aiff',
|
63 |
-
'aifc' => 'audio/x-aiff',
|
64 |
-
'aiff' => 'audio/x-aiff',
|
65 |
-
'air' => 'application/vnd.adobe.air-application-installer-package+zip',
|
66 |
-
'ait' => 'application/vnd.dvb.ait',
|
67 |
-
'ami' => 'application/vnd.amiga.ami',
|
68 |
-
'apk' => 'application/vnd.android.package-archive',
|
69 |
-
'application' => 'application/x-ms-application',
|
70 |
-
'apr' => 'application/vnd.lotus-approach',
|
71 |
-
'asa' => 'text/plain',
|
72 |
-
'asax' => 'application/octet-stream',
|
73 |
-
'asc' => 'application/pgp-signature',
|
74 |
-
'ascx' => 'text/plain',
|
75 |
-
'asf' => 'video/x-ms-asf',
|
76 |
-
'ashx' => 'text/plain',
|
77 |
-
'asm' => 'text/x-asm',
|
78 |
-
'asmx' => 'text/plain',
|
79 |
-
'aso' => 'application/vnd.accpac.simply.aso',
|
80 |
-
'asp' => 'text/plain',
|
81 |
-
'aspx' => 'text/plain',
|
82 |
-
'asx' => 'video/x-ms-asf',
|
83 |
-
'atc' => 'application/vnd.acucorp',
|
84 |
-
'atom' => 'application/atom+xml',
|
85 |
-
'atomcat' => 'application/atomcat+xml',
|
86 |
-
'atomsvc' => 'application/atomsvc+xml',
|
87 |
-
'atx' => 'application/vnd.antix.game-component',
|
88 |
-
'au' => 'audio/basic',
|
89 |
-
'avi' => 'video/x-msvideo',
|
90 |
-
'aw' => 'application/applixware',
|
91 |
-
'axd' => 'text/plain',
|
92 |
-
'azf' => 'application/vnd.airzip.filesecure.azf',
|
93 |
-
'azs' => 'application/vnd.airzip.filesecure.azs',
|
94 |
-
'azw' => 'application/vnd.amazon.ebook',
|
95 |
-
'bat' => 'application/x-msdownload',
|
96 |
-
'bcpio' => 'application/x-bcpio',
|
97 |
-
'bdf' => 'application/x-font-bdf',
|
98 |
-
'bdm' => 'application/vnd.syncml.dm+wbxml',
|
99 |
-
'bed' => 'application/vnd.realvnc.bed',
|
100 |
-
'bh2' => 'application/vnd.fujitsu.oasysprs',
|
101 |
-
'bin' => 'application/octet-stream',
|
102 |
-
'bmi' => 'application/vnd.bmi',
|
103 |
-
'bmp' => 'image/bmp',
|
104 |
-
'book' => 'application/vnd.framemaker',
|
105 |
-
'box' => 'application/vnd.previewsystems.box',
|
106 |
-
'boz' => 'application/x-bzip2',
|
107 |
-
'bpk' => 'application/octet-stream',
|
108 |
-
'btif' => 'image/prs.btif',
|
109 |
-
'bz' => 'application/x-bzip',
|
110 |
-
'bz2' => 'application/x-bzip2',
|
111 |
-
'c' => 'text/x-c',
|
112 |
-
'c11amc' => 'application/vnd.cluetrust.cartomobile-config',
|
113 |
-
'c11amz' => 'application/vnd.cluetrust.cartomobile-config-pkg',
|
114 |
-
'c4d' => 'application/vnd.clonk.c4group',
|
115 |
-
'c4f' => 'application/vnd.clonk.c4group',
|
116 |
-
'c4g' => 'application/vnd.clonk.c4group',
|
117 |
-
'c4p' => 'application/vnd.clonk.c4group',
|
118 |
-
'c4u' => 'application/vnd.clonk.c4group',
|
119 |
-
'cab' => 'application/vnd.ms-cab-compressed',
|
120 |
-
'car' => 'application/vnd.curl.car',
|
121 |
-
'cat' => 'application/vnd.ms-pki.seccat',
|
122 |
-
'cc' => 'text/x-c',
|
123 |
-
'cct' => 'application/x-director',
|
124 |
-
'ccxml' => 'application/ccxml+xml',
|
125 |
-
'cdbcmsg' => 'application/vnd.contact.cmsg',
|
126 |
-
'cdf' => 'application/x-netcdf',
|
127 |
-
'cdkey' => 'application/vnd.mediastation.cdkey',
|
128 |
-
'cdmia' => 'application/cdmi-capability',
|
129 |
-
'cdmic' => 'application/cdmi-container',
|
130 |
-
'cdmid' => 'application/cdmi-domain',
|
131 |
-
'cdmio' => 'application/cdmi-object',
|
132 |
-
'cdmiq' => 'application/cdmi-queue',
|
133 |
-
'cdx' => 'chemical/x-cdx',
|
134 |
-
'cdxml' => 'application/vnd.chemdraw+xml',
|
135 |
-
'cdy' => 'application/vnd.cinderella',
|
136 |
-
'cer' => 'application/pkix-cert',
|
137 |
-
'cfc' => 'application/x-coldfusion',
|
138 |
-
'cfm' => 'application/x-coldfusion',
|
139 |
-
'cgm' => 'image/cgm',
|
140 |
-
'chat' => 'application/x-chat',
|
141 |
-
'chm' => 'application/vnd.ms-htmlhelp',
|
142 |
-
'chrt' => 'application/vnd.kde.kchart',
|
143 |
-
'cif' => 'chemical/x-cif',
|
144 |
-
'cii' => 'application/vnd.anser-web-certificate-issue-initiation',
|
145 |
-
'cil' => 'application/vnd.ms-artgalry',
|
146 |
-
'cla' => 'application/vnd.claymore',
|
147 |
-
'class' => 'application/java-vm',
|
148 |
-
'clkk' => 'application/vnd.crick.clicker.keyboard',
|
149 |
-
'clkp' => 'application/vnd.crick.clicker.palette',
|
150 |
-
'clkt' => 'application/vnd.crick.clicker.template',
|
151 |
-
'clkw' => 'application/vnd.crick.clicker.wordbank',
|
152 |
-
'clkx' => 'application/vnd.crick.clicker',
|
153 |
-
'clp' => 'application/x-msclip',
|
154 |
-
'cmc' => 'application/vnd.cosmocaller',
|
155 |
-
'cmdf' => 'chemical/x-cmdf',
|
156 |
-
'cml' => 'chemical/x-cml',
|
157 |
-
'cmp' => 'application/vnd.yellowriver-custom-menu',
|
158 |
-
'cmx' => 'image/x-cmx',
|
159 |
-
'cod' => 'application/vnd.rim.cod',
|
160 |
-
'com' => 'application/x-msdownload',
|
161 |
-
'conf' => 'text/plain',
|
162 |
-
'cpio' => 'application/x-cpio',
|
163 |
-
'cpp' => 'text/x-c',
|
164 |
-
'cpt' => 'application/mac-compactpro',
|
165 |
-
'crd' => 'application/x-mscardfile',
|
166 |
-
'crl' => 'application/pkix-crl',
|
167 |
-
'crt' => 'application/x-x509-ca-cert',
|
168 |
-
'cryptonote' => 'application/vnd.rig.cryptonote',
|
169 |
-
'cs' => 'text/plain',
|
170 |
-
'csh' => 'application/x-csh',
|
171 |
-
'csml' => 'chemical/x-csml',
|
172 |
-
'csp' => 'application/vnd.commonspace',
|
173 |
-
'css' => 'text/css',
|
174 |
-
'cst' => 'application/x-director',
|
175 |
-
'csv' => 'text/csv',
|
176 |
-
'cu' => 'application/cu-seeme',
|
177 |
-
'curl' => 'text/vnd.curl',
|
178 |
-
'cww' => 'application/prs.cww',
|
179 |
-
'cxt' => 'application/x-director',
|
180 |
-
'cxx' => 'text/x-c',
|
181 |
-
'dae' => 'model/vnd.collada+xml',
|
182 |
-
'daf' => 'application/vnd.mobius.daf',
|
183 |
-
'dataless' => 'application/vnd.fdsn.seed',
|
184 |
-
'davmount' => 'application/davmount+xml',
|
185 |
-
'dcr' => 'application/x-director',
|
186 |
-
'dcurl' => 'text/vnd.curl.dcurl',
|
187 |
-
'dd2' => 'application/vnd.oma.dd2+xml',
|
188 |
-
'ddd' => 'application/vnd.fujixerox.ddd',
|
189 |
-
'deb' => 'application/x-debian-package',
|
190 |
-
'def' => 'text/plain',
|
191 |
-
'deploy' => 'application/octet-stream',
|
192 |
-
'der' => 'application/x-x509-ca-cert',
|
193 |
-
'dfac' => 'application/vnd.dreamfactory',
|
194 |
-
'dic' => 'text/x-c',
|
195 |
-
'dir' => 'application/x-director',
|
196 |
-
'dis' => 'application/vnd.mobius.dis',
|
197 |
-
'dist' => 'application/octet-stream',
|
198 |
-
'distz' => 'application/octet-stream',
|
199 |
-
'djv' => 'image/vnd.djvu',
|
200 |
-
'djvu' => 'image/vnd.djvu',
|
201 |
-
'dll' => 'application/x-msdownload',
|
202 |
-
'dmg' => 'application/octet-stream',
|
203 |
-
'dms' => 'application/octet-stream',
|
204 |
-
'dna' => 'application/vnd.dna',
|
205 |
-
'doc' => 'application/msword',
|
206 |
-
'docm' => 'application/vnd.ms-word.document.macroenabled.12',
|
207 |
-
'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
208 |
-
'dot' => 'application/msword',
|
209 |
-
'dotm' => 'application/vnd.ms-word.template.macroenabled.12',
|
210 |
-
'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
|
211 |
-
'dp' => 'application/vnd.osgi.dp',
|
212 |
-
'dpg' => 'application/vnd.dpgraph',
|
213 |
-
'dra' => 'audio/vnd.dra',
|
214 |
-
'dsc' => 'text/prs.lines.tag',
|
215 |
-
'dssc' => 'application/dssc+der',
|
216 |
-
'dtb' => 'application/x-dtbook+xml',
|
217 |
-
'dtd' => 'application/xml-dtd',
|
218 |
-
'dts' => 'audio/vnd.dts',
|
219 |
-
'dtshd' => 'audio/vnd.dts.hd',
|
220 |
-
'dump' => 'application/octet-stream',
|
221 |
-
'dvi' => 'application/x-dvi',
|
222 |
-
'dwf' => 'model/vnd.dwf',
|
223 |
-
'dwg' => 'image/vnd.dwg',
|
224 |
-
'dxf' => 'image/vnd.dxf',
|
225 |
-
'dxp' => 'application/vnd.spotfire.dxp',
|
226 |
-
'dxr' => 'application/x-director',
|
227 |
-
'ecelp4800' => 'audio/vnd.nuera.ecelp4800',
|
228 |
-
'ecelp7470' => 'audio/vnd.nuera.ecelp7470',
|
229 |
-
'ecelp9600' => 'audio/vnd.nuera.ecelp9600',
|
230 |
-
'ecma' => 'application/ecmascript',
|
231 |
-
'edm' => 'application/vnd.novadigm.edm',
|
232 |
-
'edx' => 'application/vnd.novadigm.edx',
|
233 |
-
'efif' => 'application/vnd.picsel',
|
234 |
-
'ei6' => 'application/vnd.pg.osasli',
|
235 |
-
'elc' => 'application/octet-stream',
|
236 |
-
'eml' => 'message/rfc822',
|
237 |
-
'emma' => 'application/emma+xml',
|
238 |
-
'eol' => 'audio/vnd.digital-winds',
|
239 |
-
'eot' => 'application/vnd.ms-fontobject',
|
240 |
-
'eps' => 'application/postscript',
|
241 |
-
'epub' => 'application/epub+zip',
|
242 |
-
'es3' => 'application/vnd.eszigno3+xml',
|
243 |
-
'esf' => 'application/vnd.epson.esf',
|
244 |
-
'et3' => 'application/vnd.eszigno3+xml',
|
245 |
-
'etx' => 'text/x-setext',
|
246 |
-
'exe' => 'application/x-msdownload',
|
247 |
-
'exi' => 'application/exi',
|
248 |
-
'ext' => 'application/vnd.novadigm.ext',
|
249 |
-
'ez' => 'application/andrew-inset',
|
250 |
-
'ez2' => 'application/vnd.ezpix-album',
|
251 |
-
'ez3' => 'application/vnd.ezpix-package',
|
252 |
-
'f' => 'text/x-fortran',
|
253 |
-
'f4v' => 'video/x-f4v',
|
254 |
-
'f77' => 'text/x-fortran',
|
255 |
-
'f90' => 'text/x-fortran',
|
256 |
-
'fbs' => 'image/vnd.fastbidsheet',
|
257 |
-
'fcs' => 'application/vnd.isac.fcs',
|
258 |
-
'fdf' => 'application/vnd.fdf',
|
259 |
-
'fe_launch' => 'application/vnd.denovo.fcselayout-link',
|
260 |
-
'fg5' => 'application/vnd.fujitsu.oasysgp',
|
261 |
-
'fgd' => 'application/x-director',
|
262 |
-
'fh' => 'image/x-freehand',
|
263 |
-
'fh4' => 'image/x-freehand',
|
264 |
-
'fh5' => 'image/x-freehand',
|
265 |
-
'fh7' => 'image/x-freehand',
|
266 |
-
'fhc' => 'image/x-freehand',
|
267 |
-
'fig' => 'application/x-xfig',
|
268 |
-
'fli' => 'video/x-fli',
|
269 |
-
'flo' => 'application/vnd.micrografx.flo',
|
270 |
-
'flv' => 'video/x-flv',
|
271 |
-
'flw' => 'application/vnd.kde.kivio',
|
272 |
-
'flx' => 'text/vnd.fmi.flexstor',
|
273 |
-
'fly' => 'text/vnd.fly',
|
274 |
-
'fm' => 'application/vnd.framemaker',
|
275 |
-
'fnc' => 'application/vnd.frogans.fnc',
|
276 |
-
'for' => 'text/x-fortran',
|
277 |
-
'fpx' => 'image/vnd.fpx',
|
278 |
-
'frame' => 'application/vnd.framemaker',
|
279 |
-
'fsc' => 'application/vnd.fsc.weblaunch',
|
280 |
-
'fst' => 'image/vnd.fst',
|
281 |
-
'ftc' => 'application/vnd.fluxtime.clip',
|
282 |
-
'fti' => 'application/vnd.anser-web-funds-transfer-initiation',
|
283 |
-
'fvt' => 'video/vnd.fvt',
|
284 |
-
'fxp' => 'application/vnd.adobe.fxp',
|
285 |
-
'fxpl' => 'application/vnd.adobe.fxp',
|
286 |
-
'fzs' => 'application/vnd.fuzzysheet',
|
287 |
-
'g2w' => 'application/vnd.geoplan',
|
288 |
-
'g3' => 'image/g3fax',
|
289 |
-
'g3w' => 'application/vnd.geospace',
|
290 |
-
'gac' => 'application/vnd.groove-account',
|
291 |
-
'gdl' => 'model/vnd.gdl',
|
292 |
-
'geo' => 'application/vnd.dynageo',
|
293 |
-
'gex' => 'application/vnd.geometry-explorer',
|
294 |
-
'ggb' => 'application/vnd.geogebra.file',
|
295 |
-
'ggt' => 'application/vnd.geogebra.tool',
|
296 |
-
'ghf' => 'application/vnd.groove-help',
|
297 |
-
'gif' => 'image/gif',
|
298 |
-
'gim' => 'application/vnd.groove-identity-message',
|
299 |
-
'gmx' => 'application/vnd.gmx',
|
300 |
-
'gnumeric' => 'application/x-gnumeric',
|
301 |
-
'gph' => 'application/vnd.flographit',
|
302 |
-
'gqf' => 'application/vnd.grafeq',
|
303 |
-
'gqs' => 'application/vnd.grafeq',
|
304 |
-
'gram' => 'application/srgs',
|
305 |
-
'gre' => 'application/vnd.geometry-explorer',
|
306 |
-
'grv' => 'application/vnd.groove-injector',
|
307 |
-
'grxml' => 'application/srgs+xml',
|
308 |
-
'gsf' => 'application/x-font-ghostscript',
|
309 |
-
'gtar' => 'application/x-gtar',
|
310 |
-
'gtm' => 'application/vnd.groove-tool-message',
|
311 |
-
'gtw' => 'model/vnd.gtw',
|
312 |
-
'gv' => 'text/vnd.graphviz',
|
313 |
-
'gxt' => 'application/vnd.geonext',
|
314 |
-
'h' => 'text/x-c',
|
315 |
-
'h261' => 'video/h261',
|
316 |
-
'h263' => 'video/h263',
|
317 |
-
'h264' => 'video/h264',
|
318 |
-
'hal' => 'application/vnd.hal+xml',
|
319 |
-
'hbci' => 'application/vnd.hbci',
|
320 |
-
'hdf' => 'application/x-hdf',
|
321 |
-
'hh' => 'text/x-c',
|
322 |
-
'hlp' => 'application/winhlp',
|
323 |
-
'hpgl' => 'application/vnd.hp-hpgl',
|
324 |
-
'hpid' => 'application/vnd.hp-hpid',
|
325 |
-
'hps' => 'application/vnd.hp-hps',
|
326 |
-
'hqx' => 'application/mac-binhex40',
|
327 |
-
'hta' => 'application/octet-stream',
|
328 |
-
'htc' => 'text/html',
|
329 |
-
'htke' => 'application/vnd.kenameaapp',
|
330 |
-
'htm' => 'text/html',
|
331 |
-
'html' => 'text/html',
|
332 |
-
'hvd' => 'application/vnd.yamaha.hv-dic',
|
333 |
-
'hvp' => 'application/vnd.yamaha.hv-voice',
|
334 |
-
'hvs' => 'application/vnd.yamaha.hv-script',
|
335 |
-
'i2g' => 'application/vnd.intergeo',
|
336 |
-
'icc' => 'application/vnd.iccprofile',
|
337 |
-
'ice' => 'x-conference/x-cooltalk',
|
338 |
-
'icm' => 'application/vnd.iccprofile',
|
339 |
-
'ico' => 'image/x-icon',
|
340 |
-
'ics' => 'text/calendar',
|
341 |
-
'ief' => 'image/ief',
|
342 |
-
'ifb' => 'text/calendar',
|
343 |
-
'ifm' => 'application/vnd.shana.informed.formdata',
|
344 |
-
'iges' => 'model/iges',
|
345 |
-
'igl' => 'application/vnd.igloader',
|
346 |
-
'igm' => 'application/vnd.insors.igm',
|
347 |
-
'igs' => 'model/iges',
|
348 |
-
'igx' => 'application/vnd.micrografx.igx',
|
349 |
-
'iif' => 'application/vnd.shana.informed.interchange',
|
350 |
-
'imp' => 'application/vnd.accpac.simply.imp',
|
351 |
-
'ims' => 'application/vnd.ms-ims',
|
352 |
-
'in' => 'text/plain',
|
353 |
-
'ini' => 'text/plain',
|
354 |
-
'ipfix' => 'application/ipfix',
|
355 |
-
'ipk' => 'application/vnd.shana.informed.package',
|
356 |
-
'irm' => 'application/vnd.ibm.rights-management',
|
357 |
-
'irp' => 'application/vnd.irepository.package+xml',
|
358 |
-
'iso' => 'application/octet-stream',
|
359 |
-
'itp' => 'application/vnd.shana.informed.formtemplate',
|
360 |
-
'ivp' => 'application/vnd.immervision-ivp',
|
361 |
-
'ivu' => 'application/vnd.immervision-ivu',
|
362 |
-
'jad' => 'text/vnd.sun.j2me.app-descriptor',
|
363 |
-
'jam' => 'application/vnd.jam',
|
364 |
-
'jar' => 'application/java-archive',
|
365 |
-
'java' => 'text/x-java-source',
|
366 |
-
'jisp' => 'application/vnd.jisp',
|
367 |
-
'jlt' => 'application/vnd.hp-jlyt',
|
368 |
-
'jnlp' => 'application/x-java-jnlp-file',
|
369 |
-
'joda' => 'application/vnd.joost.joda-archive',
|
370 |
-
'jpe' => 'image/jpeg',
|
371 |
-
'jpeg' => 'image/jpeg',
|
372 |
-
'jpg' => 'image/jpeg',
|
373 |
-
'jpgm' => 'video/jpm',
|
374 |
-
'jpgv' => 'video/jpeg',
|
375 |
-
'jpm' => 'video/jpm',
|
376 |
-
'js' => 'text/javascript',
|
377 |
-
'json' => 'application/json',
|
378 |
-
'kar' => 'audio/midi',
|
379 |
-
'karbon' => 'application/vnd.kde.karbon',
|
380 |
-
'kfo' => 'application/vnd.kde.kformula',
|
381 |
-
'kia' => 'application/vnd.kidspiration',
|
382 |
-
'kml' => 'application/vnd.google-earth.kml+xml',
|
383 |
-
'kmz' => 'application/vnd.google-earth.kmz',
|
384 |
-
'kne' => 'application/vnd.kinar',
|
385 |
-
'knp' => 'application/vnd.kinar',
|
386 |
-
'kon' => 'application/vnd.kde.kontour',
|
387 |
-
'kpr' => 'application/vnd.kde.kpresenter',
|
388 |
-
'kpt' => 'application/vnd.kde.kpresenter',
|
389 |
-
'ksp' => 'application/vnd.kde.kspread',
|
390 |
-
'ktr' => 'application/vnd.kahootz',
|
391 |
-
'ktx' => 'image/ktx',
|
392 |
-
'ktz' => 'application/vnd.kahootz',
|
393 |
-
'kwd' => 'application/vnd.kde.kword',
|
394 |
-
'kwt' => 'application/vnd.kde.kword',
|
395 |
-
'lasxml' => 'application/vnd.las.las+xml',
|
396 |
-
'latex' => 'application/x-latex',
|
397 |
-
'lbd' => 'application/vnd.llamagraphics.life-balance.desktop',
|
398 |
-
'lbe' => 'application/vnd.llamagraphics.life-balance.exchange+xml',
|
399 |
-
'les' => 'application/vnd.hhe.lesson-player',
|
400 |
-
'lha' => 'application/octet-stream',
|
401 |
-
'link66' => 'application/vnd.route66.link66+xml',
|
402 |
-
'list' => 'text/plain',
|
403 |
-
'list3820' => 'application/vnd.ibm.modcap',
|
404 |
-
'listafp' => 'application/vnd.ibm.modcap',
|
405 |
-
'log' => 'text/plain',
|
406 |
-
'lostxml' => 'application/lost+xml',
|
407 |
-
'lrf' => 'application/octet-stream',
|
408 |
-
'lrm' => 'application/vnd.ms-lrm',
|
409 |
-
'ltf' => 'application/vnd.frogans.ltf',
|
410 |
-
'lvp' => 'audio/vnd.lucent.voice',
|
411 |
-
'lwp' => 'application/vnd.lotus-wordpro',
|
412 |
-
'lzh' => 'application/octet-stream',
|
413 |
-
'm13' => 'application/x-msmediaview',
|
414 |
-
'm14' => 'application/x-msmediaview',
|
415 |
-
'm1v' => 'video/mpeg',
|
416 |
-
'm21' => 'application/mp21',
|
417 |
-
'm2a' => 'audio/mpeg',
|
418 |
-
'm2v' => 'video/mpeg',
|
419 |
-
'm3a' => 'audio/mpeg',
|
420 |
-
'm3u' => 'audio/x-mpegurl',
|
421 |
-
'm3u8' => 'application/vnd.apple.mpegurl',
|
422 |
-
'm4a' => 'audio/mp4',
|
423 |
-
'm4u' => 'video/vnd.mpegurl',
|
424 |
-
'm4v' => 'video/mp4',
|
425 |
-
'ma' => 'application/mathematica',
|
426 |
-
'mads' => 'application/mads+xml',
|
427 |
-
'mag' => 'application/vnd.ecowin.chart',
|
428 |
-
'maker' => 'application/vnd.framemaker',
|
429 |
-
'man' => 'text/troff',
|
430 |
-
'mathml' => 'application/mathml+xml',
|
431 |
-
'mb' => 'application/mathematica',
|
432 |
-
'mbk' => 'application/vnd.mobius.mbk',
|
433 |
-
'mbox' => 'application/mbox',
|
434 |
-
'mc1' => 'application/vnd.medcalcdata',
|
435 |
-
'mcd' => 'application/vnd.mcd',
|
436 |
-
'mcurl' => 'text/vnd.curl.mcurl',
|
437 |
-
'mdb' => 'application/x-msaccess',
|
438 |
-
'mdi' => 'image/vnd.ms-modi',
|
439 |
-
'me' => 'text/troff',
|
440 |
-
'mesh' => 'model/mesh',
|
441 |
-
'meta4' => 'application/metalink4+xml',
|
442 |
-
'mets' => 'application/mets+xml',
|
443 |
-
'mfm' => 'application/vnd.mfmp',
|
444 |
-
'mgp' => 'application/vnd.osgeo.mapguide.package',
|
445 |
-
'mgz' => 'application/vnd.proteus.magazine',
|
446 |
-
'mid' => 'audio/midi',
|
447 |
-
'midi' => 'audio/midi',
|
448 |
-
'mif' => 'application/vnd.mif',
|
449 |
-
'mime' => 'message/rfc822',
|
450 |
-
'mj2' => 'video/mj2',
|
451 |
-
'mjp2' => 'video/mj2',
|
452 |
-
'mlp' => 'application/vnd.dolby.mlp',
|
453 |
-
'mmd' => 'application/vnd.chipnuts.karaoke-mmd',
|
454 |
-
'mmf' => 'application/vnd.smaf',
|
455 |
-
'mmr' => 'image/vnd.fujixerox.edmics-mmr',
|
456 |
-
'mny' => 'application/x-msmoney',
|
457 |
-
'mobi' => 'application/x-mobipocket-ebook',
|
458 |
-
'mods' => 'application/mods+xml',
|
459 |
-
'mov' => 'video/quicktime',
|
460 |
-
'movie' => 'video/x-sgi-movie',
|
461 |
-
'mp2' => 'audio/mpeg',
|
462 |
-
'mp21' => 'application/mp21',
|
463 |
-
'mp2a' => 'audio/mpeg',
|
464 |
-
'mp3' => 'audio/mpeg',
|
465 |
-
'mp4' => 'video/mp4',
|
466 |
-
'mp4a' => 'audio/mp4',
|
467 |
-
'mp4s' => 'application/mp4',
|
468 |
-
'mp4v' => 'video/mp4',
|
469 |
-
'mpc' => 'application/vnd.mophun.certificate',
|
470 |
-
'mpe' => 'video/mpeg',
|
471 |
-
'mpeg' => 'video/mpeg',
|
472 |
-
'mpg' => 'video/mpeg',
|
473 |
-
'mpg4' => 'video/mp4',
|
474 |
-
'mpga' => 'audio/mpeg',
|
475 |
-
'mpkg' => 'application/vnd.apple.installer+xml',
|
476 |
-
'mpm' => 'application/vnd.blueice.multipass',
|
477 |
-
'mpn' => 'application/vnd.mophun.application',
|
478 |
-
'mpp' => 'application/vnd.ms-project',
|
479 |
-
'mpt' => 'application/vnd.ms-project',
|
480 |
-
'mpy' => 'application/vnd.ibm.minipay',
|
481 |
-
'mqy' => 'application/vnd.mobius.mqy',
|
482 |
-
'mrc' => 'application/marc',
|
483 |
-
'mrcx' => 'application/marcxml+xml',
|
484 |
-
'ms' => 'text/troff',
|
485 |
-
'mscml' => 'application/mediaservercontrol+xml',
|
486 |
-
'mseed' => 'application/vnd.fdsn.mseed',
|
487 |
-
'mseq' => 'application/vnd.mseq',
|
488 |
-
'msf' => 'application/vnd.epson.msf',
|
489 |
-
'msh' => 'model/mesh',
|
490 |
-
'msi' => 'application/x-msdownload',
|
491 |
-
'msl' => 'application/vnd.mobius.msl',
|
492 |
-
'msty' => 'application/vnd.muvee.style',
|
493 |
-
'mts' => 'model/vnd.mts',
|
494 |
-
'mus' => 'application/vnd.musician',
|
495 |
-
'musicxml' => 'application/vnd.recordare.musicxml+xml',
|
496 |
-
'mvb' => 'application/x-msmediaview',
|
497 |
-
'mwf' => 'application/vnd.mfer',
|
498 |
-
'mxf' => 'application/mxf',
|
499 |
-
'mxl' => 'application/vnd.recordare.musicxml',
|
500 |
-
'mxml' => 'application/xv+xml',
|
501 |
-
'mxs' => 'application/vnd.triscape.mxs',
|
502 |
-
'mxu' => 'video/vnd.mpegurl',
|
503 |
-
'n-gage' => 'application/vnd.nokia.n-gage.symbian.install',
|
504 |
-
'n3' => 'text/n3',
|
505 |
-
'nb' => 'application/mathematica',
|
506 |
-
'nbp' => 'application/vnd.wolfram.player',
|
507 |
-
'nc' => 'application/x-netcdf',
|
508 |
-
'ncx' => 'application/x-dtbncx+xml',
|
509 |
-
'ngdat' => 'application/vnd.nokia.n-gage.data',
|
510 |
-
'nlu' => 'application/vnd.neurolanguage.nlu',
|
511 |
-
'nml' => 'application/vnd.enliven',
|
512 |
-
'nnd' => 'application/vnd.noblenet-directory',
|
513 |
-
'nns' => 'application/vnd.noblenet-sealer',
|
514 |
-
'nnw' => 'application/vnd.noblenet-web',
|
515 |
-
'npx' => 'image/vnd.net-fpx',
|
516 |
-
'nsf' => 'application/vnd.lotus-notes',
|
517 |
-
'oa2' => 'application/vnd.fujitsu.oasys2',
|
518 |
-
'oa3' => 'application/vnd.fujitsu.oasys3',
|
519 |
-
'oas' => 'application/vnd.fujitsu.oasys',
|
520 |
-
'obd' => 'application/x-msbinder',
|
521 |
-
'oda' => 'application/oda',
|
522 |
-
'odb' => 'application/vnd.oasis.opendocument.database',
|
523 |
-
'odc' => 'application/vnd.oasis.opendocument.chart',
|
524 |
-
'odf' => 'application/vnd.oasis.opendocument.formula',
|
525 |
-
'odft' => 'application/vnd.oasis.opendocument.formula-template',
|
526 |
-
'odg' => 'application/vnd.oasis.opendocument.graphics',
|
527 |
-
'odi' => 'application/vnd.oasis.opendocument.image',
|
528 |
-
'odm' => 'application/vnd.oasis.opendocument.text-master',
|
529 |
-
'odp' => 'application/vnd.oasis.opendocument.presentation',
|
530 |
-
'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
|
531 |
-
'odt' => 'application/vnd.oasis.opendocument.text',
|
532 |
-
'oga' => 'audio/ogg',
|
533 |
-
'ogg' => 'audio/ogg',
|
534 |
-
'ogv' => 'video/ogg',
|
535 |
-
'ogx' => 'application/ogg',
|
536 |
-
'onepkg' => 'application/onenote',
|
537 |
-
'onetmp' => 'application/onenote',
|
538 |
-
'onetoc' => 'application/onenote',
|
539 |
-
'onetoc2' => 'application/onenote',
|
540 |
-
'opf' => 'application/oebps-package+xml',
|
541 |
-
'oprc' => 'application/vnd.palm',
|
542 |
-
'org' => 'application/vnd.lotus-organizer',
|
543 |
-
'osf' => 'application/vnd.yamaha.openscoreformat',
|
544 |
-
'osfpvg' => 'application/vnd.yamaha.openscoreformat.osfpvg+xml',
|
545 |
-
'otc' => 'application/vnd.oasis.opendocument.chart-template',
|
546 |
-
'otf' => 'application/x-font-otf',
|
547 |
-
'otg' => 'application/vnd.oasis.opendocument.graphics-template',
|
548 |
-
'oth' => 'application/vnd.oasis.opendocument.text-web',
|
549 |
-
'oti' => 'application/vnd.oasis.opendocument.image-template',
|
550 |
-
'otp' => 'application/vnd.oasis.opendocument.presentation-template',
|
551 |
-
'ots' => 'application/vnd.oasis.opendocument.spreadsheet-template',
|
552 |
-
'ott' => 'application/vnd.oasis.opendocument.text-template',
|
553 |
-
'oxt' => 'application/vnd.openofficeorg.extension',
|
554 |
-
'p' => 'text/x-pascal',
|
555 |
-
'p10' => 'application/pkcs10',
|
556 |
-
'p12' => 'application/x-pkcs12',
|
557 |
-
'p7b' => 'application/x-pkcs7-certificates',
|
558 |
-
'p7c' => 'application/pkcs7-mime',
|
559 |
-
'p7m' => 'application/pkcs7-mime',
|
560 |
-
'p7r' => 'application/x-pkcs7-certreqresp',
|
561 |
-
'p7s' => 'application/pkcs7-signature',
|
562 |
-
'p8' => 'application/pkcs8',
|
563 |
-
'pas' => 'text/x-pascal',
|
564 |
-
'paw' => 'application/vnd.pawaafile',
|
565 |
-
'pbd' => 'application/vnd.powerbuilder6',
|
566 |
-
'pbm' => 'image/x-portable-bitmap',
|
567 |
-
'pcf' => 'application/x-font-pcf',
|
568 |
-
'pcl' => 'application/vnd.hp-pcl',
|
569 |
-
'pclxl' => 'application/vnd.hp-pclxl',
|
570 |
-
'pct' => 'image/x-pict',
|
571 |
-
'pcurl' => 'application/vnd.curl.pcurl',
|
572 |
-
'pcx' => 'image/x-pcx',
|
573 |
-
'pdb' => 'application/vnd.palm',
|
574 |
-
'pdf' => 'application/pdf',
|
575 |
-
'pfa' => 'application/x-font-type1',
|
576 |
-
'pfb' => 'application/x-font-type1',
|
577 |
-
'pfm' => 'application/x-font-type1',
|
578 |
-
'pfr' => 'application/font-tdpfr',
|
579 |
-
'pfx' => 'application/x-pkcs12',
|
580 |
-
'pgm' => 'image/x-portable-graymap',
|
581 |
-
'pgn' => 'application/x-chess-pgn',
|
582 |
-
'pgp' => 'application/pgp-encrypted',
|
583 |
-
'php' => 'text/x-php',
|
584 |
-
'phps' => 'application/x-httpd-phps',
|
585 |
-
'pic' => 'image/x-pict',
|
586 |
-
'pkg' => 'application/octet-stream',
|
587 |
-
'pki' => 'application/pkixcmp',
|
588 |
-
'pkipath' => 'application/pkix-pkipath',
|
589 |
-
'plb' => 'application/vnd.3gpp.pic-bw-large',
|
590 |
-
'plc' => 'application/vnd.mobius.plc',
|
591 |
-
'plf' => 'application/vnd.pocketlearn',
|
592 |
-
'pls' => 'application/pls+xml',
|
593 |
-
'pml' => 'application/vnd.ctc-posml',
|
594 |
-
'png' => 'image/png',
|
595 |
-
'pnm' => 'image/x-portable-anymap',
|
596 |
-
'portpkg' => 'application/vnd.macports.portpkg',
|
597 |
-
'pot' => 'application/vnd.ms-powerpoint',
|
598 |
-
'potm' => 'application/vnd.ms-powerpoint.template.macroenabled.12',
|
599 |
-
'potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template',
|
600 |
-
'ppam' => 'application/vnd.ms-powerpoint.addin.macroenabled.12',
|
601 |
-
'ppd' => 'application/vnd.cups-ppd',
|
602 |
-
'ppm' => 'image/x-portable-pixmap',
|
603 |
-
'pps' => 'application/vnd.ms-powerpoint',
|
604 |
-
'ppsm' => 'application/vnd.ms-powerpoint.slideshow.macroenabled.12',
|
605 |
-
'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow',
|
606 |
-
'ppt' => 'application/vnd.ms-powerpoint',
|
607 |
-
'pptm' => 'application/vnd.ms-powerpoint.presentation.macroenabled.12',
|
608 |
-
'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
609 |
-
'pqa' => 'application/vnd.palm',
|
610 |
-
'prc' => 'application/x-mobipocket-ebook',
|
611 |
-
'pre' => 'application/vnd.lotus-freelance',
|
612 |
-
'prf' => 'application/pics-rules',
|
613 |
-
'ps' => 'application/postscript',
|
614 |
-
'psb' => 'application/vnd.3gpp.pic-bw-small',
|
615 |
-
'psd' => 'image/vnd.adobe.photoshop',
|
616 |
-
'psf' => 'application/x-font-linux-psf',
|
617 |
-
'pskcxml' => 'application/pskc+xml',
|
618 |
-
'ptid' => 'application/vnd.pvi.ptid1',
|
619 |
-
'pub' => 'application/x-mspublisher',
|
620 |
-
'pvb' => 'application/vnd.3gpp.pic-bw-var',
|
621 |
-
'pwn' => 'application/vnd.3m.post-it-notes',
|
622 |
-
'pya' => 'audio/vnd.ms-playready.media.pya',
|
623 |
-
'pyv' => 'video/vnd.ms-playready.media.pyv',
|
624 |
-
'qam' => 'application/vnd.epson.quickanime',
|
625 |
-
'qbo' => 'application/vnd.intu.qbo',
|
626 |
-
'qfx' => 'application/vnd.intu.qfx',
|
627 |
-
'qps' => 'application/vnd.publishare-delta-tree',
|
628 |
-
'qt' => 'video/quicktime',
|
629 |
-
'qwd' => 'application/vnd.quark.quarkxpress',
|
630 |
-
'qwt' => 'application/vnd.quark.quarkxpress',
|
631 |
-
'qxb' => 'application/vnd.quark.quarkxpress',
|
632 |
-
'qxd' => 'application/vnd.quark.quarkxpress',
|
633 |
-
'qxl' => 'application/vnd.quark.quarkxpress',
|
634 |
-
'qxt' => 'application/vnd.quark.quarkxpress',
|
635 |
-
'ra' => 'audio/x-pn-realaudio',
|
636 |
-
'ram' => 'audio/x-pn-realaudio',
|
637 |
-
'rar' => 'application/x-rar-compressed',
|
638 |
-
'ras' => 'image/x-cmu-raster',
|
639 |
-
'rb' => 'text/plain',
|
640 |
-
'rcprofile' => 'application/vnd.ipunplugged.rcprofile',
|
641 |
-
'rdf' => 'application/rdf+xml',
|
642 |
-
'rdz' => 'application/vnd.data-vision.rdz',
|
643 |
-
'rep' => 'application/vnd.businessobjects',
|
644 |
-
'res' => 'application/x-dtbresource+xml',
|
645 |
-
'resx' => 'text/xml',
|
646 |
-
'rgb' => 'image/x-rgb',
|
647 |
-
'rif' => 'application/reginfo+xml',
|
648 |
-
'rip' => 'audio/vnd.rip',
|
649 |
-
'rl' => 'application/resource-lists+xml',
|
650 |
-
'rlc' => 'image/vnd.fujixerox.edmics-rlc',
|
651 |
-
'rld' => 'application/resource-lists-diff+xml',
|
652 |
-
'rm' => 'application/vnd.rn-realmedia',
|
653 |
-
'rmi' => 'audio/midi',
|
654 |
-
'rmp' => 'audio/x-pn-realaudio-plugin',
|
655 |
-
'rms' => 'application/vnd.jcp.javame.midlet-rms',
|
656 |
-
'rnc' => 'application/relax-ng-compact-syntax',
|
657 |
-
'roff' => 'text/troff',
|
658 |
-
'rp9' => 'application/vnd.cloanto.rp9',
|
659 |
-
'rpss' => 'application/vnd.nokia.radio-presets',
|
660 |
-
'rpst' => 'application/vnd.nokia.radio-preset',
|
661 |
-
'rq' => 'application/sparql-query',
|
662 |
-
'rs' => 'application/rls-services+xml',
|
663 |
-
'rsd' => 'application/rsd+xml',
|
664 |
-
'rss' => 'application/rss+xml',
|
665 |
-
'rtf' => 'application/rtf',
|
666 |
-
'rtx' => 'text/richtext',
|
667 |
-
's' => 'text/x-asm',
|
668 |
-
'saf' => 'application/vnd.yamaha.smaf-audio',
|
669 |
-
'sbml' => 'application/sbml+xml',
|
670 |
-
'sc' => 'application/vnd.ibm.secure-container',
|
671 |
-
'scd' => 'application/x-msschedule',
|
672 |
-
'scm' => 'application/vnd.lotus-screencam',
|
673 |
-
'scq' => 'application/scvp-cv-request',
|
674 |
-
'scs' => 'application/scvp-cv-response',
|
675 |
-
'scurl' => 'text/vnd.curl.scurl',
|
676 |
-
'sda' => 'application/vnd.stardivision.draw',
|
677 |
-
'sdc' => 'application/vnd.stardivision.calc',
|
678 |
-
'sdd' => 'application/vnd.stardivision.impress',
|
679 |
-
'sdkd' => 'application/vnd.solent.sdkm+xml',
|
680 |
-
'sdkm' => 'application/vnd.solent.sdkm+xml',
|
681 |
-
'sdp' => 'application/sdp',
|
682 |
-
'sdw' => 'application/vnd.stardivision.writer',
|
683 |
-
'see' => 'application/vnd.seemail',
|
684 |
-
'seed' => 'application/vnd.fdsn.seed',
|
685 |
-
'sema' => 'application/vnd.sema',
|
686 |
-
'semd' => 'application/vnd.semd',
|
687 |
-
'semf' => 'application/vnd.semf',
|
688 |
-
'ser' => 'application/java-serialized-object',
|
689 |
-
'setpay' => 'application/set-payment-initiation',
|
690 |
-
'setreg' => 'application/set-registration-initiation',
|
691 |
-
'sfd-hdstx' => 'application/vnd.hydrostatix.sof-data',
|
692 |
-
'sfs' => 'application/vnd.spotfire.sfs',
|
693 |
-
'sgl' => 'application/vnd.stardivision.writer-global',
|
694 |
-
'sgm' => 'text/sgml',
|
695 |
-
'sgml' => 'text/sgml',
|
696 |
-
'sh' => 'application/x-sh',
|
697 |
-
'shar' => 'application/x-shar',
|
698 |
-
'shf' => 'application/shf+xml',
|
699 |
-
'sig' => 'application/pgp-signature',
|
700 |
-
'silo' => 'model/mesh',
|
701 |
-
'sis' => 'application/vnd.symbian.install',
|
702 |
-
'sisx' => 'application/vnd.symbian.install',
|
703 |
-
'sit' => 'application/x-stuffit',
|
704 |
-
'sitx' => 'application/x-stuffitx',
|
705 |
-
'skd' => 'application/vnd.koan',
|
706 |
-
'skm' => 'application/vnd.koan',
|
707 |
-
'skp' => 'application/vnd.koan',
|
708 |
-
'skt' => 'application/vnd.koan',
|
709 |
-
'sldm' => 'application/vnd.ms-powerpoint.slide.macroenabled.12',
|
710 |
-
'sldx' => 'application/vnd.openxmlformats-officedocument.presentationml.slide',
|
711 |
-
'slt' => 'application/vnd.epson.salt',
|
712 |
-
'sm' => 'application/vnd.stepmania.stepchart',
|
713 |
-
'smf' => 'application/vnd.stardivision.math',
|
714 |
-
'smi' => 'application/smil+xml',
|
715 |
-
'smil' => 'application/smil+xml',
|
716 |
-
'snd' => 'audio/basic',
|
717 |
-
'snf' => 'application/x-font-snf',
|
718 |
-
'so' => 'application/octet-stream',
|
719 |
-
'spc' => 'application/x-pkcs7-certificates',
|
720 |
-
'spf' => 'application/vnd.yamaha.smaf-phrase',
|
721 |
-
'spl' => 'application/x-futuresplash',
|
722 |
-
'spot' => 'text/vnd.in3d.spot',
|
723 |
-
'spp' => 'application/scvp-vp-response',
|
724 |
-
'spq' => 'application/scvp-vp-request',
|
725 |
-
'spx' => 'audio/ogg',
|
726 |
-
'src' => 'application/x-wais-source',
|
727 |
-
'sru' => 'application/sru+xml',
|
728 |
-
'srx' => 'application/sparql-results+xml',
|
729 |
-
'sse' => 'application/vnd.kodak-descriptor',
|
730 |
-
'ssf' => 'application/vnd.epson.ssf',
|
731 |
-
'ssml' => 'application/ssml+xml',
|
732 |
-
'st' => 'application/vnd.sailingtracker.track',
|
733 |
-
'stc' => 'application/vnd.sun.xml.calc.template',
|
734 |
-
'std' => 'application/vnd.sun.xml.draw.template',
|
735 |
-
'stf' => 'application/vnd.wt.stf',
|
736 |
-
'sti' => 'application/vnd.sun.xml.impress.template',
|
737 |
-
'stk' => 'application/hyperstudio',
|
738 |
-
'stl' => 'application/vnd.ms-pki.stl',
|
739 |
-
'str' => 'application/vnd.pg.format',
|
740 |
-
'stw' => 'application/vnd.sun.xml.writer.template',
|
741 |
-
'sub' => 'image/vnd.dvb.subtitle',
|
742 |
-
'sus' => 'application/vnd.sus-calendar',
|
743 |
-
'susp' => 'application/vnd.sus-calendar',
|
744 |
-
'sv4cpio' => 'application/x-sv4cpio',
|
745 |
-
'sv4crc' => 'application/x-sv4crc',
|
746 |
-
'svc' => 'application/vnd.dvb.service',
|
747 |
-
'svd' => 'application/vnd.svd',
|
748 |
-
'svg' => 'image/svg+xml',
|
749 |
-
'svgz' => 'image/svg+xml',
|
750 |
-
'swa' => 'application/x-director',
|
751 |
-
'swf' => 'application/x-shockwave-flash',
|
752 |
-
'swi' => 'application/vnd.aristanetworks.swi',
|
753 |
-
'sxc' => 'application/vnd.sun.xml.calc',
|
754 |
-
'sxd' => 'application/vnd.sun.xml.draw',
|
755 |
-
'sxg' => 'application/vnd.sun.xml.writer.global',
|
756 |
-
'sxi' => 'application/vnd.sun.xml.impress',
|
757 |
-
'sxm' => 'application/vnd.sun.xml.math',
|
758 |
-
'sxw' => 'application/vnd.sun.xml.writer',
|
759 |
-
't' => 'text/troff',
|
760 |
-
'tao' => 'application/vnd.tao.intent-module-archive',
|
761 |
-
'tar' => 'application/x-tar',
|
762 |
-
'tcap' => 'application/vnd.3gpp2.tcap',
|
763 |
-
'tcl' => 'application/x-tcl',
|
764 |
-
'teacher' => 'application/vnd.smart.teacher',
|
765 |
-
'tei' => 'application/tei+xml',
|
766 |
-
'teicorpus' => 'application/tei+xml',
|
767 |
-
'tex' => 'application/x-tex',
|
768 |
-
'texi' => 'application/x-texinfo',
|
769 |
-
'texinfo' => 'application/x-texinfo',
|
770 |
-
'text' => 'text/plain',
|
771 |
-
'tfi' => 'application/thraud+xml',
|
772 |
-
'tfm' => 'application/x-tex-tfm',
|
773 |
-
'thmx' => 'application/vnd.ms-officetheme',
|
774 |
-
'tif' => 'image/tiff',
|
775 |
-
'tiff' => 'image/tiff',
|
776 |
-
'tmo' => 'application/vnd.tmobile-livetv',
|
777 |
-
'torrent' => 'application/x-bittorrent',
|
778 |
-
'tpl' => 'application/vnd.groove-tool-template',
|
779 |
-
'tpt' => 'application/vnd.trid.tpt',
|
780 |
-
'tr' => 'text/troff',
|
781 |
-
'tra' => 'application/vnd.trueapp',
|
782 |
-
'trm' => 'application/x-msterminal',
|
783 |
-
'tsd' => 'application/timestamped-data',
|
784 |
-
'tsv' => 'text/tab-separated-values',
|
785 |
-
'ttc' => 'application/x-font-ttf',
|
786 |
-
'ttf' => 'application/x-font-ttf',
|
787 |
-
'ttl' => 'text/turtle',
|
788 |
-
'twd' => 'application/vnd.simtech-mindmapper',
|
789 |
-
'twds' => 'application/vnd.simtech-mindmapper',
|
790 |
-
'txd' => 'application/vnd.genomatix.tuxedo',
|
791 |
-
'txf' => 'application/vnd.mobius.txf',
|
792 |
-
'txt' => 'text/plain',
|
793 |
-
'u32' => 'application/x-authorware-bin',
|
794 |
-
'udeb' => 'application/x-debian-package',
|
795 |
-
'ufd' => 'application/vnd.ufdl',
|
796 |
-
'ufdl' => 'application/vnd.ufdl',
|
797 |
-
'umj' => 'application/vnd.umajin',
|
798 |
-
'unityweb' => 'application/vnd.unity',
|
799 |
-
'uoml' => 'application/vnd.uoml+xml',
|
800 |
-
'uri' => 'text/uri-list',
|
801 |
-
'uris' => 'text/uri-list',
|
802 |
-
'urls' => 'text/uri-list',
|
803 |
-
'ustar' => 'application/x-ustar',
|
804 |
-
'utz' => 'application/vnd.uiq.theme',
|
805 |
-
'uu' => 'text/x-uuencode',
|
806 |
-
'uva' => 'audio/vnd.dece.audio',
|
807 |
-
'uvd' => 'application/vnd.dece.data',
|
808 |
-
'uvf' => 'application/vnd.dece.data',
|
809 |
-
'uvg' => 'image/vnd.dece.graphic',
|
810 |
-
'uvh' => 'video/vnd.dece.hd',
|
811 |
-
'uvi' => 'image/vnd.dece.graphic',
|
812 |
-
'uvm' => 'video/vnd.dece.mobile',
|
813 |
-
'uvp' => 'video/vnd.dece.pd',
|
814 |
-
'uvs' => 'video/vnd.dece.sd',
|
815 |
-
'uvt' => 'application/vnd.dece.ttml+xml',
|
816 |
-
'uvu' => 'video/vnd.uvvu.mp4',
|
817 |
-
'uvv' => 'video/vnd.dece.video',
|
818 |
-
'uvva' => 'audio/vnd.dece.audio',
|
819 |
-
'uvvd' => 'application/vnd.dece.data',
|
820 |
-
'uvvf' => 'application/vnd.dece.data',
|
821 |
-
'uvvg' => 'image/vnd.dece.graphic',
|
822 |
-
'uvvh' => 'video/vnd.dece.hd',
|
823 |
-
'uvvi' => 'image/vnd.dece.graphic',
|
824 |
-
'uvvm' => 'video/vnd.dece.mobile',
|
825 |
-
'uvvp' => 'video/vnd.dece.pd',
|
826 |
-
'uvvs' => 'video/vnd.dece.sd',
|
827 |
-
'uvvt' => 'application/vnd.dece.ttml+xml',
|
828 |
-
'uvvu' => 'video/vnd.uvvu.mp4',
|
829 |
-
'uvvv' => 'video/vnd.dece.video',
|
830 |
-
'uvvx' => 'application/vnd.dece.unspecified',
|
831 |
-
'uvx' => 'application/vnd.dece.unspecified',
|
832 |
-
'vcd' => 'application/x-cdlink',
|
833 |
-
'vcf' => 'text/x-vcard',
|
834 |
-
'vcg' => 'application/vnd.groove-vcard',
|
835 |
-
'vcs' => 'text/x-vcalendar',
|
836 |
-
'vcx' => 'application/vnd.vcx',
|
837 |
-
'vis' => 'application/vnd.visionary',
|
838 |
-
'viv' => 'video/vnd.vivo',
|
839 |
-
'vor' => 'application/vnd.stardivision.writer',
|
840 |
-
'vox' => 'application/x-authorware-bin',
|
841 |
-
'vrml' => 'model/vrml',
|
842 |
-
'vsd' => 'application/vnd.visio',
|
843 |
-
'vsf' => 'application/vnd.vsf',
|
844 |
-
'vss' => 'application/vnd.visio',
|
845 |
-
'vst' => 'application/vnd.visio',
|
846 |
-
'vsw' => 'application/vnd.visio',
|
847 |
-
'vtu' => 'model/vnd.vtu',
|
848 |
-
'vxml' => 'application/voicexml+xml',
|
849 |
-
'w3d' => 'application/x-director',
|
850 |
-
'wad' => 'application/x-doom',
|
851 |
-
'wav' => 'audio/x-wav',
|
852 |
-
'wax' => 'audio/x-ms-wax',
|
853 |
-
'wbmp' => 'image/vnd.wap.wbmp',
|
854 |
-
'wbs' => 'application/vnd.criticaltools.wbs+xml',
|
855 |
-
'wbxml' => 'application/vnd.wap.wbxml',
|
856 |
-
'wcm' => 'application/vnd.ms-works',
|
857 |
-
'wdb' => 'application/vnd.ms-works',
|
858 |
-
'weba' => 'audio/webm',
|
859 |
-
'webm' => 'video/webm',
|
860 |
-
'webp' => 'image/webp',
|
861 |
-
'wg' => 'application/vnd.pmi.widget',
|
862 |
-
'wgt' => 'application/widget',
|
863 |
-
'wks' => 'application/vnd.ms-works',
|
864 |
-
'wm' => 'video/x-ms-wm',
|
865 |
-
'wma' => 'audio/x-ms-wma',
|
866 |
-
'wmd' => 'application/x-ms-wmd',
|
867 |
-
'wmf' => 'application/x-msmetafile',
|
868 |
-
'wml' => 'text/vnd.wap.wml',
|
869 |
-
'wmlc' => 'application/vnd.wap.wmlc',
|
870 |
-
'wmls' => 'text/vnd.wap.wmlscript',
|
871 |
-
'wmlsc' => 'application/vnd.wap.wmlscriptc',
|
872 |
-
'wmv' => 'video/x-ms-wmv',
|
873 |
-
'wmx' => 'video/x-ms-wmx',
|
874 |
-
'wmz' => 'application/x-ms-wmz',
|
875 |
-
'woff' => 'application/x-font-woff',
|
876 |
-
'wpd' => 'application/vnd.wordperfect',
|
877 |
-
'wpl' => 'application/vnd.ms-wpl',
|
878 |
-
'wps' => 'application/vnd.ms-works',
|
879 |
-
'wqd' => 'application/vnd.wqd',
|
880 |
-
'wri' => 'application/x-mswrite',
|
881 |
-
'wrl' => 'model/vrml',
|
882 |
-
'wsdl' => 'application/wsdl+xml',
|
883 |
-
'wspolicy' => 'application/wspolicy+xml',
|
884 |
-
'wtb' => 'application/vnd.webturbo',
|
885 |
-
'wvx' => 'video/x-ms-wvx',
|
886 |
-
'x32' => 'application/x-authorware-bin',
|
887 |
-
'x3d' => 'application/vnd.hzn-3d-crossword',
|
888 |
-
'xap' => 'application/x-silverlight-app',
|
889 |
-
'xar' => 'application/vnd.xara',
|
890 |
-
'xbap' => 'application/x-ms-xbap',
|
891 |
-
'xbd' => 'application/vnd.fujixerox.docuworks.binder',
|
892 |
-
'xbm' => 'image/x-xbitmap',
|
893 |
-
'xdf' => 'application/xcap-diff+xml',
|
894 |
-
'xdm' => 'application/vnd.syncml.dm+xml',
|
895 |
-
'xdp' => 'application/vnd.adobe.xdp+xml',
|
896 |
-
'xdssc' => 'application/dssc+xml',
|
897 |
-
'xdw' => 'application/vnd.fujixerox.docuworks',
|
898 |
-
'xenc' => 'application/xenc+xml',
|
899 |
-
'xer' => 'application/patch-ops-error+xml',
|
900 |
-
'xfdf' => 'application/vnd.adobe.xfdf',
|
901 |
-
'xfdl' => 'application/vnd.xfdl',
|
902 |
-
'xht' => 'application/xhtml+xml',
|
903 |
-
'xhtml' => 'application/xhtml+xml',
|
904 |
-
'xhvml' => 'application/xv+xml',
|
905 |
-
'xif' => 'image/vnd.xiff',
|
906 |
-
'xla' => 'application/vnd.ms-excel',
|
907 |
-
'xlam' => 'application/vnd.ms-excel.addin.macroenabled.12',
|
908 |
-
'xlc' => 'application/vnd.ms-excel',
|
909 |
-
'xlm' => 'application/vnd.ms-excel',
|
910 |
-
'xls' => 'application/vnd.ms-excel',
|
911 |
-
'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroenabled.12',
|
912 |
-
'xlsm' => 'application/vnd.ms-excel.sheet.macroenabled.12',
|
913 |
-
'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
914 |
-
'xlt' => 'application/vnd.ms-excel',
|
915 |
-
'xltm' => 'application/vnd.ms-excel.template.macroenabled.12',
|
916 |
-
'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template',
|
917 |
-
'xlw' => 'application/vnd.ms-excel',
|
918 |
-
'xml' => 'application/xml',
|
919 |
-
'xo' => 'application/vnd.olpc-sugar',
|
920 |
-
'xop' => 'application/xop+xml',
|
921 |
-
'xpi' => 'application/x-xpinstall',
|
922 |
-
'xpm' => 'image/x-xpixmap',
|
923 |
-
'xpr' => 'application/vnd.is-xpr',
|
924 |
-
'xps' => 'application/vnd.ms-xpsdocument',
|
925 |
-
'xpw' => 'application/vnd.intercon.formnet',
|
926 |
-
'xpx' => 'application/vnd.intercon.formnet',
|
927 |
-
'xsl' => 'application/xml',
|
928 |
-
'xslt' => 'application/xslt+xml',
|
929 |
-
'xsm' => 'application/vnd.syncml+xml',
|
930 |
-
'xspf' => 'application/xspf+xml',
|
931 |
-
'xul' => 'application/vnd.mozilla.xul+xml',
|
932 |
-
'xvm' => 'application/xv+xml',
|
933 |
-
'xvml' => 'application/xv+xml',
|
934 |
-
'xwd' => 'image/x-xwindowdump',
|
935 |
-
'xyz' => 'chemical/x-xyz',
|
936 |
-
'yaml' => 'text/yaml',
|
937 |
-
'yang' => 'application/yang',
|
938 |
-
'yin' => 'application/yin+xml',
|
939 |
-
'yml' => 'text/yaml',
|
940 |
-
'zaz' => 'application/vnd.zzazz.deck+xml',
|
941 |
-
'zip' => 'application/zip',
|
942 |
-
'zir' => 'application/vnd.zul',
|
943 |
-
'zirz' => 'application/vnd.zul',
|
944 |
-
'zmm' => 'application/vnd.handheld-entertainment+xml'
|
945 |
-
];
|
946 |
-
|
947 |
-
/**
|
948 |
-
* Get a singleton instance of the class
|
949 |
-
*
|
950 |
-
* @return self
|
951 |
-
* @codeCoverageIgnore
|
952 |
-
*/
|
953 |
-
public static function getInstance()
|
954 |
-
{
|
955 |
-
if (!self::$instance) {
|
956 |
-
self::$instance = new self();
|
957 |
-
}
|
958 |
-
|
959 |
-
return self::$instance;
|
960 |
-
}
|
961 |
-
|
962 |
-
/**
|
963 |
-
* Get a mimetype value from a file extension
|
964 |
-
*
|
965 |
-
* @param string $extension File extension
|
966 |
-
*
|
967 |
-
* @return string|null
|
968 |
-
*/
|
969 |
-
public function fromExtension($extension)
|
970 |
-
{
|
971 |
-
$extension = strtolower($extension);
|
972 |
-
|
973 |
-
return isset($this->mimetypes[$extension]) ? $this->mimetypes[$extension] : null;
|
974 |
-
}
|
975 |
-
|
976 |
-
/**
|
977 |
-
* Get a mimetype from a filename
|
978 |
-
*
|
979 |
-
* @param string $filename Filename to generate a mimetype from
|
980 |
-
*
|
981 |
-
* @return string|null
|
982 |
-
*/
|
983 |
-
public function fromFilename($filename)
|
984 |
-
{
|
985 |
-
return $this->fromExtension(pathinfo($filename, PATHINFO_EXTENSION));
|
986 |
-
}
|
987 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/Birthday.php
DELETED
@@ -1,85 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\GraphNodes;
|
25 |
-
|
26 |
-
use DateTime;
|
27 |
-
|
28 |
-
/**
|
29 |
-
* Birthday object to handle various Graph return formats
|
30 |
-
*
|
31 |
-
* @package Facebook
|
32 |
-
*/
|
33 |
-
class Birthday extends DateTime
|
34 |
-
{
|
35 |
-
/**
|
36 |
-
* @var bool
|
37 |
-
*/
|
38 |
-
private $hasDate = false;
|
39 |
-
|
40 |
-
/**
|
41 |
-
* @var bool
|
42 |
-
*/
|
43 |
-
private $hasYear = false;
|
44 |
-
|
45 |
-
/**
|
46 |
-
* Parses Graph birthday format to set indication flags, possible values:
|
47 |
-
*
|
48 |
-
* MM/DD/YYYY
|
49 |
-
* MM/DD
|
50 |
-
* YYYY
|
51 |
-
*
|
52 |
-
* @link https://developers.facebook.com/docs/graph-api/reference/user
|
53 |
-
*
|
54 |
-
* @param string $date
|
55 |
-
*/
|
56 |
-
public function __construct($date)
|
57 |
-
{
|
58 |
-
$parts = explode('/', $date);
|
59 |
-
|
60 |
-
$this->hasYear = count($parts) === 3 || count($parts) === 1;
|
61 |
-
$this->hasDate = count($parts) === 3 || count($parts) === 2;
|
62 |
-
|
63 |
-
parent::__construct($date);
|
64 |
-
}
|
65 |
-
|
66 |
-
/**
|
67 |
-
* Returns whether date object contains birth day and month
|
68 |
-
*
|
69 |
-
* @return bool
|
70 |
-
*/
|
71 |
-
public function hasDate()
|
72 |
-
{
|
73 |
-
return $this->hasDate;
|
74 |
-
}
|
75 |
-
|
76 |
-
/**
|
77 |
-
* Returns whether date object contains birth year
|
78 |
-
*
|
79 |
-
* @return bool
|
80 |
-
*/
|
81 |
-
public function hasYear()
|
82 |
-
{
|
83 |
-
return $this->hasYear;
|
84 |
-
}
|
85 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/Collection.php
DELETED
@@ -1,242 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\GraphNodes;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Class Collection
|
28 |
-
*
|
29 |
-
* Modified version of Collection in "illuminate/support" by Taylor Otwell
|
30 |
-
*
|
31 |
-
* @package Facebook
|
32 |
-
*/
|
33 |
-
|
34 |
-
use ArrayAccess;
|
35 |
-
use ArrayIterator;
|
36 |
-
use Countable;
|
37 |
-
use IteratorAggregate;
|
38 |
-
|
39 |
-
class Collection implements ArrayAccess, Countable, IteratorAggregate
|
40 |
-
{
|
41 |
-
/**
|
42 |
-
* The items contained in the collection.
|
43 |
-
*
|
44 |
-
* @var array
|
45 |
-
*/
|
46 |
-
protected $items = [];
|
47 |
-
|
48 |
-
/**
|
49 |
-
* Create a new collection.
|
50 |
-
*
|
51 |
-
* @param array $items
|
52 |
-
*/
|
53 |
-
public function __construct(array $items = [])
|
54 |
-
{
|
55 |
-
$this->items = $items;
|
56 |
-
}
|
57 |
-
|
58 |
-
/**
|
59 |
-
* Gets the value of a field from the Graph node.
|
60 |
-
*
|
61 |
-
* @param string $name The field to retrieve.
|
62 |
-
* @param mixed $default The default to return if the field doesn't exist.
|
63 |
-
*
|
64 |
-
* @return mixed
|
65 |
-
*/
|
66 |
-
public function getField($name, $default = null)
|
67 |
-
{
|
68 |
-
if (isset($this->items[$name])) {
|
69 |
-
return $this->items[$name];
|
70 |
-
}
|
71 |
-
|
72 |
-
return $default;
|
73 |
-
}
|
74 |
-
|
75 |
-
/**
|
76 |
-
* Gets the value of the named property for this graph object.
|
77 |
-
*
|
78 |
-
* @param string $name The property to retrieve.
|
79 |
-
* @param mixed $default The default to return if the property doesn't exist.
|
80 |
-
*
|
81 |
-
* @return mixed
|
82 |
-
*
|
83 |
-
* @deprecated 5.0.0 getProperty() has been renamed to getField()
|
84 |
-
* @todo v6: Remove this method
|
85 |
-
*/
|
86 |
-
public function getProperty($name, $default = null)
|
87 |
-
{
|
88 |
-
return $this->getField($name, $default);
|
89 |
-
}
|
90 |
-
|
91 |
-
/**
|
92 |
-
* Returns a list of all fields set on the object.
|
93 |
-
*
|
94 |
-
* @return array
|
95 |
-
*/
|
96 |
-
public function getFieldNames()
|
97 |
-
{
|
98 |
-
return array_keys($this->items);
|
99 |
-
}
|
100 |
-
|
101 |
-
/**
|
102 |
-
* Returns a list of all properties set on the object.
|
103 |
-
*
|
104 |
-
* @return array
|
105 |
-
*
|
106 |
-
* @deprecated 5.0.0 getPropertyNames() has been renamed to getFieldNames()
|
107 |
-
* @todo v6: Remove this method
|
108 |
-
*/
|
109 |
-
public function getPropertyNames()
|
110 |
-
{
|
111 |
-
return $this->getFieldNames();
|
112 |
-
}
|
113 |
-
|
114 |
-
/**
|
115 |
-
* Get all of the items in the collection.
|
116 |
-
*
|
117 |
-
* @return array
|
118 |
-
*/
|
119 |
-
public function all()
|
120 |
-
{
|
121 |
-
return $this->items;
|
122 |
-
}
|
123 |
-
|
124 |
-
/**
|
125 |
-
* Get the collection of items as a plain array.
|
126 |
-
*
|
127 |
-
* @return array
|
128 |
-
*/
|
129 |
-
public function asArray()
|
130 |
-
{
|
131 |
-
return array_map(function ($value) {
|
132 |
-
return $value instanceof Collection ? $value->asArray() : $value;
|
133 |
-
}, $this->items);
|
134 |
-
}
|
135 |
-
|
136 |
-
/**
|
137 |
-
* Run a map over each of the items.
|
138 |
-
*
|
139 |
-
* @param \Closure $callback
|
140 |
-
*
|
141 |
-
* @return static
|
142 |
-
*/
|
143 |
-
public function map(\Closure $callback)
|
144 |
-
{
|
145 |
-
return new static(array_map($callback, $this->items, array_keys($this->items)));
|
146 |
-
}
|
147 |
-
|
148 |
-
/**
|
149 |
-
* Get the collection of items as JSON.
|
150 |
-
*
|
151 |
-
* @param int $options
|
152 |
-
*
|
153 |
-
* @return string
|
154 |
-
*/
|
155 |
-
public function asJson($options = 0)
|
156 |
-
{
|
157 |
-
return json_encode($this->asArray(), $options);
|
158 |
-
}
|
159 |
-
|
160 |
-
/**
|
161 |
-
* Count the number of items in the collection.
|
162 |
-
*
|
163 |
-
* @return int
|
164 |
-
*/
|
165 |
-
public function count()
|
166 |
-
{
|
167 |
-
return count($this->items);
|
168 |
-
}
|
169 |
-
|
170 |
-
/**
|
171 |
-
* Get an iterator for the items.
|
172 |
-
*
|
173 |
-
* @return ArrayIterator
|
174 |
-
*/
|
175 |
-
public function getIterator()
|
176 |
-
{
|
177 |
-
return new ArrayIterator($this->items);
|
178 |
-
}
|
179 |
-
|
180 |
-
/**
|
181 |
-
* Determine if an item exists at an offset.
|
182 |
-
*
|
183 |
-
* @param mixed $key
|
184 |
-
*
|
185 |
-
* @return bool
|
186 |
-
*/
|
187 |
-
public function offsetExists($key)
|
188 |
-
{
|
189 |
-
return array_key_exists($key, $this->items);
|
190 |
-
}
|
191 |
-
|
192 |
-
/**
|
193 |
-
* Get an item at a given offset.
|
194 |
-
*
|
195 |
-
* @param mixed $key
|
196 |
-
*
|
197 |
-
* @return mixed
|
198 |
-
*/
|
199 |
-
public function offsetGet($key)
|
200 |
-
{
|
201 |
-
return $this->items[$key];
|
202 |
-
}
|
203 |
-
|
204 |
-
/**
|
205 |
-
* Set the item at a given offset.
|
206 |
-
*
|
207 |
-
* @param mixed $key
|
208 |
-
* @param mixed $value
|
209 |
-
*
|
210 |
-
* @return void
|
211 |
-
*/
|
212 |
-
public function offsetSet($key, $value)
|
213 |
-
{
|
214 |
-
if (is_null($key)) {
|
215 |
-
$this->items[] = $value;
|
216 |
-
} else {
|
217 |
-
$this->items[$key] = $value;
|
218 |
-
}
|
219 |
-
}
|
220 |
-
|
221 |
-
/**
|
222 |
-
* Unset the item at a given offset.
|
223 |
-
*
|
224 |
-
* @param string $key
|
225 |
-
*
|
226 |
-
* @return void
|
227 |
-
*/
|
228 |
-
public function offsetUnset($key)
|
229 |
-
{
|
230 |
-
unset($this->items[$key]);
|
231 |
-
}
|
232 |
-
|
233 |
-
/**
|
234 |
-
* Convert the collection to its string representation.
|
235 |
-
*
|
236 |
-
* @return string
|
237 |
-
*/
|
238 |
-
public function __toString()
|
239 |
-
{
|
240 |
-
return $this->asJson();
|
241 |
-
}
|
242 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphAchievement.php
DELETED
@@ -1,113 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\GraphNodes;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Class GraphAchievement
|
28 |
-
*
|
29 |
-
* @package Facebook
|
30 |
-
*/
|
31 |
-
|
32 |
-
class GraphAchievement extends GraphNode
|
33 |
-
{
|
34 |
-
/**
|
35 |
-
* @var array Maps object key names to Graph object types.
|
36 |
-
*/
|
37 |
-
protected static $graphObjectMap = [
|
38 |
-
'from' => '\Facebook\GraphNodes\GraphUser',
|
39 |
-
'application' => '\Facebook\GraphNodes\GraphApplication',
|
40 |
-
];
|
41 |
-
|
42 |
-
/**
|
43 |
-
* Returns the ID for the achievement.
|
44 |
-
*
|
45 |
-
* @return string|null
|
46 |
-
*/
|
47 |
-
public function getId()
|
48 |
-
{
|
49 |
-
return $this->getField('id');
|
50 |
-
}
|
51 |
-
|
52 |
-
/**
|
53 |
-
* Returns the user who achieved this.
|
54 |
-
*
|
55 |
-
* @return GraphUser|null
|
56 |
-
*/
|
57 |
-
public function getFrom()
|
58 |
-
{
|
59 |
-
return $this->getField('from');
|
60 |
-
}
|
61 |
-
|
62 |
-
/**
|
63 |
-
* Returns the time at which this was achieved.
|
64 |
-
*
|
65 |
-
* @return \DateTime|null
|
66 |
-
*/
|
67 |
-
public function getPublishTime()
|
68 |
-
{
|
69 |
-
return $this->getField('publish_time');
|
70 |
-
}
|
71 |
-
|
72 |
-
/**
|
73 |
-
* Returns the app in which the user achieved this.
|
74 |
-
*
|
75 |
-
* @return GraphApplication|null
|
76 |
-
*/
|
77 |
-
public function getApplication()
|
78 |
-
{
|
79 |
-
return $this->getField('application');
|
80 |
-
}
|
81 |
-
|
82 |
-
/**
|
83 |
-
* Returns information about the achievement type this instance is connected with.
|
84 |
-
*
|
85 |
-
* @return array|null
|
86 |
-
*/
|
87 |
-
public function getData()
|
88 |
-
{
|
89 |
-
return $this->getField('data');
|
90 |
-
}
|
91 |
-
|
92 |
-
/**
|
93 |
-
* Returns the type of achievement.
|
94 |
-
*
|
95 |
-
* @see https://developers.facebook.com/docs/graph-api/reference/achievement
|
96 |
-
*
|
97 |
-
* @return string
|
98 |
-
*/
|
99 |
-
public function getType()
|
100 |
-
{
|
101 |
-
return 'game.achievement';
|
102 |
-
}
|
103 |
-
|
104 |
-
/**
|
105 |
-
* Indicates whether gaining the achievement published a feed story for the user.
|
106 |
-
*
|
107 |
-
* @return boolean|null
|
108 |
-
*/
|
109 |
-
public function isNoFeedStory()
|
110 |
-
{
|
111 |
-
return $this->getField('no_feed_story');
|
112 |
-
}
|
113 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphAlbum.php
DELETED
@@ -1,183 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\GraphNodes;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Class GraphAlbum
|
28 |
-
*
|
29 |
-
* @package Facebook
|
30 |
-
*/
|
31 |
-
|
32 |
-
class GraphAlbum extends GraphNode
|
33 |
-
{
|
34 |
-
/**
|
35 |
-
* @var array Maps object key names to Graph object types.
|
36 |
-
*/
|
37 |
-
protected static $graphObjectMap = [
|
38 |
-
'from' => '\Facebook\GraphNodes\GraphUser',
|
39 |
-
'place' => '\Facebook\GraphNodes\GraphPage',
|
40 |
-
];
|
41 |
-
|
42 |
-
/**
|
43 |
-
* Returns the ID for the album.
|
44 |
-
*
|
45 |
-
* @return string|null
|
46 |
-
*/
|
47 |
-
public function getId()
|
48 |
-
{
|
49 |
-
return $this->getField('id');
|
50 |
-
}
|
51 |
-
|
52 |
-
/**
|
53 |
-
* Returns whether the viewer can upload photos to this album.
|
54 |
-
*
|
55 |
-
* @return boolean|null
|
56 |
-
*/
|
57 |
-
public function getCanUpload()
|
58 |
-
{
|
59 |
-
return $this->getField('can_upload');
|
60 |
-
}
|
61 |
-
|
62 |
-
/**
|
63 |
-
* Returns the number of photos in this album.
|
64 |
-
*
|
65 |
-
* @return int|null
|
66 |
-
*/
|
67 |
-
public function getCount()
|
68 |
-
{
|
69 |
-
return $this->getField('count');
|
70 |
-
}
|
71 |
-
|
72 |
-
/**
|
73 |
-
* Returns the ID of the album's cover photo.
|
74 |
-
*
|
75 |
-
* @return string|null
|
76 |
-
*/
|
77 |
-
public function getCoverPhoto()
|
78 |
-
{
|
79 |
-
return $this->getField('cover_photo');
|
80 |
-
}
|
81 |
-
|
82 |
-
/**
|
83 |
-
* Returns the time the album was initially created.
|
84 |
-
*
|
85 |
-
* @return \DateTime|null
|
86 |
-
*/
|
87 |
-
public function getCreatedTime()
|
88 |
-
{
|
89 |
-
return $this->getField('created_time');
|
90 |
-
}
|
91 |
-
|
92 |
-
/**
|
93 |
-
* Returns the time the album was updated.
|
94 |
-
*
|
95 |
-
* @return \DateTime|null
|
96 |
-
*/
|
97 |
-
public function getUpdatedTime()
|
98 |
-
{
|
99 |
-
return $this->getField('updated_time');
|
100 |
-
}
|
101 |
-
|
102 |
-
/**
|
103 |
-
* Returns the description of the album.
|
104 |
-
*
|
105 |
-
* @return string|null
|
106 |
-
*/
|
107 |
-
public function getDescription()
|
108 |
-
{
|
109 |
-
return $this->getField('description');
|
110 |
-
}
|
111 |
-
|
112 |
-
/**
|
113 |
-
* Returns profile that created the album.
|
114 |
-
*
|
115 |
-
* @return GraphUser|null
|
116 |
-
*/
|
117 |
-
public function getFrom()
|
118 |
-
{
|
119 |
-
return $this->getField('from');
|
120 |
-
}
|
121 |
-
|
122 |
-
/**
|
123 |
-
* Returns profile that created the album.
|
124 |
-
*
|
125 |
-
* @return GraphPage|null
|
126 |
-
*/
|
127 |
-
public function getPlace()
|
128 |
-
{
|
129 |
-
return $this->getField('place');
|
130 |
-
}
|
131 |
-
|
132 |
-
/**
|
133 |
-
* Returns a link to this album on Facebook.
|
134 |
-
*
|
135 |
-
* @return string|null
|
136 |
-
*/
|
137 |
-
public function getLink()
|
138 |
-
{
|
139 |
-
return $this->getField('link');
|
140 |
-
}
|
141 |
-
|
142 |
-
/**
|
143 |
-
* Returns the textual location of the album.
|
144 |
-
*
|
145 |
-
* @return string|null
|
146 |
-
*/
|
147 |
-
public function getLocation()
|
148 |
-
{
|
149 |
-
return $this->getField('location');
|
150 |
-
}
|
151 |
-
|
152 |
-
/**
|
153 |
-
* Returns the title of the album.
|
154 |
-
*
|
155 |
-
* @return string|null
|
156 |
-
*/
|
157 |
-
public function getName()
|
158 |
-
{
|
159 |
-
return $this->getField('name');
|
160 |
-
}
|
161 |
-
|
162 |
-
/**
|
163 |
-
* Returns the privacy settings for the album.
|
164 |
-
*
|
165 |
-
* @return string|null
|
166 |
-
*/
|
167 |
-
public function getPrivacy()
|
168 |
-
{
|
169 |
-
return $this->getField('privacy');
|
170 |
-
}
|
171 |
-
|
172 |
-
/**
|
173 |
-
* Returns the type of the album.
|
174 |
-
*
|
175 |
-
* enum{ profile, mobile, wall, normal, album }
|
176 |
-
*
|
177 |
-
* @return string|null
|
178 |
-
*/
|
179 |
-
public function getType()
|
180 |
-
{
|
181 |
-
return $this->getField('type');
|
182 |
-
}
|
183 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphApplication.php
DELETED
@@ -1,43 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\GraphNodes;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Class GraphApplication
|
28 |
-
*
|
29 |
-
* @package Facebook
|
30 |
-
*/
|
31 |
-
|
32 |
-
class GraphApplication extends GraphNode
|
33 |
-
{
|
34 |
-
/**
|
35 |
-
* Returns the ID for the application.
|
36 |
-
*
|
37 |
-
* @return string|null
|
38 |
-
*/
|
39 |
-
public function getId()
|
40 |
-
{
|
41 |
-
return $this->getField('id');
|
42 |
-
}
|
43 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphCoverPhoto.php
DELETED
@@ -1,72 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\GraphNodes;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Class GraphCoverPhoto
|
28 |
-
*
|
29 |
-
* @package Facebook
|
30 |
-
*/
|
31 |
-
class GraphCoverPhoto extends GraphNode
|
32 |
-
{
|
33 |
-
/**
|
34 |
-
* Returns the id of cover if it exists
|
35 |
-
*
|
36 |
-
* @return int|null
|
37 |
-
*/
|
38 |
-
public function getId()
|
39 |
-
{
|
40 |
-
return $this->getField('id');
|
41 |
-
}
|
42 |
-
|
43 |
-
/**
|
44 |
-
* Returns the source of cover if it exists
|
45 |
-
*
|
46 |
-
* @return string|null
|
47 |
-
*/
|
48 |
-
public function getSource()
|
49 |
-
{
|
50 |
-
return $this->getField('source');
|
51 |
-
}
|
52 |
-
|
53 |
-
/**
|
54 |
-
* Returns the offset_x of cover if it exists
|
55 |
-
*
|
56 |
-
* @return int|null
|
57 |
-
*/
|
58 |
-
public function getOffsetX()
|
59 |
-
{
|
60 |
-
return $this->getField('offset_x');
|
61 |
-
}
|
62 |
-
|
63 |
-
/**
|
64 |
-
* Returns the offset_y of cover if it exists
|
65 |
-
*
|
66 |
-
* @return int|null
|
67 |
-
*/
|
68 |
-
public function getOffsetY()
|
69 |
-
{
|
70 |
-
return $this->getField('offset_y');
|
71 |
-
}
|
72 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphEdge.php
DELETED
@@ -1,238 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\GraphNodes;
|
25 |
-
|
26 |
-
use Facebook\FacebookRequest;
|
27 |
-
use Facebook\Url\FacebookUrlManipulator;
|
28 |
-
use Facebook\Exceptions\FacebookSDKException;
|
29 |
-
|
30 |
-
/**
|
31 |
-
* Class GraphEdge
|
32 |
-
*
|
33 |
-
* @package Facebook
|
34 |
-
*/
|
35 |
-
class GraphEdge extends Collection
|
36 |
-
{
|
37 |
-
/**
|
38 |
-
* @var FacebookRequest The original request that generated this data.
|
39 |
-
*/
|
40 |
-
protected $request;
|
41 |
-
|
42 |
-
/**
|
43 |
-
* @var array An array of Graph meta data like pagination, etc.
|
44 |
-
*/
|
45 |
-
protected $metaData = [];
|
46 |
-
|
47 |
-
/**
|
48 |
-
* @var string|null The parent Graph edge endpoint that generated the list.
|
49 |
-
*/
|
50 |
-
protected $parentEdgeEndpoint;
|
51 |
-
|
52 |
-
/**
|
53 |
-
* @var string|null The subclass of the child GraphNode's.
|
54 |
-
*/
|
55 |
-
protected $subclassName;
|
56 |
-
|
57 |
-
/**
|
58 |
-
* Init this collection of GraphNode's.
|
59 |
-
*
|
60 |
-
* @param FacebookRequest $request The original request that generated this data.
|
61 |
-
* @param array $data An array of GraphNode's.
|
62 |
-
* @param array $metaData An array of Graph meta data like pagination, etc.
|
63 |
-
* @param string|null $parentEdgeEndpoint The parent Graph edge endpoint that generated the list.
|
64 |
-
* @param string|null $subclassName The subclass of the child GraphNode's.
|
65 |
-
*/
|
66 |
-
public function __construct(FacebookRequest $request, array $data = [], array $metaData = [], $parentEdgeEndpoint = null, $subclassName = null)
|
67 |
-
{
|
68 |
-
$this->request = $request;
|
69 |
-
$this->metaData = $metaData;
|
70 |
-
$this->parentEdgeEndpoint = $parentEdgeEndpoint;
|
71 |
-
$this->subclassName = $subclassName;
|
72 |
-
|
73 |
-
parent::__construct($data);
|
74 |
-
}
|
75 |
-
|
76 |
-
/**
|
77 |
-
* Gets the parent Graph edge endpoint that generated the list.
|
78 |
-
*
|
79 |
-
* @return string|null
|
80 |
-
*/
|
81 |
-
public function getParentGraphEdge()
|
82 |
-
{
|
83 |
-
return $this->parentEdgeEndpoint;
|
84 |
-
}
|
85 |
-
|
86 |
-
/**
|
87 |
-
* Gets the subclass name that the child GraphNode's are cast as.
|
88 |
-
*
|
89 |
-
* @return string|null
|
90 |
-
*/
|
91 |
-
public function getSubClassName()
|
92 |
-
{
|
93 |
-
return $this->subclassName;
|
94 |
-
}
|
95 |
-
|
96 |
-
/**
|
97 |
-
* Returns the raw meta data associated with this GraphEdge.
|
98 |
-
*
|
99 |
-
* @return array
|
100 |
-
*/
|
101 |
-
public function getMetaData()
|
102 |
-
{
|
103 |
-
return $this->metaData;
|
104 |
-
}
|
105 |
-
|
106 |
-
/**
|
107 |
-
* Returns the next cursor if it exists.
|
108 |
-
*
|
109 |
-
* @return string|null
|
110 |
-
*/
|
111 |
-
public function getNextCursor()
|
112 |
-
{
|
113 |
-
return $this->getCursor('after');
|
114 |
-
}
|
115 |
-
|
116 |
-
/**
|
117 |
-
* Returns the previous cursor if it exists.
|
118 |
-
*
|
119 |
-
* @return string|null
|
120 |
-
*/
|
121 |
-
public function getPreviousCursor()
|
122 |
-
{
|
123 |
-
return $this->getCursor('before');
|
124 |
-
}
|
125 |
-
|
126 |
-
/**
|
127 |
-
* Returns the cursor for a specific direction if it exists.
|
128 |
-
*
|
129 |
-
* @param string $direction The direction of the page: after|before
|
130 |
-
*
|
131 |
-
* @return string|null
|
132 |
-
*/
|
133 |
-
public function getCursor($direction)
|
134 |
-
{
|
135 |
-
if (isset($this->metaData['paging']['cursors'][$direction])) {
|
136 |
-
return $this->metaData['paging']['cursors'][$direction];
|
137 |
-
}
|
138 |
-
|
139 |
-
return null;
|
140 |
-
}
|
141 |
-
|
142 |
-
/**
|
143 |
-
* Generates a pagination URL based on a cursor.
|
144 |
-
*
|
145 |
-
* @param string $direction The direction of the page: next|previous
|
146 |
-
*
|
147 |
-
* @return string|null
|
148 |
-
*
|
149 |
-
* @throws FacebookSDKException
|
150 |
-
*/
|
151 |
-
public function getPaginationUrl($direction)
|
152 |
-
{
|
153 |
-
$this->validateForPagination();
|
154 |
-
|
155 |
-
// Do we have a paging URL?
|
156 |
-
if (!isset($this->metaData['paging'][$direction])) {
|
157 |
-
return null;
|
158 |
-
}
|
159 |
-
|
160 |
-
$pageUrl = $this->metaData['paging'][$direction];
|
161 |
-
|
162 |
-
return FacebookUrlManipulator::baseGraphUrlEndpoint($pageUrl);
|
163 |
-
}
|
164 |
-
|
165 |
-
/**
|
166 |
-
* Validates whether or not we can paginate on this request.
|
167 |
-
*
|
168 |
-
* @throws FacebookSDKException
|
169 |
-
*/
|
170 |
-
public function validateForPagination()
|
171 |
-
{
|
172 |
-
if ($this->request->getMethod() !== 'GET') {
|
173 |
-
throw new FacebookSDKException('You can only paginate on a GET request.', 720);
|
174 |
-
}
|
175 |
-
}
|
176 |
-
|
177 |
-
/**
|
178 |
-
* Gets the request object needed to make a next|previous page request.
|
179 |
-
*
|
180 |
-
* @param string $direction The direction of the page: next|previous
|
181 |
-
*
|
182 |
-
* @return FacebookRequest|null
|
183 |
-
*
|
184 |
-
* @throws FacebookSDKException
|
185 |
-
*/
|
186 |
-
public function getPaginationRequest($direction)
|
187 |
-
{
|
188 |
-
$pageUrl = $this->getPaginationUrl($direction);
|
189 |
-
if (!$pageUrl) {
|
190 |
-
return null;
|
191 |
-
}
|
192 |
-
|
193 |
-
$newRequest = clone $this->request;
|
194 |
-
$newRequest->setEndpoint($pageUrl);
|
195 |
-
|
196 |
-
return $newRequest;
|
197 |
-
}
|
198 |
-
|
199 |
-
/**
|
200 |
-
* Gets the request object needed to make a "next" page request.
|
201 |
-
*
|
202 |
-
* @return FacebookRequest|null
|
203 |
-
*
|
204 |
-
* @throws FacebookSDKException
|
205 |
-
*/
|
206 |
-
public function getNextPageRequest()
|
207 |
-
{
|
208 |
-
return $this->getPaginationRequest('next');
|
209 |
-
}
|
210 |
-
|
211 |
-
/**
|
212 |
-
* Gets the request object needed to make a "previous" page request.
|
213 |
-
*
|
214 |
-
* @return FacebookRequest|null
|
215 |
-
*
|
216 |
-
* @throws FacebookSDKException
|
217 |
-
*/
|
218 |
-
public function getPreviousPageRequest()
|
219 |
-
{
|
220 |
-
return $this->getPaginationRequest('previous');
|
221 |
-
}
|
222 |
-
|
223 |
-
/**
|
224 |
-
* The total number of results according to Graph if it exists.
|
225 |
-
*
|
226 |
-
* This will be returned if the summary=true modifier is present in the request.
|
227 |
-
*
|
228 |
-
* @return int|null
|
229 |
-
*/
|
230 |
-
public function getTotalCount()
|
231 |
-
{
|
232 |
-
if (isset($this->metaData['summary']['total_count'])) {
|
233 |
-
return $this->metaData['summary']['total_count'];
|
234 |
-
}
|
235 |
-
|
236 |
-
return null;
|
237 |
-
}
|
238 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphEvent.php
DELETED
@@ -1,242 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\GraphNodes;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Class GraphEvent
|
28 |
-
*
|
29 |
-
* @package Facebook
|
30 |
-
*/
|
31 |
-
class GraphEvent extends GraphNode
|
32 |
-
{
|
33 |
-
/**
|
34 |
-
* @var array Maps object key names to GraphNode types.
|
35 |
-
*/
|
36 |
-
protected static $graphObjectMap = [
|
37 |
-
'cover' => '\Facebook\GraphNodes\GraphCoverPhoto',
|
38 |
-
'place' => '\Facebook\GraphNodes\GraphPage',
|
39 |
-
'picture' => '\Facebook\GraphNodes\GraphPicture',
|
40 |
-
'parent_group' => '\Facebook\GraphNodes\GraphGroup',
|
41 |
-
];
|
42 |
-
|
43 |
-
/**
|
44 |
-
* Returns the `id` (The event ID) as string if present.
|
45 |
-
*
|
46 |
-
* @return string|null
|
47 |
-
*/
|
48 |
-
public function getId()
|
49 |
-
{
|
50 |
-
return $this->getField('id');
|
51 |
-
}
|
52 |
-
|
53 |
-
/**
|
54 |
-
* Returns the `cover` (Cover picture) as GraphCoverPhoto if present.
|
55 |
-
*
|
56 |
-
* @return GraphCoverPhoto|null
|
57 |
-
*/
|
58 |
-
public function getCover()
|
59 |
-
{
|
60 |
-
return $this->getField('cover');
|
61 |
-
}
|
62 |
-
|
63 |
-
/**
|
64 |
-
* Returns the `description` (Long-form description) as string if present.
|
65 |
-
*
|
66 |
-
* @return string|null
|
67 |
-
*/
|
68 |
-
public function getDescription()
|
69 |
-
{
|
70 |
-
return $this->getField('description');
|
71 |
-
}
|
72 |
-
|
73 |
-
/**
|
74 |
-
* Returns the `end_time` (End time, if one has been set) as DateTime if present.
|
75 |
-
*
|
76 |
-
* @return \DateTime|null
|
77 |
-
*/
|
78 |
-
public function getEndTime()
|
79 |
-
{
|
80 |
-
return $this->getField('end_time');
|
81 |
-
}
|
82 |
-
|
83 |
-
/**
|
84 |
-
* Returns the `is_date_only` (Whether the event only has a date specified, but no time) as bool if present.
|
85 |
-
*
|
86 |
-
* @return bool|null
|
87 |
-
*/
|
88 |
-
public function getIsDateOnly()
|
89 |
-
{
|
90 |
-
return $this->getField('is_date_only');
|
91 |
-
}
|
92 |
-
|
93 |
-
/**
|
94 |
-
* Returns the `name` (Event name) as string if present.
|
95 |
-
*
|
96 |
-
* @return string|null
|
97 |
-
*/
|
98 |
-
public function getName()
|
99 |
-
{
|
100 |
-
return $this->getField('name');
|
101 |
-
}
|
102 |
-
|
103 |
-
/**
|
104 |
-
* Returns the `owner` (The profile that created the event) as GraphNode if present.
|
105 |
-
*
|
106 |
-
* @return GraphNode|null
|
107 |
-
*/
|
108 |
-
public function getOwner()
|
109 |
-
{
|
110 |
-
return $this->getField('owner');
|
111 |
-
}
|
112 |
-
|
113 |
-
/**
|
114 |
-
* Returns the `parent_group` (The group the event belongs to) as GraphGroup if present.
|
115 |
-
*
|
116 |
-
* @return GraphGroup|null
|
117 |
-
*/
|
118 |
-
public function getParentGroup()
|
119 |
-
{
|
120 |
-
return $this->getField('parent_group');
|
121 |
-
}
|
122 |
-
|
123 |
-
/**
|
124 |
-
* Returns the `place` (Event Place information) as GraphPage if present.
|
125 |
-
*
|
126 |
-
* @return GraphPage|null
|
127 |
-
*/
|
128 |
-
public function getPlace()
|
129 |
-
{
|
130 |
-
return $this->getField('place');
|
131 |
-
}
|
132 |
-
|
133 |
-
/**
|
134 |
-
* Returns the `privacy` (Who can see the event) as string if present.
|
135 |
-
*
|
136 |
-
* @return string|null
|
137 |
-
*/
|
138 |
-
public function getPrivacy()
|
139 |
-
{
|
140 |
-
return $this->getField('privacy');
|
141 |
-
}
|
142 |
-
|
143 |
-
/**
|
144 |
-
* Returns the `start_time` (Start time) as DateTime if present.
|
145 |
-
*
|
146 |
-
* @return \DateTime|null
|
147 |
-
*/
|
148 |
-
public function getStartTime()
|
149 |
-
{
|
150 |
-
return $this->getField('start_time');
|
151 |
-
}
|
152 |
-
|
153 |
-
/**
|
154 |
-
* Returns the `ticket_uri` (The link users can visit to buy a ticket to this event) as string if present.
|
155 |
-
*
|
156 |
-
* @return string|null
|
157 |
-
*/
|
158 |
-
public function getTicketUri()
|
159 |
-
{
|
160 |
-
return $this->getField('ticket_uri');
|
161 |
-
}
|
162 |
-
|
163 |
-
/**
|
164 |
-
* Returns the `timezone` (Timezone) as string if present.
|
165 |
-
*
|
166 |
-
* @return string|null
|
167 |
-
*/
|
168 |
-
public function getTimezone()
|
169 |
-
{
|
170 |
-
return $this->getField('timezone');
|
171 |
-
}
|
172 |
-
|
173 |
-
/**
|
174 |
-
* Returns the `updated_time` (Last update time) as DateTime if present.
|
175 |
-
*
|
176 |
-
* @return \DateTime|null
|
177 |
-
*/
|
178 |
-
public function getUpdatedTime()
|
179 |
-
{
|
180 |
-
return $this->getField('updated_time');
|
181 |
-
}
|
182 |
-
|
183 |
-
/**
|
184 |
-
* Returns the `picture` (Event picture) as GraphPicture if present.
|
185 |
-
*
|
186 |
-
* @return GraphPicture|null
|
187 |
-
*/
|
188 |
-
public function getPicture()
|
189 |
-
{
|
190 |
-
return $this->getField('picture');
|
191 |
-
}
|
192 |
-
|
193 |
-
/**
|
194 |
-
* Returns the `attending_count` (Number of people attending the event) as int if present.
|
195 |
-
*
|
196 |
-
* @return int|null
|
197 |
-
*/
|
198 |
-
public function getAttendingCount()
|
199 |
-
{
|
200 |
-
return $this->getField('attending_count');
|
201 |
-
}
|
202 |
-
|
203 |
-
/**
|
204 |
-
* Returns the `declined_count` (Number of people who declined the event) as int if present.
|
205 |
-
*
|
206 |
-
* @return int|null
|
207 |
-
*/
|
208 |
-
public function getDeclinedCount()
|
209 |
-
{
|
210 |
-
return $this->getField('declined_count');
|
211 |
-
}
|
212 |
-
|
213 |
-
/**
|
214 |
-
* Returns the `maybe_count` (Number of people who maybe going to the event) as int if present.
|
215 |
-
*
|
216 |
-
* @return int|null
|
217 |
-
*/
|
218 |
-
public function getMaybeCount()
|
219 |
-
{
|
220 |
-
return $this->getField('maybe_count');
|
221 |
-
}
|
222 |
-
|
223 |
-
/**
|
224 |
-
* Returns the `noreply_count` (Number of people who did not reply to the event) as int if present.
|
225 |
-
*
|
226 |
-
* @return int|null
|
227 |
-
*/
|
228 |
-
public function getNoreplyCount()
|
229 |
-
{
|
230 |
-
return $this->getField('noreply_count');
|
231 |
-
}
|
232 |
-
|
233 |
-
/**
|
234 |
-
* Returns the `invited_count` (Number of people invited to the event) as int if present.
|
235 |
-
*
|
236 |
-
* @return int|null
|
237 |
-
*/
|
238 |
-
public function getInvitedCount()
|
239 |
-
{
|
240 |
-
return $this->getField('invited_count');
|
241 |
-
}
|
242 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphGroup.php
DELETED
@@ -1,170 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\GraphNodes;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Class GraphGroup
|
28 |
-
*
|
29 |
-
* @package Facebook
|
30 |
-
*/
|
31 |
-
class GraphGroup extends GraphNode
|
32 |
-
{
|
33 |
-
/**
|
34 |
-
* @var array Maps object key names to GraphNode types.
|
35 |
-
*/
|
36 |
-
protected static $graphObjectMap = [
|
37 |
-
'cover' => '\Facebook\GraphNodes\GraphCoverPhoto',
|
38 |
-
'venue' => '\Facebook\GraphNodes\GraphLocation',
|
39 |
-
];
|
40 |
-
|
41 |
-
/**
|
42 |
-
* Returns the `id` (The Group ID) as string if present.
|
43 |
-
*
|
44 |
-
* @return string|null
|
45 |
-
*/
|
46 |
-
public function getId()
|
47 |
-
{
|
48 |
-
return $this->getField('id');
|
49 |
-
}
|
50 |
-
|
51 |
-
/**
|
52 |
-
* Returns the `cover` (The cover photo of the Group) as GraphCoverPhoto if present.
|
53 |
-
*
|
54 |
-
* @return GraphCoverPhoto|null
|
55 |
-
*/
|
56 |
-
public function getCover()
|
57 |
-
{
|
58 |
-
return $this->getField('cover');
|
59 |
-
}
|
60 |
-
|
61 |
-
/**
|
62 |
-
* Returns the `description` (A brief description of the Group) as string if present.
|
63 |
-
*
|
64 |
-
* @return string|null
|
65 |
-
*/
|
66 |
-
public function getDescription()
|
67 |
-
{
|
68 |
-
return $this->getField('description');
|
69 |
-
}
|
70 |
-
|
71 |
-
/**
|
72 |
-
* Returns the `email` (The email address to upload content to the Group. Only current members of the Group can use this) as string if present.
|
73 |
-
*
|
74 |
-
* @return string|null
|
75 |
-
*/
|
76 |
-
public function getEmail()
|
77 |
-
{
|
78 |
-
return $this->getField('email');
|
79 |
-
}
|
80 |
-
|
81 |
-
/**
|
82 |
-
* Returns the `icon` (The URL for the Group's icon) as string if present.
|
83 |
-
*
|
84 |
-
* @return string|null
|
85 |
-
*/
|
86 |
-
public function getIcon()
|
87 |
-
{
|
88 |
-
return $this->getField('icon');
|
89 |
-
}
|
90 |
-
|
91 |
-
/**
|
92 |
-
* Returns the `link` (The Group's website) as string if present.
|
93 |
-
*
|
94 |
-
* @return string|null
|
95 |
-
*/
|
96 |
-
public function getLink()
|
97 |
-
{
|
98 |
-
return $this->getField('link');
|
99 |
-
}
|
100 |
-
|
101 |
-
/**
|
102 |
-
* Returns the `name` (The name of the Group) as string if present.
|
103 |
-
*
|
104 |
-
* @return string|null
|
105 |
-
*/
|
106 |
-
public function getName()
|
107 |
-
{
|
108 |
-
return $this->getField('name');
|
109 |
-
}
|
110 |
-
|
111 |
-
/**
|
112 |
-
* Returns the `member_request_count` (Number of people asking to join the group.) as int if present.
|
113 |
-
*
|
114 |
-
* @return int|null
|
115 |
-
*/
|
116 |
-
public function getMemberRequestCount()
|
117 |
-
{
|
118 |
-
return $this->getField('member_request_count');
|
119 |
-
}
|
120 |
-
|
121 |
-
/**
|
122 |
-
* Returns the `owner` (The profile that created this Group) as GraphNode if present.
|
123 |
-
*
|
124 |
-
* @return GraphNode|null
|
125 |
-
*/
|
126 |
-
public function getOwner()
|
127 |
-
{
|
128 |
-
return $this->getField('owner');
|
129 |
-
}
|
130 |
-
|
131 |
-
/**
|
132 |
-
* Returns the `parent` (The parent Group of this Group, if it exists) as GraphNode if present.
|
133 |
-
*
|
134 |
-
* @return GraphNode|null
|
135 |
-
*/
|
136 |
-
public function getParent()
|
137 |
-
{
|
138 |
-
return $this->getField('parent');
|
139 |
-
}
|
140 |
-
|
141 |
-
/**
|
142 |
-
* Returns the `privacy` (The privacy setting of the Group) as string if present.
|
143 |
-
*
|
144 |
-
* @return string|null
|
145 |
-
*/
|
146 |
-
public function getPrivacy()
|
147 |
-
{
|
148 |
-
return $this->getField('privacy');
|
149 |
-
}
|
150 |
-
|
151 |
-
/**
|
152 |
-
* Returns the `updated_time` (The last time the Group was updated (this includes changes in the Group's properties and changes in posts and comments if user can see them)) as \DateTime if present.
|
153 |
-
*
|
154 |
-
* @return \DateTime|null
|
155 |
-
*/
|
156 |
-
public function getUpdatedTime()
|
157 |
-
{
|
158 |
-
return $this->getField('updated_time');
|
159 |
-
}
|
160 |
-
|
161 |
-
/**
|
162 |
-
* Returns the `venue` (The location for the Group) as GraphLocation if present.
|
163 |
-
*
|
164 |
-
* @return GraphLocation|null
|
165 |
-
*/
|
166 |
-
public function getVenue()
|
167 |
-
{
|
168 |
-
return $this->getField('venue');
|
169 |
-
}
|
170 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphList.php
DELETED
@@ -1,36 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\GraphNodes;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Class GraphList
|
28 |
-
*
|
29 |
-
* @package Facebook
|
30 |
-
*
|
31 |
-
* @deprecated 5.0.0 GraphList has been renamed to GraphEdge
|
32 |
-
* @todo v6: Remove this class
|
33 |
-
*/
|
34 |
-
class GraphList extends GraphEdge
|
35 |
-
{
|
36 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphLocation.php
DELETED
@@ -1,102 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\GraphNodes;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Class GraphLocation
|
28 |
-
*
|
29 |
-
* @package Facebook
|
30 |
-
*/
|
31 |
-
class GraphLocation extends GraphNode
|
32 |
-
{
|
33 |
-
/**
|
34 |
-
* Returns the street component of the location
|
35 |
-
*
|
36 |
-
* @return string|null
|
37 |
-
*/
|
38 |
-
public function getStreet()
|
39 |
-
{
|
40 |
-
return $this->getField('street');
|
41 |
-
}
|
42 |
-
|
43 |
-
/**
|
44 |
-
* Returns the city component of the location
|
45 |
-
*
|
46 |
-
* @return string|null
|
47 |
-
*/
|
48 |
-
public function getCity()
|
49 |
-
{
|
50 |
-
return $this->getField('city');
|
51 |
-
}
|
52 |
-
|
53 |
-
/**
|
54 |
-
* Returns the state component of the location
|
55 |
-
*
|
56 |
-
* @return string|null
|
57 |
-
*/
|
58 |
-
public function getState()
|
59 |
-
{
|
60 |
-
return $this->getField('state');
|
61 |
-
}
|
62 |
-
|
63 |
-
/**
|
64 |
-
* Returns the country component of the location
|
65 |
-
*
|
66 |
-
* @return string|null
|
67 |
-
*/
|
68 |
-
public function getCountry()
|
69 |
-
{
|
70 |
-
return $this->getField('country');
|
71 |
-
}
|
72 |
-
|
73 |
-
/**
|
74 |
-
* Returns the zipcode component of the location
|
75 |
-
*
|
76 |
-
* @return string|null
|
77 |
-
*/
|
78 |
-
public function getZip()
|
79 |
-
{
|
80 |
-
return $this->getField('zip');
|
81 |
-
}
|
82 |
-
|
83 |
-
/**
|
84 |
-
* Returns the latitude component of the location
|
85 |
-
*
|
86 |
-
* @return float|null
|
87 |
-
*/
|
88 |
-
public function getLatitude()
|
89 |
-
{
|
90 |
-
return $this->getField('latitude');
|
91 |
-
}
|
92 |
-
|
93 |
-
/**
|
94 |
-
* Returns the street component of the location
|
95 |
-
*
|
96 |
-
* @return float|null
|
97 |
-
*/
|
98 |
-
public function getLongitude()
|
99 |
-
{
|
100 |
-
return $this->getField('longitude');
|
101 |
-
}
|
102 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphNode.php
DELETED
@@ -1,197 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\GraphNodes;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Class GraphNode
|
28 |
-
*
|
29 |
-
* @package Facebook
|
30 |
-
*/
|
31 |
-
class GraphNode extends Collection
|
32 |
-
{
|
33 |
-
/**
|
34 |
-
* @var array Maps object key names to Graph object types.
|
35 |
-
*/
|
36 |
-
protected static $graphObjectMap = [];
|
37 |
-
|
38 |
-
/**
|
39 |
-
* Init this Graph object.
|
40 |
-
*
|
41 |
-
* @param array $data
|
42 |
-
*/
|
43 |
-
public function __construct(array $data = [])
|
44 |
-
{
|
45 |
-
parent::__construct($this->castItems($data));
|
46 |
-
}
|
47 |
-
|
48 |
-
/**
|
49 |
-
* Iterates over an array and detects the types each node
|
50 |
-
* should be cast to and returns all the items as an array.
|
51 |
-
*
|
52 |
-
* @TODO Add auto-casting to AccessToken entities.
|
53 |
-
*
|
54 |
-
* @param array $data The array to iterate over.
|
55 |
-
*
|
56 |
-
* @return array
|
57 |
-
*/
|
58 |
-
public function castItems(array $data)
|
59 |
-
{
|
60 |
-
$items = [];
|
61 |
-
|
62 |
-
foreach ($data as $k => $v) {
|
63 |
-
if ($this->shouldCastAsDateTime($k)
|
64 |
-
&& (is_numeric($v)
|
65 |
-
|| $this->isIso8601DateString($v))
|
66 |
-
) {
|
67 |
-
$items[$k] = $this->castToDateTime($v);
|
68 |
-
} elseif ($k === 'birthday') {
|
69 |
-
$items[$k] = $this->castToBirthday($v);
|
70 |
-
} else {
|
71 |
-
$items[$k] = $v;
|
72 |
-
}
|
73 |
-
}
|
74 |
-
|
75 |
-
return $items;
|
76 |
-
}
|
77 |
-
|
78 |
-
/**
|
79 |
-
* Uncasts any auto-casted datatypes.
|
80 |
-
* Basically the reverse of castItems().
|
81 |
-
*
|
82 |
-
* @return array
|
83 |
-
*/
|
84 |
-
public function uncastItems()
|
85 |
-
{
|
86 |
-
$items = $this->asArray();
|
87 |
-
|
88 |
-
return array_map(function ($v) {
|
89 |
-
if ($v instanceof \DateTime) {
|
90 |
-
return $v->format(\DateTime::ISO8601);
|
91 |
-
}
|
92 |
-
|
93 |
-
return $v;
|
94 |
-
}, $items);
|
95 |
-
}
|
96 |
-
|
97 |
-
/**
|
98 |
-
* Get the collection of items as JSON.
|
99 |
-
*
|
100 |
-
* @param int $options
|
101 |
-
*
|
102 |
-
* @return string
|
103 |
-
*/
|
104 |
-
public function asJson($options = 0)
|
105 |
-
{
|
106 |
-
return json_encode($this->uncastItems(), $options);
|
107 |
-
}
|
108 |
-
|
109 |
-
/**
|
110 |
-
* Detects an ISO 8601 formatted string.
|
111 |
-
*
|
112 |
-
* @param string $string
|
113 |
-
*
|
114 |
-
* @return boolean
|
115 |
-
*
|
116 |
-
* @see https://developers.facebook.com/docs/graph-api/using-graph-api/#readmodifiers
|
117 |
-
* @see http://www.cl.cam.ac.uk/~mgk25/iso-time.html
|
118 |
-
* @see http://en.wikipedia.org/wiki/ISO_8601
|
119 |
-
*/
|
120 |
-
public function isIso8601DateString($string)
|
121 |
-
{
|
122 |
-
// This insane regex was yoinked from here:
|
123 |
-
// http://www.pelagodesign.com/blog/2009/05/20/iso-8601-date-validation-that-doesnt-suck/
|
124 |
-
// ...and I'm all like:
|
125 |
-
// http://thecodinglove.com/post/95378251969/when-code-works-and-i-dont-know-why
|
126 |
-
$crazyInsaneRegexThatSomehowDetectsIso8601 = '/^([\+-]?\d{4}(?!\d{2}\b))'
|
127 |
-
. '((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?'
|
128 |
-
. '|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d'
|
129 |
-
. '|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])'
|
130 |
-
. '((:?)[0-5]\d)?|24\:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d'
|
131 |
-
. '([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/';
|
132 |
-
|
133 |
-
return preg_match($crazyInsaneRegexThatSomehowDetectsIso8601, $string) === 1;
|
134 |
-
}
|
135 |
-
|
136 |
-
/**
|
137 |
-
* Determines if a value from Graph should be cast to DateTime.
|
138 |
-
*
|
139 |
-
* @param string $key
|
140 |
-
*
|
141 |
-
* @return boolean
|
142 |
-
*/
|
143 |
-
public function shouldCastAsDateTime($key)
|
144 |
-
{
|
145 |
-
return in_array($key, [
|
146 |
-
'created_time',
|
147 |
-
'updated_time',
|
148 |
-
'start_time',
|
149 |
-
'end_time',
|
150 |
-
'backdated_time',
|
151 |
-
'issued_at',
|
152 |
-
'expires_at',
|
153 |
-
'publish_time'
|
154 |
-
], true);
|
155 |
-
}
|
156 |
-
|
157 |
-
/**
|
158 |
-
* Casts a date value from Graph to DateTime.
|
159 |
-
*
|
160 |
-
* @param int|string $value
|
161 |
-
*
|
162 |
-
* @return \DateTime
|
163 |
-
*/
|
164 |
-
public function castToDateTime($value)
|
165 |
-
{
|
166 |
-
if (is_int($value)) {
|
167 |
-
$dt = new \DateTime();
|
168 |
-
$dt->setTimestamp($value);
|
169 |
-
} else {
|
170 |
-
$dt = new \DateTime($value);
|
171 |
-
}
|
172 |
-
|
173 |
-
return $dt;
|
174 |
-
}
|
175 |
-
|
176 |
-
/**
|
177 |
-
* Casts a birthday value from Graph to Birthday
|
178 |
-
*
|
179 |
-
* @param string $value
|
180 |
-
*
|
181 |
-
* @return Birthday
|
182 |
-
*/
|
183 |
-
public function castToBirthday($value)
|
184 |
-
{
|
185 |
-
return new Birthday($value);
|
186 |
-
}
|
187 |
-
|
188 |
-
/**
|
189 |
-
* Getter for $graphObjectMap.
|
190 |
-
*
|
191 |
-
* @return array
|
192 |
-
*/
|
193 |
-
public static function getObjectMap()
|
194 |
-
{
|
195 |
-
return static::$graphObjectMap;
|
196 |
-
}
|
197 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphNodeFactory.php
DELETED
@@ -1,392 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\GraphNodes;
|
25 |
-
|
26 |
-
use Facebook\FacebookResponse;
|
27 |
-
use Facebook\Exceptions\FacebookSDKException;
|
28 |
-
|
29 |
-
/**
|
30 |
-
* Class GraphNodeFactory
|
31 |
-
*
|
32 |
-
* @package Facebook
|
33 |
-
*
|
34 |
-
* ## Assumptions ##
|
35 |
-
* GraphEdge - is ALWAYS a numeric array
|
36 |
-
* GraphEdge - is ALWAYS an array of GraphNode types
|
37 |
-
* GraphNode - is ALWAYS an associative array
|
38 |
-
* GraphNode - MAY contain GraphNode's "recurrable"
|
39 |
-
* GraphNode - MAY contain GraphEdge's "recurrable"
|
40 |
-
* GraphNode - MAY contain DateTime's "primitives"
|
41 |
-
* GraphNode - MAY contain string's "primitives"
|
42 |
-
*/
|
43 |
-
class GraphNodeFactory
|
44 |
-
{
|
45 |
-
/**
|
46 |
-
* @const string The base graph object class.
|
47 |
-
*/
|
48 |
-
const BASE_GRAPH_NODE_CLASS = '\Facebook\GraphNodes\GraphNode';
|
49 |
-
|
50 |
-
/**
|
51 |
-
* @const string The base graph edge class.
|
52 |
-
*/
|
53 |
-
const BASE_GRAPH_EDGE_CLASS = '\Facebook\GraphNodes\GraphEdge';
|
54 |
-
|
55 |
-
/**
|
56 |
-
* @const string The graph object prefix.
|
57 |
-
*/
|
58 |
-
const BASE_GRAPH_OBJECT_PREFIX = '\Facebook\GraphNodes\\';
|
59 |
-
|
60 |
-
/**
|
61 |
-
* @var FacebookResponse The response entity from Graph.
|
62 |
-
*/
|
63 |
-
protected $response;
|
64 |
-
|
65 |
-
/**
|
66 |
-
* @var array The decoded body of the FacebookResponse entity from Graph.
|
67 |
-
*/
|
68 |
-
protected $decodedBody;
|
69 |
-
|
70 |
-
/**
|
71 |
-
* Init this Graph object.
|
72 |
-
*
|
73 |
-
* @param FacebookResponse $response The response entity from Graph.
|
74 |
-
*/
|
75 |
-
public function __construct(FacebookResponse $response)
|
76 |
-
{
|
77 |
-
$this->response = $response;
|
78 |
-
$this->decodedBody = $response->getDecodedBody();
|
79 |
-
}
|
80 |
-
|
81 |
-
/**
|
82 |
-
* Tries to convert a FacebookResponse entity into a GraphNode.
|
83 |
-
*
|
84 |
-
* @param string|null $subclassName The GraphNode sub class to cast to.
|
85 |
-
*
|
86 |
-
* @return GraphNode
|
87 |
-
*
|
88 |
-
* @throws FacebookSDKException
|
89 |
-
*/
|
90 |
-
public function makeGraphNode($subclassName = null)
|
91 |
-
{
|
92 |
-
$this->validateResponseAsArray();
|
93 |
-
$this->validateResponseCastableAsGraphNode();
|
94 |
-
|
95 |
-
return $this->castAsGraphNodeOrGraphEdge($this->decodedBody, $subclassName);
|
96 |
-
}
|
97 |
-
|
98 |
-
/**
|
99 |
-
* Convenience method for creating a GraphAchievement collection.
|
100 |
-
*
|
101 |
-
* @return GraphAchievement
|
102 |
-
*
|
103 |
-
* @throws FacebookSDKException
|
104 |
-
*/
|
105 |
-
public function makeGraphAchievement()
|
106 |
-
{
|
107 |
-
return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphAchievement');
|
108 |
-
}
|
109 |
-
|
110 |
-
/**
|
111 |
-
* Convenience method for creating a GraphAlbum collection.
|
112 |
-
*
|
113 |
-
* @return GraphAlbum
|
114 |
-
*
|
115 |
-
* @throws FacebookSDKException
|
116 |
-
*/
|
117 |
-
public function makeGraphAlbum()
|
118 |
-
{
|
119 |
-
return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphAlbum');
|
120 |
-
}
|
121 |
-
|
122 |
-
/**
|
123 |
-
* Convenience method for creating a GraphPage collection.
|
124 |
-
*
|
125 |
-
* @return GraphPage
|
126 |
-
*
|
127 |
-
* @throws FacebookSDKException
|
128 |
-
*/
|
129 |
-
public function makeGraphPage()
|
130 |
-
{
|
131 |
-
return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphPage');
|
132 |
-
}
|
133 |
-
|
134 |
-
/**
|
135 |
-
* Convenience method for creating a GraphSessionInfo collection.
|
136 |
-
*
|
137 |
-
* @return GraphSessionInfo
|
138 |
-
*
|
139 |
-
* @throws FacebookSDKException
|
140 |
-
*/
|
141 |
-
public function makeGraphSessionInfo()
|
142 |
-
{
|
143 |
-
return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphSessionInfo');
|
144 |
-
}
|
145 |
-
|
146 |
-
/**
|
147 |
-
* Convenience method for creating a GraphUser collection.
|
148 |
-
*
|
149 |
-
* @return GraphUser
|
150 |
-
*
|
151 |
-
* @throws FacebookSDKException
|
152 |
-
*/
|
153 |
-
public function makeGraphUser()
|
154 |
-
{
|
155 |
-
return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphUser');
|
156 |
-
}
|
157 |
-
|
158 |
-
/**
|
159 |
-
* Convenience method for creating a GraphEvent collection.
|
160 |
-
*
|
161 |
-
* @return GraphEvent
|
162 |
-
*
|
163 |
-
* @throws FacebookSDKException
|
164 |
-
*/
|
165 |
-
public function makeGraphEvent()
|
166 |
-
{
|
167 |
-
return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphEvent');
|
168 |
-
}
|
169 |
-
|
170 |
-
/**
|
171 |
-
* Convenience method for creating a GraphGroup collection.
|
172 |
-
*
|
173 |
-
* @return GraphGroup
|
174 |
-
*
|
175 |
-
* @throws FacebookSDKException
|
176 |
-
*/
|
177 |
-
public function makeGraphGroup()
|
178 |
-
{
|
179 |
-
return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphGroup');
|
180 |
-
}
|
181 |
-
|
182 |
-
/**
|
183 |
-
* Tries to convert a FacebookResponse entity into a GraphEdge.
|
184 |
-
*
|
185 |
-
* @param string|null $subclassName The GraphNode sub class to cast the list items to.
|
186 |
-
* @param boolean $auto_prefix Toggle to auto-prefix the subclass name.
|
187 |
-
*
|
188 |
-
* @return GraphEdge
|
189 |
-
*
|
190 |
-
* @throws FacebookSDKException
|
191 |
-
*/
|
192 |
-
public function makeGraphEdge($subclassName = null, $auto_prefix = true)
|
193 |
-
{
|
194 |
-
$this->validateResponseAsArray();
|
195 |
-
$this->validateResponseCastableAsGraphEdge();
|
196 |
-
|
197 |
-
if ($subclassName && $auto_prefix) {
|
198 |
-
$subclassName = static::BASE_GRAPH_OBJECT_PREFIX . $subclassName;
|
199 |
-
}
|
200 |
-
|
201 |
-
return $this->castAsGraphNodeOrGraphEdge($this->decodedBody, $subclassName);
|
202 |
-
}
|
203 |
-
|
204 |
-
/**
|
205 |
-
* Validates the decoded body.
|
206 |
-
*
|
207 |
-
* @throws FacebookSDKException
|
208 |
-
*/
|
209 |
-
public function validateResponseAsArray()
|
210 |
-
{
|
211 |
-
if (!is_array($this->decodedBody)) {
|
212 |
-
throw new FacebookSDKException('Unable to get response from Graph as array.', 620);
|
213 |
-
}
|
214 |
-
}
|
215 |
-
|
216 |
-
/**
|
217 |
-
* Validates that the return data can be cast as a GraphNode.
|
218 |
-
*
|
219 |
-
* @throws FacebookSDKException
|
220 |
-
*/
|
221 |
-
public function validateResponseCastableAsGraphNode()
|
222 |
-
{
|
223 |
-
if (isset($this->decodedBody['data']) && static::isCastableAsGraphEdge($this->decodedBody['data'])) {
|
224 |
-
throw new FacebookSDKException(
|
225 |
-
'Unable to convert response from Graph to a GraphNode because the response looks like a GraphEdge. Try using GraphNodeFactory::makeGraphEdge() instead.',
|
226 |
-
620
|
227 |
-
);
|
228 |
-
}
|
229 |
-
}
|
230 |
-
|
231 |
-
/**
|
232 |
-
* Validates that the return data can be cast as a GraphEdge.
|
233 |
-
*
|
234 |
-
* @throws FacebookSDKException
|
235 |
-
*/
|
236 |
-
public function validateResponseCastableAsGraphEdge()
|
237 |
-
{
|
238 |
-
if (!(isset($this->decodedBody['data']) && static::isCastableAsGraphEdge($this->decodedBody['data']))) {
|
239 |
-
throw new FacebookSDKException(
|
240 |
-
'Unable to convert response from Graph to a GraphEdge because the response does not look like a GraphEdge. Try using GraphNodeFactory::makeGraphNode() instead.',
|
241 |
-
620
|
242 |
-
);
|
243 |
-
}
|
244 |
-
}
|
245 |
-
|
246 |
-
/**
|
247 |
-
* Safely instantiates a GraphNode of $subclassName.
|
248 |
-
*
|
249 |
-
* @param array $data The array of data to iterate over.
|
250 |
-
* @param string|null $subclassName The subclass to cast this collection to.
|
251 |
-
*
|
252 |
-
* @return GraphNode
|
253 |
-
*
|
254 |
-
* @throws FacebookSDKException
|
255 |
-
*/
|
256 |
-
public function safelyMakeGraphNode(array $data, $subclassName = null)
|
257 |
-
{
|
258 |
-
$subclassName = $subclassName ?: static::BASE_GRAPH_NODE_CLASS;
|
259 |
-
static::validateSubclass($subclassName);
|
260 |
-
|
261 |
-
// Remember the parent node ID
|
262 |
-
$parentNodeId = isset($data['id']) ? $data['id'] : null;
|
263 |
-
|
264 |
-
$items = [];
|
265 |
-
|
266 |
-
foreach ($data as $k => $v) {
|
267 |
-
// Array means could be recurable
|
268 |
-
if (is_array($v)) {
|
269 |
-
// Detect any smart-casting from the $graphObjectMap array.
|
270 |
-
// This is always empty on the GraphNode collection, but subclasses can define
|
271 |
-
// their own array of smart-casting types.
|
272 |
-
$graphObjectMap = $subclassName::getObjectMap();
|
273 |
-
$objectSubClass = isset($graphObjectMap[$k])
|
274 |
-
? $graphObjectMap[$k]
|
275 |
-
: null;
|
276 |
-
|
277 |
-
// Could be a GraphEdge or GraphNode
|
278 |
-
$items[$k] = $this->castAsGraphNodeOrGraphEdge($v, $objectSubClass, $k, $parentNodeId);
|
279 |
-
} else {
|
280 |
-
$items[$k] = $v;
|
281 |
-
}
|
282 |
-
}
|
283 |
-
|
284 |
-
return new $subclassName($items);
|
285 |
-
}
|
286 |
-
|
287 |
-
/**
|
288 |
-
* Takes an array of values and determines how to cast each node.
|
289 |
-
*
|
290 |
-
* @param array $data The array of data to iterate over.
|
291 |
-
* @param string|null $subclassName The subclass to cast this collection to.
|
292 |
-
* @param string|null $parentKey The key of this data (Graph edge).
|
293 |
-
* @param string|null $parentNodeId The parent Graph node ID.
|
294 |
-
*
|
295 |
-
* @return GraphNode|GraphEdge
|
296 |
-
*
|
297 |
-
* @throws FacebookSDKException
|
298 |
-
*/
|
299 |
-
public function castAsGraphNodeOrGraphEdge(array $data, $subclassName = null, $parentKey = null, $parentNodeId = null)
|
300 |
-
{
|
301 |
-
if (isset($data['data'])) {
|
302 |
-
// Create GraphEdge
|
303 |
-
if (static::isCastableAsGraphEdge($data['data'])) {
|
304 |
-
return $this->safelyMakeGraphEdge($data, $subclassName, $parentKey, $parentNodeId);
|
305 |
-
}
|
306 |
-
// Sometimes Graph is a weirdo and returns a GraphNode under the "data" key
|
307 |
-
$data = $data['data'];
|
308 |
-
}
|
309 |
-
|
310 |
-
// Create GraphNode
|
311 |
-
return $this->safelyMakeGraphNode($data, $subclassName);
|
312 |
-
}
|
313 |
-
|
314 |
-
/**
|
315 |
-
* Return an array of GraphNode's.
|
316 |
-
*
|
317 |
-
* @param array $data The array of data to iterate over.
|
318 |
-
* @param string|null $subclassName The GraphNode subclass to cast each item in the list to.
|
319 |
-
* @param string|null $parentKey The key of this data (Graph edge).
|
320 |
-
* @param string|null $parentNodeId The parent Graph node ID.
|
321 |
-
*
|
322 |
-
* @return GraphEdge
|
323 |
-
*
|
324 |
-
* @throws FacebookSDKException
|
325 |
-
*/
|
326 |
-
public function safelyMakeGraphEdge(array $data, $subclassName = null, $parentKey = null, $parentNodeId = null)
|
327 |
-
{
|
328 |
-
if (!isset($data['data'])) {
|
329 |
-
throw new FacebookSDKException('Cannot cast data to GraphEdge. Expected a "data" key.', 620);
|
330 |
-
}
|
331 |
-
|
332 |
-
$dataList = [];
|
333 |
-
foreach ($data['data'] as $graphNode) {
|
334 |
-
$dataList[] = $this->safelyMakeGraphNode($graphNode, $subclassName);
|
335 |
-
}
|
336 |
-
|
337 |
-
$metaData = $this->getMetaData($data);
|
338 |
-
|
339 |
-
// We'll need to make an edge endpoint for this in case it's a GraphEdge (for cursor pagination)
|
340 |
-
$parentGraphEdgeEndpoint = $parentNodeId && $parentKey ? '/' . $parentNodeId . '/' . $parentKey : null;
|
341 |
-
$className = static::BASE_GRAPH_EDGE_CLASS;
|
342 |
-
|
343 |
-
return new $className($this->response->getRequest(), $dataList, $metaData, $parentGraphEdgeEndpoint, $subclassName);
|
344 |
-
}
|
345 |
-
|
346 |
-
/**
|
347 |
-
* Get the meta data from a list in a Graph response.
|
348 |
-
*
|
349 |
-
* @param array $data The Graph response.
|
350 |
-
*
|
351 |
-
* @return array
|
352 |
-
*/
|
353 |
-
public function getMetaData(array $data)
|
354 |
-
{
|
355 |
-
unset($data['data']);
|
356 |
-
|
357 |
-
return $data;
|
358 |
-
}
|
359 |
-
|
360 |
-
/**
|
361 |
-
* Determines whether or not the data should be cast as a GraphEdge.
|
362 |
-
*
|
363 |
-
* @param array $data
|
364 |
-
*
|
365 |
-
* @return boolean
|
366 |
-
*/
|
367 |
-
public static function isCastableAsGraphEdge(array $data)
|
368 |
-
{
|
369 |
-
if ($data === []) {
|
370 |
-
return true;
|
371 |
-
}
|
372 |
-
|
373 |
-
// Checks for a sequential numeric array which would be a GraphEdge
|
374 |
-
return array_keys($data) === range(0, count($data) - 1);
|
375 |
-
}
|
376 |
-
|
377 |
-
/**
|
378 |
-
* Ensures that the subclass in question is valid.
|
379 |
-
*
|
380 |
-
* @param string $subclassName The GraphNode subclass to validate.
|
381 |
-
*
|
382 |
-
* @throws FacebookSDKException
|
383 |
-
*/
|
384 |
-
public static function validateSubclass($subclassName)
|
385 |
-
{
|
386 |
-
if ($subclassName == static::BASE_GRAPH_NODE_CLASS || is_subclass_of($subclassName, static::BASE_GRAPH_NODE_CLASS)) {
|
387 |
-
return;
|
388 |
-
}
|
389 |
-
|
390 |
-
throw new FacebookSDKException('The given subclass "' . $subclassName . '" is not valid. Cannot cast to an object that is not a GraphNode subclass.', 620);
|
391 |
-
}
|
392 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphObject.php
DELETED
@@ -1,36 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\GraphNodes;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Class GraphObject
|
28 |
-
*
|
29 |
-
* @package Facebook
|
30 |
-
*
|
31 |
-
* @deprecated 5.0.0 GraphObject has been renamed to GraphNode
|
32 |
-
* @todo v6: Remove this class
|
33 |
-
*/
|
34 |
-
class GraphObject extends GraphNode
|
35 |
-
{
|
36 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphObjectFactory.php
DELETED
@@ -1,88 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\GraphNodes;
|
25 |
-
|
26 |
-
use Facebook\Exceptions\FacebookSDKException;
|
27 |
-
|
28 |
-
/**
|
29 |
-
* Class GraphObjectFactory
|
30 |
-
*
|
31 |
-
* @package Facebook
|
32 |
-
*
|
33 |
-
* @deprecated 5.0.0 GraphObjectFactory has been renamed to GraphNodeFactory
|
34 |
-
* @todo v6: Remove this class
|
35 |
-
*/
|
36 |
-
class GraphObjectFactory extends GraphNodeFactory
|
37 |
-
{
|
38 |
-
/**
|
39 |
-
* @const string The base graph object class.
|
40 |
-
*/
|
41 |
-
const BASE_GRAPH_NODE_CLASS = '\Facebook\GraphNodes\GraphObject';
|
42 |
-
|
43 |
-
/**
|
44 |
-
* @const string The base graph edge class.
|
45 |
-
*/
|
46 |
-
const BASE_GRAPH_EDGE_CLASS = '\Facebook\GraphNodes\GraphList';
|
47 |
-
|
48 |
-
/**
|
49 |
-
* Tries to convert a FacebookResponse entity into a GraphNode.
|
50 |
-
*
|
51 |
-
* @param string|null $subclassName The GraphNode sub class to cast to.
|
52 |
-
*
|
53 |
-
* @return GraphNode
|
54 |
-
*
|
55 |
-
* @deprecated 5.0.0 GraphObjectFactory has been renamed to GraphNodeFactory
|
56 |
-
*/
|
57 |
-
public function makeGraphObject($subclassName = null)
|
58 |
-
{
|
59 |
-
return $this->makeGraphNode($subclassName);
|
60 |
-
}
|
61 |
-
|
62 |
-
/**
|
63 |
-
* Convenience method for creating a GraphEvent collection.
|
64 |
-
*
|
65 |
-
* @return GraphEvent
|
66 |
-
*
|
67 |
-
* @throws FacebookSDKException
|
68 |
-
*/
|
69 |
-
public function makeGraphEvent()
|
70 |
-
{
|
71 |
-
return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphEvent');
|
72 |
-
}
|
73 |
-
|
74 |
-
/**
|
75 |
-
* Tries to convert a FacebookResponse entity into a GraphEdge.
|
76 |
-
*
|
77 |
-
* @param string|null $subclassName The GraphNode sub class to cast the list items to.
|
78 |
-
* @param boolean $auto_prefix Toggle to auto-prefix the subclass name.
|
79 |
-
*
|
80 |
-
* @return GraphEdge
|
81 |
-
*
|
82 |
-
* @deprecated 5.0.0 GraphObjectFactory has been renamed to GraphNodeFactory
|
83 |
-
*/
|
84 |
-
public function makeGraphList($subclassName = null, $auto_prefix = true)
|
85 |
-
{
|
86 |
-
return $this->makeGraphEdge($subclassName, $auto_prefix);
|
87 |
-
}
|
88 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphPage.php
DELETED
@@ -1,125 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\GraphNodes;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Class GraphPage
|
28 |
-
*
|
29 |
-
* @package Facebook
|
30 |
-
*/
|
31 |
-
class GraphPage extends GraphNode
|
32 |
-
{
|
33 |
-
/**
|
34 |
-
* @var array Maps object key names to Graph object types.
|
35 |
-
*/
|
36 |
-
protected static $graphObjectMap = [
|
37 |
-
'best_page' => '\Facebook\GraphNodes\GraphPage',
|
38 |
-
'global_brand_parent_page' => '\Facebook\GraphNodes\GraphPage',
|
39 |
-
'location' => '\Facebook\GraphNodes\GraphLocation',
|
40 |
-
];
|
41 |
-
|
42 |
-
/**
|
43 |
-
* Returns the ID for the user's page as a string if present.
|
44 |
-
*
|
45 |
-
* @return string|null
|
46 |
-
*/
|
47 |
-
public function getId()
|
48 |
-
{
|
49 |
-
return $this->getField('id');
|
50 |
-
}
|
51 |
-
|
52 |
-
/**
|
53 |
-
* Returns the Category for the user's page as a string if present.
|
54 |
-
*
|
55 |
-
* @return string|null
|
56 |
-
*/
|
57 |
-
public function getCategory()
|
58 |
-
{
|
59 |
-
return $this->getField('category');
|
60 |
-
}
|
61 |
-
|
62 |
-
/**
|
63 |
-
* Returns the Name of the user's page as a string if present.
|
64 |
-
*
|
65 |
-
* @return string|null
|
66 |
-
*/
|
67 |
-
public function getName()
|
68 |
-
{
|
69 |
-
return $this->getField('name');
|
70 |
-
}
|
71 |
-
|
72 |
-
/**
|
73 |
-
* Returns the best available Page on Facebook.
|
74 |
-
*
|
75 |
-
* @return GraphPage|null
|
76 |
-
*/
|
77 |
-
public function getBestPage()
|
78 |
-
{
|
79 |
-
return $this->getField('best_page');
|
80 |
-
}
|
81 |
-
|
82 |
-
/**
|
83 |
-
* Returns the brand's global (parent) Page.
|
84 |
-
*
|
85 |
-
* @return GraphPage|null
|
86 |
-
*/
|
87 |
-
public function getGlobalBrandParentPage()
|
88 |
-
{
|
89 |
-
return $this->getField('global_brand_parent_page');
|
90 |
-
}
|
91 |
-
|
92 |
-
/**
|
93 |
-
* Returns the location of this place.
|
94 |
-
*
|
95 |
-
* @return GraphLocation|null
|
96 |
-
*/
|
97 |
-
public function getLocation()
|
98 |
-
{
|
99 |
-
return $this->getField('location');
|
100 |
-
}
|
101 |
-
|
102 |
-
/**
|
103 |
-
* Returns the page access token for the admin user.
|
104 |
-
*
|
105 |
-
* Only available in the `/me/accounts` context.
|
106 |
-
*
|
107 |
-
* @return string|null
|
108 |
-
*/
|
109 |
-
public function getAccessToken()
|
110 |
-
{
|
111 |
-
return $this->getField('access_token');
|
112 |
-
}
|
113 |
-
|
114 |
-
/**
|
115 |
-
* Returns the roles of the page admin user.
|
116 |
-
*
|
117 |
-
* Only available in the `/me/accounts` context.
|
118 |
-
*
|
119 |
-
* @return array|null
|
120 |
-
*/
|
121 |
-
public function getPerms()
|
122 |
-
{
|
123 |
-
return $this->getField('perms');
|
124 |
-
}
|
125 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphPicture.php
DELETED
@@ -1,72 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\GraphNodes;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Class GraphPicture
|
28 |
-
*
|
29 |
-
* @package Facebook
|
30 |
-
*/
|
31 |
-
class GraphPicture extends GraphNode
|
32 |
-
{
|
33 |
-
/**
|
34 |
-
* Returns true if user picture is silhouette.
|
35 |
-
*
|
36 |
-
* @return bool|null
|
37 |
-
*/
|
38 |
-
public function isSilhouette()
|
39 |
-
{
|
40 |
-
return $this->getField('is_silhouette');
|
41 |
-
}
|
42 |
-
|
43 |
-
/**
|
44 |
-
* Returns the url of user picture if it exists
|
45 |
-
*
|
46 |
-
* @return string|null
|
47 |
-
*/
|
48 |
-
public function getUrl()
|
49 |
-
{
|
50 |
-
return $this->getField('url');
|
51 |
-
}
|
52 |
-
|
53 |
-
/**
|
54 |
-
* Returns the width of user picture if it exists
|
55 |
-
*
|
56 |
-
* @return int|null
|
57 |
-
*/
|
58 |
-
public function getWidth()
|
59 |
-
{
|
60 |
-
return $this->getField('width');
|
61 |
-
}
|
62 |
-
|
63 |
-
/**
|
64 |
-
* Returns the height of user picture if it exists
|
65 |
-
*
|
66 |
-
* @return int|null
|
67 |
-
*/
|
68 |
-
public function getHeight()
|
69 |
-
{
|
70 |
-
return $this->getField('height');
|
71 |
-
}
|
72 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphSessionInfo.php
DELETED
@@ -1,102 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\GraphNodes;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Class GraphSessionInfo
|
28 |
-
*
|
29 |
-
* @package Facebook
|
30 |
-
*/
|
31 |
-
class GraphSessionInfo extends GraphNode
|
32 |
-
{
|
33 |
-
/**
|
34 |
-
* Returns the application id the token was issued for.
|
35 |
-
*
|
36 |
-
* @return string|null
|
37 |
-
*/
|
38 |
-
public function getAppId()
|
39 |
-
{
|
40 |
-
return $this->getField('app_id');
|
41 |
-
}
|
42 |
-
|
43 |
-
/**
|
44 |
-
* Returns the application name the token was issued for.
|
45 |
-
*
|
46 |
-
* @return string|null
|
47 |
-
*/
|
48 |
-
public function getApplication()
|
49 |
-
{
|
50 |
-
return $this->getField('application');
|
51 |
-
}
|
52 |
-
|
53 |
-
/**
|
54 |
-
* Returns the date & time that the token expires.
|
55 |
-
*
|
56 |
-
* @return \DateTime|null
|
57 |
-
*/
|
58 |
-
public function getExpiresAt()
|
59 |
-
{
|
60 |
-
return $this->getField('expires_at');
|
61 |
-
}
|
62 |
-
|
63 |
-
/**
|
64 |
-
* Returns whether the token is valid.
|
65 |
-
*
|
66 |
-
* @return boolean
|
67 |
-
*/
|
68 |
-
public function getIsValid()
|
69 |
-
{
|
70 |
-
return $this->getField('is_valid');
|
71 |
-
}
|
72 |
-
|
73 |
-
/**
|
74 |
-
* Returns the date & time the token was issued at.
|
75 |
-
*
|
76 |
-
* @return \DateTime|null
|
77 |
-
*/
|
78 |
-
public function getIssuedAt()
|
79 |
-
{
|
80 |
-
return $this->getField('issued_at');
|
81 |
-
}
|
82 |
-
|
83 |
-
/**
|
84 |
-
* Returns the scope permissions associated with the token.
|
85 |
-
*
|
86 |
-
* @return array
|
87 |
-
*/
|
88 |
-
public function getScopes()
|
89 |
-
{
|
90 |
-
return $this->getField('scopes');
|
91 |
-
}
|
92 |
-
|
93 |
-
/**
|
94 |
-
* Returns the login id of the user associated with the token.
|
95 |
-
*
|
96 |
-
* @return string|null
|
97 |
-
*/
|
98 |
-
public function getUserId()
|
99 |
-
{
|
100 |
-
return $this->getField('user_id');
|
101 |
-
}
|
102 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphUser.php
DELETED
@@ -1,172 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\GraphNodes;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Class GraphUser
|
28 |
-
*
|
29 |
-
* @package Facebook
|
30 |
-
*/
|
31 |
-
class GraphUser extends GraphNode
|
32 |
-
{
|
33 |
-
/**
|
34 |
-
* @var array Maps object key names to Graph object types.
|
35 |
-
*/
|
36 |
-
protected static $graphObjectMap = [
|
37 |
-
'hometown' => '\Facebook\GraphNodes\GraphPage',
|
38 |
-
'location' => '\Facebook\GraphNodes\GraphPage',
|
39 |
-
'significant_other' => '\Facebook\GraphNodes\GraphUser',
|
40 |
-
'picture' => '\Facebook\GraphNodes\GraphPicture',
|
41 |
-
];
|
42 |
-
|
43 |
-
/**
|
44 |
-
* Returns the ID for the user as a string if present.
|
45 |
-
*
|
46 |
-
* @return string|null
|
47 |
-
*/
|
48 |
-
public function getId()
|
49 |
-
{
|
50 |
-
return $this->getField('id');
|
51 |
-
}
|
52 |
-
|
53 |
-
/**
|
54 |
-
* Returns the name for the user as a string if present.
|
55 |
-
*
|
56 |
-
* @return string|null
|
57 |
-
*/
|
58 |
-
public function getName()
|
59 |
-
{
|
60 |
-
return $this->getField('name');
|
61 |
-
}
|
62 |
-
|
63 |
-
/**
|
64 |
-
* Returns the first name for the user as a string if present.
|
65 |
-
*
|
66 |
-
* @return string|null
|
67 |
-
*/
|
68 |
-
public function getFirstName()
|
69 |
-
{
|
70 |
-
return $this->getField('first_name');
|
71 |
-
}
|
72 |
-
|
73 |
-
/**
|
74 |
-
* Returns the middle name for the user as a string if present.
|
75 |
-
*
|
76 |
-
* @return string|null
|
77 |
-
*/
|
78 |
-
public function getMiddleName()
|
79 |
-
{
|
80 |
-
return $this->getField('middle_name');
|
81 |
-
}
|
82 |
-
|
83 |
-
/**
|
84 |
-
* Returns the last name for the user as a string if present.
|
85 |
-
*
|
86 |
-
* @return string|null
|
87 |
-
*/
|
88 |
-
public function getLastName()
|
89 |
-
{
|
90 |
-
return $this->getField('last_name');
|
91 |
-
}
|
92 |
-
|
93 |
-
/**
|
94 |
-
* Returns the email for the user as a string if present.
|
95 |
-
*
|
96 |
-
* @return string|null
|
97 |
-
*/
|
98 |
-
public function getEmail()
|
99 |
-
{
|
100 |
-
return $this->getField('email');
|
101 |
-
}
|
102 |
-
|
103 |
-
/**
|
104 |
-
* Returns the gender for the user as a string if present.
|
105 |
-
*
|
106 |
-
* @return string|null
|
107 |
-
*/
|
108 |
-
public function getGender()
|
109 |
-
{
|
110 |
-
return $this->getField('gender');
|
111 |
-
}
|
112 |
-
|
113 |
-
/**
|
114 |
-
* Returns the Facebook URL for the user as a string if available.
|
115 |
-
*
|
116 |
-
* @return string|null
|
117 |
-
*/
|
118 |
-
public function getLink()
|
119 |
-
{
|
120 |
-
return $this->getField('link');
|
121 |
-
}
|
122 |
-
|
123 |
-
/**
|
124 |
-
* Returns the users birthday, if available.
|
125 |
-
*
|
126 |
-
* @return \DateTime|null
|
127 |
-
*/
|
128 |
-
public function getBirthday()
|
129 |
-
{
|
130 |
-
return $this->getField('birthday');
|
131 |
-
}
|
132 |
-
|
133 |
-
/**
|
134 |
-
* Returns the current location of the user as a GraphPage.
|
135 |
-
*
|
136 |
-
* @return GraphPage|null
|
137 |
-
*/
|
138 |
-
public function getLocation()
|
139 |
-
{
|
140 |
-
return $this->getField('location');
|
141 |
-
}
|
142 |
-
|
143 |
-
/**
|
144 |
-
* Returns the current location of the user as a GraphPage.
|
145 |
-
*
|
146 |
-
* @return GraphPage|null
|
147 |
-
*/
|
148 |
-
public function getHometown()
|
149 |
-
{
|
150 |
-
return $this->getField('hometown');
|
151 |
-
}
|
152 |
-
|
153 |
-
/**
|
154 |
-
* Returns the current location of the user as a GraphUser.
|
155 |
-
*
|
156 |
-
* @return GraphUser|null
|
157 |
-
*/
|
158 |
-
public function getSignificantOther()
|
159 |
-
{
|
160 |
-
return $this->getField('significant_other');
|
161 |
-
}
|
162 |
-
|
163 |
-
/**
|
164 |
-
* Returns the picture of the user as a GraphPicture
|
165 |
-
*
|
166 |
-
* @return GraphPicture|null
|
167 |
-
*/
|
168 |
-
public function getPicture()
|
169 |
-
{
|
170 |
-
return $this->getField('picture');
|
171 |
-
}
|
172 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/Helpers/FacebookCanvasHelper.php
DELETED
@@ -1,52 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\Helpers;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Class FacebookCanvasLoginHelper
|
28 |
-
*
|
29 |
-
* @package Facebook
|
30 |
-
*/
|
31 |
-
class FacebookCanvasHelper extends FacebookSignedRequestFromInputHelper
|
32 |
-
{
|
33 |
-
/**
|
34 |
-
* Returns the app data value.
|
35 |
-
*
|
36 |
-
* @return mixed|null
|
37 |
-
*/
|
38 |
-
public function getAppData()
|
39 |
-
{
|
40 |
-
return $this->signedRequest ? $this->signedRequest->get('app_data') : null;
|
41 |
-
}
|
42 |
-
|
43 |
-
/**
|
44 |
-
* Get raw signed request from POST.
|
45 |
-
*
|
46 |
-
* @return string|null
|
47 |
-
*/
|
48 |
-
public function getRawSignedRequest()
|
49 |
-
{
|
50 |
-
return $this->getRawSignedRequestFromPost() ?: null;
|
51 |
-
}
|
52 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/Helpers/FacebookJavaScriptHelper.php
DELETED
@@ -1,42 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\Helpers;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Class FacebookJavaScriptLoginHelper
|
28 |
-
*
|
29 |
-
* @package Facebook
|
30 |
-
*/
|
31 |
-
class FacebookJavaScriptHelper extends FacebookSignedRequestFromInputHelper
|
32 |
-
{
|
33 |
-
/**
|
34 |
-
* Get raw signed request from the cookie.
|
35 |
-
*
|
36 |
-
* @return string|null
|
37 |
-
*/
|
38 |
-
public function getRawSignedRequest()
|
39 |
-
{
|
40 |
-
return $this->getRawSignedRequestFromCookie();
|
41 |
-
}
|
42 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/Helpers/FacebookPageTabHelper.php
DELETED
@@ -1,95 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\Helpers;
|
25 |
-
|
26 |
-
use Facebook\FacebookApp;
|
27 |
-
use Facebook\FacebookClient;
|
28 |
-
|
29 |
-
/**
|
30 |
-
* Class FacebookPageTabHelper
|
31 |
-
*
|
32 |
-
* @package Facebook
|
33 |
-
*/
|
34 |
-
class FacebookPageTabHelper extends FacebookCanvasHelper
|
35 |
-
{
|
36 |
-
/**
|
37 |
-
* @var array|null
|
38 |
-
*/
|
39 |
-
protected $pageData;
|
40 |
-
|
41 |
-
/**
|
42 |
-
* Initialize the helper and process available signed request data.
|
43 |
-
*
|
44 |
-
* @param FacebookApp $app The FacebookApp entity.
|
45 |
-
* @param FacebookClient $client The client to make HTTP requests.
|
46 |
-
* @param string|null $graphVersion The version of Graph to use.
|
47 |
-
*/
|
48 |
-
public function __construct(FacebookApp $app, FacebookClient $client, $graphVersion = null)
|
49 |
-
{
|
50 |
-
parent::__construct($app, $client, $graphVersion);
|
51 |
-
|
52 |
-
if (!$this->signedRequest) {
|
53 |
-
return;
|
54 |
-
}
|
55 |
-
|
56 |
-
$this->pageData = $this->signedRequest->get('page');
|
57 |
-
}
|
58 |
-
|
59 |
-
/**
|
60 |
-
* Returns a value from the page data.
|
61 |
-
*
|
62 |
-
* @param string $key
|
63 |
-
* @param mixed|null $default
|
64 |
-
*
|
65 |
-
* @return mixed|null
|
66 |
-
*/
|
67 |
-
public function getPageData($key, $default = null)
|
68 |
-
{
|
69 |
-
if (isset($this->pageData[$key])) {
|
70 |
-
return $this->pageData[$key];
|
71 |
-
}
|
72 |
-
|
73 |
-
return $default;
|
74 |
-
}
|
75 |
-
|
76 |
-
/**
|
77 |
-
* Returns true if the user is an admin.
|
78 |
-
*
|
79 |
-
* @return boolean
|
80 |
-
*/
|
81 |
-
public function isAdmin()
|
82 |
-
{
|
83 |
-
return $this->getPageData('admin') === true;
|
84 |
-
}
|
85 |
-
|
86 |
-
/**
|
87 |
-
* Returns the page id if available.
|
88 |
-
*
|
89 |
-
* @return string|null
|
90 |
-
*/
|
91 |
-
public function getPageId()
|
92 |
-
{
|
93 |
-
return $this->getPageData('id');
|
94 |
-
}
|
95 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/Helpers/FacebookRedirectLoginHelper.php
DELETED
@@ -1,333 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\Helpers;
|
25 |
-
|
26 |
-
use Facebook\Authentication\AccessToken;
|
27 |
-
use Facebook\Authentication\OAuth2Client;
|
28 |
-
use Facebook\Exceptions\FacebookSDKException;
|
29 |
-
use Facebook\PersistentData\FacebookSessionPersistentDataHandler;
|
30 |
-
use Facebook\PersistentData\PersistentDataInterface;
|
31 |
-
use Facebook\PseudoRandomString\PseudoRandomStringGeneratorFactory;
|
32 |
-
use Facebook\PseudoRandomString\PseudoRandomStringGeneratorInterface;
|
33 |
-
use Facebook\Url\FacebookUrlDetectionHandler;
|
34 |
-
use Facebook\Url\FacebookUrlManipulator;
|
35 |
-
use Facebook\Url\UrlDetectionInterface;
|
36 |
-
|
37 |
-
/**
|
38 |
-
* Class FacebookRedirectLoginHelper
|
39 |
-
*
|
40 |
-
* @package Facebook
|
41 |
-
*/
|
42 |
-
class FacebookRedirectLoginHelper
|
43 |
-
{
|
44 |
-
/**
|
45 |
-
* @const int The length of CSRF string to validate the login link.
|
46 |
-
*/
|
47 |
-
const CSRF_LENGTH = 32;
|
48 |
-
|
49 |
-
/**
|
50 |
-
* @var OAuth2Client The OAuth 2.0 client service.
|
51 |
-
*/
|
52 |
-
protected $oAuth2Client;
|
53 |
-
|
54 |
-
/**
|
55 |
-
* @var UrlDetectionInterface The URL detection handler.
|
56 |
-
*/
|
57 |
-
protected $urlDetectionHandler;
|
58 |
-
|
59 |
-
/**
|
60 |
-
* @var PersistentDataInterface The persistent data handler.
|
61 |
-
*/
|
62 |
-
protected $persistentDataHandler;
|
63 |
-
|
64 |
-
/**
|
65 |
-
* @var PseudoRandomStringGeneratorInterface The cryptographically secure pseudo-random string generator.
|
66 |
-
*/
|
67 |
-
protected $pseudoRandomStringGenerator;
|
68 |
-
|
69 |
-
/**
|
70 |
-
* @param OAuth2Client $oAuth2Client The OAuth 2.0 client service.
|
71 |
-
* @param PersistentDataInterface|null $persistentDataHandler The persistent data handler.
|
72 |
-
* @param UrlDetectionInterface|null $urlHandler The URL detection handler.
|
73 |
-
* @param PseudoRandomStringGeneratorInterface|null $prsg The cryptographically secure pseudo-random string generator.
|
74 |
-
*/
|
75 |
-
public function __construct(OAuth2Client $oAuth2Client, PersistentDataInterface $persistentDataHandler = null, UrlDetectionInterface $urlHandler = null, PseudoRandomStringGeneratorInterface $prsg = null)
|
76 |
-
{
|
77 |
-
$this->oAuth2Client = $oAuth2Client;
|
78 |
-
$this->persistentDataHandler = $persistentDataHandler ?: new FacebookSessionPersistentDataHandler();
|
79 |
-
$this->urlDetectionHandler = $urlHandler ?: new FacebookUrlDetectionHandler();
|
80 |
-
$this->pseudoRandomStringGenerator = PseudoRandomStringGeneratorFactory::createPseudoRandomStringGenerator($prsg);
|
81 |
-
}
|
82 |
-
|
83 |
-
/**
|
84 |
-
* Returns the persistent data handler.
|
85 |
-
*
|
86 |
-
* @return PersistentDataInterface
|
87 |
-
*/
|
88 |
-
public function getPersistentDataHandler()
|
89 |
-
{
|
90 |
-
return $this->persistentDataHandler;
|
91 |
-
}
|
92 |
-
|
93 |
-
/**
|
94 |
-
* Returns the URL detection handler.
|
95 |
-
*
|
96 |
-
* @return UrlDetectionInterface
|
97 |
-
*/
|
98 |
-
public function getUrlDetectionHandler()
|
99 |
-
{
|
100 |
-
return $this->urlDetectionHandler;
|
101 |
-
}
|
102 |
-
|
103 |
-
/**
|
104 |
-
* Returns the cryptographically secure pseudo-random string generator.
|
105 |
-
*
|
106 |
-
* @return PseudoRandomStringGeneratorInterface
|
107 |
-
*/
|
108 |
-
public function getPseudoRandomStringGenerator()
|
109 |
-
{
|
110 |
-
return $this->pseudoRandomStringGenerator;
|
111 |
-
}
|
112 |
-
|
113 |
-
/**
|
114 |
-
* Stores CSRF state and returns a URL to which the user should be sent to in order to continue the login process with Facebook.
|
115 |
-
*
|
116 |
-
* @param string $redirectUrl The URL Facebook should redirect users to after login.
|
117 |
-
* @param array $scope List of permissions to request during login.
|
118 |
-
* @param array $params An array of parameters to generate URL.
|
119 |
-
* @param string $separator The separator to use in http_build_query().
|
120 |
-
*
|
121 |
-
* @return string
|
122 |
-
*/
|
123 |
-
private function makeUrl($redirectUrl, array $scope, array $params = [], $separator = '&')
|
124 |
-
{
|
125 |
-
$state = $this->persistentDataHandler->get('state') ?: $this->pseudoRandomStringGenerator->getPseudoRandomString(static::CSRF_LENGTH);
|
126 |
-
$this->persistentDataHandler->set('state', $state);
|
127 |
-
|
128 |
-
return $this->oAuth2Client->getAuthorizationUrl($redirectUrl, $state, $scope, $params, $separator);
|
129 |
-
}
|
130 |
-
|
131 |
-
/**
|
132 |
-
* Returns the URL to send the user in order to login to Facebook.
|
133 |
-
*
|
134 |
-
* @param string $redirectUrl The URL Facebook should redirect users to after login.
|
135 |
-
* @param array $scope List of permissions to request during login.
|
136 |
-
* @param string $separator The separator to use in http_build_query().
|
137 |
-
*
|
138 |
-
* @return string
|
139 |
-
*/
|
140 |
-
public function getLoginUrl($redirectUrl, array $scope = [], $separator = '&')
|
141 |
-
{
|
142 |
-
return $this->makeUrl($redirectUrl, $scope, [], $separator);
|
143 |
-
}
|
144 |
-
|
145 |
-
/**
|
146 |
-
* Returns the URL to send the user in order to log out of Facebook.
|
147 |
-
*
|
148 |
-
* @param AccessToken|string $accessToken The access token that will be logged out.
|
149 |
-
* @param string $next The url Facebook should redirect the user to after a successful logout.
|
150 |
-
* @param string $separator The separator to use in http_build_query().
|
151 |
-
*
|
152 |
-
* @return string
|
153 |
-
*
|
154 |
-
* @throws FacebookSDKException
|
155 |
-
*/
|
156 |
-
public function getLogoutUrl($accessToken, $next, $separator = '&')
|
157 |
-
{
|
158 |
-
if (!$accessToken instanceof AccessToken) {
|
159 |
-
$accessToken = new AccessToken($accessToken);
|
160 |
-
}
|
161 |
-
|
162 |
-
if ($accessToken->isAppAccessToken()) {
|
163 |
-
throw new FacebookSDKException('Cannot generate a logout URL with an app access token.', 722);
|
164 |
-
}
|
165 |
-
|
166 |
-
$params = [
|
167 |
-
'next' => $next,
|
168 |
-
'access_token' => $accessToken->getValue(),
|
169 |
-
];
|
170 |
-
|
171 |
-
return 'https://www.facebook.com/logout.php?' . http_build_query($params, null, $separator);
|
172 |
-
}
|
173 |
-
|
174 |
-
/**
|
175 |
-
* Returns the URL to send the user in order to login to Facebook with permission(s) to be re-asked.
|
176 |
-
*
|
177 |
-
* @param string $redirectUrl The URL Facebook should redirect users to after login.
|
178 |
-
* @param array $scope List of permissions to request during login.
|
179 |
-
* @param string $separator The separator to use in http_build_query().
|
180 |
-
*
|
181 |
-
* @return string
|
182 |
-
*/
|
183 |
-
public function getReRequestUrl($redirectUrl, array $scope = [], $separator = '&')
|
184 |
-
{
|
185 |
-
$params = ['auth_type' => 'rerequest'];
|
186 |
-
|
187 |
-
return $this->makeUrl($redirectUrl, $scope, $params, $separator);
|
188 |
-
}
|
189 |
-
|
190 |
-
/**
|
191 |
-
* Returns the URL to send the user in order to login to Facebook with user to be re-authenticated.
|
192 |
-
*
|
193 |
-
* @param string $redirectUrl The URL Facebook should redirect users to after login.
|
194 |
-
* @param array $scope List of permissions to request during login.
|
195 |
-
* @param string $separator The separator to use in http_build_query().
|
196 |
-
*
|
197 |
-
* @return string
|
198 |
-
*/
|
199 |
-
public function getReAuthenticationUrl($redirectUrl, array $scope = [], $separator = '&')
|
200 |
-
{
|
201 |
-
$params = ['auth_type' => 'reauthenticate'];
|
202 |
-
|
203 |
-
return $this->makeUrl($redirectUrl, $scope, $params, $separator);
|
204 |
-
}
|
205 |
-
|
206 |
-
/**
|
207 |
-
* Takes a valid code from a login redirect, and returns an AccessToken entity.
|
208 |
-
*
|
209 |
-
* @param string|null $redirectUrl The redirect URL.
|
210 |
-
*
|
211 |
-
* @return AccessToken|null
|
212 |
-
*
|
213 |
-
* @throws FacebookSDKException
|
214 |
-
*/
|
215 |
-
public function getAccessToken($redirectUrl = null)
|
216 |
-
{
|
217 |
-
if (!$code = $this->getCode()) {
|
218 |
-
return null;
|
219 |
-
}
|
220 |
-
|
221 |
-
$this->validateCsrf();
|
222 |
-
$this->resetCsrf();
|
223 |
-
|
224 |
-
$redirectUrl = $redirectUrl ?: $this->urlDetectionHandler->getCurrentUrl();
|
225 |
-
// At minimum we need to remove the state param
|
226 |
-
$redirectUrl = FacebookUrlManipulator::removeParamsFromUrl($redirectUrl, ['state']);
|
227 |
-
|
228 |
-
return $this->oAuth2Client->getAccessTokenFromCode($code, $redirectUrl);
|
229 |
-
}
|
230 |
-
|
231 |
-
/**
|
232 |
-
* Validate the request against a cross-site request forgery.
|
233 |
-
*
|
234 |
-
* @throws FacebookSDKException
|
235 |
-
*/
|
236 |
-
protected function validateCsrf()
|
237 |
-
{
|
238 |
-
$state = $this->getState();
|
239 |
-
if (!$state) {
|
240 |
-
throw new FacebookSDKException('Cross-site request forgery validation failed. Required GET param "state" missing.');
|
241 |
-
}
|
242 |
-
$savedState = $this->persistentDataHandler->get('state');
|
243 |
-
if (!$savedState) {
|
244 |
-
throw new FacebookSDKException('Cross-site request forgery validation failed. Required param "state" missing from persistent data.');
|
245 |
-
}
|
246 |
-
|
247 |
-
if (\hash_equals($savedState, $state)) {
|
248 |
-
return;
|
249 |
-
}
|
250 |
-
|
251 |
-
throw new FacebookSDKException('Cross-site request forgery validation failed. The "state" param from the URL and session do not match.');
|
252 |
-
}
|
253 |
-
|
254 |
-
/**
|
255 |
-
* Resets the CSRF so that it doesn't get reused.
|
256 |
-
*/
|
257 |
-
private function resetCsrf()
|
258 |
-
{
|
259 |
-
$this->persistentDataHandler->set('state', null);
|
260 |
-
}
|
261 |
-
|
262 |
-
/**
|
263 |
-
* Return the code.
|
264 |
-
*
|
265 |
-
* @return string|null
|
266 |
-
*/
|
267 |
-
protected function getCode()
|
268 |
-
{
|
269 |
-
return $this->getInput('code');
|
270 |
-
}
|
271 |
-
|
272 |
-
/**
|
273 |
-
* Return the state.
|
274 |
-
*
|
275 |
-
* @return string|null
|
276 |
-
*/
|
277 |
-
protected function getState()
|
278 |
-
{
|
279 |
-
return $this->getInput('state');
|
280 |
-
}
|
281 |
-
|
282 |
-
/**
|
283 |
-
* Return the error code.
|
284 |
-
*
|
285 |
-
* @return string|null
|
286 |
-
*/
|
287 |
-
public function getErrorCode()
|
288 |
-
{
|
289 |
-
return $this->getInput('error_code');
|
290 |
-
}
|
291 |
-
|
292 |
-
/**
|
293 |
-
* Returns the error.
|
294 |
-
*
|
295 |
-
* @return string|null
|
296 |
-
*/
|
297 |
-
public function getError()
|
298 |
-
{
|
299 |
-
return $this->getInput('error');
|
300 |
-
}
|
301 |
-
|
302 |
-
/**
|
303 |
-
* Returns the error reason.
|
304 |
-
*
|
305 |
-
* @return string|null
|
306 |
-
*/
|
307 |
-
public function getErrorReason()
|
308 |
-
{
|
309 |
-
return $this->getInput('error_reason');
|
310 |
-
}
|
311 |
-
|
312 |
-
/**
|
313 |
-
* Returns the error description.
|
314 |
-
*
|
315 |
-
* @return string|null
|
316 |
-
*/
|
317 |
-
public function getErrorDescription()
|
318 |
-
{
|
319 |
-
return $this->getInput('error_description');
|
320 |
-
}
|
321 |
-
|
322 |
-
/**
|
323 |
-
* Returns a value from a GET param.
|
324 |
-
*
|
325 |
-
* @param string $key
|
326 |
-
*
|
327 |
-
* @return string|null
|
328 |
-
*/
|
329 |
-
private function getInput($key)
|
330 |
-
{
|
331 |
-
return isset($_GET[$key]) ? $_GET[$key] : null;
|
332 |
-
}
|
333 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/Helpers/FacebookSignedRequestFromInputHelper.php
DELETED
@@ -1,166 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\Helpers;
|
25 |
-
|
26 |
-
use Facebook\Facebook;
|
27 |
-
use Facebook\FacebookApp;
|
28 |
-
use Facebook\FacebookClient;
|
29 |
-
use Facebook\SignedRequest;
|
30 |
-
use Facebook\Authentication\AccessToken;
|
31 |
-
use Facebook\Authentication\OAuth2Client;
|
32 |
-
|
33 |
-
/**
|
34 |
-
* Class FacebookSignedRequestFromInputHelper
|
35 |
-
*
|
36 |
-
* @package Facebook
|
37 |
-
*/
|
38 |
-
abstract class FacebookSignedRequestFromInputHelper
|
39 |
-
{
|
40 |
-
/**
|
41 |
-
* @var SignedRequest|null The SignedRequest entity.
|
42 |
-
*/
|
43 |
-
protected $signedRequest;
|
44 |
-
|
45 |
-
/**
|
46 |
-
* @var FacebookApp The FacebookApp entity.
|
47 |
-
*/
|
48 |
-
protected $app;
|
49 |
-
|
50 |
-
/**
|
51 |
-
* @var OAuth2Client The OAuth 2.0 client service.
|
52 |
-
*/
|
53 |
-
protected $oAuth2Client;
|
54 |
-
|
55 |
-
/**
|
56 |
-
* Initialize the helper and process available signed request data.
|
57 |
-
*
|
58 |
-
* @param FacebookApp $app The FacebookApp entity.
|
59 |
-
* @param FacebookClient $client The client to make HTTP requests.
|
60 |
-
* @param string|null $graphVersion The version of Graph to use.
|
61 |
-
*/
|
62 |
-
public function __construct(FacebookApp $app, FacebookClient $client, $graphVersion = null)
|
63 |
-
{
|
64 |
-
$this->app = $app;
|
65 |
-
$graphVersion = $graphVersion ?: Facebook::DEFAULT_GRAPH_VERSION;
|
66 |
-
$this->oAuth2Client = new OAuth2Client($this->app, $client, $graphVersion);
|
67 |
-
|
68 |
-
$this->instantiateSignedRequest();
|
69 |
-
}
|
70 |
-
|
71 |
-
/**
|
72 |
-
* Instantiates a new SignedRequest entity.
|
73 |
-
*
|
74 |
-
* @param string|null
|
75 |
-
*/
|
76 |
-
public function instantiateSignedRequest($rawSignedRequest = null)
|
77 |
-
{
|
78 |
-
$rawSignedRequest = $rawSignedRequest ?: $this->getRawSignedRequest();
|
79 |
-
|
80 |
-
if (!$rawSignedRequest) {
|
81 |
-
return;
|
82 |
-
}
|
83 |
-
|
84 |
-
$this->signedRequest = new SignedRequest($this->app, $rawSignedRequest);
|
85 |
-
}
|
86 |
-
|
87 |
-
/**
|
88 |
-
* Returns an AccessToken entity from the signed request.
|
89 |
-
*
|
90 |
-
* @return AccessToken|null
|
91 |
-
*
|
92 |
-
* @throws \Facebook\Exceptions\FacebookSDKException
|
93 |
-
*/
|
94 |
-
public function getAccessToken()
|
95 |
-
{
|
96 |
-
if ($this->signedRequest && $this->signedRequest->hasOAuthData()) {
|
97 |
-
$code = $this->signedRequest->get('code');
|
98 |
-
$accessToken = $this->signedRequest->get('oauth_token');
|
99 |
-
|
100 |
-
if ($code && !$accessToken) {
|
101 |
-
return $this->oAuth2Client->getAccessTokenFromCode($code);
|
102 |
-
}
|
103 |
-
|
104 |
-
$expiresAt = $this->signedRequest->get('expires', 0);
|
105 |
-
|
106 |
-
return new AccessToken($accessToken, $expiresAt);
|
107 |
-
}
|
108 |
-
|
109 |
-
return null;
|
110 |
-
}
|
111 |
-
|
112 |
-
/**
|
113 |
-
* Returns the SignedRequest entity.
|
114 |
-
*
|
115 |
-
* @return SignedRequest|null
|
116 |
-
*/
|
117 |
-
public function getSignedRequest()
|
118 |
-
{
|
119 |
-
return $this->signedRequest;
|
120 |
-
}
|
121 |
-
|
122 |
-
/**
|
123 |
-
* Returns the user_id if available.
|
124 |
-
*
|
125 |
-
* @return string|null
|
126 |
-
*/
|
127 |
-
public function getUserId()
|
128 |
-
{
|
129 |
-
return $this->signedRequest ? $this->signedRequest->getUserId() : null;
|
130 |
-
}
|
131 |
-
|
132 |
-
/**
|
133 |
-
* Get raw signed request from input.
|
134 |
-
*
|
135 |
-
* @return string|null
|
136 |
-
*/
|
137 |
-
abstract public function getRawSignedRequest();
|
138 |
-
|
139 |
-
/**
|
140 |
-
* Get raw signed request from POST input.
|
141 |
-
*
|
142 |
-
* @return string|null
|
143 |
-
*/
|
144 |
-
public function getRawSignedRequestFromPost()
|
145 |
-
{
|
146 |
-
if (isset($_POST['signed_request'])) {
|
147 |
-
return $_POST['signed_request'];
|
148 |
-
}
|
149 |
-
|
150 |
-
return null;
|
151 |
-
}
|
152 |
-
|
153 |
-
/**
|
154 |
-
* Get raw signed request from cookie set from the Javascript SDK.
|
155 |
-
*
|
156 |
-
* @return string|null
|
157 |
-
*/
|
158 |
-
public function getRawSignedRequestFromCookie()
|
159 |
-
{
|
160 |
-
if (isset($_COOKIE['fbsr_' . $this->app->getId()])) {
|
161 |
-
return $_COOKIE['fbsr_' . $this->app->getId()];
|
162 |
-
}
|
163 |
-
|
164 |
-
return null;
|
165 |
-
}
|
166 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/Http/GraphRawResponse.php
DELETED
@@ -1,137 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\Http;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Class GraphRawResponse
|
28 |
-
*
|
29 |
-
* @package Facebook
|
30 |
-
*/
|
31 |
-
class GraphRawResponse
|
32 |
-
{
|
33 |
-
/**
|
34 |
-
* @var array The response headers in the form of an associative array.
|
35 |
-
*/
|
36 |
-
protected $headers;
|
37 |
-
|
38 |
-
/**
|
39 |
-
* @var string The raw response body.
|
40 |
-
*/
|
41 |
-
protected $body;
|
42 |
-
|
43 |
-
/**
|
44 |
-
* @var int The HTTP status response code.
|
45 |
-
*/
|
46 |
-
protected $httpResponseCode;
|
47 |
-
|
48 |
-
/**
|
49 |
-
* Creates a new GraphRawResponse entity.
|
50 |
-
*
|
51 |
-
* @param string|array $headers The headers as a raw string or array.
|
52 |
-
* @param string $body The raw response body.
|
53 |
-
* @param int $httpStatusCode The HTTP response code (if sending headers as parsed array).
|
54 |
-
*/
|
55 |
-
public function __construct($headers, $body, $httpStatusCode = null)
|
56 |
-
{
|
57 |
-
if (is_numeric($httpStatusCode)) {
|
58 |
-
$this->httpResponseCode = (int)$httpStatusCode;
|
59 |
-
}
|
60 |
-
|
61 |
-
if (is_array($headers)) {
|
62 |
-
$this->headers = $headers;
|
63 |
-
} else {
|
64 |
-
$this->setHeadersFromString($headers);
|
65 |
-
}
|
66 |
-
|
67 |
-
$this->body = $body;
|
68 |
-
}
|
69 |
-
|
70 |
-
/**
|
71 |
-
* Return the response headers.
|
72 |
-
*
|
73 |
-
* @return array
|
74 |
-
*/
|
75 |
-
public function getHeaders()
|
76 |
-
{
|
77 |
-
return $this->headers;
|
78 |
-
}
|
79 |
-
|
80 |
-
/**
|
81 |
-
* Return the body of the response.
|
82 |
-
*
|
83 |
-
* @return string
|
84 |
-
*/
|
85 |
-
public function getBody()
|
86 |
-
{
|
87 |
-
return $this->body;
|
88 |
-
}
|
89 |
-
|
90 |
-
/**
|
91 |
-
* Return the HTTP response code.
|
92 |
-
*
|
93 |
-
* @return int
|
94 |
-
*/
|
95 |
-
public function getHttpResponseCode()
|
96 |
-
{
|
97 |
-
return $this->httpResponseCode;
|
98 |
-
}
|
99 |
-
|
100 |
-
/**
|
101 |
-
* Sets the HTTP response code from a raw header.
|
102 |
-
*
|
103 |
-
* @param string $rawResponseHeader
|
104 |
-
*/
|
105 |
-
public function setHttpResponseCodeFromHeader($rawResponseHeader)
|
106 |
-
{
|
107 |
-
preg_match('|HTTP/\d\.\d\s+(\d+)\s+.*|', $rawResponseHeader, $match);
|
108 |
-
$this->httpResponseCode = (int)$match[1];
|
109 |
-
}
|
110 |
-
|
111 |
-
/**
|
112 |
-
* Parse the raw headers and set as an array.
|
113 |
-
*
|
114 |
-
* @param string $rawHeaders The raw headers from the response.
|
115 |
-
*/
|
116 |
-
protected function setHeadersFromString($rawHeaders)
|
117 |
-
{
|
118 |
-
// Normalize line breaks
|
119 |
-
$rawHeaders = str_replace("\r\n", "\n", $rawHeaders);
|
120 |
-
|
121 |
-
// There will be multiple headers if a 301 was followed
|
122 |
-
// or a proxy was followed, etc
|
123 |
-
$headerCollection = explode("\n\n", trim($rawHeaders));
|
124 |
-
// We just want the last response (at the end)
|
125 |
-
$rawHeader = array_pop($headerCollection);
|
126 |
-
|
127 |
-
$headerComponents = explode("\n", $rawHeader);
|
128 |
-
foreach ($headerComponents as $line) {
|
129 |
-
if (strpos($line, ': ') === false) {
|
130 |
-
$this->setHttpResponseCodeFromHeader($line);
|
131 |
-
} else {
|
132 |
-
list($key, $value) = explode(': ', $line);
|
133 |
-
$this->headers[$key] = $value;
|
134 |
-
}
|
135 |
-
}
|
136 |
-
}
|
137 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/Http/RequestBodyInterface.php
DELETED
@@ -1,39 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\Http;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Interface
|
28 |
-
*
|
29 |
-
* @package Facebook
|
30 |
-
*/
|
31 |
-
interface RequestBodyInterface
|
32 |
-
{
|
33 |
-
/**
|
34 |
-
* Get the body of the request to send to Graph.
|
35 |
-
*
|
36 |
-
* @return string
|
37 |
-
*/
|
38 |
-
public function getBody();
|
39 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/Http/RequestBodyMultipart.php
DELETED
@@ -1,170 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\Http;
|
25 |
-
|
26 |
-
use Facebook\FileUpload\FacebookFile;
|
27 |
-
|
28 |
-
/**
|
29 |
-
* Class RequestBodyMultipartt
|
30 |
-
*
|
31 |
-
* Some things copied from Guzzle
|
32 |
-
*
|
33 |
-
* @package Facebook
|
34 |
-
*
|
35 |
-
* @see https://github.com/guzzle/guzzle/blob/master/src/Post/MultipartBody.php
|
36 |
-
*/
|
37 |
-
class RequestBodyMultipart implements RequestBodyInterface
|
38 |
-
{
|
39 |
-
/**
|
40 |
-
* @var string The boundary.
|
41 |
-
*/
|
42 |
-
private $boundary;
|
43 |
-
|
44 |
-
/**
|
45 |
-
* @var array The parameters to send with this request.
|
46 |
-
*/
|
47 |
-
private $params;
|
48 |
-
|
49 |
-
/**
|
50 |
-
* @var array The files to send with this request.
|
51 |
-
*/
|
52 |
-
private $files = [];
|
53 |
-
|
54 |
-
/**
|
55 |
-
* @param array $params The parameters to send with this request.
|
56 |
-
* @param array $files The files to send with this request.
|
57 |
-
* @param string $boundary Provide a specific boundary.
|
58 |
-
*/
|
59 |
-
public function __construct(array $params = [], array $files = [], $boundary = null)
|
60 |
-
{
|
61 |
-
$this->params = $params;
|
62 |
-
$this->files = $files;
|
63 |
-
$this->boundary = $boundary ?: uniqid();
|
64 |
-
}
|
65 |
-
|
66 |
-
/**
|
67 |
-
* @inheritdoc
|
68 |
-
*/
|
69 |
-
public function getBody()
|
70 |
-
{
|
71 |
-
$body = '';
|
72 |
-
|
73 |
-
// Compile normal params
|
74 |
-
$params = $this->getNestedParams($this->params);
|
75 |
-
foreach ($params as $k => $v) {
|
76 |
-
$body .= $this->getParamString($k, $v);
|
77 |
-
}
|
78 |
-
|
79 |
-
// Compile files
|
80 |
-
foreach ($this->files as $k => $v) {
|
81 |
-
$body .= $this->getFileString($k, $v);
|
82 |
-
}
|
83 |
-
|
84 |
-
// Peace out
|
85 |
-
$body .= "--{$this->boundary}--\r\n";
|
86 |
-
|
87 |
-
return $body;
|
88 |
-
}
|
89 |
-
|
90 |
-
/**
|
91 |
-
* Get the boundary
|
92 |
-
*
|
93 |
-
* @return string
|
94 |
-
*/
|
95 |
-
public function getBoundary()
|
96 |
-
{
|
97 |
-
return $this->boundary;
|
98 |
-
}
|
99 |
-
|
100 |
-
/**
|
101 |
-
* Get the string needed to transfer a file.
|
102 |
-
*
|
103 |
-
* @param string $name
|
104 |
-
* @param FacebookFile $file
|
105 |
-
*
|
106 |
-
* @return string
|
107 |
-
*/
|
108 |
-
private function getFileString($name, FacebookFile $file)
|
109 |
-
{
|
110 |
-
return sprintf(
|
111 |
-
"--%s\r\nContent-Disposition: form-data; name=\"%s\"; filename=\"%s\"%s\r\n\r\n%s\r\n",
|
112 |
-
$this->boundary,
|
113 |
-
$name,
|
114 |
-
$file->getFileName(),
|
115 |
-
$this->getFileHeaders($file),
|
116 |
-
$file->getContents()
|
117 |
-
);
|
118 |
-
}
|
119 |
-
|
120 |
-
/**
|
121 |
-
* Get the string needed to transfer a POST field.
|
122 |
-
*
|
123 |
-
* @param string $name
|
124 |
-
* @param string $value
|
125 |
-
*
|
126 |
-
* @return string
|
127 |
-
*/
|
128 |
-
private function getParamString($name, $value)
|
129 |
-
{
|
130 |
-
return sprintf(
|
131 |
-
"--%s\r\nContent-Disposition: form-data; name=\"%s\"\r\n\r\n%s\r\n",
|
132 |
-
$this->boundary,
|
133 |
-
$name,
|
134 |
-
$value
|
135 |
-
);
|
136 |
-
}
|
137 |
-
|
138 |
-
/**
|
139 |
-
* Returns the params as an array of nested params.
|
140 |
-
*
|
141 |
-
* @param array $params
|
142 |
-
*
|
143 |
-
* @return array
|
144 |
-
*/
|
145 |
-
private function getNestedParams(array $params)
|
146 |
-
{
|
147 |
-
$query = http_build_query($params, null, '&');
|
148 |
-
$params = explode('&', $query);
|
149 |
-
$result = [];
|
150 |
-
|
151 |
-
foreach ($params as $param) {
|
152 |
-
list($key, $value) = explode('=', $param, 2);
|
153 |
-
$result[urldecode($key)] = urldecode($value);
|
154 |
-
}
|
155 |
-
|
156 |
-
return $result;
|
157 |
-
}
|
158 |
-
|
159 |
-
/**
|
160 |
-
* Get the headers needed before transferring the content of a POST file.
|
161 |
-
*
|
162 |
-
* @param FacebookFile $file
|
163 |
-
*
|
164 |
-
* @return string
|
165 |
-
*/
|
166 |
-
protected function getFileHeaders(FacebookFile $file)
|
167 |
-
{
|
168 |
-
return "\r\nContent-Type: {$file->getMimetype()}";
|
169 |
-
}
|
170 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/Http/RequestBodyUrlEncoded.php
DELETED
@@ -1,55 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\Http;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Class RequestBodyUrlEncoded
|
28 |
-
*
|
29 |
-
* @package Facebook
|
30 |
-
*/
|
31 |
-
class RequestBodyUrlEncoded implements RequestBodyInterface
|
32 |
-
{
|
33 |
-
/**
|
34 |
-
* @var array The parameters to send with this request.
|
35 |
-
*/
|
36 |
-
protected $params = [];
|
37 |
-
|
38 |
-
/**
|
39 |
-
* Creates a new GraphUrlEncodedBody entity.
|
40 |
-
*
|
41 |
-
* @param array $params
|
42 |
-
*/
|
43 |
-
public function __construct(array $params)
|
44 |
-
{
|
45 |
-
$this->params = $params;
|
46 |
-
}
|
47 |
-
|
48 |
-
/**
|
49 |
-
* @inheritdoc
|
50 |
-
*/
|
51 |
-
public function getBody()
|
52 |
-
{
|
53 |
-
return http_build_query($this->params, null, '&');
|
54 |
-
}
|
55 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/HttpClients/FacebookCurl.php
DELETED
@@ -1,129 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\HttpClients;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Class FacebookCurl
|
28 |
-
*
|
29 |
-
* Abstraction for the procedural curl elements so that curl can be mocked and the implementation can be tested.
|
30 |
-
*
|
31 |
-
* @package Facebook
|
32 |
-
*/
|
33 |
-
class FacebookCurl
|
34 |
-
{
|
35 |
-
|
36 |
-
/**
|
37 |
-
* @var resource Curl resource instance
|
38 |
-
*/
|
39 |
-
protected $curl;
|
40 |
-
|
41 |
-
/**
|
42 |
-
* Make a new curl reference instance
|
43 |
-
*/
|
44 |
-
public function init()
|
45 |
-
{
|
46 |
-
$this->curl = curl_init();
|
47 |
-
}
|
48 |
-
|
49 |
-
/**
|
50 |
-
* Set a curl option
|
51 |
-
*
|
52 |
-
* @param $key
|
53 |
-
* @param $value
|
54 |
-
*/
|
55 |
-
public function setopt($key, $value)
|
56 |
-
{
|
57 |
-
curl_setopt($this->curl, $key, $value);
|
58 |
-
}
|
59 |
-
|
60 |
-
/**
|
61 |
-
* Set an array of options to a curl resource
|
62 |
-
*
|
63 |
-
* @param array $options
|
64 |
-
*/
|
65 |
-
public function setoptArray(array $options)
|
66 |
-
{
|
67 |
-
curl_setopt_array($this->curl, $options);
|
68 |
-
}
|
69 |
-
|
70 |
-
/**
|
71 |
-
* Send a curl request
|
72 |
-
*
|
73 |
-
* @return mixed
|
74 |
-
*/
|
75 |
-
public function exec()
|
76 |
-
{
|
77 |
-
return curl_exec($this->curl);
|
78 |
-
}
|
79 |
-
|
80 |
-
/**
|
81 |
-
* Return the curl error number
|
82 |
-
*
|
83 |
-
* @return int
|
84 |
-
*/
|
85 |
-
public function errno()
|
86 |
-
{
|
87 |
-
return curl_errno($this->curl);
|
88 |
-
}
|
89 |
-
|
90 |
-
/**
|
91 |
-
* Return the curl error message
|
92 |
-
*
|
93 |
-
* @return string
|
94 |
-
*/
|
95 |
-
public function error()
|
96 |
-
{
|
97 |
-
return curl_error($this->curl);
|
98 |
-
}
|
99 |
-
|
100 |
-
/**
|
101 |
-
* Get info from a curl reference
|
102 |
-
*
|
103 |
-
* @param $type
|
104 |
-
*
|
105 |
-
* @return mixed
|
106 |
-
*/
|
107 |
-
public function getinfo($type)
|
108 |
-
{
|
109 |
-
return curl_getinfo($this->curl, $type);
|
110 |
-
}
|
111 |
-
|
112 |
-
/**
|
113 |
-
* Get the currently installed curl version
|
114 |
-
*
|
115 |
-
* @return array
|
116 |
-
*/
|
117 |
-
public function version()
|
118 |
-
{
|
119 |
-
return curl_version();
|
120 |
-
}
|
121 |
-
|
122 |
-
/**
|
123 |
-
* Close the resource connection to curl
|
124 |
-
*/
|
125 |
-
public function close()
|
126 |
-
{
|
127 |
-
curl_close($this->curl);
|
128 |
-
}
|
129 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/HttpClients/FacebookCurlHttpClient.php
DELETED
@@ -1,163 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\HttpClients;
|
25 |
-
|
26 |
-
use Facebook\Http\GraphRawResponse;
|
27 |
-
use Facebook\Exceptions\FacebookSDKException;
|
28 |
-
|
29 |
-
/**
|
30 |
-
* Class FacebookCurlHttpClient
|
31 |
-
*
|
32 |
-
* @package Facebook
|
33 |
-
*/
|
34 |
-
class FacebookCurlHttpClient implements FacebookHttpClientInterface
|
35 |
-
{
|
36 |
-
/**
|
37 |
-
* @var string The client error message
|
38 |
-
*/
|
39 |
-
protected $curlErrorMessage = '';
|
40 |
-
|
41 |
-
/**
|
42 |
-
* @var int The curl client error code
|
43 |
-
*/
|
44 |
-
protected $curlErrorCode = 0;
|
45 |
-
|
46 |
-
/**
|
47 |
-
* @var string|boolean The raw response from the server
|
48 |
-
*/
|
49 |
-
protected $rawResponse;
|
50 |
-
|
51 |
-
/**
|
52 |
-
* @var FacebookCurl Procedural curl as object
|
53 |
-
*/
|
54 |
-
protected $facebookCurl;
|
55 |
-
|
56 |
-
/**
|
57 |
-
* @param FacebookCurl|null Procedural curl as object
|
58 |
-
*/
|
59 |
-
public function __construct(FacebookCurl $facebookCurl = null)
|
60 |
-
{
|
61 |
-
$this->facebookCurl = $facebookCurl ?: new FacebookCurl();
|
62 |
-
}
|
63 |
-
|
64 |
-
/**
|
65 |
-
* @inheritdoc
|
66 |
-
*/
|
67 |
-
public function send($url, $method, $body, array $headers, $timeOut)
|
68 |
-
{
|
69 |
-
$this->openConnection($url, $method, $body, $headers, $timeOut);
|
70 |
-
$this->sendRequest();
|
71 |
-
|
72 |
-
if ($curlErrorCode = $this->facebookCurl->errno()) {
|
73 |
-
throw new FacebookSDKException($this->facebookCurl->error(), $curlErrorCode);
|
74 |
-
}
|
75 |
-
|
76 |
-
// Separate the raw headers from the raw body
|
77 |
-
list($rawHeaders, $rawBody) = $this->extractResponseHeadersAndBody();
|
78 |
-
|
79 |
-
$this->closeConnection();
|
80 |
-
|
81 |
-
return new GraphRawResponse($rawHeaders, $rawBody);
|
82 |
-
}
|
83 |
-
|
84 |
-
/**
|
85 |
-
* Opens a new curl connection.
|
86 |
-
*
|
87 |
-
* @param string $url The endpoint to send the request to.
|
88 |
-
* @param string $method The request method.
|
89 |
-
* @param string $body The body of the request.
|
90 |
-
* @param array $headers The request headers.
|
91 |
-
* @param int $timeOut The timeout in seconds for the request.
|
92 |
-
*/
|
93 |
-
public function openConnection($url, $method, $body, array $headers, $timeOut)
|
94 |
-
{
|
95 |
-
$options = [
|
96 |
-
CURLOPT_CUSTOMREQUEST => $method,
|
97 |
-
CURLOPT_HTTPHEADER => $this->compileRequestHeaders($headers),
|
98 |
-
CURLOPT_URL => $url,
|
99 |
-
CURLOPT_CONNECTTIMEOUT => 10,
|
100 |
-
CURLOPT_TIMEOUT => $timeOut,
|
101 |
-
CURLOPT_RETURNTRANSFER => true, // Follow 301 redirects
|
102 |
-
CURLOPT_HEADER => true, // Enable header processing
|
103 |
-
CURLOPT_SSL_VERIFYHOST => 2,
|
104 |
-
CURLOPT_SSL_VERIFYPEER => true,
|
105 |
-
CURLOPT_CAINFO => __DIR__ . '/certs/DigiCertHighAssuranceEVRootCA.pem',
|
106 |
-
];
|
107 |
-
|
108 |
-
if ($method !== "GET") {
|
109 |
-
$options[CURLOPT_POSTFIELDS] = $body;
|
110 |
-
}
|
111 |
-
|
112 |
-
$this->facebookCurl->init();
|
113 |
-
$this->facebookCurl->setoptArray($options);
|
114 |
-
}
|
115 |
-
|
116 |
-
/**
|
117 |
-
* Closes an existing curl connection
|
118 |
-
*/
|
119 |
-
public function closeConnection()
|
120 |
-
{
|
121 |
-
$this->facebookCurl->close();
|
122 |
-
}
|
123 |
-
|
124 |
-
/**
|
125 |
-
* Send the request and get the raw response from curl
|
126 |
-
*/
|
127 |
-
public function sendRequest()
|
128 |
-
{
|
129 |
-
$this->rawResponse = $this->facebookCurl->exec();
|
130 |
-
}
|
131 |
-
|
132 |
-
/**
|
133 |
-
* Compiles the request headers into a curl-friendly format.
|
134 |
-
*
|
135 |
-
* @param array $headers The request headers.
|
136 |
-
*
|
137 |
-
* @return array
|
138 |
-
*/
|
139 |
-
public function compileRequestHeaders(array $headers)
|
140 |
-
{
|
141 |
-
$return = [];
|
142 |
-
|
143 |
-
foreach ($headers as $key => $value) {
|
144 |
-
$return[] = $key . ': ' . $value;
|
145 |
-
}
|
146 |
-
|
147 |
-
return $return;
|
148 |
-
}
|
149 |
-
|
150 |
-
/**
|
151 |
-
* Extracts the headers and the body into a two-part array
|
152 |
-
*
|
153 |
-
* @return array
|
154 |
-
*/
|
155 |
-
public function extractResponseHeadersAndBody()
|
156 |
-
{
|
157 |
-
$parts = explode("\r\n\r\n", $this->rawResponse);
|
158 |
-
$rawBody = array_pop($parts);
|
159 |
-
$rawHeaders = implode("\r\n\r\n", $parts);
|
160 |
-
|
161 |
-
return [trim($rawHeaders), trim($rawBody)];
|
162 |
-
}
|
163 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/HttpClients/FacebookGuzzleHttpClient.php
DELETED
@@ -1,97 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\HttpClients;
|
25 |
-
|
26 |
-
use Facebook\Http\GraphRawResponse;
|
27 |
-
use Facebook\Exceptions\FacebookSDKException;
|
28 |
-
|
29 |
-
use GuzzleHttp\Client;
|
30 |
-
use GuzzleHttp\Message\ResponseInterface;
|
31 |
-
use GuzzleHttp\Ring\Exception\RingException;
|
32 |
-
use GuzzleHttp\Exception\RequestException;
|
33 |
-
|
34 |
-
class FacebookGuzzleHttpClient implements FacebookHttpClientInterface
|
35 |
-
{
|
36 |
-
/**
|
37 |
-
* @var \GuzzleHttp\Client The Guzzle client.
|
38 |
-
*/
|
39 |
-
protected $guzzleClient;
|
40 |
-
|
41 |
-
/**
|
42 |
-
* @param \GuzzleHttp\Client|null The Guzzle client.
|
43 |
-
*/
|
44 |
-
public function __construct(Client $guzzleClient = null)
|
45 |
-
{
|
46 |
-
$this->guzzleClient = $guzzleClient ?: new Client();
|
47 |
-
}
|
48 |
-
|
49 |
-
/**
|
50 |
-
* @inheritdoc
|
51 |
-
*/
|
52 |
-
public function send($url, $method, $body, array $headers, $timeOut)
|
53 |
-
{
|
54 |
-
$options = [
|
55 |
-
'headers' => $headers,
|
56 |
-
'body' => $body,
|
57 |
-
'timeout' => $timeOut,
|
58 |
-
'connect_timeout' => 10,
|
59 |
-
'verify' => __DIR__ . '/certs/DigiCertHighAssuranceEVRootCA.pem',
|
60 |
-
];
|
61 |
-
$request = $this->guzzleClient->createRequest($method, $url, $options);
|
62 |
-
|
63 |
-
try {
|
64 |
-
$rawResponse = $this->guzzleClient->send($request);
|
65 |
-
} catch (RequestException $e) {
|
66 |
-
$rawResponse = $e->getResponse();
|
67 |
-
|
68 |
-
if ($e->getPrevious() instanceof RingException || !$rawResponse instanceof ResponseInterface) {
|
69 |
-
throw new FacebookSDKException($e->getMessage(), $e->getCode());
|
70 |
-
}
|
71 |
-
}
|
72 |
-
|
73 |
-
$rawHeaders = $this->getHeadersAsString($rawResponse);
|
74 |
-
$rawBody = $rawResponse->getBody();
|
75 |
-
$httpStatusCode = $rawResponse->getStatusCode();
|
76 |
-
|
77 |
-
return new GraphRawResponse($rawHeaders, $rawBody, $httpStatusCode);
|
78 |
-
}
|
79 |
-
|
80 |
-
/**
|
81 |
-
* Returns the Guzzle array of headers as a string.
|
82 |
-
*
|
83 |
-
* @param ResponseInterface $response The Guzzle response.
|
84 |
-
*
|
85 |
-
* @return string
|
86 |
-
*/
|
87 |
-
public function getHeadersAsString(ResponseInterface $response)
|
88 |
-
{
|
89 |
-
$headers = $response->getHeaders();
|
90 |
-
$rawHeaders = [];
|
91 |
-
foreach ($headers as $name => $values) {
|
92 |
-
$rawHeaders[] = $name . ": " . implode(", ", $values);
|
93 |
-
}
|
94 |
-
|
95 |
-
return implode("\r\n", $rawHeaders);
|
96 |
-
}
|
97 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/HttpClients/FacebookHttpClientInterface.php
DELETED
@@ -1,47 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\HttpClients;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Interface FacebookHttpClientInterface
|
28 |
-
*
|
29 |
-
* @package Facebook
|
30 |
-
*/
|
31 |
-
interface FacebookHttpClientInterface
|
32 |
-
{
|
33 |
-
/**
|
34 |
-
* Sends a request to the server and returns the raw response.
|
35 |
-
*
|
36 |
-
* @param string $url The endpoint to send the request to.
|
37 |
-
* @param string $method The request method.
|
38 |
-
* @param string $body The body of the request.
|
39 |
-
* @param array $headers The request headers.
|
40 |
-
* @param int $timeOut The timeout in seconds for the request.
|
41 |
-
*
|
42 |
-
* @return \Facebook\Http\GraphRawResponse Raw response from the server.
|
43 |
-
*
|
44 |
-
* @throws \Facebook\Exceptions\FacebookSDKException
|
45 |
-
*/
|
46 |
-
public function send($url, $method, $body, array $headers, $timeOut);
|
47 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/HttpClients/FacebookStream.php
DELETED
@@ -1,80 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\HttpClients;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Class FacebookStream
|
28 |
-
*
|
29 |
-
* Abstraction for the procedural stream elements so that the functions can be
|
30 |
-
* mocked and the implementation can be tested.
|
31 |
-
*
|
32 |
-
* @package Facebook
|
33 |
-
*/
|
34 |
-
class FacebookStream
|
35 |
-
{
|
36 |
-
/**
|
37 |
-
* @var resource Context stream resource instance
|
38 |
-
*/
|
39 |
-
protected $stream;
|
40 |
-
|
41 |
-
/**
|
42 |
-
* @var array Response headers from the stream wrapper
|
43 |
-
*/
|
44 |
-
protected $responseHeaders = [];
|
45 |
-
|
46 |
-
/**
|
47 |
-
* Make a new context stream reference instance
|
48 |
-
*
|
49 |
-
* @param array $options
|
50 |
-
*/
|
51 |
-
public function streamContextCreate(array $options)
|
52 |
-
{
|
53 |
-
$this->stream = stream_context_create($options);
|
54 |
-
}
|
55 |
-
|
56 |
-
/**
|
57 |
-
* The response headers from the stream wrapper
|
58 |
-
*
|
59 |
-
* @return array
|
60 |
-
*/
|
61 |
-
public function getResponseHeaders()
|
62 |
-
{
|
63 |
-
return $this->responseHeaders;
|
64 |
-
}
|
65 |
-
|
66 |
-
/**
|
67 |
-
* Send a stream wrapped request
|
68 |
-
*
|
69 |
-
* @param string $url
|
70 |
-
*
|
71 |
-
* @return mixed
|
72 |
-
*/
|
73 |
-
public function fileGetContents($url)
|
74 |
-
{
|
75 |
-
$rawResponse = file_get_contents($url, false, $this->stream);
|
76 |
-
$this->responseHeaders = $http_response_header ?: [];
|
77 |
-
|
78 |
-
return $rawResponse;
|
79 |
-
}
|
80 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/HttpClients/FacebookStreamHttpClient.php
DELETED
@@ -1,94 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\HttpClients;
|
25 |
-
|
26 |
-
use Facebook\Http\GraphRawResponse;
|
27 |
-
use Facebook\Exceptions\FacebookSDKException;
|
28 |
-
|
29 |
-
class FacebookStreamHttpClient implements FacebookHttpClientInterface
|
30 |
-
{
|
31 |
-
/**
|
32 |
-
* @var FacebookStream Procedural stream wrapper as object.
|
33 |
-
*/
|
34 |
-
protected $facebookStream;
|
35 |
-
|
36 |
-
/**
|
37 |
-
* @param FacebookStream|null Procedural stream wrapper as object.
|
38 |
-
*/
|
39 |
-
public function __construct(FacebookStream $facebookStream = null)
|
40 |
-
{
|
41 |
-
$this->facebookStream = $facebookStream ?: new FacebookStream();
|
42 |
-
}
|
43 |
-
|
44 |
-
/**
|
45 |
-
* @inheritdoc
|
46 |
-
*/
|
47 |
-
public function send($url, $method, $body, array $headers, $timeOut)
|
48 |
-
{
|
49 |
-
$options = [
|
50 |
-
'http' => [
|
51 |
-
'method' => $method,
|
52 |
-
'header' => $this->compileHeader($headers),
|
53 |
-
'content' => $body,
|
54 |
-
'timeout' => $timeOut,
|
55 |
-
'ignore_errors' => true
|
56 |
-
],
|
57 |
-
'ssl' => [
|
58 |
-
'verify_peer' => true,
|
59 |
-
'verify_peer_name' => true,
|
60 |
-
'allow_self_signed' => true, // All root certificates are self-signed
|
61 |
-
'cafile' => __DIR__ . '/certs/DigiCertHighAssuranceEVRootCA.pem',
|
62 |
-
],
|
63 |
-
];
|
64 |
-
|
65 |
-
$this->facebookStream->streamContextCreate($options);
|
66 |
-
$rawBody = $this->facebookStream->fileGetContents($url);
|
67 |
-
$rawHeaders = $this->facebookStream->getResponseHeaders();
|
68 |
-
|
69 |
-
if ($rawBody === false || empty($rawHeaders)) {
|
70 |
-
throw new FacebookSDKException('Stream returned an empty response', 660);
|
71 |
-
}
|
72 |
-
|
73 |
-
$rawHeaders = implode("\r\n", $rawHeaders);
|
74 |
-
|
75 |
-
return new GraphRawResponse($rawHeaders, $rawBody);
|
76 |
-
}
|
77 |
-
|
78 |
-
/**
|
79 |
-
* Formats the headers for use in the stream wrapper.
|
80 |
-
*
|
81 |
-
* @param array $headers The request headers.
|
82 |
-
*
|
83 |
-
* @return string
|
84 |
-
*/
|
85 |
-
public function compileHeader(array $headers)
|
86 |
-
{
|
87 |
-
$header = [];
|
88 |
-
foreach ($headers as $k => $v) {
|
89 |
-
$header[] = $k . ': ' . $v;
|
90 |
-
}
|
91 |
-
|
92 |
-
return implode("\r\n", $header);
|
93 |
-
}
|
94 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/HttpClients/HttpClientsFactory.php
DELETED
@@ -1,99 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\HttpClients;
|
25 |
-
|
26 |
-
use GuzzleHttp\Client;
|
27 |
-
use InvalidArgumentException;
|
28 |
-
use Exception;
|
29 |
-
|
30 |
-
class HttpClientsFactory
|
31 |
-
{
|
32 |
-
private function __construct()
|
33 |
-
{
|
34 |
-
// a factory constructor should never be invoked
|
35 |
-
}
|
36 |
-
|
37 |
-
/**
|
38 |
-
* HTTP client generation.
|
39 |
-
*
|
40 |
-
* @param FacebookHttpClientInterface|Client|string|null $handler
|
41 |
-
*
|
42 |
-
* @throws Exception If the cURL extension or the Guzzle client aren't available (if required).
|
43 |
-
* @throws InvalidArgumentException If the http client handler isn't "curl", "stream", "guzzle", or an instance of Facebook\HttpClients\FacebookHttpClientInterface.
|
44 |
-
*
|
45 |
-
* @return FacebookHttpClientInterface
|
46 |
-
*/
|
47 |
-
public static function createHttpClient($handler)
|
48 |
-
{
|
49 |
-
if (!$handler) {
|
50 |
-
return self::detectDefaultClient();
|
51 |
-
}
|
52 |
-
|
53 |
-
if ($handler instanceof FacebookHttpClientInterface) {
|
54 |
-
return $handler;
|
55 |
-
}
|
56 |
-
|
57 |
-
if ('stream' === $handler) {
|
58 |
-
return new FacebookStreamHttpClient();
|
59 |
-
}
|
60 |
-
if ('curl' === $handler) {
|
61 |
-
if (!extension_loaded('curl')) {
|
62 |
-
throw new Exception('The cURL extension must be loaded in order to use the "curl" handler.');
|
63 |
-
}
|
64 |
-
|
65 |
-
return new FacebookCurlHttpClient();
|
66 |
-
}
|
67 |
-
|
68 |
-
if ('guzzle' === $handler && !class_exists('GuzzleHttp\Client')) {
|
69 |
-
throw new Exception('The Guzzle HTTP client must be included in order to use the "guzzle" handler.');
|
70 |
-
}
|
71 |
-
|
72 |
-
if ($handler instanceof Client) {
|
73 |
-
return new FacebookGuzzleHttpClient($handler);
|
74 |
-
}
|
75 |
-
if ('guzzle' === $handler) {
|
76 |
-
return new FacebookGuzzleHttpClient();
|
77 |
-
}
|
78 |
-
|
79 |
-
throw new InvalidArgumentException('The http client handler must be set to "curl", "stream", "guzzle", be an instance of GuzzleHttp\Client or an instance of Facebook\HttpClients\FacebookHttpClientInterface');
|
80 |
-
}
|
81 |
-
|
82 |
-
/**
|
83 |
-
* Detect default HTTP client.
|
84 |
-
*
|
85 |
-
* @return FacebookHttpClientInterface
|
86 |
-
*/
|
87 |
-
private static function detectDefaultClient()
|
88 |
-
{
|
89 |
-
if (extension_loaded('curl')) {
|
90 |
-
return new FacebookCurlHttpClient();
|
91 |
-
}
|
92 |
-
|
93 |
-
if (class_exists('GuzzleHttp\Client')) {
|
94 |
-
return new FacebookGuzzleHttpClient();
|
95 |
-
}
|
96 |
-
|
97 |
-
return new FacebookStreamHttpClient();
|
98 |
-
}
|
99 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/HttpClients/certs/DigiCertHighAssuranceEVRootCA.pem
DELETED
@@ -1,23 +0,0 @@
|
|
1 |
-
-----BEGIN CERTIFICATE-----
|
2 |
-
MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBs
|
3 |
-
MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
|
4 |
-
d3cuZGlnaWNlcnQuY29tMSswKQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5j
|
5 |
-
ZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAwMFoXDTMxMTExMDAwMDAwMFowbDEL
|
6 |
-
MAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZMBcGA1UECxMQd3d3
|
7 |
-
LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFuY2Ug
|
8 |
-
RVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm
|
9 |
-
+9S75S0tMqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTW
|
10 |
-
PNt0OKRKzE0lgvdKpVMSOO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEM
|
11 |
-
xChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFB
|
12 |
-
Ik5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQNAQTXKFx01p8VdteZOE3
|
13 |
-
hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUeh10aUAsg
|
14 |
-
EsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQF
|
15 |
-
MAMBAf8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaA
|
16 |
-
FLE+w2kD+L9HAdSYJhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3Nec
|
17 |
-
nzyIZgYIVyHbIUf4KmeqvxgydkAQV8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6z
|
18 |
-
eM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFpmyPInngiK3BD41VHMWEZ71jF
|
19 |
-
hS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkKmNEVX58Svnw2
|
20 |
-
Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe
|
21 |
-
vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep
|
22 |
-
+OkuE6N36B9K
|
23 |
-
-----END CERTIFICATE-----
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/PersistentData/FacebookMemoryPersistentDataHandler.php
DELETED
@@ -1,53 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\PersistentData;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Class FacebookMemoryPersistentDataHandler
|
28 |
-
*
|
29 |
-
* @package Facebook
|
30 |
-
*/
|
31 |
-
class FacebookMemoryPersistentDataHandler implements PersistentDataInterface
|
32 |
-
{
|
33 |
-
/**
|
34 |
-
* @var array The session data to keep in memory.
|
35 |
-
*/
|
36 |
-
protected $sessionData = [];
|
37 |
-
|
38 |
-
/**
|
39 |
-
* @inheritdoc
|
40 |
-
*/
|
41 |
-
public function get($key)
|
42 |
-
{
|
43 |
-
return isset($this->sessionData[$key]) ? $this->sessionData[$key] : null;
|
44 |
-
}
|
45 |
-
|
46 |
-
/**
|
47 |
-
* @inheritdoc
|
48 |
-
*/
|
49 |
-
public function set($key, $value)
|
50 |
-
{
|
51 |
-
$this->sessionData[$key] = $value;
|
52 |
-
}
|
53 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/PersistentData/FacebookSessionPersistentDataHandler.php
DELETED
@@ -1,76 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\PersistentData;
|
25 |
-
|
26 |
-
use Facebook\Exceptions\FacebookSDKException;
|
27 |
-
|
28 |
-
/**
|
29 |
-
* Class FacebookSessionPersistentDataHandler
|
30 |
-
*
|
31 |
-
* @package Facebook
|
32 |
-
*/
|
33 |
-
class FacebookSessionPersistentDataHandler implements PersistentDataInterface
|
34 |
-
{
|
35 |
-
/**
|
36 |
-
* @var string Prefix to use for session variables.
|
37 |
-
*/
|
38 |
-
protected $sessionPrefix = 'FBRLH_';
|
39 |
-
|
40 |
-
/**
|
41 |
-
* Init the session handler.
|
42 |
-
*
|
43 |
-
* @param boolean $enableSessionCheck
|
44 |
-
*
|
45 |
-
* @throws FacebookSDKException
|
46 |
-
*/
|
47 |
-
public function __construct($enableSessionCheck = true)
|
48 |
-
{
|
49 |
-
if ($enableSessionCheck && session_status() !== PHP_SESSION_ACTIVE) {
|
50 |
-
throw new FacebookSDKException(
|
51 |
-
'Sessions are not active. Please make sure session_start() is at the top of your script.',
|
52 |
-
720
|
53 |
-
);
|
54 |
-
}
|
55 |
-
}
|
56 |
-
|
57 |
-
/**
|
58 |
-
* @inheritdoc
|
59 |
-
*/
|
60 |
-
public function get($key)
|
61 |
-
{
|
62 |
-
if (isset($_SESSION[$this->sessionPrefix . $key])) {
|
63 |
-
return $_SESSION[$this->sessionPrefix . $key];
|
64 |
-
}
|
65 |
-
|
66 |
-
return null;
|
67 |
-
}
|
68 |
-
|
69 |
-
/**
|
70 |
-
* @inheritdoc
|
71 |
-
*/
|
72 |
-
public function set($key, $value)
|
73 |
-
{
|
74 |
-
$_SESSION[$this->sessionPrefix . $key] = $value;
|
75 |
-
}
|
76 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/PersistentData/PersistentDataFactory.php
DELETED
@@ -1,65 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\PersistentData;
|
25 |
-
|
26 |
-
use InvalidArgumentException;
|
27 |
-
|
28 |
-
class PersistentDataFactory
|
29 |
-
{
|
30 |
-
private function __construct()
|
31 |
-
{
|
32 |
-
// a factory constructor should never be invoked
|
33 |
-
}
|
34 |
-
|
35 |
-
/**
|
36 |
-
* PersistentData generation.
|
37 |
-
*
|
38 |
-
* @param PersistentDataInterface|string|null $handler
|
39 |
-
*
|
40 |
-
* @throws InvalidArgumentException If the persistent data handler isn't "session", "memory", or an instance of Facebook\PersistentData\PersistentDataInterface.
|
41 |
-
*
|
42 |
-
* @return PersistentDataInterface
|
43 |
-
*/
|
44 |
-
public static function createPersistentDataHandler($handler)
|
45 |
-
{
|
46 |
-
if (!$handler) {
|
47 |
-
return session_status() === PHP_SESSION_ACTIVE
|
48 |
-
? new FacebookSessionPersistentDataHandler()
|
49 |
-
: new FacebookMemoryPersistentDataHandler();
|
50 |
-
}
|
51 |
-
|
52 |
-
if ($handler instanceof PersistentDataInterface) {
|
53 |
-
return $handler;
|
54 |
-
}
|
55 |
-
|
56 |
-
if ('session' === $handler) {
|
57 |
-
return new FacebookSessionPersistentDataHandler();
|
58 |
-
}
|
59 |
-
if ('memory' === $handler) {
|
60 |
-
return new FacebookMemoryPersistentDataHandler();
|
61 |
-
}
|
62 |
-
|
63 |
-
throw new InvalidArgumentException('The persistent data handler must be set to "session", "memory", or be an instance of Facebook\PersistentData\PersistentDataInterface');
|
64 |
-
}
|
65 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/PersistentData/PersistentDataInterface.php
DELETED
@@ -1,49 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\PersistentData;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Interface PersistentDataInterface
|
28 |
-
*
|
29 |
-
* @package Facebook
|
30 |
-
*/
|
31 |
-
interface PersistentDataInterface
|
32 |
-
{
|
33 |
-
/**
|
34 |
-
* Get a value from a persistent data store.
|
35 |
-
*
|
36 |
-
* @param string $key
|
37 |
-
*
|
38 |
-
* @return mixed
|
39 |
-
*/
|
40 |
-
public function get($key);
|
41 |
-
|
42 |
-
/**
|
43 |
-
* Set a value in the persistent data store.
|
44 |
-
*
|
45 |
-
* @param string $key
|
46 |
-
* @param mixed $value
|
47 |
-
*/
|
48 |
-
public function set($key, $value);
|
49 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/PseudoRandomString/McryptPseudoRandomStringGenerator.php
DELETED
@@ -1,68 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\PseudoRandomString;
|
25 |
-
|
26 |
-
use Facebook\Exceptions\FacebookSDKException;
|
27 |
-
|
28 |
-
class McryptPseudoRandomStringGenerator implements PseudoRandomStringGeneratorInterface
|
29 |
-
{
|
30 |
-
use PseudoRandomStringGeneratorTrait;
|
31 |
-
|
32 |
-
/**
|
33 |
-
* @const string The error message when generating the string fails.
|
34 |
-
*/
|
35 |
-
const ERROR_MESSAGE = 'Unable to generate a cryptographically secure pseudo-random string from mcrypt_create_iv(). ';
|
36 |
-
|
37 |
-
/**
|
38 |
-
* @throws FacebookSDKException
|
39 |
-
*/
|
40 |
-
public function __construct()
|
41 |
-
{
|
42 |
-
if (!function_exists('mcrypt_create_iv')) {
|
43 |
-
throw new FacebookSDKException(
|
44 |
-
static::ERROR_MESSAGE .
|
45 |
-
'The function mcrypt_create_iv() does not exist.'
|
46 |
-
);
|
47 |
-
}
|
48 |
-
}
|
49 |
-
|
50 |
-
/**
|
51 |
-
* @inheritdoc
|
52 |
-
*/
|
53 |
-
public function getPseudoRandomString($length)
|
54 |
-
{
|
55 |
-
$this->validateLength($length);
|
56 |
-
|
57 |
-
$binaryString = mcrypt_create_iv($length, MCRYPT_DEV_URANDOM);
|
58 |
-
|
59 |
-
if ($binaryString === false) {
|
60 |
-
throw new FacebookSDKException(
|
61 |
-
static::ERROR_MESSAGE .
|
62 |
-
'mcrypt_create_iv() returned an error.'
|
63 |
-
);
|
64 |
-
}
|
65 |
-
|
66 |
-
return $this->binToHex($binaryString, $length);
|
67 |
-
}
|
68 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/PseudoRandomString/OpenSslPseudoRandomStringGenerator.php
DELETED
@@ -1,67 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\PseudoRandomString;
|
25 |
-
|
26 |
-
use Facebook\Exceptions\FacebookSDKException;
|
27 |
-
|
28 |
-
class OpenSslPseudoRandomStringGenerator implements PseudoRandomStringGeneratorInterface
|
29 |
-
{
|
30 |
-
use PseudoRandomStringGeneratorTrait;
|
31 |
-
|
32 |
-
/**
|
33 |
-
* @const string The error message when generating the string fails.
|
34 |
-
*/
|
35 |
-
const ERROR_MESSAGE = 'Unable to generate a cryptographically secure pseudo-random string from openssl_random_pseudo_bytes().';
|
36 |
-
|
37 |
-
/**
|
38 |
-
* @throws FacebookSDKException
|
39 |
-
*/
|
40 |
-
public function __construct()
|
41 |
-
{
|
42 |
-
if (!function_exists('openssl_random_pseudo_bytes')) {
|
43 |
-
throw new FacebookSDKException(static::ERROR_MESSAGE . 'The function openssl_random_pseudo_bytes() does not exist.');
|
44 |
-
}
|
45 |
-
}
|
46 |
-
|
47 |
-
/**
|
48 |
-
* @inheritdoc
|
49 |
-
*/
|
50 |
-
public function getPseudoRandomString($length)
|
51 |
-
{
|
52 |
-
$this->validateLength($length);
|
53 |
-
|
54 |
-
$wasCryptographicallyStrong = false;
|
55 |
-
$binaryString = openssl_random_pseudo_bytes($length, $wasCryptographicallyStrong);
|
56 |
-
|
57 |
-
if ($binaryString === false) {
|
58 |
-
throw new FacebookSDKException(static::ERROR_MESSAGE . 'openssl_random_pseudo_bytes() returned an unknown error.');
|
59 |
-
}
|
60 |
-
|
61 |
-
if ($wasCryptographicallyStrong !== true) {
|
62 |
-
throw new FacebookSDKException(static::ERROR_MESSAGE . 'openssl_random_pseudo_bytes() returned a pseudo-random string but it was not cryptographically secure and cannot be used.');
|
63 |
-
}
|
64 |
-
|
65 |
-
return $this->binToHex($binaryString, $length);
|
66 |
-
}
|
67 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorFactory.php
DELETED
@@ -1,93 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\PseudoRandomString;
|
25 |
-
|
26 |
-
use Facebook\Exceptions\FacebookSDKException;
|
27 |
-
use InvalidArgumentException;
|
28 |
-
|
29 |
-
class PseudoRandomStringGeneratorFactory
|
30 |
-
{
|
31 |
-
private function __construct()
|
32 |
-
{
|
33 |
-
// a factory constructor should never be invoked
|
34 |
-
}
|
35 |
-
|
36 |
-
/**
|
37 |
-
* Pseudo random string generator creation.
|
38 |
-
*
|
39 |
-
* @param PseudoRandomStringGeneratorInterface|string|null $generator
|
40 |
-
*
|
41 |
-
* @throws InvalidArgumentException If the pseudo random string generator must be set to "mcrypt", "openssl", or "urandom", or be an instance of Facebook\PseudoRandomString\PseudoRandomStringGeneratorInterface.
|
42 |
-
*
|
43 |
-
* @return PseudoRandomStringGeneratorInterface
|
44 |
-
*/
|
45 |
-
public static function createPseudoRandomStringGenerator($generator)
|
46 |
-
{
|
47 |
-
if (!$generator) {
|
48 |
-
return self::detectDefaultPseudoRandomStringGenerator();
|
49 |
-
}
|
50 |
-
|
51 |
-
if ($generator instanceof PseudoRandomStringGeneratorInterface) {
|
52 |
-
return $generator;
|
53 |
-
}
|
54 |
-
|
55 |
-
if ('mcrypt' === $generator) {
|
56 |
-
return new McryptPseudoRandomStringGenerator();
|
57 |
-
}
|
58 |
-
if ('openssl' === $generator) {
|
59 |
-
return new OpenSslPseudoRandomStringGenerator();
|
60 |
-
}
|
61 |
-
if ('urandom' === $generator) {
|
62 |
-
return new UrandomPseudoRandomStringGenerator();
|
63 |
-
}
|
64 |
-
|
65 |
-
throw new InvalidArgumentException('The pseudo random string generator must be set to "mcrypt", "openssl", or "urandom", or be an instance of Facebook\PseudoRandomString\PseudoRandomStringGeneratorInterface');
|
66 |
-
}
|
67 |
-
|
68 |
-
/**
|
69 |
-
* Detects which pseudo-random string generator to use.
|
70 |
-
*
|
71 |
-
* @throws FacebookSDKException If unable to detect a cryptographically secure pseudo-random string generator.
|
72 |
-
*
|
73 |
-
* @return PseudoRandomStringGeneratorInterface
|
74 |
-
*/
|
75 |
-
private static function detectDefaultPseudoRandomStringGenerator()
|
76 |
-
{
|
77 |
-
// Since openssl_random_pseudo_bytes() can sometimes return non-cryptographically
|
78 |
-
// secure pseudo-random strings (in rare cases), we check for mcrypt_create_iv() first.
|
79 |
-
if (function_exists('mcrypt_create_iv')) {
|
80 |
-
return new McryptPseudoRandomStringGenerator();
|
81 |
-
}
|
82 |
-
|
83 |
-
if (function_exists('openssl_random_pseudo_bytes')) {
|
84 |
-
return new OpenSslPseudoRandomStringGenerator();
|
85 |
-
}
|
86 |
-
|
87 |
-
if (!ini_get('open_basedir') && is_readable('/dev/urandom')) {
|
88 |
-
return new UrandomPseudoRandomStringGenerator();
|
89 |
-
}
|
90 |
-
|
91 |
-
throw new FacebookSDKException('Unable to detect a cryptographically secure pseudo-random string generator.');
|
92 |
-
}
|
93 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorInterface.php
DELETED
@@ -1,45 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\PseudoRandomString;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Interface
|
28 |
-
*
|
29 |
-
* @package Facebook
|
30 |
-
*/
|
31 |
-
interface PseudoRandomStringGeneratorInterface
|
32 |
-
{
|
33 |
-
/**
|
34 |
-
* Get a cryptographically secure pseudo-random string of arbitrary length.
|
35 |
-
*
|
36 |
-
* @see http://sockpuppet.org/blog/2014/02/25/safely-generate-random-numbers/
|
37 |
-
*
|
38 |
-
* @param int $length The length of the string to return.
|
39 |
-
*
|
40 |
-
* @return string
|
41 |
-
*
|
42 |
-
* @throws \Facebook\Exceptions\FacebookSDKException|\InvalidArgumentException
|
43 |
-
*/
|
44 |
-
public function getPseudoRandomString($length);
|
45 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorTrait.php
DELETED
@@ -1,58 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\PseudoRandomString;
|
25 |
-
|
26 |
-
trait PseudoRandomStringGeneratorTrait
|
27 |
-
{
|
28 |
-
/**
|
29 |
-
* Validates the length argument of a random string.
|
30 |
-
*
|
31 |
-
* @param int $length The length to validate.
|
32 |
-
*
|
33 |
-
* @throws \InvalidArgumentException
|
34 |
-
*/
|
35 |
-
public function validateLength($length)
|
36 |
-
{
|
37 |
-
if (!is_int($length)) {
|
38 |
-
throw new \InvalidArgumentException('getPseudoRandomString() expects an integer for the string length');
|
39 |
-
}
|
40 |
-
|
41 |
-
if ($length < 1) {
|
42 |
-
throw new \InvalidArgumentException('getPseudoRandomString() expects a length greater than 1');
|
43 |
-
}
|
44 |
-
}
|
45 |
-
|
46 |
-
/**
|
47 |
-
* Converts binary data to hexadecimal of arbitrary length.
|
48 |
-
*
|
49 |
-
* @param string $binaryData The binary data to convert to hex.
|
50 |
-
* @param int $length The length of the string to return.
|
51 |
-
*
|
52 |
-
* @return string
|
53 |
-
*/
|
54 |
-
public function binToHex($binaryData, $length)
|
55 |
-
{
|
56 |
-
return \substr(\bin2hex($binaryData), 0, $length);
|
57 |
-
}
|
58 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/PseudoRandomString/UrandomPseudoRandomStringGenerator.php
DELETED
@@ -1,89 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\PseudoRandomString;
|
25 |
-
|
26 |
-
use Facebook\Exceptions\FacebookSDKException;
|
27 |
-
|
28 |
-
class UrandomPseudoRandomStringGenerator implements PseudoRandomStringGeneratorInterface
|
29 |
-
{
|
30 |
-
|
31 |
-
use PseudoRandomStringGeneratorTrait;
|
32 |
-
|
33 |
-
/**
|
34 |
-
* @const string The error message when generating the string fails.
|
35 |
-
*/
|
36 |
-
const ERROR_MESSAGE = 'Unable to generate a cryptographically secure pseudo-random string from /dev/urandom. ';
|
37 |
-
|
38 |
-
/**
|
39 |
-
* @throws FacebookSDKException
|
40 |
-
*/
|
41 |
-
public function __construct()
|
42 |
-
{
|
43 |
-
if (ini_get('open_basedir')) {
|
44 |
-
throw new FacebookSDKException(
|
45 |
-
static::ERROR_MESSAGE .
|
46 |
-
'There is an open_basedir constraint that prevents access to /dev/urandom.'
|
47 |
-
);
|
48 |
-
}
|
49 |
-
|
50 |
-
if (!is_readable('/dev/urandom')) {
|
51 |
-
throw new FacebookSDKException(
|
52 |
-
static::ERROR_MESSAGE .
|
53 |
-
'Unable to read from /dev/urandom.'
|
54 |
-
);
|
55 |
-
}
|
56 |
-
}
|
57 |
-
|
58 |
-
/**
|
59 |
-
* @inheritdoc
|
60 |
-
*/
|
61 |
-
public function getPseudoRandomString($length)
|
62 |
-
{
|
63 |
-
$this->validateLength($length);
|
64 |
-
|
65 |
-
$stream = fopen('/dev/urandom', 'rb');
|
66 |
-
if (!is_resource($stream)) {
|
67 |
-
throw new FacebookSDKException(
|
68 |
-
static::ERROR_MESSAGE .
|
69 |
-
'Unable to open stream to /dev/urandom.'
|
70 |
-
);
|
71 |
-
}
|
72 |
-
|
73 |
-
if (!defined('HHVM_VERSION')) {
|
74 |
-
stream_set_read_buffer($stream, 0);
|
75 |
-
}
|
76 |
-
|
77 |
-
$binaryString = fread($stream, $length);
|
78 |
-
fclose($stream);
|
79 |
-
|
80 |
-
if (!$binaryString) {
|
81 |
-
throw new FacebookSDKException(
|
82 |
-
static::ERROR_MESSAGE .
|
83 |
-
'Stream to /dev/urandom returned no data.'
|
84 |
-
);
|
85 |
-
}
|
86 |
-
|
87 |
-
return $this->binToHex($binaryString, $length);
|
88 |
-
}
|
89 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/SignedRequest.php
DELETED
@@ -1,326 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook;
|
25 |
-
|
26 |
-
use Facebook\Exceptions\FacebookSDKException;
|
27 |
-
|
28 |
-
/**
|
29 |
-
* Class SignedRequest
|
30 |
-
*
|
31 |
-
* @package Facebook
|
32 |
-
*/
|
33 |
-
class SignedRequest
|
34 |
-
{
|
35 |
-
/**
|
36 |
-
* @var FacebookApp The FacebookApp entity.
|
37 |
-
*/
|
38 |
-
protected $app;
|
39 |
-
|
40 |
-
/**
|
41 |
-
* @var string The raw encrypted signed request.
|
42 |
-
*/
|
43 |
-
protected $rawSignedRequest;
|
44 |
-
|
45 |
-
/**
|
46 |
-
* @var array The payload from the decrypted signed request.
|
47 |
-
*/
|
48 |
-
protected $payload;
|
49 |
-
|
50 |
-
/**
|
51 |
-
* Instantiate a new SignedRequest entity.
|
52 |
-
*
|
53 |
-
* @param FacebookApp $facebookApp The FacebookApp entity.
|
54 |
-
* @param string|null $rawSignedRequest The raw signed request.
|
55 |
-
*/
|
56 |
-
public function __construct(FacebookApp $facebookApp, $rawSignedRequest = null)
|
57 |
-
{
|
58 |
-
$this->app = $facebookApp;
|
59 |
-
|
60 |
-
if (!$rawSignedRequest) {
|
61 |
-
return;
|
62 |
-
}
|
63 |
-
|
64 |
-
$this->rawSignedRequest = $rawSignedRequest;
|
65 |
-
|
66 |
-
$this->parse();
|
67 |
-
}
|
68 |
-
|
69 |
-
/**
|
70 |
-
* Returns the raw signed request data.
|
71 |
-
*
|
72 |
-
* @return string|null
|
73 |
-
*/
|
74 |
-
public function getRawSignedRequest()
|
75 |
-
{
|
76 |
-
return $this->rawSignedRequest;
|
77 |
-
}
|
78 |
-
|
79 |
-
/**
|
80 |
-
* Returns the parsed signed request data.
|
81 |
-
*
|
82 |
-
* @return array|null
|
83 |
-
*/
|
84 |
-
public function getPayload()
|
85 |
-
{
|
86 |
-
return $this->payload;
|
87 |
-
}
|
88 |
-
|
89 |
-
/**
|
90 |
-
* Returns a property from the signed request data if available.
|
91 |
-
*
|
92 |
-
* @param string $key
|
93 |
-
* @param mixed|null $default
|
94 |
-
*
|
95 |
-
* @return mixed|null
|
96 |
-
*/
|
97 |
-
public function get($key, $default = null)
|
98 |
-
{
|
99 |
-
if (isset($this->payload[$key])) {
|
100 |
-
return $this->payload[$key];
|
101 |
-
}
|
102 |
-
|
103 |
-
return $default;
|
104 |
-
}
|
105 |
-
|
106 |
-
/**
|
107 |
-
* Returns user_id from signed request data if available.
|
108 |
-
*
|
109 |
-
* @return string|null
|
110 |
-
*/
|
111 |
-
public function getUserId()
|
112 |
-
{
|
113 |
-
return $this->get('user_id');
|
114 |
-
}
|
115 |
-
|
116 |
-
/**
|
117 |
-
* Checks for OAuth data in the payload.
|
118 |
-
*
|
119 |
-
* @return boolean
|
120 |
-
*/
|
121 |
-
public function hasOAuthData()
|
122 |
-
{
|
123 |
-
return $this->get('oauth_token') || $this->get('code');
|
124 |
-
}
|
125 |
-
|
126 |
-
/**
|
127 |
-
* Creates a signed request from an array of data.
|
128 |
-
*
|
129 |
-
* @param array $payload
|
130 |
-
*
|
131 |
-
* @return string
|
132 |
-
*/
|
133 |
-
public function make(array $payload)
|
134 |
-
{
|
135 |
-
$payload['algorithm'] = isset($payload['algorithm']) ? $payload['algorithm'] : 'HMAC-SHA256';
|
136 |
-
$payload['issued_at'] = isset($payload['issued_at']) ? $payload['issued_at'] : time();
|
137 |
-
$encodedPayload = $this->base64UrlEncode(json_encode($payload));
|
138 |
-
|
139 |
-
$hashedSig = $this->hashSignature($encodedPayload);
|
140 |
-
$encodedSig = $this->base64UrlEncode($hashedSig);
|
141 |
-
|
142 |
-
return $encodedSig . '.' . $encodedPayload;
|
143 |
-
}
|
144 |
-
|
145 |
-
/**
|
146 |
-
* Validates and decodes a signed request and saves
|
147 |
-
* the payload to an array.
|
148 |
-
*/
|
149 |
-
protected function parse()
|
150 |
-
{
|
151 |
-
list($encodedSig, $encodedPayload) = $this->split();
|
152 |
-
|
153 |
-
// Signature validation
|
154 |
-
$sig = $this->decodeSignature($encodedSig);
|
155 |
-
$hashedSig = $this->hashSignature($encodedPayload);
|
156 |
-
$this->validateSignature($hashedSig, $sig);
|
157 |
-
|
158 |
-
$this->payload = $this->decodePayload($encodedPayload);
|
159 |
-
|
160 |
-
// Payload validation
|
161 |
-
$this->validateAlgorithm();
|
162 |
-
}
|
163 |
-
|
164 |
-
/**
|
165 |
-
* Splits a raw signed request into signature and payload.
|
166 |
-
*
|
167 |
-
* @returns array
|
168 |
-
*
|
169 |
-
* @throws FacebookSDKException
|
170 |
-
*/
|
171 |
-
protected function split()
|
172 |
-
{
|
173 |
-
if (strpos($this->rawSignedRequest, '.') === false) {
|
174 |
-
throw new FacebookSDKException('Malformed signed request.', 606);
|
175 |
-
}
|
176 |
-
|
177 |
-
return explode('.', $this->rawSignedRequest, 2);
|
178 |
-
}
|
179 |
-
|
180 |
-
/**
|
181 |
-
* Decodes the raw signature from a signed request.
|
182 |
-
*
|
183 |
-
* @param string $encodedSig
|
184 |
-
*
|
185 |
-
* @returns string
|
186 |
-
*
|
187 |
-
* @throws FacebookSDKException
|
188 |
-
*/
|
189 |
-
protected function decodeSignature($encodedSig)
|
190 |
-
{
|
191 |
-
$sig = $this->base64UrlDecode($encodedSig);
|
192 |
-
|
193 |
-
if (!$sig) {
|
194 |
-
throw new FacebookSDKException('Signed request has malformed encoded signature data.', 607);
|
195 |
-
}
|
196 |
-
|
197 |
-
return $sig;
|
198 |
-
}
|
199 |
-
|
200 |
-
/**
|
201 |
-
* Decodes the raw payload from a signed request.
|
202 |
-
*
|
203 |
-
* @param string $encodedPayload
|
204 |
-
*
|
205 |
-
* @returns array
|
206 |
-
*
|
207 |
-
* @throws FacebookSDKException
|
208 |
-
*/
|
209 |
-
protected function decodePayload($encodedPayload)
|
210 |
-
{
|
211 |
-
$payload = $this->base64UrlDecode($encodedPayload);
|
212 |
-
|
213 |
-
if ($payload) {
|
214 |
-
$payload = json_decode($payload, true);
|
215 |
-
}
|
216 |
-
|
217 |
-
if (!is_array($payload)) {
|
218 |
-
throw new FacebookSDKException('Signed request has malformed encoded payload data.', 607);
|
219 |
-
}
|
220 |
-
|
221 |
-
return $payload;
|
222 |
-
}
|
223 |
-
|
224 |
-
/**
|
225 |
-
* Validates the algorithm used in a signed request.
|
226 |
-
*
|
227 |
-
* @throws FacebookSDKException
|
228 |
-
*/
|
229 |
-
protected function validateAlgorithm()
|
230 |
-
{
|
231 |
-
if ($this->get('algorithm') !== 'HMAC-SHA256') {
|
232 |
-
throw new FacebookSDKException('Signed request is using the wrong algorithm.', 605);
|
233 |
-
}
|
234 |
-
}
|
235 |
-
|
236 |
-
/**
|
237 |
-
* Hashes the signature used in a signed request.
|
238 |
-
*
|
239 |
-
* @param string $encodedData
|
240 |
-
*
|
241 |
-
* @return string
|
242 |
-
*
|
243 |
-
* @throws FacebookSDKException
|
244 |
-
*/
|
245 |
-
protected function hashSignature($encodedData)
|
246 |
-
{
|
247 |
-
$hashedSig = hash_hmac(
|
248 |
-
'sha256',
|
249 |
-
$encodedData,
|
250 |
-
$this->app->getSecret(),
|
251 |
-
$raw_output = true
|
252 |
-
);
|
253 |
-
|
254 |
-
if (!$hashedSig) {
|
255 |
-
throw new FacebookSDKException('Unable to hash signature from encoded payload data.', 602);
|
256 |
-
}
|
257 |
-
|
258 |
-
return $hashedSig;
|
259 |
-
}
|
260 |
-
|
261 |
-
/**
|
262 |
-
* Validates the signature used in a signed request.
|
263 |
-
*
|
264 |
-
* @param string $hashedSig
|
265 |
-
* @param string $sig
|
266 |
-
*
|
267 |
-
* @throws FacebookSDKException
|
268 |
-
*/
|
269 |
-
protected function validateSignature($hashedSig, $sig)
|
270 |
-
{
|
271 |
-
if (\hash_equals($hashedSig, $sig)) {
|
272 |
-
return;
|
273 |
-
}
|
274 |
-
|
275 |
-
throw new FacebookSDKException('Signed request has an invalid signature.', 602);
|
276 |
-
}
|
277 |
-
|
278 |
-
/**
|
279 |
-
* Base64 decoding which replaces characters:
|
280 |
-
* + instead of -
|
281 |
-
* / instead of _
|
282 |
-
*
|
283 |
-
* @link http://en.wikipedia.org/wiki/Base64#URL_applications
|
284 |
-
*
|
285 |
-
* @param string $input base64 url encoded input
|
286 |
-
*
|
287 |
-
* @return string decoded string
|
288 |
-
*/
|
289 |
-
public function base64UrlDecode($input)
|
290 |
-
{
|
291 |
-
$urlDecodedBase64 = strtr($input, '-_', '+/');
|
292 |
-
$this->validateBase64($urlDecodedBase64);
|
293 |
-
|
294 |
-
return base64_decode($urlDecodedBase64);
|
295 |
-
}
|
296 |
-
|
297 |
-
/**
|
298 |
-
* Base64 encoding which replaces characters:
|
299 |
-
* + instead of -
|
300 |
-
* / instead of _
|
301 |
-
*
|
302 |
-
* @link http://en.wikipedia.org/wiki/Base64#URL_applications
|
303 |
-
*
|
304 |
-
* @param string $input string to encode
|
305 |
-
*
|
306 |
-
* @return string base64 url encoded input
|
307 |
-
*/
|
308 |
-
public function base64UrlEncode($input)
|
309 |
-
{
|
310 |
-
return strtr(base64_encode($input), '+/', '-_');
|
311 |
-
}
|
312 |
-
|
313 |
-
/**
|
314 |
-
* Validates a base64 string.
|
315 |
-
*
|
316 |
-
* @param string $input base64 value to validate
|
317 |
-
*
|
318 |
-
* @throws FacebookSDKException
|
319 |
-
*/
|
320 |
-
protected function validateBase64($input)
|
321 |
-
{
|
322 |
-
if (!preg_match('/^[a-zA-Z0-9\/\r\n+]*={0,2}$/', $input)) {
|
323 |
-
throw new FacebookSDKException('Signed request contains malformed base64 encoding.', 608);
|
324 |
-
}
|
325 |
-
}
|
326 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/Url/FacebookUrlDetectionHandler.php
DELETED
@@ -1,182 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\Url;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Class FacebookUrlDetectionHandler
|
28 |
-
*
|
29 |
-
* @package Facebook
|
30 |
-
*/
|
31 |
-
class FacebookUrlDetectionHandler implements UrlDetectionInterface
|
32 |
-
{
|
33 |
-
/**
|
34 |
-
* @inheritdoc
|
35 |
-
*/
|
36 |
-
public function getCurrentUrl()
|
37 |
-
{
|
38 |
-
return $this->getHttpScheme() . '://' . $this->getHostName() . $this->getServerVar('REQUEST_URI');
|
39 |
-
}
|
40 |
-
|
41 |
-
/**
|
42 |
-
* Get the currently active URL scheme.
|
43 |
-
*
|
44 |
-
* @return string
|
45 |
-
*/
|
46 |
-
protected function getHttpScheme()
|
47 |
-
{
|
48 |
-
return $this->isBehindSsl() ? 'https' : 'http';
|
49 |
-
}
|
50 |
-
|
51 |
-
/**
|
52 |
-
* Tries to detect if the server is running behind an SSL.
|
53 |
-
*
|
54 |
-
* @return boolean
|
55 |
-
*/
|
56 |
-
protected function isBehindSsl()
|
57 |
-
{
|
58 |
-
// Check for proxy first
|
59 |
-
$protocol = $this->getHeader('X_FORWARDED_PROTO');
|
60 |
-
if ($protocol) {
|
61 |
-
return $this->protocolWithActiveSsl($protocol);
|
62 |
-
}
|
63 |
-
|
64 |
-
$protocol = $this->getServerVar('HTTPS');
|
65 |
-
if ($protocol) {
|
66 |
-
return $this->protocolWithActiveSsl($protocol);
|
67 |
-
}
|
68 |
-
|
69 |
-
return (string)$this->getServerVar('SERVER_PORT') === '443';
|
70 |
-
}
|
71 |
-
|
72 |
-
/**
|
73 |
-
* Detects an active SSL protocol value.
|
74 |
-
*
|
75 |
-
* @param string $protocol
|
76 |
-
*
|
77 |
-
* @return boolean
|
78 |
-
*/
|
79 |
-
protected function protocolWithActiveSsl($protocol)
|
80 |
-
{
|
81 |
-
$protocol = strtolower((string)$protocol);
|
82 |
-
|
83 |
-
return in_array($protocol, ['on', '1', 'https', 'ssl'], true);
|
84 |
-
}
|
85 |
-
|
86 |
-
/**
|
87 |
-
* Tries to detect the host name of the server.
|
88 |
-
*
|
89 |
-
* Some elements adapted from
|
90 |
-
*
|
91 |
-
* @see https://github.com/symfony/HttpFoundation/blob/master/Request.php
|
92 |
-
*
|
93 |
-
* @return string
|
94 |
-
*/
|
95 |
-
protected function getHostName()
|
96 |
-
{
|
97 |
-
// Check for proxy first
|
98 |
-
$header = $this->getHeader('X_FORWARDED_HOST');
|
99 |
-
if ($header && $this->isValidForwardedHost($header)) {
|
100 |
-
$elements = explode(',', $header);
|
101 |
-
$host = $elements[count($elements) - 1];
|
102 |
-
} elseif (!$host = $this->getHeader('HOST')) {
|
103 |
-
if (!$host = $this->getServerVar('SERVER_NAME')) {
|
104 |
-
$host = $this->getServerVar('SERVER_ADDR');
|
105 |
-
}
|
106 |
-
}
|
107 |
-
|
108 |
-
// trim and remove port number from host
|
109 |
-
// host is lowercase as per RFC 952/2181
|
110 |
-
$host = strtolower(preg_replace('/:\d+$/', '', trim($host)));
|
111 |
-
|
112 |
-
// Port number
|
113 |
-
$scheme = $this->getHttpScheme();
|
114 |
-
$port = $this->getCurrentPort();
|
115 |
-
$appendPort = ':' . $port;
|
116 |
-
|
117 |
-
// Don't append port number if a normal port.
|
118 |
-
if (($scheme == 'http' && $port == '80') || ($scheme == 'https' && $port == '443')) {
|
119 |
-
$appendPort = '';
|
120 |
-
}
|
121 |
-
|
122 |
-
return $host . $appendPort;
|
123 |
-
}
|
124 |
-
|
125 |
-
protected function getCurrentPort()
|
126 |
-
{
|
127 |
-
// Check for proxy first
|
128 |
-
$port = $this->getHeader('X_FORWARDED_PORT');
|
129 |
-
if ($port) {
|
130 |
-
return (string)$port;
|
131 |
-
}
|
132 |
-
|
133 |
-
$protocol = (string)$this->getHeader('X_FORWARDED_PROTO');
|
134 |
-
if ($protocol === 'https') {
|
135 |
-
return '443';
|
136 |
-
}
|
137 |
-
|
138 |
-
return (string)$this->getServerVar('SERVER_PORT');
|
139 |
-
}
|
140 |
-
|
141 |
-
/**
|
142 |
-
* Returns the a value from the $_SERVER super global.
|
143 |
-
*
|
144 |
-
* @param string $key
|
145 |
-
*
|
146 |
-
* @return string
|
147 |
-
*/
|
148 |
-
protected function getServerVar($key)
|
149 |
-
{
|
150 |
-
return isset($_SERVER[$key]) ? $_SERVER[$key] : '';
|
151 |
-
}
|
152 |
-
|
153 |
-
/**
|
154 |
-
* Gets a value from the HTTP request headers.
|
155 |
-
*
|
156 |
-
* @param string $key
|
157 |
-
*
|
158 |
-
* @return string
|
159 |
-
*/
|
160 |
-
protected function getHeader($key)
|
161 |
-
{
|
162 |
-
return $this->getServerVar('HTTP_' . $key);
|
163 |
-
}
|
164 |
-
|
165 |
-
/**
|
166 |
-
* Checks if the value in X_FORWARDED_HOST is a valid hostname
|
167 |
-
* Could prevent unintended redirections
|
168 |
-
*
|
169 |
-
* @param string $header
|
170 |
-
*
|
171 |
-
* @return boolean
|
172 |
-
*/
|
173 |
-
protected function isValidForwardedHost($header)
|
174 |
-
{
|
175 |
-
$elements = explode(',', $header);
|
176 |
-
$host = $elements[count($elements) - 1];
|
177 |
-
|
178 |
-
return preg_match("/^([a-z\d](-*[a-z\d])*)(\.([a-z\d](-*[a-z\d])*))*$/i", $host) //valid chars check
|
179 |
-
&& 0 < strlen($host) && strlen($host) < 254 //overall length check
|
180 |
-
&& preg_match("/^[^\.]{1,63}(\.[^\.]{1,63})*$/", $host); //length of each label
|
181 |
-
}
|
182 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/Url/FacebookUrlManipulator.php
DELETED
@@ -1,167 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\Url;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Class FacebookUrlManipulator
|
28 |
-
*
|
29 |
-
* @package Facebook
|
30 |
-
*/
|
31 |
-
class FacebookUrlManipulator
|
32 |
-
{
|
33 |
-
/**
|
34 |
-
* Remove params from a URL.
|
35 |
-
*
|
36 |
-
* @param string $url The URL to filter.
|
37 |
-
* @param array $paramsToFilter The params to filter from the URL.
|
38 |
-
*
|
39 |
-
* @return string The URL with the params removed.
|
40 |
-
*/
|
41 |
-
public static function removeParamsFromUrl($url, array $paramsToFilter)
|
42 |
-
{
|
43 |
-
$parts = parse_url($url);
|
44 |
-
|
45 |
-
$query = '';
|
46 |
-
if (isset($parts['query'])) {
|
47 |
-
$params = [];
|
48 |
-
parse_str($parts['query'], $params);
|
49 |
-
|
50 |
-
// Remove query params
|
51 |
-
foreach ($paramsToFilter as $paramName) {
|
52 |
-
unset($params[$paramName]);
|
53 |
-
}
|
54 |
-
|
55 |
-
if (count($params) > 0) {
|
56 |
-
$query = '?' . http_build_query($params, null, '&');
|
57 |
-
}
|
58 |
-
}
|
59 |
-
|
60 |
-
$scheme = isset($parts['scheme']) ? $parts['scheme'] . '://' : '';
|
61 |
-
$host = isset($parts['host']) ? $parts['host'] : '';
|
62 |
-
$port = isset($parts['port']) ? ':' . $parts['port'] : '';
|
63 |
-
$path = isset($parts['path']) ? $parts['path'] : '';
|
64 |
-
$fragment = isset($parts['fragment']) ? '#' . $parts['fragment'] : '';
|
65 |
-
|
66 |
-
return $scheme . $host . $port . $path . $query . $fragment;
|
67 |
-
}
|
68 |
-
|
69 |
-
/**
|
70 |
-
* Gracefully appends params to the URL.
|
71 |
-
*
|
72 |
-
* @param string $url The URL that will receive the params.
|
73 |
-
* @param array $newParams The params to append to the URL.
|
74 |
-
*
|
75 |
-
* @return string
|
76 |
-
*/
|
77 |
-
public static function appendParamsToUrl($url, array $newParams = [])
|
78 |
-
{
|
79 |
-
if (empty($newParams)) {
|
80 |
-
return $url;
|
81 |
-
}
|
82 |
-
|
83 |
-
if (strpos($url, '?') === false) {
|
84 |
-
return $url . '?' . http_build_query($newParams, null, '&');
|
85 |
-
}
|
86 |
-
|
87 |
-
list($path, $query) = explode('?', $url, 2);
|
88 |
-
$existingParams = [];
|
89 |
-
parse_str($query, $existingParams);
|
90 |
-
|
91 |
-
// Favor params from the original URL over $newParams
|
92 |
-
$newParams = array_merge($newParams, $existingParams);
|
93 |
-
|
94 |
-
// Sort for a predicable order
|
95 |
-
ksort($newParams);
|
96 |
-
|
97 |
-
return $path . '?' . http_build_query($newParams, null, '&');
|
98 |
-
}
|
99 |
-
|
100 |
-
/**
|
101 |
-
* Returns the params from a URL in the form of an array.
|
102 |
-
*
|
103 |
-
* @param string $url The URL to parse the params from.
|
104 |
-
*
|
105 |
-
* @return array
|
106 |
-
*/
|
107 |
-
public static function getParamsAsArray($url)
|
108 |
-
{
|
109 |
-
$query = parse_url($url, PHP_URL_QUERY);
|
110 |
-
if (!$query) {
|
111 |
-
return [];
|
112 |
-
}
|
113 |
-
$params = [];
|
114 |
-
parse_str($query, $params);
|
115 |
-
|
116 |
-
return $params;
|
117 |
-
}
|
118 |
-
|
119 |
-
/**
|
120 |
-
* Adds the params of the first URL to the second URL.
|
121 |
-
*
|
122 |
-
* Any params that already exist in the second URL will go untouched.
|
123 |
-
*
|
124 |
-
* @param string $urlToStealFrom The URL harvest the params from.
|
125 |
-
* @param string $urlToAddTo The URL that will receive the new params.
|
126 |
-
*
|
127 |
-
* @return string The $urlToAddTo with any new params from $urlToStealFrom.
|
128 |
-
*/
|
129 |
-
public static function mergeUrlParams($urlToStealFrom, $urlToAddTo)
|
130 |
-
{
|
131 |
-
$newParams = static::getParamsAsArray($urlToStealFrom);
|
132 |
-
// Nothing new to add, return as-is
|
133 |
-
if (!$newParams) {
|
134 |
-
return $urlToAddTo;
|
135 |
-
}
|
136 |
-
|
137 |
-
return static::appendParamsToUrl($urlToAddTo, $newParams);
|
138 |
-
}
|
139 |
-
|
140 |
-
/**
|
141 |
-
* Check for a "/" prefix and prepend it if not exists.
|
142 |
-
*
|
143 |
-
* @param string|null $string
|
144 |
-
*
|
145 |
-
* @return string|null
|
146 |
-
*/
|
147 |
-
public static function forceSlashPrefix($string)
|
148 |
-
{
|
149 |
-
if (!$string) {
|
150 |
-
return $string;
|
151 |
-
}
|
152 |
-
|
153 |
-
return strpos($string, '/') === 0 ? $string : '/' . $string;
|
154 |
-
}
|
155 |
-
|
156 |
-
/**
|
157 |
-
* Trims off the hostname and Graph version from a URL.
|
158 |
-
*
|
159 |
-
* @param string $urlToTrim The URL the needs the surgery.
|
160 |
-
*
|
161 |
-
* @return string The $urlToTrim with the hostname and Graph version removed.
|
162 |
-
*/
|
163 |
-
public static function baseGraphUrlEndpoint($urlToTrim)
|
164 |
-
{
|
165 |
-
return '/' . preg_replace('/^https:\/\/.+\.facebook\.com(\/v.+?)?\//', '', $urlToTrim);
|
166 |
-
}
|
167 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/Url/UrlDetectionInterface.php
DELETED
@@ -1,39 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\Url;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Interface UrlDetectionInterface
|
28 |
-
*
|
29 |
-
* @package Facebook
|
30 |
-
*/
|
31 |
-
interface UrlDetectionInterface
|
32 |
-
{
|
33 |
-
/**
|
34 |
-
* Get the currently active URL.
|
35 |
-
*
|
36 |
-
* @return string
|
37 |
-
*/
|
38 |
-
public function getCurrentUrl();
|
39 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/autoload.php
DELETED
@@ -1,81 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
|
25 |
-
/**
|
26 |
-
* You only need this file if you are not using composer.
|
27 |
-
* Why are you not using composer?
|
28 |
-
* https://getcomposer.org/
|
29 |
-
*/
|
30 |
-
|
31 |
-
if (version_compare(PHP_VERSION, '5.4.0', '<')) {
|
32 |
-
throw new Exception('The Facebook SDK requires PHP version 5.4 or higher.');
|
33 |
-
}
|
34 |
-
|
35 |
-
require_once __DIR__ . '/polyfills.php';
|
36 |
-
|
37 |
-
/**
|
38 |
-
* Register the autoloader for the Facebook SDK classes.
|
39 |
-
*
|
40 |
-
* Based off the official PSR-4 autoloader example found here:
|
41 |
-
* https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader-examples.md
|
42 |
-
*
|
43 |
-
* @param string $class The fully-qualified class name.
|
44 |
-
*
|
45 |
-
* @return void
|
46 |
-
*/
|
47 |
-
spl_autoload_register(function ($class) {
|
48 |
-
// project-specific namespace prefix
|
49 |
-
$prefix = 'Facebook\\';
|
50 |
-
|
51 |
-
// For backwards compatibility
|
52 |
-
$customBaseDir = '';
|
53 |
-
// @todo v6: Remove support for 'FACEBOOK_SDK_V4_SRC_DIR'
|
54 |
-
if (defined('FACEBOOK_SDK_V4_SRC_DIR')) {
|
55 |
-
$customBaseDir = FACEBOOK_SDK_V4_SRC_DIR;
|
56 |
-
} elseif (defined('FACEBOOK_SDK_SRC_DIR')) {
|
57 |
-
$customBaseDir = FACEBOOK_SDK_SRC_DIR;
|
58 |
-
}
|
59 |
-
// base directory for the namespace prefix
|
60 |
-
$baseDir = $customBaseDir ?: __DIR__ . '/';
|
61 |
-
|
62 |
-
// does the class use the namespace prefix?
|
63 |
-
$len = strlen($prefix);
|
64 |
-
if (strncmp($prefix, $class, $len) !== 0) {
|
65 |
-
// no, move to the next registered autoloader
|
66 |
-
return;
|
67 |
-
}
|
68 |
-
|
69 |
-
// get the relative class name
|
70 |
-
$relativeClass = substr($class, $len);
|
71 |
-
|
72 |
-
// replace the namespace prefix with the base directory, replace namespace
|
73 |
-
// separators with directory separators in the relative class name, append
|
74 |
-
// with .php
|
75 |
-
$file = rtrim($baseDir, '/') . '/' . str_replace('\\', '/', $relativeClass) . '.php';
|
76 |
-
|
77 |
-
// if the file exists, require it
|
78 |
-
if (file_exists($file)) {
|
79 |
-
require $file;
|
80 |
-
}
|
81 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/php-sdk-v4/src/Facebook/polyfills.php
DELETED
@@ -1,49 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2016 Facebook, Inc.
|
4 |
-
*
|
5 |
-
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
-
* use, copy, modify, and distribute this software in source code or binary
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
|
25 |
-
/**
|
26 |
-
* @see https://github.com/sarciszewski/php-future/blob/master/src/Security.php#L37-L51
|
27 |
-
*/
|
28 |
-
if (!function_exists('hash_equals')) {
|
29 |
-
function hash_equals($knownString, $userString)
|
30 |
-
{
|
31 |
-
if (function_exists('mb_strlen')) {
|
32 |
-
$kLen = mb_strlen($knownString, '8bit');
|
33 |
-
$uLen = mb_strlen($userString, '8bit');
|
34 |
-
} else {
|
35 |
-
$kLen = strlen($knownString);
|
36 |
-
$uLen = strlen($userString);
|
37 |
-
}
|
38 |
-
if ($kLen !== $uLen) {
|
39 |
-
return false;
|
40 |
-
}
|
41 |
-
$result = 0;
|
42 |
-
for ($i = 0; $i < $kLen; $i++) {
|
43 |
-
$result |= (ord($knownString[$i]) ^ ord($userString[$i]));
|
44 |
-
}
|
45 |
-
|
46 |
-
// They are only identical strings if $result is exactly 0...
|
47 |
-
return 0 === $result;
|
48 |
-
}
|
49 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|