Instant Articles for WP - Version 3.2

Version Description

  • Adds development mode support to post meta box (props simonengelhardt)
  • Adds rule configuration for Instagram blockquotes (props everton-rosario)
  • Adds rules for galleries (props everton-rosario)
  • Migrates some unit tests (props everton-rosario)
  • Switches to Facebook Graph SDK (props everton-rosario)
  • Improves token invalidation flow (props everton-rosario)
  • Fixes use of the_title filter (props srtfisher)
  • Improves encoding handling (props yssk22)
  • Adds post type filter to the post meta box (props technosailor)
  • Adds Playbuzz support (props everton-rosario)
  • Rename SDK getter to avert apocalypse (props diegoquinteiro)
  • Wizard copy improvements (props demoive)
  • Fixes issue with captions (props everton-rosario)
  • Adds publication block for articles with transformation warnings (props everton-rosario)
  • Fix https src attribute on some scripts (props goldenapples)
Download this release

Release Info

Developer philipjohn
Plugin Icon 128x128 Instant Articles for WP
Version 3.2
Comparing to
See all releases

Code changes from version 3.1.3 to 3.2

Files changed (112) hide show
  1. class-instant-articles-post.php +4 -36
  2. class-instant-articles-publisher.php +6 -2
  3. compat.php +8 -6
  4. compat/class-instant-articles-playbuzz.php +27 -0
  5. compat/playbuzz-rules-configuration.json +23 -0
  6. css/instant-articles-meta-box.css +6 -0
  7. css/instant-articles-wizard.css +15 -6
  8. facebook-instant-articles.php +1 -1
  9. js/instant-articles-meta-box.js +14 -0
  10. js/instant-articles-wizard.js +5 -6
  11. meta-box/class-instant-articles-meta-box.php +31 -3
  12. meta-box/meta-box-template.php +14 -0
  13. readme.txt +18 -1
  14. rules-configuration.json +49 -3
  15. vendor/autoload.php +1 -1
  16. vendor/composer/autoload_files.php +1 -1
  17. vendor/composer/autoload_psr4.php +1 -1
  18. vendor/composer/autoload_real.php +7 -7
  19. vendor/composer/autoload_static.php +6 -6
  20. vendor/composer/installed.json +11 -12
  21. vendor/facebook/facebook-instant-articles-sdk-php/composer.json +0 -47
  22. vendor/facebook/facebook-instant-articles-sdk-php/composer.lock +0 -1245
  23. vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/ElementGetter.php +1 -1
  24. vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/InstantArticleRule.php +0 -1
  25. vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/TimeRule.php +0 -1
  26. vendor/facebook/graph-sdk/LICENSE +19 -0
  27. vendor/facebook/graph-sdk/composer.json +41 -0
  28. vendor/facebook/graph-sdk/phpcs.xml.dist +7 -0
  29. vendor/facebook/graph-sdk/src/Facebook/Authentication/AccessToken.php +160 -0
  30. vendor/facebook/graph-sdk/src/Facebook/Authentication/AccessTokenMetadata.php +390 -0
  31. vendor/facebook/graph-sdk/src/Facebook/Authentication/OAuth2Client.php +292 -0
  32. vendor/facebook/graph-sdk/src/Facebook/Exceptions/FacebookAuthenticationException.php +33 -0
  33. vendor/facebook/graph-sdk/src/Facebook/Exceptions/FacebookAuthorizationException.php +33 -0
  34. vendor/facebook/graph-sdk/src/Facebook/Exceptions/FacebookClientException.php +33 -0
  35. vendor/facebook/graph-sdk/src/Facebook/Exceptions/FacebookOtherException.php +33 -0
  36. vendor/facebook/graph-sdk/src/Facebook/Exceptions/FacebookResponseException.php +214 -0
  37. vendor/facebook/graph-sdk/src/Facebook/Exceptions/FacebookResumableUploadException.php +33 -0
  38. vendor/facebook/graph-sdk/src/Facebook/Exceptions/FacebookSDKException.php +33 -0
  39. vendor/facebook/graph-sdk/src/Facebook/Exceptions/FacebookServerException.php +33 -0
  40. vendor/facebook/graph-sdk/src/Facebook/Exceptions/FacebookThrottleException.php +33 -0
  41. vendor/facebook/graph-sdk/src/Facebook/Facebook.php +614 -0
  42. vendor/facebook/graph-sdk/src/Facebook/FacebookApp.php +110 -0
  43. vendor/facebook/graph-sdk/src/Facebook/FacebookBatchRequest.php +303 -0
  44. vendor/facebook/graph-sdk/src/Facebook/FacebookBatchResponse.php +174 -0
  45. vendor/facebook/graph-sdk/src/Facebook/FacebookClient.php +250 -0
  46. vendor/facebook/graph-sdk/src/Facebook/FacebookRequest.php +534 -0
  47. vendor/facebook/graph-sdk/src/Facebook/FacebookResponse.php +410 -0
  48. vendor/facebook/graph-sdk/src/Facebook/FileUpload/FacebookFile.php +169 -0
  49. vendor/facebook/graph-sdk/src/Facebook/FileUpload/FacebookResumableUploader.php +167 -0
  50. vendor/facebook/graph-sdk/src/Facebook/FileUpload/FacebookTransferChunk.php +133 -0
  51. vendor/facebook/graph-sdk/src/Facebook/FileUpload/FacebookVideo.php +33 -0
  52. vendor/facebook/graph-sdk/src/Facebook/FileUpload/Mimetypes.php +987 -0
  53. vendor/facebook/graph-sdk/src/Facebook/GraphNodes/Birthday.php +85 -0
  54. vendor/facebook/graph-sdk/src/Facebook/GraphNodes/Collection.php +242 -0
  55. vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphAchievement.php +113 -0
  56. vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphAlbum.php +183 -0
  57. vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphApplication.php +43 -0
  58. vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphCoverPhoto.php +72 -0
  59. vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphEdge.php +238 -0
  60. vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphEvent.php +242 -0
  61. vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphGroup.php +170 -0
  62. vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphList.php +36 -0
  63. vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphLocation.php +102 -0
  64. vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphNode.php +197 -0
  65. vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphNodeFactory.php +392 -0
  66. vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphObject.php +36 -0
  67. vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphObjectFactory.php +88 -0
  68. vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphPage.php +125 -0
  69. vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphPicture.php +72 -0
  70. vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphSessionInfo.php +102 -0
  71. vendor/facebook/graph-sdk/src/Facebook/GraphNodes/GraphUser.php +172 -0
  72. vendor/facebook/graph-sdk/src/Facebook/Helpers/FacebookCanvasHelper.php +52 -0
  73. vendor/facebook/graph-sdk/src/Facebook/Helpers/FacebookJavaScriptHelper.php +42 -0
  74. vendor/facebook/graph-sdk/src/Facebook/Helpers/FacebookPageTabHelper.php +95 -0
  75. vendor/facebook/graph-sdk/src/Facebook/Helpers/FacebookRedirectLoginHelper.php +333 -0
  76. vendor/facebook/graph-sdk/src/Facebook/Helpers/FacebookSignedRequestFromInputHelper.php +166 -0
  77. vendor/facebook/graph-sdk/src/Facebook/Http/GraphRawResponse.php +137 -0
  78. vendor/facebook/graph-sdk/src/Facebook/Http/RequestBodyInterface.php +39 -0
  79. vendor/facebook/graph-sdk/src/Facebook/Http/RequestBodyMultipart.php +170 -0
  80. vendor/facebook/graph-sdk/src/Facebook/Http/RequestBodyUrlEncoded.php +55 -0
  81. vendor/facebook/graph-sdk/src/Facebook/HttpClients/FacebookCurl.php +129 -0
  82. vendor/facebook/graph-sdk/src/Facebook/HttpClients/FacebookCurlHttpClient.php +163 -0
  83. vendor/facebook/graph-sdk/src/Facebook/HttpClients/FacebookGuzzleHttpClient.php +97 -0
  84. vendor/facebook/graph-sdk/src/Facebook/HttpClients/FacebookHttpClientInterface.php +47 -0
  85. vendor/facebook/graph-sdk/src/Facebook/HttpClients/FacebookStream.php +80 -0
  86. vendor/facebook/graph-sdk/src/Facebook/HttpClients/FacebookStreamHttpClient.php +94 -0
  87. vendor/facebook/graph-sdk/src/Facebook/HttpClients/HttpClientsFactory.php +99 -0
  88. vendor/facebook/graph-sdk/src/Facebook/HttpClients/certs/DigiCertHighAssuranceEVRootCA.pem +23 -0
  89. vendor/facebook/graph-sdk/src/Facebook/PersistentData/FacebookMemoryPersistentDataHandler.php +53 -0
  90. vendor/facebook/graph-sdk/src/Facebook/PersistentData/FacebookSessionPersistentDataHandler.php +76 -0
  91. vendor/facebook/graph-sdk/src/Facebook/PersistentData/PersistentDataFactory.php +65 -0
  92. vendor/facebook/graph-sdk/src/Facebook/PersistentData/PersistentDataInterface.php +49 -0
  93. vendor/facebook/graph-sdk/src/Facebook/PseudoRandomString/McryptPseudoRandomStringGenerator.php +68 -0
  94. vendor/facebook/graph-sdk/src/Facebook/PseudoRandomString/OpenSslPseudoRandomStringGenerator.php +67 -0
  95. vendor/facebook/graph-sdk/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorFactory.php +93 -0
  96. vendor/facebook/graph-sdk/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorInterface.php +45 -0
  97. vendor/facebook/graph-sdk/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorTrait.php +58 -0
  98. vendor/facebook/graph-sdk/src/Facebook/PseudoRandomString/UrandomPseudoRandomStringGenerator.php +89 -0
  99. vendor/facebook/graph-sdk/src/Facebook/SignedRequest.php +326 -0
  100. vendor/facebook/graph-sdk/src/Facebook/Url/FacebookUrlDetectionHandler.php +182 -0
  101. vendor/facebook/graph-sdk/src/Facebook/Url/FacebookUrlManipulator.php +167 -0
  102. vendor/facebook/graph-sdk/src/Facebook/Url/UrlDetectionInterface.php +39 -0
  103. vendor/facebook/graph-sdk/src/Facebook/autoload.php +81 -0
  104. vendor/facebook/graph-sdk/src/Facebook/polyfills.php +49 -0
  105. wizard/class-instant-articles-option-publishing.php +4 -4
  106. wizard/class-instant-articles-wizard.php +95 -66
  107. wizard/templates/app-setup-template.php +5 -5
  108. wizard/templates/overview-template.php +1 -1
  109. wizard/templates/page-selection-template.php +3 -5
  110. wizard/templates/review-submission-template.php +53 -19
  111. wizard/templates/style-selection-template.php +3 -3
  112. wizard/templates/wizard-template.php +11 -8
