Disqus Comment System - Version 3.0.7

Version Description

  • Plugin has been completely rewritten to support modern and secure WordPress features.
  • Added new Automatic Installation for installing Disqus on your site. This also creates the API application required for enabling comment syncing.
  • Completely redesigned plugin settings page. Disqus replaces the Comments menu link in your WordPress admin and includes shortcut links to popular settings.
Download this release

Release Info

Developer ryanv12
Plugin Icon Disqus Comment System
Version 3.0.7
Comparing to
See all releases

Code changes from version 2.87 to 3.0.7

Files changed (63) hide show
  1. DEV +0 -16
  2. LICENSE +0 -674
  3. LICENSE.txt +339 -0
  4. readme.txt → README.txt +12 -16
  5. admin/bundles/js/en.disqus-admin.bundle.3.0.7.min.js +22 -0
  6. admin/class-disqus-admin.php +279 -0
  7. admin/css/disqus-admin.css +140 -0
  8. admin/index.php +2 -0
  9. admin/partials/disqus-admin-partial.php +16 -0
  10. assets/banner-772x250.png +0 -0
  11. assets/icon-256x256.png +0 -0
  12. assets/icon.svg +0 -16
  13. assets/screenshot-1.png +0 -0
  14. assets/screenshot-10.png +0 -0
  15. assets/screenshot-11.png +0 -0
  16. assets/screenshot-2.png +0 -0
  17. assets/screenshot-3.png +0 -0
  18. assets/screenshot-4.png +0 -0
  19. assets/screenshot-5.png +0 -0
  20. assets/screenshot-6.png +0 -0
  21. assets/screenshot-7.png +0 -0
  22. assets/screenshot-8.png +0 -0
  23. assets/screenshot-9.png +0 -0
  24. comments.php +0 -156
  25. disqus.php +48 -1497
  26. export.php +0 -195
  27. includes/class-disqus-activator.php +40 -0
  28. includes/class-disqus-api-service.php +112 -0
  29. includes/class-disqus-deactivator.php +35 -0
  30. includes/class-disqus-loader.php +128 -0
  31. includes/class-disqus.php +284 -0
  32. includes/index.php +2 -0
  33. index.php +2 -0
  34. lib/api/disqus/disqus.php +0 -461
  35. lib/api/disqus/json.php +0 -378
  36. lib/api/disqus/url.php +0 -296
  37. lib/wp-api.php +0 -107
  38. lib/wp-cli.php +0 -88
  39. locales/default.mo +0 -0
  40. locales/default.po +0 -490
  41. manage.php +0 -668
  42. media/images/logo.png +0 -0
  43. media/js/admin.js +0 -120
  44. media/js/dashboard.js +0 -15
  45. media/js/disqus.js +0 -56
  46. media/js/pointer.js +0 -17
  47. media/js/upload.js +0 -34
  48. media/styles/manage-pre25.css +0 -67
  49. media/styles/manage.css +0 -52
  50. public/class-disqus-public.php +298 -0
  51. public/index.php +2 -0
  52. media/js/count.js → public/js/comment_count.js +3 -2
  53. public/js/comment_embed.js +31 -0
  54. public/partials/disqus-public-display.php +14 -0
  55. public/partials/disqus-public-sso-login-profile.php +24 -0
  56. rest-api/class-disqus-rest-api.php +1015 -0
  57. rest-api/index.php +2 -0
  58. scripts/export-comments.php +0 -106
  59. scripts/import-comments.php +0 -63
  60. tests/initial.sql +0 -380
  61. tests/tests.php +0 -128
  62. uninstall.php +28 -0
  63. upgrade.php +0 -21
DEV DELETED
@@ -1,16 +0,0 @@
1
- This guide describes how to build disqus-wordpress from source.
2
-
3
- ::
4
-
5
- git clone git://github.com/disqus/disqus-wordpress.git disqus
6
- cd disqus
7
- git submodule update --init
8
-
9
- Updating requires also updating submodules:
10
-
11
- ::
12
-
13
- git pull origin master
14
- git submodule foreach git pull origin master
15
-
16
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
LICENSE DELETED
@@ -1,674 +0,0 @@
1
- GNU GENERAL PUBLIC LICENSE
2
- Version 3, 29 June 2007
3
-
4
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
- Everyone is permitted to copy and distribute verbatim copies
6
- of this license document, but changing it is not allowed.
7
-
8
- Preamble
9
-
10
- The GNU General Public License is a free, copyleft license for
11
- software and other kinds of works.
12
-
13
- The licenses for most software and other practical works are designed
14
- to take away your freedom to share and change the works. By contrast,
15
- the GNU General Public License is intended to guarantee your freedom to
16
- share and change all versions of a program--to make sure it remains free
17
- software for all its users. We, the Free Software Foundation, use the
18
- GNU General Public License for most of our software; it applies also to
19
- any other work released this way by its authors. You can apply it to
20
- your programs, too.
21
-
22
- When we speak of free software, we are referring to freedom, not
23
- price. Our General Public Licenses are designed to make sure that you
24
- have the freedom to distribute copies of free software (and charge for
25
- them if you wish), that you receive source code or can get it if you
26
- want it, that you can change the software or use pieces of it in new
27
- free programs, and that you know you can do these things.
28
-
29
- To protect your rights, we need to prevent others from denying you
30
- these rights or asking you to surrender the rights. Therefore, you have
31
- certain responsibilities if you distribute copies of the software, or if
32
- you modify it: responsibilities to respect the freedom of others.
33
-
34
- For example, if you distribute copies of such a program, whether
35
- gratis or for a fee, you must pass on to the recipients the same
36
- freedoms that you received. You must make sure that they, too, receive
37
- or can get the source code. And you must show them these terms so they
38
- know their rights.
39
-
40
- Developers that use the GNU GPL protect your rights with two steps:
41
- (1) assert copyright on the software, and (2) offer you this License
42
- giving you legal permission to copy, distribute and/or modify it.
43
-
44
- For the developers' and authors' protection, the GPL clearly explains
45
- that there is no warranty for this free software. For both users' and
46
- authors' sake, the GPL requires that modified versions be marked as
47
- changed, so that their problems will not be attributed erroneously to
48
- authors of previous versions.
49
-
50
- Some devices are designed to deny users access to install or run
51
- modified versions of the software inside them, although the manufacturer
52
- can do so. This is fundamentally incompatible with the aim of
53
- protecting users' freedom to change the software. The systematic
54
- pattern of such abuse occurs in the area of products for individuals to
55
- use, which is precisely where it is most unacceptable. Therefore, we
56
- have designed this version of the GPL to prohibit the practice for those
57
- products. If such problems arise substantially in other domains, we
58
- stand ready to extend this provision to those domains in future versions
59
- of the GPL, as needed to protect the freedom of users.
60
-
61
- Finally, every program is threatened constantly by software patents.
62
- States should not allow patents to restrict development and use of
63
- software on general-purpose computers, but in those that do, we wish to
64
- avoid the special danger that patents applied to a free program could
65
- make it effectively proprietary. To prevent this, the GPL assures that
66
- patents cannot be used to render the program non-free.
67
-
68
- The precise terms and conditions for copying, distribution and
69
- modification follow.
70
-
71
- TERMS AND CONDITIONS
72
-
73
- 0. Definitions.
74
-
75
- "This License" refers to version 3 of the GNU General Public License.
76
-
77
- "Copyright" also means copyright-like laws that apply to other kinds of
78
- works, such as semiconductor masks.
79
-
80
- "The Program" refers to any copyrightable work licensed under this
81
- License. Each licensee is addressed as "you". "Licensees" and
82
- "recipients" may be individuals or organizations.
83
-
84
- To "modify" a work means to copy from or adapt all or part of the work
85
- in a fashion requiring copyright permission, other than the making of an
86
- exact copy. The resulting work is called a "modified version" of the
87
- earlier work or a work "based on" the earlier work.
88
-
89
- A "covered work" means either the unmodified Program or a work based
90
- on the Program.
91
-
92
- To "propagate" a work means to do anything with it that, without
93
- permission, would make you directly or secondarily liable for
94
- infringement under applicable copyright law, except executing it on a
95
- computer or modifying a private copy. Propagation includes copying,
96
- distribution (with or without modification), making available to the
97
- public, and in some countries other activities as well.
98
-
99
- To "convey" a work means any kind of propagation that enables other
100
- parties to make or receive copies. Mere interaction with a user through
101
- a computer network, with no transfer of a copy, is not conveying.
102
-
103
- An interactive user interface displays "Appropriate Legal Notices"
104
- to the extent that it includes a convenient and prominently visible
105
- feature that (1) displays an appropriate copyright notice, and (2)
106
- tells the user that there is no warranty for the work (except to the
107
- extent that warranties are provided), that licensees may convey the
108
- work under this License, and how to view a copy of this License. If
109
- the interface presents a list of user commands or options, such as a
110
- menu, a prominent item in the list meets this criterion.
111
-
112
- 1. Source Code.
113
-
114
- The "source code" for a work means the preferred form of the work
115
- for making modifications to it. "Object code" means any non-source
116
- form of a work.
117
-
118
- A "Standard Interface" means an interface that either is an official
119
- standard defined by a recognized standards body, or, in the case of
120
- interfaces specified for a particular programming language, one that
121
- is widely used among developers working in that language.
122
-
123
- The "System Libraries" of an executable work include anything, other
124
- than the work as a whole, that (a) is included in the normal form of
125
- packaging a Major Component, but which is not part of that Major
126
- Component, and (b) serves only to enable use of the work with that
127
- Major Component, or to implement a Standard Interface for which an
128
- implementation is available to the public in source code form. A
129
- "Major Component", in this context, means a major essential component
130
- (kernel, window system, and so on) of the specific operating system
131
- (if any) on which the executable work runs, or a compiler used to
132
- produce the work, or an object code interpreter used to run it.
133
-
134
- The "Corresponding Source" for a work in object code form means all
135
- the source code needed to generate, install, and (for an executable
136
- work) run the object code and to modify the work, including scripts to
137
- control those activities. However, it does not include the work's
138
- System Libraries, or general-purpose tools or generally available free
139
- programs which are used unmodified in performing those activities but
140
- which are not part of the work. For example, Corresponding Source
141
- includes interface definition files associated with source files for
142
- the work, and the source code for shared libraries and dynamically
143
- linked subprograms that the work is specifically designed to require,
144
- such as by intimate data communication or control flow between those
145
- subprograms and other parts of the work.
146
-
147
- The Corresponding Source need not include anything that users
148
- can regenerate automatically from other parts of the Corresponding
149
- Source.
150
-
151
- The Corresponding Source for a work in source code form is that
152
- same work.
153
-
154
- 2. Basic Permissions.
155
-
156
- All rights granted under this License are granted for the term of
157
- copyright on the Program, and are irrevocable provided the stated
158
- conditions are met. This License explicitly affirms your unlimited
159
- permission to run the unmodified Program. The output from running a
160
- covered work is covered by this License only if the output, given its
161
- content, constitutes a covered work. This License acknowledges your
162
- rights of fair use or other equivalent, as provided by copyright law.
163
-
164
- You may make, run and propagate covered works that you do not
165
- convey, without conditions so long as your license otherwise remains
166
- in force. You may convey covered works to others for the sole purpose
167
- of having them make modifications exclusively for you, or provide you
168
- with facilities for running those works, provided that you comply with
169
- the terms of this License in conveying all material for which you do
170
- not control copyright. Those thus making or running the covered works
171
- for you must do so exclusively on your behalf, under your direction
172
- and control, on terms that prohibit them from making any copies of
173
- your copyrighted material outside their relationship with you.
174
-
175
- Conveying under any other circumstances is permitted solely under
176
- the conditions stated below. Sublicensing is not allowed; section 10
177
- makes it unnecessary.
178
-
179
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180
-
181
- No covered work shall be deemed part of an effective technological
182
- measure under any applicable law fulfilling obligations under article
183
- 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184
- similar laws prohibiting or restricting circumvention of such
185
- measures.
186
-
187
- When you convey a covered work, you waive any legal power to forbid
188
- circumvention of technological measures to the extent such circumvention
189
- is effected by exercising rights under this License with respect to
190
- the covered work, and you disclaim any intention to limit operation or
191
- modification of the work as a means of enforcing, against the work's
192
- users, your or third parties' legal rights to forbid circumvention of
193
- technological measures.
194
-
195
- 4. Conveying Verbatim Copies.
196
-
197
- You may convey verbatim copies of the Program's source code as you
198
- receive it, in any medium, provided that you conspicuously and
199
- appropriately publish on each copy an appropriate copyright notice;
200
- keep intact all notices stating that this License and any
201
- non-permissive terms added in accord with section 7 apply to the code;
202
- keep intact all notices of the absence of any warranty; and give all
203
- recipients a copy of this License along with the Program.
204
-
205
- You may charge any price or no price for each copy that you convey,
206
- and you may offer support or warranty protection for a fee.
207
-
208
- 5. Conveying Modified Source Versions.
209
-
210
- You may convey a work based on the Program, or the modifications to
211
- produce it from the Program, in the form of source code under the
212
- terms of section 4, provided that you also meet all of these conditions:
213
-
214
- a) The work must carry prominent notices stating that you modified
215
- it, and giving a relevant date.
216
-
217
- b) The work must carry prominent notices stating that it is
218
- released under this License and any conditions added under section
219
- 7. This requirement modifies the requirement in section 4 to
220
- "keep intact all notices".
221
-
222
- c) You must license the entire work, as a whole, under this
223
- License to anyone who comes into possession of a copy. This
224
- License will therefore apply, along with any applicable section 7
225
- additional terms, to the whole of the work, and all its parts,
226
- regardless of how they are packaged. This License gives no
227
- permission to license the work in any other way, but it does not
228
- invalidate such permission if you have separately received it.
229
-
230
- d) If the work has interactive user interfaces, each must display
231
- Appropriate Legal Notices; however, if the Program has interactive
232
- interfaces that do not display Appropriate Legal Notices, your
233
- work need not make them do so.
234
-
235
- A compilation of a covered work with other separate and independent
236
- works, which are not by their nature extensions of the covered work,
237
- and which are not combined with it such as to form a larger program,
238
- in or on a volume of a storage or distribution medium, is called an
239
- "aggregate" if the compilation and its resulting copyright are not
240
- used to limit the access or legal rights of the compilation's users
241
- beyond what the individual works permit. Inclusion of a covered work
242
- in an aggregate does not cause this License to apply to the other
243
- parts of the aggregate.
244
-
245
- 6. Conveying Non-Source Forms.
246
-
247
- You may convey a covered work in object code form under the terms
248
- of sections 4 and 5, provided that you also convey the
249
- machine-readable Corresponding Source under the terms of this License,
250
- in one of these ways:
251
-
252
- a) Convey the object code in, or embodied in, a physical product
253
- (including a physical distribution medium), accompanied by the
254
- Corresponding Source fixed on a durable physical medium
255
- customarily used for software interchange.
256
-
257
- b) Convey the object code in, or embodied in, a physical product
258
- (including a physical distribution medium), accompanied by a
259
- written offer, valid for at least three years and valid for as
260
- long as you offer spare parts or customer support for that product
261
- model, to give anyone who possesses the object code either (1) a
262
- copy of the Corresponding Source for all the software in the
263
- product that is covered by this License, on a durable physical
264
- medium customarily used for software interchange, for a price no
265
- more than your reasonable cost of physically performing this
266
- conveying of source, or (2) access to copy the
267
- Corresponding Source from a network server at no charge.
268
-
269
- c) Convey individual copies of the object code with a copy of the
270
- written offer to provide the Corresponding Source. This
271
- alternative is allowed only occasionally and noncommercially, and
272
- only if you received the object code with such an offer, in accord
273
- with subsection 6b.
274
-
275
- d) Convey the object code by offering access from a designated
276
- place (gratis or for a charge), and offer equivalent access to the
277
- Corresponding Source in the same way through the same place at no
278
- further charge. You need not require recipients to copy the
279
- Corresponding Source along with the object code. If the place to
280
- copy the object code is a network server, the Corresponding Source
281
- may be on a different server (operated by you or a third party)
282
- that supports equivalent copying facilities, provided you maintain
283
- clear directions next to the object code saying where to find the
284
- Corresponding Source. Regardless of what server hosts the
285
- Corresponding Source, you remain obligated to ensure that it is
286
- available for as long as needed to satisfy these requirements.
287
-
288
- e) Convey the object code using peer-to-peer transmission, provided
289
- you inform other peers where the object code and Corresponding
290
- Source of the work are being offered to the general public at no
291
- charge under subsection 6d.
292
-
293
- A separable portion of the object code, whose source code is excluded
294
- from the Corresponding Source as a System Library, need not be
295
- included in conveying the object code work.
296
-
297
- A "User Product" is either (1) a "consumer product", which means any
298
- tangible personal property which is normally used for personal, family,
299
- or household purposes, or (2) anything designed or sold for incorporation
300
- into a dwelling. In determining whether a product is a consumer product,
301
- doubtful cases shall be resolved in favor of coverage. For a particular
302
- product received by a particular user, "normally used" refers to a
303
- typical or common use of that class of product, regardless of the status
304
- of the particular user or of the way in which the particular user
305
- actually uses, or expects or is expected to use, the product. A product
306
- is a consumer product regardless of whether the product has substantial
307
- commercial, industrial or non-consumer uses, unless such uses represent
308
- the only significant mode of use of the product.
309
-
310
- "Installation Information" for a User Product means any methods,
311
- procedures, authorization keys, or other information required to install
312
- and execute modified versions of a covered work in that User Product from
313
- a modified version of its Corresponding Source. The information must
314
- suffice to ensure that the continued functioning of the modified object
315
- code is in no case prevented or interfered with solely because
316
- modification has been made.
317
-
318
- If you convey an object code work under this section in, or with, or
319
- specifically for use in, a User Product, and the conveying occurs as
320
- part of a transaction in which the right of possession and use of the
321
- User Product is transferred to the recipient in perpetuity or for a
322
- fixed term (regardless of how the transaction is characterized), the
323
- Corresponding Source conveyed under this section must be accompanied
324
- by the Installation Information. But this requirement does not apply
325
- if neither you nor any third party retains the ability to install
326
- modified object code on the User Product (for example, the work has
327
- been installed in ROM).
328
-
329
- The requirement to provide Installation Information does not include a
330
- requirement to continue to provide support service, warranty, or updates
331
- for a work that has been modified or installed by the recipient, or for
332
- the User Product in which it has been modified or installed. Access to a
333
- network may be denied when the modification itself materially and
334
- adversely affects the operation of the network or violates the rules and
335
- protocols for communication across the network.
336
-
337
- Corresponding Source conveyed, and Installation Information provided,
338
- in accord with this section must be in a format that is publicly
339
- documented (and with an implementation available to the public in
340
- source code form), and must require no special password or key for
341
- unpacking, reading or copying.
342
-
343
- 7. Additional Terms.
344
-
345
- "Additional permissions" are terms that supplement the terms of this
346
- License by making exceptions from one or more of its conditions.
347
- Additional permissions that are applicable to the entire Program shall
348
- be treated as though they were included in this License, to the extent
349
- that they are valid under applicable law. If additional permissions
350
- apply only to part of the Program, that part may be used separately
351
- under those permissions, but the entire Program remains governed by
352
- this License without regard to the additional permissions.
353
-
354
- When you convey a copy of a covered work, you may at your option
355
- remove any additional permissions from that copy, or from any part of
356
- it. (Additional permissions may be written to require their own
357
- removal in certain cases when you modify the work.) You may place
358
- additional permissions on material, added by you to a covered work,
359
- for which you have or can give appropriate copyright permission.
360
-
361
- Notwithstanding any other provision of this License, for material you
362
- add to a covered work, you may (if authorized by the copyright holders of
363
- that material) supplement the terms of this License with terms:
364
-
365
- a) Disclaiming warranty or limiting liability differently from the
366
- terms of sections 15 and 16 of this License; or
367
-
368
- b) Requiring preservation of specified reasonable legal notices or
369
- author attributions in that material or in the Appropriate Legal
370
- Notices displayed by works containing it; or
371
-
372
- c) Prohibiting misrepresentation of the origin of that material, or
373
- requiring that modified versions of such material be marked in
374
- reasonable ways as different from the original version; or
375
-
376
- d) Limiting the use for publicity purposes of names of licensors or
377
- authors of the material; or
378
-
379
- e) Declining to grant rights under trademark law for use of some
380
- trade names, trademarks, or service marks; or
381
-
382
- f) Requiring indemnification of licensors and authors of that
383
- material by anyone who conveys the material (or modified versions of
384
- it) with contractual assumptions of liability to the recipient, for
385
- any liability that these contractual assumptions directly impose on
386
- those licensors and authors.
387
-
388
- All other non-permissive additional terms are considered "further
389
- restrictions" within the meaning of section 10. If the Program as you
390
- received it, or any part of it, contains a notice stating that it is
391
- governed by this License along with a term that is a further
392
- restriction, you may remove that term. If a license document contains
393
- a further restriction but permits relicensing or conveying under this
394
- License, you may add to a covered work material governed by the terms
395
- of that license document, provided that the further restriction does
396
- not survive such relicensing or conveying.
397
-
398
- If you add terms to a covered work in accord with this section, you
399
- must place, in the relevant source files, a statement of the
400
- additional terms that apply to those files, or a notice indicating
401
- where to find the applicable terms.
402
-
403
- Additional terms, permissive or non-permissive, may be stated in the
404
- form of a separately written license, or stated as exceptions;
405
- the above requirements apply either way.
406
-
407
- 8. Termination.
408
-
409
- You may not propagate or modify a covered work except as expressly
410
- provided under this License. Any attempt otherwise to propagate or
411
- modify it is void, and will automatically terminate your rights under
412
- this License (including any patent licenses granted under the third
413
- paragraph of section 11).
414
-
415
- However, if you cease all violation of this License, then your
416
- license from a particular copyright holder is reinstated (a)
417
- provisionally, unless and until the copyright holder explicitly and
418
- finally terminates your license, and (b) permanently, if the copyright
419
- holder fails to notify you of the violation by some reasonable means
420
- prior to 60 days after the cessation.
421
-
422
- Moreover, your license from a particular copyright holder is
423
- reinstated permanently if the copyright holder notifies you of the
424
- violation by some reasonable means, this is the first time you have
425
- received notice of violation of this License (for any work) from that
426
- copyright holder, and you cure the violation prior to 30 days after
427
- your receipt of the notice.
428
-
429
- Termination of your rights under this section does not terminate the
430
- licenses of parties who have received copies or rights from you under
431
- this License. If your rights have been terminated and not permanently
432
- reinstated, you do not qualify to receive new licenses for the same
433
- material under section 10.
434
-
435
- 9. Acceptance Not Required for Having Copies.
436
-
437
- You are not required to accept this License in order to receive or
438
- run a copy of the Program. Ancillary propagation of a covered work
439
- occurring solely as a consequence of using peer-to-peer transmission
440
- to receive a copy likewise does not require acceptance. However,
441
- nothing other than this License grants you permission to propagate or
442
- modify any covered work. These actions infringe copyright if you do
443
- not accept this License. Therefore, by modifying or propagating a
444
- covered work, you indicate your acceptance of this License to do so.
445
-
446
- 10. Automatic Licensing of Downstream Recipients.
447
-
448
- Each time you convey a covered work, the recipient automatically
449
- receives a license from the original licensors, to run, modify and
450
- propagate that work, subject to this License. You are not responsible
451
- for enforcing compliance by third parties with this License.
452
-
453
- An "entity transaction" is a transaction transferring control of an
454
- organization, or substantially all assets of one, or subdividing an
455
- organization, or merging organizations. If propagation of a covered
456
- work results from an entity transaction, each party to that
457
- transaction who receives a copy of the work also receives whatever
458
- licenses to the work the party's predecessor in interest had or could
459
- give under the previous paragraph, plus a right to possession of the
460
- Corresponding Source of the work from the predecessor in interest, if
461
- the predecessor has it or can get it with reasonable efforts.
462
-
463
- You may not impose any further restrictions on the exercise of the
464
- rights granted or affirmed under this License. For example, you may
465
- not impose a license fee, royalty, or other charge for exercise of
466
- rights granted under this License, and you may not initiate litigation
467
- (including a cross-claim or counterclaim in a lawsuit) alleging that
468
- any patent claim is infringed by making, using, selling, offering for
469
- sale, or importing the Program or any portion of it.
470
-
471
- 11. Patents.
472
-
473
- A "contributor" is a copyright holder who authorizes use under this
474
- License of the Program or a work on which the Program is based. The
475
- work thus licensed is called the contributor's "contributor version".
476
-
477
- A contributor's "essential patent claims" are all patent claims
478
- owned or controlled by the contributor, whether already acquired or
479
- hereafter acquired, that would be infringed by some manner, permitted
480
- by this License, of making, using, or selling its contributor version,
481
- but do not include claims that would be infringed only as a
482
- consequence of further modification of the contributor version. For
483
- purposes of this definition, "control" includes the right to grant
484
- patent sublicenses in a manner consistent with the requirements of
485
- this License.
486
-
487
- Each contributor grants you a non-exclusive, worldwide, royalty-free
488
- patent license under the contributor's essential patent claims, to
489
- make, use, sell, offer for sale, import and otherwise run, modify and
490
- propagate the contents of its contributor version.
491
-
492
- In the following three paragraphs, a "patent license" is any express
493
- agreement or commitment, however denominated, not to enforce a patent
494
- (such as an express permission to practice a patent or covenant not to
495
- sue for patent infringement). To "grant" such a patent license to a
496
- party means to make such an agreement or commitment not to enforce a
497
- patent against the party.
498
-
499
- If you convey a covered work, knowingly relying on a patent license,
500
- and the Corresponding Source of the work is not available for anyone
501
- to copy, free of charge and under the terms of this License, through a
502
- publicly available network server or other readily accessible means,
503
- then you must either (1) cause the Corresponding Source to be so
504
- available, or (2) arrange to deprive yourself of the benefit of the
505
- patent license for this particular work, or (3) arrange, in a manner
506
- consistent with the requirements of this License, to extend the patent
507
- license to downstream recipients. "Knowingly relying" means you have
508
- actual knowledge that, but for the patent license, your conveying the
509
- covered work in a country, or your recipient's use of the covered work
510
- in a country, would infringe one or more identifiable patents in that
511
- country that you have reason to believe are valid.
512
-
513
- If, pursuant to or in connection with a single transaction or
514
- arrangement, you convey, or propagate by procuring conveyance of, a
515
- covered work, and grant a patent license to some of the parties
516
- receiving the covered work authorizing them to use, propagate, modify
517
- or convey a specific copy of the covered work, then the patent license
518
- you grant is automatically extended to all recipients of the covered
519
- work and works based on it.
520
-
521
- A patent license is "discriminatory" if it does not include within
522
- the scope of its coverage, prohibits the exercise of, or is
523
- conditioned on the non-exercise of one or more of the rights that are
524
- specifically granted under this License. You may not convey a covered
525
- work if you are a party to an arrangement with a third party that is
526
- in the business of distributing software, under which you make payment
527
- to the third party based on the extent of your activity of conveying
528
- the work, and under which the third party grants, to any of the
529
- parties who would receive the covered work from you, a discriminatory
530
- patent license (a) in connection with copies of the covered work
531
- conveyed by you (or copies made from those copies), or (b) primarily
532
- for and in connection with specific products or compilations that
533
- contain the covered work, unless you entered into that arrangement,
534
- or that patent license was granted, prior to 28 March 2007.
535
-
536
- Nothing in this License shall be construed as excluding or limiting
537
- any implied license or other defenses to infringement that may
538
- otherwise be available to you under applicable patent law.
539
-
540
- 12. No Surrender of Others' Freedom.
541
-
542
- If conditions are imposed on you (whether by court order, agreement or
543
- otherwise) that contradict the conditions of this License, they do not
544
- excuse you from the conditions of this License. If you cannot convey a
545
- covered work so as to satisfy simultaneously your obligations under this
546
- License and any other pertinent obligations, then as a consequence you may
547
- not convey it at all. For example, if you agree to terms that obligate you
548
- to collect a royalty for further conveying from those to whom you convey
549
- the Program, the only way you could satisfy both those terms and this
550
- License would be to refrain entirely from conveying the Program.
551
-
552
- 13. Use with the GNU Affero General Public License.
553
-
554
- Notwithstanding any other provision of this License, you have
555
- permission to link or combine any covered work with a work licensed
556
- under version 3 of the GNU Affero General Public License into a single
557
- combined work, and to convey the resulting work. The terms of this
558
- License will continue to apply to the part which is the covered work,
559
- but the special requirements of the GNU Affero General Public License,
560
- section 13, concerning interaction through a network will apply to the
561
- combination as such.
562
-
563
- 14. Revised Versions of this License.
564
-
565
- The Free Software Foundation may publish revised and/or new versions of
566
- the GNU General Public License from time to time. Such new versions will
567
- be similar in spirit to the present version, but may differ in detail to
568
- address new problems or concerns.
569
-
570
- Each version is given a distinguishing version number. If the
571
- Program specifies that a certain numbered version of the GNU General
572
- Public License "or any later version" applies to it, you have the
573
- option of following the terms and conditions either of that numbered
574
- version or of any later version published by the Free Software
575
- Foundation. If the Program does not specify a version number of the
576
- GNU General Public License, you may choose any version ever published
577
- by the Free Software Foundation.
578
-
579
- If the Program specifies that a proxy can decide which future
580
- versions of the GNU General Public License can be used, that proxy's
581
- public statement of acceptance of a version permanently authorizes you
582
- to choose that version for the Program.
583
-
584
- Later license versions may give you additional or different
585
- permissions. However, no additional obligations are imposed on any
586
- author or copyright holder as a result of your choosing to follow a
587
- later version.
588
-
589
- 15. Disclaimer of Warranty.
590
-
591
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592
- APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593
- HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594
- OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595
- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596
- PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597
- IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598
- ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599
-
600
- 16. Limitation of Liability.
601
-
602
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603
- WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604
- THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605
- GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606
- USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607
- DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608
- PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609
- EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610
- SUCH DAMAGES.
611
-
612
- 17. Interpretation of Sections 15 and 16.
613
-
614
- If the disclaimer of warranty and limitation of liability provided
615
- above cannot be given local legal effect according to their terms,
616
- reviewing courts shall apply local law that most closely approximates
617
- an absolute waiver of all civil liability in connection with the
618
- Program, unless a warranty or assumption of liability accompanies a
619
- copy of the Program in return for a fee.
620
-
621
- END OF TERMS AND CONDITIONS
622
-
623
- How to Apply These Terms to Your New Programs
624
-
625
- If you develop a new program, and you want it to be of the greatest
626
- possible use to the public, the best way to achieve this is to make it
627
- free software which everyone can redistribute and change under these terms.
628
-
629
- To do so, attach the following notices to the program. It is safest
630
- to attach them to the start of each source file to most effectively
631
- state the exclusion of warranty; and each file should have at least
632
- the "copyright" line and a pointer to where the full notice is found.
633
-
634
- Disqus WordPress Plugin
635
- Copyright (C) 2016 Disqus
636
-
637
- This program is free software: you can redistribute it and/or modify
638
- it under the terms of the GNU General Public License as published by
639
- the Free Software Foundation, either version 3 of the License, or
640
- (at your option) any later version.
641
-
642
- This program is distributed in the hope that it will be useful,
643
- but WITHOUT ANY WARRANTY; without even the implied warranty of
644
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645
- GNU General Public License for more details.
646
-
647
- You should have received a copy of the GNU General Public License
648
- along with this program. If not, see <http://www.gnu.org/licenses/>.
649
-
650
- Also add information on how to contact you by electronic and paper mail.
651
-
652
- If the program does terminal interaction, make it output a short
653
- notice like this when it starts in an interactive mode:
654
-
655
- Disqus WordPress Plugin Copyright (C) 2016 Disqus
656
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657
- This is free software, and you are welcome to redistribute it
658
- under certain conditions; type `show c' for details.
659
-
660
- The hypothetical commands `show w' and `show c' should show the appropriate
661
- parts of the General Public License. Of course, your program's commands
662
- might be different; for a GUI interface, you would use an "about box".
663
-
664
- You should also get your employer (if you work as a programmer) or school,
665
- if any, to sign a "copyright disclaimer" for the program, if necessary.
666
- For more information on this, and how to apply and follow the GNU GPL, see
667
- <http://www.gnu.org/licenses/>.
668
-
669
- The GNU General Public License does not permit incorporating your program
670
- into proprietary programs. If your program is a subroutine library, you
671
- may consider it more useful to permit linking proprietary applications with
672
- the library. If this is what you want to do, use the GNU Lesser General
673
- Public License instead of this License. But first, please read
674
- <http://www.gnu.org/philosophy/why-not-lgpl.html>.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
LICENSE.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.
readme.txt → README.txt RENAMED
@@ -1,17 +1,17 @@
1
  === Disqus Comment System ===
2
  Contributors: disqus, alexkingorg, crowdfavorite, zeeg, tail, thetylerhayes, ryanv12, iamfrancisyo, brevityness
3
  Tags: comments, threaded, email, notification, spam, avatars, community, profile, widget, disqus
4
- Requires at least: 3.2
5
- Tested up to: 4.6.1
6
- Stable tag: 2.87
7
 
8
  Disqus is the web's most popular comment system. Use Disqus to increase engagement, retain readers, and grow your audience.
9
 
10
  == Description ==
11
 
12
- [Disqus](https://disqus.com/) is the web’s most popular commenting system trusted by millions of publishers to increase reader engagement, grow audience and traffic, and monetize content. Disqus helps publishers of all sizes engage directly with their audiences to build loyalty, retain readers, and foster thriving communities.
13
 
14
- The Disqus for WordPress plugin lets site owners and developers easily add Disqus to their sites, replacing the default WordPress comment system. Disqus installs in minutes and imports your existing comments so you don’t lose any.
15
 
16
  = Why Disqus? =
17
 
@@ -48,13 +48,13 @@ The Disqus for WordPress plugin lets site owners and developers easily add Disqu
48
  * Automatic anti-spam filter powered by Akismet
49
  * Automated pre-moderation controls to flag comments based on links, user reputation
50
  * Moderate directly in the discussion, via email, or moderation panel
51
- * Email notifications for newly posted comments, replies
52
  * Moderation Panel that lets you search, filter, sort, and manage your comments
53
  * Self-moderation tools like user blocking, comment flagging
54
 
55
  == Support ==
56
 
57
- * Search our [Knowledge Base](https://help.disqus.com/) for solutions to common troubleshooting questions
58
  * Check out our support community, [Discuss Disqus](https://disqus.com/home/channel/discussdisqus/), to see if your question has been answered
59
  * Talk to our Support team at [disqus.com/support](disqus.com/support)
60
  * Visit our [Getting Started](https://help.disqus.com/customer/en/portal/articles/1264625-getting-started) page to learn the basics of Disqus
@@ -73,7 +73,7 @@ Disqus automatically checks your site's font and background color and adapts to
73
 
74
  The Disqus for WordPress plugin automatically syncs comments back to WordPress. These comments will remain in WordPress should Disqus be deactivated or removed. You can also [export your comments](https://help.disqus.com/customer/en/portal/articles/1104797-importing-exporting#exporting) from Disqus at any time.
75
 
76
- = Can I import my existing WordPress comments into Disqus? =
77
 
78
  Yes, you can import your existing WordPress comments into Disqus during installation.
79
 
@@ -118,9 +118,11 @@ Go to [https://disqus.com/help/wordpress](https://disqus.com/help/wordpress)
118
 
119
  == Changelog ==
120
 
121
- = 2.87 =
122
 
123
- * Version update for readme.txt and plugin directory assets
 
 
124
 
125
  = 2.86 =
126
 
@@ -391,9 +393,3 @@ INSERT INTO `wp_options` (blog_id, option_name, option_value, autoload) VALUES (
391
  * Legacy mode is no longer available.
392
  * The plugin management interface can now be localized.
393
  * The plugin is now valid HTML5.
394
-
395
- == Support ==
396
-
397
- * Visit https://disqus.com/help/wordpress for help documentation.
398
-
399
- * Visit https://help.disqus.com for help from our support team.
1
  === Disqus Comment System ===
2
  Contributors: disqus, alexkingorg, crowdfavorite, zeeg, tail, thetylerhayes, ryanv12, iamfrancisyo, brevityness
3
  Tags: comments, threaded, email, notification, spam, avatars, community, profile, widget, disqus
4
+ Requires at least: 4.4
5
+ Tested up to: 4.9.4
6
+ Stable tag: 3.0.7
7
 
8
  Disqus is the web's most popular comment system. Use Disqus to increase engagement, retain readers, and grow your audience.
9
 
10
  == Description ==
11
 
12
+ [Disqus](https://disqus.com/) is the web’s most popular commenting system trusted by millions of publishers to increase reader engagement, grow audience and traffic, and monetize content. Disqus helps publishers of all sizes engage directly with their audiences to build loyalty, retain readers, and foster thriving communities.
13
 
14
+ The Disqus for WordPress plugin lets site owners and developers easily add Disqus to their sites, replacing the default WordPress comment system. Disqus installs in minutes and automatically imports your existing comments.
15
 
16
  = Why Disqus? =
17
 
48
  * Automatic anti-spam filter powered by Akismet
49
  * Automated pre-moderation controls to flag comments based on links, user reputation
50
  * Moderate directly in the discussion, via email, or moderation panel
51
+ * Email notifications for newly posted comments, replies
52
  * Moderation Panel that lets you search, filter, sort, and manage your comments
53
  * Self-moderation tools like user blocking, comment flagging
54
 
55
  == Support ==
56
 
57
+ * Search our [Knowledge Base](https://help.disqus.com/customer/portal/articles/472005) for solutions to common troubleshooting questions
58
  * Check out our support community, [Discuss Disqus](https://disqus.com/home/channel/discussdisqus/), to see if your question has been answered
59
  * Talk to our Support team at [disqus.com/support](disqus.com/support)
60
  * Visit our [Getting Started](https://help.disqus.com/customer/en/portal/articles/1264625-getting-started) page to learn the basics of Disqus
73
 
74
  The Disqus for WordPress plugin automatically syncs comments back to WordPress. These comments will remain in WordPress should Disqus be deactivated or removed. You can also [export your comments](https://help.disqus.com/customer/en/portal/articles/1104797-importing-exporting#exporting) from Disqus at any time.
75
 
76
+ = Can I import my existing WordPress comments into Disqus? =
77
 
78
  Yes, you can import your existing WordPress comments into Disqus during installation.
79
 
118
 
119
  == Changelog ==
120
 
121
+ = 3.0.7 =
122
 
123
+ * Plugin has been completely rewritten to support modern and secure WordPress features.
124
+ * Added new Automatic Installation for installing Disqus on your site. This also creates the API application required for enabling comment syncing.
125
+ * Completely redesigned plugin settings page. Disqus replaces the Comments menu link in your WordPress admin and includes shortcut links to popular settings.
126
 
127
  = 2.86 =
128
 
393
  * Legacy mode is no longer available.
394
  * The plugin management interface can now be localized.
395
  * The plugin is now valid HTML5.
 
 
 
 
 
 
admin/bundles/js/en.disqus-admin.bundle.3.0.7.min.js ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ !function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=27)}([function(e,t,n){"use strict";e.exports=n(29)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(40),o=n(16),i=n(47);n.d(t,"Provider",function(){return r.b}),n.d(t,"createProvider",function(){return r.a}),n.d(t,"connectAdvanced",function(){return o.a}),n.d(t,"connect",function(){return i.a})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(5),o=n(76),i=n(11),a=["disqus_forum_url","disqus_public_key","disqus_secret_key","disqus_admin_access_token","disqus_sso_button","disqus_sso_enabled","disqus_sync_token"];t.UPDATABLE_FIELDS=a;var u=function(e){var t="checkbox"===e.type;return t?e.checked?"1":"":e.value},s=function(e){var t=function(t){e(r.setMessageAction(null))};return{onCopyText:function(e){try{var t=window.document.getElementById(e);t&&(t.select(),window.document.execCommand("copy"))}catch(e){}},onInputChange:function(t,n){var o=u(n.currentTarget);e(r.updateLocalOptionAction(t,o))},onSubmitExportCommentsForm:function(t){t.preventDefault(),new o.default(e).startExportPosts()},onSubmitSiteForm:function(n){n.preventDefault();var o=a.reduce(function(e,t){if(t in n.currentTarget.elements){var r=n.currentTarget.elements.namedItem(t),o=r,i=u(o);return Object.assign((a={},a[o.name]=i,a),e)}return e;var a},{});i.WordPressRestApi.instance.pluginRestPost("settings",o,function(n){if(n){if("OK"!==n.code)return void e(r.setMessageAction({onDismiss:t,text:n.message,type:"error"}));e(r.updateAdminOptionsAction(n.data)),e(r.setMessageAction({onDismiss:t,text:"Changes saved successfully.",type:"success"}))}})},onSubmitSyncConfigForm:function(n){n.preventDefault();var o=n.currentTarget.name;i.WordPressRestApi.instance.pluginRestPost(o,null,function(n){if(n){if("OK"!==n.code)return void e(r.setMessageAction({onDismiss:t,text:n.message,type:"error"}));e(r.updateSyncStatusAction(n.data)),e(r.setMessageAction({onDismiss:t,text:"Changes saved successfully.",type:"success"}))}})},onToggleState:function(t){e(r.toggleValueAction(t))},onUpdateInstallationState:function(t){e(r.changeInstallStateAction(t))}}};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e){return{data:e}};t.default=r},function(e,t,n){"use strict";function r(e){return function(){return e}}var o=function(){};o.thatReturns=r,o.thatReturnsFalse=r(!1),o.thatReturnsTrue=r(!0),o.thatReturnsNull=r(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},e.exports=o},function(e,t,n){"use strict";function r(e){return{data:e,type:t.UPDATE_ADMIN_OPTIONS}}function o(e,n){return{data:(r={},r[e]=n,r),type:t.UPDATE_LOCAL_OPTION};var r}function i(e){return{data:e,type:t.UPDATE_SYNC_STATUS}}function a(e){return{data:e,type:t.TOGGLE_VALUE}}function u(e,n){return{data:(r={},r[e]=n,r),type:t.SET_VALUE};var r}function s(e){return{data:e,type:t.SET_MESSAGE}}function l(e){return{data:e,type:t.CHANGE_INSTALL_STATE}}function c(e){return{data:e,type:t.CHANGE_TAB_STATE}}function f(e){return{data:e,type:t.UPDATE_EXPORT_POST_LOG}}Object.defineProperty(t,"__esModule",{value:!0}),t.UPDATE_ADMIN_OPTIONS="UPDATE_ADMIN_OPTIONS",t.UPDATE_SYNC_STATUS="UPDATE_SYNC_STATUS",t.TOGGLE_VALUE="TOGGLE_VALUE",t.SET_VALUE="SET_VALUE",t.UPDATE_LOCAL_OPTION="UPDATE_LOCAL_OPTION",t.SET_MESSAGE="SET_MESSAGE",t.CHANGE_INSTALL_STATE="CHANGE_INSTALL_STATE",t.CHANGE_TAB_STATE="CHANGE_TAB_STATE",t.UPDATE_EXPORT_POST_LOG="UPDATE_EXPORT_POST_LOG",t.updateAdminOptionsAction=r,t.updateLocalOptionAction=o,t.updateSyncStatusAction=i,t.toggleValueAction=a,t.setValueAction=u,t.setMessageAction=s,t.changeInstallStateAction=l,t.changeTabStateAction=c,t.updateExportPostLogAction=f},function(e,t,n){"use strict";var r=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(t,"__esModule",{value:!0});var o,i=n(10),a=n(74),u=n(75);!function(e){e[e.none=0]="none",e[e.noAccount=1]="noAccount",e[e.hasAccount=2]="hasAccount",e[e.noSite=3]="noSite",e[e.hasSite=4]="hasSite",e[e.installed=5]="installed"}(o=t.InstallationState||(t.InstallationState={}));!function(e){e[e.pending=0]="pending",e[e.complete=1]="complete",e[e.failed=2]="failed"}(t.ExportLogStaus||(t.ExportLogStaus={}));var s=function(e){function t(t){return e.call(this,{adminOptions:new a.default,config:t,exportLogs:i.Map(),localAdminOptions:new a.default,syncStatus:new u.default})||this}return r(t,e),t.prototype.set=function(t,n){return e.prototype.set.call(this,t,n)},t.prototype.with=function(e){return this.merge(e)},t}(i.Record({activeTab:null,adminOptions:null,config:null,exportLogs:null,installationState:o.none,isExportRunning:!1,isFetchingAdminOptions:!1,isFetchingSyncStatus:!1,isSiteFormLocked:!0,localAdminOptions:null,message:null,syncStatus:null}));t.default=s},function(e,t,n){"use strict";function r(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e);try{throw new Error(e)}catch(e){}}t.a=r},function(e,t,n){"use strict";function r(e){if(!Object(a.a)(e)||Object(o.a)(e)!=u)return!1;var t=Object(i.a)(e);if(null===t)return!0;var n=f.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&c.call(n)==p}var o=n(50),i=n(55),a=n(57),u="[object Object]",s=Function.prototype,l=Object.prototype,c=s.toString,f=l.hasOwnProperty,p=c.call(Object);t.a=r},function(e,t,n){"use strict";function r(e){return window.DISQUS_WP.adminUrls[e]}function o(e,t){return"https://"+e+".disqus.com/admin/"+t+"/"}Object.defineProperty(t,"__esModule",{value:!0}),t.getWordpressAdminUrl=r,t.getForumAdminUrl=o},function(e,t,n){!function(t,n){e.exports=n()}(0,function(){"use strict";function e(e,t){t&&(e.prototype=Object.create(t.prototype)),e.prototype.constructor=e}function t(e){return i(e)?e:P(e)}function n(e){return a(e)?e:I(e)}function r(e){return u(e)?e:N(e)}function o(e){return i(e)&&!s(e)?e:A(e)}function i(e){return!(!e||!e[ln])}function a(e){return!(!e||!e[cn])}function u(e){return!(!e||!e[fn])}function s(e){return a(e)||u(e)}function l(e){return!(!e||!e[pn])}function c(e){return e.value=!1,e}function f(e){e&&(e.value=!0)}function p(){}function d(e,t){t=t||0;for(var n=Math.max(0,e.length-t),r=new Array(n),o=0;o<n;o++)r[o]=e[o+t];return r}function h(e){return void 0===e.size&&(e.size=e.__iterate(y)),e.size}function m(e,t){if("number"!=typeof t){var n=t>>>0;if(""+n!==t||4294967295===n)return NaN;t=n}return t<0?h(e)+t:t}function y(){return!0}function v(e,t,n){return(0===e||void 0!==n&&e<=-n)&&(void 0===t||void 0!==n&&t>=n)}function g(e,t){return b(e,t,0)}function _(e,t){return b(e,t,t)}function b(e,t,n){return void 0===e?n:e<0?Math.max(0,t+e):void 0===t?e:Math.min(t,e)}function E(e){this.next=e}function w(e,t,n,r){var o=0===e?t:1===e?n:[t,n];return r?r.value=o:r={value:o,done:!1},r}function S(){return{value:void 0,done:!0}}function C(e){return!!x(e)}function k(e){return e&&"function"==typeof e.next}function O(e){var t=x(e);return t&&t.call(e)}function x(e){var t=e&&(wn&&e[wn]||e[Sn]);if("function"==typeof t)return t}function T(e){return e&&"number"==typeof e.length}function P(e){return null===e||void 0===e?U():i(e)?e.toSeq():F(e)}function I(e){return null===e||void 0===e?U().toKeyedSeq():i(e)?a(e)?e.toSeq():e.fromEntrySeq():z(e)}function N(e){return null===e||void 0===e?U():i(e)?a(e)?e.entrySeq():e.toIndexedSeq():L(e)}function A(e){return(null===e||void 0===e?U():i(e)?a(e)?e.entrySeq():e:L(e)).toSetSeq()}function D(e){this._array=e,this.size=e.length}function M(e){var t=Object.keys(e);this._object=e,this._keys=t,this.size=t.length}function R(e){this._iterable=e,this.size=e.length||e.size}function q(e){this._iterator=e,this._iteratorCache=[]}function j(e){return!(!e||!e[kn])}function U(){return On||(On=new D([]))}function z(e){var t=Array.isArray(e)?new D(e).fromEntrySeq():k(e)?new q(e).fromEntrySeq():C(e)?new R(e).fromEntrySeq():"object"==typeof e?new M(e):void 0;if(!t)throw new TypeError("Expected Array or iterable object of [k, v] entries, or keyed object: "+e);return t}function L(e){var t=H(e);if(!t)throw new TypeError("Expected Array or iterable object of values: "+e);return t}function F(e){var t=H(e)||"object"==typeof e&&new M(e);if(!t)throw new TypeError("Expected Array or iterable object of values, or keyed object: "+e);return t}function H(e){return T(e)?new D(e):k(e)?new q(e):C(e)?new R(e):void 0}function V(e,t,n,r){var o=e._cache;if(o){for(var i=o.length-1,a=0;a<=i;a++){var u=o[n?i-a:a];if(!1===t(u[1],r?u[0]:a,e))return a+1}return a}return e.__iterateUncached(t,n)}function B(e,t,n,r){var o=e._cache;if(o){var i=o.length-1,a=0;return new E(function(){var e=o[n?i-a:a];return a++>i?S():w(t,r?e[0]:a-1,e[1])})}return e.__iteratorUncached(t,n)}function K(e,t){return t?W(t,e,"",{"":e}):G(e)}function W(e,t,n,r){return Array.isArray(t)?e.call(r,n,N(t).map(function(n,r){return W(e,n,r,t)})):Q(t)?e.call(r,n,I(t).map(function(n,r){return W(e,n,r,t)})):t}function G(e){return Array.isArray(e)?N(e).map(G).toList():Q(e)?I(e).map(G).toMap():e}function Q(e){return e&&(e.constructor===Object||void 0===e.constructor)}function Y(e,t){if(e===t||e!==e&&t!==t)return!0;if(!e||!t)return!1;if("function"==typeof e.valueOf&&"function"==typeof t.valueOf){if(e=e.valueOf(),t=t.valueOf(),e===t||e!==e&&t!==t)return!0;if(!e||!t)return!1}return!("function"!=typeof e.equals||"function"!=typeof t.equals||!e.equals(t))}function $(e,t){if(e===t)return!0;if(!i(t)||void 0!==e.size&&void 0!==t.size&&e.size!==t.size||void 0!==e.__hash&&void 0!==t.__hash&&e.__hash!==t.__hash||a(e)!==a(t)||u(e)!==u(t)||l(e)!==l(t))return!1;if(0===e.size&&0===t.size)return!0;var n=!s(e);if(l(e)){var r=e.entries();return t.every(function(e,t){var o=r.next().value;return o&&Y(o[1],e)&&(n||Y(o[0],t))})&&r.next().done}var o=!1;if(void 0===e.size)if(void 0===t.size)"function"==typeof e.cacheResult&&e.cacheResult();else{o=!0;var c=e;e=t,t=c}var f=!0,p=t.__iterate(function(t,r){if(n?!e.has(t):o?!Y(t,e.get(r,yn)):!Y(e.get(r,yn),t))return f=!1,!1});return f&&e.size===p}function J(e,t){if(!(this instanceof J))return new J(e,t);if(this._value=e,this.size=void 0===t?1/0:Math.max(0,t),0===this.size){if(xn)return xn;xn=this}}function X(e,t){if(!e)throw new Error(t)}function Z(e,t,n){if(!(this instanceof Z))return new Z(e,t,n);if(X(0!==n,"Cannot step a Range by 0"),e=e||0,void 0===t&&(t=1/0),n=void 0===n?1:Math.abs(n),t<e&&(n=-n),this._start=e,this._end=t,this._step=n,this.size=Math.max(0,Math.ceil((t-e)/n-1)+1),0===this.size){if(Tn)return Tn;Tn=this}}function ee(){throw TypeError("Abstract")}function te(){}function ne(){}function re(){}function oe(e){return e>>>1&1073741824|3221225471&e}function ie(e){if(!1===e||null===e||void 0===e)return 0;if("function"==typeof e.valueOf&&(!1===(e=e.valueOf())||null===e||void 0===e))return 0;if(!0===e)return 1;var t=typeof e;if("number"===t){if(e!==e||e===1/0)return 0;var n=0|e;for(n!==e&&(n^=4294967295*e);e>4294967295;)e/=4294967295,n^=e;return oe(n)}if("string"===t)return e.length>qn?ae(e):ue(e);if("function"==typeof e.hashCode)return e.hashCode();if("object"===t)return se(e);if("function"==typeof e.toString)return ue(e.toString());throw new Error("Value type "+t+" cannot be hashed.")}function ae(e){var t=zn[e];return void 0===t&&(t=ue(e),Un===jn&&(Un=0,zn={}),Un++,zn[e]=t),t}function ue(e){for(var t=0,n=0;n<e.length;n++)t=31*t+e.charCodeAt(n)|0;return oe(t)}function se(e){var t;if(Dn&&void 0!==(t=Pn.get(e)))return t;if(void 0!==(t=e[Rn]))return t;if(!An){if(void 0!==(t=e.propertyIsEnumerable&&e.propertyIsEnumerable[Rn]))return t;if(void 0!==(t=le(e)))return t}if(t=++Mn,1073741824&Mn&&(Mn=0),Dn)Pn.set(e,t);else{if(void 0!==Nn&&!1===Nn(e))throw new Error("Non-extensible objects are not allowed as keys.");if(An)Object.defineProperty(e,Rn,{enumerable:!1,configurable:!1,writable:!1,value:t});else if(void 0!==e.propertyIsEnumerable&&e.propertyIsEnumerable===e.constructor.prototype.propertyIsEnumerable)e.propertyIsEnumerable=function(){return this.constructor.prototype.propertyIsEnumerable.apply(this,arguments)},e.propertyIsEnumerable[Rn]=t;else{if(void 0===e.nodeType)throw new Error("Unable to set a non-enumerable property on object.");e[Rn]=t}}return t}function le(e){if(e&&e.nodeType>0)switch(e.nodeType){case 1:return e.uniqueID;case 9:return e.documentElement&&e.documentElement.uniqueID}}function ce(e){X(e!==1/0,"Cannot perform this action with an infinite size.")}function fe(e){return null===e||void 0===e?we():pe(e)&&!l(e)?e:we().withMutations(function(t){var r=n(e);ce(r.size),r.forEach(function(e,n){return t.set(n,e)})})}function pe(e){return!(!e||!e[Ln])}function de(e,t){this.ownerID=e,this.entries=t}function he(e,t,n){this.ownerID=e,this.bitmap=t,this.nodes=n}function me(e,t,n){this.ownerID=e,this.count=t,this.nodes=n}function ye(e,t,n){this.ownerID=e,this.keyHash=t,this.entries=n}function ve(e,t,n){this.ownerID=e,this.keyHash=t,this.entry=n}function ge(e,t,n){this._type=t,this._reverse=n,this._stack=e._root&&be(e._root)}function _e(e,t){return w(e,t[0],t[1])}function be(e,t){return{node:e,index:0,__prev:t}}function Ee(e,t,n,r){var o=Object.create(Fn);return o.size=e,o._root=t,o.__ownerID=n,o.__hash=r,o.__altered=!1,o}function we(){return Hn||(Hn=Ee(0))}function Se(e,t,n){var r,o;if(e._root){var i=c(vn),a=c(gn);if(r=Ce(e._root,e.__ownerID,0,void 0,t,n,i,a),!a.value)return e;o=e.size+(i.value?n===yn?-1:1:0)}else{if(n===yn)return e;o=1,r=new de(e.__ownerID,[[t,n]])}return e.__ownerID?(e.size=o,e._root=r,e.__hash=void 0,e.__altered=!0,e):r?Ee(o,r):we()}function Ce(e,t,n,r,o,i,a,u){return e?e.update(t,n,r,o,i,a,u):i===yn?e:(f(u),f(a),new ve(t,r,[o,i]))}function ke(e){return e.constructor===ve||e.constructor===ye}function Oe(e,t,n,r,o){if(e.keyHash===r)return new ye(t,r,[e.entry,o]);var i,a=(0===n?e.keyHash:e.keyHash>>>n)&mn,u=(0===n?r:r>>>n)&mn;return new he(t,1<<a|1<<u,a===u?[Oe(e,t,n+dn,r,o)]:(i=new ve(t,r,o),a<u?[e,i]:[i,e]))}function xe(e,t,n,r){e||(e=new p);for(var o=new ve(e,ie(n),[n,r]),i=0;i<t.length;i++){var a=t[i];o=o.update(e,0,void 0,a[0],a[1])}return o}function Te(e,t,n,r){for(var o=0,i=0,a=new Array(n),u=0,s=1,l=t.length;u<l;u++,s<<=1){var c=t[u];void 0!==c&&u!==r&&(o|=s,a[i++]=c)}return new he(e,o,a)}function Pe(e,t,n,r,o){for(var i=0,a=new Array(hn),u=0;0!==n;u++,n>>>=1)a[u]=1&n?t[i++]:void 0;return a[r]=o,new me(e,i+1,a)}function Ie(e,t,r){for(var o=[],a=0;a<r.length;a++){var u=r[a],s=n(u);i(u)||(s=s.map(function(e){return K(e)})),o.push(s)}return De(e,t,o)}function Ne(e,t,n){return e&&e.mergeDeep&&i(t)?e.mergeDeep(t):Y(e,t)?e:t}function Ae(e){return function(t,n,r){if(t&&t.mergeDeepWith&&i(n))return t.mergeDeepWith(e,n);var o=e(t,n,r);return Y(t,o)?t:o}}function De(e,t,n){return n=n.filter(function(e){return 0!==e.size}),0===n.length?e:0!==e.size||e.__ownerID||1!==n.length?e.withMutations(function(e){for(var r=t?function(n,r){e.update(r,yn,function(e){return e===yn?n:t(e,n,r)})}:function(t,n){e.set(n,t)},o=0;o<n.length;o++)n[o].forEach(r)}):e.constructor(n[0])}function Me(e,t,n,r){var o=e===yn,i=t.next();if(i.done){var a=o?n:e,u=r(a);return u===a?e:u}X(o||e&&e.set,"invalid keyPath");var s=i.value,l=o?yn:e.get(s,yn),c=Me(l,t,n,r);return c===l?e:c===yn?e.remove(s):(o?we():e).set(s,c)}function Re(e){return e-=e>>1&1431655765,e=(858993459&e)+(e>>2&858993459),e=e+(e>>4)&252645135,e+=e>>8,127&(e+=e>>16)}function qe(e,t,n,r){var o=r?e:d(e);return o[t]=n,o}function je(e,t,n,r){var o=e.length+1;if(r&&t+1===o)return e[t]=n,e;for(var i=new Array(o),a=0,u=0;u<o;u++)u===t?(i[u]=n,a=-1):i[u]=e[u+a];return i}function Ue(e,t,n){var r=e.length-1;if(n&&t===r)return e.pop(),e;for(var o=new Array(r),i=0,a=0;a<r;a++)a===t&&(i=1),o[a]=e[a+i];return o}function ze(e){var t=Be();if(null===e||void 0===e)return t;if(Le(e))return e;var n=r(e),o=n.size;return 0===o?t:(ce(o),o>0&&o<hn?Ve(0,o,dn,null,new Fe(n.toArray())):t.withMutations(function(e){e.setSize(o),n.forEach(function(t,n){return e.set(n,t)})}))}function Le(e){return!(!e||!e[Wn])}function Fe(e,t){this.array=e,this.ownerID=t}function He(e,t){function n(e,t,n){return 0===t?r(e,n):o(e,t,n)}function r(e,n){var r=n===u?s&&s.array:e&&e.array,o=n>i?0:i-n,l=a-n;return l>hn&&(l=hn),function(){if(o===l)return Yn;var e=t?--l:o++;return r&&r[e]}}function o(e,r,o){var u,s=e&&e.array,l=o>i?0:i-o>>r,c=1+(a-o>>r);return c>hn&&(c=hn),function(){for(;;){if(u){var e=u();if(e!==Yn)return e;u=null}if(l===c)return Yn;var i=t?--c:l++;u=n(s&&s[i],r-dn,o+(i<<r))}}}var i=e._origin,a=e._capacity,u=Je(a),s=e._tail;return n(e._root,e._level,0)}function Ve(e,t,n,r,o,i,a){var u=Object.create(Gn);return u.size=t-e,u._origin=e,u._capacity=t,u._level=n,u._root=r,u._tail=o,u.__ownerID=i,u.__hash=a,u.__altered=!1,u}function Be(){return Qn||(Qn=Ve(0,0,dn))}function Ke(e,t,n){if((t=m(e,t))!==t)return e;if(t>=e.size||t<0)return e.withMutations(function(e){t<0?Ye(e,t).set(0,n):Ye(e,0,t+1).set(t,n)});t+=e._origin;var r=e._tail,o=e._root,i=c(gn);return t>=Je(e._capacity)?r=We(r,e.__ownerID,0,t,n,i):o=We(o,e.__ownerID,e._level,t,n,i),i.value?e.__ownerID?(e._root=o,e._tail=r,e.__hash=void 0,e.__altered=!0,e):Ve(e._origin,e._capacity,e._level,o,r):e}function We(e,t,n,r,o,i){var a=r>>>n&mn,u=e&&a<e.array.length;if(!u&&void 0===o)return e;var s;if(n>0){var l=e&&e.array[a],c=We(l,t,n-dn,r,o,i);return c===l?e:(s=Ge(e,t),s.array[a]=c,s)}return u&&e.array[a]===o?e:(f(i),s=Ge(e,t),void 0===o&&a===s.array.length-1?s.array.pop():s.array[a]=o,s)}function Ge(e,t){return t&&e&&t===e.ownerID?e:new Fe(e?e.array.slice():[],t)}function Qe(e,t){if(t>=Je(e._capacity))return e._tail;if(t<1<<e._level+dn){for(var n=e._root,r=e._level;n&&r>0;)n=n.array[t>>>r&mn],r-=dn;return n}}function Ye(e,t,n){void 0!==t&&(t|=0),void 0!==n&&(n|=0);var r=e.__ownerID||new p,o=e._origin,i=e._capacity,a=o+t,u=void 0===n?i:n<0?i+n:o+n;if(a===o&&u===i)return e;if(a>=u)return e.clear();for(var s=e._level,l=e._root,c=0;a+c<0;)l=new Fe(l&&l.array.length?[void 0,l]:[],r),s+=dn,c+=1<<s;c&&(a+=c,o+=c,u+=c,i+=c);for(var f=Je(i),d=Je(u);d>=1<<s+dn;)l=new Fe(l&&l.array.length?[l]:[],r),s+=dn;var h=e._tail,m=d<f?Qe(e,u-1):d>f?new Fe([],r):h;if(h&&d>f&&a<i&&h.array.length){l=Ge(l,r);for(var y=l,v=s;v>dn;v-=dn){var g=f>>>v&mn;y=y.array[g]=Ge(y.array[g],r)}y.array[f>>>dn&mn]=h}if(u<i&&(m=m&&m.removeAfter(r,0,u)),a>=d)a-=d,u-=d,s=dn,l=null,m=m&&m.removeBefore(r,0,a);else if(a>o||d<f){for(c=0;l;){var _=a>>>s&mn;if(_!==d>>>s&mn)break;_&&(c+=(1<<s)*_),s-=dn,l=l.array[_]}l&&a>o&&(l=l.removeBefore(r,s,a-c)),l&&d<f&&(l=l.removeAfter(r,s,d-c)),c&&(a-=c,u-=c)}return e.__ownerID?(e.size=u-a,e._origin=a,e._capacity=u,e._level=s,e._root=l,e._tail=m,e.__hash=void 0,e.__altered=!0,e):Ve(a,u,s,l,m)}function $e(e,t,n){for(var o=[],a=0,u=0;u<n.length;u++){var s=n[u],l=r(s);l.size>a&&(a=l.size),i(s)||(l=l.map(function(e){return K(e)})),o.push(l)}return a>e.size&&(e=e.setSize(a)),De(e,t,o)}function Je(e){return e<hn?0:e-1>>>dn<<dn}function Xe(e){return null===e||void 0===e?tt():Ze(e)?e:tt().withMutations(function(t){var r=n(e);ce(r.size),r.forEach(function(e,n){return t.set(n,e)})})}function Ze(e){return pe(e)&&l(e)}function et(e,t,n,r){var o=Object.create(Xe.prototype);return o.size=e?e.size:0,o._map=e,o._list=t,o.__ownerID=n,o.__hash=r,o}function tt(){return $n||($n=et(we(),Be()))}function nt(e,t,n){var r,o,i=e._map,a=e._list,u=i.get(t),s=void 0!==u;if(n===yn){if(!s)return e;a.size>=hn&&a.size>=2*i.size?(o=a.filter(function(e,t){return void 0!==e&&u!==t}),r=o.toKeyedSeq().map(function(e){return e[0]}).flip().toMap(),e.__ownerID&&(r.__ownerID=o.__ownerID=e.__ownerID)):(r=i.remove(t),o=u===a.size-1?a.pop():a.set(u,void 0))}else if(s){if(n===a.get(u)[1])return e;r=i,o=a.set(u,[t,n])}else r=i.set(t,a.size),o=a.set(a.size,[t,n]);return e.__ownerID?(e.size=r.size,e._map=r,e._list=o,e.__hash=void 0,e):et(r,o)}function rt(e,t){this._iter=e,this._useKeys=t,this.size=e.size}function ot(e){this._iter=e,this.size=e.size}function it(e){this._iter=e,this.size=e.size}function at(e){this._iter=e,this.size=e.size}function ut(e){var t=Tt(e);return t._iter=e,t.size=e.size,t.flip=function(){return e},t.reverse=function(){var t=e.reverse.apply(this);return t.flip=function(){return e.reverse()},t},t.has=function(t){return e.includes(t)},t.includes=function(t){return e.has(t)},t.cacheResult=Pt,t.__iterateUncached=function(t,n){var r=this;return e.__iterate(function(e,n){return!1!==t(n,e,r)},n)},t.__iteratorUncached=function(t,n){if(t===En){var r=e.__iterator(t,n);return new E(function(){var e=r.next();if(!e.done){var t=e.value[0];e.value[0]=e.value[1],e.value[1]=t}return e})}return e.__iterator(t===bn?_n:bn,n)},t}function st(e,t,n){var r=Tt(e);return r.size=e.size,r.has=function(t){return e.has(t)},r.get=function(r,o){var i=e.get(r,yn);return i===yn?o:t.call(n,i,r,e)},r.__iterateUncached=function(r,o){var i=this;return e.__iterate(function(e,o,a){return!1!==r(t.call(n,e,o,a),o,i)},o)},r.__iteratorUncached=function(r,o){var i=e.__iterator(En,o);return new E(function(){var o=i.next();if(o.done)return o;var a=o.value,u=a[0];return w(r,u,t.call(n,a[1],u,e),o)})},r}function lt(e,t){var n=Tt(e);return n._iter=e,n.size=e.size,n.reverse=function(){return e},e.flip&&(n.flip=function(){var t=ut(e);return t.reverse=function(){return e.flip()},t}),n.get=function(n,r){return e.get(t?n:-1-n,r)},n.has=function(n){return e.has(t?n:-1-n)},n.includes=function(t){return e.includes(t)},n.cacheResult=Pt,n.__iterate=function(t,n){var r=this;return e.__iterate(function(e,n){return t(e,n,r)},!n)},n.__iterator=function(t,n){return e.__iterator(t,!n)},n}function ct(e,t,n,r){var o=Tt(e);return r&&(o.has=function(r){var o=e.get(r,yn);return o!==yn&&!!t.call(n,o,r,e)},o.get=function(r,o){var i=e.get(r,yn);return i!==yn&&t.call(n,i,r,e)?i:o}),o.__iterateUncached=function(o,i){var a=this,u=0;return e.__iterate(function(e,i,s){if(t.call(n,e,i,s))return u++,o(e,r?i:u-1,a)},i),u},o.__iteratorUncached=function(o,i){var a=e.__iterator(En,i),u=0;return new E(function(){for(;;){var i=a.next();if(i.done)return i;var s=i.value,l=s[0],c=s[1];if(t.call(n,c,l,e))return w(o,r?l:u++,c,i)}})},o}function ft(e,t,n){var r=fe().asMutable();return e.__iterate(function(o,i){r.update(t.call(n,o,i,e),0,function(e){return e+1})}),r.asImmutable()}function pt(e,t,n){var r=a(e),o=(l(e)?Xe():fe()).asMutable();e.__iterate(function(i,a){o.update(t.call(n,i,a,e),function(e){return e=e||[],e.push(r?[a,i]:i),e})});var i=xt(e);return o.map(function(t){return Ct(e,i(t))})}function dt(e,t,n,r){var o=e.size;if(void 0!==t&&(t|=0),void 0!==n&&(n===1/0?n=o:n|=0),v(t,n,o))return e;var i=g(t,o),a=_(n,o);if(i!==i||a!==a)return dt(e.toSeq().cacheResult(),t,n,r);var u,s=a-i;s===s&&(u=s<0?0:s);var l=Tt(e);return l.size=0===u?u:e.size&&u||void 0,!r&&j(e)&&u>=0&&(l.get=function(t,n){return t=m(this,t),t>=0&&t<u?e.get(t+i,n):n}),l.__iterateUncached=function(t,n){var o=this;if(0===u)return 0;if(n)return this.cacheResult().__iterate(t,n);var a=0,s=!0,l=0;return e.__iterate(function(e,n){if(!s||!(s=a++<i))return l++,!1!==t(e,r?n:l-1,o)&&l!==u}),l},l.__iteratorUncached=function(t,n){if(0!==u&&n)return this.cacheResult().__iterator(t,n);var o=0!==u&&e.__iterator(t,n),a=0,s=0;return new E(function(){for(;a++<i;)o.next();if(++s>u)return S();var e=o.next();return r||t===bn?e:t===_n?w(t,s-1,void 0,e):w(t,s-1,e.value[1],e)})},l}function ht(e,t,n){var r=Tt(e);return r.__iterateUncached=function(r,o){var i=this;if(o)return this.cacheResult().__iterate(r,o);var a=0;return e.__iterate(function(e,o,u){return t.call(n,e,o,u)&&++a&&r(e,o,i)}),a},r.__iteratorUncached=function(r,o){var i=this;if(o)return this.cacheResult().__iterator(r,o);var a=e.__iterator(En,o),u=!0;return new E(function(){if(!u)return S();var e=a.next();if(e.done)return e;var o=e.value,s=o[0],l=o[1];return t.call(n,l,s,i)?r===En?e:w(r,s,l,e):(u=!1,S())})},r}function mt(e,t,n,r){var o=Tt(e);return o.__iterateUncached=function(o,i){var a=this;if(i)return this.cacheResult().__iterate(o,i);var u=!0,s=0;return e.__iterate(function(e,i,l){if(!u||!(u=t.call(n,e,i,l)))return s++,o(e,r?i:s-1,a)}),s},o.__iteratorUncached=function(o,i){var a=this;if(i)return this.cacheResult().__iterator(o,i);var u=e.__iterator(En,i),s=!0,l=0;return new E(function(){var e,i,c;do{if(e=u.next(),e.done)return r||o===bn?e:o===_n?w(o,l++,void 0,e):w(o,l++,e.value[1],e);var f=e.value;i=f[0],c=f[1],s&&(s=t.call(n,c,i,a))}while(s);return o===En?e:w(o,i,c,e)})},o}function yt(e,t){var r=a(e),o=[e].concat(t).map(function(e){return i(e)?r&&(e=n(e)):e=r?z(e):L(Array.isArray(e)?e:[e]),e}).filter(function(e){return 0!==e.size});if(0===o.length)return e;if(1===o.length){var s=o[0];if(s===e||r&&a(s)||u(e)&&u(s))return s}var l=new D(o);return r?l=l.toKeyedSeq():u(e)||(l=l.toSetSeq()),l=l.flatten(!0),l.size=o.reduce(function(e,t){if(void 0!==e){var n=t.size;if(void 0!==n)return e+n}},0),l}function vt(e,t,n){var r=Tt(e);return r.__iterateUncached=function(r,o){function a(e,l){var c=this;e.__iterate(function(e,o){return(!t||l<t)&&i(e)?a(e,l+1):!1===r(e,n?o:u++,c)&&(s=!0),!s},o)}var u=0,s=!1;return a(e,0),u},r.__iteratorUncached=function(r,o){var a=e.__iterator(r,o),u=[],s=0;return new E(function(){for(;a;){var e=a.next();if(!1===e.done){var l=e.value;if(r===En&&(l=l[1]),t&&!(u.length<t)||!i(l))return n?e:w(r,s++,l,e);u.push(a),a=l.__iterator(r,o)}else a=u.pop()}return S()})},r}function gt(e,t,n){var r=xt(e);return e.toSeq().map(function(o,i){return r(t.call(n,o,i,e))}).flatten(!0)}function _t(e,t){var n=Tt(e);return n.size=e.size&&2*e.size-1,n.__iterateUncached=function(n,r){var o=this,i=0;return e.__iterate(function(e,r){return(!i||!1!==n(t,i++,o))&&!1!==n(e,i++,o)},r),i},n.__iteratorUncached=function(n,r){var o,i=e.__iterator(bn,r),a=0;return new E(function(){return(!o||a%2)&&(o=i.next(),o.done)?o:a%2?w(n,a++,t):w(n,a++,o.value,o)})},n}function bt(e,t,n){t||(t=It);var r=a(e),o=0,i=e.toSeq().map(function(t,r){return[r,t,o++,n?n(t,r,e):t]}).toArray();return i.sort(function(e,n){return t(e[3],n[3])||e[2]-n[2]}).forEach(r?function(e,t){i[t].length=2}:function(e,t){i[t]=e[1]}),r?I(i):u(e)?N(i):A(i)}function Et(e,t,n){if(t||(t=It),n){var r=e.toSeq().map(function(t,r){return[t,n(t,r,e)]}).reduce(function(e,n){return wt(t,e[1],n[1])?n:e});return r&&r[0]}return e.reduce(function(e,n){return wt(t,e,n)?n:e})}function wt(e,t,n){var r=e(n,t);return 0===r&&n!==t&&(void 0===n||null===n||n!==n)||r>0}function St(e,n,r){var o=Tt(e);return o.size=new D(r).map(function(e){return e.size}).min(),o.__iterate=function(e,t){for(var n,r=this.__iterator(bn,t),o=0;!(n=r.next()).done&&!1!==e(n.value,o++,this););return o},o.__iteratorUncached=function(e,o){var i=r.map(function(e){return e=t(e),O(o?e.reverse():e)}),a=0,u=!1;return new E(function(){var t;return u||(t=i.map(function(e){return e.next()}),u=t.some(function(e){return e.done})),u?S():w(e,a++,n.apply(null,t.map(function(e){return e.value})))})},o}function Ct(e,t){return j(e)?t:e.constructor(t)}function kt(e){if(e!==Object(e))throw new TypeError("Expected [K, V] tuple: "+e)}function Ot(e){return ce(e.size),h(e)}function xt(e){return a(e)?n:u(e)?r:o}function Tt(e){return Object.create((a(e)?I:u(e)?N:A).prototype)}function Pt(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):P.prototype.cacheResult.call(this)}function It(e,t){return e>t?1:e<t?-1:0}function Nt(e){var n=O(e);if(!n){if(!T(e))throw new TypeError("Expected iterable or array-like: "+e);n=O(t(e))}return n}function At(e,t){var n,r=function(i){if(i instanceof r)return i;if(!(this instanceof r))return new r(i);if(!n){n=!0;var a=Object.keys(e);Rt(o,a),o.size=a.length,o._name=t,o._keys=a,o._defaultValues=e}this._map=fe(i)},o=r.prototype=Object.create(Jn);return o.constructor=r,r}function Dt(e,t,n){var r=Object.create(Object.getPrototypeOf(e));return r._map=t,r.__ownerID=n,r}function Mt(e){return e._name||e.constructor.name||"Record"}function Rt(e,t){try{t.forEach(qt.bind(void 0,e))}catch(e){}}function qt(e,t){Object.defineProperty(e,t,{get:function(){return this.get(t)},set:function(e){X(this.__ownerID,"Cannot set on an immutable record."),this.set(t,e)}})}function jt(e){return null===e||void 0===e?Ft():Ut(e)&&!l(e)?e:Ft().withMutations(function(t){var n=o(e);ce(n.size),n.forEach(function(e){return t.add(e)})})}function Ut(e){return!(!e||!e[Xn])}function zt(e,t){return e.__ownerID?(e.size=t.size,e._map=t,e):t===e._map?e:0===t.size?e.__empty():e.__make(t)}function Lt(e,t){var n=Object.create(Zn);return n.size=e?e.size:0,n._map=e,n.__ownerID=t,n}function Ft(){return er||(er=Lt(we()))}function Ht(e){return null===e||void 0===e?Kt():Vt(e)?e:Kt().withMutations(function(t){var n=o(e);ce(n.size),n.forEach(function(e){return t.add(e)})})}function Vt(e){return Ut(e)&&l(e)}function Bt(e,t){var n=Object.create(tr);return n.size=e?e.size:0,n._map=e,n.__ownerID=t,n}function Kt(){return nr||(nr=Bt(tt()))}function Wt(e){return null===e||void 0===e?Yt():Gt(e)?e:Yt().unshiftAll(e)}function Gt(e){return!(!e||!e[rr])}function Qt(e,t,n,r){var o=Object.create(or);return o.size=e,o._head=t,o.__ownerID=n,o.__hash=r,o.__altered=!1,o}function Yt(){return ir||(ir=Qt(0))}function $t(e,t){var n=function(n){e.prototype[n]=t[n]};return Object.keys(t).forEach(n),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach(n),e}function Jt(e,t){return t}function Xt(e,t){return[t,e]}function Zt(e){return function(){return!e.apply(this,arguments)}}function en(e){return function(){return-e.apply(this,arguments)}}function tn(e){return"string"==typeof e?JSON.stringify(e):String(e)}function nn(){return d(arguments)}function rn(e,t){return e<t?1:e>t?-1:0}function on(e){if(e.size===1/0)return 0;var t=l(e),n=a(e),r=t?1:0;return an(e.__iterate(n?t?function(e,t){r=31*r+un(ie(e),ie(t))|0}:function(e,t){r=r+un(ie(e),ie(t))|0}:t?function(e){r=31*r+ie(e)|0}:function(e){r=r+ie(e)|0}),r)}function an(e,t){return t=In(t,3432918353),t=In(t<<15|t>>>-15,461845907),t=In(t<<13|t>>>-13,5),t=(t+3864292196|0)^e,t=In(t^t>>>16,2246822507),t=In(t^t>>>13,3266489909),t=oe(t^t>>>16)}function un(e,t){return e^t+2654435769+(e<<6)+(e>>2)|0}var sn=Array.prototype.slice;e(n,t),e(r,t),e(o,t),t.isIterable=i,t.isKeyed=a,t.isIndexed=u,t.isAssociative=s,t.isOrdered=l,t.Keyed=n,t.Indexed=r,t.Set=o;var ln="@@__IMMUTABLE_ITERABLE__@@",cn="@@__IMMUTABLE_KEYED__@@",fn="@@__IMMUTABLE_INDEXED__@@",pn="@@__IMMUTABLE_ORDERED__@@",dn=5,hn=1<<dn,mn=hn-1,yn={},vn={value:!1},gn={value:!1},_n=0,bn=1,En=2,wn="function"==typeof Symbol&&Symbol.iterator,Sn="@@iterator",Cn=wn||Sn;E.prototype.toString=function(){return"[Iterator]"},E.KEYS=_n,E.VALUES=bn,E.ENTRIES=En,E.prototype.inspect=E.prototype.toSource=function(){return this.toString()},E.prototype[Cn]=function(){return this},e(P,t),P.of=function(){return P(arguments)},P.prototype.toSeq=function(){return this},P.prototype.toString=function(){return this.__toString("Seq {","}")},P.prototype.cacheResult=function(){return!this._cache&&this.__iterateUncached&&(this._cache=this.entrySeq().toArray(),this.size=this._cache.length),this},P.prototype.__iterate=function(e,t){return V(this,e,t,!0)},P.prototype.__iterator=function(e,t){return B(this,e,t,!0)},e(I,P),I.prototype.toKeyedSeq=function(){return this},e(N,P),N.of=function(){return N(arguments)},N.prototype.toIndexedSeq=function(){return this},N.prototype.toString=function(){return this.__toString("Seq [","]")},N.prototype.__iterate=function(e,t){return V(this,e,t,!1)},N.prototype.__iterator=function(e,t){return B(this,e,t,!1)},e(A,P),A.of=function(){return A(arguments)},A.prototype.toSetSeq=function(){return this},P.isSeq=j,P.Keyed=I,P.Set=A,P.Indexed=N;var kn="@@__IMMUTABLE_SEQ__@@";P.prototype[kn]=!0,e(D,N),D.prototype.get=function(e,t){return this.has(e)?this._array[m(this,e)]:t},D.prototype.__iterate=function(e,t){for(var n=this._array,r=n.length-1,o=0;o<=r;o++)if(!1===e(n[t?r-o:o],o,this))return o+1;return o},D.prototype.__iterator=function(e,t){var n=this._array,r=n.length-1,o=0;return new E(function(){return o>r?S():w(e,o,n[t?r-o++:o++])})},e(M,I),M.prototype.get=function(e,t){return void 0===t||this.has(e)?this._object[e]:t},M.prototype.has=function(e){return this._object.hasOwnProperty(e)},M.prototype.__iterate=function(e,t){for(var n=this._object,r=this._keys,o=r.length-1,i=0;i<=o;i++){var a=r[t?o-i:i];if(!1===e(n[a],a,this))return i+1}return i},M.prototype.__iterator=function(e,t){var n=this._object,r=this._keys,o=r.length-1,i=0;return new E(function(){var a=r[t?o-i:i];return i++>o?S():w(e,a,n[a])})},M.prototype[pn]=!0,e(R,N),R.prototype.__iterateUncached=function(e,t){if(t)return this.cacheResult().__iterate(e,t);var n=this._iterable,r=O(n),o=0;if(k(r))for(var i;!(i=r.next()).done&&!1!==e(i.value,o++,this););return o},R.prototype.__iteratorUncached=function(e,t){if(t)return this.cacheResult().__iterator(e,t);var n=this._iterable,r=O(n);if(!k(r))return new E(S);var o=0;return new E(function(){var t=r.next();return t.done?t:w(e,o++,t.value)})},e(q,N),q.prototype.__iterateUncached=function(e,t){if(t)return this.cacheResult().__iterate(e,t);for(var n=this._iterator,r=this._iteratorCache,o=0;o<r.length;)if(!1===e(r[o],o++,this))return o;for(var i;!(i=n.next()).done;){var a=i.value;if(r[o]=a,!1===e(a,o++,this))break}return o},q.prototype.__iteratorUncached=function(e,t){if(t)return this.cacheResult().__iterator(e,t);var n=this._iterator,r=this._iteratorCache,o=0;return new E(function(){if(o>=r.length){var t=n.next();if(t.done)return t;r[o]=t.value}return w(e,o,r[o++])})};var On;e(J,N),J.prototype.toString=function(){return 0===this.size?"Repeat []":"Repeat [ "+this._value+" "+this.size+" times ]"},J.prototype.get=function(e,t){return this.has(e)?this._value:t},J.prototype.includes=function(e){return Y(this._value,e)},J.prototype.slice=function(e,t){var n=this.size;return v(e,t,n)?this:new J(this._value,_(t,n)-g(e,n))},J.prototype.reverse=function(){return this},J.prototype.indexOf=function(e){return Y(this._value,e)?0:-1},J.prototype.lastIndexOf=function(e){return Y(this._value,e)?this.size:-1},J.prototype.__iterate=function(e,t){for(var n=0;n<this.size;n++)if(!1===e(this._value,n,this))return n+1;return n},J.prototype.__iterator=function(e,t){var n=this,r=0;return new E(function(){return r<n.size?w(e,r++,n._value):S()})},J.prototype.equals=function(e){return e instanceof J?Y(this._value,e._value):$(e)};var xn;e(Z,N),Z.prototype.toString=function(){return 0===this.size?"Range []":"Range [ "+this._start+"..."+this._end+(1!==this._step?" by "+this._step:"")+" ]"},Z.prototype.get=function(e,t){return this.has(e)?this._start+m(this,e)*this._step:t},Z.prototype.includes=function(e){var t=(e-this._start)/this._step;return t>=0&&t<this.size&&t===Math.floor(t)},Z.prototype.slice=function(e,t){return v(e,t,this.size)?this:(e=g(e,this.size),t=_(t,this.size),t<=e?new Z(0,0):new Z(this.get(e,this._end),this.get(t,this._end),this._step))},Z.prototype.indexOf=function(e){var t=e-this._start;if(t%this._step==0){var n=t/this._step;if(n>=0&&n<this.size)return n}return-1},Z.prototype.lastIndexOf=function(e){return this.indexOf(e)},Z.prototype.__iterate=function(e,t){for(var n=this.size-1,r=this._step,o=t?this._start+n*r:this._start,i=0;i<=n;i++){if(!1===e(o,i,this))return i+1;o+=t?-r:r}return i},Z.prototype.__iterator=function(e,t){var n=this.size-1,r=this._step,o=t?this._start+n*r:this._start,i=0;return new E(function(){var a=o;return o+=t?-r:r,i>n?S():w(e,i++,a)})},Z.prototype.equals=function(e){return e instanceof Z?this._start===e._start&&this._end===e._end&&this._step===e._step:$(this,e)};var Tn;e(ee,t),e(te,ee),e(ne,ee),e(re,ee),ee.Keyed=te,ee.Indexed=ne,ee.Set=re;var Pn,In="function"==typeof Math.imul&&-2===Math.imul(4294967295,2)?Math.imul:function(e,t){e|=0,t|=0;var n=65535&e,r=65535&t;return n*r+((e>>>16)*r+n*(t>>>16)<<16>>>0)|0},Nn=Object.isExtensible,An=function(){try{return Object.defineProperty({},"@",{}),!0}catch(e){return!1}}(),Dn="function"==typeof WeakMap;Dn&&(Pn=new WeakMap);var Mn=0,Rn="__immutablehash__";"function"==typeof Symbol&&(Rn=Symbol(Rn));var qn=16,jn=255,Un=0,zn={};e(fe,te),fe.of=function(){var e=sn.call(arguments,0);return we().withMutations(function(t){for(var n=0;n<e.length;n+=2){if(n+1>=e.length)throw new Error("Missing value for key: "+e[n]);t.set(e[n],e[n+1])}})},fe.prototype.toString=function(){return this.__toString("Map {","}")},fe.prototype.get=function(e,t){return this._root?this._root.get(0,void 0,e,t):t},fe.prototype.set=function(e,t){return Se(this,e,t)},fe.prototype.setIn=function(e,t){return this.updateIn(e,yn,function(){return t})},fe.prototype.remove=function(e){return Se(this,e,yn)},fe.prototype.deleteIn=function(e){return this.updateIn(e,function(){return yn})},fe.prototype.update=function(e,t,n){return 1===arguments.length?e(this):this.updateIn([e],t,n)},fe.prototype.updateIn=function(e,t,n){n||(n=t,t=void 0);var r=Me(this,Nt(e),t,n);return r===yn?void 0:r},fe.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):we()},fe.prototype.merge=function(){return Ie(this,void 0,arguments)},fe.prototype.mergeWith=function(e){return Ie(this,e,sn.call(arguments,1))},fe.prototype.mergeIn=function(e){var t=sn.call(arguments,1);return this.updateIn(e,we(),function(e){return"function"==typeof e.merge?e.merge.apply(e,t):t[t.length-1]})},fe.prototype.mergeDeep=function(){return Ie(this,Ne,arguments)},fe.prototype.mergeDeepWith=function(e){var t=sn.call(arguments,1);return Ie(this,Ae(e),t)},fe.prototype.mergeDeepIn=function(e){var t=sn.call(arguments,1);return this.updateIn(e,we(),function(e){return"function"==typeof e.mergeDeep?e.mergeDeep.apply(e,t):t[t.length-1]})},fe.prototype.sort=function(e){return Xe(bt(this,e))},fe.prototype.sortBy=function(e,t){return Xe(bt(this,t,e))},fe.prototype.withMutations=function(e){var t=this.asMutable();return e(t),t.wasAltered()?t.__ensureOwner(this.__ownerID):this},fe.prototype.asMutable=function(){return this.__ownerID?this:this.__ensureOwner(new p)},fe.prototype.asImmutable=function(){return this.__ensureOwner()},fe.prototype.wasAltered=function(){return this.__altered},fe.prototype.__iterator=function(e,t){return new ge(this,e,t)},fe.prototype.__iterate=function(e,t){var n=this,r=0;return this._root&&this._root.iterate(function(t){return r++,e(t[1],t[0],n)},t),r},fe.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?Ee(this.size,this._root,e,this.__hash):(this.__ownerID=e,this.__altered=!1,this)},fe.isMap=pe;var Ln="@@__IMMUTABLE_MAP__@@",Fn=fe.prototype;Fn[Ln]=!0,Fn.delete=Fn.remove,Fn.removeIn=Fn.deleteIn,de.prototype.get=function(e,t,n,r){for(var o=this.entries,i=0,a=o.length;i<a;i++)if(Y(n,o[i][0]))return o[i][1];return r},de.prototype.update=function(e,t,n,r,o,i,a){for(var u=o===yn,s=this.entries,l=0,c=s.length;l<c&&!Y(r,s[l][0]);l++);var p=l<c;if(p?s[l][1]===o:u)return this;if(f(a),(u||!p)&&f(i),!u||1!==s.length){if(!p&&!u&&s.length>=Vn)return xe(e,s,r,o);var h=e&&e===this.ownerID,m=h?s:d(s);return p?u?l===c-1?m.pop():m[l]=m.pop():m[l]=[r,o]:m.push([r,o]),h?(this.entries=m,this):new de(e,m)}},he.prototype.get=function(e,t,n,r){void 0===t&&(t=ie(n));var o=1<<((0===e?t:t>>>e)&mn),i=this.bitmap;return 0==(i&o)?r:this.nodes[Re(i&o-1)].get(e+dn,t,n,r)},he.prototype.update=function(e,t,n,r,o,i,a){void 0===n&&(n=ie(r));var u=(0===t?n:n>>>t)&mn,s=1<<u,l=this.bitmap,c=0!=(l&s);if(!c&&o===yn)return this;var f=Re(l&s-1),p=this.nodes,d=c?p[f]:void 0,h=Ce(d,e,t+dn,n,r,o,i,a);if(h===d)return this;if(!c&&h&&p.length>=Bn)return Pe(e,p,l,u,h);if(c&&!h&&2===p.length&&ke(p[1^f]))return p[1^f];if(c&&h&&1===p.length&&ke(h))return h;var m=e&&e===this.ownerID,y=c?h?l:l^s:l|s,v=c?h?qe(p,f,h,m):Ue(p,f,m):je(p,f,h,m);return m?(this.bitmap=y,this.nodes=v,this):new he(e,y,v)},me.prototype.get=function(e,t,n,r){void 0===t&&(t=ie(n));var o=(0===e?t:t>>>e)&mn,i=this.nodes[o];return i?i.get(e+dn,t,n,r):r},me.prototype.update=function(e,t,n,r,o,i,a){void 0===n&&(n=ie(r));var u=(0===t?n:n>>>t)&mn,s=o===yn,l=this.nodes,c=l[u];if(s&&!c)return this;var f=Ce(c,e,t+dn,n,r,o,i,a);if(f===c)return this;var p=this.count;if(c){if(!f&&--p<Kn)return Te(e,l,p,u)}else p++;var d=e&&e===this.ownerID,h=qe(l,u,f,d);return d?(this.count=p,this.nodes=h,this):new me(e,p,h)},ye.prototype.get=function(e,t,n,r){for(var o=this.entries,i=0,a=o.length;i<a;i++)if(Y(n,o[i][0]))return o[i][1];return r},ye.prototype.update=function(e,t,n,r,o,i,a){void 0===n&&(n=ie(r));var u=o===yn;if(n!==this.keyHash)return u?this:(f(a),f(i),Oe(this,e,t,n,[r,o]));for(var s=this.entries,l=0,c=s.length;l<c&&!Y(r,s[l][0]);l++);var p=l<c;if(p?s[l][1]===o:u)return this;if(f(a),(u||!p)&&f(i),u&&2===c)return new ve(e,this.keyHash,s[1^l]);var h=e&&e===this.ownerID,m=h?s:d(s);return p?u?l===c-1?m.pop():m[l]=m.pop():m[l]=[r,o]:m.push([r,o]),h?(this.entries=m,this):new ye(e,this.keyHash,m)},ve.prototype.get=function(e,t,n,r){return Y(n,this.entry[0])?this.entry[1]:r},ve.prototype.update=function(e,t,n,r,o,i,a){var u=o===yn,s=Y(r,this.entry[0]);return(s?o===this.entry[1]:u)?this:(f(a),u?void f(i):s?e&&e===this.ownerID?(this.entry[1]=o,this):new ve(e,this.keyHash,[r,o]):(f(i),Oe(this,e,t,ie(r),[r,o])))},de.prototype.iterate=ye.prototype.iterate=function(e,t){for(var n=this.entries,r=0,o=n.length-1;r<=o;r++)if(!1===e(n[t?o-r:r]))return!1},he.prototype.iterate=me.prototype.iterate=function(e,t){for(var n=this.nodes,r=0,o=n.length-1;r<=o;r++){var i=n[t?o-r:r];if(i&&!1===i.iterate(e,t))return!1}},ve.prototype.iterate=function(e,t){return e(this.entry)},e(ge,E),ge.prototype.next=function(){for(var e=this._type,t=this._stack;t;){var n,r=t.node,o=t.index++;if(r.entry){if(0===o)return _e(e,r.entry)}else if(r.entries){if(n=r.entries.length-1,o<=n)return _e(e,r.entries[this._reverse?n-o:o])}else if(n=r.nodes.length-1,o<=n){var i=r.nodes[this._reverse?n-o:o];if(i){if(i.entry)return _e(e,i.entry);t=this._stack=be(i,t)}continue}t=this._stack=this._stack.__prev}return S()};var Hn,Vn=hn/4,Bn=hn/2,Kn=hn/4;e(ze,ne),ze.of=function(){return this(arguments)},ze.prototype.toString=function(){return this.__toString("List [","]")},ze.prototype.get=function(e,t){if((e=m(this,e))>=0&&e<this.size){e+=this._origin;var n=Qe(this,e);return n&&n.array[e&mn]}return t},ze.prototype.set=function(e,t){return Ke(this,e,t)},ze.prototype.remove=function(e){return this.has(e)?0===e?this.shift():e===this.size-1?this.pop():this.splice(e,1):this},ze.prototype.insert=function(e,t){return this.splice(e,0,t)},ze.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=this._origin=this._capacity=0,this._level=dn,this._root=this._tail=null,this.__hash=void 0,this.__altered=!0,this):Be()},ze.prototype.push=function(){var e=arguments,t=this.size;return this.withMutations(function(n){Ye(n,0,t+e.length);for(var r=0;r<e.length;r++)n.set(t+r,e[r])})},ze.prototype.pop=function(){return Ye(this,0,-1)},ze.prototype.unshift=function(){var e=arguments;return this.withMutations(function(t){Ye(t,-e.length);for(var n=0;n<e.length;n++)t.set(n,e[n])})},ze.prototype.shift=function(){return Ye(this,1)},ze.prototype.merge=function(){return $e(this,void 0,arguments)},ze.prototype.mergeWith=function(e){return $e(this,e,sn.call(arguments,1))},ze.prototype.mergeDeep=function(){return $e(this,Ne,arguments)},ze.prototype.mergeDeepWith=function(e){var t=sn.call(arguments,1);return $e(this,Ae(e),t)},ze.prototype.setSize=function(e){return Ye(this,0,e)},ze.prototype.slice=function(e,t){var n=this.size;return v(e,t,n)?this:Ye(this,g(e,n),_(t,n))},ze.prototype.__iterator=function(e,t){var n=0,r=He(this,t);return new E(function(){var t=r();return t===Yn?S():w(e,n++,t)})},ze.prototype.__iterate=function(e,t){for(var n,r=0,o=He(this,t);(n=o())!==Yn&&!1!==e(n,r++,this););return r},ze.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?Ve(this._origin,this._capacity,this._level,this._root,this._tail,e,this.__hash):(this.__ownerID=e,this)},ze.isList=Le;var Wn="@@__IMMUTABLE_LIST__@@",Gn=ze.prototype;Gn[Wn]=!0,Gn.delete=Gn.remove,Gn.setIn=Fn.setIn,Gn.deleteIn=Gn.removeIn=Fn.removeIn,Gn.update=Fn.update,Gn.updateIn=Fn.updateIn,Gn.mergeIn=Fn.mergeIn,Gn.mergeDeepIn=Fn.mergeDeepIn,Gn.withMutations=Fn.withMutations,Gn.asMutable=Fn.asMutable,Gn.asImmutable=Fn.asImmutable,Gn.wasAltered=Fn.wasAltered,Fe.prototype.removeBefore=function(e,t,n){if(n===t?1<<t:0===this.array.length)return this;var r=n>>>t&mn;if(r>=this.array.length)return new Fe([],e);var o,i=0===r;if(t>0){var a=this.array[r];if((o=a&&a.removeBefore(e,t-dn,n))===a&&i)return this}if(i&&!o)return this;var u=Ge(this,e);if(!i)for(var s=0;s<r;s++)u.array[s]=void 0;return o&&(u.array[r]=o),u},Fe.prototype.removeAfter=function(e,t,n){if(n===(t?1<<t:0)||0===this.array.length)return this;var r=n-1>>>t&mn;if(r>=this.array.length)return this;var o;if(t>0){var i=this.array[r];if((o=i&&i.removeAfter(e,t-dn,n))===i&&r===this.array.length-1)return this}var a=Ge(this,e);return a.array.splice(r+1),o&&(a.array[r]=o),a};var Qn,Yn={};e(Xe,fe),Xe.of=function(){return this(arguments)},Xe.prototype.toString=function(){return this.__toString("OrderedMap {","}")},Xe.prototype.get=function(e,t){var n=this._map.get(e);return void 0!==n?this._list.get(n)[1]:t},Xe.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._map.clear(),this._list.clear(),this):tt()},Xe.prototype.set=function(e,t){return nt(this,e,t)},Xe.prototype.remove=function(e){return nt(this,e,yn)},Xe.prototype.wasAltered=function(){return this._map.wasAltered()||this._list.wasAltered()},Xe.prototype.__iterate=function(e,t){var n=this;return this._list.__iterate(function(t){return t&&e(t[1],t[0],n)},t)},Xe.prototype.__iterator=function(e,t){return this._list.fromEntrySeq().__iterator(e,t)},Xe.prototype.__ensureOwner=function(e){if(e===this.__ownerID)return this;var t=this._map.__ensureOwner(e),n=this._list.__ensureOwner(e);return e?et(t,n,e,this.__hash):(this.__ownerID=e,this._map=t,this._list=n,this)},Xe.isOrderedMap=Ze,Xe.prototype[pn]=!0,Xe.prototype.delete=Xe.prototype.remove;var $n;e(rt,I),rt.prototype.get=function(e,t){return this._iter.get(e,t)},rt.prototype.has=function(e){return this._iter.has(e)},rt.prototype.valueSeq=function(){return this._iter.valueSeq()},rt.prototype.reverse=function(){var e=this,t=lt(this,!0);return this._useKeys||(t.valueSeq=function(){return e._iter.toSeq().reverse()}),t},rt.prototype.map=function(e,t){var n=this,r=st(this,e,t);return this._useKeys||(r.valueSeq=function(){return n._iter.toSeq().map(e,t)}),r},rt.prototype.__iterate=function(e,t){var n,r=this;return this._iter.__iterate(this._useKeys?function(t,n){return e(t,n,r)}:(n=t?Ot(this):0,function(o){return e(o,t?--n:n++,r)}),t)},rt.prototype.__iterator=function(e,t){if(this._useKeys)return this._iter.__iterator(e,t);var n=this._iter.__iterator(bn,t),r=t?Ot(this):0;return new E(function(){var o=n.next();return o.done?o:w(e,t?--r:r++,o.value,o)})},rt.prototype[pn]=!0,e(ot,N),ot.prototype.includes=function(e){return this._iter.includes(e)},ot.prototype.__iterate=function(e,t){var n=this,r=0;return this._iter.__iterate(function(t){return e(t,r++,n)},t)},ot.prototype.__iterator=function(e,t){var n=this._iter.__iterator(bn,t),r=0;return new E(function(){var t=n.next();return t.done?t:w(e,r++,t.value,t)})},e(it,A),it.prototype.has=function(e){return this._iter.includes(e)},it.prototype.__iterate=function(e,t){var n=this;return this._iter.__iterate(function(t){return e(t,t,n)},t)},it.prototype.__iterator=function(e,t){var n=this._iter.__iterator(bn,t);return new E(function(){var t=n.next();return t.done?t:w(e,t.value,t.value,t)})},e(at,I),at.prototype.entrySeq=function(){return this._iter.toSeq()},at.prototype.__iterate=function(e,t){var n=this;return this._iter.__iterate(function(t){if(t){kt(t);var r=i(t);return e(r?t.get(1):t[1],r?t.get(0):t[0],n)}},t)},at.prototype.__iterator=function(e,t){var n=this._iter.__iterator(bn,t);return new E(function(){for(;;){var t=n.next();if(t.done)return t;var r=t.value;if(r){kt(r);var o=i(r);return w(e,o?r.get(0):r[0],o?r.get(1):r[1],t)}}})},ot.prototype.cacheResult=rt.prototype.cacheResult=it.prototype.cacheResult=at.prototype.cacheResult=Pt,e(At,te),At.prototype.toString=function(){return this.__toString(Mt(this)+" {","}")},At.prototype.has=function(e){return this._defaultValues.hasOwnProperty(e)},At.prototype.get=function(e,t){if(!this.has(e))return t;var n=this._defaultValues[e];return this._map?this._map.get(e,n):n},At.prototype.clear=function(){if(this.__ownerID)return this._map&&this._map.clear(),this;var e=this.constructor;return e._empty||(e._empty=Dt(this,we()))},At.prototype.set=function(e,t){if(!this.has(e))throw new Error('Cannot set unknown key "'+e+'" on '+Mt(this));if(this._map&&!this._map.has(e)){if(t===this._defaultValues[e])return this}var n=this._map&&this._map.set(e,t);return this.__ownerID||n===this._map?this:Dt(this,n)},At.prototype.remove=function(e){if(!this.has(e))return this;var t=this._map&&this._map.remove(e);return this.__ownerID||t===this._map?this:Dt(this,t)},At.prototype.wasAltered=function(){return this._map.wasAltered()},At.prototype.__iterator=function(e,t){var r=this;return n(this._defaultValues).map(function(e,t){return r.get(t)}).__iterator(e,t)},At.prototype.__iterate=function(e,t){var r=this;return n(this._defaultValues).map(function(e,t){return r.get(t)}).__iterate(e,t)},At.prototype.__ensureOwner=function(e){if(e===this.__ownerID)return this;var t=this._map&&this._map.__ensureOwner(e);return e?Dt(this,t,e):(this.__ownerID=e,this._map=t,this)};var Jn=At.prototype;Jn.delete=Jn.remove,Jn.deleteIn=Jn.removeIn=Fn.removeIn,Jn.merge=Fn.merge,Jn.mergeWith=Fn.mergeWith,Jn.mergeIn=Fn.mergeIn,Jn.mergeDeep=Fn.mergeDeep,Jn.mergeDeepWith=Fn.mergeDeepWith,Jn.mergeDeepIn=Fn.mergeDeepIn,Jn.setIn=Fn.setIn,Jn.update=Fn.update,Jn.updateIn=Fn.updateIn,Jn.withMutations=Fn.withMutations,Jn.asMutable=Fn.asMutable,Jn.asImmutable=Fn.asImmutable,e(jt,re),jt.of=function(){return this(arguments)},jt.fromKeys=function(e){return this(n(e).keySeq())},jt.prototype.toString=function(){return this.__toString("Set {","}")},jt.prototype.has=function(e){return this._map.has(e)},jt.prototype.add=function(e){return zt(this,this._map.set(e,!0))},jt.prototype.remove=function(e){return zt(this,this._map.remove(e))},jt.prototype.clear=function(){return zt(this,this._map.clear())},jt.prototype.union=function(){var e=sn.call(arguments,0);return e=e.filter(function(e){return 0!==e.size}),0===e.length?this:0!==this.size||this.__ownerID||1!==e.length?this.withMutations(function(t){for(var n=0;n<e.length;n++)o(e[n]).forEach(function(e){return t.add(e)})}):this.constructor(e[0])},jt.prototype.intersect=function(){var e=sn.call(arguments,0);if(0===e.length)return this;e=e.map(function(e){return o(e)});var t=this;return this.withMutations(function(n){t.forEach(function(t){e.every(function(e){return e.includes(t)})||n.remove(t)})})},jt.prototype.subtract=function(){var e=sn.call(arguments,0);if(0===e.length)return this;e=e.map(function(e){return o(e)});var t=this;return this.withMutations(function(n){t.forEach(function(t){e.some(function(e){return e.includes(t)})&&n.remove(t)})})},jt.prototype.merge=function(){return this.union.apply(this,arguments)},jt.prototype.mergeWith=function(e){var t=sn.call(arguments,1);return this.union.apply(this,t)},jt.prototype.sort=function(e){return Ht(bt(this,e))},jt.prototype.sortBy=function(e,t){return Ht(bt(this,t,e))},jt.prototype.wasAltered=function(){return this._map.wasAltered()},jt.prototype.__iterate=function(e,t){var n=this;return this._map.__iterate(function(t,r){return e(r,r,n)},t)},jt.prototype.__iterator=function(e,t){return this._map.map(function(e,t){return t}).__iterator(e,t)},jt.prototype.__ensureOwner=function(e){if(e===this.__ownerID)return this;var t=this._map.__ensureOwner(e);return e?this.__make(t,e):(this.__ownerID=e,this._map=t,this)},jt.isSet=Ut;var Xn="@@__IMMUTABLE_SET__@@",Zn=jt.prototype;Zn[Xn]=!0,Zn.delete=Zn.remove,Zn.mergeDeep=Zn.merge,Zn.mergeDeepWith=Zn.mergeWith,Zn.withMutations=Fn.withMutations,Zn.asMutable=Fn.asMutable,Zn.asImmutable=Fn.asImmutable,Zn.__empty=Ft,Zn.__make=Lt;var er;e(Ht,jt),Ht.of=function(){return this(arguments)},Ht.fromKeys=function(e){return this(n(e).keySeq())},Ht.prototype.toString=function(){return this.__toString("OrderedSet {","}")},Ht.isOrderedSet=Vt;var tr=Ht.prototype;tr[pn]=!0,tr.__empty=Kt,tr.__make=Bt;var nr;e(Wt,ne),Wt.of=function(){return this(arguments)},Wt.prototype.toString=function(){return this.__toString("Stack [","]")},Wt.prototype.get=function(e,t){var n=this._head;for(e=m(this,e);n&&e--;)n=n.next;return n?n.value:t},Wt.prototype.peek=function(){return this._head&&this._head.value},Wt.prototype.push=function(){if(0===arguments.length)return this;for(var e=this.size+arguments.length,t=this._head,n=arguments.length-1;n>=0;n--)t={value:arguments[n],next:t};return this.__ownerID?(this.size=e,this._head=t,this.__hash=void 0,this.__altered=!0,this):Qt(e,t)},Wt.prototype.pushAll=function(e){if(e=r(e),0===e.size)return this;ce(e.size);var t=this.size,n=this._head;return e.reverse().forEach(function(e){t++,n={value:e,next:n}}),this.__ownerID?(this.size=t,this._head=n,this.__hash=void 0,this.__altered=!0,this):Qt(t,n)},Wt.prototype.pop=function(){return this.slice(1)},Wt.prototype.unshift=function(){return this.push.apply(this,arguments)},Wt.prototype.unshiftAll=function(e){return this.pushAll(e)},Wt.prototype.shift=function(){return this.pop.apply(this,arguments)},Wt.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):Yt()},Wt.prototype.slice=function(e,t){if(v(e,t,this.size))return this;var n=g(e,this.size);if(_(t,this.size)!==this.size)return ne.prototype.slice.call(this,e,t);for(var r=this.size-n,o=this._head;n--;)o=o.next;return this.__ownerID?(this.size=r,this._head=o,this.__hash=void 0,this.__altered=!0,this):Qt(r,o)},Wt.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?Qt(this.size,this._head,e,this.__hash):(this.__ownerID=e,this.__altered=!1,this)},Wt.prototype.__iterate=function(e,t){if(t)return this.reverse().__iterate(e);for(var n=0,r=this._head;r&&!1!==e(r.value,n++,this);)r=r.next;return n},Wt.prototype.__iterator=function(e,t){if(t)return this.reverse().__iterator(e);var n=0,r=this._head;return new E(function(){if(r){var t=r.value;return r=r.next,w(e,n++,t)}return S()})},Wt.isStack=Gt;var rr="@@__IMMUTABLE_STACK__@@",or=Wt.prototype;or[rr]=!0,or.withMutations=Fn.withMutations,or.asMutable=Fn.asMutable,or.asImmutable=Fn.asImmutable,or.wasAltered=Fn.wasAltered;var ir;t.Iterator=E,$t(t,{toArray:function(){ce(this.size);var e=new Array(this.size||0);return this.valueSeq().__iterate(function(t,n){e[n]=t}),e},toIndexedSeq:function(){return new ot(this)},toJS:function(){return this.toSeq().map(function(e){return e&&"function"==typeof e.toJS?e.toJS():e}).__toJS()},toJSON:function(){return this.toSeq().map(function(e){return e&&"function"==typeof e.toJSON?e.toJSON():e}).__toJS()},toKeyedSeq:function(){return new rt(this,!0)},toMap:function(){return fe(this.toKeyedSeq())},toObject:function(){ce(this.size);var e={};return this.__iterate(function(t,n){e[n]=t}),e},toOrderedMap:function(){return Xe(this.toKeyedSeq())},toOrderedSet:function(){return Ht(a(this)?this.valueSeq():this)},toSet:function(){return jt(a(this)?this.valueSeq():this)},toSetSeq:function(){return new it(this)},toSeq:function(){return u(this)?this.toIndexedSeq():a(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return Wt(a(this)?this.valueSeq():this)},toList:function(){return ze(a(this)?this.valueSeq():this)},toString:function(){return"[Iterable]"},__toString:function(e,t){return 0===this.size?e+t:e+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+t},concat:function(){return Ct(this,yt(this,sn.call(arguments,0)))},includes:function(e){return this.some(function(t){return Y(t,e)})},entries:function(){return this.__iterator(En)},every:function(e,t){ce(this.size);var n=!0;return this.__iterate(function(r,o,i){if(!e.call(t,r,o,i))return n=!1,!1}),n},filter:function(e,t){return Ct(this,ct(this,e,t,!0))},find:function(e,t,n){var r=this.findEntry(e,t);return r?r[1]:n},forEach:function(e,t){return ce(this.size),this.__iterate(t?e.bind(t):e)},join:function(e){ce(this.size),e=void 0!==e?""+e:",";var t="",n=!0;return this.__iterate(function(r){n?n=!1:t+=e,t+=null!==r&&void 0!==r?r.toString():""}),t},keys:function(){return this.__iterator(_n)},map:function(e,t){return Ct(this,st(this,e,t))},reduce:function(e,t,n){ce(this.size);var r,o;return arguments.length<2?o=!0:r=t,this.__iterate(function(t,i,a){o?(o=!1,r=t):r=e.call(n,r,t,i,a)}),r},reduceRight:function(e,t,n){var r=this.toKeyedSeq().reverse();return r.reduce.apply(r,arguments)},reverse:function(){return Ct(this,lt(this,!0))},slice:function(e,t){return Ct(this,dt(this,e,t,!0))},some:function(e,t){return!this.every(Zt(e),t)},sort:function(e){return Ct(this,bt(this,e))},values:function(){return this.__iterator(bn)},butLast:function(){return this.slice(0,-1)},isEmpty:function(){return void 0!==this.size?0===this.size:!this.some(function(){return!0})},count:function(e,t){return h(e?this.toSeq().filter(e,t):this)},countBy:function(e,t){return ft(this,e,t)},equals:function(e){return $(this,e)},entrySeq:function(){var e=this;if(e._cache)return new D(e._cache);var t=e.toSeq().map(Xt).toIndexedSeq();return t.fromEntrySeq=function(){return e.toSeq()},t},filterNot:function(e,t){return this.filter(Zt(e),t)},findEntry:function(e,t,n){var r=n;return this.__iterate(function(n,o,i){if(e.call(t,n,o,i))return r=[o,n],!1}),r},findKey:function(e,t){var n=this.findEntry(e,t);return n&&n[0]},findLast:function(e,t,n){return this.toKeyedSeq().reverse().find(e,t,n)},findLastEntry:function(e,t,n){return this.toKeyedSeq().reverse().findEntry(e,t,n)},findLastKey:function(e,t){return this.toKeyedSeq().reverse().findKey(e,t)},first:function(){return this.find(y)},flatMap:function(e,t){return Ct(this,gt(this,e,t))},flatten:function(e){return Ct(this,vt(this,e,!0))},fromEntrySeq:function(){return new at(this)},get:function(e,t){return this.find(function(t,n){return Y(n,e)},void 0,t)},getIn:function(e,t){for(var n,r=this,o=Nt(e);!(n=o.next()).done;){var i=n.value;if((r=r&&r.get?r.get(i,yn):yn)===yn)return t}return r},groupBy:function(e,t){return pt(this,e,t)},has:function(e){return this.get(e,yn)!==yn},hasIn:function(e){return this.getIn(e,yn)!==yn},isSubset:function(e){return e="function"==typeof e.includes?e:t(e),this.every(function(t){return e.includes(t)})},isSuperset:function(e){return e="function"==typeof e.isSubset?e:t(e),e.isSubset(this)},keyOf:function(e){return this.findKey(function(t){return Y(t,e)})},keySeq:function(){return this.toSeq().map(Jt).toIndexedSeq()},last:function(){return this.toSeq().reverse().first()},lastKeyOf:function(e){return this.toKeyedSeq().reverse().keyOf(e)},max:function(e){return Et(this,e)},maxBy:function(e,t){return Et(this,t,e)},min:function(e){return Et(this,e?en(e):rn)},minBy:function(e,t){return Et(this,t?en(t):rn,e)},rest:function(){return this.slice(1)},skip:function(e){return this.slice(Math.max(0,e))},skipLast:function(e){return Ct(this,this.toSeq().reverse().skip(e).reverse())},skipWhile:function(e,t){return Ct(this,mt(this,e,t,!0))},skipUntil:function(e,t){return this.skipWhile(Zt(e),t)},sortBy:function(e,t){return Ct(this,bt(this,t,e))},take:function(e){return this.slice(0,Math.max(0,e))},takeLast:function(e){return Ct(this,this.toSeq().reverse().take(e).reverse())},takeWhile:function(e,t){return Ct(this,ht(this,e,t))},takeUntil:function(e,t){return this.takeWhile(Zt(e),t)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||(this.__hash=on(this))}});var ar=t.prototype;ar[ln]=!0,ar[Cn]=ar.values,ar.__toJS=ar.toArray,ar.__toStringMapper=tn,ar.inspect=ar.toSource=function(){return this.toString()},ar.chain=ar.flatMap,ar.contains=ar.includes,$t(n,{flip:function(){return Ct(this,ut(this))},mapEntries:function(e,t){var n=this,r=0;return Ct(this,this.toSeq().map(function(o,i){return e.call(t,[i,o],r++,n)}).fromEntrySeq())},mapKeys:function(e,t){var n=this;return Ct(this,this.toSeq().flip().map(function(r,o){return e.call(t,r,o,n)}).flip())}});var ur=n.prototype;return ur[cn]=!0,ur[Cn]=ar.entries,ur.__toJS=ar.toObject,ur.__toStringMapper=function(e,t){return JSON.stringify(t)+": "+tn(e)},$t(r,{toKeyedSeq:function(){return new rt(this,!1)},filter:function(e,t){return Ct(this,ct(this,e,t,!1))},findIndex:function(e,t){var n=this.findEntry(e,t);return n?n[0]:-1},indexOf:function(e){var t=this.keyOf(e);return void 0===t?-1:t},lastIndexOf:function(e){var t=this.lastKeyOf(e);return void 0===t?-1:t},reverse:function(){return Ct(this,lt(this,!1))},slice:function(e,t){return Ct(this,dt(this,e,t,!1))},splice:function(e,t){var n=arguments.length;if(t=Math.max(0|t,0),0===n||2===n&&!t)return this;e=g(e,e<0?this.count():this.size);var r=this.slice(0,e);return Ct(this,1===n?r:r.concat(d(arguments,2),this.slice(e+t)))},findLastIndex:function(e,t){var n=this.findLastEntry(e,t);return n?n[0]:-1},first:function(){return this.get(0)},flatten:function(e){return Ct(this,vt(this,e,!1))},get:function(e,t){return e=m(this,e),e<0||this.size===1/0||void 0!==this.size&&e>this.size?t:this.find(function(t,n){return n===e},void 0,t)},has:function(e){return(e=m(this,e))>=0&&(void 0!==this.size?this.size===1/0||e<this.size:-1!==this.indexOf(e))},interpose:function(e){return Ct(this,_t(this,e))},interleave:function(){var e=[this].concat(d(arguments)),t=St(this.toSeq(),N.of,e),n=t.flatten(!0);return t.size&&(n.size=t.size*e.length),Ct(this,n)},keySeq:function(){return Z(0,this.size)},last:function(){return this.get(-1)},skipWhile:function(e,t){return Ct(this,mt(this,e,t,!1))},zip:function(){return Ct(this,St(this,nn,[this].concat(d(arguments))))},zipWith:function(e){var t=d(arguments);return t[0]=this,Ct(this,St(this,e,t))}}),r.prototype[fn]=!0,r.prototype[pn]=!0,$t(o,{get:function(e,t){return this.has(e)?e:t},includes:function(e){return this.has(e)},keySeq:function(){return this.valueSeq()}}),o.prototype.has=ar.includes,o.prototype.contains=o.prototype.includes,$t(I,n.prototype),$t(N,r.prototype),$t(A,o.prototype),$t(te,n.prototype),$t(ne,r.prototype),$t(re,o.prototype),{Iterable:t,Seq:P,Collection:ee,Map:fe,OrderedMap:Xe,List:ze,Stack:Wt,Set:jt,OrderedSet:Ht,Record:At,Range:Z,Repeat:J,is:Y,fromJS:K}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(26),o=function(){function e(){}return Object.defineProperty(e,"instance",{get:function(){return e.current||(e.current=new e),e.current},set:function(t){e.current=t},enumerable:!0,configurable:!0}),e.prototype.pluginRestGet=function(e,t){var n=this;return this.makeApiRequest("GET",""+r.default.base+r.default.disqusBase+e,null,function(e){n.handleResponse(e.target.responseText,t)})},e.prototype.pluginRestPost=function(e,t,n){var o=this;return this.makeApiRequest("POST",""+r.default.base+r.default.disqusBase+e,t&&JSON.stringify(t),function(e){o.handleResponse(e.target.responseText,n)})},e.prototype.wordpressRestGet=function(e,t,n){var o=this;return this.makeApiRequest("GET",r.default.base+"wp/v2/"+e+(r.default.base.indexOf("?")>-1?"&":"?")+(t||""),null,function(e){o.handleResponse(e.target.responseText,n)})},e.prototype.makeApiRequest=function(e,t,n,o){var i=new XMLHttpRequest;return i.open(e,t),i.setRequestHeader("Content-type","application/json"),i.setRequestHeader("X-WP-Nonce",r.default.nonce),i.addEventListener("load",o),i.send(n),i},e.prototype.handleResponse=function(e,t){var n=null;try{n=JSON.parse(e)}catch(e){}t.call(null,n)},e}();t.WordPressRestApi=o},function(e,t,n){"use strict";function r(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}/*
2
+ object-assign
3
+ (c) Sindre Sorhus
4
+ @license MIT
5
+ */
6
+ var o=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,u,s=r(e),l=1;l<arguments.length;l++){n=Object(arguments[l]);for(var c in n)i.call(n,c)&&(s[c]=n[c]);if(o){u=o(n);for(var f=0;f<u.length;f++)a.call(n,u[f])&&(s[u[f]]=n[u[f]])}}return s}},function(e,t,n){"use strict";var r={};e.exports=r},function(e,t,n){e.exports=n(41)()},function(e,t,n){"use strict";n.d(t,"b",function(){return i}),n.d(t,"a",function(){return a});var r=n(14),o=n.n(r),i=o.a.shape({trySubscribe:o.a.func.isRequired,tryUnsubscribe:o.a.func.isRequired,notifyNestedSubs:o.a.func.isRequired,isSubscribed:o.a.func.isRequired}),a=o.a.shape({subscribe:o.a.func.isRequired,dispatch:o.a.func.isRequired,getState:o.a.func.isRequired})},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function a(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function u(){}function s(e,t){var n={run:function(r){try{var o=e(t.getState(),r);(o!==n.props||n.error)&&(n.shouldComponentUpdate=!0,n.props=o,n.error=null)}catch(e){n.shouldComponentUpdate=!0,n.error=e}}};return n}function l(e){var t,n,l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},c=l.getDisplayName,p=void 0===c?function(e){return"ConnectAdvanced("+e+")"}:c,b=l.methodName,E=void 0===b?"connectAdvanced":b,w=l.renderCountProp,S=void 0===w?void 0:w,C=l.shouldHandleStateChanges,k=void 0===C||C,O=l.storeKey,x=void 0===O?"store":O,T=l.withRef,P=void 0!==T&&T,I=a(l,["getDisplayName","methodName","renderCountProp","shouldHandleStateChanges","storeKey","withRef"]),N=x+"Subscription",A=g++,D=(t={},t[x]=y.a,t[N]=y.b,t),M=(n={},n[N]=y.b,n);return function(t){d()("function"==typeof t,"You must pass a component to the function returned by connect. Instead received "+JSON.stringify(t));var n=t.displayName||t.name||"Component",a=p(n),l=v({},I,{getDisplayName:p,methodName:E,renderCountProp:S,shouldHandleStateChanges:k,storeKey:x,withRef:P,displayName:a,wrappedComponentName:n,WrappedComponent:t}),c=function(n){function c(e,t){r(this,c);var i=o(this,n.call(this,e,t));return i.version=A,i.state={},i.renderCount=0,i.store=e[x]||t[x],i.propsMode=Boolean(e[x]),i.setWrappedInstance=i.setWrappedInstance.bind(i),d()(i.store,'Could not find "'+x+'" in either the context or props of "'+a+'". Either wrap the root component in a <Provider>, or explicitly pass "'+x+'" as a prop to "'+a+'".'),i.initSelector(),i.initSubscription(),i}return i(c,n),c.prototype.getChildContext=function(){var e,t=this.propsMode?null:this.subscription;return e={},e[N]=t||this.context[N],e},c.prototype.componentDidMount=function(){k&&(this.subscription.trySubscribe(),this.selector.run(this.props),this.selector.shouldComponentUpdate&&this.forceUpdate())},c.prototype.componentWillReceiveProps=function(e){this.selector.run(e)},c.prototype.shouldComponentUpdate=function(){return this.selector.shouldComponentUpdate},c.prototype.componentWillUnmount=function(){this.subscription&&this.subscription.tryUnsubscribe(),this.subscription=null,this.notifyNestedSubs=u,this.store=null,this.selector.run=u,this.selector.shouldComponentUpdate=!1},c.prototype.getWrappedInstance=function(){return d()(P,"To access the wrapped instance, you need to specify { withRef: true } in the options argument of the "+E+"() call."),this.wrappedInstance},c.prototype.setWrappedInstance=function(e){this.wrappedInstance=e},c.prototype.initSelector=function(){var t=e(this.store.dispatch,l);this.selector=s(t,this.store),this.selector.run(this.props)},c.prototype.initSubscription=function(){if(k){var e=(this.propsMode?this.props:this.context)[N];this.subscription=new m.a(this.store,e,this.onStateChange.bind(this)),this.notifyNestedSubs=this.subscription.notifyNestedSubs.bind(this.subscription)}},c.prototype.onStateChange=function(){this.selector.run(this.props),this.selector.shouldComponentUpdate?(this.componentDidUpdate=this.notifyNestedSubsOnComponentDidUpdate,this.setState(_)):this.notifyNestedSubs()},c.prototype.notifyNestedSubsOnComponentDidUpdate=function(){this.componentDidUpdate=void 0,this.notifyNestedSubs()},c.prototype.isSubscribed=function(){return Boolean(this.subscription)&&this.subscription.isSubscribed()},c.prototype.addExtraProps=function(e){if(!(P||S||this.propsMode&&this.subscription))return e;var t=v({},e);return P&&(t.ref=this.setWrappedInstance),S&&(t[S]=this.renderCount++),this.propsMode&&this.subscription&&(t[N]=this.subscription),t},c.prototype.render=function(){var e=this.selector;if(e.shouldComponentUpdate=!1,e.error)throw e.error;return Object(h.createElement)(t,this.addExtraProps(e.props))},c}(h.Component);return c.WrappedComponent=t,c.displayName=a,c.childContextTypes=M,c.contextTypes=D,c.propTypes=D,f()(c,t)}}t.a=l;var c=n(44),f=n.n(c),p=n(45),d=n.n(p),h=n(0),m=(n.n(h),n(46)),y=n(15),v=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},g=0,_={}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(18),o=n(62),i=n(63),a=n(64),u=n(22);n(21);n.d(t,"createStore",function(){return r.b}),n.d(t,"combineReducers",function(){return o.a}),n.d(t,"bindActionCreators",function(){return i.a}),n.d(t,"applyMiddleware",function(){return a.a}),n.d(t,"compose",function(){return u.a})},function(e,t,n){"use strict";function r(e,t,n){function i(){v===y&&(v=y.slice())}function s(){return m}function l(e){if("function"!=typeof e)throw new Error("Expected listener to be a function.");var t=!0;return i(),v.push(e),function(){if(t){t=!1,i();var n=v.indexOf(e);v.splice(n,1)}}}function c(e){if(!Object(o.a)(e))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(void 0===e.type)throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(g)throw new Error("Reducers may not dispatch actions.");try{g=!0,m=h(m,e)}finally{g=!1}for(var t=y=v,n=0;n<t.length;n++){(0,t[n])()}return e}function f(e){if("function"!=typeof e)throw new Error("Expected the nextReducer to be a function.");h=e,c({type:u.INIT})}function p(){var e,t=l;return e={subscribe:function(e){function n(){e.next&&e.next(s())}if("object"!=typeof e)throw new TypeError("Expected the observer to be an object.");return n(),{unsubscribe:t(n)}}},e[a.a]=function(){return this},e}var d;if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error("Expected the enhancer to be a function.");return n(r)(e,t)}if("function"!=typeof e)throw new Error("Expected the reducer to be a function.");var h=e,m=t,y=[],v=y,g=!1;return c({type:u.INIT}),d={dispatch:c,subscribe:l,getState:s,replaceReducer:f},d[a.a]=p,d}n.d(t,"a",function(){return u}),t.b=r;var o=n(8),i=n(58),a=n.n(i),u={INIT:"@@redux/INIT"}},function(e,t,n){"use strict";var r=n(51),o=r.a.Symbol;t.a=o},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict"},function(e,t,n){"use strict";function r(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce(function(e,t){return function(){return e(t.apply(void 0,arguments))}})}t.a=r},function(e,t,n){"use strict";function r(e){return function(t,n){function r(){return o}var o=e(t,n);return r.dependsOnOwnProps=!1,r}}function o(e){return null!==e.dependsOnOwnProps&&void 0!==e.dependsOnOwnProps?Boolean(e.dependsOnOwnProps):1!==e.length}function i(e,t){return function(t,n){var r=(n.displayName,function(e,t){return r.dependsOnOwnProps?r.mapToProps(e,t):r.mapToProps(e)});return r.dependsOnOwnProps=!0,r.mapToProps=function(t,n){r.mapToProps=e,r.dependsOnOwnProps=o(e);var i=r(t,n);return"function"==typeof i&&(r.mapToProps=i,r.dependsOnOwnProps=o(i),i=r(t,n)),i},r}}t.a=r,t.b=i;n(24)},function(e,t,n){"use strict";n(8),n(7)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){}return Object.defineProperty(e,"instance",{get:function(){return o},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"apiKey",{get:function(){return this._apiKey},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"accessToken",{get:function(){return this._accessToken},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"forum",{get:function(){return this._forum},enumerable:!0,configurable:!0}),e.prototype.configure=function(e,t,n){this._apiKey=e,this._accessToken=t,this._forum=n},e.prototype.createImport=function(e,t,n){var r=new FormData;return r.append("upload",new Blob([e],{type:"text/xml"}),t),r.append("sourceType","0"),r.append("forum",this.forum),r.append("api_key",this.apiKey),r.append("access_token",this.accessToken),this.post("imports/create",r,n)},e.prototype.post=function(e,t,n){if(!this.apiKey)return null;var r=new XMLHttpRequest;return r.open("POST","https://disqus.com/api/3.0/"+e+".json"),r.addEventListener("load",n),r.send(t),r},e}();t.DisqusApi=r;var o=new r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=window,o=r.DISQUS_WP&&r.DISQUS_WP.rest;t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n(28)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),o=n(30),i=n(1),a=n(17),u=n(5),s=n(69),l=n(25),c=n(92),f=n(11),p=a.createStore(c.default),d=document.getElementById("disqus-admin"),h=function(e){p.dispatch(u.setMessageAction(null))},m=function(e){e&&e.preventDefault(),p.dispatch(u.changeTabStateAction(window.location.hash.replace("#","")))};window.addEventListener("hashchange",m),window.location.hash&&m(null),o.render(r.createElement(i.Provider,{store:p},r.createElement(s.default,null)),d,function(){var e=function(e){return!!e&&("OK"===e.code||(p.dispatch(u.setMessageAction({onDismiss:h,text:e.message,type:"error"})),!1))};p.dispatch(u.setValueAction("isFetchingAdminOptions",!0)),p.dispatch(u.setValueAction("isFetchingSyncStatus",!0)),f.WordPressRestApi.instance.pluginRestGet("settings",function(t){if(p.dispatch(u.setValueAction("isFetchingAdminOptions",!1)),e(t)){var n=t.data;l.DisqusApi.instance.configure(n.disqus_public_key,n.disqus_admin_access_token,n.disqus_forum_url),p.dispatch(u.updateAdminOptionsAction(t.data))}}),f.WordPressRestApi.instance.pluginRestGet("sync/status",function(t){p.dispatch(u.setValueAction("isFetchingSyncStatus",!1)),e(t)&&p.dispatch(u.updateSyncStatusAction(t.data))})})},function(e,t,n){"use strict";function r(e){for(var t=arguments.length-1,n="Minified React error #"+e+"; visit http://facebook.github.io/react/docs/error-decoder.html?invariant="+e,r=0;r<t;r++)n+="&args[]="+encodeURIComponent(arguments[r+1]);throw t=Error(n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."),t.name="Invariant Violation",t.framesToPop=1,t}function o(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||T}function i(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||T}function a(){}function u(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||T}function s(e,t,n){var r,o={},i=null,a=null;if(null!=t)for(r in void 0!==t.ref&&(a=t.ref),void 0!==t.key&&(i=""+t.key),t)A.call(t,r)&&!D.hasOwnProperty(r)&&(o[r]=t[r]);var u=arguments.length-2;if(1===u)o.children=n;else if(1<u){for(var s=Array(u),l=0;l<u;l++)s[l]=arguments[l+2];o.children=s}if(e&&e.defaultProps)for(r in u=e.defaultProps)void 0===o[r]&&(o[r]=u[r]);return{$$typeof:w,type:e,key:i,ref:a,props:o,_owner:N.current}}function l(e){return"object"==typeof e&&null!==e&&e.$$typeof===w}function c(e){var t={"=":"=0",":":"=2"};return"$"+(""+e).replace(/[=:]/g,function(e){return t[e]})}function f(e,t,n,r){if(R.length){var o=R.pop();return o.result=e,o.keyPrefix=t,o.func=n,o.context=r,o.count=0,o}return{result:e,keyPrefix:t,func:n,context:r,count:0}}function p(e){e.result=null,e.keyPrefix=null,e.func=null,e.context=null,e.count=0,10>R.length&&R.push(e)}function d(e,t,n,o){var i=typeof e;"undefined"!==i&&"boolean"!==i||(e=null);var a=!1;if(null===e)a=!0;else switch(i){case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case w:case S:case C:case k:a=!0}}if(a)return n(o,e,""===t?"."+h(e,0):t),1;if(a=0,t=""===t?".":t+":",Array.isArray(e))for(var u=0;u<e.length;u++){i=e[u];var s=t+h(i,u);a+=d(i,s,n,o)}else if(null===e||void 0===e?s=null:(s=x&&e[x]||e["@@iterator"],s="function"==typeof s?s:null),"function"==typeof s)for(e=s.call(e),u=0;!(i=e.next()).done;)i=i.value,s=t+h(i,u++),a+=d(i,s,n,o);else"object"===i&&(n=""+e,r("31","[object Object]"===n?"object with keys {"+Object.keys(e).join(", ")+"}":n,""));return a}function h(e,t){return"object"==typeof e&&null!==e&&null!=e.key?c(e.key):t.toString(36)}function m(e,t){e.func.call(e.context,t,e.count++)}function y(e,t,n){var r=e.result,o=e.keyPrefix;e=e.func.call(e.context,t,e.count++),Array.isArray(e)?v(e,r,n,b.thatReturnsArgument):null!=e&&(l(e)&&(t=o+(!e.key||t&&t.key===e.key?"":(""+e.key).replace(M,"$&/")+"/")+n,e={$$typeof:w,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}),r.push(e))}function v(e,t,n,r,o){var i="";null!=n&&(i=(""+n).replace(M,"$&/")+"/"),t=f(t,i,r,o),null==e||d(e,"",y,t),p(t)}/** @license React v16.2.0
7
+ * react.production.min.js
8
+ *
9
+ * Copyright (c) 2013-present, Facebook, Inc.
10
+ *
11
+ * This source code is licensed under the MIT license found in the
12
+ * LICENSE file in the root directory of this source tree.
13
+ */
14
+ var g=n(12),_=n(13),b=n(4),E="function"==typeof Symbol&&Symbol.for,w=E?Symbol.for("react.element"):60103,S=E?Symbol.for("react.call"):60104,C=E?Symbol.for("react.return"):60105,k=E?Symbol.for("react.portal"):60106,O=E?Symbol.for("react.fragment"):60107,x="function"==typeof Symbol&&Symbol.iterator,T={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}};o.prototype.isReactComponent={},o.prototype.setState=function(e,t){"object"!=typeof e&&"function"!=typeof e&&null!=e&&r("85"),this.updater.enqueueSetState(this,e,t,"setState")},o.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},a.prototype=o.prototype;var P=i.prototype=new a;P.constructor=i,g(P,o.prototype),P.isPureReactComponent=!0;var I=u.prototype=new a;I.constructor=u,g(I,o.prototype),I.unstable_isAsyncReactComponent=!0,I.render=function(){return this.props.children};var N={current:null},A=Object.prototype.hasOwnProperty,D={key:!0,ref:!0,__self:!0,__source:!0},M=/\/+/g,R=[],q={Children:{map:function(e,t,n){if(null==e)return e;var r=[];return v(e,r,null,t,n),r},forEach:function(e,t,n){if(null==e)return e;t=f(null,null,t,n),null==e||d(e,"",m,t),p(t)},count:function(e){return null==e?0:d(e,"",b.thatReturnsNull,null)},toArray:function(e){var t=[];return v(e,t,null,b.thatReturnsArgument),t},only:function(e){return l(e)||r("143"),e}},Component:o,PureComponent:i,unstable_AsyncComponent:u,Fragment:O,createElement:s,cloneElement:function(e,t,n){var r=g({},e.props),o=e.key,i=e.ref,a=e._owner;if(null!=t){if(void 0!==t.ref&&(i=t.ref,a=N.current),void 0!==t.key&&(o=""+t.key),e.type&&e.type.defaultProps)var u=e.type.defaultProps;for(s in t)A.call(t,s)&&!D.hasOwnProperty(s)&&(r[s]=void 0===t[s]&&void 0!==u?u[s]:t[s])}var s=arguments.length-2;if(1===s)r.children=n;else if(1<s){u=Array(s);for(var l=0;l<s;l++)u[l]=arguments[l+2];r.children=u}return{$$typeof:w,type:e.type,key:o,ref:i,props:r,_owner:a}},createFactory:function(e){var t=s.bind(null,e);return t.type=e,t},isValidElement:l,version:"16.2.0",__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{ReactCurrentOwner:N,assign:g}},j=Object.freeze({default:q}),U=j&&q||j;e.exports=U.default?U.default:U},function(e,t,n){"use strict";function r(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(e){console.error(e)}}r(),e.exports=n(31)},function(e,t,n){"use strict";function r(e){for(var t=arguments.length-1,n="Minified React error #"+e+"; visit http://facebook.github.io/react/docs/error-decoder.html?invariant="+e,r=0;r<t;r++)n+="&args[]="+encodeURIComponent(arguments[r+1]);throw t=Error(n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."),t.name="Invariant Violation",t.framesToPop=1,t}function o(e,t){return(e&t)===t}function i(e,t){if(Pn.hasOwnProperty(e)||2<e.length&&("o"===e[0]||"O"===e[0])&&("n"===e[1]||"N"===e[1]))return!1;if(null===t)return!0;switch(typeof t){case"boolean":return Pn.hasOwnProperty(e)?e=!0:(t=a(e))?e=t.hasBooleanValue||t.hasStringBooleanValue||t.hasOverloadedBooleanValue:(e=e.toLowerCase().slice(0,5),e="data-"===e||"aria-"===e),e;case"undefined":case"number":case"string":case"object":return!0;default:return!1}}function a(e){return Nn.hasOwnProperty(e)?Nn[e]:null}function u(e){return e[1].toUpperCase()}function s(e,t,n,r,o,i,a,u,s){Bn._hasCaughtError=!1,Bn._caughtError=null;var l=Array.prototype.slice.call(arguments,3);try{t.apply(n,l)}catch(e){Bn._caughtError=e,Bn._hasCaughtError=!0}}function l(){if(Bn._hasRethrowError){var e=Bn._rethrowError;throw Bn._rethrowError=null,Bn._hasRethrowError=!1,e}}function c(){if(Kn)for(var e in Wn){var t=Wn[e],n=Kn.indexOf(e);if(-1<n||r("96",e),!Gn[n]){t.extractEvents||r("97",e),Gn[n]=t,n=t.eventTypes;for(var o in n){var i=void 0,a=n[o],u=t,s=o;Qn.hasOwnProperty(s)&&r("99",s),Qn[s]=a;var l=a.phasedRegistrationNames;if(l){for(i in l)l.hasOwnProperty(i)&&f(l[i],u,s);i=!0}else a.registrationName?(f(a.registrationName,u,s),i=!0):i=!1;i||r("98",o,e)}}}}function f(e,t,n){Yn[e]&&r("100",e),Yn[e]=t,$n[e]=t.eventTypes[n].dependencies}function p(e){Kn&&r("101"),Kn=Array.prototype.slice.call(e),c()}function d(e){var t,n=!1;for(t in e)if(e.hasOwnProperty(t)){var o=e[t];Wn.hasOwnProperty(t)&&Wn[t]===o||(Wn[t]&&r("102",t),Wn[t]=o,n=!0)}n&&c()}function h(e,t,n,r){t=e.type||"unknown-event",e.currentTarget=er(r),Bn.invokeGuardedCallbackAndCatchFirstError(t,n,void 0,e),e.currentTarget=null}function m(e,t){return null==t&&r("30"),null==e?t:Array.isArray(e)?Array.isArray(t)?(e.push.apply(e,t),e):(e.push(t),e):Array.isArray(t)?[e].concat(t):[e,t]}function y(e,t,n){Array.isArray(e)?e.forEach(t,n):e&&t.call(n,e)}function v(e,t){if(e){var n=e._dispatchListeners,r=e._dispatchInstances;if(Array.isArray(n))for(var o=0;o<n.length&&!e.isPropagationStopped();o++)h(e,t,n[o],r[o]);else n&&h(e,t,n,r);e._dispatchListeners=null,e._dispatchInstances=null,e.isPersistent()||e.constructor.release(e)}}function g(e){return v(e,!0)}function _(e){return v(e,!1)}function b(e,t){var n=e.stateNode;if(!n)return null;var o=Xn(n);if(!o)return null;n=o[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":(o=!o.disabled)||(e=e.type,o=!("button"===e||"input"===e||"select"===e||"textarea"===e)),e=!o;break e;default:e=!1}return e?null:(n&&"function"!=typeof n&&r("231",t,typeof n),n)}function E(e,t,n,r){for(var o,i=0;i<Gn.length;i++){var a=Gn[i];a&&(a=a.extractEvents(e,t,n,r))&&(o=m(o,a))}return o}function w(e){e&&(tr=m(tr,e))}function S(e){var t=tr;tr=null,t&&(e?y(t,g):y(t,_),tr&&r("95"),Bn.rethrowCaughtError())}function C(e){if(e[ir])return e[ir];for(var t=[];!e[ir];){if(t.push(e),!e.parentNode)return null;e=e.parentNode}var n=void 0,r=e[ir];if(5===r.tag||6===r.tag)return r;for(;e&&(r=e[ir]);e=t.pop())n=r;return n}function k(e){if(5===e.tag||6===e.tag)return e.stateNode;r("33")}function O(e){return e[ar]||null}function x(e){do{e=e.return}while(e&&5!==e.tag);return e||null}function T(e,t,n){for(var r=[];e;)r.push(e),e=x(e);for(e=r.length;0<e--;)t(r[e],"captured",n);for(e=0;e<r.length;e++)t(r[e],"bubbled",n)}function P(e,t,n){(t=b(e,n.dispatchConfig.phasedRegistrationNames[t]))&&(n._dispatchListeners=m(n._dispatchListeners,t),n._dispatchInstances=m(n._dispatchInstances,e))}function I(e){e&&e.dispatchConfig.phasedRegistrationNames&&T(e._targetInst,P,e)}function N(e){if(e&&e.dispatchConfig.phasedRegistrationNames){var t=e._targetInst;t=t?x(t):null,T(t,P,e)}}function A(e,t,n){e&&n&&n.dispatchConfig.registrationName&&(t=b(e,n.dispatchConfig.registrationName))&&(n._dispatchListeners=m(n._dispatchListeners,t),n._dispatchInstances=m(n._dispatchInstances,e))}function D(e){e&&e.dispatchConfig.registrationName&&A(e._targetInst,null,e)}function M(e){y(e,I)}function R(e,t,n,r){if(n&&r)e:{for(var o=n,i=r,a=0,u=o;u;u=x(u))a++;u=0;for(var s=i;s;s=x(s))u++;for(;0<a-u;)o=x(o),a--;for(;0<u-a;)i=x(i),u--;for(;a--;){if(o===i||o===i.alternate)break e;o=x(o),i=x(i)}o=null}else o=null;for(i=o,o=[];n&&n!==i&&(null===(a=n.alternate)||a!==i);)o.push(n),n=x(n);for(n=[];r&&r!==i&&(null===(a=r.alternate)||a!==i);)n.push(r),r=x(r);for(r=0;r<o.length;r++)A(o[r],"bubbled",e);for(e=n.length;0<e--;)A(n[e],"captured",t)}function q(){return!lr&&bn.canUseDOM&&(lr="textContent"in document.documentElement?"textContent":"innerText"),lr}function j(){if(cr._fallbackText)return cr._fallbackText;var e,t,n=cr._startText,r=n.length,o=U(),i=o.length;for(e=0;e<r&&n[e]===o[e];e++);var a=r-e;for(t=1;t<=a&&n[r-t]===o[i-t];t++);return cr._fallbackText=o.slice(e,1<t?1-t:void 0),cr._fallbackText}function U(){return"value"in cr._root?cr._root.value:cr._root[q()]}function z(e,t,n,r){this.dispatchConfig=e,this._targetInst=t,this.nativeEvent=n,e=this.constructor.Interface;for(var o in e)e.hasOwnProperty(o)&&((t=e[o])?this[o]=t(n):"target"===o?this.target=r:this[o]=n[o]);return this.isDefaultPrevented=(null!=n.defaultPrevented?n.defaultPrevented:!1===n.returnValue)?wn.thatReturnsTrue:wn.thatReturnsFalse,this.isPropagationStopped=wn.thatReturnsFalse,this}function L(e,t,n,r){if(this.eventPool.length){var o=this.eventPool.pop();return this.call(o,e,t,n,r),o}return new this(e,t,n,r)}function F(e){e instanceof this||r("223"),e.destructor(),10>this.eventPool.length&&this.eventPool.push(e)}function H(e){e.eventPool=[],e.getPooled=L,e.release=F}function V(e,t,n,r){return z.call(this,e,t,n,r)}function B(e,t,n,r){return z.call(this,e,t,n,r)}function K(e,t){switch(e){case"topKeyUp":return-1!==dr.indexOf(t.keyCode);case"topKeyDown":return 229!==t.keyCode;case"topKeyPress":case"topMouseDown":case"topBlur":return!0;default:return!1}}function W(e){return e=e.detail,"object"==typeof e&&"data"in e?e.data:null}function G(e,t){switch(e){case"topCompositionEnd":return W(t);case"topKeyPress":return 32!==t.which?null:(Sr=!0,Er);case"topTextInput":return e=t.data,e===Er&&Sr?null:e;default:return null}}function Q(e,t){if(Cr)return"topCompositionEnd"===e||!hr&&K(e,t)?(e=j(),cr._root=null,cr._startText=null,cr._fallbackText=null,Cr=!1,e):null;switch(e){case"topPaste":return null;case"topKeyPress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"topCompositionEnd":return br?null:t.data;default:return null}}function Y(e){if(e=Zn(e)){Or&&"function"==typeof Or.restoreControlledState||r("194");var t=Xn(e.stateNode);Or.restoreControlledState(e.stateNode,e.type,t)}}function $(e){xr?Tr?Tr.push(e):Tr=[e]:xr=e}function J(){if(xr){var e=xr,t=Tr;if(Tr=xr=null,Y(e),t)for(e=0;e<t.length;e++)Y(t[e])}}function X(e,t){return e(t)}function Z(e,t){if(Nr)return X(e,t);Nr=!0;try{return X(e,t)}finally{Nr=!1,J()}}function ee(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!Ar[e.type]:"textarea"===t}function te(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}function ne(e,t){if(!bn.canUseDOM||t&&!("addEventListener"in document))return!1;t="on"+e;var n=t in document;return n||(n=document.createElement("div"),n.setAttribute(t,"return;"),n="function"==typeof n[t]),!n&&gr&&"wheel"===e&&(n=document.implementation.hasFeature("Events.wheel","3.0")),n}function re(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function oe(e){var t=re(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&"function"==typeof n.get&&"function"==typeof n.set)return Object.defineProperty(e,t,{enumerable:n.enumerable,configurable:!0,get:function(){return n.get.call(this)},set:function(e){r=""+e,n.set.call(this,e)}}),{getValue:function(){return r},setValue:function(e){r=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}function ie(e){e._valueTracker||(e._valueTracker=oe(e))}function ae(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=re(e)?e.checked?"true":"false":e.value),(e=r)!==n&&(t.setValue(e),!0)}function ue(e,t,n){return e=z.getPooled(Dr.change,e,t,n),e.type="change",$(n),M(e),e}function se(e){w(e),S(!1)}function le(e){if(ae(k(e)))return e}function ce(e,t){if("topChange"===e)return t}function fe(){Mr&&(Mr.detachEvent("onpropertychange",pe),Rr=Mr=null)}function pe(e){"value"===e.propertyName&&le(Rr)&&(e=ue(Rr,e,te(e)),Z(se,e))}function de(e,t,n){"topFocus"===e?(fe(),Mr=t,Rr=n,Mr.attachEvent("onpropertychange",pe)):"topBlur"===e&&fe()}function he(e){if("topSelectionChange"===e||"topKeyUp"===e||"topKeyDown"===e)return le(Rr)}function me(e,t){if("topClick"===e)return le(t)}function ye(e,t){if("topInput"===e||"topChange"===e)return le(t)}function ve(e,t,n,r){return z.call(this,e,t,n,r)}function ge(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=Ur[e])&&!!t[e]}function _e(){return ge}function be(e,t,n,r){return z.call(this,e,t,n,r)}function Ee(e){return e=e.type,"string"==typeof e?e:"function"==typeof e?e.displayName||e.name:null}function we(e){var t=e;if(e.alternate)for(;t.return;)t=t.return;else{if(0!=(2&t.effectTag))return 1;for(;t.return;)if(t=t.return,0!=(2&t.effectTag))return 1}return 3===t.tag?2:3}function Se(e){return!!(e=e._reactInternalFiber)&&2===we(e)}function Ce(e){2!==we(e)&&r("188")}function ke(e){var t=e.alternate;if(!t)return t=we(e),3===t&&r("188"),1===t?null:e;for(var n=e,o=t;;){var i=n.return,a=i?i.alternate:null;if(!i||!a)break;if(i.child===a.child){for(var u=i.child;u;){if(u===n)return Ce(i),e;if(u===o)return Ce(i),t;u=u.sibling}r("188")}if(n.return!==o.return)n=i,o=a;else{u=!1;for(var s=i.child;s;){if(s===n){u=!0,n=i,o=a;break}if(s===o){u=!0,o=i,n=a;break}s=s.sibling}if(!u){for(s=a.child;s;){if(s===n){u=!0,n=a,o=i;break}if(s===o){u=!0,o=a,n=i;break}s=s.sibling}u||r("189")}}n.alternate!==o&&r("190")}return 3!==n.tag&&r("188"),n.stateNode.current===n?e:t}function Oe(e){if(!(e=ke(e)))return null;for(var t=e;;){if(5===t.tag||6===t.tag)return t;if(t.child)t.child.return=t,t=t.child;else{if(t===e)break;for(;!t.sibling;){if(!t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}}return null}function xe(e){if(!(e=ke(e)))return null;for(var t=e;;){if(5===t.tag||6===t.tag)return t;if(t.child&&4!==t.tag)t.child.return=t,t=t.child;else{if(t===e)break;for(;!t.sibling;){if(!t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}}return null}function Te(e){var t=e.targetInst;do{if(!t){e.ancestors.push(t);break}var n;for(n=t;n.return;)n=n.return;if(!(n=3!==n.tag?null:n.stateNode.containerInfo))break;e.ancestors.push(t),t=C(n)}while(t);for(n=0;n<e.ancestors.length;n++)t=e.ancestors[n],Br(e.topLevelType,t,e.nativeEvent,te(e.nativeEvent))}function Pe(e){Vr=!!e}function Ie(e,t,n){return n?Sn.listen(n,t,Ae.bind(null,e)):null}function Ne(e,t,n){return n?Sn.capture(n,t,Ae.bind(null,e)):null}function Ae(e,t){if(Vr){var n=te(t);if(n=C(n),null===n||"number"!=typeof n.tag||2===we(n)||(n=null),Hr.length){var r=Hr.pop();r.topLevelType=e,r.nativeEvent=t,r.targetInst=n,e=r}else e={topLevelType:e,nativeEvent:t,targetInst:n,ancestors:[]};try{Z(Te,e)}finally{e.topLevelType=null,e.nativeEvent=null,e.targetInst=null,e.ancestors.length=0,10>Hr.length&&Hr.push(e)}}}function De(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n["ms"+e]="MS"+t,n["O"+e]="o"+t.toLowerCase(),n}function Me(e){if(Gr[e])return Gr[e];if(!Wr[e])return e;var t,n=Wr[e];for(t in n)if(n.hasOwnProperty(t)&&t in Qr)return Gr[e]=n[t];return""}function Re(e){return Object.prototype.hasOwnProperty.call(e,Xr)||(e[Xr]=Jr++,$r[e[Xr]]={}),$r[e[Xr]]}function qe(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function je(e,t){var n=qe(e);e=0;for(var r;n;){if(3===n.nodeType){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=qe(n)}}function Ue(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&"text"===e.type||"textarea"===t||"true"===e.contentEditable)}function ze(e,t){if(oo||null==to||to!==Cn())return null;var n=to;return"selectionStart"in n&&Ue(n)?n={start:n.selectionStart,end:n.selectionEnd}:window.getSelection?(n=window.getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}):n=void 0,ro&&kn(ro,n)?null:(ro=n,e=z.getPooled(eo.select,no,e,t),e.type="select",e.target=to,M(e),e)}function Le(e,t,n,r){return z.call(this,e,t,n,r)}function Fe(e,t,n,r){return z.call(this,e,t,n,r)}function He(e,t,n,r){return z.call(this,e,t,n,r)}function Ve(e){var t=e.keyCode;return"charCode"in e?0===(e=e.charCode)&&13===t&&(e=13):e=t,32<=e||13===e?e:0}function Be(e,t,n,r){return z.call(this,e,t,n,r)}function Ke(e,t,n,r){return z.call(this,e,t,n,r)}function We(e,t,n,r){return z.call(this,e,t,n,r)}function Ge(e,t,n,r){return z.call(this,e,t,n,r)}function Qe(e,t,n,r){return z.call(this,e,t,n,r)}function Ye(e){0>po||(e.current=fo[po],fo[po]=null,po--)}function $e(e,t){po++,fo[po]=e.current,e.current=t}function Je(e){return Ze(e)?yo:ho.current}function Xe(e,t){var n=e.type.contextTypes;if(!n)return Tn;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var o,i={};for(o in n)i[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Ze(e){return 2===e.tag&&null!=e.type.childContextTypes}function et(e){Ze(e)&&(Ye(mo,e),Ye(ho,e))}function tt(e,t,n){null!=ho.cursor&&r("168"),$e(ho,t,e),$e(mo,n,e)}function nt(e,t){var n=e.stateNode,o=e.type.childContextTypes;if("function"!=typeof n.getChildContext)return t;n=n.getChildContext();for(var i in n)i in o||r("108",Ee(e)||"Unknown",i);return En({},t,n)}function rt(e){if(!Ze(e))return!1;var t=e.stateNode;return t=t&&t.__reactInternalMemoizedMergedChildContext||Tn,yo=ho.current,$e(ho,t,e),$e(mo,mo.current,e),!0}function ot(e,t){var n=e.stateNode;if(n||r("169"),t){var o=nt(e,yo);n.__reactInternalMemoizedMergedChildContext=o,Ye(mo,e),Ye(ho,e),$e(ho,o,e)}else Ye(mo,e);$e(mo,t,e)}function it(e,t,n){this.tag=e,this.key=t,this.stateNode=this.type=null,this.sibling=this.child=this.return=null,this.index=0,this.memoizedState=this.updateQueue=this.memoizedProps=this.pendingProps=this.ref=null,this.internalContextTag=n,this.effectTag=0,this.lastEffect=this.firstEffect=this.nextEffect=null,this.expirationTime=0,this.alternate=null}function at(e,t,n){var r=e.alternate;return null===r?(r=new it(e.tag,e.key,e.internalContextTag),r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.effectTag=0,r.nextEffect=null,r.firstEffect=null,r.lastEffect=null),r.expirationTime=n,r.pendingProps=t,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function ut(e,t,n){var o=void 0,i=e.type,a=e.key;return"function"==typeof i?(o=i.prototype&&i.prototype.isReactComponent?new it(2,a,t):new it(0,a,t),o.type=i,o.pendingProps=e.props):"string"==typeof i?(o=new it(5,a,t),o.type=i,o.pendingProps=e.props):"object"==typeof i&&null!==i&&"number"==typeof i.tag?(o=i,o.pendingProps=e.props):r("130",null==i?i:typeof i,""),o.expirationTime=n,o}function st(e,t,n,r){return t=new it(10,r,t),t.pendingProps=e,t.expirationTime=n,t}function lt(e,t,n){return t=new it(6,null,t),t.pendingProps=e,t.expirationTime=n,t}function ct(e,t,n){return t=new it(7,e.key,t),t.type=e.handler,t.pendingProps=e,t.expirationTime=n,t}function ft(e,t,n){return e=new it(9,null,t),e.expirationTime=n,e}function pt(e,t,n){return t=new it(4,e.key,t),t.pendingProps=e.children||[],t.expirationTime=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function dt(e){return function(t){try{return e(t)}catch(e){}}}function ht(e){if("undefined"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__)return!1;var t=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(t.isDisabled||!t.supportsFiber)return!0;try{var n=t.inject(e);vo=dt(function(e){return t.onCommitFiberRoot(n,e)}),go=dt(function(e){return t.onCommitFiberUnmount(n,e)})}catch(e){}return!0}function mt(e){"function"==typeof vo&&vo(e)}function yt(e){"function"==typeof go&&go(e)}function vt(e){return{baseState:e,expirationTime:0,first:null,last:null,callbackList:null,hasForceUpdate:!1,isInitialized:!1}}function gt(e,t){null===e.last?e.first=e.last=t:(e.last.next=t,e.last=t),(0===e.expirationTime||e.expirationTime>t.expirationTime)&&(e.expirationTime=t.expirationTime)}function _t(e,t){var n=e.alternate,r=e.updateQueue;null===r&&(r=e.updateQueue=vt(null)),null!==n?null===(e=n.updateQueue)&&(e=n.updateQueue=vt(null)):e=null,e=e!==r?e:null,null===e?gt(r,t):null===r.last||null===e.last?(gt(r,t),gt(e,t)):(gt(r,t),e.last=t)}function bt(e,t,n,r){return e=e.partialState,"function"==typeof e?e.call(t,n,r):e}function Et(e,t,n,r,o,i){null!==e&&e.updateQueue===n&&(n=t.updateQueue={baseState:n.baseState,expirationTime:n.expirationTime,first:n.first,last:n.last,isInitialized:n.isInitialized,callbackList:null,hasForceUpdate:!1}),n.expirationTime=0,n.isInitialized?e=n.baseState:(e=n.baseState=t.memoizedState,n.isInitialized=!0);for(var a=!0,u=n.first,s=!1;null!==u;){var l=u.expirationTime;if(l>i){var c=n.expirationTime;(0===c||c>l)&&(n.expirationTime=l),s||(s=!0,n.baseState=e)}else s||(n.first=u.next,null===n.first&&(n.last=null)),u.isReplace?(e=bt(u,r,e,o),a=!0):(l=bt(u,r,e,o))&&(e=a?En({},e,l):En(e,l),a=!1),u.isForced&&(n.hasForceUpdate=!0),null!==u.callback&&(l=n.callbackList,null===l&&(l=n.callbackList=[]),l.push(u));u=u.next}return null!==n.callbackList?t.effectTag|=32:null!==n.first||n.hasForceUpdate||(t.updateQueue=null),s||(n.baseState=e),e}function wt(e,t){var n=e.callbackList;if(null!==n)for(e.callbackList=null,e=0;e<n.length;e++){var o=n[e],i=o.callback;o.callback=null,"function"!=typeof i&&r("191",i),i.call(t)}}function St(e,t,n,o){function i(e,t){t.updater=a,e.stateNode=t,t._reactInternalFiber=e}var a={isMounted:Se,enqueueSetState:function(n,r,o){n=n._reactInternalFiber,o=void 0===o?null:o;var i=t(n);_t(n,{expirationTime:i,partialState:r,callback:o,isReplace:!1,isForced:!1,nextCallback:null,next:null}),e(n,i)},enqueueReplaceState:function(n,r,o){n=n._reactInternalFiber,o=void 0===o?null:o;var i=t(n);_t(n,{expirationTime:i,partialState:r,callback:o,isReplace:!0,isForced:!1,nextCallback:null,next:null}),e(n,i)},enqueueForceUpdate:function(n,r){n=n._reactInternalFiber,r=void 0===r?null:r;var o=t(n);_t(n,{expirationTime:o,partialState:null,callback:r,isReplace:!1,isForced:!0,nextCallback:null,next:null}),e(n,o)}};return{adoptClassInstance:i,constructClassInstance:function(e,t){var n=e.type,r=Je(e),o=2===e.tag&&null!=e.type.contextTypes,a=o?Xe(e,r):Tn;return t=new n(t,a),i(e,t),o&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=r,e.__reactInternalMemoizedMaskedChildContext=a),t},mountClassInstance:function(e,t){var n=e.alternate,o=e.stateNode,i=o.state||null,u=e.pendingProps;u||r("158");var s=Je(e);o.props=u,o.state=e.memoizedState=i,o.refs=Tn,o.context=Xe(e,s),null!=e.type&&null!=e.type.prototype&&!0===e.type.prototype.unstable_isAsyncReactComponent&&(e.internalContextTag|=1),"function"==typeof o.componentWillMount&&(i=o.state,o.componentWillMount(),i!==o.state&&a.enqueueReplaceState(o,o.state,null),null!==(i=e.updateQueue)&&(o.state=Et(n,e,i,o,u,t))),"function"==typeof o.componentDidMount&&(e.effectTag|=4)},updateClassInstance:function(e,t,i){var u=t.stateNode;u.props=t.memoizedProps,u.state=t.memoizedState;var s=t.memoizedProps,l=t.pendingProps;l||null==(l=s)&&r("159");var c=u.context,f=Je(t);if(f=Xe(t,f),"function"!=typeof u.componentWillReceiveProps||s===l&&c===f||(c=u.state,u.componentWillReceiveProps(l,f),u.state!==c&&a.enqueueReplaceState(u,u.state,null)),c=t.memoizedState,i=null!==t.updateQueue?Et(e,t,t.updateQueue,u,l,i):c,!(s!==l||c!==i||mo.current||null!==t.updateQueue&&t.updateQueue.hasForceUpdate))return"function"!=typeof u.componentDidUpdate||s===e.memoizedProps&&c===e.memoizedState||(t.effectTag|=4),!1;var p=l;if(null===s||null!==t.updateQueue&&t.updateQueue.hasForceUpdate)p=!0;else{var d=t.stateNode,h=t.type;p="function"==typeof d.shouldComponentUpdate?d.shouldComponentUpdate(p,i,f):!h.prototype||!h.prototype.isPureReactComponent||(!kn(s,p)||!kn(c,i))}return p?("function"==typeof u.componentWillUpdate&&u.componentWillUpdate(l,i,f),"function"==typeof u.componentDidUpdate&&(t.effectTag|=4)):("function"!=typeof u.componentDidUpdate||s===e.memoizedProps&&c===e.memoizedState||(t.effectTag|=4),n(t,l),o(t,i)),u.props=l,u.state=i,u.context=f,p}}}function Ct(e){return null===e||void 0===e?null:(e=ko&&e[ko]||e["@@iterator"],"function"==typeof e?e:null)}function kt(e,t){var n=t.ref;if(null!==n&&"function"!=typeof n){if(t._owner){t=t._owner;var o=void 0;t&&(2!==t.tag&&r("110"),o=t.stateNode),o||r("147",n);var i=""+n;return null!==e&&null!==e.ref&&e.ref._stringRef===i?e.ref:(e=function(e){var t=o.refs===Tn?o.refs={}:o.refs;null===e?delete t[i]:t[i]=e},e._stringRef=i,e)}"string"!=typeof n&&r("148"),t._owner||r("149",n)}return n}function Ot(e,t){"textarea"!==e.type&&r("31","[object Object]"===Object.prototype.toString.call(t)?"object with keys {"+Object.keys(t).join(", ")+"}":t,"")}function xt(e){function t(t,n){if(e){var r=t.lastEffect;null!==r?(r.nextEffect=n,t.lastEffect=n):t.firstEffect=t.lastEffect=n,n.nextEffect=null,n.effectTag=8}}function n(n,r){if(!e)return null;for(;null!==r;)t(n,r),r=r.sibling;return null}function o(e,t){for(e=new Map;null!==t;)null!==t.key?e.set(t.key,t):e.set(t.index,t),t=t.sibling;return e}function i(e,t,n){return e=at(e,t,n),e.index=0,e.sibling=null,e}function a(t,n,r){return t.index=r,e?null!==(r=t.alternate)?(r=r.index,r<n?(t.effectTag=2,n):r):(t.effectTag=2,n):n}function u(t){return e&&null===t.alternate&&(t.effectTag=2),t}function s(e,t,n,r){return null===t||6!==t.tag?(t=lt(n,e.internalContextTag,r),t.return=e,t):(t=i(t,n,r),t.return=e,t)}function l(e,t,n,r){return null!==t&&t.type===n.type?(r=i(t,n.props,r),r.ref=kt(t,n),r.return=e,r):(r=ut(n,e.internalContextTag,r),r.ref=kt(t,n),r.return=e,r)}function c(e,t,n,r){return null===t||7!==t.tag?(t=ct(n,e.internalContextTag,r),t.return=e,t):(t=i(t,n,r),t.return=e,t)}function f(e,t,n,r){return null===t||9!==t.tag?(t=ft(n,e.internalContextTag,r),t.type=n.value,t.return=e,t):(t=i(t,null,r),t.type=n.value,t.return=e,t)}function p(e,t,n,r){return null===t||4!==t.tag||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=pt(n,e.internalContextTag,r),t.return=e,t):(t=i(t,n.children||[],r),t.return=e,t)}function d(e,t,n,r,o){return null===t||10!==t.tag?(t=st(n,e.internalContextTag,r,o),t.return=e,t):(t=i(t,n,r),t.return=e,t)}function h(e,t,n){if("string"==typeof t||"number"==typeof t)return t=lt(""+t,e.internalContextTag,n),t.return=e,t;if("object"==typeof t&&null!==t){switch(t.$$typeof){case bo:return t.type===Co?(t=st(t.props.children,e.internalContextTag,n,t.key),t.return=e,t):(n=ut(t,e.internalContextTag,n),n.ref=kt(null,t),n.return=e,n);case Eo:return t=ct(t,e.internalContextTag,n),t.return=e,t;case wo:return n=ft(t,e.internalContextTag,n),n.type=t.value,n.return=e,n;case So:return t=pt(t,e.internalContextTag,n),t.return=e,t}if(Oo(t)||Ct(t))return t=st(t,e.internalContextTag,n,null),t.return=e,t;Ot(e,t)}return null}function m(e,t,n,r){var o=null!==t?t.key:null;if("string"==typeof n||"number"==typeof n)return null!==o?null:s(e,t,""+n,r);if("object"==typeof n&&null!==n){switch(n.$$typeof){case bo:return n.key===o?n.type===Co?d(e,t,n.props.children,r,o):l(e,t,n,r):null;case Eo:return n.key===o?c(e,t,n,r):null;case wo:return null===o?f(e,t,n,r):null;case So:return n.key===o?p(e,t,n,r):null}if(Oo(n)||Ct(n))return null!==o?null:d(e,t,n,r,null);Ot(e,n)}return null}function y(e,t,n,r,o){if("string"==typeof r||"number"==typeof r)return e=e.get(n)||null,s(t,e,""+r,o);if("object"==typeof r&&null!==r){switch(r.$$typeof){case bo:return e=e.get(null===r.key?n:r.key)||null,r.type===Co?d(t,e,r.props.children,o,r.key):l(t,e,r,o);case Eo:return e=e.get(null===r.key?n:r.key)||null,c(t,e,r,o);case wo:return e=e.get(n)||null,f(t,e,r,o);case So:return e=e.get(null===r.key?n:r.key)||null,p(t,e,r,o)}if(Oo(r)||Ct(r))return e=e.get(n)||null,d(t,e,r,o,null);Ot(t,r)}return null}function v(r,i,u,s){for(var l=null,c=null,f=i,p=i=0,d=null;null!==f&&p<u.length;p++){f.index>p?(d=f,f=null):d=f.sibling;var v=m(r,f,u[p],s);if(null===v){null===f&&(f=d);break}e&&f&&null===v.alternate&&t(r,f),i=a(v,i,p),null===c?l=v:c.sibling=v,c=v,f=d}if(p===u.length)return n(r,f),l;if(null===f){for(;p<u.length;p++)(f=h(r,u[p],s))&&(i=a(f,i,p),null===c?l=f:c.sibling=f,c=f);return l}for(f=o(r,f);p<u.length;p++)(d=y(f,r,p,u[p],s))&&(e&&null!==d.alternate&&f.delete(null===d.key?p:d.key),i=a(d,i,p),null===c?l=d:c.sibling=d,c=d);return e&&f.forEach(function(e){return t(r,e)}),l}function g(i,u,s,l){var c=Ct(s);"function"!=typeof c&&r("150"),null==(s=c.call(s))&&r("151");for(var f=c=null,p=u,d=u=0,v=null,g=s.next();null!==p&&!g.done;d++,g=s.next()){p.index>d?(v=p,p=null):v=p.sibling;var _=m(i,p,g.value,l);if(null===_){p||(p=v);break}e&&p&&null===_.alternate&&t(i,p),u=a(_,u,d),null===f?c=_:f.sibling=_,f=_,p=v}if(g.done)return n(i,p),c;if(null===p){for(;!g.done;d++,g=s.next())null!==(g=h(i,g.value,l))&&(u=a(g,u,d),null===f?c=g:f.sibling=g,f=g);return c}for(p=o(i,p);!g.done;d++,g=s.next())null!==(g=y(p,i,d,g.value,l))&&(e&&null!==g.alternate&&p.delete(null===g.key?d:g.key),u=a(g,u,d),null===f?c=g:f.sibling=g,f=g);return e&&p.forEach(function(e){return t(i,e)}),c}return function(e,o,a,s){"object"==typeof a&&null!==a&&a.type===Co&&null===a.key&&(a=a.props.children);var l="object"==typeof a&&null!==a;if(l)switch(a.$$typeof){case bo:e:{var c=a.key;for(l=o;null!==l;){if(l.key===c){if(10===l.tag?a.type===Co:l.type===a.type){n(e,l.sibling),o=i(l,a.type===Co?a.props.children:a.props,s),o.ref=kt(l,a),o.return=e,e=o;break e}n(e,l);break}t(e,l),l=l.sibling}a.type===Co?(o=st(a.props.children,e.internalContextTag,s,a.key),o.return=e,e=o):(s=ut(a,e.internalContextTag,s),s.ref=kt(o,a),s.return=e,e=s)}return u(e);case Eo:e:{for(l=a.key;null!==o;){if(o.key===l){if(7===o.tag){n(e,o.sibling),o=i(o,a,s),o.return=e,e=o;break e}n(e,o);break}t(e,o),o=o.sibling}o=ct(a,e.internalContextTag,s),o.return=e,e=o}return u(e);case wo:e:{if(null!==o){if(9===o.tag){n(e,o.sibling),o=i(o,null,s),o.type=a.value,o.return=e,e=o;break e}n(e,o)}o=ft(a,e.internalContextTag,s),o.type=a.value,o.return=e,e=o}return u(e);case So:e:{for(l=a.key;null!==o;){if(o.key===l){if(4===o.tag&&o.stateNode.containerInfo===a.containerInfo&&o.stateNode.implementation===a.implementation){n(e,o.sibling),o=i(o,a.children||[],s),o.return=e,e=o;break e}n(e,o);break}t(e,o),o=o.sibling}o=pt(a,e.internalContextTag,s),o.return=e,e=o}return u(e)}if("string"==typeof a||"number"==typeof a)return a=""+a,null!==o&&6===o.tag?(n(e,o.sibling),o=i(o,a,s)):(n(e,o),o=lt(a,e.internalContextTag,s)),o.return=e,e=o,u(e);if(Oo(a))return v(e,o,a,s);if(Ct(a))return g(e,o,a,s);if(l&&Ot(e,a),void 0===a)switch(e.tag){case 2:case 1:s=e.type,r("152",s.displayName||s.name||"Component")}return n(e,o)}}function Tt(e,t,n,o,i){function a(e,t,n){var r=t.expirationTime;t.child=null===e?To(t,null,n,r):xo(t,e.child,n,r)}function u(e,t){var n=t.ref;null===n||e&&e.ref===n||(t.effectTag|=128)}function s(e,t,n,r){if(u(e,t),!n)return r&&ot(t,!1),c(e,t);n=t.stateNode,Fr.current=t;var o=n.render();return t.effectTag|=1,a(e,t,o),t.memoizedState=n.state,t.memoizedProps=n.props,r&&ot(t,!0),t.child}function l(e){var t=e.stateNode;t.pendingContext?tt(e,t.pendingContext,t.pendingContext!==t.context):t.context&&tt(e,t.context,!1),y(e,t.containerInfo)}function c(e,t){if(null!==e&&t.child!==e.child&&r("153"),null!==t.child){e=t.child;var n=at(e,e.pendingProps,e.expirationTime);for(t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,n=n.sibling=at(e,e.pendingProps,e.expirationTime),n.return=t;n.sibling=null}return t.child}function f(e,t){switch(t.tag){case 3:l(t);break;case 2:rt(t);break;case 4:y(t,t.stateNode.containerInfo)}return null}var p=e.shouldSetTextContent,d=e.useSyncScheduling,h=e.shouldDeprioritizeSubtree,m=t.pushHostContext,y=t.pushHostContainer,v=n.enterHydrationState,g=n.resetHydrationState,_=n.tryToClaimNextHydratableInstance;e=St(o,i,function(e,t){e.memoizedProps=t},function(e,t){e.memoizedState=t});var b=e.adoptClassInstance,E=e.constructClassInstance,w=e.mountClassInstance,S=e.updateClassInstance;return{beginWork:function(e,t,n){if(0===t.expirationTime||t.expirationTime>n)return f(e,t);switch(t.tag){case 0:null!==e&&r("155");var o=t.type,i=t.pendingProps,C=Je(t);return C=Xe(t,C),o=o(i,C),t.effectTag|=1,"object"==typeof o&&null!==o&&"function"==typeof o.render?(t.tag=2,i=rt(t),b(t,o),w(t,n),t=s(e,t,!0,i)):(t.tag=1,a(e,t,o),t.memoizedProps=i,t=t.child),t;case 1:e:{if(i=t.type,n=t.pendingProps,o=t.memoizedProps,mo.current)null===n&&(n=o);else if(null===n||o===n){t=c(e,t);break e}o=Je(t),o=Xe(t,o),i=i(n,o),t.effectTag|=1,a(e,t,i),t.memoizedProps=n,t=t.child}return t;case 2:return i=rt(t),o=void 0,null===e?t.stateNode?r("153"):(E(t,t.pendingProps),w(t,n),o=!0):o=S(e,t,n),s(e,t,o,i);case 3:return l(t),i=t.updateQueue,null!==i?(o=t.memoizedState,i=Et(e,t,i,null,null,n),o===i?(g(),t=c(e,t)):(o=i.element,C=t.stateNode,(null===e||null===e.child)&&C.hydrate&&v(t)?(t.effectTag|=2,t.child=To(t,null,o,n)):(g(),a(e,t,o)),t.memoizedState=i,t=t.child)):(g(),t=c(e,t)),t;case 5:m(t),null===e&&_(t),i=t.type;var k=t.memoizedProps;return o=t.pendingProps,null===o&&null===(o=k)&&r("154"),C=null!==e?e.memoizedProps:null,mo.current||null!==o&&k!==o?(k=o.children,p(i,o)?k=null:C&&p(i,C)&&(t.effectTag|=16),u(e,t),2147483647!==n&&!d&&h(i,o)?(t.expirationTime=2147483647,t=null):(a(e,t,k),t.memoizedProps=o,t=t.child)):t=c(e,t),t;case 6:return null===e&&_(t),e=t.pendingProps,null===e&&(e=t.memoizedProps),t.memoizedProps=e,null;case 8:t.tag=7;case 7:return i=t.pendingProps,mo.current?null===i&&null===(i=e&&e.memoizedProps)&&r("154"):null!==i&&t.memoizedProps!==i||(i=t.memoizedProps),o=i.children,t.stateNode=null===e?To(t,t.stateNode,o,n):xo(t,t.stateNode,o,n),t.memoizedProps=i,t.stateNode;case 9:return null;case 4:e:{if(y(t,t.stateNode.containerInfo),i=t.pendingProps,mo.current)null===i&&null==(i=e&&e.memoizedProps)&&r("154");else if(null===i||t.memoizedProps===i){t=c(e,t);break e}null===e?t.child=xo(t,null,i,n):a(e,t,i),t.memoizedProps=i,t=t.child}return t;case 10:e:{if(n=t.pendingProps,mo.current)null===n&&(n=t.memoizedProps);else if(null===n||t.memoizedProps===n){t=c(e,t);break e}a(e,t,n),t.memoizedProps=n,t=t.child}return t;default:r("156")}},beginFailedWork:function(e,t,n){switch(t.tag){case 2:rt(t);break;case 3:l(t);break;default:r("157")}return t.effectTag|=64,null===e?t.child=null:t.child!==e.child&&(t.child=e.child),0===t.expirationTime||t.expirationTime>n?f(e,t):(t.firstEffect=null,t.lastEffect=null,t.child=null===e?To(t,null,null,n):xo(t,e.child,null,n),2===t.tag&&(e=t.stateNode,t.memoizedProps=e.props,t.memoizedState=e.state),t.child)}}}function Pt(e,t,n){function o(e){e.effectTag|=4}var i=e.createInstance,a=e.createTextInstance,u=e.appendInitialChild,s=e.finalizeInitialChildren,l=e.prepareUpdate,c=e.persistence,f=t.getRootHostContainer,p=t.popHostContext,d=t.getHostContext,h=t.popHostContainer,m=n.prepareToHydrateHostInstance,y=n.prepareToHydrateHostTextInstance,v=n.popHydrationState,g=void 0,_=void 0,b=void 0;return e.mutation?(g=function(){},_=function(e,t,n){(t.updateQueue=n)&&o(t)},b=function(e,t,n,r){n!==r&&o(t)}):r(c?"235":"236"),{completeWork:function(e,t,n){var c=t.pendingProps;switch(null===c?c=t.memoizedProps:2147483647===t.expirationTime&&2147483647!==n||(t.pendingProps=null),t.tag){case 1:return null;case 2:return et(t),null;case 3:return h(t),Ye(mo,t),Ye(ho,t),c=t.stateNode,c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),null!==e&&null!==e.child||(v(t),t.effectTag&=-3),g(t),null;case 5:p(t),n=f();var E=t.type;if(null!==e&&null!=t.stateNode){var w=e.memoizedProps,S=t.stateNode,C=d();S=l(S,E,w,c,n,C),_(e,t,S,E,w,c,n),e.ref!==t.ref&&(t.effectTag|=128)}else{if(!c)return null===t.stateNode&&r("166"),null;if(e=d(),v(t))m(t,n,e)&&o(t);else{e=i(E,c,n,e,t);e:for(w=t.child;null!==w;){if(5===w.tag||6===w.tag)u(e,w.stateNode);else if(4!==w.tag&&null!==w.child){w.child.return=w,w=w.child;continue}if(w===t)break;for(;null===w.sibling;){if(null===w.return||w.return===t)break e;w=w.return}w.sibling.return=w.return,w=w.sibling}s(e,E,c,n)&&o(t),t.stateNode=e}null!==t.ref&&(t.effectTag|=128)}return null;case 6:if(e&&null!=t.stateNode)b(e,t,e.memoizedProps,c);else{if("string"!=typeof c)return null===t.stateNode&&r("166"),null;e=f(),n=d(),v(t)?y(t)&&o(t):t.stateNode=a(c,e,n,t)}return null;case 7:(c=t.memoizedProps)||r("165"),t.tag=8,E=[];e:for((w=t.stateNode)&&(w.return=t);null!==w;){if(5===w.tag||6===w.tag||4===w.tag)r("247");else if(9===w.tag)E.push(w.type);else if(null!==w.child){w.child.return=w,w=w.child;continue}for(;null===w.sibling;){if(null===w.return||w.return===t)break e;w=w.return}w.sibling.return=w.return,w=w.sibling}return w=c.handler,c=w(c.props,E),t.child=xo(t,null!==e?e.child:null,c,n),t.child;case 8:return t.tag=7,null;case 9:case 10:return null;case 4:return h(t),g(t),null;case 0:r("167");default:r("156")}}}}function It(e,t){function n(e){var n=e.ref;if(null!==n)try{n(null)}catch(n){t(e,n)}}function o(e){switch("function"==typeof yt&&yt(e),e.tag){case 2:n(e);var r=e.stateNode;if("function"==typeof r.componentWillUnmount)try{r.props=e.memoizedProps,r.state=e.memoizedState,r.componentWillUnmount()}catch(n){t(e,n)}break;case 5:n(e);break;case 7:i(e.stateNode);break;case 4:l&&u(e)}}function i(e){for(var t=e;;)if(o(t),null===t.child||l&&4===t.tag){if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return;t=t.return}t.sibling.return=t.return,t=t.sibling}else t.child.return=t,t=t.child}function a(e){return 5===e.tag||3===e.tag||4===e.tag}function u(e){for(var t=e,n=!1,a=void 0,u=void 0;;){if(!n){n=t.return;e:for(;;){switch(null===n&&r("160"),n.tag){case 5:a=n.stateNode,u=!1;break e;case 3:case 4:a=n.stateNode.containerInfo,u=!0;break e}n=n.return}n=!0}if(5===t.tag||6===t.tag)i(t),u?_(a,t.stateNode):g(a,t.stateNode);else if(4===t.tag?a=t.stateNode.containerInfo:o(t),null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return;t=t.return,4===t.tag&&(n=!1)}t.sibling.return=t.return,t=t.sibling}}var s=e.getPublicInstance,l=e.mutation;e=e.persistence,l||r(e?"235":"236");var c=l.commitMount,f=l.commitUpdate,p=l.resetTextContent,d=l.commitTextUpdate,h=l.appendChild,m=l.appendChildToContainer,y=l.insertBefore,v=l.insertInContainerBefore,g=l.removeChild,_=l.removeChildFromContainer;return{commitResetTextContent:function(e){p(e.stateNode)},commitPlacement:function(e){e:{for(var t=e.return;null!==t;){if(a(t)){var n=t;break e}t=t.return}r("160"),n=void 0}var o=t=void 0;switch(n.tag){case 5:t=n.stateNode,o=!1;break;case 3:case 4:t=n.stateNode.containerInfo,o=!0;break;default:r("161")}16&n.effectTag&&(p(t),n.effectTag&=-17);e:t:for(n=e;;){for(;null===n.sibling;){if(null===n.return||a(n.return)){n=null;break e}n=n.return}for(n.sibling.return=n.return,n=n.sibling;5!==n.tag&&6!==n.tag;){if(2&n.effectTag)continue t;if(null===n.child||4===n.tag)continue t;n.child.return=n,n=n.child}if(!(2&n.effectTag)){n=n.stateNode;break e}}for(var i=e;;){if(5===i.tag||6===i.tag)n?o?v(t,i.stateNode,n):y(t,i.stateNode,n):o?m(t,i.stateNode):h(t,i.stateNode);else if(4!==i.tag&&null!==i.child){i.child.return=i,i=i.child;continue}if(i===e)break;for(;null===i.sibling;){if(null===i.return||i.return===e)return;i=i.return}i.sibling.return=i.return,i=i.sibling}},commitDeletion:function(e){u(e),e.return=null,e.child=null,e.alternate&&(e.alternate.child=null,e.alternate.return=null)},commitWork:function(e,t){switch(t.tag){case 2:break;case 5:var n=t.stateNode;if(null!=n){var o=t.memoizedProps;e=null!==e?e.memoizedProps:o;var i=t.type,a=t.updateQueue;t.updateQueue=null,null!==a&&f(n,a,i,e,o,t)}break;case 6:null===t.stateNode&&r("162"),n=t.memoizedProps,d(t.stateNode,null!==e?e.memoizedProps:n,n);break;case 3:break;default:r("163")}},commitLifeCycles:function(e,t){switch(t.tag){case 2:var n=t.stateNode;if(4&t.effectTag)if(null===e)n.props=t.memoizedProps,n.state=t.memoizedState,n.componentDidMount();else{var o=e.memoizedProps;e=e.memoizedState,n.props=t.memoizedProps,n.state=t.memoizedState,n.componentDidUpdate(o,e)}t=t.updateQueue,null!==t&&wt(t,n);break;case 3:n=t.updateQueue,null!==n&&wt(n,null!==t.child?t.child.stateNode:null);break;case 5:n=t.stateNode,null===e&&4&t.effectTag&&c(n,t.type,t.memoizedProps,t);break;case 6:case 4:break;default:r("163")}},commitAttachRef:function(e){var t=e.ref;if(null!==t){var n=e.stateNode;switch(e.tag){case 5:t(s(n));break;default:t(n)}}},commitDetachRef:function(e){null!==(e=e.ref)&&e(null)}}}function Nt(e){function t(e){return e===Po&&r("174"),e}var n=e.getChildHostContext,o=e.getRootHostContext,i={current:Po},a={current:Po},u={current:Po};return{getHostContext:function(){return t(i.current)},getRootHostContainer:function(){return t(u.current)},popHostContainer:function(e){Ye(i,e),Ye(a,e),Ye(u,e)},popHostContext:function(e){a.current===e&&(Ye(i,e),Ye(a,e))},pushHostContainer:function(e,t){$e(u,t,e),t=o(t),$e(a,e,e),$e(i,t,e)},pushHostContext:function(e){var r=t(u.current),o=t(i.current);r=n(o,e.type,r),o!==r&&($e(a,e,e),$e(i,r,e))},resetHostContainer:function(){i.current=Po,u.current=Po}}}function At(e){function t(e,t){var n=new it(5,null,0);n.type="DELETED",n.stateNode=t,n.return=e,n.effectTag=8,null!==e.lastEffect?(e.lastEffect.nextEffect=n,e.lastEffect=n):e.firstEffect=e.lastEffect=n}function n(e,t){switch(e.tag){case 5:return null!==(t=a(t,e.type,e.pendingProps))&&(e.stateNode=t,!0);case 6:return null!==(t=u(t,e.pendingProps))&&(e.stateNode=t,!0);default:return!1}}function o(e){for(e=e.return;null!==e&&5!==e.tag&&3!==e.tag;)e=e.return;p=e}var i=e.shouldSetTextContent;if(!(e=e.hydration))return{enterHydrationState:function(){return!1},resetHydrationState:function(){},tryToClaimNextHydratableInstance:function(){},prepareToHydrateHostInstance:function(){r("175")},prepareToHydrateHostTextInstance:function(){r("176")},popHydrationState:function(){return!1}};var a=e.canHydrateInstance,u=e.canHydrateTextInstance,s=e.getNextHydratableSibling,l=e.getFirstHydratableChild,c=e.hydrateInstance,f=e.hydrateTextInstance,p=null,d=null,h=!1;return{enterHydrationState:function(e){return d=l(e.stateNode.containerInfo),p=e,h=!0},resetHydrationState:function(){d=p=null,h=!1},tryToClaimNextHydratableInstance:function(e){if(h){var r=d;if(r){if(!n(e,r)){if(!(r=s(r))||!n(e,r))return e.effectTag|=2,h=!1,void(p=e);t(p,d)}p=e,d=l(r)}else e.effectTag|=2,h=!1,p=e}},prepareToHydrateHostInstance:function(e,t,n){return t=c(e.stateNode,e.type,e.memoizedProps,t,n,e),e.updateQueue=t,null!==t},prepareToHydrateHostTextInstance:function(e){return f(e.stateNode,e.memoizedProps,e)},popHydrationState:function(e){if(e!==p)return!1;if(!h)return o(e),h=!0,!1;var n=e.type;if(5!==e.tag||"head"!==n&&"body"!==n&&!i(n,e.memoizedProps))for(n=d;n;)t(e,n),n=s(n);return o(e),d=p?s(e.stateNode):null,!0}}}function Dt(e){function t(e){ie=Y=!0;var t=e.stateNode;if(t.current===e&&r("177"),t.isReadyForCommit=!1,Fr.current=null,1<e.effectTag)if(null!==e.lastEffect){e.lastEffect.nextEffect=e;var n=e.firstEffect}else n=e;else n=e.firstEffect;for(B(),Z=n;null!==Z;){var o=!1,i=void 0;try{for(;null!==Z;){var a=Z.effectTag;if(16&a&&D(Z),128&a){var u=Z.alternate;null!==u&&z(u)}switch(-242&a){case 2:M(Z),Z.effectTag&=-3;break;case 6:M(Z),Z.effectTag&=-3,q(Z.alternate,Z);break;case 4:q(Z.alternate,Z);break;case 8:ae=!0,R(Z),ae=!1}Z=Z.nextEffect}}catch(e){o=!0,i=e}o&&(null===Z&&r("178"),s(Z,i),null!==Z&&(Z=Z.nextEffect))}for(K(),t.current=e,Z=n;null!==Z;){n=!1,o=void 0;try{for(;null!==Z;){var l=Z.effectTag;if(36&l&&j(Z.alternate,Z),128&l&&U(Z),64&l)switch(i=Z,a=void 0,null!==ee&&(a=ee.get(i),ee.delete(i),null==a&&null!==i.alternate&&(i=i.alternate,a=ee.get(i),ee.delete(i))),null==a&&r("184"),i.tag){case 2:i.stateNode.componentDidCatch(a.error,{componentStack:a.componentStack});break;case 3:null===re&&(re=a.error);break;default:r("157")}var c=Z.nextEffect;Z.nextEffect=null,Z=c}}catch(e){n=!0,o=e}n&&(null===Z&&r("178"),s(Z,o),null!==Z&&(Z=Z.nextEffect))}return Y=ie=!1,"function"==typeof mt&&mt(e.stateNode),ne&&(ne.forEach(m),ne=null),null!==re&&(e=re,re=null,S(e)),t=t.current.expirationTime,0===t&&(te=ee=null),t}function n(e){for(;;){var t=A(e.alternate,e,X),n=e.return,r=e.sibling,o=e;if(2147483647===X||2147483647!==o.expirationTime){if(2!==o.tag&&3!==o.tag)var i=0;else i=o.updateQueue,i=null===i?0:i.expirationTime;for(var a=o.child;null!==a;)0!==a.expirationTime&&(0===i||i>a.expirationTime)&&(i=a.expirationTime),a=a.sibling;o.expirationTime=i}if(null!==t)return t;if(null!==n&&(null===n.firstEffect&&(n.firstEffect=e.firstEffect),null!==e.lastEffect&&(null!==n.lastEffect&&(n.lastEffect.nextEffect=e.firstEffect),n.lastEffect=e.lastEffect),1<e.effectTag&&(null!==n.lastEffect?n.lastEffect.nextEffect=e:n.firstEffect=e,n.lastEffect=e)),null!==r)return r;if(null===n){e.stateNode.isReadyForCommit=!0;break}e=n}return null}function o(e){var t=I(e.alternate,e,X);return null===t&&(t=n(e)),Fr.current=null,t}function i(e){var t=N(e.alternate,e,X);return null===t&&(t=n(e)),Fr.current=null,t}function a(e){if(null!==ee){if(!(0===X||X>e))if(X<=G)for(;null!==$;)$=l($)?i($):o($);else for(;null!==$&&!w();)$=l($)?i($):o($)}else if(!(0===X||X>e))if(X<=G)for(;null!==$;)$=o($);else for(;null!==$&&!w();)$=o($)}function u(e,t){if(Y&&r("243"),Y=!0,e.isReadyForCommit=!1,e!==J||t!==X||null===$){for(;-1<po;)fo[po]=null,po--;yo=Tn,ho.current=Tn,mo.current=!1,T(),J=e,X=t,$=at(J.current,null,t)}var n=!1,o=null;try{a(t)}catch(e){n=!0,o=e}for(;n;){if(oe){re=o;break}var u=$;if(null===u)oe=!0;else{var l=s(u,o);if(null===l&&r("183"),!oe){try{for(n=l,o=t,l=n;null!==u;){switch(u.tag){case 2:et(u);break;case 5:x(u);break;case 3:O(u);break;case 4:O(u)}if(u===l||u.alternate===l)break;u=u.return}$=i(n),a(o)}catch(e){n=!0,o=e;continue}break}}}return t=re,oe=Y=!1,re=null,null!==t&&S(t),e.isReadyForCommit?e.current.alternate:null}function s(e,t){var n=Fr.current=null,r=!1,o=!1,i=null;if(3===e.tag)n=e,c(e)&&(oe=!0);else for(var a=e.return;null!==a&&null===n;){if(2===a.tag?"function"==typeof a.stateNode.componentDidCatch&&(r=!0,i=Ee(a),n=a,o=!0):3===a.tag&&(n=a),c(a)){if(ae||null!==ne&&(ne.has(a)||null!==a.alternate&&ne.has(a.alternate)))return null;n=null,o=!1}a=a.return}if(null!==n){null===te&&(te=new Set),te.add(n);var u="";a=e;do{e:switch(a.tag){case 0:case 1:case 2:case 5:var s=a._debugOwner,l=a._debugSource,f=Ee(a),p=null;s&&(p=Ee(s)),s=l,f="\n in "+(f||"Unknown")+(s?" (at "+s.fileName.replace(/^.*[\\\/]/,"")+":"+s.lineNumber+")":p?" (created by "+p+")":"");break e;default:f=""}u+=f,a=a.return}while(a);a=u,e=Ee(e),null===ee&&(ee=new Map),t={componentName:e,componentStack:a,error:t,errorBoundary:r?n.stateNode:null,errorBoundaryFound:r,errorBoundaryName:i,willRetry:o},ee.set(n,t);try{var d=t.error;d&&d.suppressReactErrorLogging||console.error(d)}catch(e){e&&e.suppressReactErrorLogging||console.error(e)}return ie?(null===ne&&(ne=new Set),ne.add(n)):m(n),n}return null===re&&(re=t),null}function l(e){return null!==ee&&(ee.has(e)||null!==e.alternate&&ee.has(e.alternate))}function c(e){return null!==te&&(te.has(e)||null!==e.alternate&&te.has(e.alternate))}function f(){return 20*(1+((y()+100)/20|0))}function p(e){return 0!==Q?Q:Y?ie?1:X:!V||1&e.internalContextTag?f():1}function d(e,t){return h(e,t,!1)}function h(e,t){for(;null!==e;){if((0===e.expirationTime||e.expirationTime>t)&&(e.expirationTime=t),null!==e.alternate&&(0===e.alternate.expirationTime||e.alternate.expirationTime>t)&&(e.alternate.expirationTime=t),null===e.return){if(3!==e.tag)break;var n=e.stateNode;!Y&&n===J&&t<X&&($=J=null,X=0);var o=n,i=t;if(we>be&&r("185"),null===o.nextScheduledRoot)o.remainingExpirationTime=i,null===se?(ue=se=o,o.nextScheduledRoot=o):(se=se.nextScheduledRoot=o,se.nextScheduledRoot=ue);else{var a=o.remainingExpirationTime;(0===a||i<a)&&(o.remainingExpirationTime=i)}fe||(ge?_e&&(pe=o,de=1,E(pe,de)):1===i?b(1,null):v(i)),!Y&&n===J&&t<X&&($=J=null,X=0)}e=e.return}}function m(e){h(e,1,!0)}function y(){return G=2+((L()-W)/10|0)}function v(e){if(0!==le){if(e>le)return;H(ce)}var t=L()-W;le=e,ce=F(_,{timeout:10*(e-2)-t})}function g(){var e=0,t=null;if(null!==se)for(var n=se,o=ue;null!==o;){var i=o.remainingExpirationTime;if(0===i){if((null===n||null===se)&&r("244"),o===o.nextScheduledRoot){ue=se=o.nextScheduledRoot=null;break}if(o===ue)ue=i=o.nextScheduledRoot,se.nextScheduledRoot=i,o.nextScheduledRoot=null;else{if(o===se){se=n,se.nextScheduledRoot=ue,o.nextScheduledRoot=null;break}n.nextScheduledRoot=o.nextScheduledRoot,o.nextScheduledRoot=null}o=n.nextScheduledRoot}else{if((0===e||i<e)&&(e=i,t=o),o===se)break;n=o,o=o.nextScheduledRoot}}n=pe,null!==n&&n===t?we++:we=0,pe=t,de=e}function _(e){b(0,e)}function b(e,t){for(ve=t,g();null!==pe&&0!==de&&(0===e||de<=e)&&!he;)E(pe,de),g();if(null!==ve&&(le=0,ce=-1),0!==de&&v(de),ve=null,he=!1,we=0,me)throw e=ye,ye=null,me=!1,e}function E(e,n){if(fe&&r("245"),fe=!0,n<=y()){var o=e.finishedWork;null!==o?(e.finishedWork=null,e.remainingExpirationTime=t(o)):(e.finishedWork=null,null!==(o=u(e,n))&&(e.remainingExpirationTime=t(o)))}else o=e.finishedWork,null!==o?(e.finishedWork=null,e.remainingExpirationTime=t(o)):(e.finishedWork=null,null!==(o=u(e,n))&&(w()?e.finishedWork=o:e.remainingExpirationTime=t(o)));fe=!1}function w(){return!(null===ve||ve.timeRemaining()>Se)&&(he=!0)}function S(e){null===pe&&r("246"),pe.remainingExpirationTime=0,me||(me=!0,ye=e)}var C=Nt(e),k=At(e),O=C.popHostContainer,x=C.popHostContext,T=C.resetHostContainer,P=Tt(e,C,k,d,p),I=P.beginWork,N=P.beginFailedWork,A=Pt(e,C,k).completeWork;C=It(e,s);var D=C.commitResetTextContent,M=C.commitPlacement,R=C.commitDeletion,q=C.commitWork,j=C.commitLifeCycles,U=C.commitAttachRef,z=C.commitDetachRef,L=e.now,F=e.scheduleDeferredCallback,H=e.cancelDeferredCallback,V=e.useSyncScheduling,B=e.prepareForCommit,K=e.resetAfterCommit,W=L(),G=2,Q=0,Y=!1,$=null,J=null,X=0,Z=null,ee=null,te=null,ne=null,re=null,oe=!1,ie=!1,ae=!1,ue=null,se=null,le=0,ce=-1,fe=!1,pe=null,de=0,he=!1,me=!1,ye=null,ve=null,ge=!1,_e=!1,be=1e3,we=0,Se=1;return{computeAsyncExpiration:f,computeExpirationForFiber:p,scheduleWork:d,batchedUpdates:function(e,t){var n=ge;ge=!0;try{return e(t)}finally{(ge=n)||fe||b(1,null)}},unbatchedUpdates:function(e){if(ge&&!_e){_e=!0;try{return e()}finally{_e=!1}}return e()},flushSync:function(e){var t=ge;ge=!0;try{e:{var n=Q;Q=1;try{var o=e();break e}finally{Q=n}o=void 0}return o}finally{ge=t,fe&&r("187"),b(1,null)}},deferredUpdates:function(e){var t=Q;Q=f();try{return e()}finally{Q=t}}}}function Mt(e){function t(e){return e=Oe(e),null===e?null:e.stateNode}var n=e.getPublicInstance;e=Dt(e);var o=e.computeAsyncExpiration,i=e.computeExpirationForFiber,a=e.scheduleWork;return{createContainer:function(e,t){var n=new it(3,null,0);return e={current:n,containerInfo:e,pendingChildren:null,remainingExpirationTime:0,isReadyForCommit:!1,finishedWork:null,context:null,pendingContext:null,hydrate:t,nextScheduledRoot:null},n.stateNode=e},updateContainer:function(e,t,n,u){var s=t.current;if(n){n=n._reactInternalFiber;var l;e:{for(2===we(n)&&2===n.tag||r("170"),l=n;3!==l.tag;){if(Ze(l)){l=l.stateNode.__reactInternalMemoizedMergedChildContext;break e}(l=l.return)||r("171")}l=l.stateNode.context}n=Ze(n)?nt(n,l):l}else n=Tn;null===t.context?t.context=n:t.pendingContext=n,t=u,t=void 0===t?null:t,u=null!=e&&null!=e.type&&null!=e.type.prototype&&!0===e.type.prototype.unstable_isAsyncReactComponent?o():i(s),_t(s,{expirationTime:u,partialState:{element:e},callback:t,isReplace:!1,isForced:!1,nextCallback:null,next:null}),a(s,u)},batchedUpdates:e.batchedUpdates,unbatchedUpdates:e.unbatchedUpdates,deferredUpdates:e.deferredUpdates,flushSync:e.flushSync,getPublicRootInstance:function(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return n(e.child.stateNode);default:return e.child.stateNode}},findHostInstance:t,findHostInstanceWithNoPortals:function(e){return e=xe(e),null===e?null:e.stateNode},injectIntoDevTools:function(e){var n=e.findFiberByHostInstance;return ht(En({},e,{findHostInstanceByFiber:function(e){return t(e)},findFiberByHostInstance:function(e){return n?n(e):null}}))}}}function Rt(e,t,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:So,key:null==r?null:""+r,children:e,containerInfo:t,implementation:n}}function qt(e){return!!Yo.hasOwnProperty(e)||!Qo.hasOwnProperty(e)&&(Go.test(e)?Yo[e]=!0:(Qo[e]=!0,!1))}function jt(e,t,n){var r=a(t);if(r&&i(t,n)){var o=r.mutationMethod;o?o(e,n):null==n||r.hasBooleanValue&&!n||r.hasNumericValue&&isNaN(n)||r.hasPositiveNumericValue&&1>n||r.hasOverloadedBooleanValue&&!1===n?zt(e,t):r.mustUseProperty?e[r.propertyName]=n:(t=r.attributeName,(o=r.attributeNamespace)?e.setAttributeNS(o,t,""+n):r.hasBooleanValue||r.hasOverloadedBooleanValue&&!0===n?e.setAttribute(t,""):e.setAttribute(t,""+n))}else Ut(e,t,i(t,n)?n:null)}function Ut(e,t,n){qt(t)&&(null==n?e.removeAttribute(t):e.setAttribute(t,""+n))}function zt(e,t){var n=a(t);n?(t=n.mutationMethod)?t(e,void 0):n.mustUseProperty?e[n.propertyName]=!n.hasBooleanValue&&"":e.removeAttribute(n.attributeName):e.removeAttribute(t)}function Lt(e,t){var n=t.value,r=t.checked;return En({type:void 0,step:void 0,min:void 0,max:void 0},t,{defaultChecked:void 0,defaultValue:void 0,value:null!=n?n:e._wrapperState.initialValue,checked:null!=r?r:e._wrapperState.initialChecked})}function Ft(e,t){var n=t.defaultValue;e._wrapperState={initialChecked:null!=t.checked?t.checked:t.defaultChecked,initialValue:null!=t.value?t.value:n,controlled:"checkbox"===t.type||"radio"===t.type?null!=t.checked:null!=t.value}}function Ht(e,t){null!=(t=t.checked)&&jt(e,"checked",t)}function Vt(e,t){Ht(e,t);var n=t.value;null!=n?0===n&&""===e.value?e.value="0":"number"===t.type?(t=parseFloat(e.value)||0,(n!=t||n==t&&e.value!=n)&&(e.value=""+n)):e.value!==""+n&&(e.value=""+n):(null==t.value&&null!=t.defaultValue&&e.defaultValue!==""+t.defaultValue&&(e.defaultValue=""+t.defaultValue),null==t.checked&&null!=t.defaultChecked&&(e.defaultChecked=!!t.defaultChecked))}function Bt(e,t){switch(t.type){case"submit":case"reset":break;case"color":case"date":case"datetime":case"datetime-local":case"month":case"time":case"week":e.value="",e.value=e.defaultValue;break;default:e.value=e.value}t=e.name,""!==t&&(e.name=""),e.defaultChecked=!e.defaultChecked,e.defaultChecked=!e.defaultChecked,""!==t&&(e.name=t)}function Kt(e){var t="";return _n.Children.forEach(e,function(e){null==e||"string"!=typeof e&&"number"!=typeof e||(t+=e)}),t}function Wt(e,t){return e=En({children:void 0},t),(t=Kt(t.children))&&(e.children=t),e}function Gt(e,t,n,r){if(e=e.options,t){t={};for(var o=0;o<n.length;o++)t["$"+n[o]]=!0;for(n=0;n<e.length;n++)o=t.hasOwnProperty("$"+e[n].value),e[n].selected!==o&&(e[n].selected=o),o&&r&&(e[n].defaultSelected=!0)}else{for(n=""+n,t=null,o=0;o<e.length;o++){if(e[o].value===n)return e[o].selected=!0,void(r&&(e[o].defaultSelected=!0));null!==t||e[o].disabled||(t=e[o])}null!==t&&(t.selected=!0)}}function Qt(e,t){var n=t.value;e._wrapperState={initialValue:null!=n?n:t.defaultValue,wasMultiple:!!t.multiple}}function Yt(e,t){return null!=t.dangerouslySetInnerHTML&&r("91"),En({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function $t(e,t){var n=t.value;null==n&&(n=t.defaultValue,t=t.children,null!=t&&(null!=n&&r("92"),Array.isArray(t)&&(1>=t.length||r("93"),t=t[0]),n=""+t),null==n&&(n="")),e._wrapperState={initialValue:""+n}}function Jt(e,t){var n=t.value;null!=n&&(n=""+n,n!==e.value&&(e.value=n),null==t.defaultValue&&(e.defaultValue=n)),null!=t.defaultValue&&(e.defaultValue=t.defaultValue)}function Xt(e){var t=e.textContent;t===e._wrapperState.initialValue&&(e.value=t)}function Zt(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function en(e,t){return null==e||"http://www.w3.org/1999/xhtml"===e?Zt(t):"http://www.w3.org/2000/svg"===e&&"foreignObject"===t?"http://www.w3.org/1999/xhtml":e}function tn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&3===n.nodeType)return void(n.nodeValue=t)}e.textContent=t}function nn(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=0===n.indexOf("--"),o=n,i=t[n];o=null==i||"boolean"==typeof i||""===i?"":r||"number"!=typeof i||0===i||Zo.hasOwnProperty(o)&&Zo[o]?(""+i).trim():i+"px","float"===n&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}function rn(e,t,n){t&&(ti[e]&&(null!=t.children||null!=t.dangerouslySetInnerHTML)&&r("137",e,n()),null!=t.dangerouslySetInnerHTML&&(null!=t.children&&r("60"),"object"==typeof t.dangerouslySetInnerHTML&&"__html"in t.dangerouslySetInnerHTML||r("61")),null!=t.style&&"object"!=typeof t.style&&r("62",n()))}function on(e,t){if(-1===e.indexOf("-"))return"string"==typeof t.is;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}function an(e,t){e=9===e.nodeType||11===e.nodeType?e:e.ownerDocument;var n=Re(e);t=$n[t];for(var r=0;r<t.length;r++){var o=t[r];n.hasOwnProperty(o)&&n[o]||("topScroll"===o?Ne("topScroll","scroll",e):"topFocus"===o||"topBlur"===o?(Ne("topFocus","focus",e),Ne("topBlur","blur",e),n.topBlur=!0,n.topFocus=!0):"topCancel"===o?(ne("cancel",!0)&&Ne("topCancel","cancel",e),n.topCancel=!0):"topClose"===o?(ne("close",!0)&&Ne("topClose","close",e),n.topClose=!0):Yr.hasOwnProperty(o)&&Ie(o,Yr[o],e),n[o]=!0)}}function un(e,t,n,r){return n=9===n.nodeType?n:n.ownerDocument,r===ni&&(r=Zt(e)),r===ni?"script"===e?(e=n.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):e="string"==typeof t.is?n.createElement(e,{is:t.is}):n.createElement(e):e=n.createElementNS(r,e),e}function sn(e,t){return(9===t.nodeType?t:t.ownerDocument).createTextNode(e)}function ln(e,t,n,r){var o=on(t,n);switch(t){case"iframe":case"object":Ie("topLoad","load",e);var i=n;break;case"video":case"audio":for(i in oi)oi.hasOwnProperty(i)&&Ie(i,oi[i],e);i=n;break;case"source":Ie("topError","error",e),i=n;break;case"img":case"image":Ie("topError","error",e),Ie("topLoad","load",e),i=n;break;case"form":Ie("topReset","reset",e),Ie("topSubmit","submit",e),i=n;break;case"details":Ie("topToggle","toggle",e),i=n;break;case"input":Ft(e,n),i=Lt(e,n),Ie("topInvalid","invalid",e),an(r,"onChange");break;case"option":i=Wt(e,n);break;case"select":Qt(e,n),i=En({},n,{value:void 0}),Ie("topInvalid","invalid",e),an(r,"onChange");break;case"textarea":$t(e,n),i=Yt(e,n),Ie("topInvalid","invalid",e),an(r,"onChange");break;default:i=n}rn(t,i,ri);var a,u=i;for(a in u)if(u.hasOwnProperty(a)){var s=u[a];"style"===a?nn(e,s,ri):"dangerouslySetInnerHTML"===a?null!=(s=s?s.__html:void 0)&&Xo(e,s):"children"===a?"string"==typeof s?("textarea"!==t||""!==s)&&tn(e,s):"number"==typeof s&&tn(e,""+s):"suppressContentEditableWarning"!==a&&"suppressHydrationWarning"!==a&&"autoFocus"!==a&&(Yn.hasOwnProperty(a)?null!=s&&an(r,a):o?Ut(e,a,s):null!=s&&jt(e,a,s))}switch(t){case"input":ie(e),Bt(e,n);break;case"textarea":ie(e),Xt(e,n);break;case"option":null!=n.value&&e.setAttribute("value",n.value);break;case"select":e.multiple=!!n.multiple,t=n.value,null!=t?Gt(e,!!n.multiple,t,!1):null!=n.defaultValue&&Gt(e,!!n.multiple,n.defaultValue,!0);break;default:"function"==typeof i.onClick&&(e.onclick=wn)}}function cn(e,t,n,r,o){var i=null;switch(t){case"input":n=Lt(e,n),r=Lt(e,r),i=[];break;case"option":n=Wt(e,n),r=Wt(e,r),i=[];break;case"select":n=En({},n,{value:void 0}),r=En({},r,{value:void 0}),i=[];break;case"textarea":n=Yt(e,n),r=Yt(e,r),i=[];break;default:"function"!=typeof n.onClick&&"function"==typeof r.onClick&&(e.onclick=wn)}rn(t,r,ri);var a,u;e=null;for(a in n)if(!r.hasOwnProperty(a)&&n.hasOwnProperty(a)&&null!=n[a])if("style"===a)for(u in t=n[a])t.hasOwnProperty(u)&&(e||(e={}),e[u]="");else"dangerouslySetInnerHTML"!==a&&"children"!==a&&"suppressContentEditableWarning"!==a&&"suppressHydrationWarning"!==a&&"autoFocus"!==a&&(Yn.hasOwnProperty(a)?i||(i=[]):(i=i||[]).push(a,null));for(a in r){var s=r[a];if(t=null!=n?n[a]:void 0,r.hasOwnProperty(a)&&s!==t&&(null!=s||null!=t))if("style"===a)if(t){for(u in t)!t.hasOwnProperty(u)||s&&s.hasOwnProperty(u)||(e||(e={}),e[u]="");for(u in s)s.hasOwnProperty(u)&&t[u]!==s[u]&&(e||(e={}),e[u]=s[u])}else e||(i||(i=[]),i.push(a,e)),e=s;else"dangerouslySetInnerHTML"===a?(s=s?s.__html:void 0,t=t?t.__html:void 0,null!=s&&t!==s&&(i=i||[]).push(a,""+s)):"children"===a?t===s||"string"!=typeof s&&"number"!=typeof s||(i=i||[]).push(a,""+s):"suppressContentEditableWarning"!==a&&"suppressHydrationWarning"!==a&&(Yn.hasOwnProperty(a)?(null!=s&&an(o,a),i||t===s||(i=[])):(i=i||[]).push(a,s))}return e&&(i=i||[]).push("style",e),i}function fn(e,t,n,r,o){"input"===n&&"radio"===o.type&&null!=o.name&&Ht(e,o),on(n,r),r=on(n,o);for(var i=0;i<t.length;i+=2){var a=t[i],u=t[i+1];"style"===a?nn(e,u,ri):"dangerouslySetInnerHTML"===a?Xo(e,u):"children"===a?tn(e,u):r?null!=u?Ut(e,a,u):e.removeAttribute(a):null!=u?jt(e,a,u):zt(e,a)}switch(n){case"input":Vt(e,o);break;case"textarea":Jt(e,o);break;case"select":e._wrapperState.initialValue=void 0,t=e._wrapperState.wasMultiple,e._wrapperState.wasMultiple=!!o.multiple,n=o.value,null!=n?Gt(e,!!o.multiple,n,!1):t!==!!o.multiple&&(null!=o.defaultValue?Gt(e,!!o.multiple,o.defaultValue,!0):Gt(e,!!o.multiple,o.multiple?[]:"",!1))}}function pn(e,t,n,r,o){switch(t){case"iframe":case"object":Ie("topLoad","load",e);break;case"video":case"audio":for(var i in oi)oi.hasOwnProperty(i)&&Ie(i,oi[i],e);break;case"source":Ie("topError","error",e);break;case"img":case"image":Ie("topError","error",e),Ie("topLoad","load",e);break;case"form":Ie("topReset","reset",e),Ie("topSubmit","submit",e);break;case"details":Ie("topToggle","toggle",e);break;case"input":Ft(e,n),Ie("topInvalid","invalid",e),an(o,"onChange");break;case"select":Qt(e,n),Ie("topInvalid","invalid",e),an(o,"onChange");break;case"textarea":$t(e,n),Ie("topInvalid","invalid",e),an(o,"onChange")}rn(t,n,ri),r=null;for(var a in n)n.hasOwnProperty(a)&&(i=n[a],"children"===a?"string"==typeof i?e.textContent!==i&&(r=["children",i]):"number"==typeof i&&e.textContent!==""+i&&(r=["children",""+i]):Yn.hasOwnProperty(a)&&null!=i&&an(o,a));switch(t){case"input":ie(e),Bt(e,n);break;case"textarea":ie(e),Xt(e,n);break;case"select":case"option":break;default:"function"==typeof n.onClick&&(e.onclick=wn)}return r}function dn(e,t){return e.nodeValue!==t}function hn(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType&&(8!==e.nodeType||" react-mount-point-unstable "!==e.nodeValue))}function mn(e){return!(!(e=e?9===e.nodeType?e.documentElement:e.firstChild:null)||1!==e.nodeType||!e.hasAttribute("data-reactroot"))}function yn(e,t,n,o,i){hn(n)||r("200");var a=n._reactRootContainer;if(a)si.updateContainer(t,a,e,i);else{if(!(o=o||mn(n)))for(a=void 0;a=n.lastChild;)n.removeChild(a);var u=si.createContainer(n,o);a=n._reactRootContainer=u,si.unbatchedUpdates(function(){si.updateContainer(t,u,e,i)})}return si.getPublicRootInstance(a)}function vn(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;return hn(t)||r("200"),Rt(e,t,null,n)}function gn(e,t){this._reactRootContainer=si.createContainer(e,t)}/** @license React v16.2.0
15
+ * react-dom.production.min.js
16
+ *
17
+ * Copyright (c) 2013-present, Facebook, Inc.
18
+ *
19
+ * This source code is licensed under the MIT license found in the
20
+ * LICENSE file in the root directory of this source tree.
21
+ */
22
+ var _n=n(0),bn=n(32),En=n(12),wn=n(4),Sn=n(33),Cn=n(34),kn=n(35),On=n(36),xn=n(39),Tn=n(13);_n||r("227");var Pn={children:!0,dangerouslySetInnerHTML:!0,defaultValue:!0,defaultChecked:!0,innerHTML:!0,suppressContentEditableWarning:!0,suppressHydrationWarning:!0,style:!0},In={MUST_USE_PROPERTY:1,HAS_BOOLEAN_VALUE:4,HAS_NUMERIC_VALUE:8,HAS_POSITIVE_NUMERIC_VALUE:24,HAS_OVERLOADED_BOOLEAN_VALUE:32,HAS_STRING_BOOLEAN_VALUE:64,injectDOMPropertyConfig:function(e){var t=In,n=e.Properties||{},i=e.DOMAttributeNamespaces||{},a=e.DOMAttributeNames||{};e=e.DOMMutationMethods||{};for(var u in n){Nn.hasOwnProperty(u)&&r("48",u);var s=u.toLowerCase(),l=n[u];s={attributeName:s,attributeNamespace:null,propertyName:u,mutationMethod:null,mustUseProperty:o(l,t.MUST_USE_PROPERTY),hasBooleanValue:o(l,t.HAS_BOOLEAN_VALUE),hasNumericValue:o(l,t.HAS_NUMERIC_VALUE),hasPositiveNumericValue:o(l,t.HAS_POSITIVE_NUMERIC_VALUE),hasOverloadedBooleanValue:o(l,t.HAS_OVERLOADED_BOOLEAN_VALUE),hasStringBooleanValue:o(l,t.HAS_STRING_BOOLEAN_VALUE)},1>=s.hasBooleanValue+s.hasNumericValue+s.hasOverloadedBooleanValue||r("50",u),a.hasOwnProperty(u)&&(s.attributeName=a[u]),i.hasOwnProperty(u)&&(s.attributeNamespace=i[u]),e.hasOwnProperty(u)&&(s.mutationMethod=e[u]),Nn[u]=s}}},Nn={},An=In,Dn=An.MUST_USE_PROPERTY,Mn=An.HAS_BOOLEAN_VALUE,Rn=An.HAS_NUMERIC_VALUE,qn=An.HAS_POSITIVE_NUMERIC_VALUE,jn=An.HAS_OVERLOADED_BOOLEAN_VALUE,Un=An.HAS_STRING_BOOLEAN_VALUE,zn={Properties:{allowFullScreen:Mn,async:Mn,autoFocus:Mn,autoPlay:Mn,capture:jn,checked:Dn|Mn,cols:qn,contentEditable:Un,controls:Mn,default:Mn,defer:Mn,disabled:Mn,download:jn,draggable:Un,formNoValidate:Mn,hidden:Mn,loop:Mn,multiple:Dn|Mn,muted:Dn|Mn,noValidate:Mn,open:Mn,playsInline:Mn,readOnly:Mn,required:Mn,reversed:Mn,rows:qn,rowSpan:Rn,scoped:Mn,seamless:Mn,selected:Dn|Mn,size:qn,start:Rn,span:qn,spellCheck:Un,style:0,tabIndex:0,itemScope:Mn,acceptCharset:0,className:0,htmlFor:0,httpEquiv:0,value:Un},DOMAttributeNames:{acceptCharset:"accept-charset",className:"class",htmlFor:"for",httpEquiv:"http-equiv"},DOMMutationMethods:{value:function(e,t){if(null==t)return e.removeAttribute("value");"number"!==e.type||!1===e.hasAttribute("value")?e.setAttribute("value",""+t):e.validity&&!e.validity.badInput&&e.ownerDocument.activeElement!==e&&e.setAttribute("value",""+t)}}},Ln=An.HAS_STRING_BOOLEAN_VALUE,Fn={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"},Hn={Properties:{autoReverse:Ln,externalResourcesRequired:Ln,preserveAlpha:Ln},DOMAttributeNames:{autoReverse:"autoReverse",externalResourcesRequired:"externalResourcesRequired",preserveAlpha:"preserveAlpha"},DOMAttributeNamespaces:{xlinkActuate:Fn.xlink,xlinkArcrole:Fn.xlink,xlinkHref:Fn.xlink,xlinkRole:Fn.xlink,xlinkShow:Fn.xlink,xlinkTitle:Fn.xlink,xlinkType:Fn.xlink,xmlBase:Fn.xml,xmlLang:Fn.xml,xmlSpace:Fn.xml}},Vn=/[\-\:]([a-z])/g;"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode x-height xlink:actuate xlink:arcrole xlink:href xlink:role xlink:show xlink:title xlink:type xml:base xmlns:xlink xml:lang xml:space".split(" ").forEach(function(e){var t=e.replace(Vn,u);Hn.Properties[t]=0,Hn.DOMAttributeNames[t]=e}),An.injectDOMPropertyConfig(zn),An.injectDOMPropertyConfig(Hn);var Bn={_caughtError:null,_hasCaughtError:!1,_rethrowError:null,_hasRethrowError:!1,injection:{injectErrorUtils:function(e){"function"!=typeof e.invokeGuardedCallback&&r("197"),s=e.invokeGuardedCallback}},invokeGuardedCallback:function(e,t,n,r,o,i,a,u,l){s.apply(Bn,arguments)},invokeGuardedCallbackAndCatchFirstError:function(e,t,n,r,o,i,a,u,s){if(Bn.invokeGuardedCallback.apply(this,arguments),Bn.hasCaughtError()){var l=Bn.clearCaughtError();Bn._hasRethrowError||(Bn._hasRethrowError=!0,Bn._rethrowError=l)}},rethrowCaughtError:function(){return l.apply(Bn,arguments)},hasCaughtError:function(){return Bn._hasCaughtError},clearCaughtError:function(){if(Bn._hasCaughtError){var e=Bn._caughtError;return Bn._caughtError=null,Bn._hasCaughtError=!1,e}r("198")}},Kn=null,Wn={},Gn=[],Qn={},Yn={},$n={},Jn=Object.freeze({plugins:Gn,eventNameDispatchConfigs:Qn,registrationNameModules:Yn,registrationNameDependencies:$n,possibleRegistrationNames:null,injectEventPluginOrder:p,injectEventPluginsByName:d}),Xn=null,Zn=null,er=null,tr=null,nr={injectEventPluginOrder:p,injectEventPluginsByName:d},rr=Object.freeze({injection:nr,getListener:b,extractEvents:E,enqueueEvents:w,processEventQueue:S}),or=Math.random().toString(36).slice(2),ir="__reactInternalInstance$"+or,ar="__reactEventHandlers$"+or,ur=Object.freeze({precacheFiberNode:function(e,t){t[ir]=e},getClosestInstanceFromNode:C,getInstanceFromNode:function(e){return e=e[ir],!e||5!==e.tag&&6!==e.tag?null:e},getNodeFromInstance:k,getFiberCurrentPropsFromNode:O,updateFiberProps:function(e,t){e[ar]=t}}),sr=Object.freeze({accumulateTwoPhaseDispatches:M,accumulateTwoPhaseDispatchesSkipTarget:function(e){y(e,N)},accumulateEnterLeaveDispatches:R,accumulateDirectDispatches:function(e){y(e,D)}}),lr=null,cr={_root:null,_startText:null,_fallbackText:null},fr="dispatchConfig _targetInst nativeEvent isDefaultPrevented isPropagationStopped _dispatchListeners _dispatchInstances".split(" "),pr={type:null,target:null,currentTarget:wn.thatReturnsNull,eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null};En(z.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=wn.thatReturnsTrue)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=wn.thatReturnsTrue)},persist:function(){this.isPersistent=wn.thatReturnsTrue},isPersistent:wn.thatReturnsFalse,destructor:function(){var e,t=this.constructor.Interface;for(e in t)this[e]=null;for(t=0;t<fr.length;t++)this[fr[t]]=null}}),z.Interface=pr,z.augmentClass=function(e,t){function n(){}n.prototype=this.prototype;var r=new n;En(r,e.prototype),e.prototype=r,e.prototype.constructor=e,e.Interface=En({},this.Interface,t),e.augmentClass=this.augmentClass,H(e)},H(z),z.augmentClass(V,{data:null}),z.augmentClass(B,{data:null});var dr=[9,13,27,32],hr=bn.canUseDOM&&"CompositionEvent"in window,mr=null;bn.canUseDOM&&"documentMode"in document&&(mr=document.documentMode);var yr;if(yr=bn.canUseDOM&&"TextEvent"in window&&!mr){var vr=window.opera;yr=!("object"==typeof vr&&"function"==typeof vr.version&&12>=parseInt(vr.version(),10))}var gr,_r=yr,br=bn.canUseDOM&&(!hr||mr&&8<mr&&11>=mr),Er=String.fromCharCode(32),wr={beforeInput:{phasedRegistrationNames:{bubbled:"onBeforeInput",captured:"onBeforeInputCapture"},dependencies:["topCompositionEnd","topKeyPress","topTextInput","topPaste"]},compositionEnd:{phasedRegistrationNames:{bubbled:"onCompositionEnd",captured:"onCompositionEndCapture"},dependencies:"topBlur topCompositionEnd topKeyDown topKeyPress topKeyUp topMouseDown".split(" ")},compositionStart:{phasedRegistrationNames:{bubbled:"onCompositionStart",captured:"onCompositionStartCapture"},dependencies:"topBlur topCompositionStart topKeyDown topKeyPress topKeyUp topMouseDown".split(" ")},compositionUpdate:{phasedRegistrationNames:{bubbled:"onCompositionUpdate",captured:"onCompositionUpdateCapture"},dependencies:"topBlur topCompositionUpdate topKeyDown topKeyPress topKeyUp topMouseDown".split(" ")}},Sr=!1,Cr=!1,kr={eventTypes:wr,extractEvents:function(e,t,n,r){var o;if(hr)e:{switch(e){case"topCompositionStart":var i=wr.compositionStart;break e;case"topCompositionEnd":i=wr.compositionEnd;break e;case"topCompositionUpdate":i=wr.compositionUpdate;break e}i=void 0}else Cr?K(e,n)&&(i=wr.compositionEnd):"topKeyDown"===e&&229===n.keyCode&&(i=wr.compositionStart);return i?(br&&(Cr||i!==wr.compositionStart?i===wr.compositionEnd&&Cr&&(o=j()):(cr._root=r,cr._startText=U(),Cr=!0)),i=V.getPooled(i,t,n,r),o?i.data=o:null!==(o=W(n))&&(i.data=o),M(i),o=i):o=null,(e=_r?G(e,n):Q(e,n))?(t=B.getPooled(wr.beforeInput,t,n,r),t.data=e,M(t)):t=null,[o,t]}},Or=null,xr=null,Tr=null,Pr={injectFiberControlledHostComponent:function(e){Or=e}},Ir=Object.freeze({injection:Pr,enqueueStateRestore:$,restoreStateIfNeeded:J}),Nr=!1,Ar={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};bn.canUseDOM&&(gr=document.implementation&&document.implementation.hasFeature&&!0!==document.implementation.hasFeature("",""));var Dr={change:{phasedRegistrationNames:{bubbled:"onChange",captured:"onChangeCapture"},dependencies:"topBlur topChange topClick topFocus topInput topKeyDown topKeyUp topSelectionChange".split(" ")}},Mr=null,Rr=null,qr=!1;bn.canUseDOM&&(qr=ne("input")&&(!document.documentMode||9<document.documentMode));var jr={eventTypes:Dr,_isInputEventSupported:qr,extractEvents:function(e,t,n,r){var o=t?k(t):window,i=o.nodeName&&o.nodeName.toLowerCase();if("select"===i||"input"===i&&"file"===o.type)var a=ce;else if(ee(o))if(qr)a=ye;else{a=he;var u=de}else!(i=o.nodeName)||"input"!==i.toLowerCase()||"checkbox"!==o.type&&"radio"!==o.type||(a=me);if(a&&(a=a(e,t)))return ue(a,n,r);u&&u(e,o,t),"topBlur"===e&&null!=t&&(e=t._wrapperState||o._wrapperState)&&e.controlled&&"number"===o.type&&(e=""+o.value,o.getAttribute("value")!==e&&o.setAttribute("value",e))}};z.augmentClass(ve,{view:null,detail:null});var Ur={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};ve.augmentClass(be,{screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,getModifierState:_e,button:null,buttons:null,relatedTarget:function(e){return e.relatedTarget||(e.fromElement===e.srcElement?e.toElement:e.fromElement)}});var zr={mouseEnter:{registrationName:"onMouseEnter",dependencies:["topMouseOut","topMouseOver"]},mouseLeave:{registrationName:"onMouseLeave",dependencies:["topMouseOut","topMouseOver"]}},Lr={eventTypes:zr,extractEvents:function(e,t,n,r){if("topMouseOver"===e&&(n.relatedTarget||n.fromElement)||"topMouseOut"!==e&&"topMouseOver"!==e)return null;var o=r.window===r?r:(o=r.ownerDocument)?o.defaultView||o.parentWindow:window;if("topMouseOut"===e?(e=t,t=(t=n.relatedTarget||n.toElement)?C(t):null):e=null,e===t)return null;var i=null==e?o:k(e);o=null==t?o:k(t);var a=be.getPooled(zr.mouseLeave,e,n,r);return a.type="mouseleave",a.target=i,a.relatedTarget=o,n=be.getPooled(zr.mouseEnter,t,n,r),n.type="mouseenter",n.target=o,n.relatedTarget=i,R(a,n,e,t),[a,n]}},Fr=_n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Hr=[],Vr=!0,Br=void 0,Kr=Object.freeze({get _enabled(){return Vr},get _handleTopLevel(){return Br},setHandleTopLevel:function(e){Br=e},setEnabled:Pe,isEnabled:function(){return Vr},trapBubbledEvent:Ie,trapCapturedEvent:Ne,dispatchEvent:Ae}),Wr={animationend:De("Animation","AnimationEnd"),animationiteration:De("Animation","AnimationIteration"),animationstart:De("Animation","AnimationStart"),transitionend:De("Transition","TransitionEnd")},Gr={},Qr={};bn.canUseDOM&&(Qr=document.createElement("div").style,"AnimationEvent"in window||(delete Wr.animationend.animation,delete Wr.animationiteration.animation,delete Wr.animationstart.animation),"TransitionEvent"in window||delete Wr.transitionend.transition);var Yr={topAbort:"abort",topAnimationEnd:Me("animationend")||"animationend",topAnimationIteration:Me("animationiteration")||"animationiteration",topAnimationStart:Me("animationstart")||"animationstart",topBlur:"blur",topCancel:"cancel",topCanPlay:"canplay",topCanPlayThrough:"canplaythrough",topChange:"change",topClick:"click",topClose:"close",topCompositionEnd:"compositionend",topCompositionStart:"compositionstart",topCompositionUpdate:"compositionupdate",topContextMenu:"contextmenu",topCopy:"copy",topCut:"cut",topDoubleClick:"dblclick",topDrag:"drag",topDragEnd:"dragend",topDragEnter:"dragenter",topDragExit:"dragexit",topDragLeave:"dragleave",topDragOver:"dragover",topDragStart:"dragstart",topDrop:"drop",topDurationChange:"durationchange",topEmptied:"emptied",topEncrypted:"encrypted",topEnded:"ended",topError:"error",topFocus:"focus",topInput:"input",topKeyDown:"keydown",topKeyPress:"keypress",topKeyUp:"keyup",topLoadedData:"loadeddata",topLoad:"load",topLoadedMetadata:"loadedmetadata",topLoadStart:"loadstart",topMouseDown:"mousedown",topMouseMove:"mousemove",topMouseOut:"mouseout",topMouseOver:"mouseover",topMouseUp:"mouseup",topPaste:"paste",topPause:"pause",topPlay:"play",topPlaying:"playing",topProgress:"progress",topRateChange:"ratechange",topScroll:"scroll",topSeeked:"seeked",topSeeking:"seeking",topSelectionChange:"selectionchange",topStalled:"stalled",topSuspend:"suspend",topTextInput:"textInput",topTimeUpdate:"timeupdate",topToggle:"toggle",topTouchCancel:"touchcancel",topTouchEnd:"touchend",topTouchMove:"touchmove",topTouchStart:"touchstart",topTransitionEnd:Me("transitionend")||"transitionend",topVolumeChange:"volumechange",topWaiting:"waiting",topWheel:"wheel"},$r={},Jr=0,Xr="_reactListenersID"+(""+Math.random()).slice(2),Zr=bn.canUseDOM&&"documentMode"in document&&11>=document.documentMode,eo={select:{phasedRegistrationNames:{bubbled:"onSelect",captured:"onSelectCapture"},dependencies:"topBlur topContextMenu topFocus topKeyDown topKeyUp topMouseDown topMouseUp topSelectionChange".split(" ")}},to=null,no=null,ro=null,oo=!1,io={eventTypes:eo,extractEvents:function(e,t,n,r){var o,i=r.window===r?r.document:9===r.nodeType?r:r.ownerDocument;if(!(o=!i)){e:{i=Re(i),o=$n.onSelect;for(var a=0;a<o.length;a++){var u=o[a];if(!i.hasOwnProperty(u)||!i[u]){i=!1;break e}}i=!0}o=!i}if(o)return null;switch(i=t?k(t):window,e){case"topFocus":(ee(i)||"true"===i.contentEditable)&&(to=i,no=t,ro=null);break;case"topBlur":ro=no=to=null;break;case"topMouseDown":oo=!0;break;case"topContextMenu":case"topMouseUp":return oo=!1,ze(n,r);case"topSelectionChange":if(Zr)break;case"topKeyDown":case"topKeyUp":return ze(n,r)}return null}};z.augmentClass(Le,{animationName:null,elapsedTime:null,pseudoElement:null}),z.augmentClass(Fe,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),ve.augmentClass(He,{relatedTarget:null});var ao={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},uo={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"};ve.augmentClass(Be,{key:function(e){if(e.key){var t=ao[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?(e=Ve(e),13===e?"Enter":String.fromCharCode(e)):"keydown"===e.type||"keyup"===e.type?uo[e.keyCode]||"Unidentified":""},location:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,repeat:null,locale:null,getModifierState:_e,charCode:function(e){return"keypress"===e.type?Ve(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?Ve(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}}),be.augmentClass(Ke,{dataTransfer:null}),ve.augmentClass(We,{touches:null,targetTouches:null,changedTouches:null,altKey:null,metaKey:null,ctrlKey:null,shiftKey:null,getModifierState:_e}),z.augmentClass(Ge,{propertyName:null,elapsedTime:null,pseudoElement:null}),be.augmentClass(Qe,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:null,deltaMode:null});var so={},lo={};"abort animationEnd animationIteration animationStart blur cancel canPlay canPlayThrough click close contextMenu copy cut doubleClick drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error focus input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing progress rateChange reset scroll seeked seeking stalled submit suspend timeUpdate toggle touchCancel touchEnd touchMove touchStart transitionEnd volumeChange waiting wheel".split(" ").forEach(function(e){var t=e[0].toUpperCase()+e.slice(1),n="on"+t;t="top"+t,n={phasedRegistrationNames:{bubbled:n,captured:n+"Capture"},dependencies:[t]},so[e]=n,lo[t]=n});var co={eventTypes:so,extractEvents:function(e,t,n,r){var o=lo[e];if(!o)return null;switch(e){case"topKeyPress":if(0===Ve(n))return null;case"topKeyDown":case"topKeyUp":e=Be;break;case"topBlur":case"topFocus":e=He;break;case"topClick":if(2===n.button)return null;case"topDoubleClick":case"topMouseDown":case"topMouseMove":case"topMouseUp":case"topMouseOut":case"topMouseOver":case"topContextMenu":e=be;break;case"topDrag":case"topDragEnd":case"topDragEnter":case"topDragExit":case"topDragLeave":case"topDragOver":case"topDragStart":case"topDrop":e=Ke;break;case"topTouchCancel":case"topTouchEnd":case"topTouchMove":case"topTouchStart":e=We;break;case"topAnimationEnd":case"topAnimationIteration":case"topAnimationStart":e=Le;break;case"topTransitionEnd":e=Ge;break;case"topScroll":e=ve;break;case"topWheel":e=Qe;break;case"topCopy":case"topCut":case"topPaste":e=Fe;break;default:e=z}return t=e.getPooled(o,t,n,r),M(t),t}};Br=function(e,t,n,r){e=E(e,t,n,r),w(e),S(!1)},nr.injectEventPluginOrder("ResponderEventPlugin SimpleEventPlugin TapEventPlugin EnterLeaveEventPlugin ChangeEventPlugin SelectEventPlugin BeforeInputEventPlugin".split(" ")),Xn=ur.getFiberCurrentPropsFromNode,Zn=ur.getInstanceFromNode,er=ur.getNodeFromInstance,nr.injectEventPluginsByName({SimpleEventPlugin:co,EnterLeaveEventPlugin:Lr,ChangeEventPlugin:jr,SelectEventPlugin:io,BeforeInputEventPlugin:kr});var fo=[],po=-1;new Set;var ho={current:Tn},mo={current:!1},yo=Tn,vo=null,go=null,_o="function"==typeof Symbol&&Symbol.for,bo=_o?Symbol.for("react.element"):60103,Eo=_o?Symbol.for("react.call"):60104,wo=_o?Symbol.for("react.return"):60105,So=_o?Symbol.for("react.portal"):60106,Co=_o?Symbol.for("react.fragment"):60107,ko="function"==typeof Symbol&&Symbol.iterator,Oo=Array.isArray,xo=xt(!0),To=xt(!1),Po={},Io=Object.freeze({default:Mt}),No=Io&&Mt||Io,Ao=No.default?No.default:No,Do="object"==typeof performance&&"function"==typeof performance.now,Mo=void 0;Mo=Do?function(){return performance.now()}:function(){return Date.now()};var Ro=void 0,qo=void 0;if(bn.canUseDOM)if("function"!=typeof requestIdleCallback||"function"!=typeof cancelIdleCallback){var jo,Uo=null,zo=!1,Lo=-1,Fo=!1,Ho=0,Vo=33,Bo=33;jo=Do?{didTimeout:!1,timeRemaining:function(){var e=Ho-performance.now();return 0<e?e:0}}:{didTimeout:!1,timeRemaining:function(){var e=Ho-Date.now();return 0<e?e:0}};var Ko="__reactIdleCallback$"+Math.random().toString(36).slice(2);window.addEventListener("message",function(e){if(e.source===window&&e.data===Ko){if(zo=!1,e=Mo(),0>=Ho-e){if(!(-1!==Lo&&Lo<=e))return void(Fo||(Fo=!0,requestAnimationFrame(Wo)));jo.didTimeout=!0}else jo.didTimeout=!1;Lo=-1,e=Uo,Uo=null,null!==e&&e(jo)}},!1);var Wo=function(e){Fo=!1;var t=e-Ho+Bo;t<Bo&&Vo<Bo?(8>t&&(t=8),Bo=t<Vo?Vo:t):Vo=t,Ho=e+Bo,zo||(zo=!0,window.postMessage(Ko,"*"))};Ro=function(e,t){return Uo=e,null!=t&&"number"==typeof t.timeout&&(Lo=Mo()+t.timeout),Fo||(Fo=!0,requestAnimationFrame(Wo)),0},qo=function(){Uo=null,zo=!1,Lo=-1}}else Ro=window.requestIdleCallback,qo=window.cancelIdleCallback;else Ro=function(e){return setTimeout(function(){e({timeRemaining:function(){return 1/0}})})},qo=function(e){clearTimeout(e)};var Go=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Qo={},Yo={},$o={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg"},Jo=void 0,Xo=function(e){return"undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction?function(t,n,r,o){MSApp.execUnsafeLocalFunction(function(){return e(t,n)})}:e}(function(e,t){if(e.namespaceURI!==$o.svg||"innerHTML"in e)e.innerHTML=t;else{for(Jo=Jo||document.createElement("div"),Jo.innerHTML="<svg>"+t+"</svg>",t=Jo.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}}),Zo={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ei=["Webkit","ms","Moz","O"];Object.keys(Zo).forEach(function(e){ei.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Zo[t]=Zo[e]})});var ti=En({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0}),ni=$o.html,ri=wn.thatReturns(""),oi={topAbort:"abort",topCanPlay:"canplay",topCanPlayThrough:"canplaythrough",topDurationChange:"durationchange",topEmptied:"emptied",topEncrypted:"encrypted",topEnded:"ended",topError:"error",topLoadedData:"loadeddata",topLoadedMetadata:"loadedmetadata",topLoadStart:"loadstart",topPause:"pause",topPlay:"play",topPlaying:"playing",topProgress:"progress",topRateChange:"ratechange",topSeeked:"seeked",topSeeking:"seeking",topStalled:"stalled",topSuspend:"suspend",topTimeUpdate:"timeupdate",topVolumeChange:"volumechange",topWaiting:"waiting"},ii=Object.freeze({createElement:un,createTextNode:sn,setInitialProperties:ln,diffProperties:cn,updateProperties:fn,diffHydratedProperties:pn,diffHydratedText:dn,warnForUnmatchedText:function(){},warnForDeletedHydratableElement:function(){},warnForDeletedHydratableText:function(){},warnForInsertedHydratedElement:function(){},warnForInsertedHydratedText:function(){},restoreControlledState:function(e,t,n){switch(t){case"input":if(Vt(e,n),t=n.name,"radio"===n.type&&null!=t){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var o=n[t];if(o!==e&&o.form===e.form){var i=O(o);i||r("90"),ae(o),Vt(o,i)}}}break;case"textarea":Jt(e,n);break;case"select":null!=(t=n.value)&&Gt(e,!!n.multiple,t,!1)}}});Pr.injectFiberControlledHostComponent(ii);var ai=null,ui=null,si=Ao({getRootHostContext:function(e){var t=e.nodeType;switch(t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:en(null,"");break;default:t=8===t?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=en(e,t)}return e},getChildHostContext:function(e,t){return en(e,t)},getPublicInstance:function(e){return e},prepareForCommit:function(){ai=Vr;var e=Cn();if(Ue(e)){if("selectionStart"in e)var t={start:e.selectionStart,end:e.selectionEnd};else e:{var n=window.getSelection&&window.getSelection();if(n&&0!==n.rangeCount){t=n.anchorNode;var r=n.anchorOffset,o=n.focusNode;n=n.focusOffset;try{t.nodeType,o.nodeType}catch(e){t=null;break e}var i=0,a=-1,u=-1,s=0,l=0,c=e,f=null;t:for(;;){for(var p;c!==t||0!==r&&3!==c.nodeType||(a=i+r),c!==o||0!==n&&3!==c.nodeType||(u=i+n),3===c.nodeType&&(i+=c.nodeValue.length),null!==(p=c.firstChild);)f=c,c=p;for(;;){if(c===e)break t;if(f===t&&++s===r&&(a=i),f===o&&++l===n&&(u=i),null!==(p=c.nextSibling))break;c=f,f=c.parentNode}c=p}t=-1===a||-1===u?null:{start:a,end:u}}else t=null}t=t||{start:0,end:0}}else t=null;ui={focusedElem:e,selectionRange:t},Pe(!1)},resetAfterCommit:function(){var e=ui,t=Cn(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&On(document.documentElement,n)){if(Ue(n))if(t=r.start,e=r.end,void 0===e&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(window.getSelection){t=window.getSelection();var o=n[q()].length;e=Math.min(r.start,o),r=void 0===r.end?e:Math.min(r.end,o),!t.extend&&e>r&&(o=r,r=e,e=o),o=je(n,e);var i=je(n,r);if(o&&i&&(1!==t.rangeCount||t.anchorNode!==o.node||t.anchorOffset!==o.offset||t.focusNode!==i.node||t.focusOffset!==i.offset)){var a=document.createRange();a.setStart(o.node,o.offset),t.removeAllRanges(),e>r?(t.addRange(a),t.extend(i.node,i.offset)):(a.setEnd(i.node,i.offset),t.addRange(a))}}for(t=[],e=n;e=e.parentNode;)1===e.nodeType&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(xn(n),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}ui=null,Pe(ai),ai=null},createInstance:function(e,t,n,r,o){return e=un(e,t,n,r),e[ir]=o,e[ar]=t,e},appendInitialChild:function(e,t){e.appendChild(t)},finalizeInitialChildren:function(e,t,n,r){ln(e,t,n,r);e:{switch(t){case"button":case"input":case"select":case"textarea":e=!!n.autoFocus;break e}e=!1}return e},prepareUpdate:function(e,t,n,r,o){return cn(e,t,n,r,o)},shouldSetTextContent:function(e,t){return"textarea"===e||"string"==typeof t.children||"number"==typeof t.children||"object"==typeof t.dangerouslySetInnerHTML&&null!==t.dangerouslySetInnerHTML&&"string"==typeof t.dangerouslySetInnerHTML.__html},shouldDeprioritizeSubtree:function(e,t){return!!t.hidden},createTextInstance:function(e,t,n,r){return e=sn(e,t),e[ir]=r,e},now:Mo,mutation:{commitMount:function(e){e.focus()},commitUpdate:function(e,t,n,r,o){e[ar]=o,fn(e,t,n,r,o)},resetTextContent:function(e){e.textContent=""},commitTextUpdate:function(e,t,n){e.nodeValue=n},appendChild:function(e,t){e.appendChild(t)},appendChildToContainer:function(e,t){8===e.nodeType?e.parentNode.insertBefore(t,e):e.appendChild(t)},insertBefore:function(e,t,n){e.insertBefore(t,n)},insertInContainerBefore:function(e,t,n){8===e.nodeType?e.parentNode.insertBefore(t,n):e.insertBefore(t,n)},removeChild:function(e,t){e.removeChild(t)},removeChildFromContainer:function(e,t){8===e.nodeType?e.parentNode.removeChild(t):e.removeChild(t)}},hydration:{canHydrateInstance:function(e,t){return 1!==e.nodeType||t.toLowerCase()!==e.nodeName.toLowerCase()?null:e},canHydrateTextInstance:function(e,t){return""===t||3!==e.nodeType?null:e},getNextHydratableSibling:function(e){for(e=e.nextSibling;e&&1!==e.nodeType&&3!==e.nodeType;)e=e.nextSibling;return e},getFirstHydratableChild:function(e){for(e=e.firstChild;e&&1!==e.nodeType&&3!==e.nodeType;)e=e.nextSibling;return e},hydrateInstance:function(e,t,n,r,o,i){return e[ir]=i,e[ar]=n,pn(e,t,n,o,r)},hydrateTextInstance:function(e,t,n){return e[ir]=n,dn(e,t)},didNotMatchHydratedContainerTextInstance:function(){},didNotMatchHydratedTextInstance:function(){},didNotHydrateContainerInstance:function(){},didNotHydrateInstance:function(){},didNotFindHydratableContainerInstance:function(){},didNotFindHydratableContainerTextInstance:function(){},didNotFindHydratableInstance:function(){},didNotFindHydratableTextInstance:function(){}},scheduleDeferredCallback:Ro,cancelDeferredCallback:qo,useSyncScheduling:!0});X=si.batchedUpdates,gn.prototype.render=function(e,t){si.updateContainer(e,this._reactRootContainer,null,t)},gn.prototype.unmount=function(e){si.updateContainer(null,this._reactRootContainer,null,e)};var li={createPortal:vn,findDOMNode:function(e){if(null==e)return null;if(1===e.nodeType)return e;var t=e._reactInternalFiber;if(t)return si.findHostInstance(t);"function"==typeof e.render?r("188"):r("213",Object.keys(e))},hydrate:function(e,t,n){return yn(null,e,t,!0,n)},render:function(e,t,n){return yn(null,e,t,!1,n)},unstable_renderSubtreeIntoContainer:function(e,t,n,o){return(null==e||void 0===e._reactInternalFiber)&&r("38"),yn(e,t,n,!1,o)},unmountComponentAtNode:function(e){return hn(e)||r("40"),!!e._reactRootContainer&&(si.unbatchedUpdates(function(){yn(null,null,e,!1,function(){e._reactRootContainer=null})}),!0)},unstable_createPortal:vn,unstable_batchedUpdates:Z,unstable_deferredUpdates:si.deferredUpdates,flushSync:si.flushSync,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{EventPluginHub:rr,EventPluginRegistry:Jn,EventPropagators:sr,ReactControlledComponent:Ir,ReactDOMComponentTree:ur,ReactDOMEventListener:Kr}};si.injectIntoDevTools({findFiberByHostInstance:C,bundleType:0,version:"16.2.0",rendererPackageName:"react-dom"});var ci=Object.freeze({default:li}),fi=ci&&li||ci;e.exports=fi.default?fi.default:fi},function(e,t,n){"use strict";var r=!("undefined"==typeof window||!window.document||!window.document.createElement),o={canUseDOM:r,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:r&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:r&&!!window.screen,isInWorker:!r};e.exports=o},function(e,t,n){"use strict";var r=n(4),o={listen:function(e,t,n){return e.addEventListener?(e.addEventListener(t,n,!1),{remove:function(){e.removeEventListener(t,n,!1)}}):e.attachEvent?(e.attachEvent("on"+t,n),{remove:function(){e.detachEvent("on"+t,n)}}):void 0},capture:function(e,t,n){return e.addEventListener?(e.addEventListener(t,n,!0),{remove:function(){e.removeEventListener(t,n,!0)}}):{remove:r}},registerDefault:function(){}};e.exports=o},function(e,t,n){"use strict";function r(e){if(void 0===(e=e||("undefined"!=typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}}e.exports=r},function(e,t,n){"use strict";function r(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!==e&&t!==t}function o(e,t){if(r(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(var a=0;a<n.length;a++)if(!i.call(t,n[a])||!r(e[n[a]],t[n[a]]))return!1;return!0}var i=Object.prototype.hasOwnProperty;e.exports=o},function(e,t,n){"use strict";function r(e,t){return!(!e||!t)&&(e===t||!o(e)&&(o(t)?r(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}var o=n(37);e.exports=r},function(e,t,n){"use strict";function r(e){return o(e)&&3==e.nodeType}var o=n(38);e.exports=r},function(e,t,n){"use strict";function r(e){var t=e?e.ownerDocument||e:document,n=t.defaultView||window;return!(!e||!("function"==typeof n.Node?e instanceof n.Node:"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName))}e.exports=r},function(e,t,n){"use strict";function r(e){try{e.focus()}catch(e){}}e.exports=r},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function a(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"store",n=arguments[1],a=n||t+"Subscription",s=function(e){function n(i,a){r(this,n);var u=o(this,e.call(this,i,a));return u[t]=i.store,u}return i(n,e),n.prototype.getChildContext=function(){var e;return e={},e[t]=this[t],e[a]=null,e},n.prototype.render=function(){return u.Children.only(this.props.children)},n}(u.Component);return s.propTypes={store:c.a.isRequired,children:l.a.element.isRequired},s.childContextTypes=(e={},e[t]=c.a.isRequired,e[a]=c.b,e),s}t.a=a;var u=n(0),s=(n.n(u),n(14)),l=n.n(s),c=n(15);n(7);t.b=a()},function(e,t,n){"use strict";var r=n(4),o=n(42),i=n(43);e.exports=function(){function e(e,t,n,r,a,u){u!==i&&o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t};return n.checkPropTypes=r,n.PropTypes=n,n}},function(e,t,n){"use strict";function r(e,t,n,r,i,a,u,s){if(o(t),!e){var l;if(void 0===t)l=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,r,i,a,u,s],f=0;l=new Error(t.replace(/%s/g,function(){return c[f++]})),l.name="Invariant Violation"}throw l.framesToPop=1,l}}var o=function(e){};e.exports=r},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,n){"use strict";var r={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,mixins:!0,propTypes:!0,type:!0},o={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},i=Object.defineProperty,a=Object.getOwnPropertyNames,u=Object.getOwnPropertySymbols,s=Object.getOwnPropertyDescriptor,l=Object.getPrototypeOf,c=l&&l(Object);e.exports=function e(t,n,f){if("string"!=typeof n){if(c){var p=l(n);p&&p!==c&&e(t,p,f)}var d=a(n);u&&(d=d.concat(u(n)));for(var h=0;h<d.length;++h){var m=d[h];if(!(r[m]||o[m]||f&&f[m])){var y=s(n,m);try{i(t,m,y)}catch(e){}}}return t}return t}},function(e,t,n){"use strict";var r=function(e,t,n,r,o,i,a,u){if(!e){var s;if(void 0===t)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[n,r,o,i,a,u],c=0;s=new Error(t.replace(/%s/g,function(){return l[c++]})),s.name="Invariant Violation"}throw s.framesToPop=1,s}};e.exports=r},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(){var e=[],t=[];return{clear:function(){t=i,e=i},notify:function(){for(var n=e=t,r=0;r<n.length;r++)n[r]()},get:function(){return t},subscribe:function(n){var r=!0;return t===e&&(t=e.slice()),t.push(n),function(){r&&e!==i&&(r=!1,t===e&&(t=e.slice()),t.splice(t.indexOf(n),1))}}}}n.d(t,"a",function(){return u});var i=null,a={notify:function(){}},u=function(){function e(t,n,o){r(this,e),this.store=t,this.parentSub=n,this.onStateChange=o,this.unsubscribe=null,this.listeners=a}return e.prototype.addNestedSub=function(e){return this.trySubscribe(),this.listeners.subscribe(e)},e.prototype.notifyNestedSubs=function(){this.listeners.notify()},e.prototype.isSubscribed=function(){return Boolean(this.unsubscribe)},e.prototype.trySubscribe=function(){this.unsubscribe||(this.unsubscribe=this.parentSub?this.parentSub.addNestedSub(this.onStateChange):this.store.subscribe(this.onStateChange),this.listeners=o())},e.prototype.tryUnsubscribe=function(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null,this.listeners.clear(),this.listeners=a)},e}()},function(e,t,n){"use strict";function r(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function o(e,t,n){for(var r=t.length-1;r>=0;r--){var o=t[r](e);if(o)return o}return function(t,r){throw new Error("Invalid value of type "+typeof e+" for "+n+" argument when connecting component "+r.wrappedComponentName+".")}}function i(e,t){return e===t}var a=n(16),u=n(48),s=n(49),l=n(65),c=n(66),f=n(67),p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};t.a=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.connectHOC,n=void 0===t?a.a:t,d=e.mapStateToPropsFactories,h=void 0===d?l.a:d,m=e.mapDispatchToPropsFactories,y=void 0===m?s.a:m,v=e.mergePropsFactories,g=void 0===v?c.a:v,_=e.selectorFactory,b=void 0===_?f.a:_;return function(e,t,a){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},l=s.pure,c=void 0===l||l,f=s.areStatesEqual,d=void 0===f?i:f,m=s.areOwnPropsEqual,v=void 0===m?u.a:m,_=s.areStatePropsEqual,E=void 0===_?u.a:_,w=s.areMergedPropsEqual,S=void 0===w?u.a:w,C=r(s,["pure","areStatesEqual","areOwnPropsEqual","areStatePropsEqual","areMergedPropsEqual"]),k=o(e,h,"mapStateToProps"),O=o(t,y,"mapDispatchToProps"),x=o(a,g,"mergeProps");return n(b,p({methodName:"connect",getDisplayName:function(e){return"Connect("+e+")"},shouldHandleStateChanges:Boolean(e),initMapStateToProps:k,initMapDispatchToProps:O,initMergeProps:x,pure:c,areStatesEqual:d,areOwnPropsEqual:v,areStatePropsEqual:E,areMergedPropsEqual:S},C))}}()},function(e,t,n){"use strict";function r(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!==e&&t!==t}function o(e,t){if(r(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(var a=0;a<n.length;a++)if(!i.call(t,n[a])||!r(e[n[a]],t[n[a]]))return!1;return!0}t.a=o;var i=Object.prototype.hasOwnProperty},function(e,t,n){"use strict";function r(e){return"function"==typeof e?Object(u.b)(e,"mapDispatchToProps"):void 0}function o(e){return e?void 0:Object(u.a)(function(e){return{dispatch:e}})}function i(e){return e&&"object"==typeof e?Object(u.a)(function(t){return Object(a.bindActionCreators)(e,t)}):void 0}var a=n(17),u=n(23);t.a=[r,o,i]},function(e,t,n){"use strict";function r(e){return null==e?void 0===e?s:u:l&&l in Object(e)?Object(i.a)(e):Object(a.a)(e)}var o=n(19),i=n(53),a=n(54),u="[object Null]",s="[object Undefined]",l=o.a?o.a.toStringTag:void 0;t.a=r},function(e,t,n){"use strict";var r=n(52),o="object"==typeof self&&self&&self.Object===Object&&self,i=r.a||o||Function("return this")();t.a=i},function(e,t,n){"use strict";(function(e){var n="object"==typeof e&&e&&e.Object===Object&&e;t.a=n}).call(t,n(20))},function(e,t,n){"use strict";function r(e){var t=a.call(e,s),n=e[s];try{e[s]=void 0;var r=!0}catch(e){}var o=u.call(e);return r&&(t?e[s]=n:delete e[s]),o}var o=n(19),i=Object.prototype,a=i.hasOwnProperty,u=i.toString,s=o.a?o.a.toStringTag:void 0;t.a=r},function(e,t,n){"use strict";function r(e){return i.call(e)}var o=Object.prototype,i=o.toString;t.a=r},function(e,t,n){"use strict";var r=n(56),o=Object(r.a)(Object.getPrototypeOf,Object);t.a=o},function(e,t,n){"use strict";function r(e,t){return function(n){return e(t(n))}}t.a=r},function(e,t,n){"use strict";function r(e){return null!=e&&"object"==typeof e}t.a=r},function(e,t,n){e.exports=n(59)},function(e,t,n){"use strict";(function(e,r){Object.defineProperty(t,"__esModule",{value:!0});var o,i=n(61),a=function(e){return e&&e.__esModule?e:{default:e}}(i);o="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==e?e:r;var u=(0,a.default)(o);t.default=u}).call(t,n(20),n(60)(e))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";function r(e){var t,n=e.Symbol;return"function"==typeof n?n.observable?t=n.observable:(t=n("observable"),n.observable=t):t="@@observable",t}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r},function(e,t,n){"use strict";function r(e,t){var n=t&&t.type;return"Given action "+(n&&'"'+n.toString()+'"'||"an action")+', reducer "'+e+'" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.'}function o(e){Object.keys(e).forEach(function(t){var n=e[t];if(void 0===n(void 0,{type:a.a.INIT}))throw new Error('Reducer "'+t+"\" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.");if(void 0===n(void 0,{type:"@@redux/PROBE_UNKNOWN_ACTION_"+Math.random().toString(36).substring(7).split("").join(".")}))throw new Error('Reducer "'+t+"\" returned undefined when probed with a random type. Don't try to handle "+a.a.INIT+' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.')})}function i(e){for(var t=Object.keys(e),n={},i=0;i<t.length;i++){var a=t[i];"function"==typeof e[a]&&(n[a]=e[a])}var u=Object.keys(n),s=void 0;try{o(n)}catch(e){s=e}return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];if(s)throw s;for(var o=!1,i={},a=0;a<u.length;a++){var l=u[a],c=n[l],f=e[l],p=c(f,t);if(void 0===p){var d=r(l,t);throw new Error(d)}i[l]=p,o=o||p!==f}return o?i:e}}t.a=i;var a=n(18);n(8),n(21)},function(e,t,n){"use strict";function r(e,t){return function(){return t(e.apply(void 0,arguments))}}function o(e,t){if("function"==typeof e)return r(e,t);if("object"!=typeof e||null===e)throw new Error("bindActionCreators expected an object or a function, instead received "+(null===e?"null":typeof e)+'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');for(var n=Object.keys(e),o={},i=0;i<n.length;i++){var a=n[i],u=e[a];"function"==typeof u&&(o[a]=r(u,t))}return o}t.a=o},function(e,t,n){"use strict";function r(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return function(n,r,a){var u=e(n,r,a),s=u.dispatch,l=[],c={getState:u.getState,dispatch:function(e){return s(e)}};return l=t.map(function(e){return e(c)}),s=o.a.apply(void 0,l)(u.dispatch),i({},u,{dispatch:s})}}}t.a=r;var o=n(22),i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}},function(e,t,n){"use strict";function r(e){return"function"==typeof e?Object(i.b)(e,"mapStateToProps"):void 0}function o(e){return e?void 0:Object(i.a)(function(){return{}})}var i=n(23);t.a=[r,o]},function(e,t,n){"use strict";function r(e,t,n){return u({},n,e,t)}function o(e){return function(t,n){var r=(n.displayName,n.pure),o=n.areMergedPropsEqual,i=!1,a=void 0;return function(t,n,u){var s=e(t,n,u);return i?r&&o(s,a)||(a=s):(i=!0,a=s),a}}}function i(e){return"function"==typeof e?o(e):void 0}function a(e){return e?void 0:function(){return r}}var u=(n(24),Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e});t.a=[i,a]},function(e,t,n){"use strict";function r(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function o(e,t,n,r){return function(o,i){return n(e(o,i),t(r,i),i)}}function i(e,t,n,r,o){function i(o,i){return h=o,m=i,y=e(h,m),v=t(r,m),g=n(y,v,m),d=!0,g}function a(){return y=e(h,m),t.dependsOnOwnProps&&(v=t(r,m)),g=n(y,v,m)}function u(){return e.dependsOnOwnProps&&(y=e(h,m)),t.dependsOnOwnProps&&(v=t(r,m)),g=n(y,v,m)}function s(){var t=e(h,m),r=!p(t,y);return y=t,r&&(g=n(y,v,m)),g}function l(e,t){var n=!f(t,m),r=!c(e,h);return h=e,m=t,n&&r?a():n?u():r?s():g}var c=o.areStatesEqual,f=o.areOwnPropsEqual,p=o.areStatePropsEqual,d=!1,h=void 0,m=void 0,y=void 0,v=void 0,g=void 0;return function(e,t){return d?l(e,t):i(e,t)}}function a(e,t){var n=t.initMapStateToProps,a=t.initMapDispatchToProps,u=t.initMergeProps,s=r(t,["initMapStateToProps","initMapDispatchToProps","initMergeProps"]),l=n(e,s),c=a(e,s),f=u(e,s);return(s.pure?i:o)(l,c,f,e,s)}t.a=a;n(68)},function(e,t,n){"use strict";n(7)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(70),i=n(2),a=n(3),u=r.connect(a.default,i.default)(o.default);t.default=u},function(e,t,n){"use strict";var r=this&&this.__assign||Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e};Object.defineProperty(t,"__esModule",{value:!0});var o=n(0),i=n(9),a=n(71),u=n(90),s=n(91),l=Object.freeze({alpha:"alpha",beta:"beta"}),c=function(e){return e.data.config.permissions.canManageSettings?e.data.isFetchingAdminOptions||e.data.isFetchingSyncStatus?o.createElement(u.default,null):o.createElement(a.default,r({},e)):"You don't have permission to make any changes here. Please contact the site administrator to get access."},f=function(e){var t=(e.split("-")[1]||"").split(".")[0];return l[t]?o.createElement("div",{className:"notice notice-info inline"},o.createElement("p",null,"You are using a ",o.createElement("strong",null,"pre-release version (",""+e,")")," of the Disqus WordPress plugin."," ",o.createElement("a",{href:"https://github.com/disqus/disqus-wordpress-plugin/releases",target:"_blank"},"Check for new releases"))):null},p=function(e){return o.createElement("div",{className:"dsq-admin-wrapper"},o.createElement("div",{className:"wrap"},o.createElement("a",{href:i.getWordpressAdminUrl("disqus"),className:"disqus-logo"},o.createElement("img",{src:"https://a.disquscdn.com/dotcom/d-2407bda/img/brand/disqus-logo-blue-white.svg",width:102}))),o.createElement("div",{className:"wrap"},f(e.data.config.site.pluginVersion),e.data.message?o.createElement(s.default,r({},e.data.message)):null,c(e)))};t.default=p},function(e,t,n){"use strict";var r=this&&this.__assign||Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e};Object.defineProperty(t,"__esModule",{value:!0});var o=n(0),i=n(72),a=n(77),u=n(79),s=n(81),l=n(83),c=n(85),f=n(9),p=n(87),d=n(88),h=n(89),m=function(e){var t=e.data.adminOptions;return t.disqus_public_key&&t.disqus_secret_key&&t.disqus_installed?o.createElement(s.default,null):o.createElement("div",{className:"notice notice-warning"},o.createElement("p",null,o.createElement("span",{className:"dashicons dashicons-warning"})," ","You must have a Site Shortname, API Public Key, and API Secret Key configured to enable this feature."))},y=function(e){var t=e.data.adminOptions;return t.disqus_secret_key&&t.disqus_admin_access_token&&t.disqus_installed?o.createElement(c.default,null):o.createElement("div",{className:"notice notice-warning"},o.createElement("p",null,o.createElement("span",{className:"dashicons dashicons-warning"})," ","You must have a Site Shortname, API Secret Key, and API Access Token configured to enable this feature."))},v=function(e){return e.data.activeTab||(e.data.adminOptions.disqus_installed?"siteConfiguration":"install")},g=function(e){var t=e.data.adminOptions;return t.disqus_secret_key&&t.disqus_admin_access_token?o.createElement(i.default,null):o.createElement("div",{className:"notice notice-warning"},o.createElement("p",null,o.createElement("span",{className:"dashicons dashicons-warning"})," ","You must have an API Secret Key and API Access Token configured to enable this feature."))},_=function(e,t){return"nav-tab"+(v(e)===t?" nav-tab-active":"")},b=function(e){return o.createElement("div",{className:"nav-tab-wrapper"},o.createElement("a",{href:"#install",className:_(e,"install")},e.data.adminOptions.disqus_installed?"Reinstall":"Install"),o.createElement("a",{href:"#siteConfiguration",className:_(e,"siteConfiguration")},"Site Configuration"),o.createElement("a",{href:"#syncing",className:_(e,"syncing")},"Syncing"),o.createElement("a",{href:"#singleSignOn",className:_(e,"singleSignOn")},"Single Sign-on"),o.createElement("a",{href:"#support",className:_(e,"support")},"Support"))},E=function(e){switch(v(e)){case"syncing":return o.createElement("div",null,o.createElement("h3",null,"WordPress Comments"),o.createElement("p",{className:"description"},"Disqus has replaced the default WordPress commenting system. You may access and edit the comments in your database, but any actions performed there will not be reflected in Disqus."),o.createElement("p",{className:"submit"},o.createElement("a",{href:f.getWordpressAdminUrl("editComments"),className:"button button-large"},o.createElement("span",{className:"dashicons dashicons-wordpress-alt"})," ","View WordPress Comments")),o.createElement("hr",null),o.createElement("h3",null,"Sync"),o.createElement("p",{className:"description"},"Copy comments created and edited in Disqus to your local WordPress database for backup purposes."),y(e),o.createElement("hr",null),o.createElement("h3",null,"Import"),o.createElement("p",{className:"description"},"Import your existing WordPress comments to Disqus."," ",o.createElement("a",{href:"https://help.disqus.com/customer/portal/articles/466255",target:"_blank"},"Learn More")),g(e));case"singleSignOn":return o.createElement("div",null,o.createElement("h3",null,"Set up Single Sign-on"),o.createElement("p",{className:"description"},"Allow users to sign in with this site's user accounts. This is a Disqus Pro feature."," ",o.createElement("a",{href:"https://help.disqus.com/customer/portal/articles/1148635",target:"_blank"},"Learn More")),m(e));case"support":return o.createElement("div",null,o.createElement("h3",null,"How to Get Support"),o.createElement(d.default,null),o.createElement("hr",null),o.createElement("h3",null,"Helpful Resources"),o.createElement(p.default,null),o.createElement("hr",null),o.createElement("h3",null,"Diagnostic Information"),o.createElement("p",{className:"description"},"Include the following information in any private support requests, but do not share this publicly."),o.createElement("div",{className:"submit"},o.createElement(l.default,null)));case"install":return o.createElement(a.default,null);case"siteConfiguration":default:return o.createElement("div",null,o.createElement("h3",null,"Site Configuration"),o.createElement("p",{className:"description"},"Your site configuration comes from Disqus. Changing these values may break your installation."," ",o.createElement("a",{href:f.getForumAdminUrl(e.data.adminOptions.disqus_forum_url,"install/platforms/wordpress"),target:"_blank"},"WordPress install instructions")),o.createElement(u.default,null))}},w=function(e){return o.createElement("div",null,e.data.adminOptions.disqus_installed?o.createElement(h.default,{shortname:e.data.adminOptions.disqus_forum_url}):null,o.createElement(b,r({},e)),E(e))};t.default=w},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(73),i=n(2),a=n(3),u=r.connect(a.default,i.default)(o.default);t.default=u},function(e,t,n){"use strict";var r=this&&this.__assign||Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e};Object.defineProperty(t,"__esModule",{value:!0});var o=n(0),i=n(6),a=function(e){return e.data.isExportRunning?o.createElement("h4",null,"Sending to Disqus…"):o.createElement("h4",null,o.createElement("span",null,"Done!"," ",o.createElement("a",{href:"https://import.disqus.com/"+e.data.adminOptions.disqus_forum_url+"/",target:"_blank"},"Check your import status")))},u=function(e){var t=e.data.exportLogs.toArray(),n=t.map(function(e){var t,n;switch(e.status){case i.ExportLogStaus.failed:t="red",n=o.createElement("abbr",{title:e.error},"Failed");break;case i.ExportLogStaus.complete:t="green",n="Complete";break;case i.ExportLogStaus.pending:default:t="gray",n="Pending"}return o.createElement("tr",{key:e.id},o.createElement("td",null,e.id),o.createElement("td",null,o.createElement("a",{href:e.link},e.title)),o.createElement("td",null,o.createElement("strong",{style:{color:t}},n)),o.createElement("td",null,e.numComments))});return o.createElement("div",null,a(e),o.createElement("table",{className:"wp-list-table widefat striped"},o.createElement("thead",null,o.createElement("tr",null,o.createElement("th",{scope:"col"},"ID"),o.createElement("th",{scope:"col"},"Title"),o.createElement("th",{scope:"col"},"Status"),o.createElement("th",{scope:"col"},"# Imported"))),o.createElement("tbody",null,n)))},s=function(e){return o.createElement("form",{name:"export",method:"POST",onSubmit:e.onSubmitExportCommentsForm},o.createElement("p",{className:"submit"},o.createElement("button",{type:"submit",className:"button button-large",disabled:e.data.isExportRunning},o.createElement("span",{className:"dashicons dashicons-upload"})," ","Import Comments")),e.data.exportLogs.size?o.createElement(u,r({},e)):null)};t.default=s},function(e,t,n){"use strict";var r=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=n(10),i=function(e){function t(t){return e.call(this,t)||this}return r(t,e),t.prototype.set=function(t,n){return e.prototype.set.call(this,t,n)},t.prototype.with=function(e){return this.merge(e)},t}(o.Record({disqus_admin_access_token:null,disqus_forum_url:null,disqus_installed:null,disqus_public_key:null,disqus_secret_key:null,disqus_sso_button:null,disqus_sso_enabled:null,disqus_sync_token:null}));t.default=i},function(e,t,n){"use strict";var r=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=n(10),i=function(e){function t(t){return e.call(this,t)||this}return r(t,e),t.prototype.set=function(t,n){return e.prototype.set.call(this,t,n)},t.prototype.with=function(e){return this.merge(e)},t}(o.Record({enabled:null,last_message:null,requires_update:null,subscribed:null,subscription:null}));t.default=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(5),o=n(25),i=n(6),a=n(11);t.POSTS_PER_PAGE=10;var u=function(){function e(e){this.dispatch=e,this.currentPage=1}return e.prototype.startExportPosts=function(){return a.WordPressRestApi.instance.wordpressRestGet("posts","per_page=10&page="+this.currentPage,this.handlePostsResponse)},e.prototype.exportPost=function(e){a.WordPressRestApi.instance.pluginRestPost("export/post",{postId:e.id},this.handleExportPostResponse.bind(null,e))},e.prototype.dispatchComplete=function(e,t){this.dispatch(r.updateExportPostLogAction({error:null,id:e.id,link:e.link,numComments:t,status:i.ExportLogStaus.complete,title:e.title.rendered}))},e.prototype.dispatchError=function(e,t){this.dispatch(r.updateExportPostLogAction({error:t,id:e.id,link:e.link,numComments:null,status:i.ExportLogStaus.failed,title:e.title.rendered}))},e.prototype.handleDisqusImportResponse=function(e,t,n){var r=null;try{r=JSON.parse(n.target.responseText)}catch(e){}return r?0!==r.code?void this.dispatchError(e,r.response):void this.dispatchComplete(e,t.data.comments.length):void this.dispatchError(e,"Unknown error uploading to the Disqus servers")},e.prototype.handleExportPostResponse=function(e,t){if(!t||"OK"!==t.code)return void this.dispatchError(e,t.message);if(!t.data.comments.length)return void this.dispatchComplete(e,t.data.comments.length);var n=t.data.wxr;o.DisqusApi.instance.createImport(n.xmlContent,n.filename,this.handleDisqusImportResponse.bind(null,e,t))},e.prototype.handlePostsResponse=function(e){var t=this;Array.isArray(e)&&(e.forEach(function(e){t.dispatch(r.updateExportPostLogAction({error:null,id:e.id,link:e.link,numComments:null,status:i.ExportLogStaus.pending,title:e.title.rendered})),t.exportPost(e)}),10===e.length&&(this.currentPage+=1,this.startExportPosts()))},e}();t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(78),i=n(2),a=n(3),u=r.connect(a.default,i.default)(o.default);t.default=u},function(e,t,n){"use strict";var r=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=n(0),i=n(6),a=n(26),u="https://disqus.com/profile/login/",s="https://disqus.com/admin/install/platforms/wordpress/",l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.render=function(){var e=""+a.default.base+a.default.disqusBase+"settings "+this.props.data.adminOptions.get("disqus_sync_token","");return o.createElement("div",null,o.createElement("h3",null,"Automatic Installation"),o.createElement("p",null,"Installs Disqus on your site using a generated API application. If your site isn't publicly accessible, use the manual installation method."),this.getAutoInstallPrompt(e))},t.prototype.getAutoInstallPrompt=function(e){switch(this.props.data.installationState){case i.InstallationState.none:return o.createElement("div",null,o.createElement("p",{className:"submit"},o.createElement("strong",null,"Do you have a Disqus account?"),o.createElement("br",null),o.createElement("button",{className:"button",onClick:this.props.onUpdateInstallationState.bind(null,i.InstallationState.hasAccount)},"Yes")," ",o.createElement("button",{className:"button",onClick:this.props.onUpdateInstallationState.bind(null,i.InstallationState.noAccount)},"No")));case i.InstallationState.hasAccount:return o.createElement("div",null,o.createElement("p",{className:"submit"},o.createElement("strong",null,"Do you have a site registered on Disqus you want to use?"),o.createElement("br",null),o.createElement("button",{className:"button",onClick:this.props.onUpdateInstallationState.bind(null,i.InstallationState.hasSite)},"Yes")," ",o.createElement("button",{className:"button",onClick:this.props.onUpdateInstallationState.bind(null,i.InstallationState.noSite)},"No")));case i.InstallationState.noAccount:return o.createElement("ol",{className:"dsq-installation__instruction-list"},o.createElement("li",null,"Sign up to register your account and site with Disqus",o.createElement("br",null),o.createElement("button",{className:"button button-primary button-large",onClick:this.openDisqusPage.bind(this,e,"https://disqus.com/profile/signup/?next="+encodeURIComponent("https://disqus.com/admin/create/"))},"Sign up")),o.createElement("li",null,"After creating the site, go to the WordPress installation page to finish.",o.createElement("br",null),o.createElement("button",{className:"button",onClick:this.openDisqusPage.bind(this,e,u+"?next="+encodeURIComponent(s))},"WordPress installation page")),o.createElement("li",null,"If needed, copy the sync token below and paste it to the input field in the installation page",o.createElement("br",null),o.createElement("input",{id:"configKey",type:"text",value:e,className:"regular-text",readOnly:!0}),o.createElement("button",{className:"button",onClick:this.props.onCopyText.bind(null,"configKey")},"Copy")),o.createElement("li",null,"Click the Install button and finish configuring your Disqus settings"));case i.InstallationState.hasSite:return o.createElement("ol",{className:"dsq-installation__instruction-list"},o.createElement("li",null,"Go to the WordPress installation page",o.createElement("br",null),o.createElement("button",{className:"button button-primary button-large",onClick:this.openDisqusPage.bind(this,e,u+"?next="+encodeURIComponent(s))},"WordPress installation page")),o.createElement("li",null,"When prompted, choose the Disqus site you want to use"),o.createElement("li",null,"If needed, copy the sync token below and paste it to the input field in the installation page",o.createElement("br",null),o.createElement("input",{id:"configKey",type:"text",value:e,className:"regular-text",readOnly:!0}),o.createElement("button",{className:"button",onClick:this.props.onCopyText.bind(null,"configKey")},"Copy")),o.createElement("li",null,"Click the Install button and finish configuring your Disqus settings"));case i.InstallationState.noSite:return o.createElement("ol",{className:"dsq-installation__instruction-list"},o.createElement("li",null,"Create a new site on Disqus",o.createElement("br",null),o.createElement("button",{className:"button button-primary button-large",onClick:this.openDisqusPage.bind(this,e,u+"?next="+encodeURIComponent("https://disqus.com/admin/create/"))},"Create site")),o.createElement("li",null,"After creating the site, go to the WordPress installation page to finish.",o.createElement("br",null),o.createElement("button",{className:"button",onClick:this.openDisqusPage.bind(this,e,u+"?next="+encodeURIComponent(s))},"WordPress installation page")),o.createElement("li",null,"If needed, copy the sync token below and paste it to the input field in the installation page",o.createElement("br",null),o.createElement("input",{id:"configKey",type:"text",value:e,className:"regular-text",readOnly:!0}),o.createElement("button",{className:"button",onClick:this.props.onCopyText.bind(null,"configKey")},"Copy")),o.createElement("li",null,"Click the Install button and finish configuring your Disqus settings"));default:return null}},t.prototype.openDisqusPage=function(e,t){var n=window.open(t),r=function(t){if(t.origin.match(/https:\/\/(\w+).disqus.com/))switch(t.data){case"installPageReady":n.postMessage(e,t.origin);break;case"configurationUpdated":window.location.reload()}};window.addEventListener("message",r,!1)},t}(o.Component);t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(80),i=n(2),a=n(3),u=r.connect(a.default,i.default)(o.default);t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),o=function(e){return e.data.isSiteFormLocked?r.createElement("button",{className:"button button-link",onClick:e.onToggleState.bind(null,"isSiteFormLocked")},r.createElement("span",{className:"dashicons dashicons-lock"})," ","Click to make changes"):r.createElement("input",{type:"submit",name:"submit-site-form",className:"button button-primary",value:"Save"})},i=function(e){return r.createElement("form",{name:"site",action:"",method:"POST",onSubmit:e.onSubmitSiteForm},r.createElement("table",{className:"form-table"},r.createElement("tbody",null,r.createElement("tr",null,r.createElement("th",{scope:"row"},r.createElement("label",{htmlFor:"disqus_forum_url"},"Shortname",r.createElement("span",{style:{color:"red"}}," *"))),r.createElement("td",null,r.createElement("input",{type:"text",id:"disqus_forum_url",name:"disqus_forum_url",className:"regular-text",value:e.data.localAdminOptions.get("disqus_forum_url")||"",onChange:e.onInputChange.bind(null,"disqus_forum_url"),readOnly:Boolean(e.data.isSiteFormLocked)}),r.createElement("p",{className:"description"},"Your site's unique identifier"," ",r.createElement("a",{href:"https://help.disqus.com/customer/portal/articles/466208",target:"_blank"},"What is this?")))),r.createElement("tr",null,r.createElement("th",{scope:"row"},r.createElement("label",{htmlFor:"disqus_public_key"},"API Public Key")),r.createElement("td",null,r.createElement("input",{type:e.data.isSiteFormLocked?"password":"text",id:"disqus_public_key",name:"disqus_public_key",className:"regular-text",value:e.data.localAdminOptions.get("disqus_public_key")||"",onChange:e.onInputChange.bind(null,"disqus_public_key"),readOnly:Boolean(e.data.isSiteFormLocked),autoComplete:"new-password"}),r.createElement("p",{className:"description"},"The public key of your application (optional)."))),r.createElement("tr",null,r.createElement("th",{scope:"row"},r.createElement("label",{htmlFor:"disqus_secret_key"},"API Secret Key")),r.createElement("td",null,r.createElement("input",{type:e.data.isSiteFormLocked?"password":"text",id:"disqus_secret_key",name:"disqus_secret_key",className:"regular-text",value:e.data.localAdminOptions.get("disqus_secret_key")||"",onChange:e.onInputChange.bind(null,"disqus_secret_key"),readOnly:Boolean(e.data.isSiteFormLocked),autoComplete:"new-password"}),r.createElement("p",{className:"description"},"The secret key of your application (optional)."))),r.createElement("tr",null,r.createElement("th",{scope:"row"},r.createElement("label",{htmlFor:"disqus_admin_access_token"},"API Access Token")),r.createElement("td",null,r.createElement("input",{type:e.data.isSiteFormLocked?"password":"text",id:"disqus_admin_access_token",name:"disqus_admin_access_token",className:"regular-text",value:e.data.localAdminOptions.get("disqus_admin_access_token")||"",onChange:e.onInputChange.bind(null,"disqus_admin_access_token"),readOnly:Boolean(e.data.isSiteFormLocked),autoComplete:"new-password"}),r.createElement("p",{className:"description"},"The admin access token of your application (optional)."))))),r.createElement("p",{className:"submit"},o(e)))};t.default=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(82),i=n(2),a=n(3),u=r.connect(a.default,i.default)(o.default);t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),o=function(e){return r.createElement("form",{name:"sso",action:"",method:"POST",onSubmit:e.onSubmitSiteForm},r.createElement("table",{className:"form-table"},r.createElement("tbody",null,r.createElement("tr",null,r.createElement("th",{scope:"row"},r.createElement("label",{htmlFor:"disqus_sso_enabled"},"Enable SSO")),r.createElement("td",null,r.createElement("input",{type:"checkbox",id:"disqus_sso_enabled",name:"disqus_sso_enabled",checked:Boolean(e.data.localAdminOptions.get("disqus_sso_enabled")),onChange:e.onInputChange.bind(null,"disqus_sso_enabled")}),r.createElement("p",{className:"description"},"This will enable Single Sign-on for this site, if already enabled for your Disqus organization."))),r.createElement("tr",null,r.createElement("th",{scope:"row"},r.createElement("label",{htmlFor:"disqus_sso_button"},"Custom Login Button")),r.createElement("td",null,r.createElement("input",{type:"url",id:"disqus_sso_button",name:"disqus_sso_button",className:"regular-text",value:e.data.localAdminOptions.get("disqus_sso_button")||"",onChange:e.onInputChange.bind(null,"disqus_sso_button")}),r.createElement("p",{className:"description"},"A link to a .png, .gif, or .jpg image to show as a button in Disqus."," ",r.createElement("a",{href:"https://help.disqus.com/customer/portal/articles/236206#sso-login-button",target:"_blank"},"Learn More")))))),r.createElement("p",{className:"submit"},r.createElement("input",{type:"submit",name:"submit-application-form",className:"button button-primary",value:"Save"})))};t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(84),i=n(2),a=n(3),u=r.connect(a.default,i.default)(o.default);t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),o=function(e){return r.createElement("div",null,r.createElement("div",null,r.createElement("textarea",{id:"diagnostics-textarea",readOnly:!0,style:{minWidth:"320px",minHeight:"200px"},value:JSON.stringify(e,null,4)}),r.createElement("br",null),r.createElement("button",{className:"button",onClick:e.onCopyText.bind(null,"diagnostics-textarea")},"Copy")))};t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(86),i=n(2),a=n(3),u=r.connect(a.default,i.default)(o.default);t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),o=function(e){return e.subscribed?e.requires_update?{button:"Update Auto Syncing",endpoint:"sync/enable",status:"Needs Update",statusIcon:"play"}:e.enabled?{button:"Pause Auto Syncing",endpoint:"sync/disable",status:"Running",statusIcon:"pause"}:{button:"Enable Auto Syncing",endpoint:"sync/enable",status:"Paused",statusIcon:"play"}:{button:"Enable Auto Syncing",endpoint:"sync/enable",status:"Not Configured",statusIcon:"play"}},i=function(e){var t=o(e.data.syncStatus);return r.createElement("form",{name:t.endpoint,method:"POST",onSubmit:e.onSubmitSyncConfigForm},r.createElement("p",null,r.createElement("span",{className:"dashicons dashicons-update"})," ","Auto syncing",":"," ",r.createElement("strong",null,t.status)),e.data.syncStatus.last_message?r.createElement("p",null,e.data.syncStatus.last_message):null,r.createElement("p",{className:"submit"},r.createElement("button",{type:"submit",className:"button button-large"},r.createElement("span",{className:"dashicons dashicons-controls-"+t.statusIcon})," ",t.button)))};t.default=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),o=function(){return r.createElement("ul",null,r.createElement("li",null,r.createElement("a",{href:"https://status.disqus.com/",target:"_blank"},"Disqus System Status")),r.createElement("li",null,r.createElement("a",{href:"https://github.com/disqus/disqus-wordpress-plugin",target:"_blank"},"Github Project"," (disqus-wordpress-plugin)")))};t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),o=function(){return r.createElement("ul",{className:"dsq-support-list-container"},r.createElement("li",{className:"dsq-support-list-item"},r.createElement("div",null,r.createElement("a",{href:"https://help.disqus.com/customer/en/portal/articles/472005",target:"_blank"},r.createElement("div",{className:"dashicons dashicons-lightbulb dsq-icon-support"}),"WordPress FAQ"))),r.createElement("li",{className:"dsq-support-list-item"},r.createElement("div",null,r.createElement("a",{href:"https://disqus.com/home/channel/discussdisqus/",target:"_blank"},r.createElement("div",{className:"dashicons dashicons-groups dsq-icon-support"}),"Community Forum"))),r.createElement("li",{className:"dsq-support-list-item"},r.createElement("div",null,r.createElement("a",{href:"https://disqus.com/support/?article=contact_wordpress",target:"_blank"},r.createElement("div",{className:"dashicons dashicons-email-alt dsq-icon-support"}),"Contact Support"))))};t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),o=n(9),i=function(e){return r.createElement("div",{className:"welcome-panel"},r.createElement("div",{className:"welcome-panel-content"},r.createElement("p",{className:"about-description"},"Check out what's new"),r.createElement("div",{className:"welcome-panel-column-container"},r.createElement("div",{className:"welcome-panel-column"},r.createElement("h3",null,"Comments"),r.createElement("a",{className:"button button-primary button-hero",href:o.getForumAdminUrl(e.shortname,"moderate")},"Moderate"),r.createElement("p",null,r.createElement("strong",null,"Manage: "),r.createElement("a",{href:o.getForumAdminUrl(e.shortname,"access/banned"),target:"_blank"},"Banned users")," | ",r.createElement("a",{href:o.getForumAdminUrl(e.shortname,"settings/access"),target:"_blank"},"Restricted words filter")," | ",r.createElement("a",{href:o.getForumAdminUrl(e.shortname,"settings/moderators"),target:"_blank"},"Site moderators"))),r.createElement("div",{className:"welcome-panel-column"},r.createElement("h3",null,"Analytics"),r.createElement("ul",null,r.createElement("li",null,r.createElement("a",{className:"welcome-icon dashicons-megaphone",href:o.getForumAdminUrl(e.shortname,"analytics/comments"),target:"_blank"},"Engagement")),r.createElement("li",null,r.createElement("a",{className:"welcome-icon dashicons-chart-line",href:o.getForumAdminUrl(e.shortname,"analytics/revenue"),target:"_blank"},"Revenue")),r.createElement("li",null,r.createElement("a",{className:"welcome-icon dashicons-heart",href:o.getForumAdminUrl(e.shortname,"analytics/content"),target:"_blank"},"Popular Content")))),r.createElement("div",{className:"welcome-panel-column"},r.createElement("h3",null,"Settings"),r.createElement("ul",null,r.createElement("li",null,r.createElement("a",{className:"welcome-icon dashicons-admin-appearance",href:o.getForumAdminUrl(e.shortname,"settings/general"),target:"_blank"},"Identity")),r.createElement("li",null,r.createElement("a",{className:"welcome-icon dashicons-format-chat",href:o.getForumAdminUrl(e.shortname,"settings/community"),target:"_blank"},"Community Rules")),r.createElement("li",null,r.createElement("a",{className:"welcome-icon dashicons-admin-settings",href:o.getForumAdminUrl(e.shortname,"settings/advanced"),target:"_blank"},"Advanced")))))))};t.default=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),o=function(){return r.createElement("div",{className:"dsq-loading-container"},r.createElement("div",{className:"dsq-spinner"}))};t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),o=function(e){return e.onDismiss?r.createElement("button",{type:"button",className:"notice-dismiss",onClick:e.onDismiss},r.createElement("span",{className:"screen-reader-text"},"Dismiss this notice.")):null},i=function(e){return r.createElement("div",{className:"notice notice-"+e.type+" inline is-dismissible"},r.createElement("p",null,e.text),o(e))};t.default=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(5),o=n(6),i=window.DISQUS_WP,a=new o.default(i),u=function(e,t){switch(void 0===e&&(e=a),t.type){case r.UPDATE_ADMIN_OPTIONS:e=e.with({adminOptions:e.adminOptions.with(t.data),localAdminOptions:e.localAdminOptions.with(t.data)});break;case r.UPDATE_SYNC_STATUS:e=e.with({syncStatus:e.syncStatus.with(t.data)});break;case r.SET_MESSAGE:e=e.set("message",t.data);break;case r.SET_VALUE:e=e.with(t.data);break;case r.TOGGLE_VALUE:var n=e.get(t.data,!1);e=e.with((u={},u[t.data]=!n,u));break;case r.UPDATE_LOCAL_OPTION:e=e.with({localAdminOptions:e.localAdminOptions.with(t.data)});break;case r.CHANGE_INSTALL_STATE:e=e.with({installationState:t.data});break;case r.CHANGE_TAB_STATE:e=e.with({activeTab:t.data});break;case r.UPDATE_EXPORT_POST_LOG:var i=e.exportLogs.set(t.data.id,t.data);e=e.with({exportLogs:i,isExportRunning:Boolean(i.find(function(e,t){return e.status===o.ExportLogStaus.pending}))})}return e;var u};t.default=u}]);
admin/class-disqus-admin.php ADDED
@@ -0,0 +1,279 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The admin-specific functionality of the plugin.
4
+ *
5
+ * @link https://disqus.com
6
+ * @since 3.0
7
+ *
8
+ * @package Disqus
9
+ * @subpackage Disqus/admin
10
+ */
11
+
12
+ /**
13
+ * The admin-specific functionality of the plugin.
14
+ *
15
+ * Defines the plugin name, version, and two examples hooks for how to
16
+ * enqueue the admin-specific stylesheet and JavaScript.
17
+ *
18
+ * @package Disqus
19
+ * @subpackage Disqus/admin
20
+ * @author Ryan Valentin <ryan@disqus.com>
21
+ */
22
+ class Disqus_Admin {
23
+
24
+ /**
25
+ * The ID of this plugin.
26
+ *
27
+ * @since 3.0
28
+ * @access private
29
+ * @var string $disqus The ID of this plugin.
30
+ */
31
+ private $disqus;
32
+
33
+ /**
34
+ * The version of this plugin.
35
+ *
36
+ * @since 3.0
37
+ * @access private
38
+ * @var string $version The current version of this plugin.
39
+ */
40
+ private $version;
41
+
42
+ /**
43
+ * The unique Disqus forum shortname.
44
+ *
45
+ * @since 3.0
46
+ * @access private
47
+ * @var string $shortname The unique Disqus forum shortname.
48
+ */
49
+ private $shortname;
50
+
51
+ /**
52
+ * Initialize the class and set its properties.
53
+ *
54
+ * @since 3.0
55
+ * @param string $disqus The name of this plugin.
56
+ * @param string $version The version of this plugin.
57
+ * @param string $shortname The configured Disqus shortname.
58
+ */
59
+ public function __construct( $disqus, $version, $shortname ) {
60
+
61
+ $this->disqus = $disqus;
62
+ $this->version = $version;
63
+ $this->shortname = $shortname;
64
+ }
65
+
66
+ /**
67
+ * Register the stylesheets for the admin area.
68
+ *
69
+ * @since 3.0
70
+ */
71
+ public function enqueue_styles() {
72
+
73
+ /**
74
+ * This function is provided for demonstration purposes only.
75
+ *
76
+ * An instance of this class should be passed to the run() function
77
+ * defined in Disqus_Loader as all of the hooks are defined
78
+ * in that particular class.
79
+ *
80
+ * The Disqus_Loader will then create the relationship
81
+ * between the defined hooks and the functions defined in this
82
+ * class.
83
+ */
84
+
85
+ wp_enqueue_style(
86
+ $this->disqus, plugin_dir_url( __FILE__ ) . 'css/disqus-admin.css',
87
+ array(),
88
+ $this->version,
89
+ 'all'
90
+ );
91
+
92
+ }
93
+
94
+ /**
95
+ * Register the JavaScript for the admin area.
96
+ *
97
+ * @since 3.0
98
+ */
99
+ public function enqueue_scripts() {
100
+ if ( ! isset( $_GET['page'] ) || 'disqus' !== $_GET['page'] ) {
101
+ return;
102
+ }
103
+
104
+ $admin_js_vars = array(
105
+ 'rest' => array(
106
+ 'base' => esc_url_raw( rest_url( '/' ) ),
107
+ 'disqusBase' => 'disqus/v1/',
108
+
109
+ // Nonce is required so that the REST api permissions can recognize a user/check permissions.
110
+ 'nonce' => wp_create_nonce( 'wp_rest' ),
111
+ ),
112
+ 'adminUrls' => array(
113
+ 'disqus' => get_admin_url( null, 'admin.php?page=disqus' ),
114
+ 'editComments' => get_admin_url( null, 'edit-comments.php' ),
115
+ ),
116
+ 'permissions' => array(
117
+ 'canManageSettings' => current_user_can( 'manage_options' ),
118
+ ),
119
+ 'site' => array(
120
+ 'name' => $this->get_site_name(),
121
+ 'pluginVersion' => $this->version,
122
+ ),
123
+ );
124
+
125
+ // TODO: Match language of the WordPress installation against any other localizations once they've been set up.
126
+ $language_code = 'en';
127
+
128
+ $file = $language_code;
129
+ $file .= '.disqus-admin.bundle.';
130
+ $file .= $this->version;
131
+ $file .= WP_DEBUG ? '.js' : '.min.js';
132
+
133
+ wp_enqueue_script(
134
+ $this->disqus . '_admin',
135
+ plugin_dir_url( __FILE__ ) . 'bundles/js/' . $file,
136
+ array(),
137
+ $this->version,
138
+ true
139
+ );
140
+ wp_localize_script( $this->disqus . '_admin', 'DISQUS_WP', $admin_js_vars );
141
+ }
142
+
143
+ /**
144
+ * Builds the admin toolbar menu with the various Disqus options
145
+ *
146
+ * @since 3.0
147
+ */
148
+ public function dsq_contruct_admin_menu() {
149
+ if ( ! current_user_can( 'moderate_comments' ) ) {
150
+ return;
151
+ }
152
+
153
+ // Replace the existing WordPress comments menu item to prevent confusion
154
+ // about where to administer comments. The Disqus page will have a link to
155
+ // see WordPress comments.
156
+ remove_menu_page( 'edit-comments.php' );
157
+
158
+ add_menu_page(
159
+ 'Disqus',
160
+ 'Disqus',
161
+ 'moderate_comments',
162
+ 'disqus',
163
+ array( $this, 'dsq_render_admin_index' ),
164
+ 'dashicons-admin-comments',
165
+ 24
166
+ );
167
+ }
168
+
169
+ /**
170
+ * Builds the admin menu with the various Disqus options
171
+ *
172
+ * @since 3.0
173
+ * @param WP_Admin_Bar $wp_admin_bar Instance of the WP_Admin_Bar.
174
+ */
175
+ public function dsq_construct_admin_bar( $wp_admin_bar ) {
176
+ if ( ! current_user_can( 'moderate_comments' ) ) {
177
+ return;
178
+ }
179
+
180
+ // Replace the existing WordPress comments menu item to prevent confusion
181
+ // about where to administer comments. The Disqus page will have a link to
182
+ // see WordPress comments.
183
+ $wp_admin_bar->remove_node( 'comments' );
184
+
185
+ $disqus_node_args = array(
186
+ 'id' => 'disqus',
187
+ 'title' => '<span class="ab-icon"></span>Disqus',
188
+ 'href' => admin_url( 'admin.php?page=disqus' ),
189
+ 'meta' => array(
190
+ 'class' => 'disqus-menu-bar',
191
+ ),
192
+ );
193
+
194
+ $disqus_moderate_node_args = array(
195
+ 'parent' => 'disqus',
196
+ 'id' => 'disqus_moderate',
197
+ 'title' => 'Moderate',
198
+ 'href' => $this->get_disqus_admin_url( 'moderate' ),
199
+ );
200
+
201
+ $disqus_analytics_node_args = array(
202
+ 'parent' => 'disqus',
203
+ 'id' => 'disqus_analytics',
204
+ 'title' => 'Analytics',
205
+ 'href' => $this->get_disqus_admin_url( 'analytics/comments' ),
206
+ );
207
+
208
+ $disqus_settings_node_args = array(
209
+ 'parent' => 'disqus',
210
+ 'id' => 'disqus_settings',
211
+ 'title' => 'Settings',
212
+ 'href' => $this->get_disqus_admin_url( 'settings/general' ),
213
+ );
214
+
215
+ $disqus_configure_node_args = array(
216
+ 'parent' => 'disqus',
217
+ 'id' => 'disqus_plugin_configure',
218
+ 'title' => 'Configure Plugin',
219
+ 'href' => admin_url( 'admin.php?page=disqus' ),
220
+ );
221
+
222
+ $wp_admin_bar->add_node( $disqus_node_args );
223
+ $wp_admin_bar->add_node( $disqus_moderate_node_args );
224
+ $wp_admin_bar->add_node( $disqus_analytics_node_args );
225
+ $wp_admin_bar->add_node( $disqus_settings_node_args );
226
+ $wp_admin_bar->add_node( $disqus_configure_node_args );
227
+ }
228
+
229
+ /**
230
+ * Adds a plugin link to the Disqus entry on the plugin page.
231
+ *
232
+ * @since 3.0
233
+ * @param array $links Links rendered for Disqus entry on the plugin page.
234
+ * @param string $file The filename of the link being filtered.
235
+ */
236
+ public function dsq_plugin_action_links( $links, $file ) {
237
+ if ( 'disqus/disqus.php' === $file ) {
238
+ $plugin_links = array(
239
+ '<a href="' . esc_url( get_admin_url( null, 'admin.php?page=disqus' ) ) . '">' .
240
+ ( '' === $this->shortname ? 'Install' : 'Configure' ) .
241
+ '</a>',
242
+ );
243
+ return array_merge( $links, $plugin_links );
244
+ }
245
+ return $links;
246
+ }
247
+
248
+ /**
249
+ * Renders the admin page view from a partial file
250
+ *
251
+ * @since 3.0
252
+ */
253
+ public function dsq_render_admin_index() {
254
+ require_once plugin_dir_path( __FILE__ ) . 'partials/disqus-admin-partial.php';
255
+ }
256
+
257
+ /**
258
+ * Utility function get the admin URL with site's shortname.
259
+ *
260
+ * @since 3.0
261
+ * @access private
262
+ * @param string $path The path of the admin page to route to.
263
+ * @return string The fully-qualified admin URL for the given path.
264
+ */
265
+ private function get_disqus_admin_url( $path = '' ) {
266
+ return 'https://' . $this->shortname . '.disqus.com/admin/' . ( strlen( $path ) ? $path . '/' : '' );
267
+ }
268
+
269
+ /**
270
+ * Utility function get the site's name for display in HTML markup.
271
+ *
272
+ * @since 3.0
273
+ * @access private
274
+ * @return string The escaped name for the given site.
275
+ */
276
+ private function get_site_name() {
277
+ return esc_html( get_bloginfo( 'name' ) );
278
+ }
279
+ }
admin/css/disqus-admin.css ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * All of the CSS for your admin-specific functionality should be
3
+ * included in this file.
4
+ */
5
+
6
+ #wpadminbar #wp-admin-bar-disqus .ab-icon:before {
7
+ content: "\f101";
8
+ top: 3px;
9
+ }
10
+
11
+ .dsq-admin-header {
12
+ background: #494e58;
13
+ height: 100px;
14
+ position: absolute;
15
+ top: 0;
16
+ left: -20px;
17
+ right: -20px;
18
+ color: white;
19
+ }
20
+
21
+ .dsq-admin-wrapper {
22
+ margin-top: 20px;
23
+ }
24
+
25
+ .button-hero .disqus-icon {
26
+ float: left;
27
+ margin-top: 7px;
28
+ margin-right: 7px;
29
+ }
30
+
31
+ .welcome-panel {
32
+ overflow: hidden;
33
+ }
34
+
35
+ .welcome-panel-column .button {
36
+ margin-bottom: 1.33em;
37
+ }
38
+
39
+ .button-large .dashicons {
40
+ margin-top: 4px;
41
+ }
42
+
43
+ .submit .button-link {
44
+ text-decoration: none;
45
+ }
46
+
47
+ /* Placeholder spinner */
48
+
49
+ .dsq-loading-container {
50
+ height: 130px;
51
+ padding-top: 120px;
52
+ }
53
+
54
+ .dsq-spinner {
55
+ z-index: 500;
56
+
57
+ border: 3px solid transparent;
58
+ border-color: transparent #c2c9d4 transparent #c2c9d4;
59
+
60
+ animation: rotate-loading 1.2s linear 0s infinite normal;
61
+ transform-origin: 50% 50%;
62
+
63
+ margin: auto;
64
+ width: 25px;
65
+ height: 25px;
66
+
67
+ border-radius: 28px;
68
+ }
69
+
70
+ @keyframes rotate-loading {
71
+ 0% {
72
+ transform: rotate(0deg);
73
+ }
74
+
75
+ 100% {
76
+ transform: rotate(360deg);
77
+ }
78
+ }
79
+
80
+ .dsq-installation__instruction-list {
81
+ padding-left: 0px;
82
+ counter-reset: li 0;
83
+ margin: 35px 0px 0px 70px;
84
+ }
85
+
86
+ .dsq-installation__instruction-list::before, .installation__instruction-list::after {
87
+ content: " ";
88
+ display: table;
89
+ }
90
+
91
+ .dsq-installation__instruction-list > li {
92
+ font-size: 16px;
93
+ line-height: 1.5em;
94
+ position: relative;
95
+ z-index: 200;
96
+ margin-bottom: 40px;
97
+ list-style: none;
98
+ }
99
+
100
+ .dsq-installation__instruction-list > li::before {
101
+ content: counter(li);
102
+ counter-increment: li 1;
103
+ position: absolute;
104
+ top: -8px;
105
+ left: -65px;
106
+ width: 40px;
107
+ height: 22px;
108
+ margin-right: 8px;
109
+ color: rgb(255, 255, 255);
110
+ font-size: 21px;
111
+ font-weight: 600;
112
+ text-align: center;
113
+ padding: 0.42em 0px;
114
+ background: rgb(255, 211, 79);
115
+ border-radius: 1em;
116
+ }
117
+
118
+ .dsq-icon-support {
119
+ font-size: 72px;
120
+ width: 72px;
121
+ height: 72px;
122
+ display: block;
123
+ margin: 0 auto 5px auto;
124
+ }
125
+
126
+ .dsq-support-list-container {
127
+ display: flex;
128
+ flex-wrap: wrap;
129
+ list-style: none;
130
+ }
131
+
132
+ .dsq-support-list-item {
133
+ text-align: center;
134
+ padding: 10px 30px;
135
+ }
136
+
137
+ .dsq-support-list-item a {
138
+ text-decoration: none;
139
+ font-size: 14px;
140
+ }
admin/index.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ // Silence is golden.
admin/partials/disqus-admin-partial.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Provide a admin area view for the plugin
4
+ *
5
+ * This file is used to markup the admin-facing aspects of the plugin.
6
+ *
7
+ * @link https://disqus.com
8
+ * @since 3.0
9
+ *
10
+ * @package Disqus
11
+ * @subpackage Disqus/admin/partials
12
+ */
13
+
14
+ ?>
15
+
16
+ <div id="disqus-admin"></div>
assets/banner-772x250.png DELETED
Binary file
assets/icon-256x256.png DELETED
Binary file
assets/icon.svg DELETED
@@ -1,16 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
- <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
- <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
- width="200px" height="200px" viewBox="0 0 200 200" enable-background="new 0 0 200 200" xml:space="preserve">
6
- <g id="background">
7
- <rect fill="#2E9FFF" width="200" height="200"/>
8
- </g>
9
- <g id="Layer_2">
10
- </g>
11
- <path fill="#FFFFFF" d="M102.535,167.5c-16.518,0-31.621-6.036-43.298-16.021L30.5,155.405l11.102-27.401
12
- c-3.868-8.535-6.038-18.01-6.038-28.004c0-37.277,29.984-67.5,66.971-67.5c36.984,0,66.965,30.223,66.965,67.5
13
- C169.5,137.284,139.52,167.5,102.535,167.5z M139.102,99.807v-0.188c0-19.479-13.736-33.367-37.42-33.367h-25.58v67.5h25.201
14
- C125.171,133.753,139.102,119.284,139.102,99.807L139.102,99.807z M101.964,117.168h-7.482V82.841h7.482
15
- c10.989,0,18.283,6.265,18.283,17.07v0.188C120.247,110.995,112.953,117.168,101.964,117.168z"/>
16
- </svg>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/screenshot-1.png DELETED
Binary file
assets/screenshot-10.png DELETED
Binary file
assets/screenshot-11.png DELETED
Binary file
assets/screenshot-2.png DELETED
Binary file
assets/screenshot-3.png DELETED
Binary file
assets/screenshot-4.png DELETED
Binary file
assets/screenshot-5.png DELETED
Binary file
assets/screenshot-6.png DELETED
Binary file
assets/screenshot-7.png DELETED
Binary file
assets/screenshot-8.png DELETED
Binary file
assets/screenshot-9.png DELETED
Binary file
comments.php DELETED
@@ -1,156 +0,0 @@
1
- <?php
2
- if (DISQUS_DEBUG) {
3
- echo "<p><strong>Disqus Debug</strong> thread_id: ".get_post_meta($post->ID, 'dsq_thread_id', true)."</p>";
4
- }
5
- ?>
6
-
7
- <div id="disqus_thread">
8
- <?php if (!get_option('disqus_disable_ssr') && have_comments()): ?>
9
- <div id="dsq-content">
10
-
11
- <?php if (get_comment_pages_count() > 1 && get_option('page_comments')): // Are there comments to navigate through? ?>
12
- <div class="navigation">
13
- <div class="nav-previous">
14
- <span class="meta-nav">&larr;</span>&nbsp;
15
- <?php previous_comments_link( dsq_i('Older Comments')); ?>
16
- </div>
17
- <div class="nav-next">
18
- <?php next_comments_link(dsq_i('Newer Comments')); ?>
19
- &nbsp;<span class="meta-nav">&rarr;</span>
20
- </div>
21
- </div> <!-- .navigation -->
22
- <?php endif; // check for comment navigation ?>
23
-
24
- <ul id="dsq-comments">
25
- <?php
26
- /* Loop through and list the comments. Tell wp_list_comments()
27
- * to use dsq_comment() to format the comments.
28
- */
29
- wp_list_comments(array('callback' => 'dsq_comment'));
30
- ?>
31
- </ul>
32
-
33
- <?php if (get_comment_pages_count() > 1 && get_option('page_comments')): // Are there comments to navigate through? ?>
34
- <div class="navigation">
35
- <div class="nav-previous">
36
- <span class="meta-nav">&larr;</span>
37
- &nbsp;<?php previous_comments_link( dsq_i('Older Comments') ); ?>
38
- </div>
39
- <div class="nav-next">
40
- <?php next_comments_link( dsq_i('Newer Comments') ); ?>
41
- &nbsp;<span class="meta-nav">&rarr;</span>
42
- </div>
43
- </div><!-- .navigation -->
44
- <?php endif; // check for comment navigation ?>
45
-
46
- </div>
47
-
48
- <?php endif; ?>
49
- </div>
50
-
51
- <?php
52
-
53
- global $wp_version;
54
-
55
- $embed_vars = array(
56
- 'disqusConfig' => array(
57
- 'platform' => 'wordpress@'.$wp_version,
58
- 'language' => apply_filters( 'disqus_language_filter', '' ),
59
- ),
60
- 'disqusIdentifier' => dsq_identifier_for_post( $post ),
61
- 'disqusShortname' => strtolower( get_option( 'disqus_forum_url' ) ),
62
- 'disqusTitle' => dsq_title_for_post( $post ),
63
- 'disqusUrl' => get_permalink(),
64
- 'options' => array(
65
- 'manualSync' => get_option('disqus_manual_sync'),
66
- ),
67
- 'postId' => $post->ID,
68
- );
69
-
70
- // Add SSO vars if enabled
71
- $sso = dsq_sso();
72
- if ($sso) {
73
- global $current_site;
74
-
75
- foreach ($sso as $k=>$v) {
76
- $embed_vars['disqusConfig'][$k] = $v;
77
- }
78
-
79
- $siteurl = site_url();
80
- $sitename = get_bloginfo('name');
81
- $embed_vars['disqusConfig']['sso'] = array(
82
- 'name' => wp_specialchars_decode($sitename, ENT_QUOTES),
83
- 'button' => get_option('disqus_sso_button'),
84
- 'url' => $siteurl.'/wp-login.php',
85
- 'logout' => $siteurl.'/wp-login.php?action=logout',
86
- 'width' => '800',
87
- 'height' => '700',
88
- );
89
- }
90
-
91
- if ( get_option('dsq_external_js') == '1' ) {
92
- wp_register_script( 'dsq_embed_script', plugins_url( '/media/js/disqus.js', __FILE__ ) );
93
- wp_localize_script( 'dsq_embed_script', 'embedVars', $embed_vars );
94
- wp_enqueue_script( 'dsq_embed_script', plugins_url( '/media/js/disqus.js', __FILE__ ) );
95
- }
96
- else {
97
-
98
- ?>
99
- <script type="text/javascript">
100
- var disqus_url = '<?php echo get_permalink(); ?>';
101
- var disqus_identifier = '<?php echo dsq_identifier_for_post($post); ?>';
102
- var disqus_container_id = 'disqus_thread';
103
- var disqus_shortname = '<?php echo strtolower(get_option('disqus_forum_url')); ?>';
104
- var disqus_title = <?php echo cf_json_encode( dsq_title_for_post($post) ); ?>;
105
- var disqus_config_custom = window.disqus_config;
106
- var disqus_config = function () {
107
- /*
108
- All currently supported events:
109
- onReady: fires when everything is ready,
110
- onNewComment: fires when a new comment is posted,
111
- onIdentify: fires when user is authenticated
112
- */
113
-
114
- <?php
115
- $sso = dsq_sso();
116
- if ($sso) {
117
- foreach ($sso as $k=>$v) {
118
- echo 'this.page.' . esc_js($k) . ' = \'' . esc_js($v) . '\';';
119
- echo "\n";
120
- }
121
- echo dsq_sso_login();
122
- }
123
- ?>
124
-
125
- this.language = '<?php echo esc_js( apply_filters('disqus_language_filter', '') ) ?>';
126
- <?php if (!get_option('disqus_manual_sync')): ?>
127
- this.callbacks.onReady.push(function () {
128
-
129
- // sync comments in the background so we don't block the page
130
- var script = document.createElement('script');
131
- script.async = true;
132
- script.src = '?cf_action=sync_comments&post_id=<?php echo esc_attr( $post->ID ); ?>';
133
-
134
- var firstScript = document.getElementsByTagName('script')[0];
135
- firstScript.parentNode.insertBefore(script, firstScript);
136
- });
137
- <?php endif; ?>
138
-
139
- if (disqus_config_custom) {
140
- disqus_config_custom.call(this);
141
- }
142
- };
143
-
144
- (function() {
145
- var dsq = document.createElement('script'); dsq.type = 'text/javascript';
146
- dsq.async = true;
147
- dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
148
- (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
149
- })();
150
- </script>
151
-
152
- <?php
153
-
154
- }
155
-
156
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
disqus.php CHANGED
@@ -1,1523 +1,74 @@
1
  <?php
2
- /*
3
- Plugin Name: Disqus Comment System
4
- Plugin URI: https://disqus.com/
5
- Description: The Disqus comment system replaces your WordPress comment system with your comments hosted and powered by Disqus. Head over to the Comments admin page to set up your Disqus Comment System.
6
- Author: Disqus <team@disqus.com>
7
- Version: 2.87
8
- Author URI: https://disqus.com/
9
- */
10
-
11
- require_once(dirname(__FILE__) . '/lib/wp-api.php');
12
-
13
- define('DISQUS_DOMAIN', 'disqus.com');
14
- define('DISQUS_IMPORTER_URL', 'https://import.disqus.com/');
15
- define('DISQUS_API_URL', 'https://disqus.com/api/');
16
- define('DISQUS_RSS_PATH', '/latest.rss');
17
- define('DISQUS_CAN_EXPORT', is_file(dirname(__FILE__) . '/export.php'));
18
- if (!defined('DISQUS_DEBUG')) {
19
- define('DISQUS_DEBUG', false);
20
- }
21
- define('DISQUS_VERSION', '2.87');
22
- define('DISQUS_SYNC_TIMEOUT', 30);
23
-
24
- /**
25
- * Returns an array of all option identifiers used by Disqus.
26
- * @return array[int]string
27
- */
28
- function dsq_options() {
29
- return array(
30
- '_disqus_sync_lock',
31
- '_disqus_sync_post_ids',
32
- # render disqus in the embed
33
- 'disqus_active',
34
- 'disqus_forum_url',
35
- 'disqus_api_key',
36
- 'disqus_user_api_key',
37
- 'disqus_replace',
38
- 'disqus_cc_fix',
39
- 'dsq_external_js',
40
- # SSO features
41
- 'disqus_partner_key',
42
- 'disqus_public_key',
43
- 'disqus_secret_key',
44
- 'disqus_sso_button',
45
- # disables automatic sync via cron
46
- 'disqus_manual_sync',
47
- # disables server side rendering
48
- 'disqus_disable_ssr',
49
- # the last sync comment id (from get_forum_posts)
50
- 'disqus_last_comment_id',
51
- 'disqus_version',
52
- );
53
- }
54
-
55
- /**
56
- * @param string $file
57
- * @return string
58
- */
59
- function dsq_plugin_basename($file) {
60
- $file = dirname($file);
61
-
62
- // From WP2.5 wp-includes/plugin.php:plugin_basename()
63
- $file = str_replace('\\','/',$file); // sanitize for Win32 installs
64
- $file = preg_replace('|/+|','/', $file); // remove any duplicate slash
65
- $file = preg_replace('|^.*/' . PLUGINDIR . '/|','',$file); // get relative path from plugins dir
66
-
67
- if ( strstr($file, '/') === false ) {
68
- return $file;
69
- }
70
-
71
- $pieces = explode('/', $file);
72
- return !empty($pieces[count($pieces)-1]) ? $pieces[count($pieces)-1] : $pieces[count($pieces)-2];
73
- }
74
-
75
- if ( !defined('PLUGINDIR') ) {
76
- define('PLUGINDIR', 'wp-content/plugins'); // Relative to ABSPATH. For back compat.
77
- }
78
-
79
- $mt_disqus_version = '2.01';
80
  /**
81
- * Response from Disqus get_thread API call for comments template.
82
  *
83
- * @global string $dsq_response
84
- * @since 1.0
85
- */
86
- $dsq_response = '';
87
- /**
88
- * Disqus API instance.
89
  *
90
- * @global string $dsq_api
91
- * @since 1.0
92
- */
93
- $dsq_api = new DisqusWordPressAPI(get_option('disqus_forum_url'), get_option('disqus_api_key'));
94
-
95
- /**
96
- * Disqus currently unsupported dev toggle to output comments for this query.
97
  *
98
- * @global bool $DSQ_QUERY_COMMENTS
99
- * @since ?
 
 
 
 
 
 
 
 
 
100
  */
101
- $DSQ_QUERY_COMMENTS = false;
102
-
103
- /**
104
- * Disqus array to store post_ids from WP_Query for comment JS output.
105
- *
106
- * @global array $DSQ_QUERY_POST_IDS
107
- * @since 2.2
108
- */
109
- $DSQ_QUERY_POST_IDS = array();
110
-
111
- /**
112
- * Admin scripts
113
- */
114
-
115
- add_action('wp_dashboard_setup', 'dsq_wp_dashboard_setup');
116
- add_action( 'admin_enqueue_scripts', 'load_admin_scripts' );
117
-
118
- function load_admin_scripts($hook) {
119
-
120
- // Only show the pointer when Disqus isn't already configured
121
- if ( dsq_is_installed() === false ) {
122
- add_action( 'admin_print_footer_scripts', 'load_pointer_script_style' );
123
- }
124
-
125
- // Only load these scripts on the Disqus admin page
126
- if ( 'comments_page_disqus' != $hook ) {
127
- return;
128
- }
129
-
130
- $admin_vars = array(
131
- 'indexUrl' => admin_url('index.php'),
132
- );
133
-
134
- wp_register_script( 'admin_script', plugins_url( '/media/js/admin.js', __FILE__ ) );
135
- wp_localize_script( 'admin_script', 'adminVars', $admin_vars );
136
- wp_enqueue_script( 'admin_script', plugins_url( '/media/js/admin.js', __FILE__ ), array( 'jQuery') );
137
 
138
- wp_register_script( 'upload_script', plugins_url( '/media/js/upload.js', __FILE__) );
139
- wp_enqueue_script( 'upload_script', plugins_url( '/media/js/upload.js', __FILE__), array( 'jQuery') );
140
- }
141
-
142
- function dsq_wp_dashboard_setup() {
143
- add_action('admin_enqueue_scripts', 'load_dashboard_scripts');
144
- }
145
-
146
- function load_dashboard_scripts() {
147
- $stats = get_dash_comment_counts();
148
- $dashboard_vars = array(
149
- 'stats' => array(
150
- 'totalComments' => number_format($stats->total_comments),
151
- 'approved' => number_format($stats->approved),
152
- 'moderated' => number_format($stats->moderated),
153
- 'spam' => number_format($stats->spam),
154
- ),
155
- );
156
-
157
- wp_register_script( 'dashboard_script', plugins_url( '/media/js/dashboard.js', __FILE__ ) );
158
- wp_localize_script( 'dashboard_script', 'dashboardVars', $dashboard_vars );
159
- wp_enqueue_script( 'dashboard_script', plugins_url( '/media/js/dashboard.js', __FILE__ ), array( 'jQuery') );
160
  }
161
 
162
  /**
163
- * Adds a simple WordPress pointer to Comments menu, to remind the user to configure the plugin
 
164
  */
165
- function load_pointer_script_style() {
166
-
167
- // Assume pointer shouldn't be shown
168
- $enqueue_pointer_script_style = false;
169
-
170
- // Get array list of dismissed pointers for current user and convert it to array
171
- $dismissed_pointers = explode( ',', get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) );
172
-
173
- // Check if our pointer is not among dismissed ones
174
- if( !in_array( 'disqus_settings_pointer', $dismissed_pointers ) ) {
175
- $enqueue_pointer_script_style = true;
176
-
177
- // Add footer scripts using callback function
178
- $pointer_content = '<h3>'.dsq_i('Disqus needs to be configured').'</h3>';
179
- $pointer_content .= '<p>'.dsq_i('Configure Disqus by clicking Comments to the left.').'</p>';
180
-
181
- wp_register_script( 'pointer_script', plugins_url( '/media/js/pointer.js', __FILE__ ) );
182
- wp_localize_script( 'pointer_script', 'pointerContent', $pointer_content );
183
- wp_enqueue_script( 'pointer_script', plugins_url( '/media/js/pointer.js', __FILE__ ), array( 'jQuery') );
184
- }
185
-
186
- // Enqueue pointer CSS and JS files, if needed
187
- if( $enqueue_pointer_script_style ) {
188
- wp_enqueue_style( 'wp-pointer' );
189
- wp_enqueue_script( 'wp-pointer' );
190
- }
191
  }
192
 
193
  /**
194
- * Helper functions.
195
- */
196
-
197
- /**
198
- * Tests if site is running on Wordpress VIP
199
- * @return bool
200
  */
201
- function is_wp_vip() {
202
- return defined( 'WPCOM_IS_VIP_ENV' ) && WPCOM_IS_VIP_ENV;
 
203
  }
204
 
205
- /**
206
- * Tests if required options are configured to display the Disqus embed.
207
- * @return bool
208
- */
209
- function dsq_is_installed() {
210
- $disqus_forum_url = get_option('disqus_forum_url');
211
- $disqus_api_key = get_option('disqus_api_key');
212
- if ( strlen( $disqus_forum_url ) > 0 && strlen( $disqus_api_key ) > 0 ) {
213
- return true;
214
- }
215
- else {
216
- return false;
217
- }
218
- }
219
 
220
  /**
221
- * @return bool
 
222
  */
223
- function dsq_can_replace() {
224
- global $id, $post;
225
-
226
- if (get_option('disqus_active') === '0'){ return false; }
227
-
228
- $replace = get_option('disqus_replace');
229
-
230
- if ( is_feed() ) { return false; }
231
- if ( !isset($post) ) { return false; }
232
- if ( 'draft' == $post->post_status ) { return false; }
233
- if ( !get_option('disqus_forum_url') ) { return false; }
234
- else if ( 'all' == $replace ) { return true; }
235
-
236
- if ( !isset($post->comment_count) ) {
237
- $num_comments = 0;
238
- } else {
239
- if ( 'empty' == $replace ) {
240
- // Only get count of comments, not including pings.
241
-
242
- // If there are comments, make sure there are comments (that are not track/pingbacks)
243
- if ( $post->comment_count > 0 ) {
244
- // Yuck, this causes a DB query for each post. This can be
245
- // replaced with a lighter query, but this is still not optimal.
246
- $comments = get_approved_comments($post->ID);
247
- foreach ( $comments as $comment ) {
248
- if ( $comment->comment_type != 'trackback' && $comment->comment_type != 'pingback' ) {
249
- $num_comments++;
250
- }
251
- }
252
- } else {
253
- $num_comments = 0;
254
- }
255
- }
256
- else {
257
- $num_comments = $post->comment_count;
258
- }
259
- }
260
-
261
- return ( ('empty' == $replace && 0 == $num_comments)
262
- || ('closed' == $replace && 'closed' == $post->comment_status) );
263
- }
264
-
265
- function dsq_manage_dialog($message, $error = false) {
266
- global $wp_version;
267
-
268
- echo '<div '
269
- . ( $error ? 'id="disqus_warning" ' : '')
270
- . 'class="updated fade'
271
- . ( (version_compare($wp_version, '2.5', '<') && $error) ? '-ff0000' : '' )
272
- . '"><p><strong>'
273
- . esc_attr($message)
274
- . '</strong></p></div>';
275
- }
276
-
277
- function dsq_sync_comments($comments) {
278
- if ( count($comments) < 1 ) {
279
- return;
280
- }
281
-
282
- global $wpdb;
283
-
284
- // user MUST be logged out during this process
285
- wp_set_current_user(0);
286
-
287
- // we need the thread_ids so we can map them to posts
288
- $thread_map = array();
289
- foreach ( $comments as $comment ) {
290
- $thread_map[$comment->thread->id] = null;
291
- }
292
-
293
- $thread_ids = array_keys($thread_map);
294
-
295
- $threads_query = implode(', ', array_fill(0, count($thread_ids), '%s'));
296
-
297
- // add as many placeholders as needed
298
- $sql = "
299
- SELECT post_id, meta_value
300
- FROM $wpdb->postmeta
301
- WHERE meta_key = 'dsq_thread_id' AND meta_value IN (" . $threads_query . ")
302
- ";
303
-
304
- // Call $wpdb->prepare passing the values of the array as separate arguments
305
- $query = call_user_func_array(array($wpdb, 'prepare'), array_merge(array($sql), $thread_ids));
306
-
307
- $results = $wpdb->get_results($query);
308
-
309
- foreach ( $results as $result ) {
310
- $thread_map[$result->meta_value] = $result->post_id;
311
- }
312
- unset($result);
313
-
314
- foreach ( $comments as $comment ) {
315
- $ts = strtotime($comment->created_at);
316
- if (!$thread_map[$comment->thread->id] && !empty($comment->thread->identifier)) {
317
- // legacy threads dont already have their meta stored
318
- foreach ( $comment->thread->identifier as $identifier ) {
319
- // we know identifier starts with post_ID
320
- if ($post_ID = (int)substr($identifier, 0, strpos($identifier, ' '))) {
321
- $thread_map[$comment->thread->id] = $post_ID;
322
- $cleaned_thread_id = sanitize_meta( 'dsq_thread_id', $comment->thread->id, 'post' );
323
- update_post_meta($post_ID, 'dsq_thread_id', $cleaned_thread_id);
324
- if (DISQUS_DEBUG) {
325
- echo "updated post {$post_ID}: dsq_thread_id set to {$comment->thread->id}\n";
326
- }
327
- }
328
- }
329
- unset($identifier);
330
- }
331
- if (!$thread_map[$comment->thread->id]) {
332
- // shouldn't ever happen, but we can't be certain
333
- if (DISQUS_DEBUG) {
334
- if (!empty($comment->thread->identifier)) {
335
- $idents = implode(', ', $comment->thread->identifier);
336
- echo "skipped {$comment->id}: missing thread for identifiers ({$idents})\n";
337
- } else {
338
- echo "skipped {$comment->id}: missing thread (no identifier)\n";
339
- }
340
- }
341
- continue;
342
- }
343
- $results = $wpdb->get_results($wpdb->prepare("SELECT comment_id FROM $wpdb->commentmeta WHERE meta_key = 'dsq_post_id' AND meta_value = %s LIMIT 1", $comment->id));
344
- if (count($results)) {
345
- // already exists
346
- if (DISQUS_DEBUG) {
347
- echo "skipped {$comment->id}: comment already exists\n";
348
- }
349
- if (count($results) > 1) {
350
- // clean up duplicates -- fixes an issue where a race condition allowed comments to be synced multiple times
351
- $results = array_slice($results, 1);
352
- foreach ($results as $result) {
353
- $wpdb->prepare("DELETE FROM $wpdb->commentmeta WHERE comment_id = %s LIMIT 1", $result);
354
- }
355
- }
356
- continue;
357
- }
358
-
359
- $commentdata = false;
360
-
361
- // first lets check by the id we have stored
362
- if ($comment->meta) {
363
- $meta = explode(';', $comment->meta);
364
- foreach ($meta as $value) {
365
- $value = explode('=', $value);
366
- $meta[$value[0]] = $value[1];
367
- }
368
- unset($value);
369
- if ($meta['wp_id']) {
370
- $commentdata = $wpdb->get_row($wpdb->prepare( "SELECT comment_ID, comment_parent FROM $wpdb->comments WHERE comment_ID = %s LIMIT 1", $meta['wp_id']), ARRAY_A);
371
- }
372
- }
373
-
374
- // skip comments that were imported but are missing meta information
375
- if (!$commentdata && $comment->imported) {
376
- if (DISQUS_DEBUG) {
377
- echo "skipped {$comment->id}: comment not found and marked as imported\n";
378
- }
379
- continue;
380
- }
381
-
382
- // and follow up using legacy Disqus agent
383
- if (!$commentdata) {
384
- $commentdata = $wpdb->get_row($wpdb->prepare( "SELECT comment_ID, comment_parent FROM $wpdb->comments WHERE comment_agent = %s LIMIT 1", 'Disqus/1.0:'.$comment->id), ARRAY_A);
385
- }
386
- if (!$commentdata) {
387
- // Comment doesnt exist yet, lets insert it
388
- if ($comment->status == 'approved') {
389
- $approved = 1;
390
- } elseif ($comment->status == 'spam') {
391
- $approved = 'spam';
392
- } else {
393
- $approved = 0;
394
- }
395
- $commentdata = array(
396
- 'comment_post_ID' => $thread_map[$comment->thread->id],
397
- 'comment_date' => date('Y-m-d\TH:i:s', strtotime($comment->created_at) + (get_option('gmt_offset') * 3600)),
398
- 'comment_date_gmt' => $comment->created_at,
399
- 'comment_content' => apply_filters('pre_comment_content', $comment->message),
400
- 'comment_approved' => $approved,
401
- 'comment_agent' => 'Disqus/1.1('.DISQUS_VERSION.'):'.intval($comment->id),
402
- 'comment_type' => '',
403
- );
404
- if ($comment->is_anonymous) {
405
- $commentdata['comment_author'] = $comment->anonymous_author->name;
406
- $commentdata['comment_author_email'] = $comment->anonymous_author->email;
407
- $commentdata['comment_author_url'] = $comment->anonymous_author->url;
408
- $commentdata['comment_author_IP'] = $comment->ip_address;
409
- } else {
410
- if (!empty($comment->author->display_name)) {
411
- $commentdata['comment_author'] = $comment->author->display_name;
412
- } else {
413
- $commentdata['comment_author'] = $comment->author->username;
414
- }
415
- $commentdata['comment_author_email'] = $comment->author->email;
416
- $commentdata['comment_author_url'] = $comment->author->url;
417
- $commentdata['comment_author_IP'] = $comment->ip_address;
418
- }
419
- $commentdata = wp_filter_comment($commentdata);
420
- if ($comment->parent_post) {
421
- $parent_id = $wpdb->get_var($wpdb->prepare( "SELECT comment_id FROM $wpdb->commentmeta WHERE meta_key = 'dsq_post_id' AND meta_value = %s LIMIT 1", $comment->parent_post));
422
- if ($parent_id) {
423
- $commentdata['comment_parent'] = $parent_id;
424
- }
425
- }
426
-
427
- // due to a race condition we need to test again for coment existance
428
- if ($wpdb->get_row($wpdb->prepare( "SELECT comment_id FROM $wpdb->commentmeta WHERE meta_key = 'dsq_post_id' AND meta_value = %s LIMIT 1", $comment->id))) {
429
- // already exists
430
- if (DISQUS_DEBUG) {
431
- echo "skipped {$comment->id}: comment already exists (second check)\n";
432
- }
433
- continue;
434
- }
435
-
436
- $commentdata['comment_ID'] = wp_insert_comment($commentdata);
437
- if (DISQUS_DEBUG) {
438
- echo "inserted {$comment->id}: id is {$commentdata[comment_ID]}\n";
439
- }
440
- }
441
- if ((isset($commentdata['comment_parent']) && !$commentdata['comment_parent']) && $comment->parent_post) {
442
- $parent_id = $wpdb->get_var($wpdb->prepare( "SELECT comment_id FROM $wpdb->commentmeta WHERE meta_key = 'dsq_post_id' AND meta_value = %s LIMIT 1", $comment->parent_post));
443
- if ($parent_id) {
444
- $wpdb->query($wpdb->prepare( "UPDATE $wpdb->comments SET comment_parent = %s WHERE comment_id = %s", $parent_id, $commentdata['comment_ID']));
445
- if (DISQUS_DEBUG) {
446
- echo "updated {$comment->id}: comment_parent changed to {$parent_id}\n";
447
- }
448
-
449
- }
450
- }
451
- $comment_id = $commentdata['comment_ID'];
452
- update_comment_meta($comment_id, 'dsq_parent_post_id', $comment->parent_post);
453
- update_comment_meta($comment_id, 'dsq_post_id', $comment->id);
454
- }
455
- unset($comment);
456
-
457
- if( isset($_POST['dsq_api_key']) && $_POST['dsq_api_key'] == get_option('disqus_api_key') ) {
458
- if( isset($_GET['dsq_sync_action']) && isset($_GET['dsq_sync_comment_id']) ) {
459
- $comment_parts = explode('=', $_GET['dsq_sync_comment_id']);
460
-
461
- if (!($comment_id = intval($comment_parts[1])) > 0) {
462
- return;
463
- }
464
-
465
- if( 'wp_id' != $comment_parts[0] ) {
466
- $comment_id = $wpdb->get_var($wpdb->prepare('SELECT comment_ID FROM ' . $wpdb->comments . ' WHERE comment_post_ID = %d AND comment_agent LIKE %s', intval($post->ID), 'Disqus/1.0:' . $comment_id));
467
- }
468
-
469
- switch( $_GET['dsq_sync_action'] ) {
470
- case 'mark_spam':
471
- wp_set_comment_status($comment_id, 'spam');
472
- echo "<!-- dsq_sync: wp_set_comment_status($comment_id, 'spam') -->";
473
- break;
474
- case 'mark_approved':
475
- wp_set_comment_status($comment_id, 'approve');
476
- echo "<!-- dsq_sync: wp_set_comment_status($comment_id, 'approve') -->";
477
- break;
478
- case 'mark_killed':
479
- wp_set_comment_status($comment_id, 'hold');
480
- echo "<!-- dsq_sync: wp_set_comment_status($comment_id, 'hold') -->";
481
- break;
482
- }
483
- }
484
- }
485
- }
486
-
487
- function dsq_request_handler() {
488
- global $dsq_response;
489
- global $dsq_api;
490
- global $post;
491
- global $wpdb;
492
-
493
- if (!empty($_GET['cf_action'])) {
494
- switch ($_GET['cf_action']) {
495
- case 'sync_comments':
496
- if( !( $post_id = $_GET['post_id'] ) ) {
497
- header("HTTP/1.0 400 Bad Request");
498
- die();
499
- }
500
- // schedule the event for 5 minutes from now in case they
501
- // happen to make a quick post
502
- dsq_add_pending_post_id($post_id);
503
-
504
- if (DISQUS_DEBUG) {
505
- $response = dsq_sync_forum();
506
- if (!$response) {
507
- die('// error: '.$dsq_api->get_last_error());
508
- } else {
509
- list($last_comment_id, $comments) = $response;
510
- die('// synced '.$comments.' comments');
511
- }
512
- } else {
513
- $ts = time() + 300;
514
- $next_scheduled = wp_next_scheduled('dsq_sync_forum');
515
- if($next_scheduled) {
516
- // error_log("Not scheduling dsq_sync_forum because it's already scheduled for " . $next_scheduled);
517
- } else {
518
- // error_log("Scheduling for $ts because dsq_sync_forum is not currently scheduled.");
519
- wp_schedule_single_event($ts, 'dsq_sync_forum');
520
- }
521
- die('// sync scheduled');
522
- }
523
- break;
524
- case 'export_comments':
525
- if (current_user_can('manage_options') && DISQUS_CAN_EXPORT) {
526
- $msg = '';
527
- $result = '';
528
- $response = null;
529
-
530
- $timestamp = intval($_GET['timestamp']);
531
- $post_id = intval($_GET['post_id']);
532
- if ( isset($_GET['_dsqexport_wpnonce']) === false ) {
533
- $msg = dsq_i('Unable to export comments. Make sure you are accessing this page from the Wordpress dashboard.');
534
- $result = 'fail';
535
- }
536
- else {
537
-
538
- // Check nonce
539
- check_admin_referer('dsq-wpnonce_export', '_dsqexport_wpnonce');
540
-
541
- global $wpdb, $dsq_api;
542
- $post = $wpdb->get_results($wpdb->prepare("
543
- SELECT *
544
- FROM $wpdb->posts
545
- WHERE post_type != 'revision'
546
- AND post_status = 'publish'
547
- AND comment_count > 0
548
- AND ID > %d
549
- ORDER BY ID ASC
550
- LIMIT 1
551
- ", $post_id));
552
- $post = $post[0];
553
- $post_id = $post->ID;
554
- $max_post_id = $wpdb->get_var("
555
- SELECT MAX(Id)
556
- FROM $wpdb->posts
557
- WHERE post_type != 'revision'
558
- AND post_status = 'publish'
559
- AND comment_count > 0
560
- ");
561
- $eof = (int)($post_id == $max_post_id);
562
- if ($eof) {
563
- $status = 'complete';
564
- $msg = dsq_i('Your comments have been sent to Disqus and queued for import!');
565
- $msg .= '<br/><a href="'.DISQUS_IMPORTER_URL.'" target="_blank">';
566
- $msg .= dsq_i('See the status of your import at Disqus') . '</a>';
567
- }
568
- else {
569
- $status = 'partial';
570
- $msg = dsq_i('Processed comments on post') . ' #'. $post_id . '&hellip;';
571
- }
572
- $result = 'fail';
573
- if ($post) {
574
- require_once(dirname(__FILE__) . '/export.php');
575
- $wxr = dsq_export_wp($post);
576
- $response = $dsq_api->import_wordpress_comments($wxr, $timestamp, $eof);
577
- if (!($response['group_id'] > 0)) {
578
- $result = 'fail';
579
- $msg = '<p class="status dsq-export-fail">';
580
- $msg .= dsq_i('Sorry, something unexpected happened with the export. Please try again.');
581
- $msg .= '</p><p>';
582
- $msg .= dsq_i('If your API key has changed, you may need to reinstall Disqus (deactivate the plugin and then reactivate it).');
583
- $msg .= dsq_i('If you are still having issues, refer to the %s WordPress help page',
584
- '<a href="https://help.disqus.com/customer/portal/articles/472005" onclick="window.open(this.href); return false">');
585
- $msg .= '</a></p>';
586
- $response = $dsq_api->get_last_error();
587
- }
588
- else {
589
- if ($eof) {
590
- $msg = dsq_i('Your comments have been sent to Disqus and queued for import!');
591
- $msg .= '<br/><a href="' . $response['link'] . '" target="_blank">';
592
- $msg .= dsq_i('See the status of your import at Disqus');
593
- $msg .= '</a>';
594
- }
595
- $result = 'success';
596
- }
597
- }
598
- }
599
-
600
- // send AJAX response
601
- $response = compact('result', 'timestamp', 'status', 'post_id', 'msg', 'eof', 'response');
602
- header('Content-type: text/javascript');
603
- echo cf_json_encode($response);
604
- die();
605
- }
606
- break;
607
- case 'import_comments':
608
- if (current_user_can('manage_options')) {
609
- $msg = '';
610
- $result = '';
611
- $response = null;
612
-
613
- if ( isset($_GET['_dsqimport_wpnonce']) === false ) {
614
- $msg = dsq_i('Unable to import comments. Make sure you are accessing this page from the Wordpress dashboard.');
615
- $result = 'fail';
616
- }
617
- else
618
- {
619
- // Check nonce
620
- check_admin_referer('dsq-wpnonce_import', '_dsqimport_wpnonce');
621
-
622
- if (!isset($_GET['last_comment_id'])) $last_comment_id = false;
623
- else $last_comment_id = $_GET['last_comment_id'];
624
-
625
- if ($_GET['wipe'] == '1') {
626
- $wpdb->query("DELETE FROM `".$wpdb->prefix."commentmeta` WHERE meta_key IN ('dsq_post_id', 'dsq_parent_post_id')");
627
- $wpdb->query("DELETE FROM `".$wpdb->prefix."comments` WHERE comment_agent LIKE 'Disqus/%%'");
628
- }
629
-
630
- ob_start();
631
- $response = dsq_sync_forum($last_comment_id, true);
632
- $debug = ob_get_clean();
633
- if (!$response) {
634
- $status = 'error';
635
- $result = 'fail';
636
- $error = $dsq_api->get_last_error();
637
- $msg = '<p class="status dsq-export-fail">'.dsq_i('There was an error downloading your comments from Disqus.').'<br/>'.esc_attr($error).'</p>';
638
- } else {
639
- list($comments, $last_comment_id) = $response;
640
- if (!$comments) {
641
- $status = 'complete';
642
- $msg = dsq_i('Your comments have been downloaded from Disqus and saved in your local database.');
643
- } else {
644
- $status = 'partial';
645
- $msg = dsq_i('Import in progress (last post id: %s)', $last_comment_id) . ' &hellip;';
646
- }
647
- $result = 'success';
648
- }
649
- $debug = explode("\n", $debug);
650
- $response = compact('result', 'status', 'comments', 'msg', 'last_comment_id', 'debug');
651
- header('Content-type: text/javascript');
652
- echo cf_json_encode($response);
653
- die();
654
- }
655
- }
656
- break;
657
- }
658
- }
659
- }
660
-
661
- add_action('init', 'dsq_request_handler');
662
 
663
  /**
664
- * @param string $option_name
665
- */
666
- function dsq_image_upload_handler($option_name) {
667
- // If the upload field has a file in it
668
- if(isset($_FILES[$option_name]) && ($_FILES[$option_name]['size'] > 0)) {
669
- // Get the type of the uploaded file. This is returned as "type/extension"
670
- $arr_file_type = wp_check_filetype(basename($_FILES[$option_name]['name']));
671
- $uploaded_file_type = $arr_file_type['type'];
672
- // Set an array containing a list of acceptable formats
673
- $allowed_file_types = array('image/jpg','image/jpeg','image/gif','image/png','image/x-icon');
674
- // If the uploaded file is the right format
675
- if(in_array($uploaded_file_type, $allowed_file_types)) {
676
- // Options array for the wp_handle_upload function. 'test_upload' => false
677
- $upload_overrides = array( 'test_form' => false );
678
- // Handle the upload using WP's wp_handle_upload function. Takes the posted file and an options array
679
- $uploaded_file = wp_handle_upload($_FILES[$option_name], $upload_overrides);
680
- // If the wp_handle_upload call returned a local path for the image
681
- if(isset($uploaded_file['url'])) {
682
- update_option($option_name, $uploaded_file['url']);
683
- }
684
- }
685
- }
686
- }
687
-
688
- function dsq_add_pending_post_id($post_id) {
689
- update_post_meta($post_id, 'dsq_needs_sync', '1', $unique=true);
690
- }
691
-
692
- function dsq_get_pending_post_ids() {
693
- global $wpdb;
694
-
695
- $results = $wpdb->get_results( "SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key = 'dsq_needs_sync'");
696
- $post_ids = array();
697
- foreach ($results as $result) {
698
- $post_ids[] = $result->post_id;
699
- }
700
- return $post_ids;
701
- }
702
-
703
- function dsq_clear_pending_post_ids($post_ids) {
704
- if ( count($post_ids) < 1 ) {
705
- return;
706
- }
707
-
708
- global $wpdb;
709
-
710
- $posts_query = implode(', ', array_fill(0, count($post_ids), '%s'));
711
-
712
- // add as many placeholders as needed
713
- $sql = "
714
- DELETE FROM {$wpdb->postmeta}
715
- WHERE meta_key = 'dsq_needs_sync' AND post_id IN (" . $posts_query . ")
716
- ";
717
-
718
- // Call $wpdb->prepare passing the values of the array as separate arguments
719
- $query = call_user_func_array(array($wpdb, 'prepare'), array_merge(array($sql), $post_ids));
720
-
721
- $wpdb->query($query);
722
-
723
- update_meta_cache('dsq_needs_sync', $post_ids);
724
- }
725
-
726
-
727
- function dsq_sync_post($post_id) {
728
- global $dsq_api, $wpdb;
729
-
730
- $post = get_post($post_id);
731
-
732
- // Call update_thread to ensure our permalink is up to date
733
- dsq_update_permalink($post);
734
- }
735
-
736
- function dsq_sync_forum($last_comment_id=false, $force=false) {
737
- global $dsq_api, $wpdb;
738
-
739
- set_time_limit(DISQUS_SYNC_TIMEOUT);
740
-
741
- if ($force) {
742
- $sync_time = null;
743
- } else {
744
- $sync_time = (int)get_option('_disqus_sync_lock');
745
- }
746
-
747
- // lock expires after 1 hour
748
- if ($sync_time && $sync_time > time() - 60*60) {
749
- $dsq_api->api->last_error = 'Sync already in progress (lock found)';
750
- return false;
751
- } else {
752
- update_option('_disqus_sync_lock', time());
753
- }
754
-
755
- // sync all pending posts
756
- $post_ids = dsq_get_pending_post_ids();
757
- dsq_clear_pending_post_ids($post_ids);
758
-
759
- foreach ($post_ids as $post_id) {
760
- dsq_sync_post($post_id);
761
- }
762
-
763
- if ($last_comment_id === false) {
764
- $last_comment_id = get_option('disqus_last_comment_id');
765
- if (!$last_comment_id) {
766
- $last_comment_id = 0;
767
- }
768
- }
769
- if ($last_comment_id) {
770
- $last_comment_id++;
771
- }
772
-
773
- //$last_comment_id = 0;
774
-
775
- // Pull comments from API
776
- $dsq_response = $dsq_api->get_forum_posts($last_comment_id);
777
- if( $dsq_response < 0 || $dsq_response === false ) {
778
- return false;
779
- }
780
-
781
- // Sync comments with database.
782
- dsq_sync_comments($dsq_response);
783
- $total = 0;
784
- if ($dsq_response) {
785
- foreach ($dsq_response as $comment) {
786
- $total += 1;
787
- if ($comment->id > $last_comment_id) $last_comment_id = $comment->id;
788
- }
789
- if ($last_comment_id > get_option('disqus_last_comment_id')) {
790
- update_option('disqus_last_comment_id', $last_comment_id);
791
- }
792
- }
793
- unset($comment);
794
- delete_option('_disqus_sync_lock');
795
- return array($total, $last_comment_id);
796
- }
797
-
798
- add_action('dsq_sync_forum', 'dsq_sync_forum');
799
-
800
- function dsq_update_permalink($post) {
801
- global $dsq_api;
802
-
803
- if (DISQUS_DEBUG) {
804
- echo "updating post on disqus: {$post->ID}\n";
805
- }
806
-
807
- $response = $dsq_api->api->update_thread(null, array(
808
- 'thread_identifier' => dsq_identifier_for_post($post),
809
- 'title' => dsq_title_for_post($post),
810
- 'url' => dsq_link_for_post($post)
811
- ));
812
-
813
- //Make sure that response exists so that warnings are not thrown
814
- if (! empty($response)) {
815
- $cleaned_thread_id = sanitize_meta( 'dsq_thread_id', $response->id, 'post' );
816
- update_post_meta($post->ID, 'dsq_thread_id', $cleaned_thread_id);
817
- }
818
-
819
- return $response;
820
- }
821
-
822
- /**
823
- * Compatibility
824
- */
825
-
826
- if (!function_exists ( '_wp_specialchars' ) ) {
827
- function _wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) {
828
- $string = (string) $string;
829
-
830
- if ( 0 === strlen( $string ) ) {
831
- return '';
832
- }
833
-
834
- // Don't bother if there are no specialchars - saves some processing
835
- if ( !preg_match( '/[&<>"\']/', $string ) ) {
836
- return $string;
837
- }
838
-
839
- // Account for the previous behaviour of the function when the $quote_style is not an accepted value
840
- if ( empty( $quote_style ) ) {
841
- $quote_style = ENT_NOQUOTES;
842
- } elseif ( !in_array( $quote_style, array( 0, 2, 3, 'single', 'double' ), true ) ) {
843
- $quote_style = ENT_QUOTES;
844
- }
845
-
846
- // Store the site charset as a static to avoid multiple calls to wp_load_alloptions()
847
- if ( !$charset ) {
848
- static $_charset;
849
- if ( !isset( $_charset ) ) {
850
- $alloptions = wp_load_alloptions();
851
- $_charset = isset( $alloptions['blog_charset'] ) ? $alloptions['blog_charset'] : '';
852
- }
853
- $charset = $_charset;
854
- }
855
- if ( in_array( $charset, array( 'utf8', 'utf-8', 'UTF8' ) ) ) {
856
- $charset = 'UTF-8';
857
- }
858
-
859
- $_quote_style = $quote_style;
860
-
861
- if ( $quote_style === 'double' ) {
862
- $quote_style = ENT_COMPAT;
863
- $_quote_style = ENT_COMPAT;
864
- } elseif ( $quote_style === 'single' ) {
865
- $quote_style = ENT_NOQUOTES;
866
- }
867
-
868
- // Handle double encoding ourselves
869
- if ( !$double_encode ) {
870
- $string = wp_specialchars_decode( $string, $_quote_style );
871
- $string = preg_replace( '/&(#?x?[0-9a-z]+);/i', '|wp_entity|$1|/wp_entity|', $string );
872
- }
873
-
874
- $string = @esc_attr( $string, $quote_style, $charset );
875
-
876
- // Handle double encoding ourselves
877
- if ( !$double_encode ) {
878
- $string = str_replace( array( '|wp_entity|', '|/wp_entity|' ), array( '&', ';' ), $string );
879
- }
880
-
881
- // Backwards compatibility
882
- if ( 'single' === $_quote_style ) {
883
- $string = str_replace( "'", '&#039;', $string );
884
- }
885
-
886
- return $string;
887
- }
888
- }
889
-
890
- if (!function_exists ( 'wp_check_invalid_utf8' ) ) {
891
- function wp_check_invalid_utf8( $string, $strip = false ) {
892
- $string = (string) $string;
893
-
894
- if ( 0 === strlen( $string ) ) {
895
- return '';
896
- }
897
-
898
- // Store the site charset as a static to avoid multiple calls to get_option()
899
- static $is_utf8;
900
- if ( !isset( $is_utf8 ) ) {
901
- $is_utf8 = in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) );
902
- }
903
- if ( !$is_utf8 ) {
904
- return $string;
905
- }
906
-
907
- // Check for support for utf8 in the installed PCRE library once and store the result in a static
908
- static $utf8_pcre;
909
- if ( !isset( $utf8_pcre ) ) {
910
- $utf8_pcre = @preg_match( '/^./u', 'a' );
911
- }
912
- // We can't demand utf8 in the PCRE installation, so just return the string in those cases
913
- if ( !$utf8_pcre ) {
914
- return $string;
915
- }
916
-
917
- // preg_match fails when it encounters invalid UTF8 in $string
918
- if ( 1 === @preg_match( '/^./us', $string ) ) {
919
- return $string;
920
- }
921
-
922
- // Attempt to strip the bad chars if requested (not recommended)
923
- if ( $strip && function_exists( 'iconv' ) ) {
924
- return iconv( 'utf-8', 'utf-8', $string );
925
- }
926
-
927
- return '';
928
- }
929
- }
930
-
931
- if (!function_exists ( 'esc_html' ) ) {
932
- function esc_html( $text ) {
933
- $safe_text = wp_check_invalid_utf8( $text );
934
- $safe_text = _wp_specialchars( $safe_text, ENT_QUOTES );
935
- return apply_filters( 'esc_html', $safe_text, $text );
936
- }
937
- }
938
-
939
- if (!function_exists ( 'esc_attr' ) ) {
940
- function esc_attr( $text ) {
941
- $safe_text = wp_check_invalid_utf8( $text );
942
- $safe_text = _wp_specialchars( $safe_text, ENT_QUOTES );
943
- return apply_filters( 'attribute_escape', $safe_text, $text );
944
- }
945
- }
946
-
947
- /**
948
- * Filters/Actions
949
- */
950
-
951
- // ugly global hack for comments closing
952
- $EMBED = false;
953
- function dsq_comments_template($value) {
954
- global $EMBED;
955
- global $post;
956
- global $comments;
957
-
958
- if ( !( is_singular() && ( have_comments() || 'open' == $post->comment_status ) ) ) {
959
- return;
960
- }
961
-
962
- if ( !dsq_is_installed() || !dsq_can_replace() ) {
963
- return $value;
964
- }
965
-
966
- // TODO: If a disqus-comments.php is found in the current template's
967
- // path, use that instead of the default bundled comments.php
968
- //return TEMPLATEPATH . '/disqus-comments.php';
969
- $EMBED = true;
970
- return dirname(__FILE__) . '/comments.php';
971
- }
972
-
973
- function dsq_comment( $comment, $args, $depth ) {
974
- $GLOBALS['comment'] = $comment;
975
- switch ($comment->comment_type):
976
- case '' :
977
- ?>
978
- <li <?php comment_class(); ?> id="dsq-comment-<?php echo comment_ID(); ?>">
979
- <div id="dsq-comment-header-<?php echo comment_ID(); ?>" class="dsq-comment-header">
980
- <cite id="dsq-cite-<?php echo comment_ID(); ?>">
981
- <?php if(get_comment_author_url()) : ?>
982
- <a id="dsq-author-user-<?php echo comment_ID(); ?>" href="<?php echo comment_author_url(); ?>" target="_blank" rel="nofollow"><?php echo comment_author(); ?></a>
983
- <?php else : ?>
984
- <span id="dsq-author-user-<?php echo comment_ID(); ?>"><?php echo comment_author(); ?></span>
985
- <?php endif; ?>
986
- </cite>
987
- </div>
988
- <div id="dsq-comment-body-<?php echo comment_ID(); ?>" class="dsq-comment-body">
989
- <div id="dsq-comment-message-<?php echo comment_ID(); ?>" class="dsq-comment-message"><?php echo wp_filter_kses(comment_text()); ?></div>
990
- </div>
991
-
992
- <?php
993
- break;
994
- case 'pingback' :
995
- case 'trackback' :
996
- ?>
997
- <li class="post pingback">
998
- <p><?php echo dsq_i('Pingback:'); ?> <?php comment_author_link(); ?>(<?php edit_comment_link(dsq_i('Edit'), ' '); ?>)</p>
999
- </li>
1000
- <?php
1001
- break;
1002
- endswitch;
1003
- }
1004
-
1005
- // Mark entries in index to replace comments link.
1006
- // As of WordPress 3.1 this is required to return a numerical value
1007
- function dsq_comments_number($count) {
1008
- global $post;
1009
-
1010
- return $count;
1011
- }
1012
-
1013
- function dsq_comments_text($comment_text) {
1014
- global $post;
1015
-
1016
- if ( dsq_can_replace() ) {
1017
- return '<span class="dsq-postid" data-dsqidentifier="'.esc_attr(dsq_identifier_for_post($post)).'">'.$comment_text.'</span>';
1018
- } else {
1019
- return $comment_text;
1020
- }
1021
- }
1022
-
1023
- function dsq_bloginfo_url($url) {
1024
- if ( get_feed_link('comments_rss2') == $url && dsq_can_replace() ) {
1025
- return 'https://' . strtolower(get_option('disqus_forum_url')) . '.disqus.com' . DISQUS_RSS_PATH;
1026
- } else {
1027
- return $url;
1028
- }
1029
- }
1030
-
1031
- function dsq_plugin_action_links($links, $file) {
1032
- $plugin_file = basename(__FILE__);
1033
- if (basename($file) == $plugin_file) {
1034
- if (!dsq_is_installed()) {
1035
- $settings_link = '<a href="edit-comments.php?page=disqus">'.dsq_i('Configure').'</a>';
1036
- } else {
1037
- $settings_link = '<a href="edit-comments.php?page=disqus#adv">'.dsq_i('Settings').'</a>';
1038
- }
1039
- array_unshift($links, $settings_link);
1040
- }
1041
- return $links;
1042
- }
1043
- add_filter('plugin_action_links', 'dsq_plugin_action_links', 10, 2);
1044
-
1045
- /**
1046
- * Hide the default comment form to stop spammers by marking all comments
1047
- * as closed.
1048
- */
1049
- function dsq_comments_open($open, $post_id=null) {
1050
- global $EMBED;
1051
- if ($EMBED) return false;
1052
- return $open;
1053
- }
1054
- add_filter('comments_open', 'dsq_comments_open');
1055
-
1056
- // Always add Disqus management page to the admin menu
1057
- function dsq_add_pages() {
1058
- add_submenu_page(
1059
- 'edit-comments.php',
1060
- 'Disqus',
1061
- 'Disqus',
1062
- 'moderate_comments',
1063
- 'disqus',
1064
- 'dsq_manage'
1065
- );
1066
- }
1067
- add_action('admin_menu', 'dsq_add_pages', 10);
1068
-
1069
- // only active on dashboard
1070
- function get_dash_comment_counts() {
1071
- global $wpdb;
1072
- // taken from wp-includes/comment.php - WP 2.8.5
1073
- $count = $wpdb->get_results("
1074
- SELECT comment_approved, COUNT( * ) AS num_comments
1075
- FROM {$wpdb->comments}
1076
- WHERE comment_type != 'trackback'
1077
- AND comment_type != 'pingback'
1078
- GROUP BY comment_approved
1079
- ", ARRAY_A );
1080
- $total = 0;
1081
- $approved = array('0' => 'moderated', '1' => 'approved', 'spam' => 'spam');
1082
- $known_types = array_keys( $approved );
1083
- foreach( (array) $count as $row_num => $row ) {
1084
- $total += $row['num_comments'];
1085
- if ( in_array( $row['comment_approved'], $known_types ) && array_key_exists($row['comment_approved'], $approved) )
1086
- $stats[$approved[$row['comment_approved']]] = $row['num_comments'];
1087
- }
1088
-
1089
- $stats['total_comments'] = $total;
1090
- foreach ( $approved as $key ) {
1091
- if ( empty($stats[$key]) )
1092
- $stats[$key] = 0;
1093
- }
1094
- return (object) $stats;
1095
- }
1096
-
1097
- function dsq_manage() {
1098
- if (dsq_does_need_update() && isset($_POST['upgrade'])) {
1099
- dsq_install();
1100
- }
1101
-
1102
- if (dsq_does_need_update() && !isset($_POST['reset'])) {
1103
- include_once(dirname(__FILE__) . '/upgrade.php');
1104
- } else {
1105
- include_once(dirname(__FILE__) . '/manage.php');
1106
- }
1107
- }
1108
-
1109
- function dsq_admin_head() {
1110
- if (isset($_GET['page']) && $_GET['page'] == 'disqus') {
1111
- ?>
1112
- <link rel='stylesheet' href='<?php echo esc_url( plugins_url( 'media/styles/manage.css', __FILE__ ) ); ?>' type='text/css' />
1113
- <style type="text/css">
1114
- .dsq-importing, .dsq-imported, .dsq-import-fail, .dsq-exporting, .dsq-exported, .dsq-export-fail {
1115
- background: url(<?php echo esc_url( admin_url('images/loading.gif') ); ?>) left center no-repeat;
1116
- line-height: 16px;
1117
- padding-left: 20px;
1118
- }
1119
- p.status {
1120
- padding-top: 0;
1121
- padding-bottom: 0;
1122
- margin: 0;
1123
- }
1124
- .dsq-imported, .dsq-exported {
1125
- background: url(<?php echo esc_url( admin_url('images/yes.png') ); ?>) left center no-repeat;
1126
- }
1127
- .dsq-import-fail, .dsq-export-fail {
1128
- background: url(<?php echo esc_url( admin_url('images/no.png') ); ?>) left center no-repeat;
1129
- }
1130
- </style>
1131
- <?php
1132
- // HACK: Our own styles for older versions of WordPress.
1133
- global $wp_version;
1134
- if ( version_compare($wp_version, '2.5', '<') ) {
1135
- echo "<link rel='stylesheet' href='" . esc_url( plugins_url( 'media/styles/manage-pre25.css', __FILE__ ) ) . "' type='text/css' />";
1136
- }
1137
- }
1138
- }
1139
- add_action('admin_head', 'dsq_admin_head');
1140
-
1141
- /**
1142
- * Wrapper for built-in __() which pulls all text from
1143
- * the disqus domain and supports variable interpolation.
1144
- */
1145
- function dsq_i($text, $params=null) {
1146
- if (!is_array($params))
1147
- {
1148
- $params = func_get_args();
1149
- $params = array_slice($params, 1);
1150
- }
1151
- return vsprintf(__($text, 'disqus'), $params);
1152
- }
1153
-
1154
- // catch original query
1155
- function dsq_parse_query($query) {
1156
- add_action('the_posts', 'dsq_add_request_post_ids', 999);
1157
- }
1158
- add_action('parse_request', 'dsq_parse_query');
1159
-
1160
- // track the original request post_ids, only run once
1161
- function dsq_add_request_post_ids($posts) {
1162
- dsq_add_query_posts($posts);
1163
- remove_action('the_posts', 'dsq_log_request_post_ids', 999);
1164
- return $posts;
1165
- }
1166
-
1167
- function dsq_maybe_add_post_ids($posts) {
1168
- global $DSQ_QUERY_COMMENTS;
1169
- if ($DSQ_QUERY_COMMENTS) {
1170
- dsq_add_query_posts($posts);
1171
- }
1172
- return $posts;
1173
- }
1174
- add_action('the_posts', 'dsq_maybe_add_post_ids');
1175
-
1176
- function dsq_add_query_posts($posts) {
1177
- global $DSQ_QUERY_POST_IDS;
1178
- if (count($posts)) {
1179
- foreach ($posts as $post) {
1180
- $post_ids[] = intval($post->ID);
1181
- }
1182
- $DSQ_QUERY_POST_IDS[md5(serialize($post_ids))] = $post_ids;
1183
- }
1184
- }
1185
-
1186
- function dsq_output_count_js() {
1187
- if ( get_option('dsq_external_js') == '1' ) {
1188
- $count_vars = array(
1189
- 'disqusShortname' => strtolower( get_option( 'disqus_forum_url' ) ),
1190
- );
1191
-
1192
- wp_register_script( 'dsq_count_script', plugins_url( '/media/js/count.js', __FILE__ ) );
1193
- wp_localize_script( 'dsq_count_script', 'countVars', $count_vars );
1194
- wp_enqueue_script( 'dsq_count_script', plugins_url( '/media/js/count.js', __FILE__ ) );
1195
- }
1196
- else {
1197
- ?>
1198
- <script type="text/javascript">
1199
- // <![CDATA[
1200
- var disqus_shortname = '<?php echo strtolower( get_option('disqus_forum_url') ); ?>';
1201
- (function () {
1202
- var nodes = document.getElementsByTagName('span');
1203
- for (var i = 0, url; i < nodes.length; i++) {
1204
- if (nodes[i].className.indexOf('dsq-postid') != -1 && nodes[i].parentNode.tagName == 'A') {
1205
- nodes[i].parentNode.setAttribute('data-disqus-identifier', nodes[i].getAttribute('data-dsqidentifier'));
1206
- url = nodes[i].parentNode.href.split('#', 1);
1207
- if (url.length == 1) { url = url[0]; }
1208
- else { url = url[1]; }
1209
- nodes[i].parentNode.href = url + '#disqus_thread';
1210
- }
1211
- }
1212
- var s = document.createElement('script');
1213
- s.async = true;
1214
- s.type = 'text/javascript';
1215
- s.src = '//' + disqus_shortname + '.<?php echo DISQUS_DOMAIN; ?>/count.js';
1216
- (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
1217
- }());
1218
- // ]]>
1219
- </script>
1220
- <?php
1221
- }
1222
- }
1223
-
1224
- function dsq_output_footer_comment_js() {
1225
- if (!dsq_can_replace()) return;
1226
-
1227
- dsq_output_count_js();
1228
- }
1229
-
1230
- add_action('wp_footer', 'dsq_output_footer_comment_js');
1231
-
1232
- // UPDATE DSQ when a permalink changes
1233
-
1234
- $dsq_prev_permalinks = array();
1235
-
1236
- function dsq_prev_permalink($post_id) {
1237
- $post = get_post($post_id);
1238
- // if post not published, return
1239
- if ($post->post_status != 'publish') {
1240
- return;
1241
- }
1242
- global $dsq_prev_permalinks;
1243
- $dsq_prev_permalinks['post_'.$post_id] = get_permalink($post_id);
1244
- }
1245
- add_action('pre_post_update', 'dsq_prev_permalink');
1246
-
1247
- function dsq_check_permalink($post_id) {
1248
- global $dsq_prev_permalinks;
1249
- if (!empty($dsq_prev_permalinks['post_'.$post_id]) &&
1250
- $dsq_prev_permalinks['post_'.$post_id] != get_permalink($post_id)
1251
- ) {
1252
- $post = get_post($post_id);
1253
- dsq_update_permalink($post);
1254
- }
1255
- }
1256
- add_action('edit_post', 'dsq_check_permalink');
1257
-
1258
- // Only replace comments if the disqus_forum_url option is set.
1259
- add_filter('comments_template', 'dsq_comments_template');
1260
- add_filter('comments_number', 'dsq_comments_text');
1261
- add_filter('get_comments_number', 'dsq_comments_number');
1262
- add_filter('bloginfo_url', 'dsq_bloginfo_url');
1263
-
1264
- /**
1265
- * JSON ENCODE for PHP < 5.2.0
1266
- * Checks if json_encode is not available and defines json_encode
1267
- * to use php_json_encode in its stead
1268
- * Works on iteratable objects as well - stdClass is iteratable, so all WP objects are gonna be iteratable
1269
- */
1270
- if(!function_exists('cf_json_encode')) {
1271
- function cf_json_encode($data) {
1272
-
1273
- // json_encode is sending an application/x-javascript header on Joyent servers
1274
- // for some unknown reason.
1275
- return cfjson_encode($data);
1276
- }
1277
-
1278
- function cfjson_encode_string($str) {
1279
- if(is_bool($str)) {
1280
- return $str ? 'true' : 'false';
1281
- }
1282
-
1283
- return str_replace(
1284
- array(
1285
- '"'
1286
- , '/'
1287
- , "\n"
1288
- , "\r"
1289
- )
1290
- , array(
1291
- '\"'
1292
- , '\/'
1293
- , '\n'
1294
- , '\r'
1295
- )
1296
- , $str
1297
- );
1298
- }
1299
-
1300
- function cfjson_encode($arr) {
1301
- $json_str = '';
1302
- if (is_array($arr)) {
1303
- $pure_array = true;
1304
- $array_length = count($arr);
1305
- for ( $i = 0; $i < $array_length ; $i++) {
1306
- if (!isset($arr[$i])) {
1307
- $pure_array = false;
1308
- break;
1309
- }
1310
- }
1311
- if ($pure_array) {
1312
- $json_str = '[';
1313
- $temp = array();
1314
- for ($i=0; $i < $array_length; $i++) {
1315
- $temp[] = sprintf("%s", cfjson_encode($arr[$i]));
1316
- }
1317
- $json_str .= implode(',', $temp);
1318
- $json_str .="]";
1319
- }
1320
- else {
1321
- $json_str = '{';
1322
- $temp = array();
1323
- foreach ($arr as $key => $value) {
1324
- $temp[] = sprintf("\"%s\":%s", $key, cfjson_encode($value));
1325
- }
1326
- $json_str .= implode(',', $temp);
1327
- $json_str .= '}';
1328
- }
1329
- }
1330
- else if (is_object($arr)) {
1331
- $json_str = '{';
1332
- $temp = array();
1333
- foreach ($arr as $k => $v) {
1334
- $temp[] = '"'.$k.'":'.cfjson_encode($v);
1335
- }
1336
- $json_str .= implode(',', $temp);
1337
- $json_str .= '}';
1338
- }
1339
- else if (is_string($arr)) {
1340
- $json_str = '"'. cfjson_encode_string($arr) . '"';
1341
- }
1342
- else if (is_numeric($arr)) {
1343
- $json_str = $arr;
1344
- }
1345
- else if (is_bool($arr)) {
1346
- $json_str = $arr ? 'true' : 'false';
1347
- }
1348
- else {
1349
- $json_str = '"'. cfjson_encode_string($arr) . '"';
1350
- }
1351
- return $json_str;
1352
- }
1353
- }
1354
-
1355
- // Single Sign-on Integration
1356
-
1357
- function dsq_sso_login() {
1358
- global $current_site;
1359
- $sitename = get_bloginfo('name');
1360
- $siteurl = site_url();
1361
- $button = get_option('disqus_sso_button');
1362
- $sso_login_str = 'this.sso = {
1363
- name: "' . esc_js( $sitename ) . '",
1364
- button: "' . $button . '",
1365
- url: "' . $siteurl . '/wp-login.php",
1366
- logout: "' . $siteurl . '/wp-login.php?action=logout",
1367
- width: "800",
1368
- height: "700"
1369
- };';
1370
- return $sso_login_str;
1371
- }
1372
-
1373
- function dsq_sso() {
1374
- if ($key = get_option('disqus_partner_key')) {
1375
- // use old style SSO
1376
- $new = false;
1377
- } elseif (($key = get_option('disqus_secret_key')) && ($public = get_option('disqus_public_key'))) {
1378
- // use new style SSO
1379
- $new = true;
1380
- } else {
1381
- // sso is not configured
1382
- return array();
1383
- }
1384
- global $current_user, $dsq_api;
1385
- get_currentuserinfo();
1386
- if ($current_user->ID) {
1387
- $avatar_tag = get_avatar($current_user->ID);
1388
- $avatar_data = array();
1389
- preg_match('/(src)=((\'|")[^(\'|")]*(\'|"))/i', $avatar_tag, $avatar_data);
1390
- $avatar = str_replace(array('"', "'"), '', $avatar_data[2]);
1391
- $user_data = array(
1392
- 'username' => $current_user->display_name,
1393
- 'id' => $current_user->ID,
1394
- 'avatar' => $avatar,
1395
- 'email' => $current_user->user_email,
1396
- 'url' => $current_user->user_url,
1397
- );
1398
- }
1399
- else {
1400
- $user_data = array();
1401
- }
1402
- $user_data = base64_encode(cf_json_encode($user_data));
1403
- $time = time();
1404
- $hmac = dsq_hmacsha1($user_data.' '.$time, $key);
1405
-
1406
- $payload = $user_data.' '.$hmac.' '.$time;
1407
-
1408
- if ($new) {
1409
- return array('remote_auth_s3'=>$payload, 'api_key'=>$public);
1410
- } else {
1411
- return array('remote_auth_s2'=>$payload);
1412
- }
1413
- }
1414
-
1415
- // from: http://www.php.net/manual/en/function.sha1.php#39492
1416
- // Calculate HMAC-SHA1 according to RFC2104
1417
- // http://www.ietf.org/rfc/rfc2104.txt
1418
- function dsq_hmacsha1($data, $key) {
1419
- $blocksize=64;
1420
- $hashfunc='sha1';
1421
- if (strlen($key)>$blocksize)
1422
- $key=pack('H*', $hashfunc($key));
1423
- $key=str_pad($key,$blocksize,chr(0x00));
1424
- $ipad=str_repeat(chr(0x36),$blocksize);
1425
- $opad=str_repeat(chr(0x5c),$blocksize);
1426
- $hmac = pack(
1427
- 'H*',$hashfunc(
1428
- ($key^$opad).pack(
1429
- 'H*',$hashfunc(
1430
- ($key^$ipad).$data
1431
- )
1432
- )
1433
- )
1434
- );
1435
- return bin2hex($hmac);
1436
- }
1437
-
1438
- function dsq_identifier_for_post($post) {
1439
- return $post->ID . ' ' . $post->guid;
1440
- }
1441
-
1442
- function dsq_title_for_post($post) {
1443
- $title = get_the_title($post);
1444
- $title = strip_tags($title, DISQUS_ALLOWED_HTML);
1445
- return $title;
1446
- }
1447
-
1448
- function dsq_link_for_post($post) {
1449
- return get_permalink($post);
1450
- }
1451
-
1452
- function dsq_does_need_update() {
1453
- $version = (string)get_option('disqus_version');
1454
- if (empty($version)) {
1455
- $version = '0';
1456
- }
1457
-
1458
- if (version_compare($version, '2.49', '<')) {
1459
- return true;
1460
- }
1461
-
1462
- return false;
1463
- }
1464
-
1465
- function dsq_install($allow_database_install=true) {
1466
- global $wpdb, $userdata;
1467
-
1468
- $version = (string)get_option('disqus_version');
1469
- if (!$version) {
1470
- $version = '0';
1471
- }
1472
-
1473
- if ($allow_database_install)
1474
- {
1475
- dsq_install_database($version);
1476
- }
1477
-
1478
- if (version_compare($version, DISQUS_VERSION, '=')) return;
1479
-
1480
- // if this is a new install, we should not set disqus active
1481
- if ($version == '0') {
1482
- add_option('disqus_active', '0');
1483
- } else {
1484
- add_option('disqus_active', '1');
1485
- }
1486
-
1487
- update_option('disqus_version', DISQUS_VERSION);
1488
- }
1489
-
1490
- /**
1491
- * Initializes the database if it's not already present.
1492
  */
1493
- function dsq_install_database($version=0) {
1494
- global $wpdb;
1495
-
1496
- if ( version_compare($version, '2.49', '<') && !is_wp_vip() ) {
1497
- $wpdb->query("CREATE INDEX disqus_dupecheck ON `".$wpdb->prefix."commentmeta` (meta_key, meta_value(11));");
1498
- }
1499
- }
1500
- function dsq_reset_database($version=0) {
1501
- global $wpdb;
1502
 
1503
- if ( version_compare($version, '2.49', '>=') && !is_wp_vip() ) {
1504
- $wpdb->query("DROP INDEX disqus_dupecheck ON `".$wpdb->prefix."commentmeta`;");
1505
- }
1506
- }
1507
 
1508
- /**
1509
- * Disable internal Wordpress commenting if Disqus is enabled - this prevents spam bots from
1510
- * commenting using POST requests to /wp-comments-post.php.
1511
- *
1512
- * @param int $comment_post_ID
1513
- * @return int
1514
- */
1515
- function dsq_pre_comment_on_post($comment_post_ID) {
1516
- if (dsq_can_replace()) {
1517
- wp_die( dsq_i('Sorry, the built-in commenting system is disabled because Disqus is active.') );
1518
- }
1519
- return $comment_post_ID;
1520
  }
1521
- add_action('pre_comment_on_post', 'dsq_pre_comment_on_post');
1522
-
1523
- ?>
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  /**
3
+ * The plugin bootstrap file
4
  *
5
+ * This file is read by WordPress to generate the plugin information in the plugin
6
+ * admin area. This file also includes all of the dependencies used by the plugin,
7
+ * registers the activation and deactivation functions, and defines a function
8
+ * that starts the plugin.
 
 
9
  *
10
+ * @link https://disqus.com
11
+ * @since 3.0
12
+ * @package Disqus
 
 
 
 
13
  *
14
+ * @wordpress-plugin
15
+ * Plugin Name: Disqus for WordPress
16
+ * Plugin URI: https://disqus.com/
17
+ * Description: Disqus helps publishers increase engagement and build loyal audiences. Supports syncing comments to your database for easy backup.
18
+ * Version: 3.0.7
19
+ * Author: Disqus
20
+ * Author URI: https://disqus.com/
21
+ * License: GPL-2.0+
22
+ * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
23
+ * Text Domain: disqus
24
+ * Domain Path: /languages
25
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
 
27
+ // If this file is called directly, abort.
28
+ if ( ! defined( 'WPINC' ) ) {
29
+ die;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  }
31
 
32
  /**
33
+ * The code that runs during plugin activation.
34
+ * This action is documented in includes/class-disqus-activator.php
35
  */
36
+ function activate_disqus() {
37
+ require_once plugin_dir_path( __FILE__ ) . 'includes/class-disqus-activator.php';
38
+ Disqus_Activator::activate();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  }
40
 
41
  /**
42
+ * The code that runs during plugin deactivation.
43
+ * This action is documented in includes/class-disqus-deactivator.php
 
 
 
 
44
  */
45
+ function deactivate_disqus() {
46
+ require_once plugin_dir_path( __FILE__ ) . 'includes/class-disqus-deactivator.php';
47
+ Disqus_Deactivator::deactivate();
48
  }
49
 
50
+ register_activation_hook( __FILE__, 'activate_disqus' );
51
+ register_deactivation_hook( __FILE__, 'deactivate_disqus' );
 
 
 
 
 
 
 
 
 
 
 
 
52
 
53
  /**
54
+ * The core plugin class that is used to define internationalization,
55
+ * admin-specific hooks, and public-facing site hooks.
56
  */
57
+ require plugin_dir_path( __FILE__ ) . 'includes/class-disqus.php';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
 
59
  /**
60
+ * Begins execution of the plugin.
61
+ *
62
+ * Since everything within the plugin is registered via hooks,
63
+ * then kicking off the plugin from this point in the file does
64
+ * not affect the page life cycle.
65
+ *
66
+ * @since 3.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  */
68
+ function run_disqus() {
 
 
 
 
 
 
 
 
69
 
70
+ $plugin = new Disqus( '3.0.7' );
71
+ $plugin->run();
 
 
72
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  }
74
+ run_disqus();
 
 
export.php DELETED
@@ -1,195 +0,0 @@
1
- <?php
2
- /**
3
- * Adapted from WordPress 2.8
4
- */
5
- @set_time_limit(0);
6
- @ini_set('memory_limit', '256M');
7
- define('WXR_VERSION', '1.0');
8
-
9
- /**
10
- * {@internal Missing Short Description}}
11
- *
12
- * @since unknown
13
- *
14
- * @param unknown_type $categories
15
- */
16
- function dsq_export_wxr_missing_parents($categories) {
17
- if ( !is_array($categories) || empty($categories) )
18
- return array();
19
-
20
- foreach ( $categories as $category )
21
- $parents[$category->term_id] = $category->parent;
22
-
23
- $parents = array_unique(array_diff($parents, array_keys($parents)));
24
-
25
- if ( $zero = array_search('0', $parents) )
26
- unset($parents[$zero]);
27
-
28
- return $parents;
29
- }
30
-
31
- /**
32
- * Place string in CDATA tag.
33
- *
34
- * @since unknown
35
- *
36
- * @param string $str String to place in XML CDATA tag.
37
- */
38
- function dsq_export_wxr_cdata($str) {
39
- if ( seems_utf8($str) == false )
40
- $str = utf8_encode($str);
41
-
42
- // $str = ent2ncr(esc_html($str));
43
-
44
- $str = '<![CDATA[' . str_replace( ']]>', ']]]]><![CDATA[>', $str ) . ']]>';
45
-
46
- return $str;
47
- }
48
-
49
- /**
50
- * {@internal Missing Short Description}}
51
- *
52
- * @since unknown
53
- *
54
- * @return string Site URL.
55
- */
56
- function dsq_export_wxr_site_url() {
57
- global $current_site;
58
-
59
- // mu: the base url
60
- if ( isset($current_site->domain) ) {
61
- return 'http://'.$current_site->domain.$current_site->path;
62
- }
63
- // wp: the blog url
64
- else {
65
- return get_bloginfo_rss('url');
66
- }
67
- }
68
-
69
- /**
70
- * {@internal Missing Short Description}}
71
- *
72
- * @since unknown
73
- *
74
- * @param object $c Category Object
75
- */
76
- function dsq_export_wxr_cat_name($c) {
77
- if ( empty($c->name) )
78
- return;
79
-
80
- echo '<wp:cat_name>' . dsq_export_wxr_cdata($c->name) . '</wp:cat_name>';
81
- }
82
-
83
- /**
84
- * {@internal Missing Short Description}}
85
- *
86
- * @since unknown
87
- *
88
- * @param object $c Category Object
89
- */
90
- function dsq_export_wxr_category_description($c) {
91
- if ( empty($c->description) )
92
- return;
93
-
94
- echo '<wp:category_description>' . dsq_export_wxr_cdata($c->description) . '</wp:category_description>';
95
- }
96
-
97
- /**
98
- * {@internal Missing Short Description}}
99
- *
100
- * @since unknown
101
- *
102
- * @param object $t Tag Object
103
- */
104
- function dsq_export_wxr_tag_name($t) {
105
- if ( empty($t->name) )
106
- return;
107
-
108
- echo '<wp:tag_name>' . dsq_export_wxr_cdata($t->name) . '</wp:tag_name>';
109
- }
110
-
111
- /**
112
- * {@internal Missing Short Description}}
113
- *
114
- * @since unknown
115
- *
116
- * @param object $t Tag Object
117
- */
118
- function dsq_export_wxr_tag_description($t) {
119
- if ( empty($t->description) )
120
- return;
121
-
122
- echo '<wp:tag_description>' . dsq_export_wxr_cdata($t->description) . '</wp:tag_description>';
123
- }
124
-
125
- // receives an array of posts to export
126
- function dsq_export_wp($post, $comments=null) {
127
- global $wpdb;
128
-
129
- if (!$comments) {
130
- $comments = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_agent NOT LIKE 'Disqus/%%'", $post->ID) );
131
- }
132
-
133
- // start catching output
134
- ob_start();
135
-
136
- echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?' . ">\n";
137
- ?>
138
- <?php the_generator('export');?>
139
- <rss version="2.0"
140
- xmlns:excerpt="http://wordpress.org/export/<?php echo WXR_VERSION; ?>/excerpt/"
141
- xmlns:content="http://purl.org/rss/1.0/modules/content/"
142
- xmlns:dsq="https://disqus.com/"
143
- xmlns:wfw="http://wellformedweb.org/CommentAPI/"
144
- xmlns:dc="http://purl.org/dc/elements/1.1/"
145
- xmlns:wp="http://wordpress.org/export/<?php echo WXR_VERSION; ?>/"
146
- >
147
-
148
- <channel>
149
- <title><?php bloginfo_rss('name'); ?></title>
150
- <link><?php bloginfo_rss('url') ?></link>
151
- <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></pubDate>
152
- <generator>WordPress <?php bloginfo_rss('version'); ?>; Disqus <?php echo DISQUS_VERSION; ?></generator>
153
- <?php
154
- global $wp_query, $post;
155
- $wp_query->in_the_loop = true; // Fake being in the loop.
156
- setup_postdata($post); ?>
157
- <item>
158
- <title><?php echo apply_filters('the_title_rss', $post->post_title); ?></title>
159
- <link><?php the_permalink_rss() ?></link>
160
- <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
161
- <dc:creator><?php echo dsq_export_wxr_cdata(get_the_author()); ?></dc:creator>
162
- <guid isPermaLink="false"><?php the_guid(); ?></guid>
163
- <content:encoded><?php echo dsq_export_wxr_cdata( apply_filters('the_content_export', $post->post_content) ); ?></content:encoded>
164
- <dsq:thread_identifier><?php echo dsq_identifier_for_post($post); ?></dsq:thread_identifier>
165
- <wp:post_id><?php echo $post->ID; ?></wp:post_id>
166
- <wp:post_date_gmt><?php echo $post->post_date_gmt; ?></wp:post_date_gmt>
167
- <wp:comment_status><?php echo $post->comment_status; ?></wp:comment_status>
168
- <?php
169
- if ( $comments ) { foreach ( $comments as $c ) { ?>
170
- <wp:comment>
171
- <wp:comment_id><?php echo $c->comment_ID; ?></wp:comment_id>
172
- <wp:comment_author><?php echo dsq_export_wxr_cdata($c->comment_author); ?></wp:comment_author>
173
- <wp:comment_author_email><?php echo $c->comment_author_email; ?></wp:comment_author_email>
174
- <wp:comment_author_url><?php echo $c->comment_author_url; ?></wp:comment_author_url>
175
- <wp:comment_author_IP><?php echo $c->comment_author_IP; ?></wp:comment_author_IP>
176
- <wp:comment_date><?php echo $c->comment_date; ?></wp:comment_date>
177
- <wp:comment_date_gmt><?php echo $c->comment_date_gmt; ?></wp:comment_date_gmt>
178
- <wp:comment_content><?php echo dsq_export_wxr_cdata($c->comment_content) ?></wp:comment_content>
179
- <wp:comment_approved><?php echo $c->comment_approved; ?></wp:comment_approved>
180
- <wp:comment_type><?php echo $c->comment_type; ?></wp:comment_type>
181
- <wp:comment_parent><?php echo $c->comment_parent; ?></wp:comment_parent>
182
- </wp:comment>
183
- <?php } } // comments ?>
184
- </item>
185
- </channel>
186
- </rss>
187
- <?php
188
-
189
- // end of WXR output
190
- $output = ob_get_clean();
191
-
192
- return $output;
193
- }
194
-
195
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/class-disqus-activator.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Fired during plugin activation
4
+ *
5
+ * @link https://disqus.com
6
+ * @since 3.0
7
+ *
8
+ * @package Disqus
9
+ * @subpackage Disqus/includes
10
+ */
11
+
12
+ /**
13
+ * Fired during plugin activation.
14
+ *
15
+ * This class defines all code necessary to run during the plugin's activation.
16
+ *
17
+ * @since 3.0
18
+ * @package Disqus
19
+ * @subpackage Disqus/includes
20
+ * @author Ryan Valentin <ryan@disqus.com>
21
+ */
22
+ class Disqus_Activator {
23
+
24
+ /**
25
+ * Short Description. (use period)
26
+ *
27
+ * Long Description.
28
+ *
29
+ * @since 3.0
30
+ */
31
+ public static function activate() {
32
+ $existing_token = get_option( 'disqus_sync_token', null );
33
+
34
+ // Create a shared secret token that will be used for install/syncing with Disqus.
35
+ if ( empty( $existing_token ) ) {
36
+ update_option( 'disqus_sync_token', bin2hex( random_bytes( 16 ) ) );
37
+ }
38
+ }
39
+
40
+ }
includes/class-disqus-api-service.php ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The service for making requests to the Disqus API
4
+ *
5
+ * @link https://disqus.com
6
+ * @since 3.0
7
+ *
8
+ * @package Disqus
9
+ * @subpackage Disqus/includes
10
+ */
11
+
12
+ /**
13
+ * The service for making requests to the Disqus API
14
+ *
15
+ * @package Disqus
16
+ * @subpackage Disqus/includes
17
+ * @author Ryan Valentin <ryan@disqus.com>
18
+ */
19
+ class Disqus_Api_Service {
20
+
21
+ const DISQUS_API_BASE = 'https://disqus.com/api/3.0/';
22
+
23
+ /**
24
+ * The Disqus API secret key.
25
+ *
26
+ * @since 3.0
27
+ * @access private
28
+ * @var string $api_secret The Disqus API secret key.
29
+ */
30
+ private $api_secret;
31
+
32
+ /**
33
+ * The Disqus access token for authentication.
34
+ *
35
+ * @since 3.0
36
+ * @access private
37
+ * @var string $access_token The Disqus access token for authentication.
38
+ */
39
+ private $access_token;
40
+
41
+ /**
42
+ * Initialize the class and set its properties.
43
+ *
44
+ * @since 3.0
45
+ * @param string $api_secret The Disqus API secret key.
46
+ * @param string $access_token The admin access token associated with the $api_secret.
47
+ */
48
+ public function __construct( $api_secret, $access_token = '' ) {
49
+ $this->api_secret = $api_secret;
50
+ $this->access_token = $access_token;
51
+ }
52
+
53
+ /**
54
+ * Makes a GET request to the Disqus API.
55
+ *
56
+ * @since 3.0
57
+ * @param string $endpoint The Disqus API secret key.
58
+ * @param array $params The params to be appended to the query.
59
+ * @return array The response data array.
60
+ */
61
+ public function api_get( $endpoint, $params ) {
62
+ $api_url = Disqus_Api_Service::DISQUS_API_BASE . $endpoint . '.json?'
63
+ . 'api_secret=' . $this->api_secret
64
+ . '&access_token=' . $this->access_token;
65
+
66
+ foreach ( $params as $key => $values_array ) {
67
+ if ( ! is_array( $values_array ) ) {
68
+ $values_array = array( $values_array );
69
+ }
70
+
71
+ foreach ( $values_array as $value ) {
72
+ $api_url .= '&' . $key . '=' . urlencode( $value );
73
+ }
74
+ }
75
+
76
+ $dsq_response = wp_remote_get( $api_url, array(
77
+ 'headers' => array(
78
+ 'Referer' => '', // Unset referer so we can use secret key.
79
+ ),
80
+ ) );
81
+
82
+ $dsq_response_data = json_decode( $dsq_response['body'] );
83
+
84
+ return $dsq_response_data;
85
+ }
86
+
87
+ /**
88
+ * Makes a POST request to the Disqus API.
89
+ *
90
+ * @since 3.0
91
+ * @param string $endpoint The Disqus API secret key.
92
+ * @param array $params The params to be added to the body.
93
+ * @return array The response data array.
94
+ */
95
+ public function api_post( $endpoint, $params ) {
96
+ $api_url = Disqus_Api_Service::DISQUS_API_BASE . $endpoint . '.json?'
97
+ . 'api_secret=' . $this->api_secret
98
+ . '&access_token=' . $this->access_token;
99
+
100
+ $dsq_response = wp_remote_post( $api_url, array(
101
+ 'body' => $params,
102
+ 'headers' => array(
103
+ 'Referer' => '', // Unset referer so we can use secret key.
104
+ ),
105
+ 'method' => 'POST',
106
+ ) );
107
+
108
+ $dsq_response_data = json_decode( $dsq_response['body'] );
109
+
110
+ return $dsq_response_data;
111
+ }
112
+ }
includes/class-disqus-deactivator.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Fired during plugin deactivation
4
+ *
5
+ * @link https://disqus.com
6
+ * @since 3.0
7
+ *
8
+ * @package Disqus
9
+ * @subpackage Disqus/includes
10
+ */
11
+
12
+ /**
13
+ * Fired during plugin deactivation.
14
+ *
15
+ * This class defines all code necessary to run during the plugin's deactivation.
16
+ *
17
+ * @since 3.0
18
+ * @package Disqus
19
+ * @subpackage Disqus/includes
20
+ * @author Ryan Valentin <ryan@disqus.com>
21
+ */
22
+ class Disqus_Deactivator {
23
+
24
+ /**
25
+ * Short Description. (use period)
26
+ *
27
+ * Long Description.
28
+ *
29
+ * @since 3.0
30
+ */
31
+ public static function deactivate() {
32
+ // TODO: Call Disqus to disable syncing webhooks?
33
+ }
34
+
35
+ }
includes/class-disqus-loader.php ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Register all actions and filters for the plugin
4
+ *
5
+ * @link https://disqus.com
6
+ * @since 3.0
7
+ *
8
+ * @package Disqus
9
+ * @subpackage Disqus/includes
10
+ */
11
+
12
+ /**
13
+ * Register all actions and filters for the plugin.
14
+ *
15
+ * Maintain a list of all hooks that are registered throughout
16
+ * the plugin, and register them with the WordPress API. Call the
17
+ * run function to execute the list of actions and filters.
18
+ *
19
+ * @package Disqus
20
+ * @subpackage Disqus/includes
21
+ * @author Ryan Valentin <ryan@disqus.com>
22
+ */
23
+ class Disqus_Loader {
24
+
25
+ /**
26
+ * The array of actions registered with WordPress.
27
+ *
28
+ * @since 3.0
29
+ * @access protected
30
+ * @var array $actions The actions registered with WordPress to fire when the plugin loads.
31
+ */
32
+ protected $actions;
33
+
34
+ /**
35
+ * The array of filters registered with WordPress.
36
+ *
37
+ * @since 3.0
38
+ * @access protected
39
+ * @var array $filters The filters registered with WordPress to fire when the plugin loads.
40
+ */
41
+ protected $filters;
42
+
43
+ /**
44
+ * Initialize the collections used to maintain the actions and filters.
45
+ *
46
+ * @since 3.0
47
+ */
48
+ public function __construct() {
49
+
50
+ $this->actions = array();
51
+ $this->filters = array();
52
+
53
+ }
54
+
55
+ /**
56
+ * Add a new action to the collection to be registered with WordPress.
57
+ *
58
+ * @since 3.0
59
+ * @param string $hook The name of the WordPress action that is being registered.
60
+ * @param object $component A reference to the instance of the object on which the action is defined.
61
+ * @param string $callback The name of the function definition on the $component.
62
+ * @param int Optional $priority The priority at which the function should be fired.
63
+ * @param int Optional $accepted_args The number of arguments that should be passed to the $callback.
64
+ */
65
+ public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
66
+ $this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args );
67
+ }
68
+
69
+ /**
70
+ * Add a new filter to the collection to be registered with WordPress.
71
+ *
72
+ * @since 3.0
73
+ * @param string $hook The name of the WordPress filter that is being registered.
74
+ * @param object $component A reference to the instance of the object on which the filter is defined.
75
+ * @param string $callback The name of the function definition on the $component.
76
+ * @param int Optional $priority The priority at which the function should be fired.
77
+ * @param int Optional $accepted_args The number of arguments that should be passed to the $callback.
78
+ */
79
+ public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
80
+ $this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args );
81
+ }
82
+
83
+ /**
84
+ * A utility function that is used to register the actions and hooks into a single
85
+ * collection.
86
+ *
87
+ * @since 3.0
88
+ * @access private
89
+ * @param array $hooks The collection of hooks that is being registered (that is, actions or filters).
90
+ * @param string $hook The name of the WordPress filter that is being registered.
91
+ * @param object $component A reference to the instance of the object on which the filter is defined.
92
+ * @param string $callback The name of the function definition on the $component.
93
+ * @param int Optional $priority The priority at which the function should be fired.
94
+ * @param int Optional $accepted_args The number of arguments that should be passed to the $callback.
95
+ * @return type The collection of actions and filters registered with WordPress.
96
+ */
97
+ private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) {
98
+
99
+ $hooks[] = array(
100
+ 'hook' => $hook,
101
+ 'component' => $component,
102
+ 'callback' => $callback,
103
+ 'priority' => $priority,
104
+ 'accepted_args' => $accepted_args,
105
+ );
106
+
107
+ return $hooks;
108
+
109
+ }
110
+
111
+ /**
112
+ * Register the filters and actions with WordPress.
113
+ *
114
+ * @since 3.0
115
+ */
116
+ public function run() {
117
+
118
+ foreach ( $this->filters as $hook ) {
119
+ add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
120
+ }
121
+
122
+ foreach ( $this->actions as $hook ) {
123
+ add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
124
+ }
125
+
126
+ }
127
+
128
+ }
includes/class-disqus.php ADDED
@@ -0,0 +1,284 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The file that defines the core plugin class
4
+ *
5
+ * A class definition that includes attributes and functions used across both the
6
+ * public-facing side of the site and the admin area.
7
+ *
8
+ * @link https://disqus.com
9
+ * @since 3.0
10
+ *
11
+ * @package Disqus
12
+ * @subpackage Disqus/includes
13
+ */
14
+
15
+ /**
16
+ * The core plugin class.
17
+ *
18
+ * This is used to define internationalization, admin-specific hooks, and
19
+ * public-facing site hooks.
20
+ *
21
+ * Also maintains the unique identifier of this plugin as well as the current
22
+ * version of the plugin.
23
+ *
24
+ * @since 3.0
25
+ * @package Disqus
26
+ * @subpackage Disqus/includes
27
+ * @author Ryan Valentin <ryan@disqus.com>
28
+ */
29
+ class Disqus {
30
+
31
+ /**
32
+ * Instance of the Disqus API service.
33
+ *
34
+ * @since 3.0
35
+ * @access private
36
+ * @var Disqus_Api_Service $api_service Instance of the Disqus API service.
37
+ */
38
+ private $api_service;
39
+
40
+ /**
41
+ * The loader that's responsible for maintaining and registering all hooks that power
42
+ * the plugin.
43
+ *
44
+ * @since 3.0
45
+ * @access protected
46
+ * @var Disqus_Loader $loader Maintains and registers all hooks for the plugin.
47
+ */
48
+ protected $loader;
49
+
50
+ /**
51
+ * The unique identifier of this plugin.
52
+ *
53
+ * @since 3.0
54
+ * @access protected
55
+ * @var string $disqus The string used to uniquely identify this plugin.
56
+ */
57
+ protected $disqus;
58
+
59
+ /**
60
+ * The current version of the plugin.
61
+ *
62
+ * @since 3.0
63
+ * @access protected
64
+ * @var string $version The current version of the plugin.
65
+ */
66
+ protected $version;
67
+
68
+ /**
69
+ * The unique Disqus forum shortname.
70
+ *
71
+ * @since 3.0
72
+ * @access protected
73
+ * @var string $shortname The unique Disqus forum shortname.
74
+ */
75
+ protected $shortname;
76
+
77
+ /**
78
+ * Define the core functionality of the plugin.
79
+ *
80
+ * Set the plugin name and the plugin version that can be used throughout the plugin.
81
+ * Load the dependencies, and set the hooks for the admin area and the public-facing
82
+ * side of the site.
83
+ *
84
+ * @since 3.0
85
+ * @param string $version The version of this plugin.
86
+ */
87
+ public function __construct( $version ) {
88
+
89
+ $this->disqus = 'disqus';
90
+ $this->version = $version;
91
+ $this->shortname = strtolower( get_option( 'disqus_forum_url' ) );
92
+
93
+ $this->load_dependencies();
94
+ $this->define_admin_hooks();
95
+ $this->define_public_hooks();
96
+ $this->define_rest_api_hooks();
97
+
98
+ }
99
+
100
+ /**
101
+ * Load the required dependencies for this plugin.
102
+ *
103
+ * Include the following files that make up the plugin:
104
+ *
105
+ * - Disqus_Loader. Orchestrates the hooks of the plugin.
106
+ * - Disqus_Admin. Defines all hooks for the admin area.
107
+ * - Disqus_Public. Defines all hooks for the public side of the site.
108
+ *
109
+ * Create an instance of the loader which will be used to register the hooks
110
+ * with WordPress.
111
+ *
112
+ * @since 3.0
113
+ * @access private
114
+ */
115
+ private function load_dependencies() {
116
+
117
+ /**
118
+ * The class responsible for orchestrating the actions and filters of the
119
+ * core plugin.
120
+ */
121
+ require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-disqus-loader.php';
122
+
123
+ /**
124
+ * The class responsible making requests to the Disqus API.
125
+ */
126
+ require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-disqus-api-service.php';
127
+
128
+ /**
129
+ * The class responsible for defining all actions that occur in the admin area.
130
+ */
131
+ require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-disqus-admin.php';
132
+
133
+ /**
134
+ * The class responsible for defining all actions that occur in the public-facing
135
+ * side of the site.
136
+ */
137
+ require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-disqus-public.php';
138
+
139
+ /**
140
+ * The class responsible for defining all actions that occur on the REST API of
141
+ * the site.
142
+ */
143
+ require_once plugin_dir_path( dirname( __FILE__ ) ) . 'rest-api/class-disqus-rest-api.php';
144
+
145
+ $secret_key = get_option( 'disqus_secret_key' );
146
+ $access_token = get_option( 'disqus_admin_access_token' );
147
+
148
+ $this->api_service = new Disqus_Api_Service( $secret_key, $access_token );
149
+ $this->loader = new Disqus_Loader();
150
+ }
151
+
152
+ /**
153
+ * Register all of the hooks related to the admin area functionality
154
+ * of the plugin.
155
+ *
156
+ * @since 3.0
157
+ * @access private
158
+ */
159
+ private function define_admin_hooks() {
160
+ $plugin_admin = new Disqus_Admin( $this->get_disqus_name(), $this->get_version(), $this->get_shortname() );
161
+
162
+ $this->loader->add_filter( 'plugin_action_links', $plugin_admin, 'dsq_plugin_action_links', 10, 2 );
163
+ $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
164
+ $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
165
+ $this->loader->add_action( 'admin_menu', $plugin_admin, 'dsq_contruct_admin_menu' );
166
+ $this->loader->add_action( 'admin_bar_menu', $plugin_admin, 'dsq_construct_admin_bar', 999 );
167
+ }
168
+
169
+ /**
170
+ * Register all of the hooks related to the public-facing functionality
171
+ * of the plugin.
172
+ *
173
+ * @since 3.0
174
+ * @access private
175
+ */
176
+ private function define_public_hooks() {
177
+ $plugin_public = new Disqus_Public( $this->get_disqus_name(), $this->get_version(), $this->get_shortname() );
178
+
179
+ $this->loader->add_filter( 'comments_number', $plugin_public, 'dsq_comments_link_template' );
180
+ $this->loader->add_filter( 'comments_template', $plugin_public, 'dsq_comments_template' );
181
+ $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_comment_count' );
182
+ $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_comment_embed' );
183
+ $this->loader->add_action( 'show_user_profile', $plugin_public, 'dsq_close_window_template' );
184
+ }
185
+
186
+ /**
187
+ * Register all of the hooks related to the REST API functionality
188
+ * of the plugin.
189
+ *
190
+ * @since 3.0
191
+ * @access private
192
+ */
193
+ private function define_rest_api_hooks() {
194
+ $plugin_rest_api = new Disqus_Rest_Api( $this->get_api_service(), $this->get_version() );
195
+
196
+ $this->loader->add_action( 'rest_api_init', $plugin_rest_api, 'register_endpoints' );
197
+
198
+ $this->loader->add_filter( 'rest_pre_serve_request', $plugin_rest_api, 'filter_rest_pre_serve_request', 10, 4 );
199
+ }
200
+
201
+ /**
202
+ * Run the loader to execute all of the hooks with WordPress.
203
+ *
204
+ * @since 3.0
205
+ */
206
+ public function run() {
207
+ $this->loader->run();
208
+ }
209
+
210
+ /**
211
+ * Returns instance of the Disqus API service.
212
+ *
213
+ * @since 3.0
214
+ * @return string Instance of the Disqus API service.
215
+ */
216
+ public function get_api_service() {
217
+ return $this->api_service;
218
+ }
219
+
220
+ /**
221
+ * The name of the plugin used to uniquely identify it within the context of
222
+ * WordPress and to define internationalization functionality.
223
+ *
224
+ * @since 3.0
225
+ * @return string The name of the plugin.
226
+ */
227
+ public function get_disqus_name() {
228
+ return $this->disqus;
229
+ }
230
+
231
+ /**
232
+ * The reference to the class that orchestrates the hooks with the plugin.
233
+ *
234
+ * @since 3.0
235
+ * @return Disqus_Loader Orchestrates the hooks of the plugin.
236
+ */
237
+ public function get_loader() {
238
+ return $this->loader;
239
+ }
240
+
241
+ /**
242
+ * Retrieve the version number of the plugin.
243
+ *
244
+ * @since 3.0
245
+ * @return string The version number of the plugin.
246
+ */
247
+ public function get_version() {
248
+ return $this->version;
249
+ }
250
+
251
+ /**
252
+ * Retrieve the installed Disqus shortname.
253
+ *
254
+ * @since 3.0
255
+ * @return string The installed shortname.
256
+ */
257
+ public function get_shortname() {
258
+ return $this->shortname;
259
+ }
260
+
261
+ /**
262
+ * Formats the unique disqus_identifier for a given post.
263
+ *
264
+ * @since 3.0
265
+ * @param string $post The WordPress post object.
266
+ * @return string The unique disqus_identifier.
267
+ */
268
+ public function dsq_identifier_for_post( $post ) {
269
+ return $post->ID . ' ' . $post->guid;
270
+ }
271
+
272
+ /**
273
+ * Formats the title for a given post.
274
+ *
275
+ * @since 3.0
276
+ * @param string $post The WordPress post object.
277
+ * @return string The formatted disqus_title.
278
+ */
279
+ public function dsq_title_for_post( $post ) {
280
+ $title = get_the_title( $post );
281
+ $title = strip_tags( $title, '<b><u><i><h1><h2><h3><code><blockquote><br><hr>' );
282
+ return $title;
283
+ }
284
+ }
includes/index.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ // Silence is golden.
index.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ // Silence is golden.
lib/api/disqus/disqus.php DELETED
@@ -1,461 +0,0 @@
1
- <?php
2
- /**
3
- * Implementation of the Disqus v1.1 API.
4
- *
5
- * http://groups.google.com/group/disqus-dev/web/api-1-1
6
- *
7
- * @author Disqus <team@disqus.com>
8
- * @copyright 2007-2016 Big Head Labs
9
- * @link https://disqus.com/
10
- * @package Disqus
11
- * @version 1.1
12
- */
13
-
14
- require_once(dirname(__FILE__) . '/url.php');
15
-
16
- /** @#+
17
- * Constants
18
- */
19
- /**
20
- * Base URL for Disqus.
21
- */
22
-
23
- define('DISQUS_TYPE_SPAM', 'spam');
24
- define('DISQUS_TYPE_DELETED', 'killed');
25
- define('DISQUS_TYPE_KILLED', DISQUS_TYPE_DELETED);
26
- define('DISQUS_TYPE_NEW', 'new');
27
-
28
- define('DISQUS_STATE_APPROVED', 'approved');
29
- define('DISQUS_STATE_UNAPPROVED', 'unapproved');
30
- define('DISQUS_STATE_SPAM', 'spam');
31
- define('DISQUS_STATE_DELETED', 'killed');
32
- define('DISQUS_STATE_KILLED', DISQUS_STATE_DELETED);
33
-
34
- define('DISQUS_ACTION_SPAM', 'spam');
35
- define('DISQUS_ACTION_APPROVE', 'approve');
36
- define('DISQUS_ACTION_DELETE', 'delete');
37
- define('DISQUS_ACTION_KILL', 'kill');
38
-
39
- if (!extension_loaded('json')) {
40
- require_once(dirname(__FILE__) . '/json.php');
41
- function dsq_json_decode($data) {
42
- $json = new JSON;
43
- return $json->unserialize($data);
44
- }
45
- } else {
46
- function dsq_json_decode($data) {
47
- return json_decode($data);
48
- }
49
- }
50
-
51
- /**
52
- * Helper methods for all of the Disqus 1.1 API methods.
53
- *
54
- * @package Disqus
55
- * @author DISQUS.com <team@disqus.com>
56
- * @copyright 2007-2016 Big Head Labs
57
- * @version 1.1
58
- */
59
- class DisqusAPI {
60
- var $user_api_key;
61
- var $forum_api_key;
62
- var $api_url = 'https://disqus.com/api/';
63
- var $api_version = '1.1';
64
-
65
- /**
66
- * Creates a new interface to the Disqus API.
67
- *
68
- * @param $user_api_key
69
- * (optional) The User API key to use.
70
- * @param $forum_api_key
71
- * (optional) The Forum API key to use.
72
- * @param $api_url
73
- * (optional) The prefix URL to use when calling the Disqus API.
74
- */
75
- function __construct($user_api_key, $forum_api_key, $api_url='https://disqus.com/api/') {
76
- $this->user_api_key = $user_api_key;
77
- $this->forum_api_key = $forum_api_key;
78
- $this->api_url = $api_url;
79
- $this->last_error = null;
80
- }
81
-
82
- /**
83
- * Makes a call to a Disqus API method.
84
- *
85
- * @return
86
- * The Disqus object.
87
- * @param $method
88
- * The Disqus API method to call.
89
- * @param $args
90
- * An associative array of arguments to be passed.
91
- * @param $post
92
- * TRUE or FALSE, depending on whether we're making a POST call.
93
- */
94
- function call($method, $args=array(), $post=false) {
95
- $url = $this->api_url . $method . '/';
96
-
97
- if (!isset($args['user_api_key'])) {
98
- $args['user_api_key'] = $this->user_api_key;
99
- }
100
- if (!isset($args['forum_api_key'])) {
101
- $args['forum_api_key'] = $this->forum_api_key;
102
- }
103
- if (!isset($args['api_version'])) {
104
- $args['api_version'] = $this->api_version;
105
- }
106
-
107
- foreach ($args as $key=>$value) {
108
- // XXX: Disqus is lacking some exception handling and we sometimes
109
- // end up with 500s when passing invalid values
110
- if (empty($value)) unset($args[$key]);
111
- }
112
-
113
- if (!$post) {
114
- $url .= '?' . dsq_get_query_string($args);
115
- $args = null;
116
- }
117
-
118
- if (!($response = dsq_urlopen($url, $args)) || !$response['code']) {
119
- $this->last_error = 'Unable to connect to the Disqus API servers';
120
- return false;
121
- }
122
-
123
- if ($response['code'] != 200) {
124
- if ($response['code'] == 500) {
125
- // Try to grab the exception ID for better reporting
126
- if (!empty($response['headers']['X-Sentry-ID'])) {
127
- $this->last_error = 'DISQUS returned a bad response (HTTP '.$response['code'].', ReferenceID: '.$response['headers']['X-Sentry-ID'].')';
128
- return false;
129
- }
130
- } elseif ($response['code'] == 400) {
131
- $data = dsq_json_decode($response['data']);
132
- if ($data && $data->message) {
133
- $this->last_error = $data->message;
134
- } else {
135
- $this->last_error = "DISQUS returned a bad response (HTTP ".$response['code'].")";
136
- }
137
- return false;
138
- }
139
- $this->last_error = "DISQUS returned a bad response (HTTP ".$response['code'].")";
140
- return false;
141
- }
142
-
143
- $data = dsq_json_decode($response['data']);
144
-
145
- if (!$data) {
146
- $this->last_error = 'No valid JSON content returned from Disqus';
147
- return false;
148
- }
149
-
150
- if (!$data->succeeded) {
151
- if (!$data->message) {
152
- $this->last_error = '(No error message was received)';
153
- } else {
154
- $this->last_error = $data->message;
155
- }
156
- return false;
157
- }
158
-
159
- $this->last_error = null;
160
-
161
- return $data->message;
162
- }
163
-
164
- /**
165
- * Retrieve the last error message recorded.
166
- *
167
- * @return
168
- * The last recorded error from the API
169
- */
170
- function get_last_error() {
171
- if (empty($this->last_error)) return;
172
- if (!is_string($this->last_error)) {
173
- return var_export($this->last_error);
174
- }
175
- return $this->last_error;
176
- }
177
-
178
- /**
179
- * Validate API key and get username.
180
- *
181
- * @return
182
- * Username matching the API key
183
- */
184
- function get_user_name() {
185
- return $this->call('get_user_name', array(), true);
186
- }
187
-
188
- /**
189
- * Returns an array of hashes representing all forums the user owns.
190
- *
191
- * @return
192
- * An array of hashes representing all forums the user owns.
193
- */
194
- function get_forum_list() {
195
- return $this->call('get_forum_list');
196
- }
197
-
198
- /**
199
- * Get a forum API key for a specific forum.
200
- *
201
- * @param $forum_id
202
- * the unique id of the forum
203
- * @return
204
- * A string which is the Forum Key for the given forum.
205
- */
206
- function get_forum_api_key($forum_id) {
207
- $params = array(
208
- 'forum_id' => $forum_id,
209
- );
210
-
211
- return $this->call('get_forum_api_key', $params);
212
- }
213
-
214
- /**
215
- * Get a list of comments on a website.
216
- *
217
- * Both filter and exclude are multivalue arguments with comma as a divider.
218
- * That makes is possible to use combined requests. For example, if you want
219
- * to get all deleted spam messages, your filter argument should contain
220
- * 'spam,killed' string.
221
- *
222
- * @param $forum_id
223
- * The forum ID.
224
- * @param $params
225
- * - limit: Number of entries that should be included in the response. Default is 25.
226
- * - start: Starting point for the query. Default is 0.
227
- * - filter: Type of entries that should be returned.
228
- * - exclude: Type of entries that should be excluded from the response.
229
- * @return
230
- * Returns posts from a forum specified by id.
231
- */
232
- function get_forum_posts($forum_id, $params=array()) {
233
- $params['forum_id'] = $forum_id;
234
-
235
- return $this->call('get_forum_posts', $params);
236
- }
237
-
238
- /**
239
- * Count a number of comments in articles.
240
- *
241
- * @param $thread_ids
242
- * an array of thread IDs belonging to the given forum.
243
- * @return
244
- * A hash having thread_ids as keys and 2-element arrays as values.
245
- */
246
- function get_num_posts($thread_ids) {
247
- $params = array(
248
- 'thread_ids' => is_array($thread_ids) ? implode(',', $thread_ids) : $thread_ids,
249
- );
250
-
251
- return $this->call('get_num_posts', $params);
252
- }
253
-
254
- /**
255
- * Returns a list of categories that were created for a website (forum) provided.
256
- *
257
- * @param $forum_id
258
- * the unique of the forum
259
- * @return
260
- * A hash containing category_id, title, forum_id, and is_default.
261
- */
262
- function get_categories_list($forum_id) {
263
- $params = array(
264
- 'forum_id' => $forum_id,
265
- );
266
-
267
- return $this->call('get_categories_list', $params);
268
- }
269
-
270
- /**
271
- * Get a list of threads on a website.
272
- *
273
- * @param $forum_id
274
- * the unique id of the forum.
275
- * @param $params
276
- * - limit: Number of entries that should be included in the response. Default is 25.
277
- * - start: Starting point for the query. Default is 0.
278
- * - category_id: Filter entries by category
279
- * @return
280
- * An array of hashes representing all threads belonging to the given forum.
281
- */
282
- function get_thread_list($forum_id, $params=array()) {
283
- $params['forum_id'] = $forum_id;
284
-
285
- return $this->call('get_thread_list', $params);
286
- }
287
-
288
- /**
289
- * Get a list of threads with new comments.
290
- *
291
- * @param $forum_id
292
- * The Forum ID.
293
- * @param $since
294
- * Start date for new posts. Format: 2009-03-30T15:41, Timezone: UTC.
295
- * @return
296
- * An array of hashes representing all threads with new comments since offset.
297
- */
298
- function get_updated_threads($forum_id, $since) {
299
- $params = array(
300
- 'forum_id' => $forum_id,
301
- 'since' => is_string($since) ? $string : strftime('%Y-%m-%dT%H:%M', $since),
302
- );
303
-
304
- return $this->call('get_updated_threads', $params);
305
- }
306
-
307
- /**
308
- * Get a list of comments in a thread.
309
- *
310
- * Both filter and exclude are multivalue arguments with comma as a divider.
311
- * That makes is possible to use combined requests. For example, if you want
312
- * to get all deleted spam messages, your filter argument should contain
313
- * 'spam,killed' string. Note that values are joined by AND statement so
314
- * 'spam,new' will return all messages that are new and marked as spam. It
315
- * will not return messages that are new and not spam or that are spam but
316
- * not new (i.e. has already been moderated).
317
- *
318
- * @param $thread_id
319
- * The ID of a thread belonging to the given forum
320
- * @param $params
321
- * - limit: Number of entries that should be included in the response. Default is 25.
322
- * - start: Starting point for the query. Default is 0.
323
- * - filter: Type of entries that should be returned (new, spam or killed).
324
- * - exclude: Type of entries that should be excluded from the response (new, spam or killed).
325
- * @return
326
- * An array of hashes representing representing all posts belonging to the
327
- * given forum.
328
- */
329
- function get_thread_posts($thread_id, $params=array()) {
330
- $params['thread_id'] = $thread_id;
331
-
332
- return $this->call('get_thread_posts', $params);
333
- }
334
-
335
- /**
336
- * Get or create thread by identifier.
337
- *
338
- * This method tries to find a thread by its identifier and title. If there is
339
- * no such thread, the method creates it. In either case, the output value is
340
- * a thread object.
341
- *
342
- * @param $identifier
343
- * Unique value (per forum) for a thread that is used to keep be able to get
344
- * data even if permalink is changed.
345
- * @param $title
346
- * The title of the thread to possibly be created.
347
- * @param $params
348
- * - category_id: Filter entries by category
349
- * - create_on_fail: if thread does not exist, the method will create it
350
- * @return
351
- * Returns a hash with two keys:
352
- * - thread: a hash representing the thread corresponding to the identifier.
353
- * - created: indicates whether the thread was created as a result of this
354
- * method call. If created, it will have the specified title.
355
- */
356
- function thread_by_identifier($identifier, $title, $params=array()) {
357
- $params['identifier'] = $identifier;
358
- $params['title'] = $title;
359
-
360
- return $this->call('thread_by_identifier', $params, true);
361
- }
362
-
363
- /**
364
- * Get thread by URL.
365
- *
366
- * Finds a thread by its URL. Output value is a thread object.
367
- *
368
- * @param $url
369
- * the URL to check for an associated thread
370
- * @param $partner_api_key
371
- * (optional) The Partner API key.
372
- * @return
373
- * A thread object, otherwise NULL.
374
- */
375
- function get_thread_by_url($url, $partner_api_key=null) {
376
- $params = array(
377
- 'url' => $url,
378
- 'partner_api_key' => $partner_api_key,
379
- );
380
-
381
- return $this->call('get_thread_by_url', $params);
382
- }
383
-
384
- /**
385
- * Updates thread.
386
- *
387
- * Updates thread, specified by id and forum API key, with values described in
388
- * the optional arguments.
389
- *
390
- * @param $thread_id
391
- * the ID of a thread belonging to the given forum
392
- * @param $params
393
- * - title: the title of the thread
394
- * - slug: the per-forum-unique string used for identifying this thread in
395
- * disqus.com URL’s relating to this thread. Composed of
396
- * underscore-separated alphanumeric strings.
397
- * - url: the URL this thread is on, if known.
398
- * - allow_comments: whether this thread is open to new comments
399
- * @return
400
- * Returns an empty success message.
401
- */
402
- function update_thread($thread_id, $params=array()) {
403
- $params['thread_id'] = $thread_id;
404
-
405
- return $this->call('update_thread', $params, true);
406
- }
407
-
408
- /**
409
- * Creates a new post.
410
- *
411
- * Creates a comment to the thread specified by id.
412
- *
413
- * @param $thread_id
414
- * the thread to post to
415
- * @param $message
416
- * the content of the post
417
- * @param $author_name
418
- * the post creator’s name
419
- * @param $author_email
420
- * the post creator’s email address
421
- * @param $params
422
- * - partner_api_key
423
- * - created_at: Format: 2009-03-30T15:41, Timezone: UTC
424
- * - ip_address: the author’s IP address
425
- * - author_url: the author's homepage
426
- * - parent_post: the id of the parent post
427
- * - state: Comment's state, must be one of the following: approved,
428
- * unapproved, spam, killed
429
- * @return
430
- * Returns modified version.
431
- */
432
- function create_post($thread_id, $message, $author_name, $author_email, $params=array()) {
433
- $params['thread_id'] = $thread_id;
434
- $params['message'] = $message;
435
- $params['author_name'] = $author_name;
436
- $params['author_email'] = $author_email;
437
-
438
- return $this->call('create_post', $params, true);
439
- }
440
-
441
- /**
442
- * Delete a comment or mark it as spam (or not spam).
443
- *
444
- * @param $post_id
445
- * The Post ID.
446
- * @param $action
447
- * Name of action to be performed. Value can be 'spam', 'approve' or 'kill'.
448
- * @return
449
- * Returns modified version.
450
- */
451
- function moderate_post($post_id, $action) {
452
- $params = array(
453
- 'post_id' => $post_id,
454
- 'action' => $action,
455
- );
456
-
457
- return $this->call('moderate_post', $params, true);
458
- }
459
- }
460
-
461
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/api/disqus/json.php DELETED
@@ -1,378 +0,0 @@
1
- <?php
2
- /*
3
- ***************************************************************************
4
- * Copyright (C) 2007 by Cesar D. Rodas *
5
- * crodas@phpy.org *
6
- * *
7
- * Permission is hereby granted, free of charge, to any person obtaining *
8
- * a copy of this software and associated documentation files (the *
9
- * "Software"), to deal in the Software without restriction, including *
10
- * without limitation the rights to use, copy, modify, merge, publish, *
11
- * distribute, sublicense, and/or sell copies of the Software, and to *
12
- * permit persons to whom the Software is furnished to do so, subject to *
13
- * the following conditions: *
14
- * *
15
- * The above copyright notice and this permission notice shall be *
16
- * included in all copies or substantial portions of the Software. *
17
- * *
18
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, *
19
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
20
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*
21
- * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR *
22
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
23
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR *
24
- * OTHER DEALINGS IN THE SOFTWARE. *
25
- ***************************************************************************
26
- */
27
-
28
- /**
29
- * Serialize and Unserialize PHP Objects and array
30
- * into JSON notation.
31
- *
32
- * @category Javascript
33
- * @package JSON
34
- * @author Cesar D. Rodas <crodas@phpy.org>
35
- * @copyright 2007 Cesar D. Rodas
36
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
37
- * @version 1.0
38
- * @link http://cesars.users.phpclasses.org/json
39
- */
40
-
41
- define('IN_NOWHERE',0);
42
- define('IN_STRING',1);
43
- define('IN_OBJECT',2);
44
- define('IN_ATOMIC',3);
45
- define('IN_ASSIGN',4);
46
- define('IN_ENDSTMT',5);
47
- define('IN_ARRAY',6);
48
-
49
- /**
50
- * JSON
51
- *
52
- * This class serilize an PHP OBJECT or an ARRAY into JSON
53
- * notation. Also convert a JSON text into a PHP OBJECT or
54
- * array.
55
- *
56
- * @category Javascript
57
- * @package JSON
58
- * @author Cesar D. Rodas <crodas@phpy.org>
59
- * @copyright 2007 Cesar D. Rodas
60
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
61
- * @version 1.0
62
- * @link http://cesars.users.phpclasses.org/json
63
- */
64
- class JSON
65
- {
66
- /**
67
- * Was parsed with an error?
68
- *
69
- * var bool
70
- * @access private
71
- */
72
- var $error;
73
-
74
- function __construct() {
75
- $this->error = false;
76
- }
77
-
78
- /**
79
- * Serialize
80
- *
81
- * Serialize a PHP OBJECT or an ARRAY into
82
- * JSON notation.
83
- *
84
- * param mixed $obj Object or array to serialize
85
- * return string JSON.
86
- */
87
- function serialize($obj) {
88
- if ( is_object($obj) ) {
89
- $e = get_object_vars($obj);
90
- /* bug reported by Ben Rowe */
91
- /* Adding default empty array if the */
92
- /* object doesn't have any property */
93
- $properties = array();
94
- foreach ($e as $k => $v) {
95
- $properties[] = $this->_serialize( $k,$v );
96
- }
97
- return "{".implode(",",$properties)."}";
98
- } else if ( is_array($obj) ) {
99
- return $this->_serialize('',$obj);
100
- }
101
- }
102
-
103
- /**
104
- * UnSerialize
105
- *
106
- * Transform an JSON text into a PHP object
107
- * and return it.
108
- * @access public
109
- * @param string $text JSON text
110
- * @return mixed PHP Object, array or false.
111
- */
112
- function unserialize( $text ) {
113
- $this->error = false;
114
-
115
- return !$this->error ? $this->_unserialize($text) : false;
116
- }
117
-
118
- /**
119
- * UnSerialize
120
- *
121
- * Transform an JSON text into a PHP object
122
- * and return it.
123
- * @access private
124
- * @param string $text JSON text
125
- * @return mixed PHP Object, array or false.
126
- */
127
- function _unserialize($text) {
128
- $ret = new stdClass;
129
-
130
- while ( $f = $this->getNextToken($text,$i,$type) ) {
131
- switch ( $type ) {
132
- case IN_ARRAY:
133
- $tmp = $this->_unserializeArray($text);
134
- $ret = $tmp[0];
135
- break;
136
- case IN_OBJECT:
137
- $g=0;
138
- do {
139
- $varName = $this->getNextToken($f,$g,$xType);
140
- if ( $xType != IN_STRING ) {
141
- return false; /* error parsing */
142
- }
143
- $this->getNextToken($f,$g,$xType);
144
- if ( $xType != IN_ASSIGN) return false;
145
- $value = $this->getNextToken($f,$g,$xType);
146
-
147
- if ( $xType == IN_OBJECT) {
148
- $ret->$varName = $this->unserialize( "{".$value."}" );
149
- $g--;
150
- } else if ($xType == IN_ARRAY) {
151
- $ret->$varName = $this->_unserializeArray( $value);
152
- $g--;
153
- } else
154
- $ret->$varName = $value;
155
-
156
- $this->getNextToken($f,$g,$xType);
157
- } while ( $xType == IN_ENDSTMT);
158
- break;
159
- default:
160
- $this->error = true;
161
- break 2;
162
- }
163
- }
164
- return $ret;
165
- }
166
-
167
- /**
168
- * JSON Array Parser
169
- *
170
- * This method transform an json-array into a PHP
171
- * array
172
- * @access private
173
- * @param string $text String to parse
174
- * @return Array PHP Array
175
- */
176
- function _unserializeArray($text) {
177
- $r = array();
178
- do {
179
- $f = $this->getNextToken($text,$i,$type);
180
- switch ( $type ) {
181
- case IN_STRING:
182
- case IN_ATOMIC:
183
- $r[] = $f;
184
- break;
185
- case IN_OBJECT:
186
- $r[] = $this->unserialize("{".$f."}");
187
- $i--;
188
- break;
189
- case IN_ARRAY:
190
- $r[] = $this->_unserializeArray($f);
191
- $i--;
192
- break;
193
-
194
- }
195
- $this->getNextToken($text,$i,$type);
196
- } while ( $type == IN_ENDSTMT);
197
-
198
- return $r;
199
- }
200
-
201
- /**
202
- * Tokenizer
203
- *
204
- * Return to the Parser the next valid token and the type
205
- * of the token. If the tokenizer fails it returns false.
206
- *
207
- * @access private
208
- * @param string $e Text to extract token
209
- * @param integer $i Start position to search next token
210
- * @param integer $state Variable to get the token type
211
- * @return string|bool Token in string or false on error.
212
- */
213
- function getNextToken($e, &$i, &$state) {
214
- $state = IN_NOWHERE;
215
- $end = -1;
216
- $start = -1;
217
- while ( $i < strlen($e) && $end == -1 ) {
218
- switch( $e[$i] ) {
219
- /* objects */
220
- case "{":
221
- case "[":
222
- $_tag = $e[$i];
223
- $_endtag = $_tag == "{" ? "}" : "]";
224
- if ( $state == IN_NOWHERE ) {
225
- $start = $i+1;
226
- switch ($state) {
227
- case IN_NOWHERE:
228
- $aux = 1; /* for loop objects */
229
- $state = $_tag == "{" ? IN_OBJECT : IN_ARRAY;
230
- break;
231
- default:
232
- break 2; /* exit from switch and while */
233
- }
234
- while ( ++$i && $i < strlen($e) && $aux != 0 ) {
235
- switch( $e[$i] ) {
236
- case $_tag:
237
- $aux++;
238
- break;
239
- case $_endtag:
240
- $aux--;
241
- break;
242
- }
243
- }
244
- $end = $i-1;
245
- }
246
- break;
247
-
248
- case '"':
249
- case "'":
250
- $state = IN_STRING;
251
- $buf = "";
252
- while ( ++$i && $i < strlen($e) && $e[$i] != '"' ) {
253
- if ( $e[$i] == "\\")
254
- $i++;
255
- $buf .= $e[$i];
256
- }
257
- $i++;
258
- return $buf;
259
- break;
260
- case ":":
261
- $state = IN_ASSIGN;
262
- $end = 1;
263
- break;
264
- case "n":
265
- if ( substr($e,$i,4) == "null" ) {
266
- $i=$i+4;
267
- $state = IN_ATOMIC;
268
- return NULL;
269
- }
270
- else break 2; /* exit from switch and while */
271
- case "t":
272
- if ( substr($e,$i,4) == "true") {
273
- $state = IN_ATOMIC;
274
- $i=$i+4;
275
- return true;
276
- }
277
- else break 2; /* exit from switch and while */
278
- break;
279
- case "f":
280
- if ( substr($e,$i,5) == "false") {
281
- $state = IN_ATOMIC;
282
- $i=$i+5;
283
- return false;
284
- }
285
- else break 2; /* exit from switch and while */
286
- break;
287
- case ",":
288
- $state = IN_ENDSTMT;
289
- $end = 1;
290
- break;
291
- case " ":
292
- case "\t":
293
- case "\r":
294
- case "\n":
295
- break;
296
- case "+":
297
- case "-":
298
- case 0:
299
- case 1:
300
- case 2:
301
- case 3:
302
- case 4:
303
- case 5:
304
- case 6:
305
- case 7:
306
- case 8:
307
- case 9:
308
- case '.':
309
- $state = IN_ATOMIC;
310
- $start = (int)$i;
311
- if ( $e[$i] == "-" || $e[$i] == "+")
312
- $i++;
313
- for ( ; $i < strlen($e) && (is_numeric($e[$i]) || $e[$i] == "." || strtolower($e[$i]) == "e") ;$i++){
314
- $n = $i+1 < strlen($e) ? $e[$i+1] : "";
315
- $a = strtolower($e[$i]);
316
- if ( $a == "e" && ($n == "+" || $n == "-"))
317
- $i++;
318
- else if ( $a == "e")
319
- $this->error=true;
320
- }
321
-
322
- $end = $i;
323
- break 2; /* break while too */
324
- default:
325
- $this->error = true;
326
-
327
- }
328
- $i++;
329
- }
330
-
331
- return $start == -1 || $end == -1 ? false : substr($e, $start, $end - $start);
332
- }
333
-
334
- /**
335
- * Internal Serializer
336
- *
337
- * @param string $key Variable name
338
- * @param mixed $value Value of the variable
339
- * @access private
340
- * @return string Serialized variable
341
- */
342
- function _serialize ( $key = '', &$value ) {
343
- $r = '';
344
- if ( $key != '')$r .= "\"${key}\" : ";
345
- if ( is_numeric($value) ) {
346
- $r .= ''.$value.'';
347
- } else if ( is_string($value) ) {
348
- $r .= '"'.$this->toString($value).'"';
349
- } else if ( is_object($value) ) {
350
- $r .= $this->serialize($value);
351
- } else if ( is_null($value) ) {
352
- $r .= "null";
353
- } else if ( is_bool($value) ) {
354
- $r .= $value ? "true":"false";
355
- } else if ( is_array($value) ) {
356
- foreach($value as $k => $v)
357
- $f[] = $this->_serialize('',$v);
358
- $r .= "[".implode(",",$f)."]";
359
- unset($f);
360
- }
361
- return $r;
362
- }
363
-
364
- /**
365
- * Convert String variables
366
- *
367
- * @param string $e Variable with an string value
368
- * @access private
369
- * @return string Serialized variable
370
- */
371
- function toString($e) {
372
- $rep = array("\\","\r","\n","\t","'",'"');
373
- $val = array("\\\\",'\r','\n','\t','\'','\"');
374
- $e = str_replace($rep, $val, $e);
375
- return $e;
376
- }
377
- }
378
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/api/disqus/url.php DELETED
@@ -1,296 +0,0 @@
1
- <?php
2
- define('USER_AGENT', 'Disqus-WPPlugin/2.0-dev');
3
- define('SOCKET_TIMEOUT', 10);
4
-
5
- function dsq_get_query_string($postdata) {
6
- $postdata_str = '';
7
-
8
- if($postdata) {
9
- foreach($postdata as $key=>$value) {
10
- $postdata_str .= urlencode($key) . '=' . urlencode($value) . '&';
11
- }
12
- }
13
-
14
- return $postdata_str;
15
- }
16
-
17
-
18
- function dsq_get_post_content($boundary, $postdata, $file_name, $file_field) {
19
- if(empty($file_name) || empty($file_field)) {
20
- return dsq_get_query_string($postdata);
21
- }
22
-
23
- $content = array();
24
- $content[] = '--' . $boundary;
25
- foreach($postdata as $key=>$value) {
26
- $content[] = 'Content-Disposition: form-data; name="' . $key . '"' . "\r\n\r\n" . $value;
27
- $content[] = '--' . $boundary;
28
- }
29
- $content[] = 'Content-Disposition: form-data; name="' . $file_field . '"; filename="' . $file_name . '"';
30
- // HACK: We only need to handle text/plain files right now.
31
- $content[] = "Content-Type: text/plain\r\n";
32
- $content[] = file_get_contents($file_name);
33
- $content[] = '--' . $boundary . '--';
34
- $content = implode("\r\n", $content);
35
- return $content;
36
- }
37
-
38
-
39
- function dsq_get_http_headers_for_request($boundary, $content, $file_name, $file_field) {
40
- $headers = array();
41
- $headers[] = 'User-Agent: ' . USER_AGENT;
42
- $headers[] = 'Connection: close';
43
- if($content) {
44
- $headers[] = 'Content-Length: ' . strlen($content);
45
- if($file_name && $file_field) {
46
- $headers[] = 'Content-Type: multipart/form-data; boundary=' . $boundary;
47
- } else {
48
- $headers[] = 'Content-Type: application/x-www-form-urlencoded';
49
- }
50
- }
51
- return implode("\r\n", $headers);
52
- }
53
-
54
-
55
- function _dsq_curl_urlopen($url, $postdata, &$response, $file_name, $file_field) {
56
- $c = curl_init($url);
57
- $postdata_str = dsq_get_query_string($postdata);
58
-
59
- $c_options = array(
60
- CURLOPT_USERAGENT => USER_AGENT,
61
- CURLOPT_RETURNTRANSFER => true,
62
- CURLOPT_POST => ($postdata_str ? 1 : 0),
63
- CURLOPT_HEADER => true,
64
- CURLOPT_HTTPHEADER => array('Expect:'),
65
- CURLOPT_TIMEOUT => SOCKET_TIMEOUT
66
- );
67
- if($postdata) {
68
- $c_options[CURLOPT_POSTFIELDS] = $postdata_str;
69
- }
70
- if($file_name && $file_field) {
71
- $postdata[$file_field] = '@' . $file_name;
72
- $c_options[CURLOPT_POSTFIELDS] = $postdata;
73
- $c_options[CURLOPT_RETURNTRANSFER] = 1;
74
- }
75
- curl_setopt_array($c, $c_options);
76
-
77
- $data = curl_exec($c);
78
- list($headers, $response['data']) = explode("\r\n\r\n", $data, 2);
79
-
80
- $response['headers'] = _dsq_get_response_headers($headers, $response);
81
- $response['code'] = curl_getinfo($c, CURLINFO_HTTP_CODE);
82
- }
83
-
84
- function _dsq_get_response_headers($headers, &$response) {
85
- $headers = explode("\r\n", $headers);
86
- list($unused, $response['code'], $unused) = explode(' ', $headers[0], 3);
87
- $headers = array_slice($headers, 1);
88
-
89
- // Convert headers into associative array.
90
- foreach($headers as $unused=>$header) {
91
- $header = explode(':', $header);
92
- $header[0] = trim($header[0]);
93
- $header[1] = trim($header[1]);
94
- $headers[strtolower($header[0])] = $header[1];
95
- }
96
-
97
- return $headers;
98
- }
99
-
100
- function _dsq_fsockopen_urlopen($url, $postdata, &$response, $file_name, $file_field) {
101
- $buf = '';
102
- $req = '';
103
- $length = 0;
104
- $boundary = '----------' . md5(time());
105
- $postdata_str = dsq_get_post_content($boundary, $postdata, $file_name, $file_field);
106
- $url_pieces = parse_url($url);
107
-
108
- // Set default port for supported schemes if none is provided.
109
- if(!isset($url_pieces['port'])) {
110
- switch($url_pieces['scheme']) {
111
- case 'http':
112
- $url_pieces['port'] = 80;
113
- break;
114
- case 'https':
115
- $url_pieces['port'] = 443;
116
- $url_pieces['host'] = 'ssl://' . $url_pieces['host'];
117
- break;
118
- }
119
- }
120
-
121
- // Set default path if trailing slash is not provided.
122
- if(!isset($url_pieces['path'])) { $url_pieces['path'] = '/'; }
123
-
124
- // Determine if we need to include the port in the Host header or not.
125
- if(($url_pieces['port'] == 80 && $url_pieces['scheme'] == 'http') ||
126
- ($url_pieces['port'] == 443 && $url_pieces['scheme'] == 'https')) {
127
- $host = $url_pieces['host'];
128
- } else {
129
- $host = $url_pieces['host'] . ':' . $url_pieces['port'];
130
- }
131
-
132
- $fp = @fsockopen($url_pieces['host'], $url_pieces['port'], $errno, $errstr, SOCKET_TIMEOUT);
133
- if(!$fp) { return false; }
134
-
135
- $path = $url_pieces['path'];
136
- if ($url_pieces['query']) $path .= '?'.$url_pieces['query'];
137
-
138
- $req .= ($postdata_str ? 'POST' : 'GET') . ' ' . $path . " HTTP/1.1\r\n";
139
- $req .= 'Host: ' . $host . "\r\n";
140
- $req .= dsq_get_http_headers_for_request($boundary, $postdata_str, $file_name, $file_field);
141
- if($postdata_str) {
142
- $req .= "\r\n\r\n" . $postdata_str;
143
- }
144
- $req .= "\r\n\r\n";
145
-
146
- fwrite($fp, $req);
147
- while(!feof($fp)) {
148
- $buf .= fgets($fp, 4096);
149
- }
150
-
151
- // Parse headers from the response buffers.
152
- list($headers, $response['data']) = explode("\r\n\r\n", $buf, 2);
153
-
154
- // Get status code from headers.
155
- $headers = _dsq_get_response_headers($headers, $response);
156
-
157
- // If transfer-coding is set to chunked, we need to join the message body
158
- // together.
159
- if(isset($headers['transfer-encoding']) && 'chunked' == strtolower($headers['transfer-encoding'])) {
160
- $chunk_data = $response['data'];
161
- $joined_data = '';
162
- while(true) {
163
- // Strip length from body.
164
- list($chunk_length, $chunk_data) = explode("\r\n", $chunk_data, 2);
165
- $chunk_length = hexdec($chunk_length);
166
- if(!$chunk_length || !strlen($chunk_data)) { break; }
167
-
168
- $joined_data .= substr($chunk_data, 0, $chunk_length);
169
- $chunk_data = substr($chunk_data, $chunk_length + 1);
170
- $length += $chunk_length;
171
- }
172
- $response['data'] = $joined_data;
173
- } else {
174
- $length = $headers['content-length'];
175
- }
176
- $response['headers'] = $headers;
177
- }
178
-
179
-
180
- function _dsq_fopen_urlopen($url, $postdata, &$response, $file_name, $file_field) {
181
- $params = array();
182
- if($file_name && $file_field) {
183
- $boundary = '----------' . md5(time());
184
- $content = dsq_get_post_content($boundary, $postdata, $file_name, $file_field);
185
- $header = dsq_get_http_headers_for_request($boundary, $content, $file_name, $file_field);
186
-
187
- $params = array('http' => array(
188
- 'method' => 'POST',
189
- 'header' => $header,
190
- 'content' => $content,
191
- 'timeout' => SOCKET_TIMEOUT
192
- ));
193
- } else {
194
- if($postdata) {
195
- $params = array('http' => array(
196
- 'method' => 'POST',
197
- 'header' => 'Content-Type: application/x-www-form-urlencoded',
198
- 'content' => dsq_get_query_string($postdata),
199
- 'timeout' => SOCKET_TIMEOUT
200
- ));
201
- }
202
- }
203
-
204
-
205
- ini_set('user_agent', USER_AGENT);
206
- $ctx = stream_context_create($params);
207
- $fp = fopen($url, 'rb', false, $ctx);
208
- if(!$fp) {
209
- return false;
210
- }
211
-
212
- // Get status code from headers.
213
- list($unused, $response['code'], $unused) = explode(' ', $http_response_header[0], 3);
214
- $headers = array_slice($http_response_header, 1);
215
-
216
- // Convert headers into associative array.
217
- foreach($headers as $unused=>$header) {
218
- $header = explode(':', $header);
219
- $header[0] = trim($header[0]);
220
- $header[1] = trim($header[1]);
221
- $headers[strtolower($header[0])] = strtolower($header[1]);
222
- }
223
-
224
- $response['data'] = stream_get_contents($fp);
225
- $response['headers'] = $headers;
226
- }
227
-
228
-
229
- /**
230
- * Wrapper to provide a single interface for making an HTTP request.
231
- *
232
- * Attempts to use cURL, fopen(), or fsockopen(), whichever is available
233
- * first.
234
- *
235
- * @param string $url URL to make request to.
236
- * @param array $postdata (optional) If postdata is provided, the request
237
- * method is POST with the key/value pairs as
238
- * the data.
239
- * @param array $file (optional) Should provide associative array
240
- * with two keys: name and field. Name should
241
- * be the name of the file and field is the name
242
- * of the field to POST.
243
- */
244
- function dsq_urlopen($url, $postdata=false, $file=false) {
245
- $response = array(
246
- 'data' => '',
247
- 'code' => 0
248
- );
249
-
250
- if($file) {
251
- extract($file, EXTR_PREFIX_ALL, 'file');
252
- }
253
- if(empty($file_name) || empty($file_field)) {
254
- $file_name = false;
255
- $file_field = false;
256
- }
257
-
258
- //
259
-
260
- // Try curl, fsockopen, fopen + stream (PHP5 only), exec wget
261
- // Don't use cURL on IIS servers because it doesn't explicitly specify a CA bundle by default
262
- if(function_exists('curl_init') && strpos($_SERVER['SERVER_SOFTWARE'], 'IIS') == false) {
263
- if (!function_exists('curl_setopt_array')) {
264
- function curl_setopt_array(&$ch, $curl_options)
265
- {
266
- foreach ($curl_options as $option => $value) {
267
- if (!curl_setopt($ch, $option, $value)) {
268
- return false;
269
- }
270
- }
271
- return true;
272
- }
273
- }
274
- _dsq_curl_urlopen($url, $postdata, $response, $file_name, $file_field);
275
- } else if(ini_get('allow_url_fopen') && function_exists('stream_get_contents')) {
276
- _dsq_fopen_urlopen($url, $postdata, $response, $file_name, $file_field);
277
- } else {
278
- // TODO: Find the failure condition for fsockopen() (sockets?)
279
- _dsq_fsockopen_urlopen($url, $postdata, $response, $file_name, $file_field);
280
- }
281
-
282
- // returns array with keys data and code (from headers)
283
-
284
- return $response;
285
- }
286
-
287
- function dsq_url_method() {
288
- if(function_exists('curl_init')) {
289
- return 'curl';
290
- } else if(ini_get('allow_url_fopen') && function_exists('stream_get_contents')) {
291
- return 'fopen';
292
- } else {
293
- return 'fsockopen';
294
- }
295
- }
296
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/wp-api.php DELETED
@@ -1,107 +0,0 @@
1
- <?php
2
- /**
3
- * Implementation of the Disqus API designed for WordPress.
4
- *
5
- * @author Disqus <team@disqus.com>
6
- * @copyright 2007-2016 Big Head Labs
7
- * @link https://disqus.com/
8
- * @package Disqus
9
- * @subpackage DisqusWordPressAPI
10
- * @version 2.0
11
- */
12
-
13
- require_once(ABSPATH.WPINC.'/http.php');
14
- require_once(dirname(__FILE__) . '/api/disqus/disqus.php');
15
- /** @#+
16
- * Constants
17
- */
18
- /**
19
- * Base URL for Disqus.
20
- */
21
- define('DISQUS_ALLOWED_HTML', '<b><u><i><h1><h2><h3><code><blockquote><br><hr>');
22
-
23
- /**
24
- * Helper methods for all of the Disqus v2 API methods.
25
- *
26
- * @package Disqus
27
- * @subpackage DisqusWordPressAPI
28
- * @author DISQUS.com <team@disqus.com>
29
- * @copyright 2007-2008 Big Head Labs
30
- * @version 1.0
31
- */
32
- class DisqusWordPressAPI {
33
- var $short_name;
34
- var $forum_api_key;
35
-
36
- function __construct($short_name=null, $forum_api_key=null, $user_api_key=null) {
37
- $this->short_name = $short_name;
38
- $this->forum_api_key = $forum_api_key;
39
- $this->user_api_key = $user_api_key;
40
- $this->api = new DisqusAPI($user_api_key, $forum_api_key, DISQUS_API_URL);
41
- }
42
-
43
- function get_last_error() {
44
- return $this->api->get_last_error();
45
- }
46
-
47
- function get_user_api_key($username, $password) {
48
- $response = $this->api->call('get_user_api_key', array(
49
- 'username' => $username,
50
- 'password' => $password,
51
- ), true);
52
- return $response;
53
- }
54
-
55
- function get_forum_list($user_api_key) {
56
- $this->api->user_api_key = $user_api_key;
57
- return $this->api->get_forum_list();
58
- }
59
-
60
- function get_forum_api_key($user_api_key, $id) {
61
- $this->api->user_api_key = $user_api_key;
62
- return $this->api->get_forum_api_key($id);
63
- }
64
-
65
- function get_forum_posts($start_id=0) {
66
- $response = $this->api->get_forum_posts(null, array(
67
- 'filter' => 'approved',
68
- 'start_id' => $start_id,
69
- 'limit' => 100,
70
- 'order' => 'asc',
71
- 'full_info' => 1
72
- ));
73
- return $response;
74
- }
75
-
76
- function import_wordpress_comments(&$wxr, $timestamp, $eof=true) {
77
- $http = new WP_Http();
78
- $response = $http->request(
79
- DISQUS_IMPORTER_URL . 'api/import-wordpress-comments/',
80
- array(
81
- 'method' => 'POST',
82
- 'timeout' => 60,
83
- 'body' => array(
84
- 'forum_url' => $this->short_name,
85
- 'forum_api_key' => $this->forum_api_key,
86
- 'response_type' => 'php',
87
- 'wxr' => $wxr,
88
- 'timestamp' => $timestamp,
89
- 'eof' => (int)$eof
90
- ),
91
- )
92
- );
93
- if ($response['response']['code'] !== 200) {
94
- // hack
95
- $this->api->last_error = $response->errors;
96
- return -1;
97
- }
98
- $data = unserialize($response['body']);
99
- if (!$data || $data['stat'] == 'fail') {
100
- return -1;
101
- }
102
-
103
- return $data;
104
- }
105
- }
106
-
107
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/wp-cli.php DELETED
@@ -1,88 +0,0 @@
1
- <?php
2
- /**
3
- * Helper script for setting up the WP command line environment
4
- */
5
- error_reporting(E_ALL | E_STRICT);
6
-
7
- if (php_sapi_name() != 'cli' && !empty($_SERVER['REMOTE_ADDR'])) {
8
- // Don't execute for web requests
9
- die("This script must be run from CLI.");
10
- }
11
-
12
- if (!isset($argv)) {
13
- $argv = array();
14
- }
15
-
16
- function print_line() {
17
- $args = func_get_args();
18
- $result = call_user_func_array('sprintf', $args);
19
- print("{$result}\n");
20
- }
21
-
22
- define('DOING_AJAX', true);
23
- define('WP_USE_THEMES', false);
24
- if (isset($_ENV['WORDPRESS_PATH'])) {
25
- define('ABSPATH', $_ENV['WORDPRESS_PATH']);
26
- } else {
27
- if (substr($_SERVER['SCRIPT_FILENAME'], 0, 1) != '/') {
28
- $script_path = $_SERVER['PWD'] . $_SERVER['SCRIPT_FILENAME'];
29
- } else {
30
- $script_path = $_SERVER['SCRIPT_FILENAME'];
31
- }
32
- $tree = '';
33
- $paths = array();
34
- $chunks = explode('/', dirname($script_path));
35
- foreach ($chunks as $chunk) {
36
- if (!$chunk) continue;
37
- $tree = $tree.'/'.$chunk;
38
- array_push($paths, $tree);
39
- }
40
- $paths = array_reverse($paths);
41
-
42
- foreach ($paths as $path) {
43
- if (is_file($path.'/wp-config.php')) {
44
- define('ABSPATH', $path . '/');
45
- break;
46
- }
47
- }
48
- }
49
-
50
- if (!defined('ABSPATH')) {
51
- print_line("Unable to determine wordpress path. Please set it using WORDPRESS_PATH.");
52
- die();
53
- }
54
-
55
- $_SERVER = array(
56
- "HTTP_HOST" => "disqus.com",
57
- "SCRIPT_NAME" => "",
58
- "PHP_SELF" => __FILE__,
59
- "SERVER_NAME" => "localhost",
60
- "REQUEST_URI" => "/",
61
- "REQUEST_METHOD" => "GET"
62
- );
63
- require_once(ABSPATH . 'wp-config.php');
64
-
65
- // swap out the object cache due to memory constraints
66
-
67
- global $wp_object_cache;
68
-
69
- class DummyWP_Object_Cache extends WP_Object_Cache {
70
- function set($id, $data, $group = 'default', $expire = '') {
71
- return;
72
- }
73
- function delete($id, $group = 'default', $force = false) {
74
- return;
75
- }
76
- function add($id, $data, $group = 'default', $expire = '') {
77
- return;
78
- }
79
- }
80
-
81
- // HACK: kill all output buffers (some plugins, like Hyper Cache, use theses)
82
- while (@ob_end_flush());
83
-
84
- // We cant simply replace the object cache incase set/add do something that
85
- // matters to the webserver
86
- // $wp_object_cache = new DummyWP_Object_Cache();
87
-
88
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
locales/default.mo DELETED
Binary file
locales/default.po DELETED
@@ -1,490 +0,0 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: disqus-wordpress\n"
4
- "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2014-11-10 11:06-0800\n"
6
- "PO-Revision-Date: 2014-11-10 11:07-0800\n"
7
- "Last-Translator: Ryan <ryan@disqus.com>\n"
8
- "Language-Team: Disqus <translation@disqus.com>\n"
9
- "Language: en_US\n"
10
- "MIME-Version: 1.0\n"
11
- "Content-Type: text/plain; charset=UTF-8\n"
12
- "Content-Transfer-Encoding: 8bit\n"
13
- "X-Poedit-KeywordsList: _;gettext;gettext_noop;dsq_i;__;_e\n"
14
- "X-Poedit-Basepath: ../\n"
15
- "X-Generator: Poedit 1.6.10\n"
16
- "Plural-Forms: nplurals=2; plural=(n != 1);\n"
17
- "X-Poedit-SearchPath-0: ..\n"
18
-
19
- #: ../disqus/comments.php:15 ../disqus/comments.php:37
20
- msgid "Older Comments"
21
- msgstr ""
22
-
23
- #: ../disqus/comments.php:18 ../disqus/comments.php:40
24
- msgid "Newer Comments"
25
- msgstr ""
26
-
27
- #: ../disqus/disqus.php:178
28
- msgid "Disqus needs to be configured"
29
- msgstr ""
30
-
31
- #: ../disqus/disqus.php:179
32
- msgid "Configure Disqus by clicking Comments to the left."
33
- msgstr ""
34
-
35
- #: ../disqus/disqus.php:527
36
- msgid ""
37
- "Unable to export comments. Make sure you are accessing this page from the "
38
- "Wordpress dashboard."
39
- msgstr ""
40
-
41
- #: ../disqus/disqus.php:558 ../disqus/disqus.php:584
42
- msgid "Your comments have been sent to Disqus and queued for import!"
43
- msgstr ""
44
-
45
- #: ../disqus/disqus.php:560 ../disqus/disqus.php:586
46
- msgid "See the status of your import at Disqus"
47
- msgstr ""
48
-
49
- #: ../disqus/disqus.php:564
50
- msgid "Processed comments on post"
51
- msgstr ""
52
-
53
- #: ../disqus/disqus.php:574
54
- msgid "Sorry, something unexpected happened with the export. Please try again."
55
- msgstr ""
56
-
57
- #: ../disqus/disqus.php:576
58
- msgid ""
59
- "If your API key has changed, you may need to reinstall Disqus (deactivate "
60
- "the plugin and then reactivate it)."
61
- msgstr ""
62
-
63
- #: ../disqus/disqus.php:577
64
- #, php-format
65
- msgid "If you are still having issues, refer to the %s WordPress help page"
66
- msgstr ""
67
-
68
- #: ../disqus/disqus.php:608
69
- msgid ""
70
- "Unable to import comments. Make sure you are accessing this page from the "
71
- "Wordpress dashboard."
72
- msgstr ""
73
-
74
- #: ../disqus/disqus.php:631
75
- msgid "There was an error downloading your comments from Disqus."
76
- msgstr ""
77
-
78
- #: ../disqus/disqus.php:636
79
- msgid ""
80
- "Your comments have been downloaded from Disqus and saved in your local "
81
- "database."
82
- msgstr ""
83
-
84
- #: ../disqus/disqus.php:639
85
- #, php-format
86
- msgid "Import in progress (last post id: %s)"
87
- msgstr ""
88
-
89
- #: ../disqus/disqus.php:989
90
- msgid "Pingback:"
91
- msgstr ""
92
-
93
- #: ../disqus/disqus.php:989
94
- msgid "Edit"
95
- msgstr ""
96
-
97
- #: ../disqus/disqus.php:1026
98
- msgid "Configure"
99
- msgstr ""
100
-
101
- #: ../disqus/disqus.php:1028 ../disqus/manage.php:394
102
- msgid "Settings"
103
- msgstr ""
104
-
105
- #: ../disqus/disqus.php:1492
106
- msgid ""
107
- "Sorry, the built-in commenting system is disabled because Disqus is active."
108
- msgstr ""
109
-
110
- #: ../disqus/manage.php:62
111
- msgid "Disqus Reset"
112
- msgstr ""
113
-
114
- #: ../disqus/manage.php:65
115
- msgid "Disqus has been reset successfully."
116
- msgstr ""
117
-
118
- #: ../disqus/manage.php:67
119
- msgid "Local settings for the plugin were removed."
120
- msgstr ""
121
-
122
- #: ../disqus/manage.php:68
123
- msgid "Database changes by Disqus were reverted."
124
- msgstr ""
125
-
126
- #: ../disqus/manage.php:71
127
- msgid "If you wish to reinstall, you can do that now."
128
- msgstr ""
129
-
130
- #: ../disqus/manage.php:72
131
- msgid "Reinstall"
132
- msgstr ""
133
-
134
- #: ../disqus/manage.php:189
135
- msgid "Your settings have been changed."
136
- msgstr ""
137
-
138
- #: ../disqus/manage.php:220
139
- msgid "There was an error completing the installation of Disqus."
140
- msgstr ""
141
-
142
- #: ../disqus/manage.php:222
143
- msgid "If you are still having issues, refer to the help documentation."
144
- msgstr ""
145
-
146
- #: ../disqus/manage.php:225
147
- msgid "WordPress Help Page"
148
- msgstr ""
149
-
150
- #: ../disqus/manage.php:258
151
- msgid ""
152
- "There aren't any sites associated with this account. Maybe you want to "
153
- "create a site?"
154
- msgstr ""
155
-
156
- #: ../disqus/manage.php:261
157
- msgid "Create a site"
158
- msgstr ""
159
-
160
- #: ../disqus/manage.php:274
161
- msgid "Moderate"
162
- msgstr ""
163
-
164
- #: ../disqus/manage.php:274
165
- msgid "Install"
166
- msgstr ""
167
-
168
- #: ../disqus/manage.php:277
169
- msgid "Plugin Settings"
170
- msgstr ""
171
-
172
- #: ../disqus/manage.php:287 ../disqus/manage.php:301 ../disqus/manage.php:335
173
- msgid "Install Disqus Comments"
174
- msgstr ""
175
-
176
- #: ../disqus/manage.php:289
177
- msgid "Disqus has been installed on your blog."
178
- msgstr ""
179
-
180
- #: ../disqus/manage.php:291
181
- msgid "If you have existing comments, you may wish to export them now."
182
- msgstr ""
183
-
184
- #: ../disqus/manage.php:292
185
- msgid ""
186
- "Otherwise, you're all set, and the Disqus network is now powering comments "
187
- "on your site."
188
- msgstr ""
189
-
190
- #: ../disqus/manage.php:294
191
- msgid "Continue to the moderation dashboard"
192
- msgstr ""
193
-
194
- #: ../disqus/manage.php:307
195
- msgid "Select a website"
196
- msgstr ""
197
-
198
- #: ../disqus/manage.php:319
199
- msgid "Or register a new one on the Disqus website."
200
- msgstr ""
201
-
202
- #: ../disqus/manage.php:341
203
- msgid "Username or email"
204
- msgstr ""
205
-
206
- #: ../disqus/manage.php:344
207
- msgid "don't have a Disqus Profile yet?"
208
- msgstr ""
209
-
210
- #: ../disqus/manage.php:348
211
- msgid "Password"
212
- msgstr ""
213
-
214
- #: ../disqus/manage.php:351
215
- msgid "forgot your password?"
216
- msgstr ""
217
-
218
- #: ../disqus/manage.php:371
219
- msgid "Go to Disqus Moderation"
220
- msgstr ""
221
-
222
- #: ../disqus/manage.php:395
223
- #, php-format
224
- msgid "Version: %s"
225
- msgstr ""
226
-
227
- #: ../disqus/manage.php:401
228
- msgid "Disqus comments are currently "
229
- msgstr ""
230
-
231
- #: ../disqus/manage.php:404
232
- msgid "Disable"
233
- msgstr ""
234
-
235
- #: ../disqus/manage.php:404
236
- msgid "Enable"
237
- msgstr ""
238
-
239
- #: ../disqus/manage.php:413
240
- msgid "General"
241
- msgstr ""
242
-
243
- #: ../disqus/manage.php:416
244
- msgid "Forum Shortname"
245
- msgstr ""
246
-
247
- #: ../disqus/manage.php:421
248
- msgid ""
249
- "This is the unique identifier for your website in Disqus, automatically set "
250
- "during installation."
251
- msgstr ""
252
-
253
- #: ../disqus/manage.php:426
254
- msgid "Appearance"
255
- msgstr ""
256
-
257
- #: ../disqus/manage.php:429
258
- msgid "Use Disqus Comments on"
259
- msgstr ""
260
-
261
- #: ../disqus/manage.php:432
262
- msgid "All blog posts."
263
- msgstr ""
264
-
265
- #: ../disqus/manage.php:433
266
- msgid "Blog posts with closed comments only."
267
- msgstr ""
268
-
269
- #: ../disqus/manage.php:437
270
- msgid ""
271
- "You have selected to only enable Disqus on posts with closed comments. If "
272
- "you aren't seeing Disqus on new posts, change this option to \"All blog posts"
273
- "\"."
274
- msgstr ""
275
-
276
- #: ../disqus/manage.php:438
277
- msgid ""
278
- "Shows comments on either all blog posts, or ones with closed comments. "
279
- "Select the \"Blog posts with closed comments only\" option if you plan on "
280
- "disabling Disqus, but want to keep it on posts which already have comments."
281
- msgstr ""
282
-
283
- #: ../disqus/manage.php:444
284
- msgid "Sync"
285
- msgstr ""
286
-
287
- #: ../disqus/manage.php:447
288
- msgid "Comment Importing"
289
- msgstr ""
290
-
291
- #: ../disqus/manage.php:450
292
- msgid "Disable automated comment importing"
293
- msgstr ""
294
-
295
- #: ../disqus/manage.php:451
296
- msgid ""
297
- "If you have problems with WP-Cron taking too long, or have a large number of "
298
- "comments, you may wish to disable automated sync. Comments will only be "
299
- "imported to your local Wordpress database if you do so manually."
300
- msgstr ""
301
-
302
- #: ../disqus/manage.php:455
303
- msgid "Server-Side Rendering"
304
- msgstr ""
305
-
306
- #: ../disqus/manage.php:458
307
- msgid "Disable server-side rendering of comments"
308
- msgstr ""
309
-
310
- #: ../disqus/manage.php:459
311
- msgid "Hides comments from nearly all search engines."
312
- msgstr ""
313
-
314
- #: ../disqus/manage.php:464
315
- msgid "Patches"
316
- msgstr ""
317
-
318
- #: ../disqus/manage.php:468
319
- msgid "External Javascript Files"
320
- msgstr ""
321
-
322
- #: ../disqus/manage.php:471
323
- msgid "Render Javascript in external files"
324
- msgstr ""
325
-
326
- #: ../disqus/manage.php:472
327
- msgid ""
328
- "This will render the Disqus scripts as external files in the footer as "
329
- "recommended by Wordpress. Disable this if are not seeing Disqus appear on "
330
- "pages that normally have comments. This will fix the issue if your theme "
331
- "does not support the 'wp_enqueue_script' function, are caching your site on "
332
- "a CDN."
333
- msgstr ""
334
-
335
- #: ../disqus/manage.php:477
336
- msgid "Template Conflicts"
337
- msgstr ""
338
-
339
- #: ../disqus/manage.php:480
340
- msgid "Output JavaScript in footer"
341
- msgstr ""
342
-
343
- #: ../disqus/manage.php:481
344
- msgid ""
345
- "Enable this if you have problems with comment counts or other "
346
- "irregularities. For example: missing counts, counts always at 0, Disqus code "
347
- "showing on the page, broken image carousels, or longer-than-usual home page "
348
- "load times"
349
- msgstr ""
350
-
351
- #: ../disqus/manage.php:487
352
- msgid "Advanced"
353
- msgstr ""
354
-
355
- #: ../disqus/manage.php:488
356
- msgid "Single Sign-On"
357
- msgstr ""
358
-
359
- #: ../disqus/manage.php:490
360
- msgid "Allows users to log in to Disqus via WordPress."
361
- msgstr ""
362
-
363
- #: ../disqus/manage.php:492
364
- msgid "More info on SSO"
365
- msgstr ""
366
-
367
- #: ../disqus/manage.php:499
368
- msgid "Disqus Partner Key"
369
- msgstr ""
370
-
371
- #: ../disqus/manage.php:506
372
- msgid "API Application Public Key"
373
- msgstr ""
374
-
375
- #: ../disqus/manage.php:510 ../disqus/manage.php:518
376
- msgid "Disqus API Applications"
377
- msgstr ""
378
-
379
- #: ../disqus/manage.php:514
380
- msgid "API Application Secret Key"
381
- msgstr ""
382
-
383
- #: ../disqus/manage.php:522
384
- msgid "Custom Log-in Button"
385
- msgstr ""
386
-
387
- #: ../disqus/manage.php:536
388
- msgid "Change"
389
- msgstr ""
390
-
391
- #: ../disqus/manage.php:536
392
- msgid "Choose"
393
- msgstr ""
394
-
395
- #: ../disqus/manage.php:536
396
- msgid "button"
397
- msgstr ""
398
-
399
- #: ../disqus/manage.php:542
400
- msgid "Adds a button to the Disqus log-in interface."
401
- msgstr ""
402
-
403
- #: ../disqus/manage.php:543
404
- msgid "Example screenshot"
405
- msgstr ""
406
-
407
- #: ../disqus/manage.php:545
408
- msgid "See our documentation for a template to create your own button."
409
- msgstr ""
410
-
411
- #: ../disqus/manage.php:546
412
- msgid "SSO button documentation"
413
- msgstr ""
414
-
415
- #: ../disqus/manage.php:564
416
- msgid "Export comments to Disqus"
417
- msgstr ""
418
-
419
- #: ../disqus/manage.php:570
420
- msgid "Export Comments"
421
- msgstr ""
422
-
423
- #: ../disqus/manage.php:571
424
- msgid "This will export your existing WordPress comments to Disqus"
425
- msgstr ""
426
-
427
- #: ../disqus/manage.php:579
428
- msgid "Sync Disqus with WordPress"
429
- msgstr ""
430
-
431
- #: ../disqus/manage.php:586
432
- msgid "Sync Comments"
433
- msgstr ""
434
-
435
- #: ../disqus/manage.php:587
436
- msgid ""
437
- "This will download your Disqus comments and store them locally in WordPress"
438
- msgstr ""
439
-
440
- #: ../disqus/manage.php:591
441
- msgid "Remove all imported Disqus comments before syncing."
442
- msgstr ""
443
-
444
- #: ../disqus/manage.php:605
445
- msgid "Reset Disqus"
446
- msgstr ""
447
-
448
- #: ../disqus/manage.php:610
449
- msgid "Are you sure you want to reset the Disqus plugin?"
450
- msgstr ""
451
-
452
- #: ../disqus/manage.php:611
453
- msgid ""
454
- "This removes all Disqus-specific settings. Comments will remain unaffected."
455
- msgstr ""
456
-
457
- #: ../disqus/manage.php:613
458
- msgid ""
459
- "If you have problems with resetting taking too long you may wish to first "
460
- "manually drop the 'disqus_dupecheck' index from your 'commentmeta' table."
461
- msgstr ""
462
-
463
- #: ../disqus/manage.php:620
464
- msgid "Debug Information"
465
- msgstr ""
466
-
467
- #: ../disqus/manage.php:622
468
- msgid ""
469
- "Having problems with the plugin? Check out our troubleshooting documentation."
470
- msgstr ""
471
-
472
- #: ../disqus/manage.php:623
473
- msgid "WordPress troubleshooting ocumentation"
474
- msgstr ""
475
-
476
- #: ../disqus/manage.php:624
477
- msgid "You can also email us and include the debug info below."
478
- msgstr ""
479
-
480
- #: ../disqus/manage.php:625
481
- msgid "Contact support"
482
- msgstr ""
483
-
484
- #: ../disqus/upgrade.php:12
485
- msgid "Upgrade Disqus Comments"
486
- msgstr ""
487
-
488
- #: ../disqus/upgrade.php:15
489
- msgid "You need to upgrade your database to continue."
490
- msgstr ""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
manage.php DELETED
@@ -1,668 +0,0 @@
1
- <?php
2
- // HACK: For old versions of WordPress
3
- if ( !function_exists('wp_nonce_field') ) {
4
- function wp_nonce_field() {}
5
- }
6
-
7
- global $dsq_api;
8
-
9
- require(ABSPATH . 'wp-includes/version.php');
10
-
11
- if ( !current_user_can('moderate_comments') ) {
12
- die('The account you\'re logged in to doesn\'t have permission to access this page.');
13
- }
14
-
15
- function has_valid_nonce() {
16
- $nonce_actions = array('upgrade', 'reset', 'install', 'settings', 'active');
17
- $nonce_form_prefix = 'dsq-form_nonce_';
18
- $nonce_action_prefix = 'dsq-wpnonce_';
19
-
20
- // Check all available nonce actions
21
- foreach ( $nonce_actions as $key => $value ) {
22
- if ( isset($_POST[$nonce_form_prefix.$value]) ) {
23
- check_admin_referer($nonce_action_prefix.$value, $nonce_form_prefix.$value);
24
- return true;
25
- }
26
- }
27
-
28
- return false;
29
- }
30
-
31
- if ( ! empty($_POST) ) {
32
- $nonce_result_check = has_valid_nonce();
33
- if ($nonce_result_check === false) {
34
- die('Unable to save changes. Make sure you are accessing this page from the Wordpress dashboard.');
35
- }
36
- }
37
-
38
- if( isset($_POST['dsq_username']) ) {
39
- $_POST['dsq_username'] = stripslashes($_POST['dsq_username']);
40
- }
41
-
42
- if( isset($_POST['dsq_password']) ) {
43
- $_POST['dsq_password'] = stripslashes($_POST['dsq_password']);
44
- }
45
-
46
- // Handle export function.
47
- if( isset($_POST['export']) and DISQUS_CAN_EXPORT ) {
48
- require_once(dirname(__FILE__) . '/export.php');
49
- dsq_export_wp();
50
- }
51
-
52
- // Handle resetting.
53
- if ( isset($_POST['reset']) ) {
54
- foreach (dsq_options() as $opt) {
55
- delete_option($opt);
56
- }
57
- unset($_POST);
58
- dsq_reset_database();
59
- ?>
60
-
61
- <div class="wrap">
62
- <h2><?php echo dsq_i('Disqus Reset'); ?></h2>
63
- <form method="POST" action="?page=disqus">
64
- <?php wp_nonce_field('dsq-wpnonce_reset', 'dsq-form_nonce_reset'); ?>
65
- <p><?php echo dsq_i('Disqus has been reset successfully.') ?></p>
66
- <ul style="list-style: circle;padding-left:20px;">
67
- <li><?php echo dsq_i('Local settings for the plugin were removed.') ?></li>
68
- <li><?php echo dsq_i('Database changes by Disqus were reverted.') ?></li>
69
- </ul>
70
- <p>
71
- <?php echo dsq_i('If you wish to reinstall, you can do that now.') ?>
72
- <a href="?page=disqus&amp;step=1">&nbsp;<?php echo dsq_i('Reinstall') ?></a>
73
- </p>
74
- </form>
75
- </div>
76
- <?php
77
- die();
78
- }
79
-
80
- // Post fields that require verification.
81
- $check_fields = array(
82
- 'dsq_user_api_key' => array(
83
- 'key_name' => 'dsq_user_api_key',
84
- 'min' => 64,
85
- 'max' => 64,
86
- ),
87
- 'disqus_api_key' => array(
88
- 'key_name' => 'disqus_api_key',
89
- 'min' => 64,
90
- 'max' => 64,
91
- ),
92
- 'disqus_public_key' => array(
93
- 'key_name' => 'disqus_public_key',
94
- 'min' => 64,
95
- 'max' => 64,
96
- ),
97
- 'disqus_secret_key' => array(
98
- 'key_name' => 'disqus_secret_key',
99
- 'min' => 64,
100
- 'max' => 64,
101
- ),
102
- 'disqus_partner_key' => array(
103
- 'key_name' => 'disqus_partner_key',
104
- 'min' => 64,
105
- 'max' => 64,
106
- ),
107
- 'dsq_forum' => array(
108
- 'key_name' => 'dsq_forum',
109
- 'min' => 1,
110
- 'max' => 64,
111
- ),
112
- 'disqus_forum_url' => array(
113
- 'key_name' => 'disqus_forum_url',
114
- 'min' => 1,
115
- 'max' => 64,
116
- ),
117
- 'disqus_replace' => array(
118
- 'key_name' => 'disqus_replace',
119
- 'min' => 3,
120
- 'max' => 6,
121
- ),
122
- 'dsq_username' => array(
123
- 'key_name' => 'dsq_username',
124
- 'min' => 3,
125
- 'max' => 250,
126
- ),
127
- );
128
-
129
- // Check keys keys and remove bad input.
130
- foreach ( $check_fields as $key ) {
131
-
132
- if ( isset($_POST[$key['key_name']]) ) {
133
-
134
- // Strip tags before checking
135
- $_POST[$key['key_name']] = trim(strip_tags($_POST[$key['key_name']]));
136
-
137
- // Check usernames independently because they can have special characters
138
- // or be email addresses
139
- if ( 'dsq_username' === $key['key_name'] ) {
140
- if ( !is_valid_dsq_username($_POST[$key['key_name']], $key['min'], $key['max']) ) {
141
- unset($_POST[$key['key_name']]);
142
- }
143
- }
144
- else {
145
- if ( !is_valid_dsq_key($_POST[$key['key_name']], $key['min'], $key['max']) ) {
146
- unset($_POST[$key['key_name']]);
147
- }
148
- }
149
- }
150
- }
151
-
152
- function is_valid_dsq_username($value, $min=3, $max=250) {
153
- if ( is_email($value) ) {
154
- return true;
155
- }
156
- else {
157
- return is_valid_dsq_key($value, $min, $max);
158
- }
159
- }
160
-
161
- function is_valid_dsq_key($value, $min=1, $max=64) {
162
- return preg_match('/^[\0-9\\:A-Za-z_-]{'.$min.','.$max.'}+$/', $value);
163
- }
164
-
165
- // Handle advanced options.
166
- if ( isset($_POST['disqus_forum_url']) && isset($_POST['disqus_replace']) ) {
167
- update_option('disqus_partner_key', isset($_POST['disqus_partner_key']) ? esc_attr( trim(stripslashes($_POST['disqus_partner_key'])) ) : '');
168
- update_option('disqus_replace', isset($_POST['disqus_replace']) ? esc_attr( $_POST['disqus_replace'] ) : 'all');
169
- update_option('disqus_cc_fix', isset($_POST['disqus_cc_fix']));
170
- update_option('dsq_external_js', isset($_POST['dsq_external_js']) ? '1' : '0');
171
- update_option('disqus_manual_sync', isset($_POST['disqus_manual_sync']));
172
- update_option('disqus_disable_ssr', isset($_POST['disqus_disable_ssr']));
173
- update_option('disqus_public_key', isset($_POST['disqus_public_key']) ? esc_attr( $_POST['disqus_public_key'] ) : '');
174
- update_option('disqus_secret_key', isset($_POST['disqus_secret_key']) ? esc_attr( $_POST['disqus_secret_key'] ) : '');
175
- // Handle SSO button uploads
176
- if ( version_compare($wp_version, '3.5', '>=') ) {
177
- // Use WP 3.5's new, streamlined, much-improved built-in media uploader
178
-
179
- // Only update if a value is actually POSTed, otherwise any time the form is saved the button will be un-set
180
- if ( $_POST['disqus_sso_button'] ) {
181
- update_option('disqus_sso_button', isset($_POST['disqus_sso_button']) ? esc_url( $_POST['disqus_sso_button'] ) : '');
182
- }
183
- } else {
184
- // WP is older than 3.5, use legacy, less-elegant media uploader
185
- if(isset($_FILES['disqus_sso_button'])) {
186
- dsq_image_upload_handler('disqus_sso_button');
187
- }
188
- }
189
- dsq_manage_dialog(dsq_i('Your settings have been changed.'));
190
- }
191
-
192
- // handle disqus_active
193
- if ( isset($_POST['active']) && isset($_GET['active']) ) {
194
- update_option('disqus_active', ($_GET['active'] == '1' ? '1' : '0'));
195
- }
196
-
197
- $dsq_user_api_key = isset($_POST['dsq_user_api_key']) ? $_POST['dsq_user_api_key'] : null;
198
-
199
- // Get installation step process (or 0 if we're already installed).
200
- $step = @intval($_GET['step']);
201
- if ($step > 1 && $step != 3 && $dsq_user_api_key) $step = 1;
202
- elseif ($step == 2 && !isset($_POST['dsq_username'])) $step = 1;
203
- $step = (dsq_is_installed()) ? 0 : ($step ? $step : 1);
204
-
205
- // Handle installation process.
206
- if ( 3 == $step && isset($_POST['dsq_forum']) && isset($_POST['dsq_user_api_key']) ) {
207
- list($dsq_forum_id, $dsq_forum_url) = explode(':', $_POST['dsq_forum']);
208
- update_option('disqus_forum_url', esc_attr( $dsq_forum_url ) );
209
-
210
- // Output javascript in external files by default
211
- update_option('dsq_external_js', '1');
212
-
213
- // Output Javascript in footer by default (no effect when dsq_external_js is enabld)
214
- update_option('disqus_cc_fix', '1');
215
-
216
- $api_key = $dsq_api->get_forum_api_key($_POST['dsq_user_api_key'], $dsq_forum_id);
217
- if ( !$api_key || $api_key < 0 ) {
218
- update_option('disqus_replace', 'replace');
219
- dsq_manage_dialog(
220
- dsq_i('There was an error completing the installation of Disqus.')
221
- . ' '
222
- . dsq_i('If you are still having issues, refer to the help documentation.')
223
- . ' '
224
- . '<a href="https://help.disqus.com/customer/portal/articles/472005" target="_blank">'
225
- . dsq_i('WordPress Help Page')
226
- . '</a>',
227
- true);
228
- } else {
229
- update_option('disqus_api_key', esc_attr( $api_key ));
230
- update_option('disqus_user_api_key', esc_attr( $_POST['dsq_user_api_key']) );
231
- update_option('disqus_replace', 'all');
232
- update_option('disqus_active', '1');
233
- }
234
-
235
- if (!empty($_POST['disqus_partner_key'])) {
236
- $partner_key = trim(stripslashes($_POST['disqus_partner_key']));
237
- if (!empty($partner_key)) {
238
- update_option('disqus_partner_key', $partner_key);
239
- }
240
- }
241
- }
242
-
243
- if ( 2 == $step && isset($_POST['dsq_username']) && isset($_POST['dsq_password']) ) {
244
- $dsq_user_api_key = $dsq_api->get_user_api_key($_POST['dsq_username'], $_POST['dsq_password']);
245
- if ( $dsq_user_api_key < 0 || !$dsq_user_api_key ) {
246
- $step = 1;
247
- dsq_manage_dialog($dsq_api->get_last_error(), true);
248
- }
249
-
250
- if ( $step == 2 ) {
251
- $dsq_sites = $dsq_api->get_forum_list($dsq_user_api_key);
252
- if ( $dsq_sites < 0 ) {
253
- $step = 1;
254
- dsq_manage_dialog($dsq_api->get_last_error(), true);
255
- } else if ( !$dsq_sites ) {
256
- $step = 1;
257
- dsq_manage_dialog(
258
- dsq_i('There aren\'t any sites associated with this account. Maybe you want to create a site?')
259
- . ' '
260
- . '<a href="https://disqus.com/admin/register/" target="_blank">'
261
- . dsq_i('Create a site')
262
- . '</a>',
263
- true);
264
- }
265
- }
266
- }
267
-
268
- $show_advanced = (isset($_GET['t']) && $_GET['t'] == 'adv');
269
-
270
- ?>
271
- <div class="wrap" id="dsq-wrap">
272
- <ul id="dsq-tabs">
273
- <li<?php if (!$show_advanced) echo ' class="selected"'; ?> id="dsq-tab-main" rel="dsq-main">
274
- <?php echo (dsq_is_installed() ? dsq_i('Moderate') : dsq_i('Install')); ?>
275
- </li>
276
- <li<?php if ($show_advanced) echo ' class="selected"'; ?> id="dsq-tab-advanced" rel="dsq-advanced">
277
- <?php echo dsq_i('Plugin Settings'); ?>
278
- </li>
279
- </ul>
280
-
281
- <div id="dsq-main" class="dsq-content">
282
- <?php
283
- switch ( $step ) {
284
- case 3:
285
- ?>
286
- <div id="dsq-step-3" class="dsq-main"<?php if ($show_advanced) echo ' style="display:none;"'; ?>>
287
- <h2><?php echo dsq_i('Install Disqus Comments'); ?></h2>
288
-
289
- <p><?php echo dsq_i('Disqus has been installed on your blog.'); ?></p>
290
- <p>
291
- <?php echo dsq_i('If you have existing comments, you may wish to export them now.') ?>&nbsp;
292
- <?php echo dsq_i('Otherwise, you\'re all set, and the Disqus network is now powering comments on your site.'); ?>
293
- </p>
294
- <p><a href="edit-comments.php?page=disqus"><?php echo dsq_i('Continue to the moderation dashboard'); ?></a></p>
295
- </div>
296
- <?php
297
- break;
298
- case 2:
299
- ?>
300
- <div id="dsq-step-2" class="dsq-main"<?php if ($show_advanced) echo ' style="display:none;"'; ?>>
301
- <h2><?php echo dsq_i('Install Disqus Comments'); ?></h2>
302
-
303
- <form method="POST" action="?page=disqus&amp;step=3">
304
- <?php wp_nonce_field('dsq-wpnonce_install', 'dsq-form_nonce_install'); ?>
305
- <table class="form-table">
306
- <tr>
307
- <th scope="row" valign="top"><?php echo dsq_i('Select a website'); ?></th>
308
- <td>
309
- <?php
310
- foreach ( $dsq_sites as $counter => $dsq_site ):
311
- ?>
312
- <input name="dsq_forum" type="radio" id="dsq-site-<?php echo esc_attr($counter); ?>" value="<?php echo esc_attr($dsq_site->id); ?>:<?php echo esc_attr($dsq_site->shortname); ?>" />
313
- <label for="dsq-site-<?php echo esc_attr($counter); ?>"><strong><?php echo esc_attr($dsq_site->name); ?></strong> (<u><?php echo esc_attr($dsq_site->shortname); ?>.disqus.com</u>)</label>
314
- <br />
315
- <?php
316
- endforeach;
317
- ?>
318
- <hr />
319
- <a href="https://disqus.com/admin/signup/"><?php echo dsq_i('Or register a new one on the Disqus website.'); ?></a>
320
- </td>
321
- </tr>
322
- </table>
323
-
324
- <p class="submit" style="text-align: left">
325
- <input type="hidden" name="dsq_user_api_key" value="<?php echo esc_attr($dsq_user_api_key); ?>"/>
326
- <input name="submit" type="submit" class="button-primary button" value="Next &raquo;" />
327
- </p>
328
- </form>
329
- </div>
330
- <?php
331
- break;
332
- case 1:
333
- ?>
334
- <div id="dsq-step-1" class="dsq-main"<?php if ($show_advanced) echo ' style="display:none;"'; ?>>
335
- <h2><?php echo dsq_i('Install Disqus Comments'); ?></h2>
336
-
337
- <form method="POST" action="?page=disqus&amp;step=2">
338
- <?php wp_nonce_field('dsq-wpnonce_install', 'dsq-form_nonce_install'); ?>
339
- <table class="form-table">
340
- <tr>
341
- <th scope="row" valign="top"><?php echo dsq_i('Username or email'); ?></th>
342
- <td>
343
- <input id="dsq-username" name="dsq_username" tabindex="1" type="text" />
344
- (<a href="https://disqus.com/profile/signup/"><?php echo dsq_i('don\'t have a Disqus Profile yet?'); ?></a>)
345
- </td>
346
- </tr>
347
- <tr>
348
- <th scope="row" valign="top"><?php echo dsq_i('Password'); ?></th>
349
- <td>
350
- <input type="password" id="dsq-password" name="dsq_password" tabindex="2">
351
- (<a href="https://disqus.com/forgot/"><?php echo dsq_i('forgot your password?'); ?></a>)
352
- </td>
353
- </tr>
354
- </table>
355
-
356
- <p class="submit" style="text-align: left">
357
- <input name="submit" type="submit" class="button-primary button" value="Next &raquo;" tabindex="3">
358
- </p>
359
- </form>
360
- </div>
361
- <?php
362
- break;
363
- case 0:
364
- $url = get_option('disqus_forum_url');
365
- if ($url) { $mod_url = 'https://'.$url.'.disqus.com/admin/moderate/'; }
366
- else { $mod_url = 'https://disqus.com/admin/moderate/'; }
367
-
368
- ?>
369
- <div class="dsq-main"<?php if ($show_advanced) echo ' style="display:none;"'; ?>>
370
- <h2><a href="<?php echo esc_attr( $mod_url ) ?>"><img src="<?php echo esc_attr( plugins_url( '/media/images/logo.png', __FILE__ ) ); ?>"></a></h2>
371
- <a class="button-primary button" href="<?php echo esc_attr( $mod_url ) ?>" target="_blank"><?php echo dsq_i('Go to Disqus Moderation'); ?></a>
372
- </div>
373
- <?php } ?>
374
- </div>
375
-
376
- <?php
377
- $dsq_replace = get_option('disqus_replace');
378
- $dsq_forum_url = strtolower(get_option('disqus_forum_url'));
379
- $dsq_api_key = get_option('disqus_api_key');
380
- $dsq_user_api_key = get_option('disqus_user_api_key');
381
- $dsq_partner_key = get_option('disqus_partner_key');
382
- $dsq_cc_fix = get_option('disqus_cc_fix');
383
- $dsq_external_js = get_option('dsq_external_js');
384
- $dsq_manual_sync = get_option('disqus_manual_sync');
385
- $dsq_disable_ssr = get_option('disqus_disable_ssr');
386
- $dsq_public_key = get_option('disqus_public_key');
387
- $dsq_secret_key = get_option('disqus_secret_key');
388
- $dsq_sso_button = get_option('disqus_sso_button');
389
- $disqus_enabled = get_option('disqus_active') == '1';
390
- $disqus_enabled_state = $disqus_enabled ? 'enabled' : 'disabled';
391
- ?>
392
- <!-- Settings -->
393
- <div id="dsq-advanced" class="dsq-content dsq-advanced"<?php if (!$show_advanced) echo ' style="display:none;"'; ?>>
394
- <h2><?php echo dsq_i('Settings'); ?></h2>
395
- <p><?php echo dsq_i('Version: %s', esc_html(DISQUS_VERSION)); ?></p>
396
-
397
- <!-- Enable/disable Disqus toggle -->
398
- <form method="POST" action="?page=disqus&amp;active=<?php echo (string)((int)($disqus_enabled != true)); ?>">
399
- <?php wp_nonce_field('dsq-wpnonce_active', 'dsq-form_nonce_active'); ?>
400
- <p class="status">
401
- <?php echo dsq_i('Disqus comments are currently '); ?>
402
- <span class="dsq-<?php echo esc_attr( $disqus_enabled_state ); ?>-text"><?php echo $disqus_enabled_state; ?></span>
403
- </p>
404
- <input type="submit" name="active" class="button" value="<?php echo $disqus_enabled ? dsq_i('Disable') : dsq_i('Enable'); ?>" />
405
- </form>
406
-
407
- <!-- Configuration form -->
408
- <form method="POST" enctype="multipart/form-data">
409
- <?php wp_nonce_field('dsq-wpnonce_settings', 'dsq-form_nonce_settings'); ?>
410
- <table class="form-table">
411
-
412
- <tr>
413
- <th scope="row" valign="top"><?php echo '<h3>' . dsq_i('General') . '</h3>'; ?></th>
414
- </tr>
415
- <tr>
416
- <th scope="row" valign="top"><?php echo dsq_i('Forum Shortname'); ?></th>
417
- <td>
418
- <input type="hidden" name="disqus_forum_url" value="<?php echo esc_attr($dsq_forum_url); ?>"/>
419
- <code><?php echo esc_attr($dsq_forum_url); ?></code>
420
- <br />
421
- <?php echo dsq_i('This is the unique identifier for your website in Disqus, automatically set during installation.'); ?>
422
- </td>
423
- </tr>
424
-
425
- <tr>
426
- <th scope="row" valign="top"><?php echo '<h3>' . dsq_i('Appearance') . '</h3>'; ?></th>
427
- </tr>
428
- <tr>
429
- <th scope="row" valign="top"><?php echo dsq_i('Use Disqus Comments on'); ?></th>
430
- <td>
431
- <select name="disqus_replace" tabindex="1" class="disqus-replace">
432
- <option value="all" <?php if($dsq_replace == 'all'){echo 'selected';}?>><?php echo dsq_i('All blog posts.'); ?></option>
433
- <option value="closed" <?php if('closed'==$dsq_replace){echo 'selected';}?>><?php echo dsq_i('Blog posts with closed comments only.'); ?></option>
434
- </select>
435
- <br />
436
- <?php
437
- if ($dsq_replace == 'closed') echo '<p class="dsq-alert">'.dsq_i('You have selected to only enable Disqus on posts with closed comments. If you aren\'t seeing Disqus on new posts, change this option to "All blog posts".').'</p>';
438
- else echo dsq_i('Shows comments on either all blog posts, or ones with closed comments. Select the "Blog posts with closed comments only" option if you plan on disabling Disqus, but want to keep it on posts which already have comments.');
439
- ?>
440
- </td>
441
- </tr>
442
-
443
- <tr>
444
- <th scope="row" valign="top"><?php echo '<h3>' . dsq_i('Sync') . '</h3>'; ?></th>
445
- </tr>
446
- <tr>
447
- <th scope="row" valign="top"><?php echo dsq_i('Comment Importing'); ?></th>
448
- <td>
449
- <input type="checkbox" id="disqus_manual_sync" name="disqus_manual_sync" <?php if($dsq_manual_sync){echo 'checked="checked"';}?> >
450
- <label for="disqus_manual_sync"><?php echo dsq_i('Disable automated comment importing'); ?></label>
451
- <br /><?php echo dsq_i('If you have problems with WP-Cron taking too long, or have a large number of comments, you may wish to disable automated sync. Comments will only be imported to your local Wordpress database if you do so manually.'); ?>
452
- </td>
453
- </tr>
454
- <tr>
455
- <th scope="row" valign="top"><?php echo dsq_i('Server-Side Rendering'); ?></th>
456
- <td>
457
- <input type="checkbox" id="disqus_disable_ssr" name="disqus_disable_ssr" <?php if($dsq_disable_ssr){echo 'checked="checked"';}?> >
458
- <label for="disqus_disable_ssr"><?php echo dsq_i('Disable server-side rendering of comments'); ?></label>
459
- <br /><?php echo dsq_i('Hides comments from nearly all search engines.'); ?>
460
- </td>
461
- </tr>
462
-
463
- <tr>
464
- <th scope="row" valign="top"><?php echo '<h3>' . dsq_i('Patches') . '</h3>'; ?></th>
465
- </tr>
466
-
467
- <tr>
468
- <th scope="row" valign="top"><?php echo dsq_i('External Javascript Files'); ?></th>
469
- <td>
470
- <input type="checkbox" id="disqus_external_javascript" name="dsq_external_js" <?php if($dsq_external_js == '1'){ echo 'checked="checked"'; } ?> >
471
- <label for="disqus_external_javascript"><?php echo dsq_i('Render Javascript in external files'); ?></label>
472
- <br /><?php echo dsq_i('This will render the Disqus scripts as external files in the footer as recommended by Wordpress. Disable this if are not seeing Disqus appear on pages that normally have comments. This will fix the issue if your theme does not support the \'wp_enqueue_script\' function, are caching your site on a CDN.'); ?>
473
- </td>
474
- </tr>
475
-
476
- <tr>
477
- <th scope="row" valign="top"><?php echo dsq_i('Template Conflicts'); ?></th>
478
- <td>
479
- <input type="checkbox" id="disqus_comment_count" name="disqus_cc_fix" <?php if($dsq_external_js == '1'){ echo 'disabled '; } if($dsq_cc_fix == '1' || $dsq_external_js == '1'){ echo 'checked="checked"'; } ?> >
480
- <label for="disqus_comment_count"><?php echo dsq_i('Output JavaScript in footer'); ?></label>
481
- <br /><?php echo dsq_i('Enable this if you have problems with comment counts or other irregularities. For example: missing counts, counts always at 0, Disqus code showing on the page, broken image carousels, or longer-than-usual home page load times'); ?>
482
- </td>
483
- </tr>
484
-
485
- <tr>
486
- <th scope="row" valign="top" colspan="2">
487
- <h3><?php echo dsq_i('Advanced'); ?></h3>
488
- <h4><?php echo dsq_i('Single Sign-On'); ?></h4>
489
- <p>
490
- <?php echo dsq_i('Allows users to log in to Disqus via WordPress.'); ?>
491
- <a href="https://help.disqus.com/customer/portal/articles/684744" target="_blank">
492
- <?php echo dsq_i('More info on SSO'); ?>
493
- </a>
494
- </p>
495
- </th>
496
- </tr>
497
- <?php if (!empty($dsq_partner_key)) {// this option only shows if it was already present ?>
498
- <tr>
499
- <th scope="row" valign="top"><?php echo dsq_i('Disqus Partner Key'); ?></th>
500
- <td>
501
- <input type="text" name="disqus_partner_key" value="<?php echo esc_attr($dsq_partner_key); ?>" tabindex="2">
502
- </td>
503
- </tr>
504
- <?php } ?>
505
- <tr>
506
- <th scope="row" valign="top"><?php echo dsq_i('API Application Public Key'); ?></th>
507
- <td>
508
- <input type="text" name="disqus_public_key" value="<?php echo esc_attr($dsq_public_key); ?>" tabindex="2">
509
- <br />
510
- <a href="https://disqus.com/api/applications/" target="_blank"><?php echo dsq_i('Disqus API Applications'); ?></a>
511
- </td>
512
- </tr>
513
- <tr>
514
- <th scope="row" valign="top"><?php echo dsq_i('API Application Secret Key'); ?></th>
515
- <td>
516
- <input type="text" name="disqus_secret_key" value="<?php echo esc_attr($dsq_secret_key); ?>" tabindex="2">
517
- <br />
518
- <a href="https://disqus.com/api/applications/" target="_blank"><?php echo dsq_i('Disqus API Applications'); ?></a>
519
- </td>
520
- </tr>
521
- <tr>
522
- <th scope="row" valign="top"><?php echo dsq_i('Custom Log-in Button'); ?></th>
523
- <td>
524
- <?php if (!empty($dsq_sso_button)) { ?>
525
- <img src="<?php echo esc_attr($dsq_sso_button); ?>" alt="<?php echo esc_attr($dsq_sso_button); ?>" />
526
- <br />
527
- <?php } ?>
528
-
529
- <?php if ( version_compare($wp_version, '3.5', '>=') ) {
530
- // HACK: Use WP's new (as of WP 3.5), streamlined, much-improved built-in media uploader
531
-
532
- // Use WP 3.5's new consolidated call to get all necessary media uploader scripts and styles
533
- wp_enqueue_media();
534
- ?>
535
-
536
- <input type="button" value="<?php echo ($dsq_sso_button ? dsq_i('Change') : dsq_i('Choose')).' '.dsq_i('button'); ?>" class="button upload_image_button" tabindex="2">
537
- <input type="hidden" name="disqus_sso_button" id="disqus_sso_button" value=""/>
538
- <?php } else { // use pre-WP 3.5 media upload functionality ?>
539
- <input type="file" name="disqus_sso_button" value="<?php echo esc_attr($dsq_sso_button); ?>" tabindex="2">
540
- <?php } ?>
541
- <br />
542
- <?php echo dsq_i('Adds a button to the Disqus log-in interface.'); ?>
543
- (<a href="https://d8v2sqslxfuhj.cloudfront.net/docs/sso-button.png" target="_blank"><?php echo dsq_i('Example screenshot'); ?></a>)
544
- <br />
545
- <?php echo dsq_i('See our documentation for a template to create your own button.'); ?>&nbsp;
546
- <a href="https://help.disqus.com/customer/portal/articles/236206#sso-login-button"><?php echo dsq_i('SSO button documentation'); ?></a>
547
- </td>
548
- </tr>
549
-
550
- </table>
551
-
552
- <p class="submit" style="text-align: left">
553
- <input type="hidden" name="disqus_api_key" value="<?php echo esc_attr($dsq_api_key); ?>"/>
554
- <input type="hidden" name="disqus_user_api_key" value="<?php echo esc_attr($dsq_user_api_key); ?>"/>
555
- <input name="submit" type="submit" value="Save" class="button-primary button" tabindex="4">
556
- </p>
557
- </form>
558
-
559
- <h3>Import and Export</h3>
560
-
561
- <table class="form-table">
562
- <?php if (DISQUS_CAN_EXPORT): ?>
563
- <tr id="export">
564
- <th scope="row" valign="top"><?php echo dsq_i('Export comments to Disqus'); ?></th>
565
- <td>
566
- <div id="dsq_export">
567
- <form method="POST" action="">
568
- <?php wp_nonce_field('dsq-wpnonce_export', 'dsq-form_nonce_export'); ?>
569
- <p class="status">
570
- <a href="#" class="button"><?php echo dsq_i('Export Comments'); ?></a>
571
- <?php echo dsq_i('This will export your existing WordPress comments to Disqus'); ?>
572
- </p>
573
- </form>
574
- </div>
575
- </td>
576
- </tr>
577
- <?php endif; ?>
578
- <tr>
579
- <th scope="row" valign="top"><?php echo dsq_i('Sync Disqus with WordPress'); ?></th>
580
- <td>
581
- <div id="dsq_import">
582
- <form method="POST" action="">
583
- <?php wp_nonce_field('dsq-wpnonce_import', 'dsq-form_nonce_import'); ?>
584
- <div class="status">
585
- <p>
586
- <a href="#" class="button"><?php echo dsq_i('Sync Comments'); ?></a>
587
- <?php echo dsq_i('This will download your Disqus comments and store them locally in WordPress'); ?>
588
- </p>
589
- <label>
590
- <input type="checkbox" id="dsq_import_wipe" name="dsq_import_wipe" value="1"/>
591
- <?php echo dsq_i('Remove all imported Disqus comments before syncing.'); ?>
592
- </label>
593
- <br/>
594
- </div>
595
- </form>
596
- </div>
597
- </td>
598
- </tr>
599
- </table>
600
-
601
- <h3>Reset</h3>
602
-
603
- <table class="form-table">
604
- <tr>
605
- <th scope="row" valign="top"><?php echo dsq_i('Reset Disqus'); ?></th>
606
- <td>
607
- <form action="?page=disqus" method="POST">
608
- <?php wp_nonce_field('dsq-wpnonce_reset', 'dsq-form_nonce_reset'); ?>
609
- <p>
610
- <input type="submit" value="Reset" name="reset" onclick="return confirm('<?php echo dsq_i('Are you sure you want to reset the Disqus plugin?'); ?>')" class="button" />
611
- <?php echo dsq_i('This removes all Disqus-specific settings. Comments will remain unaffected.') ?>
612
- </p>
613
- <?php echo dsq_i('If you have problems with resetting taking too long you may wish to first manually drop the \'disqus_dupecheck\' index from your \'commentmeta\' table.') ?>
614
- </form>
615
- </td>
616
- </tr>
617
- </table>
618
- <br/>
619
-
620
- <h3><?php echo dsq_i('Debug Information'); ?></h3>
621
- <p>
622
- <?php echo dsq_i('Having problems with the plugin? Check out our troubleshooting documentation.'); ?>&nbsp;
623
- <a href="https://help.disqus.com/customer/portal/articles/472005" target="_blank"><?php echo dsq_i('WordPress troubleshooting ocumentation'); ?></a>
624
- <?php echo dsq_i('You can also email us and include the debug info below.'); ?>&nbsp;
625
- <a href="mailto:help+wp@disqus.com"><?php echo dsq_i('Contact support'); ?></a>
626
- </p>
627
- <textarea style="width:90%; height:200px;">
628
- URL: <?php echo esc_url( get_option('siteurl') ); ?>
629
-
630
- PHP Version: <?php echo esc_html( phpversion() ); ?>
631
-
632
- Version: <?php echo esc_html( $wp_version ); ?>
633
-
634
- Active Theme:
635
- <?php
636
- if ( !function_exists('wp_get_theme') ) {
637
- $theme = get_theme(get_current_theme());
638
- echo esc_html( $theme['Name'] . ' ' . $theme['Version'] );
639
- } else {
640
- $theme = wp_get_theme();
641
- echo esc_html( $theme->Name . ' ' . $theme->Version );
642
- }
643
- ?>
644
-
645
- URLOpen Method: <?php echo esc_html( dsq_url_method() ); ?>
646
-
647
- Plugin Version: <?php echo esc_html( DISQUS_VERSION ); ?>
648
-
649
- Settings:
650
- dsq_is_installed: <?php echo esc_html( dsq_is_installed().'\n' ); ?>
651
- <?php foreach (dsq_options() as $opt) {
652
- echo esc_html( $opt.': '.get_option($opt).'\n' );
653
- }
654
- ?>
655
-
656
- Plugins:
657
- <?php
658
- foreach (get_plugins() as $key => $plugin) {
659
- $isactive = '';
660
- if (is_plugin_active($key)) {
661
- $isactive = '(active)';
662
- }
663
- echo esc_html( $plugin['Name'].' '.$plugin['Version'].' '.$isactive.'\n' );
664
- }
665
- ?>
666
- </textarea><br/>
667
- </div>
668
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
media/images/logo.png DELETED
Binary file
media/js/admin.js DELETED
@@ -1,120 +0,0 @@
1
- jQuery(document).ready(function($) {
2
-
3
- // Replace comments dashboard link
4
- $('#dashboard_right_now .inside table td.last a, #dashboard_recent_comments .inside .textright a.button').attr('href', 'edit-comments.php?page=disqus');
5
-
6
- // Focuses on username text box if present
7
- if ($('#dsq-username').length) {
8
- $('#dsq-username').focus();
9
- }
10
-
11
- // Set current Disqus admin state
12
- $('#dsq-tabs li').click(function() {
13
- $('#dsq-tabs li.selected').removeClass('selected');
14
- $(this).addClass('selected');
15
- $('.dsq-main, .dsq-advanced').hide();
16
- $('.' + $(this).attr('rel')).show();
17
- });
18
- if (location.href.indexOf('#adv') != -1) {
19
- $('#dsq-tab-advanced').click();
20
- }
21
-
22
- // Bind click events to export/sync buttons
23
- dsq_fire_export();
24
- dsq_fire_import();
25
- });
26
-
27
- var dsq_fire_export = function() {
28
- jQuery(function($) {
29
- $('#dsq_export a.button').unbind().click(function() {
30
- $('#dsq_export .status').removeClass('dsq-export-fail').addClass('dsq-exporting').html('Processing...');
31
- dsq_export_comments();
32
- return false;
33
- });
34
- });
35
- };
36
-
37
- var dsq_export_comments = function() {
38
- jQuery(function($) {
39
- var status = $('#dsq_export .status');
40
- var nonce = $('#dsq-form_nonce_export').val();
41
- var export_info = (status.attr('rel') || '0|' + (new Date().getTime()/1000)).split('|');
42
- $.get(
43
- adminVars.indexUrl,
44
- {
45
- cf_action: 'export_comments',
46
- post_id: export_info[0],
47
- timestamp: export_info[1],
48
- _dsqexport_wpnonce: nonce
49
- },
50
- function(response) {
51
- switch (response.result) {
52
- case 'success':
53
- status.html(response.msg).attr('rel', response.post_id + '|' + response.timestamp);
54
- switch (response.status) {
55
- case 'partial':
56
- dsq_export_comments();
57
- break;
58
- case 'complete':
59
- status.removeClass('dsq-exporting').addClass('dsq-exported');
60
- break;
61
- }
62
- break;
63
- case 'fail':
64
- status.parent().html(response.msg);
65
- dsq_fire_export();
66
- break;
67
- }
68
- },
69
- 'json'
70
- );
71
- });
72
- };
73
-
74
- var dsq_fire_import = function() {
75
- jQuery(function($) {
76
- $('#dsq_import a.button, #dsq_import_retry').unbind().click(function() {
77
- var wipe = $('#dsq_import_wipe').is(':checked');
78
- $('#dsq_import .status').removeClass('dsq-import-fail').addClass('dsq-importing').html('Processing...');
79
- dsq_import_comments(wipe);
80
- return false;
81
- });
82
- });
83
- };
84
-
85
- var dsq_import_comments = function(wipe) {
86
- jQuery(function($) {
87
- var status = $('#dsq_import .status');
88
- var nonce = $('#dsq-form_nonce_import').val();
89
- var last_comment_id = status.attr('rel') || '0';
90
- $.get(
91
- adminVars.indexUrl,
92
- {
93
- cf_action: 'import_comments',
94
- last_comment_id: last_comment_id,
95
- wipe: (wipe ? 1 : 0),
96
- _dsqimport_wpnonce: nonce
97
- },
98
- function(response) {
99
- switch (response.result) {
100
- case 'success':
101
- status.html(response.msg).attr('rel', response.last_comment_id);
102
- switch (response.status) {
103
- case 'partial':
104
- dsq_import_comments(false);
105
- break;
106
- case 'complete':
107
- status.removeClass('dsq-importing').addClass('dsq-imported');
108
- break;
109
- }
110
- break;
111
- case 'fail':
112
- status.parent().html(response.msg);
113
- dsq_fire_import();
114
- break;
115
- }
116
- },
117
- 'json'
118
- );
119
- });
120
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
media/js/dashboard.js DELETED
@@ -1,15 +0,0 @@
1
- jQuery(document).ready(function($) {
2
-
3
- // fix menu
4
- var mc = $('#menu-comments');
5
- mc.find('a.wp-has-submenu').attr('href', 'edit-comments.php?page=disqus').end().find('.wp-submenu li:has(a[href="edit-comments.php?page=disqus"])').prependTo(mc.find('.wp-submenu ul'));
6
-
7
- // fix admin bar
8
- $('#wp-admin-bar-comments').find('a.ab-item').attr('href', 'edit-comments.php?page=disqus');
9
-
10
- // Remove trackbacks
11
- $('#dashboard_recent_comments div.trackback').remove();
12
-
13
- // Replace comment counts
14
- $('#dashboard_right_now').find('.b-comments a').html(dashboardVars.stats.totalComments).end().find('.b_approved a').html(dashboardVars.stats.approved).end().find('.b-waiting a').html(dashboardVars.stats.moderated).end().find('.b-spam a').html(dashboardVars.stats.spam);
15
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
media/js/disqus.js DELETED
@@ -1,56 +0,0 @@
1
- var disqus_url = embedVars.disqusUrl;
2
- var disqus_identifier = embedVars.disqusIdentifier;
3
- var disqus_container_id = 'disqus_thread';
4
- var disqus_shortname = embedVars.disqusShortname;
5
- var disqus_title = embedVars.disqusTitle;
6
- var disqus_config_custom = window.disqus_config;
7
- var disqus_config = function () {
8
- /*
9
- All currently supported events:
10
- onReady: fires when everything is ready,
11
- onNewComment: fires when a new comment is posted,
12
- onIdentify: fires when user is authenticated
13
- */
14
- if (typeof embedVars.disqusConfig.remote_auth_s3 !== 'undefined') {
15
- this.page.remote_auth_s3 = embedVars.disqusConfig.remote_auth_s3;
16
- }
17
-
18
- if (typeof embedVars.disqusConfig.api_key !== 'undefined') {
19
- this.page.api_key = embedVars.disqusConfig.api_key;
20
- }
21
-
22
- if (typeof embedVars.disqusConfig.sso !== 'undefined') {
23
- this.sso = {
24
- name: embedVars.disqusConfig.sso.name,
25
- button: embedVars.disqusConfig.sso.button,
26
- url: embedVars.disqusConfig.sso.url,
27
- logout: embedVars.disqusConfig.sso.logout,
28
- width: embedVars.disqusConfig.sso.width,
29
- height: embedVars.disqusConfig.sso.height
30
- };
31
- }
32
-
33
- this.language = embedVars.disqusConfig.language;
34
- this.callbacks.onReady.push(function () {
35
- if (!embedVars.options.manualSync) {
36
- // sync comments in the background so we don't block the page
37
- var script = document.createElement('script');
38
- script.async = true;
39
- script.src = '?cf_action=sync_comments&post_id=' + embedVars.postId;
40
-
41
- var firstScript = document.getElementsByTagName('script')[0];
42
- firstScript.parentNode.insertBefore(script, firstScript);
43
- }
44
- });
45
-
46
- if (disqus_config_custom) {
47
- disqus_config_custom.call(this);
48
- }
49
- };
50
-
51
- (function() {
52
- var dsq = document.createElement('script'); dsq.type = 'text/javascript';
53
- dsq.async = true;
54
- dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
55
- (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
56
- })();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
media/js/pointer.js DELETED
@@ -1,17 +0,0 @@
1
- jQuery(document).ready( function($) {
2
-
3
- $('#menu-comments').pointer({
4
- content: pointerContent,
5
- position: {
6
- edge: 'left', // arrow direction
7
- align: 'center' // vertical alignment
8
- },
9
- pointerWidth: 350,
10
- close: function() {
11
- $.post(ajaxurl, {
12
- pointer: 'disqus_settings_pointer', // pointer ID
13
- action: 'dismiss-wp-pointer'
14
- });
15
- }
16
- }).pointer('open');
17
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
media/js/upload.js DELETED
@@ -1,34 +0,0 @@
1
- var file_frame;
2
-
3
- jQuery(document).ready(function($) {
4
- $('.upload_image_button').on('click', function(event) {
5
- event.preventDefault();
6
-
7
- // If the media frame already exists, reopen it.
8
- if ( file_frame ) {
9
- file_frame.open();
10
- return;
11
- }
12
-
13
- // Create the media frame.
14
- file_frame = wp.media.frames.file_frame = wp.media({
15
- title: $(this).data('uploader_title'),
16
- button: {
17
- text: $(this).data('uploader_button_text'),
18
- },
19
- multiple: false // Set to true to allow multiple files to be selected
20
- });
21
-
22
- // When an image is selected, run a callback.
23
- file_frame.on('select', function() {
24
- // We set multiple to false so only get one image from the uploader
25
- attachment = file_frame.state().get('selection').first().toJSON();
26
-
27
- // Do something with attachment.id and/or attachment.url here
28
- $('#disqus_sso_button').val(attachment.url);
29
- });
30
-
31
- // Finally, open the modal
32
- file_frame.open();
33
- });
34
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
media/styles/manage-pre25.css DELETED
@@ -1,67 +0,0 @@
1
- /* Selectors required for pre-WordPress 2.5 */
2
-
3
- .form-table {
4
- border-collapse: collapse;
5
- margin-top: 1em;
6
- width: 100%;
7
- color: #333;
8
- }
9
-
10
- .form-table tr {
11
- background-color: #eaf3fa;
12
- }
13
-
14
- .form-table td {
15
- margin-bottom: 9px;
16
- padding: 10px;
17
- line-height: 20px;
18
- font-size: 11px;
19
- border-bottom-width: 8px;
20
- border-bottom-style: solid;
21
- border-color: #fff;
22
- }
23
-
24
- .form-table th {
25
- vertical-align: top;
26
- text-align: left;
27
- padding: 10px;
28
- width: 150px;
29
- border-bottom-width: 8px;
30
- border-bottom-style: solid;
31
- border-color: #fff;
32
- }
33
-
34
- .form-table th.th-full {
35
- width: auto;
36
- }
37
-
38
- .form-table input, .form-table textarea {
39
- border-width: 1px;
40
- border-style: solid;
41
- }
42
-
43
- .form-table div.color-option {
44
- display: block;
45
- clear: both;
46
- }
47
-
48
- .form-table input.tog {
49
- margin-top: 2px;
50
- margin-right: 2px;
51
- float: left;
52
- }
53
-
54
- .form-table table.color-palette {
55
- vertical-align: bottom;
56
- float: left;
57
- margin: -3px 3px 8px;
58
- }
59
-
60
- .form-table .color-palette td {
61
- border-bottom: none;
62
- border: 1px solid #fff;
63
- font-size: 1px;
64
- line-height: 1px;
65
- }
66
-
67
- #disqus_warning{ background-color:#ff0000; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
media/styles/manage.css DELETED
@@ -1,52 +0,0 @@
1
- ul#dsq-tabs li:last-child {
2
- width: 100px;
3
- }
4
- ul#dsq-tabs li.selected {
5
- font-weight: bold;
6
- }
7
- ul#dsq-tabs li {
8
- float: left;
9
- color: #333;
10
- padding: 0.25em;
11
- height: 16px;
12
- cursor: pointer;
13
- margin-right: 8px;
14
- text-align: right;
15
- }
16
-
17
- ul#dsq-tabs {
18
- display: block;
19
- height: 20px;
20
- list-style: none;
21
- margin: 15px 0;
22
- padding: 0;
23
- border: 0;
24
- position: absolute;
25
- right: 10px;
26
- }
27
-
28
- select.disqus-replace {
29
- border-color: #C6D9E9;
30
- }
31
-
32
- .dsq-content h2 {
33
- line-height: 41px;
34
- margin: 15px 0 10px;
35
- }
36
-
37
- .dsq-alert {
38
- color: #fff;
39
- background: #e76c35;
40
- border: 1px solid #8f3e1c;
41
- padding: 5px;
42
- }
43
-
44
- .dsq-disabled-text {
45
- color: #e76c35;
46
- font-weight: 700;
47
- }
48
-
49
- .dsq-enabled-text {
50
- color: #7fbd5a;
51
- font-weight: 700;
52
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
public/class-disqus-public.php ADDED
@@ -0,0 +1,298 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The public-facing functionality of the plugin.
4
+ *
5
+ * @link http://example.com
6
+ * @since 3.0
7
+ *
8
+ * @package Plugin_Name
9
+ * @subpackage Plugin_Name/public
10
+ */
11
+
12
+ /**
13
+ * The public-facing functionality of the plugin.
14
+ *
15
+ * Defines the plugin name, version, and two examples hooks for how to
16
+ * enqueue the admin-specific stylesheet and JavaScript.
17
+ *
18
+ * @package Plugin_Name
19
+ * @subpackage Plugin_Name/public
20
+ * @author Your Name <email@example.com>
21
+ */
22
+ class Disqus_Public {
23
+
24
+ /**
25
+ * The ID of this plugin.
26
+ *
27
+ * @since 3.0
28
+ * @access private
29
+ * @var string $disqus The ID of this plugin.
30
+ */
31
+ private $disqus;
32
+
33
+ /**
34
+ * The version of this plugin.
35
+ *
36
+ * @since 3.0
37
+ * @access private
38
+ * @var string $version The current version of this plugin.
39
+ */
40
+ private $version;
41
+
42
+ /**
43
+ * The unique Disqus forum shortname.
44
+ *
45
+ * @since 3.0
46
+ * @access private
47
+ * @var string $shortname The unique Disqus forum shortname.
48
+ */
49
+ private $shortname;
50
+
51
+ /**
52
+ * Initialize the class and set its properties.
53
+ *
54
+ * @since 3.0
55
+ * @param string $disqus The name of the plugin.
56
+ * @param string $version The version of this plugin.
57
+ * @param string $shortname The configured Disqus shortname.
58
+ */
59
+ public function __construct( $disqus, $version, $shortname ) {
60
+ $this->disqus = $disqus;
61
+ $this->version = $version;
62
+ $this->shortname = $shortname;
63
+ }
64
+
65
+ /**
66
+ * Returns the Disqus identifier for a given post.
67
+ *
68
+ * @since 3.0
69
+ * @access private
70
+ * @param WP_Post $post The WordPress post to create the title for.
71
+ * @return string The formatted identifier to be passed to Disqus.
72
+ */
73
+ private function dsq_identifier_for_post( $post ) {
74
+ return $post->ID . ' ' . $post->guid;
75
+ }
76
+
77
+ /**
78
+ * Returns the Disqus title for a given post.
79
+ *
80
+ * @since 3.0
81
+ * @access private
82
+ * @param WP_Post $post The WordPress post to create the title for.
83
+ * @return string The cleaned title to be passed to Disqus.
84
+ */
85
+ private function dsq_title_for_post( $post ) {
86
+ $title = get_the_title( $post );
87
+ $title = strip_tags( $title, '<b><u><i><h1><h2><h3><code><blockquote><br><hr>' );
88
+ return $title;
89
+ }
90
+
91
+ /**
92
+ * Returns the signed payload to authenticate an SSO user in Disqus.
93
+ *
94
+ * @since 3.0
95
+ * @access private
96
+ * @param WP_User $user The WordPress user to authenticate.
97
+ * @param string $secret_key The Disqus API Secret Key.
98
+ * @return array The signed payload to authenticate a user with Single Sign-On.
99
+ */
100
+ private function remote_auth_s3_for_user( $user, $secret_key ) {
101
+ $payload_user = array();
102
+ if ( $user->ID ) {
103
+ $payload_user['id'] = $user->ID;
104
+ $payload_user['username'] = $user->display_name;
105
+ $payload_user['avatar'] = get_avatar( $user->ID, 92 );
106
+ $payload_user['email'] = $user->user_email;
107
+ $payload_user['url'] = $user->user_url;
108
+ }
109
+ $payload_user = base64_encode( json_encode( $payload_user ) );
110
+ $time = time();
111
+ $hmac = hash_hmac( 'sha1', $payload_user . ' ' . $time, $secret_key );
112
+
113
+ return $payload_user . ' ' . $hmac . ' ' . $time;
114
+ }
115
+
116
+ /**
117
+ * Returns the Disqus comments embed configuration.
118
+ *
119
+ * @since 3.0
120
+ * @access private
121
+ * @param WP_Post $post The WordPress post to create the configuration for.
122
+ * @return array The embed configuration to localize the comments embed script with.
123
+ */
124
+ private function embed_vars_for_post( $post ) {
125
+ $embed_vars = array(
126
+ 'disqusConfig' => array(
127
+ 'integration' => 'wordpress ' . $this->version,
128
+ ),
129
+ 'disqusIdentifier' => $this->dsq_identifier_for_post( $post ),
130
+ 'disqusShortname' => $this->shortname,
131
+ 'disqusTitle' => $this->dsq_title_for_post( $post ),
132
+ 'disqusUrl' => get_permalink(),
133
+ 'postId' => $post->ID,
134
+ );
135
+
136
+ $public_key = get_option( 'disqus_public_key' );
137
+ $secret_key = get_option( 'disqus_secret_key' );
138
+ $can_enable_sso = $public_key && $secret_key && get_option( 'disqus_sso_enabled' );
139
+ if ( $can_enable_sso ) {
140
+ $user = wp_get_current_user();
141
+ $login_redirect = get_admin_url( null, 'profile.php?opener=dsq-sso-login' );
142
+ $embed_vars['disqusConfig']['sso'] = array(
143
+ 'name' => esc_js( get_bloginfo( 'name' ) ),
144
+ 'button' => esc_js( get_option( 'disqus_sso_button' ) ),
145
+ 'url' => wp_login_url( $login_redirect ),
146
+ 'logout' => wp_logout_url(),
147
+ 'width' => '800',
148
+ 'height' => '700',
149
+ );
150
+ $embed_vars['disqusConfig']['api_key'] = $public_key;
151
+ $embed_vars['disqusConfig']['remote_auth_s3'] = $this->remote_auth_s3_for_user( $user, $secret_key );
152
+ }
153
+
154
+ return $embed_vars;
155
+ }
156
+
157
+ /**
158
+ * Determines if Disqus is configured and can load on a given page.
159
+ *
160
+ * @since 3.0
161
+ * @param string $comment_text The default comment text.
162
+ * @return string The new comment text.
163
+ */
164
+ public function dsq_comments_link_template( $comment_text ) {
165
+ global $post;
166
+
167
+ if ( $this->dsq_can_load() ) {
168
+ $disqus_identifier = esc_attr( $this->dsq_identifier_for_post( $post ) );
169
+ return '<span class="dsq-postid" data-dsqidentifier="' . $disqus_identifier . '">'
170
+ . $comment_text .
171
+ '</span>';
172
+ } else {
173
+ return $comment_text;
174
+ }
175
+ }
176
+
177
+ /**
178
+ * Returns the Disqus embed comments template
179
+ *
180
+ * @since 3.0
181
+ * @return string The new comment text.
182
+ */
183
+ public function dsq_comments_template() {
184
+ global $post;
185
+
186
+ if ( $this->dsq_embed_can_load_for_post( $post ) ) {
187
+
188
+ do_action( 'dsq_before_comments' );
189
+ do_action( 'dsq_enqueue_comments_script' );
190
+
191
+ return plugin_dir_path( dirname( __FILE__ ) ) . 'public/partials/disqus-public-display.php';
192
+ }
193
+ }
194
+
195
+ /**
196
+ * Renders a script which checks to see if the window was opened
197
+ * by the Disqus embed for Single Sign-on purposes, and closes
198
+ * itself.
199
+ *
200
+ * @since 3.0
201
+ */
202
+ public function dsq_close_window_template() {
203
+ require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/partials/disqus-public-sso-login-profile.php';
204
+ }
205
+
206
+ /**
207
+ * Enqueues javascript files for displaying comment counts.
208
+ *
209
+ * @since 3.0
210
+ */
211
+ public function enqueue_comment_count() {
212
+ if ( $this->dsq_can_load() ) {
213
+
214
+ $count_vars = array(
215
+ 'disqusShortname' => $this->shortname,
216
+ );
217
+
218
+ wp_enqueue_script( $this->disqus . '_count', plugin_dir_url( __FILE__ ) . 'js/comment_count.js', array(), $this->version, true );
219
+ wp_localize_script( $this->disqus . '_count', 'countVars', $count_vars );
220
+ }
221
+ }
222
+
223
+ /**
224
+ * Enqueues javascript files for displaying the comment embed.
225
+ *
226
+ * @since 3.0
227
+ */
228
+ public function enqueue_comment_embed() {
229
+ global $post;
230
+
231
+ if ( $this->dsq_embed_can_load_for_post( $post ) ) {
232
+
233
+ $embed_vars = $this->embed_vars_for_post( $post );
234
+
235
+ wp_enqueue_script( $this->disqus . '_embed', plugin_dir_url( __FILE__ ) . 'js/comment_embed.js', array(), $this->version, true );
236
+ wp_localize_script( $this->disqus . '_embed', 'embedVars', $embed_vars );
237
+ }
238
+ }
239
+
240
+ /**
241
+ * Determines if Disqus is configured and can load on a given page.
242
+ *
243
+ * @since 3.0
244
+ * @access private
245
+ * @return boolean Whether Disqus is configured properly and can load on the current page.
246
+ */
247
+ private function dsq_can_load() {
248
+ // Don't load any Disqus scripts if there's no shortname.
249
+ if ( ! $this->shortname ) {
250
+ return false;
251
+ }
252
+
253
+ // Don't load any Disqus scripts on feed pages.
254
+ if ( is_feed() ) {
255
+ return false;
256
+ }
257
+
258
+ return true;
259
+ }
260
+
261
+ /**
262
+ * Determines if Disqus is configured and can the comments embed on a given page.
263
+ *
264
+ * @since 3.0
265
+ * @access private
266
+ * @param WP_Post $post The WordPress post used to determine if Disqus can be loaded.
267
+ * @return boolean Whether Disqus is configured properly and can load on the current page.
268
+ */
269
+ private function dsq_embed_can_load_for_post( $post ) {
270
+ // Checks if the plugin is configured properly
271
+ // and is a valid page.
272
+ if ( ! $this->dsq_can_load() ) {
273
+ return false;
274
+ }
275
+
276
+ // Make sure we have a $post object.
277
+ if ( ! isset( $post ) ) {
278
+ return false;
279
+ }
280
+
281
+ // Don't load embed when post is a draft.
282
+ if ( 'draft' == $post->post_status ) {
283
+ return false;
284
+ }
285
+
286
+ // Don't load embed when comments are closed on a post.
287
+ if ( 'open' != $post->comment_status ) {
288
+ return false;
289
+ }
290
+
291
+ // Don't load embed if it's not a single post page.
292
+ if ( ! is_singular() ) {
293
+ return false;
294
+ }
295
+
296
+ return true;
297
+ }
298
+ }
public/index.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ // Silence is golden.
media/js/count.js → public/js/comment_count.js RENAMED
@@ -10,8 +10,9 @@ var disqus_shortname = countVars.disqusShortname;
10
  nodes[i].parentNode.href = url + '#disqus_thread';
11
  }
12
  }
13
- var s = document.createElement('script'); s.async = true;
 
14
  s.type = 'text/javascript';
15
- s.src = '//' + disqus_shortname + '.disqus.com/count.js';
16
  (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
17
  }());
10
  nodes[i].parentNode.href = url + '#disqus_thread';
11
  }
12
  }
13
+ var s = document.createElement('script');
14
+ s.async = true;
15
  s.type = 'text/javascript';
16
+ s.src = 'https://' + disqus_shortname + '.disqus.com/count.js';
17
  (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
18
  }());
public/js/comment_embed.js ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var disqus_url = embedVars.disqusUrl;
2
+ var disqus_identifier = embedVars.disqusIdentifier;
3
+ var disqus_container_id = 'disqus_thread';
4
+ var disqus_shortname = embedVars.disqusShortname;
5
+ var disqus_title = embedVars.disqusTitle;
6
+ var disqus_config_custom = window.disqus_config;
7
+ var disqus_config = function () {
8
+ /*
9
+ All currently supported events:
10
+ onReady: fires when everything is ready,
11
+ onNewComment: fires when a new comment is posted,
12
+ onIdentify: fires when user is authenticated
13
+ */
14
+ var dsqConfig = embedVars.disqusConfig;
15
+ this.page.integration = dsqConfig.integration;
16
+ this.page.remote_auth_s3 = dsqConfig.remote_auth_s3;
17
+ this.page.api_key = dsqConfig.api_key;
18
+ this.sso = dsqConfig.sso;
19
+ this.language = dsqConfig.language;
20
+
21
+ if (disqus_config_custom)
22
+ disqus_config_custom.call(this);
23
+ };
24
+
25
+ (function() {
26
+ var dsq = document.createElement('script');
27
+ dsq.type = 'text/javascript';
28
+ dsq.async = true;
29
+ dsq.src = 'https://' + disqus_shortname + '.disqus.com/embed.js';
30
+ (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
31
+ })();
public/partials/disqus-public-display.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Markup which will replace the WordPress comments section on a given page.
4
+ *
5
+ * @link https://disqus.com
6
+ * @since 3.0
7
+ *
8
+ * @package Disqus
9
+ * @subpackage Disqus/public/partials
10
+ */
11
+
12
+ ?>
13
+
14
+ <div id="disqus_thread"></div>
public/partials/disqus-public-sso-login-profile.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Markup rendered as part of a user's own profile page which will check
4
+ * a query param to determine if it was opened in a child window, as in
5
+ * the case of clicking "Log in" to an SSO account via the Disqus embed,
6
+ * and will close the window. We do this because the embed is waiting for
7
+ * the window to close before reloading with the authenticated user.
8
+ *
9
+ * @link https://disqus.com
10
+ * @since 3.0
11
+ *
12
+ * @package Disqus
13
+ * @subpackage Disqus/public/partials
14
+ */
15
+
16
+ ?>
17
+
18
+ <script>
19
+ var win = window;
20
+ var isWindowed = win.opener && win.opener !== win.top;
21
+ var isDsqRedirect = win.location.href.indexOf('opener=dsq-sso-login') > -1;
22
+ if (isWindowed && isDsqRedirect)
23
+ window.close();
24
+ </script>
rest-api/class-disqus-rest-api.php ADDED
@@ -0,0 +1,1015 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The REST API-specific functionality of the plugin.
4
+ *
5
+ * @link https://disqus.com
6
+ * @since 3.0
7
+ *
8
+ * @package Disqus
9
+ * @subpackage Disqus/rest-api
10
+ */
11
+
12
+ /**
13
+ * Defines the REST API endpoints for the plugin
14
+ *
15
+ * @package Disqus
16
+ * @subpackage Disqus/rest-api
17
+ * @author Ryan Valentin <ryan@disqus.com>
18
+ */
19
+ class Disqus_Rest_Api {
20
+
21
+ const REST_NAMESPACE = 'disqus/v1';
22
+
23
+ const DISQUS_API_BASE = 'https://disqus.com/api/3.0/';
24
+
25
+ /**
26
+ * Instance of the Disqus API service.
27
+ *
28
+ * @since 3.0
29
+ * @access private
30
+ * @var Disqus_Api_Service $api_service Instance of the Disqus API service.
31
+ */
32
+ private $api_service;
33
+
34
+ /**
35
+ * The current version of the plugin.
36
+ *
37
+ * @since 3.0
38
+ * @access protected
39
+ * @var string $version The current version of the plugin.
40
+ */
41
+ protected $version;
42
+
43
+ /**
44
+ * Initialize the class and set its properties.
45
+ *
46
+ * @since 3.0
47
+ * @param Disqus_Api_Service $api_service Instance of the Disqus API service.
48
+ * @param string $version The version of this plugin.
49
+ */
50
+ public function __construct( $api_service, $version ) {
51
+ $this->api_service = $api_service;
52
+ $this->version = $version;
53
+ }
54
+
55
+ /**
56
+ * When added as a filter, allows customizing the response. We use this to stop WordPress from
57
+ * JSON-encoding the webhook verification response.
58
+ * See: https://github.com/WordPress/WordPress/blob/27aa0664df927f610e42f9a694eb452cee49e245/wp-includes/rest-api/class-wp-rest-server.php#L376
59
+ *
60
+ * @since 3.0
61
+ * @param boolean $served Whether this filter has already been applied.
62
+ * @param WP_HTTP_Response $result Result to send to the client. Usually a WP_REST_Response.
63
+ * @param WP_REST_Request $request Request used to generate the response.
64
+ * @param WP_REST_Server $server Server instance.
65
+ * @return boolean Whether we've handled the response or not.
66
+ */
67
+ public function filter_rest_pre_serve_request( $served, $result, $request, $server ) {
68
+ if ( '/' . Disqus_Rest_Api::REST_NAMESPACE . '/sync/webhook' === $request->get_route() ) {
69
+ // The sync/webhook endpoint should never return anything except the challenge in
70
+ // plain text when prompted.
71
+ header( 'Content-Type: text/plain; charset=UTF-8' );
72
+ $json_data = $request->get_json_params();
73
+ echo 'verify' === $json_data['verb'] ? $json_data['challenge'] : '';
74
+ $served = true;
75
+ }
76
+
77
+ return $served;
78
+ }
79
+
80
+ /**
81
+ * Callback to ensure user has manage_options permissions.
82
+ *
83
+ * @since 3.0
84
+ * @param WP_REST_Request $request The request object.
85
+ * @return boolean|WP_Error Whether the user has permission to the admin REST API.
86
+ */
87
+ public function rest_admin_only_permission_callback( WP_REST_Request $request ) {
88
+ // Regular cookie-based authentication.
89
+ if ( current_user_can( 'manage_options' ) ) {
90
+ return true;
91
+ }
92
+
93
+ // Shared secret authentication.
94
+ $hub_signature = $request->get_header( 'X-Hub-Signature' );
95
+ $sync_token = get_option( 'disqus_sync_token' );
96
+ $body = $request->get_body();
97
+
98
+ if ( $hub_signature &&
99
+ $sync_token &&
100
+ $body &&
101
+ ( 'sha512=' . hash_hmac( 'sha512', $body, $sync_token ) ) === $hub_signature ) {
102
+ return true;
103
+ }
104
+
105
+ return $this->rest_get_error( 'You must be logged in and have admin permissions for this resource.', 401 );
106
+ }
107
+
108
+ /**
109
+ * Registers Disqus plugin WordPress REST API endpoints.
110
+ *
111
+ * @since 3.0
112
+ */
113
+ public function register_endpoints() {
114
+ register_rest_route( Disqus_Rest_Api::REST_NAMESPACE, 'sync/webhook', array(
115
+ 'methods' => 'POST',
116
+ 'callback' => array( $this, 'rest_sync_webhook' ),
117
+ 'permission_callback' => array( $this, 'rest_admin_only_permission_callback' ),
118
+ ) );
119
+
120
+ register_rest_route( Disqus_Rest_Api::REST_NAMESPACE, 'settings', array(
121
+ array(
122
+ 'methods' => array( 'GET', 'POST' ),
123
+ 'callback' => array( $this, 'rest_settings' ),
124
+ 'permission_callback' => array( $this, 'rest_admin_only_permission_callback' ),
125
+ ),
126
+ 'schema' => array( $this, 'dsq_get_settings_schema' ),
127
+ ) );
128
+
129
+ register_rest_route( Disqus_Rest_Api::REST_NAMESPACE, 'sync/status', array(
130
+ array(
131
+ 'methods' => 'GET',
132
+ 'callback' => array( $this, 'rest_sync_status' ),
133
+ 'permission_callback' => array( $this, 'rest_admin_only_permission_callback' ),
134
+ ),
135
+ ) );
136
+
137
+ register_rest_route( Disqus_Rest_Api::REST_NAMESPACE, 'sync/enable', array(
138
+ array(
139
+ 'methods' => 'POST',
140
+ 'callback' => array( $this, 'rest_sync_enable' ),
141
+ 'permission_callback' => array( $this, 'rest_admin_only_permission_callback' ),
142
+ ),
143
+ ) );
144
+
145
+ register_rest_route( Disqus_Rest_Api::REST_NAMESPACE, 'sync/disable', array(
146
+ array(
147
+ 'methods' => 'POST',
148
+ 'callback' => array( $this, 'rest_sync_disable' ),
149
+ 'permission_callback' => array( $this, 'rest_admin_only_permission_callback' ),
150
+ ),
151
+ ) );
152
+
153
+ register_rest_route( Disqus_Rest_Api::REST_NAMESPACE, 'export/post', array(
154
+ array(
155
+ 'methods' => 'POST',
156
+ 'callback' => array( $this, 'rest_export_post' ),
157
+ 'permission_callback' => array( $this, 'rest_admin_only_permission_callback' ),
158
+ ),
159
+ ) );
160
+ }
161
+
162
+ /**
163
+ * Utility function to format REST API responses.
164
+ *
165
+ * @since 3.0
166
+ * @access private
167
+ * @param array $data The request data to be returned.
168
+ * @return WP_REST_Response The API response object.
169
+ */
170
+ private function rest_get_response( array $data ) {
171
+ return new WP_REST_Response( array(
172
+ 'code' => 'OK',
173
+ 'message' => 'Request completed successfully',
174
+ 'data' => $data,
175
+ ), 200 );
176
+ }
177
+
178
+ /**
179
+ * Utility function to format REST API errors, and to optionally log them.
180
+ *
181
+ * @since 3.0
182
+ * @access private
183
+ * @param string $message The error message to be returned.
184
+ * @param int $status_code The http status code of the error.
185
+ * @return WP_Error The API error object.
186
+ */
187
+ private function rest_get_error( $message, $status_code = 500 ) {
188
+ return new WP_Error(
189
+ $status_code,
190
+ $message,
191
+ array(
192
+ 'status' => $status_code,
193
+ )
194
+ );
195
+ }
196
+
197
+ /**
198
+ * Endpoint callback for sync/webhook. Takes a Disqus comment and saves
199
+ * it to the local comments database.
200
+ *
201
+ * @since 3.0
202
+ * @param WP_REST_Request $request The request object.
203
+ * @return WP_REST_Response|WP_Error The API response object.
204
+ */
205
+ public function rest_sync_webhook( WP_REST_Request $request ) {
206
+ $json_data = $request->get_json_params();
207
+
208
+ if ( ! isset( $json_data['verb'] ) ) {
209
+ return new WP_Error( 400, 'Missing required property: verb.' );
210
+ }
211
+
212
+ // Check for and respond to verification request before anything else.
213
+ if ( 'verify' === $json_data['verb'] ) {
214
+ // The X-Hub-Signature header was already validated, so we only need to return the challenge.
215
+ $this->log_sync_message( 'Syncing established with Disqus servers' );
216
+ return new WP_REST_Response( $json_data['challenge'], 200 );
217
+ }
218
+
219
+ // Don't attempt to sync anything that isn't a comment.
220
+ if ( 'post' !== $json_data['object_type'] ) {
221
+ return new WP_REST_Response( '', 204 );
222
+ }
223
+
224
+ try {
225
+ switch ( $json_data['verb'] ) {
226
+ case 'create':
227
+ $new_comment_id = $this->create_comment_from_post( $json_data['transformed_data'] );
228
+ $this->log_sync_message( 'Synced new comment "' . $json_data['transformed_data']['id'] . '" from Disqus' );
229
+ return new WP_REST_Response( (string) $new_comment_id, 201 );
230
+ case 'update':
231
+ $updated_comment_id = $this->update_comment_from_post( $json_data['transformed_data'] );
232
+ $this->log_sync_message( 'Updated synced comment "' . $json_data['transformed_data']['id'] . '" from Disqus' );
233
+ return new WP_REST_Response( (string) $updated_comment_id, 200 );
234
+ default:
235
+ return new WP_REST_Response( '', 204 );
236
+ }
237
+ } catch ( Exception $e ) {
238
+ $this->log_sync_message( 'Error occurred during sync request from Disqus' );
239
+ return new WP_Error( 500, (string) $e );
240
+ }
241
+ }
242
+
243
+ /**
244
+ * Endpoint callback for admin settings.
245
+ *
246
+ * @since 3.0
247
+ * @param WP_REST_Request $request The request object.
248
+ * @return WP_REST_Response|WP_Error The API response object.
249
+ */
250
+ public function rest_settings( WP_REST_Request $request ) {
251
+ $should_update = 'POST' === $request->get_method();
252
+ $new_settings = $should_update ? $this->get_request_data( $request ) : null;
253
+ $updated_settings = $this->get_or_update_settings( $new_settings );
254
+
255
+ return $this->rest_get_response( $updated_settings );
256
+ }
257
+
258
+ /**
259
+ * Endpoint callback for fetching automatic syncing status.
260
+ *
261
+ * @since 3.0
262
+ * @param WP_REST_Request $request The request object.
263
+ * @return WP_REST_Response|WP_Error The API response object.
264
+ */
265
+ public function rest_sync_status( WP_REST_Request $request ) {
266
+ try {
267
+ $status = $this->get_sync_status();
268
+
269
+ return $this->rest_get_response( $status );
270
+ } catch ( Exception $e ) {
271
+ return $this->rest_get_error( 'There was an error fetching sync status.' );
272
+ }
273
+ }
274
+
275
+ /**
276
+ * Endpoint callback for enabling automatic syncing.
277
+ *
278
+ * @since 3.0
279
+ * @param WP_REST_Request $request The request object.
280
+ * @return WP_REST_Response|WP_Error The API response object.
281
+ */
282
+ public function rest_sync_enable( WP_REST_Request $request ) {
283
+ try {
284
+ $status = $this->enable_sync();
285
+
286
+ return $this->rest_get_response( $status );
287
+ } catch ( Exception $e ) {
288
+ return $this->rest_get_error( 'There was an error attempting to enable syncing.' );
289
+ }
290
+ }
291
+
292
+ /**
293
+ * Endpoint callback for disabling automatic syncing.
294
+ *
295
+ * @since 3.0
296
+ * @param WP_REST_Request $request The request object.
297
+ * @return WP_REST_Response|WP_Error The API response object.
298
+ */
299
+ public function rest_sync_disable( WP_REST_Request $request ) {
300
+ try {
301
+ $status = $this->disable_sync();
302
+
303
+ return $this->rest_get_response( $status );
304
+ } catch ( Exception $e ) {
305
+ return $this->rest_get_error( 'There was an error attempting to disable syncing.' );
306
+ }
307
+ }
308
+
309
+ /**
310
+ * Endpoint callback for exporting comments from a single WordPress post to Disqus.
311
+ *
312
+ * @since 3.0
313
+ * @param WP_REST_Request $request The request object.
314
+ * @return WP_REST_Response|WP_Error The API response object.
315
+ */
316
+ public function rest_export_post( WP_REST_Request $request ) {
317
+ $json_data = $request->get_json_params();
318
+ $postId = $json_data['postId'];
319
+
320
+ if ( ! isset( $json_data['postId'] ) ) {
321
+ return $this->rest_get_error( 'Missing required property: postId.', 400 );
322
+ }
323
+
324
+ $post = get_post( $postId );
325
+
326
+ // First get comments that are approved, and sort them by smaller IDs first, so that the parent/child dependency
327
+ // of replies are maintained.
328
+ $comments = get_comments( array(
329
+ 'post_id' => $postId,
330
+ 'status' => 'approve',
331
+ 'orderby' => 'comment_ID',
332
+ 'order' => 'ASC',
333
+ ) );
334
+
335
+ // Filter out pingbacks/trackings and comments that have been created by Disqus via syncing.
336
+ $filtered_comments = array_filter( $comments, function ( $value ) {
337
+ return empty( $value->comment_type ) && strpos( $value->comment_agent, 'Disqus' ) === false;
338
+ } );
339
+
340
+ $response_data = array(
341
+ 'comments' => $filtered_comments,
342
+ );
343
+
344
+ if ( ! empty( $filtered_comments ) ) {
345
+ // Generate a WXR (XML) file that Disqus will be able to read.
346
+ $wxr = $this->generate_export_wxr( $post, $filtered_comments );
347
+ $filename = (string) $post->ID . '.wxr';
348
+ $response_data['wxr'] = array(
349
+ 'filename' => $filename,
350
+ 'xmlContent' => $wxr,
351
+ );
352
+ }
353
+
354
+ return $this->rest_get_response( $response_data );
355
+ }
356
+
357
+ /**
358
+ * Parses and returns body content for either form-url-encoded or json data.
359
+ *
360
+ * @since 3.0
361
+ * @param WP_REST_Request $request The request object.
362
+ * @return array Array of parsed request data.
363
+ */
364
+ private function get_request_data( WP_REST_Request $request ) {
365
+ $content_type = $request->get_content_type();
366
+
367
+ switch ( $content_type['value'] ) {
368
+ case 'application/json':
369
+ return $request->get_json_params();
370
+ default:
371
+ return $request->get_body_params();
372
+ }
373
+ }
374
+
375
+ /**
376
+ * Fetches all available plugin options and updates any values if passed, and returns updated array.
377
+ *
378
+ * @since 3.0
379
+ * @param array $new_settings Any options to be updated.
380
+ * @access private
381
+ * @return array The current settings array.
382
+ */
383
+ private function get_or_update_settings( $new_settings = null ) {
384
+ $settings = array();
385
+ $schema = $this->dsq_get_settings_schema();
386
+ $should_update = is_array( $new_settings );
387
+
388
+ // Loops through properties in our schema to check the value and update if needed.
389
+ foreach ( $schema['properties'] as $key => $schema_value ) {
390
+ $should_update_param = $should_update && isset( $new_settings[ $key ] ) && false === $schema_value['readonly'];
391
+ if ( $should_update_param ) {
392
+ update_option( $key, $new_settings[ $key ] );
393
+ }
394
+ $settings[ $key ] = get_option( $key, null );
395
+
396
+ // Escape only values that have been set, otherwise esc_attr() will change null to an empty string.
397
+ if ( null !== $settings[ $key ] ) {
398
+ $settings[ $key ] = esc_attr( $settings[ $key ] );
399
+ }
400
+ }
401
+
402
+ // Add additional non-database options here.
403
+ $settings['disqus_installed'] = trim( $settings['disqus_forum_url'] ) !== '';
404
+
405
+ return $settings;
406
+ }
407
+
408
+ /**
409
+ * Determines if subscription information matches information about this WordPress site.
410
+ *
411
+ * @since 3.0
412
+ * @param object $subscription The Disqus webhook subscription array.
413
+ * @return boolean Whether the subscription information belongs to this WordPress site.
414
+ */
415
+ private function validate_subscription( $subscription ) {
416
+ return rest_url( Disqus_Rest_Api::REST_NAMESPACE . '/sync/webhook' ) === $subscription->url;
417
+ }
418
+
419
+ /**
420
+ * Fetches and returns the syncing status from the Disqus servers.
421
+ *
422
+ * @since 3.0
423
+ * @return array The syncing status array.
424
+ * @throws Exception An exception if the Disqus API doesn't return with code 0 (status: 200).
425
+ */
426
+ private function get_sync_status() {
427
+ $is_subscribed = false;
428
+ $is_enabled = false;
429
+ $current_subscription = null;
430
+ $requires_update = false;
431
+
432
+ if ( get_option( 'disqus_secret_key' ) && get_option( 'disqus_admin_access_token' ) ) {
433
+ $api_data = $this->api_service->api_get( 'forums/webhooks/list', array(
434
+ 'forum' => get_option( 'disqus_forum_url' ),
435
+ ));
436
+
437
+ if ( 0 === $api_data->code ) {
438
+ // Loop through each subscription, looking for the first match.
439
+ foreach ( $api_data->response as $subscription ) {
440
+ if ( $this->validate_subscription( $subscription ) ) {
441
+ $current_subscription = $subscription;
442
+ $is_enabled = $current_subscription->enableSending;
443
+ $is_subscribed = true;
444
+ $requires_update = get_option( 'disqus_sync_token' ) !== $current_subscription->secret;
445
+ break;
446
+ }
447
+ }
448
+ } else {
449
+ throw new Exception( $api_data->response );
450
+ }
451
+ }
452
+
453
+ return array(
454
+ 'subscribed' => $is_subscribed,
455
+ 'enabled' => $is_enabled,
456
+ 'requires_update' => $requires_update,
457
+ 'subscription' => $current_subscription,
458
+ 'last_message' => get_option( 'disqus_last_sync_message', '' ),
459
+ );
460
+ }
461
+
462
+ /**
463
+ * Enables automatic syncing from Disqus if disabled.
464
+ *
465
+ * @since 3.0
466
+ * @return array The syncing status array.
467
+ * @throws Exception An exception if the Disqus API doesn't return with code 0 (status: 200).
468
+ */
469
+ private function enable_sync() {
470
+ $sync_status = $this->get_sync_status();
471
+ $subscription = $sync_status['subscription'];
472
+ $endpoint = null;
473
+ $params = array(
474
+ 'url' => rest_url( Disqus_Rest_Api::REST_NAMESPACE . '/sync/webhook' ),
475
+ 'secret' => get_option( 'disqus_sync_token' ),
476
+ 'enableSending' => '1',
477
+ );
478
+
479
+ if ( ! $sync_status['subscribed'] ) {
480
+ $endpoint = 'forums/webhooks/create';
481
+ $params['forum'] = get_option( 'disqus_forum_url' );
482
+ } elseif ( ! $sync_status['enabled'] || $sync_status['requires_update'] ) {
483
+ $endpoint = 'forums/webhooks/update';
484
+ $params['subscription'] = $subscription->id;
485
+ }
486
+
487
+ if ( null !== $endpoint ) {
488
+ $api_data = $this->api_service->api_post( $endpoint, $params );
489
+
490
+ if ( 0 === $api_data->code ) {
491
+ $sync_status = array(
492
+ 'subscribed' => true,
493
+ 'enabled' => true,
494
+ 'requires_update' => false,
495
+ 'subscription' => $api_data->response,
496
+ 'last_message' => $sync_status['last_message'],
497
+ );
498
+ } else {
499
+ $this->log_sync_message( 'Error enabling syncing: ' . $api_data->response );
500
+ throw new Exception( $api_data->response );
501
+ }
502
+ }
503
+
504
+ return $sync_status;
505
+ }
506
+
507
+ /**
508
+ * Disables automatic syncing from Disqus if enabled.
509
+ *
510
+ * @since 3.0
511
+ * @return array The syncing status array.
512
+ * @throws Exception An exception if the Disqus API doesn't return with code 0 (status: 200).
513
+ */
514
+ private function disable_sync() {
515
+ $sync_status = $this->get_sync_status();
516
+ $subscription = $sync_status['subscription'];
517
+
518
+ if ( $sync_status['enabled'] ) {
519
+ $params = array(
520
+ 'subscription' => $subscription->id,
521
+ 'enableSending' => '0',
522
+ );
523
+ $api_data = $this->api_service->api_post( 'forums/webhooks/update', $params );
524
+
525
+ if ( 0 === $api_data->code ) {
526
+ $sync_status = array(
527
+ 'subscribed' => true,
528
+ 'enabled' => false,
529
+ 'requires_update' => false,
530
+ 'subscription' => $api_data->response,
531
+ 'last_message' => $sync_status['last_message'],
532
+ );
533
+ } else {
534
+ throw new Exception( $api_data->response );
535
+ }
536
+ }
537
+
538
+ return $sync_status;
539
+ }
540
+
541
+ /**
542
+ * Creates a comment in the WordPress database given a Disqus post.
543
+ *
544
+ * @since 3.0
545
+ * @param array $post The Disqus post object.
546
+ * @return int The newly created comment ID.
547
+ * @throws Exception An exception if comment can't be saved from post data.
548
+ */
549
+ private function create_comment_from_post( $post ) {
550
+ $this->validate_disqus_post_data( $post );
551
+
552
+ // Check to make sure we haven't synced this comment yet.
553
+ $comment_query = new WP_Comment_Query( array(
554
+ 'meta_key' => 'dsq_post_id',
555
+ 'meta_value' => $post['id'],
556
+ 'number' => 1,
557
+ ) );
558
+
559
+ if ( ! empty( $comment_query->comments ) ) {
560
+ $this->log_sync_message( 'Error syncing new comment "' . $post['id'] . '" from Disqus. Comment with this dsq_post_id already in the local database' );
561
+ return 0;
562
+ }
563
+
564
+ $comment_data = $this->comment_data_from_post( $post );
565
+
566
+ $new_comment_id = wp_insert_comment( $comment_data );
567
+
568
+ return $new_comment_id;
569
+ }
570
+
571
+ /**
572
+ * Updates a comment in the WordPress database given a Disqus post.
573
+ *
574
+ * @since 3.0
575
+ * @param array $post The Disqus post object.
576
+ * @return int The newly created comment ID.
577
+ * @throws Exception An exception if comment can't be saved from post data.
578
+ */
579
+ private function update_comment_from_post( $post ) {
580
+ $this->validate_disqus_post_data( $post );
581
+
582
+ // Check to make sure we have synced this comment already.
583
+ $comment_query = new WP_Comment_Query( array(
584
+ 'meta_key' => 'dsq_post_id',
585
+ 'meta_value' => $post['id'],
586
+ 'number' => 1,
587
+ ) );
588
+
589
+ $comments = $comment_query->comments;
590
+
591
+ if ( empty( $comments ) ) {
592
+ $this->log_sync_message( 'Error updating synced comment "' . $post['id'] . '" from Disqus. Comment with this dsq_post_id was not in the local database' );
593
+ return 0;
594
+ }
595
+
596
+ foreach ( $comments as $comment ) {
597
+ $updated_comment_id = $comment->comment_ID;
598
+ }
599
+
600
+ $comment_data = $this->comment_data_from_post( $post );
601
+ $comment_data['comment_ID'] = $updated_comment_id;
602
+
603
+ // Remove non-updating fields.
604
+ unset( $comment_data['comment_meta'] );
605
+ unset( $comment_data['comment_agent'] );
606
+ unset( $comment_data['comment_parent'] );
607
+ unset( $comment_data['comment_type'] );
608
+ unset( $comment_data['comment_date_gmt'] );
609
+ unset( $comment_data['comment_post_ID'] );
610
+
611
+ $updated = wp_update_comment( $comment_data );
612
+
613
+ return 1 === $updated ? $updated_comment_id : 0;
614
+ }
615
+
616
+ /**
617
+ * Creates a comment in the WordPress database given a Disqus post.
618
+ *
619
+ * @since 3.0
620
+ * @param array $post The Disqus post object.
621
+ * @throws Exception An exception if comment is invalid.
622
+ */
623
+ private function validate_disqus_post_data( $post ) {
624
+ if ( ! $post || get_option( 'disqus_forum_url' ) !== $post['forum'] ) {
625
+ throw new Exception( 'The comment\'s forum does not match the installed forum. Was "' . $post['forum'] . '", expected "' . get_option( 'disqus_forum_url' ) . '"' );
626
+ }
627
+ }
628
+
629
+ /**
630
+ * Checks the state of a Disqus post (comment) and translates to the WordPress comment_approved format.
631
+ *
632
+ * @since 3.0
633
+ * @param array $post The Disqus post object.
634
+ * @return array The translated comment data to be inserted/updated.
635
+ * @throws Exception An exception if comment can't be saved from post data.
636
+ */
637
+ private function comment_data_from_post( $post ) {
638
+ $thread = $post['threadData'];
639
+ $author = $post['author'];
640
+
641
+ $wp_post_id = null;
642
+
643
+ // Look up posts with the Disqus thread ID meta field.
644
+ $post_query = new WP_Query( array(
645
+ 'meta_key' => 'dsq_thread_id',
646
+ 'meta_value' => $thread['id'],
647
+ ) );
648
+
649
+ if ( $post_query->have_posts() ) {
650
+ $wp_post_id = $post_query->post->ID;
651
+ wp_reset_postdata();
652
+ }
653
+
654
+ // If that doesn't exist, get the and update the matching post metadata.
655
+ if ( null === $wp_post_id || false === $wp_post_id ) {
656
+ $identifiers = $thread['identifiers'];
657
+ $first_identifier = count( $identifiers ) > 0 ? $identifiers[0] : null;
658
+
659
+ if ( null !== $first_identifier ) {
660
+ $wp_post_id = explode( ' ', $first_identifier, 2 )[0];
661
+ }
662
+
663
+ // Keep the post's thread ID meta up to date.
664
+ update_post_meta( $wp_post_id, 'dsq_thread_id', $thread['id'] );
665
+ }
666
+
667
+ if ( null === $wp_post_id || false == $wp_post_id ) {
668
+ throw new Exception( 'No post found associated with the thread.' );
669
+ }
670
+
671
+ // Find the parent comment, if any.
672
+ $parent = 0;
673
+ if ( null !== $post['parent'] ) {
674
+ $parent_comment_query = new WP_Comment_Query( array(
675
+ 'meta_key' => 'dsq_post_id',
676
+ 'meta_value' => (string) $post['parent'],
677
+ 'number' => 1,
678
+ ) );
679
+ $parent_comments = $parent_comment_query->comments;
680
+
681
+ if ( empty( $parent_comments ) ) {
682
+ throw new Exception( 'This comment\'s parent has not been synced yet.' );
683
+ } else {
684
+ $parent = $parent_comments[0]->comment_ID;
685
+ }
686
+ }
687
+
688
+ // Email is a special permission for Disqus API applications and won't be present
689
+ // if the user has not set the permission for their API application.
690
+ $author_email = null;
691
+ if ( isset( $author['email'] ) ) {
692
+ $author_email = $author['email'];
693
+ } elseif ( $author['isAnonymous'] ) {
694
+ $author_email = 'anonymized-' . md5( $author['name'] ) . '@disqus.com';
695
+ } else {
696
+ $author_email = 'user-' . $author['id'] . '@disqus.com';
697
+ }
698
+
699
+ // Translate the comment approval state.
700
+ $comment_approved = 1;
701
+ if ( $post['isApproved'] && ! $post['isDeleted'] ) {
702
+ $comment_approved = 1;
703
+ } elseif ( $post['isDeleted'] ) {
704
+ $comment_approved = 0; // Deleted is not a state in WordPress, so we'll keep them in pending.
705
+ } elseif ( ! $post['isDeleted'] && ! $post['isSpam'] && ! $post['isApproved'] ) {
706
+ $comment_approved = 0;
707
+ } elseif ( $post['isSpam'] && ! $post['isApproved'] ) {
708
+ $comment_approved = 'spam';
709
+ }
710
+
711
+ return array(
712
+ 'comment_post_ID' => (int) $wp_post_id,
713
+ 'comment_author' => $author['name'],
714
+ 'comment_author_email' => $author_email,
715
+ 'comment_author_IP' => $post['ipAddress'],
716
+ 'comment_author_url' => isset( $author['url'] ) ? $author['url'] : '',
717
+ 'comment_content' => $post['raw_message'],
718
+ 'comment_date_gmt' => $post['createdAt'],
719
+ 'comment_type' => '', // Leave blank for a regular comment.
720
+ 'comment_parent' => $parent,
721
+ 'comment_agent' => 'Disqus Sync Host',
722
+ 'comment_approved' => $comment_approved,
723
+ 'comment_meta' => array(
724
+ 'dsq_post_id' => $post['id'],
725
+ ),
726
+ );
727
+ }
728
+
729
+ /**
730
+ * Stores the last sync log message with date/time appended.
731
+ *
732
+ * @since 3.0
733
+ * @access private
734
+ * @param string $message The base message to store.
735
+ */
736
+ private function log_sync_message( $message ) {
737
+ update_option( 'disqus_last_sync_message', $message . ': ' . date( 'Y-m-d g:i a', time() ) );
738
+ }
739
+
740
+ /**
741
+ * Outputs a list of comments to a WXR file for uploading to the Disqus importer.
742
+ *
743
+ * @since 3.0
744
+ * @access private
745
+ * @param WP_Post $post The post details the comments belong to.
746
+ * @param array $comments The base message to store.
747
+ * @return string The WXR document as a string.
748
+ */
749
+ private function generate_export_wxr( $post, $comments ) {
750
+
751
+ $post_author = get_userdata( $post->post_author );
752
+
753
+ $xml = new DOMDocument( '1.0', get_bloginfo( 'charset' ) );
754
+
755
+ $rss = $xml->createElement( 'rss' );
756
+ $rss->setAttribute( 'version', '2.0' );
757
+ $rss->setAttributeNS(
758
+ 'http://www.w3.org/2000/xmlns/',
759
+ 'xmlns:excerpt',
760
+ 'http://wordpress.org/export/1.0/excerpt/'
761
+ );
762
+ $rss->setAttributeNS(
763
+ 'http://www.w3.org/2000/xmlns/',
764
+ 'xmlns:content',
765
+ 'http://purl.org/rss/1.0/modules/content/'
766
+ );
767
+ $rss->setAttributeNS(
768
+ 'http://www.w3.org/2000/xmlns/',
769
+ 'xmlns:dsq',
770
+ 'https://disqus.com/'
771
+ );
772
+ $rss->setAttributeNS(
773
+ 'http://www.w3.org/2000/xmlns/',
774
+ 'xmlns:wfw',
775
+ 'http://wellformedweb.org/CommentAPI/'
776
+ );
777
+ $rss->setAttributeNS(
778
+ 'http://www.w3.org/2000/xmlns/',
779
+ 'xmlns:dc',
780
+ 'http://purl.org/dc/elements/1.1/'
781
+ );
782
+ $rss->setAttributeNS(
783
+ 'http://www.w3.org/2000/xmlns/',
784
+ 'xmlns:wp',
785
+ 'http://wordpress.org/export/1.0/'
786
+ );
787
+
788
+ $channel = $xml->createElement( 'channel' );
789
+ $channel->appendChild( $xml->createElement( 'title', get_bloginfo_rss( 'name' ) ) );
790
+ $channel->appendChild( $xml->createElement( 'link', get_bloginfo_rss( 'url' ) ) );
791
+ $channel->appendChild(
792
+ $xml->createElement(
793
+ 'pubDate',
794
+ mysql2date( 'D, d M Y H:i:s +0000', get_lastpostmodified( 'GMT' ), false )
795
+ )
796
+ );
797
+ $channel->appendChild(
798
+ $xml->createElement(
799
+ 'generator',
800
+ 'WordPress ' . get_bloginfo_rss( 'version' ) . '; Disqus ' . $this->version
801
+ )
802
+ );
803
+
804
+ // Generate the item (the post).
805
+ $item = $xml->createElement( 'item' );
806
+ $item->appendChild(
807
+ $xml->createElement( 'title', apply_filters( 'the_title_rss', $post->post_title ) )
808
+ );
809
+ $item->appendChild(
810
+ $xml->createElement(
811
+ 'link',
812
+ esc_url( apply_filters( 'the_permalink_rss', get_permalink( $post->ID ) ) )
813
+ )
814
+ );
815
+ $item->appendChild(
816
+ $xml->createElement(
817
+ 'pubDate',
818
+ mysql2date( 'D, d M Y H:i:s +0000', get_post_time( 'Y-m-d H:i:s', true, $post ), false )
819
+ )
820
+ );
821
+
822
+ $author_name_cdata = $xml->createCDATASection( $post_author->display_name );
823
+ $author_name_element = $xml->createElement( 'dc:creator' );
824
+ $author_name_element->appendChild( $author_name_cdata );
825
+ $item->appendChild( $author_name_element );
826
+
827
+ $guid = $xml->createElement( 'guid', $post->guid );
828
+ $guid->setAttribute( 'isPermalink', 'false' );
829
+ $item->appendChild( $guid );
830
+
831
+ $post_content_cdata = $xml->createCDATASection( apply_filters( 'the_content_export', $post->post_content ) );
832
+ $post_content_element = $xml->createElement( 'content:encoded' );
833
+ $post_content_element->appendChild( $post_content_cdata );
834
+ $item->appendChild( $post_content_element );
835
+
836
+ $identifier_cdata = $xml->createCDATASection( $post->ID . ' ' . $post->guid );
837
+ $identifier_element = $xml->createElement( 'dsq:thread_identifier' );
838
+ $identifier_element->appendChild( $identifier_cdata );
839
+ $item->appendChild( $identifier_element );
840
+
841
+ $item->appendChild(
842
+ $xml->createElement(
843
+ 'wp:post_id',
844
+ $post->ID
845
+ )
846
+ );
847
+
848
+ $item->appendChild(
849
+ $xml->createElement(
850
+ 'wp:post_date_gmt',
851
+ $post->post_date_gmt
852
+ )
853
+ );
854
+
855
+ $item->appendChild(
856
+ $xml->createElement(
857
+ 'wp:comment_status',
858
+ $post->comment_status
859
+ )
860
+ );
861
+
862
+ foreach ( $comments as $c ) {
863
+
864
+ $wpcomment = $xml->createElement( 'wp:comment' );
865
+
866
+ $wpcomment->appendChild(
867
+ $xml->createElement(
868
+ 'wp:comment_id',
869
+ $c->comment_ID
870
+ )
871
+ );
872
+
873
+ $comment_author_name_cdata = $xml->createCDATASection( $c->comment_author );
874
+ $comment_author_name_element = $xml->createElement( 'wp:comment_author' );
875
+ $comment_author_name_element->appendChild( $comment_author_name_cdata );
876
+ $wpcomment->appendChild( $comment_author_name_element );
877
+
878
+ $wpcomment->appendChild(
879
+ $xml->createElement(
880
+ 'wp:comment_author_email',
881
+ $c->comment_author_email
882
+ )
883
+ );
884
+
885
+ $wpcomment->appendChild(
886
+ $xml->createElement(
887
+ 'wp:comment_author_url',
888
+ $c->comment_author_url
889
+ )
890
+ );
891
+
892
+ $wpcomment->appendChild(
893
+ $xml->createElement(
894
+ 'wp:comment_author_IP',
895
+ $c->comment_author_IP
896
+ )
897
+ );
898
+
899
+ $wpcomment->appendChild(
900
+ $xml->createElement(
901
+ 'wp:comment_date',
902
+ $c->comment_date
903
+ )
904
+ );
905
+
906
+ $wpcomment->appendChild(
907
+ $xml->createElement(
908
+ 'wp:comment_date_gmt',
909
+ $c->comment_date_gmt
910
+ )
911
+ );
912
+
913
+ $comment_content_cdata = $xml->createCDATASection( $c->comment_content );
914
+ $comment_content_element = $xml->createElement( 'wp:comment_content' );
915
+ $comment_content_element->appendChild( $comment_content_cdata );
916
+ $wpcomment->appendChild( $comment_content_element );
917
+
918
+ $wpcomment->appendChild(
919
+ $xml->createElement(
920
+ 'wp:comment_approved',
921
+ $c->comment_approved
922
+ )
923
+ );
924
+
925
+ $wpcomment->appendChild(
926
+ $xml->createElement(
927
+ 'wp:comment_type',
928
+ $c->comment_type
929
+ )
930
+ );
931
+
932
+ $wpcomment->appendChild(
933
+ $xml->createElement(
934
+ 'wp:comment_parent',
935
+ $c->comment_parent
936
+ )
937
+ );
938
+
939
+ $item->appendChild( $wpcomment );
940
+ }
941
+
942
+ // Append the post item to the channel.
943
+ $channel->appendChild( $item );
944
+
945
+ // Append the root channel to the RSS element.
946
+ $rss->appendChild( $channel );
947
+
948
+ // Finally append the root RSS element to the XML document.
949
+ $xml->appendChild( $rss );
950
+
951
+ $wxr = $xml->saveXML();
952
+
953
+ return $wxr;
954
+ }
955
+
956
+ /**
957
+ * Returns the schema for the Disqus admin settings REST endpoint.
958
+ *
959
+ * @since 3.0
960
+ * @access private
961
+ * @return array The REST schema.
962
+ */
963
+ private function dsq_get_settings_schema() {
964
+ return array(
965
+ // This tells the spec of JSON Schema we are using which is draft 4.
966
+ '$schema' => 'http://json-schema.org/draft-04/schema#',
967
+ // The title property marks the identity of the resource.
968
+ 'title' => 'settings',
969
+ 'type' => 'object',
970
+ // In JSON Schema you can specify object properties in the properties attribute.
971
+ 'properties' => array(
972
+ 'disqus_forum_url' => array(
973
+ 'description' => 'Your site\'s unique identifier',
974
+ 'type' => 'string',
975
+ 'readonly' => false,
976
+ ),
977
+ 'disqus_sso_enabled' => array(
978
+ 'description' => 'This will enable Single Sign-on for this site, if already enabled for your Disqus organization.',
979
+ 'type' => 'boolean',
980
+ 'readonly' => false,
981
+ ),
982
+ 'disqus_public_key' => array(
983
+ 'description' => 'The public key of your application.',
984
+ 'type' => 'string',
985
+ 'readonly' => false,
986
+ ),
987
+ 'disqus_secret_key' => array(
988
+ 'description' => 'The secret key of your application.',
989
+ 'type' => 'string',
990
+ 'readonly' => false,
991
+ ),
992
+ 'disqus_admin_access_token' => array(
993
+ 'description' => 'The primary admin\'s access token for your application.',
994
+ 'type' => 'string',
995
+ 'readonly' => false,
996
+ ),
997
+ 'disqus_sso_button' => array(
998
+ 'description' => 'A link to a .png, .gif, or .jpg image to show as a button in Disqus.',
999
+ 'type' => 'string',
1000
+ 'readonly' => false,
1001
+ ),
1002
+ 'disqus_sync_token' => array(
1003
+ 'description' => 'The shared secret token for data sync between Disqus and the plugin.',
1004
+ 'type' => 'string',
1005
+ 'readonly' => true,
1006
+ ),
1007
+ 'disqus_installed' => array(
1008
+ 'description' => 'The shared secret token for data sync between Disqus and the plugin.',
1009
+ 'type' => 'boolean',
1010
+ 'readonly' => true,
1011
+ ),
1012
+ ),
1013
+ );
1014
+ }
1015
+ }
rest-api/index.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ // Silence is golden.
scripts/export-comments.php DELETED
@@ -1,106 +0,0 @@
1
- #!/usr/bin/php
2
- <?php
3
- /**
4
- * Incrementally (in chunks of EXPORT_CHUNK_SIZE) exports all comments to DISQUS.
5
- *
6
- * ``php export-comments.php``
7
- */
8
-
9
- require_once(dirname(__FILE__) . '/../lib/wp-cli.php');
10
- require_once(dirname(__FILE__) . '/../disqus.php');
11
- require_once(dirname(__FILE__) . '/../export.php');
12
-
13
- define('EXPORT_CHUNK_SIZE', 100);
14
-
15
- $forum_url = get_option('disqus_forum_url');
16
-
17
- if (empty($forum_url)) {
18
- print_line("Disqus has not been configured on this installation!");
19
- die();
20
- }
21
-
22
- print_line('---------------------------------------------------------');
23
- print_line('Discovered DISQUS forum shortname as %s', $forum_url);
24
- print_line('---------------------------------------------------------');
25
-
26
- global $wpdb, $dsq_api;
27
-
28
- $timestamp = 0;
29
- $post_id = 0;
30
- $total = 0;
31
- $eof = 0;
32
- $total_exported = 0;
33
- $global_start = microtime();
34
-
35
- $max_post_id = $wpdb->get_var($wpdb->prepare("
36
- SELECT MAX(ID)
37
- FROM $wpdb->posts
38
- WHERE post_type != 'revision'
39
- AND post_status = 'publish'
40
- AND comment_count > 0
41
- AND ID > %d
42
- ", $post_id));
43
-
44
- print_line('Max post id is %d', $max_post_id);
45
-
46
- while ($post_id < $max_post_id) {
47
- $start = microtime();
48
-
49
- $post = $wpdb->get_results($wpdb->prepare("
50
- SELECT *
51
- FROM $wpdb->posts
52
- WHERE post_type != 'revision'
53
- AND post_status = 'publish'
54
- AND comment_count > 0
55
- AND ID > %d
56
- ORDER BY ID ASC
57
- LIMIT 1
58
- ", $post_id));
59
- $post = $post[0];
60
- $post_id = $post->ID;
61
-
62
- print_line(' Exporting comments for post id %d', $post_id);
63
-
64
- $response = null;
65
- $query = $wpdb->get_results( $wpdb->prepare("SELECT COUNT(*) as total FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_agent NOT LIKE 'Disqus/%%' LIMIT ".EXPORT_CHUNK_SIZE, $post_id) );
66
- $total_comments = $query[0]->total;
67
-
68
- $comments = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_agent NOT LIKE 'Disqus/%%' LIMIT ".EXPORT_CHUNK_SIZE, $post_id) );
69
- $group_id = null;
70
- $at = 0;
71
-
72
- // we need to send empty files to ensure EOF happens
73
- while (($at === 0 && $post_id == $max_post_id) || $at < $total_comments) {
74
- if ($post_id == $max_post_id && ($at + EXPORT_CHUNK_SIZE) >= $total_comments) {
75
- $eof = 1;
76
- }
77
- $wxr = dsq_export_wp($post, $comments);
78
- $response = $dsq_api->import_wordpress_comments($wxr, $timestamp, $eof);
79
- if (!($response['group_id'] > 0)) {
80
- print_line('---------------------------------------------------------');
81
- print_line('There was an error communicating with DISQUS!');
82
- print_line($dsq_api->get_last_error());
83
- print_line('---------------------------------------------------------');
84
- }
85
- $group_id = $response['group_id'];
86
- print_line(' %d comments exported', count($comments), $time);
87
- $total_exported += count($comments);
88
- $at += EXPORT_CHUNK_SIZE;
89
- $comments = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_agent NOT LIKE 'Disqus/%%' LIMIT ".EXPORT_CHUNK_SIZE." OFFSET {$at}", $post->ID) );
90
- // assuming the cache is the internal, reset it's value to empty to avoid
91
- // large memory consumption
92
- $wp_object_cache->cache = array();
93
- }
94
-
95
- $time = abs(microtime() - $start);
96
- print_line(' Done! (took %.2fs)', $time);
97
- }
98
- $total_time = abs(microtime() - $global_start);
99
- print_line('---------------------------------------------------------');
100
- print_line('Done (processing took %.2fs)! %d comments were sent to DISQUS', $total_time, $total_exported);
101
- if ($group_id) {
102
- print_line('');
103
- print_line('Status available at https://import.disqus.com/group/%d/', $group_id);
104
- }
105
- print_line('---------------------------------------------------------');
106
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
scripts/import-comments.php DELETED
@@ -1,63 +0,0 @@
1
- #!/usr/bin/php
2
- <?php
3
- /**
4
- * Incrementally downloads all comments from DISQUS.
5
- *
6
- * ``php import-comments.php``
7
- */
8
-
9
- require_once(dirname(__FILE__) . '/../lib/wp-cli.php');
10
- require_once(dirname(__FILE__) . '/../disqus.php');
11
-
12
- $forum_url = get_option('disqus_forum_url');
13
-
14
- if (empty($forum_url)) {
15
- print_line("Disqus has not been configured on this installation!");
16
- die();
17
- }
18
-
19
- print_line('---------------------------------------------------------');
20
- print_line('Discovered DISQUS forum shortname as %s', $forum_url);
21
- print_line('---------------------------------------------------------');
22
-
23
- $imported = true;
24
- if (in_array('--reset', $argv)) {
25
- $last_comment_id = 0;
26
- } else {
27
- $last_comment_id = get_option('disqus_last_comment_id');
28
- }
29
- $force = (in_array('--force', $argv));
30
- $total = 0;
31
- $global_start = microtime();
32
-
33
- $memory_usage = memory_get_peak_usage();
34
- while ($imported) {
35
- print_line(' Importing chunk starting at comment id %d', $last_comment_id);
36
- $start = microtime();
37
- $result = dsq_sync_forum($last_comment_id, $force);
38
- if ($result === false) {
39
- print_line('---------------------------------------------------------');
40
- print_line('There was an error communicating with DISQUS!');
41
- print_line($dsq_api->get_last_error());
42
- print_line('---------------------------------------------------------');
43
- die();
44
- break;
45
- } else {
46
- list($imported, $last_comment_id) = $result;
47
- }
48
- $total += $imported;
49
- $time = abs(microtime() - $start);
50
-
51
- // assuming the cache is the internal, reset it's value to empty to avoid
52
- // large memory consump
53
- $wp_object_cache->cache = array();
54
-
55
- $new_memory_usage = memory_get_peak_usage();
56
- print_line(' %d comments imported (took %.2fs, memory increased by %db)', $imported, $time, ($new_memory_usage - $memory_usage));
57
- $memory_usage = $new_memory_usage;
58
- }
59
- $total_time = abs(microtime() - $global_start);
60
- print_line('---------------------------------------------------------');
61
- print_line('Done (took %.2fs)! %d comments imported from DISQUS', $total_time, $total);
62
- print_line('---------------------------------------------------------');
63
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/initial.sql DELETED
@@ -1,380 +0,0 @@
1
- -- MySQL dump 10.13 Distrib 5.1.48, for apple-darwin10.4.0 (i386)
2
- --
3
- -- Host: localhost Database: wordpress
4
- -- ------------------------------------------------------
5
- -- Server version 5.1.48
6
-
7
- /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8
- /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9
- /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10
- /*!40101 SET NAMES utf8 */;
11
- /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
12
- /*!40103 SET TIME_ZONE='+00:00' */;
13
- /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
14
- /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
15
- /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
16
- /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
17
-
18
- --
19
- -- Table structure for table `wp_commentmeta`
20
- --
21
-
22
- DROP TABLE IF EXISTS `wp_commentmeta`;
23
- /*!40101 SET @saved_cs_client = @@character_set_client */;
24
- /*!40101 SET character_set_client = utf8 */;
25
- CREATE TABLE `wp_commentmeta` (
26
- `meta_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
27
- `comment_id` bigint(20) unsigned NOT NULL DEFAULT '0',
28
- `meta_key` varchar(255) DEFAULT NULL,
29
- `meta_value` longtext,
30
- PRIMARY KEY (`meta_id`),
31
- KEY `comment_id` (`comment_id`),
32
- KEY `meta_key` (`meta_key`)
33
- ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
34
- /*!40101 SET character_set_client = @saved_cs_client */;
35
-
36
- --
37
- -- Dumping data for table `wp_commentmeta`
38
- --
39
-
40
- LOCK TABLES `wp_commentmeta` WRITE;
41
- /*!40000 ALTER TABLE `wp_commentmeta` DISABLE KEYS */;
42
- /*!40000 ALTER TABLE `wp_commentmeta` ENABLE KEYS */;
43
- UNLOCK TABLES;
44
-
45
- --
46
- -- Table structure for table `wp_comments`
47
- --
48
-
49
- DROP TABLE IF EXISTS `wp_comments`;
50
- /*!40101 SET @saved_cs_client = @@character_set_client */;
51
- /*!40101 SET character_set_client = utf8 */;
52
- CREATE TABLE `wp_comments` (
53
- `comment_ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
54
- `comment_post_ID` bigint(20) unsigned NOT NULL DEFAULT '0',
55
- `comment_author` tinytext NOT NULL,
56
- `comment_author_email` varchar(100) NOT NULL DEFAULT '',
57
- `comment_author_url` varchar(200) NOT NULL DEFAULT '',
58
- `comment_author_IP` varchar(100) NOT NULL DEFAULT '',
59
- `comment_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
60
- `comment_date_gmt` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
61
- `comment_content` text NOT NULL,
62
- `comment_karma` int(11) NOT NULL DEFAULT '0',
63
- `comment_approved` varchar(20) NOT NULL DEFAULT '1',
64
- `comment_agent` varchar(255) NOT NULL DEFAULT '',
65
- `comment_type` varchar(20) NOT NULL DEFAULT '',
66
- `comment_parent` bigint(20) unsigned NOT NULL DEFAULT '0',
67
- `user_id` bigint(20) unsigned NOT NULL DEFAULT '0',
68
- PRIMARY KEY (`comment_ID`),
69
- KEY `comment_approved` (`comment_approved`),
70
- KEY `comment_post_ID` (`comment_post_ID`),
71
- KEY `comment_approved_date_gmt` (`comment_approved`,`comment_date_gmt`),
72
- KEY `comment_date_gmt` (`comment_date_gmt`)
73
- ) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
74
- /*!40101 SET character_set_client = @saved_cs_client */;
75
-
76
- --
77
- -- Dumping data for table `wp_comments`
78
- --
79
-
80
- LOCK TABLES `wp_comments` WRITE;
81
- /*!40000 ALTER TABLE `wp_comments` DISABLE KEYS */;
82
- INSERT INTO `wp_comments` VALUES (1,1,'Mr WordPress','','http://wordpress.org/','','2010-06-08 01:27:22','2010-06-08 01:27:22','Hi, this is a comment.<br />To delete a comment, just log in and view the post&#039;s comments. There you will have the option to edit or delete them.',0,'1','','',0,0),(2,1,'dcramer','dcramer@gmail.com','','127.0.0.1','2010-06-08 01:32:37','2010-06-08 06:32:37','Testing',0,'1','Disqus/1.0:47','',0,0),(3,1,'David Cramer','dcramer@gmail.com','http://www.davidcramer.net','127.0.0.1','2010-06-08 17:15:14','2010-06-08 22:15:14','Here&#39;s one more test',0,'1','Disqus/1.0:48','',0,0);
83
- /*!40000 ALTER TABLE `wp_comments` ENABLE KEYS */;
84
- UNLOCK TABLES;
85
-
86
- --
87
- -- Table structure for table `wp_links`
88
- --
89
-
90
- DROP TABLE IF EXISTS `wp_links`;
91
- /*!40101 SET @saved_cs_client = @@character_set_client */;
92
- /*!40101 SET character_set_client = utf8 */;
93
- CREATE TABLE `wp_links` (
94
- `link_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
95
- `link_url` varchar(255) NOT NULL DEFAULT '',
96
- `link_name` varchar(255) NOT NULL DEFAULT '',
97
- `link_image` varchar(255) NOT NULL DEFAULT '',
98
- `link_target` varchar(25) NOT NULL DEFAULT '',
99
- `link_description` varchar(255) NOT NULL DEFAULT '',
100
- `link_visible` varchar(20) NOT NULL DEFAULT 'Y',
101
- `link_owner` bigint(20) unsigned NOT NULL DEFAULT '1',
102
- `link_rating` int(11) NOT NULL DEFAULT '0',
103
- `link_updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
104
- `link_rel` varchar(255) NOT NULL DEFAULT '',
105
- `link_notes` mediumtext NOT NULL,
106
- `link_rss` varchar(255) NOT NULL DEFAULT '',
107
- PRIMARY KEY (`link_id`),
108
- KEY `link_visible` (`link_visible`)
109
- ) ENGINE=MyISAM AUTO_INCREMENT=8 DEFAULT CHARSET=utf8;
110
- /*!40101 SET character_set_client = @saved_cs_client */;
111
-
112
- --
113
- -- Dumping data for table `wp_links`
114
- --
115
-
116
- LOCK TABLES `wp_links` WRITE;
117
- /*!40000 ALTER TABLE `wp_links` DISABLE KEYS */;
118
- INSERT INTO `wp_links` VALUES (1,'http://codex.wordpress.org/','Documentation','','','','Y',1,0,'0000-00-00 00:00:00','','',''),(2,'http://wordpress.org/development/','Development Blog','','','','Y',1,0,'0000-00-00 00:00:00','','','http://wordpress.org/development/feed/'),(3,'http://wordpress.org/extend/ideas/','Suggest Ideas','','','','Y',1,0,'0000-00-00 00:00:00','','',''),(4,'http://wordpress.org/support/','Support Forum','','','','Y',1,0,'0000-00-00 00:00:00','','',''),(5,'http://wordpress.org/extend/plugins/','Plugins','','','','Y',1,0,'0000-00-00 00:00:00','','',''),(6,'http://wordpress.org/extend/themes/','Themes','','','','Y',1,0,'0000-00-00 00:00:00','','',''),(7,'http://planet.wordpress.org/','WordPress Planet','','','','Y',1,0,'0000-00-00 00:00:00','','','');
119
- /*!40000 ALTER TABLE `wp_links` ENABLE KEYS */;
120
- UNLOCK TABLES;
121
-
122
- --
123
- -- Table structure for table `wp_options`
124
- --
125
-
126
- DROP TABLE IF EXISTS `wp_options`;
127
- /*!40101 SET @saved_cs_client = @@character_set_client */;
128
- /*!40101 SET character_set_client = utf8 */;
129
- CREATE TABLE `wp_options` (
130
- `option_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
131
- `blog_id` int(11) NOT NULL DEFAULT '0',
132
- `option_name` varchar(64) NOT NULL DEFAULT '',
133
- `option_value` longtext NOT NULL,
134
- `autoload` varchar(20) NOT NULL DEFAULT 'yes',
135
- PRIMARY KEY (`option_id`),
136
- UNIQUE KEY `option_name` (`option_name`)
137
- ) ENGINE=MyISAM AUTO_INCREMENT=192 DEFAULT CHARSET=utf8;
138
- /*!40101 SET character_set_client = @saved_cs_client */;
139
-
140
- --
141
- -- Dumping data for table `wp_options`
142
- --
143
-
144
- LOCK TABLES `wp_options` WRITE;
145
- /*!40000 ALTER TABLE `wp_options` DISABLE KEYS */;
146
- INSERT INTO `wp_options` VALUES (1,0,'_transient_random_seed','e69b4e983acc5f314184ba789733f808','yes'),(2,0,'siteurl','http://localhost/~dcramer/wordpress-2.9','yes'),(3,0,'blogname','WordPress 2.9','yes'),(4,0,'blogdescription','Just another WordPress weblog','yes'),(5,0,'users_can_register','0','yes'),(6,0,'admin_email','dcramer@gmail.com','yes'),(7,0,'start_of_week','1','yes'),(8,0,'use_balanceTags','0','yes'),(9,0,'use_smilies','1','yes'),(10,0,'require_name_email','1','yes'),(11,0,'comments_notify','1','yes'),(12,0,'posts_per_rss','10','yes'),(13,0,'rss_use_excerpt','0','yes'),(14,0,'mailserver_url','mail.example.com','yes'),(15,0,'mailserver_login','login@example.com','yes'),(16,0,'mailserver_pass','password','yes'),(17,0,'mailserver_port','110','yes'),(18,0,'default_category','1','yes'),(19,0,'default_comment_status','open','yes'),(20,0,'default_ping_status','open','yes'),(21,0,'default_pingback_flag','1','yes'),(22,0,'default_post_edit_rows','10','yes'),(23,0,'posts_per_page','10','yes'),(24,0,'date_format','F j, Y','yes'),(25,0,'time_format','g:i a','yes'),(26,0,'links_updated_date_format','F j, Y g:i a','yes'),(27,0,'links_recently_updated_prepend','<em>','yes'),(28,0,'links_recently_updated_append','</em>','yes'),(29,0,'links_recently_updated_time','120','yes'),(30,0,'comment_moderation','0','yes'),(31,0,'moderation_notify','1','yes'),(32,0,'permalink_structure','','yes'),(33,0,'gzipcompression','0','yes'),(34,0,'hack_file','0','yes'),(35,0,'blog_charset','UTF-8','yes'),(36,0,'moderation_keys','','no'),(37,0,'active_plugins','a:1:{i:0;s:17:\"disqus/disqus.php\";}','yes'),(38,0,'home','http://localhost/~dcramer/wordpress-2.9','yes'),(39,0,'category_base','','yes'),(40,0,'ping_sites','http://rpc.pingomatic.com/','yes'),(41,0,'advanced_edit','0','yes'),(42,0,'comment_max_links','2','yes'),(43,0,'gmt_offset','0','yes'),(44,0,'default_email_category','1','yes'),(45,0,'recently_edited','','no'),(46,0,'use_linksupdate','0','yes'),(47,0,'template','default','yes'),(48,0,'stylesheet','default','yes'),(49,0,'comment_whitelist','1','yes'),(50,0,'blacklist_keys','','no'),(51,0,'comment_registration','0','yes'),(52,0,'rss_language','en','yes'),(53,0,'html_type','text/html','yes'),(54,0,'use_trackback','0','yes'),(55,0,'default_role','subscriber','yes'),(56,0,'db_version','12329','yes'),(57,0,'uploads_use_yearmonth_folders','1','yes'),(58,0,'upload_path','','yes'),(59,0,'secret','^mmMx31fC%rXXK&%a*CQz$GcUHt@rEWY8w)B9GFwQ@cwRzOyKs)e)l!)h%XPlaH$','yes'),(60,0,'blog_public','1','yes'),(61,0,'default_link_category','2','yes'),(62,0,'show_on_front','posts','yes'),(63,0,'tag_base','','yes'),(64,0,'show_avatars','1','yes'),(65,0,'avatar_rating','G','yes'),(66,0,'upload_url_path','','yes'),(67,0,'thumbnail_size_w','150','yes'),(68,0,'thumbnail_size_h','150','yes'),(69,0,'thumbnail_crop','1','yes'),(70,0,'medium_size_w','300','yes'),(71,0,'medium_size_h','300','yes'),(72,0,'avatar_default','mystery','yes'),(73,0,'enable_app','0','yes'),(74,0,'enable_xmlrpc','0','yes'),(75,0,'large_size_w','1024','yes'),(76,0,'large_size_h','1024','yes'),(77,0,'image_default_link_type','file','yes'),(78,0,'image_default_size','','yes'),(79,0,'image_default_align','','yes'),(80,0,'close_comments_for_old_posts','0','yes'),(81,0,'close_comments_days_old','14','yes'),(82,0,'thread_comments','0','yes'),(83,0,'thread_comments_depth','5','yes'),(84,0,'page_comments','1','yes'),(85,0,'comments_per_page','50','yes'),(86,0,'default_comments_page','newest','yes'),(87,0,'comment_order','asc','yes'),(88,0,'sticky_posts','a:0:{}','yes'),(89,0,'widget_categories','a:2:{i:2;a:0:{}s:12:\"_multiwidget\";i:1;}','yes'),(90,0,'widget_text','a:2:{i:2;a:0:{}s:12:\"_multiwidget\";i:1;}','yes'),(91,0,'widget_rss','a:2:{i:2;a:0:{}s:12:\"_multiwidget\";i:1;}','yes'),(92,0,'timezone_string','','yes'),(93,0,'embed_autourls','1','yes'),(94,0,'embed_size_w','','yes'),(95,0,'embed_size_h','600','yes'),(96,0,'wp_user_roles','a:5:{s:13:\"administrator\";a:2:{s:4:\"name\";s:13:\"Administrator\";s:12:\"capabilities\";a:54:{s:13:\"switch_themes\";b:1;s:11:\"edit_themes\";b:1;s:16:\"activate_plugins\";b:1;s:12:\"edit_plugins\";b:1;s:10:\"edit_users\";b:1;s:10:\"edit_files\";b:1;s:14:\"manage_options\";b:1;s:17:\"moderate_comments\";b:1;s:17:\"manage_categories\";b:1;s:12:\"manage_links\";b:1;s:12:\"upload_files\";b:1;s:6:\"import\";b:1;s:15:\"unfiltered_html\";b:1;s:10:\"edit_posts\";b:1;s:17:\"edit_others_posts\";b:1;s:20:\"edit_published_posts\";b:1;s:13:\"publish_posts\";b:1;s:10:\"edit_pages\";b:1;s:4:\"read\";b:1;s:8:\"level_10\";b:1;s:7:\"level_9\";b:1;s:7:\"level_8\";b:1;s:7:\"level_7\";b:1;s:7:\"level_6\";b:1;s:7:\"level_5\";b:1;s:7:\"level_4\";b:1;s:7:\"level_3\";b:1;s:7:\"level_2\";b:1;s:7:\"level_1\";b:1;s:7:\"level_0\";b:1;s:17:\"edit_others_pages\";b:1;s:20:\"edit_published_pages\";b:1;s:13:\"publish_pages\";b:1;s:12:\"delete_pages\";b:1;s:19:\"delete_others_pages\";b:1;s:22:\"delete_published_pages\";b:1;s:12:\"delete_posts\";b:1;s:19:\"delete_others_posts\";b:1;s:22:\"delete_published_posts\";b:1;s:20:\"delete_private_posts\";b:1;s:18:\"edit_private_posts\";b:1;s:18:\"read_private_posts\";b:1;s:20:\"delete_private_pages\";b:1;s:18:\"edit_private_pages\";b:1;s:18:\"read_private_pages\";b:1;s:12:\"delete_users\";b:1;s:12:\"create_users\";b:1;s:17:\"unfiltered_upload\";b:1;s:14:\"edit_dashboard\";b:1;s:14:\"update_plugins\";b:1;s:14:\"delete_plugins\";b:1;s:15:\"install_plugins\";b:1;s:13:\"update_themes\";b:1;s:14:\"install_themes\";b:1;}}s:6:\"editor\";a:2:{s:4:\"name\";s:6:\"Editor\";s:12:\"capabilities\";a:34:{s:17:\"moderate_comments\";b:1;s:17:\"manage_categories\";b:1;s:12:\"manage_links\";b:1;s:12:\"upload_files\";b:1;s:15:\"unfiltered_html\";b:1;s:10:\"edit_posts\";b:1;s:17:\"edit_others_posts\";b:1;s:20:\"edit_published_posts\";b:1;s:13:\"publish_posts\";b:1;s:10:\"edit_pages\";b:1;s:4:\"read\";b:1;s:7:\"level_7\";b:1;s:7:\"level_6\";b:1;s:7:\"level_5\";b:1;s:7:\"level_4\";b:1;s:7:\"level_3\";b:1;s:7:\"level_2\";b:1;s:7:\"level_1\";b:1;s:7:\"level_0\";b:1;s:17:\"edit_others_pages\";b:1;s:20:\"edit_published_pages\";b:1;s:13:\"publish_pages\";b:1;s:12:\"delete_pages\";b:1;s:19:\"delete_others_pages\";b:1;s:22:\"delete_published_pages\";b:1;s:12:\"delete_posts\";b:1;s:19:\"delete_others_posts\";b:1;s:22:\"delete_published_posts\";b:1;s:20:\"delete_private_posts\";b:1;s:18:\"edit_private_posts\";b:1;s:18:\"read_private_posts\";b:1;s:20:\"delete_private_pages\";b:1;s:18:\"edit_private_pages\";b:1;s:18:\"read_private_pages\";b:1;}}s:6:\"author\";a:2:{s:4:\"name\";s:6:\"Author\";s:12:\"capabilities\";a:10:{s:12:\"upload_files\";b:1;s:10:\"edit_posts\";b:1;s:20:\"edit_published_posts\";b:1;s:13:\"publish_posts\";b:1;s:4:\"read\";b:1;s:7:\"level_2\";b:1;s:7:\"level_1\";b:1;s:7:\"level_0\";b:1;s:12:\"delete_posts\";b:1;s:22:\"delete_published_posts\";b:1;}}s:11:\"contributor\";a:2:{s:4:\"name\";s:11:\"Contributor\";s:12:\"capabilities\";a:5:{s:10:\"edit_posts\";b:1;s:4:\"read\";b:1;s:7:\"level_1\";b:1;s:7:\"level_0\";b:1;s:12:\"delete_posts\";b:1;}}s:10:\"subscriber\";a:2:{s:4:\"name\";s:10:\"Subscriber\";s:12:\"capabilities\";a:2:{s:4:\"read\";b:1;s:7:\"level_0\";b:1;}}}','yes'),(97,0,'cron','a:3:{i:1279200449;a:3:{s:16:\"wp_version_check\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:10:\"twicedaily\";s:4:\"args\";a:0:{}s:8:\"interval\";i:43200;}}s:17:\"wp_update_plugins\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:10:\"twicedaily\";s:4:\"args\";a:0:{}s:8:\"interval\";i:43200;}}s:16:\"wp_update_themes\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:10:\"twicedaily\";s:4:\"args\";a:0:{}s:8:\"interval\";i:43200;}}}i:1279243652;a:1:{s:19:\"wp_scheduled_delete\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:5:\"daily\";s:4:\"args\";a:0:{}s:8:\"interval\";i:86400;}}}s:7:\"version\";i:2;}','yes'),(116,0,'nonce_salt','dObGEka*P!EbxXdrZaB#cUr!z6e@R2TTz@EOFuylzcBCkw68F!MxntgHVx6wvHLX','yes'),(117,0,'current_theme','WordPress Default','yes'),(118,0,'can_compress_scripts','1','yes'),(145,0,'disqus_forum_url','davidcramer','yes'),(146,0,'disqus_partner_key','','yes'),(147,0,'disqus_replace','all','yes'),(148,0,'disqus_api_key','QwQ2JLakdGd95BZ8w6ixbwHrggCQh0KMYEnBri8Z4MU9ERQyhh7M5MUG8hRj6FoI','yes'),(191,0,'disqus_user_api_key','','yes');
147
- /*!40000 ALTER TABLE `wp_options` ENABLE KEYS */;
148
- UNLOCK TABLES;
149
-
150
- --
151
- -- Table structure for table `wp_postmeta`
152
- --
153
-
154
- DROP TABLE IF EXISTS `wp_postmeta`;
155
- /*!40101 SET @saved_cs_client = @@character_set_client */;
156
- /*!40101 SET character_set_client = utf8 */;
157
- CREATE TABLE `wp_postmeta` (
158
- `meta_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
159
- `post_id` bigint(20) unsigned NOT NULL DEFAULT '0',
160
- `meta_key` varchar(255) DEFAULT NULL,
161
- `meta_value` longtext,
162
- PRIMARY KEY (`meta_id`),
163
- KEY `post_id` (`post_id`),
164
- KEY `meta_key` (`meta_key`)
165
- ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
166
- /*!40101 SET character_set_client = @saved_cs_client */;
167
-
168
- --
169
- -- Dumping data for table `wp_postmeta`
170
- --
171
-
172
- LOCK TABLES `wp_postmeta` WRITE;
173
- /*!40000 ALTER TABLE `wp_postmeta` DISABLE KEYS */;
174
- /*!40000 ALTER TABLE `wp_postmeta` ENABLE KEYS */;
175
- UNLOCK TABLES;
176
-
177
- --
178
- -- Table structure for table `wp_posts`
179
- --
180
-
181
- DROP TABLE IF EXISTS `wp_posts`;
182
- /*!40101 SET @saved_cs_client = @@character_set_client */;
183
- /*!40101 SET character_set_client = utf8 */;
184
- CREATE TABLE `wp_posts` (
185
- `ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
186
- `post_author` bigint(20) unsigned NOT NULL DEFAULT '0',
187
- `post_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
188
- `post_date_gmt` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
189
- `post_content` longtext NOT NULL,
190
- `post_title` text NOT NULL,
191
- `post_excerpt` text NOT NULL,
192
- `post_status` varchar(20) NOT NULL DEFAULT 'publish',
193
- `comment_status` varchar(20) NOT NULL DEFAULT 'open',
194
- `ping_status` varchar(20) NOT NULL DEFAULT 'open',
195
- `post_password` varchar(20) NOT NULL DEFAULT '',
196
- `post_name` varchar(200) NOT NULL DEFAULT '',
197
- `to_ping` text NOT NULL,
198
- `pinged` text NOT NULL,
199
- `post_modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
200
- `post_modified_gmt` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
201
- `post_content_filtered` text NOT NULL,
202
- `post_parent` bigint(20) unsigned NOT NULL DEFAULT '0',
203
- `guid` varchar(255) NOT NULL DEFAULT '',
204
- `menu_order` int(11) NOT NULL DEFAULT '0',
205
- `post_type` varchar(20) NOT NULL DEFAULT 'post',
206
- `post_mime_type` varchar(100) NOT NULL DEFAULT '',
207
- `comment_count` bigint(20) NOT NULL DEFAULT '0',
208
- PRIMARY KEY (`ID`),
209
- KEY `post_name` (`post_name`),
210
- KEY `type_status_date` (`post_type`,`post_status`,`post_date`,`ID`),
211
- KEY `post_parent` (`post_parent`)
212
- ) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
213
- /*!40101 SET character_set_client = @saved_cs_client */;
214
-
215
- --
216
- -- Dumping data for table `wp_posts`
217
- --
218
-
219
- LOCK TABLES `wp_posts` WRITE;
220
- /*!40000 ALTER TABLE `wp_posts` DISABLE KEYS */;
221
- INSERT INTO `wp_posts` VALUES (1,1,'2010-06-08 01:27:22','2010-06-08 01:27:22','Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!','Hello world!','','publish','open','open','','hello-world','','','2010-06-08 01:27:22','2010-06-08 01:27:22','',0,'http://localhost/~dcramer/wordpress-2.9/?p=1',0,'post','',3),(2,1,'2010-06-08 01:27:22','2010-06-08 01:27:22','This is an example of a WordPress page, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages like this one or sub-pages as you like and manage all of your content inside of WordPress.','About','','publish','open','open','','about','','','2010-06-08 01:27:22','2010-06-08 01:27:22','',0,'http://localhost/~dcramer/wordpress-2.9/?page_id=2',0,'page','',0);
222
- /*!40000 ALTER TABLE `wp_posts` ENABLE KEYS */;
223
- UNLOCK TABLES;
224
-
225
- --
226
- -- Table structure for table `wp_term_relationships`
227
- --
228
-
229
- DROP TABLE IF EXISTS `wp_term_relationships`;
230
- /*!40101 SET @saved_cs_client = @@character_set_client */;
231
- /*!40101 SET character_set_client = utf8 */;
232
- CREATE TABLE `wp_term_relationships` (
233
- `object_id` bigint(20) unsigned NOT NULL DEFAULT '0',
234
- `term_taxonomy_id` bigint(20) unsigned NOT NULL DEFAULT '0',
235
- `term_order` int(11) NOT NULL DEFAULT '0',
236
- PRIMARY KEY (`object_id`,`term_taxonomy_id`),
237
- KEY `term_taxonomy_id` (`term_taxonomy_id`)
238
- ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
239
- /*!40101 SET character_set_client = @saved_cs_client */;
240
-
241
- --
242
- -- Dumping data for table `wp_term_relationships`
243
- --
244
-
245
- LOCK TABLES `wp_term_relationships` WRITE;
246
- /*!40000 ALTER TABLE `wp_term_relationships` DISABLE KEYS */;
247
- INSERT INTO `wp_term_relationships` VALUES (1,2,0),(2,2,0),(3,2,0),(4,2,0),(5,2,0),(6,2,0),(7,2,0),(1,1,0);
248
- /*!40000 ALTER TABLE `wp_term_relationships` ENABLE KEYS */;
249
- UNLOCK TABLES;
250
-
251
- --
252
- -- Table structure for table `wp_term_taxonomy`
253
- --
254
-
255
- DROP TABLE IF EXISTS `wp_term_taxonomy`;
256
- /*!40101 SET @saved_cs_client = @@character_set_client */;
257
- /*!40101 SET character_set_client = utf8 */;
258
- CREATE TABLE `wp_term_taxonomy` (
259
- `term_taxonomy_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
260
- `term_id` bigint(20) unsigned NOT NULL DEFAULT '0',
261
- `taxonomy` varchar(32) NOT NULL DEFAULT '',
262
- `description` longtext NOT NULL,
263
- `parent` bigint(20) unsigned NOT NULL DEFAULT '0',
264
- `count` bigint(20) NOT NULL DEFAULT '0',
265
- PRIMARY KEY (`term_taxonomy_id`),
266
- UNIQUE KEY `term_id_taxonomy` (`term_id`,`taxonomy`),
267
- KEY `taxonomy` (`taxonomy`)
268
- ) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
269
- /*!40101 SET character_set_client = @saved_cs_client */;
270
-
271
- --
272
- -- Dumping data for table `wp_term_taxonomy`
273
- --
274
-
275
- LOCK TABLES `wp_term_taxonomy` WRITE;
276
- /*!40000 ALTER TABLE `wp_term_taxonomy` DISABLE KEYS */;
277
- INSERT INTO `wp_term_taxonomy` VALUES (1,1,'category','',0,1),(2,2,'link_category','',0,7);
278
- /*!40000 ALTER TABLE `wp_term_taxonomy` ENABLE KEYS */;
279
- UNLOCK TABLES;
280
-
281
- --
282
- -- Table structure for table `wp_terms`
283
- --
284
-
285
- DROP TABLE IF EXISTS `wp_terms`;
286
- /*!40101 SET @saved_cs_client = @@character_set_client */;
287
- /*!40101 SET character_set_client = utf8 */;
288
- CREATE TABLE `wp_terms` (
289
- `term_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
290
- `name` varchar(200) NOT NULL DEFAULT '',
291
- `slug` varchar(200) NOT NULL DEFAULT '',
292
- `term_group` bigint(10) NOT NULL DEFAULT '0',
293
- PRIMARY KEY (`term_id`),
294
- UNIQUE KEY `slug` (`slug`),
295
- KEY `name` (`name`)
296
- ) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
297
- /*!40101 SET character_set_client = @saved_cs_client */;
298
-
299
- --
300
- -- Dumping data for table `wp_terms`
301
- --
302
-
303
- LOCK TABLES `wp_terms` WRITE;
304
- /*!40000 ALTER TABLE `wp_terms` DISABLE KEYS */;
305
- INSERT INTO `wp_terms` VALUES (1,'Uncategorized','uncategorized',0),(2,'Blogroll','blogroll',0);
306
- /*!40000 ALTER TABLE `wp_terms` ENABLE KEYS */;
307
- UNLOCK TABLES;
308
-
309
- --
310
- -- Table structure for table `wp_usermeta`
311
- --
312
-
313
- DROP TABLE IF EXISTS `wp_usermeta`;
314
- /*!40101 SET @saved_cs_client = @@character_set_client */;
315
- /*!40101 SET character_set_client = utf8 */;
316
- CREATE TABLE `wp_usermeta` (
317
- `umeta_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
318
- `user_id` bigint(20) unsigned NOT NULL DEFAULT '0',
319
- `meta_key` varchar(255) DEFAULT NULL,
320
- `meta_value` longtext,
321
- PRIMARY KEY (`umeta_id`),
322
- KEY `user_id` (`user_id`),
323
- KEY `meta_key` (`meta_key`)
324
- ) ENGINE=MyISAM AUTO_INCREMENT=8 DEFAULT CHARSET=utf8;
325
- /*!40101 SET character_set_client = @saved_cs_client */;
326
-
327
- --
328
- -- Dumping data for table `wp_usermeta`
329
- --
330
-
331
- LOCK TABLES `wp_usermeta` WRITE;
332
- /*!40000 ALTER TABLE `wp_usermeta` DISABLE KEYS */;
333
- INSERT INTO `wp_usermeta` VALUES (1,1,'nickname','admin'),(2,1,'rich_editing','true'),(3,1,'comment_shortcuts','false'),(4,1,'admin_color','fresh'),(5,1,'wp_capabilities','a:1:{s:13:\"administrator\";b:1;}'),(7,1,'wp_user_level','10');
334
- /*!40000 ALTER TABLE `wp_usermeta` ENABLE KEYS */;
335
- UNLOCK TABLES;
336
-
337
- --
338
- -- Table structure for table `wp_users`
339
- --
340
-
341
- DROP TABLE IF EXISTS `wp_users`;
342
- /*!40101 SET @saved_cs_client = @@character_set_client */;
343
- /*!40101 SET character_set_client = utf8 */;
344
- CREATE TABLE `wp_users` (
345
- `ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
346
- `user_login` varchar(60) NOT NULL DEFAULT '',
347
- `user_pass` varchar(64) NOT NULL DEFAULT '',
348
- `user_nicename` varchar(50) NOT NULL DEFAULT '',
349
- `user_email` varchar(100) NOT NULL DEFAULT '',
350
- `user_url` varchar(100) NOT NULL DEFAULT '',
351
- `user_registered` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
352
- `user_activation_key` varchar(60) NOT NULL DEFAULT '',
353
- `user_status` int(11) NOT NULL DEFAULT '0',
354
- `display_name` varchar(250) NOT NULL DEFAULT '',
355
- PRIMARY KEY (`ID`),
356
- KEY `user_login_key` (`user_login`),
357
- KEY `user_nicename` (`user_nicename`)
358
- ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
359
- /*!40101 SET character_set_client = @saved_cs_client */;
360
-
361
- --
362
- -- Dumping data for table `wp_users`
363
- --
364
-
365
- LOCK TABLES `wp_users` WRITE;
366
- /*!40000 ALTER TABLE `wp_users` DISABLE KEYS */;
367
- INSERT INTO `wp_users` VALUES (1,'admin','$P$BPK0.c48l9CzwhitsInt6VZcoLRKL6/','admin','dcramer@gmail.com','','2010-06-08 01:27:22','',0,'admin');
368
- /*!40000 ALTER TABLE `wp_users` ENABLE KEYS */;
369
- UNLOCK TABLES;
370
- /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
371
-
372
- /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
373
- /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
374
- /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
375
- /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
376
- /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
377
- /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
378
- /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
379
-
380
- -- Dump completed on 2011-02-01 13:39:37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/tests.php DELETED
@@ -1,128 +0,0 @@
1
- <?php
2
-
3
- require_once(dirname(__FILE__) . '/../lib/wp-cli.php');
4
- require_once(dirname(__FILE__) . '/../disqus.php');
5
-
6
- require_once('PHPUnit/Autoload.php');
7
-
8
- if (!defined('DISQUS_TEST_DATABASE')) {
9
- define('DISQUS_TEST_DATABASE', sprintf('%s_test', DB_NAME));
10
- }
11
- class DisqusPluginTest extends PHPUnit_Framework_TestCase {
12
- /**
13
- * Sets up our database and fixtures.
14
- */
15
- protected function setUp() {
16
- global $wpdb;
17
-
18
- // If only we could use transactions for our fixture :(
19
- shell_exec(sprintf('mysql -u%s -p%s -D%s -h%s < initial.sql', DB_USER, DB_PASSWORD, DISQUS_TEST_DATABASE, DB_HOST));
20
-
21
- $res = $wpdb->get_results('show tables');
22
- assert(count($res) == 11);
23
- }
24
-
25
- protected function query($query) {
26
- global $wpdb;
27
-
28
- $result = $wpdb->query($query);
29
- if ($result === false) {
30
- throw new Exception(sprintf('Database error: %s', $wpdb->last_error));
31
- }
32
- }
33
-
34
- public function test_pending_posts_api() {
35
- dsq_add_pending_post_id(1);
36
- $this->assertEquals(dsq_get_pending_post_ids(), array(1));
37
-
38
- dsq_clear_pending_post_ids(array(1));
39
- $this->assertEquals(dsq_get_pending_post_ids(), array());
40
- }
41
-
42
- // /**
43
- // * Tests the dsq_sync_post function.
44
- // */
45
- // public function testSyncPost() {
46
- // global $wpdb;
47
- //
48
- // $post_id = $wpdb->get_var($wpdb->prepare('SELECT max(comment_date) FROM ' . $wpdb->comments . ' WHERE comment_post_ID = %d AND comment_agent LIKE \'Disqus/%%\'', $post->ID));
49
- //
50
- //
51
- // dsq_sync_post();
52
- // }
53
- //
54
- // /**
55
- // * Tests the dsq_sync_comments function.
56
- // */
57
- // public function testSyncComments() {
58
- // global $wpdb;
59
- //
60
- // $post_id = $wpdb->get_var($wpdb->prepare('SELECT max(comment_date) FROM ' . $wpdb->comments . ' WHERE comment_post_ID = %d AND comment_agent LIKE \'Disqus/%%\'', $post->ID));
61
- //
62
- // dsq_sync_comments($comments);
63
- // }
64
- }
65
-
66
- function main() {
67
- function cleanup() {
68
- global $wpdb;
69
-
70
- // we need to ensure that we switch off this database
71
- $wpdb->select(null);
72
-
73
- // drop our test database
74
- // XXX: why cant we use $wpdb->query ?
75
- mysql_query(sprintf('DROP DATABASE `%s`', DISQUS_TEST_DATABASE)) or die(mysql_error());
76
- }
77
-
78
- global $wpdb;
79
- // $this->query(sprintf('DROP DATABASE IF EXISTS `%s`', DISQUS_TEST_DATABASE));
80
- // check existance of test db
81
- $exists = $wpdb->get_var($wpdb->prepare('SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = \'%s\'', DISQUS_TEST_DATABASE));
82
-
83
- if (!empty($exists)) {
84
- printf("Test database '%s' already exists. Continuing will drop this database and all data!\nContinue? [y/n]\n", $exists);
85
- $handle = fopen ("php://stdin","r");
86
- $line = strtolower(trim(fgets($handle)));
87
- if($line != 'yes' && $line != 'y'){
88
- echo "ABORTING!\n";
89
- exit;
90
- }
91
- }
92
- // setup database
93
- $wpdb->query(sprintf('CREATE DATABASE `%s`', DISQUS_TEST_DATABASE));
94
- $wpdb->select(DISQUS_TEST_DATABASE);
95
-
96
- // $fp = fopen('initial.sql', 'r');
97
- // $buffer = '';
98
- // while (($line = fgets($fp)) !== false) {
99
- // $buffer .= trim($line);
100
- // if (strpos($line, ';')) {
101
- // if (!empty($buffer)) {
102
- // $this->query($buffer);
103
- // }
104
- // $buffer = '';
105
- // }
106
- // }
107
- //
108
-
109
- try {
110
- $suite = new PHPUnit_Framework_TestSuite('DisqusPluginTest');
111
- $result = $suite->run();
112
-
113
- require_once('PHPUnit/TextUI/ResultPrinter.php');
114
-
115
- $printer = new PHPUnit_TextUI_ResultPrinter();
116
- $printer->printResult($result);
117
-
118
- cleanup();
119
- } catch (Exception $ex) {
120
- cleanup();
121
-
122
- throw $ex;
123
- }
124
- }
125
-
126
- main();
127
-
128
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
uninstall.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Fired when the plugin is uninstalled.
4
+ *
5
+ * @link https://disqus.com
6
+ * @since 3.0
7
+ *
8
+ * @package Disqus
9
+ */
10
+
11
+ // If uninstall not called from WordPress, then exit.
12
+ if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
13
+ exit;
14
+ }
15
+
16
+ if ( ! current_user_can( 'install_plugins' ) ) {
17
+ exit;
18
+ }
19
+
20
+ delete_option( 'disqus_forum_url' );
21
+ delete_option( 'disqus_sso_enabled' );
22
+ delete_option( 'disqus_public_key' );
23
+ delete_option( 'disqus_secret_key' );
24
+ delete_option( 'disqus_admin_access_token' );
25
+ delete_option( 'disqus_sso_button' );
26
+ delete_option( 'disqus_sync_token' );
27
+ delete_option( 'disqus_last_sync_message' );
28
+ delete_option( 'disqus_manual_sync' ); // Legacy option.
upgrade.php DELETED
@@ -1,21 +0,0 @@
1
- <?php
2
- require(ABSPATH . 'wp-includes/version.php');
3
-
4
- if ( !current_user_can('manage_options') ) {
5
- die();
6
- }
7
-
8
- $step = (isset($_GET['step']) ? $_GET['step'] : '1');
9
-
10
- ?>
11
- <div class="wrap">
12
- <h2><?php echo dsq_i('Upgrade Disqus Comments'); ?></h2>
13
- <form method="POST" action="?page=disqus&amp;step=<?php echo esc_attr($step); ?>">
14
- <?php wp_nonce_field('dsq-wpnonce_upgrade', 'dsq-form_nonce_upgrade'); ?>
15
- <p><?php echo dsq_i('You need to upgrade your database to continue.'); ?></p>
16
-
17
- <p class="submit" style="text-align: left">
18
- <input type="submit" name="upgrade" class="button-primary button" value="Upgrade &raquo;" />
19
- </p>
20
- </form>
21
- </div>