Updates, images, config, etc.
|
|
@ -90,7 +90,7 @@ define('DOMAIN_CURRENT_SITE', $theDomain);
|
|||
define( 'PATH_CURRENT_SITE', '/' );
|
||||
define( 'SITE_ID_CURRENT_SITE', 1 );
|
||||
define( 'BLOG_ID_CURRENT_SITE', 1 );
|
||||
define('COOKIE_DOMAIN', $_SERVER['HTTP_HOST']);
|
||||
define('COOKIE_DOMAIN', $theDomain);
|
||||
|
||||
/* Det var allt, sluta redigera här! Blogga på. */
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,339 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
|
|
@ -0,0 +1,472 @@
|
|||
=== Disqus Comment System ===
|
||||
Contributors: disqus, alexkingorg, crowdfavorite, zeeg, tail, thetylerhayes, ryanv12, iamfrancisyo, brevityness, tterb
|
||||
Tags: disqus, comments, engagement, threaded, email, notification, spam, avatars, community, profile, widget
|
||||
Requires at least: 4.4
|
||||
Tested up to: 5.6
|
||||
Stable tag: 3.0.22
|
||||
Requires PHP: 5.6
|
||||
|
||||
Disqus is the web's most popular comment system. Use Disqus to increase engagement, retain readers, and grow your audience.
|
||||
|
||||
== Description ==
|
||||
|
||||
[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.
|
||||
|
||||
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.
|
||||
|
||||
= Why Disqus? =
|
||||
|
||||
* Simple one-click installation that seamlessly integrates with WordPress without ever needing to edit a single line of code or losing any of your existing comments
|
||||
* Keep users engaged on your site longer with a commenting experience readers love
|
||||
* Bring users back to your site with web and email notifications and personalized digests
|
||||
* Improve SEO ranking with user generated content
|
||||
* Keep spam out with our best-in-class anti-spam filter powered by Akismet
|
||||
* Single profile for commenting on over 4 million sites including social login support for Facebook, Twitter, and Google accounts
|
||||
* Trusted by sites like ABC News, Entertainment Weekly, and Rotten Tomatoes
|
||||
|
||||
= Disqus Features =
|
||||
|
||||
* Syncs comments automatically to WordPress for backup and flexibility if you ever decide to switch to a different platform
|
||||
* Loads asynchronously with advanced caching so that Disqus doesn’t affect your site’s performance
|
||||
* Monetization options to grow revenue
|
||||
* Export comments to WordPress-compatible XML to backup or migrate to another system
|
||||
* Analytics dashboard for measuring overall engagement on your site
|
||||
* Mobile responsive design
|
||||
|
||||
= Engagement Features =
|
||||
|
||||
* Realtime comments system with fun discussion interactions: voting, photo and video upload, rich media embed (Youtube, Twitter, Vimeo, and more), spoiler tags, mentions
|
||||
* Comment text formatting (e.g. bold, link, italics, quote) using HTML tags as well as code syntax highlighting
|
||||
* Threaded comment display (nested 3 levels) with ability to collapse individual threads
|
||||
* Sort discussion by oldest, newest, and best comments
|
||||
* Flexible login options - Social login with Facebook, Twitter, and Google, SSO, and guest commenting support
|
||||
* Instant activity notifications, email notifications, and digests pull readers back in
|
||||
* User profiles that show you recent comment history and frequented communities
|
||||
* Recommendations widget that shows where active discussions are happening elsewhere on your site
|
||||
|
||||
= Moderation Features =
|
||||
|
||||
* Automatic anti-spam filter powered by Akismet
|
||||
* Automated pre-moderation controls to flag comments based on links, user reputation
|
||||
* Moderate directly in the discussion, via email, or moderation panel
|
||||
* Email notifications for newly posted comments, replies
|
||||
* Moderation Panel that lets you search, filter, sort, and manage your comments
|
||||
* Self-moderation tools like user blocking, comment flagging
|
||||
|
||||
== Support ==
|
||||
|
||||
* Search our [Knowledge Base](https://help.disqus.com/customer/portal/articles/472005) for solutions to common troubleshooting questions
|
||||
* Check out our support community, [Discuss Disqus](https://disqus.com/home/channel/discussdisqus/), to see if your question has been answered
|
||||
* Talk to our Support team at [disqus.com/support](disqus.com/support)
|
||||
* Visit our [Getting Started](https://help.disqus.com/customer/en/portal/articles/1264625-getting-started) page to learn the basics of Disqus
|
||||
|
||||
== Frequently Asked Questions ==
|
||||
|
||||
= Is Disqus free to use on my site? =
|
||||
|
||||
Yes! Disqus is free to use. We also provide [subscription plans](https://help.disqus.com/customer/en/portal/articles/2759918-disqus-pricing-and-plans) for larger, commercial sites that want access to more powerful moderation and audience tools and customization.
|
||||
|
||||
= How do I customize the look-and-feel of Disqus? =
|
||||
|
||||
Disqus automatically checks your site's font and background color and adapts to either a light or dark color scheme, along with a serif or sans-serif font. If these are detected incorrectly, you can [override them](https://help.disqus.com/customer/en/portal/articles/545277-disqus-appearance-tweaks) in your Settings.
|
||||
|
||||
= Will I lose comments if I deactivate Disqus? =
|
||||
|
||||
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.
|
||||
|
||||
= Can I import my existing WordPress comments into Disqus? =
|
||||
|
||||
Yes, you can import your existing WordPress comments into Disqus during installation.
|
||||
|
||||
= How do I set up Single Sign-On (SSO)? =
|
||||
|
||||
SSO allows users in your database to comment without requiring them to register with Disqus. Access to SSO is currently available as an add-on for users with a [Business subscription](https://help.disqus.com/customer/en/portal/articles/2759918-disqus-pricing-and-plans#business-plan). If you would like to enable this feature, [contact our Support team](https://disqus.com/support/?article=contact_SSO). Also check out our guide for [setting up SSO on WordPress](https://help.disqus.com/customer/portal/articles/1148635).
|
||||
|
||||
= I’m experiencing an issue with my installation of Disqus. =
|
||||
|
||||
Check out our [WordPress Troubleshooting guide](https://help.disqus.com/customer/portal/articles/472005-wordpress-troubleshooting) with specific solutions for potential problems you might be experiencing.
|
||||
|
||||
== Installation ==
|
||||
|
||||
1. Go to **"Plugins"** > **"Add Plugin"**
|
||||
2. Search for **"Disqus Comment System"** by Disqus
|
||||
3. Click **"Install Now"**
|
||||
4. Activate the plugin
|
||||
5. (**Automatic: easiest**) From the Install page of the Disqus plugin settings, follow the Automatic Installation steps to set up Disqus on your site. During this process, you will need to [create a Disqus account](https://disqus.com/profile/signup/) and register your site. This also creates the API application required for enabling Comment Syncing.
|
||||
6. (**Manual: fastest**) Enter your site's [Disqus shortname](https://help.disqus.com/customer/en/portal/articles/466208) in **Site Configuration**. This requires you to have [created a Disqus account](https://disqus.com/profile/signup/) and registered your site.
|
||||
|
||||
**NOTE: It is recommended that you [backup your database](http://codex.wordpress.org/Backing_Up_Your_Database) before installing the plugin.**
|
||||
|
||||
https://www.youtube.com/watch?v=a4JBJXyuaFk
|
||||
|
||||
= Syncing comments to WordPress =
|
||||
Comment Syncing copies comments made in Disqus to your WordPress installation as backup in case you ever decide to switch back to native WordPress comments. Syncing is not enabled by default. To enable syncing, you'll need to set it up either by creating an API application (follow [instructions here](https://help.disqus.com/customer/portal/articles/960360)) or via Automatic Installation in the plugin.
|
||||
|
||||
For more information, go to [https://help.disqus.com/customer/portal/articles/960360](https://help.disqus.com/customer/portal/articles/960360)
|
||||
|
||||
= Installation trouble? =
|
||||
|
||||
Go to [https://disqus.com/help/wordpress](https://disqus.com/help/wordpress)
|
||||
|
||||
== Screenshots ==
|
||||
|
||||
1. Disqus Comments
|
||||
2. Disqus Audience Platform
|
||||
3. Comment Reply
|
||||
4. Featured Comment
|
||||
5. Recommendations (part of Disqus Comments)
|
||||
6. Mentions
|
||||
7. Real-time Comments
|
||||
8. Commenter User Profile
|
||||
9. Moderation Panel
|
||||
10. Moderation Panel Comments
|
||||
11. Moderate by Email Notifications
|
||||
|
||||
== Changelog ==
|
||||
|
||||
= 3.0.22 =
|
||||
* Added improvements to manual comment syncing (thanks Artem Russakovskii)
|
||||
* Fixed a bug with the embed handling pages with missing container IDs
|
||||
* Fixed a bug with REST URLs handling emtpy host configurations
|
||||
|
||||
= 3.0.21 =
|
||||
* Fixed issue with mismatched DISQUSVERSION causing admin issues
|
||||
|
||||
= 3.0.20 =
|
||||
* Fixed issue with comments syncing to one sticky post
|
||||
|
||||
= 3.0.19 =
|
||||
* Fixed issue with missing admin bundles
|
||||
|
||||
= 3.0.18 =
|
||||
* Tested plugin with WordPress 5.6 and updated documentation
|
||||
* Fixed count.js script being loaded on unnecessary pages
|
||||
* Fixed comments showing sync date instead of creation date in WordPress admin
|
||||
|
||||
= 3.0.17 =
|
||||
* Bumping version for WP 5.1 version bump. (Changes to README versions and main php file's version)
|
||||
* Fixed Undefined index bug where HTTP_HOST could not find web server
|
||||
|
||||
= 3.0.16 =
|
||||
|
||||
* Add a manual syncing option that allows retroactive syncing within a selected date range
|
||||
* Fixed bug where SSO avatar URLs were malformed (Thanks to [klaufel](https://github.com/disqus/disqus-wordpress-plugin/pull/49))
|
||||
|
||||
= 3.0.15 =
|
||||
|
||||
* Fixed bug preventing sites from importing WordPress comments to Disqus
|
||||
|
||||
= 3.0.14 =
|
||||
|
||||
* Add a prompt to create a secret key if missing. Fixes issue preventing some sites from using automatic installation and enabling syncing
|
||||
* Made it easier to reinstall the same site without having to select a new one
|
||||
* Bug fix for some browsers from autofilling site configuration forms
|
||||
* Bug fix for sites whose admin URL was different than their public site URL
|
||||
* Prevent Disqus from loading on pending and scheduled posts
|
||||
|
||||
= 3.0.13 =
|
||||
|
||||
* Added a new option for rendering comments javascript directly into page markup
|
||||
* Fixed warning that stated "cannot access private method Disqus_Rest_Api::dsq_get_settings_schema()"
|
||||
* A few small copy changes in plugin's admin UI
|
||||
|
||||
= 3.0.12 =
|
||||
|
||||
* Disabled browser autocomplete for site configuration form
|
||||
* Fixed an issue where admin JavaScript bundle was missing for sites with WP_DEBUG enabled
|
||||
* Implemented a dsq_can_load filter for custom control of when Disqus loads
|
||||
|
||||
= 3.0.11 =
|
||||
|
||||
* Improved UX on updating the site configuration manually
|
||||
* Fixed an issue causing a site crash with PHP version 5.2
|
||||
* Added additional information to support diagnostics
|
||||
|
||||
= 3.0.10 =
|
||||
|
||||
* Lowered minimum-supported version of PHP to 5.4
|
||||
* Fixed a syntax issue in PHP version 5.3
|
||||
|
||||
= 3.0.9 =
|
||||
|
||||
* Added a check to deactivate plugin if PHP version is earlier than the minimum-supported version 5.6.
|
||||
|
||||
= 3.0.8 =
|
||||
|
||||
* Fixed a bug that prevented automatic installation when upgrading from version 2.86 or earlier.
|
||||
|
||||
= 3.0.7 =
|
||||
|
||||
* 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.
|
||||
|
||||
= 2.86 =
|
||||
|
||||
* Don't attempt to use cURL on IIS servers
|
||||
* Check is dsq_sync_forum is scheduled before scheduling
|
||||
* Add updates for Travis CI
|
||||
* Fixes a bug in the upgrade process
|
||||
|
||||
= 2.85 =
|
||||
|
||||
* Fixes deprecation warnings on sites running PHP7
|
||||
* Removes a javascript alert from the admin
|
||||
|
||||
= 2.84 =
|
||||
|
||||
* Fixes a bug where the comment count won't work on some themes
|
||||
|
||||
= 2.83 =
|
||||
|
||||
* Fix errors when using SSO and rendering javascript inline
|
||||
|
||||
= 2.82 =
|
||||
|
||||
* Fix PHP errors when there are no comments to sync
|
||||
* Adds a new option to render Disqus javascript directly in page markup
|
||||
|
||||
= 2.81 =
|
||||
|
||||
* Fix for automatic comment syncing
|
||||
* Make sure all markup validates for HTML5
|
||||
|
||||
= 2.80 =
|
||||
|
||||
* Move all scripts to separate files instead of rendering them in php
|
||||
* Added a hook to attach custom functions to disqus_config in javascript
|
||||
* Fixed exporting bug introduced in 2.78 (Thanks to mkilian)
|
||||
* Numerous small compatibility and security enhancements
|
||||
|
||||
= 2.79 =
|
||||
|
||||
* Reinstate changes removed by 2.78
|
||||
|
||||
= 2.78 =
|
||||
|
||||
* Security fixes
|
||||
* Compatibility for Wordpress version 4.0
|
||||
|
||||
= 2.77 =
|
||||
|
||||
* Fixes login by email issue
|
||||
* Make sure Disqus is enabled after installation
|
||||
* Additional security fixes
|
||||
|
||||
= 2.76 =
|
||||
|
||||
* Security fixes (Thanks to Nik Cubrilovic, Alexander Concha and Marc-Alexandre Montpas)
|
||||
* Bump tested Wordpress version to 3.9.1
|
||||
* Remove obsolete SSO button uploader
|
||||
* Enable 'Output javascript in footer' by default during installation
|
||||
* Fix for 'Reset' function not completely working the first time
|
||||
|
||||
= 2.75 =
|
||||
|
||||
* Bump supported WordPress version to 3.8.
|
||||
* Properly encode site name for SSO login button.
|
||||
* Increased timeout for comment exporter to 60 seconds.
|
||||
* Use https: for admin pages
|
||||
* Miscellaneous bug fixes and improvements.
|
||||
|
||||
= 2.74 =
|
||||
|
||||
* Updated settings UI
|
||||
* Add filter hook for setting custom Disqus language
|
||||
* For WP >= 3.5, use new media uploader
|
||||
* Disable internal Wordpress commenting if Disqus is enabled (thanks Artem Russakovskii)
|
||||
* Cleaned up installation and configuration flow
|
||||
* Added link to WP backup guide in README
|
||||
* Fix admin bar comments link
|
||||
* Added a check to avoid a missing key notice when WP_DEBUG=TRUE (thanks Jason Lengstorf)
|
||||
* Prevent 404 errors for embed.js from being reported by Google Webmaster Tools (missed in 2.73 README)
|
||||
|
||||
= 2.73 =
|
||||
|
||||
* Apply CDATA patch from Wordpress 3.4 to dsq_export_wxr_cdata() (thanks Artem
|
||||
Russakovskii for the patch).
|
||||
* Added Single Sign-On log-in button and icon to options (only for sites using SSO)
|
||||
* Output user website if set in SSO payload
|
||||
* Added plugin activation statuses to debug info
|
||||
* Bump supported WordPress version to 3.4.1
|
||||
* Fixed issue where disqus_dupecheck won't properly uninstall
|
||||
* Load second count.js (output-in-footer version) reference via SSL too
|
||||
* Added screenshots
|
||||
|
||||
= 2.72 =
|
||||
|
||||
* Load count.js via SSL when page is accessed via HTTPS
|
||||
* Fixed styling issue with Disqus admin.
|
||||
|
||||
= 2.71 =
|
||||
|
||||
* Fixed issue where embed wasn't using SSL if page was loaded via HTTPS
|
||||
* Fixed issue with syncing where to user's without a display_name would
|
||||
revert back to Anonymous (really this time).
|
||||
* Fixed issue where Google Webmaster Tools would incorrectly report 404s.
|
||||
* Fixed issue with Disqus admin display issues.
|
||||
|
||||
= 2.70 =
|
||||
|
||||
* Properly uninstall disqus_dupecheck index when uninstalling plugin.
|
||||
* Fixed issue with syncing where to user's without a display_name would
|
||||
revert back to Anonymous.
|
||||
* Fixed issue where IP addresses weren't being synced properly.
|
||||
* Allow non-Administrators (e.g., editors) to see Disqus Moderate panel
|
||||
inline (fixes GH-3)
|
||||
|
||||
= 2.69 =
|
||||
|
||||
* Bumped version number.
|
||||
|
||||
= 2.68 =
|
||||
|
||||
* Removed debugging information from web requests in CLI scripts (thanks
|
||||
Ryan Dewhurst for the report).
|
||||
* Reduced sync lock time to 1 hour.
|
||||
* Fixed an issue which was not allowing pending posts (for sync) to clear.
|
||||
* Fixed an issue with CLI scripts when used with certain caching plugins.
|
||||
|
||||
= 2.67 =
|
||||
|
||||
* Bumped synchronization timer delays to 5 minutes.
|
||||
* wp-cli.php now requires php_sapi_name to be set to 'cli' for execution.
|
||||
* Fixed a bug with imported comments not storing the correct relative date.
|
||||
* Added a lock for dsq_sync_forum, which can be overriden in the command line script
|
||||
with the --force tag.
|
||||
* dsq_sync_forum will now handle all pending post metadata updates (formerly a separate
|
||||
cron task, dsq_sync_post).
|
||||
|
||||
= 2.66 =
|
||||
|
||||
* Fixed issue with jQuery usage which conflicted with updated jQuery version.
|
||||
|
||||
= 2.65 =
|
||||
|
||||
* Corrected a bug that was causing posts to not appear due to invalid references.
|
||||
|
||||
= 2.64 =
|
||||
|
||||
* Added an option to disable Disqus without deactivating the plugin.
|
||||
* Added a second check for comment sync to prevent stampede race conditions in WP cron.
|
||||
|
||||
= 2.63 =
|
||||
|
||||
* Added command line script to import comments from DISQUS (scripts/import-comments.php).
|
||||
* Added command line script to export comments to DISQUS (scripts/export-comments.php).
|
||||
* The exporter will now only do one post at a time.
|
||||
* The exporter now only sends required attributes to DISQUS.
|
||||
* Moved media into its own directory.
|
||||
|
||||
= 2.62 =
|
||||
|
||||
* Changed legacy query to use = operator instead of LIKE so it can be indexed.
|
||||
|
||||
= 2.61 =
|
||||
|
||||
* Fixed an issue which was causing invalid information to be presented in RSS feeds.
|
||||
|
||||
= 2.60 =
|
||||
|
||||
* Added support for new Single Sign-On (API version 3.0).
|
||||
* Improved support for legacy Single Sign-On.
|
||||
|
||||
= 2.55 =
|
||||
|
||||
* Added support for get_comments_number in templates.
|
||||
|
||||
= 2.54 =
|
||||
|
||||
* Updated URL to forum moderation.
|
||||
|
||||
= 2.53 =
|
||||
|
||||
* Fixed an issue with fsockopen and GET requests (only affects certain users).
|
||||
|
||||
= 2.52 =
|
||||
|
||||
* Fixed issue with Disqus-API package not getting updated (only affecting PHP4).
|
||||
|
||||
= 2.51 =
|
||||
|
||||
* Added CDATA comments for JavaScript.
|
||||
* Syncing comments will now restore missing thread information from old imports.
|
||||
* Install and uninstall processes have been improved.
|
||||
* Fixed an issue in PHP4 with importing comments.
|
||||
* Fixed an issue that could cause duplicate comments in some places.
|
||||
* Added an option to remove existing imported comments when importing.
|
||||
|
||||
= 2.50 =
|
||||
|
||||
* Added missing file.
|
||||
|
||||
= 2.49 =
|
||||
|
||||
* Database usage has been optimized for storing comment meta data.
|
||||
|
||||
You can perform this migration automatically by visiting Comments -> Disqus, or if
|
||||
you have a large database, you may do this by hand:
|
||||
|
||||
CREATE INDEX disqus_dupecheck ON `wp_commentmeta` (meta_key, meta_value(11));
|
||||
INSERT INTO `wp_options` (blog_id, option_name, option_value, autoload) VALUES (0, 'disqus_version', '2.49', 'yes') ON DUPLICATE KEY UPDATE option_value = VALUES(option_value);
|
||||
|
||||
= 2.48 =
|
||||
|
||||
* Comment synchronization has been optimized to be a single call per-site.
|
||||
* disqus.css will now only load when displaying comments
|
||||
|
||||
= 2.47 =
|
||||
|
||||
* Fixed a security hole with comment importing.
|
||||
* Reverted ability to use default template comments design.
|
||||
* Comments will now store which version they were imported under.
|
||||
* Added an option to disable server side rendering.
|
||||
|
||||
= 2.46 =
|
||||
|
||||
* Better debugging information for export errors.
|
||||
* Added the ability to manual import Disqus comments into Wordpress.
|
||||
* Added thread_identifier support to exports.
|
||||
* Cleaned up API error messages.
|
||||
* Fixed a bug which was causing the import process to not grab only the latest set of comments.
|
||||
* Added an option to disable automated synchronization with Disqus.
|
||||
|
||||
= 2.45 =
|
||||
|
||||
* Comments should now store thread information as well as certain other meta data.
|
||||
* Optimize get_thread polling to only pull comments which aren't stored properly.
|
||||
|
||||
= 2.44 =
|
||||
|
||||
* Fixed JavaScript response for comments sync call.
|
||||
* Comments are now marked as closed while showing the embed (fixes showing default respond form).
|
||||
|
||||
= 2.43 =
|
||||
|
||||
* Fixed a JavaScript syntax error which would cause linting to fail.
|
||||
* Correct an issue that was causing comments.php to throw a syntax error under some configurations.
|
||||
|
||||
= 2.42 =
|
||||
|
||||
* Correct a bug with saving disqus_user_api_key (non-critical).
|
||||
* Added settings to Debug Information.
|
||||
* Adjusting all includes to use absolute paths.
|
||||
* Adjusted JSON usage to solve a problem for some clients.
|
||||
|
||||
= 2.41 =
|
||||
|
||||
* Correct a bug with double urlencoding titles.
|
||||
|
||||
= 2.40 =
|
||||
|
||||
* Comments are now synced with Disqus as a delayed asynchronous cron event.
|
||||
* Comment count code has been updated to use the new widget. (Comment counts
|
||||
must be linked to get tracked within "the loop" now).
|
||||
* API bindings have been migrated to the generic 1.1 Disqus API.
|
||||
* Pages will now properly update their permalink with Disqus when it changes. This is
|
||||
done within the sync event above.
|
||||
* There is now a Debug Information pane under Advanced to assist with support requests.
|
||||
* When Disqus is unreachable it will fallback to the theme's built-in comment display.
|
||||
* Legacy mode is no longer available.
|
||||
* The plugin management interface can now be localized.
|
||||
* The plugin is now valid HTML5.
|
||||
40
wp-content/plugins/disqus-comment-system/admin/bundles/js/en.disqus-admin.bundle.3.0.22.min.js
vendored
Normal file
|
|
@ -0,0 +1,328 @@
|
|||
<?php
|
||||
/**
|
||||
* The admin-specific functionality of the plugin.
|
||||
*
|
||||
* @link https://disqus.com
|
||||
* @since 3.0
|
||||
*
|
||||
* @package Disqus
|
||||
* @subpackage Disqus/admin
|
||||
*/
|
||||
|
||||
/**
|
||||
* The admin-specific functionality of the plugin.
|
||||
*
|
||||
* Defines the plugin name, version, and two examples hooks for how to
|
||||
* enqueue the admin-specific stylesheet and JavaScript.
|
||||
*
|
||||
* @package Disqus
|
||||
* @subpackage Disqus/admin
|
||||
* @author Ryan Valentin <ryan@disqus.com>
|
||||
*/
|
||||
class Disqus_Admin {
|
||||
|
||||
/**
|
||||
* The ID of this plugin.
|
||||
*
|
||||
* @since 3.0
|
||||
* @access private
|
||||
* @var string $disqus The ID of this plugin.
|
||||
*/
|
||||
private $disqus;
|
||||
|
||||
/**
|
||||
* The version of this plugin.
|
||||
*
|
||||
* @since 3.0
|
||||
* @access private
|
||||
* @var string $version The current version of this plugin.
|
||||
*/
|
||||
private $version;
|
||||
|
||||
/**
|
||||
* The unique Disqus forum shortname.
|
||||
*
|
||||
* @since 3.0
|
||||
* @access private
|
||||
* @var string $shortname The unique Disqus forum shortname.
|
||||
*/
|
||||
private $shortname;
|
||||
|
||||
/**
|
||||
* Initialize the class and set its properties.
|
||||
*
|
||||
* @since 3.0
|
||||
* @param string $disqus The name of this plugin.
|
||||
* @param string $version The version of this plugin.
|
||||
* @param string $shortname The configured Disqus shortname.
|
||||
*/
|
||||
public function __construct( $disqus, $version, $shortname ) {
|
||||
|
||||
$this->disqus = $disqus;
|
||||
$this->version = $version;
|
||||
$this->shortname = $shortname;
|
||||
$this->ensure_sync_token();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the stylesheets for the admin area.
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public function enqueue_styles() {
|
||||
|
||||
/**
|
||||
* This function is provided for demonstration purposes only.
|
||||
*
|
||||
* An instance of this class should be passed to the run() function
|
||||
* defined in Disqus_Loader as all of the hooks are defined
|
||||
* in that particular class.
|
||||
*
|
||||
* The Disqus_Loader will then create the relationship
|
||||
* between the defined hooks and the functions defined in this
|
||||
* class.
|
||||
*/
|
||||
|
||||
wp_enqueue_style(
|
||||
$this->disqus, plugin_dir_url( __FILE__ ) . 'css/disqus-admin.css',
|
||||
array(),
|
||||
$this->version,
|
||||
'all'
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the JavaScript for the admin area.
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public function enqueue_scripts() {
|
||||
if ( ! isset( $_GET['page'] ) || 'disqus' !== $_GET['page'] ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'get_plugins' ) ) {
|
||||
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
||||
}
|
||||
|
||||
global $wp_version;
|
||||
|
||||
$admin_js_vars = array(
|
||||
'rest' => array(
|
||||
'base' => esc_url_raw( rest_url( '/' ) ),
|
||||
'disqusBase' => 'disqus/v1/',
|
||||
|
||||
// Nonce is required so that the REST api permissions can recognize a user/check permissions.
|
||||
'nonce' => wp_create_nonce( 'wp_rest' ),
|
||||
),
|
||||
'adminUrls' => array(
|
||||
'disqus' => get_admin_url( null, 'admin.php?page=disqus' ),
|
||||
'editComments' => get_admin_url( null, 'edit-comments.php' ),
|
||||
),
|
||||
'permissions' => array(
|
||||
'canManageSettings' => current_user_can( 'manage_options' ),
|
||||
),
|
||||
'site' => array(
|
||||
'name' => $this->get_site_name(),
|
||||
'pluginVersion' => $this->version,
|
||||
'allPlugins' => get_plugins(),
|
||||
'phpVersion' => phpversion(),
|
||||
'wordpressVersion' => $wp_version,
|
||||
),
|
||||
);
|
||||
|
||||
// TODO: Match language of the WordPress installation against any other localizations once they've been set up.
|
||||
$language_code = 'en';
|
||||
|
||||
$file = $language_code;
|
||||
$file .= '.disqus-admin.bundle.';
|
||||
$file .= $this->version;
|
||||
$file .= WP_DEBUG ? '.js' : '.min.js';
|
||||
|
||||
wp_enqueue_script(
|
||||
$this->disqus . '_admin',
|
||||
plugin_dir_url( __FILE__ ) . 'bundles/js/' . $file,
|
||||
array(),
|
||||
$this->version,
|
||||
true
|
||||
);
|
||||
wp_localize_script( $this->disqus . '_admin', 'DISQUS_WP', $admin_js_vars );
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter for the get_rest_url function which ensures REST URLs match admin hosts.
|
||||
*
|
||||
* @since 3.0
|
||||
* @param string $rest_url The REST URL.
|
||||
* @return string The filtered REST URL.
|
||||
*/
|
||||
public function dsq_filter_rest_url( $rest_url ) {
|
||||
$rest_url_parts = parse_url( $rest_url );
|
||||
if ( array_key_exists( 'host', $rest_url_parts ) ) {
|
||||
$rest_host = $rest_url_parts['host'];
|
||||
if ( array_key_exists( 'port', $rest_url_parts ) ) {
|
||||
$rest_host .= ':' . $rest_url_parts['port'];
|
||||
}
|
||||
|
||||
$current_host = isset( $_SERVER['HTTP_HOST'] ) ? $_SERVER['HTTP_HOST'] : $rest_host;
|
||||
|
||||
if ( $rest_host !== $current_host ) {
|
||||
$rest_url = preg_replace( '/' . $rest_host . '/', $current_host, $rest_url, 1 );
|
||||
}
|
||||
}
|
||||
|
||||
return $rest_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the admin toolbar menu with the various Disqus options
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public function dsq_contruct_admin_menu() {
|
||||
if ( ! current_user_can( 'moderate_comments' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Replace the existing WordPress comments menu item to prevent confusion
|
||||
// about where to administer comments. The Disqus page will have a link to
|
||||
// see WordPress comments.
|
||||
remove_menu_page( 'edit-comments.php' );
|
||||
|
||||
add_menu_page(
|
||||
'Disqus',
|
||||
'Disqus',
|
||||
'moderate_comments',
|
||||
'disqus',
|
||||
array( $this, 'dsq_render_admin_index' ),
|
||||
'dashicons-admin-comments',
|
||||
24
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the admin menu with the various Disqus options
|
||||
*
|
||||
* @since 3.0
|
||||
* @param WP_Admin_Bar $wp_admin_bar Instance of the WP_Admin_Bar.
|
||||
*/
|
||||
public function dsq_construct_admin_bar( $wp_admin_bar ) {
|
||||
if ( ! current_user_can( 'moderate_comments' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Replace the existing WordPress comments menu item to prevent confusion
|
||||
// about where to administer comments. The Disqus page will have a link to
|
||||
// see WordPress comments.
|
||||
$wp_admin_bar->remove_node( 'comments' );
|
||||
|
||||
$disqus_node_args = array(
|
||||
'id' => 'disqus',
|
||||
'title' => '<span class="ab-icon"></span>Disqus',
|
||||
'href' => admin_url( 'admin.php?page=disqus' ),
|
||||
'meta' => array(
|
||||
'class' => 'disqus-menu-bar',
|
||||
),
|
||||
);
|
||||
|
||||
$disqus_moderate_node_args = array(
|
||||
'parent' => 'disqus',
|
||||
'id' => 'disqus_moderate',
|
||||
'title' => 'Moderate',
|
||||
'href' => $this->get_disqus_admin_url( 'moderate' ),
|
||||
);
|
||||
|
||||
$disqus_analytics_node_args = array(
|
||||
'parent' => 'disqus',
|
||||
'id' => 'disqus_analytics',
|
||||
'title' => 'Analytics',
|
||||
'href' => $this->get_disqus_admin_url( 'analytics/comments' ),
|
||||
);
|
||||
|
||||
$disqus_settings_node_args = array(
|
||||
'parent' => 'disqus',
|
||||
'id' => 'disqus_settings',
|
||||
'title' => 'Settings',
|
||||
'href' => $this->get_disqus_admin_url( 'settings/general' ),
|
||||
);
|
||||
|
||||
$disqus_configure_node_args = array(
|
||||
'parent' => 'disqus',
|
||||
'id' => 'disqus_plugin_configure',
|
||||
'title' => 'Configure Plugin',
|
||||
'href' => admin_url( 'admin.php?page=disqus' ),
|
||||
);
|
||||
|
||||
$wp_admin_bar->add_node( $disqus_node_args );
|
||||
$wp_admin_bar->add_node( $disqus_moderate_node_args );
|
||||
$wp_admin_bar->add_node( $disqus_analytics_node_args );
|
||||
$wp_admin_bar->add_node( $disqus_settings_node_args );
|
||||
$wp_admin_bar->add_node( $disqus_configure_node_args );
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a plugin link to the Disqus entry on the plugin page.
|
||||
*
|
||||
* @since 3.0
|
||||
* @param array $links Links rendered for Disqus entry on the plugin page.
|
||||
* @param string $file The filename of the link being filtered.
|
||||
*/
|
||||
public function dsq_plugin_action_links( $links, $file ) {
|
||||
if ( 'disqus/disqus.php' === $file ) {
|
||||
$plugin_links = array(
|
||||
'<a href="' . esc_url( get_admin_url( null, 'admin.php?page=disqus' ) ) . '">' .
|
||||
( '' === $this->shortname ? 'Install' : 'Configure' ) .
|
||||
'</a>',
|
||||
);
|
||||
return array_merge( $links, $plugin_links );
|
||||
}
|
||||
return $links;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the admin page view from a partial file
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public function dsq_render_admin_index() {
|
||||
require_once plugin_dir_path( __FILE__ ) . 'partials/disqus-admin-partial.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility function get the admin URL with site's shortname.
|
||||
*
|
||||
* @since 3.0
|
||||
* @access private
|
||||
* @param string $path The path of the admin page to route to.
|
||||
* @return string The fully-qualified admin URL for the given path.
|
||||
*/
|
||||
private function get_disqus_admin_url( $path = '' ) {
|
||||
return 'https://' . $this->shortname . '.disqus.com/admin/' . ( strlen( $path ) ? $path . '/' : '' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility function get the site's name for display in HTML markup.
|
||||
*
|
||||
* @since 3.0
|
||||
* @access private
|
||||
* @return string The escaped name for the given site.
|
||||
*/
|
||||
private function get_site_name() {
|
||||
return esc_html( get_bloginfo( 'name' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the stored `disqus_sync_token` and generates a new one if it doesn't exist.
|
||||
* This is used as a secret key for authenticating requests through the REST API.
|
||||
*
|
||||
* @since 3.0.8
|
||||
* @access private
|
||||
*/
|
||||
private function ensure_sync_token() {
|
||||
$existing_token = get_option( 'disqus_sync_token', null );
|
||||
if ( empty( $existing_token ) ) {
|
||||
update_option( 'disqus_sync_token', bin2hex( random_bytes( 16 ) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,140 @@
|
|||
/**
|
||||
* All of the CSS for your admin-specific functionality should be
|
||||
* included in this file.
|
||||
*/
|
||||
|
||||
#wpadminbar #wp-admin-bar-disqus .ab-icon:before {
|
||||
content: "\f101";
|
||||
top: 3px;
|
||||
}
|
||||
|
||||
.dsq-admin-header {
|
||||
background: #494e58;
|
||||
height: 100px;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: -20px;
|
||||
right: -20px;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.dsq-admin-wrapper {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.button-hero .disqus-icon {
|
||||
float: left;
|
||||
margin-top: 7px;
|
||||
margin-right: 7px;
|
||||
}
|
||||
|
||||
.welcome-panel {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.welcome-panel-column .button {
|
||||
margin-bottom: 1.33em;
|
||||
}
|
||||
|
||||
.button-large .dashicons {
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.submit .button-link {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/* Placeholder spinner */
|
||||
|
||||
.dsq-loading-container {
|
||||
height: 130px;
|
||||
padding-top: 120px;
|
||||
}
|
||||
|
||||
.dsq-spinner {
|
||||
z-index: 500;
|
||||
|
||||
border: 3px solid transparent;
|
||||
border-color: transparent #c2c9d4 transparent #c2c9d4;
|
||||
|
||||
animation: rotate-loading 1.2s linear 0s infinite normal;
|
||||
transform-origin: 50% 50%;
|
||||
|
||||
margin: auto;
|
||||
width: 25px;
|
||||
height: 25px;
|
||||
|
||||
border-radius: 28px;
|
||||
}
|
||||
|
||||
@keyframes rotate-loading {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
.dsq-installation__instruction-list {
|
||||
padding-left: 0px;
|
||||
counter-reset: li 0;
|
||||
margin: 35px 0px 0px 70px;
|
||||
}
|
||||
|
||||
.dsq-installation__instruction-list::before, .installation__instruction-list::after {
|
||||
content: " ";
|
||||
display: table;
|
||||
}
|
||||
|
||||
.dsq-installation__instruction-list > li {
|
||||
font-size: 16px;
|
||||
line-height: 1.5em;
|
||||
position: relative;
|
||||
z-index: 200;
|
||||
margin-bottom: 40px;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.dsq-installation__instruction-list > li::before {
|
||||
content: counter(li);
|
||||
counter-increment: li 1;
|
||||
position: absolute;
|
||||
top: -8px;
|
||||
left: -65px;
|
||||
width: 40px;
|
||||
height: 22px;
|
||||
margin-right: 8px;
|
||||
color: rgb(255, 255, 255);
|
||||
font-size: 21px;
|
||||
font-weight: 600;
|
||||
text-align: center;
|
||||
padding: 0.42em 0px;
|
||||
background: rgb(255, 211, 79);
|
||||
border-radius: 1em;
|
||||
}
|
||||
|
||||
.dsq-icon-support {
|
||||
font-size: 72px;
|
||||
width: 72px;
|
||||
height: 72px;
|
||||
display: block;
|
||||
margin: 0 auto 5px auto;
|
||||
}
|
||||
|
||||
.dsq-support-list-container {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.dsq-support-list-item {
|
||||
text-align: center;
|
||||
padding: 10px 30px;
|
||||
}
|
||||
|
||||
.dsq-support-list-item a {
|
||||
text-decoration: none;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
<?php
|
||||
// Silence is golden.
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
/**
|
||||
* Provide a admin area view for the plugin
|
||||
*
|
||||
* This file is used to markup the admin-facing aspects of the plugin.
|
||||
*
|
||||
* @link https://disqus.com
|
||||
* @since 3.0
|
||||
*
|
||||
* @package Disqus
|
||||
* @subpackage Disqus/admin/partials
|
||||
*/
|
||||
|
||||
?>
|
||||
|
||||
<div id="disqus-admin"></div>
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
<?php
|
||||
/**
|
||||
* The plugin bootstrap file
|
||||
*
|
||||
* This file is read by WordPress to generate the plugin information in the plugin
|
||||
* admin area. This file also includes all of the dependencies used by the plugin,
|
||||
* registers the activation and deactivation functions, and defines a function
|
||||
* that starts the plugin.
|
||||
*
|
||||
* @link https://disqus.com
|
||||
* @since 3.0
|
||||
* @package Disqus
|
||||
*
|
||||
* @wordpress-plugin
|
||||
* Plugin Name: Disqus for WordPress
|
||||
* Plugin URI: https://disqus.com/
|
||||
* Description: Disqus helps publishers increase engagement and build loyal audiences. Supports syncing comments to your database for easy backup.
|
||||
* Version: 3.0.22
|
||||
* Author: Disqus
|
||||
* Author URI: https://disqus.com/
|
||||
* License: GPL-2.0+
|
||||
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
|
||||
* Text Domain: disqus
|
||||
* Domain Path: /languages
|
||||
*/
|
||||
|
||||
$DISQUSVERSION = '3.0.22';
|
||||
|
||||
// If this file is called directly, abort.
|
||||
if ( ! defined( 'WPINC' ) ) {
|
||||
die;
|
||||
}
|
||||
|
||||
/**
|
||||
* The code that runs during plugin activation (but not during updates).
|
||||
*/
|
||||
function activate_disqus() {
|
||||
if ( version_compare( phpversion(), '5.4', '<' ) ) {
|
||||
deactivate_plugins( plugin_basename( __FILE__ ) );
|
||||
wp_die( 'Disqus requires PHP version 5.4 or higher. Plugin was deactivated.' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The code that runs during plugin deactivation.
|
||||
* This action is documented in includes/class-disqus-deactivator.php
|
||||
*/
|
||||
function deactivate_disqus() {
|
||||
require_once plugin_dir_path( __FILE__ ) . 'includes/class-disqus-deactivator.php';
|
||||
Disqus_Deactivator::deactivate();
|
||||
}
|
||||
|
||||
register_activation_hook( __FILE__, 'activate_disqus' );
|
||||
register_deactivation_hook( __FILE__, 'deactivate_disqus' );
|
||||
|
||||
/**
|
||||
* The core plugin class that is used to define internationalization,
|
||||
* admin-specific hooks, and public-facing site hooks.
|
||||
*/
|
||||
require plugin_dir_path( __FILE__ ) . 'includes/class-disqus.php';
|
||||
|
||||
/**
|
||||
* Begins execution of the plugin.
|
||||
*
|
||||
* Since everything within the plugin is registered via hooks,
|
||||
* then kicking off the plugin from this point in the file does
|
||||
* not affect the page life cycle.
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
function run_disqus() {
|
||||
global $DISQUSVERSION;
|
||||
|
||||
$plugin = new Disqus( $DISQUSVERSION );
|
||||
$plugin->run();
|
||||
|
||||
}
|
||||
run_disqus();
|
||||
|
|
@ -0,0 +1,130 @@
|
|||
<?php
|
||||
/**
|
||||
* The service for making requests to the Disqus API
|
||||
*
|
||||
* @link https://disqus.com
|
||||
* @since 3.0
|
||||
*
|
||||
* @package Disqus
|
||||
* @subpackage Disqus/includes
|
||||
*/
|
||||
|
||||
/**
|
||||
* The service for making requests to the Disqus API
|
||||
*
|
||||
* @package Disqus
|
||||
* @subpackage Disqus/includes
|
||||
* @author Ryan Valentin <ryan@disqus.com>
|
||||
*/
|
||||
class Disqus_Api_Service {
|
||||
|
||||
const DISQUS_API_BASE = 'https://disqus.com/api/3.0/';
|
||||
|
||||
/**
|
||||
* The Disqus API secret key.
|
||||
*
|
||||
* @since 3.0
|
||||
* @access private
|
||||
* @var string $api_secret The Disqus API secret key.
|
||||
*/
|
||||
private $api_secret;
|
||||
|
||||
/**
|
||||
* The Disqus access token for authentication.
|
||||
*
|
||||
* @since 3.0
|
||||
* @access private
|
||||
* @var string $access_token The Disqus access token for authentication.
|
||||
*/
|
||||
private $access_token;
|
||||
|
||||
/**
|
||||
* Initialize the class and set its properties.
|
||||
*
|
||||
* @since 3.0
|
||||
* @param string $api_secret The Disqus API secret key.
|
||||
* @param string $access_token The admin access token associated with the $api_secret.
|
||||
*/
|
||||
public function __construct( $api_secret, $access_token = '' ) {
|
||||
$this->api_secret = $api_secret;
|
||||
$this->access_token = $access_token;
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes a GET request to the Disqus API.
|
||||
*
|
||||
* @since 3.0
|
||||
* @param string $endpoint The Disqus API secret key.
|
||||
* @param array $params The params to be appended to the query.
|
||||
* @return mixed The response data.
|
||||
*/
|
||||
public function api_get( $endpoint, $params ) {
|
||||
$api_url = Disqus_Api_Service::DISQUS_API_BASE . $endpoint . '.json?'
|
||||
. 'api_secret=' . $this->api_secret
|
||||
. '&access_token=' . $this->access_token;
|
||||
|
||||
foreach ( $params as $key => $values_array ) {
|
||||
if ( ! is_array( $values_array ) ) {
|
||||
$values_array = array( $values_array );
|
||||
}
|
||||
|
||||
foreach ( $values_array as $value ) {
|
||||
$api_url .= '&' . $key . '=' . urlencode( $value );
|
||||
}
|
||||
}
|
||||
|
||||
$dsq_response = wp_remote_get( $api_url, array(
|
||||
'headers' => array(
|
||||
'Referer' => '', // Unset referer so we can use secret key.
|
||||
),
|
||||
) );
|
||||
|
||||
return $this->get_response_body( $dsq_response );
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes a POST request to the Disqus API.
|
||||
*
|
||||
* @since 3.0
|
||||
* @param string $endpoint The Disqus API secret key.
|
||||
* @param array $params The params to be added to the body.
|
||||
* @return mixed The response data.
|
||||
*/
|
||||
public function api_post( $endpoint, $params ) {
|
||||
$api_url = Disqus_Api_Service::DISQUS_API_BASE . $endpoint . '.json?'
|
||||
. 'api_secret=' . $this->api_secret
|
||||
. '&access_token=' . $this->access_token;
|
||||
|
||||
$dsq_response = wp_remote_post( $api_url, array(
|
||||
'body' => $params,
|
||||
'headers' => array(
|
||||
'Referer' => '', // Unset referer so we can use secret key.
|
||||
),
|
||||
'method' => 'POST',
|
||||
) );
|
||||
|
||||
return $this->get_response_body( $dsq_response );
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the type of response and returns and object variable with the Disqus response.
|
||||
*
|
||||
* @since 3.0
|
||||
* @param WP_Error|array $response The remote response.
|
||||
* @return mixed The response body in Disqus API format.
|
||||
*/
|
||||
private function get_response_body( $response ) {
|
||||
if ( is_wp_error( $response ) ) {
|
||||
// The WP_Error class has no way of getting the response body, so we have to
|
||||
// emulate the Disqus API error format for downstream compatibility.
|
||||
$error_message = $response->get_error_message();
|
||||
$response = new StdClass();
|
||||
$response->code = 2;
|
||||
$response->response = $error_message;
|
||||
} else {
|
||||
$response = json_decode( $response['body'] );
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
/**
|
||||
* Fired during plugin deactivation
|
||||
*
|
||||
* @link https://disqus.com
|
||||
* @since 3.0
|
||||
*
|
||||
* @package Disqus
|
||||
* @subpackage Disqus/includes
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fired during plugin deactivation.
|
||||
*
|
||||
* This class defines all code necessary to run during the plugin's deactivation.
|
||||
*
|
||||
* @since 3.0
|
||||
* @package Disqus
|
||||
* @subpackage Disqus/includes
|
||||
* @author Ryan Valentin <ryan@disqus.com>
|
||||
*/
|
||||
class Disqus_Deactivator {
|
||||
|
||||
/**
|
||||
* Short Description. (use period)
|
||||
*
|
||||
* Long Description.
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public static function deactivate() {
|
||||
// TODO: Call Disqus to disable syncing webhooks?
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,128 @@
|
|||
<?php
|
||||
/**
|
||||
* Register all actions and filters for the plugin
|
||||
*
|
||||
* @link https://disqus.com
|
||||
* @since 3.0
|
||||
*
|
||||
* @package Disqus
|
||||
* @subpackage Disqus/includes
|
||||
*/
|
||||
|
||||
/**
|
||||
* Register all actions and filters for the plugin.
|
||||
*
|
||||
* Maintain a list of all hooks that are registered throughout
|
||||
* the plugin, and register them with the WordPress API. Call the
|
||||
* run function to execute the list of actions and filters.
|
||||
*
|
||||
* @package Disqus
|
||||
* @subpackage Disqus/includes
|
||||
* @author Ryan Valentin <ryan@disqus.com>
|
||||
*/
|
||||
class Disqus_Loader {
|
||||
|
||||
/**
|
||||
* The array of actions registered with WordPress.
|
||||
*
|
||||
* @since 3.0
|
||||
* @access protected
|
||||
* @var array $actions The actions registered with WordPress to fire when the plugin loads.
|
||||
*/
|
||||
protected $actions;
|
||||
|
||||
/**
|
||||
* The array of filters registered with WordPress.
|
||||
*
|
||||
* @since 3.0
|
||||
* @access protected
|
||||
* @var array $filters The filters registered with WordPress to fire when the plugin loads.
|
||||
*/
|
||||
protected $filters;
|
||||
|
||||
/**
|
||||
* Initialize the collections used to maintain the actions and filters.
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
$this->actions = array();
|
||||
$this->filters = array();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new action to the collection to be registered with WordPress.
|
||||
*
|
||||
* @since 3.0
|
||||
* @param string $hook The name of the WordPress action that is being registered.
|
||||
* @param object $component A reference to the instance of the object on which the action is defined.
|
||||
* @param string $callback The name of the function definition on the $component.
|
||||
* @param int Optional $priority The priority at which the function should be fired.
|
||||
* @param int Optional $accepted_args The number of arguments that should be passed to the $callback.
|
||||
*/
|
||||
public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
|
||||
$this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new filter to the collection to be registered with WordPress.
|
||||
*
|
||||
* @since 3.0
|
||||
* @param string $hook The name of the WordPress filter that is being registered.
|
||||
* @param object $component A reference to the instance of the object on which the filter is defined.
|
||||
* @param string $callback The name of the function definition on the $component.
|
||||
* @param int Optional $priority The priority at which the function should be fired.
|
||||
* @param int Optional $accepted_args The number of arguments that should be passed to the $callback.
|
||||
*/
|
||||
public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
|
||||
$this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args );
|
||||
}
|
||||
|
||||
/**
|
||||
* A utility function that is used to register the actions and hooks into a single
|
||||
* collection.
|
||||
*
|
||||
* @since 3.0
|
||||
* @access private
|
||||
* @param array $hooks The collection of hooks that is being registered (that is, actions or filters).
|
||||
* @param string $hook The name of the WordPress filter that is being registered.
|
||||
* @param object $component A reference to the instance of the object on which the filter is defined.
|
||||
* @param string $callback The name of the function definition on the $component.
|
||||
* @param int Optional $priority The priority at which the function should be fired.
|
||||
* @param int Optional $accepted_args The number of arguments that should be passed to the $callback.
|
||||
* @return type The collection of actions and filters registered with WordPress.
|
||||
*/
|
||||
private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) {
|
||||
|
||||
$hooks[] = array(
|
||||
'hook' => $hook,
|
||||
'component' => $component,
|
||||
'callback' => $callback,
|
||||
'priority' => $priority,
|
||||
'accepted_args' => $accepted_args,
|
||||
);
|
||||
|
||||
return $hooks;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the filters and actions with WordPress.
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public function run() {
|
||||
|
||||
foreach ( $this->filters as $hook ) {
|
||||
add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
|
||||
}
|
||||
|
||||
foreach ( $this->actions as $hook ) {
|
||||
add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,285 @@
|
|||
<?php
|
||||
/**
|
||||
* The file that defines the core plugin class
|
||||
*
|
||||
* A class definition that includes attributes and functions used across both the
|
||||
* public-facing side of the site and the admin area.
|
||||
*
|
||||
* @link https://disqus.com
|
||||
* @since 3.0
|
||||
*
|
||||
* @package Disqus
|
||||
* @subpackage Disqus/includes
|
||||
*/
|
||||
|
||||
/**
|
||||
* The core plugin class.
|
||||
*
|
||||
* This is used to define internationalization, admin-specific hooks, and
|
||||
* public-facing site hooks.
|
||||
*
|
||||
* Also maintains the unique identifier of this plugin as well as the current
|
||||
* version of the plugin.
|
||||
*
|
||||
* @since 3.0
|
||||
* @package Disqus
|
||||
* @subpackage Disqus/includes
|
||||
* @author Ryan Valentin <ryan@disqus.com>
|
||||
*/
|
||||
class Disqus {
|
||||
|
||||
/**
|
||||
* Instance of the Disqus API service.
|
||||
*
|
||||
* @since 3.0
|
||||
* @access private
|
||||
* @var Disqus_Api_Service $api_service Instance of the Disqus API service.
|
||||
*/
|
||||
private $api_service;
|
||||
|
||||
/**
|
||||
* The loader that's responsible for maintaining and registering all hooks that power
|
||||
* the plugin.
|
||||
*
|
||||
* @since 3.0
|
||||
* @access protected
|
||||
* @var Disqus_Loader $loader Maintains and registers all hooks for the plugin.
|
||||
*/
|
||||
protected $loader;
|
||||
|
||||
/**
|
||||
* The unique identifier of this plugin.
|
||||
*
|
||||
* @since 3.0
|
||||
* @access protected
|
||||
* @var string $disqus The string used to uniquely identify this plugin.
|
||||
*/
|
||||
protected $disqus;
|
||||
|
||||
/**
|
||||
* The current version of the plugin.
|
||||
*
|
||||
* @since 3.0
|
||||
* @access protected
|
||||
* @var string $version The current version of the plugin.
|
||||
*/
|
||||
protected $version;
|
||||
|
||||
/**
|
||||
* The unique Disqus forum shortname.
|
||||
*
|
||||
* @since 3.0
|
||||
* @access protected
|
||||
* @var string $shortname The unique Disqus forum shortname.
|
||||
*/
|
||||
protected $shortname;
|
||||
|
||||
/**
|
||||
* Define the core functionality of the plugin.
|
||||
*
|
||||
* Set the plugin name and the plugin version that can be used throughout the plugin.
|
||||
* Load the dependencies, and set the hooks for the admin area and the public-facing
|
||||
* side of the site.
|
||||
*
|
||||
* @since 3.0
|
||||
* @param string $version The version of this plugin.
|
||||
*/
|
||||
public function __construct( $version ) {
|
||||
|
||||
$this->disqus = 'disqus';
|
||||
$this->version = $version;
|
||||
$this->shortname = strtolower( get_option( 'disqus_forum_url' ) );
|
||||
|
||||
$this->load_dependencies();
|
||||
$this->define_admin_hooks();
|
||||
$this->define_public_hooks();
|
||||
$this->define_rest_api_hooks();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the required dependencies for this plugin.
|
||||
*
|
||||
* Include the following files that make up the plugin:
|
||||
*
|
||||
* - Disqus_Loader. Orchestrates the hooks of the plugin.
|
||||
* - Disqus_Admin. Defines all hooks for the admin area.
|
||||
* - Disqus_Public. Defines all hooks for the public side of the site.
|
||||
*
|
||||
* Create an instance of the loader which will be used to register the hooks
|
||||
* with WordPress.
|
||||
*
|
||||
* @since 3.0
|
||||
* @access private
|
||||
*/
|
||||
private function load_dependencies() {
|
||||
|
||||
/**
|
||||
* The class responsible for orchestrating the actions and filters of the
|
||||
* core plugin.
|
||||
*/
|
||||
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-disqus-loader.php';
|
||||
|
||||
/**
|
||||
* The class responsible making requests to the Disqus API.
|
||||
*/
|
||||
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-disqus-api-service.php';
|
||||
|
||||
/**
|
||||
* The class responsible for defining all actions that occur in the admin area.
|
||||
*/
|
||||
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-disqus-admin.php';
|
||||
|
||||
/**
|
||||
* The class responsible for defining all actions that occur in the public-facing
|
||||
* side of the site.
|
||||
*/
|
||||
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-disqus-public.php';
|
||||
|
||||
/**
|
||||
* The class responsible for defining all actions that occur on the REST API of
|
||||
* the site.
|
||||
*/
|
||||
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'rest-api/class-disqus-rest-api.php';
|
||||
|
||||
$secret_key = get_option( 'disqus_secret_key' );
|
||||
$access_token = get_option( 'disqus_admin_access_token' );
|
||||
|
||||
$this->api_service = new Disqus_Api_Service( $secret_key, $access_token );
|
||||
$this->loader = new Disqus_Loader();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register all of the hooks related to the admin area functionality
|
||||
* of the plugin.
|
||||
*
|
||||
* @since 3.0
|
||||
* @access private
|
||||
*/
|
||||
private function define_admin_hooks() {
|
||||
$plugin_admin = new Disqus_Admin( $this->get_disqus_name(), $this->get_version(), $this->get_shortname() );
|
||||
|
||||
$this->loader->add_filter( 'rest_url', $plugin_admin, 'dsq_filter_rest_url' );
|
||||
$this->loader->add_filter( 'plugin_action_links', $plugin_admin, 'dsq_plugin_action_links', 10, 2 );
|
||||
$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
|
||||
$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
|
||||
$this->loader->add_action( 'admin_menu', $plugin_admin, 'dsq_contruct_admin_menu' );
|
||||
$this->loader->add_action( 'admin_bar_menu', $plugin_admin, 'dsq_construct_admin_bar', 999 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Register all of the hooks related to the public-facing functionality
|
||||
* of the plugin.
|
||||
*
|
||||
* @since 3.0
|
||||
* @access private
|
||||
*/
|
||||
private function define_public_hooks() {
|
||||
$plugin_public = new Disqus_Public( $this->get_disqus_name(), $this->get_version(), $this->get_shortname() );
|
||||
|
||||
$this->loader->add_filter( 'comments_number', $plugin_public, 'dsq_comments_link_template' );
|
||||
$this->loader->add_filter( 'comments_template', $plugin_public, 'dsq_comments_template' );
|
||||
$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_comment_count' );
|
||||
$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_comment_embed' );
|
||||
$this->loader->add_action( 'show_user_profile', $plugin_public, 'dsq_close_window_template' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Register all of the hooks related to the REST API functionality
|
||||
* of the plugin.
|
||||
*
|
||||
* @since 3.0
|
||||
* @access private
|
||||
*/
|
||||
private function define_rest_api_hooks() {
|
||||
$plugin_rest_api = new Disqus_Rest_Api( $this->get_api_service(), $this->get_version() );
|
||||
|
||||
$this->loader->add_action( 'rest_api_init', $plugin_rest_api, 'register_endpoints' );
|
||||
|
||||
$this->loader->add_filter( 'rest_pre_serve_request', $plugin_rest_api, 'filter_rest_pre_serve_request', 10, 4 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the loader to execute all of the hooks with WordPress.
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public function run() {
|
||||
$this->loader->run();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns instance of the Disqus API service.
|
||||
*
|
||||
* @since 3.0
|
||||
* @return string Instance of the Disqus API service.
|
||||
*/
|
||||
public function get_api_service() {
|
||||
return $this->api_service;
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of the plugin used to uniquely identify it within the context of
|
||||
* WordPress and to define internationalization functionality.
|
||||
*
|
||||
* @since 3.0
|
||||
* @return string The name of the plugin.
|
||||
*/
|
||||
public function get_disqus_name() {
|
||||
return $this->disqus;
|
||||
}
|
||||
|
||||
/**
|
||||
* The reference to the class that orchestrates the hooks with the plugin.
|
||||
*
|
||||
* @since 3.0
|
||||
* @return Disqus_Loader Orchestrates the hooks of the plugin.
|
||||
*/
|
||||
public function get_loader() {
|
||||
return $this->loader;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the version number of the plugin.
|
||||
*
|
||||
* @since 3.0
|
||||
* @return string The version number of the plugin.
|
||||
*/
|
||||
public function get_version() {
|
||||
return $this->version;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the installed Disqus shortname.
|
||||
*
|
||||
* @since 3.0
|
||||
* @return string The installed shortname.
|
||||
*/
|
||||
public function get_shortname() {
|
||||
return $this->shortname;
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats the unique disqus_identifier for a given post.
|
||||
*
|
||||
* @since 3.0
|
||||
* @param string $post The WordPress post object.
|
||||
* @return string The unique disqus_identifier.
|
||||
*/
|
||||
public function dsq_identifier_for_post( $post ) {
|
||||
return $post->ID . ' ' . $post->guid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats the title for a given post.
|
||||
*
|
||||
* @since 3.0
|
||||
* @param string $post The WordPress post object.
|
||||
* @return string The formatted disqus_title.
|
||||
*/
|
||||
public function dsq_title_for_post( $post ) {
|
||||
$title = get_the_title( $post );
|
||||
$title = strip_tags( $title, '<b><u><i><h1><h2><h3><code><blockquote><br><hr>' );
|
||||
return $title;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
<?php
|
||||
// Silence is golden.
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
<?php
|
||||
// Silence is golden.
|
||||
|
|
@ -0,0 +1,346 @@
|
|||
<?php
|
||||
/**
|
||||
* The public-facing functionality of the plugin.
|
||||
*
|
||||
* @link http://example.com
|
||||
* @since 3.0
|
||||
*
|
||||
* @package Plugin_Name
|
||||
* @subpackage Plugin_Name/public
|
||||
*/
|
||||
|
||||
/**
|
||||
* The public-facing functionality of the plugin.
|
||||
*
|
||||
* Defines the plugin name, version, and two examples hooks for how to
|
||||
* enqueue the admin-specific stylesheet and JavaScript.
|
||||
*
|
||||
* @package Plugin_Name
|
||||
* @subpackage Plugin_Name/public
|
||||
* @author Your Name <email@example.com>
|
||||
*/
|
||||
class Disqus_Public {
|
||||
|
||||
/**
|
||||
* Returns the Disqus identifier for a given post.
|
||||
*
|
||||
* @since 3.0
|
||||
* @param WP_Post $post The WordPress post to create the title for.
|
||||
* @return string The formatted identifier to be passed to Disqus.
|
||||
*/
|
||||
public static function dsq_identifier_for_post( $post ) {
|
||||
return $post->ID . ' ' . $post->guid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Disqus title for a given post.
|
||||
*
|
||||
* @since 3.0
|
||||
* @param WP_Post $post The WordPress post to create the title for.
|
||||
* @return string The cleaned title to be passed to Disqus.
|
||||
*/
|
||||
public static function dsq_title_for_post( $post ) {
|
||||
$title = get_the_title( $post );
|
||||
$title = strip_tags( $title, '<b><u><i><h1><h2><h3><code><blockquote><br><hr>' );
|
||||
return $title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the signed payload to authenticate an SSO user in Disqus.
|
||||
*
|
||||
* @since 3.0
|
||||
* @param WP_User $user The WordPress user to authenticate.
|
||||
* @param string $secret_key The Disqus API Secret Key.
|
||||
* @return array The signed payload to authenticate a user with Single Sign-On.
|
||||
*/
|
||||
public static function remote_auth_s3_for_user( $user, $secret_key ) {
|
||||
$payload_user = array();
|
||||
if ( $user->ID ) {
|
||||
$payload_user['id'] = $user->ID;
|
||||
$payload_user['username'] = $user->display_name;
|
||||
$payload_user['avatar'] = get_avatar_url( $user->ID, 92 );
|
||||
$payload_user['email'] = $user->user_email;
|
||||
$payload_user['url'] = $user->user_url;
|
||||
}
|
||||
$payload_user = base64_encode( json_encode( $payload_user ) );
|
||||
$time = time();
|
||||
$hmac = hash_hmac( 'sha1', $payload_user . ' ' . $time, $secret_key );
|
||||
|
||||
return $payload_user . ' ' . $hmac . ' ' . $time;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Disqus comments embed configuration.
|
||||
*
|
||||
* @since 3.0
|
||||
* @access private
|
||||
* @param WP_Post $post The WordPress post to create the configuration for.
|
||||
* @return array The embed configuration to localize the comments embed script with.
|
||||
*/
|
||||
public static function embed_vars_for_post( $post ) {
|
||||
global $DISQUSVERSION;
|
||||
|
||||
$embed_vars = array(
|
||||
'disqusConfig' => array(
|
||||
'integration' => 'wordpress ' . $DISQUSVERSION,
|
||||
),
|
||||
'disqusIdentifier' => Disqus_Public::dsq_identifier_for_post( $post ),
|
||||
'disqusShortname' => get_option( 'disqus_forum_url' ),
|
||||
'disqusTitle' => Disqus_Public::dsq_title_for_post( $post ),
|
||||
'disqusUrl' => get_permalink( $post ),
|
||||
'postId' => $post->ID,
|
||||
);
|
||||
|
||||
$public_key = get_option( 'disqus_public_key' );
|
||||
$secret_key = get_option( 'disqus_secret_key' );
|
||||
$can_enable_sso = $public_key && $secret_key && get_option( 'disqus_sso_enabled' );
|
||||
if ( $can_enable_sso ) {
|
||||
$user = wp_get_current_user();
|
||||
$login_redirect = get_admin_url( null, 'profile.php?opener=dsq-sso-login' );
|
||||
$embed_vars['disqusConfig']['sso'] = array(
|
||||
'name' => esc_js( get_bloginfo( 'name' ) ),
|
||||
'button' => esc_js( get_option( 'disqus_sso_button' ) ),
|
||||
'url' => wp_login_url( $login_redirect ),
|
||||
'logout' => wp_logout_url(),
|
||||
'width' => '800',
|
||||
'height' => '700',
|
||||
);
|
||||
$embed_vars['disqusConfig']['api_key'] = $public_key;
|
||||
$embed_vars['disqusConfig']['remote_auth_s3'] = Disqus_Public::remote_auth_s3_for_user( $user, $secret_key );
|
||||
}
|
||||
|
||||
return $embed_vars;
|
||||
}
|
||||
|
||||
/**
|
||||
* The ID of this plugin.
|
||||
*
|
||||
* @since 3.0
|
||||
* @access private
|
||||
* @var string $disqus The ID of this plugin.
|
||||
*/
|
||||
private $disqus;
|
||||
|
||||
/**
|
||||
* The version of this plugin.
|
||||
*
|
||||
* @since 3.0
|
||||
* @access private
|
||||
* @var string $version The current version of this plugin.
|
||||
*/
|
||||
private $version;
|
||||
|
||||
/**
|
||||
* The unique Disqus forum shortname.
|
||||
*
|
||||
* @since 3.0
|
||||
* @access private
|
||||
* @var string $shortname The unique Disqus forum shortname.
|
||||
*/
|
||||
private $shortname;
|
||||
|
||||
/**
|
||||
* Initialize the class and set its properties.
|
||||
*
|
||||
* @since 3.0
|
||||
* @param string $disqus The name of the plugin.
|
||||
* @param string $version The version of this plugin.
|
||||
* @param string $shortname The configured Disqus shortname.
|
||||
*/
|
||||
public function __construct( $disqus, $version, $shortname ) {
|
||||
$this->disqus = $disqus;
|
||||
$this->version = $version;
|
||||
$this->shortname = $shortname;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if Disqus is configured and can load on a given page.
|
||||
*
|
||||
* @since 3.0
|
||||
* @param string $comment_text The default comment text.
|
||||
* @return string The new comment text.
|
||||
*/
|
||||
public function dsq_comments_link_template( $comment_text ) {
|
||||
global $post;
|
||||
|
||||
if ( $this->dsq_can_load( 'count' ) ) {
|
||||
$disqus_identifier = esc_attr( $this->dsq_identifier_for_post( $post ) );
|
||||
return '<span class="dsq-postid" data-dsqidentifier="' . $disqus_identifier . '">'
|
||||
. $comment_text .
|
||||
'</span>';
|
||||
} else {
|
||||
return $comment_text;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Disqus embed comments template
|
||||
*
|
||||
* @since 3.0
|
||||
* @return string The new comment text.
|
||||
*/
|
||||
public function dsq_comments_template() {
|
||||
global $post;
|
||||
|
||||
if ( $this->dsq_embed_can_load_for_post( $post ) ) {
|
||||
|
||||
do_action( 'dsq_before_comments' );
|
||||
do_action( 'dsq_enqueue_comments_script' );
|
||||
|
||||
return plugin_dir_path( dirname( __FILE__ ) ) . 'public/partials/disqus-public-display.php';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders a script which checks to see if the window was opened
|
||||
* by the Disqus embed for Single Sign-on purposes, and closes
|
||||
* itself.
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public function dsq_close_window_template() {
|
||||
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/partials/disqus-public-sso-login-profile.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueues javascript files for displaying comment counts.
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public function enqueue_comment_count() {
|
||||
global $post;
|
||||
|
||||
if ( $this->dsq_comment_count_can_load_for_post( $post ) ) {
|
||||
|
||||
$count_vars = array(
|
||||
'disqusShortname' => $this->shortname,
|
||||
);
|
||||
|
||||
wp_enqueue_script( $this->disqus . '_count', plugin_dir_url( __FILE__ ) . 'js/comment_count.js', array(), $this->version, true );
|
||||
wp_localize_script( $this->disqus . '_count', 'countVars', $count_vars );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueues javascript files for displaying the comment embed.
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public function enqueue_comment_embed() {
|
||||
global $post;
|
||||
|
||||
if ( $this->dsq_embed_can_load_for_post( $post ) && ! get_option( 'disqus_render_js' ) ) {
|
||||
|
||||
$embed_vars = Disqus_Public::embed_vars_for_post( $post );
|
||||
|
||||
wp_enqueue_script( $this->disqus . '_embed', plugin_dir_url( __FILE__ ) . 'js/comment_embed.js', array(), $this->version, true );
|
||||
wp_localize_script( $this->disqus . '_embed', 'embedVars', $embed_vars );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if Disqus is configured and can load on a given page.
|
||||
*
|
||||
* @since 3.0
|
||||
* @access private
|
||||
* @param string $script_name The name of the script Disqus intends to load.
|
||||
* @return boolean Whether Disqus is configured properly and can load on the current page.
|
||||
*/
|
||||
private function dsq_can_load( $script_name ) {
|
||||
// Don't load any Disqus scripts if there's no shortname.
|
||||
if ( ! $this->shortname ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Don't load any Disqus scripts on feed pages.
|
||||
if ( is_feed() ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$site_allows_load = apply_filters( 'dsq_can_load', $script_name );
|
||||
if ( is_bool( $site_allows_load ) ) {
|
||||
return $site_allows_load;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if Disqus is configured and should load the comment count script on a given page.
|
||||
*
|
||||
* @since 3.0.18
|
||||
* @access private
|
||||
* @param WP_Post $post The WordPress post used to determine if Disqus can be loaded.
|
||||
* @return boolean Whether Disqus is configured properly and should load the comment count on the current page.
|
||||
*/
|
||||
private function dsq_comment_count_can_load_for_post( $post ) {
|
||||
// Checks if the plugin is configured properly
|
||||
// and is a valid page.
|
||||
if ( ! $this->dsq_can_load( 'count' ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Make sure we have a $post object.
|
||||
if ( ! isset( $post ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Make sure comments are open if it's a single post page.
|
||||
if ( is_singular() && ! comments_open() ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if Disqus is configured and can the comments embed on a given page.
|
||||
*
|
||||
* @since 3.0
|
||||
* @access private
|
||||
* @param WP_Post $post The WordPress post used to determine if Disqus can be loaded.
|
||||
* @return boolean Whether Disqus is configured properly and can load on the current page.
|
||||
*/
|
||||
private function dsq_embed_can_load_for_post( $post ) {
|
||||
// Checks if the plugin is configured properly
|
||||
// and is a valid page.
|
||||
if ( ! $this->dsq_can_load( 'embed' ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Make sure we have a $post object.
|
||||
if ( ! isset( $post ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Don't load embed for certain types of non-public posts because these post types typically still have the
|
||||
// ID-based URL structure, rather than a friendly permalink URL.
|
||||
$illegal_post_statuses = array(
|
||||
'draft',
|
||||
'auto-draft',
|
||||
'pending',
|
||||
'future',
|
||||
'trash',
|
||||
);
|
||||
if ( in_array( $post->post_status, $illegal_post_statuses ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Don't load embed when comments are closed on a post.
|
||||
if ( 'open' != $post->comment_status ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Don't load embed when comments are closed on a post. These lines can solve a conflict with plugin Public Post Preview.
|
||||
if ( ! comments_open() ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Don't load embed if it's not a single post page.
|
||||
if ( ! is_singular() ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
<?php
|
||||
// Silence is golden.
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
var disqus_shortname = countVars.disqusShortname;
|
||||
(function () {
|
||||
var nodes = document.getElementsByTagName('span');
|
||||
for (var i = 0, url; i < nodes.length; i++) {
|
||||
if (nodes[i].className.indexOf('dsq-postid') != -1 && nodes[i].parentNode.tagName == 'A') {
|
||||
nodes[i].parentNode.setAttribute('data-disqus-identifier', nodes[i].getAttribute('data-dsqidentifier'));
|
||||
url = nodes[i].parentNode.href.split('#', 1);
|
||||
if (url.length == 1) { url = url[0]; }
|
||||
else { url = url[1]; }
|
||||
nodes[i].parentNode.href = url + '#disqus_thread';
|
||||
}
|
||||
}
|
||||
var s = document.createElement('script');
|
||||
s.async = true;
|
||||
s.type = 'text/javascript';
|
||||
s.src = 'https://' + disqus_shortname + '.disqus.com/count.js';
|
||||
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
|
||||
}());
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
var disqus_url = embedVars.disqusUrl;
|
||||
var disqus_identifier = embedVars.disqusIdentifier;
|
||||
var disqus_container_id = 'disqus_thread';
|
||||
var disqus_shortname = embedVars.disqusShortname;
|
||||
var disqus_title = embedVars.disqusTitle;
|
||||
var disqus_config_custom = window.disqus_config;
|
||||
var disqus_config = function () {
|
||||
/*
|
||||
All currently supported events:
|
||||
onReady: fires when everything is ready,
|
||||
onNewComment: fires when a new comment is posted,
|
||||
onIdentify: fires when user is authenticated
|
||||
*/
|
||||
var dsqConfig = embedVars.disqusConfig;
|
||||
this.page.integration = dsqConfig.integration;
|
||||
this.page.remote_auth_s3 = dsqConfig.remote_auth_s3;
|
||||
this.page.api_key = dsqConfig.api_key;
|
||||
this.sso = dsqConfig.sso;
|
||||
this.language = dsqConfig.language;
|
||||
|
||||
if (disqus_config_custom)
|
||||
disqus_config_custom.call(this);
|
||||
};
|
||||
|
||||
(function() {
|
||||
if (document.getElementById(disqus_container_id)) {
|
||||
var dsq = document.createElement('script');
|
||||
dsq.type = 'text/javascript';
|
||||
dsq.async = true;
|
||||
dsq.src = 'https://' + disqus_shortname + '.disqus.com/embed.js';
|
||||
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
|
||||
}
|
||||
})();
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
/**
|
||||
* Markup which will replace the WordPress comments section on a given page.
|
||||
*
|
||||
* @link https://disqus.com
|
||||
* @since 3.0
|
||||
*
|
||||
* @package Disqus
|
||||
* @subpackage Disqus/public/partials
|
||||
*/
|
||||
|
||||
?>
|
||||
|
||||
<div id="disqus_thread"></div>
|
||||
<?php
|
||||
if ( get_option( 'disqus_render_js' ) ) {
|
||||
global $post;
|
||||
$embed_vars = Disqus_Public::embed_vars_for_post( $post );
|
||||
$js = file_get_contents( plugin_dir_path( dirname( dirname( __FILE__ ) ) ) . 'public/js/comment_embed.js' );
|
||||
?>
|
||||
<script>
|
||||
var embedVars = <?php echo json_encode( $embed_vars ); ?>;
|
||||
<?php echo $js; ?>
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
/**
|
||||
* Markup rendered as part of a user's own profile page which will check
|
||||
* a query param to determine if it was opened in a child window, as in
|
||||
* the case of clicking "Log in" to an SSO account via the Disqus embed,
|
||||
* and will close the window. We do this because the embed is waiting for
|
||||
* the window to close before reloading with the authenticated user.
|
||||
*
|
||||
* @link https://disqus.com
|
||||
* @since 3.0
|
||||
*
|
||||
* @package Disqus
|
||||
* @subpackage Disqus/public/partials
|
||||
*/
|
||||
|
||||
?>
|
||||
|
||||
<script>
|
||||
var win = window;
|
||||
var isWindowed = win.opener && win.opener !== win.top;
|
||||
var isDsqRedirect = win.location.href.indexOf('opener=dsq-sso-login') > -1;
|
||||
if (isWindowed && isDsqRedirect)
|
||||
window.close();
|
||||
</script>
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
<?php
|
||||
// Silence is golden.
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
/**
|
||||
* Fired when the plugin is uninstalled.
|
||||
*
|
||||
* @link https://disqus.com
|
||||
* @since 3.0
|
||||
*
|
||||
* @package Disqus
|
||||
*/
|
||||
|
||||
// If uninstall not called from WordPress, then exit.
|
||||
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( ! current_user_can( 'install_plugins' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
delete_option( 'disqus_forum_url' );
|
||||
delete_option( 'disqus_sso_enabled' );
|
||||
delete_option( 'disqus_public_key' );
|
||||
delete_option( 'disqus_secret_key' );
|
||||
delete_option( 'disqus_admin_access_token' );
|
||||
delete_option( 'disqus_sso_button' );
|
||||
delete_option( 'disqus_sync_token' );
|
||||
delete_option( 'disqus_last_sync_message' );
|
||||
delete_option( 'disqus_render_js' );
|
||||
delete_option( 'disqus_manual_sync' ); // Legacy option.
|
||||
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 76 KiB |
|
After Width: | Height: | Size: 93 KiB |
|
After Width: | Height: | Size: 143 KiB |
|
After Width: | Height: | Size: 416 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 76 KiB |
|
After Width: | Height: | Size: 93 KiB |
|
After Width: | Height: | Size: 143 KiB |
|
After Width: | Height: | Size: 416 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 7.3 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 42 KiB |
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 68 KiB |
|
After Width: | Height: | Size: 109 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 7.3 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 36 KiB |
|
After Width: | Height: | Size: 93 KiB |
|
After Width: | Height: | Size: 104 KiB |
|
After Width: | Height: | Size: 150 KiB |
|
After Width: | Height: | Size: 618 KiB |
|
After Width: | Height: | Size: 5.8 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 4.5 KiB |
|
After Width: | Height: | Size: 8.2 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 8.6 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 128 KiB |
|
After Width: | Height: | Size: 5.3 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 47 KiB |
|
After Width: | Height: | Size: 54 KiB |
|
After Width: | Height: | Size: 63 KiB |
|
After Width: | Height: | Size: 89 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 45 KiB |
|
After Width: | Height: | Size: 41 KiB |
|
After Width: | Height: | Size: 47 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 8.8 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 4.5 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 37 KiB |
|
After Width: | Height: | Size: 68 KiB |
|
After Width: | Height: | Size: 205 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 36 KiB |
|
After Width: | Height: | Size: 61 KiB |
|
After Width: | Height: | Size: 199 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 42 KiB |