Nextend Social Login and Register (Facebook, Google, Twitter) - Version 3.0.1

Version Description

3.0 is a major update. Please review the update guide before upgrading: https://nextendweb.com/nextend-social-login-docs/upgrade-nextend-social-login-3/

=

Download this release

Release Info

Developer nextendweb
Plugin Icon 128x128 Nextend Social Login and Register (Facebook, Google, Twitter)
Version 3.0.1
Comparing to
See all releases

Code changes from version 2.0.2 to 3.0.1

Files changed (175) hide show
  1. Facebook/FileUpload/Mimetypes.php +0 -988
  2. admin/admin.php +416 -0
  3. admin/images/buttons/default.png +0 -0
  4. admin/images/buttons/icon.png +0 -0
  5. admin/images/error.png +0 -0
  6. admin/images/exclamation-mark.png +0 -0
  7. admin/images/layouts/above-separator.png +0 -0
  8. admin/images/layouts/above.png +0 -0
  9. admin/images/layouts/below-floating.png +0 -0
  10. admin/images/layouts/below-separator.png +0 -0
  11. admin/images/layouts/below.png +0 -0
  12. admin/images/nsl-logo.png +0 -0
  13. admin/images/ok.png +0 -0
  14. admin/images/padlock.png +0 -0
  15. admin/images/test-needed.png +0 -0
  16. admin/notices.php +70 -0
  17. admin/style.css +331 -0
  18. admin/templates-provider/buttons.php +169 -0
  19. admin/templates-provider/menu.php +15 -0
  20. admin/templates-provider/settings-pro.php +123 -0
  21. admin/templates-provider/usage.php +37 -0
  22. admin/templates/footer.php +4 -0
  23. admin/templates/global-settings-pro.php +208 -0
  24. admin/templates/global-settings.php +107 -0
  25. admin/templates/header.php +21 -0
  26. admin/templates/menu.php +14 -0
  27. admin/templates/pro-addon.php +244 -0
  28. admin/templates/pro.php +65 -0
  29. admin/templates/provider.php +6 -0
  30. admin/templates/providers.php +165 -0
  31. admin/upgrader.php +87 -0
  32. buttons/facebook-btn.css +0 -397
  33. class-settings.php +76 -0
  34. compat.php +35 -0
  35. includes/auth.php +34 -0
  36. includes/curl/ArrayUtil.php +73 -0
  37. includes/curl/CaseInsensitiveArray.php +218 -0
  38. includes/curl/Curl.php +1648 -0
  39. includes/curl/Decoder.php +50 -0
  40. includes/curl/StrUtil.php +18 -0
  41. includes/curl/Url.php +169 -0
  42. includes/oauth2.php +214 -0
  43. includes/provider-dummy.php +96 -0
  44. includes/provider.php +982 -0
  45. js/nsl.js +65 -0
  46. languages/nextend-facebook-connect-hu_HU.mo +0 -0
  47. languages/nextend-facebook-connect-hu_HU.po +1341 -0
  48. languages/nextend-facebook-connect.mo +0 -0
  49. languages/nextend-facebook-connect.po +1293 -0
  50. nextend-facebook-connect.php +12 -559
  51. nextend-facebook-settings.php +0 -270
  52. nextend-social-login.php +633 -0
  53. persistent.php +81 -0
  54. providers/facebook/admin/getting-started.php +40 -0
  55. providers/facebook/admin/import.php +45 -0
  56. providers/facebook/admin/settings.php +68 -0
  57. {Facebook → providers/facebook/compat/Facebook}/Authentication/AccessToken.php +14 -21
  58. {Facebook → providers/facebook/compat/Facebook}/Authentication/AccessTokenMetadata.php +37 -59
  59. {Facebook → providers/facebook/compat/Facebook}/Authentication/OAuth2Client.php +32 -57
  60. {Facebook → providers/facebook/compat/Facebook}/Exceptions/FacebookAuthenticationException.php +3 -2
  61. {Facebook → providers/facebook/compat/Facebook}/Exceptions/FacebookAuthorizationException.php +3 -2
  62. {Facebook → providers/facebook/compat/Facebook}/Exceptions/FacebookClientException.php +3 -2
  63. {Facebook → providers/facebook/compat/Facebook}/Exceptions/FacebookOtherException.php +3 -2
  64. {Facebook → providers/facebook/compat/Facebook}/Exceptions/FacebookResponseException.php +15 -23
  65. {Facebook → providers/facebook/compat/Facebook}/Exceptions/FacebookResumableUploadException.php +3 -2
  66. {Facebook → providers/facebook/compat/Facebook}/Exceptions/FacebookSDKException.php +3 -2
  67. {Facebook → providers/facebook/compat/Facebook}/Exceptions/FacebookServerException.php +3 -2
  68. {Facebook → providers/facebook/compat/Facebook}/Exceptions/FacebookThrottleException.php +3 -2
  69. {Facebook → providers/facebook/compat/Facebook}/Facebook.php +69 -141
  70. {Facebook → providers/facebook/compat/Facebook}/FacebookApp.php +16 -19
  71. {Facebook → providers/facebook/compat/Facebook}/FacebookBatchRequest.php +26 -38
  72. {Facebook → providers/facebook/compat/Facebook}/FacebookBatchResponse.php +19 -32
  73. {Facebook → providers/facebook/compat/Facebook}/FacebookClient.php +15 -28
  74. {Facebook → providers/facebook/compat/Facebook}/FacebookRequest.php +48 -72
  75. {Facebook → providers/facebook/compat/Facebook}/FacebookResponse.php +34 -59
  76. {Facebook → providers/facebook/compat/Facebook}/FileUpload/FacebookFile.php +19 -27
  77. {Facebook → providers/facebook/compat/Facebook}/FileUpload/FacebookResumableUploader.php +25 -28
  78. {Facebook → providers/facebook/compat/Facebook}/FileUpload/FacebookTransferChunk.php +18 -24
  79. {Facebook → providers/facebook/compat/Facebook}/FileUpload/FacebookVideo.php +3 -2
  80. providers/facebook/compat/Facebook/FileUpload/Mimetypes.php +986 -0
  81. {Facebook → providers/facebook/compat/Facebook}/GraphNodes/Birthday.php +6 -8
  82. {Facebook → providers/facebook/compat/Facebook}/GraphNodes/Collection.php +21 -36
  83. {Facebook → providers/facebook/compat/Facebook}/GraphNodes/GraphAchievement.php +11 -17
  84. {Facebook → providers/facebook/compat/Facebook}/GraphNodes/GraphAlbum.php +18 -31
  85. {Facebook → providers/facebook/compat/Facebook}/GraphNodes/GraphApplication.php +4 -4
  86. {Facebook → providers/facebook/compat/Facebook}/GraphNodes/GraphCoverPhoto.php +8 -11
  87. {Facebook → providers/facebook/compat/Facebook}/GraphNodes/GraphEdge.php +21 -40
  88. {Facebook → providers/facebook/compat/Facebook}/GraphNodes/GraphEvent.php +26 -45
  89. {Facebook → providers/facebook/compat/Facebook}/GraphNodes/GraphGroup.php +16 -28
  90. {Facebook → providers/facebook/compat/Facebook}/GraphNodes/GraphList.php +5 -4
  91. {Facebook → providers/facebook/compat/Facebook}/GraphNodes/GraphLocation.php +10 -16
  92. {Facebook → providers/facebook/compat/Facebook}/GraphNodes/GraphNode.php +14 -30
  93. {Facebook → providers/facebook/compat/Facebook}/GraphNodes/GraphNodeFactory.php +27 -53
  94. {Facebook → providers/facebook/compat/Facebook}/GraphNodes/GraphObject.php +5 -4
  95. {Facebook → providers/facebook/compat/Facebook}/GraphNodes/GraphObjectFactory.php +8 -10
  96. {Facebook → providers/facebook/compat/Facebook}/GraphNodes/GraphPage.php +17 -26
  97. {Facebook → providers/facebook/compat/Facebook}/GraphNodes/GraphPicture.php +7 -10
  98. {Facebook → providers/facebook/compat/Facebook}/GraphNodes/GraphSessionInfo.php +10 -16
  99. {Facebook → providers/facebook/compat/Facebook}/GraphNodes/GraphUser.php +19 -31
  100. {Facebook → providers/facebook/compat/Facebook}/Helpers/FacebookCanvasHelper.php +5 -6
  101. {Facebook → providers/facebook/compat/Facebook}/Helpers/FacebookJavaScriptHelper.php +4 -4
  102. {Facebook → providers/facebook/compat/Facebook}/Helpers/FacebookPageTabHelper.php +7 -10
  103. {Facebook → providers/facebook/compat/Facebook}/Helpers/FacebookRedirectLoginHelper.php +26 -44
  104. {Facebook → providers/facebook/compat/Facebook}/Helpers/FacebookSignedRequestFromInputHelper.php +13 -19
  105. {Facebook → providers/facebook/compat/Facebook}/Http/GraphRawResponse.php +9 -14
  106. {Facebook → providers/facebook/compat/Facebook}/Http/RequestBodyInterface.php +3 -2
  107. {Facebook → providers/facebook/compat/Facebook}/Http/RequestBodyMultipart.php +16 -34
  108. {Facebook → providers/facebook/compat/Facebook}/Http/RequestBodyUrlEncoded.php +5 -6
  109. {Facebook → providers/facebook/compat/Facebook}/HttpClients/FacebookCurl.php +11 -20
  110. {Facebook → providers/facebook/compat/Facebook}/HttpClients/FacebookCurlHttpClient.php +25 -26
  111. {Facebook → providers/facebook/compat/Facebook}/HttpClients/FacebookGuzzleHttpClient.php +13 -15
  112. {Facebook → providers/facebook/compat/Facebook}/HttpClients/FacebookHttpClientInterface.php +3 -2
  113. {Facebook → providers/facebook/compat/Facebook}/HttpClients/FacebookStream.php +7 -9
  114. {Facebook → providers/facebook/compat/Facebook}/HttpClients/FacebookStreamHttpClient.php +17 -18
  115. {Facebook → providers/facebook/compat/Facebook}/HttpClients/HttpClientsFactory.php +6 -8
  116. {Facebook → providers/facebook/compat/Facebook}/HttpClients/certs/DigiCertHighAssuranceEVRootCA.pem +0 -0
  117. {Facebook → providers/facebook/compat/Facebook}/PersistentData/FacebookMemoryPersistentDataHandler.php +5 -6
  118. {Facebook → providers/facebook/compat/Facebook}/PersistentData/FacebookSessionPersistentDataHandler.php +7 -12
  119. {Facebook → providers/facebook/compat/Facebook}/PersistentData/FacebookWordPressPersistentDataHandler.php +8 -10
  120. {Facebook → providers/facebook/compat/Facebook}/PersistentData/PersistentDataFactory.php +6 -9
  121. {Facebook → providers/facebook/compat/Facebook}/PersistentData/PersistentDataInterface.php +3 -2
  122. {Facebook → providers/facebook/compat/Facebook}/PseudoRandomString/McryptPseudoRandomStringGenerator.php +7 -14
  123. {Facebook → providers/facebook/compat/Facebook}/PseudoRandomString/OpenSslPseudoRandomStringGenerator.php +6 -7
  124. {Facebook → providers/facebook/compat/Facebook}/PseudoRandomString/PseudoRandomStringGeneratorFactory.php +6 -8
  125. {Facebook → providers/facebook/compat/Facebook}/PseudoRandomString/PseudoRandomStringGeneratorInterface.php +3 -2
  126. {Facebook → providers/facebook/compat/Facebook}/PseudoRandomString/PseudoRandomStringGeneratorTrait.php +5 -6
  127. {Facebook → providers/facebook/compat/Facebook}/PseudoRandomString/RandomBytesPseudoRandomStringGenerator.php +6 -10
  128. {Facebook → providers/facebook/compat/Facebook}/PseudoRandomString/UrandomPseudoRandomStringGenerator.php +8 -22
  129. {Facebook → providers/facebook/compat/Facebook}/SignedRequest.php +24 -45
  130. {Facebook → providers/facebook/compat/Facebook}/Url/FacebookUrlDetectionHandler.php +21 -24
  131. {Facebook → providers/facebook/compat/Facebook}/Url/FacebookUrlManipulator.php +13 -18
  132. {Facebook → providers/facebook/compat/Facebook}/Url/UrlDetectionInterface.php +3 -2
  133. {Facebook → providers/facebook/compat/Facebook}/autoload.php +0 -0
  134. {Facebook → providers/facebook/compat/Facebook}/polyfills.php +1 -2
  135. providers/facebook/compat/buttons/facebook-btn.css +397 -0
  136. {buttons → providers/facebook/compat/buttons}/facebook-btn.png +0 -0
  137. {buttons → providers/facebook/compat/buttons}/index.html +0 -0
  138. generatorbanner.png → providers/facebook/compat/generatorbanner.png +0 -0
  139. providers/facebook/compat/index.html +0 -0
  140. providers/facebook/compat/licence.txt +339 -0
  141. providers/facebook/compat/nextend-facebook-connect.php +646 -0
  142. providers/facebook/compat/nextend-facebook-settings.php +320 -0
  143. providers/facebook/compat/readme.txt +263 -0
  144. providers/facebook/facebook-client.php +70 -0
  145. providers/facebook/facebook.php +258 -0
  146. providers/facebook/facebook.png +0 -0
  147. providers/google/admin/getting-started.php +37 -0
  148. providers/google/admin/import.php +45 -0
  149. providers/google/admin/settings.php +67 -0
  150. providers/google/compat/buttons/google-btn.css +397 -0
  151. providers/google/compat/buttons/google-btn.png +0 -0
  152. providers/google/compat/buttons/index.html +0 -0
  153. providers/google/compat/generatorbanner.png +0 -0
  154. providers/google/compat/index.html +0 -0
  155. providers/google/compat/licence.txt +339 -0
  156. providers/google/compat/nextend-google-connect.php +538 -0
  157. providers/google/compat/nextend-google-settings.php +315 -0
  158. providers/google/compat/readme.txt +204 -0
  159. providers/google/compat/sdk/apiClient.php +413 -0
  160. providers/google/compat/sdk/auth/apiAuth.php +45 -0
  161. providers/google/compat/sdk/auth/apiAuthNone.php +66 -0
  162. providers/google/compat/sdk/auth/apiLoginTicket.php +64 -0
  163. providers/google/compat/sdk/auth/apiOAuth.php +270 -0
  164. providers/google/compat/sdk/auth/apiOAuth2.php +396 -0
  165. providers/google/compat/sdk/auth/apiP12Signer.php +65 -0
  166. providers/google/compat/sdk/auth/apiPemVerifier.php +61 -0
  167. providers/google/compat/sdk/auth/apiSigner.php +31 -0
  168. providers/google/compat/sdk/auth/apiVerifier.php +32 -0
  169. providers/google/compat/sdk/cache/apiApcCache.php +103 -0
  170. providers/google/compat/sdk/cache/apiCache.php +56 -0
  171. providers/google/compat/sdk/cache/apiFileCache.php +139 -0
  172. providers/google/compat/sdk/cache/apiMemcacheCache.php +132 -0
  173. providers/google/compat/sdk/config.php +91 -0
  174. providers/google/compat/sdk/contrib/apiAdsenseService.php +1369 -0
  175. providers/google/compat/sdk/contrib/apiAnalyticsService.php +27 -0
Facebook/FileUpload/Mimetypes.php DELETED
@@ -1,988 +0,0 @@
1
- <?php
2
- /**
3
- * Copyright 2017 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
- 'srt' => 'application/octet-stream',
728
- 'sru' => 'application/sru+xml',
729
- 'srx' => 'application/sparql-results+xml',
730
- 'sse' => 'application/vnd.kodak-descriptor',
731
- 'ssf' => 'application/vnd.epson.ssf',
732
- 'ssml' => 'application/ssml+xml',
733
- 'st' => 'application/vnd.sailingtracker.track',
734
- 'stc' => 'application/vnd.sun.xml.calc.template',
735
- 'std' => 'application/vnd.sun.xml.draw.template',
736
- 'stf' => 'application/vnd.wt.stf',
737
- 'sti' => 'application/vnd.sun.xml.impress.template',
738
- 'stk' => 'application/hyperstudio',
739
- 'stl' => 'application/vnd.ms-pki.stl',
740
- 'str' => 'application/vnd.pg.format',
741
- 'stw' => 'application/vnd.sun.xml.writer.template',
742
- 'sub' => 'image/vnd.dvb.subtitle',
743
- 'sus' => 'application/vnd.sus-calendar',
744
- 'susp' => 'application/vnd.sus-calendar',
745
- 'sv4cpio' => 'application/x-sv4cpio',
746
- 'sv4crc' => 'application/x-sv4crc',
747
- 'svc' => 'application/vnd.dvb.service',
748
- 'svd' => 'application/vnd.svd',
749
- 'svg' => 'image/svg+xml',
750
- 'svgz' => 'image/svg+xml',
751
- 'swa' => 'application/x-director',
752
- 'swf' => 'application/x-shockwave-flash',
753
- 'swi' => 'application/vnd.aristanetworks.swi',
754
- 'sxc' => 'application/vnd.sun.xml.calc',
755
- 'sxd' => 'application/vnd.sun.xml.draw',
756
- 'sxg' => 'application/vnd.sun.xml.writer.global',
757
- 'sxi' => 'application/vnd.sun.xml.impress',
758
- 'sxm' => 'application/vnd.sun.xml.math',
759
- 'sxw' => 'application/vnd.sun.xml.writer',
760
- 't' => 'text/troff',
761
- 'tao' => 'application/vnd.tao.intent-module-archive',
762
- 'tar' => 'application/x-tar',
763
- 'tcap' => 'application/vnd.3gpp2.tcap',
764
- 'tcl' => 'application/x-tcl',
765
- 'teacher' => 'application/vnd.smart.teacher',
766
- 'tei' => 'application/tei+xml',
767
- 'teicorpus' => 'application/tei+xml',
768
- 'tex' => 'application/x-tex',
769
- 'texi' => 'application/x-texinfo',
770
- 'texinfo' => 'application/x-texinfo',
771
- 'text' => 'text/plain',
772
- 'tfi' => 'application/thraud+xml',
773
- 'tfm' => 'application/x-tex-tfm',
774
- 'thmx' => 'application/vnd.ms-officetheme',
775
- 'tif' => 'image/tiff',
776
- 'tiff' => 'image/tiff',
777
- 'tmo' => 'application/vnd.tmobile-livetv',
778
- 'torrent' => 'application/x-bittorrent',
779
- 'tpl' => 'application/vnd.groove-tool-template',
780
- 'tpt' => 'application/vnd.trid.tpt',
781
- 'tr' => 'text/troff',
782
- 'tra' => 'application/vnd.trueapp',
783
- 'trm' => 'application/x-msterminal',
784
- 'tsd' => 'application/timestamped-data',
785
- 'tsv' => 'text/tab-separated-values',
786
- 'ttc' => 'application/x-font-ttf',
787
- 'ttf' => 'application/x-font-ttf',
788
- 'ttl' => 'text/turtle',
789
- 'twd' => 'application/vnd.simtech-mindmapper',
790
- 'twds' => 'application/vnd.simtech-mindmapper',
791
- 'txd' => 'application/vnd.genomatix.tuxedo',
792
- 'txf' => 'application/vnd.mobius.txf',
793
- 'txt' => 'text/plain',
794
- 'u32' => 'application/x-authorware-bin',
795
- 'udeb' => 'application/x-debian-package',
796
- 'ufd' => 'application/vnd.ufdl',
797
- 'ufdl' => 'application/vnd.ufdl',
798
- 'umj' => 'application/vnd.umajin',
799
- 'unityweb' => 'application/vnd.unity',
800
- 'uoml' => 'application/vnd.uoml+xml',
801
- 'uri' => 'text/uri-list',
802
- 'uris' => 'text/uri-list',
803
- 'urls' => 'text/uri-list',
804
- 'ustar' => 'application/x-ustar',
805
- 'utz' => 'application/vnd.uiq.theme',
806
- 'uu' => 'text/x-uuencode',
807
- 'uva' => 'audio/vnd.dece.audio',
808
- 'uvd' => 'application/vnd.dece.data',
809
- 'uvf' => 'application/vnd.dece.data',
810
- 'uvg' => 'image/vnd.dece.graphic',
811
- 'uvh' => 'video/vnd.dece.hd',
812
- 'uvi' => 'image/vnd.dece.graphic',
813
- 'uvm' => 'video/vnd.dece.mobile',
814
- 'uvp' => 'video/vnd.dece.pd',
815
- 'uvs' => 'video/vnd.dece.sd',
816
- 'uvt' => 'application/vnd.dece.ttml+xml',
817
- 'uvu' => 'video/vnd.uvvu.mp4',
818
- 'uvv' => 'video/vnd.dece.video',
819
- 'uvva' => 'audio/vnd.dece.audio',
820
- 'uvvd' => 'application/vnd.dece.data',
821
- 'uvvf' => 'application/vnd.dece.data',
822
- 'uvvg' => 'image/vnd.dece.graphic',
823
- 'uvvh' => 'video/vnd.dece.hd',
824
- 'uvvi' => 'image/vnd.dece.graphic',
825
- 'uvvm' => 'video/vnd.dece.mobile',
826
- 'uvvp' => 'video/vnd.dece.pd',
827
- 'uvvs' => 'video/vnd.dece.sd',
828
- 'uvvt' => 'application/vnd.dece.ttml+xml',
829
- 'uvvu' => 'video/vnd.uvvu.mp4',
830
- 'uvvv' => 'video/vnd.dece.video',
831
- 'uvvx' => 'application/vnd.dece.unspecified',
832
- 'uvx' => 'application/vnd.dece.unspecified',
833
- 'vcd' => 'application/x-cdlink',
834
- 'vcf' => 'text/x-vcard',
835
- 'vcg' => 'application/vnd.groove-vcard',
836
- 'vcs' => 'text/x-vcalendar',
837
- 'vcx' => 'application/vnd.vcx',
838
- 'vis' => 'application/vnd.visionary',
839
- 'viv' => 'video/vnd.vivo',
840
- 'vor' => 'application/vnd.stardivision.writer',
841
- 'vox' => 'application/x-authorware-bin',
842
- 'vrml' => 'model/vrml',
843
- 'vsd' => 'application/vnd.visio',
844
- 'vsf' => 'application/vnd.vsf',
845
- 'vss' => 'application/vnd.visio',
846
- 'vst' => 'application/vnd.visio',
847
- 'vsw' => 'application/vnd.visio',
848
- 'vtu' => 'model/vnd.vtu',
849
- 'vxml' => 'application/voicexml+xml',
850
- 'w3d' => 'application/x-director',
851
- 'wad' => 'application/x-doom',
852
- 'wav' => 'audio/x-wav',
853
- 'wax' => 'audio/x-ms-wax',
854
- 'wbmp' => 'image/vnd.wap.wbmp',
855
- 'wbs' => 'application/vnd.criticaltools.wbs+xml',
856
- 'wbxml' => 'application/vnd.wap.wbxml',
857
- 'wcm' => 'application/vnd.ms-works',
858
- 'wdb' => 'application/vnd.ms-works',
859
- 'weba' => 'audio/webm',
860
- 'webm' => 'video/webm',
861
- 'webp' => 'image/webp',
862
- 'wg' => 'application/vnd.pmi.widget',
863
- 'wgt' => 'application/widget',
864
- 'wks' => 'application/vnd.ms-works',
865
- 'wm' => 'video/x-ms-wm',
866
- 'wma' => 'audio/x-ms-wma',
867
- 'wmd' => 'application/x-ms-wmd',
868
- 'wmf' => 'application/x-msmetafile',
869
- 'wml' => 'text/vnd.wap.wml',
870
- 'wmlc' => 'application/vnd.wap.wmlc',
871
- 'wmls' => 'text/vnd.wap.wmlscript',
872
- 'wmlsc' => 'application/vnd.wap.wmlscriptc',
873
- 'wmv' => 'video/x-ms-wmv',
874
- 'wmx' => 'video/x-ms-wmx',
875
- 'wmz' => 'application/x-ms-wmz',
876
- 'woff' => 'application/x-font-woff',
877
- 'wpd' => 'application/vnd.wordperfect',
878
- 'wpl' => 'application/vnd.ms-wpl',
879
- 'wps' => 'application/vnd.ms-works',
880
- 'wqd' => 'application/vnd.wqd',
881
- 'wri' => 'application/x-mswrite',
882
- 'wrl' => 'model/vrml',
883
- 'wsdl' => 'application/wsdl+xml',
884
- 'wspolicy' => 'application/wspolicy+xml',
885
- 'wtb' => 'application/vnd.webturbo',
886
- 'wvx' => 'video/x-ms-wvx',
887
- 'x32' => 'application/x-authorware-bin',
888
- 'x3d' => 'application/vnd.hzn-3d-crossword',
889
- 'xap' => 'application/x-silverlight-app',
890
- 'xar' => 'application/vnd.xara',
891
- 'xbap' => 'application/x-ms-xbap',
892
- 'xbd' => 'application/vnd.fujixerox.docuworks.binder',
893
- 'xbm' => 'image/x-xbitmap',
894
- 'xdf' => 'application/xcap-diff+xml',
895
- 'xdm' => 'application/vnd.syncml.dm+xml',
896
- 'xdp' => 'application/vnd.adobe.xdp+xml',
897
- 'xdssc' => 'application/dssc+xml',
898
- 'xdw' => 'application/vnd.fujixerox.docuworks',
899
- 'xenc' => 'application/xenc+xml',
900
- 'xer' => 'application/patch-ops-error+xml',
901
- 'xfdf' => 'application/vnd.adobe.xfdf',
902
- 'xfdl' => 'application/vnd.xfdl',
903
- 'xht' => 'application/xhtml+xml',
904
- 'xhtml' => 'application/xhtml+xml',
905
- 'xhvml' => 'application/xv+xml',
906
- 'xif' => 'image/vnd.xiff',
907
- 'xla' => 'application/vnd.ms-excel',
908
- 'xlam' => 'application/vnd.ms-excel.addin.macroenabled.12',
909
- 'xlc' => 'application/vnd.ms-excel',
910
- 'xlm' => 'application/vnd.ms-excel',
911
- 'xls' => 'application/vnd.ms-excel',
912
- 'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroenabled.12',
913
- 'xlsm' => 'application/vnd.ms-excel.sheet.macroenabled.12',
914
- 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
915
- 'xlt' => 'application/vnd.ms-excel',
916
- 'xltm' => 'application/vnd.ms-excel.template.macroenabled.12',
917
- 'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template',
918
- 'xlw' => 'application/vnd.ms-excel',
919
- 'xml' => 'application/xml',
920
- 'xo' => 'application/vnd.olpc-sugar',
921
- 'xop' => 'application/xop+xml',
922
- 'xpi' => 'application/x-xpinstall',
923
- 'xpm' => 'image/x-xpixmap',
924
- 'xpr' => 'application/vnd.is-xpr',
925
- 'xps' => 'application/vnd.ms-xpsdocument',
926
- 'xpw' => 'application/vnd.intercon.formnet',
927
- 'xpx' => 'application/vnd.intercon.formnet',
928
- 'xsl' => 'application/xml',
929
- 'xslt' => 'application/xslt+xml',
930
- 'xsm' => 'application/vnd.syncml+xml',
931
- 'xspf' => 'application/xspf+xml',
932
- 'xul' => 'application/vnd.mozilla.xul+xml',
933
- 'xvm' => 'application/xv+xml',
934
- 'xvml' => 'application/xv+xml',
935
- 'xwd' => 'image/x-xwindowdump',
936
- 'xyz' => 'chemical/x-xyz',
937
- 'yaml' => 'text/yaml',
938
- 'yang' => 'application/yang',
939
- 'yin' => 'application/yin+xml',
940
- 'yml' => 'text/yaml',
941
- 'zaz' => 'application/vnd.zzazz.deck+xml',
942
- 'zip' => 'application/zip',
943
- 'zir' => 'application/vnd.zul',
944
- 'zirz' => 'application/vnd.zul',
945
- 'zmm' => 'application/vnd.handheld-entertainment+xml'
946
- ];
947
-
948
- /**
949
- * Get a singleton instance of the class
950
- *
951
- * @return self
952
- * @codeCoverageIgnore
953
- */
954
- public static function getInstance()
955
- {
956
- if (!self::$instance) {
957
- self::$instance = new self();
958
- }
959
-
960
- return self::$instance;
961
- }
962
-
963
- /**
964
- * Get a mimetype value from a file extension
965
- *
966
- * @param string $extension File extension
967
- *
968
- * @return string|null
969
- */
970
- public function fromExtension($extension)
971
- {
972
- $extension = strtolower($extension);
973
-
974
- return isset($this->mimetypes[$extension]) ? $this->mimetypes[$extension] : null;
975
- }
976
-
977
- /**
978
- * Get a mimetype from a filename
979
- *
980
- * @param string $filename Filename to generate a mimetype from
981
- *
982
- * @return string|null
983
- */
984
- public function fromFilename($filename)
985
- {
986
- return $this->fromExtension(pathinfo($filename, PATHINFO_EXTENSION));
987
- }
988
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/admin.php ADDED
@@ -0,0 +1,416 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ define('NSL_ADMIN_PATH', __FILE__);
3
+
4
+ require_once dirname(__FILE__) . '/upgrader.php';
5
+ NextendSocialUpgrader::init();
6
+
7
+ class NextendSocialLoginAdmin {
8
+
9
+ public static function init() {
10
+ add_action('admin_menu', 'NextendSocialLoginAdmin::admin_menu', 1);
11
+ add_action('admin_init', 'NextendSocialLoginAdmin::admin_init');
12
+
13
+ add_filter('plugin_action_links', 'NextendSocialLoginAdmin::plugin_action_links', 10, 2);
14
+
15
+ add_filter('nsl_update_settings_validate_nextend_social_login', 'NextendSocialLoginAdmin::validateSettings', 10, 2);
16
+
17
+ require_once dirname(__FILE__) . '/notices.php';
18
+ NextendSocialLoginAdminNotices::init();
19
+ }
20
+
21
+ public static function getAdminUrl($view = 'providers') {
22
+
23
+ return add_query_arg(array(
24
+ 'page' => 'nextend-social-login',
25
+ 'view' => $view
26
+ ), admin_url('options-general.php'));
27
+ }
28
+
29
+ public static function admin_menu() {
30
+ $menu = add_options_page('Nextend Social Login', 'Nextend Social Login', 'manage_options', 'nextend-social-login', array(
31
+ 'NextendSocialLoginAdmin',
32
+ 'display_admin'
33
+ ));
34
+
35
+ add_action('admin_print_styles-' . $menu, 'NextendSocialLoginAdmin::admin_css');
36
+ }
37
+
38
+ public static function admin_css() {
39
+ wp_enqueue_style('nsl-admin-stylesheet', plugins_url('/style.css', NSL_ADMIN_PATH));
40
+ }
41
+
42
+ public static function display_admin() {
43
+ $view = !empty($_REQUEST['view']) ? $_REQUEST['view'] : '';
44
+
45
+ if (substr($view, 0, 9) == 'provider-') {
46
+ $providerID = substr($view, 9);
47
+ if (isset(NextendSocialLogin::$providers[$providerID])) {
48
+ self::display_admin_area('provider', $providerID);
49
+
50
+ return;
51
+ }
52
+ }
53
+ switch ($view) {
54
+ case 'global-settings':
55
+ self::display_admin_area('global-settings');
56
+ break;
57
+ case 'pro-addon':
58
+ self::display_admin_area('pro-addon');
59
+ break;
60
+ case 'install-pro':
61
+ if (check_admin_referer('nextend-social-login')) {
62
+ self::display_admin_area('install-pro');
63
+ } else {
64
+ self::display_admin_area('providers');
65
+ }
66
+ break;
67
+ default:
68
+ self::display_admin_area('providers');
69
+ break;
70
+ }
71
+ }
72
+
73
+ /**
74
+ * @param string $view
75
+ * @param string $currentProvider
76
+ */
77
+ private static function display_admin_area($view, $currentProvider = '') {
78
+ if (empty($currentProvider)) {
79
+ include(dirname(__FILE__) . '/templates/header.php');
80
+ include(dirname(__FILE__) . '/templates/menu.php');
81
+
82
+ NextendSocialLoginAdminNotices::displayNotices();
83
+
84
+ /** @var string $view */
85
+ include(dirname(__FILE__) . '/templates/' . $view . '.php');
86
+ include(dirname(__FILE__) . '/templates/footer.php');
87
+ } else {
88
+ include(dirname(__FILE__) . '/templates/' . $view . '.php');
89
+ }
90
+ }
91
+
92
+ public static function renderProSettings() {
93
+ include(dirname(__FILE__) . '/templates/global-settings-pro.php');
94
+ }
95
+
96
+ public static function admin_init() {
97
+
98
+ if (isset($_GET['page']) && $_GET['page'] == 'nextend-social-login') {
99
+ if (!empty($_GET['view']) && !empty($_GET['provider'])) {
100
+ switch ($_GET['view']) {
101
+ case 'enable':
102
+ case 'sub-enable':
103
+ if (check_admin_referer('nextend-social-login_enable_' . $_GET['provider'])) {
104
+ NextendSocialLogin::enableProvider($_GET['provider']);
105
+ }
106
+ if ($_GET['view'] == 'sub-enable') {
107
+ wp_redirect(NextendSocialLogin::$providers[$_GET['provider']]->getAdminUrl('settings'));
108
+ exit;
109
+ }
110
+ break;
111
+ case 'disable':
112
+ case 'sub-disable':
113
+ if (check_admin_referer('nextend-social-login_disable_' . $_GET['provider'])) {
114
+ NextendSocialLogin::disableProvider($_GET['provider']);
115
+ }
116
+ if ($_GET['view'] == 'sub-disable') {
117
+ wp_redirect(NextendSocialLogin::$providers[$_GET['provider']]->getAdminUrl('settings'));
118
+ exit;
119
+ }
120
+ break;
121
+ }
122
+ wp_redirect(self::getAdminUrl());
123
+ exit;
124
+ }
125
+ }
126
+ add_action('admin_post_nextend-social-login', 'NextendSocialLoginAdmin::save_form_data');
127
+ add_action('wp_ajax_nextend-social-login', 'NextendSocialLoginAdmin::ajax_save_form_data');
128
+
129
+
130
+ add_action('admin_enqueue_scripts', 'NextendSocialLoginAdmin::admin_enqueue_scripts');
131
+
132
+ if (!function_exists('curl_init')) {
133
+ add_settings_error('nextend-social', 'settings_updated', printf(__('%s needs the CURL PHP extension.', 'nextend-facebook-connect'), 'Nextend Social Login') . ' ' . __('Please contact your server administrator and ask for solution!', 'nextend-facebook-connect'), 'error');
134
+ } else {
135
+ $version = curl_version();
136
+ $ssl_supported = ($version['features'] & CURL_VERSION_SSL);
137
+ if (!$ssl_supported) {
138
+ add_settings_error('nextend-social', 'settings_updated', __('Https protocol is not supported or disabled in CURL.', 'nextend-facebook-connect') . ' ' . __('Please contact your server administrator and ask for solution!', 'nextend-facebook-connect'), 'error');
139
+
140
+ ob_start();
141
+ var_dump($version);
142
+ $curlDebugHTML = ob_get_clean();
143
+ add_settings_error('nextend-social', 'settings_updated', '<h2>CURL debug</h2>' . $curlDebugHTML, 'error');
144
+ }
145
+ }
146
+
147
+ if (!function_exists('json_decode')) {
148
+ add_settings_error('nextend-social', 'settings_updated', printf(__('%s needs json_decode function.', 'nextend-facebook-connect'), 'Nextend Social Login') . ' ' . __('Please contact your server administrator and ask for solution!', 'nextend-facebook-connect'), 'error');
149
+ }
150
+ }
151
+
152
+ public static function save_form_data() {
153
+ if (current_user_can('manage_options') && check_admin_referer('nextend-social-login')) {
154
+ foreach ($_POST AS $k => $v) {
155
+ if (is_string($v)) {
156
+ $_POST[$k] = stripslashes($v);
157
+ }
158
+ }
159
+
160
+ $view = !empty($_REQUEST['view']) ? $_REQUEST['view'] : '';
161
+
162
+ if ($view == 'global-settings') {
163
+
164
+ NextendSocialLogin::$settings->update($_POST);
165
+
166
+ NextendSocialLoginAdminNotices::addSuccess(__('Settings saved.'));
167
+ wp_redirect(self::getAdminUrl($view));
168
+ exit;
169
+ } else if ($view == 'pro-addon') {
170
+
171
+ NextendSocialLogin::$settings->update($_POST);
172
+
173
+ if (NextendSocialLogin::$settings->get('license_key_ok') == '1') {
174
+ NextendSocialLoginAdminNotices::addSuccess(__('The authorization was successful', 'nextend-facebook-connect'));
175
+ }
176
+
177
+ wp_redirect(self::getAdminUrl($view));
178
+ exit;
179
+ } else if ($view == 'pro-addon-deauthorize') {
180
+
181
+ NextendSocialLogin::$settings->update(array(
182
+ 'license_key' => ''
183
+ ));
184
+
185
+ NextendSocialLoginAdminNotices::addSuccess(__('Deauthorize completed.', 'nextend-facebook-connect'));
186
+
187
+ wp_redirect(self::getAdminUrl('pro-addon'));
188
+ exit;
189
+
190
+ } else if ($view == 'import') {
191
+ $provider = isset($_GET['provider']) ? $_GET['provider'] : '';
192
+ if (!empty($provider) && isset(NextendSocialLogin::$providers[$provider]) && NextendSocialLogin::$providers[$provider]->getState() == 'legacy') {
193
+ NextendSocialLogin::$providers[$provider]->import();
194
+
195
+ wp_redirect(NextendSocialLogin::$providers[$provider]->getAdminUrl('settings'));
196
+ exit;
197
+ }
198
+
199
+ wp_redirect(NextendSocialLoginAdmin::getAdminUrl());
200
+ exit;
201
+ } else if (substr($view, 0, 9) == 'provider-') {
202
+ $providerID = substr($view, 9);
203
+ if (isset(NextendSocialLogin::$providers[$providerID])) {
204
+ NextendSocialLogin::$providers[$providerID]->settings->update($_POST);
205
+
206
+ NextendSocialLoginAdminNotices::addSuccess(__('Settings saved.'));
207
+ wp_redirect(NextendSocialLogin::$providers[$providerID]->getAdminUrl(isset($_POST['subview']) ? $_POST['subview'] : ''));
208
+ exit;
209
+ }
210
+ }
211
+ }
212
+
213
+ wp_redirect(self::getAdminUrl());
214
+ exit;
215
+ }
216
+
217
+ public static function ajax_save_form_data() {
218
+ check_ajax_referer('nextend-social-login');
219
+ if (current_user_can('manage_options')) {
220
+ $view = !empty($_POST['view']) ? $_POST['view'] : '';
221
+ if ($view === 'orderProviders') {
222
+ if (!empty($_POST['ordering'])) {
223
+ NextendSocialLogin::$settings->update(array(
224
+ 'ordering' => $_POST['ordering']
225
+ ));
226
+ }
227
+ }
228
+ }
229
+ }
230
+
231
+ public static function validateSettings($newData, $postedData) {
232
+
233
+ if (isset($postedData['redirect'])) {
234
+ if (isset($postedData['custom_redirect_enabled']) && $postedData['custom_redirect_enabled'] == '1') {
235
+ $newData['redirect'] = trim(sanitize_text_field($postedData['redirect']));
236
+ } else {
237
+ $newData['redirect'] = '';
238
+ }
239
+ }
240
+
241
+ if (isset($postedData['redirect_reg'])) {
242
+ if (isset($postedData['custom_redirect_reg_enabled']) && $postedData['custom_redirect_reg_enabled'] == '1') {
243
+ $newData['redirect_reg'] = trim(sanitize_text_field($postedData['redirect_reg']));
244
+ } else {
245
+ $newData['redirect_reg'] = '';
246
+ }
247
+ }
248
+
249
+ foreach ($postedData as $key => $value) {
250
+ switch ($key) {
251
+ case 'debug':
252
+ if ($value == 1) {
253
+ $newData[$key] = 1;
254
+ } else {
255
+ $newData[$key] = 0;
256
+ }
257
+ break;
258
+ case 'enabled':
259
+ if (is_array($value)) {
260
+ $newData[$key] = $value;
261
+ }
262
+ break;
263
+ case 'ordering':
264
+ if (is_array($value)) {
265
+ $newData[$key] = $value;
266
+ }
267
+ break;
268
+ case 'license_key':
269
+ $value = trim(sanitize_text_field($value));
270
+ $newData[$key] = $value;
271
+ if ($value != NextendSocialLogin::$settings->get('license_key')) {
272
+ $newData['license_key_ok'] = '0';
273
+
274
+ if (!empty($value)) {
275
+ try {
276
+ $response = self::apiCall('test-license', array('license_key' => $value));
277
+ if ($response === 'OK') {
278
+ $newData['license_key_ok'] = '1';
279
+ }
280
+ } catch (Exception $e) {
281
+ NextendSocialLoginAdminNotices::addError($e->getMessage());
282
+ }
283
+ }
284
+ }
285
+ break;
286
+ }
287
+ }
288
+
289
+ return $newData;
290
+ }
291
+
292
+ public static function plugin_action_links($links, $file) {
293
+
294
+ if ($file != NSL_PLUGIN_BASENAME) {
295
+ return $links;
296
+ }
297
+ $settings_link = '<a href="' . esc_url(menu_page_url('nextend-social-login', false)) . '">' . __('Settings') . '</a>';
298
+ array_unshift($links, $settings_link);
299
+
300
+ return $links;
301
+ }
302
+
303
+ public static function admin_enqueue_scripts() {
304
+ if ('settings_page_nextend-social-login' === get_current_screen()->id) {
305
+
306
+ // Since WordPress 4.9
307
+ if (function_exists('wp_enqueue_code_editor')) {
308
+ // Enqueue code editor and settings for manipulating HTML.
309
+ $settings = wp_enqueue_code_editor(array('type' => 'text/html'));
310
+
311
+ // Bail if user disabled CodeMirror.
312
+ if (false === $settings) {
313
+ return;
314
+ }
315
+
316
+ wp_add_inline_script('code-editor', sprintf('jQuery( function() { var settings = %s; jQuery(".nextend-html-editor").each(function(i, el){wp.codeEditor.initialize( el, settings);}); } );', wp_json_encode($settings)));
317
+
318
+ $settings['codemirror']['readOnly'] = 'nocursor';
319
+
320
+ wp_add_inline_script('code-editor', sprintf('jQuery( function() { var settings = %s; jQuery(".nextend-html-editor-readonly").each(function(i, el){wp.codeEditor.initialize( el, settings);}); } );', wp_json_encode($settings)));
321
+ }
322
+
323
+ if (isset($_GET['view']) && $_GET['view'] == 'pro-addon') {
324
+ wp_enqueue_script('plugin-install');
325
+ wp_enqueue_script('updates');
326
+ }
327
+ }
328
+ }
329
+
330
+ private static $endpoint = 'https://secure.nextendweb.com/wp-json/nextend-api/v2/';
331
+
332
+ public static function getEndpoint($action = '') {
333
+ return self::$endpoint . 'product/nsl/' . urlencode($action);
334
+ }
335
+
336
+ /**
337
+ * @param $action
338
+ * @param array $args
339
+ *
340
+ * @return bool|mixed
341
+ * @throws Exception
342
+ */
343
+ public static function apiCall($action, $args = array()) {
344
+
345
+ require_once NSL_PATH . '/includes/curl/Curl.php';
346
+
347
+ $curl = new NSLCurl();
348
+
349
+
350
+ $response = $curl->get(self::apiUrl($action, $args));
351
+
352
+ if ($curl->error) {
353
+ if (isset($response['message'])) {
354
+ $message = 'Nextend Social Login Pro Addon: ' . $response['message'];
355
+
356
+ NextendSocialLoginAdminNotices::addError($message);
357
+
358
+ return new WP_Error('error', $message);
359
+ } else {
360
+ throw new Exception('Nextend Social Login Pro Addon: ' . $curl->errorCode . ': ' . $curl->errorMessage);
361
+ }
362
+ }
363
+
364
+ return $response;
365
+ }
366
+
367
+ public static function apiUrl($action, $args = array()) {
368
+ $args = array_merge(array(
369
+ 'platform' => 'wordpress',
370
+ 'domain' => parse_url(site_url(), PHP_URL_HOST),
371
+ 'license_key' => NextendSocialLogin::$settings->get('license_key')
372
+ ), $args);
373
+
374
+ foreach ($args AS $key => $value) {
375
+ if (is_string($value)) {
376
+ $args[$key] = urlencode($value);
377
+ }
378
+ }
379
+
380
+ return add_query_arg($args, self::getEndpoint($action));
381
+ }
382
+
383
+ public static function showProBox() {
384
+ $isPRO = apply_filters('nsl-pro', false);
385
+ if (!$isPRO) {
386
+ include(dirname(__FILE__) . '/templates/pro.php');
387
+ }
388
+ }
389
+
390
+ public static function getProState() {
391
+ if (NextendSocialLogin::$settings->get('license_key_ok') == '1') {
392
+ $isPRO = apply_filters('nsl-pro', false);
393
+ if ($isPRO) {
394
+ return 'activated';
395
+ } else if (!current_user_can('install_plugins')) {
396
+ return 'no-capability';
397
+ } else {
398
+ if (file_exists(WP_PLUGIN_DIR . '/nextend-social-login-pro/nextend-social-login-pro.php')) {
399
+ return 'installed';
400
+ } else {
401
+ return 'not-installed';
402
+ }
403
+ }
404
+ }
405
+
406
+ return 'no-license';
407
+ }
408
+
409
+ public static function trackUrl($url, $source) {
410
+ return add_query_arg(array(
411
+ 'utm_campaign' => 'nsl',
412
+ 'utm_source' => urlencode($source),
413
+ 'utm_medium' => 'nsl-wordpress-' . (apply_filters('nsl-pro', false) ? 'pro' : 'free')
414
+ ), $url);
415
+ }
416
+ }
admin/images/buttons/default.png ADDED
Binary file
admin/images/buttons/icon.png ADDED
Binary file
admin/images/error.png ADDED
Binary file
admin/images/exclamation-mark.png ADDED
Binary file
admin/images/layouts/above-separator.png ADDED
Binary file
admin/images/layouts/above.png ADDED
Binary file
admin/images/layouts/below-floating.png ADDED
Binary file
admin/images/layouts/below-separator.png ADDED
Binary file
admin/images/layouts/below.png ADDED
Binary file
admin/images/nsl-logo.png ADDED
Binary file
admin/images/ok.png ADDED
Binary file
admin/images/padlock.png ADDED
Binary file
admin/images/test-needed.png ADDED
Binary file
admin/notices.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class NextendSocialLoginAdminNotices {
4
+
5
+ private static $notices;
6
+
7
+ public static function init() {
8
+ self::$notices = maybe_unserialize(NextendSocialLoginPersistentUser::get('_nsl_admin_notices'));
9
+ if (!is_array(self::$notices)) {
10
+ self::$notices = array();
11
+ }
12
+ if (basename($_SERVER['PHP_SELF']) !== 'options-general.php' || empty($_GET['page']) || $_GET['page'] !== 'nextend-social-login') {
13
+ add_action('admin_notices', 'NextendSocialLoginAdminNotices::admin_notices');
14
+ }
15
+
16
+ }
17
+
18
+ private static function add($type, $message) {
19
+ if (!isset(self::$notices[$type])) {
20
+ self::$notices[$type] = array();
21
+ }
22
+
23
+ if (!in_array($message, self::$notices[$type])) {
24
+ self::$notices[$type][] = $message;
25
+ }
26
+
27
+ NextendSocialLoginPersistentUser::set('_nsl_admin_notices', maybe_serialize(self::$notices));
28
+ }
29
+
30
+ public static function addError($message) {
31
+ self::add('error', $message);
32
+ }
33
+
34
+ public static function addSuccess($message) {
35
+ self::add('success', $message);
36
+ }
37
+
38
+ public static function displayNotices() {
39
+
40
+ $html = self::getHTML();
41
+
42
+ if (!empty($html)) {
43
+ echo '<div class="nsl-admin-notices">' . $html . '</div>';
44
+ }
45
+ }
46
+
47
+ public static function admin_notices() {
48
+ echo self::getHTML();
49
+ }
50
+
51
+ private static function getHTML() {
52
+ $html = '';
53
+ if (isset(self::$notices['success'])) {
54
+ foreach (self::$notices['success'] AS $message) {
55
+ $html .= '<div class="updated"><p>' . $message . '</p></div>';
56
+ }
57
+ }
58
+
59
+ if (isset(self::$notices['error'])) {
60
+ foreach (self::$notices['error'] AS $message) {
61
+ $html .= '<div class="error"><p>' . $message . '</p></div>';
62
+ }
63
+ }
64
+
65
+ NextendSocialLoginPersistentUser::delete('_nsl_admin_notices');
66
+ self::$notices = array();
67
+
68
+ return $html;
69
+ }
70
+ }
admin/style.css ADDED
@@ -0,0 +1,331 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .nsl-clear {
2
+ clear: both;
3
+ }
4
+
5
+ #wpcontent {
6
+ padding-left: 0;
7
+ padding-right: 0;
8
+ }
9
+
10
+ #nsl-admin {
11
+ margin: 0;
12
+ }
13
+
14
+ #nsl-admin,
15
+ #nsl-admin p,
16
+ #nsl-admin ul,
17
+ #nsl-admin li {
18
+ font-size: 13px;
19
+ }
20
+
21
+ #nsl-admin .nsl-admin-embed-youtube {
22
+ position: relative;
23
+ max-width: 1280px;
24
+ margin-top: 40px;
25
+ }
26
+
27
+ #nsl-admin .nsl-admin-embed-youtube div {
28
+ padding-bottom: 56.25%;
29
+ }
30
+
31
+ #nsl-admin .nsl-admin-embed-youtube iframe {
32
+ position: absolute;
33
+ left: 0;
34
+ top: 0;
35
+ width: 100%;
36
+ height: 100%;
37
+ }
38
+
39
+ #nsl-admin .form-table th em {
40
+ font-weight: normal;
41
+ }
42
+
43
+ #nsl-admin .nsl-admin-header {
44
+ background: #0073aa;
45
+ height: 106px;
46
+ display: flex;
47
+ align-items: center;
48
+ padding: 0 20px;
49
+ }
50
+
51
+ #nsl-admin .nsl-admin-header h1 {
52
+ margin: 0 auto 0 0;
53
+ padding: 0;
54
+ }
55
+
56
+ #nsl-admin .nsl-admin-header h1,
57
+ #nsl-admin .nsl-admin-header h1 a {
58
+ color: #ffffff;
59
+ font-size: 24px;
60
+ text-decoration: none;
61
+ }
62
+
63
+ #nsl-admin .nsl-admin-header h1 a {
64
+ line-height: 64px;
65
+ vertical-align: top;
66
+ }
67
+
68
+ #nsl-admin .nsl-admin-header a:focus {
69
+ box-shadow: none;
70
+ }
71
+
72
+ #nsl-admin .nsl-admin-header h1 a img {
73
+ margin: 0 10px;
74
+ vertical-align: middle;
75
+ }
76
+
77
+ #nsl-admin .nsl-admin-header a.nsl-admin-header-nav {
78
+ color: #ffffff;
79
+ font-size: 16px;
80
+ text-decoration: none;
81
+ padding: 20px;
82
+ }
83
+
84
+ #nsl-admin .nsl-admin-nav-bar {
85
+ display: flex;
86
+ background: #ffffff;
87
+ height: 55px;
88
+ border-bottom: 1px solid #dbdbdb;
89
+ padding: 0 10px;
90
+ }
91
+
92
+ #nsl-admin .nsl-admin-nav-bar .nsl-admin-nav-tab {
93
+ padding: 0 20px;
94
+ }
95
+
96
+ #nsl-admin .nsl-admin-nav-bar .nsl-admin-nav-tab {
97
+ line-height: 55px;
98
+ text-decoration: none;
99
+ color: #23282d;
100
+ }
101
+
102
+ #nsl-admin .nsl-admin-nav-bar .nsl-admin-nav-tab:focus {
103
+ box-shadow: none;
104
+ }
105
+
106
+ #nsl-admin .nsl-admin-nav-bar .nsl-admin-nav-tab.nsl-admin-nav-tab-active {
107
+ box-shadow: inset 0 -3px 0 0 #00a0d2;
108
+ color: #000;
109
+ font-weight: bold;
110
+ }
111
+
112
+ #nsl-admin .nsl-admin-sub-nav-bar {
113
+ display: flex;
114
+ height: 40px;
115
+ border-bottom: 1px solid #dddddd;
116
+ }
117
+
118
+ #nsl-admin .nsl-admin-sub-nav-bar .nsl-admin-nav-tab {
119
+ margin-right: 30px;
120
+ }
121
+
122
+ #nsl-admin .nsl-admin-sub-nav-bar .nsl-admin-nav-tab {
123
+ line-height: 40px;
124
+ text-decoration: none;
125
+ color: #23282d;
126
+ }
127
+
128
+ #nsl-admin .nsl-admin-sub-nav-bar .nsl-admin-nav-tab:focus {
129
+ box-shadow: none;
130
+ }
131
+
132
+ #nsl-admin .nsl-admin-sub-nav-bar .nsl-admin-nav-tab.nsl-admin-nav-tab-active {
133
+ box-shadow: inset 0 -3px 0 0 #00a0d2;
134
+ color: #000;
135
+ font-weight: bold;
136
+ }
137
+
138
+ .nsl-dashboard-providers {
139
+ position: relative;
140
+ padding: 15px;
141
+ }
142
+
143
+ .nsl-dashboard-providers .nsl-dashboard-provider {
144
+ position: relative;
145
+ float: left;
146
+ width: 340px;
147
+ height: 220px;
148
+ margin: 15px;
149
+
150
+ display: flex;
151
+ flex-flow: column;
152
+ }
153
+
154
+ .nsl-dashboard-providers .nsl-dashboard-provider-top {
155
+ height: 166px;
156
+ display: flex;
157
+ flex-flow: column;
158
+ justify-content: center;
159
+ align-items: center;
160
+ border-top-left-radius: 5px;
161
+ border-top-right-radius: 5px;
162
+ }
163
+
164
+ .nsl-dashboard-providers h2 {
165
+ color: #ffffff;
166
+ font-size: 22px;
167
+ margin: 20px 0 0 0;
168
+ font-weight: 600;
169
+ }
170
+
171
+ .nsl-dashboard-providers .nsl-dashboard-provider-bottom {
172
+ background: #ffffff;
173
+ flex: 1 1 auto;
174
+ display: flex;
175
+ align-items: center;
176
+ padding: 0 15px;
177
+ border: 1px solid #dbdbdb;
178
+ border-width: 0 1px 1px 1px;
179
+ border-bottom-left-radius: 5px;
180
+ border-bottom-right-radius: 5px;
181
+ }
182
+
183
+ .nsl-dashboard-provider-bottom-state {
184
+ margin-right: auto;
185
+ font-size: 14px;
186
+ color: #23282d;
187
+ }
188
+
189
+ [data-state="not-tested"] .nsl-dashboard-provider-bottom-state {
190
+ color: #0b97c6;
191
+ }
192
+
193
+ [data-state="disabled"] .nsl-dashboard-provider-bottom-state {
194
+ color: #c8463f;
195
+ }
196
+
197
+ [data-state="enabled"] .nsl-dashboard-provider-bottom-state {
198
+ color: #46b450;
199
+ }
200
+
201
+ .nsl-dashboard-providers .nsl-dashboard-provider-bottom a + a {
202
+ margin-left: 10px;
203
+ }
204
+
205
+ .nsl-dashboard-provider-sortable-handle {
206
+ position: absolute;
207
+ left: 0;
208
+ top: 0;
209
+ width: 27px;
210
+ height: 34px;
211
+ cursor: move;
212
+ background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABsAAAAiCAYAAACuoaIwAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA+tpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTExIDc5LjE1ODMyNSwgMjAxNS8wOS8xMC0wMToxMDoyMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdFJlZj0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlUmVmIyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ0MgMjAxNSAoV2luZG93cykiIHhtcDpDcmVhdGVEYXRlPSIyMDE4LTAxLTE3VDE1OjE4OjM5KzAxOjAwIiB4bXA6TW9kaWZ5RGF0ZT0iMjAxOC0wMS0xN1QxNjoxMTo0MSswMTowMCIgeG1wOk1ldGFkYXRhRGF0ZT0iMjAxOC0wMS0xN1QxNjoxMTo0MSswMTowMCIgZGM6Zm9ybWF0PSJpbWFnZS9wbmciIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QjhCNkM3MkZGQjk4MTFFN0E4RDJBRUZBQTI4OUVBNzIiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QjhCNkM3MzBGQjk4MTFFN0E4RDJBRUZBQTI4OUVBNzIiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpCOEI2QzcyREZCOTgxMUU3QThEMkFFRkFBMjg5RUE3MiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpCOEI2QzcyRUZCOTgxMUU3QThEMkFFRkFBMjg5RUE3MiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Po8u91EAAABlSURBVHjaYvz//z8DvQATAx3BqGWjlg0ey1iIUKMDxHFQ9iIgvkKkHFk+AxnGD8VxJMhRHIyMZMoRbRkoeD4B8QcgXkiCHKZrRsvG0aQ/mvRHk/5o0h9N+qNJf9SyUcuoCAACDABr5TA7L7qpSQAAAABJRU5ErkJggg==');
213
+ }
214
+
215
+ .nsl-provider-notice {
216
+ position: absolute;
217
+ right: 10px;
218
+ top: 0;
219
+ color: #fff;
220
+ line-height: 32px;
221
+ font-size: 16px;
222
+ }
223
+
224
+ .nsl-admin-notices {
225
+ padding: 30px 30px 0;
226
+ }
227
+
228
+ .nsl-admin-content .nsl-admin-notices {
229
+ padding: 20px 0 0;
230
+ }
231
+
232
+ .nsl-admin-notices > div {
233
+ margin: 5px 0 2px;
234
+ }
235
+
236
+ .nsl-admin-content {
237
+ padding: 10px 30px;
238
+ }
239
+
240
+ .nsl-admin-sub-content {
241
+ padding: 20px 0;
242
+ }
243
+
244
+ .nsl-box {
245
+ max-width: 500px;
246
+ padding: 30px;
247
+ margin: 30px 0;
248
+ background: #ffffff no-repeat 20px 40px;
249
+ border-radius: 5px;
250
+ padding-left: 110px;
251
+ }
252
+
253
+ .nsl-box h2 {
254
+ margin: 10px 0 0 0;
255
+ }
256
+
257
+ .nsl-box p {
258
+ margin: 20px 0 0 0;
259
+ }
260
+
261
+ .nsl-box-yellow {
262
+ border: 3px solid #f9cb4f;
263
+ }
264
+
265
+ .nsl-box-yellow-bg {
266
+ background: #faf7ea no-repeat 20px 40px;
267
+ }
268
+
269
+ .nsl-box-blue {
270
+ border: 3px solid #00a0d2;
271
+ background-image: url('images/test-needed.png');
272
+ }
273
+
274
+ .nsl-box-green {
275
+ border: 3px solid #46b450;
276
+ background-image: url('images/ok.png');
277
+ }
278
+
279
+ .nsl-box-red {
280
+ border: 3px solid #c8463f;
281
+ }
282
+
283
+ .nsl-box-error {
284
+ background-image: url('images/error.png');
285
+ }
286
+
287
+ .nsl-box-padlock {
288
+ background-image: url('images/padlock.png');
289
+ }
290
+
291
+ .nsl-box-exclamation-mark {
292
+ background-image: url('images/exclamation-mark.png');
293
+ }
294
+
295
+ .nsl-box .button {
296
+ margin-right: 10px;
297
+ }
298
+
299
+ #nsl-test-configuration {
300
+ line-height: 28px;
301
+ }
302
+
303
+ #nsl-test-configuration > * {
304
+ margin-right: 10px;
305
+ }
306
+
307
+ #nsl-test-please-save {
308
+ display: none;
309
+ }
310
+
311
+ #nsl-admin .CodeMirror {
312
+ height: auto;
313
+ }
314
+
315
+ #nsl-admin .CodeMirror-scroll {
316
+ min-height: 100px;
317
+ }
318
+
319
+ #nsl-admin fieldset label {
320
+ vertical-align: top;
321
+ }
322
+
323
+ input[type="radio"] ~ img {
324
+ margin-top: 20px;
325
+ margin-right: 30px;
326
+ }
327
+
328
+ input[type="radio"]:checked ~ img {
329
+ box-shadow: 0 0 0 3px #00a0d2;
330
+ border-radius: 3px;
331
+ }
admin/templates-provider/buttons.php ADDED
@@ -0,0 +1,169 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined('ABSPATH') || die();
3
+ /** @var $this NextendSocialProvider */
4
+
5
+ $settings = $this->settings;
6
+
7
+ $isPRO = apply_filters('nsl-pro', false);
8
+ ?>
9
+ <div class="nsl-admin-sub-content">
10
+ <script type="text/javascript">
11
+ (function ($) {
12
+
13
+ window.resetButtonToDefault = function (id) {
14
+ var defaultButtonValues = {
15
+ '#login_label': <?php echo wp_json_encode($settings->get('login_label', 'default')); ?>,
16
+ '#link_label': <?php echo wp_json_encode($settings->get('link_label', 'default')); ?>,
17
+ '#unlink_label': <?php echo wp_json_encode($settings->get('unlink_label', 'default')); ?>,
18
+ '#custom_default_button': <?php echo wp_json_encode($this->getRawDefaultButton()); ?>,
19
+ '#custom_icon_button': <?php echo wp_json_encode($this->getRawIconButton()); ?>
20
+ };
21
+
22
+ var $CodeMirror = jQuery(id).val(defaultButtonValues[id]).siblings('.CodeMirror').get(0);
23
+ if ($CodeMirror && typeof $CodeMirror.CodeMirror !== 'undefined') {
24
+ $CodeMirror.CodeMirror.setValue(defaultButtonValues[id]);
25
+ }
26
+ return false;
27
+ };
28
+
29
+ $(document).ready(function () {
30
+ $('#custom_default_button_enabled').on('change', function () {
31
+ if ($(this).is(':checked')) {
32
+ $('#custom_default_button_textarea_container').css('display', '');
33
+
34
+ var $CodeMirror = jQuery('#custom_default_button').siblings('.CodeMirror').get(0);
35
+ if ($CodeMirror && typeof $CodeMirror.CodeMirror !== 'undefined') {
36
+ $CodeMirror.CodeMirror.refresh();
37
+ }
38
+ }
39
+ else {
40
+ $('#custom_default_button_textarea_container').css('display', 'none');
41
+ }
42
+ });
43
+
44
+ $('#custom_icon_button_enabled').on('change', function () {
45
+ if ($(this).is(':checked')) {
46
+ $('#custom_icon_button_textarea_container').css('display', '');
47
+
48
+ var $CodeMirror = jQuery('#custom_icon_button').siblings('.CodeMirror').get(0);
49
+ if ($CodeMirror && typeof $CodeMirror.CodeMirror !== 'undefined') {
50
+ $CodeMirror.CodeMirror.refresh();
51
+ }
52
+ }
53
+ else {
54
+ $('#custom_icon_button_textarea_container').css('display', 'none');
55
+ }
56
+ });
57
+ });
58
+ })(jQuery);
59
+ </script>
60
+
61
+ <form method="post" action="<?php echo admin_url('admin-post.php'); ?>" novalidate="novalidate">
62
+
63
+ <?php wp_nonce_field('nextend-social-login'); ?>
64
+ <input type="hidden" name="action" value="nextend-social-login"/>
65
+ <input type="hidden" name="view" value="provider-<?php echo $this->getId(); ?>"/>
66
+ <input type="hidden" name="subview" value="buttons"/>
67
+
68
+ <table class="form-table">
69
+ <tbody>
70
+ <tr>
71
+ <th scope="row"><label
72
+ for="login_label"><?php _e('Login label', 'nextend-facebook-connect'); ?></label></th>
73
+ <td>
74
+ <input name="login_label" type="text" id="login_label"
75
+ value="<?php echo esc_attr($settings->get('login_label')); ?>" class="regular-text">
76
+ <p class="description"><a href="#"
77
+ onclick="return resetButtonToDefault('#login_label');"><?php _e('Reset to default', 'nextend-facebook-connect'); ?></a>
78
+ </p>
79
+ </td>
80
+ </tr>
81
+ <tr>
82
+ <th scope="row"><label for="link_label"><?php _e('Link label', 'nextend-facebook-connect'); ?></label>
83
+ </th>
84
+ <td>
85
+ <input name="link_label" type="text" id="link_label"
86
+ value="<?php echo esc_attr($settings->get('link_label')); ?>" class="regular-text">
87
+ <p class="description"><a href="#"
88
+ onclick="return resetButtonToDefault('#link_label');"><?php _e('Reset to default', 'nextend-facebook-connect'); ?></a>
89
+ </p>
90
+ </td>
91
+ </tr>
92
+ <tr>
93
+ <th scope="row"><label
94
+ for="unlink_label"><?php _e('Unlink label', 'nextend-facebook-connect'); ?></label></th>
95
+ <td>
96
+ <input name="unlink_label" type="text" id="unlink_label"
97
+ value="<?php echo esc_attr($settings->get('unlink_label')); ?>" class="regular-text">
98
+ <p class="description"><a href="#"
99
+ onclick="return resetButtonToDefault('#unlink_label');"><?php _e('Reset to default', 'nextend-facebook-connect'); ?></a>
100
+ </p>
101
+ </td>
102
+ </tr>
103
+ <tr>
104
+ <th scope="row"><label
105
+ for="custom_default_button"><?php _e('Default button', 'nextend-facebook-connect'); ?></label>
106
+ </th>
107
+ <td>
108
+ <?php
109
+ $useCustom = false;
110
+ $buttonTemplate = $settings->get('custom_default_button');
111
+ if (!empty($buttonTemplate)) {
112
+ $useCustom = true;
113
+ } else {
114
+ $buttonTemplate = $this->getRawDefaultButton();
115
+ }
116
+ ?>
117
+ <fieldset><label for="custom_default_button_enabled">
118
+ <input name="custom_default_button_enabled" type="checkbox"
119
+ id="custom_default_button_enabled"
120
+ value="1" <?php if ($useCustom): ?> checked<?php endif; ?>>
121
+ <?php _e('Use custom button', 'nextend-facebook-connect'); ?></label>
122
+ </fieldset>
123
+ <div id="custom_default_button_textarea_container" <?php if (!$useCustom): ?> style="display:none;"<?php endif; ?>>
124
+ <textarea cols="160" rows="6" name="custom_default_button" id="custom_default_button"
125
+ class="nextend-html-editor"
126
+ aria-describedby="editor-keyboard-trap-help-1 editor-keyboard-trap-help-2 editor-keyboard-trap-help-3 editor-keyboard-trap-help-4"><?php echo esc_textarea($buttonTemplate); ?></textarea>
127
+ <p class="description"><a href="#"
128
+ onclick="return resetButtonToDefault('#custom_default_button');"><?php _e('Reset to default', 'nextend-facebook-connect'); ?></a><br><br><?php printf(__('Use the %s in your custom button\'s code to make the label show up.', 'nextend-facebook-connect'), "<code>{{label}}</code>"); ?>
129
+ </p>
130
+ </div>
131
+ </td>
132
+ </tr>
133
+ <?php if ($isPRO): ?>
134
+ <tr>
135
+ <th scope="row"><label
136
+ for="custom_icon_button"><?php _e('Icon button', 'nextend-facebook-connect'); ?></label>
137
+ </th>
138
+ <td>
139
+ <?php
140
+ $useCustom = false;
141
+ $buttonTemplate = $settings->get('custom_icon_button');
142
+ if (!empty($buttonTemplate)) {
143
+ $useCustom = true;
144
+ } else {
145
+ $buttonTemplate = $this->getRawIconButton();
146
+ }
147
+ ?>
148
+ <fieldset><label for="custom_icon_button_enabled">
149
+ <input name="custom_icon_button_enabled" type="checkbox" id="custom_icon_button_enabled"
150
+ value="1" <?php if ($useCustom): ?> checked<?php endif; ?>>
151
+ <?php _e('Use custom button', 'nextend-facebook-connect'); ?></label>
152
+ </fieldset>
153
+ <div id="custom_icon_button_textarea_container" <?php if (!$useCustom): ?> style="display:none;"<?php endif; ?>>
154
+ <textarea cols="160" rows="6" name="custom_icon_button" id="custom_icon_button"
155
+ class="nextend-html-editor"
156
+ aria-describedby="editor-keyboard-trap-help-1 editor-keyboard-trap-help-2 editor-keyboard-trap-help-3 editor-keyboard-trap-help-4"><?php echo esc_textarea($buttonTemplate); ?></textarea>
157
+ <p class="description"><a href="#"
158
+ onclick="return resetButtonToDefault('#custom_icon_button');"><?php _e('Reset to default', 'nextend-facebook-connect'); ?></a>
159
+ </p>
160
+ </div>
161
+ </td>
162
+ </tr>
163
+ <?php endif; ?>
164
+ </tbody>
165
+ </table>
166
+ <p class="submit"><input type="submit" name="submit" id="submit" class="button button-primary"
167
+ value="<?php _e('Save Changes'); ?>"></p>
168
+ </form>
169
+ </div>
admin/templates-provider/menu.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined('ABSPATH') || die();
3
+ /** @var $this NextendSocialProvider */
4
+ /** @var $view string */
5
+ ?>
6
+ <div class="nsl-admin-sub-nav-bar">
7
+ <a href="<?php echo $this->getAdminUrl(); ?>"
8
+ class="nsl-admin-nav-tab<?php if ($view === 'getting-started'): ?> nsl-admin-nav-tab-active<?php endif; ?>"><?php _e('Getting Started', 'nextend-facebook-connect'); ?></a>
9
+ <a href="<?php echo $this->getAdminUrl('settings'); ?>"
10
+ class="nsl-admin-nav-tab<?php if ($view === 'settings'): ?> nsl-admin-nav-tab-active<?php endif; ?>"><?php _e('Settings', 'nextend-facebook-connect'); ?></a>
11
+ <a href="<?php echo $this->getAdminUrl('buttons'); ?>"
12
+ class="nsl-admin-nav-tab<?php if ($view === 'buttons'): ?> nsl-admin-nav-tab-active<?php endif; ?>"><?php _e('Buttons', 'nextend-facebook-connect'); ?></a>
13
+ <a href="<?php echo $this->getAdminUrl('usage'); ?>"
14
+ class="nsl-admin-nav-tab<?php if ($view === 'usage'): ?> nsl-admin-nav-tab-active<?php endif; ?>"><?php _e('Usage', 'nextend-facebook-connect'); ?></a>
15
+ </div>
admin/templates-provider/settings-pro.php ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined('ABSPATH') || die();
3
+ /** @var $this NextendSocialProvider */
4
+
5
+ $settings = $this->settings;
6
+
7
+ $isPRO = apply_filters('nsl-pro', false);
8
+
9
+ $attr = '';
10
+ if (!$isPRO) {
11
+ $attr = ' disabled ';
12
+ }
13
+ ?>
14
+
15
+ <hr/>
16
+ <h1><?php _e('PRO settings', 'nextend-facebook-connect'); ?></h1>
17
+
18
+
19
+ <?php
20
+ NextendSocialLoginAdmin::showProBox();
21
+ ?>
22
+ <input type="hidden" name="tested" id="tested" value="<?php echo esc_attr($settings->get('tested')); ?>"/>
23
+ <table class="form-table" <?php if (0 && !$isPRO): ?> style="opacity:0.5;"<?php endif; ?>>
24
+ <tbody>
25
+ <tr>
26
+ <th scope="row"><?php _e('Ask E-mail on registration', 'nextend-facebook-connect'); ?></th>
27
+ <td>
28
+ <fieldset>
29
+ <legend class="screen-reader-text">
30
+ <span><?php _e('Ask E-mail on registration', 'nextend-facebook-connect'); ?></span></legend>
31
+ <label><input type="radio" name="ask_email"
32
+ value="never" <?php if ($settings->get('ask_email') == 'never') : ?> checked="checked" <?php endif; ?><?php echo $attr; ?>>
33
+ <span><?php _e('Never', 'nextend-facebook-connect'); ?></span></label><br>
34
+ <label><input type="radio" name="ask_email"
35
+ value="when-empty" <?php if ($settings->get('ask_email') == 'when-empty') : ?> checked="checked" <?php endif; ?><?php echo $attr; ?>>
36
+ <span><?php _e('When email is not provided or empty', 'nextend-facebook-connect'); ?></span></label><br>
37
+ <label><input type="radio" name="ask_email"
38
+ value="always" <?php if ($settings->get('ask_email') == 'always') : ?> checked="checked" <?php endif; ?><?php echo $attr; ?>>
39
+ <span><?php _e('Always', 'nextend-facebook-connect'); ?></span></label><br>
40
+ </fieldset>
41
+ </td>
42
+ </tr>
43
+ <tr>
44
+ <th scope="row"><?php _e('Ask Username on registration', 'nextend-facebook-connect'); ?></th>
45
+ <td>
46
+ <fieldset>
47
+ <legend class="screen-reader-text">
48
+ <span><?php _e('Ask Username on registration', 'nextend-facebook-connect'); ?></span></legend>
49
+ <label><input type="radio" name="ask_user"
50
+ value="never" <?php if ($settings->get('ask_user') == 'never') : ?> checked="checked" <?php endif; ?><?php echo $attr; ?>>
51
+ <span><?php _e('Never, generate automatically', 'nextend-facebook-connect'); ?></span></label><br>
52
+ <label><input type="radio" name="ask_user"
53
+ value="always" <?php if ($settings->get('ask_user') == 'always') : ?> checked="checked" <?php endif; ?><?php echo $attr; ?>>
54
+ <span><?php _e('Always', 'nextend-facebook-connect'); ?></span></label><br>
55
+ </fieldset>
56
+ </td>
57
+ </tr>
58
+ <tr>
59
+ <th scope="row"><?php _e('Automatically connect the existing account upon registration', 'nextend-facebook-connect'); ?></th>
60
+ <td>
61
+ <fieldset>
62
+ <legend class="screen-reader-text">
63
+ <span><?php _e('Automatically connect the existing account upon registration', 'nextend-facebook-connect'); ?></span>
64
+ </legend>
65
+ <label><input type="radio" name="auto_link"
66
+ value="disabled" <?php if ($settings->get('auto_link') == 'disabled') : ?> checked="checked" <?php endif; ?><?php echo $attr; ?>>
67
+ <span><?php _e('Disabled', 'nextend-facebook-connect'); ?></span></label><br>
68
+ <label><input type="radio" name="auto_link"
69
+ value="email" <?php if ($settings->get('auto_link') == 'email') : ?> checked="checked" <?php endif; ?><?php echo $attr; ?>>
70
+ <span><?php _e('Automatic, based on email address', 'nextend-facebook-connect'); ?></span></label><br>
71
+ </fieldset>
72
+ </td>
73
+ </tr>
74
+ <tr>
75
+ <th scope="row"><?php _e('Disable login for the selected roles', 'nextend-facebook-connect'); ?></th>
76
+ <td>
77
+ <?php
78
+ $wp_roles = new WP_Roles();
79
+ $roles = $wp_roles->get_names();
80
+
81
+ $disable_roles = $settings->get('disabled_roles');
82
+ foreach ($roles AS $roleKey => $label):
83
+ ?>
84
+ <fieldset><label for="disabled_roles_<?php echo esc_attr($roleKey); ?>">
85
+ <input name="disabled_roles[]" type="checkbox"
86
+ id="disabled_roles_<?php echo esc_attr($roleKey); ?>"
87
+ value="<?php echo esc_attr($roleKey); ?>" <?php if (in_array($roleKey, $disable_roles)) : ?> checked <?php endif ?> <?php echo $attr; ?> />
88
+ <?php echo $label; ?></label>
89
+ </fieldset>
90
+ <?php endforeach; ?>
91
+ <input type="hidden" name="disabled_roles[]" value=""/>
92
+ </td>
93
+ </tr>
94
+ <tr>
95
+ <th scope="row"><?php _e('Default roles for user who registered with this provider', 'nextend-facebook-connect'); ?></th>
96
+ <td>
97
+ <?php
98
+ $register_roles = $settings->get('register_roles');
99
+ ?>
100
+ <fieldset><label for="register_roles_default">
101
+ <input name="register_roles[]" type="checkbox" id="register_roles_default"
102
+ value="default" <?php if (in_array('default', $register_roles)) : ?> checked <?php endif ?> <?php echo $attr; ?> />
103
+ <?php _e('Default', 'nextend-facebook-connect'); ?></label>
104
+ </fieldset>
105
+ <?php
106
+ foreach ($roles AS $roleKey => $label):
107
+ ?>
108
+ <fieldset><label for="register_roles_<?php echo esc_attr($roleKey); ?>">
109
+ <input name="register_roles[]" type="checkbox"
110
+ id="register_roles_<?php echo esc_attr($roleKey); ?>"
111
+ value="<?php echo esc_attr($roleKey); ?>" <?php if (in_array($roleKey, $register_roles)) : ?> checked <?php endif ?> <?php echo $attr; ?> />
112
+ <?php echo $label; ?></label>
113
+ </fieldset>
114
+ <?php endforeach; ?>
115
+ <input type="hidden" name="register_roles[]" value=""/>
116
+ </td>
117
+ </tr>
118
+ </tbody>
119
+ </table>
120
+ <?php if ($isPRO): ?>
121
+ <p class="submit"><input type="submit" name="submit" id="submit" class="button button-primary"
122
+ value="<?php _e('Save Changes'); ?>"></p>
123
+ <?php endif; ?>
admin/templates-provider/usage.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined('ABSPATH') || die();
3
+ /** @var $this NextendSocialProvider */
4
+ ?>
5
+ <div class="nsl-admin-sub-content">
6
+
7
+ <h4><?php _e('Shortcode', 'nextend-facebook-connect'); ?></h4>
8
+
9
+ <?php
10
+ $shortcodes = array(
11
+ '[nextend_social_login provider="' . $this->getId() . '"]',
12
+ '[nextend_social_login provider="' . $this->getId() . '" style="icon"]',
13
+ '[nextend_social_login provider="' . $this->getId() . '" style="icon" redirect="https://nextendweb.com/"]'
14
+ );
15
+ ?>
16
+
17
+ <textarea readonly cols="160" rows="6" class="nextend-html-editor-readonly"
18
+ aria-describedby="editor-keyboard-trap-help-1 editor-keyboard-trap-help-2 editor-keyboard-trap-help-3 editor-keyboard-trap-help-4"><?php echo implode("\n\n", $shortcodes); ?></textarea>
19
+
20
+
21
+ <h4><?php _e('Simple link', 'nextend-facebook-connect'); ?></h4>
22
+
23
+ <?php
24
+ $html = '<a href="' . $this->getLoginUrl() . '" data-plugin="nsl" data-action="connect" data-redirect="current" data-provider="' . esc_attr($this->getId()) . '" data-popupwidth="' . $this->getPopupWidth() . '" data-popupheight="' . $this->getPopupHeight() . '">' . "\n\t" . __('Click here to login or register', 'nextend-facebook-connect') . "\n" . '</a>';
25
+ ?>
26
+ <textarea readonly cols="160" rows="6" class="nextend-html-editor-readonly"
27
+ aria-describedby="editor-keyboard-trap-help-1 editor-keyboard-trap-help-2 editor-keyboard-trap-help-3 editor-keyboard-trap-help-4"><?php echo esc_textarea($html); ?></textarea>
28
+
29
+ <h4><?php _e('Image button', 'nextend-facebook-connect'); ?></h4>
30
+
31
+ <?php
32
+ $html = '<a href="' . $this->getLoginUrl() . '" data-plugin="nsl" data-action="connect" data-redirect="current" data-provider="' . esc_attr($this->getId()) . '" data-popupwidth="' . $this->getPopupWidth() . '" data-popupheight="' . $this->getPopupHeight() . '">' . "\n\t" . '<img src="' . __('Image url', 'nextend-facebook-connect') . '" alt="" />' . "\n" . '</a>';
33
+ ?>
34
+ <textarea readonly cols="160" rows="6" class="nextend-html-editor-readonly"
35
+ aria-describedby="editor-keyboard-trap-help-1 editor-keyboard-trap-help-2 editor-keyboard-trap-help-3 editor-keyboard-trap-help-4"><?php echo esc_textarea($html); ?></textarea>
36
+
37
+ </div>
admin/templates/footer.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php
2
+ defined('ABSPATH') || die();
3
+ ?>
4
+ </div>
admin/templates/global-settings-pro.php ADDED
@@ -0,0 +1,208 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined('ABSPATH') || die();
3
+
4
+ $isPRO = apply_filters('nsl-pro', false);
5
+
6
+ $attr = '';
7
+ if (!$isPRO) {
8
+ $attr = ' disabled ';
9
+ }
10
+
11
+ $settings = NextendSocialLogin::$settings;
12
+ ?>
13
+ <hr/>
14
+ <h1><?php _e('PRO settings', 'nextend-facebook-connect'); ?></h1>
15
+
16
+
17
+ <?php
18
+ NextendSocialLoginAdmin::showProBox();
19
+ ?>
20
+ <table class="form-table" <?php if (0 && !$isPRO): ?> style="opacity:0.5;"<?php endif; ?>>
21
+ <tbody>
22
+ <tr>
23
+ <th scope="row"><?php _e('Login form button style', 'nextend-facebook-connect'); ?></th>
24
+ <td>
25
+ <fieldset>
26
+ <legend class="screen-reader-text">
27
+ <span><?php _e('Login form button style', 'nextend-facebook-connect'); ?></span></legend>
28
+ <label>
29
+ <input type="radio" name="login_form_button_style"
30
+ value="default" <?php if ($settings->get('login_form_button_style') == 'default') : ?> checked="checked" <?php endif; ?><?php echo $attr; ?>>
31
+ <span><?php _e('Default', 'nextend-facebook-connect'); ?></span><br/>
32
+ <img src="<?php echo plugins_url('images/buttons/default.png', NSL_ADMIN_PATH) ?>"/>
33
+ </label>
34
+ <label>
35
+ <input type="radio" name="login_form_button_style"
36
+ value="icon" <?php if ($settings->get('login_form_button_style') == 'icon') : ?> checked="checked" <?php endif; ?><?php echo $attr; ?>>
37
+ <span><?php _e('Icon', 'nextend-facebook-connect'); ?></span><br/>
38
+ <img src="<?php echo plugins_url('images/buttons/icon.png', NSL_ADMIN_PATH) ?>"/>
39
+ </label><br>
40
+ </fieldset>
41
+ </td>
42
+ </tr>
43
+ <tr>
44
+ <th scope="row"><?php _e('Login layout', 'nextend-facebook-connect'); ?></th>
45
+ <td>
46
+ <fieldset>
47
+ <legend class="screen-reader-text">
48
+ <span><?php _e('Login layout', 'nextend-facebook-connect'); ?></span></legend>
49
+ <label>
50
+ <input type="radio" name="login_form_layout"
51
+ value="below" <?php if ($settings->get('login_form_layout') == 'below') : ?> checked="checked" <?php endif; ?><?php echo $attr; ?>>
52
+ <span><?php _e('Below', 'nextend-facebook-connect'); ?></span><br/>
53
+ <img src="<?php echo plugins_url('images/layouts/below.png', NSL_ADMIN_PATH) ?>"/>
54
+ </label>
55
+ <label>
56
+ <input type="radio" name="login_form_layout"
57
+ value="below-separator" <?php if ($settings->get('login_form_layout') == 'below-separator') : ?> checked="checked" <?php endif; ?><?php echo $attr; ?>>
58
+ <span><?php _e('Below with separator', 'nextend-facebook-connect'); ?></span><br/>
59
+ <img src="<?php echo plugins_url('images/layouts/below-separator.png', NSL_ADMIN_PATH) ?>"/>
60
+ </label>
61
+ <label>
62
+ <input type="radio" name="login_form_layout"
63
+ value="below-floating" <?php if ($settings->get('login_form_layout') == 'below-floating') : ?> checked="checked" <?php endif; ?><?php echo $attr; ?>>
64
+ <span><?php _e('Below and floating', 'nextend-facebook-connect'); ?></span><br/>
65
+ <img src="<?php echo plugins_url('images/layouts/below-floating.png', NSL_ADMIN_PATH) ?>"/>
66
+ </label>
67
+ <label>
68
+ <input type="radio" name="login_form_layout"
69
+ value="above" <?php if ($settings->get('login_form_layout') == 'above') : ?> checked="checked" <?php endif; ?><?php echo $attr; ?>>
70
+ <span><?php _e('Above', 'nextend-facebook-connect'); ?></span><br/>
71
+ <img src="<?php echo plugins_url('images/layouts/above.png', NSL_ADMIN_PATH) ?>"/>
72
+ </label>
73
+ <label>
74
+ <input type="radio" name="login_form_layout"
75
+ value="above-separator" <?php if ($settings->get('login_form_layout') == 'above-separator') : ?> checked="checked" <?php endif; ?><?php echo $attr; ?>>
76
+ <span><?php _e('Above with separator', 'nextend-facebook-connect'); ?></span><br/>
77
+ <img src="<?php echo plugins_url('images/layouts/above-separator.png', NSL_ADMIN_PATH) ?>"/>
78
+ </label><br>
79
+ </fieldset>
80
+ </td>
81
+ </tr>
82
+ <tr>
83
+ <th scope="row"><?php _e('Comment login button', 'nextend-facebook-connect'); ?></th>
84
+ <td>
85
+ <fieldset>
86
+ <legend class="screen-reader-text">
87
+ <span><?php _e('Comment login button', 'nextend-facebook-connect'); ?></span></legend>
88
+ <label><input type="radio" name="comment_login_button"
89
+ value="show" <?php if ($settings->get('comment_login_button') == 'show') : ?> checked="checked" <?php endif; ?><?php echo $attr; ?>>
90
+ <span><?php _e('Show', 'nextend-facebook-connect'); ?></span></label><br>
91
+ <label><input type="radio" name="comment_login_button"
92
+ value="hide" <?php if ($settings->get('comment_login_button') == 'hide') : ?> checked="checked" <?php endif; ?><?php echo $attr; ?>>
93
+ <span><?php _e('Hide', 'nextend-facebook-connect'); ?></span></label><br>
94
+ </fieldset>
95
+ <p class="description"><?php printf(__('You need to turn on the \' %1$s > %2$s > %3$s \' for this feature to work', 'nextend-facebook-connect'), __('Settings'), __('Discussion'), __('Users must be registered and logged in to comment')); ?></p>
96
+ </td>
97
+ </tr>
98
+ <tr>
99
+ <th scope="row"><?php _e('Comment button style', 'nextend-facebook-connect'); ?></th>
100
+ <td>
101
+ <fieldset>
102
+ <legend class="screen-reader-text">
103
+ <span><?php _e('Comment button style', 'nextend-facebook-connect'); ?></span></legend>
104
+ <label>
105
+ <input type="radio" name="comment_button_style"
106
+ value="default" <?php if ($settings->get('comment_button_style') == 'default') : ?> checked="checked" <?php endif; ?><?php echo $attr; ?>>
107
+ <span><?php _e('Default', 'nextend-facebook-connect'); ?></span><br/>
108
+ <img src="<?php echo plugins_url('images/buttons/default.png', NSL_ADMIN_PATH) ?>"/>
109
+ </label>
110
+ <label>
111
+ <input type="radio" name="comment_button_style"
112
+ value="icon" <?php if ($settings->get('comment_button_style') == 'icon') : ?> checked="checked" <?php endif; ?><?php echo $attr; ?>>
113
+ <span><?php _e('Icon', 'nextend-facebook-connect'); ?></span><br/>
114
+ <img src="<?php echo plugins_url('images/buttons/icon.png', NSL_ADMIN_PATH) ?>"/>
115
+ </label><br>
116
+ </fieldset>
117
+ </td>
118
+ </tr>
119
+ <tr>
120
+ <th scope="row"><?php _e('WooCommerce login form', 'nextend-facebook-connect'); ?></th>
121
+ <td>
122
+ <fieldset>
123
+ <legend class="screen-reader-text">
124
+ <span><?php _e('WooCommerce login form', 'nextend-facebook-connect'); ?></span></legend>
125
+ <label><input type="radio" name="woocommerce_login"
126
+ value="" <?php if ($settings->get('woocommerce_login') == '') : ?> checked="checked" <?php endif; ?><?php echo $attr; ?>>
127
+ <span><?php _e('No Connect button in login form', 'nextend-facebook-connect'); ?></span></label><br>
128
+ <label><input type="radio" name="woocommerce_login"
129
+ value="before" <?php if ($settings->get('woocommerce_login') == 'before') : ?> checked="checked" <?php endif; ?><?php echo $attr; ?>>
130
+ <span><?php _e('Connect button before login form', 'nextend-facebook-connect'); ?></span>
131
+ <code><?php _e('Action:'); ?>
132
+ woocommerce_login_form_start</code></label><br>
133
+ <label><input type="radio" name="woocommerce_login"
134
+ value="after" <?php if ($settings->get('woocommerce_login') == 'after') : ?> checked="checked" <?php endif; ?><?php echo $attr; ?>>
135
+ <span><?php _e('Connect button after login form', 'nextend-facebook-connect'); ?></span>
136
+ <code><?php _e('Action:'); ?>
137
+ woocommerce_login_form_end</code></label><br>
138
+ </fieldset>
139
+ </td>
140
+ </tr>
141
+
142
+ <tr>
143
+ <th scope="row"><?php _e('WooCommerce billing form', 'nextend-facebook-connect'); ?></th>
144
+ <td>
145
+ <fieldset>
146
+ <legend class="screen-reader-text">
147
+ <span><?php _e('WooCommerce billing form', 'nextend-facebook-connect'); ?></span></legend>
148
+ <label><input type="radio" name="woocommerce_billing"
149
+ value="" <?php if ($settings->get('woocommerce_billing') == '') : ?> checked="checked" <?php endif; ?><?php echo $attr; ?>>
150
+ <span><?php _e('No Connect button in billing form', 'nextend-facebook-connect'); ?></span></label><br>
151
+ <label><input type="radio" name="woocommerce_billing"
152
+ value="before" <?php if ($settings->get('woocommerce_billing') == 'before') : ?> checked="checked" <?php endif; ?><?php echo $attr; ?>>
153
+ <span><?php _e('Connect button before billing form', 'nextend-facebook-connect'); ?></span>
154
+ <code><?php _e('Action:'); ?>
155
+ woocommerce_before_checkout_billing_form</code></label><br>
156
+ <label><input type="radio" name="woocommerce_billing"
157
+ value="after" <?php if ($settings->get('woocommerce_billing') == 'after') : ?> checked="checked" <?php endif; ?><?php echo $attr; ?>>
158
+ <span><?php _e('Connect button after billing form', 'nextend-facebook-connect'); ?></span></label>
159
+ <code><?php _e('Action:'); ?>
160
+ woocommerce_after_checkout_billing_form</code><br>
161
+ </fieldset>
162
+ </td>
163
+ </tr>
164
+ <tr>
165
+ <th scope="row"><?php _e('WooCommerce account details', 'nextend-facebook-connect'); ?></th>
166
+ <td>
167
+ <fieldset>
168
+ <legend class="screen-reader-text">
169
+ <span><?php _e('WooCommerce account details', 'nextend-facebook-connect'); ?></span></legend>
170
+ <label><input type="radio" name="woocommerce_account_details"
171
+ value="before" <?php if ($settings->get('woocommerce_account_details') == 'before') : ?> checked="checked" <?php endif; ?><?php echo $attr; ?>>
172
+ <span><?php _e('Link buttons before account details', 'nextend-facebook-connect'); ?></span>
173
+ <code><?php _e('Action:'); ?>
174
+ woocommerce_edit_account_form_start</code></label><br>
175
+ <label><input type="radio" name="woocommerce_account_details"
176
+ value="after" <?php if ($settings->get('woocommerce_account_details') == 'after') : ?> checked="checked" <?php endif; ?><?php echo $attr; ?>>
177
+ <span><?php _e('Link buttons after account details', 'nextend-facebook-connect'); ?></span>
178
+ <code><?php _e('Action:'); ?>
179
+ woocommerce_edit_account_form_end</code></label><br>
180
+ </fieldset>
181
+ </td>
182
+ </tr>
183
+ <tr>
184
+ <th scope="row"><?php _e('WooCommerce button style', 'nextend-facebook-connect'); ?></th>
185
+ <td>
186
+ <fieldset>
187
+ <legend class="screen-reader-text">
188
+ <span><?php _e('WooCommerce button style', 'nextend-facebook-connect'); ?></span></legend>
189
+ <label>
190
+ <input type="radio" name="woocoommerce_form_button_style"
191
+ value="default" <?php if ($settings->get('woocoommerce_form_button_style') == 'default') : ?> checked="checked" <?php endif; ?><?php echo $attr; ?>>
192
+ <span><?php _e('Default', 'nextend-facebook-connect'); ?></span><br/>
193
+ <img src="<?php echo plugins_url('images/buttons/default.png', NSL_ADMIN_PATH) ?>"/>
194
+ </label>
195
+ <label>
196
+ <input type="radio" name="woocoommerce_form_button_style"
197
+ value="icon" <?php if ($settings->get('woocoommerce_form_button_style') == 'icon') : ?> checked="checked" <?php endif; ?><?php echo $attr; ?>>
198
+ <span><?php _e('Icon', 'nextend-facebook-connect'); ?></span><br/>
199
+ <img src="<?php echo plugins_url('images/buttons/icon.png', NSL_ADMIN_PATH) ?>"/>
200
+ </label><br>
201
+ </fieldset>
202
+ </td>
203
+ </tr>
204
+ </tbody>
205
+ </table>
206
+
207
+ <p class="submit"><input type="submit" name="submit" id="submit" class="button button-primary"
208
+ value="<?php _e('Save Changes'); ?>"></p>
admin/templates/global-settings.php ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined('ABSPATH') || die();
3
+
4
+ /** @var $view string */
5
+
6
+ $settings = NextendSocialLogin::$settings;
7
+ ?>
8
+ <div class="nsl-admin-content">
9
+ <script type="text/javascript">
10
+ (function ($) {
11
+ $(document).ready(function () {
12
+ $('#custom_redirect_enabled').on('change', function () {
13
+ if ($(this).is(':checked')) {
14
+ $('#redirect').css('display', '');
15
+ }
16
+ else {
17
+ $('#redirect').css('display', 'none');
18
+ }
19
+ });
20
+
21
+ $('#custom_redirect_reg_enabled').on('change', function () {
22
+ if ($(this).is(':checked')) {
23
+ $('#redirect_reg').css('display', '');
24
+ }
25
+ else {
26
+ $('#redirect_reg').css('display', 'none');
27
+ }
28
+ });
29
+ });
30
+ })(jQuery);
31
+ </script>
32
+
33
+ <form method="post" action="<?php echo admin_url('admin-post.php'); ?>" novalidate="novalidate">
34
+
35
+ <?php wp_nonce_field('nextend-social-login'); ?>
36
+ <input type="hidden" name="action" value="nextend-social-login"/>
37
+ <input type="hidden" name="view" value="<?php echo $view; ?>"/>
38
+ <input type="hidden" name="settings_saved" value="1"/>
39
+
40
+ <table class="form-table">
41
+ <tbody>
42
+ <tr>
43
+ <th scope="row"><?php _e('Debug mode', 'nextend-facebook-connect'); ?></th>
44
+ <td>
45
+ <fieldset>
46
+ <legend class="screen-reader-text">
47
+ <span><?php _e('Debug mode', 'nextend-facebook-connect'); ?></span></legend>
48
+ <label><input type="radio" name="debug"
49
+ value="0" <?php if ($settings->get('debug') == '0') : ?> checked="checked" <?php endif; ?>>
50
+ <span><?php _e('Disabled', 'nextend-facebook-connect'); ?></span></label><br>
51
+ <label><input type="radio" name="debug"
52
+ value="1" <?php if ($settings->get('debug') == '1') : ?> checked="checked" <?php endif; ?>>
53
+ <span><?php _e('Enabled', 'nextend-facebook-connect'); ?></span></label><br>
54
+ </fieldset>
55
+ </td>
56
+ </tr>
57
+ <tr>
58
+ <th scope="row"><label
59
+ for="redirect"><?php _e('Fixed redirect url for login', 'nextend-facebook-connect'); ?></label>
60
+ </th>
61
+ <td>
62
+ <?php
63
+ $useCustom = false;
64
+ $redirect = $settings->get('redirect');
65
+ if (!empty($redirect)) {
66
+ $useCustom = true;
67
+ }
68
+ ?>
69
+ <fieldset><label for="custom_redirect_enabled">
70
+ <input name="custom_redirect_enabled" type="checkbox" id="custom_redirect_enabled"
71
+ value="1" <?php if ($useCustom): ?> checked<?php endif; ?>>
72
+ <?php _e('Use custom', 'nextend-facebook-connect'); ?></label>
73
+ </fieldset>
74
+ <input name="redirect" type="text" id="redirect" value="<?php echo esc_attr($redirect); ?>"
75
+ class="regular-text"<?php if (!$useCustom): ?> style="display:none;"<?php endif; ?>>
76
+ </td>
77
+ </tr>
78
+ <tr>
79
+ <th scope="row"><label
80
+ for="redirect_reg"><?php _e('Fixed redirect url for register', 'nextend-facebook-connect'); ?></label>
81
+ </th>
82
+ <td>
83
+ <?php
84
+ $useCustom = false;
85
+ $redirectReg = $settings->get('redirect_reg');
86
+ if (!empty($redirectReg)) {
87
+ $useCustom = true;
88
+ }
89
+ ?>
90
+ <fieldset><label for="custom_redirect_reg_enabled">
91
+ <input name="custom_redirect_reg_enabled" type="checkbox" id="custom_redirect_reg_enabled"
92
+ value="1" <?php if ($useCustom): ?> checked<?php endif; ?>>
93
+ <?php _e('Use custom', 'nextend-facebook-connect'); ?></label>
94
+ </fieldset>
95
+ <input name="redirect_reg" type="text" id="redirect_reg"
96
+ value="<?php echo esc_attr($redirectReg); ?>"
97
+ class="regular-text"<?php if (!$useCustom): ?> style="display:none;"<?php endif; ?>>
98
+ </td>
99
+ </tr>
100
+ </tbody>
101
+ </table>
102
+ <p class="submit"><input type="submit" name="submit" id="submit" class="button button-primary"
103
+ value="<?php _e('Save Changes'); ?>"></p>
104
+
105
+ <?php NextendSocialLoginAdmin::renderProSettings(); ?>
106
+ </form>
107
+ </div>
admin/templates/header.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined('ABSPATH') || die();
3
+ ?>
4
+ <div id="nsl-admin">
5
+ <div class="nsl-admin-header">
6
+ <h1>
7
+ <a href="<?php echo NextendSocialLoginAdmin::getAdminUrl(); ?>">
8
+ <img src="<?php echo plugins_url('images/nsl-logo.png', NSL_ADMIN_PATH) ?>" width="64" height="64"
9
+ alt="Nextend Social Login"/>
10
+ Nextend Social Login</a>
11
+ </h1>
12
+
13
+ <a href="<?php echo NextendSocialLoginAdmin::trackUrl('https://nextendweb.com/nextend-social-login-docs/documentation/', 'header-menu-docs'); ?>"
14
+ class="nsl-admin-header-nav" target="_blank"><?php _e('Docs', 'nextend-facebook-connect'); ?></a>
15
+
16
+ <a href="<?php echo NextendSocialLoginAdmin::trackUrl('https://nextendweb.com/contact-us/', 'header-menu-support'); ?>"
17
+ class="nsl-admin-header-nav" target="_blank"><?php _e('Support', 'nextend-facebook-connect'); ?></a>
18
+
19
+ <a href="<?php echo NextendSocialLoginAdmin::trackUrl('https://nextendweb.com/social-login/', 'header-menu-pro-addon'); ?>"
20
+ class="nsl-admin-header-nav" target="_blank"><?php _e('Pro Addon', 'nextend-facebook-connect'); ?></a>
21
+ </div>
admin/templates/menu.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /** @var $view string */
3
+ ?>
4
+ <div class="nsl-admin-nav-bar">
5
+ <a href="<?php echo NextendSocialLoginAdmin::getAdminUrl(); ?>"
6
+ class="nsl-admin-nav-tab<?php if ($view === 'providers'): ?> nsl-admin-nav-tab-active<?php endif; ?>"><?php _e('Providers', 'nextend-facebook-connect'); ?></a>
7
+ <a href="<?php echo NextendSocialLoginAdmin::getAdminUrl('global-settings'); ?>"
8
+ class="nsl-admin-nav-tab<?php if ($view === 'global-settings'): ?> nsl-admin-nav-tab-active<?php endif; ?>"><?php _e('Global Settings', 'nextend-facebook-connect'); ?></a>
9
+
10
+ <?php if ($view === 'pro-addon' || NextendSocialLogin::$settings->get('license_key_ok') == '1' || defined('NSL_PRO_PATH')): ?>
11
+ <a href="<?php echo NextendSocialLoginAdmin::getAdminUrl('pro-addon'); ?>"
12
+ class="nsl-admin-nav-tab<?php if ($view === 'pro-addon'): ?> nsl-admin-nav-tab-active<?php endif; ?>"><?php _e('Pro Addon', 'nextend-facebook-connect'); ?></a>
13
+ <?php endif; ?>
14
+ </div>
admin/templates/pro-addon.php ADDED
@@ -0,0 +1,244 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /** @var $view string */
3
+
4
+ defined('ABSPATH') || die();
5
+
6
+ $settings = NextendSocialLogin::$settings;
7
+
8
+ $state = NextendSocialLoginAdmin::getProState();
9
+
10
+ function nsl_license_no_capability($view) {
11
+ ?>
12
+ <div class="nsl-box nsl-box-red nsl-box-error">
13
+ <h2 class="title"><?php _e('Error', 'nextend-facebook-connect'); ?></h2>
14
+ <p><?php _e('You don’t have sufficient permissions to install and activate plugins. Please contact your site’s administrator!', 'nextend-facebook-connect'); ?></p>
15
+ </div>
16
+ <?php
17
+ }
18
+
19
+ function nsl_license_installed($view) {
20
+ ?>
21
+ <div class="nsl-box nsl-box-blue">
22
+ <h2 class="title"><?php _e('Activate Pro Addon', 'nextend-facebook-connect'); ?></h2>
23
+ <p><?php _e('Pro Addon is installed but not activated. To be able to use the Pro features, you need to activate it.', 'nextend-facebook-connect'); ?></p>
24
+
25
+ <p>
26
+ <a href="<?php echo wp_nonce_url(add_query_arg(array(
27
+ 'action' => 'activate',
28
+ 'plugin' => urlencode('nextend-social-login-pro/nextend-social-login-pro.php'),
29
+ 'plugin_status' => 'all'
30
+ ), admin_url('plugins.php')), 'activate-plugin_' . 'nextend-social-login-pro/nextend-social-login-pro.php'); ?>"
31
+ target="_blank" onclick="setTimeout(function(){window.location.reload(true)}, 2000)"
32
+ class="button button-primary"><?php _e('Activate Pro Addon', 'nextend-facebook-connect'); ?></a>
33
+ <a href="<?php echo wp_nonce_url(add_query_arg(array(
34
+ 'action' => 'nextend-social-login',
35
+ 'view' => 'pro-addon-deauthorize'
36
+ ), admin_url('admin-post.php')), 'nextend-social-login'); ?>" class="button button-secondary">
37
+ <?php _e('Deauthorize Pro Addon', 'nextend-facebook-connect'); ?>
38
+ </a>
39
+ </p>
40
+ </div>
41
+ <?php
42
+ }
43
+
44
+ function nsl_license_not_installed($view) {
45
+ $plugin_slug = 'nextend-social-login-pro';
46
+ ?>
47
+ <div class="nsl-box nsl-box-blue plugin-card-<?php echo $plugin_slug; ?>">
48
+ <h2 class="title"><?php _e('Pro Addon is not installed', 'nextend-facebook-connect'); ?></h2>
49
+
50
+ <p><?php _e('To access the Pro features, you need to install and activate the Pro Addon.', 'nextend-facebook-connect'); ?></p>
51
+
52
+ <p class="submit">
53
+ <a class="install-now button button-primary" data-slug="<?php echo $plugin_slug; ?>"
54
+ href="<?php echo esc_url(wp_nonce_url(add_query_arg(array(
55
+ 'action' => 'install-plugin',
56
+ 'plugin' => $plugin_slug,
57
+ 'from' => 'nextend-facebook-connect',
58
+ ), self_admin_url('update.php')), 'install-plugin_' . $plugin_slug)); ?>"
59
+ aria-label="<?php echo esc_attr(sprintf(__('Install %s now'), 'Nextend Social Login PRO Addon')); ?>"
60
+ data-name="<?php echo esc_attr('Nextend Social Login PRO Addon'); ?>"><?php _e('Install Pro Addon', 'nextend-facebook-connect'); ?></a>
61
+ </p>
62
+ </div>
63
+ <script type="text/javascript">
64
+ (function ($) {
65
+ $(document).on('ready', function () {
66
+ var $button = $('.install-now').on('click.nsl', function (event) {
67
+ if (typeof wp.updates.installPlugin === 'function') {
68
+ /** @since WordPress 4.6.0 */
69
+
70
+ event.preventDefault();
71
+
72
+ if ($button.hasClass('updating-message') || $button.hasClass('button-disabled')) {
73
+ return;
74
+ }
75
+
76
+ if (wp.updates.shouldRequestFilesystemCredentials && !wp.updates.ajaxLocked) {
77
+ wp.updates.requestFilesystemCredentials(event);
78
+
79
+ $(document).on('credential-modal-cancel', function () {
80
+ var $message = $('.install-now.updating-message');
81
+
82
+ $message.removeClass('updating-message').text(wp.updates.l10n.installNow);
83
+
84
+ wp.a11y.speak(wp.updates.l10n.updateCancel, 'polite');
85
+ });
86
+ }
87
+
88
+ wp.updates.installPlugin({
89
+ slug: $button.data('slug'),
90
+ success: function (response) {
91
+ if (response.activateUrl) {
92
+
93
+ $button.addClass('updating-message')
94
+ .text( <?php echo wp_json_encode(__('Activating...', 'nextend-facebook-connect'))?> );
95
+
96
+ window.onNSLProActivate = function () {
97
+ window.location.reload(true);
98
+ };
99
+ $('<iframe onload="onNSLProActivate()" src="' + response.activateUrl +
100
+ '" style="visibility:hidden;"></iframe>').appendTo('body');
101
+ }
102
+ }
103
+ }).always(function () {
104
+ $button.off('.nsl');
105
+ });
106
+ }
107
+ });
108
+ });
109
+ })(jQuery);
110
+ </script>
111
+ <?php
112
+ }
113
+
114
+ function nsl_license_no_license($view) {
115
+
116
+ $args = array(
117
+ 'product' => 'nsl',
118
+ 'domain' => parse_url(site_url(), PHP_URL_HOST),
119
+ 'platform' => 'wordpress'
120
+
121
+ );
122
+
123
+ $authorizeUrl = NextendSocialLoginAdmin::trackUrl('https://secure.nextendweb.com/authorize/', 'authorize');
124
+ ?>
125
+ <div class="nsl-box nsl-box-yellow nsl-box-padlock">
126
+ <h2 class="title"><?php _e('Authorize your Pro Addon', 'nextend-facebook-connect'); ?></h2>
127
+ <p><?php _e('To be able to use the Pro features, you need to authorize Nextend Social Connect Pro Addon. You can do this by clicking on the Authorize button below then select the related purchase.', 'nextend-facebook-connect'); ?></p>
128
+
129
+ <p>
130
+ <a href="#"
131
+ onclick="window.authorizeWindow = NSLPopupCenter('<?php echo $authorizeUrl; ?>', 'authorize-window', 800, 800);return false;"
132
+ class="button button-primary"><?php _e('Authorize', 'nextend-facebook-connect'); ?></a>
133
+ </p>
134
+ </div>
135
+
136
+ <script type="text/javascript">
137
+ (function ($) {
138
+
139
+ var args = <?php echo wp_json_encode($args); ?>;
140
+ window.addEventListener('message', function (e) {
141
+ if (e.origin === 'https://secure.nextendweb.com') {
142
+ if (typeof window.authorizeWindow === 'undefined') {
143
+ if (typeof e.source !== 'undefined') {
144
+ window.authorizeWindow = e.source;
145
+ } else {
146
+ return false;
147
+ }
148
+ }
149
+
150
+ try {
151
+ var envelope = JSON.parse(e.data);
152
+
153
+ if (envelope.action) {
154
+ switch (envelope.action) {
155
+ case 'ready':
156
+ window.authorizeWindow.postMessage(JSON.stringify({
157
+ 'action': 'authorize',
158
+ 'data': args
159
+ }), 'https://secure.nextendweb.com');
160
+ break;
161
+ case 'license':
162
+ $('#license_key').val(envelope.license_key);
163
+ $('#license_form').submit();
164
+ break;
165
+ }
166
+
167
+ }
168
+ }
169
+ catch (ex) {
170
+ console.error(ex);
171
+ console.log(e);
172
+ }
173
+ }
174
+ });
175
+ })(jQuery);
176
+ </script>
177
+
178
+ <form id="license_form" method="post" action="<?php echo admin_url('admin-post.php'); ?>"
179
+ novalidate="novalidate" style="display:none;">
180
+
181
+ <?php wp_nonce_field('nextend-social-login'); ?>
182
+ <input type="hidden" name="action" value="nextend-social-login"/>
183
+ <input type="hidden" name="view" value="<?php echo $view; ?>"/>
184
+
185
+ <table class="form-table">
186
+ <tbody>
187
+ <tr>
188
+ <th scope="row"><label
189
+ for="license_key"><?php _e('License key', 'nextend-facebook-connect'); ?></label></th>
190
+ <td><input name="license_key" type="text" id="license_key"
191
+ value="<?php echo esc_attr(NextendSocialLogin::$settings->get('license_key')); ?>"
192
+ class="regular-text">
193
+ </td>
194
+ </tr>
195
+ </tbody>
196
+ </table>
197
+
198
+ </form>
199
+ <?php
200
+ }
201
+
202
+ function nsl_license_activated($view) {
203
+ ?>
204
+
205
+ <div class="nsl-box nsl-box-green">
206
+ <h2 class="title"><?php _e('Pro Addon is installed and activated', 'nextend-facebook-connect'); ?></h2>
207
+
208
+ <p><?php _e('You installed and activated the Pro Addon. If you don’t want to use it anymore, you can deauthorize using the button below.', 'nextend-facebook-connect'); ?></p>
209
+
210
+ <p class="submit">
211
+ <a href="<?php echo wp_nonce_url(add_query_arg(array(
212
+ 'action' => 'nextend-social-login',
213
+ 'view' => 'pro-addon-deauthorize'
214
+ ), admin_url('admin-post.php')), 'nextend-social-login'); ?>" class="button button-secondary">
215
+ <?php _e('Deauthorize Pro Addon', 'nextend-facebook-connect'); ?>
216
+ </a>
217
+ </p>
218
+ </div>
219
+ <?php
220
+ }
221
+
222
+
223
+ ?>
224
+ <div class="nsl-admin-content">
225
+ <?php
226
+ switch ($state) {
227
+ case 'no-capability':
228
+ nsl_license_no_capability($view);
229
+ break;
230
+ case 'installed':
231
+ nsl_license_installed($view);
232
+ break;
233
+ case 'not-installed':
234
+ nsl_license_not_installed($view);
235
+ break;
236
+ case 'no-license':
237
+ nsl_license_no_license($view);
238
+ break;
239
+ case 'activated':
240
+ nsl_license_activated($view);
241
+ break;
242
+ }
243
+ ?>
244
+ </div>
admin/templates/pro.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $state = NextendSocialLoginAdmin::getProState();
4
+
5
+ function nsl_get_pro_no_license() {
6
+ ?>
7
+ <div class="nsl-box nsl-box-yellow nsl-box-yellow-bg nsl-box-padlock">
8
+ <h2 class="title"><?php _e('Get Pro Addon to unlock more features', 'nextend-facebook-connect'); ?></h2>
9
+ <p><?php _e('The features below are available in Nextend Social Login Pro Addon. Get it today and tweak the awesome settings.', 'nextend-facebook-connect'); ?></p>
10
+ <p><?php _e('If you already have a license, you can Authorize your Pro Addon. Otherwise you can purchase it using the button below.', 'nextend-facebook-connect'); ?></p>
11
+ <p>
12
+ <a href="<?php echo NextendSocialLoginAdmin::trackUrl('https://nextendweb.com/social-login/', 'buy-pro-addon-button'); ?>"
13
+ target="_blank"
14
+ class="button button-primary"><?php _e('Buy Pro Addon', 'nextend-facebook-connect'); ?></a>
15
+ <a href="<?php echo NextendSocialLoginAdmin::getAdminUrl('pro-addon'); ?>"
16
+ class="button button-secondary"><?php _e('Authorize Pro Addon', 'nextend-facebook-connect'); ?></a>
17
+ </p>
18
+ </div>
19
+ <?php
20
+ }
21
+
22
+ function nsl_get_pro_installed() {
23
+ ?>
24
+ <div class="nsl-box nsl-box-blue">
25
+ <h2 class="title"><?php _e('Pro Addon is not activated', 'nextend-facebook-connect'); ?></h2>
26
+ <p><?php _e('To be able to use the Pro features, you need to install and activate the Nextend Social Connect Pro Addon.', 'nextend-facebook-connect'); ?></p>
27
+ <p>
28
+ <a href="<?php echo wp_nonce_url(add_query_arg(array(
29
+ 'action' => 'activate',
30
+ 'plugin' => urlencode('nextend-social-login-pro/nextend-social-login-pro.php'),
31
+ 'plugin_status' => 'all'
32
+ ), admin_url('plugins.php')), 'activate-plugin_' . 'nextend-social-login-pro/nextend-social-login-pro.php'); ?>"
33
+ target="_blank" onclick="setTimeout(function(){window.location.reload(true)}, 2000)"
34
+ class="button button-primary"><?php _e('Activate Pro Addon', 'nextend-facebook-connect'); ?></a>
35
+ </p>
36
+ </div>
37
+ <?php
38
+ }
39
+
40
+ function nsl_get_pro_not_installed() {
41
+ ?>
42
+ <div class="nsl-box nsl-box-blue">
43
+ <h2 class="title"><?php _e('Pro Addon is not installed', 'nextend-facebook-connect'); ?></h2>
44
+ <p><?php _e('To be able to use the Pro features, you need to install and activate the Nextend Social Connect Pro Addon.', 'nextend-facebook-connect'); ?></p>
45
+ <p>
46
+ <a href="<?php echo NextendSocialLoginAdmin::getAdminUrl('pro-addon'); ?>"
47
+ class="button button-primary"><?php _e('Install Pro Addon', 'nextend-facebook-connect'); ?></a>
48
+ </p>
49
+ </div>
50
+ <?php
51
+ }
52
+
53
+ switch ($state) {
54
+ case 'no-capability':
55
+ break;
56
+ case 'not-installed':
57
+ nsl_get_pro_not_installed();
58
+ break;
59
+ case 'installed':
60
+ nsl_get_pro_installed();
61
+ break;
62
+ default:
63
+ nsl_get_pro_no_license();
64
+ break;
65
+ }
admin/templates/provider.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+ /** @var $currentProvider string */
3
+
4
+ $provider = NextendSocialLogin::$providers[$currentProvider];
5
+
6
+ $provider->adminSettingsForm();
admin/templates/providers.php ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ wp_enqueue_script('jquery-ui-sortable');
3
+ ?>
4
+
5
+ <div class="nsl-dashboard-providers-container">
6
+ <div class="nsl-dashboard-providers">
7
+ <?php foreach (NextendSocialLogin::$providers AS $provider): ?>
8
+ <?php
9
+ $state = $provider->getState();
10
+ ?>
11
+
12
+ <div class="nsl-dashboard-provider" data-provider="<?php echo $provider->getId(); ?>"
13
+ data-state="<?php echo $state; ?>">
14
+ <div class="nsl-dashboard-provider-top" style="background-color: <?php echo $provider->getColor(); ?>;">
15
+ <img src="<?php echo $provider->getIcon(); ?>" width="60" height="60"
16
+ alt="<?php echo esc_attr($provider->getLabel()); ?>"/>
17
+ <h2><?php echo $provider->getLabel(); ?></h2>
18
+ </div>
19
+ <div class="nsl-dashboard-provider-bottom">
20
+ <div class="nsl-dashboard-provider-bottom-state">
21
+ <?php
22
+ switch ($state) {
23
+ case 'pro-only':
24
+ _e('Not Available', 'nextend-facebook-connect');
25
+ break;
26
+ case 'not-configured':
27
+ _e('Not Configured', 'nextend-facebook-connect');
28
+ break;
29
+ case 'not-tested':
30
+ _e('Not Tested', 'nextend-facebook-connect');
31
+ break;
32
+ case 'disabled':
33
+ _e('Disabled', 'nextend-facebook-connect');
34
+ break;
35
+ case 'enabled':
36
+ _e('Enabled', 'nextend-facebook-connect');
37
+ break;
38
+ case 'legacy':
39
+ _e('Legacy', 'nextend-facebook-connect');
40
+ break;
41
+ }
42
+ ?>
43
+ </div>
44
+
45
+ <?php
46
+ switch ($state) {
47
+ case 'pro-only':
48
+ ?>
49
+ <a href="<?php echo NextendSocialLoginAdmin::trackUrl('https://nextendweb.com/social-login/', 'buy-pro-addon-button-' . $provider->getId()); ?>"
50
+ class="button button-secondary" target="_blank">
51
+ <?php _e('Upgrade Now', 'nextend-facebook-connect'); ?>
52
+ </a>
53
+ <?php
54
+ break;
55
+ case 'not-configured':
56
+ ?>
57
+ <a href="<?php echo $provider->getAdminUrl(); ?>" class="button button-secondary">
58
+ <?php _e('Getting Started', 'nextend-facebook-connect'); ?>
59
+ </a>
60
+ <?php
61
+ break;
62
+ case 'not-tested':
63
+ ?>
64
+ <a href="<?php echo $provider->getAdminUrl('settings'); ?>"
65
+ class="button button-secondary">
66
+ <?php _e('Test to Enable', 'nextend-facebook-connect'); ?>
67
+ </a>
68
+ <?php
69
+ break;
70
+ case 'disabled':
71
+ ?>
72
+ <a href="<?php echo wp_nonce_url(add_query_arg('provider', $provider->getId(), NextendSocialLoginAdmin::getAdminUrl('enable')), 'nextend-social-login_enable_' . $provider->getId()); ?>"
73
+ class="button button-primary">
74
+ <?php _e('Enable', 'nextend-facebook-connect'); ?>
75
+ </a>
76
+ <a href="<?php echo $provider->getAdminUrl('settings'); ?>"
77
+ class="button button-secondary">
78
+ <?php _e('Settings', 'nextend-facebook-connect'); ?>
79
+ </a>
80
+ <?php
81
+ break;
82
+ case 'enabled':
83
+ ?>
84
+ <a href="<?php echo wp_nonce_url(add_query_arg('provider', $provider->getId(), NextendSocialLoginAdmin::getAdminUrl('disable')), 'nextend-social-login_disable_' . $provider->getId()); ?>"
85
+ class="button button-secondary">
86
+ <?php _e('Disable', 'nextend-facebook-connect'); ?>
87
+ </a>
88
+ <a href="<?php echo $provider->getAdminUrl('settings'); ?>"
89
+ class="button button-secondary">
90
+ <?php _e('Settings', 'nextend-facebook-connect'); ?>
91
+ </a>
92
+ <?php
93
+ break;
94
+ case 'legacy':
95
+ ?>
96
+ <a href="<?php echo $provider->getAdminUrl('import'); ?>" class="button button-primary">
97
+ <?php _e('Import', 'nextend-facebook-connect'); ?>
98
+ </a>
99
+ <?php
100
+ break;
101
+ }
102
+ ?>
103
+ </div>
104
+
105
+ <div class="nsl-dashboard-provider-sortable-handle"></div>
106
+ </div>
107
+ <?php endforeach; ?>
108
+ </div>
109
+ <div class="nsl-clear"></div>
110
+ </div>
111
+
112
+ <script>
113
+ (function ($) {
114
+ $(document).ready(function () {
115
+ var _ajax_nonce = '<?php echo wp_create_nonce("nextend-social-login"); ?>',
116
+ savingMessage = <?php echo wp_json_encode(__('Saving...', 'nextend-facebook-connect')); ?>,
117
+ errorMessage = <?php echo wp_json_encode(__('Saving failed', 'nextend-facebook-connect')); ?>,
118
+ successMessage = <?php echo wp_json_encode(__('Order Saved', 'nextend-facebook-connect')); ?>;
119
+ $('.nsl-dashboard-providers').sortable({
120
+ handle: '.nsl-dashboard-provider-sortable-handle',
121
+ tolerance: 'pointer',
122
+ stop: function (event, ui) {
123
+ var $providers = $('.nsl-dashboard-providers > div'),
124
+ providerList = [];
125
+ for (var i = 0; i < $providers.length; i++) {
126
+ providerList.push($providers.eq(i).data('provider'));
127
+ }
128
+
129
+ ui.item.find('.nsl-provider-notice').remove();
130
+
131
+ var $notice = $('<div class="nsl-provider-notice">' + savingMessage + '</div>')
132
+ .appendTo(ui.item);
133
+
134
+ $.ajax({
135
+ type: 'post',
136
+ dataType: 'json',
137
+ url: ajaxurl,
138
+ data: {
139
+ '_ajax_nonce': _ajax_nonce,
140
+ 'action': 'nextend-social-login',
141
+ 'view': 'orderProviders',
142
+ 'ordering': providerList
143
+ },
144
+ success: function () {
145
+ $notice.html(successMessage);
146
+ setTimeout(function () {
147
+ $notice.fadeOut(300, function () {
148
+ $notice.remove();
149
+ });
150
+ }, 2000);
151
+ },
152
+ error: function () {
153
+ $notice.html(errorMessage);
154
+ setTimeout(function () {
155
+ $notice.fadeOut(300, function () {
156
+ $notice.remove();
157
+ });
158
+ }, 3000);
159
+ }
160
+ });
161
+ }
162
+ });
163
+ });
164
+ })(jQuery);
165
+ </script>
admin/upgrader.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class NextendSocialUpgrader {
4
+
5
+ public static function init() {
6
+
7
+ add_filter('plugins_api', 'NextendSocialUpgrader::plugins_api', 10, 3);
8
+
9
+ add_filter('upgrader_pre_download', 'NextendSocialUpgrader::upgrader_pre_download', 10, 3);
10
+
11
+ add_filter('pre_set_site_transient_update_plugins', 'NextendSocialUpgrader::injectUpdate');
12
+
13
+ }
14
+
15
+ public static function plugins_api($res, $action, $args) {
16
+ if ($action === 'plugin_information' && $args->slug === 'nextend-social-login-pro') {
17
+ try {
18
+ $res = (object)NextendSocialLoginAdmin::apiCall($action, (array)$args);
19
+ } catch (Exception $e) {
20
+ $res = new WP_Error('error', $e->getMessage());
21
+ }
22
+ }
23
+
24
+ return $res;
25
+ }
26
+
27
+ public static function upgrader_pre_download($reply, $package, $upgrader) {
28
+ $needle = NextendSocialLoginAdmin::getEndpoint();
29
+ if (substr($package, 0, strlen($needle)) == $needle) {
30
+ add_filter('http_response', 'NextendSocialUpgrader::http_response', 10, 3);
31
+ }
32
+
33
+ return $reply;
34
+ }
35
+
36
+ public static function http_response($response, $r, $url) {
37
+
38
+ $needle = NextendSocialLoginAdmin::getEndpoint();
39
+ if (substr($url, 0, strlen($needle)) == $needle && 200 != wp_remote_retrieve_response_code($response) || is_wp_error($response)) {
40
+
41
+ if (isset($response['filename']) && file_exists($response['filename'])) {
42
+
43
+ $body = @json_decode(@file_get_contents($response['filename']), true);
44
+
45
+ if (is_array($body) && isset($body['message'])) {
46
+ $message = 'Nextend Social Login Pro Addon: ' . $body['message'];
47
+
48
+ NextendSocialLoginAdminNotices::addError($message);
49
+
50
+ return new WP_Error('error', $message);
51
+ }
52
+ }
53
+ }
54
+
55
+ return $response;
56
+ }
57
+
58
+ public static function injectUpdate($transient) {
59
+
60
+ if (!class_exists('NextendSocialLoginPRO', false)) {
61
+ return $transient;
62
+ }
63
+
64
+ $filename = "nextend-social-login-pro/nextend-social-login-pro.php";
65
+
66
+ if (!isset($transient->response[$filename])) {
67
+ try {
68
+ $item = (object)NextendSocialLoginAdmin::apiCall('plugin_information', array('slug' => 'nextend-social-login-pro'));
69
+ } catch (Exception $e) {
70
+ $item = new WP_Error('error', $e->getMessage());
71
+ }
72
+
73
+ if (!is_wp_error($item)) {
74
+ if (version_compare(NextendSocialLoginPRO::$version, $item->new_version, '<')) {
75
+ $transient->response[$filename] = (object)$item;
76
+ unset($transient->no_update[$filename]);
77
+ } else {
78
+ $transient->no_update[$filename] = (object)$item;
79
+ unset($transient->response[$filename]);
80
+ }
81
+
82
+ }
83
+ }
84
+
85
+ return $transient;
86
+ }
87
+ }
buttons/facebook-btn.css DELETED
@@ -1,397 +0,0 @@
1
- @import url(//fonts.googleapis.com/css?family=Open+Sans:600);
2
-
3
- .new-fb-btn{
4
- margin: 5px auto;
5
- display: inline-block;
6
- }
7
-
8
- .new-fb-btn,
9
- .new-fb-btn div{
10
- font-size:14px;
11
- font-weight:600;
12
- font-family:'Open Sans',sans-serif;
13
- color:#fff;
14
- text-shadow:0 0 1px RGBA(0,0,0,1);
15
- white-space:nowrap;
16
- vertical-align:middle;
17
- }
18
-
19
- /*
20
- 1 --------------
21
- */
22
- .new-fb-1,
23
- .new-fb-1 div{
24
- height: 42px;
25
- line-height: 42px;
26
- background: url('facebook-btn.png') no-repeat 0 0;
27
- }
28
-
29
- div.new-fb-1{
30
- padding: 0 0 0 20px;
31
- }
32
-
33
- div.new-fb-1-1{
34
- padding: 0 43px 0 0;
35
- background-position: right -100px;
36
- }
37
-
38
- div.new-fb-1-1-1{
39
- background-repeat: repeat-x;
40
- background-position: 0 -50px;
41
- padding: 0 20px 0 5px;
42
- }
43
-
44
- /*
45
- 2 --------------
46
- */
47
- .new-fb-2,
48
- .new-fb-2 div{
49
- height: 42px;
50
- line-height: 42px;
51
- background: url('facebook-btn.png') no-repeat 0 0;
52
- }
53
-
54
- div.new-fb-2{
55
- padding: 0 0 0 45px;
56
- background-position: 0 -150px;
57
- }
58
-
59
- div.new-fb-2-1{
60
- padding: 0 20px 0 0;
61
- background-position: right -250px;
62
- }
63
-
64
- div.new-fb-2-1-1{
65
- background-repeat: repeat-x;
66
- background-position: 0 -200px;
67
- padding: 0 0 0 10px;
68
- font-size: 12px;
69
- }
70
-
71
- /*
72
- 3 --------------
73
- */
74
- .new-fb-3,
75
- .new-fb-3 div{
76
- height: 37px;
77
- line-height: 37px;
78
- background: url('facebook-btn.png') no-repeat 0 0;
79
- }
80
-
81
- div.new-fb-3{
82
- padding: 0 0 0 35px;
83
- background-position: 0 -300px;
84
- }
85
-
86
- div.new-fb-3-1{
87
- padding: 0 18px 0 0;
88
- background-position: right -400px;
89
- }
90
-
91
- div.new-fb-3-1-1{
92
- background-repeat: repeat-x;
93
- background-position: 0 -350px;
94
- padding: 0 0 0 8px;
95
- font-size: 12px;
96
- }
97
-
98
- /*
99
- 4 --------------
100
- */
101
- .new-fb-4,
102
- .new-fb-4 div{
103
- height: 35px;
104
- line-height: 32px;
105
- background: url('facebook-btn.png') no-repeat 0 0;
106
- }
107
-
108
- div.new-fb-4{
109
- padding: 0 0 0 4px;
110
- background-position: 0 -450px;
111
- }
112
-
113
- div.new-fb-4-1{
114
- padding: 0 33px 0 0;
115
- background-position: right -550px;
116
- }
117
-
118
- div.new-fb-4-1-1{
119
- background-repeat: repeat-x;
120
- background-position: 0 -500px;
121
- padding: 0 19px 0 18px;
122
- font-size: 12px;
123
- }
124
-
125
- /*
126
- 5 --------------
127
- */
128
- .new-fb-5,
129
- .new-fb-5 div{
130
- height: 15px;
131
- line-height: 15px;
132
- background: url('facebook-btn.png') no-repeat 0 0;
133
- }
134
-
135
- div.new-fb-5{
136
- padding: 0 0 0 3px;
137
- background-position: 0 -600px;
138
- }
139
-
140
- div.new-fb-5-1{
141
- padding: 0 3px 0 0;
142
- background-position: right -640px;
143
- }
144
-
145
- div.new-fb-5-1-1{
146
- background-repeat: repeat-x;
147
- background-position: 0 -620px;
148
- padding: 0 1px;
149
- font-size: 10px;
150
- }
151
-
152
- /*
153
- 6 --------------
154
- */
155
- .new-fb-6,
156
- .new-fb-6 div{
157
- height: 29px;
158
- line-height: 26px;
159
- background: url('facebook-btn.png') no-repeat 0 0;
160
- }
161
-
162
- div.new-fb-6{
163
- padding: 0 0 0 4px;
164
- background-position: 0 -660px;
165
- }
166
-
167
- div.new-fb-6-1{
168
- padding: 0 27px 0 0;
169
- background-position: right -750px;
170
- }
171
-
172
- div.new-fb-6-1-1{
173
- background-repeat: repeat-x;
174
- background-position: 0 -700px;
175
- padding: 0 10px 0 8px;
176
- font-size: 12px;
177
- }
178
-
179
- /*
180
- 7 --------------
181
- */
182
- .new-fb-7,
183
- .new-fb-7 div{
184
- height: 29px;
185
- line-height: 26px;
186
- background: url('facebook-btn.png') no-repeat 0 0;
187
- }
188
-
189
- div.new-fb-7{
190
- padding: 0 0 0 29px;
191
- background-position: 0 -800px;
192
- }
193
-
194
- div.new-fb-7-1{
195
- padding: 0 4px 0 0;
196
- background-position: right -900px;
197
- }
198
-
199
- div.new-fb-7-1-1{
200
- background-repeat: repeat-x;
201
- background-position: 0 -850px;
202
- padding: 0 10px 0 10px;
203
- font-size: 11px;
204
- }
205
-
206
- /*
207
- 8 --------------
208
- */
209
- .new-fb-8,
210
- .new-fb-8 div{
211
- height: 25px;
212
- width: 30px;
213
- background: url('facebook-btn.png') no-repeat 0 0;
214
- }
215
-
216
- div.new-fb-8{
217
- background-position: 0 -950px;
218
- }
219
-
220
- div.new-fb-8-1{
221
- background-position: 0 -1050px;
222
- transition: background-position 0.4s;
223
- -moz-transition: background-position 0.4s; /* Firefox 4 */
224
- -webkit-transition: background-position 0.4s; /* Safari and Chrome */
225
- -o-transition: background-position 0.4s; /* Opera */
226
- }
227
-
228
- div.new-fb-8:HOVER div.new-fb-8-1{
229
- background-position: 0 -1000px;
230
- }
231
-
232
- /*
233
- 9 --------------
234
- */
235
- .new-fb-9,
236
- .new-fb-9 div{
237
- height: 26px;
238
- width: 30px;
239
- background: url('facebook-btn.png') no-repeat 0 0;
240
- }
241
-
242
- div.new-fb-9{
243
- opacity: 0.79;
244
- background-position: 0 -1100px;
245
- transition: opacity 0.4s;
246
- -moz-transition: opacity 0.4s; /* Firefox 4 */
247
- -webkit-transition: opacity 0.4s; /* Safari and Chrome */
248
- -o-transition: opacity 0.4s; /* Opera */
249
- }
250
-
251
- div.new-fb-9:HOVER{
252
- opacity: 0.99
253
- }
254
-
255
- /*
256
- 10 --------------
257
- */
258
- .new-fb-10,
259
- .new-fb-10 div{
260
- background: url('facebook-btn.png') no-repeat 0 0;
261
- }
262
-
263
- div.new-fb-10{
264
- height: 36px;
265
- width: 37px;
266
- background-position: 0 -1150px;
267
- }
268
-
269
- div.new-fb-10-1{
270
- margin: 5px 5px 6px 5px;
271
- height: 26px;
272
- width: 26px;
273
- overflow: hidden;
274
- background-position: -5px -1255px;
275
- transition: background-position 0.4s;
276
- -moz-transition: background-position 0.4s; /* Firefox 4 */
277
- -webkit-transition: background-position 0.4s; /* Safari and Chrome */
278
- -o-transition: background-position 0.4s; /* Opera */
279
- }
280
-
281
- div.new-fb-10:HOVER div.new-fb-10-1{
282
- background-position: -5px -1205px;
283
- }
284
-
285
- /*
286
- 11 --------------
287
- */
288
- .new-fb-11,
289
- .new-fb-11 div{
290
- height: 36px;
291
- width: 36px;
292
- background: url('facebook-btn.png') no-repeat 0 0;
293
- }
294
-
295
- div.new-fb-11{
296
- opacity: 0.79;
297
- background-position: 0 -1300px;
298
- transition: opacity 0.4s;
299
- -moz-transition: opacity 0.4s; /* Firefox 4 */
300
- -webkit-transition: opacity 0.4s; /* Safari and Chrome */
301
- -o-transition: opacity 0.4s; /* Opera */
302
- }
303
-
304
- div.new-fb-11:HOVER{
305
- opacity: 0.99
306
- }
307
-
308
- /*
309
- 12 --------------
310
- */
311
- .new-fb-12,
312
- .new-fb-12 div{
313
- height: 28px;
314
- width: 29px;
315
- background: url('facebook-btn.png') no-repeat 0 0;
316
- }
317
-
318
- div.new-fb-12{
319
- background-position: 0 -1350px;
320
- opacity: 0.79;
321
- transition: opacity 0.4s;
322
- -moz-transition: opacity 0.4s; /* Firefox 4 */
323
- -webkit-transition: opacity 0.4s; /* Safari and Chrome */
324
- -o-transition: opacity 0.4s; /* Opera */
325
- }
326
-
327
- div.new-fb-12:HOVER{
328
- opacity: 0.99
329
- }
330
-
331
- /*
332
- 13 --------------
333
- */
334
- .new-fb-13,
335
- .new-fb-13 div{
336
- height: 25px;
337
- width: 30px;
338
- background: url('facebook-btn.png') no-repeat 0 0;
339
- }
340
-
341
- div.new-fb-13{
342
- background-position: 0 -1400px;
343
- }
344
-
345
- div.new-fb-13-1{
346
- background-position: 0 -1050px;
347
- transition: background-position 0.4s;
348
- -moz-transition: background-position 0.4s; /* Firefox 4 */
349
- -webkit-transition: background-position 0.4s; /* Safari and Chrome */
350
- -o-transition: background-position 0.4s; /* Opera */
351
- }
352
-
353
- div.new-fb-13:HOVER div.new-fb-13-1{
354
- background-position: 0 -1000px;
355
- }
356
-
357
- /*
358
- 14 --------------
359
- */
360
- .new-fb-14,
361
- .new-fb-14 div{
362
- height: 23px;
363
- width: 23px;
364
- background: url('facebook-btn.png') no-repeat 0 0;
365
- }
366
-
367
- div.new-fb-14{
368
- background-position: 0 -1450px;
369
- }
370
-
371
- div.new-fb-14-1{
372
- background-position: 0 -1550px;
373
- transition: background-position 0.4s;
374
- -moz-transition: background-position 0.4s; /* Firefox 4 */
375
- -webkit-transition: background-position 0.4s; /* Safari and Chrome */
376
- -o-transition: background-position 0.4s; /* Opera */
377
- }
378
-
379
- div.new-fb-14:HOVER div.new-fb-14-1{
380
- background-position: 0 -1500px;
381
- }
382
-
383
- /*
384
- Main animations
385
- */
386
-
387
- .new-fb-default-anim{
388
- opacity: 0.85;
389
- transition: opacity 0.4s;
390
- -moz-transition: opacity 0.4s; /* Firefox 4 */
391
- -webkit-transition: opacity 0.4s; /* Safari and Chrome */
392
- -o-transition: opacity 0.4s; /* Opera */
393
- }
394
-
395
- .new-fb-default-anim:HOVER{
396
- opacity: 0.999;
397
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
class-settings.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class NextendSocialLoginSettings {
4
+
5
+ protected $optionKey;
6
+
7
+ protected $settings = array(
8
+ 'default' => array(),
9
+ 'stored' => array(),
10
+ 'final' => array()
11
+ );
12
+
13
+ /**
14
+ * NextendSocialLoginSettings constructor.
15
+ *
16
+ * @param $optionKey string
17
+ * @param $defaultSettings array
18
+ */
19
+ public function __construct($optionKey, $defaultSettings) {
20
+ $this->optionKey = $optionKey;
21
+
22
+ $this->settings['default'] = $defaultSettings;
23
+
24
+
25
+ $storedSettings = get_option($this->optionKey);
26
+ if ($storedSettings !== false) {
27
+ $storedSettings = (array)maybe_unserialize($storedSettings);
28
+ } else {
29
+ $storedSettings = array();
30
+ }
31
+
32
+ $this->settings['stored'] = array_merge($this->settings['default'], $storedSettings);
33
+
34
+ $this->settings['final'] = apply_filters('nsl_finalize_settings_' . $optionKey, $this->settings['stored']);
35
+ }
36
+
37
+ public function get($key, $storage = 'final') {
38
+ return $this->settings[$storage][$key];
39
+ }
40
+
41
+ public function getAll($storage = 'final') {
42
+ return $this->settings[$storage];
43
+ }
44
+
45
+
46
+ public function update($postedData) {
47
+ if (is_array($postedData)) {
48
+ $newData = array();
49
+ $newData = apply_filters('nsl_update_settings_validate_' . $this->optionKey, $newData, $postedData);
50
+
51
+ if (count($newData)) {
52
+
53
+ $isChanged = false;
54
+ foreach ($newData AS $key => $value) {
55
+ if ($this->settings['stored'][$key] != $value) {
56
+ $this->settings['stored'][$key] = $value;
57
+ $isChanged = true;
58
+ }
59
+ }
60
+
61
+ if ($isChanged) {
62
+ $allowedKeys = array_keys($this->settings['default']);
63
+ $this->settings['stored'] = array_intersect_key($this->settings['stored'], array_flip($allowedKeys));
64
+
65
+ $this->storeSettings();
66
+ }
67
+ }
68
+ }
69
+ }
70
+
71
+ protected function storeSettings() {
72
+ update_option($this->optionKey, maybe_serialize($this->settings['stored']));
73
+
74
+ $this->settings['final'] = apply_filters('nsl_finalize_settings_' . $this->optionKey, $this->settings['stored']);
75
+ }
76
+ }
compat.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!function_exists('is_nextend_facebook_login')) {
4
+ /**
5
+ * Returns true if Nextend Facebook Connect plugin is activated
6
+ * Used by Flatsome theme
7
+ *
8
+ * @deprecated
9
+ * @return bool
10
+ */
11
+ function is_nextend_facebook_login() {
12
+ if (class_exists('NextendSocialLogin', false)) {
13
+ return NextendSocialLogin::isProviderEnabled('facebook');
14
+ }
15
+
16
+ return defined('NEW_FB_LOGIN');
17
+ }
18
+ }
19
+
20
+ if (!function_exists('is_nextend_google_login')) {
21
+ /**
22
+ * Returns true if Nextend Google Connect plugin is activated
23
+ * Used by Flatsome theme
24
+ *
25
+ * @deprecated
26
+ * @return bool
27
+ */
28
+ function is_nextend_google_login() {
29
+ if (class_exists('NextendSocialLogin', false)) {
30
+ return NextendSocialLogin::isProviderEnabled('google');
31
+ }
32
+
33
+ return defined('NEW_GOOGLE_LOGIN');
34
+ }
35
+ }
includes/auth.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ abstract class NextendSocialAuth {
4
+
5
+ protected $providerID;
6
+
7
+ protected $access_token_data;
8
+
9
+ public function __construct($providerID) {
10
+ $this->providerID = $providerID;
11
+ }
12
+
13
+ public function checkError() {
14
+
15
+ }
16
+
17
+ /**
18
+ * @param string $access_token_data
19
+ */
20
+ public function setAccessTokenData($access_token_data) {
21
+ $this->access_token_data = json_decode($access_token_data, true);
22
+ }
23
+
24
+ public abstract function createAuthUrl();
25
+
26
+ public abstract function authenticate();
27
+
28
+ public abstract function get($path, $data = array());
29
+
30
+ /**
31
+ * @return bool
32
+ */
33
+ public abstract function hasAuthenticateData();
34
+ }
includes/curl/ArrayUtil.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class NSLArrayUtil {
4
+
5
+ /**
6
+ * Is Array Assoc
7
+ *
8
+ * @access public
9
+ *
10
+ * @param $array
11
+ *
12
+ * @return boolean
13
+ */
14
+ public static function is_array_assoc($array) {
15
+ return (bool)count(array_filter(array_keys($array), 'is_string'));
16
+ }
17
+
18
+ /**
19
+ * Is Array Multidim
20
+ *
21
+ * @access public
22
+ *
23
+ * @param $array
24
+ *
25
+ * @return boolean
26
+ */
27
+ public static function is_array_multidim($array) {
28
+ if (!is_array($array)) {
29
+ return false;
30
+ }
31
+
32
+ return (bool)count(array_filter($array, 'is_array'));
33
+ }
34
+
35
+ /**
36
+ * Array Flatten Multidim
37
+ *
38
+ * @access public
39
+ *
40
+ * @param $array
41
+ * @param $prefix
42
+ *
43
+ * @return array
44
+ */
45
+ public static function array_flatten_multidim($array, $prefix = false) {
46
+ $return = array();
47
+ if (is_array($array) || is_object($array)) {
48
+ if (empty($array)) {
49
+ $return[$prefix] = '';
50
+ } else {
51
+ foreach ($array as $key => $value) {
52
+ if (is_scalar($value)) {
53
+ if ($prefix) {
54
+ $return[$prefix . '[' . $key . ']'] = $value;
55
+ } else {
56
+ $return[$key] = $value;
57
+ }
58
+ } else {
59
+ if ($value instanceof \CURLFile) {
60
+ $return[$key] = $value;
61
+ } else {
62
+ $return = array_merge($return, self::array_flatten_multidim($value, $prefix ? $prefix . '[' . $key . ']' : $key));
63
+ }
64
+ }
65
+ }
66
+ }
67
+ } elseif ($array === null) {
68
+ $return[$prefix] = $array;
69
+ }
70
+
71
+ return $return;
72
+ }
73
+ }
includes/curl/CaseInsensitiveArray.php ADDED
@@ -0,0 +1,218 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class NSLCaseInsensitiveArray implements \ArrayAccess, \Countable, \Iterator {
4
+
5
+ /**
6
+ * @var mixed[] Data storage with lower-case keys
7
+ * @see offsetSet()
8
+ * @see offsetExists()
9
+ * @see offsetUnset()
10
+ * @see offsetGet()
11
+ * @see count()
12
+ * @see current()
13
+ * @see next()
14
+ * @see key()
15
+ */
16
+ private $data = array();
17
+
18
+ /**
19
+ * @var string[] Case-Sensitive keys.
20
+ * @see offsetSet()
21
+ * @see offsetUnset()
22
+ * @see key()
23
+ */
24
+ private $keys = array();
25
+
26
+ /**
27
+ * Construct
28
+ *
29
+ * Allow creating either an empty Array, or convert an existing Array to a
30
+ * Case-Insensitive Array. (Caution: Data may be lost when converting Case-
31
+ * Sensitive Arrays to Case-Insensitive Arrays)
32
+ *
33
+ * @param mixed[] $initial (optional) Existing Array to convert.
34
+ *
35
+ * @access public
36
+ */
37
+ public function __construct(array $initial = null) {
38
+ if ($initial !== null) {
39
+ foreach ($initial as $key => $value) {
40
+ $this->offsetSet($key, $value);
41
+ }
42
+ }
43
+ }
44
+
45
+ /**
46
+ * Offset Set
47
+ *
48
+ * Set data at a specified Offset. Converts the offset to lower-case, and
49
+ * stores the Case-Sensitive Offset and the Data at the lower-case indexes
50
+ * in $this->keys and @this->data.
51
+ *
52
+ * @see https://secure.php.net/manual/en/arrayaccess.offseteset.php
53
+ *
54
+ * @param string $offset The offset to store the data at (case-insensitive).
55
+ * @param mixed $value The data to store at the specified offset.
56
+ *
57
+ * @return void
58
+ *
59
+ * @access public
60
+ */
61
+ public function offsetSet($offset, $value) {
62
+ if ($offset === null) {
63
+ $this->data[] = $value;
64
+ } else {
65
+ $offsetlower = strtolower($offset);
66
+ $this->data[$offsetlower] = $value;
67
+ $this->keys[$offsetlower] = $offset;
68
+ }
69
+ }
70
+
71
+ /**
72
+ * Offset Exists
73
+ *
74
+ * Checks if the Offset exists in data storage. The index is looked up with
75
+ * the lower-case version of the provided offset.
76
+ *
77
+ * @see https://secure.php.net/manual/en/arrayaccess.offsetexists.php
78
+ *
79
+ * @param string $offset Offset to check
80
+ *
81
+ * @return bool If the offset exists.
82
+ *
83
+ * @access public
84
+ */
85
+ public function offsetExists($offset) {
86
+ return (bool)array_key_exists(strtolower($offset), $this->data);
87
+ }
88
+
89
+ /**
90
+ * Offset Unset
91
+ *
92
+ * Unsets the specified offset. Converts the provided offset to lowercase,
93
+ * and unsets the Case-Sensitive Key, as well as the stored data.
94
+ *
95
+ * @see https://secure.php.net/manual/en/arrayaccess.offsetunset.php
96
+ *
97
+ * @param string $offset The offset to unset.
98
+ *
99
+ * @return void
100
+ *
101
+ * @access public
102
+ */
103
+ public function offsetUnset($offset) {
104
+ $offsetlower = strtolower($offset);
105
+ unset($this->data[$offsetlower]);
106
+ unset($this->keys[$offsetlower]);
107
+ }
108
+
109
+ /**
110
+ * Offset Get
111
+ *
112
+ * Return the stored data at the provided offset. The offset is converted to
113
+ * lowercase and the lookup is done on the Data store directly.
114
+ *
115
+ * @see https://secure.php.net/manual/en/arrayaccess.offsetget.php
116
+ *
117
+ * @param string $offset Offset to lookup.
118
+ *
119
+ * @return mixed The data stored at the offset.
120
+ *
121
+ * @access public
122
+ */
123
+ public function offsetGet($offset) {
124
+ $offsetlower = strtolower($offset);
125
+
126
+ return isset($this->data[$offsetlower]) ? $this->data[$offsetlower] : null;
127
+ }
128
+
129
+ /**
130
+ * Count
131
+ *
132
+ * @see https://secure.php.net/manual/en/countable.count.php
133
+ *
134
+ * @param void
135
+ *
136
+ * @return int The number of elements stored in the Array.
137
+ *
138
+ * @access public
139
+ */
140
+ public function count() {
141
+ return (int)count($this->data);
142
+ }
143
+
144
+ /**
145
+ * Current
146
+ *
147
+ * @see https://secure.php.net/manual/en/iterator.current.php
148
+ *
149
+ * @param void
150
+ *
151
+ * @return mixed Data at the current position.
152
+ *
153
+ * @access public
154
+ */
155
+ public function current() {
156
+ return current($this->data);
157
+ }
158
+
159
+ /**
160
+ * Next
161
+ *
162
+ * @see https://secure.php.net/manual/en/iterator.next.php
163
+ *
164
+ * @param void
165
+ *
166
+ * @return void
167
+ *
168
+ * @access public
169
+ */
170
+ public function next() {
171
+ next($this->data);
172
+ }
173
+
174
+ /**
175
+ * Key
176
+ *
177
+ * @see https://secure.php.net/manual/en/iterator.key.php
178
+ *
179
+ * @param void
180
+ *
181
+ * @return mixed Case-Sensitive key at current position.
182
+ *
183
+ * @access public
184
+ */
185
+ public function key() {
186
+ $key = key($this->data);
187
+
188
+ return isset($this->keys[$key]) ? $this->keys[$key] : $key;
189
+ }
190
+
191
+ /**
192
+ * Valid
193
+ *
194
+ * @see https://secure.php.net/manual/en/iterator.valid.php
195
+ *
196
+ * @return bool If the current position is valid.
197
+ *
198
+ * @access public
199
+ */
200
+ public function valid() {
201
+ return (bool)!(key($this->data) === null);
202
+ }
203
+
204
+ /**
205
+ * Rewind
206
+ *
207
+ * @see https://secure.php.net/manual/en/iterator.rewind.php
208
+ *
209
+ * @param void
210
+ *
211
+ * @return void
212
+ *
213
+ * @access public
214
+ */
215
+ public function rewind() {
216
+ reset($this->data);
217
+ }
218
+ }
includes/curl/Curl.php ADDED
@@ -0,0 +1,1648 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once dirname(__FILE__) . '/CaseInsensitiveArray.php';
4
+ require_once dirname(__FILE__) . '/ArrayUtil.php';
5
+ require_once dirname(__FILE__) . '/Decoder.php';
6
+ require_once dirname(__FILE__) . '/Url.php';
7
+
8
+ class NSLCurl {
9
+
10
+ const VERSION = '8.0.0';
11
+ const DEFAULT_TIMEOUT = 30;
12
+
13
+ public $curl;
14
+ public $id = null;
15
+
16
+ public $error = false;
17
+ public $errorCode = 0;
18
+ public $errorMessage = null;
19
+
20
+ public $curlError = false;
21
+ public $curlErrorCode = 0;
22
+ public $curlErrorMessage = null;
23
+
24
+ public $httpError = false;
25
+ public $httpStatusCode = 0;
26
+ public $httpErrorMessage = null;
27
+
28
+ public $url = null;
29
+ public $requestHeaders = null;
30
+ public $responseHeaders = null;
31
+ public $rawResponseHeaders = '';
32
+ public $responseCookies = array();
33
+ public $response = null;
34
+ public $rawResponse = null;
35
+
36
+ public $beforeSendFunction = null;
37
+ public $downloadCompleteFunction = null;
38
+ public $successFunction = null;
39
+ public $errorFunction = null;
40
+ public $completeFunction = null;
41
+ public $fileHandle = null;
42
+
43
+ public $attempts = 0;
44
+ public $retries = 0;
45
+ public $isChildOfMultiCurl = false;
46
+ public $remainingRetries = 0;
47
+ public $retryDecider = null;
48
+
49
+ private $cookies = array();
50
+ private $headers = array();
51
+ private $options = array();
52
+
53
+ private $jsonDecoder = 'NSLDecoder::decodeJson';
54
+ private $jsonDecoderArgs = array(true);
55
+ private $jsonPattern = '/^(?:application|text)\/(?:[a-z]+(?:[\.-][0-9a-z]+){0,}[\+\.]|x-)?json(?:-[a-z]+)?/i';
56
+ private $xmlDecoder = 'NSLDecoder::decodeXml';
57
+ private $xmlPattern = '~^(?:text/|application/(?:atom\+|rss\+)?)xml~i';
58
+ private $defaultDecoder = null;
59
+
60
+ public static $RFC2616 = array(
61
+ // RFC 2616: "any CHAR except CTLs or separators".
62
+ // CHAR = <any US-ASCII character (octets 0 - 127)>
63
+ // CTL = <any US-ASCII control character
64
+ // (octets 0 - 31) and DEL (127)>
65
+ // separators = "(" | ")" | "<" | ">" | "@"
66
+ // | "," | ";" | ":" | "\" | <">
67
+ // | "/" | "[" | "]" | "?" | "="
68
+ // | "{" | "}" | SP | HT
69
+ // SP = <US-ASCII SP, space (32)>
70
+ // HT = <US-ASCII HT, horizontal-tab (9)>
71
+ // <"> = <US-ASCII double-quote mark (34)>
72
+ '!',
73
+ '#',
74
+ '$',
75
+ '%',
76
+ '&',
77
+ "'",
78
+ '*',
79
+ '+',
80
+ '-',
81
+ '.',
82
+ '0',
83
+ '1',
84
+ '2',
85
+ '3',
86
+ '4',
87
+ '5',
88
+ '6',
89
+ '7',
90
+ '8',
91
+ '9',
92
+ 'A',
93
+ 'B',
94
+ 'C',
95
+ 'D',
96
+ 'E',
97
+ 'F',
98
+ 'G',
99
+ 'H',
100
+ 'I',
101
+ 'J',
102
+ 'K',
103
+ 'L',
104
+ 'M',
105
+ 'N',
106
+ 'O',
107
+ 'P',
108
+ 'Q',
109
+ 'R',
110
+ 'S',
111
+ 'T',
112
+ 'U',
113
+ 'V',
114
+ 'W',
115
+ 'X',
116
+ 'Y',
117
+ 'Z',
118
+ '^',
119
+ '_',
120
+ '`',
121
+ 'a',
122
+ 'b',
123
+ 'c',
124
+ 'd',
125
+ 'e',
126
+ 'f',
127
+ 'g',
128
+ 'h',
129
+ 'i',
130
+ 'j',
131
+ 'k',
132
+ 'l',
133
+ 'm',
134
+ 'n',
135
+ 'o',
136
+ 'p',
137
+ 'q',
138
+ 'r',
139
+ 's',
140
+ 't',
141
+ 'u',
142
+ 'v',
143
+ 'w',
144
+ 'x',
145
+ 'y',
146
+ 'z',
147
+ '|',
148
+ '~',
149
+ );
150
+ public static $RFC6265 = array(
151
+ // RFC 6265: "US-ASCII characters excluding CTLs, whitespace DQUOTE, comma, semicolon, and backslash".
152
+ // %x21
153
+ '!',
154
+ // %x23-2B
155
+ '#',
156
+ '$',
157
+ '%',
158
+ '&',
159
+ "'",
160
+ '(',
161
+ ')',
162
+ '*',
163
+ '+',
164
+ // %x2D-3A
165
+ '-',
166
+ '.',
167
+ '/',
168
+ '0',
169
+ '1',
170
+ '2',
171
+ '3',
172
+ '4',
173
+ '5',
174
+ '6',
175
+ '7',
176
+ '8',
177
+ '9',
178
+ ':',
179
+ // %x3C-5B
180
+ '<',
181
+ '=',
182
+ '>',
183
+ '?',
184
+ '@',
185
+ 'A',
186
+ 'B',
187
+ 'C',
188
+ 'D',
189
+ 'E',
190
+ 'F',
191
+ 'G',
192
+ 'H',
193
+ 'I',
194
+ 'J',
195
+ 'K',
196
+ 'L',
197
+ 'M',
198
+ 'N',
199
+ 'O',
200
+ 'P',
201
+ 'Q',
202
+ 'R',
203
+ 'S',
204
+ 'T',
205
+ 'U',
206
+ 'V',
207
+ 'W',
208
+ 'X',
209
+ 'Y',
210
+ 'Z',
211
+ '[',
212
+ // %x5D-7E
213
+ ']',
214
+ '^',
215
+ '_',
216
+ '`',
217
+ 'a',
218
+ 'b',
219
+ 'c',
220
+ 'd',
221
+ 'e',
222
+ 'f',
223
+ 'g',
224
+ 'h',
225
+ 'i',
226
+ 'j',
227
+ 'k',
228
+ 'l',
229
+ 'm',
230
+ 'n',
231
+ 'o',
232
+ 'p',
233
+ 'q',
234
+ 'r',
235
+ 's',
236
+ 't',
237
+ 'u',
238
+ 'v',
239
+ 'w',
240
+ 'x',
241
+ 'y',
242
+ 'z',
243
+ '{',
244
+ '|',
245
+ '}',
246
+ '~',
247
+ );
248
+
249
+ private static $deferredProperties = array(
250
+ 'effectiveUrl',
251
+ 'rfc2616',
252
+ 'rfc6265',
253
+ 'totalTime',
254
+ );
255
+
256
+ /**
257
+ * Construct
258
+ *
259
+ * @access public
260
+ *
261
+ * @param $base_url
262
+ */
263
+ public function __construct($base_url = null) {
264
+
265
+ $this->curl = curl_init();
266
+ $this->id = uniqid('', true);
267
+ $this->setDefaultUserAgent();
268
+ $this->setDefaultTimeout();
269
+ $this->setOpt(CURLINFO_HEADER_OUT, true);
270
+
271
+ // Create a placeholder to temporarily store the header callback data.
272
+ $header_callback_data = new stdClass();
273
+ $header_callback_data->rawResponseHeaders = '';
274
+ $header_callback_data->responseCookies = array();
275
+ $this->headerCallbackData = $header_callback_data;
276
+ $this->setOpt(CURLOPT_HEADERFUNCTION, $this->createHeaderCallback($header_callback_data));
277
+
278
+ $this->setOpt(CURLOPT_RETURNTRANSFER, true);
279
+ $this->headers = new NSLCaseInsensitiveArray();
280
+ $this->setUrl($base_url);
281
+ }
282
+
283
+ /**
284
+ * Before Send
285
+ *
286
+ * @access public
287
+ *
288
+ * @param $callback
289
+ */
290
+ public function beforeSend($callback) {
291
+ $this->beforeSendFunction = $callback;
292
+ }
293
+
294
+ /**
295
+ * Build Post Data
296
+ *
297
+ * @access public
298
+ *
299
+ * @param $data
300
+ *
301
+ * @return array|string
302
+ */
303
+ public function buildPostData($data) {
304
+ $binary_data = false;
305
+ if (is_array($data)) {
306
+ // Return JSON-encoded string when the request's content-type is JSON.
307
+ if (isset($this->headers['Content-Type']) && preg_match($this->jsonPattern, $this->headers['Content-Type'])) {
308
+ $json_str = wp_json_encode($data);
309
+ if (!($json_str === false)) {
310
+ $data = $json_str;
311
+ }
312
+ } else {
313
+ // Manually build a single-dimensional array from a multi-dimensional array as using curl_setopt($ch,
314
+ // CURLOPT_POSTFIELDS, $data) doesn't correctly handle multi-dimensional arrays when files are
315
+ // referenced.
316
+ if (NSLArrayUtil::is_array_multidim($data)) {
317
+ $data = NSLArrayUtil::array_flatten_multidim($data);
318
+ }
319
+
320
+ // Modify array values to ensure any referenced files are properly handled depending on the support of
321
+ // the @filename API or CURLFile usage. This also fixes the warning "curl_setopt(): The usage of the
322
+ // @filename API for file uploading is deprecated. Please use the CURLFile class instead". Ignore
323
+ // non-file values prefixed with the @ character.
324
+ foreach ($data as $key => $value) {
325
+ if (is_string($value) && strpos($value, '@') === 0 && is_file(substr($value, 1))) {
326
+ $binary_data = true;
327
+ if (class_exists('CURLFile')) {
328
+ $data[$key] = new CURLFile(substr($value, 1));
329
+ }
330
+ } elseif ($value instanceof CURLFile) {
331
+ $binary_data = true;
332
+ }
333
+ }
334
+ }
335
+ }
336
+
337
+ if (!$binary_data && (is_array($data) || is_object($data))) {
338
+ $data = http_build_query($data, '', '&');
339
+ }
340
+
341
+ return $data;
342
+ }
343
+
344
+ /**
345
+ * Call
346
+ *
347
+ * @access public
348
+ */
349
+ public function call() {
350
+ $args = func_get_args();
351
+ $function = array_shift($args);
352
+ if (is_callable($function)) {
353
+ array_unshift($args, $this);
354
+ call_user_func_array($function, $args);
355
+ }
356
+ }
357
+
358
+ /**
359
+ * Close
360
+ *
361
+ * @access public
362
+ */
363
+ public function close() {
364
+ if (is_resource($this->curl)) {
365
+ curl_close($this->curl);
366
+ }
367
+ $this->options = null;
368
+ $this->jsonDecoder = null;
369
+ $this->jsonDecoderArgs = null;
370
+ $this->xmlDecoder = null;
371
+ $this->defaultDecoder = null;
372
+ }
373
+
374
+ /**
375
+ * Complete
376
+ *
377
+ * @access public
378
+ *
379
+ * @param $callback
380
+ */
381
+ public function complete($callback) {
382
+ $this->completeFunction = $callback;
383
+ }
384
+
385
+ /**
386
+ * Progress
387
+ *
388
+ * @access public
389
+ *
390
+ * @param $callback
391
+ */
392
+ public function progress($callback) {
393
+ $this->setOpt(CURLOPT_PROGRESSFUNCTION, $callback);
394
+ $this->setOpt(CURLOPT_NOPROGRESS, false);
395
+ }
396
+
397
+ /**
398
+ * Delete
399
+ *
400
+ * @access public
401
+ *
402
+ * @param $url
403
+ * @param $query_parameters
404
+ * @param $data
405
+ *
406
+ * @return mixed
407
+ */
408
+ public function delete($url, $query_parameters = array(), $data = array()) {
409
+ if (is_array($url)) {
410
+ $data = $query_parameters;
411
+ $query_parameters = $url;
412
+ $url = (string)$this->url;
413
+ }
414
+
415
+ $this->setUrl($url, $query_parameters);
416
+ $this->setOpt(CURLOPT_CUSTOMREQUEST, 'DELETE');
417
+ $this->setOpt(CURLOPT_POSTFIELDS, $this->buildPostData($data));
418
+
419
+ return $this->exec();
420
+ }
421
+
422
+ /**
423
+ * Download
424
+ *
425
+ * @access public
426
+ *
427
+ * @param $url
428
+ * @param $mixed_filename
429
+ *
430
+ * @return boolean
431
+ */
432
+ public function download($url, $mixed_filename) {
433
+ if (is_callable($mixed_filename)) {
434
+ $this->downloadCompleteFunction = $mixed_filename;
435
+ $this->fileHandle = tmpfile();
436
+ } else {
437
+ $filename = $mixed_filename;
438
+
439
+ // Use a temporary file when downloading. Not using a temporary file can cause an error when an existing
440
+ // file has already fully completed downloading and a new download is started with the same destination save
441
+ // path. The download request will include header "Range: bytes=$filesize-" which is syntactically valid,
442
+ // but unsatisfiable.
443
+ $download_filename = $filename . '.pccdownload';
444
+
445
+ $mode = 'wb';
446
+ // Attempt to resume download only when a temporary download file exists and is not empty.
447
+ if (file_exists($download_filename) && $filesize = filesize($download_filename)) {
448
+ $mode = 'ab';
449
+ $first_byte_position = $filesize;
450
+ $range = $first_byte_position . '-';
451
+ $this->setOpt(CURLOPT_RANGE, $range);
452
+ }
453
+ $this->fileHandle = fopen($download_filename, $mode);
454
+
455
+ // Move the downloaded temporary file to the destination save path.
456
+ $this->downloadCompleteFunction = function ($instance, $fh) use ($download_filename, $filename) {
457
+ // Close the open file handle before renaming the file.
458
+ if (is_resource($fh)) {
459
+ fclose($fh);
460
+ }
461
+
462
+ rename($download_filename, $filename);
463
+ };
464
+ }
465
+
466
+ $this->setOpt(CURLOPT_FILE, $this->fileHandle);
467
+ $this->get($url);
468
+
469
+ return !$this->error;
470
+ }
471
+
472
+ /**
473
+ * Error
474
+ *
475
+ * @access public
476
+ *
477
+ * @param $callback
478
+ */
479
+ public function error($callback) {
480
+ $this->errorFunction = $callback;
481
+ }
482
+
483
+ /**
484
+ * Exec
485
+ *
486
+ * @access public
487
+ *
488
+ * @param $ch
489
+ *
490
+ * @return mixed Returns the value provided by parseResponse.
491
+ */
492
+ public function exec($ch = null) {
493
+ $this->attempts += 1;
494
+
495
+ if ($ch === null) {
496
+ $this->responseCookies = array();
497
+ $this->call($this->beforeSendFunction);
498
+ $this->rawResponse = curl_exec($this->curl);
499
+ $this->curlErrorCode = curl_errno($this->curl);
500
+ $this->curlErrorMessage = curl_error($this->curl);
501
+ } else {
502
+ $this->rawResponse = curl_multi_getcontent($ch);
503
+ $this->curlErrorMessage = curl_error($ch);
504
+ }
505
+ $this->curlError = !($this->curlErrorCode === 0);
506
+
507
+ // Transfer the header callback data and release the temporary store to avoid memory leak.
508
+ $this->rawResponseHeaders = $this->headerCallbackData->rawResponseHeaders;
509
+ $this->responseCookies = $this->headerCallbackData->responseCookies;
510
+ $this->headerCallbackData->rawResponseHeaders = null;
511
+ $this->headerCallbackData->responseCookies = null;
512
+
513
+ // Include additional error code information in error message when possible.
514
+ if ($this->curlError && function_exists('curl_strerror')) {
515
+ $this->curlErrorMessage = curl_strerror($this->curlErrorCode) . (empty($this->curlErrorMessage) ? '' : ': ' . $this->curlErrorMessage);
516
+ }
517
+
518
+ $this->httpStatusCode = $this->getInfo(CURLINFO_HTTP_CODE);
519
+ $this->httpError = in_array(floor($this->httpStatusCode / 100), array(
520
+ 4,
521
+ 5
522
+ ));
523
+ $this->error = $this->curlError || $this->httpError;
524
+ $this->errorCode = $this->error ? ($this->curlError ? $this->curlErrorCode : $this->httpStatusCode) : 0;
525
+
526
+ // NOTE: CURLINFO_HEADER_OUT set to true is required for requestHeaders
527
+ // to not be empty (e.g. $curl->setOpt(CURLINFO_HEADER_OUT, true);).
528
+ if ($this->getOpt(CURLINFO_HEADER_OUT) === true) {
529
+ $this->requestHeaders = $this->parseRequestHeaders($this->getInfo(CURLINFO_HEADER_OUT));
530
+ }
531
+ $this->responseHeaders = $this->parseResponseHeaders($this->rawResponseHeaders);
532
+ $this->response = $this->parseResponse($this->responseHeaders, $this->rawResponse);
533
+
534
+ $this->httpErrorMessage = '';
535
+ if ($this->error) {
536
+ if (isset($this->responseHeaders['Status-Line'])) {
537
+ $this->httpErrorMessage = $this->responseHeaders['Status-Line'];
538
+ }
539
+ }
540
+ $this->errorMessage = $this->curlError ? $this->curlErrorMessage : $this->httpErrorMessage;
541
+
542
+ // Reset select deferred properties so that they may be recalculated.
543
+ unset($this->effectiveUrl);
544
+ unset($this->totalTime);
545
+
546
+ // Reset content-length possibly set from a PUT or SEARCH request.
547
+ $this->unsetHeader('Content-Length');
548
+
549
+ // Reset nobody setting possibly set from a HEAD request.
550
+ $this->setOpt(CURLOPT_NOBODY, false);
551
+
552
+ // Allow multicurl to attempt retry as needed.
553
+ if ($this->isChildOfMultiCurl) {
554
+ return;
555
+ }
556
+
557
+ if ($this->attemptRetry()) {
558
+ return $this->exec($ch);
559
+ }
560
+
561
+ $this->execDone();
562
+
563
+ return $this->response;
564
+ }
565
+
566
+ public function execDone() {
567
+ if ($this->error) {
568
+ $this->call($this->errorFunction);
569
+ } else {
570
+ $this->call($this->successFunction);
571
+ }
572
+
573
+ $this->call($this->completeFunction);
574
+
575
+ // Close open file handles and reset the curl instance.
576
+ if (!($this->fileHandle === null)) {
577
+ $this->downloadComplete($this->fileHandle);
578
+ }
579
+ }
580
+
581
+ /**
582
+ * Get
583
+ *
584
+ * @access public
585
+ *
586
+ * @param $url
587
+ * @param $data
588
+ *
589
+ * @return mixed Returns the value provided by exec.
590
+ */
591
+ public function get($url, $data = array()) {
592
+ if (is_array($url)) {
593
+ $data = $url;
594
+ $url = (string)$this->url;
595
+ }
596
+ $this->setUrl($url, $data);
597
+ $this->setOpt(CURLOPT_CUSTOMREQUEST, 'GET');
598
+ $this->setOpt(CURLOPT_HTTPGET, true);
599
+ $this->setOpt(CURLOPT_USERAGENT, 'WordPress');
600
+
601
+ return $this->exec();
602
+ }
603
+
604
+ /**
605
+ * Get Info
606
+ *
607
+ * @access public
608
+ *
609
+ * @param $opt
610
+ *
611
+ * @return mixed
612
+ */
613
+ public function getInfo($opt = null) {
614
+ $args = array();
615
+ $args[] = $this->curl;
616
+
617
+ if (func_num_args()) {
618
+ $args[] = $opt;
619
+ }
620
+
621
+ return call_user_func_array('curl_getinfo', $args);
622
+ }
623
+
624
+ /**
625
+ * Get Opt
626
+ *
627
+ * @access public
628
+ *
629
+ * @param $option
630
+ *
631
+ * @return mixed
632
+ */
633
+ public function getOpt($option) {
634
+ return isset($this->options[$option]) ? $this->options[$option] : null;
635
+ }
636
+
637
+ /**
638
+ * Head
639
+ *
640
+ * @access public
641
+ *
642
+ * @param $url
643
+ * @param $data
644
+ *
645
+ * @return mixed
646
+ */
647
+ public function head($url, $data = array()) {
648
+ if (is_array($url)) {
649
+ $data = $url;
650
+ $url = (string)$this->url;
651
+ }
652
+ $this->setUrl($url, $data);
653
+ $this->setOpt(CURLOPT_CUSTOMREQUEST, 'HEAD');
654
+ $this->setOpt(CURLOPT_NOBODY, true);
655
+
656
+ return $this->exec();
657
+ }
658
+
659
+ /**
660
+ * Options
661
+ *
662
+ * @access public
663
+ *
664
+ * @param $url
665
+ * @param $data
666
+ *
667
+ * @return mixed
668
+ */
669
+ public function options($url, $data = array()) {
670
+ if (is_array($url)) {
671
+ $data = $url;
672
+ $url = (string)$this->url;
673
+ }
674
+ $this->setUrl($url, $data);
675
+ $this->setOpt(CURLOPT_CUSTOMREQUEST, 'OPTIONS');
676
+
677
+ return $this->exec();
678
+ }
679
+
680
+ /**
681
+ * Patch
682
+ *
683
+ * @access public
684
+ *
685
+ * @param $url
686
+ * @param $data
687
+ *
688
+ * @return mixed
689
+ */
690
+ public function patch($url, $data = array()) {
691
+ if (is_array($url)) {
692
+ $data = $url;
693
+ $url = (string)$this->url;
694
+ }
695
+
696
+ if (is_array($data) && empty($data)) {
697
+ $this->removeHeader('Content-Length');
698
+ }
699
+
700
+ $this->setUrl($url);
701
+ $this->setOpt(CURLOPT_CUSTOMREQUEST, 'PATCH');
702
+ $this->setOpt(CURLOPT_POSTFIELDS, $this->buildPostData($data));
703
+
704
+ return $this->exec();
705
+ }
706
+
707
+ /**
708
+ * Post
709
+ *
710
+ * @access public
711
+ *
712
+ * @param $url
713
+ * @param $data
714
+ * @param $follow_303_with_post
715
+ * If true, will cause 303 redirections to be followed using a POST request (default: false).
716
+ * Notes:
717
+ * - Redirections are only followed if the CURLOPT_FOLLOWLOCATION option is set to true.
718
+ * - According to the HTTP specs (see [1]), a 303 redirection should be followed using
719
+ * the GET method. 301 and 302 must not.
720
+ * - In order to force a 303 redirection to be performed using the same method, the
721
+ * underlying cURL object must be set in a special state (the CURLOPT_CURSTOMREQUEST
722
+ * option must be set to the method to use after the redirection). Due to a limitation
723
+ * of the cURL extension of PHP < 5.5.11 ([2], [3]) and of HHVM, it is not possible
724
+ * to reset this option. Using these PHP engines, it is therefore impossible to
725
+ * restore this behavior on an existing php-curl-class Curl object.
726
+ *
727
+ * @return mixed
728
+ *
729
+ * [1] https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.2
730
+ * [2] https://github.com/php/php-src/pull/531
731
+ * [3] http://php.net/ChangeLog-5.php#5.5.11
732
+ */
733
+ public function post($url, $data = array(), $follow_303_with_post = false) {
734
+ if (is_array($url)) {
735
+ $follow_303_with_post = (bool)$data;
736
+ $data = $url;
737
+ $url = (string)$this->url;
738
+ }
739
+
740
+ $this->setUrl($url);
741
+
742
+ if ($follow_303_with_post) {
743
+ $this->setOpt(CURLOPT_CUSTOMREQUEST, 'POST');
744
+ } else {
745
+ if (isset($this->options[CURLOPT_CUSTOMREQUEST])) {
746
+ if ((version_compare(PHP_VERSION, '5.5.11') < 0) || defined('HHVM_VERSION')) {
747
+ trigger_error('Due to technical limitations of PHP <= 5.5.11 and HHVM, it is not possible to ' . 'perform a post-redirect-get request using a php-curl-class Curl object that ' . 'has already been used to perform other types of requests. Either use a new ' . 'php-curl-class Curl object or upgrade your PHP engine.', E_USER_ERROR);
748
+ } else {
749
+ $this->setOpt(CURLOPT_CUSTOMREQUEST, null);
750
+ }
751
+ }
752
+ }
753
+
754
+ $this->setOpt(CURLOPT_POST, true);
755
+ $this->setOpt(CURLOPT_POSTFIELDS, $this->buildPostData($data));
756
+ $this->setOpt(CURLOPT_USERAGENT, 'WordPress');
757
+
758
+ return $this->exec();
759
+ }
760
+
761
+ /**
762
+ * Put
763
+ *
764
+ * @access public
765
+ *
766
+ * @param $url
767
+ * @param $data
768
+ *
769
+ * @return mixed
770
+ */
771
+ public function put($url, $data = array()) {
772
+ if (is_array($url)) {
773
+ $data = $url;
774
+ $url = (string)$this->url;
775
+ }
776
+ $this->setUrl($url);
777
+ $this->setOpt(CURLOPT_CUSTOMREQUEST, 'PUT');
778
+ $put_data = $this->buildPostData($data);
779
+ if (empty($this->options[CURLOPT_INFILE]) && empty($this->options[CURLOPT_INFILESIZE])) {
780
+ if (is_string($put_data)) {
781
+ $this->setHeader('Content-Length', strlen($put_data));
782
+ }
783
+ }
784
+ if (!empty($put_data)) {
785
+ $this->setOpt(CURLOPT_POSTFIELDS, $put_data);
786
+ }
787
+
788
+ return $this->exec();
789
+ }
790
+
791
+ /**
792
+ * Search
793
+ *
794
+ * @access public
795
+ *
796
+ * @param $url
797
+ * @param $data
798
+ *
799
+ * @return mixed
800
+ */
801
+ public function search($url, $data = array()) {
802
+ if (is_array($url)) {
803
+ $data = $url;
804
+ $url = (string)$this->url;
805
+ }
806
+ $this->setUrl($url);
807
+ $this->setOpt(CURLOPT_CUSTOMREQUEST, 'SEARCH');
808
+ $put_data = $this->buildPostData($data);
809
+ if (empty($this->options[CURLOPT_INFILE]) && empty($this->options[CURLOPT_INFILESIZE])) {
810
+ if (is_string($put_data)) {
811
+ $this->setHeader('Content-Length', strlen($put_data));
812
+ }
813
+ }
814
+ if (!empty($put_data)) {
815
+ $this->setOpt(CURLOPT_POSTFIELDS, $put_data);
816
+ }
817
+
818
+ return $this->exec();
819
+ }
820
+
821
+ /**
822
+ * Set Basic Authentication
823
+ *
824
+ * @access public
825
+ *
826
+ * @param $username
827
+ * @param $password
828
+ */
829
+ public function setBasicAuthentication($username, $password = '') {
830
+ $this->setOpt(CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
831
+ $this->setOpt(CURLOPT_USERPWD, $username . ':' . $password);
832
+ }
833
+
834
+ /**
835
+ * Set Digest Authentication
836
+ *
837
+ * @access public
838
+ *
839
+ * @param $username
840
+ * @param $password
841
+ */
842
+ public function setDigestAuthentication($username, $password = '') {
843
+ $this->setOpt(CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
844
+ $this->setOpt(CURLOPT_USERPWD, $username . ':' . $password);
845
+ }
846
+
847
+ /**
848
+ * Set Cookie
849
+ *
850
+ * @access public
851
+ *
852
+ * @param $key
853
+ * @param $value
854
+ */
855
+ public function setCookie($key, $value) {
856
+ $this->setEncodedCookie($key, $value);
857
+ $this->buildCookies();
858
+ }
859
+
860
+ /**
861
+ * Set Cookies
862
+ *
863
+ * @access public
864
+ *
865
+ * @param $cookies
866
+ */
867
+ public function setCookies($cookies) {
868
+ foreach ($cookies as $key => $value) {
869
+ $this->setEncodedCookie($key, $value);
870
+ }
871
+ $this->buildCookies();
872
+ }
873
+
874
+ /**
875
+ * Get Cookie
876
+ *
877
+ * @access public
878
+ *
879
+ * @param $key
880
+ *
881
+ * @return mixed
882
+ */
883
+ public function getCookie($key) {
884
+ return $this->getResponseCookie($key);
885
+ }
886
+
887
+ /**
888
+ * Get Response Cookie
889
+ *
890
+ * @access public
891
+ *
892
+ * @param $key
893
+ *
894
+ * @return mixed
895
+ */
896
+ public function getResponseCookie($key) {
897
+ return isset($this->responseCookies[$key]) ? $this->responseCookies[$key] : null;
898
+ }
899
+
900
+ /**
901
+ * Get Response Cookies
902
+ *
903
+ * @access public
904
+ *
905
+ * @return array
906
+ */
907
+ public function getResponseCookies() {
908
+ return $this->responseCookies;
909
+ }
910
+
911
+ /**
912
+ * Set Max Filesize
913
+ *
914
+ * @access public
915
+ *
916
+ * @param $bytes
917
+ */
918
+ public function setMaxFilesize($bytes) {
919
+ // Make compatible with PHP version both before and after 5.5.0. PHP 5.5.0 added the cURL resource as the first
920
+ // argument to the CURLOPT_PROGRESSFUNCTION callback.
921
+ $gte_v550 = version_compare(PHP_VERSION, '5.5.0') >= 0;
922
+ if ($gte_v550) {
923
+ $callback = function ($resource, $download_size, $downloaded, $upload_size, $uploaded) use ($bytes) {
924
+ // Abort the transfer when $downloaded bytes exceeds maximum $bytes by returning a non-zero value.
925
+ return $downloaded > $bytes ? 1 : 0;
926
+ };
927
+ } else {
928
+ $callback = function ($download_size, $downloaded, $upload_size, $uploaded) use ($bytes) {
929
+ return $downloaded > $bytes ? 1 : 0;
930
+ };
931
+ }
932
+
933
+ $this->progress($callback);
934
+ }
935
+
936
+ /**
937
+ * Set Port
938
+ *
939
+ * @access public
940
+ *
941
+ * @param $port
942
+ */
943
+ public function setPort($port) {
944
+ $this->setOpt(CURLOPT_PORT, intval($port));
945
+ }
946
+
947
+ /**
948
+ * Set Connect Timeout
949
+ *
950
+ * @access public
951
+ *
952
+ * @param $seconds
953
+ */
954
+ public function setConnectTimeout($seconds) {
955
+ $this->setOpt(CURLOPT_CONNECTTIMEOUT, $seconds);
956
+ }
957
+
958
+ /**
959
+ * Set Cookie String
960
+ *
961
+ * @access public
962
+ *
963
+ * @param $string
964
+ *
965
+ * @return bool
966
+ */
967
+ public function setCookieString($string) {
968
+ return $this->setOpt(CURLOPT_COOKIE, $string);
969
+ }
970
+
971
+ /**
972
+ * Set Cookie File
973
+ *
974
+ * @access public
975
+ *
976
+ * @param $cookie_file
977
+ *
978
+ * @return boolean
979
+ */
980
+ public function setCookieFile($cookie_file) {
981
+ return $this->setOpt(CURLOPT_COOKIEFILE, $cookie_file);
982
+ }
983
+
984
+ /**
985
+ * Set Cookie Jar
986
+ *
987
+ * @access public
988
+ *
989
+ * @param $cookie_jar
990
+ *
991
+ * @return boolean
992
+ */
993
+ public function setCookieJar($cookie_jar) {
994
+ return $this->setOpt(CURLOPT_COOKIEJAR, $cookie_jar);
995
+ }
996
+
997
+ /**
998
+ * Set Default JSON Decoder
999
+ *
1000
+ * @access public
1001
+ *
1002
+ * @param $assoc
1003
+ * @param $depth
1004
+ * @param $options
1005
+ */
1006
+ public function setDefaultJsonDecoder() {
1007
+ $this->jsonDecoder = 'NSLDecoder::decodeJson';
1008
+ $this->jsonDecoderArgs = func_get_args();
1009
+ }
1010
+
1011
+ /**
1012
+ * Set Default XML Decoder
1013
+ *
1014
+ * @access public
1015
+ */
1016
+ public function setDefaultXmlDecoder() {
1017
+ $this->xmlDecoder = 'NSLDecoder::decodeXml';
1018
+ }
1019
+
1020
+ /**
1021
+ * Set Default Decoder
1022
+ *
1023
+ * @access public
1024
+ *
1025
+ * @param $mixed boolean|callable|string
1026
+ */
1027
+ public function setDefaultDecoder($mixed = 'json') {
1028
+ if ($mixed === false) {
1029
+ $this->defaultDecoder = false;
1030
+ } elseif (is_callable($mixed)) {
1031
+ $this->defaultDecoder = $mixed;
1032
+ } else {
1033
+ if ($mixed === 'json') {
1034
+ $this->defaultDecoder = $this->jsonDecoder;
1035
+ } elseif ($mixed === 'xml') {
1036
+ $this->defaultDecoder = $this->xmlDecoder;
1037
+ }
1038
+ }
1039
+ }
1040
+
1041
+ /**
1042
+ * Set Default Timeout
1043
+ *
1044
+ * @access public
1045
+ */
1046
+ public function setDefaultTimeout() {
1047
+ $this->setTimeout(self::DEFAULT_TIMEOUT);
1048
+ }
1049
+
1050
+ /**
1051
+ * Set Default User Agent
1052
+ *
1053
+ * @access public
1054
+ */
1055
+ public function setDefaultUserAgent() {
1056
+ $user_agent = 'PHP-Curl-Class/' . self::VERSION . ' (+https://github.com/php-curl-class/php-curl-class)';
1057
+ $user_agent .= ' PHP/' . PHP_VERSION;
1058
+ $curl_version = curl_version();
1059
+ $user_agent .= ' curl/' . $curl_version['version'];
1060
+ $this->setUserAgent($user_agent);
1061
+ }
1062
+
1063
+ /**
1064
+ * Set Header
1065
+ *
1066
+ * Add extra header to include in the request.
1067
+ *
1068
+ * @access public
1069
+ *
1070
+ * @param $key
1071
+ * @param $value
1072
+ */
1073
+ public function setHeader($key, $value) {
1074
+ $this->headers[$key] = $value;
1075
+ $headers = array();
1076
+ foreach ($this->headers as $key => $value) {
1077
+ $headers[] = $key . ': ' . $value;
1078
+ }
1079
+ $this->setOpt(CURLOPT_HTTPHEADER, $headers);
1080
+ }
1081
+
1082
+ /**
1083
+ * Set Headers
1084
+ *
1085
+ * Add extra headers to include in the request.
1086
+ *
1087
+ * @access public
1088
+ *
1089
+ * @param $headers
1090
+ */
1091
+ public function setHeaders($headers) {
1092
+ foreach ($headers as $key => $value) {
1093
+ $this->headers[$key] = $value;
1094
+ }
1095
+
1096
+ $headers = array();
1097
+ foreach ($this->headers as $key => $value) {
1098
+ $headers[] = $key . ': ' . $value;
1099
+ }
1100
+ $this->setOpt(CURLOPT_HTTPHEADER, $headers);
1101
+ }
1102
+
1103
+ /**
1104
+ * Set JSON Decoder
1105
+ *
1106
+ * @access public
1107
+ *
1108
+ * @param $mixed boolean|callable
1109
+ */
1110
+ public function setJsonDecoder($mixed) {
1111
+ if ($mixed === false) {
1112
+ $this->jsonDecoder = false;
1113
+ $this->jsonDecoderArgs = array();
1114
+ } elseif (is_callable($mixed)) {
1115
+ $this->jsonDecoder = $mixed;
1116
+ $this->jsonDecoderArgs = array();
1117
+ }
1118
+ }
1119
+
1120
+ /**
1121
+ * Set XML Decoder
1122
+ *
1123
+ * @access public
1124
+ *
1125
+ * @param $mixed boolean|callable
1126
+ */
1127
+ public function setXmlDecoder($mixed) {
1128
+ if ($mixed === false) {
1129
+ $this->xmlDecoder = false;
1130
+ } elseif (is_callable($mixed)) {
1131
+ $this->xmlDecoder = $mixed;
1132
+ }
1133
+ }
1134
+
1135
+ /**
1136
+ * Set Opt
1137
+ *
1138
+ * @access public
1139
+ *
1140
+ * @param $option
1141
+ * @param $value
1142
+ *
1143
+ * @return boolean
1144
+ */
1145
+ public function setOpt($option, $value) {
1146
+ $required_options = array(
1147
+ CURLOPT_RETURNTRANSFER => 'CURLOPT_RETURNTRANSFER',
1148
+ );
1149
+
1150
+ if (in_array($option, array_keys($required_options), true) && !($value === true)) {
1151
+ trigger_error($required_options[$option] . ' is a required option', E_USER_WARNING);
1152
+ }
1153
+
1154
+ $success = curl_setopt($this->curl, $option, $value);
1155
+ if ($success) {
1156
+ $this->options[$option] = $value;
1157
+ }
1158
+
1159
+ return $success;
1160
+ }
1161
+
1162
+ /**
1163
+ * Set Opts
1164
+ *
1165
+ * @access public
1166
+ *
1167
+ * @param $options
1168
+ *
1169
+ * @return boolean
1170
+ * Returns true if all options were successfully set. If an option could not be successfully set, false is
1171
+ * immediately returned, ignoring any future options in the options array. Similar to curl_setopt_array().
1172
+ */
1173
+ public function setOpts($options) {
1174
+ foreach ($options as $option => $value) {
1175
+ if (!$this->setOpt($option, $value)) {
1176
+ return false;
1177
+ }
1178
+ }
1179
+
1180
+ return true;
1181
+ }
1182
+
1183
+ /**
1184
+ * Set Referer
1185
+ *
1186
+ * @access public
1187
+ *
1188
+ * @param $referer
1189
+ */
1190
+ public function setReferer($referer) {
1191
+ $this->setReferrer($referer);
1192
+ }
1193
+
1194
+ /**
1195
+ * Set Referrer
1196
+ *
1197
+ * @access public
1198
+ *
1199
+ * @param $referrer
1200
+ */
1201
+ public function setReferrer($referrer) {
1202
+ $this->setOpt(CURLOPT_REFERER, $referrer);
1203
+ }
1204
+
1205
+ /**
1206
+ * Set Retry
1207
+ *
1208
+ * Number of retries to attempt or decider callable. Maximum number of
1209
+ * attempts is $maximum_number_of_retries + 1.
1210
+ *
1211
+ * @access public
1212
+ *
1213
+ * @param $mixed
1214
+ */
1215
+ public function setRetry($mixed) {
1216
+ if (is_callable($mixed)) {
1217
+ $this->retryDecider = $mixed;
1218
+ } elseif (is_int($mixed)) {
1219
+ $maximum_number_of_retries = $mixed;
1220
+ $this->remainingRetries = $maximum_number_of_retries;
1221
+ }
1222
+ }
1223
+
1224
+ /**
1225
+ * Set Timeout
1226
+ *
1227
+ * @access public
1228
+ *
1229
+ * @param $seconds
1230
+ */
1231
+ public function setTimeout($seconds) {
1232
+ $this->setOpt(CURLOPT_TIMEOUT, $seconds);
1233
+ }
1234
+
1235
+ /**
1236
+ * Set Url
1237
+ *
1238
+ * @access public
1239
+ *
1240
+ * @param $url
1241
+ * @param $mixed_data
1242
+ */
1243
+ public function setUrl($url, $mixed_data = '') {
1244
+ $built_url = $this->buildUrl($url, $mixed_data);
1245
+
1246
+ if ($this->url === null) {
1247
+ $this->url = (string)new NSLUrl($built_url);
1248
+ } else {
1249
+ $this->url = (string)new NSLUrl($this->url, $built_url);
1250
+ }
1251
+
1252
+ $this->setOpt(CURLOPT_URL, $this->url);
1253
+ }
1254
+
1255
+ /**
1256
+ * Set User Agent
1257
+ *
1258
+ * @access public
1259
+ *
1260
+ * @param $user_agent
1261
+ */
1262
+ public function setUserAgent($user_agent) {
1263
+ $this->setOpt(CURLOPT_USERAGENT, $user_agent);
1264
+ }
1265
+
1266
+ /**
1267
+ * Attempt Retry
1268
+ *
1269
+ * @access public
1270
+ */
1271
+ public function attemptRetry() {
1272
+ $attempt_retry = false;
1273
+ if ($this->error) {
1274
+ if ($this->retryDecider === null) {
1275
+ $attempt_retry = $this->remainingRetries >= 1;
1276
+ } else {
1277
+ $attempt_retry = call_user_func($this->retryDecider, $this);
1278
+ }
1279
+ if ($attempt_retry) {
1280
+ $this->retries += 1;
1281
+ if ($this->remainingRetries) {
1282
+ $this->remainingRetries -= 1;
1283
+ }
1284
+ }
1285
+ }
1286
+
1287
+ return $attempt_retry;
1288
+ }
1289
+
1290
+ /**
1291
+ * Success
1292
+ *
1293
+ * @access public
1294
+ *
1295
+ * @param $callback
1296
+ */
1297
+ public function success($callback) {
1298
+ $this->successFunction = $callback;
1299
+ }
1300
+
1301
+ /**
1302
+ * Unset Header
1303
+ *
1304
+ * Remove extra header previously set using NSLCurl::setHeader().
1305
+ *
1306
+ * @access public
1307
+ *
1308
+ * @param $key
1309
+ */
1310
+ public function unsetHeader($key) {
1311
+ unset($this->headers[$key]);
1312
+ $headers = array();
1313
+ foreach ($this->headers as $key => $value) {
1314
+ $headers[] = $key . ': ' . $value;
1315
+ }
1316
+ $this->setOpt(CURLOPT_HTTPHEADER, $headers);
1317
+ }
1318
+
1319
+ /**
1320
+ * Remove Header
1321
+ *
1322
+ * Remove an internal header from the request.
1323
+ * Using `curl -H "Host:" ...' is equivalent to $curl->removeHeader('Host');.
1324
+ *
1325
+ * @access public
1326
+ *
1327
+ * @param $key
1328
+ */
1329
+ public function removeHeader($key) {
1330
+ $this->setHeader($key, '');
1331
+ }
1332
+
1333
+ /**
1334
+ * Verbose
1335
+ *
1336
+ * @access public
1337
+ *
1338
+ * @param bool $on
1339
+ * @param resource $output
1340
+ */
1341
+ public function verbose($on = true, $output = STDERR) {
1342
+ // Turn off CURLINFO_HEADER_OUT for verbose to work. This has the side
1343
+ // effect of causing NSLCurl::requestHeaders to be empty.
1344
+ if ($on) {
1345
+ $this->setOpt(CURLINFO_HEADER_OUT, false);
1346
+ }
1347
+ $this->setOpt(CURLOPT_VERBOSE, $on);
1348
+ $this->setOpt(CURLOPT_STDERR, $output);
1349
+ }
1350
+
1351
+ /**
1352
+ * Destruct
1353
+ *
1354
+ * @access public
1355
+ */
1356
+ public function __destruct() {
1357
+ $this->close();
1358
+ }
1359
+
1360
+ public function __get($name) {
1361
+ $return = null;
1362
+ if (in_array($name, self::$deferredProperties) && is_callable(array(
1363
+ $this,
1364
+ $getter = '__get_' . $name
1365
+ ))) {
1366
+ $return = $this->$name = $this->$getter();
1367
+ }
1368
+
1369
+ return $return;
1370
+ }
1371
+
1372
+ /**
1373
+ * Get Effective Url
1374
+ *
1375
+ * @access private
1376
+ */
1377
+ private function __get_effectiveUrl() {
1378
+ return $this->getInfo(CURLINFO_EFFECTIVE_URL);
1379
+ }
1380
+
1381
+ /**
1382
+ * Get RFC 2616
1383
+ *
1384
+ * @access private
1385
+ */
1386
+ private function __get_rfc2616() {
1387
+ return array_fill_keys(self::$RFC2616, true);
1388
+ }
1389
+
1390
+ /**
1391
+ * Get RFC 6265
1392
+ *
1393
+ * @access private
1394
+ */
1395
+ private function __get_rfc6265() {
1396
+ return array_fill_keys(self::$RFC6265, true);
1397
+ }
1398
+
1399
+ /**
1400
+ * Get Total Time
1401
+ *
1402
+ * @access private
1403
+ */
1404
+ private function __get_totalTime() {
1405
+ return $this->getInfo(CURLINFO_TOTAL_TIME);
1406
+ }
1407
+
1408
+ /**
1409
+ * Build Cookies
1410
+ *
1411
+ * @access private
1412
+ */
1413
+ private function buildCookies() {
1414
+ // Avoid using http_build_query() as unnecessary encoding is performed.
1415
+ // http_build_query($this->cookies, '', '; ');
1416
+ $this->setOpt(CURLOPT_COOKIE, implode('; ', array_map(function ($k, $v) {
1417
+ return $k . '=' . $v;
1418
+ }, array_keys($this->cookies), array_values($this->cookies))));
1419
+ }
1420
+
1421
+ /**
1422
+ * Build Url
1423
+ *
1424
+ * @access private
1425
+ *
1426
+ * @param $url
1427
+ * @param $mixed_data
1428
+ *
1429
+ * @return string
1430
+ */
1431
+ private function buildUrl($url, $mixed_data = '') {
1432
+ $query_string = '';
1433
+ if (!empty($mixed_data)) {
1434
+ $query_mark = strpos($url, '?') > 0 ? '&' : '?';
1435
+ if (is_string($mixed_data)) {
1436
+ $query_string .= $query_mark . $mixed_data;
1437
+ } elseif (is_array($mixed_data)) {
1438
+ $query_string .= $query_mark . http_build_query($mixed_data, '', '&');
1439
+ }
1440
+ }
1441
+
1442
+ return $url . $query_string;
1443
+ }
1444
+
1445
+ /**
1446
+ * Create Header Callback
1447
+ *
1448
+ * @access private
1449
+ *
1450
+ * @param $header_callback_data
1451
+ *
1452
+ * @return callable
1453
+ */
1454
+ private function createHeaderCallback($header_callback_data) {
1455
+ return function ($ch, $header) use ($header_callback_data) {
1456
+ if (preg_match('/^Set-Cookie:\s*([^=]+)=([^;]+)/mi', $header, $cookie) === 1) {
1457
+ $header_callback_data->responseCookies[$cookie[1]] = trim($cookie[2], " \n\r\t\0\x0B");
1458
+ }
1459
+ $header_callback_data->rawResponseHeaders .= $header;
1460
+
1461
+ return strlen($header);
1462
+ };
1463
+ }
1464
+
1465
+ /**
1466
+ * Download Complete
1467
+ *
1468
+ * @access private
1469
+ *
1470
+ * @param $fh
1471
+ */
1472
+ private function downloadComplete($fh) {
1473
+ if (!$this->error && $this->downloadCompleteFunction) {
1474
+ rewind($fh);
1475
+ $this->call($this->downloadCompleteFunction, $fh);
1476
+ $this->downloadCompleteFunction = null;
1477
+ }
1478
+
1479
+ if (is_resource($fh)) {
1480
+ fclose($fh);
1481
+ }
1482
+
1483
+ // Fix "PHP Notice: Use of undefined constant STDOUT" when reading the
1484
+ // PHP script from stdin. Using null causes "Warning: curl_setopt():
1485
+ // supplied argument is not a valid File-Handle resource".
1486
+ if (!defined('STDOUT')) {
1487
+ define('STDOUT', fopen('php://stdout', 'w'));
1488
+ }
1489
+
1490
+ // Reset CURLOPT_FILE with STDOUT to avoid: "curl_exec(): CURLOPT_FILE
1491
+ // resource has gone away, resetting to default".
1492
+ $this->setOpt(CURLOPT_FILE, STDOUT);
1493
+
1494
+ // Reset CURLOPT_RETURNTRANSFER to tell cURL to return subsequent
1495
+ // responses as the return value of curl_exec(). Without this,
1496
+ // curl_exec() will revert to returning boolean values.
1497
+ $this->setOpt(CURLOPT_RETURNTRANSFER, true);
1498
+ }
1499
+
1500
+ /**
1501
+ * Parse Headers
1502
+ *
1503
+ * @access private
1504
+ *
1505
+ * @param $raw_headers
1506
+ *
1507
+ * @return array
1508
+ */
1509
+ private function parseHeaders($raw_headers) {
1510
+ $raw_headers = preg_split('/\r\n/', $raw_headers, null, PREG_SPLIT_NO_EMPTY);
1511
+ $http_headers = new NSLCaseInsensitiveArray();
1512
+
1513
+ $raw_headers_count = count($raw_headers);
1514
+ for ($i = 1; $i < $raw_headers_count; $i++) {
1515
+ if (strpos($raw_headers[$i], ':') !== false) {
1516
+ list($key, $value) = explode(':', $raw_headers[$i], 2);
1517
+ $key = trim($key);
1518
+ $value = trim($value);
1519
+ // Use isset() as array_key_exists() and ArrayAccess are not compatible.
1520
+ if (isset($http_headers[$key])) {
1521
+ $http_headers[$key] .= ',' . $value;
1522
+ } else {
1523
+ $http_headers[$key] = $value;
1524
+ }
1525
+ }
1526
+ }
1527
+
1528
+ return array(
1529
+ isset($raw_headers['0']) ? $raw_headers['0'] : '',
1530
+ $http_headers
1531
+ );
1532
+ }
1533
+
1534
+ /**
1535
+ * Parse Request Headers
1536
+ *
1537
+ * @access private
1538
+ *
1539
+ * @param $raw_headers
1540
+ *
1541
+ * @return NSLCaseInsensitiveArray
1542
+ */
1543
+ private function parseRequestHeaders($raw_headers) {
1544
+ $request_headers = new NSLCaseInsensitiveArray();
1545
+ list($first_line, $headers) = $this->parseHeaders($raw_headers);
1546
+ $request_headers['Request-Line'] = $first_line;
1547
+ foreach ($headers as $key => $value) {
1548
+ $request_headers[$key] = $value;
1549
+ }
1550
+
1551
+ return $request_headers;
1552
+ }
1553
+
1554
+ /**
1555
+ * Parse Response
1556
+ *
1557
+ * @access private
1558
+ *
1559
+ * @param $response_headers
1560
+ * @param $raw_response
1561
+ *
1562
+ * @return mixed
1563
+ * Provided the content-type is determined to be json or xml:
1564
+ * Returns stdClass object when the default json decoder is used and the content-type is json.
1565
+ * Returns SimpleXMLElement object when the default xml decoder is used and the content-type is xml.
1566
+ */
1567
+ private function parseResponse($response_headers, $raw_response) {
1568
+ $response = $raw_response;
1569
+ if (isset($response_headers['Content-Type'])) {
1570
+ if (preg_match($this->jsonPattern, $response_headers['Content-Type'])) {
1571
+ if ($this->jsonDecoder) {
1572
+ $args = $this->jsonDecoderArgs;
1573
+ array_unshift($args, $response);
1574
+ $response = call_user_func_array($this->jsonDecoder, $args);
1575
+ }
1576
+ } elseif (preg_match($this->xmlPattern, $response_headers['Content-Type'])) {
1577
+ if ($this->xmlDecoder) {
1578
+ $response = call_user_func($this->xmlDecoder, $response);
1579
+ }
1580
+ } else {
1581
+ if ($this->defaultDecoder) {
1582
+ $response = call_user_func($this->defaultDecoder, $response);
1583
+ }
1584
+ }
1585
+ }
1586
+
1587
+ return $response;
1588
+ }
1589
+
1590
+ /**
1591
+ * Parse Response Headers
1592
+ *
1593
+ * @access private
1594
+ *
1595
+ * @param $raw_response_headers
1596
+ *
1597
+ * @return NSLCaseInsensitiveArray
1598
+ */
1599
+ private function parseResponseHeaders($raw_response_headers) {
1600
+ $response_header_array = explode("\r\n\r\n", $raw_response_headers);
1601
+ $response_header = '';
1602
+ for ($i = count($response_header_array) - 1; $i >= 0; $i--) {
1603
+ if (stripos($response_header_array[$i], 'HTTP/') === 0) {
1604
+ $response_header = $response_header_array[$i];
1605
+ break;
1606
+ }
1607
+ }
1608
+
1609
+ $response_headers = new NSLCaseInsensitiveArray();
1610
+ list($first_line, $headers) = $this->parseHeaders($response_header);
1611
+ $response_headers['Status-Line'] = $first_line;
1612
+ foreach ($headers as $key => $value) {
1613
+ $response_headers[$key] = $value;
1614
+ }
1615
+
1616
+ return $response_headers;
1617
+ }
1618
+
1619
+ /**
1620
+ * Set Encoded Cookie
1621
+ *
1622
+ * @access private
1623
+ *
1624
+ * @param $key
1625
+ * @param $value
1626
+ */
1627
+ private function setEncodedCookie($key, $value) {
1628
+ $name_chars = array();
1629
+ foreach (str_split($key) as $name_char) {
1630
+ if (isset($this->rfc2616[$name_char])) {
1631
+ $name_chars[] = $name_char;
1632
+ } else {
1633
+ $name_chars[] = rawurlencode($name_char);
1634
+ }
1635
+ }
1636
+
1637
+ $value_chars = array();
1638
+ foreach (str_split($value) as $value_char) {
1639
+ if (isset($this->rfc6265[$value_char])) {
1640
+ $value_chars[] = $value_char;
1641
+ } else {
1642
+ $value_chars[] = rawurlencode($value_char);
1643
+ }
1644
+ }
1645
+
1646
+ $this->cookies[implode('', $name_chars)] = implode('', $value_chars);
1647
+ }
1648
+ }
includes/curl/Decoder.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class NSLDecoder {
4
+
5
+ /**
6
+ * Decode JSON
7
+ *
8
+ * @access public
9
+ *
10
+ * @param $json
11
+ * @param $assoc
12
+ * @param $depth
13
+ * @param $options
14
+ *
15
+ * @return array|stdClass
16
+ */
17
+ public static function decodeJson() {
18
+ $args = func_get_args();
19
+
20
+ // Call json_decode() without the $options parameter in PHP
21
+ // versions less than 5.4.0 as the $options parameter was added in
22
+ // PHP version 5.4.0.
23
+ if (version_compare(PHP_VERSION, '5.4.0', '<')) {
24
+ $args = array_slice($args, 0, 3);
25
+ }
26
+
27
+ $response = call_user_func_array('json_decode', $args);
28
+ if ($response === null) {
29
+ $response = $args['0'];
30
+ }
31
+
32
+ return $response;
33
+ }
34
+
35
+ /**
36
+ * Decode XML
37
+ *
38
+ * @access public
39
+ *
40
+ * @param $response
41
+ */
42
+ public static function decodeXml($response) {
43
+ $xml_obj = @simplexml_load_string($response);
44
+ if (!($xml_obj === false)) {
45
+ $response = $xml_obj;
46
+ }
47
+
48
+ return $response;
49
+ }
50
+ }
includes/curl/StrUtil.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class NSLStrUtil {
4
+
5
+ /**
6
+ * Return true when $haystack starts with $needle.
7
+ *
8
+ * @access public
9
+ *
10
+ * @param $haystack
11
+ * @param $needle
12
+ *
13
+ * @return bool
14
+ */
15
+ public static function startsWith($haystack, $needle) {
16
+ return mb_substr($haystack, 0, mb_strlen($needle)) === $needle;
17
+ }
18
+ }
includes/curl/Url.php ADDED
@@ -0,0 +1,169 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once dirname(__FILE__) . '/StrUtil.php';
4
+
5
+ class NSLUrl {
6
+
7
+ private $baseUrl = null;
8
+ private $relativeUrl = null;
9
+
10
+ public function __construct($base_url, $relative_url = null) {
11
+ $this->baseUrl = $base_url;
12
+ $this->relativeUrl = $relative_url;
13
+ }
14
+
15
+ public function __toString() {
16
+ return $this->absolutizeUrl();
17
+ }
18
+
19
+ /**
20
+ * Remove dot segments.
21
+ *
22
+ * Interpret and remove the special "." and ".." path segments from a referenced path.
23
+ */
24
+ public static function removeDotSegments($input) {
25
+ // 1. The input buffer is initialized with the now-appended path
26
+ // components and the output buffer is initialized to the empty
27
+ // string.
28
+ $output = '';
29
+
30
+ // 2. While the input buffer is not empty, loop as follows:
31
+ while (!empty($input)) {
32
+ // A. If the input buffer begins with a prefix of "../" or "./",
33
+ // then remove that prefix from the input buffer; otherwise,
34
+ if (NSLStrUtil::startsWith($input, '../')) {
35
+ $input = substr($input, 3);
36
+ } elseif (NSLStrUtil::startsWith($input, './')) {
37
+ $input = substr($input, 2);
38
+
39
+ // B. if the input buffer begins with a prefix of "/./" or "/.",
40
+ // where "." is a complete path segment, then replace that
41
+ // prefix with "/" in the input buffer; otherwise,
42
+ } elseif (NSLStrUtil::startsWith($input, '/./')) {
43
+ $input = substr($input, 2);
44
+ } elseif ($input === '/.') {
45
+ $input = '/';
46
+
47
+ // C. if the input buffer begins with a prefix of "/../" or "/..",
48
+ // where ".." is a complete path segment, then replace that
49
+ // prefix with "/" in the input buffer and remove the last
50
+ // segment and its preceding "/" (if any) from the output
51
+ // buffer; otherwise,
52
+ } elseif (NSLStrUtil::startsWith($input, '/../')) {
53
+ $input = substr($input, 3);
54
+ $output = substr_replace($output, '', mb_strrpos($output, '/'));
55
+ } elseif ($input === '/..') {
56
+ $input = '/';
57
+ $output = substr_replace($output, '', mb_strrpos($output, '/'));
58
+
59
+ // D. if the input buffer consists only of "." or "..", then remove
60
+ // that from the input buffer; otherwise,
61
+ } elseif ($input === '.' || $input === '..') {
62
+ $input = '';
63
+
64
+ // E. move the first path segment in the input buffer to the end of
65
+ // the output buffer, including the initial "/" character (if
66
+ // any) and any subsequent characters up to, but not including,
67
+ // the next "/" character or the end of the input buffer.
68
+ } elseif (!(($pos = mb_strpos($input, '/', 1)) === false)) {
69
+ $output .= substr($input, 0, $pos);
70
+ $input = substr_replace($input, '', 0, $pos);
71
+ } else {
72
+ $output .= $input;
73
+ $input = '';
74
+ }
75
+ }
76
+
77
+ // 3. Finally, the output buffer is returned as the result of
78
+ // remove_dot_segments.
79
+ return $output . $input;
80
+ }
81
+
82
+ /**
83
+ * Absolutize url.
84
+ *
85
+ * Combine the base and relative url into an absolute url.
86
+ */
87
+ private function absolutizeUrl() {
88
+ $b = $this->parseUrl($this->baseUrl);
89
+
90
+ if (!($this->relativeUrl === null)) {
91
+ $r = $this->parseUrl($this->relativeUrl);
92
+
93
+ // Copy relative parts to base url.
94
+ if (isset($r['scheme'])) {
95
+ $b['scheme'] = $r['scheme'];
96
+ }
97
+ if (isset($r['host'])) {
98
+ $b['host'] = $r['host'];
99
+ }
100
+ if (isset($r['port'])) {
101
+ $b['port'] = $r['port'];
102
+ }
103
+ if (isset($r['user'])) {
104
+ $b['user'] = $r['user'];
105
+ }
106
+ if (isset($r['pass'])) {
107
+ $b['pass'] = $r['pass'];
108
+ }
109
+
110
+ if (!isset($r['path']) || $r['path'] === '') {
111
+ $r['path'] = '/';
112
+ }
113
+ // Merge relative url with base when relative url's path doesn't start with a slash.
114
+ if (!(NSLStrUtil::startsWith($r['path'], '/'))) {
115
+ $base = mb_strrchr($b['path'], '/', true);
116
+ if ($base === false) {
117
+ $base = '';
118
+ }
119
+ $r['path'] = $base . '/' . $r['path'];
120
+ }
121
+ $b['path'] = $r['path'];
122
+ $b['path'] = $this->removeDotSegments($b['path']);
123
+
124
+ if (isset($r['query'])) {
125
+ $b['query'] = $r['query'];
126
+ }
127
+ if (isset($r['fragment'])) {
128
+ $b['fragment'] = $r['fragment'];
129
+ }
130
+ }
131
+
132
+ if (!isset($b['path'])) {
133
+ $b['path'] = '/';
134
+ }
135
+
136
+ $absolutized_url = $this->unparseUrl($b);
137
+
138
+ return $absolutized_url;
139
+ }
140
+
141
+ /**
142
+ * Parse url.
143
+ *
144
+ * Parse url into components of a URI as specified by RFC 3986.
145
+ */
146
+ private function parseUrl($url) {
147
+ return parse_url($url);
148
+ }
149
+
150
+ /**
151
+ * Unparse url.
152
+ *
153
+ * Combine url components into a url.
154
+ */
155
+ private function unparseUrl($parsed_url) {
156
+ $scheme = isset($parsed_url['scheme']) ? $parsed_url['scheme'] . '://' : '';
157
+ $host = isset($parsed_url['host']) ? $parsed_url['host'] : '';
158
+ $port = isset($parsed_url['port']) ? ':' . $parsed_url['port'] : '';
159
+ $user = isset($parsed_url['user']) ? $parsed_url['user'] : '';
160
+ $pass = isset($parsed_url['pass']) ? ':' . $parsed_url['pass'] : '';
161
+ $pass = ($user || $pass) ? $pass . '@' : '';
162
+ $path = isset($parsed_url['path']) ? $parsed_url['path'] : '';
163
+ $query = isset($parsed_url['query']) ? '?' . $parsed_url['query'] : '';
164
+ $fragment = isset($parsed_url['fragment']) ? '#' . $parsed_url['fragment'] : '';
165
+ $unparsed_url = $scheme . $user . $pass . $host . $port . $path . $query . $fragment;
166
+
167
+ return $unparsed_url;
168
+ }
169
+ }
includes/oauth2.php ADDED
@@ -0,0 +1,214 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once NSL_PATH . '/includes/curl/Curl.php';
4
+ require_once NSL_PATH . '/includes/auth.php';
5
+
6
+
7
+ abstract class NextendSocialOauth2 extends NextendSocialAuth {
8
+
9
+ const CSRF_LENGTH = 32;
10
+
11
+ protected $state = false;
12
+
13
+ protected $client_id;
14
+ protected $client_secret;
15
+ protected $redirect_uri;
16
+
17
+ protected $endpointAuthorization;
18
+ protected $endpointAccessToken;
19
+ protected $endpointRestAPI;
20
+
21
+ protected $defaultRestParams = array();
22
+
23
+ protected $scopes = array();
24
+
25
+ public function checkError() {
26
+ if (isset($_GET['error']) && isset($_GET['error_description'])) {
27
+ if ($this->validateState()) {
28
+ throw new Exception($_GET['error'] . ': ' . htmlspecialchars_decode($_GET['error_description']));
29
+ }
30
+ }
31
+ }
32
+
33
+ public function hasAuthenticateData() {
34
+ return isset($_REQUEST['code']);
35
+ }
36
+
37
+ /**
38
+ * @param string $client_id
39
+ */
40
+ public function setClientId($client_id) {
41
+ $this->client_id = $client_id;
42
+ }
43
+
44
+ /**
45
+ * @param string $client_secret
46
+ */
47
+ public function setClientSecret($client_secret) {
48
+ $this->client_secret = $client_secret;
49
+ }
50
+
51
+ /**
52
+ * @param string $redirect_uri
53
+ */
54
+ public function setRedirectUri($redirect_uri) {
55
+ $this->redirect_uri = $redirect_uri;
56
+ }
57
+
58
+ public function createAuthUrl() {
59
+
60
+ $args = array(
61
+ 'response_type' => 'code',
62
+ 'client_id' => urlencode($this->client_id),
63
+ 'redirect_uri' => urlencode($this->redirect_uri),
64
+ 'state' => urlencode($this->getState())
65
+ );
66
+
67
+ $scopes = apply_filters('nsl_' . $this->providerID . '_scopes', $this->scopes);
68
+ if (count($scopes)) {
69
+ $args['scope'] = urlencode($this->formatScopes($scopes));
70
+ }
71
+
72
+ return add_query_arg($args, $this->endpointAuthorization);
73
+ }
74
+
75
+ protected function formatScopes($scopes) {
76
+ return implode(' ', $scopes);
77
+ }
78
+
79
+ public function authenticate() {
80
+ if (isset($_GET['code'])) {
81
+ if (!$this->validateState()) {
82
+ throw new Exception('Unable to validate CSRF state');
83
+ }
84
+
85
+ $curl = new NSLCurl();
86
+
87
+ $accessTokenData = $curl->post($this->endpointAccessToken, array(
88
+ 'grant_type' => 'authorization_code',
89
+ 'code' => $_GET['code'],
90
+ 'redirect_uri' => $this->redirect_uri,
91
+ 'client_id' => $this->client_id,
92
+ 'client_secret' => $this->client_secret
93
+ ));
94
+
95
+ if ($curl->error) {
96
+
97
+ $this->errorFromResponse($accessTokenData);
98
+
99
+ throw new Exception($curl->errorCode . ': ' . $curl->errorMessage);
100
+ }
101
+
102
+ $accessTokenData['created'] = time();
103
+
104
+ $this->access_token_data = $accessTokenData;
105
+
106
+ return wp_json_encode($accessTokenData);
107
+ }
108
+
109
+ return false;
110
+ }
111
+
112
+ protected function errorFromResponse($response) {
113
+ if (isset($response['error'])) {
114
+ throw new Exception($response['error'] . ': ' . $response['error_description']);
115
+ }
116
+ }
117
+
118
+ protected function validateState() {
119
+ $this->state = NextendSocialLoginPersistentAnonymous::get($this->providerID . '_state');
120
+ if ($this->state === false) {
121
+ return false;
122
+ }
123
+
124
+ if (empty($_GET['state'])) {
125
+ return false;
126
+ }
127
+
128
+ if ($_GET['state'] == $this->state) {
129
+ return true;
130
+ }
131
+
132
+ return false;
133
+ }
134
+
135
+ protected function getState() {
136
+ $this->state = NextendSocialLoginPersistentAnonymous::get($this->providerID . '_state');
137
+ if ($this->state === false) {
138
+ $this->state = $this->generateRandomState();
139
+
140
+ NextendSocialLoginPersistentAnonymous::set($this->providerID . '_state', $this->state);
141
+ }
142
+
143
+ return $this->state;
144
+ }
145
+
146
+ protected function generateRandomState() {
147
+
148
+ if (function_exists('random_bytes')) {
149
+ return $this->bytesToString(random_bytes(self::CSRF_LENGTH));
150
+ }
151
+
152
+ if (class_exists('mcrypt_create_iv')) {
153
+ /** @noinspection PhpDeprecationInspection */
154
+ $binaryString = mcrypt_create_iv(self::CSRF_LENGTH, MCRYPT_DEV_URANDOM);
155
+
156
+ if ($binaryString !== false) {
157
+ return $this->bytesToString($binaryString);
158
+ }
159
+ }
160
+
161
+ if (function_exists('openssl_random_pseudo_bytes')) {
162
+ $wasCryptographicallyStrong = false;
163
+
164
+ $binaryString = openssl_random_pseudo_bytes(self::CSRF_LENGTH, $wasCryptographicallyStrong);
165
+
166
+ if ($binaryString !== false && $wasCryptographicallyStrong === true) {
167
+ return $this->bytesToString($binaryString);
168
+ }
169
+ }
170
+
171
+ return $this->randomStr(self::CSRF_LENGTH);
172
+ }
173
+
174
+ private function bytesToString($binaryString) {
175
+ return substr(bin2hex($binaryString), 0, self::CSRF_LENGTH);
176
+ }
177
+
178
+ private function randomStr($length, $keyspace = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ') {
179
+ $str = '';
180
+ $max = mb_strlen($keyspace, '8bit') - 1;
181
+ for ($i = 0; $i < $length; ++$i) {
182
+ $str .= $keyspace[random_int(0, $max)];
183
+ }
184
+
185
+ return $str;
186
+ }
187
+
188
+ /**
189
+ * @param $path
190
+ * @param array $data
191
+ *
192
+ * @return mixed
193
+ * @throws Exception
194
+ */
195
+ public function get($path, $data = array()) {
196
+ $curl = new NSLCurl();
197
+
198
+ $data = array_merge($this->defaultRestParams, $data);
199
+
200
+ $curl->setHeader('Authorization', 'Bearer ' . $this->access_token_data['access_token']);
201
+
202
+ $result = $curl->get($this->endpointRestAPI . $path, $data);
203
+
204
+ if ($curl->error) {
205
+ if (isset($result['message'])) {
206
+ throw new Exception($result['message']);
207
+ } else {
208
+ throw new Exception($curl->errorCode . ': ' . $curl->errorMessage);
209
+ }
210
+ }
211
+
212
+ return $result;
213
+ }
214
+ }
includes/provider-dummy.php ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ abstract class NextendSocialProviderDummy {
4
+
5
+ protected $id;
6
+ protected $label;
7
+ protected $path;
8
+
9
+ protected $color = '#fff';
10
+
11
+ protected $popupWidth = 600;
12
+
13
+ protected $popupHeight = 600;
14
+
15
+ /** @var NextendSocialLoginSettings */
16
+ public $settings;
17
+
18
+ public function needPro() {
19
+ return true;
20
+ }
21
+
22
+ /**
23
+ * @return string
24
+ */
25
+ public function getId() {
26
+ return $this->id;
27
+ }
28
+
29
+ /**
30
+ * @return string
31
+ */
32
+ public function getLabel() {
33
+ return $this->label;
34
+ }
35
+
36
+ public function enable() {
37
+ return false;
38
+ }
39
+
40
+ public function isEnabled() {
41
+ return false;
42
+ }
43
+
44
+ public function isTested() {
45
+ return false;
46
+ }
47
+
48
+ public function isTest() {
49
+ return false;
50
+ }
51
+
52
+ public function connect() {
53
+
54
+ }
55
+
56
+ public function adminSettingsForm() {
57
+ }
58
+
59
+ public function getAdminUrl($subview = '') {
60
+ return NextendSocialLoginAdmin::getAdminUrl('provider-' . $this->getId());
61
+ }
62
+
63
+ public function getState() {
64
+ return 'pro-only';
65
+ }
66
+
67
+ public function getIcon() {
68
+ return plugins_url('/providers/' . $this->id . '/' . $this->id . '.png', NSL_PATH_FILE);
69
+ }
70
+
71
+ /**
72
+ * @return string
73
+ */
74
+ public function getColor() {
75
+ return $this->color;
76
+ }
77
+
78
+ public function import() {
79
+ return true;
80
+ }
81
+
82
+ /**
83
+ * @return int
84
+ */
85
+ public function getPopupWidth() {
86
+ return $this->popupWidth;
87
+ }
88
+
89
+ /**
90
+ * @return int
91
+ */
92
+ public function getPopupHeight() {
93
+ return $this->popupHeight;
94
+ }
95
+
96
+ }
includes/provider.php ADDED
@@ -0,0 +1,982 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once dirname(__FILE__) . '/provider-dummy.php';
4
+
5
+ abstract class NextendSocialProvider extends NextendSocialProviderDummy {
6
+
7
+ protected $dbID;
8
+ protected $optionKey;
9
+
10
+ protected $enabled = false;
11
+
12
+ /** @var NextendSocialAuth */
13
+ protected $client;
14
+
15
+ protected $authUserData = array();
16
+
17
+ protected $requiredFields = array();
18
+
19
+ protected $svg = '';
20
+
21
+ public function __construct($defaultSettings) {
22
+
23
+ if (empty($this->dbID)) {
24
+ $this->dbID = $this->id;
25
+ }
26
+
27
+ $this->optionKey = 'nsl_' . $this->id;
28
+
29
+ $this->settings = new NextendSocialLoginSettings($this->optionKey, array_merge(array(
30
+ 'settings_saved' => '0',
31
+ 'tested' => '0',
32
+ 'custom_default_button' => '',
33
+ 'custom_icon_button' => '',
34
+ 'login_label' => '',
35
+ 'link_label' => '',
36
+ 'unlink_label' => ''
37
+ ), array(
38
+ 'ask_email' => 'when-empty',
39
+ 'ask_user' => 'never',
40
+ 'auto_link' => 'email',
41
+ 'disabled_roles' => array(),
42
+ 'register_roles' => array(
43
+ 'default'
44
+ )
45
+ ), $defaultSettings));
46
+
47
+ add_filter('nsl_update_settings_validate_' . $this->optionKey, array(
48
+ $this,
49
+ 'validateSettings'
50
+ ), 10, 2);
51
+
52
+ }
53
+
54
+ public function getOptionKey() {
55
+ return $this->optionKey;
56
+ }
57
+
58
+ public function adminSettingsForm() {
59
+ $subview = !empty($_REQUEST['subview']) ? $_REQUEST['subview'] : '';
60
+ $this->adminDisplaySubView($subview);
61
+ }
62
+
63
+ public function adminDisplaySubView($subview) {
64
+ switch ($subview) {
65
+ case 'settings':
66
+ $this->renderAdmin('settings');
67
+ break;
68
+ case 'buttons':
69
+ $this->renderAdmin('buttons');
70
+ break;
71
+ case 'usage':
72
+ $this->renderAdmin('usage');
73
+ break;
74
+ default:
75
+ $this->renderAdmin('getting-started');
76
+ break;
77
+ }
78
+ }
79
+
80
+ public function renderAdmin($view, $showMenu = true) {
81
+ include(NSL_PATH . '/admin/templates/header.php');
82
+ $_view = $view;
83
+ $view = 'providers';
84
+ include(NSL_PATH . '/admin/templates/menu.php');
85
+ $view = $_view;
86
+ echo '<div class="nsl-admin-content">';
87
+ echo '<h1>' . $this->getLabel() . '</h1>';
88
+ if ($showMenu) {
89
+ include(NSL_PATH . '/admin/templates-provider/menu.php');
90
+ }
91
+
92
+ NextendSocialLoginAdminNotices::displayNotices();
93
+
94
+ if ($view == 'buttons') {
95
+ include(NSL_PATH . '/admin/templates-provider/buttons.php');
96
+ } else if ($view == 'usage') {
97
+ include(NSL_PATH . '/admin/templates-provider/usage.php');
98
+ } else {
99
+ include($this->path . '/admin/' . $view . '.php');
100
+ }
101
+ echo '</div>';
102
+ include(NSL_PATH . '/admin/templates/footer.php');
103
+ }
104
+
105
+ public function renderProSettings() {
106
+ include(NSL_PATH . '/admin/templates-provider/settings-pro.php');
107
+ }
108
+
109
+ public function getRawDefaultButton() {
110
+ return '<span class="nsl-button nsl-button-default nsl-button-' . $this->id . '" style="background-color:' . $this->color . ';">' . $this->svg . '<span>{{label}}</span></span>';
111
+ }
112
+
113
+ public function getRawIconButton() {
114
+ return '<span class="nsl-button nsl-button-icon nsl-button-' . $this->id . '" style="background-color:' . $this->color . ';">' . $this->svg . '</span>';
115
+ }
116
+
117
+ public function getDefaultButton($label) {
118
+ $button = $this->settings->get('custom_default_button');
119
+ if (!empty($button)) {
120
+ return str_replace('{{label}}', __($label, 'nextend-facebook-connect'), $button);
121
+ }
122
+
123
+ return str_replace('{{label}}', __($label, 'nextend-facebook-connect'), $this->getRawDefaultButton());
124
+ }
125
+
126
+ public function getIconButton() {
127
+ $button = $this->settings->get('custom_icon_button');
128
+ if (!empty($button)) {
129
+ return $button;
130
+ }
131
+
132
+ return $this->getRawIconButton();
133
+ }
134
+
135
+ public function getAdminUrl($subview = '') {
136
+ return add_query_arg(array(
137
+ 'subview' => $subview
138
+ ), NextendSocialLoginAdmin::getAdminUrl('provider-' . $this->getId()));
139
+ }
140
+
141
+ public function getLoginUrl() {
142
+ $args = array('loginSocial' => $this->getId());
143
+
144
+ if (isset($_REQUEST['interim-login'])) {
145
+ $args['interim-login'] = 1;
146
+ }
147
+
148
+ return add_query_arg($args, site_url('wp-login.php'));
149
+ }
150
+
151
+ public function validateSettings($newData, $postedData) {
152
+
153
+ if (isset($postedData['custom_default_button'])) {
154
+ if (isset($postedData['custom_default_button_enabled']) && $postedData['custom_default_button_enabled'] == '1') {
155
+ $newData['custom_default_button'] = $postedData['custom_default_button'];
156
+ } else {
157
+ if ($postedData['custom_default_button'] != '') {
158
+ $newData['custom_default_button'] = '';
159
+ }
160
+ }
161
+ }
162
+
163
+ if (isset($postedData['custom_icon_button'])) {
164
+ if (isset($postedData['custom_icon_button_enabled']) && $postedData['custom_icon_button_enabled'] == '1') {
165
+ $newData['custom_icon_button'] = $postedData['custom_icon_button'];
166
+ } else {
167
+ if ($postedData['custom_icon_button'] != '') {
168
+ $newData['custom_icon_button'] = '';
169
+ }
170
+ }
171
+ }
172
+
173
+ foreach ($postedData AS $key => $value) {
174
+
175
+ switch ($key) {
176
+ case 'login_label':
177
+ case 'link_label':
178
+ case 'unlink_label':
179
+ $newData[$key] = wp_kses_post($value);
180
+ break;
181
+ case 'settings_saved':
182
+ $newData[$key] = intval($value) ? 1 : 0;
183
+ break;
184
+ }
185
+ }
186
+
187
+ return $newData;
188
+ }
189
+
190
+ public function needPro() {
191
+ return false;
192
+ }
193
+
194
+ public function enable() {
195
+ $this->enabled = true;
196
+
197
+ $this->onEnabled();
198
+
199
+ return true;
200
+ }
201
+
202
+ protected function onEnabled() {
203
+
204
+ }
205
+
206
+ public function isEnabled() {
207
+ return $this->enabled;
208
+ }
209
+
210
+ public function isTested() {
211
+ return !!$this->settings->get('tested');
212
+ }
213
+
214
+
215
+ public function getState() {
216
+ foreach ($this->requiredFields AS $name => $label) {
217
+ $value = $this->settings->get($name);
218
+ if (empty($value)) {
219
+ return 'not-configured';
220
+ }
221
+ }
222
+ if (!$this->isTested()) {
223
+ return 'not-tested';
224
+ }
225
+
226
+ if (!$this->isEnabled()) {
227
+ return 'disabled';
228
+ }
229
+
230
+ return 'enabled';
231
+ }
232
+
233
+ public function connect() {
234
+ try {
235
+ $this->doAuthenticate();
236
+ } catch (Exception $e) {
237
+ $this->onError($e);
238
+ }
239
+ }
240
+
241
+ /**
242
+ * @return NextendSocialAuth
243
+ */
244
+ protected abstract function getClient();
245
+
246
+ /**
247
+ * @throws Exception
248
+ */
249
+ protected function doAuthenticate() {
250
+
251
+ if (!$this->isTest()) {
252
+ add_action($this->id . '_login_action_before', array(
253
+ $this,
254
+ 'liveConnectBefore'
255
+ ));
256
+ add_action($this->id . '_login_action_redirect', array(
257
+ $this,
258
+ 'liveConnectRedirect'
259
+ ));
260
+ add_action($this->id . '_login_action_get_user_profile', array(
261
+ $this,
262
+ 'liveConnectGetUserProfile'
263
+ ), 10, 3);
264
+
265
+ $interim_login = isset($_REQUEST['interim-login']);
266
+ if ($interim_login) {
267
+ NextendSocialLoginPersistentAnonymous::set($this->id . '_interim_login', 1);
268
+ }
269
+
270
+ $display = isset($_REQUEST['display']);
271
+ if ($display && $_REQUEST['display'] == 'popup') {
272
+ NextendSocialLoginPersistentAnonymous::set($this->id . '_display', 'popup');
273
+ }
274
+ } else {
275
+ add_action($this->id . '_login_action_get_user_profile', array(
276
+ $this,
277
+ 'testConnectGetUserProfile'
278
+ ));
279
+ }
280
+
281
+
282
+ do_action($this->id . '_login_action_before', $this);
283
+
284
+ $client = $this->getClient();
285
+
286
+ $accessTokenData = $this->getAnonymousAccessToken();
287
+
288
+ $client->checkError();
289
+
290
+ do_action($this->id . '_login_action_redirect', $this);
291
+
292
+ if (!$accessTokenData && !$client->hasAuthenticateData()) {
293
+
294
+ header('LOCATION: ' . $client->createAuthUrl());
295
+ exit;
296
+
297
+ } else {
298
+ if (!$accessTokenData) {
299
+
300
+ $accessTokenData = $client->authenticate();
301
+
302
+ $accessTokenData = $this->requestLongLivedToken($accessTokenData);
303
+
304
+ $this->setAnonymousAccessToken($accessTokenData);
305
+ } else {
306
+ $client->setAccessTokenData($accessTokenData);
307
+ }
308
+ if (NextendSocialLoginPersistentAnonymous::get($this->id . '_display') == 'popup') {
309
+ NextendSocialLoginPersistentAnonymous::delete($this->id . '_display');
310
+ ?>
311
+ <!doctype html>
312
+ <html lang=en>
313
+ <head>
314
+ <meta charset=utf-8>
315
+ <title><?php _e('Authentication successful', 'nextend-facebook-connect'); ?></title>
316
+ <script type="text/javascript">
317
+ try {
318
+ if (window.opener !== null) {
319
+ window.opener.location = <?php echo wp_json_encode($this->getLoginUrl()); ?>;
320
+ window.close();
321
+ }
322
+ }
323
+ catch (e) {
324
+ }
325
+ window.location.reload(true);
326
+ </script>
327
+ <meta http-equiv="refresh" content="0">
328
+ </head>
329
+ </html>
330
+ <?php
331
+ exit;
332
+ }
333
+
334
+ $this->authUserData = $this->getCurrentUserInfo();
335
+
336
+ do_action($this->id . '_login_action_get_user_profile', $accessTokenData);
337
+ }
338
+ }
339
+
340
+ public function liveConnectGetUserProfile($accessToken) {
341
+
342
+ $ID = $this->getUserIDByProviderIdentifier($this->getAuthUserData('id'));
343
+ if ($ID && !get_user_by('id', $ID)) {
344
+ $this->removeConnectionByUserID($ID);
345
+ $ID = null;
346
+ }
347
+ if (!is_user_logged_in()) {
348
+
349
+ if ($ID == null) {
350
+ $this->prepareRegister($accessToken);
351
+ } else {
352
+ $this->login($ID, $accessToken);
353
+ }
354
+ } else {
355
+ $current_user = wp_get_current_user();
356
+ if ($ID === null) {
357
+ // Let's connect the account to the current user!
358
+
359
+ $this->linkUserToProviderIdentifier($current_user->ID, $this->getAuthUserData('id'));
360
+
361
+ $this->saveUserData($current_user->ID, 'access_token', $accessToken);
362
+
363
+ NextendSocialLoginAdminNotices::addSuccess(sprintf(__('Your %s account is successfully linked with your account. Now you can sign in with %s easily.', 'nextend-facebook-connect'), $this->getLabel(), $this->getLabel()));
364
+
365
+ } else if ($current_user->ID != $ID) {
366
+
367
+ NextendSocialLoginAdminNotices::addError(sprintf(__('This %s account is already linked with other account. Linking process failed!', 'nextend-facebook-connect'), $this->getLabel()));
368
+ }
369
+ }
370
+ $this->redirectToLastLocation();
371
+ }
372
+
373
+ protected function linkUserToProviderIdentifier($user_id, $providerIdentifier) {
374
+ /** @var $wpdb WPDB */
375
+ global $wpdb;
376
+
377
+ $wpdb->insert($wpdb->prefix . 'social_users', array(
378
+ 'ID' => $user_id,
379
+ 'type' => $this->dbID,
380
+ 'identifier' => $providerIdentifier
381
+ ), array(
382
+ '%d',
383
+ '%s',
384
+ '%s'
385
+ ));
386
+
387
+ do_action('nsl_' . $this->getId() . '_link_user', $user_id, $this->getId());
388
+ }
389
+
390
+ protected function getUserIDByProviderIdentifier($identifier) {
391
+ /** @var $wpdb WPDB */
392
+ global $wpdb;
393
+
394
+ return $wpdb->get_var($wpdb->prepare('SELECT ID FROM `' . $wpdb->prefix . 'social_users` WHERE type = %s AND identifier = %s', array(
395
+ $this->dbID,
396
+ $identifier
397
+ )));
398
+ }
399
+
400
+ protected function removeConnectionByUserID($user_id) {
401
+ /** @var $wpdb WPDB */
402
+ global $wpdb;
403
+
404
+ $wpdb->query($wpdb->prepare('DELETE FROM `' . $wpdb->prefix . 'social_users` WHERE type = %s AND ID = %d', array(
405
+ $this->dbID,
406
+ $user_id
407
+ )));
408
+ }
409
+
410
+ protected function unlinkUser() {
411
+ $user_info = wp_get_current_user();
412
+ if ($user_info->ID) {
413
+ $this->removeConnectionByUserID($user_info->ID);
414
+
415
+ return true;
416
+ }
417
+
418
+ return false;
419
+ }
420
+
421
+ public function isCurrentUserConnected() {
422
+ /** @var $wpdb WPDB */
423
+ global $wpdb;
424
+
425
+ $current_user = wp_get_current_user();
426
+ $ID = $wpdb->get_var($wpdb->prepare('SELECT identifier FROM `' . $wpdb->prefix . 'social_users` WHERE type LIKE %s AND ID = %d', array(
427
+ $this->dbID,
428
+ $current_user->ID
429
+ )));
430
+ if ($ID === null) {
431
+ return false;
432
+ }
433
+
434
+ return $ID;
435
+ }
436
+
437
+ public function getConnectButton($buttonStyle = 'default', $redirectTo = null) {
438
+ $arg = array();
439
+ if ($redirectTo != null) {
440
+ $arg['redirect'] = urlencode($redirectTo);
441
+ } else if (isset($_GET['redirect_to'])) {
442
+ $arg['redirect'] = urlencode($_GET['redirect_to']);
443
+ }
444
+
445
+ switch ($buttonStyle) {
446
+ case 'icon':
447
+
448
+ $button = $this->getIconButton();
449
+ break;
450
+ default:
451
+
452
+ $button = $this->getDefaultButton($this->settings->get('login_label'));
453
+ break;
454
+ }
455
+
456
+ return '<a href="' . esc_url(add_query_arg($arg, $this->getLoginUrl())) . '" rel="nofollow" aria-label="' . esc_attr__($this->settings->get('login_label')) . '" data-plugin="nsl" data-action="connect" data-provider="' . esc_attr($this->getId()) . '" data-popupwidth="' . $this->getPopupWidth() . '" data-popupheight="' . $this->getPopupHeight() . '">' . $button . '</a>';
457
+ }
458
+
459
+ public function getLinkButton() {
460
+
461
+ return '<a href="' . esc_url(add_query_arg('redirect', urlencode(NextendSocialLogin::getCurrentPageURL()), $this->getLoginUrl())) . '" style="text-decoration:none;display:inline-block;box-shadow:none;" data-plugin="nsl" data-action="link" data-provider="' . esc_attr($this->getId()) . '" data-popupwidth="' . $this->getPopupWidth() . '" data-popupheight="' . $this->getPopupHeight() . '" aria-label="' . esc_attr__($this->settings->get('link_label')) . '">' . $this->getDefaultButton($this->settings->get('link_label')) . '</a>';
462
+ }
463
+
464
+ public function getUnLinkButton() {
465
+
466
+ return '<a href="' . esc_url(add_query_arg(array(
467
+ 'action' => 'unlink',
468
+ 'redirect' => urlencode(NextendSocialLogin::getCurrentPageURL())
469
+ ), $this->getLoginUrl())) . '" style="text-decoration:none;display:inline-block;box-shadow:none;" data-plugin="nsl" data-action="unlink" data-provider="' . esc_attr($this->getId()) . '" aria-label="' . esc_attr__($this->settings->get('unlink_label')) . '">' . $this->getDefaultButton($this->settings->get('unlink_label')) . '</a>';
470
+ }
471
+
472
+ protected function redirectToLoginForm() {
473
+ self::safeRedirect(__('Authentication error', 'nextend-facebook-connect'), site_url('wp-login.php'));
474
+ }
475
+
476
+ public function liveConnectBefore() {
477
+
478
+ if (is_user_logged_in() && $this->isCurrentUserConnected()) {
479
+
480
+ if (isset($_GET['action']) && $_GET['action'] == 'unlink') {
481
+ if ($this->unlinkUser()) {
482
+ NextendSocialLoginAdminNotices::addSuccess(__('Unlink successful.', 'nextend-facebook-connect'));
483
+ }
484
+ }
485
+
486
+ $this->redirectToLastLocation();
487
+ exit;
488
+ }
489
+ }
490
+
491
+ public function liveConnectRedirect() {
492
+ if (!is_user_logged_in()) {
493
+ $redirectToLogin = NextendSocialLogin::$settings->get('redirect');
494
+ if (!empty($redirectToLogin)) {
495
+ $_GET['redirect'] = $redirectToLogin;
496
+ }
497
+ }
498
+
499
+ if (isset($_GET['redirect'])) {
500
+ NextendSocialLoginPersistentAnonymous::set('_redirect', $_GET['redirect']);
501
+ $redirect = $_GET['redirect'];
502
+ } else {
503
+ $redirect = NextendSocialLoginPersistentAnonymous::get('_redirect');
504
+ }
505
+
506
+ $redirect = apply_filters($this->id . '_login_redirect_url', $redirect, $this);
507
+
508
+ if ($redirect == '' || $redirect == $this->getLoginUrl()) {
509
+ NextendSocialLoginPersistentAnonymous::set('_redirect', site_url());
510
+ }
511
+ }
512
+
513
+ protected function updateRedirectOnRegister() {
514
+ $redirect = NextendSocialLogin::$settings->get('redirect_reg');
515
+
516
+ $redirect = apply_filters($this->id . '_register_redirect_url', $redirect, $this);
517
+
518
+ if (!empty($redirect)) {
519
+ NextendSocialLoginPersistentAnonymous::set('_redirect', $redirect);
520
+ }
521
+ }
522
+
523
+ protected function redirectToLastLocation() {
524
+
525
+ if (NextendSocialLoginPersistentAnonymous::get($this->id . '_interim_login') == 1) {
526
+ $this->deleteLoginPersistentData();
527
+
528
+ $url = add_query_arg('interim_login', 'nsl', site_url('wp-login.php', 'login'));
529
+ ?>
530
+ <!doctype html>
531
+ <html lang=en>
532
+ <head>
533
+ <meta charset=utf-8>
534
+ <title><?php _e('Authentication successful', 'nextend-facebook-connect'); ?></title>
535
+ <script type="text/javascript">
536
+ window.location = <?php echo wp_json_encode($url); ?>;
537
+ </script>
538
+ <meta http-equiv="refresh" content="0;<?php echo esc_attr($url); ?>">
539
+ </head>
540
+ </html>
541
+ <?php
542
+ exit;
543
+ }
544
+
545
+ self::safeRedirect(__('Authentication successful', 'nextend-facebook-connect'), $this->getLastLocationRedirectTo());
546
+ }
547
+
548
+ protected function getLastLocationRedirectTo() {
549
+ $redirect = NextendSocialLoginPersistentAnonymous::get('_redirect');
550
+
551
+ if (!$redirect || $redirect == '' || $redirect == $this->getLoginUrl()) {
552
+ if (isset($_GET['redirect'])) {
553
+ $redirect = $_GET['redirect'];
554
+ } else {
555
+ $redirect = site_url();
556
+ }
557
+ }
558
+ $redirect = wp_sanitize_redirect($redirect);
559
+ $redirect = wp_validate_redirect($redirect, site_url());
560
+
561
+ NextendSocialLoginPersistentAnonymous::delete('_redirect');
562
+
563
+ return $redirect;
564
+ }
565
+
566
+ protected function login($user_id, $access_token) {
567
+
568
+ add_action('nsl_' . $this->getId() . '_login', array(
569
+ $this,
570
+ 'syncProfile'
571
+ ), 10, 3);
572
+
573
+ $isLoginAllowed = apply_filters('nsl_' . $this->getId() . '_is_login_allowed', true, $this, $user_id);
574
+
575
+ if ($isLoginAllowed) {
576
+ $secure_cookie = is_ssl();
577
+ $secure_cookie = apply_filters('secure_signon_cookie', $secure_cookie, array());
578
+ global $auth_secure_cookie; // XXX ugly hack to pass this to wp_authenticate_cookie
579
+
580
+ $auth_secure_cookie = $secure_cookie;
581
+ wp_set_auth_cookie($user_id, true, $secure_cookie);
582
+ $user_info = get_userdata($user_id);
583
+ do_action('wp_login', $user_info->user_login, $user_info);
584
+
585
+ do_action('nsl_login', $user_id, $this);
586
+ do_action('nsl_' . $this->getId() . '_login', $user_id, $this, $access_token);
587
+
588
+ $this->redirectToLastLocation();
589
+
590
+ }
591
+
592
+ $this->redirectToLoginForm();
593
+ }
594
+
595
+ protected function prepareRegister($accessToken) {
596
+
597
+ $user_id = false;
598
+
599
+ $email = $this->getAuthUserData('email');
600
+ $providerUserID = $this->getAuthUserData('id');
601
+
602
+ if (empty($email)) {
603
+ $email = '';
604
+ } else {
605
+ $user_id = email_exists($email);
606
+ }
607
+ if ($user_id === false) { // Real register
608
+
609
+ add_action('nsl_' . $this->getId() . '_register_new_user', array(
610
+ $this,
611
+ 'registerComplete'
612
+ ));
613
+
614
+ $user_id = $this->register($providerUserID, $email, $this->getAuthUserData('name'), $this->getAuthUserData('first_name'), $this->getAuthUserData('last_name'));
615
+ if ($user_id) {
616
+ $this->login($user_id, $accessToken);
617
+ }
618
+
619
+
620
+ } else if ($this->autoLink($user_id, $providerUserID)) {
621
+ $this->login($user_id, $accessToken);
622
+ }
623
+
624
+ $this->redirectToLoginForm();
625
+ }
626
+
627
+ /**
628
+ * @param $user_id
629
+ * @param $provider NextendSocialProvider
630
+ * @param $access_token string
631
+ */
632
+ public function syncProfile($user_id, $provider, $access_token) {
633
+ }
634
+
635
+ protected function register($providerID, $email, $name = '', $first_name = '', $last_name = '') {
636
+
637
+ $username = strtolower($first_name . $last_name);
638
+ if (empty($username)) {
639
+ $username = strtolower($name);
640
+ }
641
+ if (empty($username)) {
642
+ $username = str_replace(array(
643
+ '@',
644
+ '.'
645
+ ), '', strtolower($email));
646
+ }
647
+
648
+ $sanitized_user_login = sanitize_user($this->settings->get('user_prefix') . $username);
649
+ if (!validate_username($sanitized_user_login)) {
650
+ $sanitized_user_login = sanitize_user('facebook' . $providerID);
651
+ }
652
+ $default_user_name = $sanitized_user_login;
653
+ $i = 1;
654
+ while (username_exists($sanitized_user_login)) {
655
+ $sanitized_user_login = $default_user_name . $i;
656
+ $i++;
657
+ }
658
+
659
+ $userData = array(
660
+ 'email' => $email,
661
+ 'username' => $sanitized_user_login
662
+ );
663
+
664
+ $userData = apply_filters('nsl_' . $this->getId() . '_register_user_data', $userData);
665
+
666
+ if (empty($userData['email'])) {
667
+ $userData['email'] = $providerID . '@' . $this->getId() . '.unknown';
668
+ }
669
+
670
+ $user_pass = wp_generate_password(12, false);
671
+ $user_id = wp_create_user($userData['username'], $user_pass, $userData['email']);
672
+ if (!is_wp_error($user_id)) {
673
+
674
+ $user_data = array();
675
+ if (!empty($name)) {
676
+ $user_data['display_name'] = $name;
677
+ }
678
+ if (!empty($first_name)) {
679
+ $user_data['first_name'] = $first_name;
680
+ if (class_exists('WooCommerce', false)) {
681
+ add_user_meta($user_id, 'billing_first_name', $first_name);
682
+ }
683
+ }
684
+ if (!empty($last_name)) {
685
+ $user_data['last_name'] = $last_name;
686
+ if (class_exists('WooCommerce', false)) {
687
+ add_user_meta($user_id, 'billing_last_name', $last_name);
688
+ }
689
+ }
690
+ if (!empty($user_data)) {
691
+ $user_data['ID'] = $user_id;
692
+ wp_update_user($user_data);
693
+ }
694
+
695
+ update_user_option($user_id, 'default_password_nag', true, true);
696
+
697
+ do_action('register_new_user', $user_id);
698
+
699
+ do_action('nsl_register_new_user', $user_id, $this);
700
+ do_action('nsl_' . $this->getId() . '_register_new_user', $user_id, $this);
701
+
702
+ $this->updateRedirectOnRegister();
703
+
704
+ $this->linkUserToProviderIdentifier($user_id, $providerID);
705
+
706
+ return $user_id;
707
+ }
708
+
709
+ return false;
710
+ }
711
+
712
+ public function registerComplete() {
713
+ $this->deleteLoginPersistentData();
714
+ }
715
+
716
+ protected function autoLink($user_id, $providerUserID) {
717
+
718
+ $isAutoLinkAllowed = true;
719
+ $isAutoLinkAllowed = apply_filters('nsl_' . $this->getId() . '_auto_link_allowed', $isAutoLinkAllowed, $this, $user_id);
720
+ if ($isAutoLinkAllowed) {
721
+ $this->linkUserToProviderIdentifier($user_id, $providerUserID);
722
+
723
+ return true;
724
+ }
725
+
726
+ return false;
727
+ }
728
+
729
+ public function isTest() {
730
+ if (is_user_logged_in() && current_user_can('manage_options')) {
731
+ if (isset($_REQUEST['test'])) {
732
+ NextendSocialLoginPersistentUser::set('_test', 1);
733
+
734
+ return true;
735
+ } else if (NextendSocialLoginPersistentUser::get('_test') == 1) {
736
+ return true;
737
+ }
738
+ }
739
+
740
+ return false;
741
+ }
742
+
743
+ public function testConnectGetUserProfile() {
744
+
745
+ $this->deleteLoginPersistentData();
746
+
747
+ $this->settings->update(array(
748
+ 'tested' => 1
749
+ ));
750
+
751
+ NextendSocialLoginAdminNotices::addSuccess(__('The test was successful', 'nextend-facebook-connect'));
752
+
753
+ ?>
754
+ <!doctype html>
755
+ <html lang=en>
756
+ <head>
757
+ <meta charset=utf-8>
758
+ <title><?php _e('The test was successful', 'nextend-facebook-connect'); ?></title>
759
+ <script type="text/javascript">
760
+ window.opener.location.reload(true);
761
+ window.close();
762
+ </script>
763
+ </head>
764
+ </html>
765
+ <?php
766
+ exit;
767
+ }
768
+
769
+ protected function setAnonymousAccessToken($accessToken) {
770
+ NextendSocialLoginPersistentAnonymous::set($this->id . '_at', $accessToken);
771
+ }
772
+
773
+ protected function getAnonymousAccessToken() {
774
+ return NextendSocialLoginPersistentAnonymous::get($this->id . '_at');
775
+ }
776
+
777
+ protected function deleteLoginPersistentData() {
778
+ NextendSocialLoginPersistentAnonymous::delete($this->id . '_at');
779
+ NextendSocialLoginPersistentAnonymous::delete($this->id . '_interim_login');
780
+ NextendSocialLoginPersistentAnonymous::delete($this->id . '_display');
781
+ NextendSocialLoginPersistentUser::delete('_test');
782
+ }
783
+
784
+ /**
785
+ * @param $e Exception
786
+ */
787
+ protected function onError($e) {
788
+ if (NextendSocialLogin::$settings->get('debug') == 1 || $this->isTest()) {
789
+ header('HTTP/1.0 401 Unauthorized');
790
+ echo "Error: " . $e->getMessage() . "\n";
791
+ } else {
792
+ $url = $this->getLastLocationRedirectTo();
793
+ ?>
794
+ <!doctype html>
795
+ <html lang=en>
796
+ <head>
797
+ <meta charset=utf-8>
798
+ <title><?php echo __('Authentication failed', 'nextend-facebook-connect'); ?></title>
799
+ <script type="text/javascript">
800
+ try {
801
+ if (window.opener !== null) {
802
+ window.close();
803
+ }
804
+ }
805
+ catch (e) {
806
+ }
807
+ window.location = <?php echo wp_json_encode($url); ?>;
808
+ </script>
809
+ <meta http-equiv="refresh" content="0;<?php echo esc_attr($url); ?>">
810
+ </head>
811
+ <body>
812
+ </body>
813
+ </html>
814
+ <?php
815
+ }
816
+ $this->deleteLoginPersistentData();
817
+ exit;
818
+ }
819
+
820
+ protected function saveUserData($user_id, $key, $data) {
821
+ update_user_meta($user_id, $this->id . '_' . $key, $data);
822
+ }
823
+
824
+ protected function getUserData($user_id, $key) {
825
+ return get_user_meta($user_id, $key, true);
826
+ }
827
+
828
+ public function getAccessToken($user_id) {
829
+ return $this->getUserData($user_id, 'access_token');
830
+ }
831
+
832
+ public function getAvatar($user_id) {
833
+ $picture = $this->getUserData($user_id, 'profile_picture');
834
+ if (!$picture || $picture == '') {
835
+ return false;
836
+ }
837
+
838
+ return $picture;
839
+ }
840
+
841
+ /**
842
+ * @return array
843
+ */
844
+ protected function getCurrentUserInfo() {
845
+ return array();
846
+ }
847
+
848
+ protected function requestLongLivedToken($accessTokenData) {
849
+ return $accessTokenData;
850
+ }
851
+
852
+ /**
853
+ * @param $key
854
+ *
855
+ * @throws Exception
856
+ * @return string
857
+ */
858
+ protected function getAuthUserData($key) {
859
+
860
+ throw new Exception('getAuthUserData ' . $key . ' is not supported.');
861
+ }
862
+
863
+ public function renderSettingsHeader() {
864
+
865
+ $state = $this->getState();
866
+ ?>
867
+ <?php if ($state == 'not-tested') : ?>
868
+ <div class="nsl-box nsl-box-blue">
869
+ <h2 class="title"><?php _e('Your configuration needs testing', 'nextend-facebook-connect'); ?></h2>
870
+ <p><?php _e('Before you can start letting your users register with your app it needs to be tested. This test makes sure that no users will have troubles with the login and registration process. <br> If you see error message in the popup check the copied ID and secret or the app itself. Otherwise your settings are fine.', 'nextend-facebook-connect'); ?></p>
871
+
872
+ <p id="nsl-test-configuration">
873
+ <a id="nsl-test-button" href="#"
874
+ onclick="NSLPopupCenter('<?php echo add_query_arg('test', '1', $this->getLoginUrl()); ?>', 'test-window', <?php echo $this->getPopupWidth(); ?>, <?php echo $this->getPopupHeight(); ?>); return false;"
875
+ class="button button-primary"><?php _e('Test the Configuration', 'nextend-facebook-connect'); ?></a>
876
+ <span id="nsl-test-please-save"><?php _e('Please save your changes before testing.', 'nextend-facebook-connect'); ?></span>
877
+ </p>
878
+ </div>
879
+ <?php endif; ?>
880
+
881
+
882
+ <?php if ($this->settings->get('tested') == '1') : ?>
883
+ <div class="nsl-box <?php if ($state == 'enabled'): ?>nsl-box-green<?php else: ?> nsl-box-yellow nsl-box-exclamation-mark<?php endif; ?>">
884
+ <h2 class="title"><?php _e('Works Fine', 'nextend-facebook-connect'); ?> -
885
+ <?php
886
+ switch ($state) {
887
+ case 'disabled':
888
+ _e('Disabled', 'nextend-facebook-connect');
889
+ break;
890
+ case 'enabled':
891
+ _e('Enabled', 'nextend-facebook-connect');
892
+ break;
893
+ }
894
+ ?></h2>
895
+ <p><?php
896
+ switch ($state) {
897
+ case 'disabled':
898
+ printf(__('This provider is currently disabled, which means that users can’t register or login via their %s account.', 'nextend-facebook-connect'), $this->getLabel());
899
+ break;
900
+ case 'enabled':
901
+ printf(__('This provider works fine, but you can test it again. If you don’t want to let users register or login with %s anymore you can disable it.', 'nextend-facebook-connect'), $this->getLabel());
902
+ echo '</p>';
903
+ echo '<p>';
904
+ printf(__('This provider is currently enabled, which means that users can register or login via their %s account.', 'nextend-facebook-connect'), $this->getLabel());
905
+ break;
906
+ }
907
+ ?></p>
908
+
909
+ <p id="nsl-test-configuration">
910
+ <a id="nsl-test-button" href="#"
911
+ onclick="NSLPopupCenter('<?php echo add_query_arg('test', '1', $this->getLoginUrl()); ?>', 'test-window', <?php echo $this->getPopupWidth(); ?>, <?php echo $this->getPopupHeight(); ?>); return false"
912
+ class="button button-secondary"><?php _e('Test Again', 'nextend-facebook-connect'); ?></a>
913
+ <span id="nsl-test-please-save"><?php _e('Please save your changes before testing.', 'nextend-facebook-connect'); ?></span>
914
+ <?php
915
+ switch ($state) {
916
+ case 'disabled':
917
+ ?>
918
+ <a href="<?php echo wp_nonce_url(add_query_arg('provider', $this->getId(), NextendSocialLoginAdmin::getAdminUrl('sub-enable')), 'nextend-social-login_enable_' . $this->getId()); ?>"
919
+ class="button button-primary">
920
+ <?php _e('Enable', 'nextend-facebook-connect'); ?>
921
+ </a>
922
+ <?php
923
+ break;
924
+ case 'enabled':
925
+ ?>
926
+ <a href="<?php echo wp_nonce_url(add_query_arg('provider', $this->getId(), NextendSocialLoginAdmin::getAdminUrl('sub-disable')), 'nextend-social-login_disable_' . $this->getId()); ?>"
927
+ class="button button-secondary">
928
+ <?php _e('Disable', 'nextend-facebook-connect'); ?>
929
+ </a>
930
+ <?php
931
+ break;
932
+ }
933
+ ?>
934
+ </p>
935
+ </div>
936
+ <?php endif; ?>
937
+
938
+
939
+ <script type="text/javascript">
940
+
941
+ jQuery(document).on('ready', function () {
942
+ var $test = jQuery('#nsl-test-configuration');
943
+ if ($test.length) {
944
+ jQuery(<?php echo wp_json_encode('#' . implode(',#', array_keys($this->requiredFields))); ?>)
945
+ .on('keyup.test', function () {
946
+ jQuery('#nsl-test-button').remove();
947
+ jQuery('#nsl-test-please-save').css('display', 'inline');
948
+ jQuery('input').off('keyup.test');
949
+ });
950
+ }
951
+ });
952
+ </script>
953
+ <?php
954
+ }
955
+
956
+ private static function safeRedirect($title, $url) {
957
+ ?>
958
+ <!doctype html>
959
+ <html lang=en>
960
+ <head>
961
+ <meta charset=utf-8>
962
+ <title><?php echo $title; ?></title>
963
+ <script type="text/javascript">
964
+ try {
965
+ if (window.opener !== null) {
966
+ window.opener.location = <?php echo wp_json_encode($url); ?>;
967
+ window.close();
968
+ }
969
+ }
970
+ catch (e) {
971
+ }
972
+ window.location = <?php echo wp_json_encode($url); ?>;
973
+ </script>
974
+ <meta http-equiv="refresh" content="0;<?php echo esc_attr($url); ?>">
975
+ </head>
976
+ <body>
977
+ </body>
978
+ </html>
979
+ <?php
980
+ exit;
981
+ }
982
+ }
js/nsl.js ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function (undefined) {
2
+ window.NSLPopupCenter = function (url, title, w, h) {
3
+ var userAgent = navigator.userAgent,
4
+ mobile = function () {
5
+ return /\b(iPhone|iP[ao]d)/.test(userAgent) ||
6
+ /\b(iP[ao]d)/.test(userAgent) ||
7
+ /Android/i.test(userAgent) ||
8
+ /Mobile/i.test(userAgent);
9
+ },
10
+ screenX = window.screenX !== undefined ? window.screenX : window.screenLeft,
11
+ screenY = window.screenY !== undefined ? window.screenY : window.screenTop,
12
+ outerWidth = window.outerWidth !== undefined ? window.outerWidth : document.documentElement.clientWidth,
13
+ outerHeight = window.outerHeight !== undefined ? window.outerHeight : document.documentElement.clientHeight - 22,
14
+ targetWidth = mobile() ? null : w,
15
+ targetHeight = mobile() ? null : h,
16
+ V = screenX < 0 ? window.screen.width + screenX : screenX,
17
+ left = parseInt(V + (outerWidth - targetWidth) / 2, 10),
18
+ right = parseInt(screenY + (outerHeight - targetHeight) / 2.5, 10),
19
+ features = [];
20
+ if (targetWidth !== null) {
21
+ features.push('width=' + targetWidth);
22
+ }
23
+ if (targetHeight !== null) {
24
+ features.push('height=' + targetHeight);
25
+ }
26
+ features.push('left=' + left);
27
+ features.push('top=' + right);
28
+ features.push('scrollbars=1');
29
+
30
+ var newWindow = window.open(url, title, features.join(','));
31
+
32
+ if (window.focus) {
33
+ newWindow.focus();
34
+ }
35
+
36
+ return newWindow;
37
+ };
38
+
39
+ if (jQuery !== undefined) {
40
+ (function ($) {
41
+ $('a[data-plugin="nsl"][data-action="connect"],a[data-plugin="nsl"][data-action="link"]').on('click', function (e) {
42
+ var $target = $(this),
43
+ href = $target.attr('href');
44
+ if (href.indexOf('?') !== -1) {
45
+ href += '&';
46
+ } else {
47
+ href += '?';
48
+ }
49
+ var redirectTo = $target.data('redirect');
50
+ if (redirectTo === 'current') {
51
+ href += 'redirect=' + encodeURIComponent(window.location.href) + '&';
52
+ } else if (redirectTo && redirectTo !== '') {
53
+ href += 'redirect=' + encodeURIComponent(redirectTo) + '&';
54
+ }
55
+
56
+ if (NSLPopupCenter(href + 'display=popup', 'nsl-social-connect', $target.data('popupwidth'), $target.data('popupheight'))) {
57
+ e.preventDefault();
58
+ } else {
59
+ window.location = href;
60
+ e.preventDefault();
61
+ }
62
+ });
63
+ })(jQuery);
64
+ }
65
+ })();
languages/nextend-facebook-connect-hu_HU.mo ADDED
Binary file
languages/nextend-facebook-connect-hu_HU.po ADDED
@@ -0,0 +1,1341 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: ss3\n"
4
+ "POT-Creation-Date: 2018-02-20 09:24+0100\n"
5
+ "PO-Revision-Date: 2018-02-20 09:24+0100\n"
6
+ "Last-Translator: \n"
7
+ "Language-Team: \n"
8
+ "Language: hu\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Generator: Poedit 2.0.6\n"
13
+ "X-Poedit-Basepath: Z:/ramona/wordpress4_2_2/wp-content/plugins\n"
14
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
15
+ "X-Poedit-SourceCharset: UTF-8\n"
16
+ "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
17
+ "_n_noop:1,2;_c;_nc:4c,1,2;_x:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;_ex:1,2c;"
18
+ "esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;"
19
+ "esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_x:1,2c;esc_html_e\n"
20
+ "X-Poedit-SearchPath-0: nextend-social-connect-pro-new\n"
21
+ "X-Poedit-SearchPath-1: nextend-facebook-connect-new\n"
22
+ "X-Poedit-SearchPathExcluded-0: nextend-facebook-connect-new/providers/"
23
+ "twitter/compat\n"
24
+ "X-Poedit-SearchPathExcluded-1: nextend-facebook-connect-new/providers/google/"
25
+ "compat\n"
26
+ "X-Poedit-SearchPathExcluded-2: nextend-facebook-connect-new/providers/"
27
+ "facebook/compat\n"
28
+
29
+ #: nextend-facebook-connect-new/admin/admin.php:133
30
+ #, php-format
31
+ msgid "%s needs the CURL PHP extension."
32
+ msgstr "A %s-nak szüksége van a CURL PHP kiegészítőre."
33
+
34
+ #: nextend-facebook-connect-new/admin/admin.php:133
35
+ #: nextend-facebook-connect-new/admin/admin.php:138
36
+ #: nextend-facebook-connect-new/admin/admin.php:148
37
+ msgid "Please contact your server administrator and ask for solution!"
38
+ msgstr ""
39
+ "Kérlek lépj kapcsolatba a szerveradminisztrátorral és kérj tőle segítséget!"
40
+
41
+ #: nextend-facebook-connect-new/admin/admin.php:138
42
+ msgid "Https protocol is not supported or disabled in CURL."
43
+ msgstr "A HTTPS protokol nincs támogat a CURL-ben vagy ki van kapcsolva."
44
+
45
+ #: nextend-facebook-connect-new/admin/admin.php:148
46
+ #, php-format
47
+ msgid "%s needs json_decode function."
48
+ msgstr "A %s-nak szüksége van a json_decode függvényre."
49
+
50
+ #: nextend-facebook-connect-new/admin/admin.php:166
51
+ #: nextend-facebook-connect-new/admin/admin.php:206
52
+ msgid "Settings saved."
53
+ msgstr "Beállítások elmentve."
54
+
55
+ #: nextend-facebook-connect-new/admin/admin.php:174
56
+ msgid "The authorization was successful"
57
+ msgstr "Az engedélyezés sikeres volt"
58
+
59
+ #: nextend-facebook-connect-new/admin/admin.php:185
60
+ msgid "Deauthorize completed."
61
+ msgstr "A engedély visszavonása befejeződött."
62
+
63
+ #: nextend-facebook-connect-new/admin/admin.php:297
64
+ #: nextend-facebook-connect-new/admin/templates-provider/menu.php:10
65
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:95
66
+ #: nextend-facebook-connect-new/admin/templates/providers.php:78
67
+ #: nextend-facebook-connect-new/admin/templates/providers.php:90
68
+ msgid "Settings"
69
+ msgstr "Beállítások"
70
+
71
+ #: nextend-facebook-connect-new/admin/templates-provider/buttons.php:72
72
+ msgid "Login label"
73
+ msgstr "Bejelentkezés felirat"
74
+
75
+ #: nextend-facebook-connect-new/admin/templates-provider/buttons.php:77
76
+ #: nextend-facebook-connect-new/admin/templates-provider/buttons.php:88
77
+ #: nextend-facebook-connect-new/admin/templates-provider/buttons.php:99
78
+ #: nextend-facebook-connect-new/admin/templates-provider/buttons.php:128
79
+ #: nextend-facebook-connect-new/admin/templates-provider/buttons.php:158
80
+ msgid "Reset to default"
81
+ msgstr "Alapbeállítás visszaállítása"
82
+
83
+ #: nextend-facebook-connect-new/admin/templates-provider/buttons.php:82
84
+ msgid "Link label"
85
+ msgstr "Profil kapcsolás felirat"
86
+
87
+ #: nextend-facebook-connect-new/admin/templates-provider/buttons.php:94
88
+ msgid "Unlink label"
89
+ msgstr "Profile szétkapcsolás felirat"
90
+
91
+ #: nextend-facebook-connect-new/admin/templates-provider/buttons.php:105
92
+ msgid "Default button"
93
+ msgstr "Alap gomb"
94
+
95
+ #: nextend-facebook-connect-new/admin/templates-provider/buttons.php:121
96
+ #: nextend-facebook-connect-new/admin/templates-provider/buttons.php:151
97
+ msgid "Use custom button"
98
+ msgstr "Egyedi gomb használata"
99
+
100
+ #: nextend-facebook-connect-new/admin/templates-provider/buttons.php:128
101
+ #, php-format
102
+ msgid "Use the %s in your custom button's code to make the label show up."
103
+ msgstr "Használd a %s azonosítót, hogy megfelenjen a gomb felirat."
104
+
105
+ #: nextend-facebook-connect-new/admin/templates-provider/buttons.php:136
106
+ msgid "Icon button"
107
+ msgstr "Ikon gomb"
108
+
109
+ #: nextend-facebook-connect-new/admin/templates-provider/buttons.php:167
110
+ #: nextend-facebook-connect-new/admin/templates-provider/settings-pro.php:122
111
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:208
112
+ #: nextend-facebook-connect-new/admin/templates/global-settings.php:103
113
+ #: nextend-facebook-connect-new/providers/facebook/admin/settings.php:48
114
+ #: nextend-facebook-connect-new/providers/google/admin/settings.php:47
115
+ #: nextend-facebook-connect-new/providers/twitter/admin/settings.php:46
116
+ #: nextend-social-connect-pro-new/providers/linkedin/admin/settings.php:45
117
+ msgid "Save Changes"
118
+ msgstr "Változtatások Mentése"
119
+
120
+ #: nextend-facebook-connect-new/admin/templates-provider/menu.php:8
121
+ #: nextend-facebook-connect-new/admin/templates/providers.php:58
122
+ #: nextend-facebook-connect-new/providers/google/admin/getting-started.php:7
123
+ #: nextend-facebook-connect-new/providers/twitter/admin/getting-started.php:7
124
+ #: nextend-social-connect-pro-new/providers/linkedin/admin/getting-started.php:6
125
+ msgid "Getting Started"
126
+ msgstr "Első Lépések"
127
+
128
+ #: nextend-facebook-connect-new/admin/templates-provider/menu.php:12
129
+ msgid "Buttons"
130
+ msgstr "Gombok"
131
+
132
+ #: nextend-facebook-connect-new/admin/templates-provider/menu.php:14
133
+ msgid "Usage"
134
+ msgstr "Használat"
135
+
136
+ #: nextend-facebook-connect-new/admin/templates-provider/settings-pro.php:16
137
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:14
138
+ msgid "PRO settings"
139
+ msgstr "PRO beállítások"
140
+
141
+ #: nextend-facebook-connect-new/admin/templates-provider/settings-pro.php:26
142
+ #: nextend-facebook-connect-new/admin/templates-provider/settings-pro.php:30
143
+ msgid "Ask E-mail on registration"
144
+ msgstr "E-mail kérésére regisztrációkor"
145
+
146
+ #: nextend-facebook-connect-new/admin/templates-provider/settings-pro.php:33
147
+ msgid "Never"
148
+ msgstr "Soha"
149
+
150
+ #: nextend-facebook-connect-new/admin/templates-provider/settings-pro.php:36
151
+ msgid "When email is not provided or empty"
152
+ msgstr "Amikor a e-mail cím nem elérhető"
153
+
154
+ #: nextend-facebook-connect-new/admin/templates-provider/settings-pro.php:39
155
+ #: nextend-facebook-connect-new/admin/templates-provider/settings-pro.php:54
156
+ msgid "Always"
157
+ msgstr "Mindig"
158
+
159
+ #: nextend-facebook-connect-new/admin/templates-provider/settings-pro.php:44
160
+ #: nextend-facebook-connect-new/admin/templates-provider/settings-pro.php:48
161
+ msgid "Ask Username on registration"
162
+ msgstr "Felhasználónév kérése regisztrációkor"
163
+
164
+ #: nextend-facebook-connect-new/admin/templates-provider/settings-pro.php:51
165
+ msgid "Never, generate automatically"
166
+ msgstr "Soha, automata generálás"
167
+
168
+ #: nextend-facebook-connect-new/admin/templates-provider/settings-pro.php:59
169
+ #: nextend-facebook-connect-new/admin/templates-provider/settings-pro.php:63
170
+ msgid "Automatically connect the existing account upon registration"
171
+ msgstr "Fiók csatlakoztatása, ha regisztráció esetén már létezik a fiók"
172
+
173
+ #: nextend-facebook-connect-new/admin/templates-provider/settings-pro.php:67
174
+ #: nextend-facebook-connect-new/admin/templates/global-settings.php:50
175
+ #: nextend-facebook-connect-new/admin/templates/providers.php:33
176
+ #: nextend-facebook-connect-new/includes/provider.php:888
177
+ msgid "Disabled"
178
+ msgstr "Kikapcsolva"
179
+
180
+ #: nextend-facebook-connect-new/admin/templates-provider/settings-pro.php:70
181
+ msgid "Automatic, based on email address"
182
+ msgstr "Automatán, e-mail cím egyezés esetén"
183
+
184
+ #: nextend-facebook-connect-new/admin/templates-provider/settings-pro.php:75
185
+ msgid "Disable login for the selected roles"
186
+ msgstr "Bejelntkezés kikapcsolása a kijelölt szerepköröknek"
187
+
188
+ #: nextend-facebook-connect-new/admin/templates-provider/settings-pro.php:95
189
+ msgid "Default roles for user who registered with this provider"
190
+ msgstr "Alap szerepkör, aki ezzel a szolgáltatóval registrál"
191
+
192
+ #: nextend-facebook-connect-new/admin/templates-provider/settings-pro.php:103
193
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:31
194
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:107
195
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:192
196
+ #: nextend-facebook-connect-new/widget.php:34
197
+ msgid "Default"
198
+ msgstr "Alapbeállítás"
199
+
200
+ #: nextend-facebook-connect-new/admin/templates-provider/usage.php:7
201
+ msgid "Shortcode"
202
+ msgstr ""
203
+
204
+ #: nextend-facebook-connect-new/admin/templates-provider/usage.php:21
205
+ msgid "Simple link"
206
+ msgstr ""
207
+
208
+ #: nextend-facebook-connect-new/admin/templates-provider/usage.php:24
209
+ msgid "Click here to login or register"
210
+ msgstr "Kattints ide a belépéshez vagy a regisztrációhoz"
211
+
212
+ #: nextend-facebook-connect-new/admin/templates-provider/usage.php:29
213
+ msgid "Image button"
214
+ msgstr ""
215
+
216
+ #: nextend-facebook-connect-new/admin/templates-provider/usage.php:32
217
+ msgid "Image url"
218
+ msgstr ""
219
+
220
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:23
221
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:27
222
+ msgid "Login form button style"
223
+ msgstr ""
224
+
225
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:37
226
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:113
227
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:198
228
+ #: nextend-facebook-connect-new/widget.php:39
229
+ msgid "Icon"
230
+ msgstr "Imon"
231
+
232
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:44
233
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:48
234
+ msgid "Login layout"
235
+ msgstr ""
236
+
237
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:52
238
+ msgid "Below"
239
+ msgstr "Alul"
240
+
241
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:58
242
+ msgid "Below with separator"
243
+ msgstr "Alul, elválasztóval"
244
+
245
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:64
246
+ msgid "Below and floating"
247
+ msgstr "Alul lebegve"
248
+
249
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:70
250
+ msgid "Above"
251
+ msgstr "Felül"
252
+
253
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:76
254
+ msgid "Above with separator"
255
+ msgstr "Felül, elválasztóval"
256
+
257
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:83
258
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:87
259
+ msgid "Comment login button"
260
+ msgstr "Belépés gomb a kommenteknél"
261
+
262
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:90
263
+ msgid "Show"
264
+ msgstr "Megjelenít"
265
+
266
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:93
267
+ msgid "Hide"
268
+ msgstr "Elrejt"
269
+
270
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:95
271
+ #, php-format
272
+ msgid "You need to turn on the ' %1$s > %2$s > %3$s ' for this feature to work"
273
+ msgstr ""
274
+
275
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:95
276
+ msgid "Discussion"
277
+ msgstr ""
278
+
279
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:95
280
+ msgid "Users must be registered and logged in to comment"
281
+ msgstr ""
282
+
283
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:99
284
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:103
285
+ msgid "Comment button style"
286
+ msgstr "Gomb stílusa a kommenteknél"
287
+
288
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:120
289
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:124
290
+ msgid "WooCommerce login form"
291
+ msgstr ""
292
+
293
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:127
294
+ msgid "No Connect button in login form"
295
+ msgstr ""
296
+
297
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:130
298
+ msgid "Connect button before login form"
299
+ msgstr "Belépés gomb a belépési űrlap előtt"
300
+
301
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:131
302
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:136
303
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:154
304
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:159
305
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:173
306
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:178
307
+ msgid "Action:"
308
+ msgstr "Action:"
309
+
310
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:135
311
+ msgid "Connect button after login form"
312
+ msgstr "Belépés gomb a belépési űrlap után"
313
+
314
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:143
315
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:147
316
+ msgid "WooCommerce billing form"
317
+ msgstr ""
318
+
319
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:150
320
+ msgid "No Connect button in billing form"
321
+ msgstr ""
322
+
323
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:153
324
+ msgid "Connect button before billing form"
325
+ msgstr "Belépés gomb a számlázási űrlap előtt"
326
+
327
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:158
328
+ msgid "Connect button after billing form"
329
+ msgstr "Belépés gomb a számlázási űrlapon"
330
+
331
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:165
332
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:169
333
+ msgid "WooCommerce account details"
334
+ msgstr ""
335
+
336
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:172
337
+ msgid "Link buttons before account details"
338
+ msgstr ""
339
+
340
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:177
341
+ msgid "Link buttons after account details"
342
+ msgstr ""
343
+
344
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:184
345
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:188
346
+ msgid "WooCommerce button style"
347
+ msgstr ""
348
+
349
+ #: nextend-facebook-connect-new/admin/templates/global-settings.php:43
350
+ #: nextend-facebook-connect-new/admin/templates/global-settings.php:47
351
+ msgid "Debug mode"
352
+ msgstr "Debug mód"
353
+
354
+ #: nextend-facebook-connect-new/admin/templates/global-settings.php:53
355
+ #: nextend-facebook-connect-new/admin/templates/providers.php:36
356
+ #: nextend-facebook-connect-new/includes/provider.php:891
357
+ msgid "Enabled"
358
+ msgstr "Bekapcsolva"
359
+
360
+ #: nextend-facebook-connect-new/admin/templates/global-settings.php:59
361
+ msgid "Fixed redirect url for login"
362
+ msgstr "Fix átirányítási link belépésnél"
363
+
364
+ #: nextend-facebook-connect-new/admin/templates/global-settings.php:72
365
+ #: nextend-facebook-connect-new/admin/templates/global-settings.php:93
366
+ msgid "Use custom"
367
+ msgstr ""
368
+
369
+ #: nextend-facebook-connect-new/admin/templates/global-settings.php:80
370
+ msgid "Fixed redirect url for register"
371
+ msgstr "Fix átirányítási link regisztrációnál"
372
+
373
+ #: nextend-facebook-connect-new/admin/templates/header.php:14
374
+ msgid "Docs"
375
+ msgstr "Dokumentáció"
376
+
377
+ #: nextend-facebook-connect-new/admin/templates/header.php:17
378
+ msgid "Support"
379
+ msgstr "Támogatás"
380
+
381
+ #: nextend-facebook-connect-new/admin/templates/header.php:20
382
+ #: nextend-facebook-connect-new/admin/templates/menu.php:12
383
+ msgid "Pro Addon"
384
+ msgstr "Pro Kiegészítő"
385
+
386
+ #: nextend-facebook-connect-new/admin/templates/menu.php:6
387
+ msgid "Providers"
388
+ msgstr ""
389
+
390
+ #: nextend-facebook-connect-new/admin/templates/menu.php:8
391
+ msgid "Global Settings"
392
+ msgstr "Általános beállítások"
393
+
394
+ #: nextend-facebook-connect-new/admin/templates/pro-addon.php:13
395
+ msgid "Error"
396
+ msgstr "Hiba"
397
+
398
+ #: nextend-facebook-connect-new/admin/templates/pro-addon.php:14
399
+ msgid ""
400
+ "You don’t have sufficient permissions to install and activate plugins. "
401
+ "Please contact your site’s administrator!"
402
+ msgstr ""
403
+
404
+ #: nextend-facebook-connect-new/admin/templates/pro-addon.php:22
405
+ #: nextend-facebook-connect-new/admin/templates/pro-addon.php:32
406
+ #: nextend-facebook-connect-new/admin/templates/pro.php:34
407
+ msgid "Activate Pro Addon"
408
+ msgstr "Pro Addon aktiválása"
409
+
410
+ #: nextend-facebook-connect-new/admin/templates/pro-addon.php:23
411
+ msgid ""
412
+ "Pro Addon is installed but not activated. To be able to use the Pro "
413
+ "features, you need to activate it."
414
+ msgstr ""
415
+
416
+ #: nextend-facebook-connect-new/admin/templates/pro-addon.php:37
417
+ #: nextend-facebook-connect-new/admin/templates/pro-addon.php:215
418
+ msgid "Deauthorize Pro Addon"
419
+ msgstr "Pro kiegészítő deaktiválása"
420
+
421
+ #: nextend-facebook-connect-new/admin/templates/pro-addon.php:48
422
+ #: nextend-facebook-connect-new/admin/templates/pro.php:43
423
+ msgid "Pro Addon is not installed"
424
+ msgstr ""
425
+
426
+ #: nextend-facebook-connect-new/admin/templates/pro-addon.php:50
427
+ msgid ""
428
+ "To access the Pro features, you need to install and activate the Pro Addon."
429
+ msgstr ""
430
+
431
+ #: nextend-facebook-connect-new/admin/templates/pro-addon.php:59
432
+ #, php-format
433
+ msgid "Install %s now"
434
+ msgstr ""
435
+
436
+ #: nextend-facebook-connect-new/admin/templates/pro-addon.php:60
437
+ #: nextend-facebook-connect-new/admin/templates/pro.php:47
438
+ msgid "Install Pro Addon"
439
+ msgstr ""
440
+
441
+ #: nextend-facebook-connect-new/admin/templates/pro-addon.php:94
442
+ msgid "Activating..."
443
+ msgstr "Aktiválás..."
444
+
445
+ #: nextend-facebook-connect-new/admin/templates/pro-addon.php:126
446
+ msgid "Authorize your Pro Addon"
447
+ msgstr "Aktiváld a Pro Kiegészítődet"
448
+
449
+ #: nextend-facebook-connect-new/admin/templates/pro-addon.php:127
450
+ msgid ""
451
+ "To be able to use the Pro features, you need to authorize Nextend Social "
452
+ "Connect Pro Addon. You can do this by clicking on the Authorize button below "
453
+ "then select the related purchase."
454
+ msgstr ""
455
+
456
+ #: nextend-facebook-connect-new/admin/templates/pro-addon.php:132
457
+ msgid "Authorize"
458
+ msgstr "Aktiválás"
459
+
460
+ #: nextend-facebook-connect-new/admin/templates/pro-addon.php:189
461
+ msgid "License key"
462
+ msgstr ""
463
+
464
+ #: nextend-facebook-connect-new/admin/templates/pro-addon.php:206
465
+ msgid "Pro Addon is installed and activated"
466
+ msgstr ""
467
+
468
+ #: nextend-facebook-connect-new/admin/templates/pro-addon.php:208
469
+ msgid ""
470
+ "You installed and activated the Pro Addon. If you don’t want to use it "
471
+ "anymore, you can deauthorize using the button below."
472
+ msgstr ""
473
+
474
+ #: nextend-facebook-connect-new/admin/templates/pro.php:8
475
+ msgid "Get Pro Addon to unlock more features"
476
+ msgstr "Vásárold meg a Pro Kiegészítőt, hogy még több funkcióhoz juss"
477
+
478
+ #: nextend-facebook-connect-new/admin/templates/pro.php:9
479
+ msgid ""
480
+ "The features below are available in Nextend Social Login Pro Addon. Get it "
481
+ "today and tweak the awesome settings."
482
+ msgstr ""
483
+
484
+ #: nextend-facebook-connect-new/admin/templates/pro.php:10
485
+ msgid ""
486
+ "If you already have a license, you can Authorize your Pro Addon. Otherwise "
487
+ "you can purchase it using the button below."
488
+ msgstr ""
489
+
490
+ #: nextend-facebook-connect-new/admin/templates/pro.php:14
491
+ msgid "Buy Pro Addon"
492
+ msgstr "Vedd meg a Pro Kiegészítőt"
493
+
494
+ #: nextend-facebook-connect-new/admin/templates/pro.php:16
495
+ msgid "Authorize Pro Addon"
496
+ msgstr "Pro Kiegészítő aktiválása"
497
+
498
+ #: nextend-facebook-connect-new/admin/templates/pro.php:25
499
+ msgid "Pro Addon is not activated"
500
+ msgstr ""
501
+
502
+ #: nextend-facebook-connect-new/admin/templates/pro.php:26
503
+ #: nextend-facebook-connect-new/admin/templates/pro.php:44
504
+ msgid ""
505
+ "To be able to use the Pro features, you need to install and activate the "
506
+ "Nextend Social Connect Pro Addon."
507
+ msgstr ""
508
+
509
+ #: nextend-facebook-connect-new/admin/templates/providers.php:24
510
+ msgid "Not Available"
511
+ msgstr "Nem elérhető"
512
+
513
+ #: nextend-facebook-connect-new/admin/templates/providers.php:27
514
+ msgid "Not Configured"
515
+ msgstr ""
516
+
517
+ #: nextend-facebook-connect-new/admin/templates/providers.php:30
518
+ msgid "Not Tested"
519
+ msgstr "Nincs Tesztelve"
520
+
521
+ #: nextend-facebook-connect-new/admin/templates/providers.php:39
522
+ msgid "Legacy"
523
+ msgstr ""
524
+
525
+ #: nextend-facebook-connect-new/admin/templates/providers.php:51
526
+ msgid "Upgrade Now"
527
+ msgstr ""
528
+
529
+ #: nextend-facebook-connect-new/admin/templates/providers.php:66
530
+ msgid "Test to Enable"
531
+ msgstr ""
532
+
533
+ #: nextend-facebook-connect-new/admin/templates/providers.php:74
534
+ #: nextend-facebook-connect-new/includes/provider.php:920
535
+ msgid "Enable"
536
+ msgstr "Bekapcsolás"
537
+
538
+ #: nextend-facebook-connect-new/admin/templates/providers.php:86
539
+ #: nextend-facebook-connect-new/includes/provider.php:928
540
+ msgid "Disable"
541
+ msgstr "Kikapcsolás"
542
+
543
+ #: nextend-facebook-connect-new/admin/templates/providers.php:97
544
+ msgid "Import"
545
+ msgstr ""
546
+
547
+ #: nextend-facebook-connect-new/admin/templates/providers.php:116
548
+ msgid "Saving..."
549
+ msgstr ""
550
+
551
+ #: nextend-facebook-connect-new/admin/templates/providers.php:117
552
+ msgid "Saving failed"
553
+ msgstr ""
554
+
555
+ #: nextend-facebook-connect-new/admin/templates/providers.php:118
556
+ msgid "Order Saved"
557
+ msgstr ""
558
+
559
+ #: nextend-facebook-connect-new/includes/provider.php:315
560
+ #: nextend-facebook-connect-new/includes/provider.php:534
561
+ #: nextend-facebook-connect-new/includes/provider.php:545
562
+ msgid "Authentication successful"
563
+ msgstr "Hitelesítés sikeres"
564
+
565
+ #: nextend-facebook-connect-new/includes/provider.php:363
566
+ #, php-format
567
+ msgid ""
568
+ "Your %s account is successfully linked with your account. Now you can sign "
569
+ "in with %s easily."
570
+ msgstr ""
571
+
572
+ #: nextend-facebook-connect-new/includes/provider.php:367
573
+ #, php-format
574
+ msgid ""
575
+ "This %s account is already linked with other account. Linking process failed!"
576
+ msgstr ""
577
+
578
+ #: nextend-facebook-connect-new/includes/provider.php:473
579
+ msgid "Authentication error"
580
+ msgstr "Hitelesítési hiba"
581
+
582
+ #: nextend-facebook-connect-new/includes/provider.php:482
583
+ msgid "Unlink successful."
584
+ msgstr ""
585
+
586
+ #: nextend-facebook-connect-new/includes/provider.php:751
587
+ #: nextend-facebook-connect-new/includes/provider.php:758
588
+ msgid "The test was successful"
589
+ msgstr ""
590
+
591
+ #: nextend-facebook-connect-new/includes/provider.php:798
592
+ msgid "Authentication failed"
593
+ msgstr "Hitelesítés sikertelen"
594
+
595
+ #: nextend-facebook-connect-new/includes/provider.php:869
596
+ msgid "Your configuration needs testing"
597
+ msgstr ""
598
+
599
+ #: nextend-facebook-connect-new/includes/provider.php:870
600
+ msgid ""
601
+ "Before you can start letting your users register with your app it needs to "
602
+ "be tested. This test makes sure that no users will have troubles with the "
603
+ "login and registration process. <br> If you see error message in the popup "
604
+ "check the copied ID and secret or the app itself. Otherwise your settings "
605
+ "are fine."
606
+ msgstr ""
607
+ "Mielőtt a felhasználók beléphetnének az oldaladra az appodat le kell "
608
+ "tesztelni. Ez a teszt segít abban, hogy a felhasználók gond nélkül tudjanak "
609
+ "belépni és regisztrálni az oldaladra.<br> Ha valamilyen hibaüzenetet látsz a "
610
+ "felugró ablakban, nézd meg az appodat vagy a kimásolt hitelesítő adatokat. "
611
+ "Ha nincs hibaüzenet, az azt jelenti, hogy minden rendben van."
612
+
613
+ #: nextend-facebook-connect-new/includes/provider.php:875
614
+ msgid "Test the Configuration"
615
+ msgstr ""
616
+
617
+ #: nextend-facebook-connect-new/includes/provider.php:876
618
+ #: nextend-facebook-connect-new/includes/provider.php:913
619
+ msgid "Please save your changes before testing."
620
+ msgstr ""
621
+
622
+ #: nextend-facebook-connect-new/includes/provider.php:884
623
+ msgid "Works Fine"
624
+ msgstr "Megfelelően Működik"
625
+
626
+ #: nextend-facebook-connect-new/includes/provider.php:898
627
+ #, php-format
628
+ msgid ""
629
+ "This provider is currently disabled, which means that users can’t register "
630
+ "or login via their %s account."
631
+ msgstr ""
632
+
633
+ #: nextend-facebook-connect-new/includes/provider.php:901
634
+ #, php-format
635
+ msgid ""
636
+ "This provider works fine, but you can test it again. If you don’t want to "
637
+ "let users register or login with %s anymore you can disable it."
638
+ msgstr ""
639
+
640
+ #: nextend-facebook-connect-new/includes/provider.php:904
641
+ #, php-format
642
+ msgid ""
643
+ "This provider is currently enabled, which means that users can register or "
644
+ "login via their %s account."
645
+ msgstr ""
646
+
647
+ #: nextend-facebook-connect-new/includes/provider.php:912
648
+ msgid "Test Again"
649
+ msgstr "Teszteld Újra"
650
+
651
+ #: nextend-facebook-connect-new/nextend-social-login.php:19
652
+ #, php-format
653
+ msgid ""
654
+ "%5$s plugin (version: %1$s, required: %2$s or newer) is not compatible with "
655
+ "the PRO addon (version: %3$s, required: %4$s or newer). Please upgrade to "
656
+ "the latest version! PRO addon disabled."
657
+ msgstr ""
658
+ "%5$s plugin (jelenlegi verzió %1$s, szükséges verzió: %2$s vagy újabb) nem "
659
+ "kompatibilis a Pro Kiegészítővel (jelenlegi verzió: %3$s , szükséges verzió: "
660
+ "%4$s vagy újabb). Kérlek frissítd a legújabb verzióra! A Pro Kiegészítő "
661
+ "kikapcsolva."
662
+
663
+ #: nextend-facebook-connect-new/nextend-social-login.php:245
664
+ #, php-format
665
+ msgid ""
666
+ "%s took the place of Nextend Google Connect. You can delete Nextend Google "
667
+ "Connect as it is not needed anymore."
668
+ msgstr ""
669
+ "%s átvette a Nextend Google Connect helyét. Letörölheted a Nextend Google "
670
+ "Connect plguint, mivel már nincs rá szükség."
671
+
672
+ #: nextend-facebook-connect-new/nextend-social-login.php:256
673
+ #, php-format
674
+ msgid ""
675
+ "%s took the place of Nextend Twitter Connect. You can delete Nextend Twitter "
676
+ "Connect as it is not needed anymore."
677
+ msgstr ""
678
+ "%s átvette a Nextend Twitter Connect helyét. Letörölheted a Nextend Twitter "
679
+ "Connect plguint, mivel már nincs rá szükség."
680
+
681
+ #: nextend-facebook-connect-new/nextend-social-login.php:349
682
+ msgid "You have logged in successfully."
683
+ msgstr ""
684
+
685
+ #: nextend-facebook-connect-new/nextend-social-login.php:426
686
+ msgid "Social Login"
687
+ msgstr ""
688
+
689
+ #: nextend-facebook-connect-new/providers/facebook/admin/getting-started.php:7
690
+ #: nextend-facebook-connect-new/providers/google/admin/getting-started.php:9
691
+ #: nextend-facebook-connect-new/providers/twitter/admin/getting-started.php:9
692
+ #, php-format
693
+ msgid ""
694
+ "To allow your visitors to log in with their %1$s account, first you must "
695
+ "create a %1$s App. The following guide will help you through the %1$s App "
696
+ "creation process. After you have created your %1$s App, head over to "
697
+ "\"Settings\" and configure the given \"%2$s\" and \"%3$s\" according to your "
698
+ "%1$s App."
699
+ msgstr ""
700
+
701
+ #: nextend-facebook-connect-new/providers/facebook/admin/getting-started.php:9
702
+ #: nextend-facebook-connect-new/providers/google/admin/getting-started.php:11
703
+ #: nextend-facebook-connect-new/providers/twitter/admin/getting-started.php:11
704
+ #: nextend-social-connect-pro-new/providers/linkedin/admin/getting-started.php:10
705
+ #, php-format
706
+ msgctxt "App creation"
707
+ msgid "Create %s"
708
+ msgstr "%s létrehozása"
709
+
710
+ #: nextend-facebook-connect-new/providers/facebook/admin/getting-started.php:12
711
+ #: nextend-facebook-connect-new/providers/google/admin/getting-started.php:14
712
+ #: nextend-facebook-connect-new/providers/twitter/admin/getting-started.php:14
713
+ #: nextend-social-connect-pro-new/providers/linkedin/admin/getting-started.php:13
714
+ #, php-format
715
+ msgid "Navigate to %s"
716
+ msgstr ""
717
+
718
+ #: nextend-facebook-connect-new/providers/facebook/admin/getting-started.php:13
719
+ #: nextend-facebook-connect-new/providers/google/admin/getting-started.php:15
720
+ #: nextend-facebook-connect-new/providers/twitter/admin/getting-started.php:15
721
+ #: nextend-social-connect-pro-new/providers/linkedin/admin/getting-started.php:14
722
+ #, php-format
723
+ msgid "Log in with your %s credentials if you are not logged in"
724
+ msgstr ""
725
+
726
+ #: nextend-facebook-connect-new/providers/facebook/admin/getting-started.php:14
727
+ msgid "Click on the \"Add a New App\" button"
728
+ msgstr "Kattints az \"Add a New App\" gombra"
729
+
730
+ #: nextend-facebook-connect-new/providers/facebook/admin/getting-started.php:15
731
+ msgid "Fill \"Display Name\" and \"Contact Email\""
732
+ msgstr ""
733
+ "Töltsd ki a \"Display name\" mezőt az app nevével. A \"Contact Email\" "
734
+ "mezőbe írd be az email címet, amin keresztül elérhetnek."
735
+
736
+ #: nextend-facebook-connect-new/providers/facebook/admin/getting-started.php:16
737
+ msgid "Click on blue \"Create App ID\" button"
738
+ msgstr "Kattints a kék \"Create App ID\" gombra"
739
+
740
+ #: nextend-facebook-connect-new/providers/facebook/admin/getting-started.php:17
741
+ msgid ""
742
+ "Move your mouse over Facebook Login and click on the appearing \"Set Up\" "
743
+ "button"
744
+ msgstr ""
745
+
746
+ #: nextend-facebook-connect-new/providers/facebook/admin/getting-started.php:18
747
+ msgid "Choose Web"
748
+ msgstr "Válaszd a \"Web\"-et"
749
+
750
+ #: nextend-facebook-connect-new/providers/facebook/admin/getting-started.php:19
751
+ #, php-format
752
+ msgid "Fill \"Site URL\" with the url of your homepage, probably: <b>%s</b>"
753
+ msgstr ""
754
+ "Írd be a weboldalad főoldalának címét a \"Site URL\" mezőbe. Valószínűleg ez "
755
+ "lesz az: <b>%s</b>"
756
+
757
+ #: nextend-facebook-connect-new/providers/facebook/admin/getting-started.php:20
758
+ msgid "Click on \"Save\""
759
+ msgstr "Kattints a \"Save\" gombra"
760
+
761
+ #: nextend-facebook-connect-new/providers/facebook/admin/getting-started.php:21
762
+ msgid "In the left sidebar, click on \"Facebook Login\""
763
+ msgstr ""
764
+
765
+ #: nextend-facebook-connect-new/providers/facebook/admin/getting-started.php:22
766
+ #: nextend-facebook-connect-new/providers/google/admin/getting-started.php:24
767
+ #, php-format
768
+ msgid ""
769
+ "Add the following URL to the \"Valid OAuth redirect URIs\" field: <b>%s</b>"
770
+ msgstr ""
771
+ "Tedd a következő linket az \"Valid OAuth redirect URIs\" mezőbe: <b>%s</b>"
772
+
773
+ #: nextend-facebook-connect-new/providers/facebook/admin/getting-started.php:23
774
+ msgid "Click on \"Save Changes\""
775
+ msgstr "Kattints a \"Save Changes\"-re"
776
+
777
+ #: nextend-facebook-connect-new/providers/facebook/admin/getting-started.php:24
778
+ msgid "In the top of the left sidebar, click on \"Settings\""
779
+ msgstr ""
780
+
781
+ #: nextend-facebook-connect-new/providers/facebook/admin/getting-started.php:25
782
+ msgid ""
783
+ "Here you can see your \"APP ID\" and you can see your \"App secret\" if you "
784
+ "click on the \"Show\" button. These will be needed in plugin's settings."
785
+ msgstr ""
786
+
787
+ #: nextend-facebook-connect-new/providers/facebook/admin/getting-started.php:26
788
+ msgid "Enter your domain name to the App Domains"
789
+ msgstr "Írd be a domain neved az \"App Domains\" mezőbe"
790
+
791
+ #: nextend-facebook-connect-new/providers/facebook/admin/getting-started.php:27
792
+ msgid ""
793
+ "Fill up the \"Privacy Policy URL\". Provide a publicly available and easily "
794
+ "accessible privacy policy that explains what data you are collecting and how "
795
+ "you will use that data."
796
+ msgstr ""
797
+ "Töltsd ki a \"Privacy Policy URL\" mezőt. A megadott link legyen publikus és "
798
+ "tartalmazza az adatvédelmi irányelveket, amik elmagyarázzák, milyen "
799
+ "információkat gyűjtesz és mihez kezdesz velük."
800
+
801
+ #: nextend-facebook-connect-new/providers/facebook/admin/getting-started.php:28
802
+ msgid "Save your changes"
803
+ msgstr ""
804
+
805
+ #: nextend-facebook-connect-new/providers/facebook/admin/getting-started.php:29
806
+ msgid ""
807
+ "Your application is currently private, which means that only you can log in "
808
+ "with it. In the left sidebar choose \"App Review\" and make your App public"
809
+ msgstr ""
810
+
811
+ #: nextend-facebook-connect-new/providers/facebook/admin/getting-started.php:33
812
+ #: nextend-facebook-connect-new/providers/google/admin/getting-started.php:30
813
+ #: nextend-facebook-connect-new/providers/twitter/admin/getting-started.php:25
814
+ #: nextend-social-connect-pro-new/providers/linkedin/admin/getting-started.php:27
815
+ #, php-format
816
+ msgid "I am done setting up my %s"
817
+ msgstr "Befejeztem a %s appom elkészítését"
818
+
819
+ #: nextend-facebook-connect-new/providers/facebook/admin/import.php:7
820
+ msgid "Import Facebook configuration"
821
+ msgstr ""
822
+
823
+ #: nextend-facebook-connect-new/providers/facebook/admin/import.php:8
824
+ #: nextend-facebook-connect-new/providers/google/admin/import.php:8
825
+ #: nextend-facebook-connect-new/providers/twitter/admin/import.php:8
826
+ msgid "Be sure to read the following notices before you proceed."
827
+ msgstr "Mielőtt tovább lépnél, olvasd el az alábbi figyelmeztetéseket."
828
+
829
+ #: nextend-facebook-connect-new/providers/facebook/admin/import.php:10
830
+ #: nextend-facebook-connect-new/providers/google/admin/import.php:10
831
+ #: nextend-facebook-connect-new/providers/twitter/admin/import.php:10
832
+ msgid "Important steps before the import"
833
+ msgstr ""
834
+
835
+ #: nextend-facebook-connect-new/providers/facebook/admin/import.php:11
836
+ #: nextend-facebook-connect-new/providers/google/admin/import.php:11
837
+ #: nextend-facebook-connect-new/providers/twitter/admin/import.php:11
838
+ msgid ""
839
+ "Make sure that the redirect URI for your app is correct before proceeding."
840
+ msgstr ""
841
+
842
+ #: nextend-facebook-connect-new/providers/facebook/admin/import.php:13
843
+ #: nextend-facebook-connect-new/providers/google/admin/import.php:13
844
+ #: nextend-facebook-connect-new/providers/twitter/admin/import.php:13
845
+ #, php-format
846
+ msgid "Visit %s."
847
+ msgstr ""
848
+
849
+ #: nextend-facebook-connect-new/providers/facebook/admin/import.php:14
850
+ #: nextend-facebook-connect-new/providers/twitter/admin/import.php:14
851
+ msgid "Select your app."
852
+ msgstr ""
853
+
854
+ #: nextend-facebook-connect-new/providers/facebook/admin/import.php:15
855
+ msgid ""
856
+ "Go to the Settings menu which you can find below the Facebook Login in the "
857
+ "left menu."
858
+ msgstr ""
859
+
860
+ #: nextend-facebook-connect-new/providers/facebook/admin/import.php:16
861
+ #: nextend-facebook-connect-new/providers/google/admin/import.php:16
862
+ #: nextend-facebook-connect-new/providers/twitter/admin/import.php:16
863
+ #, php-format
864
+ msgid "Make sure that the \"%1$s\" field contains %2$s"
865
+ msgstr ""
866
+
867
+ #: nextend-facebook-connect-new/providers/facebook/admin/import.php:17
868
+ #: nextend-facebook-connect-new/providers/google/admin/import.php:17
869
+ #: nextend-facebook-connect-new/providers/twitter/admin/import.php:17
870
+ msgid "Save your changes."
871
+ msgstr ""
872
+
873
+ #: nextend-facebook-connect-new/providers/facebook/admin/import.php:20
874
+ #: nextend-facebook-connect-new/providers/google/admin/import.php:20
875
+ #: nextend-facebook-connect-new/providers/twitter/admin/import.php:20
876
+ msgid "The following settings will be imported:"
877
+ msgstr ""
878
+
879
+ #: nextend-facebook-connect-new/providers/facebook/admin/import.php:22
880
+ #: nextend-facebook-connect-new/providers/google/admin/import.php:22
881
+ #: nextend-facebook-connect-new/providers/twitter/admin/import.php:22
882
+ msgid "Your old API configurations"
883
+ msgstr ""
884
+
885
+ #: nextend-facebook-connect-new/providers/facebook/admin/import.php:23
886
+ #: nextend-facebook-connect-new/providers/google/admin/import.php:23
887
+ #: nextend-facebook-connect-new/providers/twitter/admin/import.php:23
888
+ msgid "The user prefix you set"
889
+ msgstr ""
890
+
891
+ #: nextend-facebook-connect-new/providers/facebook/admin/import.php:26
892
+ #: nextend-facebook-connect-new/providers/google/admin/import.php:26
893
+ #: nextend-facebook-connect-new/providers/twitter/admin/import.php:26
894
+ msgid "Create a backup of the old settings"
895
+ msgstr ""
896
+
897
+ #: nextend-facebook-connect-new/providers/facebook/admin/import.php:29
898
+ #: nextend-facebook-connect-new/providers/google/admin/import.php:29
899
+ #: nextend-facebook-connect-new/providers/twitter/admin/import.php:29
900
+ msgid "Other changes"
901
+ msgstr ""
902
+
903
+ #: nextend-facebook-connect-new/providers/facebook/admin/import.php:31
904
+ #: nextend-facebook-connect-new/providers/google/admin/import.php:31
905
+ #: nextend-facebook-connect-new/providers/twitter/admin/import.php:31
906
+ msgid ""
907
+ "The custom redirect URI is now handled globally for all providers, so it "
908
+ "won't be imported from the previous version. Visit \"Nextend Social Login > "
909
+ "Global settings\" to set the new redirect URIs."
910
+ msgstr ""
911
+
912
+ #: nextend-facebook-connect-new/providers/facebook/admin/import.php:32
913
+ #: nextend-facebook-connect-new/providers/google/admin/import.php:32
914
+ #: nextend-facebook-connect-new/providers/twitter/admin/import.php:32
915
+ msgid ""
916
+ "The login button's layout will be changed to a new, more modern look. If you "
917
+ "used any custom buttons that won't be imported."
918
+ msgstr ""
919
+
920
+ #: nextend-facebook-connect-new/providers/facebook/admin/import.php:33
921
+ #: nextend-facebook-connect-new/providers/google/admin/import.php:33
922
+ #: nextend-facebook-connect-new/providers/twitter/admin/import.php:33
923
+ msgid ""
924
+ "The old version's PHP functions are not available anymore. This means if you "
925
+ "used any custom codes where you used these old functions, you need to remove "
926
+ "them."
927
+ msgstr ""
928
+
929
+ #: nextend-facebook-connect-new/providers/facebook/admin/import.php:35
930
+ #: nextend-facebook-connect-new/providers/google/admin/import.php:35
931
+ #: nextend-facebook-connect-new/providers/twitter/admin/import.php:35
932
+ msgid ""
933
+ "After the importing process finishes, you will need to <b>test</b> your app "
934
+ "and <b>enable</b> the provider. You can do both in the next screen."
935
+ msgstr ""
936
+ "Miután az importálási folyamat befejeződött, <b>le kell tesztelned</a> az "
937
+ "appodat majd <b>engedélyezni</a> a providert. Mindkettőt meg tudod tenni a "
938
+ "következő oldalon."
939
+
940
+ #: nextend-facebook-connect-new/providers/facebook/admin/import.php:42
941
+ #: nextend-facebook-connect-new/providers/google/admin/import.php:42
942
+ #: nextend-facebook-connect-new/providers/twitter/admin/import.php:43
943
+ msgid "Import Configuration"
944
+ msgstr ""
945
+
946
+ #: nextend-facebook-connect-new/providers/facebook/admin/settings.php:26
947
+ msgid "App ID"
948
+ msgstr "App ID"
949
+
950
+ #: nextend-facebook-connect-new/providers/facebook/admin/settings.php:27
951
+ #: nextend-facebook-connect-new/providers/facebook/admin/settings.php:39
952
+ #: nextend-facebook-connect-new/providers/google/admin/settings.php:26
953
+ #: nextend-facebook-connect-new/providers/google/admin/settings.php:39
954
+ #: nextend-facebook-connect-new/providers/twitter/admin/settings.php:26
955
+ #: nextend-social-connect-pro-new/providers/linkedin/admin/settings.php:25
956
+ #: nextend-social-connect-pro-new/providers/linkedin/admin/settings.php:37
957
+ msgid "Required"
958
+ msgstr ""
959
+
960
+ #: nextend-facebook-connect-new/providers/facebook/admin/settings.php:32
961
+ #: nextend-facebook-connect-new/providers/google/admin/settings.php:33
962
+ #: nextend-facebook-connect-new/providers/twitter/admin/settings.php:31
963
+ #: nextend-social-connect-pro-new/providers/linkedin/admin/settings.php:31
964
+ #, php-format
965
+ msgid ""
966
+ "If you are not sure what is your %s, please head over to <a href=\"%s"
967
+ "\">Getting Started</a>"
968
+ msgstr ""
969
+
970
+ #: nextend-facebook-connect-new/providers/facebook/admin/settings.php:38
971
+ msgid "App Secret"
972
+ msgstr "App Secret"
973
+
974
+ #: nextend-facebook-connect-new/providers/facebook/admin/settings.php:52
975
+ #: nextend-facebook-connect-new/providers/google/admin/settings.php:51
976
+ #: nextend-facebook-connect-new/providers/twitter/admin/settings.php:50
977
+ #: nextend-social-connect-pro-new/providers/linkedin/admin/settings.php:49
978
+ msgid "Other settings"
979
+ msgstr ""
980
+
981
+ #: nextend-facebook-connect-new/providers/facebook/admin/settings.php:57
982
+ #: nextend-facebook-connect-new/providers/google/admin/settings.php:56
983
+ #: nextend-facebook-connect-new/providers/twitter/admin/settings.php:55
984
+ #: nextend-social-connect-pro-new/providers/linkedin/admin/settings.php:54
985
+ msgid "Username prefix on register"
986
+ msgstr ""
987
+
988
+ #: nextend-facebook-connect-new/providers/facebook/facebook.php:50
989
+ msgid "Continue with <b>Facebook</b>"
990
+ msgstr "Folytatás a <b>Facebookkal</b>"
991
+
992
+ #: nextend-facebook-connect-new/providers/facebook/facebook.php:51
993
+ msgid "Link account with <b>Facebook</b>"
994
+ msgstr ""
995
+
996
+ #: nextend-facebook-connect-new/providers/facebook/facebook.php:52
997
+ msgid "Unlink account from <b>Facebook</b>"
998
+ msgstr ""
999
+
1000
+ #: nextend-facebook-connect-new/providers/facebook/facebook.php:110
1001
+ #: nextend-facebook-connect-new/providers/google/google.php:72
1002
+ #: nextend-facebook-connect-new/providers/twitter/twitter.php:73
1003
+ #: nextend-social-connect-pro-new/providers/linkedin/linkedin.php:69
1004
+ #, php-format
1005
+ msgid "The %s entered did not appear to be a valid. Please enter a valid %s."
1006
+ msgstr ""
1007
+
1008
+ #: nextend-facebook-connect-new/providers/google/admin/getting-started.php:16
1009
+ msgid ""
1010
+ "If you don't have a project yet, you'll need to create one. You can do this "
1011
+ "by clicking on the blue \"Create project\" button on the right side"
1012
+ msgstr ""
1013
+
1014
+ #: nextend-facebook-connect-new/providers/google/admin/getting-started.php:17
1015
+ msgid "Name your project and then click on the Create button"
1016
+ msgstr ""
1017
+
1018
+ #: nextend-facebook-connect-new/providers/google/admin/getting-started.php:18
1019
+ msgid "Once you have a project, you'll end up in the dashboard."
1020
+ msgstr ""
1021
+
1022
+ #: nextend-facebook-connect-new/providers/google/admin/getting-started.php:19
1023
+ msgid ""
1024
+ "Click on the \"Credentials\" in the left hand menu to create new API "
1025
+ "credentials"
1026
+ msgstr ""
1027
+ "Kattints a \"Credentials\" feliratra a bal oldali menüben hogy új API "
1028
+ "adatokat készíts"
1029
+
1030
+ #: nextend-facebook-connect-new/providers/google/admin/getting-started.php:20
1031
+ msgid ""
1032
+ "Go to the OAuth consent screen tab and enter a product name and provide the "
1033
+ "Privacy Policy URL, then click on the save button."
1034
+ msgstr ""
1035
+
1036
+ #: nextend-facebook-connect-new/providers/google/admin/getting-started.php:21
1037
+ msgid ""
1038
+ "Go back to the Credentials tab and locate the small box at the middle. Click "
1039
+ "on the blue \"Create credentials\" button. Chose the \"OAuth client ID\" "
1040
+ "from the dropdown list."
1041
+ msgstr ""
1042
+ "Menj vissza a \"Credentials\" fülre és keresd meg a kis dobozt középen. "
1043
+ "Kattints a kék \"Create credentials\" gombra. Válaszd ki az \"OAuth client ID"
1044
+ "\"-t a lenyíló listából."
1045
+
1046
+ #: nextend-facebook-connect-new/providers/google/admin/getting-started.php:22
1047
+ msgid "Your application type should be \"Web application\""
1048
+ msgstr ""
1049
+
1050
+ #: nextend-facebook-connect-new/providers/google/admin/getting-started.php:23
1051
+ msgid "Name your application"
1052
+ msgstr ""
1053
+
1054
+ #: nextend-facebook-connect-new/providers/google/admin/getting-started.php:25
1055
+ msgid "Click on the Create button"
1056
+ msgstr "Kattints a \"Create\" gombra"
1057
+
1058
+ #: nextend-facebook-connect-new/providers/google/admin/getting-started.php:26
1059
+ msgid ""
1060
+ "A modal should pop up with your credentials. If that doesn't happen, go to "
1061
+ "the Credentials in the left hand menu and select your app by clicking on its "
1062
+ "name and you'll be able to copy-paste the Client ID and Client Secret from "
1063
+ "there."
1064
+ msgstr ""
1065
+ "Fel fog ugrani egy ablak a hitelesítő adataiddal. Ha ez nem történik meg, "
1066
+ "menj a \"Credentials\" fülre a bal oldali menüben és választ ki az appodat a "
1067
+ "nevére kattintva. Innen ki tudod másolni a Client ID-t és Client Secretet."
1068
+
1069
+ #: nextend-facebook-connect-new/providers/google/admin/import.php:7
1070
+ msgid "Import Google configuration"
1071
+ msgstr ""
1072
+
1073
+ #: nextend-facebook-connect-new/providers/google/admin/import.php:14
1074
+ msgid "If you have more projects, select the one where your app is."
1075
+ msgstr ""
1076
+
1077
+ #: nextend-facebook-connect-new/providers/google/admin/import.php:15
1078
+ msgid "Click on Credentials at the left-hand menu then select your app."
1079
+ msgstr ""
1080
+ "Kattints a \"Credentials\" feliratra a bal oldali menüben majd válaszd ki az "
1081
+ "appodat."
1082
+
1083
+ #: nextend-facebook-connect-new/providers/google/admin/settings.php:25
1084
+ #: nextend-social-connect-pro-new/providers/linkedin/admin/settings.php:24
1085
+ msgid "Client ID"
1086
+ msgstr "Client ID"
1087
+
1088
+ #: nextend-facebook-connect-new/providers/google/admin/settings.php:38
1089
+ #: nextend-social-connect-pro-new/providers/linkedin/admin/settings.php:36
1090
+ msgid "Client Secret"
1091
+ msgstr "Client Secret"
1092
+
1093
+ #: nextend-facebook-connect-new/providers/google/google.php:39
1094
+ msgid "Continue with <b>Google</b>"
1095
+ msgstr "Folytatás a <b>Google-el</b>"
1096
+
1097
+ #: nextend-facebook-connect-new/providers/google/google.php:40
1098
+ msgid "Link account with <b>Google</b>"
1099
+ msgstr ""
1100
+
1101
+ #: nextend-facebook-connect-new/providers/google/google.php:41
1102
+ msgid "Unlink account from <b>Google</b>"
1103
+ msgstr ""
1104
+
1105
+ #: nextend-facebook-connect-new/providers/twitter/admin/getting-started.php:16
1106
+ msgid "Click on the \"Create New App\" button"
1107
+ msgstr "Kattints a \"Create New App\" gombra"
1108
+
1109
+ #: nextend-facebook-connect-new/providers/twitter/admin/getting-started.php:17
1110
+ #, php-format
1111
+ msgid ""
1112
+ "Fill the name and description fields. Then enter your site's URL to the "
1113
+ "Website field: <b>%s</b>"
1114
+ msgstr ""
1115
+ "Írd be az appod nevét a \"name\" és a leírását a \"description\" mezőbe. "
1116
+ "Aztán írd be az oldalad címét a Website mezőbe: <b>%s</b>"
1117
+
1118
+ #: nextend-facebook-connect-new/providers/twitter/admin/getting-started.php:18
1119
+ #, php-format
1120
+ msgid "Add the following URL to the \"Callback URL\" field: <b>%s</b>"
1121
+ msgstr "Tedd a következő linket az \"Callback URL\" mezőbe: <b>%s</b>"
1122
+
1123
+ #: nextend-facebook-connect-new/providers/twitter/admin/getting-started.php:19
1124
+ msgid "Accept the Twitter Developer Agreement"
1125
+ msgstr "Fogadd el a Twitter Fejlesztői Megállapodást"
1126
+
1127
+ #: nextend-facebook-connect-new/providers/twitter/admin/getting-started.php:20
1128
+ msgid ""
1129
+ "Create your application by clicking on the Create your Twitter application "
1130
+ "button"
1131
+ msgstr ""
1132
+ "Hozd létre az alkalmazásodat a \"Create your Twitter application\" gombra "
1133
+ "kattintva"
1134
+
1135
+ #: nextend-facebook-connect-new/providers/twitter/admin/getting-started.php:21
1136
+ msgid ""
1137
+ "Go to the Keys and Access Tokens tab and find the Consumer Key and Secret"
1138
+ msgstr ""
1139
+
1140
+ #: nextend-facebook-connect-new/providers/twitter/admin/import.php:7
1141
+ msgid "Import Twitter configuration"
1142
+ msgstr ""
1143
+
1144
+ #: nextend-facebook-connect-new/providers/twitter/admin/import.php:15
1145
+ msgid "Go to the Settings tab."
1146
+ msgstr ""
1147
+
1148
+ #: nextend-facebook-connect-new/providers/twitter/admin/settings.php:25
1149
+ msgid "Consumer Key"
1150
+ msgstr "Consumer Key"
1151
+
1152
+ #: nextend-facebook-connect-new/providers/twitter/admin/settings.php:36
1153
+ msgid "Consumer Secret"
1154
+ msgstr "Consumer Secret"
1155
+
1156
+ #: nextend-facebook-connect-new/providers/twitter/twitter.php:40
1157
+ msgid "Continue with <b>Twitter</b>"
1158
+ msgstr "Folytatás a <b>Twitterrel</b>"
1159
+
1160
+ #: nextend-facebook-connect-new/providers/twitter/twitter.php:41
1161
+ msgid "Link account with <b>Twitter</b>"
1162
+ msgstr ""
1163
+
1164
+ #: nextend-facebook-connect-new/providers/twitter/twitter.php:42
1165
+ msgid "Unlink account from <b>Twitter</b>"
1166
+ msgstr ""
1167
+
1168
+ #: nextend-facebook-connect-new/providers/twitter/twitter.php:153
1169
+ #: nextend-facebook-connect-new/providers/twitter/twitter.php:155
1170
+ #: nextend-facebook-connect-new/providers/twitter/twitter.php:158
1171
+ #: nextend-social-connect-pro-new/class-provider-extension.php:142
1172
+ #: nextend-social-connect-pro-new/class-provider-extension.php:144
1173
+ #: nextend-social-connect-pro-new/class-provider-extension.php:147
1174
+ #: nextend-social-connect-pro-new/class-provider-extension.php:153
1175
+ #: nextend-social-connect-pro-new/class-provider-extension.php:166
1176
+ #: nextend-social-connect-pro-new/class-provider-extension.php:168
1177
+ #: nextend-social-connect-pro-new/class-provider-extension.php:171
1178
+ msgid "ERROR"
1179
+ msgstr "HIBA"
1180
+
1181
+ #: nextend-facebook-connect-new/providers/twitter/twitter.php:153
1182
+ #: nextend-social-connect-pro-new/class-provider-extension.php:166
1183
+ msgid "Please enter an email address."
1184
+ msgstr ""
1185
+
1186
+ #: nextend-facebook-connect-new/providers/twitter/twitter.php:155
1187
+ #: nextend-social-connect-pro-new/class-provider-extension.php:168
1188
+ msgid "The email address isn&#8217;t correct."
1189
+ msgstr ""
1190
+
1191
+ #: nextend-facebook-connect-new/providers/twitter/twitter.php:158
1192
+ #: nextend-social-connect-pro-new/class-provider-extension.php:171
1193
+ msgid "This email is already registered, please choose another one."
1194
+ msgstr ""
1195
+
1196
+ #: nextend-facebook-connect-new/providers/twitter/twitter.php:167
1197
+ #: nextend-social-connect-pro-new/class-provider-extension.php:183
1198
+ msgid "Registration Form"
1199
+ msgstr ""
1200
+
1201
+ #: nextend-facebook-connect-new/providers/twitter/twitter.php:167
1202
+ #: nextend-social-connect-pro-new/class-provider-extension.php:183
1203
+ msgid "Register For This Site!"
1204
+ msgstr ""
1205
+
1206
+ #: nextend-facebook-connect-new/providers/twitter/twitter.php:173
1207
+ #: nextend-social-connect-pro-new/class-provider-extension.php:197
1208
+ msgid "Email"
1209
+ msgstr "Email"
1210
+
1211
+ #: nextend-facebook-connect-new/providers/twitter/twitter.php:177
1212
+ #: nextend-social-connect-pro-new/class-provider-extension.php:202
1213
+ msgid "Registration confirmation will be emailed to you."
1214
+ msgstr ""
1215
+
1216
+ #: nextend-facebook-connect-new/providers/twitter/twitter.php:181
1217
+ #: nextend-social-connect-pro-new/class-provider-extension.php:206
1218
+ msgid "Register"
1219
+ msgstr ""
1220
+
1221
+ #: nextend-facebook-connect-new/widget.php:10
1222
+ #, php-format
1223
+ msgid "%s Buttons"
1224
+ msgstr "%s Gombok"
1225
+
1226
+ #: nextend-facebook-connect-new/widget.php:22
1227
+ msgid "Title:"
1228
+ msgstr ""
1229
+
1230
+ #: nextend-facebook-connect-new/widget.php:30
1231
+ msgid "Button style:"
1232
+ msgstr "Gomb stílus:"
1233
+
1234
+ #: nextend-social-connect-pro-new/class-provider-extension.php:78
1235
+ msgid "Social login is not allowed with this role!"
1236
+ msgstr ""
1237
+
1238
+ #: nextend-social-connect-pro-new/class-provider-extension.php:142
1239
+ msgid "Please enter a username."
1240
+ msgstr ""
1241
+
1242
+ #: nextend-social-connect-pro-new/class-provider-extension.php:144
1243
+ msgid ""
1244
+ "This username is invalid because it uses illegal characters. Please enter a "
1245
+ "valid username."
1246
+ msgstr ""
1247
+
1248
+ #: nextend-social-connect-pro-new/class-provider-extension.php:147
1249
+ msgid "This username is already registered. Please choose another one."
1250
+ msgstr ""
1251
+
1252
+ #: nextend-social-connect-pro-new/class-provider-extension.php:153
1253
+ msgid "Sorry, that username is not allowed."
1254
+ msgstr ""
1255
+
1256
+ #: nextend-social-connect-pro-new/class-provider-extension.php:190
1257
+ msgid "Username"
1258
+ msgstr ""
1259
+
1260
+ #: nextend-social-connect-pro-new/class-provider-extension.php:218
1261
+ msgid ""
1262
+ "This email is already registered, please login in to your account to link "
1263
+ "with Facebook."
1264
+ msgstr ""
1265
+
1266
+ #: nextend-social-connect-pro-new/providers/linkedin/admin/getting-started.php:8
1267
+ #, php-format
1268
+ msgid ""
1269
+ "To allow your visitors to log in with their %1$s account, first you must "
1270
+ "create a %1$s App. The following guide will help you through the %1$s App "
1271
+ "creation process. After you created your %1$s App, head over to \"Settings\" "
1272
+ "and configure the given \"%2$s\" and \"%3$s\" according to your %1$s App."
1273
+ msgstr ""
1274
+
1275
+ #: nextend-social-connect-pro-new/providers/linkedin/admin/getting-started.php:15
1276
+ msgid "Locate the yellow \"Create application\" button and click on it."
1277
+ msgstr ""
1278
+
1279
+ #: nextend-social-connect-pro-new/providers/linkedin/admin/getting-started.php:16
1280
+ msgid "Fill the fields marked with *"
1281
+ msgstr "Töltsd ki a csillaggal jelölt mezőket"
1282
+
1283
+ #: nextend-social-connect-pro-new/providers/linkedin/admin/getting-started.php:17
1284
+ #, php-format
1285
+ msgid "Fill \"Website URL\" with the url of your homepage, probably: <b>%s</b>"
1286
+ msgstr ""
1287
+ "Írd be a weboldalad főoldalának címét a \"Website URL\" mezőbe. "
1288
+ "Valószínűleg ez lesz az: <b>%s</b>"
1289
+
1290
+ #: nextend-social-connect-pro-new/providers/linkedin/admin/getting-started.php:19
1291
+ msgid "Accept the Terms of use and hit Submit"
1292
+ msgstr ""
1293
+ "Fogadd el a Felhasználási Feltétleket és kattints a Beküldés (Submit) gombra"
1294
+
1295
+ #: nextend-social-connect-pro-new/providers/linkedin/admin/getting-started.php:20
1296
+ msgid "Find the necessary Authentication Keys under the Authentication menu"
1297
+ msgstr ""
1298
+ "A szükséges \"Authentication Keys\"-t az Authentication menüben találod"
1299
+
1300
+ #: nextend-social-connect-pro-new/providers/linkedin/admin/getting-started.php:21
1301
+ #, php-format
1302
+ msgid ""
1303
+ "Add the following URL to the \"Authorized Redirect URLs:\" field: <b>%s</b>"
1304
+ msgstr ""
1305
+ "Tedd a következő linket az \"Authorized Redirect URLs:\" mezőbe: <b>%s</b>"
1306
+
1307
+ #: nextend-social-connect-pro-new/providers/linkedin/admin/getting-started.php:22
1308
+ msgid ""
1309
+ "You probably want to enable the \"r_emailaddress\" under the Default "
1310
+ "Application Permissions"
1311
+ msgstr ""
1312
+
1313
+ #: nextend-social-connect-pro-new/providers/linkedin/admin/getting-started.php:23
1314
+ msgid "Hit update to save the changes"
1315
+ msgstr ""
1316
+
1317
+ #: nextend-social-connect-pro-new/providers/linkedin/linkedin.php:35
1318
+ msgid "Continue with <b>LinkedIn</b>"
1319
+ msgstr "Folytatás a <b>LinkedInnel</b>"
1320
+
1321
+ #: nextend-social-connect-pro-new/providers/linkedin/linkedin.php:36
1322
+ msgid "Link account with <b>LinkedIn</b>"
1323
+ msgstr ""
1324
+
1325
+ #: nextend-social-connect-pro-new/providers/linkedin/linkedin.php:37
1326
+ msgid "Unlink account from <b>LinkedIn</b>"
1327
+ msgstr ""
1328
+
1329
+ #: nextend-social-connect-pro-new/template-parts/login-layout-above-separator.php:9
1330
+ #: nextend-social-connect-pro-new/template-parts/login-layout-below-separator.php:9
1331
+ msgid "OR"
1332
+ msgstr ""
1333
+
1334
+ #: nextend-social-connect-pro-new/template-parts/woocommerce-edit-account-after.php:1
1335
+ #: nextend-social-connect-pro-new/template-parts/woocommerce-edit-account-before.php:1
1336
+ msgid "Social accounts"
1337
+ msgstr ""
1338
+
1339
+ #~ msgctxt "App creation"
1340
+ #~ msgid "Create %"
1341
+ #~ msgstr "%s"
languages/nextend-facebook-connect.mo ADDED
Binary file
languages/nextend-facebook-connect.po ADDED
@@ -0,0 +1,1293 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: ss3\n"
4
+ "POT-Creation-Date: 2018-02-20 09:24+0100\n"
5
+ "PO-Revision-Date: 2018-02-20 09:24+0100\n"
6
+ "Last-Translator: \n"
7
+ "Language-Team: \n"
8
+ "Language: hu\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Generator: Poedit 2.0.6\n"
13
+ "X-Poedit-Basepath: Z:/ramona/wordpress4_2_2/wp-content/plugins\n"
14
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
15
+ "X-Poedit-SourceCharset: UTF-8\n"
16
+ "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
17
+ "_n_noop:1,2;_c;_nc:4c,1,2;_x:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;_ex:1,2c;"
18
+ "esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;"
19
+ "esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_x:1,2c;esc_html_e\n"
20
+ "X-Poedit-SearchPath-0: nextend-social-connect-pro-new\n"
21
+ "X-Poedit-SearchPath-1: nextend-facebook-connect-new\n"
22
+ "X-Poedit-SearchPathExcluded-0: nextend-facebook-connect-new/providers/"
23
+ "twitter/compat\n"
24
+ "X-Poedit-SearchPathExcluded-1: nextend-facebook-connect-new/providers/google/"
25
+ "compat\n"
26
+ "X-Poedit-SearchPathExcluded-2: nextend-facebook-connect-new/providers/"
27
+ "facebook/compat\n"
28
+
29
+ #: nextend-facebook-connect-new/admin/admin.php:133
30
+ #, php-format
31
+ msgid "%s needs the CURL PHP extension."
32
+ msgstr ""
33
+
34
+ #: nextend-facebook-connect-new/admin/admin.php:133
35
+ #: nextend-facebook-connect-new/admin/admin.php:138
36
+ #: nextend-facebook-connect-new/admin/admin.php:148
37
+ msgid "Please contact your server administrator and ask for solution!"
38
+ msgstr ""
39
+
40
+ #: nextend-facebook-connect-new/admin/admin.php:138
41
+ msgid "Https protocol is not supported or disabled in CURL."
42
+ msgstr ""
43
+
44
+ #: nextend-facebook-connect-new/admin/admin.php:148
45
+ #, php-format
46
+ msgid "%s needs json_decode function."
47
+ msgstr ""
48
+
49
+ #: nextend-facebook-connect-new/admin/admin.php:166
50
+ #: nextend-facebook-connect-new/admin/admin.php:206
51
+ msgid "Settings saved."
52
+ msgstr ""
53
+
54
+ #: nextend-facebook-connect-new/admin/admin.php:174
55
+ msgid "The authorization was successful"
56
+ msgstr ""
57
+
58
+ #: nextend-facebook-connect-new/admin/admin.php:185
59
+ msgid "Deauthorize completed."
60
+ msgstr ""
61
+
62
+ #: nextend-facebook-connect-new/admin/admin.php:297
63
+ #: nextend-facebook-connect-new/admin/templates-provider/menu.php:10
64
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:95
65
+ #: nextend-facebook-connect-new/admin/templates/providers.php:78
66
+ #: nextend-facebook-connect-new/admin/templates/providers.php:90
67
+ msgid "Settings"
68
+ msgstr ""
69
+
70
+ #: nextend-facebook-connect-new/admin/templates-provider/buttons.php:72
71
+ msgid "Login label"
72
+ msgstr ""
73
+
74
+ #: nextend-facebook-connect-new/admin/templates-provider/buttons.php:77
75
+ #: nextend-facebook-connect-new/admin/templates-provider/buttons.php:88
76
+ #: nextend-facebook-connect-new/admin/templates-provider/buttons.php:99
77
+ #: nextend-facebook-connect-new/admin/templates-provider/buttons.php:128
78
+ #: nextend-facebook-connect-new/admin/templates-provider/buttons.php:158
79
+ msgid "Reset to default"
80
+ msgstr ""
81
+
82
+ #: nextend-facebook-connect-new/admin/templates-provider/buttons.php:82
83
+ msgid "Link label"
84
+ msgstr ""
85
+
86
+ #: nextend-facebook-connect-new/admin/templates-provider/buttons.php:94
87
+ msgid "Unlink label"
88
+ msgstr ""
89
+
90
+ #: nextend-facebook-connect-new/admin/templates-provider/buttons.php:105
91
+ msgid "Default button"
92
+ msgstr ""
93
+
94
+ #: nextend-facebook-connect-new/admin/templates-provider/buttons.php:121
95
+ #: nextend-facebook-connect-new/admin/templates-provider/buttons.php:151
96
+ msgid "Use custom button"
97
+ msgstr ""
98
+
99
+ #: nextend-facebook-connect-new/admin/templates-provider/buttons.php:128
100
+ #, php-format
101
+ msgid "Use the %s in your custom button's code to make the label show up."
102
+ msgstr ""
103
+
104
+ #: nextend-facebook-connect-new/admin/templates-provider/buttons.php:136
105
+ msgid "Icon button"
106
+ msgstr ""
107
+
108
+ #: nextend-facebook-connect-new/admin/templates-provider/buttons.php:167
109
+ #: nextend-facebook-connect-new/admin/templates-provider/settings-pro.php:122
110
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:208
111
+ #: nextend-facebook-connect-new/admin/templates/global-settings.php:103
112
+ #: nextend-facebook-connect-new/providers/facebook/admin/settings.php:48
113
+ #: nextend-facebook-connect-new/providers/google/admin/settings.php:47
114
+ #: nextend-facebook-connect-new/providers/twitter/admin/settings.php:46
115
+ #: nextend-social-connect-pro-new/providers/linkedin/admin/settings.php:45
116
+ msgid "Save Changes"
117
+ msgstr ""
118
+
119
+ #: nextend-facebook-connect-new/admin/templates-provider/menu.php:8
120
+ #: nextend-facebook-connect-new/admin/templates/providers.php:58
121
+ #: nextend-facebook-connect-new/providers/google/admin/getting-started.php:7
122
+ #: nextend-facebook-connect-new/providers/twitter/admin/getting-started.php:7
123
+ #: nextend-social-connect-pro-new/providers/linkedin/admin/getting-started.php:6
124
+ msgid "Getting Started"
125
+ msgstr ""
126
+
127
+ #: nextend-facebook-connect-new/admin/templates-provider/menu.php:12
128
+ msgid "Buttons"
129
+ msgstr ""
130
+
131
+ #: nextend-facebook-connect-new/admin/templates-provider/menu.php:14
132
+ msgid "Usage"
133
+ msgstr ""
134
+
135
+ #: nextend-facebook-connect-new/admin/templates-provider/settings-pro.php:16
136
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:14
137
+ msgid "PRO settings"
138
+ msgstr ""
139
+
140
+ #: nextend-facebook-connect-new/admin/templates-provider/settings-pro.php:26
141
+ #: nextend-facebook-connect-new/admin/templates-provider/settings-pro.php:30
142
+ msgid "Ask E-mail on registration"
143
+ msgstr ""
144
+
145
+ #: nextend-facebook-connect-new/admin/templates-provider/settings-pro.php:33
146
+ msgid "Never"
147
+ msgstr ""
148
+
149
+ #: nextend-facebook-connect-new/admin/templates-provider/settings-pro.php:36
150
+ msgid "When email is not provided or empty"
151
+ msgstr ""
152
+
153
+ #: nextend-facebook-connect-new/admin/templates-provider/settings-pro.php:39
154
+ #: nextend-facebook-connect-new/admin/templates-provider/settings-pro.php:54
155
+ msgid "Always"
156
+ msgstr ""
157
+
158
+ #: nextend-facebook-connect-new/admin/templates-provider/settings-pro.php:44
159
+ #: nextend-facebook-connect-new/admin/templates-provider/settings-pro.php:48
160
+ msgid "Ask Username on registration"
161
+ msgstr ""
162
+
163
+ #: nextend-facebook-connect-new/admin/templates-provider/settings-pro.php:51
164
+ msgid "Never, generate automatically"
165
+ msgstr ""
166
+
167
+ #: nextend-facebook-connect-new/admin/templates-provider/settings-pro.php:59
168
+ #: nextend-facebook-connect-new/admin/templates-provider/settings-pro.php:63
169
+ msgid "Automatically connect the existing account upon registration"
170
+ msgstr ""
171
+
172
+ #: nextend-facebook-connect-new/admin/templates-provider/settings-pro.php:67
173
+ #: nextend-facebook-connect-new/admin/templates/global-settings.php:50
174
+ #: nextend-facebook-connect-new/admin/templates/providers.php:33
175
+ #: nextend-facebook-connect-new/includes/provider.php:888
176
+ msgid "Disabled"
177
+ msgstr ""
178
+
179
+ #: nextend-facebook-connect-new/admin/templates-provider/settings-pro.php:70
180
+ msgid "Automatic, based on email address"
181
+ msgstr ""
182
+
183
+ #: nextend-facebook-connect-new/admin/templates-provider/settings-pro.php:75
184
+ msgid "Disable login for the selected roles"
185
+ msgstr ""
186
+
187
+ #: nextend-facebook-connect-new/admin/templates-provider/settings-pro.php:95
188
+ msgid "Default roles for user who registered with this provider"
189
+ msgstr ""
190
+
191
+ #: nextend-facebook-connect-new/admin/templates-provider/settings-pro.php:103
192
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:31
193
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:107
194
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:192
195
+ #: nextend-facebook-connect-new/widget.php:34
196
+ msgid "Default"
197
+ msgstr ""
198
+
199
+ #: nextend-facebook-connect-new/admin/templates-provider/usage.php:7
200
+ msgid "Shortcode"
201
+ msgstr ""
202
+
203
+ #: nextend-facebook-connect-new/admin/templates-provider/usage.php:21
204
+ msgid "Simple link"
205
+ msgstr ""
206
+
207
+ #: nextend-facebook-connect-new/admin/templates-provider/usage.php:24
208
+ msgid "Click here to login or register"
209
+ msgstr ""
210
+
211
+ #: nextend-facebook-connect-new/admin/templates-provider/usage.php:29
212
+ msgid "Image button"
213
+ msgstr ""
214
+
215
+ #: nextend-facebook-connect-new/admin/templates-provider/usage.php:32
216
+ msgid "Image url"
217
+ msgstr ""
218
+
219
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:23
220
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:27
221
+ msgid "Login form button style"
222
+ msgstr ""
223
+
224
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:37
225
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:113
226
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:198
227
+ #: nextend-facebook-connect-new/widget.php:39
228
+ msgid "Icon"
229
+ msgstr ""
230
+
231
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:44
232
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:48
233
+ msgid "Login layout"
234
+ msgstr ""
235
+
236
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:52
237
+ msgid "Below"
238
+ msgstr ""
239
+
240
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:58
241
+ msgid "Below with separator"
242
+ msgstr ""
243
+
244
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:64
245
+ msgid "Below and floating"
246
+ msgstr ""
247
+
248
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:70
249
+ msgid "Above"
250
+ msgstr ""
251
+
252
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:76
253
+ msgid "Above with separator"
254
+ msgstr ""
255
+
256
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:83
257
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:87
258
+ msgid "Comment login button"
259
+ msgstr ""
260
+
261
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:90
262
+ msgid "Show"
263
+ msgstr ""
264
+
265
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:93
266
+ msgid "Hide"
267
+ msgstr ""
268
+
269
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:95
270
+ #, php-format
271
+ msgid "You need to turn on the ' %1$s > %2$s > %3$s ' for this feature to work"
272
+ msgstr ""
273
+
274
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:95
275
+ msgid "Discussion"
276
+ msgstr ""
277
+
278
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:95
279
+ msgid "Users must be registered and logged in to comment"
280
+ msgstr ""
281
+
282
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:99
283
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:103
284
+ msgid "Comment button style"
285
+ msgstr ""
286
+
287
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:120
288
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:124
289
+ msgid "WooCommerce login form"
290
+ msgstr ""
291
+
292
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:127
293
+ msgid "No Connect button in login form"
294
+ msgstr ""
295
+
296
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:130
297
+ msgid "Connect button before login form"
298
+ msgstr ""
299
+
300
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:131
301
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:136
302
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:154
303
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:159
304
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:173
305
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:178
306
+ msgid "Action:"
307
+ msgstr ""
308
+
309
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:135
310
+ msgid "Connect button after login form"
311
+ msgstr ""
312
+
313
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:143
314
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:147
315
+ msgid "WooCommerce billing form"
316
+ msgstr ""
317
+
318
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:150
319
+ msgid "No Connect button in billing form"
320
+ msgstr ""
321
+
322
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:153
323
+ msgid "Connect button before billing form"
324
+ msgstr ""
325
+
326
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:158
327
+ msgid "Connect button after billing form"
328
+ msgstr ""
329
+
330
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:165
331
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:169
332
+ msgid "WooCommerce account details"
333
+ msgstr ""
334
+
335
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:172
336
+ msgid "Link buttons before account details"
337
+ msgstr ""
338
+
339
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:177
340
+ msgid "Link buttons after account details"
341
+ msgstr ""
342
+
343
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:184
344
+ #: nextend-facebook-connect-new/admin/templates/global-settings-pro.php:188
345
+ msgid "WooCommerce button style"
346
+ msgstr ""
347
+
348
+ #: nextend-facebook-connect-new/admin/templates/global-settings.php:43
349
+ #: nextend-facebook-connect-new/admin/templates/global-settings.php:47
350
+ msgid "Debug mode"
351
+ msgstr ""
352
+
353
+ #: nextend-facebook-connect-new/admin/templates/global-settings.php:53
354
+ #: nextend-facebook-connect-new/admin/templates/providers.php:36
355
+ #: nextend-facebook-connect-new/includes/provider.php:891
356
+ msgid "Enabled"
357
+ msgstr ""
358
+
359
+ #: nextend-facebook-connect-new/admin/templates/global-settings.php:59
360
+ msgid "Fixed redirect url for login"
361
+ msgstr ""
362
+
363
+ #: nextend-facebook-connect-new/admin/templates/global-settings.php:72
364
+ #: nextend-facebook-connect-new/admin/templates/global-settings.php:93
365
+ msgid "Use custom"
366
+ msgstr ""
367
+
368
+ #: nextend-facebook-connect-new/admin/templates/global-settings.php:80
369
+ msgid "Fixed redirect url for register"
370
+ msgstr ""
371
+
372
+ #: nextend-facebook-connect-new/admin/templates/header.php:14
373
+ msgid "Docs"
374
+ msgstr ""
375
+
376
+ #: nextend-facebook-connect-new/admin/templates/header.php:17
377
+ msgid "Support"
378
+ msgstr ""
379
+
380
+ #: nextend-facebook-connect-new/admin/templates/header.php:20
381
+ #: nextend-facebook-connect-new/admin/templates/menu.php:12
382
+ msgid "Pro Addon"
383
+ msgstr ""
384
+
385
+ #: nextend-facebook-connect-new/admin/templates/menu.php:6
386
+ msgid "Providers"
387
+ msgstr ""
388
+
389
+ #: nextend-facebook-connect-new/admin/templates/menu.php:8
390
+ msgid "Global Settings"
391
+ msgstr ""
392
+
393
+ #: nextend-facebook-connect-new/admin/templates/pro-addon.php:13
394
+ msgid "Error"
395
+ msgstr ""
396
+
397
+ #: nextend-facebook-connect-new/admin/templates/pro-addon.php:14
398
+ msgid ""
399
+ "You don’t have sufficient permissions to install and activate plugins. "
400
+ "Please contact your site’s administrator!"
401
+ msgstr ""
402
+
403
+ #: nextend-facebook-connect-new/admin/templates/pro-addon.php:22
404
+ #: nextend-facebook-connect-new/admin/templates/pro-addon.php:32
405
+ #: nextend-facebook-connect-new/admin/templates/pro.php:34
406
+ msgid "Activate Pro Addon"
407
+ msgstr ""
408
+
409
+ #: nextend-facebook-connect-new/admin/templates/pro-addon.php:23
410
+ msgid ""
411
+ "Pro Addon is installed but not activated. To be able to use the Pro "
412
+ "features, you need to activate it."
413
+ msgstr ""
414
+
415
+ #: nextend-facebook-connect-new/admin/templates/pro-addon.php:37
416
+ #: nextend-facebook-connect-new/admin/templates/pro-addon.php:215
417
+ msgid "Deauthorize Pro Addon"
418
+ msgstr ""
419
+
420
+ #: nextend-facebook-connect-new/admin/templates/pro-addon.php:48
421
+ #: nextend-facebook-connect-new/admin/templates/pro.php:43
422
+ msgid "Pro Addon is not installed"
423
+ msgstr ""
424
+
425
+ #: nextend-facebook-connect-new/admin/templates/pro-addon.php:50
426
+ msgid ""
427
+ "To access the Pro features, you need to install and activate the Pro Addon."
428
+ msgstr ""
429
+
430
+ #: nextend-facebook-connect-new/admin/templates/pro-addon.php:59
431
+ #, php-format
432
+ msgid "Install %s now"
433
+ msgstr ""
434
+
435
+ #: nextend-facebook-connect-new/admin/templates/pro-addon.php:60
436
+ #: nextend-facebook-connect-new/admin/templates/pro.php:47
437
+ msgid "Install Pro Addon"
438
+ msgstr ""
439
+
440
+ #: nextend-facebook-connect-new/admin/templates/pro-addon.php:94
441
+ msgid "Activating..."
442
+ msgstr ""
443
+
444
+ #: nextend-facebook-connect-new/admin/templates/pro-addon.php:126
445
+ msgid "Authorize your Pro Addon"
446
+ msgstr ""
447
+
448
+ #: nextend-facebook-connect-new/admin/templates/pro-addon.php:127
449
+ msgid ""
450
+ "To be able to use the Pro features, you need to authorize Nextend Social "
451
+ "Connect Pro Addon. You can do this by clicking on the Authorize button below "
452
+ "then select the related purchase."
453
+ msgstr ""
454
+
455
+ #: nextend-facebook-connect-new/admin/templates/pro-addon.php:132
456
+ msgid "Authorize"
457
+ msgstr ""
458
+
459
+ #: nextend-facebook-connect-new/admin/templates/pro-addon.php:189
460
+ msgid "License key"
461
+ msgstr ""
462
+
463
+ #: nextend-facebook-connect-new/admin/templates/pro-addon.php:206
464
+ msgid "Pro Addon is installed and activated"
465
+ msgstr ""
466
+
467
+ #: nextend-facebook-connect-new/admin/templates/pro-addon.php:208
468
+ msgid ""
469
+ "You installed and activated the Pro Addon. If you don’t want to use it "
470
+ "anymore, you can deauthorize using the button below."
471
+ msgstr ""
472
+
473
+ #: nextend-facebook-connect-new/admin/templates/pro.php:8
474
+ msgid "Get Pro Addon to unlock more features"
475
+ msgstr ""
476
+
477
+ #: nextend-facebook-connect-new/admin/templates/pro.php:9
478
+ msgid ""
479
+ "The features below are available in Nextend Social Login Pro Addon. Get it "
480
+ "today and tweak the awesome settings."
481
+ msgstr ""
482
+
483
+ #: nextend-facebook-connect-new/admin/templates/pro.php:10
484
+ msgid ""
485
+ "If you already have a license, you can Authorize your Pro Addon. Otherwise "
486
+ "you can purchase it using the button below."
487
+ msgstr ""
488
+
489
+ #: nextend-facebook-connect-new/admin/templates/pro.php:14
490
+ msgid "Buy Pro Addon"
491
+ msgstr ""
492
+
493
+ #: nextend-facebook-connect-new/admin/templates/pro.php:16
494
+ msgid "Authorize Pro Addon"
495
+ msgstr ""
496
+
497
+ #: nextend-facebook-connect-new/admin/templates/pro.php:25
498
+ msgid "Pro Addon is not activated"
499
+ msgstr ""
500
+
501
+ #: nextend-facebook-connect-new/admin/templates/pro.php:26
502
+ #: nextend-facebook-connect-new/admin/templates/pro.php:44
503
+ msgid ""
504
+ "To be able to use the Pro features, you need to install and activate the "
505
+ "Nextend Social Connect Pro Addon."
506
+ msgstr ""
507
+
508
+ #: nextend-facebook-connect-new/admin/templates/providers.php:24
509
+ msgid "Not Available"
510
+ msgstr ""
511
+
512
+ #: nextend-facebook-connect-new/admin/templates/providers.php:27
513
+ msgid "Not Configured"
514
+ msgstr ""
515
+
516
+ #: nextend-facebook-connect-new/admin/templates/providers.php:30
517
+ msgid "Not Tested"
518
+ msgstr ""
519
+
520
+ #: nextend-facebook-connect-new/admin/templates/providers.php:39
521
+ msgid "Legacy"
522
+ msgstr ""
523
+
524
+ #: nextend-facebook-connect-new/admin/templates/providers.php:51
525
+ msgid "Upgrade Now"
526
+ msgstr ""
527
+
528
+ #: nextend-facebook-connect-new/admin/templates/providers.php:66
529
+ msgid "Test to Enable"
530
+ msgstr ""
531
+
532
+ #: nextend-facebook-connect-new/admin/templates/providers.php:74
533
+ #: nextend-facebook-connect-new/includes/provider.php:920
534
+ msgid "Enable"
535
+ msgstr ""
536
+
537
+ #: nextend-facebook-connect-new/admin/templates/providers.php:86
538
+ #: nextend-facebook-connect-new/includes/provider.php:928
539
+ msgid "Disable"
540
+ msgstr ""
541
+
542
+ #: nextend-facebook-connect-new/admin/templates/providers.php:97
543
+ msgid "Import"
544
+ msgstr ""
545
+
546
+ #: nextend-facebook-connect-new/admin/templates/providers.php:116
547
+ msgid "Saving..."
548
+ msgstr ""
549
+
550
+ #: nextend-facebook-connect-new/admin/templates/providers.php:117
551
+ msgid "Saving failed"
552
+ msgstr ""
553
+
554
+ #: nextend-facebook-connect-new/admin/templates/providers.php:118
555
+ msgid "Order Saved"
556
+ msgstr ""
557
+
558
+ #: nextend-facebook-connect-new/includes/provider.php:315
559
+ #: nextend-facebook-connect-new/includes/provider.php:534
560
+ #: nextend-facebook-connect-new/includes/provider.php:545
561
+ msgid "Authentication successful"
562
+ msgstr ""
563
+
564
+ #: nextend-facebook-connect-new/includes/provider.php:363
565
+ #, php-format
566
+ msgid ""
567
+ "Your %s account is successfully linked with your account. Now you can sign "
568
+ "in with %s easily."
569
+ msgstr ""
570
+
571
+ #: nextend-facebook-connect-new/includes/provider.php:367
572
+ #, php-format
573
+ msgid ""
574
+ "This %s account is already linked with other account. Linking process failed!"
575
+ msgstr ""
576
+
577
+ #: nextend-facebook-connect-new/includes/provider.php:473
578
+ msgid "Authentication error"
579
+ msgstr ""
580
+
581
+ #: nextend-facebook-connect-new/includes/provider.php:482
582
+ msgid "Unlink successful."
583
+ msgstr ""
584
+
585
+ #: nextend-facebook-connect-new/includes/provider.php:751
586
+ #: nextend-facebook-connect-new/includes/provider.php:758
587
+ msgid "The test was successful"
588
+ msgstr ""
589
+
590
+ #: nextend-facebook-connect-new/includes/provider.php:798
591
+ msgid "Authentication failed"
592
+ msgstr ""
593
+
594
+ #: nextend-facebook-connect-new/includes/provider.php:869
595
+ msgid "Your configuration needs testing"
596
+ msgstr ""
597
+
598
+ #: nextend-facebook-connect-new/includes/provider.php:870
599
+ msgid ""
600
+ "Before you can start letting your users register with your app it needs to "
601
+ "be tested. This test makes sure that no users will have troubles with the "
602
+ "login and registration process. <br> If you see error message in the popup "
603
+ "check the copied ID and secret or the app itself. Otherwise your settings "
604
+ "are fine."
605
+ msgstr ""
606
+
607
+ #: nextend-facebook-connect-new/includes/provider.php:875
608
+ msgid "Test the Configuration"
609
+ msgstr ""
610
+
611
+ #: nextend-facebook-connect-new/includes/provider.php:876
612
+ #: nextend-facebook-connect-new/includes/provider.php:913
613
+ msgid "Please save your changes before testing."
614
+ msgstr ""
615
+
616
+ #: nextend-facebook-connect-new/includes/provider.php:884
617
+ msgid "Works Fine"
618
+ msgstr ""
619
+
620
+ #: nextend-facebook-connect-new/includes/provider.php:898
621
+ #, php-format
622
+ msgid ""
623
+ "This provider is currently disabled, which means that users can’t register "
624
+ "or login via their %s account."
625
+ msgstr ""
626
+
627
+ #: nextend-facebook-connect-new/includes/provider.php:901
628
+ #, php-format
629
+ msgid ""
630
+ "This provider works fine, but you can test it again. If you don’t want to "
631
+ "let users register or login with %s anymore you can disable it."
632
+ msgstr ""
633
+
634
+ #: nextend-facebook-connect-new/includes/provider.php:904
635
+ #, php-format
636
+ msgid ""
637
+ "This provider is currently enabled, which means that users can register or "
638
+ "login via their %s account."
639
+ msgstr ""
640
+
641
+ #: nextend-facebook-connect-new/includes/provider.php:912
642
+ msgid "Test Again"
643
+ msgstr ""
644
+
645
+ #: nextend-facebook-connect-new/nextend-social-login.php:19
646
+ #, php-format
647
+ msgid ""
648
+ "%5$s plugin (version: %1$s, required: %2$s or newer) is not compatible with "
649
+ "the PRO addon (version: %3$s, required: %4$s or newer). Please upgrade to "
650
+ "the latest version! PRO addon disabled."
651
+ msgstr ""
652
+
653
+ #: nextend-facebook-connect-new/nextend-social-login.php:245
654
+ #, php-format
655
+ msgid ""
656
+ "%s took the place of Nextend Google Connect. You can delete Nextend Google "
657
+ "Connect as it is not needed anymore."
658
+ msgstr ""
659
+
660
+ #: nextend-facebook-connect-new/nextend-social-login.php:256
661
+ #, php-format
662
+ msgid ""
663
+ "%s took the place of Nextend Twitter Connect. You can delete Nextend Twitter "
664
+ "Connect as it is not needed anymore."
665
+ msgstr ""
666
+
667
+ #: nextend-facebook-connect-new/nextend-social-login.php:349
668
+ msgid "You have logged in successfully."
669
+ msgstr ""
670
+
671
+ #: nextend-facebook-connect-new/nextend-social-login.php:426
672
+ msgid "Social Login"
673
+ msgstr ""
674
+
675
+ #: nextend-facebook-connect-new/providers/facebook/admin/getting-started.php:7
676
+ #: nextend-facebook-connect-new/providers/google/admin/getting-started.php:9
677
+ #: nextend-facebook-connect-new/providers/twitter/admin/getting-started.php:9
678
+ #, php-format
679
+ msgid ""
680
+ "To allow your visitors to log in with their %1$s account, first you must "
681
+ "create a %1$s App. The following guide will help you through the %1$s App "
682
+ "creation process. After you have created your %1$s App, head over to "
683
+ "\"Settings\" and configure the given \"%2$s\" and \"%3$s\" according to your "
684
+ "%1$s App."
685
+ msgstr ""
686
+
687
+ #: nextend-facebook-connect-new/providers/facebook/admin/getting-started.php:9
688
+ #: nextend-facebook-connect-new/providers/google/admin/getting-started.php:11
689
+ #: nextend-facebook-connect-new/providers/twitter/admin/getting-started.php:11
690
+ #: nextend-social-connect-pro-new/providers/linkedin/admin/getting-started.php:10
691
+ #, php-format
692
+ msgctxt "App creation"
693
+ msgid "Create %s"
694
+ msgstr ""
695
+
696
+ #: nextend-facebook-connect-new/providers/facebook/admin/getting-started.php:12
697
+ #: nextend-facebook-connect-new/providers/google/admin/getting-started.php:14
698
+ #: nextend-facebook-connect-new/providers/twitter/admin/getting-started.php:14
699
+ #: nextend-social-connect-pro-new/providers/linkedin/admin/getting-started.php:13
700
+ #, php-format
701
+ msgid "Navigate to %s"
702
+ msgstr ""
703
+
704
+ #: nextend-facebook-connect-new/providers/facebook/admin/getting-started.php:13
705
+ #: nextend-facebook-connect-new/providers/google/admin/getting-started.php:15
706
+ #: nextend-facebook-connect-new/providers/twitter/admin/getting-started.php:15
707
+ #: nextend-social-connect-pro-new/providers/linkedin/admin/getting-started.php:14
708
+ #, php-format
709
+ msgid "Log in with your %s credentials if you are not logged in"
710
+ msgstr ""
711
+
712
+ #: nextend-facebook-connect-new/providers/facebook/admin/getting-started.php:14
713
+ msgid "Click on the \"Add a New App\" button"
714
+ msgstr ""
715
+
716
+ #: nextend-facebook-connect-new/providers/facebook/admin/getting-started.php:15
717
+ msgid "Fill \"Display Name\" and \"Contact Email\""
718
+ msgstr ""
719
+
720
+ #: nextend-facebook-connect-new/providers/facebook/admin/getting-started.php:16
721
+ msgid "Click on blue \"Create App ID\" button"
722
+ msgstr ""
723
+
724
+ #: nextend-facebook-connect-new/providers/facebook/admin/getting-started.php:17
725
+ msgid ""
726
+ "Move your mouse over Facebook Login and click on the appearing \"Set Up\" "
727
+ "button"
728
+ msgstr ""
729
+
730
+ #: nextend-facebook-connect-new/providers/facebook/admin/getting-started.php:18
731
+ msgid "Choose Web"
732
+ msgstr ""
733
+
734
+ #: nextend-facebook-connect-new/providers/facebook/admin/getting-started.php:19
735
+ #, php-format
736
+ msgid "Fill \"Site URL\" with the url of your homepage, probably: <b>%s</b>"
737
+ msgstr ""
738
+
739
+ #: nextend-facebook-connect-new/providers/facebook/admin/getting-started.php:20
740
+ msgid "Click on \"Save\""
741
+ msgstr ""
742
+
743
+ #: nextend-facebook-connect-new/providers/facebook/admin/getting-started.php:21
744
+ msgid "In the left sidebar, click on \"Facebook Login\""
745
+ msgstr ""
746
+
747
+ #: nextend-facebook-connect-new/providers/facebook/admin/getting-started.php:22
748
+ #: nextend-facebook-connect-new/providers/google/admin/getting-started.php:24
749
+ #, php-format
750
+ msgid ""
751
+ "Add the following URL to the \"Valid OAuth redirect URIs\" field: <b>%s</b>"
752
+ msgstr ""
753
+
754
+ #: nextend-facebook-connect-new/providers/facebook/admin/getting-started.php:23
755
+ msgid "Click on \"Save Changes\""
756
+ msgstr ""
757
+
758
+ #: nextend-facebook-connect-new/providers/facebook/admin/getting-started.php:24
759
+ msgid "In the top of the left sidebar, click on \"Settings\""
760
+ msgstr ""
761
+
762
+ #: nextend-facebook-connect-new/providers/facebook/admin/getting-started.php:25
763
+ msgid ""
764
+ "Here you can see your \"APP ID\" and you can see your \"App secret\" if you "
765
+ "click on the \"Show\" button. These will be needed in plugin's settings."
766
+ msgstr ""
767
+
768
+ #: nextend-facebook-connect-new/providers/facebook/admin/getting-started.php:26
769
+ msgid "Enter your domain name to the App Domains"
770
+ msgstr ""
771
+
772
+ #: nextend-facebook-connect-new/providers/facebook/admin/getting-started.php:27
773
+ msgid ""
774
+ "Fill up the \"Privacy Policy URL\". Provide a publicly available and easily "
775
+ "accessible privacy policy that explains what data you are collecting and how "
776
+ "you will use that data."
777
+ msgstr ""
778
+
779
+ #: nextend-facebook-connect-new/providers/facebook/admin/getting-started.php:28
780
+ msgid "Save your changes"
781
+ msgstr ""
782
+
783
+ #: nextend-facebook-connect-new/providers/facebook/admin/getting-started.php:29
784
+ msgid ""
785
+ "Your application is currently private, which means that only you can log in "
786
+ "with it. In the left sidebar choose \"App Review\" and make your App public"
787
+ msgstr ""
788
+
789
+ #: nextend-facebook-connect-new/providers/facebook/admin/getting-started.php:33
790
+ #: nextend-facebook-connect-new/providers/google/admin/getting-started.php:30
791
+ #: nextend-facebook-connect-new/providers/twitter/admin/getting-started.php:25
792
+ #: nextend-social-connect-pro-new/providers/linkedin/admin/getting-started.php:27
793
+ #, php-format
794
+ msgid "I am done setting up my %s"
795
+ msgstr ""
796
+
797
+ #: nextend-facebook-connect-new/providers/facebook/admin/import.php:7
798
+ msgid "Import Facebook configuration"
799
+ msgstr ""
800
+
801
+ #: nextend-facebook-connect-new/providers/facebook/admin/import.php:8
802
+ #: nextend-facebook-connect-new/providers/google/admin/import.php:8
803
+ #: nextend-facebook-connect-new/providers/twitter/admin/import.php:8
804
+ msgid "Be sure to read the following notices before you proceed."
805
+ msgstr ""
806
+
807
+ #: nextend-facebook-connect-new/providers/facebook/admin/import.php:10
808
+ #: nextend-facebook-connect-new/providers/google/admin/import.php:10
809
+ #: nextend-facebook-connect-new/providers/twitter/admin/import.php:10
810
+ msgid "Important steps before the import"
811
+ msgstr ""
812
+
813
+ #: nextend-facebook-connect-new/providers/facebook/admin/import.php:11
814
+ #: nextend-facebook-connect-new/providers/google/admin/import.php:11
815
+ #: nextend-facebook-connect-new/providers/twitter/admin/import.php:11
816
+ msgid ""
817
+ "Make sure that the redirect URI for your app is correct before proceeding."
818
+ msgstr ""
819
+
820
+ #: nextend-facebook-connect-new/providers/facebook/admin/import.php:13
821
+ #: nextend-facebook-connect-new/providers/google/admin/import.php:13
822
+ #: nextend-facebook-connect-new/providers/twitter/admin/import.php:13
823
+ #, php-format
824
+ msgid "Visit %s."
825
+ msgstr ""
826
+
827
+ #: nextend-facebook-connect-new/providers/facebook/admin/import.php:14
828
+ #: nextend-facebook-connect-new/providers/twitter/admin/import.php:14
829
+ msgid "Select your app."
830
+ msgstr ""
831
+
832
+ #: nextend-facebook-connect-new/providers/facebook/admin/import.php:15
833
+ msgid ""
834
+ "Go to the Settings menu which you can find below the Facebook Login in the "
835
+ "left menu."
836
+ msgstr ""
837
+
838
+ #: nextend-facebook-connect-new/providers/facebook/admin/import.php:16
839
+ #: nextend-facebook-connect-new/providers/google/admin/import.php:16
840
+ #: nextend-facebook-connect-new/providers/twitter/admin/import.php:16
841
+ #, php-format
842
+ msgid "Make sure that the \"%1$s\" field contains %2$s"
843
+ msgstr ""
844
+
845
+ #: nextend-facebook-connect-new/providers/facebook/admin/import.php:17
846
+ #: nextend-facebook-connect-new/providers/google/admin/import.php:17
847
+ #: nextend-facebook-connect-new/providers/twitter/admin/import.php:17
848
+ msgid "Save your changes."
849
+ msgstr ""
850
+
851
+ #: nextend-facebook-connect-new/providers/facebook/admin/import.php:20
852
+ #: nextend-facebook-connect-new/providers/google/admin/import.php:20
853
+ #: nextend-facebook-connect-new/providers/twitter/admin/import.php:20
854
+ msgid "The following settings will be imported:"
855
+ msgstr ""
856
+
857
+ #: nextend-facebook-connect-new/providers/facebook/admin/import.php:22
858
+ #: nextend-facebook-connect-new/providers/google/admin/import.php:22
859
+ #: nextend-facebook-connect-new/providers/twitter/admin/import.php:22
860
+ msgid "Your old API configurations"
861
+ msgstr ""
862
+
863
+ #: nextend-facebook-connect-new/providers/facebook/admin/import.php:23
864
+ #: nextend-facebook-connect-new/providers/google/admin/import.php:23
865
+ #: nextend-facebook-connect-new/providers/twitter/admin/import.php:23
866
+ msgid "The user prefix you set"
867
+ msgstr ""
868
+
869
+ #: nextend-facebook-connect-new/providers/facebook/admin/import.php:26
870
+ #: nextend-facebook-connect-new/providers/google/admin/import.php:26
871
+ #: nextend-facebook-connect-new/providers/twitter/admin/import.php:26
872
+ msgid "Create a backup of the old settings"
873
+ msgstr ""
874
+
875
+ #: nextend-facebook-connect-new/providers/facebook/admin/import.php:29
876
+ #: nextend-facebook-connect-new/providers/google/admin/import.php:29
877
+ #: nextend-facebook-connect-new/providers/twitter/admin/import.php:29
878
+ msgid "Other changes"
879
+ msgstr ""
880
+
881
+ #: nextend-facebook-connect-new/providers/facebook/admin/import.php:31
882
+ #: nextend-facebook-connect-new/providers/google/admin/import.php:31
883
+ #: nextend-facebook-connect-new/providers/twitter/admin/import.php:31
884
+ msgid ""
885
+ "The custom redirect URI is now handled globally for all providers, so it "
886
+ "won't be imported from the previous version. Visit \"Nextend Social Login > "
887
+ "Global settings\" to set the new redirect URIs."
888
+ msgstr ""
889
+
890
+ #: nextend-facebook-connect-new/providers/facebook/admin/import.php:32
891
+ #: nextend-facebook-connect-new/providers/google/admin/import.php:32
892
+ #: nextend-facebook-connect-new/providers/twitter/admin/import.php:32
893
+ msgid ""
894
+ "The login button's layout will be changed to a new, more modern look. If you "
895
+ "used any custom buttons that won't be imported."
896
+ msgstr ""
897
+
898
+ #: nextend-facebook-connect-new/providers/facebook/admin/import.php:33
899
+ #: nextend-facebook-connect-new/providers/google/admin/import.php:33
900
+ #: nextend-facebook-connect-new/providers/twitter/admin/import.php:33
901
+ msgid ""
902
+ "The old version's PHP functions are not available anymore. This means if you "
903
+ "used any custom codes where you used these old functions, you need to remove "
904
+ "them."
905
+ msgstr ""
906
+
907
+ #: nextend-facebook-connect-new/providers/facebook/admin/import.php:35
908
+ #: nextend-facebook-connect-new/providers/google/admin/import.php:35
909
+ #: nextend-facebook-connect-new/providers/twitter/admin/import.php:35
910
+ msgid ""
911
+ "After the importing process finishes, you will need to <b>test</b> your app "
912
+ "and <b>enable</b> the provider. You can do both in the next screen."
913
+ msgstr ""
914
+
915
+ #: nextend-facebook-connect-new/providers/facebook/admin/import.php:42
916
+ #: nextend-facebook-connect-new/providers/google/admin/import.php:42
917
+ #: nextend-facebook-connect-new/providers/twitter/admin/import.php:43
918
+ msgid "Import Configuration"
919
+ msgstr ""
920
+
921
+ #: nextend-facebook-connect-new/providers/facebook/admin/settings.php:26
922
+ msgid "App ID"
923
+ msgstr ""
924
+
925
+ #: nextend-facebook-connect-new/providers/facebook/admin/settings.php:27
926
+ #: nextend-facebook-connect-new/providers/facebook/admin/settings.php:39
927
+ #: nextend-facebook-connect-new/providers/google/admin/settings.php:26
928
+ #: nextend-facebook-connect-new/providers/google/admin/settings.php:39
929
+ #: nextend-facebook-connect-new/providers/twitter/admin/settings.php:26
930
+ #: nextend-social-connect-pro-new/providers/linkedin/admin/settings.php:25
931
+ #: nextend-social-connect-pro-new/providers/linkedin/admin/settings.php:37
932
+ msgid "Required"
933
+ msgstr ""
934
+
935
+ #: nextend-facebook-connect-new/providers/facebook/admin/settings.php:32
936
+ #: nextend-facebook-connect-new/providers/google/admin/settings.php:33
937
+ #: nextend-facebook-connect-new/providers/twitter/admin/settings.php:31
938
+ #: nextend-social-connect-pro-new/providers/linkedin/admin/settings.php:31
939
+ #, php-format
940
+ msgid ""
941
+ "If you are not sure what is your %s, please head over to <a href=\"%s"
942
+ "\">Getting Started</a>"
943
+ msgstr ""
944
+
945
+ #: nextend-facebook-connect-new/providers/facebook/admin/settings.php:38
946
+ msgid "App Secret"
947
+ msgstr ""
948
+
949
+ #: nextend-facebook-connect-new/providers/facebook/admin/settings.php:52
950
+ #: nextend-facebook-connect-new/providers/google/admin/settings.php:51
951
+ #: nextend-facebook-connect-new/providers/twitter/admin/settings.php:50
952
+ #: nextend-social-connect-pro-new/providers/linkedin/admin/settings.php:49
953
+ msgid "Other settings"
954
+ msgstr ""
955
+
956
+ #: nextend-facebook-connect-new/providers/facebook/admin/settings.php:57
957
+ #: nextend-facebook-connect-new/providers/google/admin/settings.php:56
958
+ #: nextend-facebook-connect-new/providers/twitter/admin/settings.php:55
959
+ #: nextend-social-connect-pro-new/providers/linkedin/admin/settings.php:54
960
+ msgid "Username prefix on register"
961
+ msgstr ""
962
+
963
+ #: nextend-facebook-connect-new/providers/facebook/facebook.php:50
964
+ msgid "Continue with <b>Facebook</b>"
965
+ msgstr ""
966
+
967
+ #: nextend-facebook-connect-new/providers/facebook/facebook.php:51
968
+ msgid "Link account with <b>Facebook</b>"
969
+ msgstr ""
970
+
971
+ #: nextend-facebook-connect-new/providers/facebook/facebook.php:52
972
+ msgid "Unlink account from <b>Facebook</b>"
973
+ msgstr ""
974
+
975
+ #: nextend-facebook-connect-new/providers/facebook/facebook.php:110
976
+ #: nextend-facebook-connect-new/providers/google/google.php:72
977
+ #: nextend-facebook-connect-new/providers/twitter/twitter.php:73
978
+ #: nextend-social-connect-pro-new/providers/linkedin/linkedin.php:69
979
+ #, php-format
980
+ msgid "The %s entered did not appear to be a valid. Please enter a valid %s."
981
+ msgstr ""
982
+
983
+ #: nextend-facebook-connect-new/providers/google/admin/getting-started.php:16
984
+ msgid ""
985
+ "If you don't have a project yet, you'll need to create one. You can do this "
986
+ "by clicking on the blue \"Create project\" button on the right side"
987
+ msgstr ""
988
+
989
+ #: nextend-facebook-connect-new/providers/google/admin/getting-started.php:17
990
+ msgid "Name your project and then click on the Create button"
991
+ msgstr ""
992
+
993
+ #: nextend-facebook-connect-new/providers/google/admin/getting-started.php:18
994
+ msgid "Once you have a project, you'll end up in the dashboard."
995
+ msgstr ""
996
+
997
+ #: nextend-facebook-connect-new/providers/google/admin/getting-started.php:19
998
+ msgid ""
999
+ "Click on the \"Credentials\" in the left hand menu to create new API "
1000
+ "credentials"
1001
+ msgstr ""
1002
+
1003
+ #: nextend-facebook-connect-new/providers/google/admin/getting-started.php:20
1004
+ msgid ""
1005
+ "Go to the OAuth consent screen tab and enter a product name and provide the "
1006
+ "Privacy Policy URL, then click on the save button."
1007
+ msgstr ""
1008
+
1009
+ #: nextend-facebook-connect-new/providers/google/admin/getting-started.php:21
1010
+ msgid ""
1011
+ "Go back to the Credentials tab and locate the small box at the middle. Click "
1012
+ "on the blue \"Create credentials\" button. Chose the \"OAuth client ID\" "
1013
+ "from the dropdown list."
1014
+ msgstr ""
1015
+
1016
+ #: nextend-facebook-connect-new/providers/google/admin/getting-started.php:22
1017
+ msgid "Your application type should be \"Web application\""
1018
+ msgstr ""
1019
+
1020
+ #: nextend-facebook-connect-new/providers/google/admin/getting-started.php:23
1021
+ msgid "Name your application"
1022
+ msgstr ""
1023
+
1024
+ #: nextend-facebook-connect-new/providers/google/admin/getting-started.php:25
1025
+ msgid "Click on the Create button"
1026
+ msgstr ""
1027
+
1028
+ #: nextend-facebook-connect-new/providers/google/admin/getting-started.php:26
1029
+ msgid ""
1030
+ "A modal should pop up with your credentials. If that doesn't happen, go to "
1031
+ "the Credentials in the left hand menu and select your app by clicking on its "
1032
+ "name and you'll be able to copy-paste the Client ID and Client Secret from "
1033
+ "there."
1034
+ msgstr ""
1035
+
1036
+ #: nextend-facebook-connect-new/providers/google/admin/import.php:7
1037
+ msgid "Import Google configuration"
1038
+ msgstr ""
1039
+
1040
+ #: nextend-facebook-connect-new/providers/google/admin/import.php:14
1041
+ msgid "If you have more projects, select the one where your app is."
1042
+ msgstr ""
1043
+
1044
+ #: nextend-facebook-connect-new/providers/google/admin/import.php:15
1045
+ msgid "Click on Credentials at the left-hand menu then select your app."
1046
+ msgstr ""
1047
+
1048
+ #: nextend-facebook-connect-new/providers/google/admin/settings.php:25
1049
+ #: nextend-social-connect-pro-new/providers/linkedin/admin/settings.php:24
1050
+ msgid "Client ID"
1051
+ msgstr ""
1052
+
1053
+ #: nextend-facebook-connect-new/providers/google/admin/settings.php:38
1054
+ #: nextend-social-connect-pro-new/providers/linkedin/admin/settings.php:36
1055
+ msgid "Client Secret"
1056
+ msgstr ""
1057
+
1058
+ #: nextend-facebook-connect-new/providers/google/google.php:39
1059
+ msgid "Continue with <b>Google</b>"
1060
+ msgstr ""
1061
+
1062
+ #: nextend-facebook-connect-new/providers/google/google.php:40
1063
+ msgid "Link account with <b>Google</b>"
1064
+ msgstr ""
1065
+
1066
+ #: nextend-facebook-connect-new/providers/google/google.php:41
1067
+ msgid "Unlink account from <b>Google</b>"
1068
+ msgstr ""
1069
+
1070
+ #: nextend-facebook-connect-new/providers/twitter/admin/getting-started.php:16
1071
+ msgid "Click on the \"Create New App\" button"
1072
+ msgstr ""
1073
+
1074
+ #: nextend-facebook-connect-new/providers/twitter/admin/getting-started.php:17
1075
+ #, php-format
1076
+ msgid ""
1077
+ "Fill the name and description fields. Then enter your site's URL to the "
1078
+ "Website field: <b>%s</b>"
1079
+ msgstr ""
1080
+
1081
+ #: nextend-facebook-connect-new/providers/twitter/admin/getting-started.php:18
1082
+ #, php-format
1083
+ msgid "Add the following URL to the \"Callback URL\" field: <b>%s</b>"
1084
+ msgstr ""
1085
+
1086
+ #: nextend-facebook-connect-new/providers/twitter/admin/getting-started.php:19
1087
+ msgid "Accept the Twitter Developer Agreement"
1088
+ msgstr ""
1089
+
1090
+ #: nextend-facebook-connect-new/providers/twitter/admin/getting-started.php:20
1091
+ msgid ""
1092
+ "Create your application by clicking on the Create your Twitter application "
1093
+ "button"
1094
+ msgstr ""
1095
+
1096
+ #: nextend-facebook-connect-new/providers/twitter/admin/getting-started.php:21
1097
+ msgid ""
1098
+ "Go to the Keys and Access Tokens tab and find the Consumer Key and Secret"
1099
+ msgstr ""
1100
+
1101
+ #: nextend-facebook-connect-new/providers/twitter/admin/import.php:7
1102
+ msgid "Import Twitter configuration"
1103
+ msgstr ""
1104
+
1105
+ #: nextend-facebook-connect-new/providers/twitter/admin/import.php:15
1106
+ msgid "Go to the Settings tab."
1107
+ msgstr ""
1108
+
1109
+ #: nextend-facebook-connect-new/providers/twitter/admin/settings.php:25
1110
+ msgid "Consumer Key"
1111
+ msgstr ""
1112
+
1113
+ #: nextend-facebook-connect-new/providers/twitter/admin/settings.php:36
1114
+ msgid "Consumer Secret"
1115
+ msgstr ""
1116
+
1117
+ #: nextend-facebook-connect-new/providers/twitter/twitter.php:40
1118
+ msgid "Continue with <b>Twitter</b>"
1119
+ msgstr ""
1120
+
1121
+ #: nextend-facebook-connect-new/providers/twitter/twitter.php:41
1122
+ msgid "Link account with <b>Twitter</b>"
1123
+ msgstr ""
1124
+
1125
+ #: nextend-facebook-connect-new/providers/twitter/twitter.php:42
1126
+ msgid "Unlink account from <b>Twitter</b>"
1127
+ msgstr ""
1128
+
1129
+ #: nextend-facebook-connect-new/providers/twitter/twitter.php:153
1130
+ #: nextend-facebook-connect-new/providers/twitter/twitter.php:155
1131
+ #: nextend-facebook-connect-new/providers/twitter/twitter.php:158
1132
+ #: nextend-social-connect-pro-new/class-provider-extension.php:142
1133
+ #: nextend-social-connect-pro-new/class-provider-extension.php:144
1134
+ #: nextend-social-connect-pro-new/class-provider-extension.php:147
1135
+ #: nextend-social-connect-pro-new/class-provider-extension.php:153
1136
+ #: nextend-social-connect-pro-new/class-provider-extension.php:166
1137
+ #: nextend-social-connect-pro-new/class-provider-extension.php:168
1138
+ #: nextend-social-connect-pro-new/class-provider-extension.php:171
1139
+ msgid "ERROR"
1140
+ msgstr ""
1141
+
1142
+ #: nextend-facebook-connect-new/providers/twitter/twitter.php:153
1143
+ #: nextend-social-connect-pro-new/class-provider-extension.php:166
1144
+ msgid "Please enter an email address."
1145
+ msgstr ""
1146
+
1147
+ #: nextend-facebook-connect-new/providers/twitter/twitter.php:155
1148
+ #: nextend-social-connect-pro-new/class-provider-extension.php:168
1149
+ msgid "The email address isn&#8217;t correct."
1150
+ msgstr ""
1151
+
1152
+ #: nextend-facebook-connect-new/providers/twitter/twitter.php:158
1153
+ #: nextend-social-connect-pro-new/class-provider-extension.php:171
1154
+ msgid "This email is already registered, please choose another one."
1155
+ msgstr ""
1156
+
1157
+ #: nextend-facebook-connect-new/providers/twitter/twitter.php:167
1158
+ #: nextend-social-connect-pro-new/class-provider-extension.php:183
1159
+ msgid "Registration Form"
1160
+ msgstr ""
1161
+
1162
+ #: nextend-facebook-connect-new/providers/twitter/twitter.php:167
1163
+ #: nextend-social-connect-pro-new/class-provider-extension.php:183
1164
+ msgid "Register For This Site!"
1165
+ msgstr ""
1166
+
1167
+ #: nextend-facebook-connect-new/providers/twitter/twitter.php:173
1168
+ #: nextend-social-connect-pro-new/class-provider-extension.php:197
1169
+ msgid "Email"
1170
+ msgstr ""
1171
+
1172
+ #: nextend-facebook-connect-new/providers/twitter/twitter.php:177
1173
+ #: nextend-social-connect-pro-new/class-provider-extension.php:202
1174
+ msgid "Registration confirmation will be emailed to you."
1175
+ msgstr ""
1176
+
1177
+ #: nextend-facebook-connect-new/providers/twitter/twitter.php:181
1178
+ #: nextend-social-connect-pro-new/class-provider-extension.php:206
1179
+ msgid "Register"
1180
+ msgstr ""
1181
+
1182
+ #: nextend-facebook-connect-new/widget.php:10
1183
+ #, php-format
1184
+ msgid "%s Buttons"
1185
+ msgstr ""
1186
+
1187
+ #: nextend-facebook-connect-new/widget.php:22
1188
+ msgid "Title:"
1189
+ msgstr ""
1190
+
1191
+ #: nextend-facebook-connect-new/widget.php:30
1192
+ msgid "Button style:"
1193
+ msgstr ""
1194
+
1195
+ #: nextend-social-connect-pro-new/class-provider-extension.php:78
1196
+ msgid "Social login is not allowed with this role!"
1197
+ msgstr ""
1198
+
1199
+ #: nextend-social-connect-pro-new/class-provider-extension.php:142
1200
+ msgid "Please enter a username."
1201
+ msgstr ""
1202
+
1203
+ #: nextend-social-connect-pro-new/class-provider-extension.php:144
1204
+ msgid ""
1205
+ "This username is invalid because it uses illegal characters. Please enter a "
1206
+ "valid username."
1207
+ msgstr ""
1208
+
1209
+ #: nextend-social-connect-pro-new/class-provider-extension.php:147
1210
+ msgid "This username is already registered. Please choose another one."
1211
+ msgstr ""
1212
+
1213
+ #: nextend-social-connect-pro-new/class-provider-extension.php:153
1214
+ msgid "Sorry, that username is not allowed."
1215
+ msgstr ""
1216
+
1217
+ #: nextend-social-connect-pro-new/class-provider-extension.php:190
1218
+ msgid "Username"
1219
+ msgstr ""
1220
+
1221
+ #: nextend-social-connect-pro-new/class-provider-extension.php:218
1222
+ msgid ""
1223
+ "This email is already registered, please login in to your account to link "
1224
+ "with Facebook."
1225
+ msgstr ""
1226
+
1227
+ #: nextend-social-connect-pro-new/providers/linkedin/admin/getting-started.php:8
1228
+ #, php-format
1229
+ msgid ""
1230
+ "To allow your visitors to log in with their %1$s account, first you must "
1231
+ "create a %1$s App. The following guide will help you through the %1$s App "
1232
+ "creation process. After you created your %1$s App, head over to \"Settings\" "
1233
+ "and configure the given \"%2$s\" and \"%3$s\" according to your %1$s App."
1234
+ msgstr ""
1235
+
1236
+ #: nextend-social-connect-pro-new/providers/linkedin/admin/getting-started.php:15
1237
+ msgid "Locate the yellow \"Create application\" button and click on it."
1238
+ msgstr ""
1239
+
1240
+ #: nextend-social-connect-pro-new/providers/linkedin/admin/getting-started.php:16
1241
+ msgid "Fill the fields marked with *"
1242
+ msgstr ""
1243
+
1244
+ #: nextend-social-connect-pro-new/providers/linkedin/admin/getting-started.php:17
1245
+ #, php-format
1246
+ msgid "Fill \"Website URL\" with the url of your homepage, probably: <b>%s</b>"
1247
+ msgstr ""
1248
+
1249
+ #: nextend-social-connect-pro-new/providers/linkedin/admin/getting-started.php:19
1250
+ msgid "Accept the Terms of use and hit Submit"
1251
+ msgstr ""
1252
+
1253
+ #: nextend-social-connect-pro-new/providers/linkedin/admin/getting-started.php:20
1254
+ msgid "Find the necessary Authentication Keys under the Authentication menu"
1255
+ msgstr ""
1256
+
1257
+ #: nextend-social-connect-pro-new/providers/linkedin/admin/getting-started.php:21
1258
+ #, php-format
1259
+ msgid ""
1260
+ "Add the following URL to the \"Authorized Redirect URLs:\" field: <b>%s</b>"
1261
+ msgstr ""
1262
+
1263
+ #: nextend-social-connect-pro-new/providers/linkedin/admin/getting-started.php:22
1264
+ msgid ""
1265
+ "You probably want to enable the \"r_emailaddress\" under the Default "
1266
+ "Application Permissions"
1267
+ msgstr ""
1268
+
1269
+ #: nextend-social-connect-pro-new/providers/linkedin/admin/getting-started.php:23
1270
+ msgid "Hit update to save the changes"
1271
+ msgstr ""
1272
+
1273
+ #: nextend-social-connect-pro-new/providers/linkedin/linkedin.php:35
1274
+ msgid "Continue with <b>LinkedIn</b>"
1275
+ msgstr ""
1276
+
1277
+ #: nextend-social-connect-pro-new/providers/linkedin/linkedin.php:36
1278
+ msgid "Link account with <b>LinkedIn</b>"
1279
+ msgstr ""
1280
+
1281
+ #: nextend-social-connect-pro-new/providers/linkedin/linkedin.php:37
1282
+ msgid "Unlink account from <b>LinkedIn</b>"
1283
+ msgstr ""
1284
+
1285
+ #: nextend-social-connect-pro-new/template-parts/login-layout-above-separator.php:9
1286
+ #: nextend-social-connect-pro-new/template-parts/login-layout-below-separator.php:9
1287
+ msgid "OR"
1288
+ msgstr ""
1289
+
1290
+ #: nextend-social-connect-pro-new/template-parts/woocommerce-edit-account-after.php:1
1291
+ #: nextend-social-connect-pro-new/template-parts/woocommerce-edit-account-before.php:1
1292
+ msgid "Social accounts"
1293
+ msgstr ""
nextend-facebook-connect.php CHANGED
@@ -1,571 +1,24 @@
1
  <?php
2
-
3
  /*
4
- Plugin Name: Nextend Facebook Connect
5
  Plugin URI: https://nextendweb.com/
6
- Description: This plugins helps you create Facebook login and register buttons. The login and register process only takes one click.
7
- Version: 2.0.2
8
  Author: Nextendweb
9
  License: GPL2
 
 
10
  */
11
 
12
- /* Copyright 2012 Roland Soos - Nextend (email : roland@nextendweb.com)
13
-
14
- This program is free software; you can redistribute it and/or modify
15
- it under the terms of the GNU General Public License, version 2, as
16
- published by the Free Software Foundation.
17
-
18
- This program is distributed in the hope that it will be useful,
19
- but WITHOUT ANY WARRANTY; without even the implied warranty of
20
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
- GNU General Public License for more details.
22
-
23
- You should have received a copy of the GNU General Public License
24
- along with this program; if not, write to the Free Software
25
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26
- */
27
- global $new_fb_settings;
28
- define('NEW_FB_LOGIN', 1);
29
- if (!defined('NEW_FB_LOGIN_PLUGIN_BASENAME')) define('NEW_FB_LOGIN_PLUGIN_BASENAME', plugin_basename(__FILE__));
30
- $new_fb_settings = maybe_unserialize(get_option('nextend_fb_connect'));
31
-
32
- if (!function_exists('nextend_uniqid')) {
33
- function nextend_uniqid() {
34
- if (isset($_COOKIE['nextend_uniqid'])) {
35
- if (get_site_transient('n_' . $_COOKIE['nextend_uniqid']) !== false) {
36
- return $_COOKIE['nextend_uniqid'];
37
- }
38
- }
39
- $_COOKIE['nextend_uniqid'] = uniqid('nextend', true);
40
- setcookie('nextend_uniqid', $_COOKIE['nextend_uniqid'], time() + 3600, '/', '', false, true);
41
- set_site_transient('n_' . $_COOKIE['nextend_uniqid'], 1, 3600);
42
-
43
- return $_COOKIE['nextend_uniqid'];
44
- }
45
- }
46
-
47
- /*
48
- Loading style for buttons
49
- */
50
-
51
- function nextend_fb_connect_stylesheet() {
52
-
53
- wp_register_style('nextend_fb_connect_stylesheet', plugins_url('buttons/facebook-btn.css', __FILE__));
54
- wp_enqueue_style('nextend_fb_connect_stylesheet');
55
- }
56
-
57
- if (!isset($new_fb_settings['fb_load_style'])) $new_fb_settings['fb_load_style'] = 1;
58
- if ($new_fb_settings['fb_load_style']) {
59
- add_action('wp_enqueue_scripts', 'nextend_fb_connect_stylesheet');
60
- add_action('login_enqueue_scripts', 'nextend_fb_connect_stylesheet');
61
- add_action('admin_enqueue_scripts', 'nextend_fb_connect_stylesheet');
62
- }
63
-
64
- /*
65
- Creating the required table on installation
66
- */
67
-
68
- function nextend_fb_connect_install() {
69
-
70
- global $wpdb;
71
- $table_name = $wpdb->prefix . "social_users";
72
- $sql = "CREATE TABLE $table_name (
73
- `ID` int(11) NOT NULL,
74
- `type` varchar(20) NOT NULL,
75
- `identifier` varchar(100) NOT NULL,
76
- KEY `ID` (`ID`,`type`)
77
- );";
78
- require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
79
- dbDelta($sql);
80
- }
81
-
82
- register_activation_hook(__FILE__, 'nextend_fb_connect_install');
83
-
84
- /*
85
- Adding query vars for the WP parser
86
- */
87
-
88
- function new_fb_add_query_var() {
89
-
90
- global $wp;
91
- $wp->add_query_var('editProfileRedirect');
92
- $wp->add_query_var('loginFacebook');
93
- $wp->add_query_var('loginFacebookdoauth');
94
- }
95
-
96
- add_filter('init', 'new_fb_add_query_var');
97
-
98
- /* -----------------------------------------------------------------------------
99
- Main function to handle the Sign in/Register/Linking process
100
- ----------------------------------------------------------------------------- */
101
-
102
- /*
103
- Compatibility for older versions
104
- */
105
-
106
- function new_fb_login_compat() {
107
-
108
- global $wp;
109
- if ($wp->request == 'loginFacebook' || isset($wp->query_vars['loginFacebook'])) {
110
- new_fb_login_action();
111
- }
112
- }
113
-
114
- add_action('parse_request', 'new_fb_login_compat');
115
-
116
- /*
117
- For login page
118
- */
119
-
120
- function new_fb_login() {
121
-
122
- if (isset($_REQUEST['loginFacebook']) && $_REQUEST['loginFacebook'] == '1') {
123
- new_fb_login_action();
124
- }
125
- }
126
-
127
- add_action('login_init', 'new_fb_login');
128
-
129
- function new_fb_login_action() {
130
-
131
- global $wp, $wpdb, $new_fb_settings;
132
- if (isset($_GET['action']) && $_GET['action'] == 'unlink') {
133
- $user_info = wp_get_current_user();
134
- if ($user_info->ID) {
135
- $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'social_users
136
- WHERE ID = %d
137
- AND type = \'fb\'', $user_info->ID));
138
- set_site_transient($user_info->ID . '_new_fb_admin_notice', __('Your Facebook profile is successfully unlinked from your account.', 'nextend-facebook-connect'), 3600);
139
- }
140
- new_fb_redirect();
141
- }
142
-
143
- if (is_user_logged_in() && new_fb_is_user_connected()) {
144
- new_fb_redirect();
145
- exit;
146
- }
147
-
148
- if (!class_exists('Facebook')) {
149
- require(dirname(__FILE__) . '/Facebook/autoload.php');
150
- }
151
-
152
- $settings = maybe_unserialize(get_option('nextend_fb_connect'));
153
-
154
- if (defined('NEXTEND_FB_APP_ID')) $settings['fb_appid'] = NEXTEND_FB_APP_ID;
155
- if (defined('NEXTEND_FB_APP_SECRET')) $settings['fb_secret'] = NEXTEND_FB_APP_SECRET;
156
-
157
- $fb = new Facebook\Facebook(array(
158
- 'app_id' => $settings['fb_appid'],
159
- 'app_secret' => $settings['fb_secret'],
160
- 'persistent_data_handler' => new Facebook\PersistentData\FacebookWordPressPersistentDataHandler(nextend_uniqid())
161
- ));
162
-
163
- if (isset($_REQUEST['code'])) {
164
- $helper = $fb->getRedirectLoginHelper();
165
- try {
166
- $accessToken = $helper->getAccessToken(new_fb_login_url());
167
- } catch (Facebook\Exceptions\FacebookResponseException $e) {
168
- // When Graph returns an error
169
- echo 'Graph returned an error: ' . $e->getMessage();
170
- exit;
171
- } catch (Facebook\Exceptions\FacebookSDKException $e) {
172
- // When validation fails or other local issues
173
- echo 'Facebook SDK returned an error: ' . $e->getMessage();
174
- exit;
175
- }
176
-
177
- if (!isset($accessToken)) {
178
- if ($helper->getError()) {
179
- header('HTTP/1.0 401 Unauthorized');
180
- echo "Error: " . $helper->getError() . "\n";
181
- echo "Error Code: " . $helper->getErrorCode() . "\n";
182
- echo "Error Reason: " . $helper->getErrorReason() . "\n";
183
- echo "Error Description: " . $helper->getErrorDescription() . "\n";
184
- } else {
185
- header('HTTP/1.0 400 Bad Request');
186
- echo 'Bad request';
187
- }
188
- exit;
189
- }
190
-
191
- // The OAuth 2.0 client handler helps us manage access tokens
192
- $oAuth2Client = $fb->getOAuth2Client();
193
-
194
- if (!$accessToken->isLongLived()) {
195
- // Exchanges a short-lived access token for a long-lived one
196
- try {
197
- $accessToken = $oAuth2Client->getLongLivedAccessToken($accessToken);
198
- } catch (Facebook\Exceptions\FacebookSDKException $e) {
199
- echo "<p>Error getting long-lived access token: " . $helper->getMessage() . "</p>\n\n";
200
- exit;
201
- }
202
- }
203
-
204
- $response = $fb->get('/me?fields=id,name,email,first_name,last_name', $accessToken);
205
- $user_profile = $response->getGraphUser();
206
-
207
- $ID = $wpdb->get_var($wpdb->prepare('
208
- SELECT ID FROM ' . $wpdb->prefix . 'social_users WHERE type = "fb" AND identifier = "%d"
209
- ', $user_profile['id']));
210
- if (!get_user_by('id', $ID)) {
211
- $wpdb->query($wpdb->prepare('
212
- DELETE FROM ' . $wpdb->prefix . 'social_users WHERE ID = "%d"
213
- ', $ID));
214
- $ID = null;
215
- }
216
- if (!is_user_logged_in()) {
217
- if ($ID == NULL) { // Register
218
-
219
- if (!isset($user_profile['email'])) $user_profile['email'] = $user_profile['id'] . '@facebook.com';
220
- $ID = email_exists($user_profile['email']);
221
- if ($ID == false) { // Real register
222
-
223
- require_once(ABSPATH . WPINC . '/registration.php');
224
- $random_password = wp_generate_password($length = 12, $include_standard_special_chars = false);
225
- if (!isset($new_fb_settings['fb_user_prefix'])) $new_fb_settings['fb_user_prefix'] = 'facebook-';
226
-
227
- $username = strtolower($user_profile['first_name'] . $user_profile['last_name']);
228
- $sanitized_user_login = sanitize_user($new_fb_settings['fb_user_prefix'] . $username);
229
- if (!validate_username($sanitized_user_login)) {
230
- $sanitized_user_login = sanitize_user('facebook' . $user_profile['id']);
231
- }
232
- $defaul_user_name = $sanitized_user_login;
233
- $i = 1;
234
- while (username_exists($sanitized_user_login)) {
235
- $sanitized_user_login = $defaul_user_name . $i;
236
- $i++;
237
- }
238
- $ID = wp_create_user($sanitized_user_login, $random_password, $user_profile['email']);
239
- if (!is_wp_error($ID)) {
240
- wp_new_user_notification($ID, $random_password);
241
- $user_info = get_userdata($ID);
242
- wp_update_user(array(
243
- 'ID' => $ID,
244
- 'display_name' => $user_profile['name'],
245
- 'first_name' => $user_profile['first_name'],
246
- 'last_name' => $user_profile['last_name']
247
- ));
248
-
249
- //update_user_meta( $ID, 'new_fb_default_password', $user_info->user_pass);
250
- do_action('nextend_fb_user_registered', $ID, $user_profile, $fb);
251
- } else {
252
- return;
253
- }
254
- }
255
- if ($ID) {
256
- $wpdb->insert($wpdb->prefix . 'social_users', array(
257
- 'ID' => $ID,
258
- 'type' => 'fb',
259
- 'identifier' => $user_profile['id']
260
- ), array(
261
- '%d',
262
- '%s',
263
- '%s'
264
- ));
265
- }
266
- if (isset($new_fb_settings['fb_redirect_reg']) && $new_fb_settings['fb_redirect_reg'] != '' && $new_fb_settings['fb_redirect_reg'] != 'auto') {
267
- set_site_transient(nextend_uniqid() . '_fb_r', $new_fb_settings['fb_redirect_reg'], 3600);
268
- }
269
- }
270
- if ($ID) { // Login
271
-
272
- $secure_cookie = is_ssl();
273
- $secure_cookie = apply_filters('secure_signon_cookie', $secure_cookie, array());
274
- global $auth_secure_cookie; // XXX ugly hack to pass this to wp_authenticate_cookie
275
-
276
- $auth_secure_cookie = $secure_cookie;
277
- wp_set_auth_cookie($ID, true, $secure_cookie);
278
- $user_info = get_userdata($ID);
279
- update_user_meta($ID, 'fb_profile_picture', 'https://graph.facebook.com/' . $user_profile['id'] . '/picture?type=large');
280
- do_action('wp_login', $user_info->user_login, $user_info);
281
- update_user_meta($ID, 'fb_user_access_token', $accessToken);
282
- do_action('nextend_fb_user_logged_in', $ID, $user_profile, $fb);
283
- }
284
- } else {
285
- $current_user = wp_get_current_user();
286
- if ($current_user->ID == $ID) {
287
-
288
- // It was a simple login
289
-
290
- } elseif ($ID === NULL) { // Let's connect the accout to the current user!
291
-
292
- $wpdb->insert($wpdb->prefix . 'social_users', array(
293
- 'ID' => $current_user->ID,
294
- 'type' => 'fb',
295
- 'identifier' => $user_profile['id']
296
- ), array(
297
- '%d',
298
- '%s',
299
- '%s'
300
- ));
301
- update_user_meta($current_user->ID, 'fb_user_access_token', (string) $accessToken);
302
- do_action('nextend_fb_user_account_linked', $ID, $user_profile, $fb);
303
- $user_info = wp_get_current_user();
304
- set_site_transient($user_info->ID . '_new_fb_admin_notice', __('Your Facebook profile is successfully linked with your account. Now you can sign in with Facebook easily.', 'nextend-facebook-connect'), 3600);
305
- } else {
306
- $user_info = wp_get_current_user();
307
- set_site_transient($user_info->ID . '_new_fb_admin_notice', __('This Facebook profile is already linked with other account. Linking process failed!', 'nextend-facebook-connect'), 3600);
308
- }
309
- }
310
- new_fb_redirect();
311
- } else {
312
- $helper = $fb->getRedirectLoginHelper();
313
-
314
- $permissions = apply_filters('nextend_fb_permissions', array('email'));
315
- $loginUrl = $helper->getLoginUrl(new_fb_login_url(), $permissions);
316
-
317
- if (isset($new_fb_settings['fb_redirect']) && $new_fb_settings['fb_redirect'] != '' && $new_fb_settings['fb_redirect'] != 'auto') {
318
- $_GET['redirect'] = $new_fb_settings['fb_redirect'];
319
- }
320
- if (isset($_GET['redirect'])) {
321
- set_site_transient(nextend_uniqid() . '_fb_r', $_GET['redirect'], 3600);
322
- }
323
- $redirect = get_site_transient(nextend_uniqid() . '_fb_r');
324
- if ($redirect == '' || $redirect == new_fb_login_url()) {
325
- set_site_transient(nextend_uniqid() . '_fb_r', site_url(), 3600);
326
- }
327
-
328
- header('Location: ' . $loginUrl);
329
- exit;
330
- }
331
- }
332
-
333
- /*
334
- Is the current user connected the Facebook profile?
335
- */
336
-
337
- function new_fb_is_user_connected() {
338
-
339
- global $wpdb;
340
- $current_user = wp_get_current_user();
341
- $ID = $wpdb->get_var($wpdb->prepare('
342
- SELECT identifier FROM ' . $wpdb->prefix . 'social_users WHERE type = "fb" AND ID = "%d"
343
- ', $current_user->ID));
344
- if ($ID === NULL) return false;
345
-
346
- return $ID;
347
- }
348
-
349
- function new_fb_get_user_access_token($id) {
350
-
351
- return get_user_meta($id, 'fb_user_access_token', true);
352
- }
353
-
354
- /*
355
- Connect Field in the Profile page
356
- */
357
-
358
- function new_add_fb_connect_field() {
359
-
360
- global $new_is_social_header;
361
-
362
- //if(new_fb_is_user_connected()) return;
363
- if ($new_is_social_header === NULL) {
364
- ?>
365
- <h3>Social connect</h3>
366
- <?php
367
- $new_is_social_header = true;
368
- }
369
- ?>
370
- <table class="form-table">
371
- <tbody>
372
- <tr>
373
- <th>
374
- </th>
375
- <td>
376
- <?php
377
- if (new_fb_is_user_connected()) {
378
- echo new_fb_unlink_button();
379
- } else {
380
- echo new_fb_link_button();
381
- }
382
- ?>
383
- </td>
384
- </tr>
385
- </tbody>
386
- </table>
387
- <?php
388
- }
389
-
390
- add_action('profile_personal_options', 'new_add_fb_connect_field');
391
-
392
- function new_add_fb_login_form() {
393
-
394
- ?>
395
- <script type="text/javascript">
396
- if (jQuery.type(has_social_form) === "undefined") {
397
- var has_social_form = false;
398
- var socialLogins = null;
399
- }
400
- jQuery(document).ready(function () {
401
- (function ($) {
402
- if (!has_social_form) {
403
- has_social_form = true;
404
- var loginForm = $('#loginform,#registerform,#front-login-form,#setupform');
405
- socialLogins = $('<div class="newsociallogins" style="text-align: center;"><div style="clear:both;"></div></div>');
406
- if (loginForm.find('input').length > 0)
407
- loginForm.prepend("<h3 style='text-align:center;'><?php _e('OR'); ?></h3>");
408
- loginForm.prepend(socialLogins);
409
- socialLogins = loginForm.find('.newsociallogins');
410
- }
411
- if (!window.fb_added) {
412
- socialLogins.prepend('<?php echo addslashes(preg_replace('/^\s+|\n|\r|\s+$/m', '', new_fb_sign_button())); ?>');
413
- window.fb_added = true;
414
- }
415
- }(jQuery));
416
- });
417
- </script>
418
- <?php
419
- }
420
-
421
- add_action('login_form', 'new_add_fb_login_form');
422
- add_action('register_form', 'new_add_fb_login_form');
423
- add_action('bp_sidebar_login_form', 'new_add_fb_login_form');
424
- add_filter('get_avatar', 'new_fb_insert_avatar', 5, 5);
425
-
426
- function new_fb_insert_avatar($avatar = '', $id_or_email, $size = 96, $default = '', $alt = false) {
427
-
428
- $id = 0;
429
- if (is_numeric($id_or_email)) {
430
- $id = $id_or_email;
431
- } else if (is_string($id_or_email)) {
432
- $u = get_user_by('email', $id_or_email);
433
- $id = $u->id;
434
- } else if (is_object($id_or_email)) {
435
- $id = $id_or_email->user_id;
436
- }
437
- if ($id == 0) return $avatar;
438
- $pic = get_user_meta($id, 'fb_profile_picture', true);
439
- if (!$pic || $pic == '') return $avatar;
440
- $avatar = preg_replace('/src=("|\').*?("|\')/i', 'src=\'' . $pic . '\'', $avatar);
441
-
442
- return $avatar;
443
- }
444
-
445
- add_filter('bp_core_fetch_avatar', 'new_fb_bp_insert_avatar', 3, 5);
446
-
447
- function new_fb_bp_insert_avatar($avatar = '', $params, $id) {
448
- if (!is_numeric($id) || strpos($avatar, 'gravatar') === false) return $avatar;
449
- $pic = get_user_meta($id, 'fb_profile_picture', true);
450
- if (!$pic || $pic == '') return $avatar;
451
- $avatar = preg_replace('/src=("|\').*?("|\')/i', 'src=\'' . $pic . '\'', $avatar);
452
-
453
- return $avatar;
454
- }
455
-
456
- /*
457
- Options Page
458
- */
459
- require_once(trailingslashit(dirname(__FILE__)) . "nextend-facebook-settings.php");
460
- if (class_exists('NextendFBSettings')) {
461
- $nextendfbsettings = new NextendFBSettings();
462
- if (isset($nextendfbsettings)) {
463
- add_action('admin_menu', array(
464
- &$nextendfbsettings,
465
- 'NextendFB_Menu'
466
- ), 1);
467
- }
468
- }
469
- add_filter('plugin_action_links', 'new_fb_plugin_action_links', 10, 2);
470
-
471
- function new_fb_plugin_action_links($links, $file) {
472
-
473
- if ($file != NEW_FB_LOGIN_PLUGIN_BASENAME) return $links;
474
- $settings_link = '<a href="' . esc_url(menu_page_url('nextend-facebook-connect', false)) . '">' . esc_html(__('Settings', 'nextend-facebook-connect')) . '</a>';
475
- array_unshift($links, $settings_link);
476
-
477
- return $links;
478
- }
479
-
480
- /* -----------------------------------------------------------------------------
481
- Miscellaneous functions
482
- ----------------------------------------------------------------------------- */
483
-
484
- function new_fb_sign_button() {
485
-
486
- global $new_fb_settings;
487
-
488
- return '<a href="' . esc_url(new_fb_login_url() . (isset($_GET['redirect_to']) ? '&redirect=' . $_GET['redirect_to'] : '')) . '" rel="nofollow">' . $new_fb_settings['fb_login_button'] . '</a><br />';
489
- }
490
-
491
- function new_fb_link_button() {
492
-
493
- global $new_fb_settings;
494
-
495
- return '<a href="' . esc_url(new_fb_login_url() . '&redirect=' . new_fb_curPageURL()) . '">' . $new_fb_settings['fb_link_button'] . '</a><br />';
496
  }
497
 
498
- function new_fb_unlink_button() {
499
-
500
- global $new_fb_settings;
501
-
502
- return '<a href="' . esc_url(new_fb_login_url() . '&action=unlink&redirect=' . new_fb_curPageURL()) . '">' . $new_fb_settings['fb_unlink_button'] . '</a><br />';
503
  }
504
-
505
- function new_fb_curPageURL() {
506
- global $wp;
507
- return home_url(add_query_arg(array(),$wp->request));
508
- }
509
-
510
- function new_fb_login_url() {
511
-
512
- return site_url('wp-login.php') . '?loginFacebook=1';
513
- }
514
-
515
- function new_fb_redirect() {
516
-
517
- $redirect = get_site_transient(nextend_uniqid() . '_fb_r');
518
-
519
- if (!$redirect || $redirect == '' || $redirect == new_fb_login_url()) {
520
- if (isset($_GET['redirect'])) {
521
- $redirect = $_GET['redirect'];
522
- } else {
523
- $redirect = site_url();
524
- }
525
- }
526
- $redirect = wp_sanitize_redirect($redirect);
527
- $redirect = wp_validate_redirect($redirect, site_url());
528
- header('LOCATION: ' . $redirect);
529
- delete_site_transient(nextend_uniqid() . '_fb_r');
530
- exit;
531
- }
532
-
533
- function new_fb_edit_profile_redirect() {
534
-
535
- global $wp;
536
- if (isset($wp->query_vars['editProfileRedirect'])) {
537
- if (function_exists('bp_loggedin_user_domain')) {
538
- header('LOCATION: ' . bp_loggedin_user_domain() . 'profile/edit/group/1/');
539
- } else {
540
- header('LOCATION: ' . self_admin_url('profile.php'));
541
- }
542
- exit;
543
- }
544
- }
545
-
546
- add_action('parse_request', 'new_fb_edit_profile_redirect');
547
-
548
- function new_fb_jquery() {
549
-
550
- wp_enqueue_script('jquery');
551
- }
552
-
553
- add_action('login_form_login', 'new_fb_jquery');
554
- add_action('login_form_register', 'new_fb_jquery');
555
-
556
- /*
557
- Session notices used in the profile settings
558
- */
559
-
560
- function new_fb_admin_notice() {
561
- $user_info = wp_get_current_user();
562
- $notice = get_site_transient($user_info->ID . '_new_fb_admin_notice');
563
- if ($notice !== false) {
564
- echo '<div class="updated">
565
- <p>' . $notice . '</p>
566
- </div>';
567
- delete_site_transient($user_info->ID . '_new_fb_admin_notice');
568
- }
569
  }
570
 
571
- add_action('admin_notices', 'new_fb_admin_notice');
1
  <?php
 
2
  /*
3
+ Plugin Name: Nextend Social Login
4
  Plugin URI: https://nextendweb.com/
5
+ Description: Nextend Social Login displays social login buttons for Facebook, Google and Twitter.
6
+ Version: 3.0.1
7
  Author: Nextendweb
8
  License: GPL2
9
+ Text Domain: nextend-facebook-connect
10
+ Domain Path: /languages
11
  */
12
 
13
+ if (!defined('NSL_PATH_FILE')) {
14
+ define('NSL_PATH_FILE', __FILE__);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  }
16
 
17
+ if (!defined('NSL_PATH')) {
18
+ define('NSL_PATH', dirname(NSL_PATH_FILE));
 
 
 
19
  }
20
+ if (!defined('NSL_PLUGIN_BASENAME')) {
21
+ define('NSL_PLUGIN_BASENAME', plugin_basename(NSL_PATH_FILE));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  }
23
 
24
+ require_once(NSL_PATH . '/nextend-social-login.php');
nextend-facebook-settings.php DELETED
@@ -1,270 +0,0 @@
1
- <?php
2
- /*
3
- Nextend FB Connect Settings Page
4
- */
5
-
6
- $newfb_status = "normal";
7
-
8
- if (!class_exists('NextendFBSettings')) {
9
-
10
- add_action('admin_init', array(
11
- 'NextendFBSettings',
12
- 'store_settings'
13
- ));
14
-
15
- class NextendFBSettings {
16
-
17
- static function store_settings() {
18
- if (current_user_can('manage_options')) {
19
- if (isset($_POST['newfb_update_options']) && check_admin_referer('nextend-facebook-connect')) {
20
- if ($_POST['newfb_update_options'] == 'Y') {
21
- foreach ($_POST AS $k => $v) {
22
- $_POST[$k] = stripslashes($v);
23
- }
24
- unset($_POST['Submit']);
25
- $sanitize = array(
26
- 'newfb_update_options',
27
- 'fb_appid',
28
- 'fb_secret',
29
- 'fb_redirect',
30
- 'fb_redirect_reg',
31
- 'fb_load_style'
32
- );
33
- foreach ($sanitize AS $k) {
34
- $_POST[$k] = sanitize_text_field($_POST[$k]);
35
- }
36
-
37
- $_POST['fb_user_prefix'] = preg_replace("/[^A-Za-z0-9\-_ ]/", '', $_POST['fb_user_prefix']);
38
- update_option("nextend_fb_connect", maybe_serialize($_POST));
39
- $newfb_status = 'update_success';
40
- }
41
- }
42
- }
43
- }
44
-
45
- static function NextendFB_Options_Page() {
46
- $domain = get_option('siteurl');
47
- $domain = str_replace(array(
48
- 'http://',
49
- 'https://'
50
- ), array(
51
- '',
52
- ''
53
- ), $domain);
54
- $domain = str_replace('www.', '', $domain);
55
- $a = explode("/", $domain);
56
- $domain = $a[0];
57
- ?>
58
-
59
- <div class="wrap">
60
- <div id="newfb-options">
61
- <div id="newfb-title"><h2>Nextend Facebook Connect Settings</h2></div>
62
- <?php
63
- global $newfb_status;
64
- if ($newfb_status == 'update_success') $message = __('Configuration updated', 'nextend-facebook-connect') . "<br />"; else if ($newfb_status == 'update_failed') $message = __('Error while saving options', 'nextend-facebook-connect') . "<br />"; else
65
- $message = '';
66
-
67
- if ($message != "") {
68
- ?>
69
- <div class="updated"><strong><p><?php
70
- echo $message;
71
- ?></p></strong></div><?php
72
- } ?>
73
-
74
- <?php
75
- if (!function_exists('curl_init')) {
76
- ?>
77
- <div class="error"><strong><p>Facebook needs the CURL PHP extension. Contact your server adminsitrator!</p></strong></div>
78
- <?php
79
- } else {
80
- $version = curl_version();
81
- $ssl_supported = ($version['features'] & CURL_VERSION_SSL);
82
- if (!$ssl_supported) {
83
- ?>
84
- <div class="error"><strong><p>Protocol https not supported or disabled in libcurl. Contact your server adminsitrator!</p></strong></div>
85
- <?php
86
- }
87
- }
88
- if (!function_exists('json_decode')) {
89
- ?>
90
- <div class="error"><strong><p>Facebook needs the JSON PHP extension. Contact your server adminsitrator!</p></strong></div>
91
- <?php
92
- }
93
- ?>
94
-
95
- <div id="newfb-desc">
96
- <p><?php _e('This plugins helps you create Facebook login and register buttons. The login and register process only takes one click and you can fully customize the buttons with images and other assets.', 'nextend-facebook-connect'); ?></p>
97
- <h3><?php _e('Setup', 'nextend-facebook-connect'); ?></h3>
98
- <p>
99
- <?php _e('<ol><li><a href="https://developers.facebook.com/apps/" target="_blank">Create a facebook app!</a></li>', 'nextend-facebook-connect'); ?>
100
- <?php _e('<li>Don\'t choose from the listed options, but click on <b>advanced setup</b> in the bottom.</li>', 'nextend-facebook-connect'); ?>
101
- <?php _e('<li>Choose an <b>app name</b>, and a <b>category</b>, then click on <b>Create App ID</b>.</li>', 'nextend-facebook-connect'); ?>
102
- <?php _e('<li>Pass the security check.</li>', 'nextend-facebook-connect'); ?>
103
- <?php _e('<li>Go to the <b>Settings</b> of the application.</li>', 'nextend-facebook-connect'); ?>
104
- <?php _e('<li>Click on <b>+ Add Platform</b>, and choose <b>Website</b>.</li>', 'nextend-facebook-connect'); ?>
105
- <?php _e('<li>Give your website\'s address at the <b>Site URL</b> field with: <b>' . get_option('siteurl') . '</b></li>', 'nextend-facebook-connect'); ?>
106
- <?php _e('<li>Give a <b>Contact Email</b> and click on <b>Save Changes</b>.</li>', 'nextend-facebook-connect'); ?>
107
- <?php _e('<li>Go to <b>Status & Review</b>, and change the availability for the general public to <b>YES</b>.</li>', 'nextend-facebook-connect'); ?>
108
- <?php _e('<li>Go back to the <b>Settings</b>, and copy the <b>App ID</b>, and <b>APP Secret</b>, which you have to copy and paste below.</li>', 'nextend-facebook-connect'); ?>
109
- <?php _e('<li><b>Save changes!</b></li></ol>', 'nextend-facebook-connect'); ?>
110
-
111
-
112
- </p>
113
- <h3><?php _e('Usage', 'nextend-facebook-connect'); ?></h3>
114
- <h4><?php _e('Simple link', 'nextend-facebook-connect'); ?></h4>
115
- <p><?php _e('&lt;a href="' . new_fb_login_url() . '&redirect=' . get_option('siteurl') . '" onclick="window.location = \'' . new_fb_login_url() . '&redirect=\'+window.location.href; return false;"&gt;Click here to login or register with Facebook&lt;/a&gt;', 'nextend-facebook-connect'); ?></p>
116
-
117
- <h4><?php _e('Image button', 'nextend-facebook-connect'); ?></h4>
118
- <p><?php _e('&lt;a href="' . new_fb_login_url() . '&redirect=' . get_option('siteurl') . '" onclick="window.location = \'' . new_fb_login_url() . '&redirect=\'+window.location.href; return false;"&gt; &lt;img src="HereComeTheImage" /&gt; &lt;/a&gt;', 'nextend-facebook-connect'); ?></p>
119
-
120
- <h3><?php _e('Note', 'nextend-facebook-connect'); ?></h3>
121
- <p><?php _e('If the Facebook user\'s email address already used by another member of your site, the facebook profile will be automatically linked to the existing profile!', 'nextend-facebook-connect'); ?></p>
122
-
123
- </div>
124
-
125
- <!--right-->
126
- <div class="postbox-container" style="float:right;width:30%;">
127
- <div class="metabox-holder">
128
- <div class="meta-box-sortables">
129
-
130
- <!--about-->
131
- <div id="newfb-about" class="postbox">
132
- <h3 class="hndle"><?php _e('About this plugin', 'nextend-facebook-connect'); ?></h3>
133
- <div class="inside"><ul>
134
-
135
- <li><a href="http://www.nextendweb.com/social-connect-plugins-for-wordpress.html" target="_blank"><?php _e('Check the related <b>blog post</b>!', 'nextend-facebook-connect'); ?></a></li>
136
- <li><br></li>
137
- <li><a href="http://wordpress.org/extend/plugins/nextend-facebook-connect/" target="_blank"><?php _e('Nextend Facebook Connect', 'nextend-facebook-connect'); ?></a></li>
138
- <li><br></li>
139
- <li><a href="http://profiles.wordpress.org/nextendweb" target="_blank"><?php _e('Nextend plugins at WordPress.org', 'nextend-facebook-connect'); ?></a></li>
140
- </ul></div>
141
- </div>
142
- <!--about end-->
143
-
144
- <!--others-->
145
- <!--others end-->
146
-
147
- </div></div></div>
148
- <!--right end-->
149
-
150
- <!--left-->
151
- <div class="postbox-container" style="float:left;width: 69%;">
152
- <div class="metabox-holder">
153
- <div class="meta-box-sortabless">
154
-
155
- <!--setting-->
156
- <div id="newfb-setting" class="postbox">
157
- <h3 class="hndle"><?php _e('Settings', 'nextend-facebook-connect'); ?></h3>
158
- <?php $nextend_fb_connect = maybe_unserialize(get_option('nextend_fb_connect')); ?>
159
-
160
- <form method="post" action="<?php echo get_bloginfo("wpurl"); ?>/wp-admin/options-general.php?page=nextend-facebook-connect">
161
- <?php wp_nonce_field('nextend-facebook-connect'); ?>
162
- <input type="hidden" name="newfb_update_options" value="Y">
163
-
164
- <table class="form-table">
165
- <tr>
166
- <th scope="row"><?php _e('Facebook App ID:', 'nextend-facebook-connect'); ?></th>
167
- <td>
168
- <input type="text" name="fb_appid" value="<?php echo esc_html($nextend_fb_connect['fb_appid']); ?>"/>
169
- </td>
170
- </tr>
171
-
172
- <tr>
173
- <th scope="row"><?php _e('Facebook App Secret:', 'nextend-facebook-connect'); ?></th>
174
- <td>
175
- <input type="text" name="fb_secret" value="<?php echo esc_html($nextend_fb_connect['fb_secret']); ?>"/>
176
- </td>
177
- </tr>
178
-
179
- <tr>
180
- <th scope="row"><?php _e('New user prefix:', 'nextend-facebook-connect'); ?></th>
181
- <td>
182
- <?php if (!isset($nextend_fb_connect['fb_user_prefix'])) $nextend_fb_connect['fb_user_prefix'] = 'Facebook - '; ?>
183
- <input type="text" name="fb_user_prefix" value="<?php echo esc_html($nextend_fb_connect['fb_user_prefix']); ?>"/>
184
- </td>
185
- </tr>
186
-
187
- <tr>
188
- <th scope="row"><?php _e('Fixed redirect url for login:', 'nextend-facebook-connect'); ?></th>
189
- <td>
190
- <?php if (!isset($nextend_fb_connect['fb_redirect'])) $nextend_fb_connect['fb_redirect'] = 'auto'; ?>
191
- <input type="text" name="fb_redirect" value="<?php echo esc_html($nextend_fb_connect['fb_redirect']); ?>"/>
192
- </td>
193
- </tr>
194
-
195
- <tr>
196
- <th scope="row"><?php _e('Fixed redirect url for register:', 'nextend-facebook-connect'); ?></th>
197
- <td>
198
- <?php if (!isset($nextend_fb_connect['fb_redirect_reg'])) $nextend_fb_connect['fb_redirect_reg'] = 'auto'; ?>
199
- <input type="text" name="fb_redirect_reg" value="<?php echo esc_html($nextend_fb_connect['fb_redirect_reg']); ?>"/>
200
- </td>
201
- </tr>
202
-
203
- <tr>
204
- <th scope="row"><?php _e('Load button stylesheet:', 'nextend-facebook-connect'); ?></th>
205
- <td>
206
- <?php if (!isset($nextend_fb_connect['fb_load_style'])) $nextend_fb_connect['fb_load_style'] = 1; ?>
207
- <input name="fb_load_style" id="fb_load_style_yes" value="1" type="radio" <?php if (isset($nextend_fb_connect['fb_load_style']) && $nextend_fb_connect['fb_load_style']) { ?> checked <?php } ?>> Yes &nbsp;&nbsp;&nbsp;&nbsp;
208
- <input name="fb_load_style" id="fb_load_style_no" value="0" type="radio" <?php if (isset($nextend_fb_connect['fb_load_style']) && $nextend_fb_connect['fb_load_style'] == 0) { ?> checked <?php } ?>> No
209
- </td>
210
- </tr>
211
-
212
- <tr>
213
- <th scope="row"><?php _e('Login button:', 'nextend-facebook-connect'); ?></th>
214
- <td>
215
- <?php if (!isset($nextend_fb_connect['fb_login_button'])) $nextend_fb_connect['fb_login_button'] = '<div class="new-fb-btn new-fb-1 new-fb-default-anim"><div class="new-fb-1-1"><div class="new-fb-1-1-1">CONNECT WITH</div></div></div>'; ?>
216
- <textarea cols="83" rows="3" name="fb_login_button"><?php echo esc_html($nextend_fb_connect['fb_login_button']); ?></textarea>
217
- </td>
218
- </tr>
219
-
220
- <tr>
221
- <th scope="row"><?php _e('Link account button:', 'nextend-facebook-connect'); ?></th>
222
- <td>
223
- <?php if (!isset($nextend_fb_connect['fb_link_button'])) $nextend_fb_connect['fb_link_button'] = '<div class="new-fb-btn new-fb-1 new-fb-default-anim"><div class="new-fb-1-1"><div class="new-fb-1-1-1">LINK ACCOUNT TO</div></div></div>'; ?>
224
- <textarea cols="83" rows="3" name="fb_link_button"><?php echo esc_html($nextend_fb_connect['fb_link_button']); ?></textarea>
225
- </td>
226
- </tr>
227
-
228
- <tr>
229
- <th scope="row"><?php _e('Unlink account button:', 'nextend-facebook-connect'); ?></th>
230
- <td>
231
- <?php if (!isset($nextend_fb_connect['fb_unlink_button'])) $nextend_fb_connect['fb_unlink_button'] = '<div class="new-fb-btn new-fb-1 new-fb-default-anim"><div class="new-fb-1-1"><div class="new-fb-1-1-1">UNLINK ACCOUNT</div></div></div>'; ?>
232
- <textarea cols="83" rows="3" name="fb_unlink_button"><?php echo esc_html($nextend_fb_connect['fb_unlink_button']); ?></textarea>
233
- </td>
234
- </tr>
235
- <tr>
236
- <th scope="row"></th>
237
- <td>
238
- <a href="http://www.nextendweb.com/social-connect-button-generator" target="_blank"><img style="margin-left: -4px;" src="<?php echo plugins_url('generatorbanner.png', __FILE__); ?>"/></a>
239
- </td>
240
- </tr>
241
- </table>
242
-
243
- <p class="submit">
244
- <input style="margin-left: 10%;" type="submit" name="Submit" value="<?php _e('Save Changes', 'nextend-facebook-connect'); ?>"/>
245
- </p>
246
- </form>
247
- </div>
248
- <!--setting end-->
249
-
250
- <!--others-->
251
- <!--others end-->
252
-
253
- </div></div></div>
254
- <!--left end-->
255
-
256
- </div>
257
- </div>
258
- <?php
259
- }
260
-
261
- function NextendFB_Menu() {
262
- add_options_page(__('Nextend FB Connect'), __('Nextend FB Connect'), 'manage_options', 'nextend-facebook-connect', array(
263
- 'NextendFBSettings',
264
- 'NextendFB_Options_Page'
265
- ));
266
- }
267
-
268
- }
269
- }
270
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
nextend-social-login.php ADDED
@@ -0,0 +1,633 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once(NSL_PATH . '/persistent.php');
4
+ require_once(NSL_PATH . '/class-settings.php');
5
+ require_once(NSL_PATH . '/includes/provider.php');
6
+ require_once(NSL_PATH . '/admin/admin.php');
7
+
8
+ require_once(NSL_PATH . '/compat.php');
9
+
10
+ class NextendSocialLogin {
11
+
12
+ public static $version = '3.0.1';
13
+
14
+ public static $nslPROMinVersion = '3.0.0';
15
+
16
+ public static function checkVersion() {
17
+ if (version_compare(self::$version, NextendSocialLoginPRO::$nslMinVersion, '<') || version_compare(NextendSocialLoginPRO::$version, self::$nslPROMinVersion, '<')) {
18
+ if (is_admin()) {
19
+ NextendSocialLoginAdminNotices::addError(sprintf(__('%5$s plugin (version: %1$s, required: %2$s or newer) is not compatible with the PRO addon (version: %3$s, required: %4$s or newer). Please upgrade to the latest version! PRO addon disabled.'), self::$version, NextendSocialLoginPRO::$nslMinVersion, NextendSocialLoginPRO::$version, self::$nslPROMinVersion, "Nextend Social Login"));
20
+ }
21
+
22
+ return false;
23
+ }
24
+
25
+ return true;
26
+ }
27
+
28
+ /** @var NextendSocialLoginSettings */
29
+ public static $settings;
30
+
31
+ private static $styles = array(
32
+ 'default' => array(
33
+ 'container' => 'nsl-container-block'
34
+ ),
35
+ 'icon' => array(
36
+ 'container' => 'nsl-container-inline'
37
+ )
38
+ );
39
+
40
+ public static $providersPath;
41
+
42
+ /**
43
+ * @var NextendSocialProviderDummy[]
44
+ */
45
+ public static $providers = array();
46
+
47
+ /**
48
+ * @var NextendSocialProvider[]
49
+ */
50
+ public static $enabledProviders = array();
51
+
52
+ private static $ordering = array();
53
+
54
+ private static $loginHeadAdded = false;
55
+ private static $counter = 1;
56
+
57
+ public static function init() {
58
+ add_action('plugins_loaded', 'NextendSocialLogin::plugins_loaded');
59
+ register_activation_hook(NSL_PATH_FILE, 'NextendSocialLogin::install');
60
+
61
+ add_action('activate_nextend-google-connect/nextend-google-connect.php', 'NextendSocialLogin::compatPreventActivationGoogle');
62
+ add_action('activate_nextend-twitter-connect/nextend-twitter-connect.php', 'NextendSocialLogin::compatPreventActivationTwitter');
63
+
64
+ add_action('delete_user', 'NextendSocialLogin::delete_user');
65
+
66
+ self::$settings = new NextendSocialLoginSettings('nextend_social_login', array(
67
+ 'enabled' => array(),
68
+ 'ordering' => array(
69
+ 'facebook',
70
+ 'google',
71
+ 'twitter'
72
+ ),
73
+ 'license_key' => '',
74
+ 'license_key_ok' => '0',
75
+ 'redirect' => '',
76
+ 'redirect_reg' => '',
77
+ 'login_form_layout' => 'below',
78
+ 'login_form_button_style' => 'default',
79
+ 'comment_login_button' => 'show',
80
+ 'comment_button_style' => 'default',
81
+ 'woocommerce_login' => 'after',
82
+ 'woocommerce_billing' => 'before',
83
+ 'woocoommerce_form_button_style' => 'default',
84
+ 'woocommerce_account_details' => 'before',
85
+ 'debug' => '0'
86
+ ));
87
+ }
88
+
89
+ public static function plugins_loaded() {
90
+
91
+ load_plugin_textdomain('nextend-facebook-connect', FALSE, basename(dirname(__FILE__)) . '/languages/');
92
+
93
+ NextendSocialLoginAdmin::init();
94
+
95
+ self::$providersPath = NSL_PATH . '/providers/';
96
+
97
+ $providers = array_diff(scandir(self::$providersPath), array(
98
+ '..',
99
+ '.'
100
+ ));
101
+
102
+ foreach ($providers AS $provider) {
103
+ if (file_exists(self::$providersPath . $provider . '/' . $provider . '.php')) {
104
+ require_once(self::$providersPath . $provider . '/' . $provider . '.php');
105
+ }
106
+ }
107
+
108
+ do_action('nsl-add-providers');
109
+
110
+ self::$ordering = array_flip(self::$settings->get('ordering'));
111
+ uksort(self::$providers, 'NextendSocialLogin::sortProviders');
112
+ uksort(self::$enabledProviders, 'NextendSocialLogin::sortProviders');
113
+
114
+ do_action('nsl-providers-loaded');
115
+
116
+ add_action('login_init', 'NextendSocialLogin::login_init');
117
+ add_action('wp_logout', 'NextendSocialLogin::wp_logout');
118
+
119
+ add_action('parse_request', 'NextendSocialLogin::editProfileRedirect');
120
+
121
+ if (count(self::$enabledProviders) > 0) {
122
+
123
+
124
+ add_action('login_form', 'NextendSocialLogin::addLoginFormButtons');
125
+ add_action('register_form', 'NextendSocialLogin::addLoginFormButtons');
126
+ add_action('bp_sidebar_login_form', 'NextendSocialLogin::addLoginButtons');
127
+
128
+
129
+ add_action('profile_personal_options', 'NextendSocialLogin::addLinkAndUnlinkButtons');
130
+
131
+ add_action('login_form_login', 'NextendSocialLogin::jQuery');
132
+ add_action('login_form_register', 'NextendSocialLogin::jQuery');
133
+
134
+ add_action('wp_head', 'NextendSocialLogin::styles', 100);
135
+ add_action('admin_head', 'NextendSocialLogin::styles', 100);
136
+ add_action('login_head', 'NextendSocialLogin::loginHead', 100);
137
+
138
+ add_action('wp_print_footer_scripts', 'NextendSocialLogin::scripts', 100);
139
+ add_action('login_footer', 'NextendSocialLogin::scripts', 100);
140
+
141
+
142
+ add_filter('get_avatar', 'NextendSocialLogin::renderAvatar', 5, 5);
143
+ add_filter('bp_core_fetch_avatar', 'NextendSocialLogin::renderAvatarBP', 3, 5);
144
+
145
+
146
+ add_shortcode('nextend_social_login', 'NextendSocialLogin::shortcode');
147
+ }
148
+
149
+ add_action('admin_print_footer_scripts', 'NextendSocialLogin::scripts', 100);
150
+
151
+ require_once(NSL_PATH . '/widget.php');
152
+ }
153
+
154
+ public static function styles() {
155
+
156
+ $stylesheet = self::get_template_part('style.css');
157
+ if (!empty($stylesheet) && file_exists($stylesheet)) {
158
+ echo '<style type="text/css">' . file_get_contents($stylesheet) . '</style>';
159
+ }
160
+ }
161
+
162
+ public static function loginHead() {
163
+ self::styles();
164
+
165
+ $template = self::get_template_part('login-layout-' . sanitize_file_name(self::$settings->get('login_form_layout')) . '.php');
166
+ if (!empty($template) && file_exists($template)) {
167
+ require($template);
168
+ }
169
+
170
+ self::$loginHeadAdded = true;
171
+ }
172
+
173
+ public static function scripts() {
174
+ $scripts = NSL_PATH . '/js/nsl.js';
175
+ if (file_exists($scripts)) {
176
+ echo '<script type="text/javascript">' . file_get_contents($scripts) . '</script>';
177
+ }
178
+ }
179
+
180
+ public static function install() {
181
+ global $wpdb;
182
+ $table_name = $wpdb->prefix . "social_users";
183
+ $sql = "CREATE TABLE " . $table_name . " (`ID` int(11) NOT NULL, `type` varchar(20) NOT NULL, `identifier` varchar(100) NOT NULL, KEY `ID` (`ID`,`type`));";
184
+ require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
185
+ dbDelta($sql);
186
+
187
+ //Legacy
188
+
189
+ $facebookSettings = maybe_unserialize(get_option('nextend_fb_connect'));
190
+
191
+ if (!empty($facebookSettings['fb_appid']) && !empty($facebookSettings['fb_secret'])) {
192
+ $providerPath = NSL_PATH . '/providers/facebook/facebook.php';
193
+ if (file_exists($providerPath)) {
194
+
195
+ require_once($providerPath);
196
+
197
+ self::$providers['facebook']->settings->update(array(
198
+ 'legacy' => 1
199
+ ));
200
+ }
201
+ }
202
+
203
+ if (function_exists('new_google_connect_install')) {
204
+ $googleSettings = maybe_unserialize(get_option('nextend_google_connect'));
205
+ if (!empty($googleSettings['google_client_id']) && !empty($googleSettings['google_client_secret'])) {
206
+ $providerPath = NSL_PATH . '/providers/google/google.php';
207
+ if (file_exists($providerPath)) {
208
+
209
+ require_once($providerPath);
210
+
211
+ self::$providers['google']->settings->update(array(
212
+ 'legacy' => 1
213
+ ));
214
+ }
215
+ }
216
+
217
+ add_action('activated_plugin', 'NextendSocialLogin::compatDeactivateGoogle');
218
+ }
219
+
220
+ if (function_exists('new_twitter_connect_install')) {
221
+ $twitterSettings = maybe_unserialize(get_option('nextend_twitter_connect'));
222
+ if (!empty($twitterSettings['twitter_consumer_key']) && !empty($twitterSettings['twitter_consumer_secret'])) {
223
+ $providerPath = NSL_PATH . '/providers/twitter/twitter.php';
224
+ if (file_exists($providerPath)) {
225
+
226
+ require_once($providerPath);
227
+
228
+ self::$providers['twitter']->settings->update(array(
229
+ 'legacy' => 1
230
+ ));
231
+ }
232
+ }
233
+
234
+ add_action('activated_plugin', 'NextendSocialLogin::compatDeactivateTwitter');
235
+ }
236
+ }
237
+
238
+ public static function compatDeactivateGoogle() {
239
+ if (is_plugin_active('nextend-google-connect/nextend-google-connect.php')) {
240
+ deactivate_plugins('nextend-google-connect/nextend-google-connect.php');
241
+ }
242
+ }
243
+
244
+ public static function compatPreventActivationGoogle() {
245
+ printf(__('%s took the place of Nextend Google Connect. You can delete Nextend Google Connect as it is not needed anymore.', 'nextend-facebook-connect'), "Nextend Social Login");
246
+ exit;
247
+ }
248
+
249
+ public static function compatDeactivateTwitter() {
250
+ if (is_plugin_active('nextend-twitter-connect/nextend-twitter-connect.php')) {
251
+ deactivate_plugins('nextend-twitter-connect/nextend-twitter-connect.php');
252
+ }
253
+ }
254
+
255
+ public static function compatPreventActivationTwitter() {
256
+ printf(__('%s took the place of Nextend Twitter Connect. You can delete Nextend Twitter Connect as it is not needed anymore.', 'nextend-facebook-connect'), "Nextend Social Login");
257
+ exit;
258
+ }
259
+
260
+ public static function sortProviders($a, $b) {
261
+ if (isset(self::$ordering[$a]) && isset(self::$ordering[$b])) {
262
+ if (self::$ordering[$a] < self::$ordering[$b]) {
263
+ return -1;
264
+ }
265
+
266
+ return 1;
267
+ }
268
+ if (isset(self::$ordering[$a])) {
269
+ return -1;
270
+ }
271
+
272
+ return 1;
273
+ }
274
+
275
+ /**
276
+ * @param $provider NextendSocialProviderDummy
277
+ */
278
+ public static function addProvider($provider) {
279
+ if (in_array($provider->getId(), self::$settings->get('enabled'))) {
280
+ if ($provider->isTested() && $provider->enable()) {
281
+ self::$enabledProviders[$provider->getId()] = $provider;
282
+ }
283
+ }
284
+ self::$providers[$provider->getId()] = $provider;
285
+ }
286
+
287
+ public static function enableProvider($providerID) {
288
+ if (isset(self::$providers[$providerID])) {
289
+ $enabled = self::$settings->get('enabled');
290
+ $enabled[] = self::$providers[$providerID]->getId();
291
+ $enabled = array_unique($enabled);
292
+
293
+ self::$settings->update(array(
294
+ 'enabled' => $enabled
295
+ ));
296
+ }
297
+ }
298
+
299
+ public static function disableProvider($providerID) {
300
+ if (isset(self::$providers[$providerID])) {
301
+
302
+ $enabled = array_diff(self::$settings->get('enabled'), array(self::$providers[$providerID]->getId()));
303
+
304
+ self::$settings->update(array(
305
+ 'enabled' => $enabled
306
+ ));
307
+ }
308
+ }
309
+
310
+ public static function isProviderEnabled($providerID) {
311
+ return isset(self::$enabledProviders[$providerID]);
312
+ }
313
+
314
+ public static function wp_logout() {
315
+ NextendSocialLoginPersistentAnonymous::destroy();
316
+ }
317
+
318
+ public static function login_init() {
319
+
320
+ add_filter('wp_login_errors', 'NextendSocialLogin::wp_login_errors');
321
+
322
+ if (isset($_GET['interim_login']) && $_GET['interim_login'] === 'nsl' && is_user_logged_in()) {
323
+ self::onInterimLoginSuccess();
324
+ }
325
+
326
+ if (isset($_REQUEST['loginFacebook']) && $_REQUEST['loginFacebook'] == '1') {
327
+ $_REQUEST['loginSocial'] = 'facebook';
328
+ }
329
+ if (isset($_REQUEST['loginGoogle']) && $_REQUEST['loginGoogle'] == '1') {
330
+ $_REQUEST['loginSocial'] = 'google';
331
+ }
332
+ if (isset($_REQUEST['loginTwitter']) && $_REQUEST['loginTwitter'] == '1') {
333
+ $_REQUEST['loginTwitter'] = 'twitter';
334
+ }
335
+
336
+ if (isset($_REQUEST['loginSocial']) && isset(self::$providers[$_REQUEST['loginSocial']]) && (self::$providers[$_REQUEST['loginSocial']]->isEnabled() || self::$providers[$_REQUEST['loginSocial']]->isTest())) {
337
+ self::$providers[$_REQUEST['loginSocial']]->connect();
338
+ }
339
+ }
340
+
341
+ private static function onInterimLoginSuccess() {
342
+ global $interim_login;
343
+ do_action("login_form_login");
344
+ $customize_login = isset($_REQUEST['customize-login']);
345
+ if ($customize_login) {
346
+ wp_enqueue_script('customize-base');
347
+ }
348
+
349
+ $message = '<p class="message">' . __('You have logged in successfully.') . '</p>';
350
+ $interim_login = 'success';
351
+ login_header('', $message); ?>
352
+ </div>
353
+ <?php
354
+ /** This action is documented in wp-login.php */
355
+ do_action('login_footer'); ?>
356
+ <?php if ($customize_login) : ?>
357
+ <script type="text/javascript">setTimeout(function () {
358
+ new wp.customize.Messenger({url: '<?php echo wp_customize_url(); ?>', channel: 'login'}).send(
359
+ 'login');
360
+ }, 1000);</script>
361
+ <?php endif; ?>
362
+ </body></html>
363
+ <?php exit;
364
+ }
365
+
366
+ public static function wp_login_errors($errors) {
367
+
368
+ if (empty($errors)) {
369
+ $errors = new WP_Error();
370
+ }
371
+
372
+
373
+ $error = NextendSocialLoginPersistentAnonymous::get('_login_error');
374
+ if ($error !== false) {
375
+ $errors->add('error', $error);
376
+ NextendSocialLoginPersistentAnonymous::delete('_login_error');
377
+ }
378
+
379
+ return $errors;
380
+ }
381
+
382
+ public static function editProfileRedirect() {
383
+ global $wp;
384
+
385
+ if (isset($wp->query_vars['editProfileRedirect'])) {
386
+ if (function_exists('bp_loggedin_user_domain')) {
387
+ header('LOCATION: ' . bp_loggedin_user_domain() . 'profile/edit/group/1/');
388
+ } else {
389
+ header('LOCATION: ' . self_admin_url('profile.php'));
390
+ }
391
+ exit;
392
+ }
393
+ }
394
+
395
+ public static function jQuery() {
396
+ wp_enqueue_script('jquery');
397
+ }
398
+
399
+ public static function addLoginFormButtons() {
400
+ self::renderLoginButtons();
401
+ }
402
+
403
+ public static function addLoginButtons() {
404
+ self::renderLoginButtons(NextendSocialLogin::getCurrentPageURL());
405
+ }
406
+
407
+ private static function renderLoginButtons($redirect_to = false) {
408
+
409
+ if (!self::$loginHeadAdded) {
410
+ $index = self::$counter++;
411
+ echo '<div id="nsl-custom-login-form-' . $index . '">' . self::renderButtonsWithContainer(self::$settings->get('login_form_button_style'), false, $redirect_to) . '</div>';
412
+ echo '<script type="text/javascript">(function($){$("document").ready(function(){var el = $("#nsl-custom-login-form-' . $index . '");el.appendTo(el.closest("form"))})})(jQuery)</script>';
413
+ } else {
414
+
415
+ echo self::renderButtonsWithContainer(self::$settings->get('login_form_button_style'), false, $redirect_to);
416
+ }
417
+
418
+ }
419
+
420
+ public static function addLinkAndUnlinkButtons() {
421
+ echo self::renderLinkAndUnlinkButtons();
422
+ }
423
+
424
+ public static function renderLinkAndUnlinkButtons() {
425
+ if (count(self::$enabledProviders)) {
426
+ $buttons = '<h2>' . __('Social Login', 'nextend-facebook-connect') . '</h2>';
427
+ foreach (self::$enabledProviders AS $provider) {
428
+ if ($provider->isCurrentUserConnected()) {
429
+ $buttons .= $provider->getUnLinkButton();
430
+ } else {
431
+ $buttons .= $provider->getLinkButton();
432
+ }
433
+ }
434
+
435
+ return '<div class="nsl-container ' . self::$styles['default']['container'] . '">' . $buttons . '</div>';
436
+ }
437
+
438
+ return '';
439
+ }
440
+
441
+ public static function getAvatar($user_id) {
442
+ foreach (self::$enabledProviders AS $provider) {
443
+ $avatar = $provider->getAvatar($user_id);
444
+ if ($avatar !== false) {
445
+ return $avatar;
446
+ }
447
+ }
448
+
449
+ return false;
450
+ }
451
+
452
+ public static function renderAvatar($avatar = '', $id_or_email, $size = 96, $default = '', $alt = false) {
453
+
454
+ $id = 0;
455
+
456
+ if (is_numeric($id_or_email)) {
457
+ $id = $id_or_email;
458
+ } else if (is_string($id_or_email)) {
459
+ $user = get_user_by('email', $id_or_email);
460
+ if ($user) {
461
+ $id = $user->ID;
462
+ }
463
+ } else if (is_object($id_or_email)) {
464
+ if (!empty($id_or_email->comment_author_email)) {
465
+ $user = get_user_by('email', $id_or_email->comment_author_email);
466
+ if ($user) {
467
+ $id = $user->ID;
468
+ }
469
+ } else if (!empty($id_or_email->user_id)) {
470
+ $id = $id_or_email->user_id;
471
+ }
472
+ }
473
+ if ($id == 0) {
474
+ return $avatar;
475
+ }
476
+
477
+ $pic = self::getAvatar($id);
478
+ if (!$pic) {
479
+ return $avatar;
480
+ }
481
+ $avatar = preg_replace('/src=("|\').*?("|\')/i', 'src=\'' . $pic . '\'', $avatar);
482
+
483
+ return $avatar;
484
+ }
485
+
486
+ public static function renderAvatarBP($avatar = '', $params, $id) {
487
+ if (!is_numeric($id) || strpos($avatar, 'gravatar') === false) {
488
+ return $avatar;
489
+ }
490
+
491
+ $pic = self::getAvatar($id);
492
+ if (!$pic || $pic == '') {
493
+ return $avatar;
494
+ }
495
+ $avatar = preg_replace('/src=("|\').*?("|\')/i', 'src=\'' . $pic . '\'', $avatar);
496
+
497
+ return $avatar;
498
+ }
499
+
500
+ public static function shortcode($atts) {
501
+ if (!is_user_logged_in()) {
502
+
503
+ $atts = array_merge(array(
504
+ 'style' => 'default',
505
+ 'provider' => false,
506
+ 'redirect' => false
507
+ ), $atts);
508
+
509
+ $providers = false;
510
+ $providerID = $atts['provider'] === false ? false : $atts['provider'];
511
+ if ($providerID !== false && isset(self::$enabledProviders[$providerID])) {
512
+ $providers = array(self::$enabledProviders[$providerID]);
513
+ }
514
+
515
+ return self::renderButtonsWithContainer($atts['style'], $providers, $atts['redirect']);
516
+ }
517
+
518
+ return '';
519
+ }
520
+
521
+ /**
522
+ * @param string $style
523
+ * @param bool|NextendSocialProvider[] $providers
524
+ * @param bool|string $redirect_to
525
+ *
526
+ * @return string
527
+ */
528
+ public static function renderButtonsWithContainer($style = 'default', $providers = false, $redirect_to = false) {
529
+
530
+ if (!isset(self::$styles[$style])) {
531
+ $style = 'default';
532
+ }
533
+
534
+ $enabledProviders = false;
535
+ if (is_array($providers)) {
536
+ $enabledProviders = array();
537
+ foreach ($providers AS $provider) {
538
+ if ($provider && isset(self::$enabledProviders[$provider->getId()])) {
539
+ $enabledProviders[$provider->getId()] = $provider;
540
+ }
541
+ }
542
+ }
543
+ if ($enabledProviders === false) {
544
+ $enabledProviders = self::$enabledProviders;
545
+ }
546
+
547
+ if (count($enabledProviders)) {
548
+ $buttons = '';
549
+ foreach ($enabledProviders AS $provider) {
550
+ $buttons .= $provider->getConnectButton($style, $redirect_to);
551
+ }
552
+
553
+ return '<div class="nsl-container ' . self::$styles[$style]['container'] . '">' . $buttons . '</div>';
554
+ }
555
+
556
+ return '';
557
+ }
558
+
559
+ public static function getCurrentPageURL() {
560
+
561
+ return set_url_scheme('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
562
+ }
563
+
564
+ public static function get_template_part($file_name, $name = null) {
565
+ // Execute code for this part
566
+ do_action('get_template_part_' . $file_name, $file_name, $name);
567
+
568
+ // Setup possible parts
569
+ $templates = array();
570
+ $templates[] = $file_name;
571
+
572
+ // Allow template parts to be filtered
573
+ $templates = apply_filters('nsl_get_template_part', $templates, $file_name, $name);
574
+
575
+ // Return the part that is found
576
+ return self::locate_template($templates);
577
+ }
578
+
579
+ public static function locate_template($template_names) {
580
+ // No file found yet
581
+ $located = false;
582
+
583
+ // Try to find a template file
584
+ foreach ((array)$template_names as $template_name) {
585
+
586
+ // Continue if template is empty
587
+ if (empty($template_name)) {
588
+ continue;
589
+ }
590
+
591
+ // Trim off any slashes from the template name
592
+ $template_name = ltrim($template_name, '/');
593
+ // Check child theme first
594
+ if (file_exists(trailingslashit(get_stylesheet_directory()) . 'nsl/' . $template_name)) {
595
+ $located = trailingslashit(get_stylesheet_directory()) . 'nsl/' . $template_name;
596
+ break;
597
+
598
+ // Check parent theme next
599
+ } elseif (file_exists(trailingslashit(get_template_directory()) . 'nsl/' . $template_name)) {
600
+ $located = trailingslashit(get_template_directory()) . 'nsl/' . $template_name;
601
+ break;
602
+
603
+ // Check theme compatibility last
604
+ } elseif (file_exists(trailingslashit(self::get_templates_dir()) . $template_name)) {
605
+ $located = trailingslashit(self::get_templates_dir()) . $template_name;
606
+ break;
607
+ } elseif (defined('NSL_PRO_PATH') && file_exists(trailingslashit(NSL_PRO_PATH) . 'template-parts/' . $template_name)) {
608
+ $located = trailingslashit(NSL_PRO_PATH) . 'template-parts/' . $template_name;
609
+ break;
610
+ }
611
+ }
612
+
613
+ return $located;
614
+ }
615
+
616
+ public static function get_templates_dir() {
617
+ return NSL_PATH . '/template-parts';
618
+ }
619
+
620
+ public static function delete_user($user_id) {
621
+ /** @var $wpdb WPDB */
622
+ global $wpdb;
623
+
624
+ $wpdb->delete($wpdb->prefix . 'social_users', array(
625
+ 'ID' => $user_id
626
+ ), array(
627
+ '%d'
628
+ ));
629
+
630
+ }
631
+ }
632
+
633
+ NextendSocialLogin::init();
persistent.php ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class NextendSocialLoginPersistentAnonymous {
4
+
5
+ private static function getSessionID($mustCreate = false) {
6
+ if (isset($_COOKIE['nsl_session'])) {
7
+ if (get_site_transient('n_' . $_COOKIE['nsl_session']) !== false) {
8
+ return $_COOKIE['nsl_session'];
9
+ }
10
+ }
11
+ if ($mustCreate) {
12
+ $_COOKIE['nsl_session'] = uniqid('nsl', true);
13
+ self::setcookie('nsl_session', $_COOKIE['nsl_session'], time() + DAY_IN_SECONDS, apply_filters('nsl_session_use_secure_cookie', false));
14
+ set_site_transient('n_' . $_COOKIE['nsl_session'], 1, 3600);
15
+
16
+ return $_COOKIE['nsl_session'];
17
+ }
18
+
19
+ return false;
20
+ }
21
+
22
+ public static function set($key, $value, $expiration = 3600) {
23
+
24
+ set_site_transient(self::getSessionID(true) . $key, (string)$value, $expiration);
25
+ }
26
+
27
+ public static function get($key) {
28
+
29
+ $session = self::getSessionID();
30
+ if ($session) {
31
+ return get_site_transient($session . $key);
32
+ }
33
+
34
+ return false;
35
+ }
36
+
37
+ public static function delete($key) {
38
+
39
+ $session = self::getSessionID();
40
+ if ($session) {
41
+ delete_site_transient(self::getSessionID() . $key);
42
+ }
43
+ }
44
+
45
+ public static function destroy() {
46
+ $sessionID = self::getSessionID();
47
+ if ($sessionID) {
48
+ self::setcookie('nsl_session', $sessionID, time() - YEAR_IN_SECONDS, apply_filters('nsl_session_use_secure_cookie', false));
49
+ delete_site_transient('n_' . $sessionID);
50
+ }
51
+ }
52
+
53
+ private static function setcookie($name, $value, $expire, $secure = false) {
54
+
55
+ setcookie($name, $value, $expire, COOKIEPATH ? COOKIEPATH : '/', COOKIE_DOMAIN, $secure);
56
+ }
57
+
58
+ }
59
+
60
+ class NextendSocialLoginPersistentUser {
61
+
62
+ private static function getSessionID() {
63
+ return get_current_user_id();
64
+ }
65
+
66
+ public static function set($key, $value, $expiration = 3600) {
67
+
68
+ set_site_transient(self::getSessionID() . $key, (string)$value, $expiration);
69
+ }
70
+
71
+ public static function get($key) {
72
+
73
+ return get_site_transient(self::getSessionID() . $key);
74
+ }
75
+
76
+ public static function delete($key) {
77
+
78
+ delete_site_transient(self::getSessionID() . $key);
79
+ }
80
+
81
+ }
providers/facebook/admin/getting-started.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined('ABSPATH') || die();
3
+ /** @var $this NextendSocialProvider */
4
+ ?>
5
+ <div class="nsl-admin-sub-content">
6
+
7
+ <p style="max-width:55em;"><?php printf(__('To allow your visitors to log in with their %1$s account, first you must create a %1$s App. The following guide will help you through the %1$s App creation process. After you have created your %1$s App, head over to "Settings" and configure the given "%2$s" and "%3$s" according to your %1$s App.', 'nextend-facebook-connect'), "Facebook", "App ID", "App secret"); ?></p>
8
+
9
+ <h2 class="title"><?php printf(_x('Create %s', 'App creation', 'nextend-facebook-connect'), 'Facebook App'); ?></h2>
10
+
11
+ <ol>
12
+ <li><?php printf(__('Navigate to %s', 'nextend-facebook-connect'), '<a href="https://developers.facebook.com/apps/" target="_blank">https://developers.facebook.com/apps/</a>'); ?></li>
13
+ <li><?php printf(__('Log in with your %s credentials if you are not logged in', 'nextend-facebook-connect'), 'Facebook'); ?></li>
14
+ <li><?php _e('Click on the "Add a New App" button', 'nextend-facebook-connect'); ?></li>
15
+ <li><?php _e('Fill "Display Name" and "Contact Email"', 'nextend-facebook-connect'); ?></li>
16
+ <li><?php _e('Click on blue "Create App ID" button', 'nextend-facebook-connect'); ?></li>
17
+ <li><?php _e('Move your mouse over Facebook Login and click on the appearing "Set Up" button', 'nextend-facebook-connect'); ?></li>
18
+ <li><?php _e('Choose Web', 'nextend-facebook-connect'); ?></li>
19
+ <li><?php printf(__('Fill "Site URL" with the url of your homepage, probably: <b>%s</b>', 'nextend-facebook-connect'), site_url()); ?></li>
20
+ <li><?php _e('Click on "Save"', 'nextend-facebook-connect'); ?></li>
21
+ <li><?php _e('In the left sidebar, click on "Facebook Login"', 'nextend-facebook-connect'); ?></li>
22
+ <li><?php printf(__('Add the following URL to the "Valid OAuth redirect URIs" field: <b>%s</b>', 'nextend-facebook-connect'), $this->getLoginUrl()); ?></li>
23
+ <li><?php _e('Click on "Save Changes"', 'nextend-facebook-connect'); ?></li>
24
+ <li><?php _e('In the top of the left sidebar, click on "Settings"', 'nextend-facebook-connect'); ?></li>
25
+ <li><?php _e('Here you can see your "APP ID" and you can see your "App secret" if you click on the "Show" button. These will be needed in plugin\'s settings.', 'nextend-facebook-connect'); ?></li>
26
+ <li><?php _e('Enter your domain name to the App Domains', 'nextend-facebook-connect'); ?></li>
27
+ <li><?php _e('Fill up the "Privacy Policy URL". Provide a publicly available and easily accessible privacy policy that explains what data you are collecting and how you will use that data.', 'nextend-facebook-connect'); ?></li>
28
+ <li><?php _e('Save your changes', 'nextend-facebook-connect'); ?></li>
29
+ <li><?php _e('Your application is currently private, which means that only you can log in with it. In the left sidebar choose "App Review" and make your App public', 'nextend-facebook-connect'); ?></li>
30
+ </ol>
31
+
32
+ <a href="<?php echo $this->getAdminUrl('settings'); ?>"
33
+ class="button button-primary"><?php printf(__('I am done setting up my %s', 'nextend-facebook-connect'), 'Facebook App'); ?></a>
34
+
35
+ <br>
36
+ <div class="nsl-admin-embed-youtube">
37
+ <div></div>
38
+ <iframe src="https://www.youtube.com/embed/7iiIe8RLIAM?rel=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
39
+ </div>
40
+ </div>
providers/facebook/admin/import.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined('ABSPATH') || die();
3
+ /** @var $this NextendSocialProvider */
4
+ ?>
5
+
6
+ <div class="nsl-admin-sub-content">
7
+ <h2 class="title"><?php _e('Import Facebook configuration', 'nextend-facebook-connect'); ?></h2>
8
+ <p><?php _e('Be sure to read the following notices before you proceed.', 'nextend-facebook-connect'); ?></p>
9
+
10
+ <h4><?php _e('Important steps before the import', 'nextend-facebook-connect'); ?></h4>
11
+ <p><?php _e('Make sure that the redirect URI for your app is correct before proceeding.', 'nextend-facebook-connect'); ?></p>
12
+ <ol>
13
+ <li><?php printf(__('Visit %s.', 'nextend-facebook-connect'), '<a href="https://developers.facebook.com/apps/" target="_blank">https://developers.facebook.com/apps/</a>'); ?></li>
14
+ <li><?php _e('Select your app.', 'nextend-facebook-connect'); ?></li>
15
+ <li><?php _e('Go to the Settings menu which you can find below the Facebook Login in the left menu.', 'nextend-facebook-connect'); ?></li>
16
+ <li><?php printf(__('Make sure that the "%1$s" field contains %2$s', 'nextend-facebook-connect'), 'Valid OAuth redirect URIs', $this->getLoginUrl()); ?> </li>
17
+ <li><?php _e('Save your changes.', 'nextend-facebook-connect'); ?></li>
18
+ </ol>
19
+
20
+ <h4><?php _e('The following settings will be imported:', 'nextend-facebook-connect'); ?></h4>
21
+ <ol>
22
+ <li><?php _e('Your old API configurations', 'nextend-facebook-connect'); ?></li>
23
+ <li><?php _e('The user prefix you set', 'nextend-facebook-connect'); ?></li>
24
+ </ol>
25
+
26
+ <h4><?php _e('Create a backup of the old settings', 'nextend-facebook-connect'); ?></h4>
27
+ <textarea cols="160" rows="6" readonly title=""><?php echo esc_textarea(wp_json_encode(maybe_unserialize(get_option('nextend_fb_connect')), defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 0)); ?></textarea>
28
+
29
+ <h4><?php _e('Other changes', 'nextend-facebook-connect'); ?></h4>
30
+ <ol>
31
+ <li><?php _e('The custom redirect URI is now handled globally for all providers, so it won\'t be imported from the previous version. Visit "Nextend Social Login > Global settings" to set the new redirect URIs.', 'nextend-facebook-connect'); ?></li>
32
+ <li><?php _e('The login button\'s layout will be changed to a new, more modern look. If you used any custom buttons that won\'t be imported.', 'nextend-facebook-connect'); ?></li>
33
+ <li><?php _e('The old version\'s PHP functions are not available anymore. This means if you used any custom codes where you used these old functions, you need to remove them.', 'nextend-facebook-connect'); ?></li>
34
+ </ol>
35
+ <p><?php _e('After the importing process finishes, you will need to <b>test</b> your app and <b>enable</b> the provider. You can do both in the next screen.', 'nextend-facebook-connect'); ?></p>
36
+ <p>
37
+ <a href="<?php echo wp_nonce_url(add_query_arg(array(
38
+ 'action' => 'nextend-social-login',
39
+ 'view' => 'import',
40
+ 'provider' => $this->getId()
41
+ ), admin_url('admin-post.php')), 'nextend-social-login'); ?>" class="button button-primary">
42
+ <?php _e('Import Configuration', 'nextend-facebook-connect'); ?>
43
+ </a>
44
+ </p>
45
+ </div>
providers/facebook/admin/settings.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined('ABSPATH') || die();
3
+ /** @var $this NextendSocialProvider */
4
+
5
+ $settings = $this->settings;
6
+ ?>
7
+
8
+ <div class="nsl-admin-sub-content">
9
+
10
+ <?php
11
+ $this->renderSettingsHeader();
12
+ ?>
13
+
14
+ <form method="post" action="<?php echo admin_url('admin-post.php'); ?>" novalidate="novalidate">
15
+
16
+ <?php wp_nonce_field('nextend-social-login'); ?>
17
+ <input type="hidden" name="action" value="nextend-social-login"/>
18
+ <input type="hidden" name="view" value="provider-<?php echo $this->getId(); ?>"/>
19
+ <input type="hidden" name="subview" value="settings"/>
20
+ <input type="hidden" name="settings_saved" value="1"/>
21
+ <input type="hidden" name="tested" id="tested" value="<?php echo esc_attr($settings->get('tested')); ?>"/>
22
+ <table class="form-table">
23
+ <tbody>
24
+ <?php if (!defined('NEXTEND_FB_APP_ID')): ?>
25
+ <tr>
26
+ <th scope="row"><label for="appid"><?php _e('App ID', 'nextend-facebook-connect'); ?>
27
+ - <em>(<?php _e('Required', 'nextend-facebook-connect'); ?>)</em></label></th>
28
+ <td>
29
+ <input name="appid" type="text" id="appid"
30
+ value="<?php echo esc_attr($settings->get('appid')); ?>" class="regular-text">
31
+ <p class="description"
32
+ id="tagline-appid"><?php printf(__('If you are not sure what is your %s, please head over to <a href="%s">Getting Started</a>', 'nextend-facebook-connect'), 'App ID', $this->getAdminUrl()); ?></p>
33
+ </td>
34
+ </tr>
35
+ <?php endif; ?>
36
+ <?php if (!defined('NEXTEND_FB_APP_SECRET')): ?>
37
+ <tr>
38
+ <th scope="row"><label for="secret"><?php _e('App Secret', 'nextend-facebook-connect'); ?>
39
+ - <em>(<?php _e('Required', 'nextend-facebook-connect'); ?>)</em></label>
40
+ </th>
41
+ <td><input name="secret" type="text" id="secret"
42
+ value="<?php echo esc_attr($settings->get('secret')); ?>" class="regular-text"></td>
43
+ </tr>
44
+ <?php endif; ?>
45
+ </tbody>
46
+ </table>
47
+ <p class="submit"><input type="submit" name="submit" id="submit" class="button button-primary"
48
+ value="<?php _e('Save Changes'); ?>"></p>
49
+
50
+
51
+ <hr/>
52
+ <h2><?php _e('Other settings', 'nextend-facebook-connect'); ?></h2>
53
+ <table class="form-table">
54
+ <tbody>
55
+ <tr>
56
+ <th scope="row"><label
57
+ for="user_prefix"><?php _e('Username prefix on register', 'nextend-facebook-connect'); ?></label></th>
58
+ <td><input name="user_prefix" type="text" id="user_prefix"
59
+ value="<?php echo esc_attr($settings->get('user_prefix')); ?>" class="regular-text"></td>
60
+ </tr>
61
+ </tbody>
62
+ </table>
63
+
64
+ <?php
65
+ $this->renderProSettings();
66
+ ?>
67
+ </form>
68
+ </div>
{Facebook → providers/facebook/compat/Facebook}/Authentication/AccessToken.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\Authentication;
25
 
26
  /**
@@ -28,8 +29,8 @@ namespace Facebook\Authentication;
28
  *
29
  * @package Facebook
30
  */
31
- class AccessToken
32
- {
33
  /**
34
  * The access token value.
35
  *
@@ -50,8 +51,7 @@ class AccessToken
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);
@@ -65,8 +65,7 @@ class AccessToken
65
  *
66
  * @return string
67
  */
68
- public function getAppSecretProof($appSecret)
69
- {
70
  return hash_hmac('sha256', $this->value, $appSecret);
71
  }
72
 
@@ -75,8 +74,7 @@ class AccessToken
75
  *
76
  * @return \DateTime|null
77
  */
78
- public function getExpiresAt()
79
- {
80
  return $this->expiresAt;
81
  }
82
 
@@ -85,8 +83,7 @@ class AccessToken
85
  *
86
  * @return bool
87
  */
88
- public function isAppAccessToken()
89
- {
90
  return strpos($this->value, '|') !== false;
91
  }
92
 
@@ -95,8 +92,7 @@ class AccessToken
95
  *
96
  * @return bool
97
  */
98
- public function isLongLived()
99
- {
100
  if ($this->expiresAt) {
101
  return $this->expiresAt->getTimestamp() > time() + (60 * 60 * 2);
102
  }
@@ -113,10 +109,10 @@ class AccessToken
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()) {
@@ -131,8 +127,7 @@ class AccessToken
131
  *
132
  * @return string
133
  */
134
- public function getValue()
135
- {
136
  return $this->value;
137
  }
138
 
@@ -141,8 +136,7 @@ class AccessToken
141
  *
142
  * @return string
143
  */
144
- public function __toString()
145
- {
146
  return $this->getValue();
147
  }
148
 
@@ -151,8 +145,7 @@ class AccessToken
151
  *
152
  * @param int $timeStamp
153
  */
154
- protected function setExpiresAtFromTimeStamp($timeStamp)
155
- {
156
  $dt = new \DateTime();
157
  $dt->setTimestamp($timeStamp);
158
  $this->expiresAt = $dt;
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\Authentication;
26
 
27
  /**
29
  *
30
  * @package Facebook
31
  */
32
+ class AccessToken {
33
+
34
  /**
35
  * The access token value.
36
  *
51
  * @param string $accessToken
52
  * @param int $expiresAt
53
  */
54
+ public function __construct($accessToken, $expiresAt = 0) {
 
55
  $this->value = $accessToken;
56
  if ($expiresAt) {
57
  $this->setExpiresAtFromTimeStamp($expiresAt);
65
  *
66
  * @return string
67
  */
68
+ public function getAppSecretProof($appSecret) {
 
69
  return hash_hmac('sha256', $this->value, $appSecret);
70
  }
71
 
74
  *
75
  * @return \DateTime|null
76
  */
77
+ public function getExpiresAt() {
 
78
  return $this->expiresAt;
79
  }
80
 
83
  *
84
  * @return bool
85
  */
86
+ public function isAppAccessToken() {
 
87
  return strpos($this->value, '|') !== false;
88
  }
89
 
92
  *
93
  * @return bool
94
  */
95
+ public function isLongLived() {
 
96
  if ($this->expiresAt) {
97
  return $this->expiresAt->getTimestamp() > time() + (60 * 60 * 2);
98
  }
109
  *
110
  * @return boolean|null
111
  */
112
+ public function isExpired() {
 
113
  if ($this->getExpiresAt() instanceof \DateTime) {
114
+ return $this->getExpiresAt()
115
+ ->getTimestamp() < time();
116
  }
117
 
118
  if ($this->isAppAccessToken()) {
127
  *
128
  * @return string
129
  */
130
+ public function getValue() {
 
131
  return $this->value;
132
  }
133
 
136
  *
137
  * @return string
138
  */
139
+ public function __toString() {
 
140
  return $this->getValue();
141
  }
142
 
145
  *
146
  * @param int $timeStamp
147
  */
148
+ protected function setExpiresAtFromTimeStamp($timeStamp) {
 
149
  $dt = new \DateTime();
150
  $dt->setTimestamp($timeStamp);
151
  $this->expiresAt = $dt;
{Facebook → providers/facebook/compat/Facebook}/Authentication/AccessTokenMetadata.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\Authentication;
25
 
26
  use Facebook\Exceptions\FacebookSDKException;
@@ -33,8 +34,8 @@ use Facebook\Exceptions\FacebookSDKException;
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
  *
@@ -47,15 +48,17 @@ class AccessTokenMetadata
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
  }
@@ -73,8 +76,7 @@ class AccessTokenMetadata
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
  }
@@ -91,10 +93,9 @@ class AccessTokenMetadata
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
 
@@ -107,8 +108,7 @@ class AccessTokenMetadata
107
  *
108
  * @return mixed
109
  */
110
- public function getChildProperty($parentField, $field, $default = null)
111
- {
112
  if (!isset($this->metadata[$parentField])) {
113
  return $default;
114
  }
@@ -128,8 +128,7 @@ class AccessTokenMetadata
128
  *
129
  * @return mixed
130
  */
131
- public function getErrorProperty($field, $default = null)
132
- {
133
  return $this->getChildProperty('error', $field, $default);
134
  }
135
 
@@ -141,8 +140,7 @@ class AccessTokenMetadata
141
  *
142
  * @return mixed
143
  */
144
- public function getMetadataProperty($field, $default = null)
145
- {
146
  return $this->getChildProperty('metadata', $field, $default);
147
  }
148
 
@@ -151,8 +149,7 @@ class AccessTokenMetadata
151
  *
152
  * @return string|null
153
  */
154
- public function getAppId()
155
- {
156
  return $this->getField('app_id');
157
  }
158
 
@@ -161,8 +158,7 @@ class AccessTokenMetadata
161
  *
162
  * @return string|null
163
  */
164
- public function getApplication()
165
- {
166
  return $this->getField('application');
167
  }
168
 
@@ -172,8 +168,7 @@ class AccessTokenMetadata
172
  *
173
  * @return bool|null
174
  */
175
- public function isError()
176
- {
177
  return $this->getField('error') !== null;
178
  }
179
 
@@ -182,8 +177,7 @@ class AccessTokenMetadata
182
  *
183
  * @return int|null
184
  */
185
- public function getErrorCode()
186
- {
187
  return $this->getErrorProperty('code');
188
  }
189
 
@@ -192,8 +186,7 @@ class AccessTokenMetadata
192
  *
193
  * @return string|null
194
  */
195
- public function getErrorMessage()
196
- {
197
  return $this->getErrorProperty('message');
198
  }
199
 
@@ -202,8 +195,7 @@ class AccessTokenMetadata
202
  *
203
  * @return int|null
204
  */
205
- public function getErrorSubcode()
206
- {
207
  return $this->getErrorProperty('subcode');
208
  }
209
 
@@ -212,8 +204,7 @@ class AccessTokenMetadata
212
  *
213
  * @return \DateTime|null
214
  */
215
- public function getExpiresAt()
216
- {
217
  return $this->getField('expires_at');
218
  }
219
 
@@ -222,8 +213,7 @@ class AccessTokenMetadata
222
  *
223
  * @return boolean|null
224
  */
225
- public function getIsValid()
226
- {
227
  return $this->getField('is_valid');
228
  }
229
 
@@ -237,8 +227,7 @@ class AccessTokenMetadata
237
  *
238
  * @return \DateTime|null
239
  */
240
- public function getIssuedAt()
241
- {
242
  return $this->getField('issued_at');
243
  }
244
 
@@ -248,8 +237,7 @@ class AccessTokenMetadata
248
  *
249
  * @return array|null
250
  */
251
- public function getMetadata()
252
- {
253
  return $this->getField('metadata');
254
  }
255
 
@@ -258,8 +246,7 @@ class AccessTokenMetadata
258
  *
259
  * @return string|null
260
  */
261
- public function getSso()
262
- {
263
  return $this->getMetadataProperty('sso');
264
  }
265
 
@@ -268,8 +255,7 @@ class AccessTokenMetadata
268
  *
269
  * @return string|null
270
  */
271
- public function getAuthType()
272
- {
273
  return $this->getMetadataProperty('auth_type');
274
  }
275
 
@@ -278,8 +264,7 @@ class AccessTokenMetadata
278
  *
279
  * @return string|null
280
  */
281
- public function getAuthNonce()
282
- {
283
  return $this->getMetadataProperty('auth_nonce');
284
  }
285
 
@@ -289,8 +274,7 @@ class AccessTokenMetadata
289
  *
290
  * @return string|null
291
  */
292
- public function getProfileId()
293
- {
294
  return $this->getField('profile_id');
295
  }
296
 
@@ -300,8 +284,7 @@ class AccessTokenMetadata
300
  *
301
  * @return array
302
  */
303
- public function getScopes()
304
- {
305
  return $this->getField('scopes');
306
  }
307
 
@@ -310,8 +293,7 @@ class AccessTokenMetadata
310
  *
311
  * @return string|null
312
  */
313
- public function getUserId()
314
- {
315
  return $this->getField('user_id');
316
  }
317
 
@@ -323,8 +305,7 @@ class AccessTokenMetadata
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
  }
@@ -338,8 +319,7 @@ class AccessTokenMetadata
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
  }
@@ -350,13 +330,13 @@ class AccessTokenMetadata
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
  }
@@ -368,8 +348,7 @@ class AccessTokenMetadata
368
  *
369
  * @return \DateTime
370
  */
371
- private function convertTimestampToDateTime($timestamp)
372
- {
373
  $dt = new \DateTime();
374
  $dt->setTimestamp($timestamp);
375
 
@@ -379,8 +358,7 @@ class AccessTokenMetadata
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]);
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\Authentication;
26
 
27
  use Facebook\Exceptions\FacebookSDKException;
34
  * @package Facebook
35
  * @see https://developers.facebook.com/docs/graph-api/reference/debug_token
36
  */
37
+ class AccessTokenMetadata {
38
+
39
  /**
40
  * The access token metadata.
41
  *
48
  *
49
  * @var array
50
  */
51
+ protected static $dateProperties = [
52
+ 'expires_at',
53
+ 'issued_at'
54
+ ];
55
 
56
  /**
57
  * @param array $metadata
58
  *
59
  * @throws FacebookSDKException
60
  */
61
+ public function __construct(array $metadata) {
 
62
  if (!isset($metadata['data'])) {
63
  throw new FacebookSDKException('Unexpected debug token response data.', 401);
64
  }
76
  *
77
  * @return mixed
78
  */
79
+ public function getField($field, $default = null) {
 
80
  if (isset($this->metadata[$field])) {
81
  return $this->metadata[$field];
82
  }
93
  * @return mixed
94
  *
95
  * @deprecated 5.0.0 getProperty() has been renamed to getField()
96
+ * @todo v6: Remove this method
97
  */
98
+ public function getProperty($field, $default = null) {
 
99
  return $this->getField($field, $default);
100
  }
101
 
108
  *
109
  * @return mixed
110
  */
111
+ public function getChildProperty($parentField, $field, $default = null) {
 
112
  if (!isset($this->metadata[$parentField])) {
113
  return $default;
114
  }
128
  *
129
  * @return mixed
130
  */
131
+ public function getErrorProperty($field, $default = null) {
 
132
  return $this->getChildProperty('error', $field, $default);
133
  }
134
 
140
  *
141
  * @return mixed
142
  */
143
+ public function getMetadataProperty($field, $default = null) {
 
144
  return $this->getChildProperty('metadata', $field, $default);
145
  }
146
 
149
  *
150
  * @return string|null
151
  */
152
+ public function getAppId() {
 
153
  return $this->getField('app_id');
154
  }
155
 
158
  *
159
  * @return string|null
160
  */
161
+ public function getApplication() {
 
162
  return $this->getField('application');
163
  }
164
 
168
  *
169
  * @return bool|null
170
  */
171
+ public function isError() {
 
172
  return $this->getField('error') !== null;
173
  }
174
 
177
  *
178
  * @return int|null
179
  */
180
+ public function getErrorCode() {
 
181
  return $this->getErrorProperty('code');
182
  }
183
 
186
  *
187
  * @return string|null
188
  */
189
+ public function getErrorMessage() {
 
190
  return $this->getErrorProperty('message');
191
  }
192
 
195
  *
196
  * @return int|null
197
  */
198
+ public function getErrorSubcode() {
 
199
  return $this->getErrorProperty('subcode');
200
  }
201
 
204
  *
205
  * @return \DateTime|null
206
  */
207
+ public function getExpiresAt() {
 
208
  return $this->getField('expires_at');
209
  }
210
 
213
  *
214
  * @return boolean|null
215
  */
216
+ public function getIsValid() {
 
217
  return $this->getField('is_valid');
218
  }
219
 
227
  *
228
  * @return \DateTime|null
229
  */
230
+ public function getIssuedAt() {
 
231
  return $this->getField('issued_at');
232
  }
233
 
237
  *
238
  * @return array|null
239
  */
240
+ public function getMetadata() {
 
241
  return $this->getField('metadata');
242
  }
243
 
246
  *
247
  * @return string|null
248
  */
249
+ public function getSso() {
 
250
  return $this->getMetadataProperty('sso');
251
  }
252
 
255
  *
256
  * @return string|null
257
  */
258
+ public function getAuthType() {
 
259
  return $this->getMetadataProperty('auth_type');
260
  }
261
 
264
  *
265
  * @return string|null
266
  */
267
+ public function getAuthNonce() {
 
268
  return $this->getMetadataProperty('auth_nonce');
269
  }
270
 
274
  *
275
  * @return string|null
276
  */
277
+ public function getProfileId() {
 
278
  return $this->getField('profile_id');
279
  }
280
 
284
  *
285
  * @return array
286
  */
287
+ public function getScopes() {
 
288
  return $this->getField('scopes');
289
  }
290
 
293
  *
294
  * @return string|null
295
  */
296
+ public function getUserId() {
 
297
  return $this->getField('user_id');
298
  }
299
 
305
  *
306
  * @throws FacebookSDKException
307
  */
308
+ public function validateAppId($appId) {
 
309
  if ($this->getAppId() !== $appId) {
310
  throw new FacebookSDKException('Access token metadata contains unexpected app ID.', 401);
311
  }
319
  *
320
  * @throws FacebookSDKException
321
  */
322
+ public function validateUserId($userId) {
 
323
  if ($this->getUserId() !== $userId) {
324
  throw new FacebookSDKException('Access token metadata contains unexpected user ID.', 401);
325
  }
330
  *
331
  * @throws FacebookSDKException
332
  */
333
+ public function validateExpiration() {
 
334
  if (!$this->getExpiresAt() instanceof \DateTime) {
335
  return;
336
  }
337
 
338
+ if ($this->getExpiresAt()
339
+ ->getTimestamp() < time()) {
340
  throw new FacebookSDKException('Inspection of access token metadata shows that the access token has expired.', 401);
341
  }
342
  }
348
  *
349
  * @return \DateTime
350
  */
351
+ private function convertTimestampToDateTime($timestamp) {
 
352
  $dt = new \DateTime();
353
  $dt->setTimestamp($timestamp);
354
 
358
  /**
359
  * Casts the unix timestamps as DateTime entities.
360
  */
361
+ private function castTimestampsToDateTime() {
 
362
  foreach (static::$dateProperties as $key) {
363
  if (isset($this->metadata[$key]) && $this->metadata[$key] !== 0) {
364
  $this->metadata[$key] = $this->convertTimestampToDateTime($this->metadata[$key]);
{Facebook → providers/facebook/compat/Facebook}/Authentication/OAuth2Client.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\Authentication;
25
 
26
  use Facebook\Facebook;
@@ -36,8 +37,8 @@ use Facebook\Exceptions\FacebookSDKException;
36
  *
37
  * @package Facebook
38
  */
39
- class OAuth2Client
40
- {
41
  /**
42
  * @const string The base authorization URL.
43
  */
@@ -76,10 +77,9 @@ class OAuth2Client
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
 
@@ -89,8 +89,7 @@ class OAuth2Client
89
  *
90
  * @return FacebookRequest|null
91
  */
92
- public function getLastRequest()
93
- {
94
  return $this->lastRequest;
95
  }
96
 
@@ -101,22 +100,13 @@ class OAuth2Client
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
  }
@@ -132,15 +122,14 @@ class OAuth2Client
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);
@@ -156,10 +145,9 @@ class OAuth2Client
156
  *
157
  * @throws FacebookSDKException
158
  */
159
- public function getAccessTokenFromCode($code, $redirectUri = '')
160
- {
161
  $params = [
162
- 'code' => $code,
163
  'redirect_uri' => $redirectUri,
164
  ];
165
 
@@ -175,11 +163,10 @@ class OAuth2Client
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
 
@@ -196,14 +183,13 @@ class OAuth2Client
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);
@@ -221,10 +207,9 @@ class OAuth2Client
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);
@@ -258,21 +243,12 @@ class OAuth2Client
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
  }
@@ -282,10 +258,9 @@ class OAuth2Client
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
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\Authentication;
26
 
27
  use Facebook\Facebook;
37
  *
38
  * @package Facebook
39
  */
40
+ class OAuth2Client {
41
+
42
  /**
43
  * @const string The base authorization URL.
44
  */
77
  * @param FacebookClient $client
78
  * @param string|null $graphVersion The version of the Graph API to use.
79
  */
80
+ public function __construct(FacebookApp $app, FacebookClient $client, $graphVersion = null) {
81
+ $this->app = $app;
82
+ $this->client = $client;
 
83
  $this->graphVersion = $graphVersion ?: Facebook::DEFAULT_GRAPH_VERSION;
84
  }
85
 
89
  *
90
  * @return FacebookRequest|null
91
  */
92
+ public function getLastRequest() {
 
93
  return $this->lastRequest;
94
  }
95
 
100
  *
101
  * @return AccessTokenMetadata
102
  */
103
+ public function debugToken($accessToken) {
 
104
  $accessToken = $accessToken instanceof AccessToken ? $accessToken->getValue() : $accessToken;
105
+ $params = ['input_token' => $accessToken];
106
+
107
+ $this->lastRequest = new FacebookRequest($this->app, $this->app->getAccessToken(), 'GET', '/debug_token', $params, null, $this->graphVersion);
108
+ $response = $this->client->sendRequest($this->lastRequest);
109
+ $metadata = $response->getDecodedBody();
 
 
 
 
 
 
 
 
110
 
111
  return new AccessTokenMetadata($metadata);
112
  }
122
  *
123
  * @return string
124
  */
125
+ public function getAuthorizationUrl($redirectUrl, $state, array $scope = [], array $params = [], $separator = '&') {
 
126
  $params += [
127
+ 'client_id' => $this->app->getId(),
128
+ 'state' => $state,
129
  'response_type' => 'code',
130
+ 'sdk' => 'php-sdk-' . Facebook::VERSION,
131
+ 'redirect_uri' => $redirectUrl,
132
+ 'scope' => implode(',', $scope)
133
  ];
134
 
135
  return static::BASE_AUTHORIZATION_URL . '/' . $this->graphVersion . '/dialog/oauth?' . http_build_query($params, null, $separator);
145
  *
146
  * @throws FacebookSDKException
147
  */
148
+ public function getAccessTokenFromCode($code, $redirectUri = '') {
 
149
  $params = [
150
+ 'code' => $code,
151
  'redirect_uri' => $redirectUri,
152
  ];
153
 
163
  *
164
  * @throws FacebookSDKException
165
  */
166
+ public function getLongLivedAccessToken($accessToken) {
 
167
  $accessToken = $accessToken instanceof AccessToken ? $accessToken->getValue() : $accessToken;
168
+ $params = [
169
+ 'grant_type' => 'fb_exchange_token',
170
  'fb_exchange_token' => $accessToken,
171
  ];
172
 
183
  *
184
  * @throws FacebookSDKException
185
  */
186
+ public function getCodeFromLongLivedAccessToken($accessToken, $redirectUri = '') {
 
187
  $params = [
188
  'redirect_uri' => $redirectUri,
189
  ];
190
 
191
  $response = $this->sendRequestWithClientParams('/oauth/client_code', $params, $accessToken);
192
+ $data = $response->getDecodedBody();
193
 
194
  if (!isset($data['code'])) {
195
  throw new FacebookSDKException('Code was not returned from Graph.', 401);
207
  *
208
  * @throws FacebookSDKException
209
  */
210
+ protected function requestAnAccessToken(array $params) {
 
211
  $response = $this->sendRequestWithClientParams('/oauth/access_token', $params);
212
+ $data = $response->getDecodedBody();
213
 
214
  if (!isset($data['access_token'])) {
215
  throw new FacebookSDKException('Access token was not returned from Graph.', 401);
243
  *
244
  * @throws FacebookResponseException
245
  */
246
+ protected function sendRequestWithClientParams($endpoint, array $params, $accessToken = null) {
 
247
  $params += $this->getClientParams();
248
 
249
  $accessToken = $accessToken ?: $this->app->getAccessToken();
250
 
251
+ $this->lastRequest = new FacebookRequest($this->app, $accessToken, 'GET', $endpoint, $params, null, $this->graphVersion);
 
 
 
 
 
 
 
 
252
 
253
  return $this->client->sendRequest($this->lastRequest);
254
  }
258
  *
259
  * @return array
260
  */
261
+ protected function getClientParams() {
 
262
  return [
263
+ 'client_id' => $this->app->getId(),
264
  'client_secret' => $this->app->getSecret(),
265
  ];
266
  }
{Facebook → providers/facebook/compat/Facebook}/Exceptions/FacebookAuthenticationException.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\Exceptions;
25
 
26
  /**
@@ -28,6 +29,6 @@ namespace Facebook\Exceptions;
28
  *
29
  * @package Facebook
30
  */
31
- class FacebookAuthenticationException extends FacebookSDKException
32
- {
33
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\Exceptions;
26
 
27
  /**
29
  *
30
  * @package Facebook
31
  */
32
+ class FacebookAuthenticationException extends FacebookSDKException {
33
+
34
  }
{Facebook → providers/facebook/compat/Facebook}/Exceptions/FacebookAuthorizationException.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\Exceptions;
25
 
26
  /**
@@ -28,6 +29,6 @@ namespace Facebook\Exceptions;
28
  *
29
  * @package Facebook
30
  */
31
- class FacebookAuthorizationException extends FacebookSDKException
32
- {
33
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\Exceptions;
26
 
27
  /**
29
  *
30
  * @package Facebook
31
  */
32
+ class FacebookAuthorizationException extends FacebookSDKException {
33
+
34
  }
{Facebook → providers/facebook/compat/Facebook}/Exceptions/FacebookClientException.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\Exceptions;
25
 
26
  /**
@@ -28,6 +29,6 @@ namespace Facebook\Exceptions;
28
  *
29
  * @package Facebook
30
  */
31
- class FacebookClientException extends FacebookSDKException
32
- {
33
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\Exceptions;
26
 
27
  /**
29
  *
30
  * @package Facebook
31
  */
32
+ class FacebookClientException extends FacebookSDKException {
33
+
34
  }
{Facebook → providers/facebook/compat/Facebook}/Exceptions/FacebookOtherException.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\Exceptions;
25
 
26
  /**
@@ -28,6 +29,6 @@ namespace Facebook\Exceptions;
28
  *
29
  * @package Facebook
30
  */
31
- class FacebookOtherException extends FacebookSDKException
32
- {
33
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\Exceptions;
26
 
27
  /**
29
  *
30
  * @package Facebook
31
  */
32
+ class FacebookOtherException extends FacebookSDKException {
33
+
34
  }
{Facebook → providers/facebook/compat/Facebook}/Exceptions/FacebookResponseException.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\Exceptions;
25
 
26
  use Facebook\FacebookResponse;
@@ -30,8 +31,8 @@ use Facebook\FacebookResponse;
30
  *
31
  * @package Facebook
32
  */
33
- class FacebookResponseException extends FacebookSDKException
34
- {
35
  /**
36
  * @var FacebookResponse The response that threw the exception.
37
  */
@@ -48,13 +49,12 @@ class FacebookResponseException extends FacebookSDKException
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
  }
@@ -66,15 +66,14 @@ class FacebookResponseException extends FacebookSDKException
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'])) {
@@ -143,8 +142,7 @@ class FacebookResponseException extends FacebookSDKException
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
  }
@@ -157,8 +155,7 @@ class FacebookResponseException extends FacebookSDKException
157
  *
158
  * @return int
159
  */
160
- public function getHttpStatusCode()
161
- {
162
  return $this->response->getHttpStatusCode();
163
  }
164
 
@@ -167,8 +164,7 @@ class FacebookResponseException extends FacebookSDKException
167
  *
168
  * @return int
169
  */
170
- public function getSubErrorCode()
171
- {
172
  return $this->get('error_subcode', -1);
173
  }
174
 
@@ -177,8 +173,7 @@ class FacebookResponseException extends FacebookSDKException
177
  *
178
  * @return string
179
  */
180
- public function getErrorType()
181
- {
182
  return $this->get('type', '');
183
  }
184
 
@@ -187,8 +182,7 @@ class FacebookResponseException extends FacebookSDKException
187
  *
188
  * @return string
189
  */
190
- public function getRawResponse()
191
- {
192
  return $this->response->getBody();
193
  }
194
 
@@ -197,8 +191,7 @@ class FacebookResponseException extends FacebookSDKException
197
  *
198
  * @return array
199
  */
200
- public function getResponseData()
201
- {
202
  return $this->responseData;
203
  }
204
 
@@ -207,8 +200,7 @@ class FacebookResponseException extends FacebookSDKException
207
  *
208
  * @return FacebookResponse
209
  */
210
- public function getResponse()
211
- {
212
  return $this->response;
213
  }
214
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\Exceptions;
26
 
27
  use Facebook\FacebookResponse;
31
  *
32
  * @package Facebook
33
  */
34
+ class FacebookResponseException extends FacebookSDKException {
35
+
36
  /**
37
  * @var FacebookResponse The response that threw the exception.
38
  */
49
  * @param FacebookResponse $response The response that threw the exception.
50
  * @param FacebookSDKException $previousException The more detailed exception.
51
  */
52
+ public function __construct(FacebookResponse $response, FacebookSDKException $previousException = null) {
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
  }
66
  *
67
  * @return FacebookResponseException
68
  */
69
+ public static function create(FacebookResponse $response) {
 
70
  $data = $response->getDecodedBody();
71
 
72
  if (!isset($data['error']['code']) && isset($data['code'])) {
73
  $data = ['error' => $data];
74
  }
75
 
76
+ $code = isset($data['error']['code']) ? $data['error']['code'] : null;
77
  $message = isset($data['error']['message']) ? $data['error']['message'] : 'Unknown error from Graph.';
78
 
79
  if (isset($data['error']['error_subcode'])) {
142
  *
143
  * @return mixed
144
  */
145
+ private function get($key, $default = null) {
 
146
  if (isset($this->responseData['error'][$key])) {
147
  return $this->responseData['error'][$key];
148
  }
155
  *
156
  * @return int
157
  */
158
+ public function getHttpStatusCode() {
 
159
  return $this->response->getHttpStatusCode();
160
  }
161
 
164
  *
165
  * @return int
166
  */
167
+ public function getSubErrorCode() {
 
168
  return $this->get('error_subcode', -1);
169
  }
170
 
173
  *
174
  * @return string
175
  */
176
+ public function getErrorType() {
 
177
  return $this->get('type', '');
178
  }
179
 
182
  *
183
  * @return string
184
  */
185
+ public function getRawResponse() {
 
186
  return $this->response->getBody();
187
  }
188
 
191
  *
192
  * @return array
193
  */
194
+ public function getResponseData() {
 
195
  return $this->responseData;
196
  }
197
 
200
  *
201
  * @return FacebookResponse
202
  */
203
+ public function getResponse() {
 
204
  return $this->response;
205
  }
206
  }
{Facebook → providers/facebook/compat/Facebook}/Exceptions/FacebookResumableUploadException.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\Exceptions;
25
 
26
  /**
@@ -28,6 +29,6 @@ namespace Facebook\Exceptions;
28
  *
29
  * @package Facebook
30
  */
31
- class FacebookResumableUploadException extends FacebookSDKException
32
- {
33
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\Exceptions;
26
 
27
  /**
29
  *
30
  * @package Facebook
31
  */
32
+ class FacebookResumableUploadException extends FacebookSDKException {
33
+
34
  }
{Facebook → providers/facebook/compat/Facebook}/Exceptions/FacebookSDKException.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\Exceptions;
25
 
26
  /**
@@ -28,6 +29,6 @@ namespace Facebook\Exceptions;
28
  *
29
  * @package Facebook
30
  */
31
- class FacebookSDKException extends \Exception
32
- {
33
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\Exceptions;
26
 
27
  /**
29
  *
30
  * @package Facebook
31
  */
32
+ class FacebookSDKException extends \Exception {
33
+
34
  }
{Facebook → providers/facebook/compat/Facebook}/Exceptions/FacebookServerException.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\Exceptions;
25
 
26
  /**
@@ -28,6 +29,6 @@ namespace Facebook\Exceptions;
28
  *
29
  * @package Facebook
30
  */
31
- class FacebookServerException extends FacebookSDKException
32
- {
33
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\Exceptions;
26
 
27
  /**
29
  *
30
  * @package Facebook
31
  */
32
+ class FacebookServerException extends FacebookSDKException {
33
+
34
  }
{Facebook → providers/facebook/compat/Facebook}/Exceptions/FacebookThrottleException.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\Exceptions;
25
 
26
  /**
@@ -28,6 +29,6 @@ namespace Facebook\Exceptions;
28
  *
29
  * @package Facebook
30
  */
31
- class FacebookThrottleException extends FacebookSDKException
32
- {
33
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\Exceptions;
26
 
27
  /**
29
  *
30
  * @package Facebook
31
  */
32
+ class FacebookThrottleException extends FacebookSDKException {
33
+
34
  }
{Facebook → providers/facebook/compat/Facebook}/Facebook.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook;
25
 
26
  use Facebook\Authentication\AccessToken;
@@ -48,8 +49,8 @@ use Facebook\Exceptions\FacebookSDKException;
48
  *
49
  * @package Facebook
50
  */
51
- class Facebook
52
- {
53
  /**
54
  * @const string Version number of the Facebook PHP SDK.
55
  */
@@ -122,17 +123,16 @@ class Facebook
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']) {
@@ -142,18 +142,11 @@ class Facebook
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']);
@@ -168,8 +161,7 @@ class Facebook
168
  *
169
  * @return FacebookApp
170
  */
171
- public function getApp()
172
- {
173
  return $this->app;
174
  }
175
 
@@ -178,8 +170,7 @@ class Facebook
178
  *
179
  * @return FacebookClient
180
  */
181
- public function getClient()
182
- {
183
  return $this->client;
184
  }
185
 
@@ -188,11 +179,10 @@ class Facebook
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
 
@@ -204,8 +194,7 @@ class Facebook
204
  *
205
  * @return FacebookResponse|FacebookBatchResponse|null
206
  */
207
- public function getLastResponse()
208
- {
209
  return $this->lastResponse;
210
  }
211
 
@@ -214,8 +203,7 @@ class Facebook
214
  *
215
  * @return UrlDetectionInterface
216
  */
217
- public function getUrlDetectionHandler()
218
- {
219
  return $this->urlDetectionHandler;
220
  }
221
 
@@ -224,8 +212,7 @@ class Facebook
224
  *
225
  * @param UrlDetectionInterface $urlDetectionHandler
226
  */
227
- private function setUrlDetectionHandler(UrlDetectionInterface $urlDetectionHandler)
228
- {
229
  $this->urlDetectionHandler = $urlDetectionHandler;
230
  }
231
 
@@ -234,8 +221,7 @@ class Facebook
234
  *
235
  * @return AccessToken|null
236
  */
237
- public function getDefaultAccessToken()
238
- {
239
  return $this->defaultAccessToken;
240
  }
241
 
@@ -246,8 +232,7 @@ class Facebook
246
  *
247
  * @throws \InvalidArgumentException
248
  */
249
- public function setDefaultAccessToken($accessToken)
250
- {
251
  if (is_string($accessToken)) {
252
  $this->defaultAccessToken = new AccessToken($accessToken);
253
 
@@ -268,8 +253,7 @@ class Facebook
268
  *
269
  * @return string
270
  */
271
- public function getDefaultGraphVersion()
272
- {
273
  return $this->defaultGraphVersion;
274
  }
275
 
@@ -278,14 +262,8 @@ class Facebook
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
  /**
@@ -293,8 +271,7 @@ class Facebook
293
  *
294
  * @return FacebookJavaScriptHelper
295
  */
296
- public function getJavaScriptHelper()
297
- {
298
  return new FacebookJavaScriptHelper($this->app, $this->client, $this->defaultGraphVersion);
299
  }
300
 
@@ -303,8 +280,7 @@ class Facebook
303
  *
304
  * @return FacebookCanvasHelper
305
  */
306
- public function getCanvasHelper()
307
- {
308
  return new FacebookCanvasHelper($this->app, $this->client, $this->defaultGraphVersion);
309
  }
310
 
@@ -313,8 +289,7 @@ class Facebook
313
  *
314
  * @return FacebookPageTabHelper
315
  */
316
- public function getPageTabHelper()
317
- {
318
  return new FacebookPageTabHelper($this->app, $this->client, $this->defaultGraphVersion);
319
  }
320
 
@@ -330,16 +305,8 @@ class Facebook
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
  /**
@@ -355,16 +322,8 @@ class Facebook
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
  /**
@@ -380,16 +339,8 @@ class Facebook
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
  /**
@@ -401,8 +352,7 @@ class Facebook
401
  *
402
  * @throws FacebookSDKException
403
  */
404
- public function next(GraphEdge $graphEdge)
405
- {
406
  return $this->getPaginationResults($graphEdge, 'next');
407
  }
408
 
@@ -415,8 +365,7 @@ class Facebook
415
  *
416
  * @throws FacebookSDKException
417
  */
418
- public function previous(GraphEdge $graphEdge)
419
- {
420
  return $this->getPaginationResults($graphEdge, 'previous');
421
  }
422
 
@@ -430,8 +379,7 @@ class Facebook
430
  *
431
  * @throws FacebookSDKException
432
  */
433
- public function getPaginationResults(GraphEdge $graphEdge, $direction)
434
- {
435
  $paginationRequest = $graphEdge->getPaginationRequest($direction);
436
  if (!$paginationRequest) {
437
  return null;
@@ -441,7 +389,7 @@ class Facebook
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
  }
@@ -460,11 +408,10 @@ class Facebook
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
  }
@@ -480,16 +427,10 @@ class Facebook
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
  }
@@ -508,20 +449,11 @@ class Facebook
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
  /**
@@ -533,8 +465,7 @@ class Facebook
533
  *
534
  * @throws FacebookSDKException
535
  */
536
- public function fileToUpload($pathToFile)
537
- {
538
  return new FacebookFile($pathToFile);
539
  }
540
 
@@ -547,42 +478,40 @@ class Facebook
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
 
@@ -590,16 +519,15 @@ class Facebook
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) {
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook;
26
 
27
  use Facebook\Authentication\AccessToken;
49
  *
50
  * @package Facebook
51
  */
52
+ class Facebook {
53
+
54
  /**
55
  * @const string Version number of the Facebook PHP SDK.
56
  */
123
  *
124
  * @throws FacebookSDKException
125
  */
126
+ public function __construct(array $config = []) {
 
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']) {
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(HttpClientsFactory::createHttpClient($config['http_client_handler']), $config['enable_beta_mode']);
147
+ $this->pseudoRandomStringGenerator = PseudoRandomStringGeneratorFactory::createPseudoRandomStringGenerator($config['pseudo_random_string_generator']);
 
 
 
 
 
148
  $this->setUrlDetectionHandler($config['url_detection_handler'] ?: new FacebookUrlDetectionHandler());
149
+ $this->persistentDataHandler = PersistentDataFactory::createPersistentDataHandler($config['persistent_data_handler']);
 
 
150
 
151
  if (isset($config['default_access_token'])) {
152
  $this->setDefaultAccessToken($config['default_access_token']);
161
  *
162
  * @return FacebookApp
163
  */
164
+ public function getApp() {
 
165
  return $this->app;
166
  }
167
 
170
  *
171
  * @return FacebookClient
172
  */
173
+ public function getClient() {
 
174
  return $this->client;
175
  }
176
 
179
  *
180
  * @return OAuth2Client
181
  */
182
+ public function getOAuth2Client() {
 
183
  if (!$this->oAuth2Client instanceof OAuth2Client) {
184
+ $app = $this->getApp();
185
+ $client = $this->getClient();
186
  $this->oAuth2Client = new OAuth2Client($app, $client, $this->defaultGraphVersion);
187
  }
188
 
194
  *
195
  * @return FacebookResponse|FacebookBatchResponse|null
196
  */
197
+ public function getLastResponse() {
 
198
  return $this->lastResponse;
199
  }
200
 
203
  *
204
  * @return UrlDetectionInterface
205
  */
206
+ public function getUrlDetectionHandler() {
 
207
  return $this->urlDetectionHandler;
208
  }
209
 
212
  *
213
  * @param UrlDetectionInterface $urlDetectionHandler
214
  */
215
+ private function setUrlDetectionHandler(UrlDetectionInterface $urlDetectionHandler) {
 
216
  $this->urlDetectionHandler = $urlDetectionHandler;
217
  }
218
 
221
  *
222
  * @return AccessToken|null
223
  */
224
+ public function getDefaultAccessToken() {
 
225
  return $this->defaultAccessToken;
226
  }
227
 
232
  *
233
  * @throws \InvalidArgumentException
234
  */
235
+ public function setDefaultAccessToken($accessToken) {
 
236
  if (is_string($accessToken)) {
237
  $this->defaultAccessToken = new AccessToken($accessToken);
238
 
253
  *
254
  * @return string
255
  */
256
+ public function getDefaultGraphVersion() {
 
257
  return $this->defaultGraphVersion;
258
  }
259
 
262
  *
263
  * @return FacebookRedirectLoginHelper
264
  */
265
+ public function getRedirectLoginHelper() {
266
+ return new FacebookRedirectLoginHelper($this->getOAuth2Client(), $this->persistentDataHandler, $this->urlDetectionHandler, $this->pseudoRandomStringGenerator);
 
 
 
 
 
 
267
  }
268
 
269
  /**
271
  *
272
  * @return FacebookJavaScriptHelper
273
  */
274
+ public function getJavaScriptHelper() {
 
275
  return new FacebookJavaScriptHelper($this->app, $this->client, $this->defaultGraphVersion);
276
  }
277
 
280
  *
281
  * @return FacebookCanvasHelper
282
  */
283
+ public function getCanvasHelper() {
 
284
  return new FacebookCanvasHelper($this->app, $this->client, $this->defaultGraphVersion);
285
  }
286
 
289
  *
290
  * @return FacebookPageTabHelper
291
  */
292
+ public function getPageTabHelper() {
 
293
  return new FacebookPageTabHelper($this->app, $this->client, $this->defaultGraphVersion);
294
  }
295
 
305
  *
306
  * @throws FacebookSDKException
307
  */
308
+ public function get($endpoint, $accessToken = null, $eTag = null, $graphVersion = null) {
309
+ return $this->sendRequest('GET', $endpoint, $params = [], $accessToken, $eTag, $graphVersion);
 
 
 
 
 
 
 
 
310
  }
311
 
312
  /**
322
  *
323
  * @throws FacebookSDKException
324
  */
325
+ public function post($endpoint, array $params = [], $accessToken = null, $eTag = null, $graphVersion = null) {
326
+ return $this->sendRequest('POST', $endpoint, $params, $accessToken, $eTag, $graphVersion);
 
 
 
 
 
 
 
 
327
  }
328
 
329
  /**
339
  *
340
  * @throws FacebookSDKException
341
  */
342
+ public function delete($endpoint, array $params = [], $accessToken = null, $eTag = null, $graphVersion = null) {
343
+ return $this->sendRequest('DELETE', $endpoint, $params, $accessToken, $eTag, $graphVersion);
 
 
 
 
 
 
 
 
344
  }
345
 
346
  /**
352
  *
353
  * @throws FacebookSDKException
354
  */
355
+ public function next(GraphEdge $graphEdge) {
 
356
  return $this->getPaginationResults($graphEdge, 'next');
357
  }
358
 
365
  *
366
  * @throws FacebookSDKException
367
  */
368
+ public function previous(GraphEdge $graphEdge) {
 
369
  return $this->getPaginationResults($graphEdge, 'previous');
370
  }
371
 
379
  *
380
  * @throws FacebookSDKException
381
  */
382
+ public function getPaginationResults(GraphEdge $graphEdge, $direction) {
 
383
  $paginationRequest = $graphEdge->getPaginationRequest($direction);
384
  if (!$paginationRequest) {
385
  return null;
389
 
390
  // Keep the same GraphNode subclass
391
  $subClassName = $graphEdge->getSubClassName();
392
+ $graphEdge = $this->lastResponse->getGraphEdge($subClassName, false);
393
 
394
  return count($graphEdge) > 0 ? $graphEdge : null;
395
  }
408
  *
409
  * @throws FacebookSDKException
410
  */
411
+ public function sendRequest($method, $endpoint, array $params = [], $accessToken = null, $eTag = null, $graphVersion = null) {
412
+ $accessToken = $accessToken ?: $this->defaultAccessToken;
 
413
  $graphVersion = $graphVersion ?: $this->defaultGraphVersion;
414
+ $request = $this->request($method, $endpoint, $params, $accessToken, $eTag, $graphVersion);
415
 
416
  return $this->lastResponse = $this->client->sendRequest($request);
417
  }
427
  *
428
  * @throws FacebookSDKException
429
  */
430
+ public function sendBatchRequest(array $requests, $accessToken = null, $graphVersion = null) {
431
+ $accessToken = $accessToken ?: $this->defaultAccessToken;
 
432
  $graphVersion = $graphVersion ?: $this->defaultGraphVersion;
433
+ $batchRequest = new FacebookBatchRequest($this->app, $requests, $accessToken, $graphVersion);
 
 
 
 
 
434
 
435
  return $this->lastResponse = $this->client->sendBatchRequest($batchRequest);
436
  }
449
  *
450
  * @throws FacebookSDKException
451
  */
452
+ public function request($method, $endpoint, array $params = [], $accessToken = null, $eTag = null, $graphVersion = null) {
453
+ $accessToken = $accessToken ?: $this->defaultAccessToken;
 
454
  $graphVersion = $graphVersion ?: $this->defaultGraphVersion;
455
 
456
+ return new FacebookRequest($this->app, $accessToken, $method, $endpoint, $params, $eTag, $graphVersion);
 
 
 
 
 
 
 
 
457
  }
458
 
459
  /**
465
  *
466
  * @throws FacebookSDKException
467
  */
468
+ public function fileToUpload($pathToFile) {
 
469
  return new FacebookFile($pathToFile);
470
  }
471
 
478
  *
479
  * @throws FacebookSDKException
480
  */
481
+ public function videoToUpload($pathToFile) {
 
482
  return new FacebookVideo($pathToFile);
483
  }
484
 
485
  /**
486
  * Upload a video in chunks.
487
  *
488
+ * @param int $target The id of the target node before the /videos edge.
489
+ * @param string $pathToFile The full path to the file.
490
+ * @param array $metadata The metadata associated with the video file.
491
+ * @param string|null $accessToken The access token.
492
+ * @param int $maxTransferTries The max times to retry a failed upload chunk.
493
+ * @param string|null $graphVersion The Graph API version to use.
494
  *
495
  * @return array
496
  *
497
  * @throws FacebookSDKException
498
  */
499
+ public function uploadVideo($target, $pathToFile, $metadata = [], $accessToken = null, $maxTransferTries = 5, $graphVersion = null) {
500
+ $accessToken = $accessToken ?: $this->defaultAccessToken;
 
501
  $graphVersion = $graphVersion ?: $this->defaultGraphVersion;
502
 
503
  $uploader = new FacebookResumableUploader($this->app, $this->client, $accessToken, $graphVersion);
504
+ $endpoint = '/' . $target . '/videos';
505
+ $file = $this->videoToUpload($pathToFile);
506
+ $chunk = $uploader->start($endpoint, $file);
507
 
508
  do {
509
  $chunk = $this->maxTriesTransfer($uploader, $endpoint, $chunk, $maxTransferTries);
510
  } while (!$chunk->isLastChunk());
511
 
512
  return [
513
+ 'video_id' => $chunk->getVideoId(),
514
+ 'success' => $uploader->finish($endpoint, $chunk->getUploadSessionId(), $metadata),
515
  ];
516
  }
517
 
519
  * Attempts to upload a chunk of a file in $retryCountdown tries.
520
  *
521
  * @param FacebookResumableUploader $uploader
522
+ * @param string $endpoint
523
+ * @param FacebookTransferChunk $chunk
524
+ * @param int $retryCountdown
525
  *
526
  * @return FacebookTransferChunk
527
  *
528
  * @throws FacebookSDKException
529
  */
530
+ private function maxTriesTransfer(FacebookResumableUploader $uploader, $endpoint, FacebookTransferChunk $chunk, $retryCountdown) {
 
531
  $newChunk = $uploader->transfer($endpoint, $chunk, $retryCountdown < 1);
532
 
533
  if ($newChunk !== $chunk) {
{Facebook → providers/facebook/compat/Facebook}/FacebookApp.php RENAMED
@@ -21,13 +21,14 @@
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
  */
@@ -44,15 +45,13 @@ class FacebookApp implements \Serializable
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
 
@@ -61,8 +60,7 @@ class FacebookApp implements \Serializable
61
  *
62
  * @return string
63
  */
64
- public function getId()
65
- {
66
  return $this->id;
67
  }
68
 
@@ -71,8 +69,7 @@ class FacebookApp implements \Serializable
71
  *
72
  * @return string
73
  */
74
- public function getSecret()
75
- {
76
  return $this->secret;
77
  }
78
 
@@ -81,8 +78,7 @@ class FacebookApp implements \Serializable
81
  *
82
  * @return AccessToken
83
  */
84
- public function getAccessToken()
85
- {
86
  return new AccessToken($this->id . '|' . $this->secret);
87
  }
88
 
@@ -91,9 +87,11 @@ class FacebookApp implements \Serializable
91
  *
92
  * @return string
93
  */
94
- public function serialize()
95
- {
96
- return implode('|', [$this->id, $this->secret]);
 
 
97
  }
98
 
99
  /**
@@ -101,8 +99,7 @@ class FacebookApp implements \Serializable
101
  *
102
  * @param string $serialized
103
  */
104
- public function unserialize($serialized)
105
- {
106
  list($id, $secret) = explode('|', $serialized);
107
 
108
  $this->__construct($id, $secret);
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook;
26
 
27
  use Facebook\Authentication\AccessToken;
28
  use Facebook\Exceptions\FacebookSDKException;
29
 
30
+ class FacebookApp implements \Serializable {
31
+
32
  /**
33
  * @var string The app ID.
34
  */
45
  *
46
  * @throws FacebookSDKException
47
  */
48
+ public function __construct($id, $secret) {
49
+ if (!is_string($id) // Keeping this for BC. Integers greater than PHP_INT_MAX will make is_int() return false
50
+ && !is_int($id)) {
 
 
51
  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.');
52
  }
53
  // 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
54
+ $this->id = (string)$id;
55
  $this->secret = $secret;
56
  }
57
 
60
  *
61
  * @return string
62
  */
63
+ public function getId() {
 
64
  return $this->id;
65
  }
66
 
69
  *
70
  * @return string
71
  */
72
+ public function getSecret() {
 
73
  return $this->secret;
74
  }
75
 
78
  *
79
  * @return AccessToken
80
  */
81
+ public function getAccessToken() {
 
82
  return new AccessToken($this->id . '|' . $this->secret);
83
  }
84
 
87
  *
88
  * @return string
89
  */
90
+ public function serialize() {
91
+ return implode('|', [
92
+ $this->id,
93
+ $this->secret
94
+ ]);
95
  }
96
 
97
  /**
99
  *
100
  * @param string $serialized
101
  */
102
+ public function unserialize($serialized) {
 
103
  list($id, $secret) = explode('|', $serialized);
104
 
105
  $this->__construct($id, $secret);
{Facebook → providers/facebook/compat/Facebook}/FacebookBatchRequest.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook;
25
 
26
  use ArrayIterator;
@@ -34,8 +35,8 @@ use Facebook\Exceptions\FacebookSDKException;
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
  */
@@ -54,8 +55,7 @@ class FacebookBatchRequest extends FacebookRequest implements IteratorAggregate,
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);
@@ -71,8 +71,7 @@ class FacebookBatchRequest extends FacebookRequest implements IteratorAggregate,
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);
@@ -87,7 +86,7 @@ class FacebookBatchRequest extends FacebookRequest implements IteratorAggregate,
87
 
88
  $this->addFallbackDefaults($request);
89
  $requestToAdd = [
90
- 'name' => $name,
91
  'request' => $request,
92
  ];
93
 
@@ -108,8 +107,7 @@ class FacebookBatchRequest extends FacebookRequest implements IteratorAggregate,
108
  *
109
  * @throws FacebookSDKException
110
  */
111
- public function addFallbackDefaults(FacebookRequest $request)
112
- {
113
  if (!$request->getApp()) {
114
  $app = $this->getApp();
115
  if (!$app) {
@@ -136,13 +134,12 @@ class FacebookBatchRequest extends FacebookRequest implements IteratorAggregate,
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();
@@ -161,20 +158,18 @@ class FacebookBatchRequest extends FacebookRequest implements IteratorAggregate,
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
- public function prepareRequestsForBatch()
173
- {
174
  $this->validateBatchRequestCount();
175
 
176
  $params = [
177
- 'batch' => $this->convertRequestsToJson(),
178
  'include_headers' => true,
179
  ];
180
  $this->setParams($params);
@@ -185,12 +180,11 @@ class FacebookBatchRequest extends FacebookRequest implements IteratorAggregate,
185
  *
186
  * @return string
187
  */
188
- public function convertRequestsToJson()
189
- {
190
  $requests = [];
191
  foreach ($this->requests as $request) {
192
  $attachedFiles = isset($request['attached_files']) ? $request['attached_files'] : null;
193
- $requests[] = $this->requestEntityToBatchArray($request['request'], $request['name'], $attachedFiles);
194
  }
195
 
196
  return json_encode($requests);
@@ -201,8 +195,7 @@ class FacebookBatchRequest extends FacebookRequest implements IteratorAggregate,
201
  *
202
  * @throws FacebookSDKException
203
  */
204
- public function validateBatchRequestCount()
205
- {
206
  $batchCount = count($this->requests);
207
  if ($batchCount === 0) {
208
  throw new FacebookSDKException('There are no batch requests to send.');
@@ -221,23 +214,23 @@ class FacebookBatchRequest extends FacebookRequest implements IteratorAggregate,
221
  *
222
  * @return array
223
  */
224
- public function requestEntityToBatchArray(FacebookRequest $request, $requestName = null, $attachedFiles = null)
225
- {
226
  $compiledHeaders = [];
227
- $headers = $request->getHeaders();
228
  foreach ($headers as $name => $value) {
229
  $compiledHeaders[] = $name . ': ' . $value;
230
  }
231
 
232
  $batch = [
233
- 'headers' => $compiledHeaders,
234
- 'method' => $request->getMethod(),
235
  'relative_url' => $request->getUrl(),
236
  ];
237
 
238
  // Since file uploads are moved to the root request of a batch request,
239
  // the child requests will always be URL-encoded.
240
- $body = $request->getUrlEncodedBody()->getBody();
 
241
  if ($body) {
242
  $batch['body'] = $body;
243
  }
@@ -262,40 +255,35 @@ class FacebookBatchRequest extends FacebookRequest implements IteratorAggregate,
262
  *
263
  * @return ArrayIterator
264
  */
265
- public function getIterator()
266
- {
267
  return new ArrayIterator($this->requests);
268
  }
269
 
270
  /**
271
  * @inheritdoc
272
  */
273
- public function offsetSet($offset, $value)
274
- {
275
  $this->add($value, $offset);
276
  }
277
 
278
  /**
279
  * @inheritdoc
280
  */
281
- public function offsetExists($offset)
282
- {
283
  return isset($this->requests[$offset]);
284
  }
285
 
286
  /**
287
  * @inheritdoc
288
  */
289
- public function offsetUnset($offset)
290
- {
291
  unset($this->requests[$offset]);
292
  }
293
 
294
  /**
295
  * @inheritdoc
296
  */
297
- public function offsetGet($offset)
298
- {
299
  return isset($this->requests[$offset]) ? $this->requests[$offset] : null;
300
  }
301
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook;
26
 
27
  use ArrayIterator;
35
  *
36
  * @package Facebook
37
  */
38
+ class FacebookBatchRequest extends FacebookRequest implements IteratorAggregate, ArrayAccess {
39
+
40
  /**
41
  * @var array An array of FacebookRequest entities to send.
42
  */
55
  * @param AccessToken|string|null $accessToken
56
  * @param string|null $graphVersion
57
  */
58
+ public function __construct(FacebookApp $app = null, array $requests = [], $accessToken = null, $graphVersion = null) {
 
59
  parent::__construct($app, $accessToken, 'POST', '', [], null, $graphVersion);
60
 
61
  $this->add($requests);
71
  *
72
  * @throws \InvalidArgumentException
73
  */
74
+ public function add($request, $name = null) {
 
75
  if (is_array($request)) {
76
  foreach ($request as $key => $req) {
77
  $this->add($req, $key);
86
 
87
  $this->addFallbackDefaults($request);
88
  $requestToAdd = [
89
+ 'name' => $name,
90
  'request' => $request,
91
  ];
92
 
107
  *
108
  * @throws FacebookSDKException
109
  */
110
+ public function addFallbackDefaults(FacebookRequest $request) {
 
111
  if (!$request->getApp()) {
112
  $app = $this->getApp();
113
  if (!$app) {
134
  *
135
  * @throws FacebookSDKException
136
  */
137
+ public function extractFileAttachments(FacebookRequest $request) {
 
138
  if (!$request->containsFileUploads()) {
139
  return null;
140
  }
141
 
142
+ $files = $request->getFiles();
143
  $fileNames = [];
144
  foreach ($files as $file) {
145
  $fileName = uniqid();
158
  *
159
  * @return array
160
  */
161
+ public function getRequests() {
 
162
  return $this->requests;
163
  }
164
 
165
  /**
166
  * Prepares the requests to be sent as a batch request.
167
  */
168
+ public function prepareRequestsForBatch() {
 
169
  $this->validateBatchRequestCount();
170
 
171
  $params = [
172
+ 'batch' => $this->convertRequestsToJson(),
173
  'include_headers' => true,
174
  ];
175
  $this->setParams($params);
180
  *
181
  * @return string
182
  */
183
+ public function convertRequestsToJson() {
 
184
  $requests = [];
185
  foreach ($this->requests as $request) {
186
  $attachedFiles = isset($request['attached_files']) ? $request['attached_files'] : null;
187
+ $requests[] = $this->requestEntityToBatchArray($request['request'], $request['name'], $attachedFiles);
188
  }
189
 
190
  return json_encode($requests);
195
  *
196
  * @throws FacebookSDKException
197
  */
198
+ public function validateBatchRequestCount() {
 
199
  $batchCount = count($this->requests);
200
  if ($batchCount === 0) {
201
  throw new FacebookSDKException('There are no batch requests to send.');
214
  *
215
  * @return array
216
  */
217
+ public function requestEntityToBatchArray(FacebookRequest $request, $requestName = null, $attachedFiles = null) {
 
218
  $compiledHeaders = [];
219
+ $headers = $request->getHeaders();
220
  foreach ($headers as $name => $value) {
221
  $compiledHeaders[] = $name . ': ' . $value;
222
  }
223
 
224
  $batch = [
225
+ 'headers' => $compiledHeaders,
226
+ 'method' => $request->getMethod(),
227
  'relative_url' => $request->getUrl(),
228
  ];
229
 
230
  // Since file uploads are moved to the root request of a batch request,
231
  // the child requests will always be URL-encoded.
232
+ $body = $request->getUrlEncodedBody()
233
+ ->getBody();
234
  if ($body) {
235
  $batch['body'] = $body;
236
  }
255
  *
256
  * @return ArrayIterator
257
  */
258
+ public function getIterator() {
 
259
  return new ArrayIterator($this->requests);
260
  }
261
 
262
  /**
263
  * @inheritdoc
264
  */
265
+ public function offsetSet($offset, $value) {
 
266
  $this->add($value, $offset);
267
  }
268
 
269
  /**
270
  * @inheritdoc
271
  */
272
+ public function offsetExists($offset) {
 
273
  return isset($this->requests[$offset]);
274
  }
275
 
276
  /**
277
  * @inheritdoc
278
  */
279
+ public function offsetUnset($offset) {
 
280
  unset($this->requests[$offset]);
281
  }
282
 
283
  /**
284
  * @inheritdoc
285
  */
286
+ public function offsetGet($offset) {
 
287
  return isset($this->requests[$offset]) ? $this->requests[$offset] : null;
288
  }
289
  }
{Facebook → providers/facebook/compat/Facebook}/FacebookBatchResponse.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook;
25
 
26
  use ArrayIterator;
@@ -32,8 +33,8 @@ use ArrayAccess;
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
  */
@@ -50,14 +51,13 @@ class FacebookBatchResponse extends FacebookResponse implements IteratorAggregat
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();
@@ -69,8 +69,7 @@ class FacebookBatchResponse extends FacebookResponse implements IteratorAggregat
69
  *
70
  * @return array
71
  */
72
- public function getResponses()
73
- {
74
  return $this->responses;
75
  }
76
 
@@ -80,8 +79,7 @@ class FacebookBatchResponse extends FacebookResponse implements IteratorAggregat
80
  *
81
  * @param array $responses
82
  */
83
- public function setResponses(array $responses)
84
- {
85
  $this->responses = [];
86
 
87
  foreach ($responses as $key => $graphResponse) {
@@ -95,74 +93,63 @@ class FacebookBatchResponse extends FacebookResponse implements IteratorAggregat
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) {
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook;
26
 
27
  use ArrayIterator;
33
  *
34
  * @package Facebook
35
  */
36
+ class FacebookBatchResponse extends FacebookResponse implements IteratorAggregate, ArrayAccess {
37
+
38
  /**
39
  * @var FacebookBatchRequest The original entity that made the batch request.
40
  */
51
  * @param FacebookBatchRequest $batchRequest
52
  * @param FacebookResponse $response
53
  */
54
+ public function __construct(FacebookBatchRequest $batchRequest, FacebookResponse $response) {
 
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();
69
  *
70
  * @return array
71
  */
72
+ public function getResponses() {
 
73
  return $this->responses;
74
  }
75
 
79
  *
80
  * @param array $responses
81
  */
82
+ public function setResponses(array $responses) {
 
83
  $this->responses = [];
84
 
85
  foreach ($responses as $key => $graphResponse) {
93
  * @param int $key
94
  * @param array|null $response
95
  */
96
+ public function addResponse($key, $response) {
 
97
  $originalRequestName = isset($this->batchRequest[$key]['name']) ? $this->batchRequest[$key]['name'] : $key;
98
+ $originalRequest = isset($this->batchRequest[$key]['request']) ? $this->batchRequest[$key]['request'] : null;
99
 
100
  $httpResponseBody = isset($response['body']) ? $response['body'] : null;
101
  $httpResponseCode = isset($response['code']) ? $response['code'] : null;
102
  // @TODO With PHP 5.5 support, this becomes array_column($response['headers'], 'value', 'name')
103
  $httpResponseHeaders = isset($response['headers']) ? $this->normalizeBatchHeaders($response['headers']) : [];
104
 
105
+ $this->responses[$originalRequestName] = new FacebookResponse($originalRequest, $httpResponseBody, $httpResponseCode, $httpResponseHeaders);
 
 
 
 
 
106
  }
107
 
108
  /**
109
  * @inheritdoc
110
  */
111
+ public function getIterator() {
 
112
  return new ArrayIterator($this->responses);
113
  }
114
 
115
  /**
116
  * @inheritdoc
117
  */
118
+ public function offsetSet($offset, $value) {
 
119
  $this->addResponse($offset, $value);
120
  }
121
 
122
  /**
123
  * @inheritdoc
124
  */
125
+ public function offsetExists($offset) {
 
126
  return isset($this->responses[$offset]);
127
  }
128
 
129
  /**
130
  * @inheritdoc
131
  */
132
+ public function offsetUnset($offset) {
 
133
  unset($this->responses[$offset]);
134
  }
135
 
136
  /**
137
  * @inheritdoc
138
  */
139
+ public function offsetGet($offset) {
 
140
  return isset($this->responses[$offset]) ? $this->responses[$offset] : null;
141
  }
142
 
143
  /**
144
  * Converts the batch header array into a standard format.
145
+ *
146
  * @TODO replace with array_column() when PHP 5.5 is supported.
147
  *
148
  * @param array $batchHeaders
149
  *
150
  * @return array
151
  */
152
+ private function normalizeBatchHeaders(array $batchHeaders) {
 
153
  $headers = [];
154
 
155
  foreach ($batchHeaders as $header) {
{Facebook → providers/facebook/compat/Facebook}/FacebookClient.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook;
25
 
26
  use Facebook\HttpClients\FacebookHttpClientInterface;
@@ -33,8 +34,8 @@ use Facebook\Exceptions\FacebookSDKException;
33
  *
34
  * @package Facebook
35
  */
36
- class FacebookClient
37
- {
38
  /**
39
  * @const string Production Graph API URL.
40
  */
@@ -91,10 +92,9 @@ class FacebookClient
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
  /**
@@ -102,8 +102,7 @@ class FacebookClient
102
  *
103
  * @param FacebookHttpClientInterface $httpClientHandler
104
  */
105
- public function setHttpClientHandler(FacebookHttpClientInterface $httpClientHandler)
106
- {
107
  $this->httpClientHandler = $httpClientHandler;
108
  }
109
 
@@ -112,8 +111,7 @@ class FacebookClient
112
  *
113
  * @return FacebookHttpClientInterface
114
  */
115
- public function getHttpClientHandler()
116
- {
117
  return $this->httpClientHandler;
118
  }
119
 
@@ -122,8 +120,7 @@ class FacebookClient
122
  *
123
  * @return FacebookHttpClientInterface
124
  */
125
- public function detectHttpClientHandler()
126
- {
127
  return extension_loaded('curl') ? new FacebookCurlHttpClient() : new FacebookStreamHttpClient();
128
  }
129
 
@@ -132,8 +129,7 @@ class FacebookClient
132
  *
133
  * @param boolean $betaMode
134
  */
135
- public function enableBetaMode($betaMode = true)
136
- {
137
  $this->enableBetaMode = $betaMode;
138
  }
139
 
@@ -144,8 +140,7 @@ class FacebookClient
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
  }
@@ -160,10 +155,9 @@ class FacebookClient
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()) {
@@ -195,8 +189,7 @@ class FacebookClient
195
  *
196
  * @throws FacebookSDKException
197
  */
198
- public function sendRequest(FacebookRequest $request)
199
- {
200
  if (get_class($request) === 'Facebook\FacebookRequest') {
201
  $request->validateAccessToken();
202
  }
@@ -217,12 +210,7 @@ class FacebookClient
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();
@@ -240,8 +228,7 @@ class FacebookClient
240
  *
241
  * @throws FacebookSDKException
242
  */
243
- public function sendBatchRequest(FacebookBatchRequest $request)
244
- {
245
  $request->prepareRequestsForBatch();
246
  $facebookResponse = $this->sendRequest($request);
247
 
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook;
26
 
27
  use Facebook\HttpClients\FacebookHttpClientInterface;
34
  *
35
  * @package Facebook
36
  */
37
+ class FacebookClient {
38
+
39
  /**
40
  * @const string Production Graph API URL.
41
  */
92
  * @param FacebookHttpClientInterface|null $httpClientHandler
93
  * @param boolean $enableBeta
94
  */
95
+ public function __construct(FacebookHttpClientInterface $httpClientHandler = null, $enableBeta = false) {
 
96
  $this->httpClientHandler = $httpClientHandler ?: $this->detectHttpClientHandler();
97
+ $this->enableBetaMode = $enableBeta;
98
  }
99
 
100
  /**
102
  *
103
  * @param FacebookHttpClientInterface $httpClientHandler
104
  */
105
+ public function setHttpClientHandler(FacebookHttpClientInterface $httpClientHandler) {
 
106
  $this->httpClientHandler = $httpClientHandler;
107
  }
108
 
111
  *
112
  * @return FacebookHttpClientInterface
113
  */
114
+ public function getHttpClientHandler() {
 
115
  return $this->httpClientHandler;
116
  }
117
 
120
  *
121
  * @return FacebookHttpClientInterface
122
  */
123
+ public function detectHttpClientHandler() {
 
124
  return extension_loaded('curl') ? new FacebookCurlHttpClient() : new FacebookStreamHttpClient();
125
  }
126
 
129
  *
130
  * @param boolean $betaMode
131
  */
132
+ public function enableBetaMode($betaMode = true) {
 
133
  $this->enableBetaMode = $betaMode;
134
  }
135
 
140
  *
141
  * @return string
142
  */
143
+ public function getBaseGraphUrl($postToVideoUrl = false) {
 
144
  if ($postToVideoUrl) {
145
  return $this->enableBetaMode ? static::BASE_GRAPH_VIDEO_URL_BETA : static::BASE_GRAPH_VIDEO_URL;
146
  }
155
  *
156
  * @return array
157
  */
158
+ public function prepareRequestMessage(FacebookRequest $request) {
 
159
  $postToVideoUrl = $request->containsVideoUploads();
160
+ $url = $this->getBaseGraphUrl($postToVideoUrl) . $request->getUrl();
161
 
162
  // If we're sending files they should be sent as multipart/form-data
163
  if ($request->containsFileUploads()) {
189
  *
190
  * @throws FacebookSDKException
191
  */
192
+ public function sendRequest(FacebookRequest $request) {
 
193
  if (get_class($request) === 'Facebook\FacebookRequest') {
194
  $request->validateAccessToken();
195
  }
210
 
211
  static::$requestCount++;
212
 
213
+ $returnResponse = new FacebookResponse($request, $rawResponse->getBody(), $rawResponse->getHttpResponseCode(), $rawResponse->getHeaders());
 
 
 
 
 
214
 
215
  if ($returnResponse->isError()) {
216
  throw $returnResponse->getThrownException();
228
  *
229
  * @throws FacebookSDKException
230
  */
231
+ public function sendBatchRequest(FacebookBatchRequest $request) {
 
232
  $request->prepareRequestsForBatch();
233
  $facebookResponse = $this->sendRequest($request);
234
 
{Facebook → providers/facebook/compat/Facebook}/FacebookRequest.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook;
25
 
26
  use Facebook\Authentication\AccessToken;
@@ -36,8 +37,8 @@ use Facebook\Exceptions\FacebookSDKException;
36
  *
37
  * @package Facebook
38
  */
39
- class FacebookRequest
40
- {
41
  /**
42
  * @var FacebookApp The Facebook app entity.
43
  */
@@ -94,8 +95,7 @@ class FacebookRequest
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);
@@ -112,8 +112,7 @@ class FacebookRequest
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();
@@ -131,8 +130,7 @@ class FacebookRequest
131
  *
132
  * @throws FacebookSDKException
133
  */
134
- public function setAccessTokenFromParams($accessToken)
135
- {
136
  $existingAccessToken = $this->getAccessToken();
137
  if (!$existingAccessToken) {
138
  $this->setAccessToken($accessToken);
@@ -148,8 +146,7 @@ class FacebookRequest
148
  *
149
  * @return string|null
150
  */
151
- public function getAccessToken()
152
- {
153
  return $this->accessToken;
154
  }
155
 
@@ -158,8 +155,7 @@ class FacebookRequest
158
  *
159
  * @return AccessToken|null
160
  */
161
- public function getAccessTokenEntity()
162
- {
163
  return $this->accessToken ? new AccessToken($this->accessToken) : null;
164
  }
165
 
@@ -168,8 +164,7 @@ class FacebookRequest
168
  *
169
  * @param FacebookApp|null $app
170
  */
171
- public function setApp(FacebookApp $app = null)
172
- {
173
  $this->app = $app;
174
  }
175
 
@@ -178,8 +173,7 @@ class FacebookRequest
178
  *
179
  * @return FacebookApp
180
  */
181
- public function getApp()
182
- {
183
  return $this->app;
184
  }
185
 
@@ -188,8 +182,7 @@ class FacebookRequest
188
  *
189
  * @return string|null
190
  */
191
- public function getAppSecretProof()
192
- {
193
  if (!$accessTokenEntity = $this->getAccessTokenEntity()) {
194
  return null;
195
  }
@@ -202,8 +195,7 @@ class FacebookRequest
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.');
@@ -215,8 +207,7 @@ class FacebookRequest
215
  *
216
  * @param string
217
  */
218
- public function setMethod($method)
219
- {
220
  $this->method = strtoupper($method);
221
  }
222
 
@@ -225,8 +216,7 @@ class FacebookRequest
225
  *
226
  * @return string
227
  */
228
- public function getMethod()
229
- {
230
  return $this->method;
231
  }
232
 
@@ -235,13 +225,16 @@ class FacebookRequest
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
  }
@@ -255,8 +248,7 @@ class 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'])) {
@@ -264,7 +256,10 @@ class FacebookRequest
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;
@@ -275,8 +270,7 @@ class FacebookRequest
275
  *
276
  * @return string
277
  */
278
- public function getEndpoint()
279
- {
280
  // For batch requests, this will be empty
281
  return $this->endpoint;
282
  }
@@ -286,8 +280,7 @@ class FacebookRequest
286
  *
287
  * @return array
288
  */
289
- public function getHeaders()
290
- {
291
  $headers = static::getDefaultHeaders();
292
 
293
  if ($this->eTag) {
@@ -302,8 +295,7 @@ class FacebookRequest
302
  *
303
  * @param array $headers
304
  */
305
- public function setHeaders(array $headers)
306
- {
307
  $this->headers = array_merge($this->headers, $headers);
308
  }
309
 
@@ -312,8 +304,7 @@ class FacebookRequest
312
  *
313
  * @param string $eTag
314
  */
315
- public function setETag($eTag)
316
- {
317
  $this->eTag = $eTag;
318
  }
319
 
@@ -326,8 +317,7 @@ class 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
  }
@@ -350,8 +340,7 @@ class FacebookRequest
350
  *
351
  * @return FacebookRequest
352
  */
353
- public function dangerouslySetParams(array $params = [])
354
- {
355
  $this->params = array_merge($this->params, $params);
356
 
357
  return $this;
@@ -364,8 +353,7 @@ class FacebookRequest
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);
@@ -382,16 +370,14 @@ class FacebookRequest
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
 
@@ -400,8 +386,7 @@ class FacebookRequest
400
  *
401
  * @return array
402
  */
403
- public function getFiles()
404
- {
405
  return $this->files;
406
  }
407
 
@@ -410,8 +395,7 @@ class FacebookRequest
410
  *
411
  * @return boolean
412
  */
413
- public function containsFileUploads()
414
- {
415
  return !empty($this->files);
416
  }
417
 
@@ -420,8 +404,7 @@ class FacebookRequest
420
  *
421
  * @return boolean
422
  */
423
- public function containsVideoUploads()
424
- {
425
  foreach ($this->files as $file) {
426
  if ($file instanceof FacebookVideo) {
427
  return true;
@@ -436,8 +419,7 @@ class FacebookRequest
436
  *
437
  * @return RequestBodyMultipart
438
  */
439
- public function getMultipartBody()
440
- {
441
  $params = $this->getPostParams();
442
 
443
  return new RequestBodyMultipart($params, $this->files);
@@ -448,8 +430,7 @@ class FacebookRequest
448
  *
449
  * @return RequestBodyUrlEncoded
450
  */
451
- public function getUrlEncodedBody()
452
- {
453
  $params = $this->getPostParams();
454
 
455
  return new RequestBodyUrlEncoded($params);
@@ -460,13 +441,12 @@ class FacebookRequest
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
 
@@ -478,8 +458,7 @@ class FacebookRequest
478
  *
479
  * @return array
480
  */
481
- public function getPostParams()
482
- {
483
  if ($this->getMethod() === 'POST') {
484
  return $this->getParams();
485
  }
@@ -492,8 +471,7 @@ class FacebookRequest
492
  *
493
  * @return string
494
  */
495
- public function getGraphVersion()
496
- {
497
  return $this->graphVersion;
498
  }
499
 
@@ -502,18 +480,17 @@ class FacebookRequest
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;
@@ -524,10 +501,9 @@ class FacebookRequest
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
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook;
26
 
27
  use Facebook\Authentication\AccessToken;
37
  *
38
  * @package Facebook
39
  */
40
+ class FacebookRequest {
41
+
42
  /**
43
  * @var FacebookApp The Facebook app entity.
44
  */
95
  * @param string|null $eTag
96
  * @param string|null $graphVersion
97
  */
98
+ public function __construct(FacebookApp $app = null, $accessToken = null, $method = null, $endpoint = null, array $params = [], $eTag = null, $graphVersion = null) {
 
99
  $this->setApp($app);
100
  $this->setAccessToken($accessToken);
101
  $this->setMethod($method);
112
  *
113
  * @return FacebookRequest
114
  */
115
+ public function setAccessToken($accessToken) {
 
116
  $this->accessToken = $accessToken;
117
  if ($accessToken instanceof AccessToken) {
118
  $this->accessToken = $accessToken->getValue();
130
  *
131
  * @throws FacebookSDKException
132
  */
133
+ public function setAccessTokenFromParams($accessToken) {
 
134
  $existingAccessToken = $this->getAccessToken();
135
  if (!$existingAccessToken) {
136
  $this->setAccessToken($accessToken);
146
  *
147
  * @return string|null
148
  */
149
+ public function getAccessToken() {
 
150
  return $this->accessToken;
151
  }
152
 
155
  *
156
  * @return AccessToken|null
157
  */
158
+ public function getAccessTokenEntity() {
 
159
  return $this->accessToken ? new AccessToken($this->accessToken) : null;
160
  }
161
 
164
  *
165
  * @param FacebookApp|null $app
166
  */
167
+ public function setApp(FacebookApp $app = null) {
 
168
  $this->app = $app;
169
  }
170
 
173
  *
174
  * @return FacebookApp
175
  */
176
+ public function getApp() {
 
177
  return $this->app;
178
  }
179
 
182
  *
183
  * @return string|null
184
  */
185
+ public function getAppSecretProof() {
 
186
  if (!$accessTokenEntity = $this->getAccessTokenEntity()) {
187
  return null;
188
  }
195
  *
196
  * @throws FacebookSDKException
197
  */
198
+ public function validateAccessToken() {
 
199
  $accessToken = $this->getAccessToken();
200
  if (!$accessToken) {
201
  throw new FacebookSDKException('You must provide an access token.');
207
  *
208
  * @param string
209
  */
210
+ public function setMethod($method) {
 
211
  $this->method = strtoupper($method);
212
  }
213
 
216
  *
217
  * @return string
218
  */
219
+ public function getMethod() {
 
220
  return $this->method;
221
  }
222
 
225
  *
226
  * @throws FacebookSDKException
227
  */
228
+ public function validateMethod() {
 
229
  if (!$this->method) {
230
  throw new FacebookSDKException('HTTP method not specified.');
231
  }
232
 
233
+ if (!in_array($this->method, [
234
+ 'GET',
235
+ 'POST',
236
+ 'DELETE'
237
+ ])) {
238
  throw new FacebookSDKException('Invalid HTTP method specified.');
239
  }
240
  }
248
  *
249
  * @throws FacebookSDKException
250
  */
251
+ public function setEndpoint($endpoint) {
 
252
  // Harvest the access token from the endpoint to keep things in sync
253
  $params = FacebookUrlManipulator::getParamsAsArray($endpoint);
254
  if (isset($params['access_token'])) {
256
  }
257
 
258
  // Clean the token & app secret proof from the endpoint.
259
+ $filterParams = [
260
+ 'access_token',
261
+ 'appsecret_proof'
262
+ ];
263
  $this->endpoint = FacebookUrlManipulator::removeParamsFromUrl($endpoint, $filterParams);
264
 
265
  return $this;
270
  *
271
  * @return string
272
  */
273
+ public function getEndpoint() {
 
274
  // For batch requests, this will be empty
275
  return $this->endpoint;
276
  }
280
  *
281
  * @return array
282
  */
283
+ public function getHeaders() {
 
284
  $headers = static::getDefaultHeaders();
285
 
286
  if ($this->eTag) {
295
  *
296
  * @param array $headers
297
  */
298
+ public function setHeaders(array $headers) {
 
299
  $this->headers = array_merge($this->headers, $headers);
300
  }
301
 
304
  *
305
  * @param string $eTag
306
  */
307
+ public function setETag($eTag) {
 
308
  $this->eTag = $eTag;
309
  }
310
 
317
  *
318
  * @throws FacebookSDKException
319
  */
320
+ public function setParams(array $params = []) {
 
321
  if (isset($params['access_token'])) {
322
  $this->setAccessTokenFromParams($params['access_token']);
323
  }
340
  *
341
  * @return FacebookRequest
342
  */
343
+ public function dangerouslySetParams(array $params = []) {
 
344
  $this->params = array_merge($this->params, $params);
345
 
346
  return $this;
353
  *
354
  * @return array
355
  */
356
+ public function sanitizeFileParams(array $params) {
 
357
  foreach ($params as $key => $value) {
358
  if ($value instanceof FacebookFile) {
359
  $this->addFile($key, $value);
370
  * @param string $key
371
  * @param FacebookFile $file
372
  */
373
+ public function addFile($key, FacebookFile $file) {
 
374
  $this->files[$key] = $file;
375
  }
376
 
377
  /**
378
  * Removes all the files from the upload queue.
379
  */
380
+ public function resetFiles() {
 
381
  $this->files = [];
382
  }
383
 
386
  *
387
  * @return array
388
  */
389
+ public function getFiles() {
 
390
  return $this->files;
391
  }
392
 
395
  *
396
  * @return boolean
397
  */
398
+ public function containsFileUploads() {
 
399
  return !empty($this->files);
400
  }
401
 
404
  *
405
  * @return boolean
406
  */
407
+ public function containsVideoUploads() {
 
408
  foreach ($this->files as $file) {
409
  if ($file instanceof FacebookVideo) {
410
  return true;
419
  *
420
  * @return RequestBodyMultipart
421
  */
422
+ public function getMultipartBody() {
 
423
  $params = $this->getPostParams();
424
 
425
  return new RequestBodyMultipart($params, $this->files);
430
  *
431
  * @return RequestBodyUrlEncoded
432
  */
433
+ public function getUrlEncodedBody() {
 
434
  $params = $this->getPostParams();
435
 
436
  return new RequestBodyUrlEncoded($params);
441
  *
442
  * @return array
443
  */
444
+ public function getParams() {
 
445
  $params = $this->params;
446
 
447
  $accessToken = $this->getAccessToken();
448
  if ($accessToken) {
449
+ $params['access_token'] = $accessToken;
450
  $params['appsecret_proof'] = $this->getAppSecretProof();
451
  }
452
 
458
  *
459
  * @return array
460
  */
461
+ public function getPostParams() {
 
462
  if ($this->getMethod() === 'POST') {
463
  return $this->getParams();
464
  }
471
  *
472
  * @return string
473
  */
474
+ public function getGraphVersion() {
 
475
  return $this->graphVersion;
476
  }
477
 
480
  *
481
  * @return string
482
  */
483
+ public function getUrl() {
 
484
  $this->validateMethod();
485
 
486
  $graphVersion = FacebookUrlManipulator::forceSlashPrefix($this->graphVersion);
487
+ $endpoint = FacebookUrlManipulator::forceSlashPrefix($this->getEndpoint());
488
 
489
  $url = $graphVersion . $endpoint;
490
 
491
  if ($this->getMethod() !== 'POST') {
492
  $params = $this->getParams();
493
+ $url = FacebookUrlManipulator::appendParamsToUrl($url, $params);
494
  }
495
 
496
  return $url;
501
  *
502
  * @return array
503
  */
504
+ public static function getDefaultHeaders() {
 
505
  return [
506
+ 'User-Agent' => 'fb-php-' . Facebook::VERSION,
507
  'Accept-Encoding' => '*',
508
  ];
509
  }
{Facebook → providers/facebook/compat/Facebook}/FacebookResponse.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook;
25
 
26
  use Facebook\GraphNodes\GraphNodeFactory;
@@ -32,8 +33,8 @@ use Facebook\Exceptions\FacebookSDKException;
32
  *
33
  * @package Facebook
34
  */
35
- class FacebookResponse
36
- {
37
  /**
38
  * @var int The HTTP status code response from Graph.
39
  */
@@ -72,12 +73,11 @@ class FacebookResponse
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
  }
@@ -87,8 +87,7 @@ class FacebookResponse
87
  *
88
  * @return FacebookRequest
89
  */
90
- public function getRequest()
91
- {
92
  return $this->request;
93
  }
94
 
@@ -97,8 +96,7 @@ class FacebookResponse
97
  *
98
  * @return FacebookApp
99
  */
100
- public function getApp()
101
- {
102
  return $this->request->getApp();
103
  }
104
 
@@ -107,8 +105,7 @@ class FacebookResponse
107
  *
108
  * @return string|null
109
  */
110
- public function getAccessToken()
111
- {
112
  return $this->request->getAccessToken();
113
  }
114
 
@@ -117,8 +114,7 @@ class FacebookResponse
117
  *
118
  * @return int
119
  */
120
- public function getHttpStatusCode()
121
- {
122
  return $this->httpStatusCode;
123
  }
124
 
@@ -127,8 +123,7 @@ class FacebookResponse
127
  *
128
  * @return array
129
  */
130
- public function getHeaders()
131
- {
132
  return $this->headers;
133
  }
134
 
@@ -137,8 +132,7 @@ class FacebookResponse
137
  *
138
  * @return string
139
  */
140
- public function getBody()
141
- {
142
  return $this->body;
143
  }
144
 
@@ -147,8 +141,7 @@ class FacebookResponse
147
  *
148
  * @return array
149
  */
150
- public function getDecodedBody()
151
- {
152
  return $this->decodedBody;
153
  }
154
 
@@ -157,8 +150,7 @@ class FacebookResponse
157
  *
158
  * @return string|null
159
  */
160
- public function getAppSecretProof()
161
- {
162
  return $this->request->getAppSecretProof();
163
  }
164
 
@@ -167,8 +159,7 @@ class FacebookResponse
167
  *
168
  * @return string|null
169
  */
170
- public function getETag()
171
- {
172
  return isset($this->headers['ETag']) ? $this->headers['ETag'] : null;
173
  }
174
 
@@ -177,8 +168,7 @@ class FacebookResponse
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
 
@@ -187,8 +177,7 @@ class FacebookResponse
187
  *
188
  * @return boolean
189
  */
190
- public function isError()
191
- {
192
  return isset($this->decodedBody['error']);
193
  }
194
 
@@ -197,16 +186,14 @@ class FacebookResponse
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
 
@@ -215,8 +202,7 @@ class FacebookResponse
215
  *
216
  * @return FacebookResponseException|null
217
  */
218
- public function getThrownException()
219
- {
220
  return $this->thrownException;
221
  }
222
 
@@ -231,8 +217,7 @@ class FacebookResponse
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) {
@@ -266,10 +251,9 @@ class FacebookResponse
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
 
@@ -282,8 +266,7 @@ class FacebookResponse
282
  *
283
  * @throws FacebookSDKException
284
  */
285
- public function getGraphNode($subclassName = null)
286
- {
287
  $factory = new GraphNodeFactory($this);
288
 
289
  return $factory->makeGraphNode($subclassName);
@@ -296,8 +279,7 @@ class FacebookResponse
296
  *
297
  * @throws FacebookSDKException
298
  */
299
- public function getGraphAlbum()
300
- {
301
  $factory = new GraphNodeFactory($this);
302
 
303
  return $factory->makeGraphAlbum();
@@ -310,8 +292,7 @@ class FacebookResponse
310
  *
311
  * @throws FacebookSDKException
312
  */
313
- public function getGraphPage()
314
- {
315
  $factory = new GraphNodeFactory($this);
316
 
317
  return $factory->makeGraphPage();
@@ -324,8 +305,7 @@ class FacebookResponse
324
  *
325
  * @throws FacebookSDKException
326
  */
327
- public function getGraphSessionInfo()
328
- {
329
  $factory = new GraphNodeFactory($this);
330
 
331
  return $factory->makeGraphSessionInfo();
@@ -338,8 +318,7 @@ class FacebookResponse
338
  *
339
  * @throws FacebookSDKException
340
  */
341
- public function getGraphUser()
342
- {
343
  $factory = new GraphNodeFactory($this);
344
 
345
  return $factory->makeGraphUser();
@@ -352,8 +331,7 @@ class FacebookResponse
352
  *
353
  * @throws FacebookSDKException
354
  */
355
- public function getGraphEvent()
356
- {
357
  $factory = new GraphNodeFactory($this);
358
 
359
  return $factory->makeGraphEvent();
@@ -366,8 +344,7 @@ class FacebookResponse
366
  *
367
  * @throws FacebookSDKException
368
  */
369
- public function getGraphGroup()
370
- {
371
  $factory = new GraphNodeFactory($this);
372
 
373
  return $factory->makeGraphGroup();
@@ -384,10 +361,9 @@ class FacebookResponse
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
 
@@ -401,8 +377,7 @@ class FacebookResponse
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);
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook;
26
 
27
  use Facebook\GraphNodes\GraphNodeFactory;
33
  *
34
  * @package Facebook
35
  */
36
+ class FacebookResponse {
37
+
38
  /**
39
  * @var int The HTTP status code response from Graph.
40
  */
73
  * @param int|null $httpStatusCode
74
  * @param array|null $headers
75
  */
76
+ public function __construct(FacebookRequest $request, $body = null, $httpStatusCode = null, array $headers = []) {
77
+ $this->request = $request;
78
+ $this->body = $body;
 
79
  $this->httpStatusCode = $httpStatusCode;
80
+ $this->headers = $headers;
81
 
82
  $this->decodeBody();
83
  }
87
  *
88
  * @return FacebookRequest
89
  */
90
+ public function getRequest() {
 
91
  return $this->request;
92
  }
93
 
96
  *
97
  * @return FacebookApp
98
  */
99
+ public function getApp() {
 
100
  return $this->request->getApp();
101
  }
102
 
105
  *
106
  * @return string|null
107
  */
108
+ public function getAccessToken() {
 
109
  return $this->request->getAccessToken();
110
  }
111
 
114
  *
115
  * @return int
116
  */
117
+ public function getHttpStatusCode() {
 
118
  return $this->httpStatusCode;
119
  }
120
 
123
  *
124
  * @return array
125
  */
126
+ public function getHeaders() {
 
127
  return $this->headers;
128
  }
129
 
132
  *
133
  * @return string
134
  */
135
+ public function getBody() {
 
136
  return $this->body;
137
  }
138
 
141
  *
142
  * @return array
143
  */
144
+ public function getDecodedBody() {
 
145
  return $this->decodedBody;
146
  }
147
 
150
  *
151
  * @return string|null
152
  */
153
+ public function getAppSecretProof() {
 
154
  return $this->request->getAppSecretProof();
155
  }
156
 
159
  *
160
  * @return string|null
161
  */
162
+ public function getETag() {
 
163
  return isset($this->headers['ETag']) ? $this->headers['ETag'] : null;
164
  }
165
 
168
  *
169
  * @return string|null
170
  */
171
+ public function getGraphVersion() {
 
172
  return isset($this->headers['Facebook-API-Version']) ? $this->headers['Facebook-API-Version'] : null;
173
  }
174
 
177
  *
178
  * @return boolean
179
  */
180
+ public function isError() {
 
181
  return isset($this->decodedBody['error']);
182
  }
183
 
186
  *
187
  * @throws FacebookSDKException
188
  */
189
+ public function throwException() {
 
190
  throw $this->thrownException;
191
  }
192
 
193
  /**
194
  * Instantiates an exception to be thrown later.
195
  */
196
+ public function makeException() {
 
197
  $this->thrownException = FacebookResponseException::create($this);
198
  }
199
 
202
  *
203
  * @return FacebookResponseException|null
204
  */
205
+ public function getThrownException() {
 
206
  return $this->thrownException;
207
  }
208
 
217
  * a short-lived access token for a long-lived access token
218
  * - And sometimes nothing :/ but that'd be a bug.
219
  */
220
+ public function decodeBody() {
 
221
  $this->decodedBody = json_decode($this->body, true);
222
 
223
  if ($this->decodedBody === null) {
251
  * @throws FacebookSDKException
252
  *
253
  * @deprecated 5.0.0 getGraphObject() has been renamed to getGraphNode()
254
+ * @todo v6: Remove this method
255
  */
256
+ public function getGraphObject($subclassName = null) {
 
257
  return $this->getGraphNode($subclassName);
258
  }
259
 
266
  *
267
  * @throws FacebookSDKException
268
  */
269
+ public function getGraphNode($subclassName = null) {
 
270
  $factory = new GraphNodeFactory($this);
271
 
272
  return $factory->makeGraphNode($subclassName);
279
  *
280
  * @throws FacebookSDKException
281
  */
282
+ public function getGraphAlbum() {
 
283
  $factory = new GraphNodeFactory($this);
284
 
285
  return $factory->makeGraphAlbum();
292
  *
293
  * @throws FacebookSDKException
294
  */
295
+ public function getGraphPage() {
 
296
  $factory = new GraphNodeFactory($this);
297
 
298
  return $factory->makeGraphPage();
305
  *
306
  * @throws FacebookSDKException
307
  */
308
+ public function getGraphSessionInfo() {
 
309
  $factory = new GraphNodeFactory($this);
310
 
311
  return $factory->makeGraphSessionInfo();
318
  *
319
  * @throws FacebookSDKException
320
  */
321
+ public function getGraphUser() {
 
322
  $factory = new GraphNodeFactory($this);
323
 
324
  return $factory->makeGraphUser();
331
  *
332
  * @throws FacebookSDKException
333
  */
334
+ public function getGraphEvent() {
 
335
  $factory = new GraphNodeFactory($this);
336
 
337
  return $factory->makeGraphEvent();
344
  *
345
  * @throws FacebookSDKException
346
  */
347
+ public function getGraphGroup() {
 
348
  $factory = new GraphNodeFactory($this);
349
 
350
  return $factory->makeGraphGroup();
361
  * @throws FacebookSDKException
362
  *
363
  * @deprecated 5.0.0 getGraphList() has been renamed to getGraphEdge()
364
+ * @todo v6: Remove this method
365
  */
366
+ public function getGraphList($subclassName = null, $auto_prefix = true) {
 
367
  return $this->getGraphEdge($subclassName, $auto_prefix);
368
  }
369
 
377
  *
378
  * @throws FacebookSDKException
379
  */
380
+ public function getGraphEdge($subclassName = null, $auto_prefix = true) {
 
381
  $factory = new GraphNodeFactory($this);
382
 
383
  return $factory->makeGraphEdge($subclassName, $auto_prefix);
{Facebook → providers/facebook/compat/Facebook}/FileUpload/FacebookFile.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\FileUpload;
25
 
26
  use Facebook\Exceptions\FacebookSDKException;
@@ -30,8 +31,8 @@ use Facebook\Exceptions\FacebookSDKException;
30
  *
31
  * @package Facebook
32
  */
33
- class FacebookFile
34
- {
35
  /**
36
  * @var string The path to the file on the system.
37
  */
@@ -56,24 +57,22 @@ class FacebookFile
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
 
@@ -82,8 +81,7 @@ class FacebookFile
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
  }
@@ -98,8 +96,7 @@ class FacebookFile
98
  /**
99
  * Stops the file stream.
100
  */
101
- public function close()
102
- {
103
  if (is_resource($this->stream)) {
104
  fclose($this->stream);
105
  }
@@ -110,8 +107,7 @@ class FacebookFile
110
  *
111
  * @return string
112
  */
113
- public function getContents()
114
- {
115
  return stream_get_contents($this->stream, $this->maxLength, $this->offset);
116
  }
117
 
@@ -120,8 +116,7 @@ class FacebookFile
120
  *
121
  * @return string
122
  */
123
- public function getFileName()
124
- {
125
  return basename($this->path);
126
  }
127
 
@@ -130,8 +125,7 @@ class FacebookFile
130
  *
131
  * @return string
132
  */
133
- public function getFilePath()
134
- {
135
  return $this->path;
136
  }
137
 
@@ -140,8 +134,7 @@ class FacebookFile
140
  *
141
  * @return int
142
  */
143
- public function getSize()
144
- {
145
  return filesize($this->path);
146
  }
147
 
@@ -150,9 +143,9 @@ class FacebookFile
150
  *
151
  * @return string
152
  */
153
- public function getMimetype()
154
- {
155
- return Mimetypes::getInstance()->fromFilename($this->path) ?: 'text/plain';
156
  }
157
 
158
  /**
@@ -162,8 +155,7 @@ class FacebookFile
162
  *
163
  * @return boolean
164
  */
165
- protected function isRemoteFile($pathToFile)
166
- {
167
  return preg_match('/^(https?|ftp):\/\/.*/', $pathToFile) === 1;
168
  }
169
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\FileUpload;
26
 
27
  use Facebook\Exceptions\FacebookSDKException;
31
  *
32
  * @package Facebook
33
  */
34
+ class FacebookFile {
35
+
36
  /**
37
  * @var string The path to the file on the system.
38
  */
57
  * Creates a new FacebookFile entity.
58
  *
59
  * @param string $filePath
60
+ * @param int $maxLength
61
+ * @param int $offset
62
  *
63
  * @throws FacebookSDKException
64
  */
65
+ public function __construct($filePath, $maxLength = -1, $offset = -1) {
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
  $this->close();
77
  }
78
 
81
  *
82
  * @throws FacebookSDKException
83
  */
84
+ public function open() {
 
85
  if (!$this->isRemoteFile($this->path) && !is_readable($this->path)) {
86
  throw new FacebookSDKException('Failed to create FacebookFile entity. Unable to read resource: ' . $this->path . '.');
87
  }
96
  /**
97
  * Stops the file stream.
98
  */
99
+ public function close() {
 
100
  if (is_resource($this->stream)) {
101
  fclose($this->stream);
102
  }
107
  *
108
  * @return string
109
  */
110
+ public function getContents() {
 
111
  return stream_get_contents($this->stream, $this->maxLength, $this->offset);
112
  }
113
 
116
  *
117
  * @return string
118
  */
119
+ public function getFileName() {
 
120
  return basename($this->path);
121
  }
122
 
125
  *
126
  * @return string
127
  */
128
+ public function getFilePath() {
 
129
  return $this->path;
130
  }
131
 
134
  *
135
  * @return int
136
  */
137
+ public function getSize() {
 
138
  return filesize($this->path);
139
  }
140
 
143
  *
144
  * @return string
145
  */
146
+ public function getMimetype() {
147
+ return Mimetypes::getInstance()
148
+ ->fromFilename($this->path) ?: 'text/plain';
149
  }
150
 
151
  /**
155
  *
156
  * @return boolean
157
  */
158
+ protected function isRemoteFile($pathToFile) {
 
159
  return preg_match('/^(https?|ftp):\/\/.*/', $pathToFile) === 1;
160
  }
161
  }
{Facebook → providers/facebook/compat/Facebook}/FileUpload/FacebookResumableUploader.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\FileUpload;
25
 
26
  use Facebook\Authentication\AccessToken;
@@ -36,8 +37,8 @@ use Facebook\FacebookRequest;
36
  *
37
  * @package Facebook
38
  */
39
- class FacebookResumableUploader
40
- {
41
  /**
42
  * @var FacebookApp
43
  */
@@ -64,29 +65,27 @@ class FacebookResumableUploader
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
 
@@ -96,21 +95,20 @@ class FacebookResumableUploader
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 {
@@ -133,16 +131,15 @@ class FacebookResumableUploader
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);
@@ -154,14 +151,14 @@ class FacebookResumableUploader
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
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\FileUpload;
26
 
27
  use Facebook\Authentication\AccessToken;
37
  *
38
  * @package Facebook
39
  */
40
+ class FacebookResumableUploader {
41
+
42
  /**
43
  * @var FacebookApp
44
  */
65
  * @param AccessToken|string|null $accessToken
66
  * @param string $graphVersion
67
  */
68
+ public function __construct(FacebookApp $app, FacebookClient $client, $accessToken, $graphVersion) {
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
+ $params = [
 
87
  'upload_phase' => 'start',
88
+ 'file_size' => $file->getSize(),
89
  ];
90
  $response = $this->sendUploadRequest($endpoint, $params);
91
 
95
  /**
96
  * Upload by chunks - transfer phase
97
  *
98
+ * @param string $endpoint
99
  * @param FacebookTransferChunk $chunk
100
+ * @param boolean $allowToThrow
101
  *
102
  * @return FacebookTransferChunk
103
  *
104
  * @throws FacebookResponseException
105
  */
106
+ public function transfer($endpoint, FacebookTransferChunk $chunk, $allowToThrow = false) {
 
107
  $params = [
108
+ 'upload_phase' => 'transfer',
109
  'upload_session_id' => $chunk->getUploadSessionId(),
110
+ 'start_offset' => $chunk->getStartOffset(),
111
+ 'video_file_chunk' => $chunk->getPartialFile(),
112
  ];
113
 
114
  try {
131
  *
132
  * @param string $endpoint
133
  * @param string $uploadSessionId
134
+ * @param array $metadata The metadata associated with the file.
135
  *
136
  * @return boolean
137
  *
138
  * @throws FacebookSDKException
139
  */
140
+ public function finish($endpoint, $uploadSessionId, $metadata = []) {
141
+ $params = array_merge($metadata, [
142
+ 'upload_phase' => 'finish',
 
143
  'upload_session_id' => $uploadSessionId,
144
  ]);
145
  $response = $this->sendUploadRequest($endpoint, $params);
151
  * Helper to make a FacebookRequest and send it.
152
  *
153
  * @param string $endpoint The endpoint to POST to.
154
+ * @param array $params The params to send with the request.
155
  *
156
  * @return array
157
  */
158
+ private function sendUploadRequest($endpoint, $params = []) {
 
159
  $request = new FacebookRequest($this->app, $this->accessToken, 'POST', $endpoint, $params, null, $this->graphVersion);
160
 
161
+ return $this->client->sendRequest($request)
162
+ ->getDecodedBody();
163
  }
164
  }
{Facebook → providers/facebook/compat/Facebook}/FileUpload/FacebookTransferChunk.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\FileUpload;
25
 
26
  /**
@@ -28,8 +29,8 @@ namespace Facebook\FileUpload;
28
  *
29
  * @package Facebook
30
  */
31
- class FacebookTransferChunk
32
- {
33
  /**
34
  * @var FacebookFile The file to chunk during upload.
35
  */
@@ -57,18 +58,17 @@ class FacebookTransferChunk
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
  /**
@@ -76,8 +76,7 @@ class FacebookTransferChunk
76
  *
77
  * @return FacebookFile
78
  */
79
- public function getFile()
80
- {
81
  return $this->file;
82
  }
83
 
@@ -86,8 +85,7 @@ class FacebookTransferChunk
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);
@@ -98,8 +96,7 @@ class FacebookTransferChunk
98
  *
99
  * @return int
100
  */
101
- public function getUploadSessionId()
102
- {
103
  return $this->uploadSessionId;
104
  }
105
 
@@ -108,16 +105,14 @@ class FacebookTransferChunk
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
 
@@ -126,8 +121,7 @@ class FacebookTransferChunk
126
  *
127
  * @return int
128
  */
129
- public function getVideoId()
130
- {
131
  return $this->videoId;
132
  }
133
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\FileUpload;
26
 
27
  /**
29
  *
30
  * @package Facebook
31
  */
32
+ class FacebookTransferChunk {
33
+
34
  /**
35
  * @var FacebookFile The file to chunk during upload.
36
  */
58
 
59
  /**
60
  * @param FacebookFile $file
61
+ * @param int $uploadSessionId
62
+ * @param int $videoId
63
+ * @param int $startOffset
64
+ * @param int $endOffset
65
  */
66
+ public function __construct(FacebookFile $file, $uploadSessionId, $videoId, $startOffset, $endOffset) {
67
+ $this->file = $file;
 
68
  $this->uploadSessionId = $uploadSessionId;
69
+ $this->videoId = $videoId;
70
+ $this->startOffset = $startOffset;
71
+ $this->endOffset = $endOffset;
72
  }
73
 
74
  /**
76
  *
77
  * @return FacebookFile
78
  */
79
+ public function getFile() {
 
80
  return $this->file;
81
  }
82
 
85
  *
86
  * @return FacebookFile
87
  */
88
+ public function getPartialFile() {
 
89
  $maxLength = $this->endOffset - $this->startOffset;
90
 
91
  return new FacebookFile($this->file->getFilePath(), $maxLength, $this->startOffset);
96
  *
97
  * @return int
98
  */
99
+ public function getUploadSessionId() {
 
100
  return $this->uploadSessionId;
101
  }
102
 
105
  *
106
  * @return bool
107
  */
108
+ public function isLastChunk() {
 
109
  return $this->startOffset === $this->endOffset;
110
  }
111
 
112
  /**
113
  * @return int
114
  */
115
+ public function getStartOffset() {
 
116
  return $this->startOffset;
117
  }
118
 
121
  *
122
  * @return int
123
  */
124
+ public function getVideoId() {
 
125
  return $this->videoId;
126
  }
127
  }
{Facebook → providers/facebook/compat/Facebook}/FileUpload/FacebookVideo.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\FileUpload;
25
 
26
  /**
@@ -28,6 +29,6 @@ namespace Facebook\FileUpload;
28
  *
29
  * @package Facebook
30
  */
31
- class FacebookVideo extends FacebookFile
32
- {
33
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\FileUpload;
26
 
27
  /**
29
  *
30
  * @package Facebook
31
  */
32
+ class FacebookVideo extends FacebookFile {
33
+
34
  }
providers/facebook/compat/Facebook/FileUpload/Mimetypes.php ADDED
@@ -0,0 +1,986 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2017 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
+ namespace Facebook\FileUpload;
26
+
27
+ /**
28
+ * Provides mappings of file extensions to mimetypes
29
+ *
30
+ * Taken from Guzzle
31
+ *
32
+ * @see https://github.com/guzzle/guzzle/blob/master/src/Mimetypes.php
33
+ *
34
+ * @link http://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x/conf/mime.types
35
+ */
36
+ class Mimetypes {
37
+
38
+ /** @var self */
39
+ protected static $instance;
40
+
41
+ /** @var array Mapping of extension to mimetype */
42
+ protected $mimetypes = [
43
+ '3dml' => 'text/vnd.in3d.3dml',
44
+ '3g2' => 'video/3gpp2',
45
+ '3gp' => 'video/3gpp',
46
+ '7z' => 'application/x-7z-compressed',
47
+ 'aab' => 'application/x-authorware-bin',
48
+ 'aac' => 'audio/x-aac',
49
+ 'aam' => 'application/x-authorware-map',
50
+ 'aas' => 'application/x-authorware-seg',
51
+ 'abw' => 'application/x-abiword',
52
+ 'ac' => 'application/pkix-attr-cert',
53
+ 'acc' => 'application/vnd.americandynamics.acc',
54
+ 'ace' => 'application/x-ace-compressed',
55
+ 'acu' => 'application/vnd.acucobol',
56
+ 'acutc' => 'application/vnd.acucorp',
57
+ 'adp' => 'audio/adpcm',
58
+ 'aep' => 'application/vnd.audiograph',
59
+ 'afm' => 'application/x-font-type1',
60
+ 'afp' => 'application/vnd.ibm.modcap',
61
+ 'ahead' => 'application/vnd.ahead.space',
62
+ 'ai' => 'application/postscript',
63
+ 'aif' => 'audio/x-aiff',
64
+ 'aifc' => 'audio/x-aiff',
65
+ 'aiff' => 'audio/x-aiff',
66
+ 'air' => 'application/vnd.adobe.air-application-installer-package+zip',
67
+ 'ait' => 'application/vnd.dvb.ait',
68
+ 'ami' => 'application/vnd.amiga.ami',
69
+ 'apk' => 'application/vnd.android.package-archive',
70
+ 'application' => 'application/x-ms-application',
71
+ 'apr' => 'application/vnd.lotus-approach',
72
+ 'asa' => 'text/plain',
73
+ 'asax' => 'application/octet-stream',
74
+ 'asc' => 'application/pgp-signature',
75
+ 'ascx' => 'text/plain',
76
+ 'asf' => 'video/x-ms-asf',
77
+ 'ashx' => 'text/plain',
78
+ 'asm' => 'text/x-asm',
79
+ 'asmx' => 'text/plain',
80
+ 'aso' => 'application/vnd.accpac.simply.aso',
81
+ 'asp' => 'text/plain',
82
+ 'aspx' => 'text/plain',
83
+ 'asx' => 'video/x-ms-asf',
84
+ 'atc' => 'application/vnd.acucorp',
85
+ 'atom' => 'application/atom+xml',
86
+ 'atomcat' => 'application/atomcat+xml',
87
+ 'atomsvc' => 'application/atomsvc+xml',
88
+ 'atx' => 'application/vnd.antix.game-component',
89
+ 'au' => 'audio/basic',
90
+ 'avi' => 'video/x-msvideo',
91
+ 'aw' => 'application/applixware',
92
+ 'axd' => 'text/plain',
93
+ 'azf' => 'application/vnd.airzip.filesecure.azf',
94
+ 'azs' => 'application/vnd.airzip.filesecure.azs',
95
+ 'azw' => 'application/vnd.amazon.ebook',
96
+ 'bat' => 'application/x-msdownload',
97
+ 'bcpio' => 'application/x-bcpio',
98
+ 'bdf' => 'application/x-font-bdf',
99
+ 'bdm' => 'application/vnd.syncml.dm+wbxml',
100
+ 'bed' => 'application/vnd.realvnc.bed',
101
+ 'bh2' => 'application/vnd.fujitsu.oasysprs',
102
+ 'bin' => 'application/octet-stream',
103
+ 'bmi' => 'application/vnd.bmi',
104
+ 'bmp' => 'image/bmp',
105
+ 'book' => 'application/vnd.framemaker',
106
+ 'box' => 'application/vnd.previewsystems.box',
107
+ 'boz' => 'application/x-bzip2',
108
+ 'bpk' => 'application/octet-stream',
109
+ 'btif' => 'image/prs.btif',
110
+ 'bz' => 'application/x-bzip',
111
+ 'bz2' => 'application/x-bzip2',
112
+ 'c' => 'text/x-c',
113
+ 'c11amc' => 'application/vnd.cluetrust.cartomobile-config',
114
+ 'c11amz' => 'application/vnd.cluetrust.cartomobile-config-pkg',
115
+ 'c4d' => 'application/vnd.clonk.c4group',
116
+ 'c4f' => 'application/vnd.clonk.c4group',
117
+ 'c4g' => 'application/vnd.clonk.c4group',
118
+ 'c4p' => 'application/vnd.clonk.c4group',
119
+ 'c4u' => 'application/vnd.clonk.c4group',
120
+ 'cab' => 'application/vnd.ms-cab-compressed',
121
+ 'car' => 'application/vnd.curl.car',
122
+ 'cat' => 'application/vnd.ms-pki.seccat',
123
+ 'cc' => 'text/x-c',
124
+ 'cct' => 'application/x-director',
125
+ 'ccxml' => 'application/ccxml+xml',
126
+ 'cdbcmsg' => 'application/vnd.contact.cmsg',
127
+ 'cdf' => 'application/x-netcdf',
128
+ 'cdkey' => 'application/vnd.mediastation.cdkey',
129
+ 'cdmia' => 'application/cdmi-capability',
130
+ 'cdmic' => 'application/cdmi-container',
131
+ 'cdmid' => 'application/cdmi-domain',
132
+ 'cdmio' => 'application/cdmi-object',
133
+ 'cdmiq' => 'application/cdmi-queue',
134
+ 'cdx' => 'chemical/x-cdx',
135
+ 'cdxml' => 'application/vnd.chemdraw+xml',
136
+ 'cdy' => 'application/vnd.cinderella',
137
+ 'cer' => 'application/pkix-cert',
138
+ 'cfc' => 'application/x-coldfusion',
139
+ 'cfm' => 'application/x-coldfusion',
140
+ 'cgm' => 'image/cgm',
141
+ 'chat' => 'application/x-chat',
142
+ 'chm' => 'application/vnd.ms-htmlhelp',
143
+ 'chrt' => 'application/vnd.kde.kchart',
144
+ 'cif' => 'chemical/x-cif',
145
+ 'cii' => 'application/vnd.anser-web-certificate-issue-initiation',
146
+ 'cil' => 'application/vnd.ms-artgalry',
147
+ 'cla' => 'application/vnd.claymore',
148
+ 'class' => 'application/java-vm',
149
+ 'clkk' => 'application/vnd.crick.clicker.keyboard',
150
+ 'clkp' => 'application/vnd.crick.clicker.palette',
151
+ 'clkt' => 'application/vnd.crick.clicker.template',
152
+ 'clkw' => 'application/vnd.crick.clicker.wordbank',
153
+ 'clkx' => 'application/vnd.crick.clicker',
154
+ 'clp' => 'application/x-msclip',
155
+ 'cmc' => 'application/vnd.cosmocaller',
156
+ 'cmdf' => 'chemical/x-cmdf',
157
+ 'cml' => 'chemical/x-cml',
158
+ 'cmp' => 'application/vnd.yellowriver-custom-menu',
159
+ 'cmx' => 'image/x-cmx',
160
+ 'cod' => 'application/vnd.rim.cod',
161
+ 'com' => 'application/x-msdownload',
162
+ 'conf' => 'text/plain',
163
+ 'cpio' => 'application/x-cpio',
164
+ 'cpp' => 'text/x-c',
165
+ 'cpt' => 'application/mac-compactpro',
166
+ 'crd' => 'application/x-mscardfile',
167
+ 'crl' => 'application/pkix-crl',
168
+ 'crt' => 'application/x-x509-ca-cert',
169
+ 'cryptonote' => 'application/vnd.rig.cryptonote',
170
+ 'cs' => 'text/plain',
171
+ 'csh' => 'application/x-csh',
172
+ 'csml' => 'chemical/x-csml',
173
+ 'csp' => 'application/vnd.commonspace',
174
+ 'css' => 'text/css',
175
+ 'cst' => 'application/x-director',
176
+ 'csv' => 'text/csv',
177
+ 'cu' => 'application/cu-seeme',
178
+ 'curl' => 'text/vnd.curl',
179
+ 'cww' => 'application/prs.cww',
180
+ 'cxt' => 'application/x-director',
181
+ 'cxx' => 'text/x-c',
182
+ 'dae' => 'model/vnd.collada+xml',
183
+ 'daf' => 'application/vnd.mobius.daf',
184
+ 'dataless' => 'application/vnd.fdsn.seed',
185
+ 'davmount' => 'application/davmount+xml',
186
+ 'dcr' => 'application/x-director',
187
+ 'dcurl' => 'text/vnd.curl.dcurl',
188
+ 'dd2' => 'application/vnd.oma.dd2+xml',
189
+ 'ddd' => 'application/vnd.fujixerox.ddd',
190
+ 'deb' => 'application/x-debian-package',
191
+ 'def' => 'text/plain',
192
+ 'deploy' => 'application/octet-stream',
193
+ 'der' => 'application/x-x509-ca-cert',
194
+ 'dfac' => 'application/vnd.dreamfactory',
195
+ 'dic' => 'text/x-c',
196
+ 'dir' => 'application/x-director',
197
+ 'dis' => 'application/vnd.mobius.dis',
198
+ 'dist' => 'application/octet-stream',
199
+ 'distz' => 'application/octet-stream',
200
+ 'djv' => 'image/vnd.djvu',
201
+ 'djvu' => 'image/vnd.djvu',
202
+ 'dll' => 'application/x-msdownload',
203
+ 'dmg' => 'application/octet-stream',
204
+ 'dms' => 'application/octet-stream',
205
+ 'dna' => 'application/vnd.dna',
206
+ 'doc' => 'application/msword',
207
+ 'docm' => 'application/vnd.ms-word.document.macroenabled.12',
208
+ 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
209
+ 'dot' => 'application/msword',
210
+ 'dotm' => 'application/vnd.ms-word.template.macroenabled.12',
211
+ 'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
212
+ 'dp' => 'application/vnd.osgi.dp',
213
+ 'dpg' => 'application/vnd.dpgraph',
214
+ 'dra' => 'audio/vnd.dra',
215
+ 'dsc' => 'text/prs.lines.tag',
216
+ 'dssc' => 'application/dssc+der',
217
+ 'dtb' => 'application/x-dtbook+xml',
218
+ 'dtd' => 'application/xml-dtd',
219
+ 'dts' => 'audio/vnd.dts',
220
+ 'dtshd' => 'audio/vnd.dts.hd',
221
+ 'dump' => 'application/octet-stream',
222
+ 'dvi' => 'application/x-dvi',
223
+ 'dwf' => 'model/vnd.dwf',
224
+ 'dwg' => 'image/vnd.dwg',
225
+ 'dxf' => 'image/vnd.dxf',
226
+ 'dxp' => 'application/vnd.spotfire.dxp',
227
+ 'dxr' => 'application/x-director',
228
+ 'ecelp4800' => 'audio/vnd.nuera.ecelp4800',
229
+ 'ecelp7470' => 'audio/vnd.nuera.ecelp7470',
230
+ 'ecelp9600' => 'audio/vnd.nuera.ecelp9600',
231
+ 'ecma' => 'application/ecmascript',
232
+ 'edm' => 'application/vnd.novadigm.edm',
233
+ 'edx' => 'application/vnd.novadigm.edx',
234
+ 'efif' => 'application/vnd.picsel',
235
+ 'ei6' => 'application/vnd.pg.osasli',
236
+ 'elc' => 'application/octet-stream',
237
+ 'eml' => 'message/rfc822',
238
+ 'emma' => 'application/emma+xml',
239
+ 'eol' => 'audio/vnd.digital-winds',
240
+ 'eot' => 'application/vnd.ms-fontobject',
241
+ 'eps' => 'application/postscript',
242
+ 'epub' => 'application/epub+zip',
243
+ 'es3' => 'application/vnd.eszigno3+xml',
244
+ 'esf' => 'application/vnd.epson.esf',
245
+ 'et3' => 'application/vnd.eszigno3+xml',
246
+ 'etx' => 'text/x-setext',
247
+ 'exe' => 'application/x-msdownload',
248
+ 'exi' => 'application/exi',
249
+ 'ext' => 'application/vnd.novadigm.ext',
250
+ 'ez' => 'application/andrew-inset',
251
+ 'ez2' => 'application/vnd.ezpix-album',
252
+ 'ez3' => 'application/vnd.ezpix-package',
253
+ 'f' => 'text/x-fortran',
254
+ 'f4v' => 'video/x-f4v',
255
+ 'f77' => 'text/x-fortran',
256
+ 'f90' => 'text/x-fortran',
257
+ 'fbs' => 'image/vnd.fastbidsheet',
258
+ 'fcs' => 'application/vnd.isac.fcs',
259
+ 'fdf' => 'application/vnd.fdf',
260
+ 'fe_launch' => 'application/vnd.denovo.fcselayout-link',
261
+ 'fg5' => 'application/vnd.fujitsu.oasysgp',
262
+ 'fgd' => 'application/x-director',
263
+ 'fh' => 'image/x-freehand',
264
+ 'fh4' => 'image/x-freehand',
265
+ 'fh5' => 'image/x-freehand',
266
+ 'fh7' => 'image/x-freehand',
267
+ 'fhc' => 'image/x-freehand',
268
+ 'fig' => 'application/x-xfig',
269
+ 'fli' => 'video/x-fli',
270
+ 'flo' => 'application/vnd.micrografx.flo',
271
+ 'flv' => 'video/x-flv',
272
+ 'flw' => 'application/vnd.kde.kivio',
273
+ 'flx' => 'text/vnd.fmi.flexstor',
274
+ 'fly' => 'text/vnd.fly',
275
+ 'fm' => 'application/vnd.framemaker',
276
+ 'fnc' => 'application/vnd.frogans.fnc',
277
+ 'for' => 'text/x-fortran',
278
+ 'fpx' => 'image/vnd.fpx',
279
+ 'frame' => 'application/vnd.framemaker',
280
+ 'fsc' => 'application/vnd.fsc.weblaunch',
281
+ 'fst' => 'image/vnd.fst',
282
+ 'ftc' => 'application/vnd.fluxtime.clip',
283
+ 'fti' => 'application/vnd.anser-web-funds-transfer-initiation',
284
+ 'fvt' => 'video/vnd.fvt',
285
+ 'fxp' => 'application/vnd.adobe.fxp',
286
+ 'fxpl' => 'application/vnd.adobe.fxp',
287
+ 'fzs' => 'application/vnd.fuzzysheet',
288
+ 'g2w' => 'application/vnd.geoplan',
289
+ 'g3' => 'image/g3fax',
290
+ 'g3w' => 'application/vnd.geospace',
291
+ 'gac' => 'application/vnd.groove-account',
292
+ 'gdl' => 'model/vnd.gdl',
293
+ 'geo' => 'application/vnd.dynageo',
294
+ 'gex' => 'application/vnd.geometry-explorer',
295
+ 'ggb' => 'application/vnd.geogebra.file',
296
+ 'ggt' => 'application/vnd.geogebra.tool',
297
+ 'ghf' => 'application/vnd.groove-help',
298
+ 'gif' => 'image/gif',
299
+ 'gim' => 'application/vnd.groove-identity-message',
300
+ 'gmx' => 'application/vnd.gmx',
301
+ 'gnumeric' => 'application/x-gnumeric',
302
+ 'gph' => 'application/vnd.flographit',
303
+ 'gqf' => 'application/vnd.grafeq',
304
+ 'gqs' => 'application/vnd.grafeq',
305
+ 'gram' => 'application/srgs',
306
+ 'gre' => 'application/vnd.geometry-explorer',
307
+ 'grv' => 'application/vnd.groove-injector',
308
+ 'grxml' => 'application/srgs+xml',
309
+ 'gsf' => 'application/x-font-ghostscript',
310
+ 'gtar' => 'application/x-gtar',
311
+ 'gtm' => 'application/vnd.groove-tool-message',
312
+ 'gtw' => 'model/vnd.gtw',
313
+ 'gv' => 'text/vnd.graphviz',
314
+ 'gxt' => 'application/vnd.geonext',
315
+ 'h' => 'text/x-c',
316
+ 'h261' => 'video/h261',
317
+ 'h263' => 'video/h263',
318
+ 'h264' => 'video/h264',
319
+ 'hal' => 'application/vnd.hal+xml',
320
+ 'hbci' => 'application/vnd.hbci',
321
+ 'hdf' => 'application/x-hdf',
322
+ 'hh' => 'text/x-c',
323
+ 'hlp' => 'application/winhlp',
324
+ 'hpgl' => 'application/vnd.hp-hpgl',
325
+ 'hpid' => 'application/vnd.hp-hpid',
326
+ 'hps' => 'application/vnd.hp-hps',
327
+ 'hqx' => 'application/mac-binhex40',
328
+ 'hta' => 'application/octet-stream',
329
+ 'htc' => 'text/html',
330
+ 'htke' => 'application/vnd.kenameaapp',
331
+ 'htm' => 'text/html',
332
+ 'html' => 'text/html',
333
+ 'hvd' => 'application/vnd.yamaha.hv-dic',
334
+ 'hvp' => 'application/vnd.yamaha.hv-voice',
335
+ 'hvs' => 'application/vnd.yamaha.hv-script',
336
+ 'i2g' => 'application/vnd.intergeo',
337
+ 'icc' => 'application/vnd.iccprofile',
338
+ 'ice' => 'x-conference/x-cooltalk',
339
+ 'icm' => 'application/vnd.iccprofile',
340
+ 'ico' => 'image/x-icon',
341
+ 'ics' => 'text/calendar',
342
+ 'ief' => 'image/ief',
343
+ 'ifb' => 'text/calendar',
344
+ 'ifm' => 'application/vnd.shana.informed.formdata',
345
+ 'iges' => 'model/iges',
346
+ 'igl' => 'application/vnd.igloader',
347
+ 'igm' => 'application/vnd.insors.igm',
348
+ 'igs' => 'model/iges',
349
+ 'igx' => 'application/vnd.micrografx.igx',
350
+ 'iif' => 'application/vnd.shana.informed.interchange',
351
+ 'imp' => 'application/vnd.accpac.simply.imp',
352
+ 'ims' => 'application/vnd.ms-ims',
353
+ 'in' => 'text/plain',
354
+ 'ini' => 'text/plain',
355
+ 'ipfix' => 'application/ipfix',
356
+ 'ipk' => 'application/vnd.shana.informed.package',
357
+ 'irm' => 'application/vnd.ibm.rights-management',
358
+ 'irp' => 'application/vnd.irepository.package+xml',
359
+ 'iso' => 'application/octet-stream',
360
+ 'itp' => 'application/vnd.shana.informed.formtemplate',
361
+ 'ivp' => 'application/vnd.immervision-ivp',
362
+ 'ivu' => 'application/vnd.immervision-ivu',
363
+ 'jad' => 'text/vnd.sun.j2me.app-descriptor',
364
+ 'jam' => 'application/vnd.jam',
365
+ 'jar' => 'application/java-archive',
366
+ 'java' => 'text/x-java-source',
367
+ 'jisp' => 'application/vnd.jisp',
368
+ 'jlt' => 'application/vnd.hp-jlyt',
369
+ 'jnlp' => 'application/x-java-jnlp-file',
370
+ 'joda' => 'application/vnd.joost.joda-archive',
371
+ 'jpe' => 'image/jpeg',
372
+ 'jpeg' => 'image/jpeg',
373
+ 'jpg' => 'image/jpeg',
374
+ 'jpgm' => 'video/jpm',
375
+ 'jpgv' => 'video/jpeg',
376
+ 'jpm' => 'video/jpm',
377
+ 'js' => 'text/javascript',
378
+ 'json' => 'application/json',
379
+ 'kar' => 'audio/midi',
380
+ 'karbon' => 'application/vnd.kde.karbon',
381
+ 'kfo' => 'application/vnd.kde.kformula',
382
+ 'kia' => 'application/vnd.kidspiration',
383
+ 'kml' => 'application/vnd.google-earth.kml+xml',
384
+ 'kmz' => 'application/vnd.google-earth.kmz',
385
+ 'kne' => 'application/vnd.kinar',
386
+ 'knp' => 'application/vnd.kinar',
387
+ 'kon' => 'application/vnd.kde.kontour',
388
+ 'kpr' => 'application/vnd.kde.kpresenter',
389
+ 'kpt' => 'application/vnd.kde.kpresenter',
390
+ 'ksp' => 'application/vnd.kde.kspread',
391
+ 'ktr' => 'application/vnd.kahootz',
392
+ 'ktx' => 'image/ktx',
393
+ 'ktz' => 'application/vnd.kahootz',
394
+ 'kwd' => 'application/vnd.kde.kword',
395
+ 'kwt' => 'application/vnd.kde.kword',
396
+ 'lasxml' => 'application/vnd.las.las+xml',
397
+ 'latex' => 'application/x-latex',
398
+ 'lbd' => 'application/vnd.llamagraphics.life-balance.desktop',
399
+ 'lbe' => 'application/vnd.llamagraphics.life-balance.exchange+xml',
400
+ 'les' => 'application/vnd.hhe.lesson-player',
401
+ 'lha' => 'application/octet-stream',
402
+ 'link66' => 'application/vnd.route66.link66+xml',
403
+ 'list' => 'text/plain',
404
+ 'list3820' => 'application/vnd.ibm.modcap',
405
+ 'listafp' => 'application/vnd.ibm.modcap',
406
+ 'log' => 'text/plain',
407
+ 'lostxml' => 'application/lost+xml',
408
+ 'lrf' => 'application/octet-stream',
409
+ 'lrm' => 'application/vnd.ms-lrm',
410
+ 'ltf' => 'application/vnd.frogans.ltf',
411
+ 'lvp' => 'audio/vnd.lucent.voice',
412
+ 'lwp' => 'application/vnd.lotus-wordpro',
413
+ 'lzh' => 'application/octet-stream',
414
+ 'm13' => 'application/x-msmediaview',
415
+ 'm14' => 'application/x-msmediaview',
416
+ 'm1v' => 'video/mpeg',
417
+ 'm21' => 'application/mp21',
418
+ 'm2a' => 'audio/mpeg',
419
+ 'm2v' => 'video/mpeg',
420
+ 'm3a' => 'audio/mpeg',
421
+ 'm3u' => 'audio/x-mpegurl',
422
+ 'm3u8' => 'application/vnd.apple.mpegurl',
423
+ 'm4a' => 'audio/mp4',
424
+ 'm4u' => 'video/vnd.mpegurl',
425
+ 'm4v' => 'video/mp4',
426
+ 'ma' => 'application/mathematica',
427
+ 'mads' => 'application/mads+xml',
428
+ 'mag' => 'application/vnd.ecowin.chart',
429
+ 'maker' => 'application/vnd.framemaker',
430
+ 'man' => 'text/troff',
431
+ 'mathml' => 'application/mathml+xml',
432
+ 'mb' => 'application/mathematica',
433
+ 'mbk' => 'application/vnd.mobius.mbk',
434
+ 'mbox' => 'application/mbox',
435
+ 'mc1' => 'application/vnd.medcalcdata',
436
+ 'mcd' => 'application/vnd.mcd',
437
+ 'mcurl' => 'text/vnd.curl.mcurl',
438
+ 'mdb' => 'application/x-msaccess',
439
+ 'mdi' => 'image/vnd.ms-modi',
440
+ 'me' => 'text/troff',
441
+ 'mesh' => 'model/mesh',
442
+ 'meta4' => 'application/metalink4+xml',
443
+ 'mets' => 'application/mets+xml',
444
+ 'mfm' => 'application/vnd.mfmp',
445
+ 'mgp' => 'application/vnd.osgeo.mapguide.package',
446
+ 'mgz' => 'application/vnd.proteus.magazine',
447
+ 'mid' => 'audio/midi',
448
+ 'midi' => 'audio/midi',
449
+ 'mif' => 'application/vnd.mif',
450
+ 'mime' => 'message/rfc822',
451
+ 'mj2' => 'video/mj2',
452
+ 'mjp2' => 'video/mj2',
453
+ 'mlp' => 'application/vnd.dolby.mlp',
454
+ 'mmd' => 'application/vnd.chipnuts.karaoke-mmd',
455
+ 'mmf' => 'application/vnd.smaf',
456
+ 'mmr' => 'image/vnd.fujixerox.edmics-mmr',
457
+ 'mny' => 'application/x-msmoney',
458
+ 'mobi' => 'application/x-mobipocket-ebook',
459
+ 'mods' => 'application/mods+xml',
460
+ 'mov' => 'video/quicktime',
461
+ 'movie' => 'video/x-sgi-movie',
462
+ 'mp2' => 'audio/mpeg',
463
+ 'mp21' => 'application/mp21',
464
+ 'mp2a' => 'audio/mpeg',
465
+ 'mp3' => 'audio/mpeg',
466
+ 'mp4' => 'video/mp4',
467
+ 'mp4a' => 'audio/mp4',
468
+ 'mp4s' => 'application/mp4',
469
+ 'mp4v' => 'video/mp4',
470
+ 'mpc' => 'application/vnd.mophun.certificate',
471
+ 'mpe' => 'video/mpeg',
472
+ 'mpeg' => 'video/mpeg',
473
+ 'mpg' => 'video/mpeg',
474
+ 'mpg4' => 'video/mp4',
475
+ 'mpga' => 'audio/mpeg',
476
+ 'mpkg' => 'application/vnd.apple.installer+xml',
477
+ 'mpm' => 'application/vnd.blueice.multipass',
478
+ 'mpn' => 'application/vnd.mophun.application',
479
+ 'mpp' => 'application/vnd.ms-project',
480
+ 'mpt' => 'application/vnd.ms-project',
481
+ 'mpy' => 'application/vnd.ibm.minipay',
482
+ 'mqy' => 'application/vnd.mobius.mqy',
483
+ 'mrc' => 'application/marc',
484
+ 'mrcx' => 'application/marcxml+xml',
485
+ 'ms' => 'text/troff',
486
+ 'mscml' => 'application/mediaservercontrol+xml',
487
+ 'mseed' => 'application/vnd.fdsn.mseed',
488
+ 'mseq' => 'application/vnd.mseq',
489
+ 'msf' => 'application/vnd.epson.msf',
490
+ 'msh' => 'model/mesh',
491
+ 'msi' => 'application/x-msdownload',
492
+ 'msl' => 'application/vnd.mobius.msl',
493
+ 'msty' => 'application/vnd.muvee.style',
494
+ 'mts' => 'model/vnd.mts',
495
+ 'mus' => 'application/vnd.musician',
496
+ 'musicxml' => 'application/vnd.recordare.musicxml+xml',
497
+ 'mvb' => 'application/x-msmediaview',
498
+ 'mwf' => 'application/vnd.mfer',
499
+ 'mxf' => 'application/mxf',
500
+ 'mxl' => 'application/vnd.recordare.musicxml',
501
+ 'mxml' => 'application/xv+xml',
502
+ 'mxs' => 'application/vnd.triscape.mxs',
503
+ 'mxu' => 'video/vnd.mpegurl',
504
+ 'n-gage' => 'application/vnd.nokia.n-gage.symbian.install',
505
+ 'n3' => 'text/n3',
506
+ 'nb' => 'application/mathematica',
507
+ 'nbp' => 'application/vnd.wolfram.player',
508
+ 'nc' => 'application/x-netcdf',
509
+ 'ncx' => 'application/x-dtbncx+xml',
510
+ 'ngdat' => 'application/vnd.nokia.n-gage.data',
511
+ 'nlu' => 'application/vnd.neurolanguage.nlu',
512
+ 'nml' => 'application/vnd.enliven',
513
+ 'nnd' => 'application/vnd.noblenet-directory',
514
+ 'nns' => 'application/vnd.noblenet-sealer',
515
+ 'nnw' => 'application/vnd.noblenet-web',
516
+ 'npx' => 'image/vnd.net-fpx',
517
+ 'nsf' => 'application/vnd.lotus-notes',
518
+ 'oa2' => 'application/vnd.fujitsu.oasys2',
519
+ 'oa3' => 'application/vnd.fujitsu.oasys3',
520
+ 'oas' => 'application/vnd.fujitsu.oasys',
521
+ 'obd' => 'application/x-msbinder',
522
+ 'oda' => 'application/oda',
523
+ 'odb' => 'application/vnd.oasis.opendocument.database',
524
+ 'odc' => 'application/vnd.oasis.opendocument.chart',
525
+ 'odf' => 'application/vnd.oasis.opendocument.formula',
526
+ 'odft' => 'application/vnd.oasis.opendocument.formula-template',
527
+ 'odg' => 'application/vnd.oasis.opendocument.graphics',
528
+ 'odi' => 'application/vnd.oasis.opendocument.image',
529
+ 'odm' => 'application/vnd.oasis.opendocument.text-master',
530
+ 'odp' => 'application/vnd.oasis.opendocument.presentation',
531
+ 'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
532
+ 'odt' => 'application/vnd.oasis.opendocument.text',
533
+ 'oga' => 'audio/ogg',
534
+ 'ogg' => 'audio/ogg',
535
+ 'ogv' => 'video/ogg',
536
+ 'ogx' => 'application/ogg',
537
+ 'onepkg' => 'application/onenote',
538
+ 'onetmp' => 'application/onenote',
539
+ 'onetoc' => 'application/onenote',
540
+ 'onetoc2' => 'application/onenote',
541
+ 'opf' => 'application/oebps-package+xml',
542
+ 'oprc' => 'application/vnd.palm',
543
+ 'org' => 'application/vnd.lotus-organizer',
544
+ 'osf' => 'application/vnd.yamaha.openscoreformat',
545
+ 'osfpvg' => 'application/vnd.yamaha.openscoreformat.osfpvg+xml',
546
+ 'otc' => 'application/vnd.oasis.opendocument.chart-template',
547
+ 'otf' => 'application/x-font-otf',
548
+ 'otg' => 'application/vnd.oasis.opendocument.graphics-template',
549
+ 'oth' => 'application/vnd.oasis.opendocument.text-web',
550
+ 'oti' => 'application/vnd.oasis.opendocument.image-template',
551
+ 'otp' => 'application/vnd.oasis.opendocument.presentation-template',
552
+ 'ots' => 'application/vnd.oasis.opendocument.spreadsheet-template',
553
+ 'ott' => 'application/vnd.oasis.opendocument.text-template',
554
+ 'oxt' => 'application/vnd.openofficeorg.extension',
555
+ 'p' => 'text/x-pascal',
556
+ 'p10' => 'application/pkcs10',
557
+ 'p12' => 'application/x-pkcs12',
558
+ 'p7b' => 'application/x-pkcs7-certificates',
559
+ 'p7c' => 'application/pkcs7-mime',
560
+ 'p7m' => 'application/pkcs7-mime',
561
+ 'p7r' => 'application/x-pkcs7-certreqresp',
562
+ 'p7s' => 'application/pkcs7-signature',
563
+ 'p8' => 'application/pkcs8',
564
+ 'pas' => 'text/x-pascal',
565
+ 'paw' => 'application/vnd.pawaafile',
566
+ 'pbd' => 'application/vnd.powerbuilder6',
567
+ 'pbm' => 'image/x-portable-bitmap',
568
+ 'pcf' => 'application/x-font-pcf',
569
+ 'pcl' => 'application/vnd.hp-pcl',
570
+ 'pclxl' => 'application/vnd.hp-pclxl',
571
+ 'pct' => 'image/x-pict',
572
+ 'pcurl' => 'application/vnd.curl.pcurl',
573
+ 'pcx' => 'image/x-pcx',
574
+ 'pdb' => 'application/vnd.palm',
575
+ 'pdf' => 'application/pdf',
576
+ 'pfa' => 'application/x-font-type1',
577
+ 'pfb' => 'application/x-font-type1',
578
+ 'pfm' => 'application/x-font-type1',
579
+ 'pfr' => 'application/font-tdpfr',
580
+ 'pfx' => 'application/x-pkcs12',
581
+ 'pgm' => 'image/x-portable-graymap',
582
+ 'pgn' => 'application/x-chess-pgn',
583
+ 'pgp' => 'application/pgp-encrypted',
584
+ 'php' => 'text/x-php',
585
+ 'phps' => 'application/x-httpd-phps',
586
+ 'pic' => 'image/x-pict',
587
+ 'pkg' => 'application/octet-stream',
588
+ 'pki' => 'application/pkixcmp',
589
+ 'pkipath' => 'application/pkix-pkipath',
590
+ 'plb' => 'application/vnd.3gpp.pic-bw-large',
591
+ 'plc' => 'application/vnd.mobius.plc',
592
+ 'plf' => 'application/vnd.pocketlearn',
593
+ 'pls' => 'application/pls+xml',
594
+ 'pml' => 'application/vnd.ctc-posml',
595
+ 'png' => 'image/png',
596
+ 'pnm' => 'image/x-portable-anymap',
597
+ 'portpkg' => 'application/vnd.macports.portpkg',
598
+ 'pot' => 'application/vnd.ms-powerpoint',
599
+ 'potm' => 'application/vnd.ms-powerpoint.template.macroenabled.12',
600
+ 'potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template',
601
+ 'ppam' => 'application/vnd.ms-powerpoint.addin.macroenabled.12',
602
+ 'ppd' => 'application/vnd.cups-ppd',
603
+ 'ppm' => 'image/x-portable-pixmap',
604
+ 'pps' => 'application/vnd.ms-powerpoint',
605
+ 'ppsm' => 'application/vnd.ms-powerpoint.slideshow.macroenabled.12',
606
+ 'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow',
607
+ 'ppt' => 'application/vnd.ms-powerpoint',
608
+ 'pptm' => 'application/vnd.ms-powerpoint.presentation.macroenabled.12',
609
+ 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
610
+ 'pqa' => 'application/vnd.palm',
611
+ 'prc' => 'application/x-mobipocket-ebook',
612
+ 'pre' => 'application/vnd.lotus-freelance',
613
+ 'prf' => 'application/pics-rules',
614
+ 'ps' => 'application/postscript',
615
+ 'psb' => 'application/vnd.3gpp.pic-bw-small',
616
+ 'psd' => 'image/vnd.adobe.photoshop',
617
+ 'psf' => 'application/x-font-linux-psf',
618
+ 'pskcxml' => 'application/pskc+xml',
619
+ 'ptid' => 'application/vnd.pvi.ptid1',
620
+ 'pub' => 'application/x-mspublisher',
621
+ 'pvb' => 'application/vnd.3gpp.pic-bw-var',
622
+ 'pwn' => 'application/vnd.3m.post-it-notes',
623
+ 'pya' => 'audio/vnd.ms-playready.media.pya',
624
+ 'pyv' => 'video/vnd.ms-playready.media.pyv',
625
+ 'qam' => 'application/vnd.epson.quickanime',
626
+ 'qbo' => 'application/vnd.intu.qbo',
627
+ 'qfx' => 'application/vnd.intu.qfx',
628
+ 'qps' => 'application/vnd.publishare-delta-tree',
629
+ 'qt' => 'video/quicktime',
630
+ 'qwd' => 'application/vnd.quark.quarkxpress',
631
+ 'qwt' => 'application/vnd.quark.quarkxpress',
632
+ 'qxb' => 'application/vnd.quark.quarkxpress',
633
+ 'qxd' => 'application/vnd.quark.quarkxpress',
634
+ 'qxl' => 'application/vnd.quark.quarkxpress',
635
+ 'qxt' => 'application/vnd.quark.quarkxpress',
636
+ 'ra' => 'audio/x-pn-realaudio',
637
+ 'ram' => 'audio/x-pn-realaudio',
638
+ 'rar' => 'application/x-rar-compressed',
639
+ 'ras' => 'image/x-cmu-raster',
640
+ 'rb' => 'text/plain',
641
+ 'rcprofile' => 'application/vnd.ipunplugged.rcprofile',
642
+ 'rdf' => 'application/rdf+xml',
643
+ 'rdz' => 'application/vnd.data-vision.rdz',
644
+ 'rep' => 'application/vnd.businessobjects',
645
+ 'res' => 'application/x-dtbresource+xml',
646
+ 'resx' => 'text/xml',
647
+ 'rgb' => 'image/x-rgb',
648
+ 'rif' => 'application/reginfo+xml',
649
+ 'rip' => 'audio/vnd.rip',
650
+ 'rl' => 'application/resource-lists+xml',
651
+ 'rlc' => 'image/vnd.fujixerox.edmics-rlc',
652
+ 'rld' => 'application/resource-lists-diff+xml',
653
+ 'rm' => 'application/vnd.rn-realmedia',
654
+ 'rmi' => 'audio/midi',
655
+ 'rmp' => 'audio/x-pn-realaudio-plugin',
656
+ 'rms' => 'application/vnd.jcp.javame.midlet-rms',
657
+ 'rnc' => 'application/relax-ng-compact-syntax',
658
+ 'roff' => 'text/troff',
659
+ 'rp9' => 'application/vnd.cloanto.rp9',
660
+ 'rpss' => 'application/vnd.nokia.radio-presets',
661
+ 'rpst' => 'application/vnd.nokia.radio-preset',
662
+ 'rq' => 'application/sparql-query',
663
+ 'rs' => 'application/rls-services+xml',
664
+ 'rsd' => 'application/rsd+xml',
665
+ 'rss' => 'application/rss+xml',
666
+ 'rtf' => 'application/rtf',
667
+ 'rtx' => 'text/richtext',
668
+ 's' => 'text/x-asm',
669
+ 'saf' => 'application/vnd.yamaha.smaf-audio',
670
+ 'sbml' => 'application/sbml+xml',
671
+ 'sc' => 'application/vnd.ibm.secure-container',
672
+ 'scd' => 'application/x-msschedule',
673
+ 'scm' => 'application/vnd.lotus-screencam',
674
+ 'scq' => 'application/scvp-cv-request',
675
+ 'scs' => 'application/scvp-cv-response',
676
+ 'scurl' => 'text/vnd.curl.scurl',
677
+ 'sda' => 'application/vnd.stardivision.draw',
678
+ 'sdc' => 'application/vnd.stardivision.calc',
679
+ 'sdd' => 'application/vnd.stardivision.impress',
680
+ 'sdkd' => 'application/vnd.solent.sdkm+xml',
681
+ 'sdkm' => 'application/vnd.solent.sdkm+xml',
682
+ 'sdp' => 'application/sdp',
683
+ 'sdw' => 'application/vnd.stardivision.writer',
684
+ 'see' => 'application/vnd.seemail',
685
+ 'seed' => 'application/vnd.fdsn.seed',
686
+ 'sema' => 'application/vnd.sema',
687
+ 'semd' => 'application/vnd.semd',
688
+ 'semf' => 'application/vnd.semf',
689
+ 'ser' => 'application/java-serialized-object',
690
+ 'setpay' => 'application/set-payment-initiation',
691
+ 'setreg' => 'application/set-registration-initiation',
692
+ 'sfd-hdstx' => 'application/vnd.hydrostatix.sof-data',
693
+ 'sfs' => 'application/vnd.spotfire.sfs',
694
+ 'sgl' => 'application/vnd.stardivision.writer-global',
695
+ 'sgm' => 'text/sgml',
696
+ 'sgml' => 'text/sgml',
697
+ 'sh' => 'application/x-sh',
698
+ 'shar' => 'application/x-shar',
699
+ 'shf' => 'application/shf+xml',
700
+ 'sig' => 'application/pgp-signature',
701
+ 'silo' => 'model/mesh',
702
+ 'sis' => 'application/vnd.symbian.install',
703
+ 'sisx' => 'application/vnd.symbian.install',
704
+ 'sit' => 'application/x-stuffit',
705
+ 'sitx' => 'application/x-stuffitx',
706
+ 'skd' => 'application/vnd.koan',
707
+ 'skm' => 'application/vnd.koan',
708
+ 'skp' => 'application/vnd.koan',
709
+ 'skt' => 'application/vnd.koan',
710
+ 'sldm' => 'application/vnd.ms-powerpoint.slide.macroenabled.12',
711
+ 'sldx' => 'application/vnd.openxmlformats-officedocument.presentationml.slide',
712
+ 'slt' => 'application/vnd.epson.salt',
713
+ 'sm' => 'application/vnd.stepmania.stepchart',
714
+ 'smf' => 'application/vnd.stardivision.math',
715
+ 'smi' => 'application/smil+xml',
716
+ 'smil' => 'application/smil+xml',
717
+ 'snd' => 'audio/basic',
718
+ 'snf' => 'application/x-font-snf',
719
+ 'so' => 'application/octet-stream',
720
+ 'spc' => 'application/x-pkcs7-certificates',
721
+ 'spf' => 'application/vnd.yamaha.smaf-phrase',
722
+ 'spl' => 'application/x-futuresplash',
723
+ 'spot' => 'text/vnd.in3d.spot',
724
+ 'spp' => 'application/scvp-vp-response',
725
+ 'spq' => 'application/scvp-vp-request',
726
+ 'spx' => 'audio/ogg',
727
+ 'src' => 'application/x-wais-source',
728
+ 'srt' => 'application/octet-stream',
729
+ 'sru' => 'application/sru+xml',
730
+ 'srx' => 'application/sparql-results+xml',
731
+ 'sse' => 'application/vnd.kodak-descriptor',
732
+ 'ssf' => 'application/vnd.epson.ssf',
733
+ 'ssml' => 'application/ssml+xml',
734
+ 'st' => 'application/vnd.sailingtracker.track',
735
+ 'stc' => 'application/vnd.sun.xml.calc.template',
736
+ 'std' => 'application/vnd.sun.xml.draw.template',
737
+ 'stf' => 'application/vnd.wt.stf',
738
+ 'sti' => 'application/vnd.sun.xml.impress.template',
739
+ 'stk' => 'application/hyperstudio',
740
+ 'stl' => 'application/vnd.ms-pki.stl',
741
+ 'str' => 'application/vnd.pg.format',
742
+ 'stw' => 'application/vnd.sun.xml.writer.template',
743
+ 'sub' => 'image/vnd.dvb.subtitle',
744
+ 'sus' => 'application/vnd.sus-calendar',
745
+ 'susp' => 'application/vnd.sus-calendar',
746
+ 'sv4cpio' => 'application/x-sv4cpio',
747
+ 'sv4crc' => 'application/x-sv4crc',
748
+ 'svc' => 'application/vnd.dvb.service',
749
+ 'svd' => 'application/vnd.svd',
750
+ 'svg' => 'image/svg+xml',
751
+ 'svgz' => 'image/svg+xml',
752
+ 'swa' => 'application/x-director',
753
+ 'swf' => 'application/x-shockwave-flash',
754
+ 'swi' => 'application/vnd.aristanetworks.swi',
755
+ 'sxc' => 'application/vnd.sun.xml.calc',
756
+ 'sxd' => 'application/vnd.sun.xml.draw',
757
+ 'sxg' => 'application/vnd.sun.xml.writer.global',
758
+ 'sxi' => 'application/vnd.sun.xml.impress',
759
+ 'sxm' => 'application/vnd.sun.xml.math',
760
+ 'sxw' => 'application/vnd.sun.xml.writer',
761
+ 't' => 'text/troff',
762
+ 'tao' => 'application/vnd.tao.intent-module-archive',
763
+ 'tar' => 'application/x-tar',
764
+ 'tcap' => 'application/vnd.3gpp2.tcap',
765
+ 'tcl' => 'application/x-tcl',
766
+ 'teacher' => 'application/vnd.smart.teacher',
767
+ 'tei' => 'application/tei+xml',
768
+ 'teicorpus' => 'application/tei+xml',
769
+ 'tex' => 'application/x-tex',
770
+ 'texi' => 'application/x-texinfo',
771
+ 'texinfo' => 'application/x-texinfo',
772
+ 'text' => 'text/plain',
773
+ 'tfi' => 'application/thraud+xml',
774
+ 'tfm' => 'application/x-tex-tfm',
775
+ 'thmx' => 'application/vnd.ms-officetheme',
776
+ 'tif' => 'image/tiff',
777
+ 'tiff' => 'image/tiff',
778
+ 'tmo' => 'application/vnd.tmobile-livetv',
779
+ 'torrent' => 'application/x-bittorrent',
780
+ 'tpl' => 'application/vnd.groove-tool-template',
781
+ 'tpt' => 'application/vnd.trid.tpt',
782
+ 'tr' => 'text/troff',
783
+ 'tra' => 'application/vnd.trueapp',
784
+ 'trm' => 'application/x-msterminal',
785
+ 'tsd' => 'application/timestamped-data',
786
+ 'tsv' => 'text/tab-separated-values',
787
+ 'ttc' => 'application/x-font-ttf',
788
+ 'ttf' => 'application/x-font-ttf',
789
+ 'ttl' => 'text/turtle',
790
+ 'twd' => 'application/vnd.simtech-mindmapper',
791
+ 'twds' => 'application/vnd.simtech-mindmapper',
792
+ 'txd' => 'application/vnd.genomatix.tuxedo',
793
+ 'txf' => 'application/vnd.mobius.txf',
794
+ 'txt' => 'text/plain',
795
+ 'u32' => 'application/x-authorware-bin',
796
+ 'udeb' => 'application/x-debian-package',
797
+ 'ufd' => 'application/vnd.ufdl',
798
+ 'ufdl' => 'application/vnd.ufdl',
799
+ 'umj' => 'application/vnd.umajin',
800
+ 'unityweb' => 'application/vnd.unity',
801
+ 'uoml' => 'application/vnd.uoml+xml',
802
+ 'uri' => 'text/uri-list',
803
+ 'uris' => 'text/uri-list',
804
+ 'urls' => 'text/uri-list',
805
+ 'ustar' => 'application/x-ustar',
806
+ 'utz' => 'application/vnd.uiq.theme',
807
+ 'uu' => 'text/x-uuencode',
808
+ 'uva' => 'audio/vnd.dece.audio',
809
+ 'uvd' => 'application/vnd.dece.data',
810
+ 'uvf' => 'application/vnd.dece.data',
811
+ 'uvg' => 'image/vnd.dece.graphic',
812
+ 'uvh' => 'video/vnd.dece.hd',
813
+ 'uvi' => 'image/vnd.dece.graphic',
814
+ 'uvm' => 'video/vnd.dece.mobile',
815
+ 'uvp' => 'video/vnd.dece.pd',
816
+ 'uvs' => 'video/vnd.dece.sd',
817
+ 'uvt' => 'application/vnd.dece.ttml+xml',
818
+ 'uvu' => 'video/vnd.uvvu.mp4',
819
+ 'uvv' => 'video/vnd.dece.video',
820
+ 'uvva' => 'audio/vnd.dece.audio',
821
+ 'uvvd' => 'application/vnd.dece.data',
822
+ 'uvvf' => 'application/vnd.dece.data',
823
+ 'uvvg' => 'image/vnd.dece.graphic',
824
+ 'uvvh' => 'video/vnd.dece.hd',
825
+ 'uvvi' => 'image/vnd.dece.graphic',
826
+ 'uvvm' => 'video/vnd.dece.mobile',
827
+ 'uvvp' => 'video/vnd.dece.pd',
828
+ 'uvvs' => 'video/vnd.dece.sd',
829
+ 'uvvt' => 'application/vnd.dece.ttml+xml',
830
+ 'uvvu' => 'video/vnd.uvvu.mp4',
831
+ 'uvvv' => 'video/vnd.dece.video',
832
+ 'uvvx' => 'application/vnd.dece.unspecified',
833
+ 'uvx' => 'application/vnd.dece.unspecified',
834
+ 'vcd' => 'application/x-cdlink',
835
+ 'vcf' => 'text/x-vcard',
836
+ 'vcg' => 'application/vnd.groove-vcard',
837
+ 'vcs' => 'text/x-vcalendar',
838
+ 'vcx' => 'application/vnd.vcx',
839
+ 'vis' => 'application/vnd.visionary',
840
+ 'viv' => 'video/vnd.vivo',
841
+ 'vor' => 'application/vnd.stardivision.writer',
842
+ 'vox' => 'application/x-authorware-bin',
843
+ 'vrml' => 'model/vrml',
844
+ 'vsd' => 'application/vnd.visio',
845
+ 'vsf' => 'application/vnd.vsf',
846
+ 'vss' => 'application/vnd.visio',
847
+ 'vst' => 'application/vnd.visio',
848
+ 'vsw' => 'application/vnd.visio',
849
+ 'vtu' => 'model/vnd.vtu',
850
+ 'vxml' => 'application/voicexml+xml',
851
+ 'w3d' => 'application/x-director',
852
+ 'wad' => 'application/x-doom',
853
+ 'wav' => 'audio/x-wav',
854
+ 'wax' => 'audio/x-ms-wax',
855
+ 'wbmp' => 'image/vnd.wap.wbmp',
856
+ 'wbs' => 'application/vnd.criticaltools.wbs+xml',
857
+ 'wbxml' => 'application/vnd.wap.wbxml',
858
+ 'wcm' => 'application/vnd.ms-works',
859
+ 'wdb' => 'application/vnd.ms-works',
860
+ 'weba' => 'audio/webm',
861
+ 'webm' => 'video/webm',
862
+ 'webp' => 'image/webp',
863
+ 'wg' => 'application/vnd.pmi.widget',
864
+ 'wgt' => 'application/widget',
865
+ 'wks' => 'application/vnd.ms-works',
866
+ 'wm' => 'video/x-ms-wm',
867
+ 'wma' => 'audio/x-ms-wma',
868
+ 'wmd' => 'application/x-ms-wmd',
869
+ 'wmf' => 'application/x-msmetafile',
870
+ 'wml' => 'text/vnd.wap.wml',
871
+ 'wmlc' => 'application/vnd.wap.wmlc',
872
+ 'wmls' => 'text/vnd.wap.wmlscript',
873
+ 'wmlsc' => 'application/vnd.wap.wmlscriptc',
874
+ 'wmv' => 'video/x-ms-wmv',
875
+ 'wmx' => 'video/x-ms-wmx',
876
+ 'wmz' => 'application/x-ms-wmz',
877
+ 'woff' => 'application/x-font-woff',
878
+ 'wpd' => 'application/vnd.wordperfect',
879
+ 'wpl' => 'application/vnd.ms-wpl',
880
+ 'wps' => 'application/vnd.ms-works',
881
+ 'wqd' => 'application/vnd.wqd',
882
+ 'wri' => 'application/x-mswrite',
883
+ 'wrl' => 'model/vrml',
884
+ 'wsdl' => 'application/wsdl+xml',
885
+ 'wspolicy' => 'application/wspolicy+xml',
886
+ 'wtb' => 'application/vnd.webturbo',
887
+ 'wvx' => 'video/x-ms-wvx',
888
+ 'x32' => 'application/x-authorware-bin',
889
+ 'x3d' => 'application/vnd.hzn-3d-crossword',
890
+ 'xap' => 'application/x-silverlight-app',
891
+ 'xar' => 'application/vnd.xara',
892
+ 'xbap' => 'application/x-ms-xbap',
893
+ 'xbd' => 'application/vnd.fujixerox.docuworks.binder',
894
+ 'xbm' => 'image/x-xbitmap',
895
+ 'xdf' => 'application/xcap-diff+xml',
896
+ 'xdm' => 'application/vnd.syncml.dm+xml',
897
+ 'xdp' => 'application/vnd.adobe.xdp+xml',
898
+ 'xdssc' => 'application/dssc+xml',
899
+ 'xdw' => 'application/vnd.fujixerox.docuworks',
900
+ 'xenc' => 'application/xenc+xml',
901
+ 'xer' => 'application/patch-ops-error+xml',
902
+ 'xfdf' => 'application/vnd.adobe.xfdf',
903
+ 'xfdl' => 'application/vnd.xfdl',
904
+ 'xht' => 'application/xhtml+xml',
905
+ 'xhtml' => 'application/xhtml+xml',
906
+ 'xhvml' => 'application/xv+xml',
907
+ 'xif' => 'image/vnd.xiff',
908
+ 'xla' => 'application/vnd.ms-excel',
909
+ 'xlam' => 'application/vnd.ms-excel.addin.macroenabled.12',
910
+ 'xlc' => 'application/vnd.ms-excel',
911
+ 'xlm' => 'application/vnd.ms-excel',
912
+ 'xls' => 'application/vnd.ms-excel',
913
+ 'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroenabled.12',
914
+ 'xlsm' => 'application/vnd.ms-excel.sheet.macroenabled.12',
915
+ 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
916
+ 'xlt' => 'application/vnd.ms-excel',
917
+ 'xltm' => 'application/vnd.ms-excel.template.macroenabled.12',
918
+ 'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template',
919
+ 'xlw' => 'application/vnd.ms-excel',
920
+ 'xml' => 'application/xml',
921
+ 'xo' => 'application/vnd.olpc-sugar',
922
+ 'xop' => 'application/xop+xml',
923
+ 'xpi' => 'application/x-xpinstall',
924
+ 'xpm' => 'image/x-xpixmap',
925
+ 'xpr' => 'application/vnd.is-xpr',
926
+ 'xps' => 'application/vnd.ms-xpsdocument',
927
+ 'xpw' => 'application/vnd.intercon.formnet',
928
+ 'xpx' => 'application/vnd.intercon.formnet',
929
+ 'xsl' => 'application/xml',
930
+ 'xslt' => 'application/xslt+xml',
931
+ 'xsm' => 'application/vnd.syncml+xml',
932
+ 'xspf' => 'application/xspf+xml',
933
+ 'xul' => 'application/vnd.mozilla.xul+xml',
934
+ 'xvm' => 'application/xv+xml',
935
+ 'xvml' => 'application/xv+xml',
936
+ 'xwd' => 'image/x-xwindowdump',
937
+ 'xyz' => 'chemical/x-xyz',
938
+ 'yaml' => 'text/yaml',
939
+ 'yang' => 'application/yang',
940
+ 'yin' => 'application/yin+xml',
941
+ 'yml' => 'text/yaml',
942
+ 'zaz' => 'application/vnd.zzazz.deck+xml',
943
+ 'zip' => 'application/zip',
944
+ 'zir' => 'application/vnd.zul',
945
+ 'zirz' => 'application/vnd.zul',
946
+ 'zmm' => 'application/vnd.handheld-entertainment+xml'
947
+ ];
948
+
949
+ /**
950
+ * Get a singleton instance of the class
951
+ *
952
+ * @return self
953
+ * @codeCoverageIgnore
954
+ */
955
+ public static function getInstance() {
956
+ if (!self::$instance) {
957
+ self::$instance = new self();
958
+ }
959
+
960
+ return self::$instance;
961
+ }
962
+
963
+ /**
964
+ * Get a mimetype value from a file extension
965
+ *
966
+ * @param string $extension File extension
967
+ *
968
+ * @return string|null
969
+ */
970
+ public function fromExtension($extension) {
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
+ return $this->fromExtension(pathinfo($filename, PATHINFO_EXTENSION));
985
+ }
986
+ }
{Facebook → providers/facebook/compat/Facebook}/GraphNodes/Birthday.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\GraphNodes;
25
 
26
  use DateTime;
@@ -30,8 +31,8 @@ use DateTime;
30
  *
31
  * @package Facebook
32
  */
33
- class Birthday extends DateTime
34
- {
35
  /**
36
  * @var bool
37
  */
@@ -53,8 +54,7 @@ class Birthday extends DateTime
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;
@@ -68,8 +68,7 @@ class Birthday extends DateTime
68
  *
69
  * @return bool
70
  */
71
- public function hasDate()
72
- {
73
  return $this->hasDate;
74
  }
75
 
@@ -78,8 +77,7 @@ class Birthday extends DateTime
78
  *
79
  * @return bool
80
  */
81
- public function hasYear()
82
- {
83
  return $this->hasYear;
84
  }
85
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\GraphNodes;
26
 
27
  use DateTime;
31
  *
32
  * @package Facebook
33
  */
34
+ class Birthday extends DateTime {
35
+
36
  /**
37
  * @var bool
38
  */
54
  *
55
  * @param string $date
56
  */
57
+ public function __construct($date) {
 
58
  $parts = explode('/', $date);
59
 
60
  $this->hasYear = count($parts) === 3 || count($parts) === 1;
68
  *
69
  * @return bool
70
  */
71
+ public function hasDate() {
 
72
  return $this->hasDate;
73
  }
74
 
77
  *
78
  * @return bool
79
  */
80
+ public function hasYear() {
 
81
  return $this->hasYear;
82
  }
83
  }
{Facebook → providers/facebook/compat/Facebook}/GraphNodes/Collection.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\GraphNodes;
25
 
26
  /**
@@ -36,8 +37,8 @@ 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
  *
@@ -50,8 +51,7 @@ class Collection implements ArrayAccess, Countable, IteratorAggregate
50
  *
51
  * @param array $items
52
  */
53
- public function __construct(array $items = [])
54
- {
55
  $this->items = $items;
56
  }
57
 
@@ -63,8 +63,7 @@ class Collection implements ArrayAccess, Countable, IteratorAggregate
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
  }
@@ -81,10 +80,9 @@ class Collection implements ArrayAccess, Countable, IteratorAggregate
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
 
@@ -93,8 +91,7 @@ class Collection implements ArrayAccess, Countable, IteratorAggregate
93
  *
94
  * @return array
95
  */
96
- public function getFieldNames()
97
- {
98
  return array_keys($this->items);
99
  }
100
 
@@ -104,10 +101,9 @@ class Collection implements ArrayAccess, Countable, IteratorAggregate
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
 
@@ -116,8 +112,7 @@ class Collection implements ArrayAccess, Countable, IteratorAggregate
116
  *
117
  * @return array
118
  */
119
- public function all()
120
- {
121
  return $this->items;
122
  }
123
 
@@ -126,8 +121,7 @@ class Collection implements ArrayAccess, Countable, IteratorAggregate
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);
@@ -140,8 +134,7 @@ class Collection implements ArrayAccess, Countable, IteratorAggregate
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
 
@@ -152,8 +145,7 @@ class Collection implements ArrayAccess, Countable, IteratorAggregate
152
  *
153
  * @return string
154
  */
155
- public function asJson($options = 0)
156
- {
157
  return json_encode($this->asArray(), $options);
158
  }
159
 
@@ -162,8 +154,7 @@ class Collection implements ArrayAccess, Countable, IteratorAggregate
162
  *
163
  * @return int
164
  */
165
- public function count()
166
- {
167
  return count($this->items);
168
  }
169
 
@@ -172,8 +163,7 @@ class Collection implements ArrayAccess, Countable, IteratorAggregate
172
  *
173
  * @return ArrayIterator
174
  */
175
- public function getIterator()
176
- {
177
  return new ArrayIterator($this->items);
178
  }
179
 
@@ -184,8 +174,7 @@ class Collection implements ArrayAccess, Countable, IteratorAggregate
184
  *
185
  * @return bool
186
  */
187
- public function offsetExists($key)
188
- {
189
  return array_key_exists($key, $this->items);
190
  }
191
 
@@ -196,8 +185,7 @@ class Collection implements ArrayAccess, Countable, IteratorAggregate
196
  *
197
  * @return mixed
198
  */
199
- public function offsetGet($key)
200
- {
201
  return $this->items[$key];
202
  }
203
 
@@ -209,8 +197,7 @@ class Collection implements ArrayAccess, Countable, IteratorAggregate
209
  *
210
  * @return void
211
  */
212
- public function offsetSet($key, $value)
213
- {
214
  if (is_null($key)) {
215
  $this->items[] = $value;
216
  } else {
@@ -225,8 +212,7 @@ class Collection implements ArrayAccess, Countable, IteratorAggregate
225
  *
226
  * @return void
227
  */
228
- public function offsetUnset($key)
229
- {
230
  unset($this->items[$key]);
231
  }
232
 
@@ -235,8 +221,7 @@ class Collection implements ArrayAccess, Countable, IteratorAggregate
235
  *
236
  * @return string
237
  */
238
- public function __toString()
239
- {
240
  return $this->asJson();
241
  }
242
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\GraphNodes;
26
 
27
  /**
37
  use Countable;
38
  use IteratorAggregate;
39
 
40
+ class Collection implements ArrayAccess, Countable, IteratorAggregate {
41
+
42
  /**
43
  * The items contained in the collection.
44
  *
51
  *
52
  * @param array $items
53
  */
54
+ public function __construct(array $items = []) {
 
55
  $this->items = $items;
56
  }
57
 
63
  *
64
  * @return mixed
65
  */
66
+ public function getField($name, $default = null) {
 
67
  if (isset($this->items[$name])) {
68
  return $this->items[$name];
69
  }
80
  * @return mixed
81
  *
82
  * @deprecated 5.0.0 getProperty() has been renamed to getField()
83
+ * @todo v6: Remove this method
84
  */
85
+ public function getProperty($name, $default = null) {
 
86
  return $this->getField($name, $default);
87
  }
88
 
91
  *
92
  * @return array
93
  */
94
+ public function getFieldNames() {
 
95
  return array_keys($this->items);
96
  }
97
 
101
  * @return array
102
  *
103
  * @deprecated 5.0.0 getPropertyNames() has been renamed to getFieldNames()
104
+ * @todo v6: Remove this method
105
  */
106
+ public function getPropertyNames() {
 
107
  return $this->getFieldNames();
108
  }
109
 
112
  *
113
  * @return array
114
  */
115
+ public function all() {
 
116
  return $this->items;
117
  }
118
 
121
  *
122
  * @return array
123
  */
124
+ public function asArray() {
 
125
  return array_map(function ($value) {
126
  return $value instanceof Collection ? $value->asArray() : $value;
127
  }, $this->items);
134
  *
135
  * @return static
136
  */
137
+ public function map(\Closure $callback) {
 
138
  return new static(array_map($callback, $this->items, array_keys($this->items)));
139
  }
140
 
145
  *
146
  * @return string
147
  */
148
+ public function asJson($options = 0) {
 
149
  return json_encode($this->asArray(), $options);
150
  }
151
 
154
  *
155
  * @return int
156
  */
157
+ public function count() {
 
158
  return count($this->items);
159
  }
160
 
163
  *
164
  * @return ArrayIterator
165
  */
166
+ public function getIterator() {
 
167
  return new ArrayIterator($this->items);
168
  }
169
 
174
  *
175
  * @return bool
176
  */
177
+ public function offsetExists($key) {
 
178
  return array_key_exists($key, $this->items);
179
  }
180
 
185
  *
186
  * @return mixed
187
  */
188
+ public function offsetGet($key) {
 
189
  return $this->items[$key];
190
  }
191
 
197
  *
198
  * @return void
199
  */
200
+ public function offsetSet($key, $value) {
 
201
  if (is_null($key)) {
202
  $this->items[] = $value;
203
  } else {
212
  *
213
  * @return void
214
  */
215
+ public function offsetUnset($key) {
 
216
  unset($this->items[$key]);
217
  }
218
 
221
  *
222
  * @return string
223
  */
224
+ public function __toString() {
 
225
  return $this->asJson();
226
  }
227
  }
{Facebook → providers/facebook/compat/Facebook}/GraphNodes/GraphAchievement.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\GraphNodes;
25
 
26
  /**
@@ -28,13 +29,13 @@ namespace Facebook\GraphNodes;
28
  *
29
  * @package Facebook
30
  */
31
- class GraphAchievement extends GraphNode
32
- {
33
  /**
34
  * @var array Maps object key names to Graph object types.
35
  */
36
  protected static $graphObjectMap = [
37
- 'from' => '\Facebook\GraphNodes\GraphUser',
38
  'application' => '\Facebook\GraphNodes\GraphApplication',
39
  ];
40
 
@@ -43,8 +44,7 @@ class GraphAchievement extends GraphNode
43
  *
44
  * @return string|null
45
  */
46
- public function getId()
47
- {
48
  return $this->getField('id');
49
  }
50
 
@@ -53,8 +53,7 @@ class GraphAchievement extends GraphNode
53
  *
54
  * @return GraphUser|null
55
  */
56
- public function getFrom()
57
- {
58
  return $this->getField('from');
59
  }
60
 
@@ -63,8 +62,7 @@ class GraphAchievement extends GraphNode
63
  *
64
  * @return \DateTime|null
65
  */
66
- public function getPublishTime()
67
- {
68
  return $this->getField('publish_time');
69
  }
70
 
@@ -73,8 +71,7 @@ class GraphAchievement extends GraphNode
73
  *
74
  * @return GraphApplication|null
75
  */
76
- public function getApplication()
77
- {
78
  return $this->getField('application');
79
  }
80
 
@@ -83,8 +80,7 @@ class GraphAchievement extends GraphNode
83
  *
84
  * @return array|null
85
  */
86
- public function getData()
87
- {
88
  return $this->getField('data');
89
  }
90
 
@@ -95,8 +91,7 @@ class GraphAchievement extends GraphNode
95
  *
96
  * @return string
97
  */
98
- public function getType()
99
- {
100
  return 'game.achievement';
101
  }
102
 
@@ -105,8 +100,7 @@ class GraphAchievement extends GraphNode
105
  *
106
  * @return boolean|null
107
  */
108
- public function isNoFeedStory()
109
- {
110
  return $this->getField('no_feed_story');
111
  }
112
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\GraphNodes;
26
 
27
  /**
29
  *
30
  * @package Facebook
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
 
44
  *
45
  * @return string|null
46
  */
47
+ public function getId() {
 
48
  return $this->getField('id');
49
  }
50
 
53
  *
54
  * @return GraphUser|null
55
  */
56
+ public function getFrom() {
 
57
  return $this->getField('from');
58
  }
59
 
62
  *
63
  * @return \DateTime|null
64
  */
65
+ public function getPublishTime() {
 
66
  return $this->getField('publish_time');
67
  }
68
 
71
  *
72
  * @return GraphApplication|null
73
  */
74
+ public function getApplication() {
 
75
  return $this->getField('application');
76
  }
77
 
80
  *
81
  * @return array|null
82
  */
83
+ public function getData() {
 
84
  return $this->getField('data');
85
  }
86
 
91
  *
92
  * @return string
93
  */
94
+ public function getType() {
 
95
  return 'game.achievement';
96
  }
97
 
100
  *
101
  * @return boolean|null
102
  */
103
+ public function isNoFeedStory() {
 
104
  return $this->getField('no_feed_story');
105
  }
106
  }
{Facebook → providers/facebook/compat/Facebook}/GraphNodes/GraphAlbum.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\GraphNodes;
25
 
26
  /**
@@ -29,13 +30,13 @@ namespace Facebook\GraphNodes;
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
 
@@ -44,8 +45,7 @@ class GraphAlbum extends GraphNode
44
  *
45
  * @return string|null
46
  */
47
- public function getId()
48
- {
49
  return $this->getField('id');
50
  }
51
 
@@ -54,8 +54,7 @@ class GraphAlbum extends GraphNode
54
  *
55
  * @return boolean|null
56
  */
57
- public function getCanUpload()
58
- {
59
  return $this->getField('can_upload');
60
  }
61
 
@@ -64,8 +63,7 @@ class GraphAlbum extends GraphNode
64
  *
65
  * @return int|null
66
  */
67
- public function getCount()
68
- {
69
  return $this->getField('count');
70
  }
71
 
@@ -74,8 +72,7 @@ class GraphAlbum extends GraphNode
74
  *
75
  * @return string|null
76
  */
77
- public function getCoverPhoto()
78
- {
79
  return $this->getField('cover_photo');
80
  }
81
 
@@ -84,8 +81,7 @@ class GraphAlbum extends GraphNode
84
  *
85
  * @return \DateTime|null
86
  */
87
- public function getCreatedTime()
88
- {
89
  return $this->getField('created_time');
90
  }
91
 
@@ -94,8 +90,7 @@ class GraphAlbum extends GraphNode
94
  *
95
  * @return \DateTime|null
96
  */
97
- public function getUpdatedTime()
98
- {
99
  return $this->getField('updated_time');
100
  }
101
 
@@ -104,8 +99,7 @@ class GraphAlbum extends GraphNode
104
  *
105
  * @return string|null
106
  */
107
- public function getDescription()
108
- {
109
  return $this->getField('description');
110
  }
111
 
@@ -114,8 +108,7 @@ class GraphAlbum extends GraphNode
114
  *
115
  * @return GraphUser|null
116
  */
117
- public function getFrom()
118
- {
119
  return $this->getField('from');
120
  }
121
 
@@ -124,8 +117,7 @@ class GraphAlbum extends GraphNode
124
  *
125
  * @return GraphPage|null
126
  */
127
- public function getPlace()
128
- {
129
  return $this->getField('place');
130
  }
131
 
@@ -134,8 +126,7 @@ class GraphAlbum extends GraphNode
134
  *
135
  * @return string|null
136
  */
137
- public function getLink()
138
- {
139
  return $this->getField('link');
140
  }
141
 
@@ -144,8 +135,7 @@ class GraphAlbum extends GraphNode
144
  *
145
  * @return string|null
146
  */
147
- public function getLocation()
148
- {
149
  return $this->getField('location');
150
  }
151
 
@@ -154,8 +144,7 @@ class GraphAlbum extends GraphNode
154
  *
155
  * @return string|null
156
  */
157
- public function getName()
158
- {
159
  return $this->getField('name');
160
  }
161
 
@@ -164,8 +153,7 @@ class GraphAlbum extends GraphNode
164
  *
165
  * @return string|null
166
  */
167
- public function getPrivacy()
168
- {
169
  return $this->getField('privacy');
170
  }
171
 
@@ -176,8 +164,7 @@ class GraphAlbum extends GraphNode
176
  *
177
  * @return string|null
178
  */
179
- public function getType()
180
- {
181
  return $this->getField('type');
182
  }
183
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\GraphNodes;
26
 
27
  /**
30
  * @package Facebook
31
  */
32
 
33
+ class GraphAlbum extends GraphNode {
34
+
35
  /**
36
  * @var array Maps object key names to Graph object types.
37
  */
38
  protected static $graphObjectMap = [
39
+ 'from' => '\Facebook\GraphNodes\GraphUser',
40
  'place' => '\Facebook\GraphNodes\GraphPage',
41
  ];
42
 
45
  *
46
  * @return string|null
47
  */
48
+ public function getId() {
 
49
  return $this->getField('id');
50
  }
51
 
54
  *
55
  * @return boolean|null
56
  */
57
+ public function getCanUpload() {
 
58
  return $this->getField('can_upload');
59
  }
60
 
63
  *
64
  * @return int|null
65
  */
66
+ public function getCount() {
 
67
  return $this->getField('count');
68
  }
69
 
72
  *
73
  * @return string|null
74
  */
75
+ public function getCoverPhoto() {
 
76
  return $this->getField('cover_photo');
77
  }
78
 
81
  *
82
  * @return \DateTime|null
83
  */
84
+ public function getCreatedTime() {
 
85
  return $this->getField('created_time');
86
  }
87
 
90
  *
91
  * @return \DateTime|null
92
  */
93
+ public function getUpdatedTime() {
 
94
  return $this->getField('updated_time');
95
  }
96
 
99
  *
100
  * @return string|null
101
  */
102
+ public function getDescription() {
 
103
  return $this->getField('description');
104
  }
105
 
108
  *
109
  * @return GraphUser|null
110
  */
111
+ public function getFrom() {
 
112
  return $this->getField('from');
113
  }
114
 
117
  *
118
  * @return GraphPage|null
119
  */
120
+ public function getPlace() {
 
121
  return $this->getField('place');
122
  }
123
 
126
  *
127
  * @return string|null
128
  */
129
+ public function getLink() {
 
130
  return $this->getField('link');
131
  }
132
 
135
  *
136
  * @return string|null
137
  */
138
+ public function getLocation() {
 
139
  return $this->getField('location');
140
  }
141
 
144
  *
145
  * @return string|null
146
  */
147
+ public function getName() {
 
148
  return $this->getField('name');
149
  }
150
 
153
  *
154
  * @return string|null
155
  */
156
+ public function getPrivacy() {
 
157
  return $this->getField('privacy');
158
  }
159
 
164
  *
165
  * @return string|null
166
  */
167
+ public function getType() {
 
168
  return $this->getField('type');
169
  }
170
  }
{Facebook → providers/facebook/compat/Facebook}/GraphNodes/GraphApplication.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\GraphNodes;
25
 
26
  /**
@@ -29,15 +30,14 @@ namespace Facebook\GraphNodes;
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
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\GraphNodes;
26
 
27
  /**
30
  * @package Facebook
31
  */
32
 
33
+ class GraphApplication extends GraphNode {
34
+
35
  /**
36
  * Returns the ID for the application.
37
  *
38
  * @return string|null
39
  */
40
+ public function getId() {
 
41
  return $this->getField('id');
42
  }
43
  }
{Facebook → providers/facebook/compat/Facebook}/GraphNodes/GraphCoverPhoto.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\GraphNodes;
25
 
26
  /**
@@ -28,25 +29,23 @@ namespace Facebook\GraphNodes;
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
 
@@ -55,8 +54,7 @@ class GraphCoverPhoto extends GraphNode
55
  *
56
  * @return int|null
57
  */
58
- public function getOffsetX()
59
- {
60
  return $this->getField('offset_x');
61
  }
62
 
@@ -65,8 +63,7 @@ class GraphCoverPhoto extends GraphNode
65
  *
66
  * @return int|null
67
  */
68
- public function getOffsetY()
69
- {
70
  return $this->getField('offset_y');
71
  }
72
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\GraphNodes;
26
 
27
  /**
29
  *
30
  * @package Facebook
31
  */
32
+ class GraphCoverPhoto extends GraphNode {
33
+
34
  /**
35
  * Returns the id of cover if it exists
36
  *
37
  * @return int|null
38
  */
39
+ public function getId() {
 
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
  return $this->getField('source');
50
  }
51
 
54
  *
55
  * @return int|null
56
  */
57
+ public function getOffsetX() {
 
58
  return $this->getField('offset_x');
59
  }
60
 
63
  *
64
  * @return int|null
65
  */
66
+ public function getOffsetY() {
 
67
  return $this->getField('offset_y');
68
  }
69
  }
{Facebook → providers/facebook/compat/Facebook}/GraphNodes/GraphEdge.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\GraphNodes;
25
 
26
  use Facebook\FacebookRequest;
@@ -32,8 +33,8 @@ use Facebook\Exceptions\FacebookSDKException;
32
  *
33
  * @package Facebook
34
  */
35
- class GraphEdge extends Collection
36
- {
37
  /**
38
  * @var FacebookRequest The original request that generated this data.
39
  */
@@ -63,12 +64,11 @@ class GraphEdge extends Collection
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
  }
@@ -78,8 +78,7 @@ class GraphEdge extends Collection
78
  *
79
  * @return string|null
80
  */
81
- public function getParentGraphEdge()
82
- {
83
  return $this->parentEdgeEndpoint;
84
  }
85
 
@@ -88,8 +87,7 @@ class GraphEdge extends Collection
88
  *
89
  * @return string|null
90
  */
91
- public function getSubClassName()
92
- {
93
  return $this->subclassName;
94
  }
95
 
@@ -98,8 +96,7 @@ class GraphEdge extends Collection
98
  *
99
  * @return array
100
  */
101
- public function getMetaData()
102
- {
103
  return $this->metaData;
104
  }
105
 
@@ -108,8 +105,7 @@ class GraphEdge extends Collection
108
  *
109
  * @return string|null
110
  */
111
- public function getNextCursor()
112
- {
113
  return $this->getCursor('after');
114
  }
115
 
@@ -118,8 +114,7 @@ class GraphEdge extends Collection
118
  *
119
  * @return string|null
120
  */
121
- public function getPreviousCursor()
122
- {
123
  return $this->getCursor('before');
124
  }
125
 
@@ -130,8 +125,7 @@ class GraphEdge extends Collection
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
  }
@@ -148,8 +142,7 @@ class GraphEdge extends Collection
148
  *
149
  * @throws FacebookSDKException
150
  */
151
- public function getPaginationUrl($direction)
152
- {
153
  $this->validateForPagination();
154
 
155
  // Do we have a paging URL?
@@ -167,8 +160,7 @@ class GraphEdge extends Collection
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
  }
@@ -183,8 +175,7 @@ class GraphEdge extends Collection
183
  *
184
  * @throws FacebookSDKException
185
  */
186
- public function getPaginationRequest($direction)
187
- {
188
  $pageUrl = $this->getPaginationUrl($direction);
189
  if (!$pageUrl) {
190
  return null;
@@ -203,8 +194,7 @@ class GraphEdge extends Collection
203
  *
204
  * @throws FacebookSDKException
205
  */
206
- public function getNextPageRequest()
207
- {
208
  return $this->getPaginationRequest('next');
209
  }
210
 
@@ -215,8 +205,7 @@ class GraphEdge extends Collection
215
  *
216
  * @throws FacebookSDKException
217
  */
218
- public function getPreviousPageRequest()
219
- {
220
  return $this->getPaginationRequest('previous');
221
  }
222
 
@@ -227,8 +216,7 @@ class GraphEdge extends Collection
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
  }
@@ -239,14 +227,7 @@ class GraphEdge extends Collection
239
  /**
240
  * @inheritDoc
241
  */
242
- public function map(\Closure $callback)
243
- {
244
- return new static(
245
- $this->request,
246
- array_map($callback, $this->items, array_keys($this->items)),
247
- $this->metaData,
248
- $this->parentEdgeEndpoint,
249
- $this->subclassName
250
- );
251
  }
252
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\GraphNodes;
26
 
27
  use Facebook\FacebookRequest;
33
  *
34
  * @package Facebook
35
  */
36
+ class GraphEdge extends Collection {
37
+
38
  /**
39
  * @var FacebookRequest The original request that generated this data.
40
  */
64
  * @param string|null $parentEdgeEndpoint The parent Graph edge endpoint that generated the list.
65
  * @param string|null $subclassName The subclass of the child GraphNode's.
66
  */
67
+ public function __construct(FacebookRequest $request, array $data = [], array $metaData = [], $parentEdgeEndpoint = null, $subclassName = null) {
68
+ $this->request = $request;
69
+ $this->metaData = $metaData;
 
70
  $this->parentEdgeEndpoint = $parentEdgeEndpoint;
71
+ $this->subclassName = $subclassName;
72
 
73
  parent::__construct($data);
74
  }
78
  *
79
  * @return string|null
80
  */
81
+ public function getParentGraphEdge() {
 
82
  return $this->parentEdgeEndpoint;
83
  }
84
 
87
  *
88
  * @return string|null
89
  */
90
+ public function getSubClassName() {
 
91
  return $this->subclassName;
92
  }
93
 
96
  *
97
  * @return array
98
  */
99
+ public function getMetaData() {
 
100
  return $this->metaData;
101
  }
102
 
105
  *
106
  * @return string|null
107
  */
108
+ public function getNextCursor() {
 
109
  return $this->getCursor('after');
110
  }
111
 
114
  *
115
  * @return string|null
116
  */
117
+ public function getPreviousCursor() {
 
118
  return $this->getCursor('before');
119
  }
120
 
125
  *
126
  * @return string|null
127
  */
128
+ public function getCursor($direction) {
 
129
  if (isset($this->metaData['paging']['cursors'][$direction])) {
130
  return $this->metaData['paging']['cursors'][$direction];
131
  }
142
  *
143
  * @throws FacebookSDKException
144
  */
145
+ public function getPaginationUrl($direction) {
 
146
  $this->validateForPagination();
147
 
148
  // Do we have a paging URL?
160
  *
161
  * @throws FacebookSDKException
162
  */
163
+ public function validateForPagination() {
 
164
  if ($this->request->getMethod() !== 'GET') {
165
  throw new FacebookSDKException('You can only paginate on a GET request.', 720);
166
  }
175
  *
176
  * @throws FacebookSDKException
177
  */
178
+ public function getPaginationRequest($direction) {
 
179
  $pageUrl = $this->getPaginationUrl($direction);
180
  if (!$pageUrl) {
181
  return null;
194
  *
195
  * @throws FacebookSDKException
196
  */
197
+ public function getNextPageRequest() {
 
198
  return $this->getPaginationRequest('next');
199
  }
200
 
205
  *
206
  * @throws FacebookSDKException
207
  */
208
+ public function getPreviousPageRequest() {
 
209
  return $this->getPaginationRequest('previous');
210
  }
211
 
216
  *
217
  * @return int|null
218
  */
219
+ public function getTotalCount() {
 
220
  if (isset($this->metaData['summary']['total_count'])) {
221
  return $this->metaData['summary']['total_count'];
222
  }
227
  /**
228
  * @inheritDoc
229
  */
230
+ public function map(\Closure $callback) {
231
+ return new static($this->request, array_map($callback, $this->items, array_keys($this->items)), $this->metaData, $this->parentEdgeEndpoint, $this->subclassName);
 
 
 
 
 
 
 
232
  }
233
  }
{Facebook → providers/facebook/compat/Facebook}/GraphNodes/GraphEvent.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\GraphNodes;
25
 
26
  /**
@@ -28,15 +29,15 @@ namespace Facebook\GraphNodes;
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
 
@@ -45,8 +46,7 @@ class GraphEvent extends GraphNode
45
  *
46
  * @return string|null
47
  */
48
- public function getId()
49
- {
50
  return $this->getField('id');
51
  }
52
 
@@ -55,8 +55,7 @@ class GraphEvent extends GraphNode
55
  *
56
  * @return GraphCoverPhoto|null
57
  */
58
- public function getCover()
59
- {
60
  return $this->getField('cover');
61
  }
62
 
@@ -65,8 +64,7 @@ class GraphEvent extends GraphNode
65
  *
66
  * @return string|null
67
  */
68
- public function getDescription()
69
- {
70
  return $this->getField('description');
71
  }
72
 
@@ -75,8 +73,7 @@ class GraphEvent extends GraphNode
75
  *
76
  * @return \DateTime|null
77
  */
78
- public function getEndTime()
79
- {
80
  return $this->getField('end_time');
81
  }
82
 
@@ -85,8 +82,7 @@ class GraphEvent extends GraphNode
85
  *
86
  * @return bool|null
87
  */
88
- public function getIsDateOnly()
89
- {
90
  return $this->getField('is_date_only');
91
  }
92
 
@@ -95,8 +91,7 @@ class GraphEvent extends GraphNode
95
  *
96
  * @return string|null
97
  */
98
- public function getName()
99
- {
100
  return $this->getField('name');
101
  }
102
 
@@ -105,8 +100,7 @@ class GraphEvent extends GraphNode
105
  *
106
  * @return GraphNode|null
107
  */
108
- public function getOwner()
109
- {
110
  return $this->getField('owner');
111
  }
112
 
@@ -115,8 +109,7 @@ class GraphEvent extends GraphNode
115
  *
116
  * @return GraphGroup|null
117
  */
118
- public function getParentGroup()
119
- {
120
  return $this->getField('parent_group');
121
  }
122
 
@@ -125,8 +118,7 @@ class GraphEvent extends GraphNode
125
  *
126
  * @return GraphPage|null
127
  */
128
- public function getPlace()
129
- {
130
  return $this->getField('place');
131
  }
132
 
@@ -135,8 +127,7 @@ class GraphEvent extends GraphNode
135
  *
136
  * @return string|null
137
  */
138
- public function getPrivacy()
139
- {
140
  return $this->getField('privacy');
141
  }
142
 
@@ -145,8 +136,7 @@ class GraphEvent extends GraphNode
145
  *
146
  * @return \DateTime|null
147
  */
148
- public function getStartTime()
149
- {
150
  return $this->getField('start_time');
151
  }
152
 
@@ -155,8 +145,7 @@ class GraphEvent extends GraphNode
155
  *
156
  * @return string|null
157
  */
158
- public function getTicketUri()
159
- {
160
  return $this->getField('ticket_uri');
161
  }
162
 
@@ -165,8 +154,7 @@ class GraphEvent extends GraphNode
165
  *
166
  * @return string|null
167
  */
168
- public function getTimezone()
169
- {
170
  return $this->getField('timezone');
171
  }
172
 
@@ -175,8 +163,7 @@ class GraphEvent extends GraphNode
175
  *
176
  * @return \DateTime|null
177
  */
178
- public function getUpdatedTime()
179
- {
180
  return $this->getField('updated_time');
181
  }
182
 
@@ -185,8 +172,7 @@ class GraphEvent extends GraphNode
185
  *
186
  * @return GraphPicture|null
187
  */
188
- public function getPicture()
189
- {
190
  return $this->getField('picture');
191
  }
192
 
@@ -195,8 +181,7 @@ class GraphEvent extends GraphNode
195
  *
196
  * @return int|null
197
  */
198
- public function getAttendingCount()
199
- {
200
  return $this->getField('attending_count');
201
  }
202
 
@@ -205,8 +190,7 @@ class GraphEvent extends GraphNode
205
  *
206
  * @return int|null
207
  */
208
- public function getDeclinedCount()
209
- {
210
  return $this->getField('declined_count');
211
  }
212
 
@@ -215,8 +199,7 @@ class GraphEvent extends GraphNode
215
  *
216
  * @return int|null
217
  */
218
- public function getMaybeCount()
219
- {
220
  return $this->getField('maybe_count');
221
  }
222
 
@@ -225,8 +208,7 @@ class GraphEvent extends GraphNode
225
  *
226
  * @return int|null
227
  */
228
- public function getNoreplyCount()
229
- {
230
  return $this->getField('noreply_count');
231
  }
232
 
@@ -235,8 +217,7 @@ class GraphEvent extends GraphNode
235
  *
236
  * @return int|null
237
  */
238
- public function getInvitedCount()
239
- {
240
  return $this->getField('invited_count');
241
  }
242
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\GraphNodes;
26
 
27
  /**
29
  *
30
  * @package Facebook
31
  */
32
+ class GraphEvent extends GraphNode {
33
+
34
  /**
35
  * @var array Maps object key names to GraphNode types.
36
  */
37
  protected static $graphObjectMap = [
38
+ 'cover' => '\Facebook\GraphNodes\GraphCoverPhoto',
39
+ 'place' => '\Facebook\GraphNodes\GraphPage',
40
+ 'picture' => '\Facebook\GraphNodes\GraphPicture',
41
  'parent_group' => '\Facebook\GraphNodes\GraphGroup',
42
  ];
43
 
46
  *
47
  * @return string|null
48
  */
49
+ public function getId() {
 
50
  return $this->getField('id');
51
  }
52
 
55
  *
56
  * @return GraphCoverPhoto|null
57
  */
58
+ public function getCover() {
 
59
  return $this->getField('cover');
60
  }
61
 
64
  *
65
  * @return string|null
66
  */
67
+ public function getDescription() {
 
68
  return $this->getField('description');
69
  }
70
 
73
  *
74
  * @return \DateTime|null
75
  */
76
+ public function getEndTime() {
 
77
  return $this->getField('end_time');
78
  }
79
 
82
  *
83
  * @return bool|null
84
  */
85
+ public function getIsDateOnly() {
 
86
  return $this->getField('is_date_only');
87
  }
88
 
91
  *
92
  * @return string|null
93
  */
94
+ public function getName() {
 
95
  return $this->getField('name');
96
  }
97
 
100
  *
101
  * @return GraphNode|null
102
  */
103
+ public function getOwner() {
 
104
  return $this->getField('owner');
105
  }
106
 
109
  *
110
  * @return GraphGroup|null
111
  */
112
+ public function getParentGroup() {
 
113
  return $this->getField('parent_group');
114
  }
115
 
118
  *
119
  * @return GraphPage|null
120
  */
121
+ public function getPlace() {
 
122
  return $this->getField('place');
123
  }
124
 
127
  *
128
  * @return string|null
129
  */
130
+ public function getPrivacy() {
 
131
  return $this->getField('privacy');
132
  }
133
 
136
  *
137
  * @return \DateTime|null
138
  */
139
+ public function getStartTime() {
 
140
  return $this->getField('start_time');
141
  }
142
 
145
  *
146
  * @return string|null
147
  */
148
+ public function getTicketUri() {
 
149
  return $this->getField('ticket_uri');
150
  }
151
 
154
  *
155
  * @return string|null
156
  */
157
+ public function getTimezone() {
 
158
  return $this->getField('timezone');
159
  }
160
 
163
  *
164
  * @return \DateTime|null
165
  */
166
+ public function getUpdatedTime() {
 
167
  return $this->getField('updated_time');
168
  }
169
 
172
  *
173
  * @return GraphPicture|null
174
  */
175
+ public function getPicture() {
 
176
  return $this->getField('picture');
177
  }
178
 
181
  *
182
  * @return int|null
183
  */
184
+ public function getAttendingCount() {
 
185
  return $this->getField('attending_count');
186
  }
187
 
190
  *
191
  * @return int|null
192
  */
193
+ public function getDeclinedCount() {
 
194
  return $this->getField('declined_count');
195
  }
196
 
199
  *
200
  * @return int|null
201
  */
202
+ public function getMaybeCount() {
 
203
  return $this->getField('maybe_count');
204
  }
205
 
208
  *
209
  * @return int|null
210
  */
211
+ public function getNoreplyCount() {
 
212
  return $this->getField('noreply_count');
213
  }
214
 
217
  *
218
  * @return int|null
219
  */
220
+ public function getInvitedCount() {
 
221
  return $this->getField('invited_count');
222
  }
223
  }
{Facebook → providers/facebook/compat/Facebook}/GraphNodes/GraphGroup.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\GraphNodes;
25
 
26
  /**
@@ -28,8 +29,8 @@ namespace Facebook\GraphNodes;
28
  *
29
  * @package Facebook
30
  */
31
- class GraphGroup extends GraphNode
32
- {
33
  /**
34
  * @var array Maps object key names to GraphNode types.
35
  */
@@ -43,8 +44,7 @@ class GraphGroup extends GraphNode
43
  *
44
  * @return string|null
45
  */
46
- public function getId()
47
- {
48
  return $this->getField('id');
49
  }
50
 
@@ -53,8 +53,7 @@ class GraphGroup extends GraphNode
53
  *
54
  * @return GraphCoverPhoto|null
55
  */
56
- public function getCover()
57
- {
58
  return $this->getField('cover');
59
  }
60
 
@@ -63,8 +62,7 @@ class GraphGroup extends GraphNode
63
  *
64
  * @return string|null
65
  */
66
- public function getDescription()
67
- {
68
  return $this->getField('description');
69
  }
70
 
@@ -73,8 +71,7 @@ class GraphGroup extends GraphNode
73
  *
74
  * @return string|null
75
  */
76
- public function getEmail()
77
- {
78
  return $this->getField('email');
79
  }
80
 
@@ -83,8 +80,7 @@ class GraphGroup extends GraphNode
83
  *
84
  * @return string|null
85
  */
86
- public function getIcon()
87
- {
88
  return $this->getField('icon');
89
  }
90
 
@@ -93,8 +89,7 @@ class GraphGroup extends GraphNode
93
  *
94
  * @return string|null
95
  */
96
- public function getLink()
97
- {
98
  return $this->getField('link');
99
  }
100
 
@@ -103,8 +98,7 @@ class GraphGroup extends GraphNode
103
  *
104
  * @return string|null
105
  */
106
- public function getName()
107
- {
108
  return $this->getField('name');
109
  }
110
 
@@ -113,8 +107,7 @@ class GraphGroup extends GraphNode
113
  *
114
  * @return int|null
115
  */
116
- public function getMemberRequestCount()
117
- {
118
  return $this->getField('member_request_count');
119
  }
120
 
@@ -123,8 +116,7 @@ class GraphGroup extends GraphNode
123
  *
124
  * @return GraphNode|null
125
  */
126
- public function getOwner()
127
- {
128
  return $this->getField('owner');
129
  }
130
 
@@ -133,8 +125,7 @@ class GraphGroup extends GraphNode
133
  *
134
  * @return GraphNode|null
135
  */
136
- public function getParent()
137
- {
138
  return $this->getField('parent');
139
  }
140
 
@@ -143,8 +134,7 @@ class GraphGroup extends GraphNode
143
  *
144
  * @return string|null
145
  */
146
- public function getPrivacy()
147
- {
148
  return $this->getField('privacy');
149
  }
150
 
@@ -153,8 +143,7 @@ class GraphGroup extends GraphNode
153
  *
154
  * @return \DateTime|null
155
  */
156
- public function getUpdatedTime()
157
- {
158
  return $this->getField('updated_time');
159
  }
160
 
@@ -163,8 +152,7 @@ class GraphGroup extends GraphNode
163
  *
164
  * @return GraphLocation|null
165
  */
166
- public function getVenue()
167
- {
168
  return $this->getField('venue');
169
  }
170
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\GraphNodes;
26
 
27
  /**
29
  *
30
  * @package Facebook
31
  */
32
+ class GraphGroup extends GraphNode {
33
+
34
  /**
35
  * @var array Maps object key names to GraphNode types.
36
  */
44
  *
45
  * @return string|null
46
  */
47
+ public function getId() {
 
48
  return $this->getField('id');
49
  }
50
 
53
  *
54
  * @return GraphCoverPhoto|null
55
  */
56
+ public function getCover() {
 
57
  return $this->getField('cover');
58
  }
59
 
62
  *
63
  * @return string|null
64
  */
65
+ public function getDescription() {
 
66
  return $this->getField('description');
67
  }
68
 
71
  *
72
  * @return string|null
73
  */
74
+ public function getEmail() {
 
75
  return $this->getField('email');
76
  }
77
 
80
  *
81
  * @return string|null
82
  */
83
+ public function getIcon() {
 
84
  return $this->getField('icon');
85
  }
86
 
89
  *
90
  * @return string|null
91
  */
92
+ public function getLink() {
 
93
  return $this->getField('link');
94
  }
95
 
98
  *
99
  * @return string|null
100
  */
101
+ public function getName() {
 
102
  return $this->getField('name');
103
  }
104
 
107
  *
108
  * @return int|null
109
  */
110
+ public function getMemberRequestCount() {
 
111
  return $this->getField('member_request_count');
112
  }
113
 
116
  *
117
  * @return GraphNode|null
118
  */
119
+ public function getOwner() {
 
120
  return $this->getField('owner');
121
  }
122
 
125
  *
126
  * @return GraphNode|null
127
  */
128
+ public function getParent() {
 
129
  return $this->getField('parent');
130
  }
131
 
134
  *
135
  * @return string|null
136
  */
137
+ public function getPrivacy() {
 
138
  return $this->getField('privacy');
139
  }
140
 
143
  *
144
  * @return \DateTime|null
145
  */
146
+ public function getUpdatedTime() {
 
147
  return $this->getField('updated_time');
148
  }
149
 
152
  *
153
  * @return GraphLocation|null
154
  */
155
+ public function getVenue() {
 
156
  return $this->getField('venue');
157
  }
158
  }
{Facebook → providers/facebook/compat/Facebook}/GraphNodes/GraphList.php RENAMED
@@ -21,16 +21,17 @@
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
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\GraphNodes;
26
 
27
  /**
28
  * Class GraphList
29
  *
30
+ * @package Facebook
31
  *
32
  * @deprecated 5.0.0 GraphList has been renamed to GraphEdge
33
+ * @todo v6: Remove this class
34
  */
35
+ class GraphList extends GraphEdge {
36
+
37
  }
{Facebook → providers/facebook/compat/Facebook}/GraphNodes/GraphLocation.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\GraphNodes;
25
 
26
  /**
@@ -28,15 +29,14 @@ namespace Facebook\GraphNodes;
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
 
@@ -45,8 +45,7 @@ class GraphLocation extends GraphNode
45
  *
46
  * @return string|null
47
  */
48
- public function getCity()
49
- {
50
  return $this->getField('city');
51
  }
52
 
@@ -55,8 +54,7 @@ class GraphLocation extends GraphNode
55
  *
56
  * @return string|null
57
  */
58
- public function getState()
59
- {
60
  return $this->getField('state');
61
  }
62
 
@@ -65,8 +63,7 @@ class GraphLocation extends GraphNode
65
  *
66
  * @return string|null
67
  */
68
- public function getCountry()
69
- {
70
  return $this->getField('country');
71
  }
72
 
@@ -75,8 +72,7 @@ class GraphLocation extends GraphNode
75
  *
76
  * @return string|null
77
  */
78
- public function getZip()
79
- {
80
  return $this->getField('zip');
81
  }
82
 
@@ -85,8 +81,7 @@ class GraphLocation extends GraphNode
85
  *
86
  * @return float|null
87
  */
88
- public function getLatitude()
89
- {
90
  return $this->getField('latitude');
91
  }
92
 
@@ -95,8 +90,7 @@ class GraphLocation extends GraphNode
95
  *
96
  * @return float|null
97
  */
98
- public function getLongitude()
99
- {
100
  return $this->getField('longitude');
101
  }
102
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\GraphNodes;
26
 
27
  /**
29
  *
30
  * @package Facebook
31
  */
32
+ class GraphLocation extends GraphNode {
33
+
34
  /**
35
  * Returns the street component of the location
36
  *
37
  * @return string|null
38
  */
39
+ public function getStreet() {
 
40
  return $this->getField('street');
41
  }
42
 
45
  *
46
  * @return string|null
47
  */
48
+ public function getCity() {
 
49
  return $this->getField('city');
50
  }
51
 
54
  *
55
  * @return string|null
56
  */
57
+ public function getState() {
 
58
  return $this->getField('state');
59
  }
60
 
63
  *
64
  * @return string|null
65
  */
66
+ public function getCountry() {
 
67
  return $this->getField('country');
68
  }
69
 
72
  *
73
  * @return string|null
74
  */
75
+ public function getZip() {
 
76
  return $this->getField('zip');
77
  }
78
 
81
  *
82
  * @return float|null
83
  */
84
+ public function getLatitude() {
 
85
  return $this->getField('latitude');
86
  }
87
 
90
  *
91
  * @return float|null
92
  */
93
+ public function getLongitude() {
 
94
  return $this->getField('longitude');
95
  }
96
  }
{Facebook → providers/facebook/compat/Facebook}/GraphNodes/GraphNode.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\GraphNodes;
25
 
26
  /**
@@ -28,8 +29,8 @@ namespace Facebook\GraphNodes;
28
  *
29
  * @package Facebook
30
  */
31
- class GraphNode extends Collection
32
- {
33
  /**
34
  * @var array Maps object key names to Graph object types.
35
  */
@@ -40,8 +41,7 @@ class GraphNode extends Collection
40
  *
41
  * @param array $data
42
  */
43
- public function __construct(array $data = [])
44
- {
45
  parent::__construct($this->castItems($data));
46
  }
47
 
@@ -55,15 +55,11 @@ class GraphNode extends Collection
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);
@@ -81,8 +77,7 @@ class GraphNode extends Collection
81
  *
82
  * @return array
83
  */
84
- public function uncastItems()
85
- {
86
  $items = $this->asArray();
87
 
88
  return array_map(function ($v) {
@@ -101,8 +96,7 @@ class GraphNode extends Collection
101
  *
102
  * @return string
103
  */
104
- public function asJson($options = 0)
105
- {
106
  return json_encode($this->uncastItems(), $options);
107
  }
108
 
@@ -117,18 +111,12 @@ class GraphNode extends Collection
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
  }
@@ -140,8 +128,7 @@ class GraphNode extends Collection
140
  *
141
  * @return boolean
142
  */
143
- public function shouldCastAsDateTime($key)
144
- {
145
  return in_array($key, [
146
  'created_time',
147
  'updated_time',
@@ -161,8 +148,7 @@ class GraphNode extends Collection
161
  *
162
  * @return \DateTime
163
  */
164
- public function castToDateTime($value)
165
- {
166
  if (is_int($value)) {
167
  $dt = new \DateTime();
168
  $dt->setTimestamp($value);
@@ -180,8 +166,7 @@ class GraphNode extends Collection
180
  *
181
  * @return Birthday
182
  */
183
- public function castToBirthday($value)
184
- {
185
  return new Birthday($value);
186
  }
187
 
@@ -190,8 +175,7 @@ class GraphNode extends Collection
190
  *
191
  * @return array
192
  */
193
- public static function getObjectMap()
194
- {
195
  return static::$graphObjectMap;
196
  }
197
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\GraphNodes;
26
 
27
  /**
29
  *
30
  * @package Facebook
31
  */
32
+ class GraphNode extends Collection {
33
+
34
  /**
35
  * @var array Maps object key names to Graph object types.
36
  */
41
  *
42
  * @param array $data
43
  */
44
+ public function __construct(array $data = []) {
 
45
  parent::__construct($this->castItems($data));
46
  }
47
 
55
  *
56
  * @return array
57
  */
58
+ public function castItems(array $data) {
 
59
  $items = [];
60
 
61
  foreach ($data as $k => $v) {
62
+ if ($this->shouldCastAsDateTime($k) && (is_numeric($v) || $this->isIso8601DateString($v))) {
 
 
 
63
  $items[$k] = $this->castToDateTime($v);
64
  } elseif ($k === 'birthday') {
65
  $items[$k] = $this->castToBirthday($v);
77
  *
78
  * @return array
79
  */
80
+ public function uncastItems() {
 
81
  $items = $this->asArray();
82
 
83
  return array_map(function ($v) {
96
  *
97
  * @return string
98
  */
99
+ public function asJson($options = 0) {
 
100
  return json_encode($this->uncastItems(), $options);
101
  }
102
 
111
  * @see http://www.cl.cam.ac.uk/~mgk25/iso-time.html
112
  * @see http://en.wikipedia.org/wiki/ISO_8601
113
  */
114
+ public function isIso8601DateString($string) {
 
115
  // This insane regex was yoinked from here:
116
  // http://www.pelagodesign.com/blog/2009/05/20/iso-8601-date-validation-that-doesnt-suck/
117
  // ...and I'm all like:
118
  // http://thecodinglove.com/post/95378251969/when-code-works-and-i-dont-know-why
119
+ $crazyInsaneRegexThatSomehowDetectsIso8601 = '/^([\+-]?\d{4}(?!\d{2}\b))' . '((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?' . '|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d' . '|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])' . '((:?)[0-5]\d)?|24\:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d' . '([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/';
 
 
 
 
 
120
 
121
  return preg_match($crazyInsaneRegexThatSomehowDetectsIso8601, $string) === 1;
122
  }
128
  *
129
  * @return boolean
130
  */
131
+ public function shouldCastAsDateTime($key) {
 
132
  return in_array($key, [
133
  'created_time',
134
  'updated_time',
148
  *
149
  * @return \DateTime
150
  */
151
+ public function castToDateTime($value) {
 
152
  if (is_int($value)) {
153
  $dt = new \DateTime();
154
  $dt->setTimestamp($value);
166
  *
167
  * @return Birthday
168
  */
169
+ public function castToBirthday($value) {
 
170
  return new Birthday($value);
171
  }
172
 
175
  *
176
  * @return array
177
  */
178
+ public static function getObjectMap() {
 
179
  return static::$graphObjectMap;
180
  }
181
  }
{Facebook → providers/facebook/compat/Facebook}/GraphNodes/GraphNodeFactory.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\GraphNodes;
25
 
26
  use Facebook\FacebookResponse;
@@ -40,8 +41,8 @@ use Facebook\Exceptions\FacebookSDKException;
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
  */
@@ -72,9 +73,8 @@ class GraphNodeFactory
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
 
@@ -87,8 +87,7 @@ class GraphNodeFactory
87
  *
88
  * @throws FacebookSDKException
89
  */
90
- public function makeGraphNode($subclassName = null)
91
- {
92
  $this->validateResponseAsArray();
93
  $this->validateResponseCastableAsGraphNode();
94
 
@@ -102,8 +101,7 @@ class GraphNodeFactory
102
  *
103
  * @throws FacebookSDKException
104
  */
105
- public function makeGraphAchievement()
106
- {
107
  return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphAchievement');
108
  }
109
 
@@ -114,8 +112,7 @@ class GraphNodeFactory
114
  *
115
  * @throws FacebookSDKException
116
  */
117
- public function makeGraphAlbum()
118
- {
119
  return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphAlbum');
120
  }
121
 
@@ -126,8 +123,7 @@ class GraphNodeFactory
126
  *
127
  * @throws FacebookSDKException
128
  */
129
- public function makeGraphPage()
130
- {
131
  return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphPage');
132
  }
133
 
@@ -138,8 +134,7 @@ class GraphNodeFactory
138
  *
139
  * @throws FacebookSDKException
140
  */
141
- public function makeGraphSessionInfo()
142
- {
143
  return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphSessionInfo');
144
  }
145
 
@@ -150,8 +145,7 @@ class GraphNodeFactory
150
  *
151
  * @throws FacebookSDKException
152
  */
153
- public function makeGraphUser()
154
- {
155
  return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphUser');
156
  }
157
 
@@ -162,8 +156,7 @@ class GraphNodeFactory
162
  *
163
  * @throws FacebookSDKException
164
  */
165
- public function makeGraphEvent()
166
- {
167
  return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphEvent');
168
  }
169
 
@@ -174,8 +167,7 @@ class GraphNodeFactory
174
  *
175
  * @throws FacebookSDKException
176
  */
177
- public function makeGraphGroup()
178
- {
179
  return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphGroup');
180
  }
181
 
@@ -189,8 +181,7 @@ class GraphNodeFactory
189
  *
190
  * @throws FacebookSDKException
191
  */
192
- public function makeGraphEdge($subclassName = null, $auto_prefix = true)
193
- {
194
  $this->validateResponseAsArray();
195
  $this->validateResponseCastableAsGraphEdge();
196
 
@@ -206,8 +197,7 @@ class GraphNodeFactory
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
  }
@@ -218,13 +208,9 @@ class GraphNodeFactory
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
 
@@ -233,13 +219,9 @@ class GraphNodeFactory
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
 
@@ -253,8 +235,7 @@ class GraphNodeFactory
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
 
@@ -270,9 +251,7 @@ class GraphNodeFactory
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);
@@ -296,8 +275,7 @@ class GraphNodeFactory
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'])) {
@@ -323,8 +301,7 @@ class GraphNodeFactory
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
  }
@@ -338,7 +315,7 @@ class GraphNodeFactory
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
  }
@@ -350,8 +327,7 @@ class GraphNodeFactory
350
  *
351
  * @return array
352
  */
353
- public function getMetaData(array $data)
354
- {
355
  unset($data['data']);
356
 
357
  return $data;
@@ -364,8 +340,7 @@ class GraphNodeFactory
364
  *
365
  * @return boolean
366
  */
367
- public static function isCastableAsGraphEdge(array $data)
368
- {
369
  if ($data === []) {
370
  return true;
371
  }
@@ -381,8 +356,7 @@ class GraphNodeFactory
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
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\GraphNodes;
26
 
27
  use Facebook\FacebookResponse;
41
  * GraphNode - MAY contain DateTime's "primitives"
42
  * GraphNode - MAY contain string's "primitives"
43
  */
44
+ class GraphNodeFactory {
45
+
46
  /**
47
  * @const string The base graph object class.
48
  */
73
  *
74
  * @param FacebookResponse $response The response entity from Graph.
75
  */
76
+ public function __construct(FacebookResponse $response) {
77
+ $this->response = $response;
 
78
  $this->decodedBody = $response->getDecodedBody();
79
  }
80
 
87
  *
88
  * @throws FacebookSDKException
89
  */
90
+ public function makeGraphNode($subclassName = null) {
 
91
  $this->validateResponseAsArray();
92
  $this->validateResponseCastableAsGraphNode();
93
 
101
  *
102
  * @throws FacebookSDKException
103
  */
104
+ public function makeGraphAchievement() {
 
105
  return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphAchievement');
106
  }
107
 
112
  *
113
  * @throws FacebookSDKException
114
  */
115
+ public function makeGraphAlbum() {
 
116
  return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphAlbum');
117
  }
118
 
123
  *
124
  * @throws FacebookSDKException
125
  */
126
+ public function makeGraphPage() {
 
127
  return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphPage');
128
  }
129
 
134
  *
135
  * @throws FacebookSDKException
136
  */
137
+ public function makeGraphSessionInfo() {
 
138
  return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphSessionInfo');
139
  }
140
 
145
  *
146
  * @throws FacebookSDKException
147
  */
148
+ public function makeGraphUser() {
 
149
  return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphUser');
150
  }
151
 
156
  *
157
  * @throws FacebookSDKException
158
  */
159
+ public function makeGraphEvent() {
 
160
  return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphEvent');
161
  }
162
 
167
  *
168
  * @throws FacebookSDKException
169
  */
170
+ public function makeGraphGroup() {
 
171
  return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphGroup');
172
  }
173
 
181
  *
182
  * @throws FacebookSDKException
183
  */
184
+ public function makeGraphEdge($subclassName = null, $auto_prefix = true) {
 
185
  $this->validateResponseAsArray();
186
  $this->validateResponseCastableAsGraphEdge();
187
 
197
  *
198
  * @throws FacebookSDKException
199
  */
200
+ public function validateResponseAsArray() {
 
201
  if (!is_array($this->decodedBody)) {
202
  throw new FacebookSDKException('Unable to get response from Graph as array.', 620);
203
  }
208
  *
209
  * @throws FacebookSDKException
210
  */
211
+ public function validateResponseCastableAsGraphNode() {
 
212
  if (isset($this->decodedBody['data']) && static::isCastableAsGraphEdge($this->decodedBody['data'])) {
213
+ throw new FacebookSDKException('Unable to convert response from Graph to a GraphNode because the response looks like a GraphEdge. Try using GraphNodeFactory::makeGraphEdge() instead.', 620);
 
 
 
214
  }
215
  }
216
 
219
  *
220
  * @throws FacebookSDKException
221
  */
222
+ public function validateResponseCastableAsGraphEdge() {
 
223
  if (!(isset($this->decodedBody['data']) && static::isCastableAsGraphEdge($this->decodedBody['data']))) {
224
+ throw new FacebookSDKException('Unable to convert response from Graph to a GraphEdge because the response does not look like a GraphEdge. Try using GraphNodeFactory::makeGraphNode() instead.', 620);
 
 
 
225
  }
226
  }
227
 
235
  *
236
  * @throws FacebookSDKException
237
  */
238
+ public function safelyMakeGraphNode(array $data, $subclassName = null) {
 
239
  $subclassName = $subclassName ?: static::BASE_GRAPH_NODE_CLASS;
240
  static::validateSubclass($subclassName);
241
 
251
  // This is always empty on the GraphNode collection, but subclasses can define
252
  // their own array of smart-casting types.
253
  $graphObjectMap = $subclassName::getObjectMap();
254
+ $objectSubClass = isset($graphObjectMap[$k]) ? $graphObjectMap[$k] : null;
 
 
255
 
256
  // Could be a GraphEdge or GraphNode
257
  $items[$k] = $this->castAsGraphNodeOrGraphEdge($v, $objectSubClass, $k, $parentNodeId);
275
  *
276
  * @throws FacebookSDKException
277
  */
278
+ public function castAsGraphNodeOrGraphEdge(array $data, $subclassName = null, $parentKey = null, $parentNodeId = null) {
 
279
  if (isset($data['data'])) {
280
  // Create GraphEdge
281
  if (static::isCastableAsGraphEdge($data['data'])) {
301
  *
302
  * @throws FacebookSDKException
303
  */
304
+ public function safelyMakeGraphEdge(array $data, $subclassName = null, $parentKey = null, $parentNodeId = null) {
 
305
  if (!isset($data['data'])) {
306
  throw new FacebookSDKException('Cannot cast data to GraphEdge. Expected a "data" key.', 620);
307
  }
315
 
316
  // We'll need to make an edge endpoint for this in case it's a GraphEdge (for cursor pagination)
317
  $parentGraphEdgeEndpoint = $parentNodeId && $parentKey ? '/' . $parentNodeId . '/' . $parentKey : null;
318
+ $className = static::BASE_GRAPH_EDGE_CLASS;
319
 
320
  return new $className($this->response->getRequest(), $dataList, $metaData, $parentGraphEdgeEndpoint, $subclassName);
321
  }
327
  *
328
  * @return array
329
  */
330
+ public function getMetaData(array $data) {
 
331
  unset($data['data']);
332
 
333
  return $data;
340
  *
341
  * @return boolean
342
  */
343
+ public static function isCastableAsGraphEdge(array $data) {
 
344
  if ($data === []) {
345
  return true;
346
  }
356
  *
357
  * @throws FacebookSDKException
358
  */
359
+ public static function validateSubclass($subclassName) {
 
360
  if ($subclassName == static::BASE_GRAPH_NODE_CLASS || is_subclass_of($subclassName, static::BASE_GRAPH_NODE_CLASS)) {
361
  return;
362
  }
{Facebook → providers/facebook/compat/Facebook}/GraphNodes/GraphObject.php RENAMED
@@ -21,16 +21,17 @@
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
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\GraphNodes;
26
 
27
  /**
28
  * Class GraphObject
29
  *
30
+ * @package Facebook
31
  *
32
  * @deprecated 5.0.0 GraphObject has been renamed to GraphNode
33
+ * @todo v6: Remove this class
34
  */
35
+ class GraphObject extends GraphNode {
36
+
37
  }
{Facebook → providers/facebook/compat/Facebook}/GraphNodes/GraphObjectFactory.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\GraphNodes;
25
 
26
  use Facebook\Exceptions\FacebookSDKException;
@@ -28,13 +29,13 @@ use Facebook\Exceptions\FacebookSDKException;
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
  */
@@ -54,8 +55,7 @@ class GraphObjectFactory extends GraphNodeFactory
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
 
@@ -66,8 +66,7 @@ class GraphObjectFactory extends GraphNodeFactory
66
  *
67
  * @throws FacebookSDKException
68
  */
69
- public function makeGraphEvent()
70
- {
71
  return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphEvent');
72
  }
73
 
@@ -81,8 +80,7 @@ class GraphObjectFactory extends GraphNodeFactory
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
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\GraphNodes;
26
 
27
  use Facebook\Exceptions\FacebookSDKException;
29
  /**
30
  * Class GraphObjectFactory
31
  *
32
+ * @package Facebook
33
  *
34
  * @deprecated 5.0.0 GraphObjectFactory has been renamed to GraphNodeFactory
35
+ * @todo v6: Remove this class
36
  */
37
+ class GraphObjectFactory extends GraphNodeFactory {
38
+
39
  /**
40
  * @const string The base graph object class.
41
  */
55
  *
56
  * @deprecated 5.0.0 GraphObjectFactory has been renamed to GraphNodeFactory
57
  */
58
+ public function makeGraphObject($subclassName = null) {
 
59
  return $this->makeGraphNode($subclassName);
60
  }
61
 
66
  *
67
  * @throws FacebookSDKException
68
  */
69
+ public function makeGraphEvent() {
 
70
  return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphEvent');
71
  }
72
 
80
  *
81
  * @deprecated 5.0.0 GraphObjectFactory has been renamed to GraphNodeFactory
82
  */
83
+ public function makeGraphList($subclassName = null, $auto_prefix = true) {
 
84
  return $this->makeGraphEdge($subclassName, $auto_prefix);
85
  }
86
  }
{Facebook → providers/facebook/compat/Facebook}/GraphNodes/GraphPage.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\GraphNodes;
25
 
26
  /**
@@ -28,17 +29,17 @@ namespace Facebook\GraphNodes;
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
- 'cover' => '\Facebook\GraphNodes\GraphCoverPhoto',
41
- 'picture' => '\Facebook\GraphNodes\GraphPicture',
42
  ];
43
 
44
  /**
@@ -46,8 +47,7 @@ class GraphPage extends GraphNode
46
  *
47
  * @return string|null
48
  */
49
- public function getId()
50
- {
51
  return $this->getField('id');
52
  }
53
 
@@ -56,8 +56,7 @@ class GraphPage extends GraphNode
56
  *
57
  * @return string|null
58
  */
59
- public function getCategory()
60
- {
61
  return $this->getField('category');
62
  }
63
 
@@ -66,8 +65,7 @@ class GraphPage extends GraphNode
66
  *
67
  * @return string|null
68
  */
69
- public function getName()
70
- {
71
  return $this->getField('name');
72
  }
73
 
@@ -76,8 +74,7 @@ class GraphPage extends GraphNode
76
  *
77
  * @return GraphPage|null
78
  */
79
- public function getBestPage()
80
- {
81
  return $this->getField('best_page');
82
  }
83
 
@@ -86,8 +83,7 @@ class GraphPage extends GraphNode
86
  *
87
  * @return GraphPage|null
88
  */
89
- public function getGlobalBrandParentPage()
90
- {
91
  return $this->getField('global_brand_parent_page');
92
  }
93
 
@@ -96,8 +92,7 @@ class GraphPage extends GraphNode
96
  *
97
  * @return GraphLocation|null
98
  */
99
- public function getLocation()
100
- {
101
  return $this->getField('location');
102
  }
103
 
@@ -106,8 +101,7 @@ class GraphPage extends GraphNode
106
  *
107
  * @return GraphCoverPhoto|null
108
  */
109
- public function getCover()
110
- {
111
  return $this->getField('cover');
112
  }
113
 
@@ -116,8 +110,7 @@ class GraphPage extends GraphNode
116
  *
117
  * @return GraphPicture|null
118
  */
119
- public function getPicture()
120
- {
121
  return $this->getField('picture');
122
  }
123
 
@@ -128,8 +121,7 @@ class GraphPage extends GraphNode
128
  *
129
  * @return string|null
130
  */
131
- public function getAccessToken()
132
- {
133
  return $this->getField('access_token');
134
  }
135
 
@@ -140,8 +132,7 @@ class GraphPage extends GraphNode
140
  *
141
  * @return array|null
142
  */
143
- public function getPerms()
144
- {
145
  return $this->getField('perms');
146
  }
147
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\GraphNodes;
26
 
27
  /**
29
  *
30
  * @package Facebook
31
  */
32
+ class GraphPage extends GraphNode {
33
+
34
  /**
35
  * @var array Maps object key names to Graph object types.
36
  */
37
  protected static $graphObjectMap = [
38
+ 'best_page' => '\Facebook\GraphNodes\GraphPage',
39
  'global_brand_parent_page' => '\Facebook\GraphNodes\GraphPage',
40
+ 'location' => '\Facebook\GraphNodes\GraphLocation',
41
+ 'cover' => '\Facebook\GraphNodes\GraphCoverPhoto',
42
+ 'picture' => '\Facebook\GraphNodes\GraphPicture',
43
  ];
44
 
45
  /**
47
  *
48
  * @return string|null
49
  */
50
+ public function getId() {
 
51
  return $this->getField('id');
52
  }
53
 
56
  *
57
  * @return string|null
58
  */
59
+ public function getCategory() {
 
60
  return $this->getField('category');
61
  }
62
 
65
  *
66
  * @return string|null
67
  */
68
+ public function getName() {
 
69
  return $this->getField('name');
70
  }
71
 
74
  *
75
  * @return GraphPage|null
76
  */
77
+ public function getBestPage() {
 
78
  return $this->getField('best_page');
79
  }
80
 
83
  *
84
  * @return GraphPage|null
85
  */
86
+ public function getGlobalBrandParentPage() {
 
87
  return $this->getField('global_brand_parent_page');
88
  }
89
 
92
  *
93
  * @return GraphLocation|null
94
  */
95
+ public function getLocation() {
 
96
  return $this->getField('location');
97
  }
98
 
101
  *
102
  * @return GraphCoverPhoto|null
103
  */
104
+ public function getCover() {
 
105
  return $this->getField('cover');
106
  }
107
 
110
  *
111
  * @return GraphPicture|null
112
  */
113
+ public function getPicture() {
 
114
  return $this->getField('picture');
115
  }
116
 
121
  *
122
  * @return string|null
123
  */
124
+ public function getAccessToken() {
 
125
  return $this->getField('access_token');
126
  }
127
 
132
  *
133
  * @return array|null
134
  */
135
+ public function getPerms() {
 
136
  return $this->getField('perms');
137
  }
138
  }
{Facebook → providers/facebook/compat/Facebook}/GraphNodes/GraphPicture.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\GraphNodes;
25
 
26
  /**
@@ -28,15 +29,14 @@ namespace Facebook\GraphNodes;
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
 
@@ -45,8 +45,7 @@ class GraphPicture extends GraphNode
45
  *
46
  * @return string|null
47
  */
48
- public function getUrl()
49
- {
50
  return $this->getField('url');
51
  }
52
 
@@ -55,8 +54,7 @@ class GraphPicture extends GraphNode
55
  *
56
  * @return int|null
57
  */
58
- public function getWidth()
59
- {
60
  return $this->getField('width');
61
  }
62
 
@@ -65,8 +63,7 @@ class GraphPicture extends GraphNode
65
  *
66
  * @return int|null
67
  */
68
- public function getHeight()
69
- {
70
  return $this->getField('height');
71
  }
72
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\GraphNodes;
26
 
27
  /**
29
  *
30
  * @package Facebook
31
  */
32
+ class GraphPicture extends GraphNode {
33
+
34
  /**
35
  * Returns true if user picture is silhouette.
36
  *
37
  * @return bool|null
38
  */
39
+ public function isSilhouette() {
 
40
  return $this->getField('is_silhouette');
41
  }
42
 
45
  *
46
  * @return string|null
47
  */
48
+ public function getUrl() {
 
49
  return $this->getField('url');
50
  }
51
 
54
  *
55
  * @return int|null
56
  */
57
+ public function getWidth() {
 
58
  return $this->getField('width');
59
  }
60
 
63
  *
64
  * @return int|null
65
  */
66
+ public function getHeight() {
 
67
  return $this->getField('height');
68
  }
69
  }
{Facebook → providers/facebook/compat/Facebook}/GraphNodes/GraphSessionInfo.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\GraphNodes;
25
 
26
  /**
@@ -28,15 +29,14 @@ namespace Facebook\GraphNodes;
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
 
@@ -45,8 +45,7 @@ class GraphSessionInfo extends GraphNode
45
  *
46
  * @return string|null
47
  */
48
- public function getApplication()
49
- {
50
  return $this->getField('application');
51
  }
52
 
@@ -55,8 +54,7 @@ class GraphSessionInfo extends GraphNode
55
  *
56
  * @return \DateTime|null
57
  */
58
- public function getExpiresAt()
59
- {
60
  return $this->getField('expires_at');
61
  }
62
 
@@ -65,8 +63,7 @@ class GraphSessionInfo extends GraphNode
65
  *
66
  * @return boolean
67
  */
68
- public function getIsValid()
69
- {
70
  return $this->getField('is_valid');
71
  }
72
 
@@ -75,8 +72,7 @@ class GraphSessionInfo extends GraphNode
75
  *
76
  * @return \DateTime|null
77
  */
78
- public function getIssuedAt()
79
- {
80
  return $this->getField('issued_at');
81
  }
82
 
@@ -85,8 +81,7 @@ class GraphSessionInfo extends GraphNode
85
  *
86
  * @return array
87
  */
88
- public function getScopes()
89
- {
90
  return $this->getField('scopes');
91
  }
92
 
@@ -95,8 +90,7 @@ class GraphSessionInfo extends GraphNode
95
  *
96
  * @return string|null
97
  */
98
- public function getUserId()
99
- {
100
  return $this->getField('user_id');
101
  }
102
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\GraphNodes;
26
 
27
  /**
29
  *
30
  * @package Facebook
31
  */
32
+ class GraphSessionInfo extends GraphNode {
33
+
34
  /**
35
  * Returns the application id the token was issued for.
36
  *
37
  * @return string|null
38
  */
39
+ public function getAppId() {
 
40
  return $this->getField('app_id');
41
  }
42
 
45
  *
46
  * @return string|null
47
  */
48
+ public function getApplication() {
 
49
  return $this->getField('application');
50
  }
51
 
54
  *
55
  * @return \DateTime|null
56
  */
57
+ public function getExpiresAt() {
 
58
  return $this->getField('expires_at');
59
  }
60
 
63
  *
64
  * @return boolean
65
  */
66
+ public function getIsValid() {
 
67
  return $this->getField('is_valid');
68
  }
69
 
72
  *
73
  * @return \DateTime|null
74
  */
75
+ public function getIssuedAt() {
 
76
  return $this->getField('issued_at');
77
  }
78
 
81
  *
82
  * @return array
83
  */
84
+ public function getScopes() {
 
85
  return $this->getField('scopes');
86
  }
87
 
90
  *
91
  * @return string|null
92
  */
93
+ public function getUserId() {
 
94
  return $this->getField('user_id');
95
  }
96
  }
{Facebook → providers/facebook/compat/Facebook}/GraphNodes/GraphUser.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\GraphNodes;
25
 
26
  /**
@@ -28,16 +29,16 @@ namespace Facebook\GraphNodes;
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
  /**
@@ -45,8 +46,7 @@ class GraphUser extends GraphNode
45
  *
46
  * @return string|null
47
  */
48
- public function getId()
49
- {
50
  return $this->getField('id');
51
  }
52
 
@@ -55,8 +55,7 @@ class GraphUser extends GraphNode
55
  *
56
  * @return string|null
57
  */
58
- public function getName()
59
- {
60
  return $this->getField('name');
61
  }
62
 
@@ -65,8 +64,7 @@ class GraphUser extends GraphNode
65
  *
66
  * @return string|null
67
  */
68
- public function getFirstName()
69
- {
70
  return $this->getField('first_name');
71
  }
72
 
@@ -75,8 +73,7 @@ class GraphUser extends GraphNode
75
  *
76
  * @return string|null
77
  */
78
- public function getMiddleName()
79
- {
80
  return $this->getField('middle_name');
81
  }
82
 
@@ -85,8 +82,7 @@ class GraphUser extends GraphNode
85
  *
86
  * @return string|null
87
  */
88
- public function getLastName()
89
- {
90
  return $this->getField('last_name');
91
  }
92
 
@@ -95,8 +91,7 @@ class GraphUser extends GraphNode
95
  *
96
  * @return string|null
97
  */
98
- public function getEmail()
99
- {
100
  return $this->getField('email');
101
  }
102
 
@@ -105,8 +100,7 @@ class GraphUser extends GraphNode
105
  *
106
  * @return string|null
107
  */
108
- public function getGender()
109
- {
110
  return $this->getField('gender');
111
  }
112
 
@@ -115,8 +109,7 @@ class GraphUser extends GraphNode
115
  *
116
  * @return string|null
117
  */
118
- public function getLink()
119
- {
120
  return $this->getField('link');
121
  }
122
 
@@ -125,8 +118,7 @@ class GraphUser extends GraphNode
125
  *
126
  * @return \DateTime|null
127
  */
128
- public function getBirthday()
129
- {
130
  return $this->getField('birthday');
131
  }
132
 
@@ -135,8 +127,7 @@ class GraphUser extends GraphNode
135
  *
136
  * @return GraphPage|null
137
  */
138
- public function getLocation()
139
- {
140
  return $this->getField('location');
141
  }
142
 
@@ -145,8 +136,7 @@ class GraphUser extends GraphNode
145
  *
146
  * @return GraphPage|null
147
  */
148
- public function getHometown()
149
- {
150
  return $this->getField('hometown');
151
  }
152
 
@@ -155,8 +145,7 @@ class GraphUser extends GraphNode
155
  *
156
  * @return GraphUser|null
157
  */
158
- public function getSignificantOther()
159
- {
160
  return $this->getField('significant_other');
161
  }
162
 
@@ -165,8 +154,7 @@ class GraphUser extends GraphNode
165
  *
166
  * @return GraphPicture|null
167
  */
168
- public function getPicture()
169
- {
170
  return $this->getField('picture');
171
  }
172
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\GraphNodes;
26
 
27
  /**
29
  *
30
  * @package Facebook
31
  */
32
+ class GraphUser extends GraphNode {
33
+
34
  /**
35
  * @var array Maps object key names to Graph object types.
36
  */
37
  protected static $graphObjectMap = [
38
+ 'hometown' => '\Facebook\GraphNodes\GraphPage',
39
+ 'location' => '\Facebook\GraphNodes\GraphPage',
40
  'significant_other' => '\Facebook\GraphNodes\GraphUser',
41
+ 'picture' => '\Facebook\GraphNodes\GraphPicture',
42
  ];
43
 
44
  /**
46
  *
47
  * @return string|null
48
  */
49
+ public function getId() {
 
50
  return $this->getField('id');
51
  }
52
 
55
  *
56
  * @return string|null
57
  */
58
+ public function getName() {
 
59
  return $this->getField('name');
60
  }
61
 
64
  *
65
  * @return string|null
66
  */
67
+ public function getFirstName() {
 
68
  return $this->getField('first_name');
69
  }
70
 
73
  *
74
  * @return string|null
75
  */
76
+ public function getMiddleName() {
 
77
  return $this->getField('middle_name');
78
  }
79
 
82
  *
83
  * @return string|null
84
  */
85
+ public function getLastName() {
 
86
  return $this->getField('last_name');
87
  }
88
 
91
  *
92
  * @return string|null
93
  */
94
+ public function getEmail() {
 
95
  return $this->getField('email');
96
  }
97
 
100
  *
101
  * @return string|null
102
  */
103
+ public function getGender() {
 
104
  return $this->getField('gender');
105
  }
106
 
109
  *
110
  * @return string|null
111
  */
112
+ public function getLink() {
 
113
  return $this->getField('link');
114
  }
115
 
118
  *
119
  * @return \DateTime|null
120
  */
121
+ public function getBirthday() {
 
122
  return $this->getField('birthday');
123
  }
124
 
127
  *
128
  * @return GraphPage|null
129
  */
130
+ public function getLocation() {
 
131
  return $this->getField('location');
132
  }
133
 
136
  *
137
  * @return GraphPage|null
138
  */
139
+ public function getHometown() {
 
140
  return $this->getField('hometown');
141
  }
142
 
145
  *
146
  * @return GraphUser|null
147
  */
148
+ public function getSignificantOther() {
 
149
  return $this->getField('significant_other');
150
  }
151
 
154
  *
155
  * @return GraphPicture|null
156
  */
157
+ public function getPicture() {
 
158
  return $this->getField('picture');
159
  }
160
  }
{Facebook → providers/facebook/compat/Facebook}/Helpers/FacebookCanvasHelper.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\Helpers;
25
 
26
  /**
@@ -28,15 +29,14 @@ namespace Facebook\Helpers;
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
 
@@ -45,8 +45,7 @@ class FacebookCanvasHelper extends FacebookSignedRequestFromInputHelper
45
  *
46
  * @return string|null
47
  */
48
- public function getRawSignedRequest()
49
- {
50
  return $this->getRawSignedRequestFromPost() ?: null;
51
  }
52
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\Helpers;
26
 
27
  /**
29
  *
30
  * @package Facebook
31
  */
32
+ class FacebookCanvasHelper extends FacebookSignedRequestFromInputHelper {
33
+
34
  /**
35
  * Returns the app data value.
36
  *
37
  * @return mixed|null
38
  */
39
+ public function getAppData() {
 
40
  return $this->signedRequest ? $this->signedRequest->get('app_data') : null;
41
  }
42
 
45
  *
46
  * @return string|null
47
  */
48
+ public function getRawSignedRequest() {
 
49
  return $this->getRawSignedRequestFromPost() ?: null;
50
  }
51
  }
{Facebook → providers/facebook/compat/Facebook}/Helpers/FacebookJavaScriptHelper.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\Helpers;
25
 
26
  /**
@@ -28,15 +29,14 @@ namespace Facebook\Helpers;
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
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\Helpers;
26
 
27
  /**
29
  *
30
  * @package Facebook
31
  */
32
+ class FacebookJavaScriptHelper extends FacebookSignedRequestFromInputHelper {
33
+
34
  /**
35
  * Get raw signed request from the cookie.
36
  *
37
  * @return string|null
38
  */
39
+ public function getRawSignedRequest() {
 
40
  return $this->getRawSignedRequestFromCookie();
41
  }
42
  }
{Facebook → providers/facebook/compat/Facebook}/Helpers/FacebookPageTabHelper.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\Helpers;
25
 
26
  use Facebook\FacebookApp;
@@ -31,8 +32,8 @@ use Facebook\FacebookClient;
31
  *
32
  * @package Facebook
33
  */
34
- class FacebookPageTabHelper extends FacebookCanvasHelper
35
- {
36
  /**
37
  * @var array|null
38
  */
@@ -45,8 +46,7 @@ class FacebookPageTabHelper extends FacebookCanvasHelper
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) {
@@ -64,8 +64,7 @@ class FacebookPageTabHelper extends FacebookCanvasHelper
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
  }
@@ -78,8 +77,7 @@ class FacebookPageTabHelper extends FacebookCanvasHelper
78
  *
79
  * @return boolean
80
  */
81
- public function isAdmin()
82
- {
83
  return $this->getPageData('admin') === true;
84
  }
85
 
@@ -88,8 +86,7 @@ class FacebookPageTabHelper extends FacebookCanvasHelper
88
  *
89
  * @return string|null
90
  */
91
- public function getPageId()
92
- {
93
  return $this->getPageData('id');
94
  }
95
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\Helpers;
26
 
27
  use Facebook\FacebookApp;
32
  *
33
  * @package Facebook
34
  */
35
+ class FacebookPageTabHelper extends FacebookCanvasHelper {
36
+
37
  /**
38
  * @var array|null
39
  */
46
  * @param FacebookClient $client The client to make HTTP requests.
47
  * @param string|null $graphVersion The version of Graph to use.
48
  */
49
+ public function __construct(FacebookApp $app, FacebookClient $client, $graphVersion = null) {
 
50
  parent::__construct($app, $client, $graphVersion);
51
 
52
  if (!$this->signedRequest) {
64
  *
65
  * @return mixed|null
66
  */
67
+ public function getPageData($key, $default = null) {
 
68
  if (isset($this->pageData[$key])) {
69
  return $this->pageData[$key];
70
  }
77
  *
78
  * @return boolean
79
  */
80
+ public function isAdmin() {
 
81
  return $this->getPageData('admin') === true;
82
  }
83
 
86
  *
87
  * @return string|null
88
  */
89
+ public function getPageId() {
 
90
  return $this->getPageData('id');
91
  }
92
  }
{Facebook → providers/facebook/compat/Facebook}/Helpers/FacebookRedirectLoginHelper.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\Helpers;
25
 
26
  use Facebook\Authentication\AccessToken;
@@ -39,8 +40,8 @@ use Facebook\Url\UrlDetectionInterface;
39
  *
40
  * @package Facebook
41
  */
42
- class FacebookRedirectLoginHelper
43
- {
44
  /**
45
  * @const int The length of CSRF string to validate the login link.
46
  */
@@ -72,11 +73,10 @@ class FacebookRedirectLoginHelper
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
 
@@ -85,8 +85,7 @@ class FacebookRedirectLoginHelper
85
  *
86
  * @return PersistentDataInterface
87
  */
88
- public function getPersistentDataHandler()
89
- {
90
  return $this->persistentDataHandler;
91
  }
92
 
@@ -95,8 +94,7 @@ class FacebookRedirectLoginHelper
95
  *
96
  * @return UrlDetectionInterface
97
  */
98
- public function getUrlDetectionHandler()
99
- {
100
  return $this->urlDetectionHandler;
101
  }
102
 
@@ -105,8 +103,7 @@ class FacebookRedirectLoginHelper
105
  *
106
  * @return PseudoRandomStringGeneratorInterface
107
  */
108
- public function getPseudoRandomStringGenerator()
109
- {
110
  return $this->pseudoRandomStringGenerator;
111
  }
112
 
@@ -120,8 +117,7 @@ class FacebookRedirectLoginHelper
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
 
@@ -137,8 +133,7 @@ class FacebookRedirectLoginHelper
137
  *
138
  * @return string
139
  */
140
- public function getLoginUrl($redirectUrl, array $scope = [], $separator = '&')
141
- {
142
  return $this->makeUrl($redirectUrl, $scope, [], $separator);
143
  }
144
 
@@ -153,8 +148,7 @@ class FacebookRedirectLoginHelper
153
  *
154
  * @throws FacebookSDKException
155
  */
156
- public function getLogoutUrl($accessToken, $next, $separator = '&')
157
- {
158
  if (!$accessToken instanceof AccessToken) {
159
  $accessToken = new AccessToken($accessToken);
160
  }
@@ -164,7 +158,7 @@ class FacebookRedirectLoginHelper
164
  }
165
 
166
  $params = [
167
- 'next' => $next,
168
  'access_token' => $accessToken->getValue(),
169
  ];
170
 
@@ -180,8 +174,7 @@ class FacebookRedirectLoginHelper
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);
@@ -196,8 +189,7 @@ class FacebookRedirectLoginHelper
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);
@@ -212,8 +204,7 @@ class FacebookRedirectLoginHelper
212
  *
213
  * @throws FacebookSDKException
214
  */
215
- public function getAccessToken($redirectUrl = null)
216
- {
217
  if (!$code = $this->getCode()) {
218
  return null;
219
  }
@@ -233,8 +224,7 @@ class FacebookRedirectLoginHelper
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.');
@@ -254,8 +244,7 @@ class FacebookRedirectLoginHelper
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
 
@@ -264,8 +253,7 @@ class FacebookRedirectLoginHelper
264
  *
265
  * @return string|null
266
  */
267
- protected function getCode()
268
- {
269
  return $this->getInput('code');
270
  }
271
 
@@ -274,8 +262,7 @@ class FacebookRedirectLoginHelper
274
  *
275
  * @return string|null
276
  */
277
- protected function getState()
278
- {
279
  return $this->getInput('state');
280
  }
281
 
@@ -284,8 +271,7 @@ class FacebookRedirectLoginHelper
284
  *
285
  * @return string|null
286
  */
287
- public function getErrorCode()
288
- {
289
  return $this->getInput('error_code');
290
  }
291
 
@@ -294,8 +280,7 @@ class FacebookRedirectLoginHelper
294
  *
295
  * @return string|null
296
  */
297
- public function getError()
298
- {
299
  return $this->getInput('error');
300
  }
301
 
@@ -304,8 +289,7 @@ class FacebookRedirectLoginHelper
304
  *
305
  * @return string|null
306
  */
307
- public function getErrorReason()
308
- {
309
  return $this->getInput('error_reason');
310
  }
311
 
@@ -314,8 +298,7 @@ class FacebookRedirectLoginHelper
314
  *
315
  * @return string|null
316
  */
317
- public function getErrorDescription()
318
- {
319
  return $this->getInput('error_description');
320
  }
321
 
@@ -326,8 +309,7 @@ class FacebookRedirectLoginHelper
326
  *
327
  * @return string|null
328
  */
329
- private function getInput($key)
330
- {
331
  return isset($_GET[$key]) ? $_GET[$key] : null;
332
  }
333
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\Helpers;
26
 
27
  use Facebook\Authentication\AccessToken;
40
  *
41
  * @package Facebook
42
  */
43
+ class FacebookRedirectLoginHelper {
44
+
45
  /**
46
  * @const int The length of CSRF string to validate the login link.
47
  */
73
  * @param UrlDetectionInterface|null $urlHandler The URL detection handler.
74
  * @param PseudoRandomStringGeneratorInterface|null $prsg The cryptographically secure pseudo-random string generator.
75
  */
76
+ public function __construct(OAuth2Client $oAuth2Client, PersistentDataInterface $persistentDataHandler = null, UrlDetectionInterface $urlHandler = null, PseudoRandomStringGeneratorInterface $prsg = null) {
77
+ $this->oAuth2Client = $oAuth2Client;
78
+ $this->persistentDataHandler = $persistentDataHandler ?: new FacebookSessionPersistentDataHandler();
79
+ $this->urlDetectionHandler = $urlHandler ?: new FacebookUrlDetectionHandler();
 
80
  $this->pseudoRandomStringGenerator = PseudoRandomStringGeneratorFactory::createPseudoRandomStringGenerator($prsg);
81
  }
82
 
85
  *
86
  * @return PersistentDataInterface
87
  */
88
+ public function getPersistentDataHandler() {
 
89
  return $this->persistentDataHandler;
90
  }
91
 
94
  *
95
  * @return UrlDetectionInterface
96
  */
97
+ public function getUrlDetectionHandler() {
 
98
  return $this->urlDetectionHandler;
99
  }
100
 
103
  *
104
  * @return PseudoRandomStringGeneratorInterface
105
  */
106
+ public function getPseudoRandomStringGenerator() {
 
107
  return $this->pseudoRandomStringGenerator;
108
  }
109
 
117
  *
118
  * @return string
119
  */
120
+ private function makeUrl($redirectUrl, array $scope, array $params = [], $separator = '&') {
 
121
  $state = $this->persistentDataHandler->get('state') ?: $this->pseudoRandomStringGenerator->getPseudoRandomString(static::CSRF_LENGTH);
122
  $this->persistentDataHandler->set('state', $state);
123
 
133
  *
134
  * @return string
135
  */
136
+ public function getLoginUrl($redirectUrl, array $scope = [], $separator = '&') {
 
137
  return $this->makeUrl($redirectUrl, $scope, [], $separator);
138
  }
139
 
148
  *
149
  * @throws FacebookSDKException
150
  */
151
+ public function getLogoutUrl($accessToken, $next, $separator = '&') {
 
152
  if (!$accessToken instanceof AccessToken) {
153
  $accessToken = new AccessToken($accessToken);
154
  }
158
  }
159
 
160
  $params = [
161
+ 'next' => $next,
162
  'access_token' => $accessToken->getValue(),
163
  ];
164
 
174
  *
175
  * @return string
176
  */
177
+ public function getReRequestUrl($redirectUrl, array $scope = [], $separator = '&') {
 
178
  $params = ['auth_type' => 'rerequest'];
179
 
180
  return $this->makeUrl($redirectUrl, $scope, $params, $separator);
189
  *
190
  * @return string
191
  */
192
+ public function getReAuthenticationUrl($redirectUrl, array $scope = [], $separator = '&') {
 
193
  $params = ['auth_type' => 'reauthenticate'];
194
 
195
  return $this->makeUrl($redirectUrl, $scope, $params, $separator);
204
  *
205
  * @throws FacebookSDKException
206
  */
207
+ public function getAccessToken($redirectUrl = null) {
 
208
  if (!$code = $this->getCode()) {
209
  return null;
210
  }
224
  *
225
  * @throws FacebookSDKException
226
  */
227
+ protected function validateCsrf() {
 
228
  $state = $this->getState();
229
  if (!$state) {
230
  throw new FacebookSDKException('Cross-site request forgery validation failed. Required GET param "state" missing.');
244
  /**
245
  * Resets the CSRF so that it doesn't get reused.
246
  */
247
+ private function resetCsrf() {
 
248
  $this->persistentDataHandler->set('state', null);
249
  }
250
 
253
  *
254
  * @return string|null
255
  */
256
+ protected function getCode() {
 
257
  return $this->getInput('code');
258
  }
259
 
262
  *
263
  * @return string|null
264
  */
265
+ protected function getState() {
 
266
  return $this->getInput('state');
267
  }
268
 
271
  *
272
  * @return string|null
273
  */
274
+ public function getErrorCode() {
 
275
  return $this->getInput('error_code');
276
  }
277
 
280
  *
281
  * @return string|null
282
  */
283
+ public function getError() {
 
284
  return $this->getInput('error');
285
  }
286
 
289
  *
290
  * @return string|null
291
  */
292
+ public function getErrorReason() {
 
293
  return $this->getInput('error_reason');
294
  }
295
 
298
  *
299
  * @return string|null
300
  */
301
+ public function getErrorDescription() {
 
302
  return $this->getInput('error_description');
303
  }
304
 
309
  *
310
  * @return string|null
311
  */
312
+ private function getInput($key) {
 
313
  return isset($_GET[$key]) ? $_GET[$key] : null;
314
  }
315
  }
{Facebook → providers/facebook/compat/Facebook}/Helpers/FacebookSignedRequestFromInputHelper.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\Helpers;
25
 
26
  use Facebook\Facebook;
@@ -35,8 +36,8 @@ use Facebook\Authentication\OAuth2Client;
35
  *
36
  * @package Facebook
37
  */
38
- abstract class FacebookSignedRequestFromInputHelper
39
- {
40
  /**
41
  * @var SignedRequest|null The SignedRequest entity.
42
  */
@@ -59,10 +60,9 @@ abstract class FacebookSignedRequestFromInputHelper
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();
@@ -73,8 +73,7 @@ abstract class FacebookSignedRequestFromInputHelper
73
  *
74
  * @param string|null
75
  */
76
- public function instantiateSignedRequest($rawSignedRequest = null)
77
- {
78
  $rawSignedRequest = $rawSignedRequest ?: $this->getRawSignedRequest();
79
 
80
  if (!$rawSignedRequest) {
@@ -91,10 +90,9 @@ abstract class FacebookSignedRequestFromInputHelper
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) {
@@ -114,8 +112,7 @@ abstract class FacebookSignedRequestFromInputHelper
114
  *
115
  * @return SignedRequest|null
116
  */
117
- public function getSignedRequest()
118
- {
119
  return $this->signedRequest;
120
  }
121
 
@@ -124,8 +121,7 @@ abstract class FacebookSignedRequestFromInputHelper
124
  *
125
  * @return string|null
126
  */
127
- public function getUserId()
128
- {
129
  return $this->signedRequest ? $this->signedRequest->getUserId() : null;
130
  }
131
 
@@ -141,8 +137,7 @@ abstract class FacebookSignedRequestFromInputHelper
141
  *
142
  * @return string|null
143
  */
144
- public function getRawSignedRequestFromPost()
145
- {
146
  if (isset($_POST['signed_request'])) {
147
  return $_POST['signed_request'];
148
  }
@@ -155,8 +150,7 @@ abstract class FacebookSignedRequestFromInputHelper
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
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\Helpers;
26
 
27
  use Facebook\Facebook;
36
  *
37
  * @package Facebook
38
  */
39
+ abstract class FacebookSignedRequestFromInputHelper {
40
+
41
  /**
42
  * @var SignedRequest|null The SignedRequest entity.
43
  */
60
  * @param FacebookClient $client The client to make HTTP requests.
61
  * @param string|null $graphVersion The version of Graph to use.
62
  */
63
+ public function __construct(FacebookApp $app, FacebookClient $client, $graphVersion = null) {
64
+ $this->app = $app;
65
+ $graphVersion = $graphVersion ?: Facebook::DEFAULT_GRAPH_VERSION;
 
66
  $this->oAuth2Client = new OAuth2Client($this->app, $client, $graphVersion);
67
 
68
  $this->instantiateSignedRequest();
73
  *
74
  * @param string|null
75
  */
76
+ public function instantiateSignedRequest($rawSignedRequest = null) {
 
77
  $rawSignedRequest = $rawSignedRequest ?: $this->getRawSignedRequest();
78
 
79
  if (!$rawSignedRequest) {
90
  *
91
  * @throws \Facebook\Exceptions\FacebookSDKException
92
  */
93
+ public function getAccessToken() {
 
94
  if ($this->signedRequest && $this->signedRequest->hasOAuthData()) {
95
+ $code = $this->signedRequest->get('code');
96
  $accessToken = $this->signedRequest->get('oauth_token');
97
 
98
  if ($code && !$accessToken) {
112
  *
113
  * @return SignedRequest|null
114
  */
115
+ public function getSignedRequest() {
 
116
  return $this->signedRequest;
117
  }
118
 
121
  *
122
  * @return string|null
123
  */
124
+ public function getUserId() {
 
125
  return $this->signedRequest ? $this->signedRequest->getUserId() : null;
126
  }
127
 
137
  *
138
  * @return string|null
139
  */
140
+ public function getRawSignedRequestFromPost() {
 
141
  if (isset($_POST['signed_request'])) {
142
  return $_POST['signed_request'];
143
  }
150
  *
151
  * @return string|null
152
  */
153
+ public function getRawSignedRequestFromCookie() {
 
154
  if (isset($_COOKIE['fbsr_' . $this->app->getId()])) {
155
  return $_COOKIE['fbsr_' . $this->app->getId()];
156
  }
{Facebook → providers/facebook/compat/Facebook}/Http/GraphRawResponse.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\Http;
25
 
26
  /**
@@ -28,8 +29,8 @@ namespace Facebook\Http;
28
  *
29
  * @package Facebook
30
  */
31
- class GraphRawResponse
32
- {
33
  /**
34
  * @var array The response headers in the form of an associative array.
35
  */
@@ -52,8 +53,7 @@ class GraphRawResponse
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
  }
@@ -72,8 +72,7 @@ class GraphRawResponse
72
  *
73
  * @return array
74
  */
75
- public function getHeaders()
76
- {
77
  return $this->headers;
78
  }
79
 
@@ -82,8 +81,7 @@ class GraphRawResponse
82
  *
83
  * @return string
84
  */
85
- public function getBody()
86
- {
87
  return $this->body;
88
  }
89
 
@@ -92,8 +90,7 @@ class GraphRawResponse
92
  *
93
  * @return int
94
  */
95
- public function getHttpResponseCode()
96
- {
97
  return $this->httpResponseCode;
98
  }
99
 
@@ -102,8 +99,7 @@ class GraphRawResponse
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
  }
@@ -113,8 +109,7 @@ class GraphRawResponse
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
 
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\Http;
26
 
27
  /**
29
  *
30
  * @package Facebook
31
  */
32
+ class GraphRawResponse {
33
+
34
  /**
35
  * @var array The response headers in the form of an associative array.
36
  */
53
  * @param string $body The raw response body.
54
  * @param int $httpStatusCode The HTTP response code (if sending headers as parsed array).
55
  */
56
+ public function __construct($headers, $body, $httpStatusCode = null) {
 
57
  if (is_numeric($httpStatusCode)) {
58
  $this->httpResponseCode = (int)$httpStatusCode;
59
  }
72
  *
73
  * @return array
74
  */
75
+ public function getHeaders() {
 
76
  return $this->headers;
77
  }
78
 
81
  *
82
  * @return string
83
  */
84
+ public function getBody() {
 
85
  return $this->body;
86
  }
87
 
90
  *
91
  * @return int
92
  */
93
+ public function getHttpResponseCode() {
 
94
  return $this->httpResponseCode;
95
  }
96
 
99
  *
100
  * @param string $rawResponseHeader
101
  */
102
+ public function setHttpResponseCodeFromHeader($rawResponseHeader) {
 
103
  preg_match('|HTTP/\d\.\d\s+(\d+)\s+.*|', $rawResponseHeader, $match);
104
  $this->httpResponseCode = (int)$match[1];
105
  }
109
  *
110
  * @param string $rawHeaders The raw headers from the response.
111
  */
112
+ protected function setHeadersFromString($rawHeaders) {
 
113
  // Normalize line breaks
114
  $rawHeaders = str_replace("\r\n", "\n", $rawHeaders);
115
 
{Facebook → providers/facebook/compat/Facebook}/Http/RequestBodyInterface.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\Http;
25
 
26
  /**
@@ -28,8 +29,8 @@ namespace Facebook\Http;
28
  *
29
  * @package Facebook
30
  */
31
- interface RequestBodyInterface
32
- {
33
  /**
34
  * Get the body of the request to send to Graph.
35
  *
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\Http;
26
 
27
  /**
29
  *
30
  * @package Facebook
31
  */
32
+ interface RequestBodyInterface {
33
+
34
  /**
35
  * Get the body of the request to send to Graph.
36
  *
{Facebook → providers/facebook/compat/Facebook}/Http/RequestBodyMultipart.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\Http;
25
 
26
  use Facebook\FileUpload\FacebookFile;
@@ -32,10 +33,10 @@ use Facebook\FileUpload\FacebookFile;
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
  */
@@ -56,18 +57,16 @@ class RequestBodyMultipart implements RequestBodyInterface
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
@@ -92,8 +91,7 @@ class RequestBodyMultipart implements RequestBodyInterface
92
  *
93
  * @return string
94
  */
95
- public function getBoundary()
96
- {
97
  return $this->boundary;
98
  }
99
 
@@ -105,16 +103,8 @@ class RequestBodyMultipart implements RequestBodyInterface
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
  /**
@@ -125,14 +115,8 @@ class RequestBodyMultipart implements RequestBodyInterface
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
  /**
@@ -142,9 +126,8 @@ class RequestBodyMultipart implements RequestBodyInterface
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
 
@@ -163,8 +146,7 @@ class RequestBodyMultipart implements RequestBodyInterface
163
  *
164
  * @return string
165
  */
166
- protected function getFileHeaders(FacebookFile $file)
167
- {
168
  return "\r\nContent-Type: {$file->getMimetype()}";
169
  }
170
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\Http;
26
 
27
  use Facebook\FileUpload\FacebookFile;
33
  *
34
  * @package Facebook
35
  *
36
+ * @see https://github.com/guzzle/guzzle/blob/master/src/Post/MultipartBody.php
37
  */
38
+ class RequestBodyMultipart implements RequestBodyInterface {
39
+
40
  /**
41
  * @var string The boundary.
42
  */
57
  * @param array $files The files to send with this request.
58
  * @param string $boundary Provide a specific boundary.
59
  */
60
+ public function __construct(array $params = [], array $files = [], $boundary = null) {
61
+ $this->params = $params;
62
+ $this->files = $files;
 
63
  $this->boundary = $boundary ?: uniqid();
64
  }
65
 
66
  /**
67
  * @inheritdoc
68
  */
69
+ public function getBody() {
 
70
  $body = '';
71
 
72
  // Compile normal params
91
  *
92
  * @return string
93
  */
94
+ public function getBoundary() {
 
95
  return $this->boundary;
96
  }
97
 
103
  *
104
  * @return string
105
  */
106
+ private function getFileString($name, FacebookFile $file) {
107
+ return sprintf("--%s\r\nContent-Disposition: form-data; name=\"%s\"; filename=\"%s\"%s\r\n\r\n%s\r\n", $this->boundary, $name, $file->getFileName(), $this->getFileHeaders($file), $file->getContents());
 
 
 
 
 
 
 
 
108
  }
109
 
110
  /**
115
  *
116
  * @return string
117
  */
118
+ private function getParamString($name, $value) {
119
+ return sprintf("--%s\r\nContent-Disposition: form-data; name=\"%s\"\r\n\r\n%s\r\n", $this->boundary, $name, $value);
 
 
 
 
 
 
120
  }
121
 
122
  /**
126
  *
127
  * @return array
128
  */
129
+ private function getNestedParams(array $params) {
130
+ $query = http_build_query($params, null, '&');
 
131
  $params = explode('&', $query);
132
  $result = [];
133
 
146
  *
147
  * @return string
148
  */
149
+ protected function getFileHeaders(FacebookFile $file) {
 
150
  return "\r\nContent-Type: {$file->getMimetype()}";
151
  }
152
  }
{Facebook → providers/facebook/compat/Facebook}/Http/RequestBodyUrlEncoded.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\Http;
25
 
26
  /**
@@ -28,8 +29,8 @@ namespace Facebook\Http;
28
  *
29
  * @package Facebook
30
  */
31
- class RequestBodyUrlEncoded implements RequestBodyInterface
32
- {
33
  /**
34
  * @var array The parameters to send with this request.
35
  */
@@ -40,16 +41,14 @@ class RequestBodyUrlEncoded implements RequestBodyInterface
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
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\Http;
26
 
27
  /**
29
  *
30
  * @package Facebook
31
  */
32
+ class RequestBodyUrlEncoded implements RequestBodyInterface {
33
+
34
  /**
35
  * @var array The parameters to send with this request.
36
  */
41
  *
42
  * @param array $params
43
  */
44
+ public function __construct(array $params) {
 
45
  $this->params = $params;
46
  }
47
 
48
  /**
49
  * @inheritdoc
50
  */
51
+ public function getBody() {
 
52
  return http_build_query($this->params, null, '&');
53
  }
54
  }
{Facebook → providers/facebook/compat/Facebook}/HttpClients/FacebookCurl.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\HttpClients;
25
 
26
  /**
@@ -30,8 +31,7 @@ namespace Facebook\HttpClients;
30
  *
31
  * @package Facebook
32
  */
33
- class FacebookCurl
34
- {
35
 
36
  /**
37
  * @var resource Curl resource instance
@@ -41,8 +41,7 @@ class FacebookCurl
41
  /**
42
  * Make a new curl reference instance
43
  */
44
- public function init()
45
- {
46
  $this->curl = curl_init();
47
  }
48
 
@@ -52,8 +51,7 @@ class FacebookCurl
52
  * @param $key
53
  * @param $value
54
  */
55
- public function setopt($key, $value)
56
- {
57
  curl_setopt($this->curl, $key, $value);
58
  }
59
 
@@ -62,8 +60,7 @@ class FacebookCurl
62
  *
63
  * @param array $options
64
  */
65
- public function setoptArray(array $options)
66
- {
67
  curl_setopt_array($this->curl, $options);
68
  }
69
 
@@ -72,8 +69,7 @@ class FacebookCurl
72
  *
73
  * @return mixed
74
  */
75
- public function exec()
76
- {
77
  return curl_exec($this->curl);
78
  }
79
 
@@ -82,8 +78,7 @@ class FacebookCurl
82
  *
83
  * @return int
84
  */
85
- public function errno()
86
- {
87
  return curl_errno($this->curl);
88
  }
89
 
@@ -92,8 +87,7 @@ class FacebookCurl
92
  *
93
  * @return string
94
  */
95
- public function error()
96
- {
97
  return curl_error($this->curl);
98
  }
99
 
@@ -104,8 +98,7 @@ class FacebookCurl
104
  *
105
  * @return mixed
106
  */
107
- public function getinfo($type)
108
- {
109
  return curl_getinfo($this->curl, $type);
110
  }
111
 
@@ -114,16 +107,14 @@ class FacebookCurl
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
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\HttpClients;
26
 
27
  /**
31
  *
32
  * @package Facebook
33
  */
34
+ class FacebookCurl {
 
35
 
36
  /**
37
  * @var resource Curl resource instance
41
  /**
42
  * Make a new curl reference instance
43
  */
44
+ public function init() {
 
45
  $this->curl = curl_init();
46
  }
47
 
51
  * @param $key
52
  * @param $value
53
  */
54
+ public function setopt($key, $value) {
 
55
  curl_setopt($this->curl, $key, $value);
56
  }
57
 
60
  *
61
  * @param array $options
62
  */
63
+ public function setoptArray(array $options) {
 
64
  curl_setopt_array($this->curl, $options);
65
  }
66
 
69
  *
70
  * @return mixed
71
  */
72
+ public function exec() {
 
73
  return curl_exec($this->curl);
74
  }
75
 
78
  *
79
  * @return int
80
  */
81
+ public function errno() {
 
82
  return curl_errno($this->curl);
83
  }
84
 
87
  *
88
  * @return string
89
  */
90
+ public function error() {
 
91
  return curl_error($this->curl);
92
  }
93
 
98
  *
99
  * @return mixed
100
  */
101
+ public function getinfo($type) {
 
102
  return curl_getinfo($this->curl, $type);
103
  }
104
 
107
  *
108
  * @return array
109
  */
110
+ public function version() {
 
111
  return curl_version();
112
  }
113
 
114
  /**
115
  * Close the resource connection to curl
116
  */
117
+ public function close() {
 
118
  curl_close($this->curl);
119
  }
120
  }
{Facebook → providers/facebook/compat/Facebook}/HttpClients/FacebookCurlHttpClient.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\HttpClients;
25
 
26
  use Facebook\Http\GraphRawResponse;
@@ -31,8 +32,8 @@ use Facebook\Exceptions\FacebookSDKException;
31
  *
32
  * @package Facebook
33
  */
34
- class FacebookCurlHttpClient implements FacebookHttpClientInterface
35
- {
36
  /**
37
  * @var string The client error message
38
  */
@@ -56,16 +57,14 @@ class FacebookCurlHttpClient implements FacebookHttpClientInterface
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
 
@@ -90,19 +89,20 @@ class FacebookCurlHttpClient implements FacebookHttpClientInterface
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") {
@@ -116,16 +116,14 @@ class FacebookCurlHttpClient implements FacebookHttpClientInterface
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
 
@@ -136,8 +134,7 @@ class FacebookCurlHttpClient implements FacebookHttpClientInterface
136
  *
137
  * @return array
138
  */
139
- public function compileRequestHeaders(array $headers)
140
- {
141
  $return = [];
142
 
143
  foreach ($headers as $key => $value) {
@@ -152,12 +149,14 @@ class FacebookCurlHttpClient implements FacebookHttpClientInterface
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
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\HttpClients;
26
 
27
  use Facebook\Http\GraphRawResponse;
32
  *
33
  * @package Facebook
34
  */
35
+ class FacebookCurlHttpClient implements FacebookHttpClientInterface {
36
+
37
  /**
38
  * @var string The client error message
39
  */
57
  /**
58
  * @param FacebookCurl|null Procedural curl as object
59
  */
60
+ public function __construct(FacebookCurl $facebookCurl = null) {
 
61
  $this->facebookCurl = $facebookCurl ?: new FacebookCurl();
62
  }
63
 
64
  /**
65
  * @inheritdoc
66
  */
67
+ public function send($url, $method, $body, array $headers, $timeOut) {
 
68
  $this->openConnection($url, $method, $body, $headers, $timeOut);
69
  $this->sendRequest();
70
 
89
  * @param array $headers The request headers.
90
  * @param int $timeOut The timeout in seconds for the request.
91
  */
92
+ public function openConnection($url, $method, $body, array $headers, $timeOut) {
 
93
  $options = [
94
+ CURLOPT_CUSTOMREQUEST => $method,
95
+ CURLOPT_HTTPHEADER => $this->compileRequestHeaders($headers),
96
+ CURLOPT_URL => $url,
97
  CURLOPT_CONNECTTIMEOUT => 10,
98
+ CURLOPT_TIMEOUT => $timeOut,
99
+ CURLOPT_RETURNTRANSFER => true,
100
+ // Follow 301 redirects
101
+ CURLOPT_HEADER => true,
102
+ // 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") {
116
  /**
117
  * Closes an existing curl connection
118
  */
119
+ public function closeConnection() {
 
120
  $this->facebookCurl->close();
121
  }
122
 
123
  /**
124
  * Send the request and get the raw response from curl
125
  */
126
+ public function sendRequest() {
 
127
  $this->rawResponse = $this->facebookCurl->exec();
128
  }
129
 
134
  *
135
  * @return array
136
  */
137
+ public function compileRequestHeaders(array $headers) {
 
138
  $return = [];
139
 
140
  foreach ($headers as $key => $value) {
149
  *
150
  * @return array
151
  */
152
+ public function extractResponseHeadersAndBody() {
153
+ $parts = explode("\r\n\r\n", $this->rawResponse);
154
+ $rawBody = array_pop($parts);
 
155
  $rawHeaders = implode("\r\n\r\n", $parts);
156
 
157
+ return [
158
+ trim($rawHeaders),
159
+ trim($rawBody)
160
+ ];
161
  }
162
  }
{Facebook → providers/facebook/compat/Facebook}/HttpClients/FacebookGuzzleHttpClient.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\HttpClients;
25
 
26
  use Facebook\Http\GraphRawResponse;
@@ -31,8 +32,8 @@ 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
  */
@@ -41,22 +42,20 @@ class FacebookGuzzleHttpClient implements FacebookHttpClientInterface
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
 
@@ -70,8 +69,8 @@ class FacebookGuzzleHttpClient implements FacebookHttpClientInterface
70
  }
71
  }
72
 
73
- $rawHeaders = $this->getHeadersAsString($rawResponse);
74
- $rawBody = $rawResponse->getBody();
75
  $httpStatusCode = $rawResponse->getStatusCode();
76
 
77
  return new GraphRawResponse($rawHeaders, $rawBody, $httpStatusCode);
@@ -84,9 +83,8 @@ class FacebookGuzzleHttpClient implements FacebookHttpClientInterface
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);
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\HttpClients;
26
 
27
  use Facebook\Http\GraphRawResponse;
32
  use GuzzleHttp\Ring\Exception\RingException;
33
  use GuzzleHttp\Exception\RequestException;
34
 
35
+ class FacebookGuzzleHttpClient implements FacebookHttpClientInterface {
36
+
37
  /**
38
  * @var \GuzzleHttp\Client The Guzzle client.
39
  */
42
  /**
43
  * @param \GuzzleHttp\Client|null The Guzzle client.
44
  */
45
+ public function __construct(Client $guzzleClient = null) {
 
46
  $this->guzzleClient = $guzzleClient ?: new Client();
47
  }
48
 
49
  /**
50
  * @inheritdoc
51
  */
52
+ public function send($url, $method, $body, array $headers, $timeOut) {
 
53
  $options = [
54
+ 'headers' => $headers,
55
+ 'body' => $body,
56
+ 'timeout' => $timeOut,
57
  'connect_timeout' => 10,
58
+ 'verify' => __DIR__ . '/certs/DigiCertHighAssuranceEVRootCA.pem',
59
  ];
60
  $request = $this->guzzleClient->createRequest($method, $url, $options);
61
 
69
  }
70
  }
71
 
72
+ $rawHeaders = $this->getHeadersAsString($rawResponse);
73
+ $rawBody = $rawResponse->getBody();
74
  $httpStatusCode = $rawResponse->getStatusCode();
75
 
76
  return new GraphRawResponse($rawHeaders, $rawBody, $httpStatusCode);
83
  *
84
  * @return string
85
  */
86
+ public function getHeadersAsString(ResponseInterface $response) {
87
+ $headers = $response->getHeaders();
 
88
  $rawHeaders = [];
89
  foreach ($headers as $name => $values) {
90
  $rawHeaders[] = $name . ": " . implode(", ", $values);
{Facebook → providers/facebook/compat/Facebook}/HttpClients/FacebookHttpClientInterface.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\HttpClients;
25
 
26
  /**
@@ -28,8 +29,8 @@ namespace Facebook\HttpClients;
28
  *
29
  * @package Facebook
30
  */
31
- interface FacebookHttpClientInterface
32
- {
33
  /**
34
  * Sends a request to the server and returns the raw response.
35
  *
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\HttpClients;
26
 
27
  /**
29
  *
30
  * @package Facebook
31
  */
32
+ interface FacebookHttpClientInterface {
33
+
34
  /**
35
  * Sends a request to the server and returns the raw response.
36
  *
{Facebook → providers/facebook/compat/Facebook}/HttpClients/FacebookStream.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\HttpClients;
25
 
26
  /**
@@ -31,8 +32,8 @@ namespace Facebook\HttpClients;
31
  *
32
  * @package Facebook
33
  */
34
- class FacebookStream
35
- {
36
  /**
37
  * @var resource Context stream resource instance
38
  */
@@ -48,8 +49,7 @@ class FacebookStream
48
  *
49
  * @param array $options
50
  */
51
- public function streamContextCreate(array $options)
52
- {
53
  $this->stream = stream_context_create($options);
54
  }
55
 
@@ -58,8 +58,7 @@ class FacebookStream
58
  *
59
  * @return array
60
  */
61
- public function getResponseHeaders()
62
- {
63
  return $this->responseHeaders;
64
  }
65
 
@@ -70,9 +69,8 @@ class FacebookStream
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;
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\HttpClients;
26
 
27
  /**
32
  *
33
  * @package Facebook
34
  */
35
+ class FacebookStream {
36
+
37
  /**
38
  * @var resource Context stream resource instance
39
  */
49
  *
50
  * @param array $options
51
  */
52
+ public function streamContextCreate(array $options) {
 
53
  $this->stream = stream_context_create($options);
54
  }
55
 
58
  *
59
  * @return array
60
  */
61
+ public function getResponseHeaders() {
 
62
  return $this->responseHeaders;
63
  }
64
 
69
  *
70
  * @return mixed
71
  */
72
+ public function fileGetContents($url) {
73
+ $rawResponse = file_get_contents($url, false, $this->stream);
 
74
  $this->responseHeaders = $http_response_header ?: [];
75
 
76
  return $rawResponse;
{Facebook → providers/facebook/compat/Facebook}/HttpClients/FacebookStreamHttpClient.php RENAMED
@@ -21,13 +21,14 @@
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
  */
@@ -36,34 +37,33 @@ class FacebookStreamHttpClient implements FacebookHttpClientInterface
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)) {
@@ -82,8 +82,7 @@ class FacebookStreamHttpClient implements FacebookHttpClientInterface
82
  *
83
  * @return string
84
  */
85
- public function compileHeader(array $headers)
86
- {
87
  $header = [];
88
  foreach ($headers as $k => $v) {
89
  $header[] = $k . ': ' . $v;
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\HttpClients;
26
 
27
  use Facebook\Http\GraphRawResponse;
28
  use Facebook\Exceptions\FacebookSDKException;
29
 
30
+ class FacebookStreamHttpClient implements FacebookHttpClientInterface {
31
+
32
  /**
33
  * @var FacebookStream Procedural stream wrapper as object.
34
  */
37
  /**
38
  * @param FacebookStream|null Procedural stream wrapper as object.
39
  */
40
+ public function __construct(FacebookStream $facebookStream = null) {
 
41
  $this->facebookStream = $facebookStream ?: new FacebookStream();
42
  }
43
 
44
  /**
45
  * @inheritdoc
46
  */
47
+ public function send($url, $method, $body, array $headers, $timeOut) {
 
48
  $options = [
49
  'http' => [
50
+ 'method' => $method,
51
+ 'header' => $this->compileHeader($headers),
52
+ 'content' => $body,
53
+ 'timeout' => $timeOut,
54
  'ignore_errors' => true
55
  ],
56
+ 'ssl' => [
57
+ 'verify_peer' => true,
58
+ 'verify_peer_name' => true,
59
+ 'allow_self_signed' => true,
60
+ // 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)) {
82
  *
83
  * @return string
84
  */
85
+ public function compileHeader(array $headers) {
 
86
  $header = [];
87
  foreach ($headers as $k => $v) {
88
  $header[] = $k . ': ' . $v;
{Facebook → providers/facebook/compat/Facebook}/HttpClients/HttpClientsFactory.php RENAMED
@@ -21,16 +21,16 @@
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
 
@@ -44,8 +44,7 @@ class HttpClientsFactory
44
  *
45
  * @return FacebookHttpClientInterface
46
  */
47
- public static function createHttpClient($handler)
48
- {
49
  if (!$handler) {
50
  return self::detectDefaultClient();
51
  }
@@ -84,8 +83,7 @@ class HttpClientsFactory
84
  *
85
  * @return FacebookHttpClientInterface
86
  */
87
- private static function detectDefaultClient()
88
- {
89
  if (extension_loaded('curl')) {
90
  return new FacebookCurlHttpClient();
91
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\HttpClients;
26
 
27
  use GuzzleHttp\Client;
28
  use InvalidArgumentException;
29
  use Exception;
30
 
31
+ class HttpClientsFactory {
32
+
33
+ private function __construct() {
 
34
  // a factory constructor should never be invoked
35
  }
36
 
44
  *
45
  * @return FacebookHttpClientInterface
46
  */
47
+ public static function createHttpClient($handler) {
 
48
  if (!$handler) {
49
  return self::detectDefaultClient();
50
  }
83
  *
84
  * @return FacebookHttpClientInterface
85
  */
86
+ private static function detectDefaultClient() {
 
87
  if (extension_loaded('curl')) {
88
  return new FacebookCurlHttpClient();
89
  }
{Facebook → providers/facebook/compat/Facebook}/HttpClients/certs/DigiCertHighAssuranceEVRootCA.pem RENAMED
File without changes
{Facebook → providers/facebook/compat/Facebook}/PersistentData/FacebookMemoryPersistentDataHandler.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\PersistentData;
25
 
26
  /**
@@ -28,8 +29,8 @@ namespace Facebook\PersistentData;
28
  *
29
  * @package Facebook
30
  */
31
- class FacebookMemoryPersistentDataHandler implements PersistentDataInterface
32
- {
33
  /**
34
  * @var array The session data to keep in memory.
35
  */
@@ -38,16 +39,14 @@ class FacebookMemoryPersistentDataHandler implements PersistentDataInterface
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
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\PersistentData;
26
 
27
  /**
29
  *
30
  * @package Facebook
31
  */
32
+ class FacebookMemoryPersistentDataHandler implements PersistentDataInterface {
33
+
34
  /**
35
  * @var array The session data to keep in memory.
36
  */
39
  /**
40
  * @inheritdoc
41
  */
42
+ public function get($key) {
 
43
  return isset($this->sessionData[$key]) ? $this->sessionData[$key] : null;
44
  }
45
 
46
  /**
47
  * @inheritdoc
48
  */
49
+ public function set($key, $value) {
 
50
  $this->sessionData[$key] = $value;
51
  }
52
  }
{Facebook → providers/facebook/compat/Facebook}/PersistentData/FacebookSessionPersistentDataHandler.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\PersistentData;
25
 
26
  use Facebook\Exceptions\FacebookSDKException;
@@ -30,8 +31,8 @@ use Facebook\Exceptions\FacebookSDKException;
30
  *
31
  * @package Facebook
32
  */
33
- class FacebookSessionPersistentDataHandler implements PersistentDataInterface
34
- {
35
  /**
36
  * @var string Prefix to use for session variables.
37
  */
@@ -44,21 +45,16 @@ class FacebookSessionPersistentDataHandler implements PersistentDataInterface
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
  }
@@ -69,8 +65,7 @@ class FacebookSessionPersistentDataHandler implements PersistentDataInterface
69
  /**
70
  * @inheritdoc
71
  */
72
- public function set($key, $value)
73
- {
74
  $_SESSION[$this->sessionPrefix . $key] = $value;
75
  }
76
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\PersistentData;
26
 
27
  use Facebook\Exceptions\FacebookSDKException;
31
  *
32
  * @package Facebook
33
  */
34
+ class FacebookSessionPersistentDataHandler implements PersistentDataInterface {
35
+
36
  /**
37
  * @var string Prefix to use for session variables.
38
  */
45
  *
46
  * @throws FacebookSDKException
47
  */
48
+ public function __construct($enableSessionCheck = true) {
 
49
  if ($enableSessionCheck && session_status() !== PHP_SESSION_ACTIVE) {
50
+ throw new FacebookSDKException('Sessions are not active. Please make sure session_start() is at the top of your script.', 720);
 
 
 
51
  }
52
  }
53
 
54
  /**
55
  * @inheritdoc
56
  */
57
+ public function get($key) {
 
58
  if (isset($_SESSION[$this->sessionPrefix . $key])) {
59
  return $_SESSION[$this->sessionPrefix . $key];
60
  }
65
  /**
66
  * @inheritdoc
67
  */
68
+ public function set($key, $value) {
 
69
  $_SESSION[$this->sessionPrefix . $key] = $value;
70
  }
71
  }
{Facebook → providers/facebook/compat/Facebook}/PersistentData/FacebookWordPressPersistentDataHandler.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\PersistentData;
25
 
26
  /**
@@ -28,28 +29,25 @@ namespace Facebook\PersistentData;
28
  *
29
  * @package Facebook
30
  */
31
- class FacebookWordPressPersistentDataHandler implements PersistentDataInterface
32
- {
33
 
34
  private $uniqueID;
35
-
36
- public function __construct($id){
37
  $this->uniqueID = $id;
38
  }
39
 
40
  /**
41
  * @inheritdoc
42
  */
43
- public function get($key)
44
- {
45
- return get_site_transient( $this->uniqueID . $key);
46
  }
47
 
48
  /**
49
  * @inheritdoc
50
  */
51
- public function set($key, $value)
52
- {
53
- set_site_transient( $this->uniqueID . $key, $value, 3600);
54
  }
55
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\PersistentData;
26
 
27
  /**
29
  *
30
  * @package Facebook
31
  */
32
+ class FacebookWordPressPersistentDataHandler implements PersistentDataInterface {
 
33
 
34
  private $uniqueID;
35
+
36
+ public function __construct($id) {
37
  $this->uniqueID = $id;
38
  }
39
 
40
  /**
41
  * @inheritdoc
42
  */
43
+ public function get($key) {
44
+ return get_site_transient($this->uniqueID . $key);
 
45
  }
46
 
47
  /**
48
  * @inheritdoc
49
  */
50
+ public function set($key, $value) {
51
+ set_site_transient($this->uniqueID . $key, $value, 3600);
 
52
  }
53
  }
{Facebook → providers/facebook/compat/Facebook}/PersistentData/PersistentDataFactory.php RENAMED
@@ -21,14 +21,14 @@
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
 
@@ -41,12 +41,9 @@ class PersistentDataFactory
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) {
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\PersistentData;
26
 
27
  use InvalidArgumentException;
28
 
29
+ class PersistentDataFactory {
30
+
31
+ private function __construct() {
 
32
  // a factory constructor should never be invoked
33
  }
34
 
41
  *
42
  * @return PersistentDataInterface
43
  */
44
+ public static function createPersistentDataHandler($handler) {
 
45
  if (!$handler) {
46
+ return session_status() === PHP_SESSION_ACTIVE ? new FacebookSessionPersistentDataHandler() : new FacebookMemoryPersistentDataHandler();
 
 
47
  }
48
 
49
  if ($handler instanceof PersistentDataInterface) {
{Facebook → providers/facebook/compat/Facebook}/PersistentData/PersistentDataInterface.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\PersistentData;
25
 
26
  /**
@@ -28,8 +29,8 @@ namespace Facebook\PersistentData;
28
  *
29
  * @package Facebook
30
  */
31
- interface PersistentDataInterface
32
- {
33
  /**
34
  * Get a value from a persistent data store.
35
  *
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\PersistentData;
26
 
27
  /**
29
  *
30
  * @package Facebook
31
  */
32
+ interface PersistentDataInterface {
33
+
34
  /**
35
  * Get a value from a persistent data store.
36
  *
{Facebook → providers/facebook/compat/Facebook}/PseudoRandomString/McryptPseudoRandomStringGenerator.php RENAMED
@@ -21,12 +21,13 @@
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
  /**
@@ -37,30 +38,22 @@ class McryptPseudoRandomStringGenerator implements PseudoRandomStringGeneratorIn
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);
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\PseudoRandomString;
26
 
27
  use Facebook\Exceptions\FacebookSDKException;
28
 
29
+ class McryptPseudoRandomStringGenerator implements PseudoRandomStringGeneratorInterface {
30
+
31
  use PseudoRandomStringGeneratorTrait;
32
 
33
  /**
38
  /**
39
  * @throws FacebookSDKException
40
  */
41
+ public function __construct() {
 
42
  if (!function_exists('mcrypt_create_iv')) {
43
+ throw new FacebookSDKException(static::ERROR_MESSAGE . 'The function mcrypt_create_iv() does not exist.');
 
 
 
44
  }
45
  }
46
 
47
  /**
48
  * @inheritdoc
49
  */
50
+ public function getPseudoRandomString($length) {
 
51
  $this->validateLength($length);
52
 
53
  $binaryString = mcrypt_create_iv($length, MCRYPT_DEV_URANDOM);
54
 
55
  if ($binaryString === false) {
56
+ throw new FacebookSDKException(static::ERROR_MESSAGE . 'mcrypt_create_iv() returned an error.');
 
 
 
57
  }
58
 
59
  return $this->binToHex($binaryString, $length);
{Facebook → providers/facebook/compat/Facebook}/PseudoRandomString/OpenSslPseudoRandomStringGenerator.php RENAMED
@@ -21,12 +21,13 @@
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
  /**
@@ -37,8 +38,7 @@ class OpenSslPseudoRandomStringGenerator implements PseudoRandomStringGeneratorI
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
  }
@@ -47,12 +47,11 @@ class OpenSslPseudoRandomStringGenerator implements PseudoRandomStringGeneratorI
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.');
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\PseudoRandomString;
26
 
27
  use Facebook\Exceptions\FacebookSDKException;
28
 
29
+ class OpenSslPseudoRandomStringGenerator implements PseudoRandomStringGeneratorInterface {
30
+
31
  use PseudoRandomStringGeneratorTrait;
32
 
33
  /**
38
  /**
39
  * @throws FacebookSDKException
40
  */
41
+ public function __construct() {
 
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
  }
47
  /**
48
  * @inheritdoc
49
  */
50
+ public function getPseudoRandomString($length) {
 
51
  $this->validateLength($length);
52
 
53
  $wasCryptographicallyStrong = false;
54
+ $binaryString = openssl_random_pseudo_bytes($length, $wasCryptographicallyStrong);
55
 
56
  if ($binaryString === false) {
57
  throw new FacebookSDKException(static::ERROR_MESSAGE . 'openssl_random_pseudo_bytes() returned an unknown error.');
{Facebook → providers/facebook/compat/Facebook}/PseudoRandomString/PseudoRandomStringGeneratorFactory.php RENAMED
@@ -21,15 +21,15 @@
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
 
@@ -42,8 +42,7 @@ class PseudoRandomStringGeneratorFactory
42
  *
43
  * @return PseudoRandomStringGeneratorInterface
44
  */
45
- public static function createPseudoRandomStringGenerator($generator)
46
- {
47
  if (!$generator) {
48
  return self::detectDefaultPseudoRandomStringGenerator();
49
  }
@@ -75,8 +74,7 @@ class PseudoRandomStringGeneratorFactory
75
  *
76
  * @return PseudoRandomStringGeneratorInterface
77
  */
78
- private static function detectDefaultPseudoRandomStringGenerator()
79
- {
80
  // Check for PHP 7's CSPRNG first to keep mcrypt deprecation messages from appearing in PHP 7.1.
81
  if (function_exists('random_bytes')) {
82
  return new RandomBytesPseudoRandomStringGenerator();
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\PseudoRandomString;
26
 
27
  use Facebook\Exceptions\FacebookSDKException;
28
  use InvalidArgumentException;
29
 
30
+ class PseudoRandomStringGeneratorFactory {
31
+
32
+ private function __construct() {
 
33
  // a factory constructor should never be invoked
34
  }
35
 
42
  *
43
  * @return PseudoRandomStringGeneratorInterface
44
  */
45
+ public static function createPseudoRandomStringGenerator($generator) {
 
46
  if (!$generator) {
47
  return self::detectDefaultPseudoRandomStringGenerator();
48
  }
74
  *
75
  * @return PseudoRandomStringGeneratorInterface
76
  */
77
+ private static function detectDefaultPseudoRandomStringGenerator() {
 
78
  // Check for PHP 7's CSPRNG first to keep mcrypt deprecation messages from appearing in PHP 7.1.
79
  if (function_exists('random_bytes')) {
80
  return new RandomBytesPseudoRandomStringGenerator();
{Facebook → providers/facebook/compat/Facebook}/PseudoRandomString/PseudoRandomStringGeneratorInterface.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\PseudoRandomString;
25
 
26
  /**
@@ -28,8 +29,8 @@ namespace Facebook\PseudoRandomString;
28
  *
29
  * @package Facebook
30
  */
31
- interface PseudoRandomStringGeneratorInterface
32
- {
33
  /**
34
  * Get a cryptographically secure pseudo-random string of arbitrary length.
35
  *
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\PseudoRandomString;
26
 
27
  /**
29
  *
30
  * @package Facebook
31
  */
32
+ interface PseudoRandomStringGeneratorInterface {
33
+
34
  /**
35
  * Get a cryptographically secure pseudo-random string of arbitrary length.
36
  *
{Facebook → providers/facebook/compat/Facebook}/PseudoRandomString/PseudoRandomStringGeneratorTrait.php RENAMED
@@ -21,10 +21,11 @@
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
  *
@@ -32,8 +33,7 @@ trait PseudoRandomStringGeneratorTrait
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
  }
@@ -51,8 +51,7 @@ trait PseudoRandomStringGeneratorTrait
51
  *
52
  * @return string
53
  */
54
- public function binToHex($binaryData, $length)
55
- {
56
  return \substr(\bin2hex($binaryData), 0, $length);
57
  }
58
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\PseudoRandomString;
26
 
27
+ trait PseudoRandomStringGeneratorTrait {
28
+
29
  /**
30
  * Validates the length argument of a random string.
31
  *
33
  *
34
  * @throws \InvalidArgumentException
35
  */
36
+ public function validateLength($length) {
 
37
  if (!is_int($length)) {
38
  throw new \InvalidArgumentException('getPseudoRandomString() expects an integer for the string length');
39
  }
51
  *
52
  * @return string
53
  */
54
+ public function binToHex($binaryData, $length) {
 
55
  return \substr(\bin2hex($binaryData), 0, $length);
56
  }
57
  }
{Facebook → providers/facebook/compat/Facebook}/PseudoRandomString/RandomBytesPseudoRandomStringGenerator.php RENAMED
@@ -21,12 +21,13 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\PseudoRandomString;
25
 
26
  use Facebook\Exceptions\FacebookSDKException;
27
 
28
- class RandomBytesPseudoRandomStringGenerator implements PseudoRandomStringGeneratorInterface
29
- {
30
  use PseudoRandomStringGeneratorTrait;
31
 
32
  /**
@@ -37,21 +38,16 @@ class RandomBytesPseudoRandomStringGenerator implements PseudoRandomStringGenera
37
  /**
38
  * @throws FacebookSDKException
39
  */
40
- public function __construct()
41
- {
42
  if (!function_exists('random_bytes')) {
43
- throw new FacebookSDKException(
44
- static::ERROR_MESSAGE .
45
- 'The function random_bytes() does not exist.'
46
- );
47
  }
48
  }
49
 
50
  /**
51
  * @inheritdoc
52
  */
53
- public function getPseudoRandomString($length)
54
- {
55
  $this->validateLength($length);
56
 
57
  return $this->binToHex(random_bytes($length), $length);
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\PseudoRandomString;
26
 
27
  use Facebook\Exceptions\FacebookSDKException;
28
 
29
+ class RandomBytesPseudoRandomStringGenerator implements PseudoRandomStringGeneratorInterface {
30
+
31
  use PseudoRandomStringGeneratorTrait;
32
 
33
  /**
38
  /**
39
  * @throws FacebookSDKException
40
  */
41
+ public function __construct() {
 
42
  if (!function_exists('random_bytes')) {
43
+ throw new FacebookSDKException(static::ERROR_MESSAGE . 'The function random_bytes() does not exist.');
 
 
 
44
  }
45
  }
46
 
47
  /**
48
  * @inheritdoc
49
  */
50
+ public function getPseudoRandomString($length) {
 
51
  $this->validateLength($length);
52
 
53
  return $this->binToHex(random_bytes($length), $length);
{Facebook → providers/facebook/compat/Facebook}/PseudoRandomString/UrandomPseudoRandomStringGenerator.php RENAMED
@@ -21,12 +21,12 @@
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
 
@@ -38,36 +38,25 @@ class UrandomPseudoRandomStringGenerator implements PseudoRandomStringGeneratorI
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')) {
@@ -78,10 +67,7 @@ class UrandomPseudoRandomStringGenerator implements PseudoRandomStringGeneratorI
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);
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\PseudoRandomString;
26
 
27
  use Facebook\Exceptions\FacebookSDKException;
28
 
29
+ class UrandomPseudoRandomStringGenerator implements PseudoRandomStringGeneratorInterface {
 
30
 
31
  use PseudoRandomStringGeneratorTrait;
32
 
38
  /**
39
  * @throws FacebookSDKException
40
  */
41
+ public function __construct() {
 
42
  if (ini_get('open_basedir')) {
43
+ throw new FacebookSDKException(static::ERROR_MESSAGE . 'There is an open_basedir constraint that prevents access to /dev/urandom.');
 
 
 
44
  }
45
 
46
  if (!is_readable('/dev/urandom')) {
47
+ throw new FacebookSDKException(static::ERROR_MESSAGE . 'Unable to read from /dev/urandom.');
 
 
 
48
  }
49
  }
50
 
51
  /**
52
  * @inheritdoc
53
  */
54
+ public function getPseudoRandomString($length) {
 
55
  $this->validateLength($length);
56
 
57
  $stream = fopen('/dev/urandom', 'rb');
58
  if (!is_resource($stream)) {
59
+ throw new FacebookSDKException(static::ERROR_MESSAGE . 'Unable to open stream to /dev/urandom.');
 
 
 
60
  }
61
 
62
  if (!defined('HHVM_VERSION')) {
67
  fclose($stream);
68
 
69
  if (!$binaryString) {
70
+ throw new FacebookSDKException(static::ERROR_MESSAGE . 'Stream to /dev/urandom returned no data.');
 
 
 
71
  }
72
 
73
  return $this->binToHex($binaryString, $length);
{Facebook → providers/facebook/compat/Facebook}/SignedRequest.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook;
25
 
26
  use Facebook\Exceptions\FacebookSDKException;
@@ -30,8 +31,8 @@ use Facebook\Exceptions\FacebookSDKException;
30
  *
31
  * @package Facebook
32
  */
33
- class SignedRequest
34
- {
35
  /**
36
  * @var FacebookApp The FacebookApp entity.
37
  */
@@ -53,8 +54,7 @@ class SignedRequest
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) {
@@ -71,8 +71,7 @@ class SignedRequest
71
  *
72
  * @return string|null
73
  */
74
- public function getRawSignedRequest()
75
- {
76
  return $this->rawSignedRequest;
77
  }
78
 
@@ -81,8 +80,7 @@ class SignedRequest
81
  *
82
  * @return array|null
83
  */
84
- public function getPayload()
85
- {
86
  return $this->payload;
87
  }
88
 
@@ -94,8 +92,7 @@ class SignedRequest
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
  }
@@ -108,8 +105,7 @@ class SignedRequest
108
  *
109
  * @return string|null
110
  */
111
- public function getUserId()
112
- {
113
  return $this->get('user_id');
114
  }
115
 
@@ -118,8 +114,7 @@ class SignedRequest
118
  *
119
  * @return boolean
120
  */
121
- public function hasOAuthData()
122
- {
123
  return $this->get('oauth_token') || $this->get('code');
124
  }
125
 
@@ -130,13 +125,12 @@ class SignedRequest
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;
@@ -146,12 +140,11 @@ class SignedRequest
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
 
@@ -168,8 +161,7 @@ class SignedRequest
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
  }
@@ -186,8 +178,7 @@ class SignedRequest
186
  *
187
  * @throws FacebookSDKException
188
  */
189
- protected function decodeSignature($encodedSig)
190
- {
191
  $sig = $this->base64UrlDecode($encodedSig);
192
 
193
  if (!$sig) {
@@ -206,8 +197,7 @@ class SignedRequest
206
  *
207
  * @throws FacebookSDKException
208
  */
209
- protected function decodePayload($encodedPayload)
210
- {
211
  $payload = $this->base64UrlDecode($encodedPayload);
212
 
213
  if ($payload) {
@@ -226,8 +216,7 @@ class SignedRequest
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
  }
@@ -242,14 +231,8 @@ class SignedRequest
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);
@@ -266,8 +249,7 @@ class SignedRequest
266
  *
267
  * @throws FacebookSDKException
268
  */
269
- protected function validateSignature($hashedSig, $sig)
270
- {
271
  if (\hash_equals($hashedSig, $sig)) {
272
  return;
273
  }
@@ -286,8 +268,7 @@ class SignedRequest
286
  *
287
  * @return string decoded string
288
  */
289
- public function base64UrlDecode($input)
290
- {
291
  $urlDecodedBase64 = strtr($input, '-_', '+/');
292
  $this->validateBase64($urlDecodedBase64);
293
 
@@ -305,8 +286,7 @@ class SignedRequest
305
  *
306
  * @return string base64 url encoded input
307
  */
308
- public function base64UrlEncode($input)
309
- {
310
  return strtr(base64_encode($input), '+/', '-_');
311
  }
312
 
@@ -317,8 +297,7 @@ class SignedRequest
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
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook;
26
 
27
  use Facebook\Exceptions\FacebookSDKException;
31
  *
32
  * @package Facebook
33
  */
34
+ class SignedRequest {
35
+
36
  /**
37
  * @var FacebookApp The FacebookApp entity.
38
  */
54
  * @param FacebookApp $facebookApp The FacebookApp entity.
55
  * @param string|null $rawSignedRequest The raw signed request.
56
  */
57
+ public function __construct(FacebookApp $facebookApp, $rawSignedRequest = null) {
 
58
  $this->app = $facebookApp;
59
 
60
  if (!$rawSignedRequest) {
71
  *
72
  * @return string|null
73
  */
74
+ public function getRawSignedRequest() {
 
75
  return $this->rawSignedRequest;
76
  }
77
 
80
  *
81
  * @return array|null
82
  */
83
+ public function getPayload() {
 
84
  return $this->payload;
85
  }
86
 
92
  *
93
  * @return mixed|null
94
  */
95
+ public function get($key, $default = null) {
 
96
  if (isset($this->payload[$key])) {
97
  return $this->payload[$key];
98
  }
105
  *
106
  * @return string|null
107
  */
108
+ public function getUserId() {
 
109
  return $this->get('user_id');
110
  }
111
 
114
  *
115
  * @return boolean
116
  */
117
+ public function hasOAuthData() {
 
118
  return $this->get('oauth_token') || $this->get('code');
119
  }
120
 
125
  *
126
  * @return string
127
  */
128
+ public function make(array $payload) {
 
129
  $payload['algorithm'] = isset($payload['algorithm']) ? $payload['algorithm'] : 'HMAC-SHA256';
130
  $payload['issued_at'] = isset($payload['issued_at']) ? $payload['issued_at'] : time();
131
+ $encodedPayload = $this->base64UrlEncode(json_encode($payload));
132
 
133
+ $hashedSig = $this->hashSignature($encodedPayload);
134
  $encodedSig = $this->base64UrlEncode($hashedSig);
135
 
136
  return $encodedSig . '.' . $encodedPayload;
140
  * Validates and decodes a signed request and saves
141
  * the payload to an array.
142
  */
143
+ protected function parse() {
 
144
  list($encodedSig, $encodedPayload) = $this->split();
145
 
146
  // Signature validation
147
+ $sig = $this->decodeSignature($encodedSig);
148
  $hashedSig = $this->hashSignature($encodedPayload);
149
  $this->validateSignature($hashedSig, $sig);
150
 
161
  *
162
  * @throws FacebookSDKException
163
  */
164
+ protected function split() {
 
165
  if (strpos($this->rawSignedRequest, '.') === false) {
166
  throw new FacebookSDKException('Malformed signed request.', 606);
167
  }
178
  *
179
  * @throws FacebookSDKException
180
  */
181
+ protected function decodeSignature($encodedSig) {
 
182
  $sig = $this->base64UrlDecode($encodedSig);
183
 
184
  if (!$sig) {
197
  *
198
  * @throws FacebookSDKException
199
  */
200
+ protected function decodePayload($encodedPayload) {
 
201
  $payload = $this->base64UrlDecode($encodedPayload);
202
 
203
  if ($payload) {
216
  *
217
  * @throws FacebookSDKException
218
  */
219
+ protected function validateAlgorithm() {
 
220
  if ($this->get('algorithm') !== 'HMAC-SHA256') {
221
  throw new FacebookSDKException('Signed request is using the wrong algorithm.', 605);
222
  }
231
  *
232
  * @throws FacebookSDKException
233
  */
234
+ protected function hashSignature($encodedData) {
235
+ $hashedSig = hash_hmac('sha256', $encodedData, $this->app->getSecret(), $raw_output = true);
 
 
 
 
 
 
236
 
237
  if (!$hashedSig) {
238
  throw new FacebookSDKException('Unable to hash signature from encoded payload data.', 602);
249
  *
250
  * @throws FacebookSDKException
251
  */
252
+ protected function validateSignature($hashedSig, $sig) {
 
253
  if (\hash_equals($hashedSig, $sig)) {
254
  return;
255
  }
268
  *
269
  * @return string decoded string
270
  */
271
+ public function base64UrlDecode($input) {
 
272
  $urlDecodedBase64 = strtr($input, '-_', '+/');
273
  $this->validateBase64($urlDecodedBase64);
274
 
286
  *
287
  * @return string base64 url encoded input
288
  */
289
+ public function base64UrlEncode($input) {
 
290
  return strtr(base64_encode($input), '+/', '-_');
291
  }
292
 
297
  *
298
  * @throws FacebookSDKException
299
  */
300
+ protected function validateBase64($input) {
 
301
  if (!preg_match('/^[a-zA-Z0-9\/\r\n+]*={0,2}$/', $input)) {
302
  throw new FacebookSDKException('Signed request contains malformed base64 encoding.', 608);
303
  }
{Facebook → providers/facebook/compat/Facebook}/Url/FacebookUrlDetectionHandler.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\Url;
25
 
26
  /**
@@ -28,13 +29,12 @@ namespace Facebook\Url;
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
 
@@ -43,8 +43,7 @@ class FacebookUrlDetectionHandler implements UrlDetectionInterface
43
  *
44
  * @return string
45
  */
46
- protected function getHttpScheme()
47
- {
48
  return $this->isBehindSsl() ? 'https' : 'http';
49
  }
50
 
@@ -53,8 +52,7 @@ class FacebookUrlDetectionHandler implements UrlDetectionInterface
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) {
@@ -76,11 +74,15 @@ class FacebookUrlDetectionHandler implements UrlDetectionInterface
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
  /**
@@ -92,13 +94,12 @@ class FacebookUrlDetectionHandler implements UrlDetectionInterface
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');
@@ -122,8 +123,7 @@ class FacebookUrlDetectionHandler implements UrlDetectionInterface
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) {
@@ -145,8 +145,7 @@ class FacebookUrlDetectionHandler implements UrlDetectionInterface
145
  *
146
  * @return string
147
  */
148
- protected function getServerVar($key)
149
- {
150
  return isset($_SERVER[$key]) ? $_SERVER[$key] : '';
151
  }
152
 
@@ -157,8 +156,7 @@ class FacebookUrlDetectionHandler implements UrlDetectionInterface
157
  *
158
  * @return string
159
  */
160
- protected function getHeader($key)
161
- {
162
  return $this->getServerVar('HTTP_' . $key);
163
  }
164
 
@@ -170,11 +168,10 @@ class FacebookUrlDetectionHandler implements UrlDetectionInterface
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
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\Url;
26
 
27
  /**
29
  *
30
  * @package Facebook
31
  */
32
+ class FacebookUrlDetectionHandler implements UrlDetectionInterface {
33
+
34
  /**
35
  * @inheritdoc
36
  */
37
+ public function getCurrentUrl() {
 
38
  return $this->getHttpScheme() . '://' . $this->getHostName() . $this->getServerVar('REQUEST_URI');
39
  }
40
 
43
  *
44
  * @return string
45
  */
46
+ protected function getHttpScheme() {
 
47
  return $this->isBehindSsl() ? 'https' : 'http';
48
  }
49
 
52
  *
53
  * @return boolean
54
  */
55
+ protected function isBehindSsl() {
 
56
  // Check for proxy first
57
  $protocol = $this->getHeader('X_FORWARDED_PROTO');
58
  if ($protocol) {
74
  *
75
  * @return boolean
76
  */
77
+ protected function protocolWithActiveSsl($protocol) {
 
78
  $protocol = strtolower((string)$protocol);
79
 
80
+ return in_array($protocol, [
81
+ 'on',
82
+ '1',
83
+ 'https',
84
+ 'ssl'
85
+ ], true);
86
  }
87
 
88
  /**
94
  *
95
  * @return string
96
  */
97
+ protected function getHostName() {
 
98
  // Check for proxy first
99
  $header = $this->getHeader('X_FORWARDED_HOST');
100
  if ($header && $this->isValidForwardedHost($header)) {
101
  $elements = explode(',', $header);
102
+ $host = $elements[count($elements) - 1];
103
  } elseif (!$host = $this->getHeader('HOST')) {
104
  if (!$host = $this->getServerVar('SERVER_NAME')) {
105
  $host = $this->getServerVar('SERVER_ADDR');
123
  return $host . $appendPort;
124
  }
125
 
126
+ protected function getCurrentPort() {
 
127
  // Check for proxy first
128
  $port = $this->getHeader('X_FORWARDED_PORT');
129
  if ($port) {
145
  *
146
  * @return string
147
  */
148
+ protected function getServerVar($key) {
 
149
  return isset($_SERVER[$key]) ? $_SERVER[$key] : '';
150
  }
151
 
156
  *
157
  * @return string
158
  */
159
+ protected function getHeader($key) {
 
160
  return $this->getServerVar('HTTP_' . $key);
161
  }
162
 
168
  *
169
  * @return boolean
170
  */
171
+ protected function isValidForwardedHost($header) {
 
172
  $elements = explode(',', $header);
173
+ $host = $elements[count($elements) - 1];
174
+
175
  return preg_match("/^([a-z\d](-*[a-z\d])*)(\.([a-z\d](-*[a-z\d])*))*$/i", $host) //valid chars check
176
  && 0 < strlen($host) && strlen($host) < 254 //overall length check
177
  && preg_match("/^[^\.]{1,63}(\.[^\.]{1,63})*$/", $host); //length of each label
{Facebook → providers/facebook/compat/Facebook}/Url/FacebookUrlManipulator.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\Url;
25
 
26
  /**
@@ -28,8 +29,8 @@ namespace Facebook\Url;
28
  *
29
  * @package Facebook
30
  */
31
- class FacebookUrlManipulator
32
- {
33
  /**
34
  * Remove params from a URL.
35
  *
@@ -38,8 +39,7 @@ class FacebookUrlManipulator
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 = '';
@@ -57,10 +57,10 @@ class FacebookUrlManipulator
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;
@@ -74,8 +74,7 @@ class FacebookUrlManipulator
74
  *
75
  * @return string
76
  */
77
- public static function appendParamsToUrl($url, array $newParams = [])
78
- {
79
  if (empty($newParams)) {
80
  return $url;
81
  }
@@ -104,8 +103,7 @@ class FacebookUrlManipulator
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 [];
@@ -126,8 +124,7 @@ class FacebookUrlManipulator
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) {
@@ -144,8 +141,7 @@ class FacebookUrlManipulator
144
  *
145
  * @return string|null
146
  */
147
- public static function forceSlashPrefix($string)
148
- {
149
  if (!$string) {
150
  return $string;
151
  }
@@ -160,8 +156,7 @@ class FacebookUrlManipulator
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
  }
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\Url;
26
 
27
  /**
29
  *
30
  * @package Facebook
31
  */
32
+ class FacebookUrlManipulator {
33
+
34
  /**
35
  * Remove params from a URL.
36
  *
39
  *
40
  * @return string The URL with the params removed.
41
  */
42
+ public static function removeParamsFromUrl($url, array $paramsToFilter) {
 
43
  $parts = parse_url($url);
44
 
45
  $query = '';
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;
74
  *
75
  * @return string
76
  */
77
+ public static function appendParamsToUrl($url, array $newParams = []) {
 
78
  if (empty($newParams)) {
79
  return $url;
80
  }
103
  *
104
  * @return array
105
  */
106
+ public static function getParamsAsArray($url) {
 
107
  $query = parse_url($url, PHP_URL_QUERY);
108
  if (!$query) {
109
  return [];
124
  *
125
  * @return string The $urlToAddTo with any new params from $urlToStealFrom.
126
  */
127
+ public static function mergeUrlParams($urlToStealFrom, $urlToAddTo) {
 
128
  $newParams = static::getParamsAsArray($urlToStealFrom);
129
  // Nothing new to add, return as-is
130
  if (!$newParams) {
141
  *
142
  * @return string|null
143
  */
144
+ public static function forceSlashPrefix($string) {
 
145
  if (!$string) {
146
  return $string;
147
  }
156
  *
157
  * @return string The $urlToTrim with the hostname and Graph version removed.
158
  */
159
+ public static function baseGraphUrlEndpoint($urlToTrim) {
 
160
  return '/' . preg_replace('/^https:\/\/.+\.facebook\.com(\/v.+?)?\//', '', $urlToTrim);
161
  }
162
  }
{Facebook → providers/facebook/compat/Facebook}/Url/UrlDetectionInterface.php RENAMED
@@ -21,6 +21,7 @@
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
 
24
  namespace Facebook\Url;
25
 
26
  /**
@@ -28,8 +29,8 @@ namespace Facebook\Url;
28
  *
29
  * @package Facebook
30
  */
31
- interface UrlDetectionInterface
32
- {
33
  /**
34
  * Get the currently active URL.
35
  *
21
  * DEALINGS IN THE SOFTWARE.
22
  *
23
  */
24
+
25
  namespace Facebook\Url;
26
 
27
  /**
29
  *
30
  * @package Facebook
31
  */
32
+ interface UrlDetectionInterface {
33
+
34
  /**
35
  * Get the currently active URL.
36
  *
{Facebook → providers/facebook/compat/Facebook}/autoload.php RENAMED
File without changes
{Facebook → providers/facebook/compat/Facebook}/polyfills.php RENAMED
@@ -26,8 +26,7 @@
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');
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
  if (function_exists('mb_strlen')) {
31
  $kLen = mb_strlen($knownString, '8bit');
32
  $uLen = mb_strlen($userString, '8bit');
providers/facebook/compat/buttons/facebook-btn.css ADDED
@@ -0,0 +1,397 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @import url(//fonts.googleapis.com/css?family=Open+Sans:600);
2
+
3
+ .new-fb-btn {
4
+ margin: 5px auto;
5
+ display: inline-block;
6
+ }
7
+
8
+ .new-fb-btn,
9
+ .new-fb-btn div {
10
+ font-size: 14px;
11
+ font-weight: 600;
12
+ font-family: 'Open Sans', sans-serif;
13
+ color: #fff;
14
+ text-shadow: 0 0 1px RGBA(0, 0, 0, 1);
15
+ white-space: nowrap;
16
+ vertical-align: middle;
17
+ }
18
+
19
+ /*
20
+ 1 --------------
21
+ */
22
+ .new-fb-1,
23
+ .new-fb-1 div {
24
+ height: 42px;
25
+ line-height: 42px;
26
+ background: url('facebook-btn.png') no-repeat 0 0;
27
+ }
28
+
29
+ div.new-fb-1 {
30
+ padding: 0 0 0 20px;
31
+ }
32
+
33
+ div.new-fb-1-1 {
34
+ padding: 0 43px 0 0;
35
+ background-position: right -100px;
36
+ }
37
+
38
+ div.new-fb-1-1-1 {
39
+ background-repeat: repeat-x;
40
+ background-position: 0 -50px;
41
+ padding: 0 20px 0 5px;
42
+ }
43
+
44
+ /*
45
+ 2 --------------
46
+ */
47
+ .new-fb-2,
48
+ .new-fb-2 div {
49
+ height: 42px;
50
+ line-height: 42px;
51
+ background: url('facebook-btn.png') no-repeat 0 0;
52
+ }
53
+
54
+ div.new-fb-2 {
55
+ padding: 0 0 0 45px;
56
+ background-position: 0 -150px;
57
+ }
58
+
59
+ div.new-fb-2-1 {
60
+ padding: 0 20px 0 0;
61
+ background-position: right -250px;
62
+ }
63
+
64
+ div.new-fb-2-1-1 {
65
+ background-repeat: repeat-x;
66
+ background-position: 0 -200px;
67
+ padding: 0 0 0 10px;
68
+ font-size: 12px;
69
+ }
70
+
71
+ /*
72
+ 3 --------------
73
+ */
74
+ .new-fb-3,
75
+ .new-fb-3 div {
76
+ height: 37px;
77
+ line-height: 37px;
78
+ background: url('facebook-btn.png') no-repeat 0 0;
79
+ }
80
+
81
+ div.new-fb-3 {
82
+ padding: 0 0 0 35px;
83
+ background-position: 0 -300px;
84
+ }
85
+
86
+ div.new-fb-3-1 {
87
+ padding: 0 18px 0 0;
88
+ background-position: right -400px;
89
+ }
90
+
91
+ div.new-fb-3-1-1 {
92
+ background-repeat: repeat-x;
93
+ background-position: 0 -350px;
94
+ padding: 0 0 0 8px;
95
+ font-size: 12px;
96
+ }
97
+
98
+ /*
99
+ 4 --------------
100
+ */
101
+ .new-fb-4,
102
+ .new-fb-4 div {
103
+ height: 35px;
104
+ line-height: 32px;
105
+ background: url('facebook-btn.png') no-repeat 0 0;
106
+ }
107
+
108
+ div.new-fb-4 {
109
+ padding: 0 0 0 4px;
110
+ background-position: 0 -450px;
111
+ }
112
+
113
+ div.new-fb-4-1 {
114
+ padding: 0 33px 0 0;
115
+ background-position: right -550px;
116
+ }
117
+
118
+ div.new-fb-4-1-1 {
119
+ background-repeat: repeat-x;
120
+ background-position: 0 -500px;
121
+ padding: 0 19px 0 18px;
122
+ font-size: 12px;
123
+ }
124
+
125
+ /*
126
+ 5 --------------
127
+ */
128
+ .new-fb-5,
129
+ .new-fb-5 div {
130
+ height: 15px;
131
+ line-height: 15px;
132
+ background: url('facebook-btn.png') no-repeat 0 0;
133
+ }
134
+
135
+ div.new-fb-5 {
136
+ padding: 0 0 0 3px;
137
+ background-position: 0 -600px;
138
+ }
139
+
140
+ div.new-fb-5-1 {
141
+ padding: 0 3px 0 0;
142
+ background-position: right -640px;
143
+ }
144
+
145
+ div.new-fb-5-1-1 {
146
+ background-repeat: repeat-x;
147
+ background-position: 0 -620px;
148
+ padding: 0 1px;
149
+ font-size: 10px;
150
+ }
151
+
152
+ /*
153
+ 6 --------------
154
+ */
155
+ .new-fb-6,
156
+ .new-fb-6 div {
157
+ height: 29px;
158
+ line-height: 26px;
159
+ background: url('facebook-btn.png') no-repeat 0 0;
160
+ }
161
+
162
+ div.new-fb-6 {
163
+ padding: 0 0 0 4px;
164
+ background-position: 0 -660px;
165
+ }
166
+
167
+ div.new-fb-6-1 {
168
+ padding: 0 27px 0 0;
169
+ background-position: right -750px;
170
+ }
171
+
172
+ div.new-fb-6-1-1 {
173
+ background-repeat: repeat-x;
174
+ background-position: 0 -700px;
175
+ padding: 0 10px 0 8px;
176
+ font-size: 12px;
177
+ }
178
+
179
+ /*
180
+ 7 --------------
181
+ */
182
+ .new-fb-7,
183
+ .new-fb-7 div {
184
+ height: 29px;
185
+ line-height: 26px;
186
+ background: url('facebook-btn.png') no-repeat 0 0;
187
+ }
188
+
189
+ div.new-fb-7 {
190
+ padding: 0 0 0 29px;
191
+ background-position: 0 -800px;
192
+ }
193
+
194
+ div.new-fb-7-1 {
195
+ padding: 0 4px 0 0;
196
+ background-position: right -900px;
197
+ }
198
+
199
+ div.new-fb-7-1-1 {
200
+ background-repeat: repeat-x;
201
+ background-position: 0 -850px;
202
+ padding: 0 10px 0 10px;
203
+ font-size: 11px;
204
+ }
205
+
206
+ /*
207
+ 8 --------------
208
+ */
209
+ .new-fb-8,
210
+ .new-fb-8 div {
211
+ height: 25px;
212
+ width: 30px;
213
+ background: url('facebook-btn.png') no-repeat 0 0;
214
+ }
215
+
216
+ div.new-fb-8 {
217
+ background-position: 0 -950px;
218
+ }
219
+
220
+ div.new-fb-8-1 {
221
+ background-position: 0 -1050px;
222
+ transition: background-position 0.4s;
223
+ -moz-transition: background-position 0.4s; /* Firefox 4 */
224
+ -webkit-transition: background-position 0.4s; /* Safari and Chrome */
225
+ -o-transition: background-position 0.4s; /* Opera */
226
+ }
227
+
228
+ div.new-fb-8:HOVER div.new-fb-8-1 {
229
+ background-position: 0 -1000px;
230
+ }
231
+
232
+ /*
233
+ 9 --------------
234
+ */
235
+ .new-fb-9,
236
+ .new-fb-9 div {
237
+ height: 26px;
238
+ width: 30px;
239
+ background: url('facebook-btn.png') no-repeat 0 0;
240
+ }
241
+
242
+ div.new-fb-9 {
243
+ opacity: 0.79;
244
+ background-position: 0 -1100px;
245
+ transition: opacity 0.4s;
246
+ -moz-transition: opacity 0.4s; /* Firefox 4 */
247
+ -webkit-transition: opacity 0.4s; /* Safari and Chrome */
248
+ -o-transition: opacity 0.4s; /* Opera */
249
+ }
250
+
251
+ div.new-fb-9:HOVER {
252
+ opacity: 0.99
253
+ }
254
+
255
+ /*
256
+ 10 --------------
257
+ */
258
+ .new-fb-10,
259
+ .new-fb-10 div {
260
+ background: url('facebook-btn.png') no-repeat 0 0;
261
+ }
262
+
263
+ div.new-fb-10 {
264
+ height: 36px;
265
+ width: 37px;
266
+ background-position: 0 -1150px;
267
+ }
268
+
269
+ div.new-fb-10-1 {
270
+ margin: 5px 5px 6px 5px;
271
+ height: 26px;
272
+ width: 26px;
273
+ overflow: hidden;
274
+ background-position: -5px -1255px;
275
+ transition: background-position 0.4s;
276
+ -moz-transition: background-position 0.4s; /* Firefox 4 */
277
+ -webkit-transition: background-position 0.4s; /* Safari and Chrome */
278
+ -o-transition: background-position 0.4s; /* Opera */
279
+ }
280
+
281
+ div.new-fb-10:HOVER div.new-fb-10-1 {
282
+ background-position: -5px -1205px;
283
+ }
284
+
285
+ /*
286
+ 11 --------------
287
+ */
288
+ .new-fb-11,
289
+ .new-fb-11 div {
290
+ height: 36px;
291
+ width: 36px;
292
+ background: url('facebook-btn.png') no-repeat 0 0;
293
+ }
294
+
295
+ div.new-fb-11 {
296
+ opacity: 0.79;
297
+ background-position: 0 -1300px;
298
+ transition: opacity 0.4s;
299
+ -moz-transition: opacity 0.4s; /* Firefox 4 */
300
+ -webkit-transition: opacity 0.4s; /* Safari and Chrome */
301
+ -o-transition: opacity 0.4s; /* Opera */
302
+ }
303
+
304
+ div.new-fb-11:HOVER {
305
+ opacity: 0.99
306
+ }
307
+
308
+ /*
309
+ 12 --------------
310
+ */
311
+ .new-fb-12,
312
+ .new-fb-12 div {
313
+ height: 28px;
314
+ width: 29px;
315
+ background: url('facebook-btn.png') no-repeat 0 0;
316
+ }
317
+
318
+ div.new-fb-12 {
319
+ background-position: 0 -1350px;
320
+ opacity: 0.79;
321
+ transition: opacity 0.4s;
322
+ -moz-transition: opacity 0.4s; /* Firefox 4 */
323
+ -webkit-transition: opacity 0.4s; /* Safari and Chrome */
324
+ -o-transition: opacity 0.4s; /* Opera */
325
+ }
326
+
327
+ div.new-fb-12:HOVER {
328
+ opacity: 0.99
329
+ }
330
+
331
+ /*
332
+ 13 --------------
333
+ */
334
+ .new-fb-13,
335
+ .new-fb-13 div {
336
+ height: 25px;
337
+ width: 30px;
338
+ background: url('facebook-btn.png') no-repeat 0 0;
339
+ }
340
+
341
+ div.new-fb-13 {
342
+ background-position: 0 -1400px;
343
+ }
344
+
345
+ div.new-fb-13-1 {
346
+ background-position: 0 -1050px;
347
+ transition: background-position 0.4s;
348
+ -moz-transition: background-position 0.4s; /* Firefox 4 */
349
+ -webkit-transition: background-position 0.4s; /* Safari and Chrome */
350
+ -o-transition: background-position 0.4s; /* Opera */
351
+ }
352
+
353
+ div.new-fb-13:HOVER div.new-fb-13-1 {
354
+ background-position: 0 -1000px;
355
+ }
356
+
357
+ /*
358
+ 14 --------------
359
+ */
360
+ .new-fb-14,
361
+ .new-fb-14 div {
362
+ height: 23px;
363
+ width: 23px;
364
+ background: url('facebook-btn.png') no-repeat 0 0;
365
+ }
366
+
367
+ div.new-fb-14 {
368
+ background-position: 0 -1450px;
369
+ }
370
+
371
+ div.new-fb-14-1 {
372
+ background-position: 0 -1550px;
373
+ transition: background-position 0.4s;
374
+ -moz-transition: background-position 0.4s; /* Firefox 4 */
375
+ -webkit-transition: background-position 0.4s; /* Safari and Chrome */
376
+ -o-transition: background-position 0.4s; /* Opera */
377
+ }
378
+
379
+ div.new-fb-14:HOVER div.new-fb-14-1 {
380
+ background-position: 0 -1500px;
381
+ }
382
+
383
+ /*
384
+ Main animations
385
+ */
386
+
387
+ .new-fb-default-anim {
388
+ opacity: 0.85;
389
+ transition: opacity 0.4s;
390
+ -moz-transition: opacity 0.4s; /* Firefox 4 */
391
+ -webkit-transition: opacity 0.4s; /* Safari and Chrome */
392
+ -o-transition: opacity 0.4s; /* Opera */
393
+ }
394
+
395
+ .new-fb-default-anim:HOVER {
396
+ opacity: 0.999;
397
+ }
{buttons → providers/facebook/compat/buttons}/facebook-btn.png RENAMED
File without changes
{buttons → providers/facebook/compat/buttons}/index.html RENAMED
File without changes
generatorbanner.png → providers/facebook/compat/generatorbanner.png RENAMED
File without changes
providers/facebook/compat/index.html ADDED
File without changes
providers/facebook/compat/licence.txt ADDED
@@ -0,0 +1,339 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 2, June 1991
3
+
4
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
5
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6
+ Everyone is permitted to copy and distribute verbatim copies
7
+ of this license document, but changing it is not allowed.
8
+
9
+ Preamble
10
+
11
+ The licenses for most software are designed to take away your
12
+ freedom to share and change it. By contrast, the GNU General Public
13
+ License is intended to guarantee your freedom to share and change free
14
+ software--to make sure the software is free for all its users. This
15
+ General Public License applies to most of the Free Software
16
+ Foundation's software and to any other program whose authors commit to
17
+ using it. (Some other Free Software Foundation software is covered by
18
+ the GNU Lesser General Public License instead.) You can apply it to
19
+ your programs, too.
20
+
21
+ When we speak of free software, we are referring to freedom, not
22
+ price. Our General Public Licenses are designed to make sure that you
23
+ have the freedom to distribute copies of free software (and charge for
24
+ this service if you wish), that you receive source code or can get it
25
+ if you want it, that you can change the software or use pieces of it
26
+ in new free programs; and that you know you can do these things.
27
+
28
+ To protect your rights, we need to make restrictions that forbid
29
+ anyone to deny you these rights or to ask you to surrender the rights.
30
+ These restrictions translate to certain responsibilities for you if you
31
+ distribute copies of the software, or if you modify it.
32
+
33
+ For example, if you distribute copies of such a program, whether
34
+ gratis or for a fee, you must give the recipients all the rights that
35
+ you have. You must make sure that they, too, receive or can get the
36
+ source code. And you must show them these terms so they know their
37
+ rights.
38
+
39
+ We protect your rights with two steps: (1) copyright the software, and
40
+ (2) offer you this license which gives you legal permission to copy,
41
+ distribute and/or modify the software.
42
+
43
+ Also, for each author's protection and ours, we want to make certain
44
+ that everyone understands that there is no warranty for this free
45
+ software. If the software is modified by someone else and passed on, we
46
+ want its recipients to know that what they have is not the original, so
47
+ that any problems introduced by others will not reflect on the original
48
+ authors' reputations.
49
+
50
+ Finally, any free program is threatened constantly by software
51
+ patents. We wish to avoid the danger that redistributors of a free
52
+ program will individually obtain patent licenses, in effect making the
53
+ program proprietary. To prevent this, we have made it clear that any
54
+ patent must be licensed for everyone's free use or not licensed at all.
55
+
56
+ The precise terms and conditions for copying, distribution and
57
+ modification follow.
58
+
59
+ GNU GENERAL PUBLIC LICENSE
60
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61
+
62
+ 0. This License applies to any program or other work which contains
63
+ a notice placed by the copyright holder saying it may be distributed
64
+ under the terms of this General Public License. The "Program", below,
65
+ refers to any such program or work, and a "work based on the Program"
66
+ means either the Program or any derivative work under copyright law:
67
+ that is to say, a work containing the Program or a portion of it,
68
+ either verbatim or with modifications and/or translated into another
69
+ language. (Hereinafter, translation is included without limitation in
70
+ the term "modification".) Each licensee is addressed as "you".
71
+
72
+ Activities other than copying, distribution and modification are not
73
+ covered by this License; they are outside its scope. The act of
74
+ running the Program is not restricted, and the output from the Program
75
+ is covered only if its contents constitute a work based on the
76
+ Program (independent of having been made by running the Program).
77
+ Whether that is true depends on what the Program does.
78
+
79
+ 1. You may copy and distribute verbatim copies of the Program's
80
+ source code as you receive it, in any medium, provided that you
81
+ conspicuously and appropriately publish on each copy an appropriate
82
+ copyright notice and disclaimer of warranty; keep intact all the
83
+ notices that refer to this License and to the absence of any warranty;
84
+ and give any other recipients of the Program a copy of this License
85
+ along with the Program.
86
+
87
+ You may charge a fee for the physical act of transferring a copy, and
88
+ you may at your option offer warranty protection in exchange for a fee.
89
+
90
+ 2. You may modify your copy or copies of the Program or any portion
91
+ of it, thus forming a work based on the Program, and copy and
92
+ distribute such modifications or work under the terms of Section 1
93
+ above, provided that you also meet all of these conditions:
94
+
95
+ a) You must cause the modified files to carry prominent notices
96
+ stating that you changed the files and the date of any change.
97
+
98
+ b) You must cause any work that you distribute or publish, that in
99
+ whole or in part contains or is derived from the Program or any
100
+ part thereof, to be licensed as a whole at no charge to all third
101
+ parties under the terms of this License.
102
+
103
+ c) If the modified program normally reads commands interactively
104
+ when run, you must cause it, when started running for such
105
+ interactive use in the most ordinary way, to print or display an
106
+ announcement including an appropriate copyright notice and a
107
+ notice that there is no warranty (or else, saying that you provide
108
+ a warranty) and that users may redistribute the program under
109
+ these conditions, and telling the user how to view a copy of this
110
+ License. (Exception: if the Program itself is interactive but
111
+ does not normally print such an announcement, your work based on
112
+ the Program is not required to print an announcement.)
113
+
114
+ These requirements apply to the modified work as a whole. If
115
+ identifiable sections of that work are not derived from the Program,
116
+ and can be reasonably considered independent and separate works in
117
+ themselves, then this License, and its terms, do not apply to those
118
+ sections when you distribute them as separate works. But when you
119
+ distribute the same sections as part of a whole which is a work based
120
+ on the Program, the distribution of the whole must be on the terms of
121
+ this License, whose permissions for other licensees extend to the
122
+ entire whole, and thus to each and every part regardless of who wrote it.
123
+
124
+ Thus, it is not the intent of this section to claim rights or contest
125
+ your rights to work written entirely by you; rather, the intent is to
126
+ exercise the right to control the distribution of derivative or
127
+ collective works based on the Program.
128
+
129
+ In addition, mere aggregation of another work not based on the Program
130
+ with the Program (or with a work based on the Program) on a volume of
131
+ a storage or distribution medium does not bring the other work under
132
+ the scope of this License.
133
+
134
+ 3. You may copy and distribute the Program (or a work based on it,
135
+ under Section 2) in object code or executable form under the terms of
136
+ Sections 1 and 2 above provided that you also do one of the following:
137
+
138
+ a) Accompany it with the complete corresponding machine-readable
139
+ source code, which must be distributed under the terms of Sections
140
+ 1 and 2 above on a medium customarily used for software interchange; or,
141
+
142
+ b) Accompany it with a written offer, valid for at least three
143
+ years, to give any third party, for a charge no more than your
144
+ cost of physically performing source distribution, a complete
145
+ machine-readable copy of the corresponding source code, to be
146
+ distributed under the terms of Sections 1 and 2 above on a medium
147
+ customarily used for software interchange; or,
148
+
149
+ c) Accompany it with the information you received as to the offer
150
+ to distribute corresponding source code. (This alternative is
151
+ allowed only for noncommercial distribution and only if you
152
+ received the program in object code or executable form with such
153
+ an offer, in accord with Subsection b above.)
154
+
155
+ The source code for a work means the preferred form of the work for
156
+ making modifications to it. For an executable work, complete source
157
+ code means all the source code for all modules it contains, plus any
158
+ associated interface definition files, plus the scripts used to
159
+ control compilation and installation of the executable. However, as a
160
+ special exception, the source code distributed need not include
161
+ anything that is normally distributed (in either source or binary
162
+ form) with the major components (compiler, kernel, and so on) of the
163
+ operating system on which the executable runs, unless that component
164
+ itself accompanies the executable.
165
+
166
+ If distribution of executable or object code is made by offering
167
+ access to copy from a designated place, then offering equivalent
168
+ access to copy the source code from the same place counts as
169
+ distribution of the source code, even though third parties are not
170
+ compelled to copy the source along with the object code.
171
+
172
+ 4. You may not copy, modify, sublicense, or distribute the Program
173
+ except as expressly provided under this License. Any attempt
174
+ otherwise to copy, modify, sublicense or distribute the Program is
175
+ void, and will automatically terminate your rights under this License.
176
+ However, parties who have received copies, or rights, from you under
177
+ this License will not have their licenses terminated so long as such
178
+ parties remain in full compliance.
179
+
180
+ 5. You are not required to accept this License, since you have not
181
+ signed it. However, nothing else grants you permission to modify or
182
+ distribute the Program or its derivative works. These actions are
183
+ prohibited by law if you do not accept this License. Therefore, by
184
+ modifying or distributing the Program (or any work based on the
185
+ Program), you indicate your acceptance of this License to do so, and
186
+ all its terms and conditions for copying, distributing or modifying
187
+ the Program or works based on it.
188
+
189
+ 6. Each time you redistribute the Program (or any work based on the
190
+ Program), the recipient automatically receives a license from the
191
+ original licensor to copy, distribute or modify the Program subject to
192
+ these terms and conditions. You may not impose any further
193
+ restrictions on the recipients' exercise of the rights granted herein.
194
+ You are not responsible for enforcing compliance by third parties to
195
+ this License.
196
+
197
+ 7. If, as a consequence of a court judgment or allegation of patent
198
+ infringement or for any other reason (not limited to patent issues),
199
+ conditions are imposed on you (whether by court order, agreement or
200
+ otherwise) that contradict the conditions of this License, they do not
201
+ excuse you from the conditions of this License. If you cannot
202
+ distribute so as to satisfy simultaneously your obligations under this
203
+ License and any other pertinent obligations, then as a consequence you
204
+ may not distribute the Program at all. For example, if a patent
205
+ license would not permit royalty-free redistribution of the Program by
206
+ all those who receive copies directly or indirectly through you, then
207
+ the only way you could satisfy both it and this License would be to
208
+ refrain entirely from distribution of the Program.
209
+
210
+ If any portion of this section is held invalid or unenforceable under
211
+ any particular circumstance, the balance of the section is intended to
212
+ apply and the section as a whole is intended to apply in other
213
+ circumstances.
214
+
215
+ It is not the purpose of this section to induce you to infringe any
216
+ patents or other property right claims or to contest validity of any
217
+ such claims; this section has the sole purpose of protecting the
218
+ integrity of the free software distribution system, which is
219
+ implemented by public license practices. Many people have made
220
+ generous contributions to the wide range of software distributed
221
+ through that system in reliance on consistent application of that
222
+ system; it is up to the author/donor to decide if he or she is willing
223
+ to distribute software through any other system and a licensee cannot
224
+ impose that choice.
225
+
226
+ This section is intended to make thoroughly clear what is believed to
227
+ be a consequence of the rest of this License.
228
+
229
+ 8. If the distribution and/or use of the Program is restricted in
230
+ certain countries either by patents or by copyrighted interfaces, the
231
+ original copyright holder who places the Program under this License
232
+ may add an explicit geographical distribution limitation excluding
233
+ those countries, so that distribution is permitted only in or among
234
+ countries not thus excluded. In such case, this License incorporates
235
+ the limitation as if written in the body of this License.
236
+
237
+ 9. The Free Software Foundation may publish revised and/or new versions
238
+ of the General Public License from time to time. Such new versions will
239
+ be similar in spirit to the present version, but may differ in detail to
240
+ address new problems or concerns.
241
+
242
+ Each version is given a distinguishing version number. If the Program
243
+ specifies a version number of this License which applies to it and "any
244
+ later version", you have the option of following the terms and conditions
245
+ either of that version or of any later version published by the Free
246
+ Software Foundation. If the Program does not specify a version number of
247
+ this License, you may choose any version ever published by the Free Software
248
+ Foundation.
249
+
250
+ 10. If you wish to incorporate parts of the Program into other free
251
+ programs whose distribution conditions are different, write to the author
252
+ to ask for permission. For software which is copyrighted by the Free
253
+ Software Foundation, write to the Free Software Foundation; we sometimes
254
+ make exceptions for this. Our decision will be guided by the two goals
255
+ of preserving the free status of all derivatives of our free software and
256
+ of promoting the sharing and reuse of software generally.
257
+
258
+ NO WARRANTY
259
+
260
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261
+ FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262
+ OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263
+ PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264
+ OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266
+ TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267
+ PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268
+ REPAIR OR CORRECTION.
269
+
270
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272
+ REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273
+ INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274
+ OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275
+ TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276
+ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277
+ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278
+ POSSIBILITY OF SUCH DAMAGES.
279
+
280
+ END OF TERMS AND CONDITIONS
281
+
282
+ How to Apply These Terms to Your New Programs
283
+
284
+ If you develop a new program, and you want it to be of the greatest
285
+ possible use to the public, the best way to achieve this is to make it
286
+ free software which everyone can redistribute and change under these terms.
287
+
288
+ To do so, attach the following notices to the program. It is safest
289
+ to attach them to the start of each source file to most effectively
290
+ convey the exclusion of warranty; and each file should have at least
291
+ the "copyright" line and a pointer to where the full notice is found.
292
+
293
+ <one line to give the program's name and a brief idea of what it does.>
294
+ Copyright (C) <year> <name of author>
295
+
296
+ This program is free software; you can redistribute it and/or modify
297
+ it under the terms of the GNU General Public License as published by
298
+ the Free Software Foundation; either version 2 of the License, or
299
+ (at your option) any later version.
300
+
301
+ This program is distributed in the hope that it will be useful,
302
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
303
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304
+ GNU General Public License for more details.
305
+
306
+ You should have received a copy of the GNU General Public License along
307
+ with this program; if not, write to the Free Software Foundation, Inc.,
308
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309
+
310
+ Also add information on how to contact you by electronic and paper mail.
311
+
312
+ If the program is interactive, make it output a short notice like this
313
+ when it starts in an interactive mode:
314
+
315
+ Gnomovision version 69, Copyright (C) year name of author
316
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317
+ This is free software, and you are welcome to redistribute it
318
+ under certain conditions; type `show c' for details.
319
+
320
+ The hypothetical commands `show w' and `show c' should show the appropriate
321
+ parts of the General Public License. Of course, the commands you use may
322
+ be called something other than `show w' and `show c'; they could even be
323
+ mouse-clicks or menu items--whatever suits your program.
324
+
325
+ You should also get your employer (if you work as a programmer) or your
326
+ school, if any, to sign a "copyright disclaimer" for the program, if
327
+ necessary. Here is a sample; alter the names:
328
+
329
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
331
+
332
+ <signature of Ty Coon>, 1 April 1989
333
+ Ty Coon, President of Vice
334
+
335
+ This General Public License does not permit incorporating your program into
336
+ proprietary programs. If your program is a subroutine library, you may
337
+ consider it more useful to permit linking proprietary applications with the
338
+ library. If this is what you want to do, use the GNU Lesser General
339
+ Public License instead of this License.
providers/facebook/compat/nextend-facebook-connect.php ADDED
@@ -0,0 +1,646 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ Plugin Name: Nextend Facebook Connect
5
+ Plugin URI: https://nextendweb.com/
6
+ Description: This plugins helps you create Facebook login and register buttons. The login and register process only takes one click.
7
+ Version: 2.0.2
8
+ Author: Nextendweb
9
+ License: GPL2
10
+ */
11
+
12
+ /* Copyright 2012 Roland Soos - Nextend (email : roland@nextendweb.com)
13
+
14
+ This program is free software; you can redistribute it and/or modify
15
+ it under the terms of the GNU General Public License, version 2, as
16
+ published by the Free Software Foundation.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26
+ */
27
+ global $new_fb_settings;
28
+ define('NEW_FB_LOGIN', 1);
29
+ if (!defined('NEW_FB_LOGIN_PLUGIN_BASENAME')) {
30
+ define('NEW_FB_LOGIN_PLUGIN_BASENAME', plugin_basename(__FILE__));
31
+ }
32
+ $new_fb_settings = maybe_unserialize(get_option('nextend_fb_connect'));
33
+
34
+ if (!function_exists('nextend_uniqid')) {
35
+ function nextend_uniqid() {
36
+ if (isset($_COOKIE['nextend_uniqid'])) {
37
+ if (get_site_transient('n_' . $_COOKIE['nextend_uniqid']) !== false) {
38
+ return $_COOKIE['nextend_uniqid'];
39
+ }
40
+ }
41
+ $_COOKIE['nextend_uniqid'] = uniqid('nextend', true);
42
+ setcookie('nextend_uniqid', $_COOKIE['nextend_uniqid'], time() + 3600, '/', '', false, true);
43
+ set_site_transient('n_' . $_COOKIE['nextend_uniqid'], 1, 3600);
44
+
45
+ return $_COOKIE['nextend_uniqid'];
46
+ }
47
+ }
48
+
49
+ /*
50
+ Loading style for buttons
51
+ */
52
+
53
+ function nextend_fb_connect_stylesheet() {
54
+
55
+ wp_register_style('nextend_fb_connect_stylesheet', plugins_url('buttons/facebook-btn.css', __FILE__));
56
+ wp_enqueue_style('nextend_fb_connect_stylesheet');
57
+ }
58
+
59
+ if (!isset($new_fb_settings['fb_load_style'])) {
60
+ $new_fb_settings['fb_load_style'] = 1;
61
+ }
62
+ if ($new_fb_settings['fb_load_style']) {
63
+ add_action('wp_enqueue_scripts', 'nextend_fb_connect_stylesheet');
64
+ add_action('login_enqueue_scripts', 'nextend_fb_connect_stylesheet');
65
+ add_action('admin_enqueue_scripts', 'nextend_fb_connect_stylesheet');
66
+ }
67
+
68
+ /*
69
+ Creating the required table on installation
70
+ */
71
+
72
+ function nextend_fb_connect_install() {
73
+
74
+ global $wpdb;
75
+ $table_name = $wpdb->prefix . "social_users";
76
+ $sql = "CREATE TABLE $table_name (
77
+ `ID` int(11) NOT NULL,
78
+ `type` varchar(20) NOT NULL,
79
+ `identifier` varchar(100) NOT NULL,
80
+ KEY `ID` (`ID`,`type`)
81
+ );";
82
+ require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
83
+ dbDelta($sql);
84
+ }
85
+
86
+ register_activation_hook(__FILE__, 'nextend_fb_connect_install');
87
+
88
+ /*
89
+ Adding query vars for the WP parser
90
+ */
91
+
92
+ function new_fb_add_query_var() {
93
+
94
+ global $wp;
95
+ $wp->add_query_var('editProfileRedirect');
96
+ $wp->add_query_var('loginFacebook');
97
+ $wp->add_query_var('loginFacebookdoauth');
98
+ }
99
+
100
+ add_filter('init', 'new_fb_add_query_var');
101
+
102
+ /* -----------------------------------------------------------------------------
103
+ Main function to handle the Sign in/Register/Linking process
104
+ ----------------------------------------------------------------------------- */
105
+
106
+ /*
107
+ Compatibility for older versions
108
+ */
109
+
110
+ function new_fb_login_compat() {
111
+
112
+ global $wp;
113
+ if ($wp->request == 'loginFacebook' || isset($wp->query_vars['loginFacebook'])) {
114
+ new_fb_login_action();
115
+ }
116
+ }
117
+
118
+ add_action('parse_request', 'new_fb_login_compat');
119
+
120
+ /*
121
+ For login page
122
+ */
123
+
124
+ function new_fb_login() {
125
+
126
+ if (isset($_REQUEST['loginFacebook']) && $_REQUEST['loginFacebook'] == '1') {
127
+ new_fb_login_action();
128
+ }
129
+ }
130
+
131
+ add_action('login_init', 'new_fb_login');
132
+
133
+ function new_fb_login_action() {
134
+
135
+ global $wp, $wpdb, $new_fb_settings;
136
+ if (isset($_GET['action']) && $_GET['action'] == 'unlink') {
137
+ $user_info = wp_get_current_user();
138
+ if ($user_info->ID) {
139
+ $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'social_users
140
+ WHERE ID = %d
141
+ AND type = \'fb\'', $user_info->ID));
142
+ set_site_transient($user_info->ID . '_new_fb_admin_notice', 'Your Facebook profile is successfully unlinked from your account.', 3600);
143
+ }
144
+ new_fb_redirect();
145
+ }
146
+
147
+ if (is_user_logged_in() && new_fb_is_user_connected()) {
148
+ new_fb_redirect();
149
+ exit;
150
+ }
151
+
152
+ if (!class_exists('Facebook')) {
153
+ require(dirname(__FILE__) . '/Facebook/autoload.php');
154
+ }
155
+
156
+ $settings = maybe_unserialize(get_option('nextend_fb_connect'));
157
+
158
+ if (defined('NEXTEND_FB_APP_ID')) {
159
+ $settings['fb_appid'] = NEXTEND_FB_APP_ID;
160
+ }
161
+ if (defined('NEXTEND_FB_APP_SECRET')) {
162
+ $settings['fb_secret'] = NEXTEND_FB_APP_SECRET;
163
+ }
164
+
165
+ $fb = new Facebook\Facebook(array(
166
+ 'app_id' => $settings['fb_appid'],
167
+ 'app_secret' => $settings['fb_secret'],
168
+ 'persistent_data_handler' => new Facebook\PersistentData\FacebookWordPressPersistentDataHandler(nextend_uniqid())
169
+ ));
170
+
171
+ if (isset($_REQUEST['code'])) {
172
+ $helper = $fb->getRedirectLoginHelper();
173
+ try {
174
+ $accessToken = $helper->getAccessToken(new_fb_login_url());
175
+ } catch (Facebook\Exceptions\FacebookResponseException $e) {
176
+ // When Graph returns an error
177
+ echo 'Graph returned an error: ' . $e->getMessage();
178
+ exit;
179
+ } catch (Facebook\Exceptions\FacebookSDKException $e) {
180
+ // When validation fails or other local issues
181
+ echo 'Facebook SDK returned an error: ' . $e->getMessage();
182
+ exit;
183
+ }
184
+
185
+ if (!isset($accessToken)) {
186
+ if ($helper->getError()) {
187
+ header('HTTP/1.0 401 Unauthorized');
188
+ echo "Error: " . $helper->getError() . "\n";
189
+ echo "Error Code: " . $helper->getErrorCode() . "\n";
190
+ echo "Error Reason: " . $helper->getErrorReason() . "\n";
191
+ echo "Error Description: " . $helper->getErrorDescription() . "\n";
192
+ } else {
193
+ header('HTTP/1.0 400 Bad Request');
194
+ echo 'Bad request';
195
+ }
196
+ exit;
197
+ }
198
+
199
+ if (!$accessToken->isLongLived()) {
200
+ // Exchanges a short-lived access token for a long-lived one
201
+ try {
202
+ // The OAuth 2.0 client handler helps us manage access tokens
203
+ $oAuth2Client = $fb->getOAuth2Client();
204
+ $accessToken = $oAuth2Client->getLongLivedAccessToken($accessToken);
205
+ } catch (Facebook\Exceptions\FacebookSDKException $e) {
206
+ echo "<p>Error getting long-lived access token: " . $helper->getMessage() . "</p>\n\n";
207
+ exit;
208
+ }
209
+ }
210
+
211
+ $fb->setDefaultAccessToken($accessToken);
212
+
213
+ $fields = array(
214
+ 'id',
215
+ 'name',
216
+ 'email',
217
+ 'first_name',
218
+ 'last_name'
219
+ );
220
+ $response = $fb->get('/me?fields=' . implode(',', apply_filters('nextend_fb_me_fields', $fields)));
221
+ $user_profile = $response->getGraphUser();
222
+
223
+ $ID = $wpdb->get_var($wpdb->prepare('
224
+ SELECT ID FROM ' . $wpdb->prefix . 'social_users WHERE type = "fb" AND identifier = "%d"
225
+ ', $user_profile['id']));
226
+ if (!get_user_by('id', $ID)) {
227
+ $wpdb->query($wpdb->prepare('
228
+ DELETE FROM ' . $wpdb->prefix . 'social_users WHERE ID = "%d"
229
+ ', $ID));
230
+ $ID = null;
231
+ }
232
+ if (!is_user_logged_in()) {
233
+ if ($ID == null) { // Register
234
+
235
+ if (!isset($user_profile['email'])) {
236
+ $user_profile['email'] = $user_profile['id'] . '@facebook.com';
237
+ }
238
+ $ID = email_exists($user_profile['email']);
239
+ if ($ID == false) { // Real register
240
+
241
+ require_once(ABSPATH . WPINC . '/registration.php');
242
+ $random_password = wp_generate_password($length = 12, $include_standard_special_chars = false);
243
+ if (!isset($new_fb_settings['fb_user_prefix'])) {
244
+ $new_fb_settings['fb_user_prefix'] = 'facebook-';
245
+ }
246
+
247
+ $username = strtolower($user_profile['first_name'] . $user_profile['last_name']);
248
+ $sanitized_user_login = sanitize_user($new_fb_settings['fb_user_prefix'] . $username);
249
+ if (!validate_username($sanitized_user_login)) {
250
+ $sanitized_user_login = sanitize_user('facebook' . $user_profile['id']);
251
+ }
252
+ $defaul_user_name = $sanitized_user_login;
253
+ $i = 1;
254
+ while (username_exists($sanitized_user_login)) {
255
+ $sanitized_user_login = $defaul_user_name . $i;
256
+ $i++;
257
+ }
258
+ $ID = wp_create_user($sanitized_user_login, $random_password, $user_profile['email']);
259
+ if (!is_wp_error($ID)) {
260
+ wp_new_user_notification($ID, $random_password);
261
+ $user_info = get_userdata($ID);
262
+ wp_update_user(array(
263
+ 'ID' => $ID,
264
+ 'display_name' => $user_profile['name'],
265
+ 'first_name' => $user_profile['first_name'],
266
+ 'last_name' => $user_profile['last_name']
267
+ ));
268
+
269
+ //update_user_meta( $ID, 'new_fb_default_password', $user_info->user_pass);
270
+ do_action('nextend_fb_user_registered', $ID, $user_profile, $fb);
271
+ } else {
272
+ return;
273
+ }
274
+ }
275
+ if ($ID) {
276
+ $wpdb->insert($wpdb->prefix . 'social_users', array(
277
+ 'ID' => $ID,
278
+ 'type' => 'fb',
279
+ 'identifier' => $user_profile['id']
280
+ ), array(
281
+ '%d',
282
+ '%s',
283
+ '%s'
284
+ ));
285
+ }
286
+ if (isset($new_fb_settings['fb_redirect_reg']) && $new_fb_settings['fb_redirect_reg'] != '' && $new_fb_settings['fb_redirect_reg'] != 'auto') {
287
+ set_site_transient(nextend_uniqid() . '_fb_r', $new_fb_settings['fb_redirect_reg'], 3600);
288
+ }
289
+ }
290
+ if ($ID) { // Login
291
+
292
+ $secure_cookie = is_ssl();
293
+ $secure_cookie = apply_filters('secure_signon_cookie', $secure_cookie, array());
294
+ global $auth_secure_cookie; // XXX ugly hack to pass this to wp_authenticate_cookie
295
+
296
+ $auth_secure_cookie = $secure_cookie;
297
+ wp_set_auth_cookie($ID, true, $secure_cookie);
298
+ $user_info = get_userdata($ID);
299
+ update_user_meta($ID, 'fb_profile_picture', 'https://graph.facebook.com/' . $user_profile['id'] . '/picture?type=large');
300
+ do_action('wp_login', $user_info->user_login, $user_info);
301
+ update_user_meta($ID, 'fb_user_access_token', $accessToken);
302
+ do_action('nextend_fb_user_logged_in', $ID, $user_profile, $fb);
303
+ }
304
+ } else {
305
+ $current_user = wp_get_current_user();
306
+ if ($current_user->ID == $ID) {
307
+
308
+ // It was a simple login
309
+
310
+ } elseif ($ID === null) { // Let's connect the accout to the current user!
311
+
312
+ $wpdb->insert($wpdb->prefix . 'social_users', array(
313
+ 'ID' => $current_user->ID,
314
+ 'type' => 'fb',
315
+ 'identifier' => $user_profile['id']
316
+ ), array(
317
+ '%d',
318
+ '%s',
319
+ '%s'
320
+ ));
321
+ update_user_meta($current_user->ID, 'fb_user_access_token', (string)$accessToken);
322
+ do_action('nextend_fb_user_account_linked', $ID, $user_profile, $fb);
323
+ $user_info = wp_get_current_user();
324
+ set_site_transient($user_info->ID . '_new_fb_admin_notice', 'Your Facebook profile is successfully linked with your account. Now you can sign in with Facebook easily.', 3600);
325
+ } else {
326
+ $user_info = wp_get_current_user();
327
+ set_site_transient($user_info->ID . '_new_fb_admin_notice', 'This Facebook profile is already linked with other account. Linking process failed!', 3600);
328
+ }
329
+ }
330
+ new_fb_redirect();
331
+ } else {
332
+ $helper = $fb->getRedirectLoginHelper();
333
+
334
+ $permissions = apply_filters('nextend_fb_permissions', array('email'));
335
+ $loginUrl = $helper->getLoginUrl(new_fb_login_url(), $permissions);
336
+
337
+ if (isset($new_fb_settings['fb_redirect']) && $new_fb_settings['fb_redirect'] != '' && $new_fb_settings['fb_redirect'] != 'auto') {
338
+ $_GET['redirect'] = $new_fb_settings['fb_redirect'];
339
+ }
340
+ if (isset($_GET['redirect'])) {
341
+ set_site_transient(nextend_uniqid() . '_fb_r', $_GET['redirect'], 3600);
342
+ }
343
+ $redirect = get_site_transient(nextend_uniqid() . '_fb_r');
344
+ if ($redirect == '' || $redirect == new_fb_login_url()) {
345
+ set_site_transient(nextend_uniqid() . '_fb_r', site_url(), 3600);
346
+ }
347
+
348
+ header('Location: ' . $loginUrl);
349
+ exit;
350
+ }
351
+ }
352
+
353
+ /*
354
+ Is the current user connected the Facebook profile?
355
+ */
356
+
357
+ function new_fb_is_user_connected() {
358
+
359
+ global $wpdb;
360
+ $current_user = wp_get_current_user();
361
+ $ID = $wpdb->get_var($wpdb->prepare('
362
+ SELECT identifier FROM ' . $wpdb->prefix . 'social_users WHERE type = "fb" AND ID = "%d"
363
+ ', $current_user->ID));
364
+ if ($ID === null) {
365
+ return false;
366
+ }
367
+
368
+ return $ID;
369
+ }
370
+
371
+ function new_fb_get_user_access_token($id) {
372
+
373
+ return get_user_meta($id, 'fb_user_access_token', true);
374
+ }
375
+
376
+ /*
377
+ Connect Field in the Profile page
378
+ */
379
+
380
+ function new_add_fb_connect_field() {
381
+
382
+ global $new_is_social_header;
383
+
384
+ //if(new_fb_is_user_connected()) return;
385
+ if ($new_is_social_header === null) {
386
+ ?>
387
+ <h3>Social connect</h3>
388
+ <?php
389
+ $new_is_social_header = true;
390
+ }
391
+ ?>
392
+ <table class="form-table">
393
+ <tbody>
394
+ <tr>
395
+ <th>
396
+ </th>
397
+ <td>
398
+ <?php
399
+ if (new_fb_is_user_connected()) {
400
+ echo new_fb_unlink_button();
401
+ } else {
402
+ echo new_fb_link_button();
403
+ }
404
+ ?>
405
+ </td>
406
+ </tr>
407
+ </tbody>
408
+ </table>
409
+ <?php
410
+ }
411
+
412
+ add_action('profile_personal_options', 'new_add_fb_connect_field');
413
+
414
+ function new_add_fb_login_form() {
415
+
416
+ ?>
417
+ <script type="text/javascript">
418
+ if (jQuery.type(has_social_form) === 'undefined') {
419
+ var has_social_form = false;
420
+ var socialLogins = null;
421
+ }
422
+ jQuery(document).ready(function () {
423
+ (function ($) {
424
+ if (!has_social_form) {
425
+ has_social_form = true;
426
+ var loginForm = $('#loginform,#registerform,#front-login-form,#setupform');
427
+ socialLogins = $(
428
+ '<div class="newsociallogins" style="text-align: center;"><div style="clear:both;"></div></div>');
429
+ if (loginForm.find('input').length > 0) {
430
+ loginForm.prepend("<h3 style='text-align:center;'><?php _e('OR'); ?></h3>");
431
+ }
432
+ loginForm.prepend(socialLogins);
433
+ socialLogins = loginForm.find('.newsociallogins');
434
+ }
435
+ if (!window.fb_added) {
436
+ socialLogins.prepend(
437
+ '<?php echo addslashes(preg_replace('/^\s+|\n|\r|\s+$/m', '', new_fb_sign_button())); ?>');
438
+ window.fb_added = true;
439
+ }
440
+ }(jQuery));
441
+ });
442
+ </script>
443
+ <?php
444
+ }
445
+
446
+ add_action('login_form', 'new_add_fb_login_form');
447
+ add_action('register_form', 'new_add_fb_login_form');
448
+ add_action('bp_sidebar_login_form', 'new_add_fb_login_form');
449
+ add_filter('get_avatar', 'new_fb_insert_avatar', 5, 5);
450
+
451
+ function new_fb_insert_avatar($avatar = '', $id_or_email, $size = 96, $default = '', $alt = false) {
452
+
453
+ $id = 0;
454
+ if (is_numeric($id_or_email)) {
455
+ $id = $id_or_email;
456
+ } else if (is_string($id_or_email)) {
457
+ $u = get_user_by('email', $id_or_email);
458
+ $id = $u->id;
459
+ } else if (is_object($id_or_email)) {
460
+ $id = $id_or_email->user_id;
461
+ }
462
+ if ($id == 0) {
463
+ return $avatar;
464
+ }
465
+ $pic = get_user_meta($id, 'fb_profile_picture', true);
466
+ if (!$pic || $pic == '') {
467
+ return $avatar;
468
+ }
469
+ $avatar = preg_replace('/src=("|\').*?("|\')/i', 'src=\'' . $pic . '\'', $avatar);
470
+
471
+ return $avatar;
472
+ }
473
+
474
+ add_filter('bp_core_fetch_avatar', 'new_fb_bp_insert_avatar', 3, 5);
475
+
476
+ function new_fb_bp_insert_avatar($avatar = '', $params, $id) {
477
+ if (!is_numeric($id) || strpos($avatar, 'gravatar') === false) {
478
+ return $avatar;
479
+ }
480
+ $pic = get_user_meta($id, 'fb_profile_picture', true);
481
+ if (!$pic || $pic == '') {
482
+ return $avatar;
483
+ }
484
+ $avatar = preg_replace('/src=("|\').*?("|\')/i', 'src=\'' . $pic . '\'', $avatar);
485
+
486
+ return $avatar;
487
+ }
488
+
489
+ /*
490
+ Options Page
491
+ */
492
+ require_once(trailingslashit(dirname(__FILE__)) . "nextend-facebook-settings.php");
493
+ if (class_exists('NextendFBSettings')) {
494
+ $nextendfbsettings = new NextendFBSettings();
495
+ if (isset($nextendfbsettings)) {
496
+ add_action('admin_menu', array(
497
+ &$nextendfbsettings,
498
+ 'NextendFB_Menu'
499
+ ), 1);
500
+ }
501
+ }
502
+ add_filter('plugin_action_links', 'new_fb_plugin_action_links', 10, 2);
503
+
504
+ function new_fb_plugin_action_links($links, $file) {
505
+
506
+ if ($file != NEW_FB_LOGIN_PLUGIN_BASENAME) {
507
+ return $links;
508
+ }
509
+ $settings_link = '<a href="' . esc_url(menu_page_url('nextend-facebook-connect', false)) . '">' . esc_html('Settings') . '</a>';
510
+ array_unshift($links, $settings_link);
511
+
512
+ return $links;
513
+ }
514
+
515
+ /* -----------------------------------------------------------------------------
516
+ Miscellaneous functions
517
+ ----------------------------------------------------------------------------- */
518
+
519
+ function new_fb_sign_button() {
520
+
521
+ global $new_fb_settings;
522
+
523
+ return '<a href="' . esc_url(new_fb_login_url() . (isset($_GET['redirect_to']) ? '&redirect=' . $_GET['redirect_to'] : '')) . '" rel="nofollow">' . $new_fb_settings['fb_login_button'] . '</a><br />';
524
+ }
525
+
526
+ function new_fb_link_button() {
527
+
528
+ global $new_fb_settings;
529
+
530
+ return '<a href="' . esc_url(new_fb_login_url() . '&redirect=' . new_fb_curPageURL()) . '">' . $new_fb_settings['fb_link_button'] . '</a><br />';
531
+ }
532
+
533
+ function new_fb_unlink_button() {
534
+
535
+ global $new_fb_settings;
536
+
537
+ return '<a href="' . esc_url(new_fb_login_url() . '&action=unlink&redirect=' . new_fb_curPageURL()) . '">' . $new_fb_settings['fb_unlink_button'] . '</a><br />';
538
+ }
539
+
540
+ function new_fb_curPageURL() {
541
+ global $wp;
542
+
543
+ return home_url(add_query_arg(array(), $wp->request));
544
+ }
545
+
546
+ function new_fb_login_url() {
547
+ $site_url = site_url('wp-login.php');
548
+
549
+ return $site_url . (strpos($site_url, "?") === false ? '?' : '&') . 'loginFacebook=1';
550
+ }
551
+
552
+ function new_fb_redirect() {
553
+
554
+ $redirect = get_site_transient(nextend_uniqid() . '_fb_r');
555
+
556
+ if (!$redirect || $redirect == '' || $redirect == new_fb_login_url()) {
557
+ if (isset($_GET['redirect'])) {
558
+ $redirect = $_GET['redirect'];
559
+ } else {
560
+ $redirect = site_url();
561
+ }
562
+ }
563
+ $redirect = wp_sanitize_redirect($redirect);
564
+ $redirect = wp_validate_redirect($redirect, site_url());
565
+ header('LOCATION: ' . $redirect);
566
+ delete_site_transient(nextend_uniqid() . '_fb_r');
567
+ exit;
568
+ }
569
+
570
+ function new_fb_edit_profile_redirect() {
571
+
572
+ global $wp;
573
+ if (isset($wp->query_vars['editProfileRedirect'])) {
574
+ if (function_exists('bp_loggedin_user_domain')) {
575
+ header('LOCATION: ' . bp_loggedin_user_domain() . 'profile/edit/group/1/');
576
+ } else {
577
+ header('LOCATION: ' . self_admin_url('profile.php'));
578
+ }
579
+ exit;
580
+ }
581
+ }
582
+
583
+ add_action('parse_request', 'new_fb_edit_profile_redirect');
584
+
585
+ function new_fb_jquery() {
586
+
587
+ wp_enqueue_script('jquery');
588
+ }
589
+
590
+ add_action('login_form_login', 'new_fb_jquery');
591
+ add_action('login_form_register', 'new_fb_jquery');
592
+
593
+ /*
594
+ Session notices used in the profile settings
595
+ */
596
+
597
+ function new_fb_admin_notice() {
598
+ $user_info = wp_get_current_user();
599
+ $notice = get_site_transient($user_info->ID . '_new_fb_admin_notice');
600
+ if ($notice !== false) {
601
+ echo '<div class="updated">
602
+ <p>' . $notice . '</p>
603
+ </div>';
604
+ delete_site_transient($user_info->ID . '_new_fb_admin_notice');
605
+ }
606
+ }
607
+
608
+ add_action('admin_notices', 'new_fb_admin_notice');
609
+
610
+ function new_fb_2018_march_notice() {
611
+ if (!get_option('nfbc-2018march', false)) {
612
+ if (!empty($_GET['nextendfacebookconnect']) && $_GET['nextendfacebookconnect'] == '2018march') {
613
+ update_option('nfbc-2018march', true);
614
+
615
+ return;
616
+ }
617
+ ?>
618
+ <div class="nextend-facebook-connect-dismiss notice notice-warning is-dismissible">
619
+ <p>In March, Facebook will turn on <a
620
+ href="https://developers.facebook.com/blog/post/2017/12/18/strict-uri-matching/"
621
+ target="_blank">strict URI matching</a>.
622
+ This might prevent your visitors to log with Facebook, so immediate action required on your side.<br>
623
+ <a href="<?php echo NextendSocialLoginAdmin::trackUrl('https://nextendweb.com/nextend-social-login-docs/facebook-api-changes/', 'header-menu-docs'); ?>"
624
+ target="_blank">Read this guide to prevent future issues.</a>
625
+ </p>
626
+ <p>Your <b>valid oauth redirect URIs</b>:</p>
627
+ <ul>
628
+ <li><?php echo new_fb_login_url(); ?></li>
629
+ <li><?php echo add_query_arg(array('loginSocial' => 'facebook'), site_url('wp-login.php')); ?></li>
630
+ </ul>
631
+ </div>
632
+ <script>
633
+ jQuery(function ($) {
634
+ $(document).ready(function () {
635
+ $('.nextend-facebook-connect-dismiss .notice-dismiss').on('click', function () {
636
+ window.location = window.location + (window.location.href.indexOf('?') > 0 ? '&' : '?') +
637
+ 'nextendfacebookconnect=2018march';
638
+ });
639
+ });
640
+ });
641
+ </script>
642
+ <?php
643
+ }
644
+ }
645
+
646
+ add_action('admin_notices', 'new_fb_2018_march_notice');
providers/facebook/compat/nextend-facebook-settings.php ADDED
@@ -0,0 +1,320 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Nextend FB Connect Settings Page
4
+ */
5
+
6
+ $newfb_status = "normal";
7
+
8
+ if (!class_exists('NextendFBSettings')) {
9
+
10
+ add_action('admin_init', array(
11
+ 'NextendFBSettings',
12
+ 'store_settings'
13
+ ));
14
+
15
+ class NextendFBSettings {
16
+
17
+ static function store_settings() {
18
+ if (current_user_can('manage_options')) {
19
+ if (isset($_POST['newfb_update_options']) && check_admin_referer('nextend-facebook-connect')) {
20
+ if ($_POST['newfb_update_options'] == 'Y') {
21
+ foreach ($_POST AS $k => $v) {
22
+ $_POST[$k] = stripslashes($v);
23
+ }
24
+ unset($_POST['Submit']);
25
+ $sanitize = array(
26
+ 'newfb_update_options',
27
+ 'fb_appid',
28
+ 'fb_secret',
29
+ 'fb_redirect',
30
+ 'fb_redirect_reg',
31
+ 'fb_load_style'
32
+ );
33
+ foreach ($sanitize AS $k) {
34
+ $_POST[$k] = sanitize_text_field($_POST[$k]);
35
+ }
36
+
37
+ $_POST['fb_user_prefix'] = preg_replace("/[^A-Za-z0-9\-_ ]/", '', $_POST['fb_user_prefix']);
38
+ update_option("nextend_fb_connect", maybe_serialize($_POST));
39
+ $newfb_status = 'update_success';
40
+ }
41
+ }
42
+ }
43
+ }
44
+
45
+ static function NextendFB_Options_Page() {
46
+ $domain = get_option('siteurl');
47
+ $domain = str_replace(array(
48
+ 'http://',
49
+ 'https://'
50
+ ), array(
51
+ '',
52
+ ''
53
+ ), $domain);
54
+ $domain = str_replace('www.', '', $domain);
55
+ $a = explode("/", $domain);
56
+ $domain = $a[0];
57
+ ?>
58
+
59
+ <div class="wrap">
60
+ <div id="newfb-options">
61
+ <div id="newfb-title"><h2>Nextend Facebook Connect Settings</h2></div>
62
+ <?php
63
+ global $newfb_status;
64
+ if ($newfb_status == 'update_success') {
65
+ $message = 'Configuration updated' . "<br />";
66
+ } else if ($newfb_status == 'update_failed') {
67
+ $message = 'Error while saving options' . "<br />";
68
+ } else {
69
+ $message = '';
70
+ }
71
+
72
+ if ($message != "") {
73
+ ?>
74
+ <div class="updated"><strong><p><?php
75
+ echo $message;
76
+ ?></p></strong></div><?php
77
+ } ?>
78
+
79
+ <?php
80
+ if (!function_exists('curl_init')) {
81
+ ?>
82
+ <div class="error"><strong><p>Facebook needs the CURL PHP extension. Contact your server
83
+ adminsitrator!</p></strong></div>
84
+ <?php
85
+ } else {
86
+ $version = curl_version();
87
+ $ssl_supported = ($version['features'] & CURL_VERSION_SSL);
88
+ if (!$ssl_supported) {
89
+ ?>
90
+ <div class="error"><strong><p>Protocol https not supported or disabled in libcurl. Contact
91
+ your server adminsitrator!</p></strong></div>
92
+ <?php
93
+ }
94
+ }
95
+ if (!function_exists('json_decode')) {
96
+ ?>
97
+ <div class="error"><strong><p>Facebook needs the JSON PHP extension. Contact your server
98
+ adminsitrator!</p></strong></div>
99
+ <?php
100
+ }
101
+ ?>
102
+
103
+ <div id="newfb-desc">
104
+ <p><?php echo 'This plugins helps you create Facebook login and register buttons. The login and register process only takes one click and you can fully customize the buttons with images and other assets.'; ?></p>
105
+ <h3><?php echo 'Setup'; ?></h3>
106
+ <p>
107
+ <?php echo '<ol><li><a href="https://developers.facebook.com/apps/" target="_blank">Create a facebook app!</a></li>'; ?>
108
+ <?php echo '<li>Don\'t choose from the listed options, but click on <b>advanced setup</b> in the bottom.</li>'; ?>
109
+ <?php echo '<li>Choose an <b>app name</b>, and a <b>category</b>, then click on <b>Create App ID</b>.</li>'; ?>
110
+ <?php echo '<li>Pass the security check.</li>'; ?>
111
+ <?php echo '<li>Go to the <b>Settings</b> of the application.</li>'; ?>
112
+ <?php echo '<li>Click on <b>+ Add Platform</b>, and choose <b>Website</b>.</li>'; ?>
113
+ <?php echo '<li>Give your website\'s address at the <b>Site URL</b> field with: <b>' . get_option('siteurl') . '</b></li>'; ?>
114
+ <?php echo '<li>Give a <b>Contact Email</b> and click on <b>Save Changes</b>.</li>'; ?>
115
+ <?php echo '<li>Go to <b>Status & Review</b>, and change the availability for the general public to <b>YES</b>.</li>'; ?>
116
+ <?php echo '<li>Go back to the <b>Settings</b>, and copy the <b>App ID</b>, and <b>APP Secret</b>, which you have to copy and paste below.</li>'; ?>
117
+ <?php echo '<li><b>Save changes!</b></li></ol>'; ?>
118
+
119
+
120
+ </p>
121
+ <h3><?php echo 'Usage'; ?></h3>
122
+ <h4><?php echo 'Simple link'; ?></h4>
123
+ <p><?php echo '&lt;a href="' . new_fb_login_url() . '&redirect=' . get_option('siteurl') . '" onclick="window.location = \'' . new_fb_login_url() . '&redirect=\'+window.location.href; return false;"&gt;Click here to login or register with Facebook&lt;/a&gt;'; ?></p>
124
+
125
+ <h4><?php echo 'Image button'; ?></h4>
126
+ <p><?php echo '&lt;a href="' . new_fb_login_url() . '&redirect=' . get_option('siteurl') . '" onclick="window.location = \'' . new_fb_login_url() . '&redirect=\'+window.location.href; return false;"&gt; &lt;img src="HereComeTheImage" /&gt; &lt;/a&gt;'; ?></p>
127
+
128
+ <h3><?php echo 'Note'; ?></h3>
129
+ <p><?php echo 'If the Facebook user\'s email address already used by another member of your site, the facebook profile will be automatically linked to the existing profile!'; ?></p>
130
+
131
+ </div>
132
+
133
+ <!--right-->
134
+ <div class="postbox-container" style="float:right;width:30%;">
135
+ <div class="metabox-holder">
136
+ <div class="meta-box-sortables">
137
+
138
+ <!--about-->
139
+ <div id="newfb-about" class="postbox">
140
+ <h3 class="hndle"><?php echo 'About this plugin'; ?></h3>
141
+ <div class="inside">
142
+ <ul>
143
+
144
+ <li>
145
+ <a href="http://www.nextendweb.com/social-connect-plugins-for-wordpress.html"
146
+ target="_blank"><?php echo 'Check the related <b>blog post</b>!'; ?></a>
147
+ </li>
148
+ <li><br></li>
149
+ <li><a href="http://wordpress.org/extend/plugins/nextend-facebook-connect/"
150
+ target="_blank"><?php echo 'Nextend Facebook Connect'; ?></a></li>
151
+ <li><br></li>
152
+ <li><a href="http://profiles.wordpress.org/nextendweb"
153
+ target="_blank"><?php echo 'Nextend plugins at WordPress.org'; ?></a>
154
+ </li>
155
+ </ul>
156
+ </div>
157
+ </div>
158
+ <!--about end-->
159
+
160
+ <!--others-->
161
+ <!--others end-->
162
+
163
+ </div>
164
+ </div>
165
+ </div>
166
+ <!--right end-->
167
+
168
+ <!--left-->
169
+ <div class="postbox-container" style="float:left;width: 69%;">
170
+ <div class="metabox-holder">
171
+ <div class="meta-box-sortabless">
172
+
173
+ <!--setting-->
174
+ <div id="newfb-setting" class="postbox">
175
+ <h3 class="hndle"><?php echo 'Settings'; ?></h3>
176
+ <?php $nextend_fb_connect = maybe_unserialize(get_option('nextend_fb_connect')); ?>
177
+
178
+ <form method="post"
179
+ action="<?php echo get_bloginfo("wpurl"); ?>/wp-admin/options-general.php?page=nextend-facebook-connect">
180
+ <?php wp_nonce_field('nextend-facebook-connect'); ?>
181
+ <input type="hidden" name="newfb_update_options" value="Y">
182
+
183
+ <table class="form-table">
184
+ <tr>
185
+ <th scope="row"><?php echo 'Facebook App ID:'; ?></th>
186
+ <td>
187
+ <input type="text" name="fb_appid"
188
+ value="<?php echo esc_html($nextend_fb_connect['fb_appid']); ?>"/>
189
+ </td>
190
+ </tr>
191
+
192
+ <tr>
193
+ <th scope="row"><?php echo 'Facebook App Secret:'; ?></th>
194
+ <td>
195
+ <input type="text" name="fb_secret"
196
+ value="<?php echo esc_html($nextend_fb_connect['fb_secret']); ?>"/>
197
+ </td>
198
+ </tr>
199
+
200
+ <tr>
201
+ <th scope="row"><?php echo 'New user prefix:'; ?></th>
202
+ <td>
203
+ <?php if (!isset($nextend_fb_connect['fb_user_prefix'])) {
204
+ $nextend_fb_connect['fb_user_prefix'] = 'Facebook - ';
205
+ } ?>
206
+ <input type="text" name="fb_user_prefix"
207
+ value="<?php echo esc_html($nextend_fb_connect['fb_user_prefix']); ?>"/>
208
+ </td>
209
+ </tr>
210
+
211
+ <tr>
212
+ <th scope="row"><?php echo 'Fixed redirect url for login:'; ?></th>
213
+ <td>
214
+ <?php if (!isset($nextend_fb_connect['fb_redirect'])) {
215
+ $nextend_fb_connect['fb_redirect'] = 'auto';
216
+ } ?>
217
+ <input type="text" name="fb_redirect"
218
+ value="<?php echo esc_html($nextend_fb_connect['fb_redirect']); ?>"/>
219
+ </td>
220
+ </tr>
221
+
222
+ <tr>
223
+ <th scope="row"><?php echo 'Fixed redirect url for register:'; ?></th>
224
+ <td>
225
+ <?php if (!isset($nextend_fb_connect['fb_redirect_reg'])) {
226
+ $nextend_fb_connect['fb_redirect_reg'] = 'auto';
227
+ } ?>
228
+ <input type="text" name="fb_redirect_reg"
229
+ value="<?php echo esc_html($nextend_fb_connect['fb_redirect_reg']); ?>"/>
230
+ </td>
231
+ </tr>
232
+
233
+ <tr>
234
+ <th scope="row"><?php echo 'Load button stylesheet:'; ?></th>
235
+ <td>
236
+ <?php if (!isset($nextend_fb_connect['fb_load_style'])) {
237
+ $nextend_fb_connect['fb_load_style'] = 1;
238
+ } ?>
239
+ <input name="fb_load_style" id="fb_load_style_yes" value="1"
240
+ type="radio" <?php if (isset($nextend_fb_connect['fb_load_style']) && $nextend_fb_connect['fb_load_style']) { ?> checked <?php } ?>>
241
+ Yes &nbsp;&nbsp;&nbsp;&nbsp;
242
+ <input name="fb_load_style" id="fb_load_style_no" value="0"
243
+ type="radio" <?php if (isset($nextend_fb_connect['fb_load_style']) && $nextend_fb_connect['fb_load_style'] == 0) { ?> checked <?php } ?>>
244
+ No
245
+ </td>
246
+ </tr>
247
+
248
+ <tr>
249
+ <th scope="row"><?php echo 'Login button:'; ?></th>
250
+ <td>
251
+ <?php if (!isset($nextend_fb_connect['fb_login_button'])) {
252
+ $nextend_fb_connect['fb_login_button'] = '<div class="new-fb-btn new-fb-1 new-fb-default-anim"><div class="new-fb-1-1"><div class="new-fb-1-1-1">CONNECT WITH</div></div></div>';
253
+ } ?>
254
+ <textarea cols="83" rows="3"
255
+ name="fb_login_button"><?php echo esc_html($nextend_fb_connect['fb_login_button']); ?></textarea>
256
+ </td>
257
+ </tr>
258
+
259
+ <tr>
260
+ <th scope="row"><?php echo 'Link account button:'; ?></th>
261
+ <td>
262
+ <?php if (!isset($nextend_fb_connect['fb_link_button'])) {
263
+ $nextend_fb_connect['fb_link_button'] = '<div class="new-fb-btn new-fb-1 new-fb-default-anim"><div class="new-fb-1-1"><div class="new-fb-1-1-1">LINK ACCOUNT TO</div></div></div>';
264
+ } ?>
265
+ <textarea cols="83" rows="3"
266
+ name="fb_link_button"><?php echo esc_html($nextend_fb_connect['fb_link_button']); ?></textarea>
267
+ </td>
268
+ </tr>
269
+
270
+ <tr>
271
+ <th scope="row"><?php echo 'Unlink account button:'; ?></th>
272
+ <td>
273
+ <?php if (!isset($nextend_fb_connect['fb_unlink_button'])) {
274
+ $nextend_fb_connect['fb_unlink_button'] = '<div class="new-fb-btn new-fb-1 new-fb-default-anim"><div class="new-fb-1-1"><div class="new-fb-1-1-1">UNLINK ACCOUNT</div></div></div>';
275
+ } ?>
276
+ <textarea cols="83" rows="3"
277
+ name="fb_unlink_button"><?php echo esc_html($nextend_fb_connect['fb_unlink_button']); ?></textarea>
278
+ </td>
279
+ </tr>
280
+ <tr>
281
+ <th scope="row"></th>
282
+ <td>
283
+ <a href="http://www.nextendweb.com/social-connect-button-generator"
284
+ target="_blank"><img style="margin-left: -4px;"
285
+ src="<?php echo plugins_url('generatorbanner.png', __FILE__); ?>"/></a>
286
+ </td>
287
+ </tr>
288
+ </table>
289
+
290
+ <p class="submit">
291
+ <input style="margin-left: 10%;" type="submit" name="Submit"
292
+ value="<?php echo 'Save Changes'; ?>"/>
293
+ </p>
294
+ </form>
295
+ </div>
296
+ <!--setting end-->
297
+
298
+ <!--others-->
299
+ <!--others end-->
300
+
301
+ </div>
302
+ </div>
303
+ </div>
304
+ <!--left end-->
305
+
306
+ </div>
307
+ </div>
308
+ <?php
309
+ }
310
+
311
+ function NextendFB_Menu() {
312
+ add_options_page(__('Nextend FB Connect'), __('Nextend FB Connect'), 'manage_options', 'nextend-facebook-connect', array(
313
+ 'NextendFBSettings',
314
+ 'NextendFB_Options_Page'
315
+ ));
316
+ }
317
+
318
+ }
319
+ }
320
+ ?>
providers/facebook/compat/readme.txt ADDED
@@ -0,0 +1,263 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Nextend Facebook Connect ===
2
+ Contributors: nextendweb
3
+ Tags: facebook, register, login, social connect, social, facebook connect
4
+ Donate link: https://www.facebook.com/nextendweb
5
+ Requires at least: 3.0
6
+ Tested up to: 4.7.3
7
+ Stable tag: 2.0.2
8
+ License: GPLv2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
+
11
+ One click registration & login plugin for Facebook? Easy installation? Is it totally free and comes with support? Yeah!
12
+
13
+ == Description ==
14
+
15
+ Check the [DEMO](http://secure.nextendweb.com/) on our site.
16
+
17
+ Also we created a [Social Connect button generator](http://www.nextendweb.com/social-connect-button-generator) for this plugin. This allows you to create fancy login buttons.
18
+
19
+ Personally, I hate to fill out registration forms, waiting for confirmation e-mails, so we designed this plugin for our website. Now, we want to share this very usable plugin with everyone, for free!
20
+
21
+ **Why should you choose Nextend Facebook Connect plugin from the many social plugins?**
22
+
23
+ * If your visitors have a Facebook profile, they can register your site with a single click, and later to log in too.
24
+ * The previously registered users can simply attach their existing Facebook profile to their account, so in the future, they can logging in with the one social button.
25
+ * The plugin has multiple desings, so it fits all kind of websites smoothly and elegantly.
26
+ * The plugin supports Facebook profile picture as avatar.
27
+ * Very simple to use.
28
+ * Fast and helpful support.
29
+
30
+ If you like our stuff donate a like to our [Facebook page](https://www.facebook.com/nextendweb) or follow us on [Twitter](https://twitter.com/nextendweb)!
31
+
32
+ #### Usage
33
+
34
+ After you activated the plugin, the plugin will automatically
35
+
36
+ * add the login buttons to the WordPress login page. See screenshot #1
37
+ * add the account linking buttons to the WordPress profile page. See screenshot #2
38
+
39
+
40
+ #### Advanced usage
41
+
42
+ **Simple link**
43
+
44
+ &lt;a href="*siteurl*/wp-login.php?loginFacebook=1&redirect=*siteurl*" onclick="window.location = \'*siteurl*/wp-login.php?loginFacebook=1&redirect=\'+window.location.href; return false;"&gt;Click here to login or register with Facebook&lt;/a&gt;
45
+
46
+ **Image button**
47
+
48
+ &lt;a href="*siteurl*/wp-login.php?loginFacebook=1&redirect=*siteurl*" onclick="window.location = \'*siteurl*/wp-login.php?loginFacebook=1&redirect=\'+window.location.href; return false;"&gt; &lt;img src="HereComeTheImage" /&gt; &lt;/a&gt;
49
+
50
+ == Installation ==
51
+
52
+ 1. Install the zip file from your backend, or extract it and just drop the contents in the wp-content/plugins/ directory, then activate the Plugin from Plugins page.
53
+ 2. Create a facebook app => https://developers.facebook.com/apps/
54
+ 3. Don't choose from the listed options, but click on "advanced setup" in the bottom.
55
+ 4. Choose an app name, and a category, then click on Create App ID.
56
+ 5. Pass the security check.
57
+ 6. Go to the Settings of the application.
58
+ 7. Click on + Add Platform, and choose Website.
59
+ 8. Give your website's address at the Site URL field with: http://yoursiteurl.com
60
+ 9. Give a Contact Email and click on Save Changes.
61
+ 10. Go to Status & Review, and change the availability for the general public to YES.
62
+ 11. Go back to the Settings, and copy the App ID, and APP Secret.
63
+ 12. Paste them into your website's Settings -> Nextend Settings.
64
+ 13. Save changes!
65
+
66
+
67
+
68
+ == Screenshots ==
69
+
70
+ 1. Our Social Connect plugins on the main WP login page
71
+ 2. Our Social Connect plugins in the profile page for account linking
72
+
73
+ == Changelog ==
74
+
75
+ = 2.0.2 =
76
+ * Fix: Fatal error: Call to undefined method Facebook\Facebook::getAccessToken()
77
+
78
+ = 2.0.1 =
79
+ * Fix: Redirect uri mismatch in spacial server environment
80
+
81
+ = 2.0.0 =
82
+ * The latest Facebook PHP API used: https://github.com/facebook/php-graph-sdk
83
+ * Facebook SDK for PHP requires PHP 5.4 or greater.
84
+ * Fix: Facebook 2.2 API does not work anymore
85
+
86
+ = 1.5.9 =
87
+ * Nonce added to backend
88
+
89
+ = 1.5.8 =
90
+ * Vulnerability fix
91
+
92
+ = 1.5.7 =
93
+ * Facebook 2.4 api support added
94
+
95
+ = 1.5.6 =
96
+ * XSS Vulnerability fix
97
+
98
+ = 1.5.4 =
99
+ * Updated installation instruction
100
+
101
+ = 1.5.3 =
102
+ * Updated installation instruction
103
+
104
+ = 1.5.2 =
105
+ * Fixed username generation (Thanks to: Cyrus Collier)
106
+ * Fixed redirect issue (Thanks to: Cyrus Collier)
107
+
108
+ = 1.5.1 =
109
+ * Security fix for XSS
110
+
111
+ = 1.5.0 =
112
+ * Security fix for redirects (Thanks to: Kacper Szurek and Elger Jonker)
113
+
114
+ = 1.4.59 =
115
+ * Avatar fix
116
+ * Buddypress avatar support. If Buddypress avatar not exists, then FB avatar used. If there is a BuddyPress avatar, that will be used.
117
+
118
+ = 1.4.58 =
119
+ * Typo in redirects
120
+
121
+ = 1.4.57 =
122
+ * Fix: WordPress transient functions used to store the required session variables. $_SESSION fully removed. Beta!!!
123
+
124
+ = 1.4.56 =
125
+ * Fix: Now the plugin use wp transient for the admin messages
126
+ * NOTICE: If the 1.4.54 version work for you fine, do NOT update yet!
127
+
128
+ = 1.4.55 =
129
+ * Fix: Now the plugin use cookies instead of PHP session. Maybe this fixes the problems.
130
+ * NOTICE: If the previous version work for you fine, do NOT update yet!
131
+
132
+ = 1.4.54 =
133
+ * Feature: You can now define NEXTEND_FB_APP_ID and NEXTEND_FB_APP_SECRET contant and it will overwrite the backend settings.
134
+
135
+ = 1.4.53 =
136
+ * Error messages added if some PHP components are missing.
137
+
138
+ = 1.4.52 =
139
+ * Avatar fix
140
+
141
+ = 1.4.48 =
142
+ * Avatar fix
143
+ * Changes in actions
144
+
145
+ = 1.4.47 =
146
+ * Optimalizations
147
+
148
+ = 1.4.46 =
149
+ * Redirection fix
150
+ * Unlink speed up
151
+
152
+ = 1.4.45 =
153
+ * New filter added to get extended Facebook permissions: nextend_fb_scope
154
+ * Read more on the new filter: http://www.nextendweb.com/knowledgebase/question/how-can-i-get-extended-facebook-permissions-for-other-fields
155
+
156
+ = 1.4.44 =
157
+ * Now user not logged out after the unlinking process.
158
+
159
+ = 1.4.43 =
160
+ * Redirection fix
161
+ * Added feature: unlink account
162
+ * Added WP actions for register/login/account linking. Read more: http://www.nextendweb.com/knowledgebase/question/how-can-i-make-custom-calls-when-a-visitor-log-in-with-facebook-connect
163
+
164
+ = 1.4.42 =
165
+ * Added check for login inputs
166
+
167
+ = 1.4.36 =
168
+ * PHP notice fixes
169
+
170
+ = 1.4.35 =
171
+ * With `new_fb_get_user_access_token($user_id)` PHP function you can get the user access token, if any...
172
+ * Javascript login fix for "SimpleModal Login"
173
+
174
+ = 1.4.34 =
175
+ * Typo fix, please update from 1.4.3x to this version!
176
+
177
+ = 1.4.33 =
178
+ * Double login button fix
179
+
180
+ = 1.4.32 =
181
+ * Official SSL support added - Thanks for Chin for the help
182
+
183
+ = 1.4.29 =
184
+ * "There was an error with the FB auth!" fix
185
+
186
+ = 1.4.28 =
187
+ * Certificate fix
188
+
189
+ = 1.4.27 =
190
+ * Important security fix
191
+
192
+ = 1.4.26 =
193
+ * Added e-mail notification on registration
194
+
195
+ = 1.4.25 =
196
+ * wp_login do_action fix
197
+
198
+ = 1.4.23 =
199
+ * Bugfix for Wordpress 3.5RC1
200
+ * Added email check
201
+ * Fixed get avatar filter
202
+ * new_fb_is_user_connected() function now returns with the Facebook id if authenticated, null if not...
203
+
204
+ = 1.4.21 =
205
+ * Bugfix for Wordpress 3.5RC1
206
+
207
+ = 1.4.20 =
208
+ * Avatar bugfix
209
+
210
+ = 1.4.19 =
211
+ * Added profile picture support for avatars
212
+
213
+ = 1.4.18 =
214
+ * Fixed SDK loading
215
+
216
+ = 1.4.16 =
217
+ * Buttons added to registration form
218
+
219
+ = 1.4.15 =
220
+ * Email fix
221
+ * Added the option for different redirect for Login and Registration
222
+
223
+ = 1.4.14 =
224
+ * Login page jQuery fix
225
+
226
+ = 1.4.13 =
227
+ * Some login fixes
228
+
229
+ = 1.4.12 =
230
+ * Fixed session check
231
+
232
+ = 1.4.11 =
233
+ * Added a fix when Facebook class already loaded
234
+
235
+ = 1.4.10 =
236
+ * Added editProfileRedirect parameter for buddypress edit profile redirect. Usage: siteurl?editProfileRedirect=1
237
+
238
+ = 1.4.9 =
239
+ * https bugfix - author Michel Weimerskirch
240
+
241
+ = 1.4.8 =
242
+ * Added name, first name and last name support.
243
+
244
+ = 1.4.4 =
245
+ * Modified login redirect issue for wp-login.php - author Michel Weimerskirch
246
+ * Added fix redirect url support. If you leave it empty or "auto" it will try to redirect back the user to the last visited page.
247
+
248
+ = 1.4.3 =
249
+ * Facebook Certification bugfix
250
+
251
+ = 1.4 =
252
+ * Added Social button generator support
253
+
254
+ = 1.3 =
255
+ * Added linking option to the profile page, so an already registered user can easily link the profile with a Facebook profile.
256
+
257
+ = 1.2 =
258
+ * Fixed a bug when the htaccess short urls not enabled.
259
+
260
+ == Upgrade Notice ==
261
+
262
+ = 2.0 =
263
+ Facebook SDK for PHP requires PHP 5.4 or greater. Please check your server configuration before updating!
providers/facebook/facebook-client.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once NSL_PATH . '/includes/oauth2.php';
3
+
4
+ class NextendSocialProviderFacebookClient extends NextendSocialOauth2 {
5
+
6
+ const DEFAULT_GRAPH_VERSION = 'v2.11';
7
+
8
+
9
+ protected $access_token_data = array(
10
+ 'access_token' => '',
11
+ 'expires_in' => -1,
12
+ 'created' => -1
13
+ );
14
+
15
+ protected $scopes = array('email');
16
+
17
+ public function __construct($providerID, $isTest) {
18
+ parent::__construct($providerID);
19
+
20
+ $this->endpointAuthorization = 'https://www.facebook.com/' . self::DEFAULT_GRAPH_VERSION . '/dialog/oauth';
21
+ if ((isset($_GET['display']) && $_GET['display'] == 'popup') || $isTest) {
22
+ $this->endpointAuthorization .= '?display=popup';
23
+ }
24
+ $this->endpointAccessToken = 'https://graph.facebook.com/' . self::DEFAULT_GRAPH_VERSION . '/oauth/access_token';
25
+ $this->endpointRestAPI = 'https://graph.facebook.com/' . self::DEFAULT_GRAPH_VERSION . '/';
26
+ }
27
+
28
+ protected function formatScopes($scopes) {
29
+ return implode(',', $scopes);
30
+ }
31
+
32
+ public function isAccessTokenLongLived() {
33
+
34
+ return $this->access_token_data['created'] + $this->access_token_data['expires_in'] > time() + (60 * 60 * 2);
35
+ }
36
+
37
+ public function requestLongLivedAccessToken() {
38
+
39
+ $curl = new NSLCurl();
40
+
41
+ $accessTokenData = $curl->get($this->endpointAccessToken, array(
42
+ 'grant_type' => 'fb_exchange_token',
43
+ 'client_id' => $this->client_id,
44
+ 'client_secret' => $this->client_secret,
45
+ 'fb_exchange_token' => $this->access_token_data['access_token']
46
+ ));
47
+
48
+ if ($curl->error) {
49
+
50
+ if (isset($accessTokenData['error'])) {
51
+ throw new Exception($accessTokenData['error'] . ': ' . $accessTokenData['error_description']);
52
+ } else {
53
+ throw new Exception($curl->errorCode . ': ' . $curl->errorMessage);
54
+ }
55
+ }
56
+
57
+ $accessTokenData['created'] = time();
58
+
59
+ $this->access_token_data = $accessTokenData;
60
+
61
+ return wp_json_encode($accessTokenData);
62
+ }
63
+
64
+ protected function errorFromResponse($response) {
65
+ if (isset($response['error'])) {
66
+ throw new Exception($response['error']['message']);
67
+ }
68
+ }
69
+
70
+ }
providers/facebook/facebook.php ADDED
@@ -0,0 +1,258 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class NextendSocialProviderFacebook extends NextendSocialProvider {
4
+
5
+ protected $dbID = 'fb';
6
+
7
+ /** @var NextendSocialProviderFacebookClient */
8
+ protected $client;
9
+
10
+ protected $color = '#4267b2';
11
+
12
+ protected $svg = '<svg xmlns="http://www.w3.org/2000/svg"><path fill="#fff" d="M22.688 0H1.323C.589 0 0 .589 0 1.322v21.356C0 23.41.59 24 1.323 24h11.505v-9.289H9.693V11.09h3.124V8.422c0-3.1 1.89-4.789 4.658-4.789 1.322 0 2.467.1 2.8.145v3.244h-1.922c-1.5 0-1.801.711-1.801 1.767V11.1h3.59l-.466 3.622h-3.113V24h6.114c.734 0 1.323-.589 1.323-1.322V1.322A1.302 1.302 0 0 0 22.688 0z"/></svg>';
13
+
14
+ protected $popupWidth = 475;
15
+
16
+ protected $popupHeight = 175;
17
+
18
+ public function __construct() {
19
+ $this->id = 'facebook';
20
+ $this->label = 'Facebook';
21
+
22
+ $this->path = dirname(__FILE__);
23
+
24
+ $this->requiredFields = array(
25
+ 'appid' => 'App ID',
26
+ 'secret' => 'App Secret'
27
+ );
28
+
29
+ add_filter('nsl_finalize_settings_' . $this->optionKey, array(
30
+ $this,
31
+ 'finalizeSettings'
32
+ ));
33
+
34
+ parent::__construct(array(
35
+ 'appid' => '',
36
+ 'secret' => '',
37
+ 'user_prefix' => '',
38
+ 'login_label' => 'Continue with <b>Facebook</b>',
39
+ 'link_label' => 'Link account with <b>Facebook</b>',
40
+ 'unlink_label' => 'Unlink account from <b>Facebook</b>',
41
+ 'legacy' => 0
42
+ ));
43
+
44
+ if ($this->settings->get('legacy') == 1) {
45
+ $this->loadCompat();
46
+ }
47
+ }
48
+
49
+ protected function forTranslation() {
50
+ __('Continue with <b>Facebook</b>', 'nextend-facebook-connect');
51
+ __('Link account with <b>Facebook</b>', 'nextend-facebook-connect');
52
+ __('Unlink account from <b>Facebook</b>', 'nextend-facebook-connect');
53
+ }
54
+
55
+ public function finalizeSettings($settings) {
56
+
57
+ if (defined('NEXTEND_FB_APP_ID')) {
58
+ $settings['appid'] = NEXTEND_FB_APP_ID;
59
+ }
60
+ if (defined('NEXTEND_FB_APP_SECRET')) {
61
+ $settings['secret'] = NEXTEND_FB_APP_SECRET;
62
+ }
63
+
64
+ return $settings;
65
+ }
66
+
67
+ public function getClient() {
68
+ if ($this->client === null) {
69
+
70
+ require_once dirname(__FILE__) . '/facebook-client.php';
71
+
72
+ $this->client = new NextendSocialProviderFacebookClient($this->id, $this->isTest());
73
+
74
+ $this->client->setClientId($this->settings->get('appid'));
75
+ $this->client->setClientSecret($this->settings->get('secret'));
76
+ $this->client->setRedirectUri($this->getLoginUrl());
77
+ }
78
+
79
+ return $this->client;
80
+ }
81
+
82
+ public function validateSettings($newData, $postedData) {
83
+ $newData = parent::validateSettings($newData, $postedData);
84
+
85
+ foreach ($postedData AS $key => $value) {
86
+
87
+ switch ($key) {
88
+ case 'legacy':
89
+ if ($postedData['legacy'] == 1) {
90
+ $newData['legacy'] = 1;
91
+ } else {
92
+ $newData['legacy'] = 0;
93
+ }
94
+ break;
95
+ case 'tested':
96
+ if ($postedData[$key] == '1' && (!isset($newData['tested']) || $newData['tested'] != '0')) {
97
+ $newData['tested'] = 1;
98
+ } else {
99
+ $newData['tested'] = 0;
100
+ }
101
+ break;
102
+ case 'appid':
103
+ case 'secret':
104
+ $newData[$key] = trim(sanitize_text_field($value));
105
+ if ($this->settings->get($key) !== $newData[$key]) {
106
+ $newData['tested'] = 0;
107
+ }
108
+
109
+ if (empty($newData[$key])) {
110
+ NextendSocialLoginAdminNotices::addError(sprintf(__('The %s entered did not appear to be a valid. Please enter a valid %s.', 'nextend-facebook-connect'), $this->requiredFields[$key], $this->requiredFields[$key]));
111
+ }
112
+ break;
113
+ case 'user_prefix':
114
+ $newData[$key] = preg_replace("/[^A-Za-z0-9\-_ ]/", '', $value);
115
+ break;
116
+ }
117
+ }
118
+
119
+ return $newData;
120
+ }
121
+
122
+ /**
123
+ * @param $accessTokenData
124
+ *
125
+ * @return string
126
+ * @throws Exception
127
+ */
128
+ protected function requestLongLivedToken($accessTokenData) {
129
+ $client = $this->getClient();
130
+ if (!$client->isAccessTokenLongLived()) {
131
+
132
+ return $client->requestLongLivedAccessToken();
133
+ }
134
+
135
+ return $accessTokenData;
136
+ }
137
+
138
+ /**
139
+ * @return array
140
+ */
141
+ protected function getCurrentUserInfo() {
142
+ return $this->getClient()
143
+ ->get('/me?fields=id,name,email,first_name,last_name');
144
+ }
145
+
146
+ protected function getAuthUserData($key) {
147
+
148
+ switch ($key) {
149
+ case 'id':
150
+ return $this->authUserData['id'];
151
+ case 'email':
152
+ return $this->authUserData['email'];
153
+ case 'name':
154
+ return $this->authUserData['name'];
155
+ case 'first_name':
156
+ return $this->authUserData['first_name'];
157
+ case 'last_name':
158
+ return $this->authUserData['last_name'];
159
+ }
160
+
161
+ return parent::getAuthUserData($key);
162
+ }
163
+
164
+ public function syncProfile($user_id, $provider, $access_token) {
165
+ $this->saveUserData($user_id, 'profile_picture', 'https://graph.facebook.com/' . $this->getAuthUserData('id') . '/picture?type=large');
166
+ $this->saveUserData($user_id, 'access_token', $access_token);
167
+ }
168
+
169
+ protected function saveUserData($user_id, $key, $data) {
170
+ switch ($key) {
171
+ case 'profile_picture':
172
+ update_user_meta($user_id, 'fb_profile_picture', $data);
173
+ break;
174
+ case 'access_token':
175
+ update_user_meta($user_id, 'fb_user_access_token', $data);
176
+ break;
177
+ default:
178
+ parent::saveUserData($user_id, $key, $data);
179
+ break;
180
+ }
181
+ }
182
+
183
+ protected function getUserData($user_id, $key) {
184
+ switch ($key) {
185
+ case 'profile_picture':
186
+ return get_user_meta($user_id, 'fb_profile_picture', true);
187
+ break;
188
+ case 'access_token':
189
+ return get_user_meta($user_id, 'fb_user_access_token', true);
190
+ break;
191
+ }
192
+
193
+ return parent::getUserData($user_id, $key);
194
+ }
195
+
196
+ public function getState() {
197
+ if ($this->settings->get('legacy') == 1) {
198
+ return 'legacy';
199
+ }
200
+
201
+ return parent::getState();
202
+ }
203
+
204
+ public function loadCompat() {
205
+
206
+ if (!is_admin()) {
207
+ require_once(dirname(__FILE__) . '/compat/nextend-facebook-connect.php');
208
+ } else {
209
+ if (basename($_SERVER['PHP_SELF']) !== 'plugins.php') {
210
+ require_once(dirname(__FILE__) . '/compat/nextend-facebook-connect.php');
211
+ } else {
212
+
213
+ add_action('admin_menu', array(
214
+ $this,
215
+ 'loadCompatMenu'
216
+ ), 1);
217
+ }
218
+ }
219
+ }
220
+
221
+ public function loadCompatMenu() {
222
+ add_options_page('Nextend FB Connect', 'Nextend FB Connect', 'manage_options', 'nextend-facebook-connect', array(
223
+ 'NextendFBSettings',
224
+ 'NextendFB_Options_Page'
225
+ ));
226
+ }
227
+
228
+ public function import() {
229
+ $oldSettings = maybe_unserialize(get_option('nextend_fb_connect'));
230
+ if (!empty($oldSettings['fb_appid']) && !empty($oldSettings['fb_secret'])) {
231
+ $newSettings = array(
232
+ 'appid' => $oldSettings['fb_appid'],
233
+ 'secret' => $oldSettings['fb_secret']
234
+ );
235
+
236
+ if (!empty($oldSettings['fb_user_prefix'])) {
237
+ $newSettings['user_prefix'] = $oldSettings['fb_user_prefix'];
238
+ }
239
+
240
+ $newSettings['legacy'] = 0;
241
+ $this->settings->update($newSettings);
242
+
243
+ delete_option('nextend_fb_connect');
244
+ }
245
+
246
+ return true;
247
+ }
248
+
249
+ public function adminDisplaySubView($subview) {
250
+ if ($subview == 'import' && $this->settings->get('legacy') == 1) {
251
+ $this->renderAdmin('import', false);
252
+ } else {
253
+ parent::adminDisplaySubView($subview);
254
+ }
255
+ }
256
+ }
257
+
258
+ NextendSocialLogin::addProvider(new NextendSocialProviderFacebook);
providers/facebook/facebook.png ADDED
Binary file
providers/google/admin/getting-started.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined('ABSPATH') || die();
3
+ /** @var $this NextendSocialProvider */
4
+ ?>
5
+
6
+ <div class="nsl-admin-sub-content">
7
+ <h2 class="title"><?php _e('Getting Started', 'nextend-facebook-connect'); ?></h2>
8
+
9
+ <p style="max-width:55em;"><?php printf(__('To allow your visitors to log in with their %1$s account, first you must create a %1$s App. The following guide will help you through the %1$s App creation process. After you have created your %1$s App, head over to "Settings" and configure the given "%2$s" and "%3$s" according to your %1$s App.', 'nextend-facebook-connect'), "Google", "Client ID", "Client secret"); ?></p>
10
+
11
+ <h2 class="title"><?php printf(_x('Create %s', 'App creation', 'nextend-facebook-connect'), 'Google App'); ?></h2>
12
+
13
+ <ol>
14
+ <li><?php printf(__('Navigate to %s', 'nextend-facebook-connect'), '<a href="https://console.developers.google.com/apis/" target="_blank">https://console.developers.google.com/apis/</a>'); ?></li>
15
+ <li><?php printf(__('Log in with your %s credentials if you are not logged in', 'nextend-facebook-connect'), 'Google'); ?></li>
16
+ <li><?php _e('If you don\'t have a project yet, you\'ll need to create one. You can do this by clicking on the blue "Create project" button on the right side', 'nextend-facebook-connect'); ?></li>
17
+ <li><?php _e('Name your project and then click on the Create button', 'nextend-facebook-connect'); ?></li>
18
+ <li><?php _e('Once you have a project, you\'ll end up in the dashboard.', 'nextend-facebook-connect'); ?></li>
19
+ <li><?php _e('Click on the "Credentials" in the left hand menu to create new API credentials', 'nextend-facebook-connect'); ?></li>
20
+ <li><?php _e('Go to the OAuth consent screen tab and enter a product name and provide the Privacy Policy URL, then click on the save button.', 'nextend-facebook-connect'); ?></li>
21
+ <li><?php _e('Go back to the Credentials tab and locate the small box at the middle. Click on the blue "Create credentials" button. Chose the "OAuth client ID" from the dropdown list.', 'nextend-facebook-connect'); ?></li>
22
+ <li><?php _e('Your application type should be "Web application"', 'nextend-facebook-connect'); ?></li>
23
+ <li><?php _e('Name your application', 'nextend-facebook-connect'); ?></li>
24
+ <li><?php printf(__('Add the following URL to the "Valid OAuth redirect URIs" field: <b>%s</b>', 'nextend-facebook-connect'), $this->getLoginUrl()); ?></li>
25
+ <li><?php _e('Click on the Create button', 'nextend-facebook-connect'); ?></li>
26
+ <li><?php _e('A modal should pop up with your credentials. If that doesn\'t happen, go to the Credentials in the left hand menu and select your app by clicking on its name and you\'ll be able to copy-paste the Client ID and Client Secret from there.', 'nextend-facebook-connect'); ?></li>
27
+ </ol>
28
+
29
+ <a href="<?php echo $this->getAdminUrl('settings'); ?>"
30
+ class="button button-primary"><?php printf(__('I am done setting up my %s', 'nextend-facebook-connect'), 'Google App'); ?></a>
31
+
32
+ <br>
33
+ <div class="nsl-admin-embed-youtube">
34
+ <div></div>
35
+ <iframe src="https://www.youtube.com/embed/BdV8ugLaSU8?rel=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
36
+ </div>
37
+ </div>
providers/google/admin/import.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined('ABSPATH') || die();
3
+ /** @var $this NextendSocialProvider */
4
+ ?>
5
+
6
+ <div class="nsl-admin-sub-content">
7
+ <h2 class="title"><?php _e('Import Google configuration', 'nextend-facebook-connect'); ?></h2>
8
+ <p><?php _e('Be sure to read the following notices before you proceed.', 'nextend-facebook-connect'); ?></p>
9
+
10
+ <h4><?php _e('Important steps before the import', 'nextend-facebook-connect'); ?></h4>
11
+ <p><?php _e('Make sure that the redirect URI for your app is correct before proceeding.', 'nextend-facebook-connect'); ?></p>
12
+ <ol>
13
+ <li><?php printf(__('Visit %s.', 'nextend-facebook-connect'), '<a href="https://console.developers.google.com/apis/" target="_blank">https://console.developers.google.com/apis/</a>'); ?></li>
14
+ <li><?php _e('If you have more projects, select the one where your app is.', 'nextend-facebook-connect'); ?></li>
15
+ <li><?php _e('Click on Credentials at the left-hand menu then select your app.', 'nextend-facebook-connect'); ?></li>
16
+ <li><?php printf(__('Make sure that the "%1$s" field contains %2$s', 'nextend-facebook-connect'), 'Authorized redirect URIs', $this->getLoginUrl()); ?> </li>
17
+ <li><?php _e('Save your changes.', 'nextend-facebook-connect'); ?></li>
18
+ </ol>
19
+
20
+ <h4><?php _e('The following settings will be imported:', 'nextend-facebook-connect'); ?></h4>
21
+ <ol>
22
+ <li><?php _e('Your old API configurations', 'nextend-facebook-connect'); ?></li>
23
+ <li><?php _e('The user prefix you set', 'nextend-facebook-connect'); ?></li>
24
+ </ol>
25
+
26
+ <h4><?php _e('Create a backup of the old settings', 'nextend-facebook-connect'); ?></h4>
27
+ <textarea cols="160" rows="6" readonly title=""><?php echo esc_textarea(wp_json_encode(maybe_unserialize(get_option('nextend_google_connect')), defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 0)); ?></textarea>
28
+
29
+ <h4><?php _e('Other changes', 'nextend-facebook-connect'); ?></h4>
30
+ <ol>
31
+ <li><?php _e('The custom redirect URI is now handled globally for all providers, so it won\'t be imported from the previous version. Visit "Nextend Social Login > Global settings" to set the new redirect URIs.', 'nextend-facebook-connect'); ?></li>
32
+ <li><?php _e('The login button\'s layout will be changed to a new, more modern look. If you used any custom buttons that won\'t be imported.', 'nextend-facebook-connect'); ?></li>
33
+ <li><?php _e('The old version\'s PHP functions are not available anymore. This means if you used any custom codes where you used these old functions, you need to remove them.', 'nextend-facebook-connect'); ?></li>
34
+ </ol>
35
+ <p><?php _e('After the importing process finishes, you will need to <b>test</b> your app and <b>enable</b> the provider. You can do both in the next screen.', 'nextend-facebook-connect'); ?></p>
36
+ <p>
37
+ <a href="<?php echo wp_nonce_url(add_query_arg(array(
38
+ 'action' => 'nextend-social-login',
39
+ 'view' => 'import',
40
+ 'provider' => $this->getId()
41
+ ), admin_url('admin-post.php')), 'nextend-social-login'); ?>" class="button button-primary">
42
+ <?php _e('Import Configuration', 'nextend-facebook-connect'); ?>
43
+ </a>
44
+ </p>
45
+ </div>
providers/google/admin/settings.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined('ABSPATH') || die();
3
+ /** @var $this NextendSocialProvider */
4
+
5
+ $settings = $this->settings;
6
+ ?>
7
+
8
+ <div class="nsl-admin-sub-content">
9
+
10
+ <?php
11
+ $this->renderSettingsHeader();
12
+ ?>
13
+
14
+ <form method="post" action="<?php echo admin_url('admin-post.php'); ?>" novalidate="novalidate">
15
+
16
+ <?php wp_nonce_field('nextend-social-login'); ?>
17
+ <input type="hidden" name="action" value="nextend-social-login"/>
18
+ <input type="hidden" name="view" value="provider-<?php echo $this->getId(); ?>"/>
19
+ <input type="hidden" name="subview" value="settings"/>
20
+ <input type="hidden" name="settings_saved" value="1"/>
21
+ <input type="hidden" name="tested" id="tested" value="<?php echo esc_attr($settings->get('tested')); ?>"/>
22
+ <table class="form-table">
23
+ <tbody>
24
+ <tr>
25
+ <th scope="row"><label for="client_id"><?php _e('Client ID', 'nextend-facebook-connect'); ?>
26
+ - <em>(<?php _e('Required', 'nextend-facebook-connect'); ?>)</em></label></label>
27
+ </th>
28
+ <td>
29
+ <input name="client_id" type="text" id="client_id"
30
+ value="<?php echo esc_attr($settings->get('client_id')); ?>" class="regular-text"
31
+ style="width:40em;">
32
+ <p class="description"
33
+ id="tagline-client_id"><?php printf(__('If you are not sure what is your %s, please head over to <a href="%s">Getting Started</a>', 'nextend-facebook-connect'), 'Client ID', $this->getAdminUrl()); ?></p>
34
+ </td>
35
+ </tr>
36
+ <tr>
37
+ <th scope="row"><label
38
+ for="client_secret"><?php _e('Client Secret', 'nextend-facebook-connect'); ?></label>
39
+ - <em>(<?php _e('Required', 'nextend-facebook-connect'); ?>)</em></label></th>
40
+ <td><input name="client_secret" type="text" id="client_secret"
41
+ value="<?php echo esc_attr($settings->get('client_secret')); ?>" class="regular-text">
42
+ </td>
43
+ </tr>
44
+ </tbody>
45
+ </table>
46
+ <p class="submit"><input type="submit" name="submit" id="submit" class="button button-primary"
47
+ value="<?php _e('Save Changes'); ?>"></p>
48
+
49
+
50
+ <hr/>
51
+ <h2><?php _e('Other settings', 'nextend-facebook-connect'); ?></h2>
52
+ <table class="form-table">
53
+ <tbody>
54
+ <tr>
55
+ <th scope="row"><label
56
+ for="user_prefix"><?php _e('Username prefix on register', 'nextend-facebook-connect'); ?></label></th>
57
+ <td><input name="user_prefix" type="text" id="user_prefix"
58
+ value="<?php echo esc_attr($settings->get('user_prefix')); ?>" class="regular-text"></td>
59
+ </tr>
60
+ </tbody>
61
+ </table>
62
+
63
+ <?php
64
+ $this->renderProSettings();
65
+ ?>
66
+ </form>
67
+ </div>
providers/google/compat/buttons/google-btn.css ADDED
@@ -0,0 +1,397 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @import url(//fonts.googleapis.com/css?family=Open+Sans:600);
2
+
3
+ .new-google-btn {
4
+ margin: 5px auto;
5
+ display: inline-block;
6
+ }
7
+
8
+ .new-google-btn,
9
+ .new-google-btn div {
10
+ font-size: 14px;
11
+ font-weight: 600;
12
+ font-family: 'Open Sans', sans-serif;
13
+ color: #fff;
14
+ text-shadow: 0 0 1px RGBA(0, 0, 0, 1);
15
+ white-space: nowrap;
16
+ vertical-align: middle;
17
+ }
18
+
19
+ /*
20
+ 1 --------------
21
+ */
22
+ .new-google-1,
23
+ .new-google-1 div {
24
+ height: 42px;
25
+ line-height: 42px;
26
+ background: url('google-btn.png') no-repeat 0 0;
27
+ }
28
+
29
+ div.new-google-1 {
30
+ padding: 0 0 0 20px;
31
+ }
32
+
33
+ div.new-google-1-1 {
34
+ padding: 0 43px 0 0;
35
+ background-position: right -100px;
36
+ }
37
+
38
+ div.new-google-1-1-1 {
39
+ background-repeat: repeat-x;
40
+ background-position: 0 -50px;
41
+ padding: 0 20px 0 5px;
42
+ }
43
+
44
+ /*
45
+ 2 --------------
46
+ */
47
+ .new-google-2,
48
+ .new-google-2 div {
49
+ height: 42px;
50
+ line-height: 42px;
51
+ background: url('google-btn.png') no-repeat 0 0;
52
+ }
53
+
54
+ div.new-google-2 {
55
+ padding: 0 0 0 45px;
56
+ background-position: 0 -150px;
57
+ }
58
+
59
+ div.new-google-2-1 {
60
+ padding: 0 20px 0 0;
61
+ background-position: right -250px;
62
+ }
63
+
64
+ div.new-google-2-1-1 {
65
+ background-repeat: repeat-x;
66
+ background-position: 0 -200px;
67
+ padding: 0 0 0 10px;
68
+ font-size: 12px;
69
+ }
70
+
71
+ /*
72
+ 3 --------------
73
+ */
74
+ .new-google-3,
75
+ .new-google-3 div {
76
+ height: 37px;
77
+ line-height: 37px;
78
+ background: url('google-btn.png') no-repeat 0 0;
79
+ }
80
+
81
+ div.new-google-3 {
82
+ padding: 0 0 0 35px;
83
+ background-position: 0 -300px;
84
+ }
85
+
86
+ div.new-google-3-1 {
87
+ padding: 0 18px 0 0;
88
+ background-position: right -400px;
89
+ }
90
+
91
+ div.new-google-3-1-1 {
92
+ background-repeat: repeat-x;
93
+ background-position: 0 -350px;
94
+ padding: 0 0 0 8px;
95
+ font-size: 12px;
96
+ }
97
+
98
+ /*
99
+ 4 --------------
100
+ */
101
+ .new-google-4,
102
+ .new-google-4 div {
103
+ height: 35px;
104
+ line-height: 32px;
105
+ background: url('google-btn.png') no-repeat 0 0;
106
+ }
107
+
108
+ div.new-google-4 {
109
+ padding: 0 0 0 4px;
110
+ background-position: 0 -450px;
111
+ }
112
+
113
+ div.new-google-4-1 {
114
+ padding: 0 33px 0 0;
115
+ background-position: right -550px;
116
+ }
117
+
118
+ div.new-google-4-1-1 {
119
+ background-repeat: repeat-x;
120
+ background-position: 0 -500px;
121
+ padding: 0 19px 0 18px;
122
+ font-size: 12px;
123
+ }
124
+
125
+ /*
126
+ 5 --------------
127
+ */
128
+ .new-google-5,
129
+ .new-google-5 div {
130
+ height: 15px;
131
+ line-height: 15px;
132
+ background: url('google-btn.png') no-repeat 0 0;
133
+ }
134
+
135
+ div.new-google-5 {
136
+ padding: 0 0 0 3px;
137
+ background-position: 0 -600px;
138
+ }
139
+
140
+ div.new-google-5-1 {
141
+ padding: 0 3px 0 0;
142
+ background-position: right -640px;
143
+ }
144
+
145
+ div.new-google-5-1-1 {
146
+ background-repeat: repeat-x;
147
+ background-position: 0 -620px;
148
+ padding: 0 1px;
149
+ font-size: 10px;
150
+ }
151
+
152
+ /*
153
+ 6 --------------
154
+ */
155
+ .new-google-6,
156
+ .new-google-6 div {
157
+ height: 29px;
158
+ line-height: 26px;
159
+ background: url('google-btn.png') no-repeat 0 0;
160
+ }
161
+
162
+ div.new-google-6 {
163
+ padding: 0 0 0 4px;
164
+ background-position: 0 -660px;
165
+ }
166
+
167
+ div.new-google-6-1 {
168
+ padding: 0 27px 0 0;
169
+ background-position: right -750px;
170
+ }
171
+
172
+ div.new-google-6-1-1 {
173
+ background-repeat: repeat-x;
174
+ background-position: 0 -700px;
175
+ padding: 0 10px 0 8px;
176
+ font-size: 12px;
177
+ }
178
+
179
+ /*
180
+ 7 --------------
181
+ */
182
+ .new-google-7,
183
+ .new-google-7 div {
184
+ height: 29px;
185
+ line-height: 26px;
186
+ background: url('google-btn.png') no-repeat 0 0;
187
+ }
188
+
189
+ div.new-google-7 {
190
+ padding: 0 0 0 29px;
191
+ background-position: 0 -800px;
192
+ }
193
+
194
+ div.new-google-7-1 {
195
+ padding: 0 4px 0 0;
196
+ background-position: right -900px;
197
+ }
198
+
199
+ div.new-google-7-1-1 {
200
+ background-repeat: repeat-x;
201
+ background-position: 0 -850px;
202
+ padding: 0 10px 0 10px;
203
+ font-size: 11px;
204
+ }
205
+
206
+ /*
207
+ 8 --------------
208
+ */
209
+ .new-google-8,
210
+ .new-google-8 div {
211
+ height: 25px;
212
+ width: 30px;
213
+ background: url('google-btn.png') no-repeat 0 0;
214
+ }
215
+
216
+ div.new-google-8 {
217
+ background-position: 0 -950px;
218
+ }
219
+
220
+ div.new-google-8-1 {
221
+ background-position: 0 -1050px;
222
+ transition: background-position 0.4s;
223
+ -moz-transition: background-position 0.4s; /* Firefox 4 */
224
+ -webkit-transition: background-position 0.4s; /* Safari and Chrome */
225
+ -o-transition: background-position 0.4s; /* Opera */
226
+ }
227
+
228
+ div.new-google-8:HOVER div.new-google-8-1 {
229
+ background-position: 0 -1000px;
230
+ }
231
+
232
+ /*
233
+ 9 --------------
234
+ */
235
+ .new-google-9,
236
+ .new-google-9 div {
237
+ height: 26px;
238
+ width: 30px;
239
+ background: url('google-btn.png') no-repeat 0 0;
240
+ }
241
+
242
+ div.new-google-9 {
243
+ opacity: 0.79;
244
+ background-position: 0 -1100px;
245
+ transition: opacity 0.4s;
246
+ -moz-transition: opacity 0.4s; /* Firefox 4 */
247
+ -webkit-transition: opacity 0.4s; /* Safari and Chrome */
248
+ -o-transition: opacity 0.4s; /* Opera */
249
+ }
250
+
251
+ div.new-google-9:HOVER {
252
+ opacity: 0.99
253
+ }
254
+
255
+ /*
256
+ 10 --------------
257
+ */
258
+ .new-google-10,
259
+ .new-google-10 div {
260
+ background: url('google-btn.png') no-repeat 0 0;
261
+ }
262
+
263
+ div.new-google-10 {
264
+ height: 36px;
265
+ width: 37px;
266
+ background-position: 0 -1150px;
267
+ }
268
+
269
+ div.new-google-10-1 {
270
+ margin: 5px 5px 6px 5px;
271
+ height: 26px;
272
+ width: 26px;
273
+ overflow: hidden;
274
+ background-position: -5px -1255px;
275
+ transition: background-position 0.4s;
276
+ -moz-transition: background-position 0.4s; /* Firefox 4 */
277
+ -webkit-transition: background-position 0.4s; /* Safari and Chrome */
278
+ -o-transition: background-position 0.4s; /* Opera */
279
+ }
280
+
281
+ div.new-google-10:HOVER div.new-google-10-1 {
282
+ background-position: -5px -1205px;
283
+ }
284
+
285
+ /*
286
+ 11 --------------
287
+ */
288
+ .new-google-11,
289
+ .new-google-11 div {
290
+ height: 36px;
291
+ width: 36px;
292
+ background: url('google-btn.png') no-repeat 0 0;
293
+ }
294
+
295
+ div.new-google-11 {
296
+ opacity: 0.79;
297
+ background-position: 0 -1300px;
298
+ transition: opacity 0.4s;
299
+ -moz-transition: opacity 0.4s; /* Firefox 4 */
300
+ -webkit-transition: opacity 0.4s; /* Safari and Chrome */
301
+ -o-transition: opacity 0.4s; /* Opera */
302
+ }
303
+
304
+ div.new-google-11:HOVER {
305
+ opacity: 0.99
306
+ }
307
+
308
+ /*
309
+ 12 --------------
310
+ */
311
+ .new-google-12,
312
+ .new-google-12 div {
313
+ height: 28px;
314
+ width: 29px;
315
+ background: url('google-btn.png') no-repeat 0 0;
316
+ }
317
+
318
+ div.new-google-12 {
319
+ background-position: 0 -1350px;
320
+ opacity: 0.79;
321
+ transition: opacity 0.4s;
322
+ -moz-transition: opacity 0.4s; /* Firefox 4 */
323
+ -webkit-transition: opacity 0.4s; /* Safari and Chrome */
324
+ -o-transition: opacity 0.4s; /* Opera */
325
+ }
326
+
327
+ div.new-google-12:HOVER {
328
+ opacity: 0.99
329
+ }
330
+
331
+ /*
332
+ 13 --------------
333
+ */
334
+ .new-google-13,
335
+ .new-google-13 div {
336
+ height: 25px;
337
+ width: 30px;
338
+ background: url('google-btn.png') no-repeat 0 0;
339
+ }
340
+
341
+ div.new-google-13 {
342
+ background-position: 0 -1400px;
343
+ }
344
+
345
+ div.new-google-13-1 {
346
+ background-position: 0 -1050px;
347
+ transition: background-position 0.4s;
348
+ -moz-transition: background-position 0.4s; /* Firefox 4 */
349
+ -webkit-transition: background-position 0.4s; /* Safari and Chrome */
350
+ -o-transition: background-position 0.4s; /* Opera */
351
+ }
352
+
353
+ div.new-google-13:HOVER div.new-google-13-1 {
354
+ background-position: 0 -1000px;
355
+ }
356
+
357
+ /*
358
+ 14 --------------
359
+ */
360
+ .new-google-14,
361
+ .new-google-14 div {
362
+ height: 23px;
363
+ width: 23px;
364
+ background: url('google-btn.png') no-repeat 0 0;
365
+ }
366
+
367
+ div.new-google-14 {
368
+ background-position: 0 -1450px;
369
+ }
370
+
371
+ div.new-google-14-1 {
372
+ background-position: 0 -1550px;
373
+ transition: background-position 0.4s;
374
+ -moz-transition: background-position 0.4s; /* Firefox 4 */
375
+ -webkit-transition: background-position 0.4s; /* Safari and Chrome */
376
+ -o-transition: background-position 0.4s; /* Opera */
377
+ }
378
+
379
+ div.new-google-14:HOVER div.new-google-14-1 {
380
+ background-position: 0 -1500px;
381
+ }
382
+
383
+ /*
384
+ Main animations
385
+ */
386
+
387
+ .new-google-default-anim {
388
+ opacity: 0.79;
389
+ transition: opacity 0.4s;
390
+ -moz-transition: opacity 0.4s; /* Firefox 4 */
391
+ -webkit-transition: opacity 0.4s; /* Safari and Chrome */
392
+ -o-transition: opacity 0.4s; /* Opera */
393
+ }
394
+
395
+ .new-google-default-anim:HOVER {
396
+ opacity: 0.999;
397
+ }
providers/google/compat/buttons/google-btn.png ADDED
Binary file
providers/google/compat/buttons/index.html ADDED
File without changes
providers/google/compat/generatorbanner.png ADDED
Binary file
providers/google/compat/index.html ADDED
File without changes
providers/google/compat/licence.txt ADDED
@@ -0,0 +1,339 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 2, June 1991
3
+
4
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
5
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6
+ Everyone is permitted to copy and distribute verbatim copies
7
+ of this license document, but changing it is not allowed.
8
+
9
+ Preamble
10
+
11
+ The licenses for most software are designed to take away your
12
+ freedom to share and change it. By contrast, the GNU General Public
13
+ License is intended to guarantee your freedom to share and change free
14
+ software--to make sure the software is free for all its users. This
15
+ General Public License applies to most of the Free Software
16
+ Foundation's software and to any other program whose authors commit to
17
+ using it. (Some other Free Software Foundation software is covered by
18
+ the GNU Lesser General Public License instead.) You can apply it to
19
+ your programs, too.
20
+
21
+ When we speak of free software, we are referring to freedom, not
22
+ price. Our General Public Licenses are designed to make sure that you
23
+ have the freedom to distribute copies of free software (and charge for
24
+ this service if you wish), that you receive source code or can get it
25
+ if you want it, that you can change the software or use pieces of it
26
+ in new free programs; and that you know you can do these things.
27
+
28
+ To protect your rights, we need to make restrictions that forbid
29
+ anyone to deny you these rights or to ask you to surrender the rights.
30
+ These restrictions translate to certain responsibilities for you if you
31
+ distribute copies of the software, or if you modify it.
32
+
33
+ For example, if you distribute copies of such a program, whether
34
+ gratis or for a fee, you must give the recipients all the rights that
35
+ you have. You must make sure that they, too, receive or can get the
36
+ source code. And you must show them these terms so they know their
37
+ rights.
38
+
39
+ We protect your rights with two steps: (1) copyright the software, and
40
+ (2) offer you this license which gives you legal permission to copy,
41
+ distribute and/or modify the software.
42
+
43
+ Also, for each author's protection and ours, we want to make certain
44
+ that everyone understands that there is no warranty for this free
45
+ software. If the software is modified by someone else and passed on, we
46
+ want its recipients to know that what they have is not the original, so
47
+ that any problems introduced by others will not reflect on the original
48
+ authors' reputations.
49
+
50
+ Finally, any free program is threatened constantly by software
51
+ patents. We wish to avoid the danger that redistributors of a free
52
+ program will individually obtain patent licenses, in effect making the
53
+ program proprietary. To prevent this, we have made it clear that any
54
+ patent must be licensed for everyone's free use or not licensed at all.
55
+
56
+ The precise terms and conditions for copying, distribution and
57
+ modification follow.
58
+
59
+ GNU GENERAL PUBLIC LICENSE
60
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61
+
62
+ 0. This License applies to any program or other work which contains
63
+ a notice placed by the copyright holder saying it may be distributed
64
+ under the terms of this General Public License. The "Program", below,
65
+ refers to any such program or work, and a "work based on the Program"
66
+ means either the Program or any derivative work under copyright law:
67
+ that is to say, a work containing the Program or a portion of it,
68
+ either verbatim or with modifications and/or translated into another
69
+ language. (Hereinafter, translation is included without limitation in
70
+ the term "modification".) Each licensee is addressed as "you".
71
+
72
+ Activities other than copying, distribution and modification are not
73
+ covered by this License; they are outside its scope. The act of
74
+ running the Program is not restricted, and the output from the Program
75
+ is covered only if its contents constitute a work based on the
76
+ Program (independent of having been made by running the Program).
77
+ Whether that is true depends on what the Program does.
78
+
79
+ 1. You may copy and distribute verbatim copies of the Program's
80
+ source code as you receive it, in any medium, provided that you
81
+ conspicuously and appropriately publish on each copy an appropriate
82
+ copyright notice and disclaimer of warranty; keep intact all the
83
+ notices that refer to this License and to the absence of any warranty;
84
+ and give any other recipients of the Program a copy of this License
85
+ along with the Program.
86
+
87
+ You may charge a fee for the physical act of transferring a copy, and
88
+ you may at your option offer warranty protection in exchange for a fee.
89
+
90
+ 2. You may modify your copy or copies of the Program or any portion
91
+ of it, thus forming a work based on the Program, and copy and
92
+ distribute such modifications or work under the terms of Section 1
93
+ above, provided that you also meet all of these conditions:
94
+
95
+ a) You must cause the modified files to carry prominent notices
96
+ stating that you changed the files and the date of any change.
97
+
98
+ b) You must cause any work that you distribute or publish, that in
99
+ whole or in part contains or is derived from the Program or any
100
+ part thereof, to be licensed as a whole at no charge to all third
101
+ parties under the terms of this License.
102
+
103
+ c) If the modified program normally reads commands interactively
104
+ when run, you must cause it, when started running for such
105
+ interactive use in the most ordinary way, to print or display an
106
+ announcement including an appropriate copyright notice and a
107
+ notice that there is no warranty (or else, saying that you provide
108
+ a warranty) and that users may redistribute the program under
109
+ these conditions, and telling the user how to view a copy of this
110
+ License. (Exception: if the Program itself is interactive but
111
+ does not normally print such an announcement, your work based on
112
+ the Program is not required to print an announcement.)
113
+
114
+ These requirements apply to the modified work as a whole. If
115
+ identifiable sections of that work are not derived from the Program,
116
+ and can be reasonably considered independent and separate works in
117
+ themselves, then this License, and its terms, do not apply to those
118
+ sections when you distribute them as separate works. But when you
119
+ distribute the same sections as part of a whole which is a work based
120
+ on the Program, the distribution of the whole must be on the terms of
121
+ this License, whose permissions for other licensees extend to the
122
+ entire whole, and thus to each and every part regardless of who wrote it.
123
+
124
+ Thus, it is not the intent of this section to claim rights or contest
125
+ your rights to work written entirely by you; rather, the intent is to
126
+ exercise the right to control the distribution of derivative or
127
+ collective works based on the Program.
128
+
129
+ In addition, mere aggregation of another work not based on the Program
130
+ with the Program (or with a work based on the Program) on a volume of
131
+ a storage or distribution medium does not bring the other work under
132
+ the scope of this License.
133
+
134
+ 3. You may copy and distribute the Program (or a work based on it,
135
+ under Section 2) in object code or executable form under the terms of
136
+ Sections 1 and 2 above provided that you also do one of the following:
137
+
138
+ a) Accompany it with the complete corresponding machine-readable
139
+ source code, which must be distributed under the terms of Sections
140
+ 1 and 2 above on a medium customarily used for software interchange; or,
141
+
142
+ b) Accompany it with a written offer, valid for at least three
143
+ years, to give any third party, for a charge no more than your
144
+ cost of physically performing source distribution, a complete
145
+ machine-readable copy of the corresponding source code, to be
146
+ distributed under the terms of Sections 1 and 2 above on a medium
147
+ customarily used for software interchange; or,
148
+
149
+ c) Accompany it with the information you received as to the offer
150
+ to distribute corresponding source code. (This alternative is
151
+ allowed only for noncommercial distribution and only if you
152
+ received the program in object code or executable form with such
153
+ an offer, in accord with Subsection b above.)
154
+
155
+ The source code for a work means the preferred form of the work for
156
+ making modifications to it. For an executable work, complete source
157
+ code means all the source code for all modules it contains, plus any
158
+ associated interface definition files, plus the scripts used to
159
+ control compilation and installation of the executable. However, as a
160
+ special exception, the source code distributed need not include
161
+ anything that is normally distributed (in either source or binary
162
+ form) with the major components (compiler, kernel, and so on) of the
163
+ operating system on which the executable runs, unless that component
164
+ itself accompanies the executable.
165
+
166
+ If distribution of executable or object code is made by offering
167
+ access to copy from a designated place, then offering equivalent
168
+ access to copy the source code from the same place counts as
169
+ distribution of the source code, even though third parties are not
170
+ compelled to copy the source along with the object code.
171
+
172
+ 4. You may not copy, modify, sublicense, or distribute the Program
173
+ except as expressly provided under this License. Any attempt
174
+ otherwise to copy, modify, sublicense or distribute the Program is
175
+ void, and will automatically terminate your rights under this License.
176
+ However, parties who have received copies, or rights, from you under
177
+ this License will not have their licenses terminated so long as such
178
+ parties remain in full compliance.
179
+
180
+ 5. You are not required to accept this License, since you have not
181
+ signed it. However, nothing else grants you permission to modify or
182
+ distribute the Program or its derivative works. These actions are
183
+ prohibited by law if you do not accept this License. Therefore, by
184
+ modifying or distributing the Program (or any work based on the
185
+ Program), you indicate your acceptance of this License to do so, and
186
+ all its terms and conditions for copying, distributing or modifying
187
+ the Program or works based on it.
188
+
189
+ 6. Each time you redistribute the Program (or any work based on the
190
+ Program), the recipient automatically receives a license from the
191
+ original licensor to copy, distribute or modify the Program subject to
192
+ these terms and conditions. You may not impose any further
193
+ restrictions on the recipients' exercise of the rights granted herein.
194
+ You are not responsible for enforcing compliance by third parties to
195
+ this License.
196
+
197
+ 7. If, as a consequence of a court judgment or allegation of patent
198
+ infringement or for any other reason (not limited to patent issues),
199
+ conditions are imposed on you (whether by court order, agreement or
200
+ otherwise) that contradict the conditions of this License, they do not
201
+ excuse you from the conditions of this License. If you cannot
202
+ distribute so as to satisfy simultaneously your obligations under this
203
+ License and any other pertinent obligations, then as a consequence you
204
+ may not distribute the Program at all. For example, if a patent
205
+ license would not permit royalty-free redistribution of the Program by
206
+ all those who receive copies directly or indirectly through you, then
207
+ the only way you could satisfy both it and this License would be to
208
+ refrain entirely from distribution of the Program.
209
+
210
+ If any portion of this section is held invalid or unenforceable under
211
+ any particular circumstance, the balance of the section is intended to
212
+ apply and the section as a whole is intended to apply in other
213
+ circumstances.
214
+
215
+ It is not the purpose of this section to induce you to infringe any
216
+ patents or other property right claims or to contest validity of any
217
+ such claims; this section has the sole purpose of protecting the
218
+ integrity of the free software distribution system, which is
219
+ implemented by public license practices. Many people have made
220
+ generous contributions to the wide range of software distributed
221
+ through that system in reliance on consistent application of that
222
+ system; it is up to the author/donor to decide if he or she is willing
223
+ to distribute software through any other system and a licensee cannot
224
+ impose that choice.
225
+
226
+ This section is intended to make thoroughly clear what is believed to
227
+ be a consequence of the rest of this License.
228
+
229
+ 8. If the distribution and/or use of the Program is restricted in
230
+ certain countries either by patents or by copyrighted interfaces, the
231
+ original copyright holder who places the Program under this License
232
+ may add an explicit geographical distribution limitation excluding
233
+ those countries, so that distribution is permitted only in or among
234
+ countries not thus excluded. In such case, this License incorporates
235
+ the limitation as if written in the body of this License.
236
+
237
+ 9. The Free Software Foundation may publish revised and/or new versions
238
+ of the General Public License from time to time. Such new versions will
239
+ be similar in spirit to the present version, but may differ in detail to
240
+ address new problems or concerns.
241
+
242
+ Each version is given a distinguishing version number. If the Program
243
+ specifies a version number of this License which applies to it and "any
244
+ later version", you have the option of following the terms and conditions
245
+ either of that version or of any later version published by the Free
246
+ Software Foundation. If the Program does not specify a version number of
247
+ this License, you may choose any version ever published by the Free Software
248
+ Foundation.
249
+
250
+ 10. If you wish to incorporate parts of the Program into other free
251
+ programs whose distribution conditions are different, write to the author
252
+ to ask for permission. For software which is copyrighted by the Free
253
+ Software Foundation, write to the Free Software Foundation; we sometimes
254
+ make exceptions for this. Our decision will be guided by the two goals
255
+ of preserving the free status of all derivatives of our free software and
256
+ of promoting the sharing and reuse of software generally.
257
+
258
+ NO WARRANTY
259
+
260
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261
+ FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262
+ OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263
+ PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264
+ OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266
+ TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267
+ PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268
+ REPAIR OR CORRECTION.
269
+
270
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272
+ REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273
+ INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274
+ OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275
+ TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276
+ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277
+ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278
+ POSSIBILITY OF SUCH DAMAGES.
279
+
280
+ END OF TERMS AND CONDITIONS
281
+
282
+ How to Apply These Terms to Your New Programs
283
+
284
+ If you develop a new program, and you want it to be of the greatest
285
+ possible use to the public, the best way to achieve this is to make it
286
+ free software which everyone can redistribute and change under these terms.
287
+
288
+ To do so, attach the following notices to the program. It is safest
289
+ to attach them to the start of each source file to most effectively
290
+ convey the exclusion of warranty; and each file should have at least
291
+ the "copyright" line and a pointer to where the full notice is found.
292
+
293
+ <one line to give the program's name and a brief idea of what it does.>
294
+ Copyright (C) <year> <name of author>
295
+
296
+ This program is free software; you can redistribute it and/or modify
297
+ it under the terms of the GNU General Public License as published by
298
+ the Free Software Foundation; either version 2 of the License, or
299
+ (at your option) any later version.
300
+
301
+ This program is distributed in the hope that it will be useful,
302
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
303
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304
+ GNU General Public License for more details.
305
+
306
+ You should have received a copy of the GNU General Public License along
307
+ with this program; if not, write to the Free Software Foundation, Inc.,
308
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309
+
310
+ Also add information on how to contact you by electronic and paper mail.
311
+
312
+ If the program is interactive, make it output a short notice like this
313
+ when it starts in an interactive mode:
314
+
315
+ Gnomovision version 69, Copyright (C) year name of author
316
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317
+ This is free software, and you are welcome to redistribute it
318
+ under certain conditions; type `show c' for details.
319
+
320
+ The hypothetical commands `show w' and `show c' should show the appropriate
321
+ parts of the General Public License. Of course, the commands you use may
322
+ be called something other than `show w' and `show c'; they could even be
323
+ mouse-clicks or menu items--whatever suits your program.
324
+
325
+ You should also get your employer (if you work as a programmer) or your
326
+ school, if any, to sign a "copyright disclaimer" for the program, if
327
+ necessary. Here is a sample; alter the names:
328
+
329
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
331
+
332
+ <signature of Ty Coon>, 1 April 1989
333
+ Ty Coon, President of Vice
334
+
335
+ This General Public License does not permit incorporating your program into
336
+ proprietary programs. If your program is a subroutine library, you may
337
+ consider it more useful to permit linking proprietary applications with the
338
+ library. If this is what you want to do, use the GNU Lesser General
339
+ Public License instead of this License.
providers/google/compat/nextend-google-connect.php ADDED
@@ -0,0 +1,538 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ Plugin Name: Nextend Google Connect
5
+ Plugin URI: http://nextendweb.com/
6
+ Description: Google connect
7
+ Version: 1.6.1
8
+ Author: Roland Soos, Jamie Bainbridge
9
+ License: GPL2
10
+ */
11
+
12
+ /* Copyright 2012 Roland Soos - Nextend (email : roland@nextendweb.com)
13
+
14
+ This program is free software; you can redistribute it and/or modify
15
+ it under the terms of the GNU General Public License, version 2, as
16
+ published by the Free Software Foundation.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26
+ */
27
+ global $new_google_settings;
28
+
29
+ define('NEW_GOOGLE_LOGIN', 1);
30
+ if (!defined('NEW_GOOGLE_LOGIN_PLUGIN_BASENAME')) {
31
+ define('NEW_GOOGLE_LOGIN_PLUGIN_BASENAME', plugin_basename(__FILE__));
32
+ }
33
+ $new_google_settings = maybe_unserialize(get_option('nextend_google_connect'));
34
+
35
+ if (!function_exists('nextend_uniqid')) {
36
+ function nextend_uniqid() {
37
+ if (isset($_COOKIE['nextend_uniqid'])) {
38
+ if (get_site_transient('n_' . $_COOKIE['nextend_uniqid']) !== false) {
39
+ return $_COOKIE['nextend_uniqid'];
40
+ }
41
+ }
42
+ $_COOKIE['nextend_uniqid'] = uniqid('nextend', true);
43
+ setcookie('nextend_uniqid', $_COOKIE['nextend_uniqid'], time() + 3600, '/');
44
+ set_site_transient('n_' . $_COOKIE['nextend_uniqid'], 1, 3600);
45
+
46
+ return $_COOKIE['nextend_uniqid'];
47
+ }
48
+ }
49
+
50
+ /*
51
+ Loading style for buttons
52
+ */
53
+
54
+ function nextend_google_connect_stylesheet() {
55
+ wp_register_style('nextend_google_connect_stylesheet', plugins_url('buttons/google-btn.css', __FILE__));
56
+ wp_enqueue_style('nextend_google_connect_stylesheet');
57
+ }
58
+
59
+ if ($new_google_settings['google_load_style']) {
60
+ add_action('wp_enqueue_scripts', 'nextend_google_connect_stylesheet');
61
+ add_action('login_enqueue_scripts', 'nextend_google_connect_stylesheet');
62
+ add_action('admin_enqueue_scripts', 'nextend_google_connect_stylesheet');
63
+ }
64
+
65
+ /*
66
+ Adding query vars for the WP parser
67
+ */
68
+
69
+ function new_google_add_query_var() {
70
+
71
+ global $wp;
72
+ $wp->add_query_var('editProfileRedirect');
73
+ $wp->add_query_var('loginGoogle');
74
+ }
75
+
76
+ add_filter('init', 'new_google_add_query_var');
77
+
78
+ /* -----------------------------------------------------------------------------
79
+ Main function to handle the Sign in/Register/Linking process
80
+ ----------------------------------------------------------------------------- */
81
+
82
+ /*
83
+ Compatibility for older versions
84
+ */
85
+ add_action('parse_request', 'new_google_login_compat');
86
+
87
+ function new_google_login_compat() {
88
+
89
+ global $wp;
90
+ if ($wp->request == 'loginGoogle' || isset($wp->query_vars['loginGoogle'])) {
91
+ new_google_login_action();
92
+ }
93
+ }
94
+
95
+ /*
96
+ For login page
97
+ */
98
+ add_action('login_init', 'new_google_login');
99
+
100
+ function new_google_login() {
101
+
102
+ if (isset($_REQUEST['loginGoogle']) && $_REQUEST['loginGoogle'] == '1') {
103
+ new_google_login_action();
104
+ }
105
+ }
106
+
107
+ function new_google_login_action() {
108
+ global $wp, $wpdb, $new_google_settings;
109
+
110
+ if (isset($_GET['action']) && $_GET['action'] == 'unlink') {
111
+ $user_info = wp_get_current_user();
112
+ if ($user_info->ID) {
113
+ $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'social_users
114
+ WHERE ID = %d
115
+ AND type = \'google\'', $user_info->ID));
116
+ set_site_transient($user_info->ID . '_new_google_admin_notice', 'Your Google profile is successfully unlinked from your account.', 3600);
117
+ }
118
+ new_google_redirect();
119
+ }
120
+ include(dirname(__FILE__) . '/sdk/init.php');
121
+
122
+ if (isset($_GET['code'])) {
123
+ if (isset($new_google_settings['google_redirect']) && $new_google_settings['google_redirect'] != '' && $new_google_settings['google_redirect'] != 'auto') {
124
+ $_GET['redirect'] = $new_google_settings['google_redirect'];
125
+ }
126
+
127
+ set_site_transient(nextend_uniqid() . '_google_r', $_GET['redirect'], 3600);
128
+
129
+ $client->authenticate();
130
+ $access_token = $client->getAccessToken();
131
+ set_site_transient(nextend_uniqid() . '_google_at', $access_token, 3600);
132
+ header('Location: ' . filter_var(new_google_login_url(), FILTER_SANITIZE_URL));
133
+ exit;
134
+ }
135
+
136
+ $access_token = get_site_transient(nextend_uniqid() . '_google_at');
137
+
138
+ if ($access_token !== false) {
139
+ $client->setAccessToken($access_token);
140
+ }
141
+ if (isset($_REQUEST['logout'])) {
142
+ delete_site_transient(nextend_uniqid() . '_google_at');
143
+ $client->revokeToken();
144
+ }
145
+ if ($client->getAccessToken()) {
146
+ $u = $oauth2->userinfo->get();
147
+
148
+ // The access token may have been updated lazily.
149
+ set_site_transient(nextend_uniqid() . '_google_at', $client->getAccessToken(), 3600);
150
+
151
+ // These fields are currently filtered through the PHP sanitize filters.
152
+
153
+ // See http://www.php.net/manual/en/filter.filters.sanitize.php
154
+
155
+ $email = filter_var($u['email'], FILTER_SANITIZE_EMAIL);
156
+ $ID = $wpdb->get_var($wpdb->prepare('
157
+ SELECT ID FROM ' . $wpdb->prefix . 'social_users WHERE type = "google" AND identifier = "%s"
158
+ ', $u['id']));
159
+ if (!get_user_by('id', $ID)) {
160
+ $wpdb->query($wpdb->prepare('
161
+ DELETE FROM ' . $wpdb->prefix . 'social_users WHERE ID = "%s"
162
+ ', $ID));
163
+ $ID = null;
164
+ }
165
+ if (!is_user_logged_in()) {
166
+ if ($ID == null) { // Register
167
+
168
+ $ID = email_exists($email);
169
+ if ($ID == false) { // Real register
170
+
171
+ require_once(ABSPATH . WPINC . '/registration.php');
172
+ $random_password = wp_generate_password($length = 12, $include_standard_special_chars = false);
173
+ if (!isset($new_google_settings['google_user_prefix'])) {
174
+ $new_google_settings['google_user_prefix'] = 'Google - ';
175
+ }
176
+ $sanitized_user_login = sanitize_user($new_google_settings['google_user_prefix'] . $u['name']);
177
+ if (!validate_username($sanitized_user_login)) {
178
+ $sanitized_user_login = sanitize_user('google' . $user_profile['id']);
179
+ }
180
+ $defaul_user_name = $sanitized_user_login;
181
+ $i = 1;
182
+ while (username_exists($sanitized_user_login)) {
183
+ $sanitized_user_login = $defaul_user_name . $i;
184
+ $i++;
185
+ }
186
+ $ID = wp_create_user($sanitized_user_login, $random_password, $email);
187
+ if (!is_wp_error($ID)) {
188
+ wp_new_user_notification($ID, $random_password);
189
+ $user_info = get_userdata($ID);
190
+ wp_update_user(array(
191
+ 'ID' => $ID,
192
+ 'display_name' => $u['name'],
193
+ 'first_name' => $u['given_name'],
194
+ 'last_name' => $u['family_name'],
195
+ 'googleplus' => $u['link']
196
+ ));
197
+ update_user_meta($ID, 'new_google_default_password', $user_info->user_pass);
198
+ do_action('nextend_google_user_registered', $ID, $u, $oauth2);
199
+ } else {
200
+ return;
201
+ }
202
+ }
203
+ if ($ID) {
204
+ $wpdb->insert($wpdb->prefix . 'social_users', array(
205
+ 'ID' => $ID,
206
+ 'type' => 'google',
207
+ 'identifier' => $u['id']
208
+ ), array(
209
+ '%d',
210
+ '%s',
211
+ '%s'
212
+ ));
213
+ }
214
+ if (isset($new_google_settings['google_redirect_reg']) && $new_google_settings['google_redirect_reg'] != '' && $new_google_settings['google_redirect_reg'] != 'auto') {
215
+ set_site_transient(nextend_uniqid() . '_google_r', $new_google_settings['google_redirect_reg'], 3600);
216
+ }
217
+ }
218
+ if ($ID) { // Login
219
+
220
+ $secure_cookie = is_ssl();
221
+ $secure_cookie = apply_filters('secure_signon_cookie', $secure_cookie, array());
222
+ global $auth_secure_cookie; // XXX ugly hack to pass this to wp_authenticate_cookie
223
+
224
+ $auth_secure_cookie = $secure_cookie;
225
+ wp_set_auth_cookie($ID, true, $secure_cookie);
226
+ $user_info = get_userdata($ID);
227
+ do_action('wp_login', $user_info->user_login, $user_info);
228
+ do_action('nextend_google_user_logged_in', $ID, $u, $oauth2);
229
+
230
+ // @Jamie Bainbridge fix for Google Avatars
231
+ $userJSON = @file_get_contents('http://picasaweb.google.com/data/entry/api/user/' . $u['id'] . '?alt=json');
232
+ if ($userJSON) {
233
+ $userArray = json_decode($userJSON, true);
234
+ if ($userArray && isset($userArray["entry"]) && isset($userArray["entry"]["gphoto\$thumbnail"]) && isset($userArray["entry"]["gphoto\$thumbnail"]["\$t"])) {
235
+ update_user_meta($ID, 'google_profile_picture', $userArray["entry"]["gphoto\$thumbnail"]["\$t"]);
236
+ }
237
+ }
238
+ }
239
+ } else {
240
+ if (new_google_is_user_connected()) { // It was a simple login
241
+
242
+
243
+ } elseif ($ID === null) { // Let's connect the account to the current user!
244
+
245
+ $current_user = wp_get_current_user();
246
+ $wpdb->insert($wpdb->prefix . 'social_users', array(
247
+ 'ID' => $current_user->ID,
248
+ 'type' => 'google',
249
+ 'identifier' => $u['id']
250
+ ), array(
251
+ '%d',
252
+ '%s',
253
+ '%s'
254
+ ));
255
+ do_action('nextend_google_user_account_linked', $ID, $u, $oauth2);
256
+ $user_info = wp_get_current_user();
257
+ set_site_transient($user_info->ID . '_new_google_admin_notice', 'Your Google profile is successfully linked with your account. Now you can sign in with Google easily.', 3600);
258
+ } else {
259
+ $user_info = wp_get_current_user();
260
+ set_site_transient($user_info->ID . '_new_google_admin_notice', 'This Google profile is already linked with other account. Linking process failed!', 3600);
261
+ }
262
+ }
263
+ } else {
264
+ if (isset($new_google_settings['google_redirect']) && $new_google_settings['google_redirect'] != '' && $new_google_settings['google_redirect'] != 'auto') {
265
+ $_GET['redirect'] = $new_google_settings['google_redirect'];
266
+ }
267
+ if (isset($_GET['redirect'])) {
268
+ set_site_transient(nextend_uniqid() . '_google_r', $_GET['redirect'], 3600);
269
+ }
270
+
271
+ $redirect = get_site_transient(nextend_uniqid() . '_google_r');
272
+
273
+ if ($redirect || $redirect == new_google_login_url()) {
274
+ $redirect = site_url();
275
+ set_site_transient(nextend_uniqid() . '_google_r', $redirect, 3600);
276
+ }
277
+ header('LOCATION: ' . $client->createAuthUrl());
278
+ exit;
279
+ }
280
+ new_google_redirect();
281
+ }
282
+
283
+ /*
284
+ Is the current user connected the Google profile?
285
+ */
286
+
287
+ function new_google_is_user_connected() {
288
+
289
+ global $wpdb;
290
+ $current_user = wp_get_current_user();
291
+ $ID = $wpdb->get_var($wpdb->prepare('
292
+ SELECT identifier FROM ' . $wpdb->prefix . 'social_users WHERE type = "google" AND ID = "%d"
293
+ ', $current_user->ID));
294
+ if ($ID === null) {
295
+ return false;
296
+ }
297
+
298
+ return $ID;
299
+ }
300
+
301
+ /*
302
+ Connect Field in the Profile page
303
+ */
304
+
305
+ function new_add_google_connect_field() {
306
+
307
+ global $new_is_social_header;
308
+ if ($new_is_social_header === null) {
309
+ ?>
310
+ <h3>Social connect</h3>
311
+ <?php
312
+ $new_is_social_header = true;
313
+ }
314
+ ?>
315
+ <table class="form-table">
316
+ <tbody>
317
+ <tr>
318
+ <th></th>
319
+ <td>
320
+ <?php
321
+ if (new_google_is_user_connected()) {
322
+ echo new_google_unlink_button();
323
+ } else {
324
+ echo new_google_link_button();
325
+ }
326
+ ?>
327
+ </td>
328
+ </tr>
329
+ </tbody>
330
+ </table>
331
+ <?php
332
+ }
333
+
334
+ add_action('profile_personal_options', 'new_add_google_connect_field');
335
+
336
+ function new_add_google_login_form() {
337
+
338
+ ?>
339
+ <script>
340
+ if (jQuery.type(has_social_form) === 'undefined') {
341
+ var has_social_form = false;
342
+ var socialLogins = null;
343
+ }
344
+ jQuery(document).ready(function () {
345
+ (function ($) {
346
+ if (!has_social_form) {
347
+ has_social_form = true;
348
+ var loginForm = $('#loginform,#registerform,#front-login-form,#setupform');
349
+ socialLogins = $(
350
+ '<div class="newsociallogins" style="text-align: center;"><div style="clear:both;"></div></div>');
351
+ if (loginForm.find('input').length > 0) {
352
+ loginForm.prepend("<h3 style='text-align:center;'><?php _e('OR'); ?></h3>");
353
+ }
354
+ loginForm.prepend(socialLogins);
355
+ }
356
+ if (!window.google_added) {
357
+ socialLogins.prepend(
358
+ '<?php echo addslashes(preg_replace('/^\s+|\n|\r|\s+$/m', '', new_google_sign_button())); ?>');
359
+ window.google_added = true;
360
+ }
361
+ }(jQuery));
362
+ });
363
+ </script>
364
+ <?php
365
+ }
366
+
367
+ add_action('login_form', 'new_add_google_login_form');
368
+ add_action('register_form', 'new_add_google_login_form');
369
+ add_action('bp_sidebar_login_form', 'new_add_google_login_form');
370
+ add_filter('get_avatar', 'new_google_insert_avatar', 5, 5);
371
+
372
+ function new_google_insert_avatar($avatar = '', $id_or_email, $size = 96, $default = '', $alt = false) {
373
+
374
+ $id = 0;
375
+ if (is_numeric($id_or_email)) {
376
+ $id = $id_or_email;
377
+ } else if (is_string($id_or_email)) {
378
+ $u = get_user_by('email', $id_or_email);
379
+ $id = $u->id;
380
+ } else if (is_object($id_or_email)) {
381
+ $id = $id_or_email->user_id;
382
+ }
383
+ if ($id == 0) {
384
+ return $avatar;
385
+ }
386
+ $pic = get_user_meta($id, 'google_profile_picture', true);
387
+ if (!$pic || $pic == '') {
388
+ return $avatar;
389
+ }
390
+ $avatar = preg_replace('/src=("|\').*?("|\')/i', 'src=\'' . $pic . '\'', $avatar);
391
+
392
+ return $avatar;
393
+ }
394
+
395
+ add_filter('bp_core_fetch_avatar', 'new_google_bp_insert_avatar', 3, 5);
396
+
397
+ function new_google_bp_insert_avatar($avatar = '', $params, $id) {
398
+ if (!is_numeric($id) || strpos($avatar, 'gravatar') === false) {
399
+ return $avatar;
400
+ }
401
+ $pic = get_user_meta($id, 'google_profile_picture', true);
402
+ if (!$pic || $pic == '') {
403
+ return $avatar;
404
+ }
405
+ $avatar = preg_replace('/src=("|\').*?("|\')/i', 'src=\'' . $pic . '\'', $avatar);
406
+
407
+ return $avatar;
408
+ }
409
+
410
+ /*
411
+ Options Page
412
+ */
413
+ require_once(trailingslashit(dirname(__FILE__)) . "nextend-google-settings.php");
414
+ if (class_exists('NextendGoogleSettings')) {
415
+ $nextendgooglesettings = new NextendGoogleSettings();
416
+ if (isset($nextendgooglesettings)) {
417
+ add_action('admin_menu', array(
418
+ &$nextendgooglesettings,
419
+ 'NextendGoogle_Menu'
420
+ ), 1);
421
+ }
422
+ }
423
+ add_filter('plugin_action_links', 'new_google_plugin_action_links', 10, 2);
424
+
425
+ function new_google_plugin_action_links($links, $file) {
426
+
427
+ if ($file != NEW_GOOGLE_LOGIN_PLUGIN_BASENAME) {
428
+ return $links;
429
+ }
430
+ $settings_link = '<a href="' . esc_url(menu_page_url('nextend-google-connect', false)) . '">' . esc_html('Settings') . '</a>';
431
+ array_unshift($links, $settings_link);
432
+
433
+ return $links;
434
+ }
435
+
436
+ /* -----------------------------------------------------------------------------
437
+ Miscellaneous functions
438
+ ----------------------------------------------------------------------------- */
439
+
440
+ function new_google_sign_button() {
441
+
442
+ global $new_google_settings;
443
+
444
+ return '<a href="' . esc_url(new_google_login_url() . (isset($_GET['redirect_to']) ? '&redirect=' . urlencode($_GET['redirect_to']) : '')) . '" rel="nofollow">' . $new_google_settings['google_login_button'] . '</a><br />';
445
+ }
446
+
447
+ function new_google_link_button() {
448
+
449
+ global $new_google_settings;
450
+
451
+ return '<a href="' . esc_url(new_google_login_url() . '&redirect=' . urlencode(new_google_curPageURL())) . '">' . $new_google_settings['google_link_button'] . '</a><br />';
452
+ }
453
+
454
+ function new_google_unlink_button() {
455
+
456
+ global $new_google_settings;
457
+
458
+ return '<a href="' . esc_url(new_google_login_url() . '&action=unlink&redirect=' . urlencode(new_google_curPageURL())) . '">' . $new_google_settings['google_unlink_button'] . '</a><br />';
459
+ }
460
+
461
+ function new_google_curPageURL() {
462
+
463
+ $pageURL = 'http';
464
+ if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {
465
+ $pageURL .= "s";
466
+ }
467
+ $pageURL .= "://";
468
+ if ($_SERVER["SERVER_PORT"] != "80") {
469
+ $pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
470
+ } else {
471
+ $pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
472
+ }
473
+
474
+ return $pageURL;
475
+ }
476
+
477
+ function new_google_login_url() {
478
+
479
+ return site_url('wp-login.php') . '?loginGoogle=1';
480
+ }
481
+
482
+ function new_google_redirect() {
483
+
484
+ $redirect = get_site_transient(nextend_uniqid() . '_google_r');
485
+
486
+ if (!$redirect || $redirect == '' || $redirect == new_google_login_url()) {
487
+ if (isset($_GET['redirect'])) {
488
+ $redirect = $_GET['redirect'];
489
+ } else {
490
+ $redirect = site_url();
491
+ }
492
+ }
493
+ $redirect = wp_sanitize_redirect($redirect);
494
+ $redirect = wp_validate_redirect($redirect, site_url());
495
+ header('LOCATION: ' . $redirect);
496
+ delete_site_transient(nextend_uniqid() . '_google_r');
497
+ exit;
498
+ }
499
+
500
+ function new_google_edit_profile_redirect() {
501
+
502
+ global $wp;
503
+ if (isset($wp->query_vars['editProfileRedirect'])) {
504
+ if (function_exists('bp_loggedin_user_domain')) {
505
+ header('LOCATION: ' . bp_loggedin_user_domain() . 'profile/edit/group/1/');
506
+ } else {
507
+ header('LOCATION: ' . self_admin_url('profile.php'));
508
+ }
509
+ exit;
510
+ }
511
+ }
512
+
513
+ add_action('parse_request', 'new_google_edit_profile_redirect');
514
+
515
+ function new_google_jquery() {
516
+
517
+ wp_enqueue_script('jquery');
518
+ }
519
+
520
+ add_action('login_form_login', 'new_google_jquery');
521
+ add_action('login_form_register', 'new_google_jquery');
522
+
523
+ /*
524
+ Session notices used in the profile settings
525
+ */
526
+
527
+ function new_google_admin_notice() {
528
+ $user_info = wp_get_current_user();
529
+ $notice = get_site_transient($user_info->ID . '_new_google_admin_notice');
530
+ if ($notice !== false) {
531
+ echo '<div class="updated">
532
+ <p>' . $notice . '</p>
533
+ </div>';
534
+ delete_site_transient($user_info->ID . '_new_google_admin_notice');
535
+ }
536
+ }
537
+
538
+ add_action('admin_notices', 'new_google_admin_notice');
providers/google/compat/nextend-google-settings.php ADDED
@@ -0,0 +1,315 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Nextend Google Connect Settings Page
4
+ */
5
+
6
+
7
+ if (!class_exists('NextendGoogleSettings')) {
8
+
9
+ add_action('admin_init', array(
10
+ 'NextendGoogleSettings',
11
+ 'store_settings'
12
+ ));
13
+
14
+ class NextendGoogleSettings {
15
+
16
+ static function store_settings() {
17
+ if (current_user_can('manage_options')) {
18
+ if (isset($_POST['newgoogle_update_options']) && check_admin_referer('nextend-google-connect')) {
19
+ if ($_POST['newgoogle_update_options'] == 'Y') {
20
+ foreach ($_POST AS $k => $v) {
21
+ $_POST[$k] = stripslashes($v);
22
+ }
23
+ unset($_POST['Submit']);
24
+ $sanitize = array(
25
+ 'newgoogle_update_options',
26
+ 'google_client_id',
27
+ 'google_client_secret',
28
+ 'google_api_key',
29
+ 'google_redirect',
30
+ 'google_redirect_reg',
31
+ 'google_load_style'
32
+ );
33
+ foreach ($sanitize AS $k) {
34
+ $_POST[$k] = sanitize_text_field($_POST[$k]);
35
+ }
36
+
37
+ $_POST['google_user_prefix'] = preg_replace("/[^A-Za-z0-9\-_ ]/", '', $_POST['google_user_prefix']);
38
+
39
+ update_option("nextend_google_connect", maybe_serialize($_POST));
40
+ $newgoogle_status = 'update_success';
41
+ }
42
+ }
43
+ }
44
+ }
45
+
46
+ static function NextendGoogle_Options_Page() {
47
+ $domain = get_option('siteurl');
48
+ $domain = str_replace(array(
49
+ 'http://',
50
+ 'https://'
51
+ ), array(
52
+ '',
53
+ ''
54
+ ), $domain);
55
+ $domain = str_replace('www.', '', $domain);
56
+ $a = explode("/", $domain);
57
+ $domain = $a[0];
58
+ ?>
59
+
60
+ <div class="wrap">
61
+ <div id="newgoogle-options">
62
+ <div id="newgoogle-title"><h2>Nextend Google Connect Settings</h2></div>
63
+ <?php
64
+ global $newgoogle_status;
65
+ if ($newgoogle_status == 'update_success') {
66
+ $message = 'Configuration updated' . "<br />";
67
+ } else if ($newgoogle_status == 'update_failed') {
68
+ $message = 'Error while saving options' . "<br />";
69
+ } else {
70
+ $message = '';
71
+ }
72
+
73
+ if ($message != "") {
74
+ ?>
75
+ <div class="updated"><strong><p><?php
76
+ echo $message;
77
+ ?></p></strong></div><?php
78
+ } ?>
79
+ <div id="newgoogle-desc">
80
+ <p><?php echo 'This plugins helps you create Google login and register buttons. The login and register process only takes one click and you can fully customize the buttons with images and other assets.'; ?></p>
81
+ <h3><?php echo 'Setup'; ?></h3>
82
+ <p>
83
+ <?php echo '<ol><li><a href="https://www.google.com/accounts/ManageDomains" target="_blank">Add your domain to Google system!</a></li>'; ?>
84
+ <?php echo '<li>The bottom of the page will contain a link to your domain. Click on it and follow Google\'s veryfication steps.</li>'; ?>
85
+ <?php echo '<li>After you are done, <a href="https://code.google.com/apis/console" target="_blank">We have to create and API access.</a></li>'; ?>
86
+ <?php echo '<li>Create a new API access with your product name.<br><img src="http://www.nextendweb.com/wp-content/uploads/2012/10/googleapi11.png" /></li>'; ?>
87
+ <?php echo '<li>Search for the Google+ API row and enable the service</li>'; ?>
88
+ <?php echo '<li>Then click on the API access panel and create and OAuth 2 clien ID!<br><img src="http://www.nextendweb.com/wp-content/uploads/2012/10/googleapi21.png" /></li>'; ?>
89
+ <?php echo '<li>Product name can be anything then click on next.</li>'; ?>
90
+ <?php echo '<li>Click on the <b>more options</b> link and copy and paste <b>' . new_google_login_url() . '</b> to the textarea.<br><img src="http://www.nextendweb.com/wp-content/uploads/2012/10/googleapi31.png" /></li>'; ?>
91
+ <?php echo '<li>Now you should use the values in the fields below.<br><img src="http://www.nextendweb.com/wp-content/uploads/2012/10/googleapi4.png" /></li>'; ?>
92
+ <?php echo '<li><b>Save changes!</b></li></ol>'; ?>
93
+
94
+
95
+ </p>
96
+ <h3><?php echo 'Usage'; ?></h3>
97
+ <h4><?php echo 'Simple link'; ?></h4>
98
+ <p><?php echo '&lt;a href="' . new_google_login_url() . '&redirect=' . get_option('siteurl') . '" onclick="window.location = \'' . new_google_login_url() . '&redirect=\'+window.location.href; return false;"&gt;Click here to login or register with google&lt;/a&gt;'; ?></p>
99
+
100
+ <h4><?php echo 'Image button'; ?></h4>
101
+ <p><?php echo '&lt;a href="' . new_google_login_url() . '&redirect=' . get_option('siteurl') . '" onclick="window.location = \'' . new_google_login_url() . '&redirect=\'+window.location.href; return false;"&gt; &lt;img src="HereComeTheImage" /&gt; &lt;/a&gt;'; ?></p>
102
+
103
+ <h3><?php echo 'Note'; ?></h3>
104
+ <p><?php echo 'If the google user\'s email address already used by another member of your site, the google profile will be automatically linked to the existing profile!'; ?></p>
105
+
106
+ </div>
107
+
108
+ <!--right-->
109
+ <div class="postbox-container" style="float:right;width:30%;">
110
+ <div class="metabox-holder">
111
+ <div class="meta-box-sortables">
112
+
113
+ <!--about-->
114
+ <div id="newgoogle-about" class="postbox">
115
+ <h3 class="hndle"><?php echo 'About this plugin'; ?></h3>
116
+ <div class="inside">
117
+ <ul>
118
+
119
+ <li>
120
+ <a href="http://www.nextendweb.com/social-connect-plugins-for-wordpress.html"
121
+ target="_blank"><?php echo 'Check the realted <b>blog post</b>!'; ?></a>
122
+ </li>
123
+ <li><br></li>
124
+ <li><a href="http://wordpress.org/extend/plugins/nextend-google-connect/"
125
+ target="_blank"><?php echo 'Nextend Google Connect'; ?></a></li>
126
+ <li><br></li>
127
+ <li><a href="http://profiles.wordpress.org/nextendweb"
128
+ target="_blank"><?php echo 'Nextend plugins at WordPress.org'; ?></a>
129
+ </li>
130
+ </ul>
131
+ </div>
132
+ </div>
133
+ <!--about end-->
134
+
135
+ <!--others-->
136
+ <!--others end-->
137
+
138
+ </div>
139
+ </div>
140
+ </div>
141
+ <!--right end-->
142
+
143
+ <!--left-->
144
+ <div class="postbox-container" style="float:left;width: 69%;">
145
+ <div class="metabox-holder">
146
+ <div class="meta-box-sortabless">
147
+
148
+ <!--setting-->
149
+ <div id="newgoogle-setting" class="postbox">
150
+ <h3 class="hndle"><?php echo 'Settings'; ?></h3>
151
+ <?php $nextend_google_connect = maybe_unserialize(get_option('nextend_google_connect')); ?>
152
+
153
+ <form method="post"
154
+ action="<?php echo get_bloginfo("wpurl"); ?>/wp-admin/options-general.php?page=nextend-google-connect">
155
+ <?php wp_nonce_field('nextend-google-connect'); ?>
156
+ <input type="hidden" name="newgoogle_update_options" value="Y">
157
+
158
+ <table class="form-table">
159
+ <tr>
160
+ <th scope="row"><?php echo 'Google Client ID:'; ?></th>
161
+ <td>
162
+ <input type="text" name="google_client_id"
163
+ value="<?php echo esc_html($nextend_google_connect['google_client_id']); ?>"/>
164
+ </td>
165
+ </tr>
166
+
167
+ <tr>
168
+ <th scope="row"><?php echo 'Google Client Secret:'; ?></th>
169
+ <td>
170
+ <input type="text" name="google_client_secret"
171
+ value="<?php echo esc_html($nextend_google_connect['google_client_secret']); ?>"/>
172
+ </td>
173
+ </tr>
174
+
175
+ <tr>
176
+ <th scope="row"><?php echo 'Google API key:'; ?></th>
177
+ <td>
178
+ <input type="text" name="google_api_key"
179
+ value="<?php echo esc_html($nextend_google_connect['google_api_key']); ?>"/>
180
+ </td>
181
+ </tr>
182
+
183
+ <tr>
184
+ <th scope="row"><?php echo 'New user prefix:'; ?></th>
185
+ <td>
186
+ <?php if (!isset($nextend_google_connect['google_user_prefix'])) {
187
+ $nextend_google_connect['google_user_prefix'] = 'Google - ';
188
+ } ?>
189
+ <input type="text" name="google_user_prefix"
190
+ value="<?php echo esc_html($nextend_google_connect['google_user_prefix']); ?>"/>
191
+ </td>
192
+ </tr>
193
+
194
+ <tr>
195
+ <th scope="row"><?php echo 'New user prefix:'; ?></th>
196
+ <td>
197
+ <?php if (!isset($nextend_google_connect['google_user_prefix'])) {
198
+ $nextend_google_connect['google_user_prefix'] = 'Facebook - ';
199
+ } ?>
200
+ <input type="text" name="google_user_prefix"
201
+ value="<?php echo esc_html($nextend_google_connect['google_user_prefix']); ?>"/>
202
+ </td>
203
+ </tr>
204
+
205
+ <tr>
206
+ <th scope="row"><?php echo 'Fixed redirect url for login:'; ?></th>
207
+ <td>
208
+ <?php if (!isset($nextend_google_connect['google_redirect'])) {
209
+ $nextend_google_connect['google_redirect'] = 'auto';
210
+ } ?>
211
+ <input type="text" name="google_redirect"
212
+ value="<?php echo esc_html($nextend_google_connect['google_redirect']); ?>"/>
213
+ </td>
214
+ </tr>
215
+
216
+ <tr>
217
+ <th scope="row"><?php echo 'Fixed redirect url for register:'; ?></th>
218
+ <td>
219
+ <?php if (!isset($nextend_google_connect['google_redirect_reg'])) {
220
+ $nextend_google_connect['google_redirect_reg'] = 'auto';
221
+ } ?>
222
+ <input type="text" name="google_redirect_reg"
223
+ value="<?php echo esc_html($nextend_google_connect['google_redirect_reg']); ?>"/>
224
+ </td>
225
+ </tr>
226
+
227
+ <tr>
228
+ <th scope="row"><?php echo 'Load button stylesheet:'; ?></th>
229
+ <td>
230
+ <?php if (!isset($nextend_google_connect['google_load_style'])) {
231
+ $nextend_google_connect['google_load_style'] = 1;
232
+ } ?>
233
+ <input name="google_load_style" id="google_load_style_yes" value="1"
234
+ type="radio" <?php if (isset($nextend_google_connect['google_load_style']) && $nextend_google_connect['google_load_style']) { ?> checked <?php } ?>>
235
+ Yes &nbsp;&nbsp;&nbsp;&nbsp;
236
+ <input name="google_load_style" id="google_load_style_no" value="0"
237
+ type="radio" <?php if (isset($nextend_google_connect['google_load_style']) && $nextend_google_connect['google_load_style'] == 0) { ?> checked <?php } ?>>
238
+ No
239
+ </td>
240
+ </tr>
241
+
242
+ <tr>
243
+ <th scope="row"><?php echo 'Login button:'; ?></th>
244
+ <td>
245
+ <?php if (!isset($nextend_google_connect['google_login_button'])) {
246
+ $nextend_google_connect['google_login_button'] = '<div class="new-google-btn new-google-1 new-google-default-anim"><div class="new-google-1-1"><div class="new-google-1-1-1">CONNECT WITH</div></div></div>';
247
+ } ?>
248
+ <textarea cols="83" rows="3"
249
+ name="google_login_button"><?php echo esc_html($nextend_google_connect['google_login_button']); ?></textarea>
250
+ </td>
251
+ </tr>
252
+
253
+ <tr>
254
+ <th scope="row"><?php echo 'Link account button:'; ?></th>
255
+ <td>
256
+ <?php if (!isset($nextend_google_connect['google_link_button'])) {
257
+ $nextend_google_connect['google_link_button'] = '<div class="new-google-btn new-google-1 new-google-default-anim"><div class="new-google-1-1"><div class="new-google-1-1-1">LINK ACCOUNT TO</div></div></div>';
258
+ } ?>
259
+ <textarea cols="83" rows="3"
260
+ name="google_link_button"><?php echo esc_html($nextend_google_connect['google_link_button']); ?></textarea>
261
+ </td>
262
+ </tr>
263
+
264
+ <tr>
265
+ <th scope="row"><?php echo 'Unlink account button:'; ?></th>
266
+ <td>
267
+ <?php if (!isset($nextend_google_connect['google_unlink_button'])) {
268
+ $nextend_google_connect['google_unlink_button'] = '<div class="new-google-btn new-google-1 new-google-default-anim"><div class="new-google-1-1"><div class="new-google-1-1-1">UNLINK ACCOUNT</div></div></div>';
269
+ } ?>
270
+ <textarea cols="83" rows="3"
271
+ name="google_unlink_button"><?php echo esc_html($nextend_google_connect['google_unlink_button']); ?></textarea>
272
+ </td>
273
+ </tr>
274
+
275
+ <tr>
276
+ <th scope="row"></th>
277
+ <td>
278
+ <a href="http://www.nextendweb.com/social-connect-button-generator"
279
+ target="_blank"><img style="margin-left: -4px;"
280
+ src="<?php echo plugins_url('generatorbanner.png', __FILE__); ?>"/></a>
281
+ </td>
282
+ </tr>
283
+ </table>
284
+
285
+ <p class="submit">
286
+ <input style="margin-left: 10%;" type="submit" name="Submit"
287
+ value="<?php echo 'Save Changes'; ?>"/>
288
+ </p>
289
+ </form>
290
+ </div>
291
+ <!--setting end-->
292
+
293
+ <!--others-->
294
+ <!--others end-->
295
+
296
+ </div>
297
+ </div>
298
+ </div>
299
+ <!--left end-->
300
+
301
+ </div>
302
+ </div>
303
+ <?php
304
+ }
305
+
306
+ function NextendGoogle_Menu() {
307
+ add_options_page(__('Nextend Google Connect'), __('Nextend Google Connect'), 'manage_options', 'nextend-google-connect', array(
308
+ 'NextendGoogleSettings',
309
+ 'NextendGoogle_Options_Page'
310
+ ));
311
+ }
312
+
313
+ }
314
+ }
315
+ ?>
providers/google/compat/readme.txt ADDED
@@ -0,0 +1,204 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Nextend Google Connect ===
2
+ Contributors: nextendweb
3
+ Tags: google, register, login, social connect, social, google connect
4
+ Donate link: https://www.facebook.com/nextendweb
5
+ Requires at least: 3.0
6
+ Tested up to: 4.7.0
7
+ Stable tag: 1.6.1
8
+ License: GPLv2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
+
11
+ One click registration & login plugin for Google? Easy installation? Is it totally free and comes with support? Yeah!
12
+
13
+ == Description ==
14
+
15
+ Check the [DEMO](http://secure.nextendweb.com/) on our site.
16
+
17
+ Also we created a [Social Connect button generator](http://www.nextendweb.com/social-connect-button-generator) for this plugin. This allows you to create fancy login buttons.
18
+
19
+ Personally, I hate to fill out registration forms, waiting for confirmation e-mails, so we designed this plugin for our website. Now, we want to share this very usable plugin with everyone, for free!
20
+
21
+ **Why should you choose Nextend Google Connect plugin from the many social plugins?**
22
+
23
+ * If your visitors have a Google profile, they can register your site with a single click, and later to log in too.
24
+ * The previously registered users can simply attach their existing Google profile to their account, so in the future, they can logging in with the one social button.
25
+ * The plugin has multiple desings, so it fits all kind of websites smoothly and elegantly. - Soon
26
+ * Very simple to use.
27
+ * Fast and helpful support.
28
+ * Totally free.
29
+
30
+ If you like our stuff donate a like to our [Facebook page](https://www.facebook.com/nextendweb) or follow us on [Twitter](https://twitter.com/nextendweb)!
31
+
32
+ #### Usage
33
+
34
+ After you activated the plugin, the plugin will autmatically
35
+
36
+ * add the login buttons to the WordPress login page. See screenshot #1
37
+ * add the account linking buttons to the WordPress profile page. See screenshot #2
38
+
39
+
40
+ #### Advanced usage
41
+
42
+ **Simple link**
43
+
44
+ &lt;a href="*siteurl*/wp-login.php?loginGoogle=1&redirect=*siteurl*" onclick="window.location = \'*siteurl*/wp-login.php?loginGoogle=1&redirect=\'+window.location.href; return false;"&gt;Click here to login or register with Google&lt;/a&gt;
45
+
46
+ **Image button**
47
+
48
+ &lt;a href="*siteurl*/wp-login.php?loginGoogle=1&redirect=*siteurl*" onclick="window.location = \'*siteurl*/wp-login.php?loginGoogle=1&redirect=\'+window.location.href; return false;"&gt; &lt;img src="HereComeTheImage" /&gt; &lt;/a&gt;
49
+
50
+ == Installation ==
51
+
52
+ 1. Extract the zip file and just drop the contents in the wp-content/plugins/ directory of your WordPress installation and then activate the Plugin from Plugins page.
53
+ 2. Follow the steps in the Nextend Google Connect settings page!
54
+
55
+
56
+ == Screenshots ==
57
+
58
+ 1. Our Social Connect plugins on the main WP login page
59
+ 2. Our Social Connect plugins in the profile page for account linking
60
+
61
+ == Changelog ==
62
+
63
+ = 1.6.1 =
64
+ * Fix: Missing check which resulted a notice - made by Alberto
65
+
66
+ = 1.6.0 =
67
+ * Fix: Redirect urls are well encoded - made by JRB
68
+
69
+ = 1.5.9 =
70
+ * Nonce added to backend
71
+
72
+ = 1.5.5 =
73
+ * Vulnerability fix
74
+
75
+ = 1.5.3 =
76
+ * XSS Vulnerability fix
77
+
78
+ = 1.5.1 =
79
+ * Security fix for XSS
80
+
81
+ = 1.5.0 =
82
+ * Security fix for redirects (Thanks to: Kacper Szurek and Elger Jonker)
83
+ * Avatar fix (Thanks to: Jamie Bainbridge)
84
+
85
+ = 1.4.58 =
86
+ * Avatar fix
87
+ * Buddypress avatar support. If Buddypress avatar not exists, then Google avatar used. If there is a BuddyPress avatar, that will be used.
88
+
89
+ = 1.4.56 =
90
+ * Fix: WordPress transient functions used to store the required session variables. $_SESSION fully removed. Beta!!!
91
+
92
+ = 1.4.55 =
93
+ * Fix: Now the plugin use cookies instead of PHP session. Maybe this fixes the problems.
94
+ * Fix: Now the plugin use wp transient for the admin messages
95
+ * NOTICE: If the 1.4.54 version work for you fine, do NOT update yet!
96
+
97
+
98
+ = 1.4.54 =
99
+ * Fix
100
+
101
+ = 1.4.53 =
102
+ * Fix for crash
103
+
104
+ = 1.4.52 =
105
+ * Avatar fix
106
+
107
+ = 1.4.51 =
108
+ * Redirection fix
109
+ * Some other bug fixes with account linking feature
110
+
111
+ = 1.4.50 =
112
+ * Avatar fix
113
+ * Changes in actions
114
+
115
+ = 1.4.49 =
116
+ * Settings page fixed
117
+
118
+ = 1.4.48 =
119
+ * Redirection fix
120
+ * Optimalizations
121
+
122
+ = 1.4.45 =
123
+ * Feature: Account unlinking added
124
+
125
+ = 1.4.42 =
126
+ * Buddypress login widget support
127
+
128
+ = 1.4.38 =
129
+ * Added check for login inputs
130
+
131
+ = 1.4.36 =
132
+ * PHP notice fixes
133
+
134
+ = 1.4.33 =
135
+ * Typo fix, please update from 1.4.3x to this version!
136
+
137
+ = 1.4.32 =
138
+ * Double login button fix
139
+
140
+ = 1.4.31 =
141
+ * Callback url changed! if you used older version please repeat installation step #8
142
+ * Official SSL support added - Thanks for Chin for the help
143
+
144
+ = 1.4.27 =
145
+ * Important security fix
146
+
147
+ = 1.4.26 =
148
+ * Avatar support added
149
+ * Added e-mail notification on registration
150
+
151
+ = 1.4.25 =
152
+ * wp_login do_action fix
153
+
154
+ = 1.4.24 =
155
+ * new_google_is_user_connected() function now returns with the Google id if authenticated, null if not...
156
+
157
+ = 1.4.23 =
158
+ * Now the application will only request authorization for the register.
159
+
160
+ = 1.4.22 =
161
+ * Bugfix for Wordpress 3.5RC1
162
+
163
+ = 1.4.21 =
164
+ * Bugfix for Wordpress 3.5RC1
165
+
166
+ = 1.4.18 =
167
+ * Register redirect bugfix
168
+
169
+ = 1.4.17 =
170
+ * Bugfix
171
+
172
+ = 1.4.16 =
173
+ * Buttons added to registration form
174
+
175
+ = 1.4.15 =
176
+ * Added the option for different redirect for Login and Registration
177
+
178
+ = 1.4.14 =
179
+ * Login page jQuery fix
180
+
181
+ = 1.4.12 =
182
+ * Fixed session check
183
+
184
+ = 1.4.11 =
185
+ * Fixed wrong login urls on the settings page
186
+
187
+ = 1.4.10 =
188
+ * Added editProfileRedirect parameter for buddypress edit profile redirect. Usage: siteurl?editProfileRedirect=1
189
+
190
+ = 1.4.9 =
191
+ * https bugfix - author Michel Weimerskirch
192
+
193
+ = 1.4.8 =
194
+ * Added name, first name, last name and Google plus url support.
195
+ *
196
+ = 1.4.4 =
197
+ * Modified login redirect issue for wp-login.php - author Michel Weimerskirch
198
+ * Added fix redirect url support. If you leave it empty or "auto" it will try to redirect back the user to the last visited page.
199
+
200
+ = 1.1 =
201
+ * Added Social button generator support
202
+
203
+ = 1.0.1 =
204
+ * Added linking option to the profile page, so an already registered user can easily link the profile with a Facebook profile.
providers/google/compat/sdk/apiClient.php ADDED
@@ -0,0 +1,413 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Copyright 2010 Google Inc.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ // Check for the required json and curl extensions, the Google API PHP Client won't function without them.
19
+ if (!function_exists('curl_init')) {
20
+ throw new Exception('Google PHP API Client requires the CURL PHP extension');
21
+ }
22
+
23
+ if (!function_exists('json_decode')) {
24
+ throw new Exception('Google PHP API Client requires the JSON PHP extension');
25
+ }
26
+
27
+ if (!function_exists('http_build_query')) {
28
+ throw new Exception('Google PHP API Client requires http_build_query()');
29
+ }
30
+
31
+ if (!ini_get('date.timezone') && function_exists('date_default_timezone_set')) {
32
+ date_default_timezone_set('UTC');
33
+ }
34
+
35
+ // hack around with the include paths a bit so the library 'just works'
36
+ $cwd = dirname(__FILE__);
37
+ set_include_path("$cwd" . PATH_SEPARATOR . get_include_path());
38
+
39
+ require_once "config.php";
40
+ // If a local configuration file is found, merge it's values with the default configuration
41
+ if (file_exists($cwd . '/local_config.php')) {
42
+ $defaultConfig = $apiConfig;
43
+ require_once($cwd . '/local_config.php');
44
+ $apiConfig = array_merge($defaultConfig, $apiConfig);
45
+ }
46
+
47
+ // Include the top level classes, they each include their own dependencies
48
+ require_once 'service/apiModel.php';
49
+ require_once 'service/apiService.php';
50
+ require_once 'service/apiServiceRequest.php';
51
+ require_once 'auth/apiAuth.php';
52
+ require_once 'cache/apiCache.php';
53
+ require_once 'io/apiIO.php';
54
+ require_once('service/apiMediaFileUpload.php');
55
+
56
+ /**
57
+ * The Google API Client
58
+ * http://code.google.com/p/google-api-php-client/
59
+ *
60
+ * @author Chris Chabot <chabotc@google.com>
61
+ * @author Chirag Shah <chirags@google.com>
62
+ */
63
+ class apiClient {
64
+
65
+ // the version of the discovery mechanism this class is meant to work with
66
+ const discoveryVersion = 'v0.3';
67
+
68
+ /**
69
+ * @static
70
+ * @var apiAuth $auth
71
+ */
72
+ static $auth;
73
+
74
+ /** @var apiIo $io */
75
+ static $io;
76
+
77
+ /** @var apiCache $cache */
78
+ static $cache;
79
+
80
+ /** @var array $scopes */
81
+ protected $scopes = array();
82
+
83
+ /** @var bool $useObjects */
84
+ protected $useObjects = false;
85
+
86
+ // definitions of services that are discovered.
87
+ protected $services = array();
88
+
89
+ // Used to track authenticated state, can't discover services after doing authenticate()
90
+ private $authenticated = false;
91
+
92
+ private $defaultService = array(
93
+ 'authorization_token_url' => 'https://www.google.com/accounts/OAuthAuthorizeToken',
94
+ 'request_token_url' => 'https://www.google.com/accounts/OAuthGetRequestToken',
95
+ 'access_token_url' => 'https://www.google.com/accounts/OAuthGetAccessToken'
96
+ );
97
+
98
+ public function __construct($config = array()) {
99
+ global $apiConfig;
100
+ $apiConfig = array_merge($apiConfig, $config);
101
+ self::$cache = new $apiConfig['cacheClass']();
102
+ self::$auth = new $apiConfig['authClass']();
103
+ self::$io = new $apiConfig['ioClass']();
104
+ }
105
+
106
+ public function discover($service, $version = 'v1') {
107
+ $this->addService($service, $version);
108
+ $this->$service = $this->discoverService($service, $this->services[$service]['discoveryURI']);
109
+
110
+ return $this->$service;
111
+ }
112
+
113
+ /**
114
+ * Add a service
115
+ */
116
+ public function addService($service, $version) {
117
+ global $apiConfig;
118
+ if ($this->authenticated) {
119
+ // Adding services after being authenticated, since the oauth scope is already set (so you wouldn't have access to that data)
120
+ throw new apiException('Cant add services after having authenticated');
121
+ }
122
+ $this->services[$service] = $this->defaultService;
123
+ if (isset($apiConfig['services'][$service])) {
124
+ // Merge the service descriptor with the default values
125
+ $this->services[$service] = array_merge($this->services[$service], $apiConfig['services'][$service]);
126
+ }
127
+ $this->services[$service]['discoveryURI'] = $apiConfig['basePath'] . '/discovery/' . self::discoveryVersion . '/describe/' . urlencode($service) . '/' . urlencode($version);
128
+ }
129
+
130
+ /**
131
+ * Set the type of Auth class the client should use.
132
+ *
133
+ * @param string $authClassName
134
+ */
135
+ public function setAuthClass($authClassName) {
136
+ self::$auth = new $authClassName();
137
+ }
138
+
139
+ public function authenticate() {
140
+ $service = $this->prepareService();
141
+ $this->authenticated = true;
142
+
143
+ return self::$auth->authenticate($service);
144
+ }
145
+
146
+ /**
147
+ * Construct the OAuth 2.0 authorization request URI.
148
+ *
149
+ * @return string
150
+ */
151
+ public function createAuthUrl() {
152
+ $service = $this->prepareService();
153
+
154
+ return self::$auth->createAuthUrl($service['scope']);
155
+ }
156
+
157
+ private function prepareService() {
158
+ $service = $this->defaultService;
159
+ $scopes = array();
160
+ if ($this->scopes) {
161
+ $scopes = $this->scopes;
162
+ } else {
163
+ foreach ($this->services as $key => $val) {
164
+ if (isset($val['scope'])) {
165
+ if (is_array($val['scope'])) {
166
+ $scopes = array_merge($val['scope'], $scopes);
167
+ } else {
168
+ $scopes[] = $val['scope'];
169
+ }
170
+ } else {
171
+ $scopes[] = 'https://www.googleapis.com/auth/' . $key;
172
+ }
173
+ unset($val['discoveryURI']);
174
+ unset($val['scope']);
175
+ $service = array_merge($service, $val);
176
+ }
177
+ }
178
+ $service['scope'] = implode(' ', $scopes);
179
+
180
+ return $service;
181
+ }
182
+
183
+ /**
184
+ * Set the OAuth 2.0 access token using the string that resulted from calling authenticate()
185
+ * or apiClient#getAccessToken().
186
+ *
187
+ * @param string $accessToken JSON encoded string containing in the following format:
188
+ * {"access_token":"TOKEN", "refresh_token":"TOKEN", "token_type":"Bearer",
189
+ * "expires_in":3600, "id_token":"TOKEN", "created":1320790426}
190
+ */
191
+ public function setAccessToken($accessToken) {
192
+ if ($accessToken == null || 'null' == $accessToken) {
193
+ $accessToken = null;
194
+ }
195
+ self::$auth->setAccessToken($accessToken);
196
+ }
197
+
198
+ /**
199
+ * Get the OAuth 2.0 access token.
200
+ *
201
+ * @return string $accessToken JSON encoded string in the following format:
202
+ * {"access_token":"TOKEN", "refresh_token":"TOKEN", "token_type":"Bearer",
203
+ * "expires_in":3600,"id_token":"TOKEN", "created":1320790426}
204
+ */
205
+ public function getAccessToken() {
206
+ $token = self::$auth->getAccessToken();
207
+
208
+ return (null == $token || 'null' == $token) ? null : $token;
209
+ }
210
+
211
+ /**
212
+ * Set the developer key to use, these are obtained through the API Console.
213
+ *
214
+ * @see http://code.google.com/apis/console-help/#generatingdevkeys
215
+ *
216
+ * @param string $developerKey
217
+ */
218
+ public function setDeveloperKey($developerKey) {
219
+ self::$auth->setDeveloperKey($developerKey);
220
+ }
221
+
222
+ /**
223
+ * Set OAuth 2.0 "state" parameter to achieve per-request customization.
224
+ *
225
+ * @see http://tools.ietf.org/html/draft-ietf-oauth-v2-22#section-3.1.2.2
226
+ *
227
+ * @param string $state
228
+ */
229
+ public function setState($state) {
230
+ self::$auth->setState($state);
231
+ }
232
+
233
+ /**
234
+ * @param string $accessType Possible values for access_type include:
235
+ * {@code "offline"} to request offline access from the user. (This is the default value)
236
+ * {@code "online"} to request online access from the user.
237
+ */
238
+ public function setAccessType($accessType) {
239
+ self::$auth->setAccessType($accessType);
240
+ }
241
+
242
+ /**
243
+ * @param string $approvalPrompt Possible values for approval_prompt include:
244
+ * {@code "force"} to force the approval UI to appear. (This is the default value)
245
+ * {@code "auto"} to request auto-approval when possible.
246
+ */
247
+ public function setApprovalPrompt($approvalPrompt) {
248
+ self::$auth->setApprovalPrompt($approvalPrompt);
249
+ }
250
+
251
+ /**
252
+ * Set the application name, this is included in the User-Agent HTTP header.
253
+ *
254
+ * @param string $applicationName
255
+ */
256
+ public function setApplicationName($applicationName) {
257
+ global $apiConfig;
258
+ $apiConfig['application_name'] = $applicationName;
259
+ }
260
+
261
+ /**
262
+ * Set the OAuth 2.0 Client ID.
263
+ *
264
+ * @param string $clientId
265
+ */
266
+ public function setClientId($clientId) {
267
+ global $apiConfig;
268
+ $apiConfig['oauth2_client_id'] = $clientId;
269
+ self::$auth->clientId = $clientId;
270
+ }
271
+
272
+ /**
273
+ * Set the OAuth 2.0 Client Secret.
274
+ *
275
+ * @param string $clientSecret
276
+ */
277
+ public function setClientSecret($clientSecret) {
278
+ global $apiConfig;
279
+ $apiConfig['oauth2_client_secret'] = $clientSecret;
280
+ self::$auth->clientSecret = $clientSecret;
281
+ }
282
+
283
+ /**
284
+ * Set the OAuth 2.0 Redirect URI.
285
+ *
286
+ * @param string $redirectUri
287
+ */
288
+ public function setRedirectUri($redirectUri) {
289
+ global $apiConfig;
290
+ $apiConfig['oauth2_redirect_uri'] = $redirectUri;
291
+ self::$auth->redirectUri = $redirectUri;
292
+ }
293
+
294
+ /**
295
+ * Fetches a fresh OAuth 2.0 access token with the given refresh token.
296
+ *
297
+ * @param string $refreshToken
298
+ *
299
+ * @return void
300
+ */
301
+ public function refreshToken($refreshToken) {
302
+ self::$auth->refreshToken($refreshToken);
303
+ }
304
+
305
+ /**
306
+ * Revoke an OAuth2 access token or refresh token. This method will revoke the current access
307
+ * token, if a token isn't provided.
308
+ *
309
+ * @throws apiAuthException
310
+ *
311
+ * @param string|null $token The token (access token or a refresh token) that should be revoked.
312
+ *
313
+ * @return boolean Returns True if the revocation was successful, otherwise False.
314
+ */
315
+ public function revokeToken($token = null) {
316
+ self::$auth->revokeToken($token);
317
+ }
318
+
319
+ /**
320
+ * Verify an id_token. This method will verify the current id_token, if one
321
+ * isn't provided.
322
+ *
323
+ * @throws apiAuthException
324
+ *
325
+ * @param string|null $token The token (id_token) that should be verified.
326
+ *
327
+ * @return apiLoginTicket Returns an apiLoginTicket if the verification was
328
+ * successful.
329
+ */
330
+ public function verifyIdToken($token = null) {
331
+ return self::$auth->verifyIdToken($token);
332
+ }
333
+
334
+ /**
335
+ * This function allows you to overrule the automatically generated scopes,
336
+ * so that you can ask for more or less permission in the auth flow
337
+ * Set this before you call authenticate() though!
338
+ *
339
+ * @param array $scopes , ie: array('https://www.googleapis.com/auth/plus', 'https://www.googleapis.com/auth/moderator')
340
+ */
341
+ public function setScopes($scopes) {
342
+ $this->scopes = is_string($scopes) ? explode(" ", $scopes) : $scopes;
343
+ }
344
+
345
+ /**
346
+ * Declare if objects should be returned by the api service classes.
347
+ *
348
+ * @param boolean $useObjects True if objects should be returned by the service classes.
349
+ * False if associative arrays should be returned (default behavior).
350
+ */
351
+ public function setUseObjects($useObjects) {
352
+ global $apiConfig;
353
+ $apiConfig['use_objects'] = $useObjects;
354
+ }
355
+
356
+ private function discoverService($serviceName, $serviceURI) {
357
+ $request = self::$io->makeRequest(new apiHttpRequest($serviceURI));
358
+ if ($request->getResponseHttpCode() != 200) {
359
+ throw new apiException("Could not fetch discovery document for $serviceName, code: " . $request->getResponseHttpCode() . ", response: " . $request->getResponseBody());
360
+ }
361
+ $discoveryResponse = $request->getResponseBody();
362
+ $discoveryDocument = json_decode($discoveryResponse, true);
363
+ if ($discoveryDocument == null) {
364
+ throw new apiException("Invalid json returned for $serviceName");
365
+ }
366
+
367
+ return new apiService($serviceName, $discoveryDocument, apiClient::getIo());
368
+ }
369
+
370
+ /**
371
+ * @static
372
+ * @return apiAuth the implementation of apiAuth.
373
+ */
374
+ public static function getAuth() {
375
+ return apiClient::$auth;
376
+ }
377
+
378
+ /**
379
+ * @static
380
+ * @return apiIo the implementation of apiIo.
381
+ */
382
+ public static function getIo() {
383
+ return apiClient::$io;
384
+ }
385
+
386
+ /**
387
+ * @return apiCache the implementation of apiCache.
388
+ */
389
+ public function getCache() {
390
+ return apiClient::$cache;
391
+ }
392
+ }
393
+
394
+ // Exceptions that the Google PHP API Library can throw
395
+ class apiException extends Exception {
396
+
397
+ }
398
+
399
+ class apiAuthException extends apiException {
400
+
401
+ }
402
+
403
+ class apiCacheException extends apiException {
404
+
405
+ }
406
+
407
+ class apiIOException extends apiException {
408
+
409
+ }
410
+
411
+ class apiServiceException extends apiException {
412
+
413
+ }
providers/google/compat/sdk/auth/apiAuth.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Copyright 2010 Google Inc.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ require_once "apiAuthNone.php";
19
+ require_once "apiOAuth.php";
20
+ require_once "apiOAuth2.php";
21
+
22
+ /**
23
+ * Abstract class for the Authentication in the API client
24
+ *
25
+ * @author Chris Chabot <chabotc@google.com>
26
+ *
27
+ */
28
+ abstract class apiAuth {
29
+
30
+ abstract public function authenticate($service);
31
+
32
+ abstract public function sign(apiHttpRequest $request);
33
+
34
+ abstract public function createAuthUrl($scope);
35
+
36
+ abstract public function getAccessToken();
37
+
38
+ abstract public function setAccessToken($accessToken);
39
+
40
+ abstract public function setDeveloperKey($developerKey);
41
+
42
+ abstract public function refreshToken($refreshToken);
43
+
44
+ abstract public function revokeToken();
45
+ }
providers/google/compat/sdk/auth/apiAuthNone.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Copyright 2010 Google Inc.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ /**
19
+ * Do-nothing authentication implementation, use this if you want to make un-authenticated calls
20
+ *
21
+ * @author Chris Chabot <chabotc@google.com>
22
+ * @author Chirag Shah <chirags@google.com>
23
+ */
24
+ class apiAuthNone extends apiAuth {
25
+
26
+ public $key = null;
27
+
28
+ public function __construct() {
29
+ global $apiConfig;
30
+ if (!empty($apiConfig['developer_key'])) {
31
+ $this->setDeveloperKey($apiConfig['developer_key']);
32
+ }
33
+ }
34
+
35
+ public function setDeveloperKey($key) {
36
+ $this->key = $key;
37
+ }
38
+
39
+ public function authenticate($service) {/*noop*/
40
+ }
41
+
42
+ public function setAccessToken($accessToken) {/* noop*/
43
+ }
44
+
45
+ public function getAccessToken() {
46
+ return null;
47
+ }
48
+
49
+ public function createAuthUrl($scope) {
50
+ return null;
51
+ }
52
+
53
+ public function refreshToken($refreshToken) {/* noop*/
54
+ }
55
+
56
+ public function revokeToken() {/* noop*/
57
+ }
58
+
59
+ public function sign(apiHttpRequest $request) {
60
+ if ($this->key) {
61
+ $request->setUrl($request->getUrl() . ((strpos($request->getUrl(), '?') === false) ? '?' : '&') . 'key=' . urlencode($this->key));
62
+ }
63
+
64
+ return $request;
65
+ }
66
+ }
providers/google/compat/sdk/auth/apiLoginTicket.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Copyright 2011 Google Inc.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ /**
19
+ * Class to hold information about an authenticated login.
20
+ *
21
+ * @author Brian Eaton <beaton@google.com>
22
+ */
23
+ class apiLoginTicket {
24
+
25
+ const USER_ATTR = "id";
26
+
27
+ // Information from id token envelope.
28
+ private $envelope;
29
+
30
+ // Information from id token payload.
31
+ private $payload;
32
+
33
+ /**
34
+ * Creates a user based on the supplied token.
35
+ *
36
+ * envelope: header from a verified authentication token.
37
+ * payload: information from a verified authentication token.
38
+ */
39
+ public function __construct($envelope, $payload) {
40
+ $this->envelope = $envelope;
41
+ $this->payload = $payload;
42
+ }
43
+
44
+ /**
45
+ * Returns the numeric identifier for the user.
46
+ */
47
+ public function getUserId() {
48
+ if (array_key_exists(self::USER_ATTR, $this->payload)) {
49
+ return $this->payload[self::USER_ATTR];
50
+ }
51
+ throw new apiAuthException("No user_id in token");
52
+ }
53
+
54
+ /**
55
+ * Returns attributes from the login ticket. This can contain
56
+ * various information about the user session.
57
+ */
58
+ public function getAttributes() {
59
+ return array(
60
+ "envelope" => $this->envelope,
61
+ "payload" => $this->payload
62
+ );
63
+ }
64
+ }
providers/google/compat/sdk/auth/apiOAuth.php ADDED
@@ -0,0 +1,270 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Copyright 2008 Google Inc.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ require_once "external/OAuth.php";
19
+
20
+ /**
21
+ * Authentication class that deals with 3-Legged OAuth 1.0a authentication
22
+ *
23
+ * This class uses the OAuth 1.0a spec which has a slightly different work flow in
24
+ * how callback urls, request & access tokens are dealt with to prevent a possible
25
+ * man in the middle attack.
26
+ *
27
+ * @author Chris Chabot <chabotc@google.com>
28
+ *
29
+ */
30
+ class apiOAuth extends apiAuth {
31
+
32
+ public $cacheKey;
33
+ protected $consumerToken;
34
+ protected $accessToken;
35
+ protected $privateKeyFile;
36
+ protected $developerKey;
37
+ public $service;
38
+
39
+ /**
40
+ * Instantiates the class, but does not initiate the login flow, leaving it
41
+ * to the discretion of the caller.
42
+ */
43
+ public function __construct() {
44
+ global $apiConfig;
45
+ if (!empty($apiConfig['developer_key'])) {
46
+ $this->setDeveloperKey($apiConfig['developer_key']);
47
+ }
48
+ $this->consumerToken = new apiClientOAuthConsumer($apiConfig['oauth_consumer_key'], $apiConfig['oauth_consumer_secret'], null);
49
+ $this->signatureMethod = new apiClientOAuthSignatureMethod_HMAC_SHA1();
50
+ $this->cacheKey = 'OAuth:' . $apiConfig['oauth_consumer_key']; // Scope data to the local user as well, or else multiple local users will share the same OAuth credentials.
51
+ }
52
+
53
+ /**
54
+ * The 3 legged oauth class needs a way to store the access key and token
55
+ * it uses the apiCache class to do so.
56
+ *
57
+ * Constructing this class will initiate the 3 legged oauth work flow, including redirecting
58
+ * to the OAuth provider's site if required(!)
59
+ *
60
+ * @param string $consumerKey
61
+ * @param string $consumerSecret
62
+ *
63
+ * @return apiOAuth3Legged the logged-in provider instance
64
+ */
65
+ public function authenticate($service) {
66
+ global $apiConfig;
67
+ $this->service = $service;
68
+ $this->service['authorization_token_url'] .= '?scope=' . apiClientOAuthUtil::urlencodeRFC3986($service['scope']) . '&domain=' . apiClientOAuthUtil::urlencodeRFC3986($apiConfig['site_name']) . '&oauth_token=';
69
+ if (isset($_GET['oauth_verifier']) && isset($_GET['oauth_token']) && isset($_GET['uid'])) {
70
+ $uid = $_GET['uid'];
71
+ $secret = apiClient::$cache->get($this->cacheKey . ":nonce:" . $uid);
72
+ apiClient::$cache->delete($this->cacheKey . ":nonce:" . $uid);
73
+ $token = $this->upgradeRequestToken($_GET['oauth_token'], $secret, $_GET['oauth_verifier']);
74
+
75
+ return json_encode($token);
76
+ } else {
77
+ // Initialize the OAuth dance, first request a request token, then kick the client to the authorize URL
78
+ // First we store the current URL in our cache, so that when the oauth dance is completed we can return there
79
+ $callbackUrl = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
80
+ $uid = uniqid();
81
+ $token = $this->obtainRequestToken($callbackUrl, $uid);
82
+ apiClient::$cache->set($this->cacheKey . ":nonce:" . $uid, $token->secret);
83
+ $this->redirectToAuthorization($token);
84
+ }
85
+ }
86
+
87
+ /**
88
+ * Sets the internal oauth access token (which is returned by the authenticate function), a user should only
89
+ * go through the authenticate() flow once (which involces a bunch of browser redirections and authentication screens, not fun)
90
+ * and every time the user comes back the access token from the authentication() flow should be re-used (it essentially never expires)
91
+ *
92
+ * @param object $accessToken
93
+ */
94
+ public function setAccessToken($accessToken) {
95
+ $accessToken = json_decode($accessToken, true);
96
+ if ($accessToken == null) {
97
+ throw new apiAuthException("Could not json decode the access token");
98
+ }
99
+ if (!isset($accessToken['key']) || !isset($accessToken['secret'])) {
100
+ throw new apiAuthException("Invalid OAuth token, missing key and/or secret");
101
+ }
102
+ $this->accessToken = new apiClientOAuthConsumer($accessToken['key'], $accessToken['secret']);
103
+ }
104
+
105
+ /**
106
+ * Returns the current access token
107
+ */
108
+ public function getAccessToken() {
109
+ return $this->accessToken;
110
+ }
111
+
112
+
113
+ /**
114
+ * Set the developer key to use, these are obtained through the API Console
115
+ */
116
+ public function setDeveloperKey($developerKey) {
117
+ $this->developerKey = $developerKey;
118
+ }
119
+
120
+ /**
121
+ * Upgrades an existing request token to an access token.
122
+ *
123
+ * @param apiCache $cache cache class to use (file,apc,memcache,mysql)
124
+ * @param oauthVerifier
125
+ */
126
+ public function upgradeRequestToken($requestToken, $requestTokenSecret, $oauthVerifier) {
127
+ $ret = $this->requestAccessToken($requestToken, $requestTokenSecret, $oauthVerifier);
128
+ $matches = array();
129
+ @parse_str($ret, $matches);
130
+ if (!isset($matches['oauth_token']) || !isset($matches['oauth_token_secret'])) {
131
+ throw new apiAuthException("Error authorizing access key (result was: {$ret})");
132
+ }
133
+ // The token was upgraded to an access token, we can now continue to use it.
134
+ $this->accessToken = new apiClientOAuthConsumer(apiClientOAuthUtil::urldecodeRFC3986($matches['oauth_token']), apiClientOAuthUtil::urldecodeRFC3986($matches['oauth_token_secret']));
135
+
136
+ return $this->accessToken;
137
+ }
138
+
139
+ /**
140
+ * Sends the actual request to exchange an existing request token for an access token.
141
+ *
142
+ * @param string $requestToken the existing request token
143
+ * @param string $requestTokenSecret the request token secret
144
+ *
145
+ * @return array('http_code' => HTTP response code (200, 404, 401, etc), 'data' => the html document)
146
+ */
147
+ protected function requestAccessToken($requestToken, $requestTokenSecret, $oauthVerifier) {
148
+ $accessToken = new apiClientOAuthConsumer($requestToken, $requestTokenSecret);
149
+ $accessRequest = apiClientOAuthRequest::from_consumer_and_token($this->consumerToken, $accessToken, "GET", $this->service['access_token_url'], array('oauth_verifier' => $oauthVerifier));
150
+ $accessRequest->sign_request($this->signatureMethod, $this->consumerToken, $accessToken);
151
+ $request = apiClient::$io->makeRequest(new apiHttpRequest($accessRequest));
152
+ if ($request->getResponseHttpCode() != 200) {
153
+ throw new apiAuthException("Could not fetch access token, http code: " . $request->getResponseHttpCode() . ', response body: ' . $request->getResponseBody());
154
+ }
155
+
156
+ return $request->getResponseBody();
157
+ }
158
+
159
+ /**
160
+ * Obtains a request token from the specified provider.
161
+ */
162
+ public function obtainRequestToken($callbackUrl, $uid) {
163
+ $callbackParams = (strpos($_SERVER['REQUEST_URI'], '?') !== false ? '&' : '?') . 'uid=' . urlencode($uid);
164
+ $ret = $this->requestRequestToken($callbackUrl . $callbackParams);
165
+ $matches = array();
166
+ preg_match('/oauth_token=(.*)&oauth_token_secret=(.*)&oauth_callback_confirmed=(.*)/', $ret, $matches);
167
+ if (!is_array($matches) || count($matches) != 4) {
168
+ throw new apiAuthException("Error retrieving request key ({$ret})");
169
+ }
170
+
171
+ return new apiClientOAuthToken(apiClientOAuthUtil::urldecodeRFC3986($matches[1]), apiClientOAuthUtil::urldecodeRFC3986($matches[2]));
172
+ }
173
+
174
+ /**
175
+ * Sends the actual request to obtain a request token.
176
+ *
177
+ * @return array('http_code' => HTTP response code (200, 404, 401, etc), 'data' => the html document)
178
+ */
179
+ protected function requestRequestToken($callbackUrl) {
180
+ $requestTokenRequest = apiClientOAuthRequest::from_consumer_and_token($this->consumerToken, null, "GET", $this->service['request_token_url'], array());
181
+ $requestTokenRequest->set_parameter('scope', $this->service['scope']);
182
+ $requestTokenRequest->set_parameter('oauth_callback', $callbackUrl);
183
+ $requestTokenRequest->sign_request($this->signatureMethod, $this->consumerToken, null);
184
+ $request = apiClient::$io->makeRequest(new apiHttpRequest($requestTokenRequest));
185
+ if ($request->getResponseHttpCode() != 200) {
186
+ throw new apiAuthException("Couldn't fetch request token, http code: " . $request->getResponseHttpCode() . ', response body: ' . $request->getResponseBody());
187
+ }
188
+
189
+ return $request->getResponseBody();
190
+ }
191
+
192
+ /**
193
+ * Redirect the uset to the (provider's) authorize page, if approved it should kick the user back to the call back URL
194
+ * which hopefully means we'll end up in the constructor of this class again, but with oauth_continue=1 set
195
+ *
196
+ * @param OAuthToken $token the request token
197
+ * @param string $callbackUrl the URL to return to post-authorization (passed to login site)
198
+ */
199
+ public function redirectToAuthorization($token) {
200
+ $authorizeRedirect = $this->service['authorization_token_url'] . $token->key;
201
+ header("Location: $authorizeRedirect");
202
+ }
203
+
204
+ /**
205
+ * Sign the request using OAuth. This uses the consumer token and key
206
+ *
207
+ * @param string $method the method (get/put/delete/post)
208
+ * @param string $url the url to sign (http://site/social/rest/people/1/@me)
209
+ * @param array $params the params that should be appended to the url (count=20 fields=foo, etc)
210
+ * @param string $postBody for POST/PUT requests, the postBody is included in the signature
211
+ *
212
+ * @return string the signed url
213
+ */
214
+ public function sign(apiHttpRequest $request) {
215
+ // add the developer key to the request before signing it
216
+ if ($this->developerKey) {
217
+ $request->setUrl($request->getUrl() . ((strpos($request->getUrl(), '?') === false) ? '?' : '&') . 'key=' . urlencode($this->developerKey));
218
+ }
219
+ // and sign the request
220
+ $oauthRequest = apiClientOAuthRequest::from_request($request->getMethod(), $request->getBaseUrl(), $request->getQueryParams());
221
+ $params = $this->mergeParameters($request->getQueryParams());
222
+ foreach ($params as $key => $val) {
223
+ if (is_array($val)) {
224
+ $val = implode(',', $val);
225
+ }
226
+ $oauthRequest->set_parameter($key, $val);
227
+ }
228
+ $oauthRequest->sign_request($this->signatureMethod, $this->consumerToken, $this->accessToken);
229
+ $authHeaders = $oauthRequest->to_header();
230
+ $headers = $request->getHeaders();
231
+ $headers[] = $authHeaders;
232
+ $request->setHeaders($headers);
233
+ // and add the access token key to it (since it doesn't include the secret, it's still secure to store this in cache)
234
+ $request->accessKey = $this->accessToken->key;
235
+
236
+ return $request;
237
+ }
238
+
239
+ /**
240
+ * Merges the supplied parameters with reasonable defaults for 2 legged oauth. User-supplied parameters
241
+ * will have precedent over the defaults.
242
+ *
243
+ * @param array $params the user-supplied params that will be appended to the url
244
+ *
245
+ * @return array the combined parameters
246
+ */
247
+ protected function mergeParameters($params) {
248
+ $defaults = array(
249
+ 'oauth_nonce' => md5(microtime() . mt_rand()),
250
+ 'oauth_version' => apiClientOAuthRequest::$version,
251
+ 'oauth_timestamp' => time(),
252
+ 'oauth_consumer_key' => $this->consumerToken->key
253
+ );
254
+ if ($this->accessToken != null) {
255
+ $params['oauth_token'] = $this->accessToken->key;
256
+ }
257
+
258
+ return array_merge($defaults, $params);
259
+ }
260
+
261
+ public function createAuthUrl($scope) {
262
+ return null;
263
+ }
264
+
265
+ public function refreshToken($refreshToken) {/* noop*/
266
+ }
267
+
268
+ public function revokeToken() {/* noop*/
269
+ }
270
+ }
providers/google/compat/sdk/auth/apiOAuth2.php ADDED
@@ -0,0 +1,396 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Copyright 2008 Google Inc.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ require_once "apiVerifier.php";
19
+ require_once "apiLoginTicket.php";
20
+ require_once "service/apiUtils.php";
21
+
22
+ /**
23
+ * Authentication class that deals with the OAuth 2 web-server authentication flow
24
+ *
25
+ * @author Chris Chabot <chabotc@google.com>
26
+ * @author Chirag Shah <chirags@google.com>
27
+ *
28
+ */
29
+ class apiOAuth2 extends apiAuth {
30
+
31
+ public $clientId;
32
+ public $clientSecret;
33
+ public $developerKey;
34
+ public $accessToken;
35
+ public $redirectUri;
36
+ public $state;
37
+ public $accessType = 'offline';
38
+ public $approvalPrompt = 'force';
39
+
40
+ const OAUTH2_REVOKE_URI = 'https://accounts.google.com/o/oauth2/revoke';
41
+ const OAUTH2_TOKEN_URI = 'https://accounts.google.com/o/oauth2/token';
42
+ const OAUTH2_AUTH_URL = 'https://accounts.google.com/o/oauth2/auth';
43
+ const OAUTH2_FEDERATED_SIGNON_CERTS_URL = 'https://www.googleapis.com/oauth2/v1/certs';
44
+ const CLOCK_SKEW_SECS = 300; // five minutes in seconds
45
+ const AUTH_TOKEN_LIFETIME_SECS = 300; // five minutes in seconds
46
+ const MAX_TOKEN_LIFETIME_SECS = 86400; // one day in seconds
47
+
48
+ /**
49
+ * Instantiates the class, but does not initiate the login flow, leaving it
50
+ * to the discretion of the caller (which is done by calling authenticate()).
51
+ */
52
+ public function __construct() {
53
+ global $apiConfig;
54
+
55
+ if (!empty($apiConfig['developer_key'])) {
56
+ $this->developerKey = $apiConfig['developer_key'];
57
+ }
58
+
59
+ if (!empty($apiConfig['oauth2_client_id'])) {
60
+ $this->clientId = $apiConfig['oauth2_client_id'];
61
+ }
62
+
63
+ if (!empty($apiConfig['oauth2_client_secret'])) {
64
+ $this->clientSecret = $apiConfig['oauth2_client_secret'];
65
+ }
66
+
67
+ if (!empty($apiConfig['oauth2_redirect_uri'])) {
68
+ $this->redirectUri = $apiConfig['oauth2_redirect_uri'];
69
+ }
70
+
71
+ if (!empty($apiConfig['oauth2_access_type'])) {
72
+ $this->accessType = $apiConfig['oauth2_access_type'];
73
+ }
74
+
75
+ if (!empty($apiConfig['oauth2_approval_prompt'])) {
76
+ $this->approvalPrompt = $apiConfig['oauth2_approval_prompt'];
77
+ }
78
+ }
79
+
80
+ /**
81
+ * @param $service
82
+ *
83
+ * @return string
84
+ * @throws apiAuthException
85
+ */
86
+ public function authenticate($service) {
87
+ if (isset($_GET['code'])) {
88
+ // We got here from the redirect from a successful authorization grant, fetch the access token
89
+ $request = apiClient::$io->makeRequest(new apiHttpRequest(self::OAUTH2_TOKEN_URI, 'POST', array(), array(
90
+ 'code' => $_GET['code'],
91
+ 'grant_type' => 'authorization_code',
92
+ 'redirect_uri' => $this->redirectUri,
93
+ 'client_id' => $this->clientId,
94
+ 'client_secret' => $this->clientSecret
95
+ )));
96
+
97
+ if ($request->getResponseHttpCode() == 200) {
98
+ $this->setAccessToken($request->getResponseBody());
99
+ $this->accessToken['created'] = time();
100
+
101
+ return $this->getAccessToken();
102
+ } else {
103
+ $response = $request->getResponseBody();
104
+ $decodedResponse = json_decode($response, true);
105
+ if ($decodedResponse != $response && $decodedResponse != null && $decodedResponse['error']) {
106
+ $response = $decodedResponse['error'];
107
+ }
108
+ throw new apiAuthException("Error fetching OAuth2 access token, message: '$response'", $request->getResponseHttpCode());
109
+ }
110
+ }
111
+
112
+ $authUrl = $this->createAuthUrl($service['scope']);
113
+ header('Location: ' . $authUrl);
114
+ }
115
+
116
+ /**
117
+ * Create a URL to obtain user authorization.
118
+ * The authorization endpoint allows the user to first
119
+ * authenticate, and then grant/deny the access request.
120
+ *
121
+ * @param string $scope The scope is expressed as a list of space-delimited strings.
122
+ *
123
+ * @return string
124
+ */
125
+ public function createAuthUrl($scope) {
126
+ $params = array(
127
+ 'response_type=code',
128
+ 'redirect_uri=' . urlencode($this->redirectUri),
129
+ 'client_id=' . urlencode($this->clientId),
130
+ 'scope=' . urlencode($scope),
131
+ 'access_type=' . urlencode($this->accessType),
132
+ 'approval_prompt=' . urlencode($this->approvalPrompt)
133
+ );
134
+
135
+ if (isset($this->state)) {
136
+ $params[] = 'state=' . urlencode($this->state);
137
+ }
138
+ $params = implode('&', $params);
139
+
140
+ return self::OAUTH2_AUTH_URL . "?$params";
141
+ }
142
+
143
+ /**
144
+ * @param $accessToken
145
+ *
146
+ * @throws apiAuthException Thrown when $accessToken is invalid.
147
+ */
148
+ public function setAccessToken($accessToken) {
149
+ $accessToken = json_decode($accessToken, true);
150
+ if ($accessToken == null) {
151
+ throw new apiAuthException('Could not json decode the access token');
152
+ }
153
+ if (!isset($accessToken['access_token'])) {
154
+ throw new apiAuthException("Invalid token format");
155
+ }
156
+ $this->accessToken = $accessToken;
157
+ }
158
+
159
+ public function getAccessToken() {
160
+ return json_encode($this->accessToken);
161
+ }
162
+
163
+ public function setDeveloperKey($developerKey) {
164
+ $this->developerKey = $developerKey;
165
+ }
166
+
167
+ public function setState($state) {
168
+ $this->state = $state;
169
+ }
170
+
171
+ public function setAccessType($accessType) {
172
+ $this->accessType = $accessType;
173
+ }
174
+
175
+ public function setApprovalPrompt($approvalPrompt) {
176
+ $this->approvalPrompt = $approvalPrompt;
177
+ }
178
+
179
+ /**
180
+ * Include an accessToken in a given apiHttpRequest.
181
+ *
182
+ * @param apiHttpRequest $request
183
+ *
184
+ * @return apiHttpRequest
185
+ * @throws apiAuthException
186
+ */
187
+ public function sign(apiHttpRequest $request) {
188
+ // add the developer key to the request before signing it
189
+ if ($this->developerKey) {
190
+ $requestUrl = $request->getUrl();
191
+ $requestUrl .= (strpos($request->getUrl(), '?') === false) ? '?' : '&';
192
+ $requestUrl .= 'key=' . urlencode($this->developerKey);
193
+ $request->setUrl($requestUrl);
194
+ }
195
+
196
+ // Cannot sign the request without an OAuth access token.
197
+ if (null == $this->accessToken) {
198
+ return $request;
199
+ }
200
+
201
+ // If the token is set to expire in the next 30 seconds (or has already
202
+ // expired), refresh it and set the new token.
203
+ $expired = ($this->accessToken['created'] + ($this->accessToken['expires_in'] - 30)) < time();
204
+ if ($expired) {
205
+ if (!array_key_exists('refresh_token', $this->accessToken)) {
206
+ throw new apiAuthException("The OAuth 2.0 access token has expired, " . "and a refresh token is not available. Refresh tokens are not " . "returned for responses that were auto-approved.");
207
+ }
208
+ $this->refreshToken($this->accessToken['refresh_token']);
209
+ }
210
+
211
+ // Add the OAuth2 header to the request
212
+ $request->setRequestHeaders(array('Authorization' => 'Bearer ' . $this->accessToken['access_token']));
213
+
214
+ return $request;
215
+ }
216
+
217
+ /**
218
+ * Fetches a fresh access token with the given refresh token.
219
+ *
220
+ * @param string $refreshToken
221
+ *
222
+ * @return void
223
+ */
224
+ public function refreshToken($refreshToken) {
225
+ $params = array(
226
+ 'client_id' => $this->clientId,
227
+ 'client_secret' => $this->clientSecret,
228
+ 'refresh_token' => $refreshToken,
229
+ 'grant_type' => 'refresh_token'
230
+ );
231
+ $request = apiClient::$io->makeRequest(new apiHttpRequest(self::OAUTH2_TOKEN_URI, 'POST', array(), $params));
232
+ $code = $request->getResponseHttpCode();
233
+ $body = $request->getResponseBody();
234
+ if ($code == 200) {
235
+ $token = json_decode($body, true);
236
+ if ($token == null) {
237
+ throw new apiAuthException("Could not json decode the access token");
238
+ }
239
+
240
+ if (!isset($token['access_token']) || !isset($token['expires_in'])) {
241
+ throw new apiAuthException("Invalid token format");
242
+ }
243
+
244
+ $this->accessToken['access_token'] = $token['access_token'];
245
+ $this->accessToken['expires_in'] = $token['expires_in'];
246
+ $this->accessToken['created'] = time();
247
+ } else {
248
+ throw new apiAuthException("Error refreshing the OAuth2 token, message: '$body'", $code);
249
+ }
250
+ }
251
+
252
+ /**
253
+ * Revoke an OAuth2 access token or refresh token. This method will revoke the current access
254
+ * token, if a token isn't provided.
255
+ *
256
+ * @throws apiAuthException
257
+ *
258
+ * @param string|null $token The token (access token or a refresh token) that should be revoked.
259
+ *
260
+ * @return boolean Returns True if the revocation was successful, otherwise False.
261
+ */
262
+ public function revokeToken($token = null) {
263
+ if (!$token) {
264
+ $token = $this->accessToken['access_token'];
265
+ }
266
+ $request = new apiHttpRequest(self::OAUTH2_REVOKE_URI, 'POST', array(), "token=$token");
267
+ $response = apiClient::$io->makeRequest($request);
268
+ $code = $response->getResponseHttpCode();
269
+ if ($code == 200) {
270
+ $this->accessToken = null;
271
+
272
+ return true;
273
+ }
274
+
275
+ return false;
276
+ }
277
+
278
+ // Gets federated sign-on certificates to use for verifying identity tokens.
279
+ // Returns certs as array structure, where keys are key ids, and values
280
+ // are PEM encoded certificates.
281
+ private function getFederatedSignOnCerts() {
282
+ // This relies on makeRequest caching certificate responses.
283
+ $request = apiClient::$io->makeRequest(new apiHttpRequest(self::OAUTH2_FEDERATED_SIGNON_CERTS_URL));
284
+ if ($request->getResponseHttpCode() == 200) {
285
+ $certs = json_decode($request->getResponseBody(), true);
286
+ if ($certs) {
287
+ return $certs;
288
+ }
289
+ }
290
+ throw new apiAuthException("Failed to retrieve verification certificates: '" . $request->getResponseBody() . "'.", $request->getResponseHttpCode());
291
+ }
292
+
293
+ /**
294
+ * Verifies an id token and returns the authenticated apiLoginTicket.
295
+ * Throws an exception if the id token is not valid.
296
+ * The audience parameter can be used to control which id tokens are
297
+ * accepted. By default, the id token must have been issued to this OAuth2 client.
298
+ *
299
+ * @param $id_token
300
+ * @param $audience
301
+ *
302
+ * @return apiLoginTicket
303
+ */
304
+ public function verifyIdToken($id_token = null, $audience = null) {
305
+ if (!$id_token) {
306
+ $id_token = $this->accessToken['id_token'];
307
+ }
308
+
309
+ $certs = $this->getFederatedSignonCerts();
310
+ if (!$audience) {
311
+ $audience = $this->clientId;
312
+ }
313
+
314
+ return $this->verifySignedJwtWithCerts($id_token, $certs, $audience);
315
+ }
316
+
317
+ // Verifies the id token, returns the verified token contents.
318
+ // Visible for testing.
319
+ function verifySignedJwtWithCerts($jwt, $certs, $required_audience) {
320
+ $segments = explode(".", $jwt);
321
+ if (count($segments) != 3) {
322
+ throw new apiAuthException("Wrong number of segments in token: $jwt");
323
+ }
324
+ $signed = $segments[0] . "." . $segments[1];
325
+ $signature = apiUtils::urlSafeB64Decode($segments[2]);
326
+
327
+ // Parse envelope.
328
+ $envelope = json_decode(apiUtils::urlSafeB64Decode($segments[0]), true);
329
+ if (!$envelope) {
330
+ throw new apiAuthException("Can't parse token envelope: " . $segments[0]);
331
+ }
332
+
333
+ // Parse token
334
+ $json_body = apiUtils::urlSafeB64Decode($segments[1]);
335
+ $payload = json_decode($json_body, true);
336
+ if (!$payload) {
337
+ throw new apiAuthException("Can't parse token payload: " . $segments[1]);
338
+ }
339
+
340
+ // Check signature
341
+ $verified = false;
342
+ foreach ($certs as $keyName => $pem) {
343
+ $public_key = new apiPemVerifier($pem);
344
+ if ($public_key->verify($signed, $signature)) {
345
+ $verified = true;
346
+ break;
347
+ }
348
+ }
349
+
350
+ if (!$verified) {
351
+ throw new apiAuthException("Invalid token signature: $jwt");
352
+ }
353
+
354
+ // Check issued-at timestamp
355
+ $iat = 0;
356
+ if (array_key_exists("iat", $payload)) {
357
+ $iat = $payload["iat"];
358
+ }
359
+ if (!$iat) {
360
+ throw new apiAuthException("No issue time in token: $json_body");
361
+ }
362
+ $earliest = $iat - self::CLOCK_SKEW_SECS;
363
+
364
+ // Check expiration timestamp
365
+ $now = time();
366
+ $exp = 0;
367
+ if (array_key_exists("exp", $payload)) {
368
+ $exp = $payload["exp"];
369
+ }
370
+ if (!$exp) {
371
+ throw new apiAuthException("No expiration time in token: $json_body");
372
+ }
373
+ if ($exp >= $now + self::MAX_TOKEN_LIFETIME_SECS) {
374
+ throw new apiAuthException("Expiration time too far in future: $json_body");
375
+ }
376
+
377
+ $latest = $exp + self::CLOCK_SKEW_SECS;
378
+ if ($now < $earliest) {
379
+ throw new apiAuthException("Token used too early, $now < $earliest: $json_body");
380
+ }
381
+ if ($now > $latest) {
382
+ throw new apiAuthException("Token used too late, $now > $latest: $json_body");
383
+ }
384
+
385
+ // TODO(beaton): check issuer field?
386
+
387
+ // Check audience
388
+ $aud = $payload["aud"];
389
+ if ($aud != $required_audience) {
390
+ throw new apiAuthException("Wrong recipient, $aud != $required_audience: $json_body");
391
+ }
392
+
393
+ // All good.
394
+ return new apiLoginTicket($envelope, $payload);
395
+ }
396
+ }
providers/google/compat/sdk/auth/apiP12Signer.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Copyright 2011 Google Inc.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ /**
19
+ * Signs data.
20
+ *
21
+ * Only used for testing.
22
+ *
23
+ * @author Brian Eaton <beaton@google.com>
24
+ */
25
+ class apiP12Signer extends apiSigner {
26
+
27
+ // OpenSSL private key resource
28
+ private $privateKey;
29
+
30
+ // Creates a new signer from a .p12 file.
31
+ function __construct($p12file, $password) {
32
+ if (!function_exists('openssl_x509_read')) {
33
+ throw new Exception('The Google PHP API library needs the openssl PHP extension');
34
+ }
35
+ // This throws on error
36
+ $p12 = file_get_contents($p12file);
37
+ $certs = array();
38
+ if (!openssl_pkcs12_read($p12, $certs, $password)) {
39
+ throw new apiAuthException("Unable to parse $p12file. " . "Is this a .p12 file? Is the password correct? OpenSSL error: " . openssl_error_string());
40
+ }
41
+ // TODO(beaton): is this part of the contract for the openssl_pkcs12_read
42
+ // method? What happens if there are multiple private keys? Do we care?
43
+ if (!array_key_exists("pkey", $certs) || !$certs["pkey"]) {
44
+ throw new apiAuthException("No private key found in p12 file $p12file");
45
+ }
46
+ $this->privateKey = openssl_pkey_get_private($certs["pkey"]);
47
+ if (!$this->privateKey) {
48
+ throw new apiAuthException("Unable to load private key in $p12file");
49
+ }
50
+ }
51
+
52
+ function __destruct() {
53
+ if ($this->privateKey) {
54
+ openssl_pkey_free($this->privateKey);
55
+ }
56
+ }
57
+
58
+ function sign($data) {
59
+ if (!openssl_sign($data, $signature, $this->privateKey, "sha256")) {
60
+ throw new apiAuthException("Unable to sign data");
61
+ }
62
+
63
+ return $signature;
64
+ }
65
+ }
providers/google/compat/sdk/auth/apiPemVerifier.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Copyright 2011 Google Inc.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ /**
19
+ * Verifies signatures using PEM encoded certificates.
20
+ *
21
+ * @author Brian Eaton <beaton@google.com>
22
+ */
23
+ class apiPemVerifier extends apiVerifier {
24
+
25
+ private $publicKey;
26
+
27
+ /**
28
+ * Constructs a verifier from the supplied PEM-encoded certificate.
29
+ *
30
+ * $pem: a PEM encoded certificate (not a file).
31
+ */
32
+ function __construct($pem) {
33
+ if (!function_exists('openssl_x509_read')) {
34
+ throw new Exception('The Google PHP API library needs the openssl PHP extension');
35
+ }
36
+ $this->publicKey = openssl_x509_read($pem);
37
+ if (!$this->publicKey) {
38
+ throw new apiAuthException("Unable to parse PEM: $pem");
39
+ }
40
+ }
41
+
42
+ function __destruct() {
43
+ if ($this->publicKey) {
44
+ openssl_x509_free($this->publicKey);
45
+ }
46
+ }
47
+
48
+ /**
49
+ * Verifies the signature on data.
50
+ *
51
+ * Returns true if the signature is valid, false otherwise.
52
+ */
53
+ function verify($data, $signature) {
54
+ $status = openssl_verify($data, $signature, $this->publicKey, "sha256");
55
+ if ($status === -1) {
56
+ throw new apiAuthException("Signature verification error: " . openssl_error_string());
57
+ }
58
+
59
+ return $status === 1;
60
+ }
61
+ }
providers/google/compat/sdk/auth/apiSigner.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Copyright 2011 Google Inc.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ require_once "apiP12Signer.php";
19
+
20
+ /**
21
+ * Signs data.
22
+ *
23
+ * @author Brian Eaton <beaton@google.com>
24
+ */
25
+ abstract class apiSigner {
26
+
27
+ /**
28
+ * Signs data, returns the signature as binary data.
29
+ */
30
+ abstract public function sign($data);
31
+ }
providers/google/compat/sdk/auth/apiVerifier.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Copyright 2011 Google Inc.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ require_once "apiPemVerifier.php";
19
+
20
+ /**
21
+ * Verifies signatures.
22
+ *
23
+ * @author Brian Eaton <beaton@google.com>
24
+ */
25
+ abstract class apiVerifier {
26
+
27
+ /**
28
+ * Checks a signature, returns true if the signature is correct,
29
+ * false otherwise.
30
+ */
31
+ abstract public function verify($data, $signature);
32
+ }
providers/google/compat/sdk/cache/apiApcCache.php ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Copyright 2010 Google Inc.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ /**
19
+ * A persistent storage class based on the APC cache, which is not
20
+ * really very persistent, as soon as you restart your web server
21
+ * the storage will be wiped, however for debugging and/or speed
22
+ * it can be useful, kinda, and cache is a lot cheaper then storage.
23
+ *
24
+ * @author Chris Chabot <chabotc@google.com>
25
+ */
26
+ class apiApcCache extends apiCache {
27
+
28
+ public function __construct() {
29
+ if (!function_exists('apc_add')) {
30
+ throw new apiCacheException("Apc functions not available");
31
+ }
32
+ }
33
+
34
+ private function isLocked($key) {
35
+ if ((@apc_fetch($key . '.lock')) === false) {
36
+ return false;
37
+ }
38
+
39
+ return true;
40
+ }
41
+
42
+ private function createLock($key) {
43
+ // the interesting thing is that this could fail if the lock was created in the meantime..
44
+ // but we'll ignore that out of convenience
45
+ @apc_add($key . '.lock', '', 5);
46
+ }
47
+
48
+ private function removeLock($key) {
49
+ // suppress all warnings, if some other process removed it that's ok too
50
+ @apc_delete($key . '.lock');
51
+ }
52
+
53
+ private function waitForLock($key) {
54
+ // 20 x 250 = 5 seconds
55
+ $tries = 20;
56
+ $cnt = 0;
57
+ do {
58
+ // 250 ms is a long time to sleep, but it does stop the server from burning all resources on polling locks..
59
+ usleep(250);
60
+ $cnt++;
61
+ } while ($cnt <= $tries && $this->isLocked($key));
62
+ if ($this->isLocked($key)) {
63
+ // 5 seconds passed, assume the owning process died off and remove it
64
+ $this->removeLock($key);
65
+ }
66
+ }
67
+
68
+ /**
69
+ * @inheritDoc
70
+ */
71
+ public function get($key, $expiration = false) {
72
+
73
+ if (($ret = @apc_fetch($key)) === false) {
74
+ return false;
75
+ }
76
+ if (!$expiration || (time() - $ret['time'] > $expiration)) {
77
+ $this->delete($key);
78
+
79
+ return false;
80
+ }
81
+
82
+ return unserialize($ret['data']);
83
+ }
84
+
85
+ /**
86
+ * @inheritDoc
87
+ */
88
+ public function set($key, $value) {
89
+ if (@apc_store($key, array(
90
+ 'time' => time(),
91
+ 'data' => serialize($value)
92
+ )) == false) {
93
+ throw new apiCacheException("Couldn't store data");
94
+ }
95
+ }
96
+
97
+ /**
98
+ * @inheritDoc
99
+ */
100
+ public function delete($key) {
101
+ @apc_delete($key);
102
+ }
103
+ }
providers/google/compat/sdk/cache/apiCache.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Copyright 2008 Google Inc.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ require_once "apiFileCache.php";
19
+ require_once "apiApcCache.php";
20
+ require_once "apiMemcacheCache.php";
21
+
22
+ /**
23
+ * Abstract storage class
24
+ *
25
+ * @author Chris Chabot <chabotc@google.com>
26
+ */
27
+ abstract class apiCache {
28
+
29
+ /**
30
+ * Retrieves the data for the given key, or false if they
31
+ * key is unknown or expired
32
+ *
33
+ * @param String $key The key who's data to retrieve
34
+ * @param boolean|int $expiration Expiration time in seconds
35
+ *
36
+ */
37
+ abstract function get($key, $expiration = false);
38
+
39
+ /**
40
+ * Store the key => $value set. The $value is serialized
41
+ * by this function so can be of any type
42
+ *
43
+ * @param String $key Key of the data
44
+ * @param $value the data
45
+ */
46
+ abstract function set($key, $value);
47
+
48
+ /**
49
+ * Removes the key/data pair for the given $key
50
+ *
51
+ * @param String $key
52
+ */
53
+ abstract function delete($key);
54
+ }
55
+
56
+
providers/google/compat/sdk/cache/apiFileCache.php ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Copyright 2008 Google Inc.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ /*
19
+ * This class implements a basic on disk storage. While that does
20
+ * work quite well it's not the most elegant and scalable solution.
21
+ * It will also get you into a heap of trouble when you try to run
22
+ * this in a clustered environment. In those cases please use the
23
+ * MySql back-end
24
+ *
25
+ * @author Chris Chabot <chabotc@google.com>
26
+ */
27
+
28
+ class apiFileCache extends apiCache {
29
+
30
+ private $path;
31
+
32
+ public function __construct() {
33
+ global $apiConfig;
34
+ $this->path = $apiConfig['ioFileCache_directory'];
35
+ }
36
+
37
+ private function isLocked($storageFile) {
38
+ // our lock file convention is simple: /the/file/path.lock
39
+ return file_exists($storageFile . '.lock');
40
+ }
41
+
42
+ private function createLock($storageFile) {
43
+ $storageDir = dirname($storageFile);
44
+ if (!is_dir($storageDir)) {
45
+ if (!@mkdir($storageDir, 0755, true)) {
46
+ // make sure the failure isn't because of a concurrency issue
47
+ if (!is_dir($storageDir)) {
48
+ throw new apiCacheException("Could not create storage directory: $storageDir");
49
+ }
50
+ }
51
+ }
52
+ @touch($storageFile . '.lock');
53
+ }
54
+
55
+ private function removeLock($storageFile) {
56
+ // suppress all warnings, if some other process removed it that's ok too
57
+ @unlink($storageFile . '.lock');
58
+ }
59
+
60
+ private function waitForLock($storageFile) {
61
+ // 20 x 250 = 5 seconds
62
+ $tries = 20;
63
+ $cnt = 0;
64
+ do {
65
+ // make sure PHP picks up on file changes. This is an expensive action but really can't be avoided
66
+ clearstatcache();
67
+ // 250 ms is a long time to sleep, but it does stop the server from burning all resources on polling locks..
68
+ usleep(250);
69
+ $cnt++;
70
+ } while ($cnt <= $tries && $this->isLocked($storageFile));
71
+ if ($this->isLocked($storageFile)) {
72
+ // 5 seconds passed, assume the owning process died off and remove it
73
+ $this->removeLock($storageFile);
74
+ }
75
+ }
76
+
77
+ private function getCacheDir($hash) {
78
+ // use the first 2 characters of the hash as a directory prefix
79
+ // this should prevent slowdowns due to huge directory listings
80
+ // and thus give some basic amount of scalability
81
+ return $this->path . '/' . substr($hash, 0, 2);
82
+ }
83
+
84
+ private function getCacheFile($hash) {
85
+ return $this->getCacheDir($hash) . '/' . $hash;
86
+ }
87
+
88
+ public function get($key, $expiration = false) {
89
+ $storageFile = $this->getCacheFile(md5($key));
90
+ // See if this storage file is locked, if so we wait upto 5 seconds for the lock owning process to
91
+ // complete it's work. If the lock is not released within that time frame, it's cleaned up.
92
+ // This should give us a fair amount of 'Cache Stampeding' protection
93
+ if ($this->isLocked($storageFile)) {
94
+ $this->waitForLock($storageFile);
95
+ }
96
+ if (file_exists($storageFile) && is_readable($storageFile)) {
97
+ $now = time();
98
+ if (!$expiration || (($mtime = @filemtime($storageFile)) !== false && ($now - $mtime) < $expiration)) {
99
+ if (($data = @file_get_contents($storageFile)) !== false) {
100
+ $data = unserialize($data);
101
+
102
+ return $data;
103
+ }
104
+ }
105
+ }
106
+
107
+ return false;
108
+ }
109
+
110
+ public function set($key, $value) {
111
+ $storageDir = $this->getCacheDir(md5($key));
112
+ $storageFile = $this->getCacheFile(md5($key));
113
+ if ($this->isLocked($storageFile)) {
114
+ // some other process is writing to this file too, wait until it's done to prevent hickups
115
+ $this->waitForLock($storageFile);
116
+ }
117
+ if (!is_dir($storageDir)) {
118
+ if (!@mkdir($storageDir, 0755, true)) {
119
+ throw new apiCacheException("Could not create storage directory: $storageDir");
120
+ }
121
+ }
122
+ // we serialize the whole request object, since we don't only want the
123
+ // responseContent but also the postBody used, headers, size, etc
124
+ $data = serialize($value);
125
+ $this->createLock($storageFile);
126
+ if (!@file_put_contents($storageFile, $data)) {
127
+ $this->removeLock($storageFile);
128
+ throw new apiCacheException("Could not store data in the file");
129
+ }
130
+ $this->removeLock($storageFile);
131
+ }
132
+
133
+ public function delete($key) {
134
+ $file = $this->getCacheFile(md5($key));
135
+ if (!@unlink($file)) {
136
+ throw new apiCacheException("Cache file could not be deleted");
137
+ }
138
+ }
139
+ }
providers/google/compat/sdk/cache/apiMemcacheCache.php ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Copyright 2008 Google Inc.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ /**
19
+ * A persistent storage class based on the memcache, which is not
20
+ * really very persistent, as soon as you restart your memcache daemon
21
+ * the storage will be wiped, however for debugging and/or speed
22
+ * it can be useful, kinda, and cache is a lot cheaper then storage.
23
+ *
24
+ * @author Chris Chabot <chabotc@google.com>
25
+ */
26
+ class apiMemcacheCache extends apiCache {
27
+
28
+ private $connection = false;
29
+
30
+ public function __construct() {
31
+ global $apiConfig;
32
+ if (!function_exists('memcache_connect')) {
33
+ throw new apiCacheException("Memcache functions not available");
34
+ }
35
+ $this->host = $apiConfig['ioMemCacheCache_host'];
36
+ $this->port = $apiConfig['ioMemCacheCache_port'];
37
+ if (empty($this->host) || empty($this->port)) {
38
+ throw new apiCacheException("You need to supply a valid memcache host and port");
39
+ }
40
+ }
41
+
42
+ private function isLocked($key) {
43
+ $this->check();
44
+ if ((@memcache_get($this->connection, $key . '.lock')) === false) {
45
+ return false;
46
+ }
47
+
48
+ return true;
49
+ }
50
+
51
+ private function createLock($key) {
52
+ $this->check();
53
+ // the interesting thing is that this could fail if the lock was created in the meantime..
54
+ // but we'll ignore that out of convenience
55
+ @memcache_add($this->connection, $key . '.lock', '', 0, 5);
56
+ }
57
+
58
+ private function removeLock($key) {
59
+ $this->check();
60
+ // suppress all warnings, if some other process removed it that's ok too
61
+ @memcache_delete($this->connection, $key . '.lock');
62
+ }
63
+
64
+ private function waitForLock($key) {
65
+ $this->check();
66
+ // 20 x 250 = 5 seconds
67
+ $tries = 20;
68
+ $cnt = 0;
69
+ do {
70
+ // 250 ms is a long time to sleep, but it does stop the server from burning all resources on polling locks..
71
+ usleep(250);
72
+ $cnt++;
73
+ } while ($cnt <= $tries && $this->isLocked($key));
74
+ if ($this->isLocked($key)) {
75
+ // 5 seconds passed, assume the owning process died off and remove it
76
+ $this->removeLock($key);
77
+ }
78
+ }
79
+
80
+ // I prefer lazy initialization since the cache isn't used every request
81
+ // so this potentially saves a lot of overhead
82
+ private function connect() {
83
+ if (!$this->connection = @memcache_pconnect($this->host, $this->port)) {
84
+ throw new apiCacheException("Couldn't connect to memcache server");
85
+ }
86
+ }
87
+
88
+ private function check() {
89
+ if (!$this->connection) {
90
+ $this->connect();
91
+ }
92
+ }
93
+
94
+ /**
95
+ * @inheritDoc
96
+ */
97
+ public function get($key, $expiration = false) {
98
+ $this->check();
99
+ if (($ret = @memcache_get($this->connection, $key)) === false) {
100
+ return false;
101
+ }
102
+ if (!$expiration || (time() - $ret['time'] > $expiration)) {
103
+ $this->delete($key);
104
+
105
+ return false;
106
+ }
107
+
108
+ return $ret['data'];
109
+ }
110
+
111
+ /**
112
+ * @inheritDoc
113
+ */
114
+ public function set($key, $value) {
115
+ $this->check();
116
+ // we store it with the cache_time default expiration so objects will at least get cleaned eventually.
117
+ if (@memcache_set($this->connection, $key, array(
118
+ 'time' => time(),
119
+ 'data' => $value
120
+ ), false) == false) {
121
+ throw new apiCacheException("Couldn't store data in cache");
122
+ }
123
+ }
124
+
125
+ /**
126
+ * @inheritDoc
127
+ */
128
+ public function delete($key) {
129
+ $this->check();
130
+ @memcache_delete($this->connection, $key);
131
+ }
132
+ }
providers/google/compat/sdk/config.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Copyright 2010 Google Inc.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ global $apiConfig;
19
+ $apiConfig = array(
20
+ // True if objects should be returned by the service classes.
21
+ // False if associative arrays should be returned (default behavior).
22
+ 'use_objects' => false,
23
+
24
+ // The application_name is included in the User-Agent HTTP header.
25
+ 'application_name' => '',
26
+
27
+ // OAuth2 Settings, you can get these keys at https://code.google.com/apis/console
28
+ 'oauth2_client_id' => '',
29
+ 'oauth2_client_secret' => '',
30
+ 'oauth2_redirect_uri' => '',
31
+
32
+ // The developer key, you get this at https://code.google.com/apis/console
33
+ 'developer_key' => '',
34
+
35
+ // OAuth1 Settings.
36
+ // If you're using the apiOAuth auth class, it will use these values for the oauth consumer key and secret.
37
+ // See http://code.google.com/apis/accounts/docs/RegistrationForWebAppsAuto.html for info on how to obtain those
38
+ 'oauth_consumer_key' => 'anonymous',
39
+ 'oauth_consumer_secret' => 'anonymous',
40
+
41
+ // Site name to show in the Google's OAuth 1 authentication screen.
42
+ 'site_name' => 'www.example.org',
43
+
44
+ // Which Authentication, Storage and HTTP IO classes to use.
45
+ 'authClass' => 'apiOAuth2',
46
+ 'ioClass' => 'apiCurlIO',
47
+ 'cacheClass' => 'apiFileCache',
48
+
49
+ // If you want to run the test suite (by running # phpunit AllTests.php in the tests/ directory), fill in the settings below
50
+ 'oauth_test_token' => '',
51
+ // the oauth access token to use (which you can get by runing authenticate() as the test user and copying the token value), ie '{"key":"foo","secret":"bar","callback_url":null}'
52
+ 'oauth_test_user' => '',
53
+ // and the user ID to use, this can either be a vanity name 'testuser' or a numberic ID '123456'
54
+
55
+ // Don't change these unless you're working against a special development or testing environment.
56
+ 'basePath' => 'https://www.googleapis.com',
57
+
58
+ // IO Class dependent configuration, you only have to configure the values for the class that was configured as the ioClass above
59
+ 'ioFileCache_directory' => (function_exists('sys_get_temp_dir') ? sys_get_temp_dir() . '/apiClient' : '/tmp/apiClient'),
60
+ 'ioMemCacheStorage_host' => '127.0.0.1',
61
+ 'ioMemcacheStorage_port' => '11211',
62
+
63
+ // Definition of service specific values like scopes, oauth token URLs, etc
64
+ 'services' => array(
65
+ 'analytics' => array('scope' => 'https://www.googleapis.com/auth/analytics.readonly'),
66
+ 'calendar' => array(
67
+ 'scope' => array(
68
+ "https://www.googleapis.com/auth/calendar",
69
+ "https://www.googleapis.com/auth/calendar.readonly",
70
+ )
71
+ ),
72
+ 'books' => array('scope' => 'https://www.googleapis.com/auth/books'),
73
+ 'latitude' => array(
74
+ 'scope' => array(
75
+ 'https://www.googleapis.com/auth/latitude.all.best',
76
+ 'https://www.googleapis.com/auth/latitude.all.city',
77
+ )
78
+ ),
79
+ 'moderator' => array('scope' => 'https://www.googleapis.com/auth/moderator'),
80
+ 'oauth2' => array(
81
+ 'scope' => array(
82
+ 'https://www.googleapis.com/auth/userinfo.profile',
83
+ 'https://www.googleapis.com/auth/userinfo.email',
84
+ )
85
+ ),
86
+ 'plus' => array('scope' => 'https://www.googleapis.com/auth/plus.me'),
87
+ 'siteVerification' => array('scope' => 'https://www.googleapis.com/auth/siteverification'),
88
+ 'tasks' => array('scope' => 'https://www.googleapis.com/auth/tasks'),
89
+ 'urlshortener' => array('scope' => 'https://www.googleapis.com/auth/urlshortener')
90
+ )
91
+ );
providers/google/compat/sdk/contrib/apiAdsenseService.php ADDED
@@ -0,0 +1,1369 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Copyright (c) 2010 Google Inc.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6
+ * use this file except in compliance with the License. You may obtain a copy of
7
+ * the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14
+ * License for the specific language governing permissions and limitations under
15
+ * the License.
16
+ */
17
+
18
+ require_once 'service/apiModel.php';
19
+ require_once 'service/apiService.php';
20
+ require_once 'service/apiServiceRequest.php';
21
+
22
+
23
+ /**
24
+ * The "urlchannels" collection of methods.
25
+ * Typical usage is:
26
+ * <code>
27
+ * $adsenseService = new apiAdsenseService(...);
28
+ * $urlchannels = $adsenseService->urlchannels;
29
+ * </code>
30
+ */
31
+ class UrlchannelsServiceResource extends apiServiceResource {
32
+
33
+
34
+ /**
35
+ * List all URL channels in the specified ad client for this AdSense account. (urlchannels.list)
36
+ *
37
+ * @param string $adClientId Ad client for which to list URL channels.
38
+ * @param array $optParams Optional parameters. Valid optional parameters are listed below.
39
+ *
40
+ * @opt_param string pageToken A continuation token, used to page through URL channels. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
41
+ * @opt_param int maxResults The maximum number of URL channels to include in the response, used for paging.
42
+ * @return UrlChannels
43
+ */
44
+ public function listUrlchannels($adClientId, $optParams = array()) {
45
+ $params = array('adClientId' => $adClientId);
46
+ $params = array_merge($params, $optParams);
47
+ $data = $this->__call('list', array($params));
48
+ if ($this->useObjects()) {
49
+ return new UrlChannels($data);
50
+ } else {
51
+ return $data;
52
+ }
53
+ }
54
+ }
55
+
56
+ /**
57
+ * The "adunits" collection of methods.
58
+ * Typical usage is:
59
+ * <code>
60
+ * $adsenseService = new apiAdsenseService(...);
61
+ * $adunits = $adsenseService->adunits;
62
+ * </code>
63
+ */
64
+ class AdunitsServiceResource extends apiServiceResource {
65
+
66
+
67
+ /**
68
+ * List all ad units in the specified ad client for this AdSense account. (adunits.list)
69
+ *
70
+ * @param string $adClientId Ad client for which to list ad units.
71
+ * @param array $optParams Optional parameters. Valid optional parameters are listed below.
72
+ *
73
+ * @opt_param bool includeInactive Whether to include inactive ad units. Default: true.
74
+ * @opt_param string pageToken A continuation token, used to page through ad units. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
75
+ * @opt_param int maxResults The maximum number of ad units to include in the response, used for paging.
76
+ * @return AdUnits
77
+ */
78
+ public function listAdunits($adClientId, $optParams = array()) {
79
+ $params = array('adClientId' => $adClientId);
80
+ $params = array_merge($params, $optParams);
81
+ $data = $this->__call('list', array($params));
82
+ if ($this->useObjects()) {
83
+ return new AdUnits($data);
84
+ } else {
85
+ return $data;
86
+ }
87
+ }
88
+
89
+ /**
90
+ * Gets the specified ad unit in the specified ad client. (adunits.get)
91
+ *
92
+ * @param string $adClientId Ad client for which to get the ad unit.
93
+ * @param string $adUnitId Ad unit to retrieve.
94
+ *
95
+ * @return AdUnit
96
+ */
97
+ public function get($adClientId, $adUnitId, $optParams = array()) {
98
+ $params = array(
99
+ 'adClientId' => $adClientId,
100
+ 'adUnitId' => $adUnitId
101
+ );
102
+ $params = array_merge($params, $optParams);
103
+ $data = $this->__call('get', array($params));
104
+ if ($this->useObjects()) {
105
+ return new AdUnit($data);
106
+ } else {
107
+ return $data;
108
+ }
109
+ }
110
+ }
111
+
112
+
113
+ /**
114
+ * The "customchannels" collection of methods.
115
+ * Typical usage is:
116
+ * <code>
117
+ * $adsenseService = new apiAdsenseService(...);
118
+ * $customchannels = $adsenseService->customchannels;
119
+ * </code>
120
+ */
121
+ class AdunitsCustomchannelsServiceResource extends apiServiceResource {
122
+
123
+
124
+ /**
125
+ * List all custom channels which the specified ad unit belongs to. (customchannels.list)
126
+ *
127
+ * @param string $adClientId Ad client which contains the ad unit.
128
+ * @param string $adUnitId Ad unit for which to list custom channels.
129
+ * @param array $optParams Optional parameters. Valid optional parameters are listed below.
130
+ *
131
+ * @opt_param string pageToken A continuation token, used to page through custom channels. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
132
+ * @opt_param int maxResults The maximum number of custom channels to include in the response, used for paging.
133
+ * @return CustomChannels
134
+ */
135
+ public function listAdunitsCustomchannels($adClientId, $adUnitId, $optParams = array()) {
136
+ $params = array(
137
+ 'adClientId' => $adClientId,
138
+ 'adUnitId' => $adUnitId
139
+ );
140
+ $params = array_merge($params, $optParams);
141
+ $data = $this->__call('list', array($params));
142
+ if ($this->useObjects()) {
143
+ return new CustomChannels($data);
144
+ } else {
145
+ return $data;
146
+ }
147
+ }
148
+ }
149
+
150
+ /**
151
+ * The "adclients" collection of methods.
152
+ * Typical usage is:
153
+ * <code>
154
+ * $adsenseService = new apiAdsenseService(...);
155
+ * $adclients = $adsenseService->adclients;
156
+ * </code>
157
+ */
158
+ class AdclientsServiceResource extends apiServiceResource {
159
+
160
+
161
+ /**
162
+ * List all ad clients in this AdSense account. (adclients.list)
163
+ *
164
+ * @param array $optParams Optional parameters. Valid optional parameters are listed below.
165
+ *
166
+ * @opt_param string pageToken A continuation token, used to page through ad clients. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
167
+ * @opt_param int maxResults The maximum number of ad clients to include in the response, used for paging.
168
+ * @return AdClients
169
+ */
170
+ public function listAdclients($optParams = array()) {
171
+ $params = array();
172
+ $params = array_merge($params, $optParams);
173
+ $data = $this->__call('list', array($params));
174
+ if ($this->useObjects()) {
175
+ return new AdClients($data);
176
+ } else {
177
+ return $data;
178
+ }
179
+ }
180
+ }
181
+
182
+ /**
183
+ * The "reports" collection of methods.
184
+ * Typical usage is:
185
+ * <code>
186
+ * $adsenseService = new apiAdsenseService(...);
187
+ * $reports = $adsenseService->reports;
188
+ * </code>
189
+ */
190
+ class ReportsServiceResource extends apiServiceResource {
191
+
192
+
193
+ /**
194
+ * Generate an AdSense report based on the report request sent in the query parameters. Returns the
195
+ * result as JSON; to retrieve output in CSV format specify "alt=csv" as a query parameter.
196
+ * (reports.generate)
197
+ *
198
+ * @param string $startDate Start of the date range to report on in "YYYY-MM-DD" format, inclusive.
199
+ * @param string $endDate End of the date range to report on in "YYYY-MM-DD" format, inclusive.
200
+ * @param array $optParams Optional parameters. Valid optional parameters are listed below.
201
+ *
202
+ * @opt_param string sort The name of a dimension or metric to sort the resulting report on, optionally prefixed with "+" to sort ascending or "-" to sort descending. If no prefix is specified, the column is sorted ascending.
203
+ * @opt_param string locale Optional locale to use for translating report output to a local language. Defaults to "en_US" if not specified.
204
+ * @opt_param string metric Numeric columns to include in the report.
205
+ * @opt_param int maxResults The maximum number of rows of report data to return.
206
+ * @opt_param string filter Filters to be run on the report.
207
+ * @opt_param string currency Optional currency to use when reporting on monetary metrics. Defaults to the account's currency if not set.
208
+ * @opt_param int startIndex Index of the first row of report data to return.
209
+ * @opt_param string dimension Dimensions to base the report on.
210
+ * @opt_param string accountId Accounts upon which to report.
211
+ * @return AdsenseReportsGenerateResponse
212
+ */
213
+ public function generate($startDate, $endDate, $optParams = array()) {
214
+ $params = array(
215
+ 'startDate' => $startDate,
216
+ 'endDate' => $endDate
217
+ );
218
+ $params = array_merge($params, $optParams);
219
+ $data = $this->__call('generate', array($params));
220
+ if ($this->useObjects()) {
221
+ return new AdsenseReportsGenerateResponse($data);
222
+ } else {
223
+ return $data;
224
+ }
225
+ }
226
+ }
227
+
228
+ /**
229
+ * The "accounts" collection of methods.
230
+ * Typical usage is:
231
+ * <code>
232
+ * $adsenseService = new apiAdsenseService(...);
233
+ * $accounts = $adsenseService->accounts;
234
+ * </code>
235
+ */
236
+ class AccountsServiceResource extends apiServiceResource {
237
+
238
+
239
+ /**
240
+ * List all accounts available to this AdSense account. (accounts.list)
241
+ *
242
+ * @param array $optParams Optional parameters. Valid optional parameters are listed below.
243
+ *
244
+ * @opt_param string pageToken A continuation token, used to page through accounts. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
245
+ * @opt_param int maxResults The maximum number of accounts to include in the response, used for paging.
246
+ * @return Accounts
247
+ */
248
+ public function listAccounts($optParams = array()) {
249
+ $params = array();
250
+ $params = array_merge($params, $optParams);
251
+ $data = $this->__call('list', array($params));
252
+ if ($this->useObjects()) {
253
+ return new Accounts($data);
254
+ } else {
255
+ return $data;
256
+ }
257
+ }
258
+
259
+ /**
260
+ * Get information about the selected AdSense account. (accounts.get)
261
+ *
262
+ * @param string $accountId Account to get information about.
263
+ * @param array $optParams Optional parameters. Valid optional parameters are listed below.
264
+ *
265
+ * @opt_param bool tree Whether the tree of sub accounts should be returned.
266
+ * @return Account
267
+ */
268
+ public function get($accountId, $optParams = array()) {
269
+ $params = array('accountId' => $accountId);
270
+ $params = array_merge($params, $optParams);
271
+ $data = $this->__call('get', array($params));
272
+ if ($this->useObjects()) {
273
+ return new Account($data);
274
+ } else {
275
+ return $data;
276
+ }
277
+ }
278
+ }
279
+
280
+
281
+ /**
282
+ * The "urlchannels" collection of methods.
283
+ * Typical usage is:
284
+ * <code>
285
+ * $adsenseService = new apiAdsenseService(...);
286
+ * $urlchannels = $adsenseService->urlchannels;
287
+ * </code>
288
+ */
289
+ class AccountsUrlchannelsServiceResource extends apiServiceResource {
290
+
291
+
292
+ /**
293
+ * List all URL channels in the specified ad client for the specified account. (urlchannels.list)
294
+ *
295
+ * @param string $accountId Account to which the ad client belongs.
296
+ * @param string $adClientId Ad client for which to list URL channels.
297
+ * @param array $optParams Optional parameters. Valid optional parameters are listed below.
298
+ *
299
+ * @opt_param string pageToken A continuation token, used to page through URL channels. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
300
+ * @opt_param int maxResults The maximum number of URL channels to include in the response, used for paging.
301
+ * @return UrlChannels
302
+ */
303
+ public function listAccountsUrlchannels($accountId, $adClientId, $optParams = array()) {
304
+ $params = array(
305
+ 'accountId' => $accountId,
306
+ 'adClientId' => $adClientId
307
+ );
308
+ $params = array_merge($params, $optParams);
309
+ $data = $this->__call('list', array($params));
310
+ if ($this->useObjects()) {
311
+ return new UrlChannels($data);
312
+ } else {
313
+ return $data;
314
+ }
315
+ }
316
+ }
317
+
318
+ /**
319
+ * The "adunits" collection of methods.
320
+ * Typical usage is:
321
+ * <code>
322
+ * $adsenseService = new apiAdsenseService(...);
323
+ * $adunits = $adsenseService->adunits;
324
+ * </code>
325
+ */
326
+ class AccountsAdunitsServiceResource extends apiServiceResource {
327
+
328
+
329
+ /**
330
+ * List all ad units in the specified ad client for the specified account. (adunits.list)
331
+ *
332
+ * @param string $accountId Account to which the ad client belongs.
333
+ * @param string $adClientId Ad client for which to list ad units.
334
+ * @param array $optParams Optional parameters. Valid optional parameters are listed below.
335
+ *
336
+ * @opt_param bool includeInactive Whether to include inactive ad units. Default: true.
337
+ * @opt_param string pageToken A continuation token, used to page through ad units. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
338
+ * @opt_param int maxResults The maximum number of ad units to include in the response, used for paging.
339
+ * @return AdUnits
340
+ */
341
+ public function listAccountsAdunits($accountId, $adClientId, $optParams = array()) {
342
+ $params = array(
343
+ 'accountId' => $accountId,
344
+ 'adClientId' => $adClientId
345
+ );
346
+ $params = array_merge($params, $optParams);
347
+ $data = $this->__call('list', array($params));
348
+ if ($this->useObjects()) {
349
+ return new AdUnits($data);
350
+ } else {
351
+ return $data;
352
+ }
353
+ }
354
+
355
+ /**
356
+ * Gets the specified ad unit in the specified ad client for the specified account. (adunits.get)
357
+ *
358
+ * @param string $accountId Account to which the ad client belongs.
359
+ * @param string $adClientId Ad client for which to get the ad unit.
360
+ * @param string $adUnitId Ad unit to retrieve.
361
+ *
362
+ * @return AdUnit
363
+ */
364
+ public function get($accountId, $adClientId, $adUnitId, $optParams = array()) {
365
+ $params = array(
366
+ 'accountId' => $accountId,
367
+ 'adClientId' => $adClientId,
368
+ 'adUnitId' => $adUnitId
369
+ );
370
+ $params = array_merge($params, $optParams);
371
+ $data = $this->__call('get', array($params));
372
+ if ($this->useObjects()) {
373
+ return new AdUnit($data);
374
+ } else {
375
+ return $data;
376
+ }
377
+ }
378
+ }
379
+
380
+
381
+ /**
382
+ * The "customchannels" collection of methods.
383
+ * Typical usage is:
384
+ * <code>
385
+ * $adsenseService = new apiAdsenseService(...);
386
+ * $customchannels = $adsenseService->customchannels;
387
+ * </code>
388
+ */
389
+ class AccountsAdunitsCustomchannelsServiceResource extends apiServiceResource {
390
+
391
+
392
+ /**
393
+ * List all custom channels which the specified ad unit belongs to. (customchannels.list)
394
+ *
395
+ * @param string $accountId Account to which the ad client belongs.
396
+ * @param string $adClientId Ad client which contains the ad unit.
397
+ * @param string $adUnitId Ad unit for which to list custom channels.
398
+ * @param array $optParams Optional parameters. Valid optional parameters are listed below.
399
+ *
400
+ * @opt_param string pageToken A continuation token, used to page through custom channels. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
401
+ * @opt_param int maxResults The maximum number of custom channels to include in the response, used for paging.
402
+ * @return CustomChannels
403
+ */
404
+ public function listAccountsAdunitsCustomchannels($accountId, $adClientId, $adUnitId, $optParams = array()) {
405
+ $params = array(
406
+ 'accountId' => $accountId,
407
+ 'adClientId' => $adClientId,
408
+ 'adUnitId' => $adUnitId
409
+ );
410
+ $params = array_merge($params, $optParams);
411
+ $data = $this->__call('list', array($params));
412
+ if ($this->useObjects()) {
413
+ return new CustomChannels($data);
414
+ } else {
415
+ return $data;
416
+ }
417
+ }
418
+ }
419
+
420
+ /**
421
+ * The "adclients" collection of methods.
422
+ * Typical usage is:
423
+ * <code>
424
+ * $adsenseService = new apiAdsenseService(...);
425
+ * $adclients = $adsenseService->adclients;
426
+ * </code>
427
+ */
428
+ class AccountsAdclientsServiceResource extends apiServiceResource {
429
+
430
+
431
+ /**
432
+ * List all ad clients in the specified account. (adclients.list)
433
+ *
434
+ * @param string $accountId Account for which to list ad clients.
435
+ * @param array $optParams Optional parameters. Valid optional parameters are listed below.
436
+ *
437
+ * @opt_param string pageToken A continuation token, used to page through ad clients. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
438
+ * @opt_param int maxResults The maximum number of ad clients to include in the response, used for paging.
439
+ * @return AdClients
440
+ */
441
+ public function listAccountsAdclients($accountId, $optParams = array()) {
442
+ $params = array('accountId' => $accountId);
443
+ $params = array_merge($params, $optParams);
444
+ $data = $this->__call('list', array($params));
445
+ if ($this->useObjects()) {
446
+ return new AdClients($data);
447
+ } else {
448
+ return $data;
449
+ }
450
+ }
451
+ }
452
+
453
+ /**
454
+ * The "reports" collection of methods.
455
+ * Typical usage is:
456
+ * <code>
457
+ * $adsenseService = new apiAdsenseService(...);
458
+ * $reports = $adsenseService->reports;
459
+ * </code>
460
+ */
461
+ class AccountsReportsServiceResource extends apiServiceResource {
462
+
463
+
464
+ /**
465
+ * Generate an AdSense report based on the report request sent in the query parameters. Returns the
466
+ * result as JSON; to retrieve output in CSV format specify "alt=csv" as a query parameter.
467
+ * (reports.generate)
468
+ *
469
+ * @param string $startDate Start of the date range to report on in "YYYY-MM-DD" format, inclusive.
470
+ * @param string $endDate End of the date range to report on in "YYYY-MM-DD" format, inclusive.
471
+ * @param array $optParams Optional parameters. Valid optional parameters are listed below.
472
+ *
473
+ * @opt_param string accountId Account upon which to report.
474
+ * @opt_param string sort The name of a dimension or metric to sort the resulting report on, optionally prefixed with "+" to sort ascending or "-" to sort descending. If no prefix is specified, the column is sorted ascending.
475
+ * @opt_param string locale Optional locale to use for translating report output to a local language. Defaults to "en_US" if not specified.
476
+ * @opt_param string metric Numeric columns to include in the report.
477
+ * @opt_param int maxResults The maximum number of rows of report data to return.
478
+ * @opt_param string filter Filters to be run on the report.
479
+ * @opt_param string currency Optional currency to use when reporting on monetary metrics. Defaults to the account's currency if not set.
480
+ * @opt_param int startIndex Index of the first row of report data to return.
481
+ * @opt_param string dimension Dimensions to base the report on.
482
+ * @return AdsenseReportsGenerateResponse
483
+ */
484
+ public function generate($startDate, $endDate, $optParams = array()) {
485
+ $params = array(
486
+ 'startDate' => $startDate,
487
+ 'endDate' => $endDate
488
+ );
489
+ $params = array_merge($params, $optParams);
490
+ $data = $this->__call('generate', array($params));
491
+ if ($this->useObjects()) {
492
+ return new AdsenseReportsGenerateResponse($data);
493
+ } else {
494
+ return $data;
495
+ }
496
+ }
497
+ }
498
+
499
+ /**
500
+ * The "customchannels" collection of methods.
501
+ * Typical usage is:
502
+ * <code>
503
+ * $adsenseService = new apiAdsenseService(...);
504
+ * $customchannels = $adsenseService->customchannels;
505
+ * </code>
506
+ */
507
+ class AccountsCustomchannelsServiceResource extends apiServiceResource {
508
+
509
+
510
+ /**
511
+ * List all custom channels in the specified ad client for the specified account.
512
+ * (customchannels.list)
513
+ *
514
+ * @param string $accountId Account to which the ad client belongs.
515
+ * @param string $adClientId Ad client for which to list custom channels.
516
+ * @param array $optParams Optional parameters. Valid optional parameters are listed below.
517
+ *
518
+ * @opt_param string pageToken A continuation token, used to page through custom channels. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
519
+ * @opt_param int maxResults The maximum number of custom channels to include in the response, used for paging.
520
+ * @return CustomChannels
521
+ */
522
+ public function listAccountsCustomchannels($accountId, $adClientId, $optParams = array()) {
523
+ $params = array(
524
+ 'accountId' => $accountId,
525
+ 'adClientId' => $adClientId
526
+ );
527
+ $params = array_merge($params, $optParams);
528
+ $data = $this->__call('list', array($params));
529
+ if ($this->useObjects()) {
530
+ return new CustomChannels($data);
531
+ } else {
532
+ return $data;
533
+ }
534
+ }
535
+
536
+ /**
537
+ * Get the specified custom channel from the specified ad client for the specified account.
538
+ * (customchannels.get)
539
+ *
540
+ * @param string $accountId Account to which the ad client belongs.
541
+ * @param string $adClientId Ad client which contains the custom channel.
542
+ * @param string $customChannelId Custom channel to retrieve.
543
+ *
544
+ * @return CustomChannel
545
+ */
546
+ public function get($accountId, $adClientId, $customChannelId, $optParams = array()) {
547
+ $params = array(
548
+ 'accountId' => $accountId,
549
+ 'adClientId' => $adClientId,
550
+ 'customChannelId' => $customChannelId
551
+ );
552
+ $params = array_merge($params, $optParams);
553
+ $data = $this->__call('get', array($params));
554
+ if ($this->useObjects()) {
555
+ return new CustomChannel($data);
556
+ } else {
557
+ return $data;
558
+ }
559
+ }
560
+ }
561
+
562
+
563
+ /**
564
+ * The "adunits" collection of methods.
565
+ * Typical usage is:
566
+ * <code>
567
+ * $adsenseService = new apiAdsenseService(...);
568
+ * $adunits = $adsenseService->adunits;
569
+ * </code>
570
+ */
571
+ class AccountsCustomchannelsAdunitsServiceResource extends apiServiceResource {
572
+
573
+
574
+ /**
575
+ * List all ad units in the specified custom channel. (adunits.list)
576
+ *
577
+ * @param string $accountId Account to which the ad client belongs.
578
+ * @param string $adClientId Ad client which contains the custom channel.
579
+ * @param string $customChannelId Custom channel for which to list ad units.
580
+ * @param array $optParams Optional parameters. Valid optional parameters are listed below.
581
+ *
582
+ * @opt_param bool includeInactive Whether to include inactive ad units. Default: true.
583
+ * @opt_param int maxResults The maximum number of ad units to include in the response, used for paging.
584
+ * @opt_param string pageToken A continuation token, used to page through ad units. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
585
+ * @return AdUnits
586
+ */
587
+ public function listAccountsCustomchannelsAdunits($accountId, $adClientId, $customChannelId, $optParams = array()) {
588
+ $params = array(
589
+ 'accountId' => $accountId,
590
+ 'adClientId' => $adClientId,
591
+ 'customChannelId' => $customChannelId
592
+ );
593
+ $params = array_merge($params, $optParams);
594
+ $data = $this->__call('list', array($params));
595
+ if ($this->useObjects()) {
596
+ return new AdUnits($data);
597
+ } else {
598
+ return $data;
599
+ }
600
+ }
601
+ }
602
+
603
+ /**
604
+ * The "customchannels" collection of methods.
605
+ * Typical usage is:
606
+ * <code>
607
+ * $adsenseService = new apiAdsenseService(...);
608
+ * $customchannels = $adsenseService->customchannels;
609
+ * </code>
610
+ */
611
+ class CustomchannelsServiceResource extends apiServiceResource {
612
+
613
+
614
+ /**
615
+ * List all custom channels in the specified ad client for this AdSense account.
616
+ * (customchannels.list)
617
+ *
618
+ * @param string $adClientId Ad client for which to list custom channels.
619
+ * @param array $optParams Optional parameters. Valid optional parameters are listed below.
620
+ *
621
+ * @opt_param string pageToken A continuation token, used to page through custom channels. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
622
+ * @opt_param int maxResults The maximum number of custom channels to include in the response, used for paging.
623
+ * @return CustomChannels
624
+ */
625
+ public function listCustomchannels($adClientId, $optParams = array()) {
626
+ $params = array('adClientId' => $adClientId);
627
+ $params = array_merge($params, $optParams);
628
+ $data = $this->__call('list', array($params));
629
+ if ($this->useObjects()) {
630
+ return new CustomChannels($data);
631
+ } else {
632
+ return $data;
633
+ }
634
+ }
635
+
636
+ /**
637
+ * Get the specified custom channel from the specified ad client. (customchannels.get)
638
+ *
639
+ * @param string $adClientId Ad client which contains the custom channel.
640
+ * @param string $customChannelId Custom channel to retrieve.
641
+ *
642
+ * @return CustomChannel
643
+ */
644
+ public function get($adClientId, $customChannelId, $optParams = array()) {
645
+ $params = array(
646
+ 'adClientId' => $adClientId,
647
+ 'customChannelId' => $customChannelId
648
+ );
649
+ $params = array_merge($params, $optParams);
650
+ $data = $this->__call('get', array($params));
651
+ if ($this->useObjects()) {
652
+ return new CustomChannel($data);
653
+ } else {
654
+ return $data;
655
+ }
656
+ }
657
+ }
658
+
659
+
660
+ /**
661
+ * The "adunits" collection of methods.
662
+ * Typical usage is:
663
+ * <code>
664
+ * $adsenseService = new apiAdsenseService(...);
665
+ * $adunits = $adsenseService->adunits;
666
+ * </code>
667
+ */
668
+ class CustomchannelsAdunitsServiceResource extends apiServiceResource {
669
+
670
+
671
+ /**
672
+ * List all ad units in the specified custom channel. (adunits.list)
673
+ *
674
+ * @param string $adClientId Ad client which contains the custom channel.
675
+ * @param string $customChannelId Custom channel for which to list ad units.
676
+ * @param array $optParams Optional parameters. Valid optional parameters are listed below.
677
+ *
678
+ * @opt_param bool includeInactive Whether to include inactive ad units. Default: true.
679
+ * @opt_param string pageToken A continuation token, used to page through ad units. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
680
+ * @opt_param int maxResults The maximum number of ad units to include in the response, used for paging.
681
+ * @return AdUnits
682
+ */
683
+ public function listCustomchannelsAdunits($adClientId, $customChannelId, $optParams = array()) {
684
+ $params = array(
685
+ 'adClientId' => $adClientId,
686
+ 'customChannelId' => $customChannelId
687
+ );
688
+ $params = array_merge($params, $optParams);
689
+ $data = $this->__call('list', array($params));
690
+ if ($this->useObjects()) {
691
+ return new AdUnits($data);
692
+ } else {
693
+ return $data;
694
+ }
695
+ }
696
+ }
697
+
698
+
699
+ /**
700
+ * Service definition for Adsense (v1.1).
701
+ *
702
+ * <p>
703
+ * Gives AdSense publishers access to their inventory and the ability to generate reports
704
+ * </p>
705
+ *
706
+ * <p>
707
+ * For more information about this service, see the
708
+ * <a href="https://code.google.com/apis/adsense/management/" target="_blank">API Documentation</a>
709
+ * </p>
710
+ *
711
+ * @author Google, Inc.
712
+ */
713
+ class apiAdsenseService extends apiService {
714
+
715
+ public $urlchannels;
716
+ public $adunits;
717
+ public $adunits_customchannels;
718
+ public $adunits_customchannels_customchannels;
719
+ public $adclients;
720
+ public $reports;
721
+ public $accounts;
722
+ public $accounts_urlchannels;
723
+ public $accounts_urlchannels_urlchannels;
724
+ public $accounts_urlchannels_adunits;
725
+ public $accounts_urlchannels_adclients;
726
+ public $accounts_urlchannels_reports;
727
+ public $accounts_urlchannels_customchannels;
728
+ public $accounts_adunits;
729
+ public $accounts_adunits_urlchannels;
730
+ public $accounts_adunits_adunits;
731
+ public $accounts_adunits_adclients;
732
+ public $accounts_adunits_reports;
733
+ public $accounts_adunits_customchannels;
734
+ public $accounts_adclients;
735
+ public $accounts_adclients_urlchannels;
736
+ public $accounts_adclients_adunits;
737
+ public $accounts_adclients_adclients;
738
+ public $accounts_adclients_reports;
739
+ public $accounts_adclients_customchannels;
740
+ public $accounts_reports;
741
+ public $accounts_reports_urlchannels;
742
+ public $accounts_reports_adunits;
743
+ public $accounts_reports_adclients;
744
+ public $accounts_reports_reports;
745
+ public $accounts_reports_customchannels;
746
+ public $accounts_customchannels;
747
+ public $accounts_customchannels_urlchannels;
748
+ public $accounts_customchannels_adunits;
749
+ public $accounts_customchannels_adclients;
750
+ public $accounts_customchannels_reports;
751
+ public $accounts_customchannels_customchannels;
752
+ public $customchannels;
753
+ public $customchannels_adunits;
754
+ public $customchannels_adunits_adunits;
755
+
756
+ /**
757
+ * Constructs the internal representation of the Adsense service.
758
+ *
759
+ * @param apiClient apiClient
760
+ */
761
+ public function __construct(apiClient $apiClient) {
762
+ $this->rpcPath = '/rpc';
763
+ $this->restBasePath = '/adsense/v1.1/';
764
+ $this->version = 'v1.1';
765
+ $this->serviceName = 'adsense';
766
+
767
+ $apiClient->addService($this->serviceName, $this->version);
768
+ $this->urlchannels = new UrlchannelsServiceResource($this, $this->serviceName, 'urlchannels', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "adClientId": {"required": true, "type": "string", "location": "path"}, "maxResults": {"format": "int32", "maximum": "10000", "minimum": "0", "location": "query", "type": "integer"}}, "id": "adsense.urlchannels.list", "httpMethod": "GET", "path": "adclients/{adClientId}/urlchannels", "response": {"$ref": "UrlChannels"}}}}', true));
769
+ $this->adunits = new AdunitsServiceResource($this, $this->serviceName, 'adunits', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"includeInactive": {"type": "boolean", "location": "query"}, "pageToken": {"type": "string", "location": "query"}, "adClientId": {"required": true, "type": "string", "location": "path"}, "maxResults": {"format": "int32", "maximum": "10000", "minimum": "0", "location": "query", "type": "integer"}}, "id": "adsense.adunits.list", "httpMethod": "GET", "path": "adclients/{adClientId}/adunits", "response": {"$ref": "AdUnits"}}, "get": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"adClientId": {"required": true, "type": "string", "location": "path"}, "adUnitId": {"required": true, "type": "string", "location": "path"}}, "id": "adsense.adunits.get", "httpMethod": "GET", "path": "adclients/{adClientId}/adunits/{adUnitId}", "response": {"$ref": "AdUnit"}}}}', true));
770
+ $this->adunits_customchannels = new AdunitsCustomchannelsServiceResource($this, $this->serviceName, 'customchannels', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "adClientId": {"required": true, "type": "string", "location": "path"}, "adUnitId": {"required": true, "type": "string", "location": "path"}, "maxResults": {"format": "int32", "maximum": "10000", "minimum": "0", "location": "query", "type": "integer"}}, "id": "adsense.adunits.customchannels.list", "httpMethod": "GET", "path": "adclients/{adClientId}/adunits/{adUnitId}/customchannels", "response": {"$ref": "CustomChannels"}}}}', true));
771
+ $this->adclients = new AdclientsServiceResource($this, $this->serviceName, 'adclients', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "maxResults": {"format": "int32", "maximum": "10000", "minimum": "0", "location": "query", "type": "integer"}}, "response": {"$ref": "AdClients"}, "httpMethod": "GET", "path": "adclients", "id": "adsense.adclients.list"}}}', true));
772
+ $this->reports = new ReportsServiceResource($this, $this->serviceName, 'reports', json_decode('{"methods": {"generate": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"sort": {"repeated": true, "type": "string", "location": "query"}, "startDate": {"required": true, "type": "string", "location": "query"}, "endDate": {"required": true, "type": "string", "location": "query"}, "locale": {"type": "string", "location": "query"}, "metric": {"repeated": true, "type": "string", "location": "query"}, "maxResults": {"format": "int32", "maximum": "50000", "minimum": "0", "location": "query", "type": "integer"}, "filter": {"repeated": true, "type": "string", "location": "query"}, "currency": {"type": "string", "location": "query"}, "startIndex": {"format": "int32", "maximum": "5000", "minimum": "0", "location": "query", "type": "integer"}, "dimension": {"repeated": true, "type": "string", "location": "query"}, "accountId": {"repeated": true, "type": "string", "location": "query"}}, "id": "adsense.reports.generate", "httpMethod": "GET", "path": "reports", "response": {"$ref": "AdsenseReportsGenerateResponse"}}}}', true));
773
+ $this->accounts = new AccountsServiceResource($this, $this->serviceName, 'accounts', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "maxResults": {"format": "int32", "maximum": "10000", "minimum": "0", "location": "query", "type": "integer"}}, "response": {"$ref": "Accounts"}, "httpMethod": "GET", "path": "accounts", "id": "adsense.accounts.list"}, "get": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"tree": {"type": "boolean", "location": "query"}, "accountId": {"required": true, "type": "string", "location": "path"}}, "id": "adsense.accounts.get", "httpMethod": "GET", "path": "accounts/{accountId}", "response": {"$ref": "Account"}}}}', true));
774
+ $this->accounts_urlchannels = new AccountsUrlchannelsServiceResource($this, $this->serviceName, 'urlchannels', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "adClientId": {"required": true, "type": "string", "location": "path"}, "maxResults": {"format": "int32", "maximum": "10000", "minimum": "0", "location": "query", "type": "integer"}, "accountId": {"required": true, "type": "string", "location": "path"}}, "id": "adsense.accounts.urlchannels.list", "httpMethod": "GET", "path": "accounts/{accountId}/adclients/{adClientId}/urlchannels", "response": {"$ref": "UrlChannels"}}}}', true));
775
+ $this->accounts_adunits = new AccountsAdunitsServiceResource($this, $this->serviceName, 'adunits', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"includeInactive": {"type": "boolean", "location": "query"}, "pageToken": {"type": "string", "location": "query"}, "adClientId": {"required": true, "type": "string", "location": "path"}, "maxResults": {"format": "int32", "maximum": "10000", "minimum": "0", "location": "query", "type": "integer"}, "accountId": {"required": true, "type": "string", "location": "path"}}, "id": "adsense.accounts.adunits.list", "httpMethod": "GET", "path": "accounts/{accountId}/adclients/{adClientId}/adunits", "response": {"$ref": "AdUnits"}}, "get": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"adClientId": {"required": true, "type": "string", "location": "path"}, "adUnitId": {"required": true, "type": "string", "location": "path"}, "accountId": {"required": true, "type": "string", "location": "path"}}, "id": "adsense.accounts.adunits.get", "httpMethod": "GET", "path": "accounts/{accountId}/adclients/{adClientId}/adunits/{adUnitId}", "response": {"$ref": "AdUnit"}}}}', true));
776
+ $this->accounts_adunits_customchannels = new AccountsAdunitsCustomchannelsServiceResource($this, $this->serviceName, 'customchannels', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "adClientId": {"required": true, "type": "string", "location": "path"}, "adUnitId": {"required": true, "type": "string", "location": "path"}, "maxResults": {"format": "int32", "maximum": "10000", "minimum": "0", "location": "query", "type": "integer"}, "accountId": {"required": true, "type": "string", "location": "path"}}, "id": "adsense.accounts.adunits.customchannels.list", "httpMethod": "GET", "path": "accounts/{accountId}/adclients/{adClientId}/adunits/{adUnitId}/customchannels", "response": {"$ref": "CustomChannels"}}}}', true));
777
+ $this->accounts_adclients = new AccountsAdclientsServiceResource($this, $this->serviceName, 'adclients', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "maxResults": {"format": "int32", "maximum": "10000", "minimum": "0", "location": "query", "type": "integer"}, "accountId": {"required": true, "type": "string", "location": "path"}}, "id": "adsense.accounts.adclients.list", "httpMethod": "GET", "path": "accounts/{accountId}/adclients", "response": {"$ref": "AdClients"}}}}', true));
778
+ $this->accounts_reports = new AccountsReportsServiceResource($this, $this->serviceName, 'reports', json_decode('{"methods": {"generate": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"sort": {"repeated": true, "type": "string", "location": "query"}, "startDate": {"required": true, "type": "string", "location": "query"}, "endDate": {"required": true, "type": "string", "location": "query"}, "locale": {"type": "string", "location": "query"}, "metric": {"repeated": true, "type": "string", "location": "query"}, "maxResults": {"format": "int32", "maximum": "50000", "minimum": "0", "location": "query", "type": "integer"}, "filter": {"repeated": true, "type": "string", "location": "query"}, "currency": {"type": "string", "location": "query"}, "startIndex": {"format": "int32", "maximum": "5000", "minimum": "0", "location": "query", "type": "integer"}, "dimension": {"repeated": true, "type": "string", "location": "query"}, "accountId": {"type": "string", "location": "path"}}, "id": "adsense.accounts.reports.generate", "httpMethod": "GET", "path": "accounts/{accountId}/reports", "response": {"$ref": "AdsenseReportsGenerateResponse"}}}}', true));
779
+ $this->accounts_customchannels = new AccountsCustomchannelsServiceResource($this, $this->serviceName, 'customchannels', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "adClientId": {"required": true, "type": "string", "location": "path"}, "maxResults": {"format": "int32", "maximum": "10000", "minimum": "0", "location": "query", "type": "integer"}, "accountId": {"required": true, "type": "string", "location": "path"}}, "id": "adsense.accounts.customchannels.list", "httpMethod": "GET", "path": "accounts/{accountId}/adclients/{adClientId}/customchannels", "response": {"$ref": "CustomChannels"}}, "get": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"customChannelId": {"required": true, "type": "string", "location": "path"}, "adClientId": {"required": true, "type": "string", "location": "path"}, "accountId": {"required": true, "type": "string", "location": "path"}}, "id": "adsense.accounts.customchannels.get", "httpMethod": "GET", "path": "accounts/{accountId}/adclients/{adClientId}/customchannels/{customChannelId}", "response": {"$ref": "CustomChannel"}}}}', true));
780
+ $this->accounts_customchannels_adunits = new AccountsCustomchannelsAdunitsServiceResource($this, $this->serviceName, 'adunits', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"includeInactive": {"type": "boolean", "location": "query"}, "customChannelId": {"required": true, "type": "string", "location": "path"}, "adClientId": {"required": true, "type": "string", "location": "path"}, "maxResults": {"format": "int32", "maximum": "10000", "minimum": "0", "location": "query", "type": "integer"}, "pageToken": {"type": "string", "location": "query"}, "accountId": {"required": true, "type": "string", "location": "path"}}, "id": "adsense.accounts.customchannels.adunits.list", "httpMethod": "GET", "path": "accounts/{accountId}/adclients/{adClientId}/customchannels/{customChannelId}/adunits", "response": {"$ref": "AdUnits"}}}}', true));
781
+ $this->customchannels = new CustomchannelsServiceResource($this, $this->serviceName, 'customchannels', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "adClientId": {"required": true, "type": "string", "location": "path"}, "maxResults": {"format": "int32", "maximum": "10000", "minimum": "0", "location": "query", "type": "integer"}}, "id": "adsense.customchannels.list", "httpMethod": "GET", "path": "adclients/{adClientId}/customchannels", "response": {"$ref": "CustomChannels"}}, "get": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"customChannelId": {"required": true, "type": "string", "location": "path"}, "adClientId": {"required": true, "type": "string", "location": "path"}}, "id": "adsense.customchannels.get", "httpMethod": "GET", "path": "adclients/{adClientId}/customchannels/{customChannelId}", "response": {"$ref": "CustomChannel"}}}}', true));
782
+ $this->customchannels_adunits = new CustomchannelsAdunitsServiceResource($this, $this->serviceName, 'adunits', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "parameters": {"includeInactive": {"type": "boolean", "location": "query"}, "pageToken": {"type": "string", "location": "query"}, "customChannelId": {"required": true, "type": "string", "location": "path"}, "adClientId": {"required": true, "type": "string", "location": "path"}, "maxResults": {"format": "int32", "maximum": "10000", "minimum": "0", "location": "query", "type": "integer"}}, "id": "adsense.customchannels.adunits.list", "httpMethod": "GET", "path": "adclients/{adClientId}/customchannels/{customChannelId}/adunits", "response": {"$ref": "AdUnits"}}}}', true));
783
+ }
784
+ }
785
+
786
+ class Account extends apiModel {
787
+
788
+ public $kind;
789
+ public $id;
790
+ protected $__subAccountsType = 'Account';
791
+ protected $__subAccountsDataType = 'array';
792
+ public $subAccounts;
793
+ public $name;
794
+
795
+ public function setKind($kind) {
796
+ $this->kind = $kind;
797
+ }
798
+
799
+ public function getKind() {
800
+ return $this->kind;
801
+ }
802
+
803
+ public function setId($id) {
804
+ $this->id = $id;
805
+ }
806
+
807
+ public function getId() {
808
+ return $this->id;
809
+ }
810
+
811
+ public function setSubAccounts(/* array(Account) */
812
+ $subAccounts) {
813
+ $this->assertIsArray($subAccounts, 'Account', __METHOD__);
814
+ $this->subAccounts = $subAccounts;
815
+ }
816
+
817
+ public function getSubAccounts() {
818
+ return $this->subAccounts;
819
+ }
820
+
821
+ public function setName($name) {
822
+ $this->name = $name;
823
+ }
824
+
825
+ public function getName() {
826
+ return $this->name;
827
+ }
828
+ }
829
+
830
+ class Accounts extends apiModel {
831
+
832
+ public $nextPageToken;
833
+ protected $__itemsType = 'Account';
834
+ protected $__itemsDataType = 'array';
835
+ public $items;
836
+ public $kind;
837
+ public $etag;
838
+
839
+ public function setNextPageToken($nextPageToken) {
840
+ $this->nextPageToken = $nextPageToken;
841
+ }
842
+
843
+ public function getNextPageToken() {
844
+ return $this->nextPageToken;
845
+ }
846
+
847
+ public function setItems(/* array(Account) */
848
+ $items) {
849
+ $this->assertIsArray($items, 'Account', __METHOD__);
850
+ $this->items = $items;
851
+ }
852
+
853
+ public function getItems() {
854
+ return $this->items;
855
+ }
856
+
857
+ public function setKind($kind) {
858
+ $this->kind = $kind;
859
+ }
860
+
861
+ public function getKind() {
862
+ return $this->kind;
863
+ }
864
+
865
+ public function setEtag($etag) {
866
+ $this->etag = $etag;
867
+ }
868
+
869
+ public function getEtag() {
870
+ return $this->etag;
871
+ }
872
+ }
873
+
874
+ class AdClient extends apiModel {
875
+
876
+ public $productCode;
877
+ public $kind;
878
+ public $id;
879
+ public $supportsReporting;
880
+
881
+ public function setProductCode($productCode) {
882
+ $this->productCode = $productCode;
883
+ }
884
+
885
+ public function getProductCode() {
886
+ return $this->productCode;
887
+ }
888
+
889
+ public function setKind($kind) {
890
+ $this->kind = $kind;
891
+ }
892
+
893
+ public function getKind() {
894
+ return $this->kind;
895
+ }
896
+
897
+ public function setId($id) {
898
+ $this->id = $id;
899
+ }
900
+
901
+ public function getId() {
902
+ return $this->id;
903
+ }
904
+
905
+ public function setSupportsReporting($supportsReporting) {
906
+ $this->supportsReporting = $supportsReporting;
907
+ }
908
+
909
+ public function getSupportsReporting() {
910
+ return $this->supportsReporting;
911
+ }
912
+ }
913
+
914
+ class AdClients extends apiModel {
915
+
916
+ public $nextPageToken;
917
+ protected $__itemsType = 'AdClient';
918
+ protected $__itemsDataType = 'array';
919
+ public $items;
920
+ public $kind;
921
+ public $etag;
922
+
923
+ public function setNextPageToken($nextPageToken) {
924
+ $this->nextPageToken = $nextPageToken;
925
+ }
926
+
927
+ public function getNextPageToken() {
928
+ return $this->nextPageToken;
929
+ }
930
+
931
+ public function setItems(/* array(AdClient) */
932
+ $items) {
933
+ $this->assertIsArray($items, 'AdClient', __METHOD__);
934
+ $this->items = $items;
935
+ }
936
+
937
+ public function getItems() {
938
+ return $this->items;
939
+ }
940
+
941
+ public function setKind($kind) {
942
+ $this->kind = $kind;
943
+ }
944
+
945
+ public function getKind() {
946
+ return $this->kind;
947
+ }
948
+
949
+ public function setEtag($etag) {
950
+ $this->etag = $etag;
951
+ }
952
+
953
+ public function getEtag() {
954
+ return $this->etag;
955
+ }
956
+ }
957
+
958
+ class AdUnit extends apiModel {
959
+
960
+ public $status;
961
+ public $kind;
962
+ public $code;
963
+ public $id;
964
+ public $name;
965
+
966
+ public function setStatus($status) {
967
+ $this->status = $status;
968
+ }
969
+
970
+ public function getStatus() {
971
+ return $this->status;
972
+ }
973
+
974
+ public function setKind($kind) {
975
+ $this->kind = $kind;
976
+ }
977
+
978
+ public function getKind() {
979
+ return $this->kind;
980
+ }
981
+
982
+ public function setCode($code) {
983
+ $this->code = $code;
984
+ }
985
+
986
+ public function getCode() {
987
+ return $this->code;
988
+ }
989
+
990
+ public function setId($id) {
991
+ $this->id = $id;
992
+ }
993
+
994
+ public function getId() {
995
+ return $this->id;
996
+ }
997
+
998
+ public function setName($name) {
999
+ $this->name = $name;
1000
+ }
1001
+
1002
+ public function getName() {
1003
+ return $this->name;
1004
+ }
1005
+ }
1006
+
1007
+ class AdUnits extends apiModel {
1008
+
1009
+ public $nextPageToken;
1010
+ protected $__itemsType = 'AdUnit';
1011
+ protected $__itemsDataType = 'array';
1012
+ public $items;
1013
+ public $kind;
1014
+ public $etag;
1015
+
1016
+ public function setNextPageToken($nextPageToken) {
1017
+ $this->nextPageToken = $nextPageToken;
1018
+ }
1019
+
1020
+ public function getNextPageToken() {
1021
+ return $this->nextPageToken;
1022
+ }
1023
+
1024
+ public function setItems(/* array(AdUnit) */
1025
+ $items) {
1026
+ $this->assertIsArray($items, 'AdUnit', __METHOD__);
1027
+ $this->items = $items;
1028
+ }
1029
+
1030
+ public function getItems() {
1031
+ return $this->items;
1032
+ }
1033
+
1034
+ public function setKind($kind) {
1035
+ $this->kind = $kind;
1036
+ }
1037
+
1038
+ public function getKind() {
1039
+ return $this->kind;
1040
+ }
1041
+
1042
+ public function setEtag($etag) {
1043
+ $this->etag = $etag;
1044
+ }
1045
+
1046
+ public function getEtag() {
1047
+ return $this->etag;
1048
+ }
1049
+ }
1050
+
1051
+ class AdsenseReportsGenerateResponse extends apiModel {
1052
+
1053
+ public $kind;
1054
+ public $rows;
1055
+ public $warnings;
1056
+ public $totals;
1057
+ protected $__headersType = 'AdsenseReportsGenerateResponseHeaders';
1058
+ protected $__headersDataType = 'array';
1059
+ public $headers;
1060
+ public $totalMatchedRows;
1061
+ public $averages;
1062
+
1063
+ public function setKind($kind) {
1064
+ $this->kind = $kind;
1065
+ }
1066
+
1067
+ public function getKind() {
1068
+ return $this->kind;
1069
+ }
1070
+
1071
+ public function setRows(/* array(string) */
1072
+ $rows) {
1073
+ $this->assertIsArray($rows, 'string', __METHOD__);
1074
+ $this->rows = $rows;
1075
+ }
1076
+
1077
+ public function getRows() {
1078
+ return $this->rows;
1079
+ }
1080
+
1081
+ public function setWarnings(/* array(string) */
1082
+ $warnings) {
1083
+ $this->assertIsArray($warnings, 'string', __METHOD__);
1084
+ $this->warnings = $warnings;
1085
+ }
1086
+
1087
+ public function getWarnings() {
1088
+ return $this->warnings;
1089
+ }
1090
+
1091
+ public function setTotals(/* array(string) */
1092
+ $totals) {
1093
+ $this->assertIsArray($totals, 'string', __METHOD__);
1094
+ $this->totals = $totals;
1095
+ }
1096
+
1097
+ public function getTotals() {
1098
+ return $this->totals;
1099
+ }
1100
+
1101
+ public function setHeaders(/* array(AdsenseReportsGenerateResponseHeaders) */
1102
+ $headers) {
1103
+ $this->assertIsArray($headers, 'AdsenseReportsGenerateResponseHeaders', __METHOD__);
1104
+ $this->headers = $headers;
1105
+ }
1106
+
1107
+ public function getHeaders() {
1108
+ return $this->headers;
1109
+ }
1110
+
1111
+ public function setTotalMatchedRows($totalMatchedRows) {
1112
+ $this->totalMatchedRows = $totalMatchedRows;
1113
+ }
1114
+
1115
+ public function getTotalMatchedRows() {
1116
+ return $this->totalMatchedRows;
1117
+ }
1118
+
1119
+ public function setAverages(/* array(string) */
1120
+ $averages) {
1121
+ $this->assertIsArray($averages, 'string', __METHOD__);
1122
+ $this->averages = $averages;
1123
+ }
1124
+
1125
+ public function getAverages() {
1126
+ return $this->averages;
1127
+ }
1128
+ }
1129
+
1130
+ class AdsenseReportsGenerateResponseHeaders extends apiModel {
1131
+
1132
+ public $currency;
1133
+ public $type;
1134
+ public $name;
1135
+
1136
+ public function setCurrency($currency) {
1137
+ $this->currency = $currency;
1138
+ }
1139
+
1140
+ public function getCurrency() {
1141
+ return $this->currency;
1142
+ }
1143
+
1144
+ public function setType($type) {
1145
+ $this->type = $type;
1146
+ }
1147
+
1148
+ public function getType() {
1149
+ return $this->type;
1150
+ }
1151
+
1152
+ public function setName($name) {
1153
+ $this->name = $name;
1154
+ }
1155
+
1156
+ public function getName() {
1157
+ return $this->name;
1158
+ }
1159
+ }
1160
+
1161
+ class CustomChannel extends apiModel {
1162
+
1163
+ public $kind;
1164
+ public $code;
1165
+ protected $__targetingInfoType = 'CustomChannelTargetingInfo';
1166
+ protected $__targetingInfoDataType = '';
1167
+ public $targetingInfo;
1168
+ public $id;
1169
+ public $name;
1170
+
1171
+ public function setKind($kind) {
1172
+ $this->kind = $kind;
1173
+ }
1174
+
1175
+ public function getKind() {
1176
+ return $this->kind;
1177
+ }
1178
+
1179
+ public function setCode($code) {
1180
+ $this->code = $code;
1181
+ }
1182
+
1183
+ public function getCode() {
1184
+ return $this->code;
1185
+ }
1186
+
1187
+ public function setTargetingInfo(CustomChannelTargetingInfo $targetingInfo) {
1188
+ $this->targetingInfo = $targetingInfo;
1189
+ }
1190
+
1191
+ public function getTargetingInfo() {
1192
+ return $this->targetingInfo;
1193
+ }
1194
+
1195
+ public function setId($id) {
1196
+ $this->id = $id;
1197
+ }
1198
+
1199
+ public function getId() {
1200
+ return $this->id;
1201
+ }
1202
+
1203
+ public function setName($name) {
1204
+ $this->name = $name;
1205
+ }
1206
+
1207
+ public function getName() {
1208
+ return $this->name;
1209
+ }
1210
+ }
1211
+
1212
+ class CustomChannelTargetingInfo extends apiModel {
1213
+
1214
+ public $location;
1215
+ public $adsAppearOn;
1216
+ public $siteLanguage;
1217
+ public $description;
1218
+
1219
+ public function setLocation($location) {
1220
+ $this->location = $location;
1221
+ }
1222
+
1223
+ public function getLocation() {
1224
+ return $this->location;
1225
+ }
1226
+
1227
+ public function setAdsAppearOn($adsAppearOn) {
1228
+ $this->adsAppearOn = $adsAppearOn;
1229
+ }
1230
+
1231
+ public function getAdsAppearOn() {
1232
+ return $this->adsAppearOn;
1233
+ }
1234
+
1235
+ public function setSiteLanguage($siteLanguage) {
1236
+ $this->siteLanguage = $siteLanguage;
1237
+ }
1238
+
1239
+ public function getSiteLanguage() {
1240
+ return $this->siteLanguage;
1241
+ }
1242
+
1243
+ public function setDescription($description) {
1244
+ $this->description = $description;
1245
+ }
1246
+
1247
+ public function getDescription() {
1248
+ return $this->description;
1249
+ }
1250
+ }
1251
+
1252
+ class CustomChannels extends apiModel {
1253
+
1254
+ public $nextPageToken;
1255
+ protected $__itemsType = 'CustomChannel';
1256
+ protected $__itemsDataType = 'array';
1257
+ public $items;
1258
+ public $kind;
1259
+ public $etag;
1260
+
1261
+ public function setNextPageToken($nextPageToken) {
1262
+ $this->nextPageToken = $nextPageToken;
1263
+ }
1264
+
1265
+ public function getNextPageToken() {
1266
+ return $this->nextPageToken;
1267
+ }
1268
+
1269
+ public function setItems(/* array(CustomChannel) */
1270
+ $items) {
1271
+ $this->assertIsArray($items, 'CustomChannel', __METHOD__);
1272
+ $this->items = $items;
1273
+ }
1274
+
1275
+ public function getItems() {
1276
+ return $this->items;
1277
+ }
1278
+
1279
+ public function setKind($kind) {
1280
+ $this->kind = $kind;
1281
+ }
1282
+
1283
+ public function getKind() {
1284
+ return $this->kind;
1285
+ }
1286
+
1287
+ public function setEtag($etag) {
1288
+ $this->etag = $etag;
1289
+ }
1290
+
1291
+ public function getEtag() {
1292
+ return $this->etag;
1293
+ }
1294
+ }
1295
+
1296
+ class UrlChannel extends apiModel {
1297
+
1298
+ public $kind;
1299
+ public $id;
1300
+ public $urlPattern;
1301
+
1302
+ public function setKind($kind) {
1303
+ $this->kind = $kind;
1304
+ }
1305
+
1306
+ public function getKind() {
1307
+ return $this->kind;
1308
+ }
1309
+
1310
+ public function setId($id) {
1311
+ $this->id = $id;
1312
+ }
1313
+
1314
+ public function getId() {
1315
+ return $this->id;
1316
+ }
1317
+
1318
+ public function setUrlPattern($urlPattern) {
1319
+ $this->urlPattern = $urlPattern;
1320
+ }
1321
+
1322
+ public function getUrlPattern() {
1323
+ return $this->urlPattern;
1324
+ }
1325
+ }
1326
+
1327
+ class UrlChannels extends apiModel {
1328
+
1329
+ public $nextPageToken;
1330
+ protected $__itemsType = 'UrlChannel';
1331
+ protected $__itemsDataType = 'array';
1332
+ public $items;
1333
+ public $kind;
1334
+ public $etag;
1335
+
1336
+ public function setNextPageToken($nextPageToken) {
1337
+ $this->nextPageToken = $nextPageToken;
1338
+ }
1339
+
1340
+ public function getNextPageToken() {
1341
+ return $this->nextPageToken;
1342
+ }
1343
+
1344
+ public function setItems(/* array(UrlChannel) */
1345
+ $items) {
1346
+ $this->assertIsArray($items, 'UrlChannel', __METHOD__);
1347
+ $this->items = $items;
1348
+ }
1349
+
1350
+ public function getItems() {
1351
+ return $this->items;
1352
+ }
1353
+
1354
+ public function setKind($kind) {
1355
+ $this->kind = $kind;
1356
+ }
1357
+
1358
+ public function getKind() {
1359
+ return $this->kind;
1360
+ }
1361
+
1362
+ public function setEtag($etag) {
1363
+ $this->etag = $etag;
1364
+ }
1365
+
1366
+ public function getEtag() {
1367
+ return $this->etag;
1368
+ }
1369
+ }
providers/google/compat/sdk/contrib/apiAnalyticsService.php ADDED
@@ -0,0 +1,1951 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Copyright (c) 2010 Google Inc.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6
+ * use this file except in compliance with the License. You may obtain a copy of
7
+ * the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14
+ * License for the specific language governing permissions and limitations under
15
+ * the License.
16
+ */
17
+
18
+ require_once 'service/apiModel.php';
19
+ require_once 'service/apiService.php';
20
+ require_once 'service/apiServiceRequest.php';
21
+
22
+
23
+ /**
24
+ * The "management" collection of methods.
25
+ * Typical usage is:
26
+ * <code>
27
+ *