class-instant-articles-post.php CHANGED
@@ -86,12 +86,13 @@ class Instant_Articles_Post {
86
  $title = $this->_post->post_title;
87
 
88
  /**
89
- * Apply the default filter 'the_title' for the post tite.
90
  *
91
  * @since 3.1
92
  * @param string $title The current post title.
 
93
  */
94
- $title = apply_filters( 'the_title', $title);
95
 
96
  /**
97
  * Filter the post title for use in instant articles.
@@ -682,40 +683,7 @@ class Instant_Articles_Post {
682
  $this->instant_article->withStyle( 'default' );
683
  }
684
 
685
- $libxml_previous_state = libxml_use_internal_errors( true );
686
- $document = new DOMDocument( '1.0', get_option( 'blog_charset' ) );
687
- $content = $this->get_the_content();
688
-
689
- // DOMDocument isn’t handling encodings too well, so let’s help it a little.
690
- if ( function_exists( 'mb_convert_encoding' ) ) {
691
- $content = mb_convert_encoding( $content, 'HTML-ENTITIES', get_option( 'blog_charset' ) );
692
- } else {
693
- $content = htmlspecialchars_decode( utf8_decode( htmlentities( $content, ENT_COMPAT, 'utf-8', false ) ) );
694
- }
695
-
696
- $result = $document->loadHTML( '<!doctype html><html><body>' . $content . '</body></html>' );
697
-
698
- // We need to make sure that scripts use absolute URLs and not relative URLs.
699
- $scripts = $document->getElementsByTagName('script');
700
- if ( ! empty( $scripts ) ) {
701
- foreach ( $scripts as $script ){
702
- $src = $script->getAttribute( 'src' );
703
- $explode_src = parse_url( $src );
704
- if ( is_array( $explode_src ) && empty( $explode_src['scheme'] ) && ! empty( $explode_src['host'] ) && ! empty( $explode_src['path'] ) ) {
705
- $src = 'https://' . $explode_src['host'] . $explode_src['path'];
706
- }
707
- $script->setAttribute( 'src' , $src );
708
- }
709
- }
710
-
711
- libxml_clear_errors();
712
- libxml_use_internal_errors( $libxml_previous_state );
713
-
714
- $document = apply_filters( 'instant_articles_parsed_document', $document );
715
-
716
- if ( $result ) {
717
- $transformer->transform( $this->instant_article, $document );
718
- }
719
 
720
  $this->add_ads_from_settings();
721
  $this->add_analytics_from_settings();
86
  $title = $this->_post->post_title;
87
 
88
  /**
89
+ * Apply the default filter 'the_title' for the post title.
90
  *
91
  * @since 3.1
92
  * @param string $title The current post title.
93
+ * @param int $id The current post ID.
94
  */
95
+ $title = apply_filters( 'the_title', $title, $this->_post->ID );
96
 
97
  /**
98
  * Filter the post title for use in instant articles.
683
  $this->instant_article->withStyle( 'default' );
684
  }
685
 
686
+ $transformer->transformString( $this->instant_article, $this->get_the_content(), get_option( 'blog_charset' ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
687
 
688
  $this->add_ads_from_settings();
689
  $this->add_analytics_from_settings();
class-instant-articles-publisher.php CHANGED
@@ -21,6 +21,7 @@ class Instant_Articles_Publisher {
21
  * Key to store the submission status ID on meta data
22
  */
23
  const SUBMISSION_ID_KEY = 'instant_articles_submission_id';
 
24
 
25
  /**
26
  * Inits publisher.
@@ -71,6 +72,7 @@ class Instant_Articles_Publisher {
71
  $fb_app_settings = Instant_Articles_Option_FB_App::get_option_decoded();
72
  $fb_page_settings = Instant_Articles_Option_FB_Page::get_option_decoded();
73
  $publishing_settings = Instant_Articles_Option_Publishing::get_option_decoded();
 
74
 
75
  $dev_mode = isset( $publishing_settings['dev_mode'] )
76
  ? ( $publishing_settings['dev_mode'] ? true : false )
@@ -99,12 +101,14 @@ class Instant_Articles_Publisher {
99
 
100
  // Don't process if contains warnings and blocker flag for transformation warnings is turned on.
101
  if ( count( $adapter->transformer->getWarnings() ) > 0
102
- && isset( $publishing_settings['block_publish_with_warnings'] )
103
- && $publishing_settings['block_publish_with_warnings'] ) {
 
104
 
105
  // Unpublishes if already published
106
  $client->removeArticle( $article->getCanonicalURL() );
107
  delete_post_meta( $post_id, self::SUBMISSION_ID_KEY );
 
108
  return;
109
  }
110
 
21
  * Key to store the submission status ID on meta data
22
  */
23
  const SUBMISSION_ID_KEY = 'instant_articles_submission_id';
24
+ const FORCE_SUBMIT_KEY = 'instant_articles_force_submit';
25
 
26
  /**
27
  * Inits publisher.
72
  $fb_app_settings = Instant_Articles_Option_FB_App::get_option_decoded();
73
  $fb_page_settings = Instant_Articles_Option_FB_Page::get_option_decoded();
74
  $publishing_settings = Instant_Articles_Option_Publishing::get_option_decoded();
75
+ $force_submit = get_post_meta( $post_id, self::FORCE_SUBMIT_KEY, true );
76
 
77
  $dev_mode = isset( $publishing_settings['dev_mode'] )
78
  ? ( $publishing_settings['dev_mode'] ? true : false )
101
 
102
  // Don't process if contains warnings and blocker flag for transformation warnings is turned on.
103
  if ( count( $adapter->transformer->getWarnings() ) > 0
104
+ && ( ! isset( $publishing_settings[ 'publish_with_warnings' ] ) || ! $publishing_settings[ 'publish_with_warnings' ] )
105
+ && ( ! $force_submit )
106
+ ) {
107
 
108
  // Unpublishes if already published
109
  $client->removeArticle( $article->getCanonicalURL() );
110
  delete_post_meta( $post_id, self::SUBMISSION_ID_KEY );
111
+
112
  return;
113
  }
114
 
compat.php CHANGED
@@ -7,11 +7,6 @@
7
  * @package default
8
  */
9
 
10
- if ( !function_exists( 'is_plugin_active' ) ) {
11
- require_once ( ABSPATH . '/wp-admin/includes/plugin.php' );
12
- }
13
-
14
-
15
  // Load compat layer for Co-Authors Plus.
16
  if ( function_exists( 'get_coauthors' ) && ! defined( 'CAP_IA_COMPAT' ) ) {
17
  include( dirname( __FILE__ ) . '/compat/class-instant-articles-co-authors-plus.php' );
@@ -41,8 +36,15 @@ if ( defined( 'JETPACK__VERSION' ) ) {
41
  }
42
 
43
  // Load support for Get The Image plugin
44
- if ( is_plugin_active( 'get-the-image/get-the-image.php' ) ) {
45
  include( dirname( __FILE__ ) . '/compat/class-instant-articles-get-the-image.php' );
46
  $gti = new Instant_Articles_Get_The_Image;
47
  $gti->init();
48
  }
 
 
 
 
 
 
 
7
  * @package default
8
  */
9
 
 
 
 
 
 
10
  // Load compat layer for Co-Authors Plus.
11
  if ( function_exists( 'get_coauthors' ) && ! defined( 'CAP_IA_COMPAT' ) ) {
12
  include( dirname( __FILE__ ) . '/compat/class-instant-articles-co-authors-plus.php' );
36
  }
37
 
38
  // Load support for Get The Image plugin
39
+ if ( function_exists( 'get_the_image' ) ) {
40
  include( dirname( __FILE__ ) . '/compat/class-instant-articles-get-the-image.php' );
41
  $gti = new Instant_Articles_Get_The_Image;
42
  $gti->init();
43
  }
44
+
45
+ // Load support for Playbuzz plugin
46
+ if ( function_exists( 'playbuzz_settings_link' ) ) {
47
+ include( dirname( __FILE__ ) . '/compat/class-instant-articles-playbuzz.php' );
48
+ $playbuzz = new Instant_Articles_Playbuzz;
49
+ $playbuzz->init();
50
+ }
compat/class-instant-articles-playbuzz.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Support class for Playbuzz
5
+ *
6
+ * @since 3.1.1
7
+ *
8
+ */
9
+ class Instant_Articles_Playbuzz {
10
+
11
+ /**
12
+ * Init the compat layer
13
+ *
14
+ */
15
+ function init() {
16
+ add_filter( 'instant_articles_transformer_rules_loaded', array( 'Instant_Articles_Playbuzz', 'transformer_loaded' ) );
17
+ }
18
+
19
+ public static function transformer_loaded( $transformer ) {
20
+ // Appends more rules to transformer
21
+ $file_path = plugin_dir_path( __FILE__ ) . 'playbuzz-rules-configuration.json';
22
+ $configuration = file_get_contents( $file_path );
23
+ $transformer->loadRules( $configuration );
24
+
25
+ return $transformer;
26
+ }
27
+ }
compat/playbuzz-rules-configuration.json ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "rules": [{
3
+ "class" : "IgnoreRule",
4
+ "selector": "//p/script[contains(@src,'playbuzz')]"
5
+ }, {
6
+ "class": "InteractiveRule",
7
+ "selector" : "div.pb_feed",
8
+ "properties" : {
9
+ "interactive.iframe" : {
10
+ "type" : "multiple",
11
+ "children": [{
12
+ "type": "fragment",
13
+ "fragment": "<script type='text/javascript' src='//cdn.playbuzz.com/widget/feed.js'></script>"
14
+ }, {
15
+ "type": "element",
16
+ "selector": "div.pb_feed"
17
+ }
18
+ ]
19
+ }
20
+ }
21
+ }
22
+ ]
23
+ }
css/instant-articles-meta-box.css CHANGED
@@ -1,3 +1,9 @@
 
 
 
 
 
 
1
  .instant-articles-messages {
2
  margin-left: 15px;
3
  margin-top: 0px;
1
+ .instant-articles-dev-mode-indicator {
2
+ float: right;
3
+ text-decoration: none;
4
+ font-size: smaller;
5
+ }
6
+
7
  .instant-articles-messages {
8
  margin-left: 15px;
9
  margin-top: 0px;
css/instant-articles-wizard.css CHANGED
@@ -350,18 +350,27 @@ a.instant-articles-button {
350
  font-weight: bold;
351
  }
352
  .instant-articles-advanced-settings {
353
- text-decoration: none;
354
  font-weight: bold;
355
  margin-top: 20px;
356
- display: block;
357
  }
358
- .instant-articles-advanced-settings:active,
359
- .instant-articles-advanced-settings:focus {
 
 
360
  outline: none;
361
  box-shadow: none;
362
  }
363
-
364
- .instant-articles-wizard-advanced-settings-box {
 
 
 
 
 
 
 
 
 
365
  display: none;
366
  }
367
 
350
  font-weight: bold;
351
  }
352
  .instant-articles-advanced-settings {
 
353
  font-weight: bold;
354
  margin-top: 20px;
 
355
  }
356
+ .instant-articles-wizard-toggle a,
357
+ .instant-articles-wizard-toggle a:active,
358
+ .instant-articles-wizard-toggle a:focus {
359
+ text-decoration: none;
360
  outline: none;
361
  box-shadow: none;
362
  }
363
+ .instant-articles-wizard-toggle-opened::before {
364
+ content: "▼ ";
365
+ }
366
+ .instant-articles-wizard-toggle-closed::before {
367
+ content: "▶︎ ";
368
+ }
369
+ .instant-articles-advanced-settings[data-state='opened'] .instant-articles-wizard-toggle-closed {
370
+ display: none;
371
+ }
372
+ .instant-articles-advanced-settings[data-state='closed'] .instant-articles-wizard-toggle-opened,
373
+ .instant-articles-advanced-settings[data-state='closed'] + .instant-articles-wizard-advanced-settings-box {
374
  display: none;
375
  }
376
 
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.1.3
8
  * Text Domain: instant-articles
9
  * License: GPLv2
10
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
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
js/instant-articles-meta-box.js CHANGED
@@ -1,3 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
1
  function instant_articles_load_meta_box ( post_ID ) {
2
  jQuery( document ).ready( function( $ ) {
3
  var data = {
@@ -6,6 +17,9 @@ function instant_articles_load_meta_box ( post_ID ) {
6
  };
7
  jQuery.post( ajaxurl, data, function(response) {
8
  jQuery( '#instant_article_meta_box .inside' ).html( response );
 
 
 
9
  }, 'html' );
10
  jQuery( '#instant_article_meta_box' ).delegate( '.instant-articles-toggle-debug', 'click', function () {
11
  jQuery( '#instant_article_meta_box' ).toggleClass( 'instant-articles-show-debug' );
1
+ function instant_articles_force_submit ( post_ID ) {
2
+ var data = {
3
+ 'action': 'instant_articles_force_submit',
4
+ 'post_ID': post_ID,
5
+ 'force': jQuery( '#instant_articles_force_submit' ).is( ':checked' ),
6
+ 'security': jQuery( '#instant_articles_force_submit' ).attr( 'data-security' )
7
+ };
8
+ jQuery.post( ajaxurl, data, function(response) {
9
+ instant_articles_load_meta_box( post_ID );
10
+ });
11
+ }
12
  function instant_articles_load_meta_box ( post_ID ) {
13
  jQuery( document ).ready( function( $ ) {
14
  var data = {
17
  };
18
  jQuery.post( ajaxurl, data, function(response) {
19
  jQuery( '#instant_article_meta_box .inside' ).html( response );
20
+ jQuery( '#instant_articles_force_submit').click( function () {
21
+ instant_articles_force_submit( post_ID );
22
+ } );
23
  }, 'html' );
24
  jQuery( '#instant_article_meta_box' ).delegate( '.instant-articles-toggle-debug', 'click', function () {
25
  jQuery( '#instant_article_meta_box' ).toggleClass( 'instant-articles-show-debug' );
js/instant-articles-wizard.js CHANGED
@@ -122,15 +122,14 @@ function instant_articles_wizard_bind_events () {
122
  jQuery( document ).ready( function () {
123
  instant_articles_wizard_bind_events();
124
 
125
- jQuery( '.instant-articles-wizard-toggle' ).on( 'click', function () {
126
- var text = jQuery( this ).text();
127
- if ( text.indexOf( '' ) !== -1 ) {
128
- text = text.replace( '', '' );
129
  }
130
  else {
131
- text = text.replace( '', '' );
132
  }
133
- jQuery( this ).text( text ).next().slideToggle();
134
  return false;
135
  });
136
  });
122
  jQuery( document ).ready( function () {
123
  instant_articles_wizard_bind_events();
124
 
125
+ jQuery( '.instant-articles-wizard-toggle a' ).on( 'click', function () {
126
+ $advancedSettingsContainer = jQuery( '.instant-articles-advanced-settings' );
127
+ if ( $advancedSettingsContainer.attr( 'data-state') === 'closed' ) {
128
+ $advancedSettingsContainer.attr( 'data-state', 'opened' );
129
  }
130
  else {
131
+ $advancedSettingsContainer.attr( 'data-state', 'closed' );
132
  }
 
133
  return false;
134
  });
135
  });
meta-box/class-instant-articles-meta-box.php CHANGED
@@ -28,6 +28,10 @@ class Instant_Articles_Meta_Box {
28
  'wp_ajax_instant_articles_meta_box',
29
  array( 'Instant_Articles_Meta_Box', 'render_meta_box' )
30
  );
 
 
 
 
31
  }
32
 
33
  /**
@@ -38,7 +42,9 @@ class Instant_Articles_Meta_Box {
38
  'instant_article_meta_box',
39
  'Facebook Instant Articles',
40
  array( 'Instant_Articles_Meta_Box', 'render_meta_box_loader' ),
41
- 'post',
 
 
42
  'normal',
43
  'default'
44
  );
@@ -53,25 +59,46 @@ class Instant_Articles_Meta_Box {
53
  include( dirname( __FILE__ ) . '/meta-box-loader-template.php' );
54
  }
55
 
 
 
 
 
 
 
 
 
 
 
 
56
  /**
57
  * Renderer for the Metabox.
58
  */
59
  public static function render_meta_box() {
60
- $post_id = intval( filter_input( INPUT_POST, 'post_ID' ) );
 
61
  $post = get_post( $post_id );
62
  $adapter = new Instant_Articles_Post( $post );
63
  $article = $adapter->to_instant_article();
64
  $canonical_url = $adapter->get_canonical_url();
65
  $submission_status = null;
66
  $published = 'publish' === $post->post_status;
 
 
67
 
68
  Instant_Articles_Wizard::menu_items();
69
  $settings_page_href = Instant_Articles_Wizard::get_url();
70
 
 
 
71
  if ( $published ) {
72
  try {
73
  $fb_app_settings = Instant_Articles_Option_FB_App::get_option_decoded();
74
  $fb_page_settings = Instant_Articles_Option_FB_Page::get_option_decoded();
 
 
 
 
 
75
 
76
  if ( isset( $fb_app_settings['app_id'] )
77
  && isset( $fb_app_settings['app_secret'] )
@@ -82,7 +109,8 @@ class Instant_Articles_Meta_Box {
82
  $fb_app_settings['app_id'],
83
  $fb_app_settings['app_secret'],
84
  $fb_page_settings['page_access_token'],
85
- $fb_page_settings['page_id']
 
86
  );
87
 
88
  $submission_status_id = get_post_meta( $post_id, Instant_Articles_Publisher::SUBMISSION_ID_KEY, true );
28
  'wp_ajax_instant_articles_meta_box',
29
  array( 'Instant_Articles_Meta_Box', 'render_meta_box' )
30
  );
31
+ add_action(
32
+ 'wp_ajax_instant_articles_force_submit',
33
+ array( 'Instant_Articles_Meta_Box', 'force_submit' )
34
+ );
35
  }
36
 
37
  /**
42
  'instant_article_meta_box',
43
  'Facebook Instant Articles',
44
  array( 'Instant_Articles_Meta_Box', 'render_meta_box_loader' ),
45
+
46
+ /** This filter is defined in facebook-instant-articles.php. */
47
+ apply_filters( 'instant_articles_post_types', array( 'post' ) ),
48
  'normal',
49
  'default'
50
  );
59
  include( dirname( __FILE__ ) . '/meta-box-loader-template.php' );
60
  }
61
 
62
+ /**
63
+ * Renderer for the Metabox.
64
+ */
65
+ public static function force_submit() {
66
+ check_ajax_referer( 'instant-articles-force-submit', 'security' );
67
+ $post_id = intval( $_POST[ 'post_ID' ] );
68
+ $force = sanitize_text_field( $_POST[ 'force' ] ) === 'true';
69
+ update_post_meta( $post_id, Instant_Articles_Publisher::FORCE_SUBMIT_KEY, $force );
70
+ Instant_Articles_Publisher::submit_article( $post_id, get_post( $post_id ) );
71
+ }
72
+
73
  /**
74
  * Renderer for the Metabox.
75
  */
76
  public static function render_meta_box() {
77
+ $ajax_nonce = wp_create_nonce( "instant-articles-force-submit" );
78
+ $post_id = intval( $_POST[ 'post_ID' ] );
79
  $post = get_post( $post_id );
80
  $adapter = new Instant_Articles_Post( $post );
81
  $article = $adapter->to_instant_article();
82
  $canonical_url = $adapter->get_canonical_url();
83
  $submission_status = null;
84
  $published = 'publish' === $post->post_status;
85
+ $dev_mode = false;
86
+ $force_submit = get_post_meta( $post_id, Instant_Articles_Publisher::FORCE_SUBMIT_KEY, true );
87
 
88
  Instant_Articles_Wizard::menu_items();
89
  $settings_page_href = Instant_Articles_Wizard::get_url();
90
 
91
+ $publishing_settings = Instant_Articles_Option_Publishing::get_option_decoded();
92
+ $publish_with_warnings = $publishing_settings[ 'publish_with_warnings' ];
93
  if ( $published ) {
94
  try {
95
  $fb_app_settings = Instant_Articles_Option_FB_App::get_option_decoded();
96
  $fb_page_settings = Instant_Articles_Option_FB_Page::get_option_decoded();
97
+ $publishing_settings = Instant_Articles_Option_Publishing::get_option_decoded();
98
+
99
+ $dev_mode = isset( $publishing_settings['dev_mode'] )
100
+ ? ( $publishing_settings['dev_mode'] ? true : false )
101
+ : false;
102
 
103
  if ( isset( $fb_app_settings['app_id'] )
104
  && isset( $fb_app_settings['app_secret'] )
109
  $fb_app_settings['app_id'],
110
  $fb_app_settings['app_secret'],
111
  $fb_page_settings['page_access_token'],
112
+ $fb_page_settings['page_id'],
113
+ $dev_mode
114
  );
115
 
116
  $submission_status_id = get_post_meta( $post_id, Instant_Articles_Publisher::SUBMISSION_ID_KEY, true );
meta-box/meta-box-template.php CHANGED
@@ -11,6 +11,13 @@ use Facebook\InstantArticles\Client\InstantArticleStatus;
11
  use Facebook\InstantArticles\Client\ServerMessage;
12
  ?>
13
 
 
 
 
 
 
 
 
14
  <?php if ( ! $published ) : ?>
15
  <p>
16
  <b>
@@ -163,6 +170,13 @@ use Facebook\InstantArticles\Client\ServerMessage;
163
  </li>
164
  <?php endforeach; ?>
165
  </ul>
 
 
 
 
 
 
 
166
 
167
  <?php else : ?>
168
  <p>
11
  use Facebook\InstantArticles\Client\ServerMessage;
12
  ?>
13
 
14
+ <?php if ( $dev_mode ) : ?>
15
+ <a href="<?php echo esc_url( $settings_page_href ); ?>" class="instant-articles-dev-mode-indicator">
16
+ <span class="dashicons dashicons-admin-tools"></span>
17
+ Development Mode
18
+ </a>
19
+ <?php endif; ?>
20
+
21
  <?php if ( ! $published ) : ?>
22
  <p>
23
  <b>
170
  </li>
171
  <?php endforeach; ?>
172
  </ul>
173
+ <?php if ( ! $publish_with_warnings ) : ?>
174
+ <hr />
175
+ <p>
176
+ <input type="checkbox" id="instant_articles_force_submit" data-security="<?php echo $ajax_nonce; ?>" <?php checked( $force_submit , 1 ); ?> />
177
+ Submit this article even with warnings
178
+ </p>
179
+ <?php endif; ?>
180
 
181
  <?php else : ?>
182
  <p>
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.1.3
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -85,6 +85,23 @@ Usually simply visiting the permalinks settings page in the WordPress dashboard
85
 
86
  == Changelog ==
87
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
  = 3.1.3 =
89
  * Fix for expiring token issue
90
  * Fix missing icons
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
 
85
 
86
  == Changelog ==
87
 
88
+ = 3.2 =
89
+ * Adds development mode support to post meta box (props simonengelhardt)
90
+ * Adds rule configuration for Instagram blockquotes (props everton-rosario)
91
+ * Adds rules for galleries (props everton-rosario)
92
+ * Migrates some unit tests (props everton-rosario)
93
+ * Switches to Facebook Graph SDK (props everton-rosario)
94
+ * Improves token invalidation flow (props everton-rosario)
95
+ * Fixes use of `the_title` filter (props srtfisher)
96
+ * Improves encoding handling (props yssk22)
97
+ * Adds post type filter to the post meta box (props technosailor)
98
+ * Adds Playbuzz support (props everton-rosario)
99
+ * Rename SDK getter to avert apocalypse (props diegoquinteiro)
100
+ * Wizard copy improvements (props demoive)
101
+ * Fixes issue with captions (props everton-rosario)
102
+ * Adds publication block for articles with transformation warnings (props everton-rosario)
103
+ * Fix https src attribute on some scripts (props goldenapples)
104
+
105
  = 3.1.3 =
106
  * Fix for expiring token issue
107
  * Fix missing icons
rules-configuration.json CHANGED
@@ -120,6 +120,26 @@
120
  }, {
121
  "class": "H2Rule",
122
  "selector" : "h3,h4,h5,h6"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
  }, {
124
  "class": "InteractiveRule",
125
  "selector" : "iframe",
@@ -397,8 +417,10 @@
397
  }, {
398
  "class": "CaptionRule",
399
  "selector" : "figcaption"
400
- },
401
- {
 
 
402
  "class": "ImageRule",
403
  "selector" : "figure",
404
  "properties" : {
@@ -424,5 +446,29 @@
424
  "attribute": "type"
425
  }
426
  }
427
- }]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
428
  }
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": "IgnoreRule",
142
+ "selector" : "script"
143
  }, {
144
  "class": "InteractiveRule",
145
  "selector" : "iframe",
417
  }, {
418
  "class": "CaptionRule",
419
  "selector" : "figcaption"
420
+ }, {
421
+ "class": "CaptionRule",
422
+ "selector" : "p.wp-caption-text"
423
+ }, {
424
  "class": "ImageRule",
425
  "selector" : "figure",
426
  "properties" : {
446
  "attribute": "type"
447
  }
448
  }
449
+ }, {
450
+ "class" : "PassThroughRule",
451
+ "selector" : "div.vce-gallery-big"
452
+ }, {
453
+ "class" : "PassThroughRule",
454
+ "selector" : "div.vce-gallery-small"
455
+ }, {
456
+ "class" : "IgnoreRule",
457
+ "selector" : "div.vce-gallery-slider"
458
+ }, {
459
+ "class": "SlideshowImageRule",
460
+ "selector" : "div.big-gallery-item",
461
+ "properties" : {
462
+ "image.url" : {
463
+ "type" : "string",
464
+ "selector" : "img",
465
+ "attribute": "src"
466
+ },
467
+ "caption.title" : {
468
+ "type" : "string",
469
+ "selector" : "figcaption.wp-caption-text"
470
+ }
471
+ }
472
+ }
473
+ ]
474
  }
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer' . '/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit337744729a91b1fdea5f68820e3d1dfe::getLoader();
4
 
5
  require_once __DIR__ . '/composer' . '/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit6908494315138775469765f169c8289c::getLoader();
vendor/composer/autoload_files.php CHANGED
@@ -6,5 +6,5 @@ $vendorDir = dirname(dirname(__FILE__));
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
9
- '7e702cccdb9dd904f2ccf22e5f37abae' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/polyfills.php',
10
  );
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
9
+ 'c65d09b6820da036953a371c8c73a9b1' => $vendorDir . '/facebook/graph-sdk/src/Facebook/polyfills.php',
10
  );
vendor/composer/autoload_psr4.php CHANGED
@@ -8,5 +8,5 @@ $baseDir = dirname($vendorDir);
8
  return array(
9
  'Symfony\\Component\\CssSelector\\' => array($vendorDir . '/symfony/css-selector'),
10
  'Facebook\\InstantArticles\\' => array($vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles'),
11
- 'Facebook\\' => array($vendorDir . '/facebook/php-sdk-v4/src/Facebook'),
12
  );
8
  return array(
9
  'Symfony\\Component\\CssSelector\\' => array($vendorDir . '/symfony/css-selector'),
10
  'Facebook\\InstantArticles\\' => array($vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles'),
11
+ 'Facebook\\' => array($vendorDir . '/facebook/graph-sdk/src/Facebook'),
12
  );
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit337744729a91b1fdea5f68820e3d1dfe
6
  {
7
  private static $loader;
8
 
@@ -19,15 +19,15 @@ class ComposerAutoloaderInit337744729a91b1fdea5f68820e3d1dfe
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInit337744729a91b1fdea5f68820e3d1dfe', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInit337744729a91b1fdea5f68820e3d1dfe', '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\ComposerStaticInit337744729a91b1fdea5f68820e3d1dfe::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
@@ -48,19 +48,19 @@ class ComposerAutoloaderInit337744729a91b1fdea5f68820e3d1dfe
48
  $loader->register(true);
49
 
50
  if ($useStaticLoader) {
51
- $includeFiles = Composer\Autoload\ComposerStaticInit337744729a91b1fdea5f68820e3d1dfe::$files;
52
  } else {
53
  $includeFiles = require __DIR__ . '/autoload_files.php';
54
  }
55
  foreach ($includeFiles as $fileIdentifier => $file) {
56
- composerRequire337744729a91b1fdea5f68820e3d1dfe($fileIdentifier, $file);
57
  }
58
 
59
  return $loader;
60
  }
61
  }
62
 
63
- function composerRequire337744729a91b1fdea5f68820e3d1dfe($fileIdentifier, $file)
64
  {
65
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
66
  require $file;
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit6908494315138775469765f169c8289c
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInit6908494315138775469765f169c8289c', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit6908494315138775469765f169c8289c', '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\ComposerStaticInit6908494315138775469765f169c8289c::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\ComposerStaticInit6908494315138775469765f169c8289c::$files;
52
  } else {
53
  $includeFiles = require __DIR__ . '/autoload_files.php';
54
  }
55
  foreach ($includeFiles as $fileIdentifier => $file) {
56
+ composerRequire6908494315138775469765f169c8289c($fileIdentifier, $file);
57
  }
58
 
59
  return $loader;
60
  }
61
  }
62
 
63
+ function composerRequire6908494315138775469765f169c8289c($fileIdentifier, $file)
64
  {
65
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
66
  require $file;
vendor/composer/autoload_static.php CHANGED
@@ -4,10 +4,10 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInit337744729a91b1fdea5f68820e3d1dfe
8
  {
9
  public static $files = array (
10
- '7e702cccdb9dd904f2ccf22e5f37abae' => __DIR__ . '/..' . '/facebook/php-sdk-v4/src/Facebook/polyfills.php',
11
  );
12
 
13
  public static $prefixLengthsPsr4 = array (
@@ -33,7 +33,7 @@ class ComposerStaticInit337744729a91b1fdea5f68820e3d1dfe
33
  ),
34
  'Facebook\\' =>
35
  array (
36
- 0 => __DIR__ . '/..' . '/facebook/php-sdk-v4/src/Facebook',
37
  ),
38
  );
39
 
@@ -122,9 +122,9 @@ class ComposerStaticInit337744729a91b1fdea5f68820e3d1dfe
122
  public static function getInitializer(ClassLoader $loader)
123
  {
124
  return \Closure::bind(function () use ($loader) {
125
- $loader->prefixLengthsPsr4 = ComposerStaticInit337744729a91b1fdea5f68820e3d1dfe::$prefixLengthsPsr4;
126
- $loader->prefixDirsPsr4 = ComposerStaticInit337744729a91b1fdea5f68820e3d1dfe::$prefixDirsPsr4;
127
- $loader->classMap = ComposerStaticInit337744729a91b1fdea5f68820e3d1dfe::$classMap;
128
 
129
  }, null, ClassLoader::class);
130
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit6908494315138775469765f169c8289c
8
  {
9
  public static $files = array (
10
+ 'c65d09b6820da036953a371c8c73a9b1' => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook/polyfills.php',
11
  );
12
 
13
  public static $prefixLengthsPsr4 = array (
33
  ),
34
  'Facebook\\' =>
35
  array (
36
+ 0 => __DIR__ . '/..' . '/facebook/graph-sdk/src/Facebook',
37
  ),
38
  );
39
 
122
  public static function getInitializer(ClassLoader $loader)
123
  {
124
  return \Closure::bind(function () use ($loader) {
125
+ $loader->prefixLengthsPsr4 = ComposerStaticInit6908494315138775469765f169c8289c::$prefixLengthsPsr4;
126
+ $loader->prefixDirsPsr4 = ComposerStaticInit6908494315138775469765f169c8289c::$prefixDirsPsr4;
127
+ $loader->classMap = ComposerStaticInit6908494315138775469765f169c8289c::$classMap;
128
 
129
  }, null, ClassLoader::class);
130
  }
vendor/composer/installed.json CHANGED
@@ -32,7 +32,7 @@
32
  ]
33
  },
34
  {
35
- "name": "facebook/php-sdk-v4",
36
  "version": "5.3.1",
37
  "version_normalized": "5.3.1.0",
38
  "source": {
@@ -88,13 +88,12 @@
88
  "keywords": [
89
  "facebook",
90
  "sdk"
91
- ],
92
- "abandoned": "facebook/graph-sdk"
93
  },
94
  {
95
  "name": "symfony/css-selector",
96
- "version": "v2.8.11",
97
- "version_normalized": "2.8.11.0",
98
  "source": {
99
  "type": "git",
100
  "url": "https://github.com/symfony/css-selector.git",
@@ -148,22 +147,22 @@
148
  },
149
  {
150
  "name": "facebook/facebook-instant-articles-sdk-php",
151
- "version": "v1.5.0",
152
- "version_normalized": "1.5.0.0",
153
  "source": {
154
  "type": "git",
155
  "url": "https://github.com/facebook/facebook-instant-articles-sdk-php.git",
156
- "reference": "e7ba342acea3106a83210196c952fbbed0f0fe30"
157
  },
158
  "dist": {
159
  "type": "zip",
160
- "url": "https://api.github.com/repos/facebook/facebook-instant-articles-sdk-php/zipball/e7ba342acea3106a83210196c952fbbed0f0fe30",
161
- "reference": "e7ba342acea3106a83210196c952fbbed0f0fe30",
162
  "shasum": ""
163
  },
164
  "require": {
165
  "apache/log4php": "2.3.0",
166
- "facebook/php-sdk-v4": "~5.0",
167
  "php": "^5.4 || ^7.0",
168
  "symfony/css-selector": "2.8.*"
169
  },
@@ -172,7 +171,7 @@
172
  "phpunit/phpunit": "^4.8",
173
  "squizlabs/php_codesniffer": "^2.6.0"
174
  },
175
- "time": "2016-08-26 13:55:03",
176
  "type": "library",
177
  "installation-source": "dist",
178
  "autoload": {
32
  ]
33
  },
34
  {
35
+ "name": "facebook/graph-sdk",
36
  "version": "5.3.1",
37
  "version_normalized": "5.3.1.0",
38
  "source": {
88
  "keywords": [
89
  "facebook",
90
  "sdk"
91
+ ]
 
92
  },
93
  {
94
  "name": "symfony/css-selector",
95
+ "version": "v2.8.12",
96
+ "version_normalized": "2.8.12.0",
97
  "source": {
98
  "type": "git",
99
  "url": "https://github.com/symfony/css-selector.git",
147
  },
148
  {
149
  "name": "facebook/facebook-instant-articles-sdk-php",
150
+ "version": "v1.5.2",
151
+ "version_normalized": "1.5.2.0",
152
  "source": {
153
  "type": "git",
154
  "url": "https://github.com/facebook/facebook-instant-articles-sdk-php.git",
155
+ "reference": "563726feebd4c3a0132d33bb5b946d4b460a9fa7"
156
  },
157
  "dist": {
158
  "type": "zip",
159
+ "url": "https://api.github.com/repos/facebook/facebook-instant-articles-sdk-php/zipball/563726feebd4c3a0132d33bb5b946d4b460a9fa7",
160
+ "reference": "563726feebd4c3a0132d33bb5b946d4b460a9fa7",
161
  "shasum": ""
162
  },
163
  "require": {
164
  "apache/log4php": "2.3.0",
165
+ "facebook/graph-sdk": "~5.0",
166
  "php": "^5.4 || ^7.0",
167
  "symfony/css-selector": "2.8.*"
168
  },
171
  "phpunit/phpunit": "^4.8",
172
  "squizlabs/php_codesniffer": "^2.6.0"
173
  },
174
+ "time": "2016-10-07 18:26:43",
175
  "type": "library",
176
  "installation-source": "dist",
177
  "autoload": {
vendor/facebook/facebook-instant-articles-sdk-php/composer.json DELETED
@@ -1,47 +0,0 @@
1
- {
2
- "name": "facebook/facebook-instant-articles-sdk-php",
3
- "description": "Facebook Instant Articles SDK for PHP",
4
- "keywords": ["facebook", "sdk", "instant", "articles"],
5
- "type": "library",
6
- "homepage": "https://github.com/facebook/facebook-instant-articles-sdk-php",
7
- "license": "proprietary",
8
- "authors": [{
9
- "name": "Facebook",
10
- "homepage": "https://github.com/facebook/facebook-instant-articles-sdk-php/contributors"
11
- }],
12
- "require": {
13
- "php": "^5.4 || ^7.0",
14
- "symfony/css-selector": "2.8.*",
15
- "facebook/php-sdk-v4": "~5.0",
16
- "apache/log4php": "2.3.0"
17
- },
18
- "require-dev": {
19
- "fzaninotto/faker": "^1.6.0",
20
- "phpunit/phpunit": "^4.8",
21
- "squizlabs/php_codesniffer": "^2.6.0"
22
- },
23
- "autoload": {
24
- "psr-4": {
25
- "Facebook\\InstantArticles\\": "src/Facebook/InstantArticles/"
26
- }
27
- },
28
- "autoload-dev": {
29
- "psr-4": {
30
- "Facebook\\InstantArticles\\": "tests/Facebook/InstantArticles/"
31
- }
32
- },
33
- "scripts": {
34
- "all": [
35
- "@cs",
36
- "@test"
37
- ],
38
- "cs": [
39
- "composer install",
40
- "phpcbf --standard=phpcs.xml -p || phpcs --standard=phpcs.xml -p"
41
- ],
42
- "test": [
43
- "composer install",
44
- "phpunit"
45
- ]
46
- }
47
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/facebook/facebook-instant-articles-sdk-php/composer.lock DELETED
@@ -1,1245 +0,0 @@
1
- {
2
- "_readme": [
3
- "This file locks the dependencies of your project to a known state",
4
- "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
5
- "This file is @generated automatically"
6
- ],
7
- "hash": "1cb48da59b04851b1ddcce5ac4a16e91",
8
- "content-hash": "e47809dbb41d3cf5a6049a4db9fe2301",
9
- "packages": [
10
- {
11
- "name": "apache/log4php",
12
- "version": "2.3.0",
13
- "source": {
14
- "type": "git",
15
- "url": "https://git-wip-us.apache.org/repos/asf/logging-log4php.git",
16
- "reference": "8c6df2481cd68d0d211d38f700406c5f0a9de0c2"
17
- },
18
- "require": {
19
- "php": ">=5.2.7"
20
- },
21
- "type": "library",
22
- "autoload": {
23
- "classmap": [
24
- "src/main/php/"
25
- ]
26
- },
27
- "notification-url": "https://packagist.org/downloads/",
28
- "license": [
29
- "Apache-2.0"
30
- ],
31
- "description": "A versatile logging framework for PHP",
32
- "homepage": "http://logging.apache.org/log4php/",
33
- "keywords": [
34
- "log",
35
- "logging",
36
- "php"
37
- ],
38
- "time": "2012-10-26 09:13:25"
39
- },
40
- {
41
- "name": "facebook/php-sdk-v4",
42
- "version": "5.2.0",
43
- "source": {
44
- "type": "git",
45
- "url": "https://github.com/facebook/facebook-php-sdk-v4.git",
46
- "reference": "c60fba1fe1de62db1e0776d32fc2fb778189459c"
47
- },
48
- "dist": {
49
- "type": "zip",
50
- "url": "https://api.github.com/repos/facebook/facebook-php-sdk-v4/zipball/c60fba1fe1de62db1e0776d32fc2fb778189459c",
51
- "reference": "c60fba1fe1de62db1e0776d32fc2fb778189459c",
52
- "shasum": ""
53
- },
54
- "require": {
55
- "php": "^5.4|^7.0"
56
- },
57
- "require-dev": {
58
- "guzzlehttp/guzzle": "~5.0",
59
- "mockery/mockery": "~0.8",
60
- "phpunit/phpunit": "~4.0"
61
- },
62
- "suggest": {
63
- "guzzlehttp/guzzle": "Allows for implementation of the Guzzle HTTP client"
64
- },
65
- "type": "library",
66
- "extra": {
67
- "branch-alias": {
68
- "dev-master": "5.x-dev"
69
- }
70
- },
71
- "autoload": {
72
- "psr-4": {
73
- "Facebook\\": "src/Facebook/"
74
- },
75
- "files": [
76
- "src/Facebook/polyfills.php"
77
- ]
78
- },
79
- "notification-url": "https://packagist.org/downloads/",
80
- "license": [
81
- "Facebook Platform"
82
- ],
83
- "authors": [
84
- {
85
- "name": "Facebook",
86
- "homepage": "https://github.com/facebook/facebook-php-sdk-v4/contributors"
87
- }
88
- ],
89
- "description": "Facebook SDK for PHP",
90
- "homepage": "https://github.com/facebook/facebook-php-sdk-v4",
91
- "keywords": [
92
- "facebook",
93
- "sdk"
94
- ],
95
- "time": "2016-05-18 22:04:36"
96
- },
97
- {
98
- "name": "symfony/css-selector",
99
- "version": "v2.8.7",
100
- "source": {
101
- "type": "git",
102
- "url": "https://github.com/symfony/css-selector.git",
103
- "reference": "9a0b2649328297fb6acd0c823789d92efcbd36ad"
104
- },
105
- "dist": {
106
- "type": "zip",
107
- "url": "https://api.github.com/repos/symfony/css-selector/zipball/9a0b2649328297fb6acd0c823789d92efcbd36ad",
108
- "reference": "9a0b2649328297fb6acd0c823789d92efcbd36ad",
109
- "shasum": ""
110
- },
111
- "require": {
112
- "php": ">=5.3.9"
113
- },
114
- "type": "library",
115
- "extra": {
116
- "branch-alias": {
117
- "dev-master": "2.8-dev"
118
- }
119
- },
120
- "autoload": {
121
- "psr-4": {
122
- "Symfony\\Component\\CssSelector\\": ""
123
- },
124
- "exclude-from-classmap": [
125
- "/Tests/"
126
- ]
127
- },
128
- "notification-url": "https://packagist.org/downloads/",
129
- "license": [
130
- "MIT"
131
- ],
132
- "authors": [
133
- {
134
- "name": "Jean-François Simon",
135
- "email": "jeanfrancois.simon@sensiolabs.com"
136
- },
137
- {
138
- "name": "Fabien Potencier",
139
- "email": "fabien@symfony.com"
140
- },
141
- {
142
- "name": "Symfony Community",
143
- "homepage": "https://symfony.com/contributors"
144
- }
145
- ],
146
- "description": "Symfony CssSelector Component",
147
- "homepage": "https://symfony.com",
148
- "time": "2016-06-06 11:11:27"
149
- }
150
- ],
151
- "packages-dev": [
152
- {
153
- "name": "doctrine/instantiator",
154
- "version": "1.0.5",
155
- "source": {
156
- "type": "git",
157
- "url": "https://github.com/doctrine/instantiator.git",
158
- "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d"
159
- },
160
- "dist": {
161
- "type": "zip",
162
- "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d",
163
- "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d",
164
- "shasum": ""
165
- },
166
- "require": {
167
- "php": ">=5.3,<8.0-DEV"
168
- },
169
- "require-dev": {
170
- "athletic/athletic": "~0.1.8",
171
- "ext-pdo": "*",
172
- "ext-phar": "*",
173
- "phpunit/phpunit": "~4.0",
174
- "squizlabs/php_codesniffer": "~2.0"
175
- },
176
- "type": "library",
177
- "extra": {
178
- "branch-alias": {
179
- "dev-master": "1.0.x-dev"
180
- }
181
- },
182
- "autoload": {
183
- "psr-4": {
184
- "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/"
185
- }
186
- },
187
- "notification-url": "https://packagist.org/downloads/",
188
- "license": [
189
- "MIT"
190
- ],
191
- "authors": [
192
- {
193
- "name": "Marco Pivetta",
194
- "email": "ocramius@gmail.com",
195
- "homepage": "http://ocramius.github.com/"
196
- }
197
- ],
198
- "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
199
- "homepage": "https://github.com/doctrine/instantiator",
200
- "keywords": [
201
- "constructor",
202
- "instantiate"
203
- ],
204
- "time": "2015-06-14 21:17:01"
205
- },
206
- {
207
- "name": "fzaninotto/faker",
208
- "version": "v1.6.0",
209
- "source": {
210
- "type": "git",
211
- "url": "https://github.com/fzaninotto/Faker.git",
212
- "reference": "44f9a286a04b80c76a4e5fb7aad8bb539b920123"
213
- },
214
- "dist": {
215
- "type": "zip",
216
- "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/44f9a286a04b80c76a4e5fb7aad8bb539b920123",
217
- "reference": "44f9a286a04b80c76a4e5fb7aad8bb539b920123",
218
- "shasum": ""
219
- },
220
- "require": {
221
- "php": "^5.3.3|^7.0"
222
- },
223
- "require-dev": {
224
- "ext-intl": "*",
225
- "phpunit/phpunit": "~4.0",
226
- "squizlabs/php_codesniffer": "~1.5"
227
- },
228
- "type": "library",
229
- "extra": {
230
- "branch-alias": []
231
- },
232
- "autoload": {
233
- "psr-4": {
234
- "Faker\\": "src/Faker/"
235
- }
236
- },
237
- "notification-url": "https://packagist.org/downloads/",
238
- "license": [
239
- "MIT"
240
- ],
241
- "authors": [
242
- {
243
- "name": "François Zaninotto"
244
- }
245
- ],
246
- "description": "Faker is a PHP library that generates fake data for you.",
247
- "keywords": [
248
- "data",
249
- "faker",
250
- "fixtures"
251
- ],
252
- "time": "2016-04-29 12:21:54"
253
- },
254
- {
255
- "name": "phpdocumentor/reflection-docblock",
256
- "version": "2.0.4",
257
- "source": {
258
- "type": "git",
259
- "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
260
- "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8"
261
- },
262
- "dist": {
263
- "type": "zip",
264
- "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d68dbdc53dc358a816f00b300704702b2eaff7b8",
265
- "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8",
266
- "shasum": ""
267
- },
268
- "require": {
269
- "php": ">=5.3.3"
270
- },
271
- "require-dev": {
272
- "phpunit/phpunit": "~4.0"
273
- },
274
- "suggest": {
275
- "dflydev/markdown": "~1.0",
276
- "erusev/parsedown": "~1.0"
277
- },
278
- "type": "library",
279
- "extra": {
280
- "branch-alias": {
281
- "dev-master": "2.0.x-dev"
282
- }
283
- },
284
- "autoload": {
285
- "psr-0": {
286
- "phpDocumentor": [
287
- "src/"
288
- ]
289
- }
290
- },
291
- "notification-url": "https://packagist.org/downloads/",
292
- "license": [
293
- "MIT"
294
- ],
295
- "authors": [
296
- {
297
- "name": "Mike van Riel",
298
- "email": "mike.vanriel@naenius.com"
299
- }
300
- ],
301
- "time": "2015-02-03 12:10:50"
302
- },
303
- {
304
- "name": "phpspec/prophecy",
305
- "version": "v1.6.1",
306
- "source": {
307
- "type": "git",
308
- "url": "https://github.com/phpspec/prophecy.git",
309
- "reference": "58a8137754bc24b25740d4281399a4a3596058e0"
310
- },
311
- "dist": {
312
- "type": "zip",
313
- "url": "https://api.github.com/repos/phpspec/prophecy/zipball/58a8137754bc24b25740d4281399a4a3596058e0",
314
- "reference": "58a8137754bc24b25740d4281399a4a3596058e0",
315
- "shasum": ""
316
- },
317
- "require": {
318
- "doctrine/instantiator": "^1.0.2",
319
- "php": "^5.3|^7.0",
320
- "phpdocumentor/reflection-docblock": "^2.0|^3.0.2",
321
- "sebastian/comparator": "^1.1",
322
- "sebastian/recursion-context": "^1.0"
323
- },
324
- "require-dev": {
325
- "phpspec/phpspec": "^2.0"
326
- },
327
- "type": "library",
328
- "extra": {
329
- "branch-alias": {
330
- "dev-master": "1.6.x-dev"
331
- }
332
- },
333
- "autoload": {
334
- "psr-0": {
335
- "Prophecy\\": "src/"
336
- }
337
- },
338
- "notification-url": "https://packagist.org/downloads/",
339
- "license": [
340
- "MIT"
341
- ],
342
- "authors": [
343
- {
344
- "name": "Konstantin Kudryashov",
345
- "email": "ever.zet@gmail.com",
346
- "homepage": "http://everzet.com"
347
- },
348
- {
349
- "name": "Marcello Duarte",
350
- "email": "marcello.duarte@gmail.com"
351
- }
352
- ],
353
- "description": "Highly opinionated mocking framework for PHP 5.3+",
354
- "homepage": "https://github.com/phpspec/prophecy",
355
- "keywords": [
356
- "Double",
357
- "Dummy",
358
- "fake",
359
- "mock",
360
- "spy",
361
- "stub"
362
- ],
363
- "time": "2016-06-07 08:13:47"
364
- },
365
- {
366
- "name": "phpunit/php-code-coverage",
367
- "version": "2.2.4",
368
- "source": {
369
- "type": "git",
370
- "url": "https://github.com/sebastianbergmann/php-code-coverage.git",
371
- "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979"
372
- },
373
- "dist": {
374
- "type": "zip",
375
- "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979",
376
- "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979",
377
- "shasum": ""
378
- },
379
- "require": {
380
- "php": ">=5.3.3",
381
- "phpunit/php-file-iterator": "~1.3",
382
- "phpunit/php-text-template": "~1.2",
383
- "phpunit/php-token-stream": "~1.3",
384
- "sebastian/environment": "^1.3.2",
385
- "sebastian/version": "~1.0"
386
- },
387
- "require-dev": {
388
- "ext-xdebug": ">=2.1.4",
389
- "phpunit/phpunit": "~4"
390
- },
391
- "suggest": {
392
- "ext-dom": "*",
393
- "ext-xdebug": ">=2.2.1",
394
- "ext-xmlwriter": "*"
395
- },
396
- "type": "library",
397
- "extra": {
398
- "branch-alias": {
399
- "dev-master": "2.2.x-dev"
400
- }
401
- },
402
- "autoload": {
403
- "classmap": [
404
- "src/"
405
- ]
406
- },
407
- "notification-url": "https://packagist.org/downloads/",
408
- "license": [
409
- "BSD-3-Clause"
410
- ],
411
- "authors": [
412
- {
413
- "name": "Sebastian Bergmann",
414
- "email": "sb@sebastian-bergmann.de",
415
- "role": "lead"
416
- }
417
- ],
418
- "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.",
419
- "homepage": "https://github.com/sebastianbergmann/php-code-coverage",
420
- "keywords": [
421
- "coverage",
422
- "testing",
423
- "xunit"
424
- ],
425
- "time": "2015-10-06 15:47:00"
426
- },
427
- {
428
- "name": "phpunit/php-file-iterator",
429
- "version": "1.4.1",
430
- "source": {
431
- "type": "git",
432
- "url": "https://github.com/sebastianbergmann/php-file-iterator.git",
433
- "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0"
434
- },
435
- "dist": {
436
- "type": "zip",
437
- "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/6150bf2c35d3fc379e50c7602b75caceaa39dbf0",
438
- "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0",
439
- "shasum": ""
440
- },
441
- "require": {
442
- "php": ">=5.3.3"
443
- },
444
- "type": "library",
445
- "extra": {
446
- "branch-alias": {
447
- "dev-master": "1.4.x-dev"
448
- }
449
- },
450
- "autoload": {
451
- "classmap": [
452
- "src/"
453
- ]
454
- },
455
- "notification-url": "https://packagist.org/downloads/",
456
- "license": [
457
- "BSD-3-Clause"
458
- ],
459
- "authors": [
460
- {
461
- "name": "Sebastian Bergmann",
462
- "email": "sb@sebastian-bergmann.de",
463
- "role": "lead"
464
- }
465
- ],
466
- "description": "FilterIterator implementation that filters files based on a list of suffixes.",
467
- "homepage": "https://github.com/sebastianbergmann/php-file-iterator/",
468
- "keywords": [
469
- "filesystem",
470
- "iterator"
471
- ],
472
- "time": "2015-06-21 13:08:43"
473
- },
474
- {
475
- "name": "phpunit/php-text-template",
476
- "version": "1.2.1",
477
- "source": {
478
- "type": "git",
479
- "url": "https://github.com/sebastianbergmann/php-text-template.git",
480
- "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686"
481
- },
482
- "dist": {
483
- "type": "zip",
484
- "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
485
- "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
486
- "shasum": ""
487
- },
488
- "require": {
489
- "php": ">=5.3.3"
490
- },
491
- "type": "library",
492
- "autoload": {
493
- "classmap": [
494
- "src/"
495
- ]
496
- },
497
- "notification-url": "https://packagist.org/downloads/",
498
- "license": [
499
- "BSD-3-Clause"
500
- ],
501
- "authors": [
502
- {
503
- "name": "Sebastian Bergmann",
504
- "email": "sebastian@phpunit.de",
505
- "role": "lead"
506
- }
507
- ],
508
- "description": "Simple template engine.",
509
- "homepage": "https://github.com/sebastianbergmann/php-text-template/",
510
- "keywords": [
511
- "template"
512
- ],
513
- "time": "2015-06-21 13:50:34"
514
- },
515
- {
516
- "name": "phpunit/php-timer",
517
- "version": "1.0.8",
518
- "source": {
519
- "type": "git",
520
- "url": "https://github.com/sebastianbergmann/php-timer.git",
521
- "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260"
522
- },
523
- "dist": {
524
- "type": "zip",
525
- "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/38e9124049cf1a164f1e4537caf19c99bf1eb260",
526
- "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260",
527
- "shasum": ""
528
- },
529
- "require": {
530
- "php": ">=5.3.3"
531
- },
532
- "require-dev": {
533
- "phpunit/phpunit": "~4|~5"
534
- },
535
- "type": "library",
536
- "autoload": {
537
- "classmap": [
538
- "src/"
539
- ]
540
- },
541
- "notification-url": "https://packagist.org/downloads/",
542
- "license": [
543
- "BSD-3-Clause"
544
- ],
545
- "authors": [
546
- {
547
- "name": "Sebastian Bergmann",
548
- "email": "sb@sebastian-bergmann.de",
549
- "role": "lead"
550
- }
551
- ],
552
- "description": "Utility class for timing",
553
- "homepage": "https://github.com/sebastianbergmann/php-timer/",
554
- "keywords": [
555
- "timer"
556
- ],
557
- "time": "2016-05-12 18:03:57"
558
- },
559
- {
560
- "name": "phpunit/php-token-stream",
561
- "version": "1.4.8",
562
- "source": {
563
- "type": "git",
564
- "url": "https://github.com/sebastianbergmann/php-token-stream.git",
565
- "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da"
566
- },
567
- "dist": {
568
- "type": "zip",
569
- "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da",
570
- "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da",
571
- "shasum": ""
572
- },
573
- "require": {
574
- "ext-tokenizer": "*",
575
- "php": ">=5.3.3"
576
- },
577
- "require-dev": {
578
- "phpunit/phpunit": "~4.2"
579
- },
580
- "type": "library",
581
- "extra": {
582
- "branch-alias": {
583
- "dev-master": "1.4-dev"
584
- }
585
- },
586
- "autoload": {
587
- "classmap": [
588
- "src/"
589
- ]
590
- },
591
- "notification-url": "https://packagist.org/downloads/",
592
- "license": [
593
- "BSD-3-Clause"
594
- ],
595
- "authors": [
596
- {
597
- "name": "Sebastian Bergmann",
598
- "email": "sebastian@phpunit.de"
599
- }
600
- ],
601
- "description": "Wrapper around PHP's tokenizer extension.",
602
- "homepage": "https://github.com/sebastianbergmann/php-token-stream/",
603
- "keywords": [
604
- "tokenizer"
605
- ],
606
- "time": "2015-09-15 10:49:45"
607
- },
608
- {
609
- "name": "phpunit/phpunit",
610
- "version": "4.8.26",
611
- "source": {
612
- "type": "git",
613
- "url": "https://github.com/sebastianbergmann/phpunit.git",
614
- "reference": "fc1d8cd5b5de11625979125c5639347896ac2c74"
615
- },
616
- "dist": {
617
- "type": "zip",
618
- "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/fc1d8cd5b5de11625979125c5639347896ac2c74",
619
- "reference": "fc1d8cd5b5de11625979125c5639347896ac2c74",
620
- "shasum": ""
621
- },
622
- "require": {
623
- "ext-dom": "*",
624
- "ext-json": "*",
625
- "ext-pcre": "*",
626
- "ext-reflection": "*",
627
- "ext-spl": "*",
628
- "php": ">=5.3.3",
629
- "phpspec/prophecy": "^1.3.1",
630
- "phpunit/php-code-coverage": "~2.1",
631
- "phpunit/php-file-iterator": "~1.4",
632
- "phpunit/php-text-template": "~1.2",
633
- "phpunit/php-timer": "^1.0.6",
634
- "phpunit/phpunit-mock-objects": "~2.3",
635
- "sebastian/comparator": "~1.1",
636
- "sebastian/diff": "~1.2",
637
- "sebastian/environment": "~1.3",
638
- "sebastian/exporter": "~1.2",
639
- "sebastian/global-state": "~1.0",
640
- "sebastian/version": "~1.0",
641
- "symfony/yaml": "~2.1|~3.0"
642
- },
643
- "suggest": {
644
- "phpunit/php-invoker": "~1.1"
645
- },
646
- "bin": [
647
- "phpunit"
648
- ],
649
- "type": "library",
650
- "extra": {
651
- "branch-alias": {
652
- "dev-master": "4.8.x-dev"
653
- }
654
- },
655
- "autoload": {
656
- "classmap": [
657
- "src/"
658
- ]
659
- },
660
- "notification-url": "https://packagist.org/downloads/",
661
- "license": [
662
- "BSD-3-Clause"
663
- ],
664
- "authors": [
665
- {
666
- "name": "Sebastian Bergmann",
667
- "email": "sebastian@phpunit.de",
668
- "role": "lead"
669
- }
670
- ],
671
- "description": "The PHP Unit Testing framework.",
672
- "homepage": "https://phpunit.de/",
673
- "keywords": [
674
- "phpunit",
675
- "testing",
676
- "xunit"
677
- ],
678
- "time": "2016-05-17 03:09:28"
679
- },
680
- {
681
- "name": "phpunit/phpunit-mock-objects",
682
- "version": "2.3.8",
683
- "source": {
684
- "type": "git",
685
- "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
686
- "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983"
687
- },
688
- "dist": {
689
- "type": "zip",
690
- "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983",
691
- "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983",
692
- "shasum": ""
693
- },
694
- "require": {
695
- "doctrine/instantiator": "^1.0.2",
696
- "php": ">=5.3.3",
697
- "phpunit/php-text-template": "~1.2",
698
- "sebastian/exporter": "~1.2"
699
- },
700
- "require-dev": {
701
- "phpunit/phpunit": "~4.4"
702
- },
703
- "suggest": {
704
- "ext-soap": "*"
705
- },
706
- "type": "library",
707
- "extra": {
708
- "branch-alias": {
709
- "dev-master": "2.3.x-dev"
710
- }
711
- },
712
- "autoload": {
713
- "classmap": [
714
- "src/"
715
- ]
716
- },
717
- "notification-url": "https://packagist.org/downloads/",
718
- "license": [
719
- "BSD-3-Clause"
720
- ],
721
- "authors": [
722
- {
723
- "name": "Sebastian Bergmann",
724
- "email": "sb@sebastian-bergmann.de",
725
- "role": "lead"
726
- }
727
- ],
728
- "description": "Mock Object library for PHPUnit",
729
- "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/",
730
- "keywords": [
731
- "mock",
732
- "xunit"
733
- ],
734
- "time": "2015-10-02 06:51:40"
735
- },
736
- {
737
- "name": "sebastian/comparator",
738
- "version": "1.2.0",
739
- "source": {
740
- "type": "git",
741
- "url": "https://github.com/sebastianbergmann/comparator.git",
742
- "reference": "937efb279bd37a375bcadf584dec0726f84dbf22"
743
- },
744
- "dist": {
745
- "type": "zip",
746
- "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22",
747
- "reference": "937efb279bd37a375bcadf584dec0726f84dbf22",
748
- "shasum": ""
749
- },
750
- "require": {
751
- "php": ">=5.3.3",
752
- "sebastian/diff": "~1.2",
753
- "sebastian/exporter": "~1.2"
754
- },
755
- "require-dev": {
756
- "phpunit/phpunit": "~4.4"
757
- },
758
- "type": "library",
759
- "extra": {
760
- "branch-alias": {
761
- "dev-master": "1.2.x-dev"
762
- }
763
- },
764
- "autoload": {
765
- "classmap": [
766
- "src/"
767
- ]
768
- },
769
- "notification-url": "https://packagist.org/downloads/",
770
- "license": [
771
- "BSD-3-Clause"
772
- ],
773
- "authors": [
774
- {
775
- "name": "Jeff Welch",
776
- "email": "whatthejeff@gmail.com"
777
- },
778
- {
779
- "name": "Volker Dusch",
780
- "email": "github@wallbash.com"
781
- },
782
- {
783
- "name": "Bernhard Schussek",
784
- "email": "bschussek@2bepublished.at"
785
- },
786
- {
787
- "name": "Sebastian Bergmann",
788
- "email": "sebastian@phpunit.de"
789
- }
790
- ],
791
- "description": "Provides the functionality to compare PHP values for equality",
792
- "homepage": "http://www.github.com/sebastianbergmann/comparator",
793
- "keywords": [
794
- "comparator",
795
- "compare",
796
- "equality"
797
- ],
798
- "time": "2015-07-26 15:48:44"
799
- },
800
- {
801
- "name": "sebastian/diff",
802
- "version": "1.4.1",
803
- "source": {
804
- "type": "git",
805
- "url": "https://github.com/sebastianbergmann/diff.git",
806
- "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e"
807
- },
808
- "dist": {
809
- "type": "zip",
810
- "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e",
811
- "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e",
812
- "shasum": ""
813
- },
814
- "require": {
815
- "php": ">=5.3.3"
816
- },
817
- "require-dev": {
818
- "phpunit/phpunit": "~4.8"
819
- },
820
- "type": "library",
821
- "extra": {
822
- "branch-alias": {
823
- "dev-master": "1.4-dev"
824
- }
825
- },
826
- "autoload": {
827
- "classmap": [
828
- "src/"
829
- ]
830
- },
831
- "notification-url": "https://packagist.org/downloads/",
832
- "license": [
833
- "BSD-3-Clause"
834
- ],
835
- "authors": [
836
- {
837
- "name": "Kore Nordmann",
838
- "email": "mail@kore-nordmann.de"
839
- },
840
- {
841
- "name": "Sebastian Bergmann",
842
- "email": "sebastian@phpunit.de"
843
- }
844
- ],
845
- "description": "Diff implementation",
846
- "homepage": "https://github.com/sebastianbergmann/diff",
847
- "keywords": [
848
- "diff"
849
- ],
850
- "time": "2015-12-08 07:14:41"
851
- },
852
- {
853
- "name": "sebastian/environment",
854
- "version": "1.3.7",
855
- "source": {
856
- "type": "git",
857
- "url": "https://github.com/sebastianbergmann/environment.git",
858
- "reference": "4e8f0da10ac5802913afc151413bc8c53b6c2716"
859
- },
860
- "dist": {
861
- "type": "zip",
862
- "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/4e8f0da10ac5802913afc151413bc8c53b6c2716",
863
- "reference": "4e8f0da10ac5802913afc151413bc8c53b6c2716",
864
- "shasum": ""
865
- },
866
- "require": {
867
- "php": ">=5.3.3"
868
- },
869
- "require-dev": {
870
- "phpunit/phpunit": "~4.4"
871
- },
872
- "type": "library",
873
- "extra": {
874
- "branch-alias": {
875
- "dev-master": "1.3.x-dev"
876
- }
877
- },
878
- "autoload": {
879
- "classmap": [
880
- "src/"
881
- ]
882
- },
883
- "notification-url": "https://packagist.org/downloads/",
884
- "license": [
885
- "BSD-3-Clause"
886
- ],
887
- "authors": [
888
- {
889
- "name": "Sebastian Bergmann",
890
- "email": "sebastian@phpunit.de"
891
- }
892
- ],
893
- "description": "Provides functionality to handle HHVM/PHP environments",
894
- "homepage": "http://www.github.com/sebastianbergmann/environment",
895
- "keywords": [
896
- "Xdebug",
897
- "environment",
898
- "hhvm"
899
- ],
900
- "time": "2016-05-17 03:18:57"
901
- },
902
- {
903
- "name": "sebastian/exporter",
904
- "version": "1.2.2",
905
- "source": {
906
- "type": "git",
907
- "url": "https://github.com/sebastianbergmann/exporter.git",
908
- "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4"
909
- },
910
- "dist": {
911
- "type": "zip",
912
- "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/42c4c2eec485ee3e159ec9884f95b431287edde4",
913
- "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4",
914
- "shasum": ""
915
- },
916
- "require": {
917
- "php": ">=5.3.3",
918
- "sebastian/recursion-context": "~1.0"
919
- },
920
- "require-dev": {
921
- "ext-mbstring": "*",
922
- "phpunit/phpunit": "~4.4"
923
- },
924
- "type": "library",
925
- "extra": {
926
- "branch-alias": {
927
- "dev-master": "1.3.x-dev"
928
- }
929
- },
930
- "autoload": {
931
- "classmap": [
932
- "src/"
933
- ]
934
- },
935
- "notification-url": "https://packagist.org/downloads/",
936
- "license": [
937
- "BSD-3-Clause"
938
- ],
939
- "authors": [
940
- {
941
- "name": "Jeff Welch",
942
- "email": "whatthejeff@gmail.com"
943
- },
944
- {
945
- "name": "Volker Dusch",
946
- "email": "github@wallbash.com"
947
- },
948
- {
949
- "name": "Bernhard Schussek",
950
- "email": "bschussek@2bepublished.at"
951
- },
952
- {
953
- "name": "Sebastian Bergmann",
954
- "email": "sebastian@phpunit.de"
955
- },
956
- {
957
- "name": "Adam Harvey",
958
- "email": "aharvey@php.net"
959
- }
960
- ],
961
- "description": "Provides the functionality to export PHP variables for visualization",
962
- "homepage": "http://www.github.com/sebastianbergmann/exporter",
963
- "keywords": [
964
- "export",
965
- "exporter"
966
- ],
967
- "time": "2016-06-17 09:04:28"
968
- },
969
- {
970
- "name": "sebastian/global-state",
971
- "version": "1.1.1",
972
- "source": {
973
- "type": "git",
974
- "url": "https://github.com/sebastianbergmann/global-state.git",
975
- "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4"
976
- },
977
- "dist": {
978
- "type": "zip",
979
- "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4",
980
- "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4",
981
- "shasum": ""
982
- },
983
- "require": {
984
- "php": ">=5.3.3"
985
- },
986
- "require-dev": {
987
- "phpunit/phpunit": "~4.2"
988
- },
989
- "suggest": {
990
- "ext-uopz": "*"
991
- },
992
- "type": "library",
993
- "extra": {
994
- "branch-alias": {
995
- "dev-master": "1.0-dev"
996
- }
997
- },
998
- "autoload": {
999
- "classmap": [
1000
- "src/"
1001
- ]
1002
- },
1003
- "notification-url": "https://packagist.org/downloads/",
1004
- "license": [
1005
- "BSD-3-Clause"
1006
- ],
1007
- "authors": [
1008
- {
1009
- "name": "Sebastian Bergmann",
1010
- "email": "sebastian@phpunit.de"
1011
- }
1012
- ],
1013
- "description": "Snapshotting of global state",
1014
- "homepage": "http://www.github.com/sebastianbergmann/global-state",
1015
- "keywords": [
1016
- "global state"
1017
- ],
1018
- "time": "2015-10-12 03:26:01"
1019
- },
1020
- {
1021
- "name": "sebastian/recursion-context",
1022
- "version": "1.0.2",
1023
- "source": {
1024
- "type": "git",
1025
- "url": "https://github.com/sebastianbergmann/recursion-context.git",
1026
- "reference": "913401df809e99e4f47b27cdd781f4a258d58791"
1027
- },
1028
- "dist": {
1029
- "type": "zip",
1030
- "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/913401df809e99e4f47b27cdd781f4a258d58791",
1031
- "reference": "913401df809e99e4f47b27cdd781f4a258d58791",
1032
- "shasum": ""
1033
- },
1034
- "require": {
1035
- "php": ">=5.3.3"
1036
- },
1037
- "require-dev": {
1038
- "phpunit/phpunit": "~4.4"
1039
- },
1040
- "type": "library",
1041
- "extra": {
1042
- "branch-alias": {
1043
- "dev-master": "1.0.x-dev"
1044
- }
1045
- },
1046
- "autoload": {
1047
- "classmap": [
1048
- "src/"
1049
- ]
1050
- },
1051
- "notification-url": "https://packagist.org/downloads/",
1052
- "license": [
1053
- "BSD-3-Clause"
1054
- ],
1055
- "authors": [
1056
- {
1057
- "name": "Jeff Welch",
1058
- "email": "whatthejeff@gmail.com"
1059
- },
1060
- {
1061
- "name": "Sebastian Bergmann",
1062
- "email": "sebastian@phpunit.de"
1063
- },
1064
- {
1065
- "name": "Adam Harvey",
1066
- "email": "aharvey@php.net"
1067
- }
1068
- ],
1069
- "description": "Provides functionality to recursively process PHP variables",
1070
- "homepage": "http://www.github.com/sebastianbergmann/recursion-context",
1071
- "time": "2015-11-11 19:50:13"
1072
- },
1073
- {
1074
- "name": "sebastian/version",
1075
- "version": "1.0.6",
1076
- "source": {
1077
- "type": "git",
1078
- "url": "https://github.com/sebastianbergmann/version.git",
1079
- "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6"
1080
- },
1081
- "dist": {
1082
- "type": "zip",
1083
- "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6",
1084
- "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6",
1085
- "shasum": ""
1086
- },
1087
- "type": "library",
1088
- "autoload": {
1089
- "classmap": [
1090
- "src/"
1091
- ]
1092
- },
1093
- "notification-url": "https://packagist.org/downloads/",
1094
- "license": [
1095
- "BSD-3-Clause"
1096
- ],
1097
- "authors": [
1098
- {
1099
- "name": "Sebastian Bergmann",
1100
- "email": "sebastian@phpunit.de",
1101
- "role": "lead"
1102
- }
1103
- ],
1104
- "description": "Library that helps with managing the version number of Git-hosted PHP projects",
1105
- "homepage": "https://github.com/sebastianbergmann/version",
1106
- "time": "2015-06-21 13:59:46"
1107
- },
1108
- {
1109
- "name": "squizlabs/php_codesniffer",
1110
- "version": "2.6.1",
1111
- "source": {
1112
- "type": "git",
1113
- "url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
1114
- "reference": "fb72ed32f8418db5e7770be1653e62e0d6f5dd3d"
1115
- },
1116
- "dist": {
1117
- "type": "zip",
1118
- "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/fb72ed32f8418db5e7770be1653e62e0d6f5dd3d",
1119
- "reference": "fb72ed32f8418db5e7770be1653e62e0d6f5dd3d",
1120
- "shasum": ""
1121
- },
1122
- "require": {
1123
- "ext-simplexml": "*",
1124
- "ext-tokenizer": "*",
1125
- "ext-xmlwriter": "*",
1126
- "php": ">=5.1.2"
1127
- },
1128
- "require-dev": {
1129
- "phpunit/phpunit": "~4.0"
1130
- },
1131
- "bin": [
1132
- "scripts/phpcs",
1133
- "scripts/phpcbf"
1134
- ],
1135
- "type": "library",
1136
- "extra": {
1137
- "branch-alias": {
1138
- "dev-master": "2.x-dev"
1139
- }
1140
- },
1141
- "autoload": {
1142
- "classmap": [
1143
- "CodeSniffer.php",
1144
- "CodeSniffer/CLI.php",
1145
- "CodeSniffer/Exception.php",
1146
- "CodeSniffer/File.php",
1147
- "CodeSniffer/Fixer.php",
1148
- "CodeSniffer/Report.php",
1149
- "CodeSniffer/Reporting.php",
1150
- "CodeSniffer/Sniff.php",
1151
- "CodeSniffer/Tokens.php",
1152
- "CodeSniffer/Reports/",
1153
- "CodeSniffer/Tokenizers/",
1154
- "CodeSniffer/DocGenerators/",
1155
- "CodeSniffer/Standards/AbstractPatternSniff.php",
1156
- "CodeSniffer/Standards/AbstractScopeSniff.php",
1157
- "CodeSniffer/Standards/AbstractVariableSniff.php",
1158
- "CodeSniffer/Standards/IncorrectPatternException.php",
1159
- "CodeSniffer/Standards/Generic/Sniffs/",
1160
- "CodeSniffer/Standards/MySource/Sniffs/",
1161
- "CodeSniffer/Standards/PEAR/Sniffs/",
1162
- "CodeSniffer/Standards/PSR1/Sniffs/",
1163
- "CodeSniffer/Standards/PSR2/Sniffs/",
1164
- "CodeSniffer/Standards/Squiz/Sniffs/",
1165
- "CodeSniffer/Standards/Zend/Sniffs/"
1166
- ]
1167
- },
1168
- "notification-url": "https://packagist.org/downloads/",
1169
- "license": [
1170
- "BSD-3-Clause"
1171
- ],
1172
- "authors": [
1173
- {
1174
- "name": "Greg Sherwood",
1175
- "role": "lead"
1176
- }
1177
- ],
1178
- "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
1179
- "homepage": "http://www.squizlabs.com/php-codesniffer",
1180
- "keywords": [
1181
- "phpcs",
1182
- "standards"
1183
- ],
1184
- "time": "2016-05-30 22:24:32"
1185
- },
1186
- {
1187
- "name": "symfony/yaml",
1188
- "version": "v2.8.7",
1189
- "source": {
1190
- "type": "git",
1191
- "url": "https://github.com/symfony/yaml.git",
1192
- "reference": "815fabf3f48c7d1df345a69d1ad1a88f59757b34"
1193
- },
1194
- "dist": {
1195
- "type": "zip",
1196
- "url": "https://api.github.com/repos/symfony/yaml/zipball/815fabf3f48c7d1df345a69d1ad1a88f59757b34",
1197
- "reference": "815fabf3f48c7d1df345a69d1ad1a88f59757b34",
1198
- "shasum": ""
1199
- },
1200
- "require": {
1201
- "php": ">=5.3.9"
1202
- },
1203
- "type": "library",
1204
- "extra": {
1205
- "branch-alias": {
1206
- "dev-master": "2.8-dev"
1207
- }
1208
- },
1209
- "autoload": {
1210
- "psr-4": {
1211
- "Symfony\\Component\\Yaml\\": ""
1212
- },
1213
- "exclude-from-classmap": [
1214
- "/Tests/"
1215
- ]
1216
- },
1217
- "notification-url": "https://packagist.org/downloads/",
1218
- "license": [
1219
- "MIT"
1220
- ],
1221
- "authors": [
1222
- {
1223
- "name": "Fabien Potencier",
1224
- "email": "fabien@symfony.com"
1225
- },
1226
- {
1227
- "name": "Symfony Community",
1228
- "homepage": "https://symfony.com/contributors"
1229
- }
1230
- ],
1231
- "description": "Symfony Yaml Component",
1232
- "homepage": "https://symfony.com",
1233
- "time": "2016-06-06 11:11:27"
1234
- }
1235
- ],
1236
- "aliases": [],
1237
- "minimum-stability": "stable",
1238
- "stability-flags": [],
1239
- "prefer-stable": false,
1240
- "prefer-lowest": false,
1241
- "platform": {
1242
- "php": "^5.4 || ^7.0"
1243
- },
1244
- "platform-dev": []
1245
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/ElementGetter.php CHANGED
@@ -53,7 +53,7 @@ class ElementGetter extends AbstractGetter
53
  public function get($node)
54
  {
55
  $elements = self::findAll($node, $this->selector);
56
- if (!empty($elements)) {
57
  Transformer::markAsProcessed($elements->item(0));
58
  return Transformer::cloneNode($elements->item(0));
59
  }
53
  public function get($node)
54
  {
55
  $elements = self::findAll($node, $this->selector);
56
+ if (!empty($elements) && property_exists($elements, 'length') && $elements->length !== 0) {
57
  Transformer::markAsProcessed($elements->item(0));
58
  return Transformer::cloneNode($elements->item(0));
59
  }
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/InstantArticleRule.php CHANGED
@@ -44,7 +44,6 @@ class InstantArticleRule extends ConfigurationSelectorRule
44
  );
45
 
46
  return $canonical_rule;
47
-
48
  }
49
 
50
  public function apply($transformer, $instant_article, $node)
44
  );
45
 
46
  return $canonical_rule;
 
47
  }
48
 
49
  public function apply($transformer, $instant_article, $node)
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/TimeRule.php CHANGED
@@ -44,7 +44,6 @@ class TimeRule extends ConfigurationSelectorRule
44
  }
45
 
46
  return $time_rule;
47
-
48
  }
49
 
50
  public function apply($transformer, $header, $node)
44
  }
45
 
46
  return $time_rule;
 
47
  }
48
 
49
  public function apply($transformer, $header, $node)
vendor/facebook/graph-sdk/LICENSE ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/composer.json ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/phpcs.xml.dist ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <ruleset>
3
+ <file>src/</file>
4
+ <file>tests/</file>
5
+ <arg value="spn" />
6
+ <rule ref="PSR2" />
7
+ </ruleset>
vendor/facebook/graph-sdk/src/Facebook/Authentication/AccessToken.php ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/Authentication/AccessTokenMetadata.php ADDED
@@ -0,0 +1,390 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/Authentication/OAuth2Client.php ADDED
@@ -0,0 +1,292 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/Exceptions/FacebookAuthenticationException.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/Exceptions/FacebookAuthorizationException.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/Exceptions/FacebookClientException.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/Exceptions/FacebookOtherException.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/Exceptions/FacebookResponseException.php ADDED
@@ -0,0 +1,214 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/Exceptions/FacebookResumableUploadException.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/Exceptions/FacebookSDKException.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/Exceptions/FacebookServerException.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/Exceptions/FacebookThrottleException.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/Facebook.php ADDED
@@ -0,0 +1,614 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/FacebookApp.php ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/FacebookBatchRequest.php ADDED
@@ -0,0 +1,303 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/FacebookBatchResponse.php ADDED
@@ -0,0 +1,174 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/FacebookClient.php ADDED
@@ -0,0 +1,250 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/FacebookRequest.php ADDED
@@ -0,0 +1,534 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/FacebookResponse.php ADDED
@@ -0,0 +1,410 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/FileUpload/FacebookFile.php ADDED
@@ -0,0 +1,169 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/FileUpload/FacebookResumableUploader.php ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/FileUpload/FacebookTransferChunk.php ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/FileUpload/FacebookVideo.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/FileUpload/Mimetypes.php ADDED
@@ -0,0 +1,987 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/GraphNodes/Birthday.php ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/GraphNodes/Collection.php ADDED
@@ -0,0 +1,242 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/GraphNodes/GraphAchievement.php ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/GraphNodes/GraphAlbum.php ADDED
@@ -0,0 +1,183 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/GraphNodes/GraphApplication.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/GraphNodes/GraphCoverPhoto.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/GraphNodes/GraphEdge.php ADDED
@@ -0,0 +1,238 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/GraphNodes/GraphEvent.php ADDED
@@ -0,0 +1,242 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/GraphNodes/GraphGroup.php ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/GraphNodes/GraphList.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/GraphNodes/GraphLocation.php ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/GraphNodes/GraphNode.php ADDED
@@ -0,0 +1,197 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/GraphNodes/GraphNodeFactory.php ADDED
@@ -0,0 +1,392 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/GraphNodes/GraphObject.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/GraphNodes/GraphObjectFactory.php ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/GraphNodes/GraphPage.php ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/GraphNodes/GraphPicture.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/GraphNodes/GraphSessionInfo.php ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/GraphNodes/GraphUser.php ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/Helpers/FacebookCanvasHelper.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/Helpers/FacebookJavaScriptHelper.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/Helpers/FacebookPageTabHelper.php ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/Helpers/FacebookRedirectLoginHelper.php ADDED
@@ -0,0 +1,333 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/Helpers/FacebookSignedRequestFromInputHelper.php ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/Http/GraphRawResponse.php ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/Http/RequestBodyInterface.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/Http/RequestBodyMultipart.php ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/Http/RequestBodyUrlEncoded.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/HttpClients/FacebookCurl.php ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/HttpClients/FacebookCurlHttpClient.php ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/HttpClients/FacebookGuzzleHttpClient.php ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/HttpClients/FacebookHttpClientInterface.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/HttpClients/FacebookStream.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/HttpClients/FacebookStreamHttpClient.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/HttpClients/HttpClientsFactory.php ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/HttpClients/certs/DigiCertHighAssuranceEVRootCA.pem ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/PersistentData/FacebookMemoryPersistentDataHandler.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/PersistentData/FacebookSessionPersistentDataHandler.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/PersistentData/PersistentDataFactory.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/PersistentData/PersistentDataInterface.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/PseudoRandomString/McryptPseudoRandomStringGenerator.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/PseudoRandomString/OpenSslPseudoRandomStringGenerator.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorFactory.php ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorInterface.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorTrait.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/PseudoRandomString/UrandomPseudoRandomStringGenerator.php ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/SignedRequest.php ADDED
@@ -0,0 +1,326 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/Url/FacebookUrlDetectionHandler.php ADDED
@@ -0,0 +1,182 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/Url/FacebookUrlManipulator.php ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/Url/UrlDetectionInterface.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/autoload.php ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/graph-sdk/src/Facebook/polyfills.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ }
wizard/class-instant-articles-option-publishing.php CHANGED
@@ -43,16 +43,16 @@ class Instant_Articles_Option_Publishing extends Instant_Articles_Option {
43
  'label' => '',
44
  'render' => 'textarea',
45
  'placeholder' => '{ "rules": [{ "class": "BoldRule", "selector": "span.bold" }, ... ] }',
46
- 'description' => 'Read more about <a href="https://github.com/facebook/facebook-instant-articles-sdk-php/blob/master/docs/QuickStart.md#custom-transformer-rules" target="_blank">defining your own custom rules</a> to extend/override the <a href="https://github.com/Automattic/facebook-instant-articles-wp/blob/master/rules-configuration.json" target="_blank">built-in ruleset</a>. If you\'ve defined a common rule which you think this plugin should include by default, <a href="https://github.com/Automattic/facebook-instant-articles-wp/issues/new" target="_blank">tell us about it</a>!',
47
  'default' => '',
48
  ),
49
 
50
- 'block_publish_with_warnings' => array(
51
  'label' => 'Transformation warnings',
52
- 'description' => 'Articles won\'t be available as Instant Articles if transformation process contains warnings. Note: All warnings should be fixed in order to have them available as Instant Articles.',
53
  'render' => 'checkbox',
54
  'default' => false,
55
- 'checkbox_label' => 'Don\'t publish with warnings',
56
  ),
57
  );
58
 
43
  'label' => '',
44
  'render' => 'textarea',
45
  'placeholder' => '{ "rules": [{ "class": "BoldRule", "selector": "span.bold" }, ... ] }',
46
+ 'description' => 'Read more about <a href="https://developers.facebook.com/docs/instant-articles/sdk/transformer-rules" target="_blank">defining your own custom rules</a> to extend/override the <a href="https://github.com/Automattic/facebook-instant-articles-wp/blob/master/rules-configuration.json" target="_blank">built-in ruleset</a>. If you\'ve defined a common rule which you think this plugin should include by default, <a href="https://github.com/Automattic/facebook-instant-articles-wp/issues/new" target="_blank">tell us about it</a>!',
47
  'default' => '',
48
  ),
49
 
50
+ 'publish_with_warnings' => array(
51
  'label' => 'Transformation warnings',
52
+ 'description' => 'With this option disabled, articles which contain warnings in their transformation process won\'t be available as Instant Articles by default this can be overridden on individual articles. Note: It is recommended that all transformation warnings be fixed.',
53
  'render' => 'checkbox',
54
  'default' => false,
55
+ 'checkbox_label' => 'Publish articles containing warnings',
56
  ),
57
  );
58
 
wizard/class-instant-articles-wizard.php CHANGED
@@ -173,14 +173,14 @@ class Instant_Articles_Wizard {
173
  $fb_app_settings = Instant_Articles_Option_FB_App::get_option_decoded();
174
  $fb_page_settings = Instant_Articles_Option_FB_Page::get_option_decoded();
175
 
176
- $client = Client::create(
177
- $fb_app_settings[ 'app_id' ],
178
- $fb_app_settings[ 'app_secret' ],
179
- $fb_page_settings[ 'page_access_token' ],
180
- $fb_page_settings[ 'page_id' ]
181
- );
182
-
183
  try {
 
 
 
 
 
 
 
184
  // Bulk upload articles for review
185
  $articles_for_review = Instant_Articles_Wizard_Review_Submission::getArticlesForReview();
186
  foreach ( $articles_for_review as $post ) {
@@ -236,72 +236,101 @@ class Instant_Articles_Wizard {
236
  wp_die( esc_html( 'You do not have sufficient permissions to access this page.' ) );
237
  }
238
 
239
- // Read options (they are used on the templates)
240
- $current_state = Instant_Articles_Wizard_State::get_current_state();
241
- $fb_page_settings = Instant_Articles_Option_FB_Page::get_option_decoded();
242
- $fb_app_settings = Instant_Articles_Option_FB_App::get_option_decoded();
243
- $fb_helper = new Instant_Articles_Wizard_FB_Helper();
244
- $settings_url = self::get_url();
245
-
246
- // Handle redirection from Login flow
247
- // ----------------------------------
248
- // Only during STATE_APP_SETUP
249
- if ( $current_state === Instant_Articles_Wizard_State::STATE_APP_SETUP ) {
250
- $user_access_token = $fb_helper->get_fb_access_token();
251
- $permissions = $fb_helper->get_fb_permissions( $user_access_token );
252
-
253
- // Trigger transition if all needed permissions are granted
254
- if ( $user_access_token && isset( $permissions[ 'pages_manage_instant_articles' ] ) && isset( $permissions[ 'pages_show_list' ] ) ) {
255
- Instant_Articles_Wizard_State::do_transition( Instant_Articles_Wizard_State::STATE_PAGE_SELECTION, array(
256
- 'app_id' => $fb_app_settings[ 'app_id' ],
257
- 'app_secret' => $fb_app_settings[ 'app_secret' ],
258
- 'user_access_token' => $user_access_token->getValue()
259
- ) );
260
- // Override step
261
- $current_state = Instant_Articles_Wizard_State::get_current_state();
262
- }
263
- }
264
- // ----------------------------------
265
-
266
- // Handle redirection from Login flow
267
- // ----------------------------------
268
- // Only during STATE_PAGE_SELECTION
269
- if ( $current_state === Instant_Articles_Wizard_State::STATE_PAGE_SELECTION ) {
270
  $fb_helper = new Instant_Articles_Wizard_FB_Helper();
271
- try {
272
- $pages = $fb_helper->get_pages();
273
- } catch ( Facebook\Exceptions\FacebookSDKException $e ) {
274
- // If we couldn't fetch the pages, revert to the App setup
275
- Instant_Articles_Wizard_State::do_transition( Instant_Articles_Wizard_State::STATE_APP_SETUP );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
276
  }
277
- }
278
-
279
- // Grabs the current configured style
280
- // ----------------------------------
281
- // Only during STATE_STYLE_SELECTION
282
- if ( $current_state === Instant_Articles_Wizard_State::STATE_STYLE_SELECTION ) {
283
- $settings_style = Instant_Articles_Option_Styles::get_option_decoded();
284
- if ( isset( $settings_style['article_style'] ) && ! empty( $settings_style['article_style'] ) ) {
285
- $article_style = $settings_style['article_style'];
286
- } else {
287
- $article_style = 'default';
 
 
288
  }
289
- }
290
- // ----------------------------------
291
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
292
 
293
- // Check submission status
294
- // ----------------------------------
295
- // Only during STATE_REVIEW_SUBMISSION
296
- if ( $current_state === Instant_Articles_Wizard_State::STATE_REVIEW_SUBMISSION ) {
297
- $review_submission_status = Instant_Articles_Wizard_Review_Submission::getReviewSubmissionStatus();
298
- if ( $review_submission_status === Instant_Articles_Wizard_Review_Submission::STATUS_NOT_SUBMITTED ) {
299
- $articles_for_review = Instant_Articles_Wizard_Review_Submission::getArticlesForReview();
 
 
 
 
300
  }
301
  }
302
- // ----------------------------------
303
-
304
- include( dirname( __FILE__ ) . '/templates/wizard-template.php' );
305
  }
306
 
307
  }
173
  $fb_app_settings = Instant_Articles_Option_FB_App::get_option_decoded();
174
  $fb_page_settings = Instant_Articles_Option_FB_Page::get_option_decoded();
175
 
 
 
 
 
 
 
 
176
  try {
177
+ $client = Client::create(
178
+ $fb_app_settings[ 'app_id' ],
179
+ $fb_app_settings[ 'app_secret' ],
180
+ $fb_page_settings[ 'page_access_token' ],
181
+ $fb_page_settings[ 'page_id' ]
182
+ );
183
+
184
  // Bulk upload articles for review
185
  $articles_for_review = Instant_Articles_Wizard_Review_Submission::getArticlesForReview();
186
  foreach ( $articles_for_review as $post ) {
236
  wp_die( esc_html( 'You do not have sufficient permissions to access this page.' ) );
237
  }
238
 
239
+ try {
240
+ // Read options (they are used on the templates)
241
+ $current_state = Instant_Articles_Wizard_State::get_current_state();
242
+ $fb_page_settings = Instant_Articles_Option_FB_Page::get_option_decoded();
243
+ $fb_app_settings = Instant_Articles_Option_FB_App::get_option_decoded();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
244
  $fb_helper = new Instant_Articles_Wizard_FB_Helper();
245
+ $settings_url = self::get_url();
246
+
247
+ // Handle redirection from Login flow
248
+ // ----------------------------------
249
+ // Only during STATE_APP_SETUP
250
+ if ( $current_state === Instant_Articles_Wizard_State::STATE_APP_SETUP ) {
251
+ $user_access_token = $fb_helper->get_fb_access_token();
252
+ $permissions = $fb_helper->get_fb_permissions( $user_access_token );
253
+
254
+ // Trigger transition if all needed permissions are granted
255
+ if ( $user_access_token && isset( $permissions[ 'pages_manage_instant_articles' ] ) && isset( $permissions[ 'pages_show_list' ] ) ) {
256
+ Instant_Articles_Wizard_State::do_transition( Instant_Articles_Wizard_State::STATE_PAGE_SELECTION, array(
257
+ 'app_id' => $fb_app_settings[ 'app_id' ],
258
+ 'app_secret' => $fb_app_settings[ 'app_secret' ],
259
+ 'user_access_token' => $user_access_token->getValue()
260
+ ) );
261
+ // Override step
262
+ $current_state = Instant_Articles_Wizard_State::get_current_state();
263
+ }
264
  }
265
+ // ----------------------------------
266
+
267
+ // Handle redirection from Login flow
268
+ // ----------------------------------
269
+ // Only during STATE_PAGE_SELECTION
270
+ if ( $current_state === Instant_Articles_Wizard_State::STATE_PAGE_SELECTION ) {
271
+ $fb_helper = new Instant_Articles_Wizard_FB_Helper();
272
+ try {
273
+ $pages = $fb_helper->get_pages();
274
+ } catch ( Exception $e ) {
275
+ // If we couldn't fetch the pages, revert to the App setup
276
+ Instant_Articles_Wizard_State::do_transition( Instant_Articles_Wizard_State::STATE_APP_SETUP );
277
+ }
278
  }
 
 
279
 
280
+ // Grabs the current configured style
281
+ // ----------------------------------
282
+ // Only during STATE_STYLE_SELECTION
283
+ if ( $current_state === Instant_Articles_Wizard_State::STATE_STYLE_SELECTION ) {
284
+ $settings_style = Instant_Articles_Option_Styles::get_option_decoded();
285
+ if ( isset( $settings_style['article_style'] ) && ! empty( $settings_style['article_style'] ) ) {
286
+ $article_style = $settings_style['article_style'];
287
+ } else {
288
+ $article_style = 'default';
289
+ }
290
+ }
291
+ // ----------------------------------
292
+
293
+
294
+ // Check submission status
295
+ // ----------------------------------
296
+ // Only during STATE_REVIEW_SUBMISSION
297
+ if ( $current_state === Instant_Articles_Wizard_State::STATE_REVIEW_SUBMISSION ) {
298
+ $review_submission_status = Instant_Articles_Wizard_Review_Submission::getReviewSubmissionStatus();
299
+
300
+ if ( $review_submission_status === Instant_Articles_Wizard_Review_Submission::STATUS_NOT_SUBMITTED ) {
301
+ $articles_for_review = Instant_Articles_Wizard_Review_Submission::getArticlesForReview();
302
+
303
+ // Map to Instant_Articles_Post instances
304
+ $instant_articles_for_review = array_map( function ( $article ) {
305
+ $instant_articles_post = new Instant_Articles_Post( $article );
306
+ // Call transformation to load warnings
307
+ $instant_articles_post->to_instant_article();
308
+ return $instant_articles_post;
309
+ }, $articles_for_review );
310
+
311
+ // Filter articles with warnings and not forced
312
+ $instant_articles_with_warnings = array_filter( $instant_articles_for_review, function ( $article ) {
313
+ $has_warnings = ( count( $article->transformer->getWarnings() ) > 0 );
314
+ $force_submit = get_post_meta( $article->get_the_id(), Instant_Articles_Publisher::FORCE_SUBMIT_KEY, true );
315
+ return $has_warnings && ! $force_submit;
316
+ } );
317
+ }
318
+ }
319
+ // ----------------------------------
320
 
321
+ include( dirname( __FILE__ ) . '/templates/wizard-template.php' );
322
+ } catch (Exception $e) {
323
+ if ( Instant_Articles_Wizard_State::get_current_state() !== Instant_Articles_Wizard_State::STATE_APP_SETUP ) {
324
+ // Restarts the wizard
325
+ Instant_Articles_Wizard_State::do_transition( Instant_Articles_Wizard_State::STATE_APP_SETUP );
326
+ echo '<div class="error settings-error notice is-dismissible"><p><strong>'.
327
+ esc_html(
328
+ 'Error processing your request. Check server log for more details. Setup and login again to renew Application credentials. Error message: ' .
329
+ $e->getMessage()
330
+ ) . '</strong></p></div>';
331
+ Instant_Articles_Wizard::render( $ajax, true );
332
  }
333
  }
 
 
 
334
  }
335
 
336
  }
wizard/templates/app-setup-template.php CHANGED
@@ -12,7 +12,7 @@
12
  <!-- Step 1: grab your App ID and App Secret -->
13
  <div class="instant-articles-card">
14
  <div class="instant-articles-card-title">
15
- <h3>Log In with Your Developers App and Facebook Account</h3>
16
  <div class="instant-articles-card-title-right">
17
  <span class="instant-articles-card-title-step">Step 1 of 2</span>
18
  </div>
@@ -23,11 +23,11 @@
23
 
24
  <p>You'll need to log in with your Facebook Developers App ID to connect your plugin to the Facebook Page you'll use to publish your Instant Articles.</p>
25
 
26
- <p><strong>Already have an App ID and Secret?</strong> Just enter them to the right.</p>
27
 
28
  <p><strong>Need to create one?</strong></p>
29
 
30
- <p>Click on the 'Get App ID' button below to begin the process of getting your App ID and Secret. This will open the App set up page in a new tab. Then, follow these steps:</p>
31
 
32
  <ol>
33
  <li>Click on the green '+ Add a New App' button in the upper right corner of the page.</li>
@@ -37,10 +37,10 @@
37
  <li>Click '+Add Platform' at the bottom of the page and select 'Website.'</li>
38
  <li>Under both the 'App Domains' in the main section and 'Site URL' in the 'Website' section, enter this domain: <b><?php echo esc_url( self::get_admin_url() ); ?></b></li>
39
  <li>Click 'Save Changes' in the lower right corner.</li>
40
- <li>Select 'Show' to see your App Secret. Copy your App ID and Secret and enter them to the right.</li>
41
  </ol>
42
 
43
- <p><strong>Need more help?</strong> <a href="https://developers.facebook.com/docs/instant-articles/wordpress-quickstart#appid" target="_blank">See detailed instructions on setting up your App ID in our documentation</a>.</p>
44
 
45
  <a class="instant-articles-button" href="https://developers.facebook.com/apps" target="_blank">
46
  Get App ID
12
  <!-- Step 1: grab your App ID and App Secret -->
13
  <div class="instant-articles-card">
14
  <div class="instant-articles-card-title">
15
+ <h3>Log In With Your Developers App and Facebook Account</h3>
16
  <div class="instant-articles-card-title-right">
17
  <span class="instant-articles-card-title-step">Step 1 of 2</span>
18
  </div>
23
 
24
  <p>You'll need to log in with your Facebook Developers App ID to connect your plugin to the Facebook Page you'll use to publish your Instant Articles.</p>
25
 
26
+ <p><strong>Already have an App ID and App Secret?</strong> Just enter them to the right.</p>
27
 
28
  <p><strong>Need to create one?</strong></p>
29
 
30
+ <p>Click on the 'Get App ID' button below to begin the process of getting your App ID and App Secret. This will open the app set up page in a new tab. Then, follow these steps:</p>
31
 
32
  <ol>
33
  <li>Click on the green '+ Add a New App' button in the upper right corner of the page.</li>
37
  <li>Click '+Add Platform' at the bottom of the page and select 'Website.'</li>
38
  <li>Under both the 'App Domains' in the main section and 'Site URL' in the 'Website' section, enter this domain: <b><?php echo esc_url( self::get_admin_url() ); ?></b></li>
39
  <li>Click 'Save Changes' in the lower right corner.</li>
40
+ <li>Select 'Show' to see your App Secret. Copy your App ID and App Secret and enter them to the right.</li>
41
  </ol>
42
 
43
+ <p>For more detailed instructions on setting up your App ID, <a href="https://developers.facebook.com/docs/instant-articles/wordpress-quickstart#appid" target="_blank">check out the docs</a>.</p>
44
 
45
  <a class="instant-articles-button" href="https://developers.facebook.com/apps" target="_blank">
46
  Get App ID
wizard/templates/overview-template.php CHANGED
@@ -15,7 +15,7 @@
15
  <div class="instant-articles-card-step">
16
  <img src="<?php echo esc_url( plugin_dir_url( __FILE__ ) ); ?>../../assets/key@2x.png">
17
  <h4>Set Up and Log In</h4>
18
- <p>If you don't have one already, set up your Facebook Developers App. Then log in to connect your plugin.</p>
19
  </div>
20
  <div class="instant-articles-card-step">
21
  <img src="<?php echo esc_url( plugin_dir_url( __FILE__ ) ); ?>../../assets/connect@2x.png">
15
  <div class="instant-articles-card-step">
16
  <img src="<?php echo esc_url( plugin_dir_url( __FILE__ ) ); ?>../../assets/key@2x.png">
17
  <h4>Set Up and Log In</h4>
18
+ <p>If you don't have one already, set up your Facebook Developers App. This will allow you to log in and connect your plugin.</p>
19
  </div>
20
  <div class="instant-articles-card-step">
21
  <img src="<?php echo esc_url( plugin_dir_url( __FILE__ ) ); ?>../../assets/connect@2x.png">
wizard/templates/page-selection-template.php CHANGED
@@ -43,12 +43,10 @@
43
  <img class="instant-articles-page-img" src="<?php echo esc_attr( $page[ 'page_picture' ] ) ?>"/>
44
  <label>
45
  <?php echo esc_html( $page[ 'page_name' ] ) ?>
46
- <?php if ( $page[ 'supports_instant_articles' ] ) : ?>
47
- <span class="page-enabled">✔ Enabled</span>
48
- <?php else : ?>
49
  <span class="page-not-enabled">
50
- This page has not been signed up yet.
51
- <a href="https://www.facebook.com/instant_articles/signup?redirect_uri=<?php echo urlencode( $settings_url ) ?>&page_id=<?php echo urlencode( $page[ 'page_id' ] ) ?>">Sign Up</a>.
52
  </span>
53
  <?php endif; ?>
54
  </label>
43
  <img class="instant-articles-page-img" src="<?php echo esc_attr( $page[ 'page_picture' ] ) ?>"/>
44
  <label>
45
  <?php echo esc_html( $page[ 'page_name' ] ) ?>
46
+ <?php if ( ! $page[ 'supports_instant_articles' ] ) : ?>
 
 
47
  <span class="page-not-enabled">
48
+ First, <a href="https://www.facebook.com/instant_articles/signup?redirect_uri=<?php echo rawurlencode( $settings_url ) ?>&page_id=<?php echo rawurlencode( $page[ 'page_id' ] ) ?>">sign up</a>
49
+ this Page to access the Instant Articles tools through Facebook. Then select it here.
50
  </span>
51
  <?php endif; ?>
52
  </label>
wizard/templates/review-submission-template.php CHANGED
@@ -46,28 +46,62 @@ switch ( $review_submission_status ) :
46
 
47
  case Instant_Articles_Wizard_Review_Submission::STATUS_NOT_SUBMITTED : ?>
48
 
49
- <?php if ( count($articles_for_review) >= Instant_Articles_Wizard_Review_Submission::MIN_ARTICLES ) : ?>
50
- <div class="instant-articles-card">
51
- <div class="instant-articles-card-title">
52
- <h3>Submit for Review</h3>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  </div>
54
- <div class="instant-articles-card-content">
55
- <div class="instant-articles-card-content-box instant-articles-card-content-full">
56
- <p>
57
- The Instant Articles team will review a sample batch of your Instant Articles before you can begin to publish.
58
- Click the 'Submit for Review" button below to send the last <?php echo esc_html( Instant_Articles_Wizard_Review_Submission::MIN_ARTICLES ); ?>
59
- articles you've published to the team for review.
60
- </p>
61
- <p>
62
- It will take us 2 business days to complete the review.
63
- Once we've had a chance to take a look, we'll let you know if you're ready to start publishing or if you need to make some updates.
64
- </p>
65
- <button id="instant-articles-wizard-submit-for-review" class="instant-articles-button instant-articles-button-highlight">
66
- <label>Submit for Review</label>
67
- </button>
 
 
 
 
 
 
68
  </div>
69
  </div>
70
- </div>
71
  <?php else: ?>
72
  <div class="instant-articles-card">
73
  <div class="instant-articles-card-title">
46
 
47
  case Instant_Articles_Wizard_Review_Submission::STATUS_NOT_SUBMITTED : ?>
48
 
49
+ <?php if ( count( $articles_for_review ) >= Instant_Articles_Wizard_Review_Submission::MIN_ARTICLES ) : ?>
50
+ <?php if ( count( $instant_articles_with_warnings ) > 0 ) : ?>
51
+ <div class="instant-articles-card">
52
+ <div class="instant-articles-card-title">
53
+ <h3>Submit for Review</h3>
54
+ </div>
55
+ <div class="instant-articles-card-content">
56
+ <div class="instant-articles-card-content-box instant-articles-card-content-full">
57
+ <p>
58
+ In order to begin publishing Instant Articles, our team needs to review a sample
59
+ batch of <?php echo esc_html( Instant_Articles_Wizard_Review_Submission::MIN_ARTICLES ); ?> of your Instant Articles.
60
+ </p>
61
+ <p>
62
+ The plugin tried to automatically transform your last <?php echo esc_html( Instant_Articles_Wizard_Review_Submission::MIN_ARTICLES ); ?>
63
+ posts into Instant Articles as a sample to submit for review, but some of these posts contained elements the plugin didn't know how to convert.
64
+ </p>
65
+ <p>
66
+ Before submitting for review, you'll need to handle the warnings on these articles by looking at the "Instant Articles" box on the post edit screen:
67
+ </p>
68
+ <ul>
69
+ <?php foreach ($instant_articles_with_warnings as $article): ?>
70
+ <li><?php edit_post_link( $article->get_the_title(), '- ', '', $article->get_the_id() ); ?> </li>
71
+ <?php endforeach; ?>
72
+ </ul>
73
+ <p>
74
+ Once you've handled these warnings, please return to this page and click the 'Submit for Review" button below.
75
+ </p>
76
+ <button id="instant-articles-wizard-submit-for-review" class="instant-articles-button-disabled instant-articles-button instant-articles-button-highlight">
77
+ <label>Submit for Review</label>
78
+ </button>
79
+ </div>
80
+ </div>
81
  </div>
82
+ <?php else: ?>
83
+ <div class="instant-articles-card">
84
+ <div class="instant-articles-card-title">
85
+ <h3>Submit for Review</h3>
86
+ </div>
87
+ <div class="instant-articles-card-content">
88
+ <div class="instant-articles-card-content-box instant-articles-card-content-full">
89
+ <p>
90
+ The Instant Articles team will review a sample batch of your Instant Articles before you can begin to publish.
91
+ Click the 'Submit for Review" button below to send the last <?php echo esc_html( Instant_Articles_Wizard_Review_Submission::MIN_ARTICLES ); ?>
92
+ articles you've published to the team for review.
93
+ </p>
94
+ <p>
95
+ It will take us 2 business days to complete the review.
96
+ Once we've had a chance to take a look, we'll let you know if you're ready to start publishing or if you need to make some updates.
97
+ </p>
98
+ <button id="instant-articles-wizard-submit-for-review" class="instant-articles-button instant-articles-button-highlight">
99
+ <label>Submit for Review</label>
100
+ </button>
101
+ </div>
102
  </div>
103
  </div>
104
+ <?php endif; ?>
105
  <?php else: ?>
106
  <div class="instant-articles-card">
107
  <div class="instant-articles-card-title">
wizard/templates/style-selection-template.php CHANGED
@@ -40,12 +40,12 @@
40
  <div class="instant-articles-card-content-box instant-articles-card-content-full">
41
  <p>
42
  Customize the look and feel of your articles with one or more unique styles.
43
- Try to make your Instant Articles look as much like your mobile web articles as possible
44
- and be sure to upload your publication or blog's logo.
45
  <a href="https://developers.facebook.com/docs/instant-articles/guides/design" target="_blank">Learn more in our design guidelines</a>.
46
  </p>
47
  <p>
48
- Want to preview your style? Download Facebook Pages Manager on your
49
  <a href="https://itunes.apple.com/us/app/facebook-pages-manager/id514643583?mt=8" target="_blank">iPhone</a>
50
  or
51
  <a href="https://play.google.com/store/apps/details?id=com.facebook.pages.app" target="_blank">Android</a>
40
  <div class="instant-articles-card-content-box instant-articles-card-content-full">
41
  <p>
42
  Customize the look and feel of your articles with one or more unique styles.
43
+ Try to have design consistency between your Instant Articles and mobile
44
+ web articles and also ensure you upload your publication or blog's logo.
45
  <a href="https://developers.facebook.com/docs/instant-articles/guides/design" target="_blank">Learn more in our design guidelines</a>.
46
  </p>
47
  <p>
48
+ Want to preview how your articles will look? Download Facebook Pages Manager on your
49
  <a href="https://itunes.apple.com/us/app/facebook-pages-manager/id514643583?mt=8" target="_blank">iPhone</a>
50
  or
51
  <a href="https://play.google.com/store/apps/details?id=com.facebook.pages.app" target="_blank">Android</a>
wizard/templates/wizard-template.php CHANGED
@@ -98,15 +98,18 @@
98
 
99
  <?php if ( ! $ajax ) : ?>
100
  </div>
 
101
  <?php if ( count( get_settings_errors() ) !== 0 ) : ?>
102
- <a class="instant-articles-advanced-settings instant-articles-wizard-toggle" href="#">▼ Advanced Settings</a>
103
- <div class="instant-articles-wizard-advanced-settings-box" style="display: block;">
104
- <?php include( dirname( __FILE__ ) . '/advanced-template.php' ); ?>
105
- </div>
106
  <?php else: ?>
107
- <a class="instant-articles-advanced-settings instant-articles-wizard-toggle" href="#">► Advanced Settings</a>
108
- <div class="instant-articles-wizard-advanced-settings-box" style="display: none;">
109
- <?php include( dirname( __FILE__ ) . '/advanced-template.php' ); ?>
110
- </div>
111
  <?php endif; ?>
 
 
 
 
 
 
 
 
112
  <?php endif; ?>
98
 
99
  <?php if ( ! $ajax ) : ?>
100
  </div>
101
+
102
  <?php if ( count( get_settings_errors() ) !== 0 ) : ?>
103
+ <p class="instant-articles-advanced-settings" data-state="opened">
 
 
 
104
  <?php else: ?>
105
+ <p class="instant-articles-advanced-settings" data-state="closed">
 
 
 
106
  <?php endif; ?>
107
+
108
+ <span class="instant-articles-wizard-toggle instant-articles-wizard-toggle-closed">Already set up? <a href="#">Open Advanced Settings now</a></span>
109
+ <span class="instant-articles-wizard-toggle instant-articles-wizard-toggle-opened"><a href="#">Close Advanced Settings</a></span>
110
+ </p>
111
+
112
+ <div class="instant-articles-wizard-advanced-settings-box">
113
+ <?php include( dirname( __FILE__ ) . '/advanced-template.php' ); ?>
114
+ </div>
115
  <?php endif; ?>