initial
This commit is contained in:
commit
7cd6339996
|
@ -0,0 +1 @@
|
|||
vendor/**
|
|
@ -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,18 @@
|
|||
|
||||
# APIgoat API wordpress plugin
|
||||
|
||||
This is an example of Wordpress plugin using the APIgoat API
|
||||
|
||||
It produce a shortcode to fetch and format content from a APIgoat project API.
|
||||
|
||||
It is based on DevinVinson/WordPress-Plugin-Boilerplate(https://github.com/DevinVinson/WordPress-Plugin-Boilerplate)
|
||||
|
||||
## Details
|
||||
* classes/APIgoatList.php is the main shortcode definition
|
||||
* classes/APIgoatFetchAPI.php contains the authentication and query
|
||||
* classes/APIgoatDoc.php is a formater
|
||||
|
||||
License
|
||||
----
|
||||
|
||||
MIT
|
|
@ -0,0 +1,114 @@
|
|||
=== Plugin Name ===
|
||||
Contributors: (this should be a list of wordpress.org userid's)
|
||||
Donate link: http://example.com/
|
||||
Tags: comments, spam
|
||||
Requires at least: 3.0.1
|
||||
Tested up to: 3.4
|
||||
Stable tag: 4.3
|
||||
License: GPLv2 or later
|
||||
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
Here is a short description of the plugin. This should be no more than 150 characters. No markup here.
|
||||
|
||||
== Description ==
|
||||
|
||||
This is the long description. No limit, and you can use Markdown (as well as in the following sections).
|
||||
|
||||
For backwards compatibility, if this section is missing, the full length of the short description will be used, and
|
||||
Markdown parsed.
|
||||
|
||||
A few notes about the sections above:
|
||||
|
||||
* "Contributors" is a comma separated list of wp.org/wp-plugins.org usernames
|
||||
* "Tags" is a comma separated list of tags that apply to the plugin
|
||||
* "Requires at least" is the lowest version that the plugin will work on
|
||||
* "Tested up to" is the highest version that you've *successfully used to test the plugin*. Note that it might work on
|
||||
higher versions... this is just the highest one you've verified.
|
||||
* Stable tag should indicate the Subversion "tag" of the latest stable version, or "trunk," if you use `/trunk/` for
|
||||
stable.
|
||||
|
||||
Note that the `readme.txt` of the stable tag is the one that is considered the defining one for the plugin, so
|
||||
if the `/trunk/readme.txt` file says that the stable tag is `4.3`, then it is `/tags/4.3/readme.txt` that'll be used
|
||||
for displaying information about the plugin. In this situation, the only thing considered from the trunk `readme.txt`
|
||||
is the stable tag pointer. Thus, if you develop in trunk, you can update the trunk `readme.txt` to reflect changes in
|
||||
your in-development version, without having that information incorrectly disclosed about the current stable version
|
||||
that lacks those changes -- as long as the trunk's `readme.txt` points to the correct stable tag.
|
||||
|
||||
If no stable tag is provided, it is assumed that trunk is stable, but you should specify "trunk" if that's where
|
||||
you put the stable version, in order to eliminate any doubt.
|
||||
|
||||
== Installation ==
|
||||
|
||||
This section describes how to install the plugin and get it working.
|
||||
|
||||
e.g.
|
||||
|
||||
1. Upload `apigoat_doc.php` to the `/wp-content/plugins/` directory
|
||||
1. Activate the plugin through the 'Plugins' menu in WordPress
|
||||
1. Place `<?php do_action('apigoat_doc_hook'); ?>` in your templates
|
||||
|
||||
== Frequently Asked Questions ==
|
||||
|
||||
= A question that someone might have =
|
||||
|
||||
An answer to that question.
|
||||
|
||||
= What about foo bar? =
|
||||
|
||||
Answer to foo bar dilemma.
|
||||
|
||||
== Screenshots ==
|
||||
|
||||
1. This screen shot description corresponds to screenshot-1.(png|jpg|jpeg|gif). Note that the screenshot is taken from
|
||||
the /assets directory or the directory that contains the stable readme.txt (tags or trunk). Screenshots in the /assets
|
||||
directory take precedence. For example, `/assets/screenshot-1.png` would win over `/tags/4.3/screenshot-1.png`
|
||||
(or jpg, jpeg, gif).
|
||||
2. This is the second screen shot
|
||||
|
||||
== Changelog ==
|
||||
|
||||
= 1.0 =
|
||||
* A change since the previous version.
|
||||
* Another change.
|
||||
|
||||
= 0.5 =
|
||||
* List versions from most recent at top to oldest at bottom.
|
||||
|
||||
== Upgrade Notice ==
|
||||
|
||||
= 1.0 =
|
||||
Upgrade notices describe the reason a user should upgrade. No more than 300 characters.
|
||||
|
||||
= 0.5 =
|
||||
This version fixes a security related bug. Upgrade immediately.
|
||||
|
||||
== Arbitrary section ==
|
||||
|
||||
You may provide arbitrary sections, in the same format as the ones above. This may be of use for extremely complicated
|
||||
plugins where more information needs to be conveyed that doesn't fit into the categories of "description" or
|
||||
"installation." Arbitrary sections will be shown below the built-in sections outlined above.
|
||||
|
||||
== A brief Markdown Example ==
|
||||
|
||||
Ordered list:
|
||||
|
||||
1. Some feature
|
||||
1. Another feature
|
||||
1. Something else about the plugin
|
||||
|
||||
Unordered list:
|
||||
|
||||
* something
|
||||
* something else
|
||||
* third thing
|
||||
|
||||
Here's a link to [WordPress](http://wordpress.org/ "Your favorite software") and one to [Markdown's Syntax Documentation][markdown syntax].
|
||||
Titles are optional, naturally.
|
||||
|
||||
[markdown syntax]: http://daringfireball.net/projects/markdown/syntax
|
||||
"Markdown is what the parser uses to process much of the readme file"
|
||||
|
||||
Markdown uses email style notation for blockquotes and I've been told:
|
||||
> Asterisks for *emphasis*. Double it up for **strong**.
|
||||
|
||||
`<?php code(); // goes in backticks ?>`
|
|
@ -0,0 +1,111 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The admin-specific functionality of the plugin.
|
||||
*
|
||||
* @link http://example.com
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @package apigoat_doc
|
||||
* @subpackage apigoat_doc/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 apigoat_doc
|
||||
* @subpackage apigoat_doc/admin
|
||||
* @author Your Name <email@example.com>
|
||||
*/
|
||||
class apigoat_doc_Admin
|
||||
{
|
||||
|
||||
/**
|
||||
* The ID of this plugin.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access private
|
||||
* @var string $apigoat_doc The ID of this plugin.
|
||||
*/
|
||||
private $apigoat_doc;
|
||||
|
||||
/**
|
||||
* The version of this plugin.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access private
|
||||
* @var string $version The current version of this plugin.
|
||||
*/
|
||||
private $version;
|
||||
|
||||
/**
|
||||
* Initialize the class and set its properties.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @param string $apigoat_doc The name of this plugin.
|
||||
* @param string $version The version of this plugin.
|
||||
*/
|
||||
public function __construct($apigoat_doc, $version)
|
||||
{
|
||||
|
||||
$this->apigoat_doc = $apigoat_doc;
|
||||
$this->version = $version;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the stylesheets for the admin area.
|
||||
*
|
||||
* @since 1.0.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 apigoat_doc_Loader as all of the hooks are defined
|
||||
* in that particular class.
|
||||
*
|
||||
* The apigoat_doc_Loader will then create the relationship
|
||||
* between the defined hooks and the functions defined in this
|
||||
* class.
|
||||
*/
|
||||
|
||||
wp_enqueue_style($this->apigoat_doc, plugin_dir_url(__FILE__) . 'css/apigoat_doc-admin.css', array(), $this->version, 'all');
|
||||
wp_enqueue_style($this->apigoat_doc, plugin_dir_url(__FILE__) . '../../wedocs/assets/css/frontend.css', array(), $this->version, 'all');
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the JavaScript for the admin area.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function enqueue_scripts()
|
||||
{
|
||||
|
||||
/**
|
||||
* This function is provided for demonstration purposes only.
|
||||
*
|
||||
* An instance of this class should be passed to the run() function
|
||||
* defined in apigoat_doc_Loader as all of the hooks are defined
|
||||
* in that particular class.
|
||||
*
|
||||
* The apigoat_doc_Loader will then create the relationship
|
||||
* between the defined hooks and the functions defined in this
|
||||
* class.
|
||||
*/
|
||||
|
||||
wp_enqueue_script($this->apigoat_doc, plugin_dir_url(__FILE__) . 'js/apigoat_doc-admin.js', array('jquery'), $this->version, false);
|
||||
}
|
||||
|
||||
public function register_session()
|
||||
{
|
||||
if (!session_id()) {
|
||||
session_start();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
/**
|
||||
* All of the CSS for your admin-specific functionality should be
|
||||
* included in this file.
|
||||
*/
|
|
@ -0,0 +1 @@
|
|||
<?php // Silence is golden
|
|
@ -0,0 +1,32 @@
|
|||
(function( $ ) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* All of the code for your admin-facing JavaScript source
|
||||
* should reside in this file.
|
||||
*
|
||||
* Note: It has been assumed you will write jQuery code here, so the
|
||||
* $ function reference has been prepared for usage within the scope
|
||||
* of this function.
|
||||
*
|
||||
* This enables you to define handlers, for when the DOM is ready:
|
||||
*
|
||||
* $(function() {
|
||||
*
|
||||
* });
|
||||
*
|
||||
* When the window is loaded:
|
||||
*
|
||||
* $( window ).load(function() {
|
||||
*
|
||||
* });
|
||||
*
|
||||
* ...and/or other possibilities.
|
||||
*
|
||||
* Ideally, it is not considered best practise to attach more than a
|
||||
* single DOM-ready or window-load handler for a particular page.
|
||||
* Although scripts in the WordPress core, Plugins and Themes may be
|
||||
* practising this, we should strive to set a better example in our own work.
|
||||
*/
|
||||
|
||||
})( jQuery );
|
|
@ -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 http://example.com
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @package apigoat_doc
|
||||
* @subpackage apigoat_doc/admin/partials
|
||||
*/
|
||||
?>
|
||||
|
||||
<!-- This file should primarily consist of HTML with a little bit of PHP. -->
|
|
@ -0,0 +1,88 @@
|
|||
<?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 http://example.com
|
||||
* @since 1.0.0
|
||||
* @package apigoat_doc
|
||||
*
|
||||
* @wordpress-plugin
|
||||
* Plugin Name: APIgoat API doc
|
||||
* Plugin URI: https://apigoat.com
|
||||
* Description: Consume API to get doc
|
||||
* Version: 1.0.0
|
||||
* Author: APIgoat
|
||||
* Author URI: https://apigoat.com/
|
||||
* License: GPL-2.0+
|
||||
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
|
||||
* Text Domain: apigoat_doc
|
||||
* Domain Path: /languages
|
||||
*/
|
||||
|
||||
// If this file is called directly, abort.
|
||||
if (!defined('WPINC')) {
|
||||
die;
|
||||
}
|
||||
/**
|
||||
* Currently plugin version.
|
||||
* Start at version 1.0.0 and use SemVer - https://semver.org
|
||||
* Rename this for your plugin and update it as you release new versions.
|
||||
*/
|
||||
define('apigoat_doc_VERSION', '1.0.0');
|
||||
|
||||
/**
|
||||
* The code that runs during plugin activation.
|
||||
* This action is documented in includes/class-apigoat_doc-activator.php
|
||||
*/
|
||||
function activate_apigoat_doc()
|
||||
{
|
||||
require_once plugin_dir_path(__FILE__) . 'includes/class-apigoat_doc-activator.php';
|
||||
apigoat_doc_Activator::activate();
|
||||
}
|
||||
|
||||
/**
|
||||
* The code that runs during plugin deactivation.
|
||||
* This action is documented in includes/class-apigoat_doc-deactivator.php
|
||||
*/
|
||||
function deactivate_apigoat_doc()
|
||||
{
|
||||
require_once plugin_dir_path(__FILE__) . 'includes/class-apigoat_doc-deactivator.php';
|
||||
apigoat_doc_Deactivator::deactivate();
|
||||
}
|
||||
|
||||
register_activation_hook(__FILE__, 'activate_apigoat_doc');
|
||||
register_deactivation_hook(__FILE__, 'deactivate_apigoat_doc');
|
||||
|
||||
/**
|
||||
* The core plugin class that is used to define internationalization,
|
||||
* admin-specific hooks, and public-facing site hooks.
|
||||
*/
|
||||
require plugin_dir_path(__FILE__) . 'vendor/autoload.php';
|
||||
require plugin_dir_path(__FILE__) . 'classes/APIgoatFetchAPI.php';
|
||||
require plugin_dir_path(__FILE__) . 'classes/APIgoatTemplate.php';
|
||||
require plugin_dir_path(__FILE__) . 'classes/APIgoatDoc.php';
|
||||
require plugin_dir_path(__FILE__) . 'includes/class-apigoat_doc.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 1.0.0
|
||||
*/
|
||||
|
||||
function run_apigoat_doc()
|
||||
{
|
||||
|
||||
$plugin = new apigoat_doc();
|
||||
$plugin->run();
|
||||
}
|
||||
run_apigoat_doc();
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
class APIgoatDoc extends APIgoatTemplate
|
||||
{
|
||||
|
||||
static function getDocs(array $data, array $headers)
|
||||
{
|
||||
$content = '';
|
||||
$menu = '';
|
||||
|
||||
//preprint($data);
|
||||
|
||||
foreach ($data as $row) {
|
||||
|
||||
$menu .= li(href($row['name'], '#' . $row['title']), "class='page_item current_page_item'");
|
||||
$content .= div(
|
||||
anchor($row['title']) . h3($row['name'])
|
||||
. h2($row['title'], "class='entry-title'")
|
||||
. p($row['type'] . " " . $row['value'])
|
||||
. ((!empty($row['example'])) ? pre(htmlentities($row['example'])) : '')
|
||||
. p(trim($row['text']))
|
||||
);
|
||||
}
|
||||
|
||||
foreach ($headers as $name => $header) {
|
||||
$menu = h3($header) . $menu;
|
||||
}
|
||||
|
||||
|
||||
return div(
|
||||
div(
|
||||
ul($menu, "class='doc-nav-list'"),
|
||||
'',
|
||||
"class='wedocs-sidebar wedocs-hide-mobile'"
|
||||
) . div(
|
||||
$content,
|
||||
'',
|
||||
"class='wedocs-single-content'"
|
||||
),
|
||||
'',
|
||||
"class='wedocs-single-wrap'"
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,104 @@
|
|||
<?php
|
||||
|
||||
use BernardoSilva\JWTAPIClient\APIClient;
|
||||
use BernardoSilva\JWTAPIClient\AccessTokenCredentials;
|
||||
use \Firebase\JWT\JWT;
|
||||
|
||||
include_once plugin_dir_path(dirname(__FILE__)) . 'includes/html_helper.php';
|
||||
|
||||
class APIgoatFetchAPI
|
||||
{
|
||||
|
||||
private $username = 'wp-behavior@apigoat.com';
|
||||
private $password = '0sKtegdSSk';
|
||||
private $baseURI = 'https://goat.local/p/goatcheese/api/v1/';
|
||||
private $jwt_pubkey = '9sKjdjuue8sSjwh6';
|
||||
private $jwt_alg = ['HS256'];
|
||||
private $client;
|
||||
private $credentials;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->client = new APIClient($this->baseURI);
|
||||
$this->clientOptions = [
|
||||
'verify' => false,
|
||||
'content-Type' => 'application/json',
|
||||
'accept' => 'application/json'
|
||||
];
|
||||
|
||||
if (!$this->authenticationValid()) {
|
||||
$this->authenticate();
|
||||
$this->saveCredentials();
|
||||
$this->client = new APIClient($this->baseURI, $this->credentials);
|
||||
} else {
|
||||
$this->credentials = new AccessTokenCredentials($_SESSION['APIgoat']['API_jwt_token']);
|
||||
$this->client->setCredentials($this->credentials);
|
||||
}
|
||||
}
|
||||
|
||||
public function fetchBehaviors()
|
||||
{
|
||||
$clientOptions = $this->clientOptions;
|
||||
$clientOptions['query'] = [
|
||||
"Query" => [
|
||||
"select" => [
|
||||
["behavior.name", "name"], ["code", "title"], ["description", "text"], "value", "example", "type", ["behavior_category.name", "category_name"]
|
||||
],
|
||||
"filter" => [
|
||||
"behavior" => [
|
||||
0 => ["group", "Free"],
|
||||
1 => ["status", "Active"]
|
||||
]
|
||||
],
|
||||
"join" => ["behavior_category"],
|
||||
"limit" => 20
|
||||
],
|
||||
"debug" => true
|
||||
];
|
||||
|
||||
|
||||
$response = $this->client->get('Behavior', $clientOptions);
|
||||
|
||||
$body = json_decode($response->getBody()->getContents(), true);
|
||||
if ($response->getStatusCode() == 200) {
|
||||
return $body;
|
||||
} else {
|
||||
$body = json_decode($response->getBody(), true);
|
||||
return $body;
|
||||
}
|
||||
}
|
||||
|
||||
private function saveCredentials()
|
||||
{
|
||||
if (!empty($this->jwt_pubkey)) {
|
||||
$decoded = JWT::decode($this->credentials->getAccessToken(), $this->jwt_pubkey, $this->jwt_alg);
|
||||
$_SESSION['APIgoat']['API_jwt_expire'] = $decoded->exp;
|
||||
$_SESSION['APIgoat']['API_jwt_token'] = $this->credentials->getAccessToken();
|
||||
}
|
||||
}
|
||||
|
||||
private function authenticate()
|
||||
{
|
||||
$options = [
|
||||
'verify' => false, // might need this if API uses self signed certificate
|
||||
'form_params' => [
|
||||
'u' => $this->username,
|
||||
'pw' => md5($this->password)
|
||||
],
|
||||
'debug' => false
|
||||
];
|
||||
// authenticate on API to get token
|
||||
$response = $this->client->post('Authy/auth', $options);
|
||||
$loginResponseDecoded = json_decode($response->getBody()->getContents(), true);
|
||||
|
||||
$this->credentials = new AccessTokenCredentials($loginResponseDecoded['token']);
|
||||
}
|
||||
|
||||
private function authenticationValid()
|
||||
{
|
||||
if (isset($_SESSION['APIgoat']) && !empty($_SESSION['APIgoat']['API_jwt_token']) && $_SESSION['APIgoat']['API_jwt_expire'] > time()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
class APIgoatList
|
||||
{
|
||||
|
||||
static function init($atts, $content = null)
|
||||
{
|
||||
$APIgoatFetchAPI = new APIgoatFetchAPI();
|
||||
$Behaviors = $APIgoatFetchAPI->fetchBehaviors();
|
||||
/*if (isset($Behaviors['debug'])) {
|
||||
echo "<br>" . preprint($Behaviors['debug']) . "<br>";
|
||||
}
|
||||
|
||||
if (isset($Behaviors['messages'])) {
|
||||
echo "<br>" . preprint($Behaviors['messages']) . "<br>";
|
||||
}*/
|
||||
if ($Behaviors['data']) {
|
||||
$table = APIgoatDoc::getDocs($Behaviors['data'], ['Code' => 'Parameters']);
|
||||
|
||||
return $content . div($table, '', "class='site-main'");
|
||||
} else {
|
||||
return $content . "<br>Error" . preprint($Behaviors);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
include_once plugin_dir_path(dirname(__FILE__)) . 'includes/html_helper.php';
|
||||
|
||||
class APIgoatTemplate
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
public function getTable(array $data, array $headers = null, array $classes = null)
|
||||
{
|
||||
$rows = '';
|
||||
$cols = '';
|
||||
$header = '';
|
||||
$th = '';
|
||||
|
||||
foreach ($data as $row) {
|
||||
if (is_array($row)) {
|
||||
$header = '';
|
||||
foreach ($row as $name => $field) {
|
||||
if ($headers == null || in_array($name, $headers)) {
|
||||
$cols .= td($field);
|
||||
}
|
||||
}
|
||||
$rows .= tr($cols);
|
||||
$cols = '';
|
||||
} else {
|
||||
$rows .= tr(td($row));
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($headers as $name => $header) {
|
||||
$th .= th($header);
|
||||
}
|
||||
|
||||
|
||||
return table(
|
||||
thead($th) . tbody($rows),
|
||||
"class='" . $classes['table'] . "'"
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"name": "drez/apigoat_doc",
|
||||
"description": "Access the APIgoat API from within Wordpress",
|
||||
"homepage": "https://apigoat.com/",
|
||||
"type": "wordpress-plugin",
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"bernardosilva/jwt-api-client-php": "^0.0.3",
|
||||
"firebase/php-jwt": "^5.2"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,693 @@
|
|||
{
|
||||
"_readme": [
|
||||
"This file locks the dependencies of your project to a known state",
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "36bc1e9e45d4ce6b4e227d41925ff986",
|
||||
"packages": [
|
||||
{
|
||||
"name": "bernardosilva/jwt-api-client-php",
|
||||
"version": "0.0.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/BernardoSilva/jwt-api-client-php.git",
|
||||
"reference": "90c4f6bf1fa6411e65d295d978470b762c99fdf8"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/BernardoSilva/jwt-api-client-php/zipball/90c4f6bf1fa6411e65d295d978470b762c99fdf8",
|
||||
"reference": "90c4f6bf1fa6411e65d295d978470b762c99fdf8",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"guzzlehttp/guzzle": "^6.3",
|
||||
"php": ">=5.5"
|
||||
},
|
||||
"require-dev": {
|
||||
"bernardosilva/git-hooks-php": "^2.0",
|
||||
"phpunit/phpunit": ">=4.8"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"BernardoSilva\\JWTAPIClient\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"GPL-3.0+"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Bernardo Silva",
|
||||
"email": "benny.stuff@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "API client prepared to consume API using JWT for PHP",
|
||||
"time": "2018-01-15T15:05:10+00:00"
|
||||
},
|
||||
{
|
||||
"name": "firebase/php-jwt",
|
||||
"version": "v5.2.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/firebase/php-jwt.git",
|
||||
"reference": "feb0e820b8436873675fd3aca04f3728eb2185cb"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/firebase/php-jwt/zipball/feb0e820b8436873675fd3aca04f3728eb2185cb",
|
||||
"reference": "feb0e820b8436873675fd3aca04f3728eb2185cb",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": ">=4.8 <=9"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Firebase\\JWT\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Neuman Vong",
|
||||
"email": "neuman+pear@twilio.com",
|
||||
"role": "Developer"
|
||||
},
|
||||
{
|
||||
"name": "Anant Narayanan",
|
||||
"email": "anant@php.net",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.",
|
||||
"homepage": "https://github.com/firebase/php-jwt",
|
||||
"keywords": [
|
||||
"jwt",
|
||||
"php"
|
||||
],
|
||||
"time": "2020-03-25T18:49:23+00:00"
|
||||
},
|
||||
{
|
||||
"name": "guzzlehttp/guzzle",
|
||||
"version": "6.5.5",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/guzzle/guzzle.git",
|
||||
"reference": "9d4290de1cfd701f38099ef7e183b64b4b7b0c5e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/9d4290de1cfd701f38099ef7e183b64b4b7b0c5e",
|
||||
"reference": "9d4290de1cfd701f38099ef7e183b64b4b7b0c5e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-json": "*",
|
||||
"guzzlehttp/promises": "^1.0",
|
||||
"guzzlehttp/psr7": "^1.6.1",
|
||||
"php": ">=5.5",
|
||||
"symfony/polyfill-intl-idn": "^1.17.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-curl": "*",
|
||||
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0",
|
||||
"psr/log": "^1.1"
|
||||
},
|
||||
"suggest": {
|
||||
"psr/log": "Required for using the Log middleware"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "6.5-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"GuzzleHttp\\": "src/"
|
||||
},
|
||||
"files": [
|
||||
"src/functions_include.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Michael Dowling",
|
||||
"email": "mtdowling@gmail.com",
|
||||
"homepage": "https://github.com/mtdowling"
|
||||
}
|
||||
],
|
||||
"description": "Guzzle is a PHP HTTP client library",
|
||||
"homepage": "http://guzzlephp.org/",
|
||||
"keywords": [
|
||||
"client",
|
||||
"curl",
|
||||
"framework",
|
||||
"http",
|
||||
"http client",
|
||||
"rest",
|
||||
"web service"
|
||||
],
|
||||
"time": "2020-06-16T21:01:06+00:00"
|
||||
},
|
||||
{
|
||||
"name": "guzzlehttp/promises",
|
||||
"version": "v1.3.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/guzzle/promises.git",
|
||||
"reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646",
|
||||
"reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.5.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^4.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.4-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"GuzzleHttp\\Promise\\": "src/"
|
||||
},
|
||||
"files": [
|
||||
"src/functions_include.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Michael Dowling",
|
||||
"email": "mtdowling@gmail.com",
|
||||
"homepage": "https://github.com/mtdowling"
|
||||
}
|
||||
],
|
||||
"description": "Guzzle promises library",
|
||||
"keywords": [
|
||||
"promise"
|
||||
],
|
||||
"time": "2016-12-20T10:07:11+00:00"
|
||||
},
|
||||
{
|
||||
"name": "guzzlehttp/psr7",
|
||||
"version": "1.6.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/guzzle/psr7.git",
|
||||
"reference": "239400de7a173fe9901b9ac7c06497751f00727a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/guzzle/psr7/zipball/239400de7a173fe9901b9ac7c06497751f00727a",
|
||||
"reference": "239400de7a173fe9901b9ac7c06497751f00727a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.4.0",
|
||||
"psr/http-message": "~1.0",
|
||||
"ralouphie/getallheaders": "^2.0.5 || ^3.0.0"
|
||||
},
|
||||
"provide": {
|
||||
"psr/http-message-implementation": "1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-zlib": "*",
|
||||
"phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8"
|
||||
},
|
||||
"suggest": {
|
||||
"zendframework/zend-httphandlerrunner": "Emit PSR-7 responses"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.6-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"GuzzleHttp\\Psr7\\": "src/"
|
||||
},
|
||||
"files": [
|
||||
"src/functions_include.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Michael Dowling",
|
||||
"email": "mtdowling@gmail.com",
|
||||
"homepage": "https://github.com/mtdowling"
|
||||
},
|
||||
{
|
||||
"name": "Tobias Schultze",
|
||||
"homepage": "https://github.com/Tobion"
|
||||
}
|
||||
],
|
||||
"description": "PSR-7 message implementation that also provides common utility methods",
|
||||
"keywords": [
|
||||
"http",
|
||||
"message",
|
||||
"psr-7",
|
||||
"request",
|
||||
"response",
|
||||
"stream",
|
||||
"uri",
|
||||
"url"
|
||||
],
|
||||
"time": "2019-07-01T23:21:34+00:00"
|
||||
},
|
||||
{
|
||||
"name": "paragonie/random_compat",
|
||||
"version": "v9.99.99",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/paragonie/random_compat.git",
|
||||
"reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/paragonie/random_compat/zipball/84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95",
|
||||
"reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "4.*|5.*",
|
||||
"vimeo/psalm": "^1"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes."
|
||||
},
|
||||
"type": "library",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Paragon Initiative Enterprises",
|
||||
"email": "security@paragonie.com",
|
||||
"homepage": "https://paragonie.com"
|
||||
}
|
||||
],
|
||||
"description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7",
|
||||
"keywords": [
|
||||
"csprng",
|
||||
"polyfill",
|
||||
"pseudorandom",
|
||||
"random"
|
||||
],
|
||||
"time": "2018-07-02T15:55:56+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/http-message",
|
||||
"version": "1.0.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-fig/http-message.git",
|
||||
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
|
||||
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Psr\\Http\\Message\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "PHP-FIG",
|
||||
"homepage": "http://www.php-fig.org/"
|
||||
}
|
||||
],
|
||||
"description": "Common interface for HTTP messages",
|
||||
"homepage": "https://github.com/php-fig/http-message",
|
||||
"keywords": [
|
||||
"http",
|
||||
"http-message",
|
||||
"psr",
|
||||
"psr-7",
|
||||
"request",
|
||||
"response"
|
||||
],
|
||||
"time": "2016-08-06T14:39:51+00:00"
|
||||
},
|
||||
{
|
||||
"name": "ralouphie/getallheaders",
|
||||
"version": "3.0.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/ralouphie/getallheaders.git",
|
||||
"reference": "120b605dfeb996808c31b6477290a714d356e822"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822",
|
||||
"reference": "120b605dfeb996808c31b6477290a714d356e822",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.6"
|
||||
},
|
||||
"require-dev": {
|
||||
"php-coveralls/php-coveralls": "^2.1",
|
||||
"phpunit/phpunit": "^5 || ^6.5"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"files": [
|
||||
"src/getallheaders.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Ralph Khattar",
|
||||
"email": "ralph.khattar@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "A polyfill for getallheaders.",
|
||||
"time": "2019-03-08T08:55:37+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-intl-idn",
|
||||
"version": "v1.18.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-intl-idn.git",
|
||||
"reference": "5dcab1bc7146cf8c1beaa4502a3d9be344334251"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/5dcab1bc7146cf8c1beaa4502a3d9be344334251",
|
||||
"reference": "5dcab1bc7146cf8c1beaa4502a3d9be344334251",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3",
|
||||
"symfony/polyfill-intl-normalizer": "^1.10",
|
||||
"symfony/polyfill-php70": "^1.10",
|
||||
"symfony/polyfill-php72": "^1.10"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-intl": "For best performance"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.18-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
"url": "https://github.com/symfony/polyfill"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Polyfill\\Intl\\Idn\\": ""
|
||||
},
|
||||
"files": [
|
||||
"bootstrap.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Laurent Bassin",
|
||||
"email": "laurent@bassin.info"
|
||||
},
|
||||
{
|
||||
"name": "Trevor Rowbotham",
|
||||
"email": "trevor.rowbotham@pm.me"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"compatibility",
|
||||
"idn",
|
||||
"intl",
|
||||
"polyfill",
|
||||
"portable",
|
||||
"shim"
|
||||
],
|
||||
"time": "2020-08-04T06:02:08+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-intl-normalizer",
|
||||
"version": "v1.18.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-intl-normalizer.git",
|
||||
"reference": "37078a8dd4a2a1e9ab0231af7c6cb671b2ed5a7e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/37078a8dd4a2a1e9ab0231af7c6cb671b2ed5a7e",
|
||||
"reference": "37078a8dd4a2a1e9ab0231af7c6cb671b2ed5a7e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-intl": "For best performance"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.18-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
"url": "https://github.com/symfony/polyfill"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Polyfill\\Intl\\Normalizer\\": ""
|
||||
},
|
||||
"files": [
|
||||
"bootstrap.php"
|
||||
],
|
||||
"classmap": [
|
||||
"Resources/stubs"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Grekas",
|
||||
"email": "p@tchwork.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony polyfill for intl's Normalizer class and related functions",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"compatibility",
|
||||
"intl",
|
||||
"normalizer",
|
||||
"polyfill",
|
||||
"portable",
|
||||
"shim"
|
||||
],
|
||||
"time": "2020-07-14T12:35:20+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-php70",
|
||||
"version": "v1.18.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-php70.git",
|
||||
"reference": "0dd93f2c578bdc9c72697eaa5f1dd25644e618d3"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/0dd93f2c578bdc9c72697eaa5f1dd25644e618d3",
|
||||
"reference": "0dd93f2c578bdc9c72697eaa5f1dd25644e618d3",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"paragonie/random_compat": "~1.0|~2.0|~9.99",
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.18-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
"url": "https://github.com/symfony/polyfill"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Polyfill\\Php70\\": ""
|
||||
},
|
||||
"files": [
|
||||
"bootstrap.php"
|
||||
],
|
||||
"classmap": [
|
||||
"Resources/stubs"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Grekas",
|
||||
"email": "p@tchwork.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"compatibility",
|
||||
"polyfill",
|
||||
"portable",
|
||||
"shim"
|
||||
],
|
||||
"time": "2020-07-14T12:35:20+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-php72",
|
||||
"version": "v1.18.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-php72.git",
|
||||
"reference": "639447d008615574653fb3bc60d1986d7172eaae"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/639447d008615574653fb3bc60d1986d7172eaae",
|
||||
"reference": "639447d008615574653fb3bc60d1986d7172eaae",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.18-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
"url": "https://github.com/symfony/polyfill"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Polyfill\\Php72\\": ""
|
||||
},
|
||||
"files": [
|
||||
"bootstrap.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Grekas",
|
||||
"email": "p@tchwork.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"compatibility",
|
||||
"polyfill",
|
||||
"portable",
|
||||
"shim"
|
||||
],
|
||||
"time": "2020-07-14T12:35:20+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [],
|
||||
"aliases": [],
|
||||
"minimum-stability": "stable",
|
||||
"stability-flags": [],
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
"platform": [],
|
||||
"platform-dev": []
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Fired during plugin activation
|
||||
*
|
||||
* @link http://example.com
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @package apigoat_doc
|
||||
* @subpackage apigoat_doc/includes
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fired during plugin activation.
|
||||
*
|
||||
* This class defines all code necessary to run during the plugin's activation.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @package apigoat_doc
|
||||
* @subpackage apigoat_doc/includes
|
||||
* @author Your Name <email@example.com>
|
||||
*/
|
||||
class apigoat_doc_Activator
|
||||
{
|
||||
|
||||
/**
|
||||
* Short Description. (use period)
|
||||
*
|
||||
* Long Description.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function activate()
|
||||
{
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Fired during plugin deactivation
|
||||
*
|
||||
* @link http://example.com
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @package apigoat_doc
|
||||
* @subpackage apigoat_doc/includes
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fired during plugin deactivation.
|
||||
*
|
||||
* This class defines all code necessary to run during the plugin's deactivation.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @package apigoat_doc
|
||||
* @subpackage apigoat_doc/includes
|
||||
* @author Your Name <email@example.com>
|
||||
*/
|
||||
class apigoat_doc_Deactivator
|
||||
{
|
||||
|
||||
/**
|
||||
* Short Description. (use period)
|
||||
*
|
||||
* Long Description.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function deactivate()
|
||||
{
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Define the internationalization functionality
|
||||
*
|
||||
* Loads and defines the internationalization files for this plugin
|
||||
* so that it is ready for translation.
|
||||
*
|
||||
* @link http://example.com
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @package apigoat_doc
|
||||
* @subpackage apigoat_doc/includes
|
||||
*/
|
||||
|
||||
/**
|
||||
* Define the internationalization functionality.
|
||||
*
|
||||
* Loads and defines the internationalization files for this plugin
|
||||
* so that it is ready for translation.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @package apigoat_doc
|
||||
* @subpackage apigoat_doc/includes
|
||||
* @author Your Name <email@example.com>
|
||||
*/
|
||||
class apigoat_doc_i18n
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Load the plugin text domain for translation.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function load_plugin_textdomain()
|
||||
{
|
||||
|
||||
load_plugin_textdomain(
|
||||
'apigoat_doc',
|
||||
false,
|
||||
dirname(dirname(plugin_basename(__FILE__))) . '/languages/'
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,141 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Register all actions and filters for the plugin
|
||||
*
|
||||
* @link http://example.com
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @package apigoat_doc
|
||||
* @subpackage apigoat_doc/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 apigoat_doc
|
||||
* @subpackage apigoat_doc/includes
|
||||
* @author Your Name <email@example.com>
|
||||
*/
|
||||
class apigoat_doc_Loader
|
||||
{
|
||||
|
||||
/**
|
||||
* The array of actions registered with WordPress.
|
||||
*
|
||||
* @since 1.0.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 1.0.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 1.0.0
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
$this->actions = array();
|
||||
$this->filters = array();
|
||||
$this->shortcodes = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new action to the collection to be registered with WordPress.
|
||||
*
|
||||
* @since 1.0.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 $priority Optional. The priority at which the function should be fired. Default is 10.
|
||||
* @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1.
|
||||
*/
|
||||
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 1.0.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 $priority Optional. The priority at which the function should be fired. Default is 10.
|
||||
* @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1
|
||||
*/
|
||||
public function add_filter($hook, $component, $callback, $priority = 10, $accepted_args = 1)
|
||||
{
|
||||
$this->filters = $this->add($this->filters, $hook, $component, $callback, $priority, $accepted_args);
|
||||
}
|
||||
|
||||
public function add_shortcode($hook, $component, $callback, $priority = 10, $accepted_args = 1)
|
||||
{
|
||||
$this->shortcodes = $this->add($this->shortcodes, $hook, $component, $callback, $priority, $accepted_args);
|
||||
}
|
||||
|
||||
/**
|
||||
* A utility function that is used to register the actions and hooks into a single
|
||||
* collection.
|
||||
*
|
||||
* @since 1.0.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 $priority The priority at which the function should be fired.
|
||||
* @param int $accepted_args The number of arguments that should be passed to the $callback.
|
||||
* @return array 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 1.0.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']);
|
||||
}
|
||||
|
||||
foreach ($this->shortcodes as $hook) {
|
||||
add_shortcode($hook['hook'], $hook['callback']);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,223 @@
|
|||
<?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 http://example.com
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @package apigoat_doc
|
||||
* @subpackage apigoat_doc/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 1.0.0
|
||||
* @package apigoat_doc
|
||||
* @subpackage apigoat_doc/includes
|
||||
* @author Your Name <email@example.com>
|
||||
*/
|
||||
class apigoat_doc
|
||||
{
|
||||
|
||||
/**
|
||||
* The loader that's responsible for maintaining and registering all hooks that power
|
||||
* the plugin.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access protected
|
||||
* @var apigoat_doc_Loader $loader Maintains and registers all hooks for the plugin.
|
||||
*/
|
||||
protected $loader;
|
||||
|
||||
/**
|
||||
* The unique identifier of this plugin.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access protected
|
||||
* @var string $apigoat_doc The string used to uniquely identify this plugin.
|
||||
*/
|
||||
protected $apigoat_doc;
|
||||
|
||||
/**
|
||||
* The current version of the plugin.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access protected
|
||||
* @var string $version The current version of the plugin.
|
||||
*/
|
||||
protected $version;
|
||||
|
||||
/**
|
||||
* 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, define the locale, and set the hooks for the admin area and
|
||||
* the public-facing side of the site.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
if (defined('apigoat_doc_VERSION')) {
|
||||
$this->version = apigoat_doc_VERSION;
|
||||
} else {
|
||||
$this->version = '1.0.0';
|
||||
}
|
||||
$this->apigoat_doc = 'apigoat_doc';
|
||||
|
||||
$this->load_dependencies();
|
||||
$this->set_locale();
|
||||
$this->define_admin_hooks();
|
||||
$this->define_public_hooks();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the required dependencies for this plugin.
|
||||
*
|
||||
* Include the following files that make up the plugin:
|
||||
*
|
||||
* - apigoat_doc_Loader. Orchestrates the hooks of the plugin.
|
||||
* - apigoat_doc_i18n. Defines internationalization functionality.
|
||||
* - apigoat_doc_Admin. Defines all hooks for the admin area.
|
||||
* - apigoat_doc_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 1.0.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-apigoat_doc-loader.php';
|
||||
|
||||
/**
|
||||
* The class responsible for defining internationalization functionality
|
||||
* of the plugin.
|
||||
*/
|
||||
require_once plugin_dir_path(dirname(__FILE__)) . 'includes/class-apigoat_doc-i18n.php';
|
||||
|
||||
/**
|
||||
* The class responsible for defining all actions that occur in the admin area.
|
||||
*/
|
||||
require_once plugin_dir_path(dirname(__FILE__)) . 'admin/class-apigoat_doc-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-apigoat_doc-public.php';
|
||||
|
||||
require plugin_dir_path(dirname(__FILE__)) . 'classes/APIgoatList.php';
|
||||
|
||||
$this->loader = new apigoat_doc_Loader();
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the locale for this plugin for internationalization.
|
||||
*
|
||||
* Uses the apigoat_doc_i18n class in order to set the domain and to register the hook
|
||||
* with WordPress.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access private
|
||||
*/
|
||||
private function set_locale()
|
||||
{
|
||||
|
||||
$plugin_i18n = new apigoat_doc_i18n();
|
||||
|
||||
$this->loader->add_action('plugins_loaded', $plugin_i18n, 'load_plugin_textdomain');
|
||||
}
|
||||
|
||||
/**
|
||||
* Register all of the hooks related to the admin area functionality
|
||||
* of the plugin.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access private
|
||||
*/
|
||||
private function define_admin_hooks()
|
||||
{
|
||||
$plugin_admin = new apigoat_doc_Admin($this->get_apigoat_doc(), $this->get_version());
|
||||
$this->loader->add_action('init', $plugin_admin, 'register_session', 1);
|
||||
$this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_styles');
|
||||
$this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts');
|
||||
}
|
||||
|
||||
/**
|
||||
* Register all of the hooks related to the public-facing functionality
|
||||
* of the plugin.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access private
|
||||
*/
|
||||
private function define_public_hooks()
|
||||
{
|
||||
$plugin_public = new apigoat_doc_Public($this->get_apigoat_doc(), $this->get_version());
|
||||
$this->loader->add_action('init', $plugin_public, 'register_session', 1);
|
||||
$this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_styles');
|
||||
$this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_scripts');
|
||||
$this->loader->add_shortcode('APIgoat_list', $plugin_public, array('APIgoatList', 'init'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the loader to execute all of the hooks with WordPress.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$this->loader->run();
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of the plugin used to uniquely identify it within the context of
|
||||
* WordPress and to define internationalization functionality.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @return string The name of the plugin.
|
||||
*/
|
||||
public function get_apigoat_doc()
|
||||
{
|
||||
return $this->apigoat_doc;
|
||||
}
|
||||
|
||||
/**
|
||||
* The reference to the class that orchestrates the hooks with the plugin.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @return apigoat_doc_Loader Orchestrates the hooks of the plugin.
|
||||
*/
|
||||
public function get_loader()
|
||||
{
|
||||
return $this->loader;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the version number of the plugin.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @return string The version number of the plugin.
|
||||
*/
|
||||
public function get_version()
|
||||
{
|
||||
return $this->version;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,991 @@
|
|||
<?php
|
||||
|
||||
|
||||
function clean($string, $more = false)
|
||||
{
|
||||
$string = str_replace("\'", "'", $string);
|
||||
$string = str_replace("'", "''", $string);
|
||||
if ($more)
|
||||
$string = str_replace("\"", "”", $string);
|
||||
return $string;
|
||||
}
|
||||
|
||||
function htmlLink($name, $link, $options = "", $title = "")
|
||||
{
|
||||
if (!empty($title)) {
|
||||
if ($title === true) {
|
||||
$title = ' title="' . strip_tags($name) . '" ';
|
||||
} else {
|
||||
$title = ' title="' . $title . '" ';
|
||||
}
|
||||
}
|
||||
|
||||
$optionsContent = generateData($options);
|
||||
|
||||
return "<a href=\"$link\" $optionsContent $title>$name</a>";
|
||||
}
|
||||
|
||||
function href($name, $link, $options = "", $title = "")
|
||||
{
|
||||
return htmlLink($name, $link, $options, $title);
|
||||
}
|
||||
|
||||
function anchor($id)
|
||||
{
|
||||
return "<a id=\"$id\"></a>";
|
||||
}
|
||||
|
||||
function div($content, $id = "", $options = "")
|
||||
{
|
||||
if ($id) $id = "id=\"$id\"";
|
||||
$optionsContent = generateData($options);
|
||||
|
||||
return "<div $id $optionsContent>$content</div>";
|
||||
}
|
||||
|
||||
function pre($content, $options = "")
|
||||
{
|
||||
return "<pre $options>$content</pre>";
|
||||
}
|
||||
|
||||
function input($type, $name, $value = "", $options = "", $id = "")
|
||||
{
|
||||
if ($id == "") {
|
||||
$id = $name;
|
||||
}
|
||||
|
||||
$optionsContent = generateData($options);
|
||||
|
||||
return "<input type=\"$type\" name=\"$name\" id=\"$id\" value=\"" . $value . "\" $optionsContent/>";
|
||||
}
|
||||
|
||||
function img($path, $height = "", $width = "", $options = "", $alt = "", $title = "")
|
||||
{
|
||||
$optionsContent = generateData($options);
|
||||
|
||||
if (!empty($other))
|
||||
$other = ' ' . $other;
|
||||
/* bug au niveau explorer il voyais pas les photo maintenant corrigé avec cette patch */
|
||||
if (!empty($height)) {
|
||||
if ($height === true) {
|
||||
$path = _SITE_URL . 'css/img/' . $path;
|
||||
} else {
|
||||
$height = ' height="' . $height . '" ';
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($width))
|
||||
$width = ' width="' . $width . '" ';
|
||||
|
||||
if (!empty($alt)) {
|
||||
if ($title == '') {
|
||||
$title = ' title="' . $alt . '" ';
|
||||
} else {
|
||||
$title = ' title="' . $title . '" ';
|
||||
}
|
||||
|
||||
$alt = ' alt="' . $alt . '" ';
|
||||
}
|
||||
|
||||
return "<img src=\"" . $path . "\" $width $height $optionsContent $alt $title />";
|
||||
}
|
||||
|
||||
function p($content, $options = "")
|
||||
{
|
||||
$optionsContent = generateData($options);
|
||||
|
||||
return "<p $optionsContent>$content</p>";
|
||||
}
|
||||
|
||||
function b($content, $options = "")
|
||||
{
|
||||
return "<b $options>$content</b>";
|
||||
}
|
||||
function strong($content, $options = "")
|
||||
{
|
||||
$optionsContent = generateData($options);
|
||||
|
||||
return "<strong $optionsContent>$content</strong>";
|
||||
}
|
||||
function i($content, $options = "")
|
||||
{
|
||||
return "<i $options>$content</i>";
|
||||
}
|
||||
|
||||
function h1($content, $options = "")
|
||||
{
|
||||
$optionsContent = generateData($options);
|
||||
|
||||
return "<h1 $optionsContent>$content</h1>";
|
||||
}
|
||||
|
||||
function h2($content, $options = "")
|
||||
{
|
||||
$optionsContent = generateData($options);
|
||||
|
||||
return "<h2 $optionsContent>$content</h2>";
|
||||
}
|
||||
|
||||
function h3($content, $options = "")
|
||||
{
|
||||
$optionsContent = generateData($options);
|
||||
|
||||
return "<h3 $optionsContent>$content</h3>";
|
||||
}
|
||||
|
||||
function h4($content, $options = "")
|
||||
{
|
||||
$optionsContent = generateData($options);
|
||||
|
||||
return "<h4 $optionsContent>$content</h4>";
|
||||
}
|
||||
|
||||
function ul($content, $options = "")
|
||||
{
|
||||
$optionsContent = generateData($options);
|
||||
|
||||
return "<ul $optionsContent>$content</ul>";
|
||||
}
|
||||
|
||||
function li($content, $options = "")
|
||||
{
|
||||
$optionsContent = generateData($options);
|
||||
|
||||
return "<li $optionsContent>$content</li>";
|
||||
}
|
||||
|
||||
function span($content = "", $options = "")
|
||||
{
|
||||
$optionsContent = generateData($options);
|
||||
|
||||
return "<span $optionsContent>$content</span>";
|
||||
}
|
||||
|
||||
function tr($content, $options = "")
|
||||
{
|
||||
$optionsContent = generateData($options);
|
||||
|
||||
return "<tr $optionsContent>$content</tr>\n";
|
||||
}
|
||||
|
||||
function td($content, $options = "")
|
||||
{
|
||||
$optionsContent = generateData($options);
|
||||
|
||||
return "<td $optionsContent>$content</td>";
|
||||
}
|
||||
|
||||
function th($content, $options = "")
|
||||
{
|
||||
$optionsContent = generateData($options);
|
||||
|
||||
return "<th $optionsContent>$content</th>";
|
||||
}
|
||||
|
||||
function thead($content, $option = "")
|
||||
{
|
||||
return "<thead $option>$content</thead>";
|
||||
}
|
||||
|
||||
function body($content, $option = "")
|
||||
{
|
||||
return "<body $option>
|
||||
$content</body>";
|
||||
}
|
||||
|
||||
function tbody($content, $option = "")
|
||||
{
|
||||
return "<tbody $option>$content</tbody>";
|
||||
}
|
||||
|
||||
function tfoot($content, $option = "")
|
||||
{
|
||||
return "<tfoot $option>$content</tfoot>";
|
||||
}
|
||||
|
||||
function table($content, $option = "")
|
||||
{
|
||||
return "<table $option>$content</table>";
|
||||
}
|
||||
|
||||
function form($content, $option = "")
|
||||
{
|
||||
return "<form $option>$content</form>";
|
||||
}
|
||||
|
||||
function select($name, $options, $selOption = "", $idSelected = "", $id = "", $opt_re = false, $null_in_sel = false)
|
||||
{
|
||||
if (empty($id))
|
||||
$id = $name;
|
||||
if ($null_in_sel) {
|
||||
$null_in_sel_tab = array('0' => _MESS_SELECTION, '1' => '');
|
||||
if ($options) {
|
||||
array_unshift($options, $null_in_sel_tab);
|
||||
} else {
|
||||
$options = array($null_in_sel_tab);
|
||||
}
|
||||
}
|
||||
if (is_array($options)) {
|
||||
for ($i = 0, $c = count($options); $i < $c; $i++) {
|
||||
if (!empty($options[$i][0])) {
|
||||
// handle multiple selected id
|
||||
if (is_array($idSelected)) {
|
||||
if (array_search($options[$i][1], $idSelected) !== false) {
|
||||
$option .= option($options[$i][0], $options[$i][1], "v='" . $options[$i][2] . "' selected=\"yes\"");
|
||||
} else
|
||||
$option .= option($options[$i][0], $options[$i][1], "v='" . $options[$i][2] . "'");
|
||||
} else {
|
||||
// handle standard selected id
|
||||
if ($idSelected == $options[$i][1]) {
|
||||
$option .= option($options[$i][0], $options[$i][1], "v='" . $options[$i][2] . "' selected=\"yes\"");
|
||||
} else
|
||||
$option .= option($options[$i][0], $options[$i][1], "v='" . $options[$i][2] . "'");
|
||||
}
|
||||
}
|
||||
}
|
||||
$options = $option;
|
||||
}
|
||||
if (!$opt_re)
|
||||
return "<select name=\"$name\" id=\"$id\" $selOption>$options</select>";
|
||||
else
|
||||
return $options;
|
||||
}
|
||||
|
||||
function selectbox($name, $select, $valeur = '', $class = '')
|
||||
{
|
||||
$placeholder = $name;
|
||||
if ($valeur) {
|
||||
$name = $valeur;
|
||||
}
|
||||
return label(span($name, ' placeholder="' . $placeholder . '" class="select-label-span"') . $select, ' class="select-label js-select-label ' . $class . '"');
|
||||
}
|
||||
|
||||
function optionListeSelect($options, $selectedValue, $defaultLabel = true)
|
||||
{
|
||||
if ($options) {
|
||||
$selectedLabel = "";
|
||||
foreach ($options as $option) {
|
||||
$class = "";
|
||||
if (is_array($selectedValue)) {
|
||||
if (array_search($option[1], $selectedValue) !== false) {
|
||||
$class = ' class="selected"';
|
||||
$selectedLabel .= $option[0] . ',';
|
||||
}
|
||||
} else {
|
||||
if ($selectedValue == $option[1]) {
|
||||
$class = ' class="selected"';
|
||||
$selectedLabel .= $option[0] . ',';
|
||||
}
|
||||
}
|
||||
$optionsList .=
|
||||
li(
|
||||
strong(ucfirst($option[0]), 'unselectable="on" title="' . ucfirst($option[0]) . '"'),
|
||||
'v=\'' . $option[2] . '\' unselectable="on" data-label="' . $option[0] . '" data-value="' . $option[1] . '"' . $class
|
||||
);
|
||||
}
|
||||
}
|
||||
if (empty($selectedLabel)) {
|
||||
if (!empty($defaultLabel)) {
|
||||
$selectedLabel = $defaultLabel;
|
||||
} else {
|
||||
/* mets rien esti */
|
||||
/* $selectedLabel = $options[0][0];
|
||||
$inputValue = $options[0][1];*/
|
||||
}
|
||||
} else {
|
||||
$selectedLabel = substr($selectedLabel, 0, -1);
|
||||
}
|
||||
$return['optionsList'] = $optionsList;
|
||||
$return['selectedLabel'] = $selectedLabel;
|
||||
return $return;
|
||||
}
|
||||
|
||||
function selectboxCustomArray($name, $options, $defaultLabel = '', $attr = '', $selectedValue = 'default', $classParam = '', $null_in_sel = false)
|
||||
{
|
||||
$placeholder = $name;
|
||||
$tabindex = "";
|
||||
$multiple = false;
|
||||
if (is_array($selectedValue)) {
|
||||
$selectedValue = implode(',', $selectedValue);
|
||||
}
|
||||
$inputValue = $selectedValue;
|
||||
if (!is_array($selectedValue)) {
|
||||
$selectedValue = explode(',', $selectedValue);
|
||||
}
|
||||
if ($selectedValue) {
|
||||
foreach ($selectedValue as $value) {
|
||||
$valuesList[] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$attr = str_replace('otherTabs=1', '', $attr);
|
||||
if (!preg_match('/disabled/', $attr))
|
||||
$tabindex = ' tabindex="0" othertabs="1"';
|
||||
if (preg_match('/multiple/', $attr))
|
||||
$multiple = true;
|
||||
|
||||
$rOption = optionListeSelect($options, $selectedValue, $defaultLabel);
|
||||
$optionsList = $rOption['optionsList'];
|
||||
$selectedLabel = $rOption['selectedLabel'];
|
||||
|
||||
if (!empty($defaultLabel)) {
|
||||
$defaultLabel = li(span(_('Clear'), 'unselectable="on" title="' . ucfirst($defaultLabel) . '"'), 'class="default" unselectable="on" data-label="' . $defaultLabel . '" data-value="default"');
|
||||
}
|
||||
if ($null_in_sel) {
|
||||
$emptyLabel = li(span(_('Empty value'), 'unselectable="off" title="' . ucfirst(_('Empty value')) . '"'), 'class="null" unselectable="off" data-label="' . _('Empty value') . '" data-value="_null"');
|
||||
$classParam .= " hasNull";
|
||||
}
|
||||
$grayClass = " gray ";
|
||||
if ($inputValue) {
|
||||
$grayClass = "";
|
||||
}
|
||||
$mobileHeader = "";
|
||||
if ($multiple) {
|
||||
$mobileHeader = div(span('x', 'class="select-close-button js-select-close-button"'), '', 'class="mobile-header"');
|
||||
}
|
||||
$findme = 'SearchTabs';
|
||||
$SearchTabs = " SearchTabs='1' ";
|
||||
if (strpos($attr, $findme) === false) {
|
||||
$SearchTabs = '';
|
||||
}
|
||||
$list = ul(
|
||||
$defaultLabel
|
||||
. $emptyLabel
|
||||
. $optionsList,
|
||||
'class="scrollable select-element ' . $name . '" data-default-selected=\'' . json_encode($valuesList) . '\''
|
||||
)
|
||||
. input('hidden', $name, $inputValue, 'class="selextbox-input NC' . str_replace('[]', '', $name) . '" ' . $SearchTabs . ' s="d"');
|
||||
|
||||
return label(
|
||||
span($selectedLabel, ' placeholder="' . $placeholder . '" class="select-label-span' . $grayClass . '"' . $tabindex) . $mobileHeader . $list,
|
||||
str_replace('SearchTabs=\'1\'', '', str_replace('s=\'d\'', '', $attr . ' data-child-select="' . str_replace('[]', '', $name) . '" data-name="' . $name . '" class="select-label js-select-label ' . $classParam . '"'))
|
||||
);
|
||||
}
|
||||
|
||||
function arrayToOptions($options, $idSelected = '')
|
||||
{
|
||||
if (is_array($options)) {
|
||||
for ($i = 0, $c = count($options); $i < $c; $i++) {
|
||||
if (!empty($options[$i][0])) {
|
||||
// handle multiple selected id
|
||||
if (is_array($idSelected)) {
|
||||
if (array_search($options[$i][1], $idSelected)) {
|
||||
$option .= option($options[$i][0], $options[$i][1], "v='" . $options[$i][2] . "' selected=\"yes\"");
|
||||
} else
|
||||
$option .= option($options[$i][0], $options[$i][1], "v='" . $options[$i][2] . "'");
|
||||
} else {
|
||||
// handle standard selected id
|
||||
if ($idSelected == $options[$i][1]) {
|
||||
$option .= option($options[$i][0], $options[$i][1], "v='" . $options[$i][2] . "' selected=\"yes\"");
|
||||
} else
|
||||
$option .= option($options[$i][0], $options[$i][1], "v='" . $options[$i][2] . "'");
|
||||
}
|
||||
}
|
||||
}
|
||||
$options = $option;
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
|
||||
function arrayToJson($options, $idSelected = '')
|
||||
{
|
||||
if (is_array($options)) {
|
||||
for ($i = 0, $c = count($options); $i < $c; $i++) {
|
||||
if (!empty($options[$i][0])) {
|
||||
// handle multiple selected id
|
||||
if (is_array($idSelected)) {
|
||||
if (array_search($options[$i][1], $idSelected)) {
|
||||
$option[$options[$i][1]] = li($options[$i][0], "data-label='" . $options[$i][0] . "' data-value='" . $options[$i][1] . "' v='" . $options[$i][2] . "' class='selected'");
|
||||
} else
|
||||
$option[$options[$i][1]] = li($options[$i][0], "data-label='" . $options[$i][0] . "' data-value='" . $options[$i][1] . "' v='" . $options[$i][2] . "'");
|
||||
} else {
|
||||
// handle standard selected id
|
||||
if ($idSelected == $options[$i][1]) {
|
||||
$option[$options[$i][1]] = li($options[$i][0], "data-label='" . $options[$i][0] . "' data-value='" . $options[$i][1] . "' v='" . $options[$i][2] . "' class='selected'");
|
||||
} else
|
||||
$option[$options[$i][1]] = li($options[$i][0], "data-label='" . $options[$i][0] . "' data-value='" . $options[$i][1] . "' v='" . $options[$i][2] . "'");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return json_encode($option);
|
||||
}
|
||||
|
||||
function option($caption, $value, $options = "")
|
||||
{
|
||||
return "<option value=\"$value\" $options>$caption</option>";
|
||||
}
|
||||
|
||||
function iframe($src, $options = "")
|
||||
{
|
||||
return "<iframe src=\"$src\" $options></iframe>
|
||||
";
|
||||
}
|
||||
|
||||
function textarea($id, $value = "", $options = "")
|
||||
{
|
||||
$optionsContent = generateData($options);
|
||||
|
||||
return "<textarea id=\"$id\" name=\"$id\" $optionsContent >$value</textarea>";
|
||||
}
|
||||
|
||||
function customCheckInput($input, $label)
|
||||
{
|
||||
return span(
|
||||
$input
|
||||
. span('', 'class="placeholder-input"')
|
||||
. span(
|
||||
$label,
|
||||
'class="checkbox-label"'
|
||||
),
|
||||
'class="custom-input"'
|
||||
);
|
||||
}
|
||||
function checkbox($id, $value, $options = "")
|
||||
{
|
||||
return "<input type=\"checkbox\" id=\"$id\" name=\"$id\" value=\"$value\" $options>";
|
||||
}
|
||||
function radio($id, $value, $options = "")
|
||||
{
|
||||
return "<input type=\"radio\" id=\"$id\" name=\"$id\" value=\"$value\" $options>";
|
||||
}
|
||||
|
||||
function loadCss($style, $options = "")
|
||||
{
|
||||
if ($style) {
|
||||
return "<link href=\"$style\" rel=\"stylesheet\" type=\"text/css\" $options />";
|
||||
}
|
||||
}
|
||||
|
||||
function loadjs($js)
|
||||
{
|
||||
if ($js) {
|
||||
return "<script src=\"$js\" type=\"text/javascript\"></script>";
|
||||
}
|
||||
}
|
||||
|
||||
function htmlHeader($title = "", $style = "", $desciption = "", $keywords = "", $others = "", $favicon = "favicon.ico", $author = '')
|
||||
{
|
||||
$Html_head = "<head>";
|
||||
//$Html_head .= "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\" />";
|
||||
$Html_head .= "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />";
|
||||
if (!empty($desciption))
|
||||
$Html_head .= "<meta name=\"description\" content=\"$desciption\" />";
|
||||
if (!empty($keywords))
|
||||
$Html_head .= "<meta name=\"keywords\" content=\"$keywords\" />";
|
||||
if (!empty($title))
|
||||
$Html_head .= "<title>$title</title>";
|
||||
//if(!empty($favicon))
|
||||
$Html_head .= "<link rel=\"icon\" type=\"image/png\" href=\"" . _SITE_URL . $favicon . "\" />";
|
||||
if (!empty($style))
|
||||
$Html_head .= $style;
|
||||
$Html_head .= $others;
|
||||
$Html_head .= "<meta name='Author' content='" . $author . "' />";
|
||||
$Html_head .= "<meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1'>";
|
||||
|
||||
$Html_head .= "</head>";
|
||||
return $Html_head;
|
||||
}
|
||||
|
||||
function docType()
|
||||
{
|
||||
//return "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
|
||||
//return "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">";
|
||||
return "<!DOCTYPE HTML>";
|
||||
}
|
||||
|
||||
function htmlTag($content, $option = "")
|
||||
{
|
||||
$Html = "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"fr\" lang=\"fr\" dir=\"ltr\" " . $option . ">";
|
||||
$Html .= $content;
|
||||
$Html .= "</html>";
|
||||
return $Html;
|
||||
}
|
||||
|
||||
function startHtml()
|
||||
{
|
||||
$Html = "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"fr\" lang=\"fr\" dir=\"ltr\">";
|
||||
return $Html;
|
||||
}
|
||||
|
||||
function closeHtml()
|
||||
{
|
||||
$Html_foot .= "</html>";
|
||||
return $Html_foot;
|
||||
}
|
||||
|
||||
function htmlSpace($nbr)
|
||||
{
|
||||
for ($i = 0; $i < $nbr; $i++)
|
||||
$space .= " ";
|
||||
return $space;
|
||||
}
|
||||
|
||||
function req($val)
|
||||
{
|
||||
return str_replace('\\', '\\\\', strip_tags(trim(htmlspecialchars((get_magic_quotes_gpc() ? stripslashes($_REQUEST[$val]) : $_REQUEST[$val]), ENT_QUOTES))));
|
||||
}
|
||||
|
||||
function cleanString($str)
|
||||
{
|
||||
$str = str_replace("script", "", $str);
|
||||
return $str;
|
||||
}
|
||||
|
||||
function getUrlParamsJSON($arrayParams = "", $asUrl = false)
|
||||
{
|
||||
$keys = array_keys($_REQUEST);
|
||||
|
||||
if ($asUrl) {
|
||||
foreach ($keys as $key) {
|
||||
if (in_array($key, $arrayParams)) {
|
||||
$urlParams .= "&" . $key . "=" . urlencode($_REQUEST[$key]);
|
||||
}
|
||||
}
|
||||
return $urlParams;
|
||||
}
|
||||
|
||||
$urlParams .= "'dum':'z'";
|
||||
if ($arrayParams[0] != "") {
|
||||
foreach ($keys as $key) {
|
||||
if (in_array($key, $arrayParams)) {
|
||||
$urlParams .= ",\"" . $key . "\":\"" . urlencode($_REQUEST[$key]) . "\"";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
foreach ($keys as $key) {
|
||||
if ($key != "__utma" && $key != "__utmz" && $key != "PHPSESSID" && !strstr($key, "SESS") && $key != "dum") {
|
||||
$urlParams .= ",'" . $key . "':'" . urlencode($_REQUEST[$key]) . "'";
|
||||
}
|
||||
}
|
||||
}
|
||||
return $urlParams;
|
||||
}
|
||||
|
||||
function message($message)
|
||||
{
|
||||
return "<script>$(document).ready(function() {message('" . $message . "');});</script>";
|
||||
}
|
||||
|
||||
function script($data, $option = "")
|
||||
{
|
||||
return "<script type='text/javascript' " . $option . ">" . $data . "</script>";
|
||||
}
|
||||
|
||||
function scriptReady($data, $option = "")
|
||||
{
|
||||
return "<script type='text/javascript' " . $option . ">
|
||||
$(document).ready(function(){
|
||||
" . $data . "
|
||||
});</script>";
|
||||
}
|
||||
|
||||
function style($data, $option = "")
|
||||
{
|
||||
return "<style type='text/css' $option>" . trim(preg_replace("/\s+/", " ", $data)) . "</style>";
|
||||
}
|
||||
|
||||
|
||||
function createRandomKey($amount)
|
||||
{
|
||||
$keyset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||
$randkey = "";
|
||||
for ($i = 0; $i < $amount; $i++)
|
||||
$randkey .= substr($keyset, rand(0, strlen($keyset) - 1), 1);
|
||||
return $randkey;
|
||||
}
|
||||
|
||||
function ynToStr($yn, $lang = 'fr')
|
||||
{
|
||||
if ($lang == 'fr') {
|
||||
return ($yn == 'y') ? "Oui" : "Non";
|
||||
}
|
||||
if ($lang == 'en') {
|
||||
return ($yn == 'y') ? "Yes" : "No";
|
||||
}
|
||||
}
|
||||
|
||||
function selectYN($name, $selected = '', $options = '')
|
||||
{
|
||||
return select($name, array(0 => array('Yes', 'y'), 1 => array('No', 'n')), $options, $selected);
|
||||
}
|
||||
|
||||
function selectYesNo($name, $selected = '', $options = '')
|
||||
{
|
||||
return select($name, array(0 => array('Yes', 'yes'), 1 => array('No', 'no')), $options, $selected);
|
||||
}
|
||||
|
||||
function selectIntYN($name, $selected = '', $options = '', $null = false)
|
||||
{
|
||||
if ($null)
|
||||
$choices = array(0 => array('Choose', '0'), 1 => array('Yes', '1'), 2 => array('No', '2'));
|
||||
else
|
||||
$choices = array(0 => array('Yes', '1'), 1 => array('No', '0'));
|
||||
return select($name, $choices, $options . " s='" . $selected . "'", $selected);
|
||||
}
|
||||
|
||||
function selectLang($name, $selected = '', $options = '')
|
||||
{
|
||||
return select($name, array(0 => array('Francais', 'FR'), 1 => array('English', 'EN')), $options, $selected);
|
||||
}
|
||||
function assocToNumDef($array, $addDefault = false, $valeur = _MESS_SELECTION)
|
||||
{
|
||||
$arrValues = array_values($array);
|
||||
$len = count($arrValues);
|
||||
/*if($addDefault){
|
||||
$num[] = array(1=> NULL, 0=> $valeur);
|
||||
}*/
|
||||
for ($i = 0; $i < $len; $i++) {
|
||||
$val = array_values($arrValues[$i]);
|
||||
$num[] = $val;
|
||||
}
|
||||
return $num;
|
||||
}
|
||||
|
||||
function assocToNumWidthNull($array, $addDefault = false)
|
||||
{
|
||||
return assocToNumDef($array, $addDefault = false);
|
||||
}
|
||||
|
||||
function assocToNum($array, $addDefault = false)
|
||||
{
|
||||
$arrValues = array_values($array);
|
||||
$len = count($arrValues);
|
||||
/* if($addDefault){
|
||||
$num[] = array(1=> NULL, 0=> _MESS_SELECTION, 2=>'_MESS_SELECTION');
|
||||
}*/
|
||||
for ($i = 0; $i < $len; $i++) {
|
||||
$val = array_values($arrValues[$i]);
|
||||
$num[] = $val;
|
||||
}
|
||||
return $num;
|
||||
}
|
||||
function assocToNumV($array, $addDefault = false)
|
||||
{
|
||||
$arrValues = array_values($array);
|
||||
$len = count($arrValues);
|
||||
/*if($addDefault){
|
||||
$num[] = array(1=> NULL, 0=> _MESS_SELECTION, 2=>'_MESS_SELECTION');
|
||||
}*/
|
||||
for ($i = 0; $i < $len; $i++) {
|
||||
$val = array_values($arrValues[$i]);
|
||||
$num[] = $val;
|
||||
}
|
||||
return $num;
|
||||
}
|
||||
$array_search;
|
||||
function message_label($label, $local = NULL)
|
||||
{
|
||||
|
||||
if ($label) {
|
||||
global $messagesCache;
|
||||
if (!$local)
|
||||
$local = $_SESSION[_AUTH_VAR]->config['locale']['locale'];
|
||||
|
||||
if (!isset($messagesCache[$label][$local])) {
|
||||
$data = \App\MessageQuery::create()
|
||||
->filterByLabel($label)
|
||||
->findOne();
|
||||
|
||||
if ($data) {
|
||||
$messagesCache[$label][$local] = $data->getTranslation($local)->getText();
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($data)) {
|
||||
$e = new App\Message();
|
||||
$e->setLabel($label);
|
||||
$e->save();
|
||||
|
||||
if (count($_SESSION[_AUTH_VAR]->config['locale']['supported_locale']) > 1) {
|
||||
foreach ($_SESSION[_AUTH_VAR]->config['locale']['supported_locale'] as $locale) {
|
||||
$mt = new App\MessageI18n();
|
||||
$mt->setLocale($locale);
|
||||
$mt->setText($label == '' ? null : $label);
|
||||
$e->addMessageI18n($mt);
|
||||
$e->save();
|
||||
}
|
||||
} else {
|
||||
$mt = new App\MessageI18n();
|
||||
$mt->setLocale($local);
|
||||
$mt->setText($label == '' ? null : $label);
|
||||
$e->addMessageI18n($mt);
|
||||
$e->save();
|
||||
}
|
||||
|
||||
$messagesCache[$label][$local] = $label;
|
||||
}
|
||||
|
||||
return $messagesCache[$label][$local];
|
||||
}
|
||||
}
|
||||
|
||||
function handleNotOkResponse($msg, $ui = '', $print = false, $text_title = 'Message')
|
||||
{
|
||||
$ui = (!empty($ui)) ? '#' . $ui : '';
|
||||
$msg = message_label($msg);
|
||||
$error['txt'] .= $msg;
|
||||
|
||||
if ($_SESSION[_AUTH_VAR]->SessVar['content-type'] == 'JSON') {
|
||||
header('Cache-Control: no-cache, must-revalidate');
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Content-type: application/json');
|
||||
$ret['status'] = 'error-notok';
|
||||
$ret['data']['title'] = $text_title;
|
||||
$ret['data']['msg'] = $msg;
|
||||
die(json_encode($ret));
|
||||
} else {
|
||||
if ($print) {
|
||||
$error['onReadyJs'] = "
|
||||
<script>$('#ui-dialog-title-alertDialog').html('" . str_replace("'", " ", $text_title) . "');
|
||||
$('#alert_text').show().html('" . str_replace("'", " ", $msg) . "');
|
||||
$('#alertDialog').dialog('open');</script>
|
||||
|
||||
";
|
||||
} else {
|
||||
$error['onReadyJs'] = "
|
||||
$('#ui-dialog-title-alertDialog').html('" . str_replace("'", " ", $text_title) . "');
|
||||
$('#alert_text').show().html('" . str_replace("'", " ", $msg) . "');
|
||||
$('#alertDialog').dialog('open');";
|
||||
$error['error'] = 'yes';
|
||||
}
|
||||
|
||||
return $error;
|
||||
}
|
||||
}
|
||||
function handleValidationError($objValidationFails, $ui = '', $text_title = 'Message', $extValidationErr = '')
|
||||
{
|
||||
$error['error'] = 'yes';
|
||||
$red_flag = "";
|
||||
$fields = array();
|
||||
if (is_array($extValidationErr)) {
|
||||
foreach ($extValidationErr as $failure => $field) {
|
||||
$msg = message_label($failure);
|
||||
$error['txt'] .= $msg . "<br>";
|
||||
$fields = array_merge($fields, $field['fields']);
|
||||
}
|
||||
}
|
||||
foreach ($objValidationFails->getValidationFailures() as $failure) {
|
||||
$msg = message_label($failure->getMessage());
|
||||
$error['txt'] .= $msg . "<br>";
|
||||
$fields[] = $failure->getColumn();
|
||||
}
|
||||
$ui = (!empty($ui)) ? "#" . $ui : "";
|
||||
$error['onReadyJs'] .= "
|
||||
$('" . $ui . " .error_field').removeClass('error_field');";
|
||||
foreach ($fields as $field) {
|
||||
if (!empty($field)) {
|
||||
if (strstr($field, '.')) {
|
||||
$input = explode('.', $field);
|
||||
$fieldName = $input[1];
|
||||
} else
|
||||
$fieldName = $field;
|
||||
$error['onReadyJs'] .= "
|
||||
if($('" . $ui . " [v=" . addslashes(strtoupper($fieldName)) . "] .select-label-span').length > 0){
|
||||
$('" . $ui . " [v=" . addslashes(strtoupper($fieldName)) . "] .select-label-span').addClass('error_field');
|
||||
}else{
|
||||
$('" . $ui . " [v=" . addslashes(strtoupper($fieldName)) . "]').addClass('error_field');
|
||||
}
|
||||
";
|
||||
}
|
||||
}
|
||||
$error['onReadyJs'] .= "
|
||||
|
||||
$('#ui-dialog-title-alertDialog').html('" . addslashes($text_title) . "');
|
||||
$('#alert_text').show().html('" . addslashes($error['txt']) . "');
|
||||
$('#alertDialog').dialog('open');
|
||||
alert_close = '$(\'" . $ui . " .error_field\').first().focus();';
|
||||
";
|
||||
|
||||
if ($_SESSION[_AUTH_VAR]->SessVar['content-type'] == 'JSON') {
|
||||
header('Cache-Control: no-cache, must-revalidate');
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Content-type: application/json');
|
||||
$ret['status'] = 'error-validation';
|
||||
$ret['data'] = $fields;
|
||||
die(json_encode($ret));
|
||||
} else {
|
||||
return $error;
|
||||
}
|
||||
}
|
||||
function camelize($string, $pascalCase = false)
|
||||
{
|
||||
if (strpos($string, '_') !== false) {
|
||||
$string = strtolower($string);
|
||||
}
|
||||
$string = str_replace(array('-', '_'), ' ', $string);
|
||||
$string = ucwords($string);
|
||||
$string = str_replace(' ', '', $string);
|
||||
|
||||
if (!$pascalCase) {
|
||||
return lcfirst($string);
|
||||
}
|
||||
return $string;
|
||||
}
|
||||
function unCamelize($input)
|
||||
{
|
||||
preg_match_all('!([A-Z][A-Z0-9]*(?=$|[A-Z][a-z0-9])|[A-Za-z][a-z0-9]+)!', $input, $matches);
|
||||
$ret = $matches[0];
|
||||
foreach ($ret as &$match) {
|
||||
$match = $match == strtoupper($match) ? strtolower($match) : lcfirst($match);
|
||||
}
|
||||
return implode('_', $ret);
|
||||
}
|
||||
function format_phone($phone)
|
||||
{
|
||||
return format_phone_v2($phone);
|
||||
}
|
||||
function format_phone_v2($phone)
|
||||
{
|
||||
$phoneNumber = preg_replace('/[^0-9]/', '', $phoneNumber);
|
||||
|
||||
if (strlen($phoneNumber) > 10) {
|
||||
$countryCode = substr($phoneNumber, 0, strlen($phoneNumber) - 10);
|
||||
$areaCode = substr($phoneNumber, -10, 3);
|
||||
$nextThree = substr($phoneNumber, -7, 3);
|
||||
$lastFour = substr($phoneNumber, -4, 4);
|
||||
|
||||
$phoneNumber = '+' . $countryCode . ' (' . $areaCode . ') ' . $nextThree . '-' . $lastFour;
|
||||
} else if (strlen($phoneNumber) == 10) {
|
||||
$areaCode = substr($phoneNumber, 0, 3);
|
||||
$nextThree = substr($phoneNumber, 3, 3);
|
||||
$lastFour = substr($phoneNumber, 6, 4);
|
||||
|
||||
$phoneNumber = '(' . $areaCode . ') ' . $nextThree . '-' . $lastFour;
|
||||
} else if (strlen($phoneNumber) == 7) {
|
||||
$nextThree = substr($phoneNumber, 0, 3);
|
||||
$lastFour = substr($phoneNumber, 3, 4);
|
||||
|
||||
$phoneNumber = $nextThree . '-' . $lastFour;
|
||||
}
|
||||
|
||||
return ltrim($phoneNumber, '0');
|
||||
}
|
||||
|
||||
function return_jour($id)
|
||||
{
|
||||
$tab_jour[0] = "Samedi";
|
||||
$tab_jour[1] = "Dimanche";
|
||||
$tab_jour[2] = "Lundi";
|
||||
$tab_jour[3] = "Mardi";
|
||||
$tab_jour[4] = "Mercredi";
|
||||
$tab_jour[5] = "Jeudi";
|
||||
$tab_jour[6] = "Vendredi";
|
||||
|
||||
return substr($tab_jour[$id], 0, 3);
|
||||
}
|
||||
|
||||
function label($text, $options = "")
|
||||
{
|
||||
return "<label $options>$text</label>";
|
||||
}
|
||||
|
||||
function article($text, $options = "")
|
||||
{
|
||||
return "<article $options>$text</article>";
|
||||
}
|
||||
function button($text, $options = "")
|
||||
{
|
||||
return "<button $options>$text</button>";
|
||||
}
|
||||
|
||||
function section($text, $options = "")
|
||||
{
|
||||
$optionsContent = generateData($options);
|
||||
|
||||
return "<section $optionsContent>$text</section>";
|
||||
}
|
||||
function canvas($text, $options = "")
|
||||
{
|
||||
return "<canvas $options>$text</canvas>";
|
||||
}
|
||||
|
||||
function headerTag($text, $options = "")
|
||||
{
|
||||
return "<header $options>$text</header>";
|
||||
}
|
||||
|
||||
function nav($text, $options = "")
|
||||
{
|
||||
$optionsContent = generateData($options);
|
||||
|
||||
return "<nav $optionsContent>$text</nav>";
|
||||
}
|
||||
|
||||
function footer($text, $options = "")
|
||||
{
|
||||
return "<footer $options>$text</footer>";
|
||||
}
|
||||
|
||||
function encrypt_decrypt($action, $string)
|
||||
{
|
||||
$output = false;
|
||||
|
||||
$encrypt_method = "AES-256-CBC";
|
||||
$secret_key = _CRYPT_KEY;
|
||||
$secret_iv = _CRYPT_IV;
|
||||
|
||||
$key = hash('sha256', $secret_key);
|
||||
$iv = substr(hash('sha256', $secret_iv), 0, 16);
|
||||
|
||||
if ($action == 'encrypt') {
|
||||
$output = openssl_encrypt($string, $encrypt_method, $key, 0, $iv);
|
||||
$output = base64_encode($output);
|
||||
} else if ($action == 'decrypt') {
|
||||
$output = openssl_decrypt(base64_decode($string), $encrypt_method, $key, 0, $iv);
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
function generateData($options)
|
||||
{
|
||||
if (is_array($options)) {
|
||||
if ($options[0] === null) {
|
||||
$dataArray = $options;
|
||||
} else {
|
||||
$dataArray = $options[1];
|
||||
$optionsContent .= $options[0];
|
||||
}
|
||||
|
||||
if (count($dataArray) > 0) {
|
||||
foreach ($dataArray as $key => $data) {
|
||||
$optionsContent .= 'data-' . $key . '="' . $data . '" ';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$optionsContent = $options;
|
||||
}
|
||||
|
||||
return $optionsContent;
|
||||
}
|
||||
|
||||
function send404()
|
||||
{
|
||||
if ($_SESSION[_AUTH_VAR]->SessVar['content-type'] == 'JSON') {
|
||||
http_response_code(404);
|
||||
header('Cache-Control: no-cache, must-revalidate');
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Content-type: application/json');
|
||||
$ret['status'] = 'error-notfound';
|
||||
die(json_encode($ret));
|
||||
} else {
|
||||
http_response_code(404);
|
||||
}
|
||||
}
|
||||
|
||||
function swheader($name = '', $hasControls = '')
|
||||
{
|
||||
return div(
|
||||
htmlLink(span(_('Open/close menu')), 'javascript:', 'class="toggle-menu button-link-blue trigger-menu"')
|
||||
. div($controlsContent, $name . 'ControlsList', "class='custom-controls " . $hasControls . "'")
|
||||
. $_SESSION['ccSwCustom'],
|
||||
'',
|
||||
'class="sw-header"'
|
||||
);
|
||||
}
|
||||
|
||||
function preprint(array $array)
|
||||
{
|
||||
echo pre(print_r($array, true));
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
<?php // Silence is golden
|
|
@ -0,0 +1,81 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The public-facing functionality of the plugin.
|
||||
*
|
||||
* @link http://example.com
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @package apigoat_doc
|
||||
* @subpackage apigoat_doc/public
|
||||
*/
|
||||
|
||||
/**
|
||||
* The public-facing functionality of the plugin.
|
||||
*
|
||||
* @package apigoat_doc
|
||||
* @subpackage apigoat_doc/public
|
||||
* @author Your Name <email@example.com>
|
||||
*/
|
||||
class apigoat_doc_Public
|
||||
{
|
||||
|
||||
/**
|
||||
* The ID of this plugin.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access private
|
||||
* @var string $apigoat_doc The ID of this plugin.
|
||||
*/
|
||||
private $apigoat_doc;
|
||||
|
||||
/**
|
||||
* The version of this plugin.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access private
|
||||
* @var string $version The current version of this plugin.
|
||||
*/
|
||||
private $version;
|
||||
|
||||
/**
|
||||
* Initialize the class and set its properties.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @param string $apigoat_doc The name of the plugin.
|
||||
* @param string $version The version of this plugin.
|
||||
*/
|
||||
public function __construct($apigoat_doc, $version)
|
||||
{
|
||||
|
||||
$this->apigoat_doc = $apigoat_doc;
|
||||
$this->version = $version;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the stylesheets for the public-facing side of the site.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function enqueue_styles()
|
||||
{
|
||||
wp_enqueue_style($this->apigoat_doc, plugin_dir_url(__FILE__) . 'css/apigoat_doc-public.css', array(), $this->version, 'all');
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the JavaScript for the public-facing side of the site.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function enqueue_scripts()
|
||||
{
|
||||
wp_enqueue_script($this->apigoat_doc, plugin_dir_url(__FILE__) . 'js/apigoat_doc-public.js', array('jquery'), $this->version, false);
|
||||
}
|
||||
|
||||
public function register_session()
|
||||
{
|
||||
if (!session_id()) {
|
||||
session_start();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
.wedocs-single-wrap {
|
||||
width: 100%;
|
||||
display: -ms-flex;
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.wedocs-single-wrap .wedocs-single-content {
|
||||
width: 75%;
|
||||
border-left: 1px solid #eee;
|
||||
padding-left: 25px;
|
||||
}
|
||||
|
||||
.wedocs-single-wrap:before, .wedocs-single-wrap:after {
|
||||
content: " ";
|
||||
display: table;
|
||||
}
|
||||
|
||||
.wedocs-single-wrap .wedocs-sidebar {
|
||||
width: 25%;
|
||||
}
|
||||
|
||||
.wedocs-single-wrap .wedocs-sidebar ul.doc-nav-list {
|
||||
list-style: none;
|
||||
margin: 0 12px 0 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.wedocs-single-wrap .wedocs-sidebar ul.doc-nav-list > li.current_page_parent > a, .wedocs-single-wrap .wedocs-sidebar ul.doc-nav-list > li.current_page_item > a, .wedocs-single-wrap .wedocs-sidebar ul.doc-nav-list > li.current_page_ancestor > a {
|
||||
background: #3598DB;
|
||||
color: #fff;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.wedocs-single-wrap .wedocs-sidebar ul.doc-nav-list li a {
|
||||
display: block;
|
||||
padding: 8px 10px 8px 20px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.wedocs-single-wrap .wedocs-sidebar ul.doc-nav-list > li > a:before {
|
||||
margin-right: 10px;
|
||||
content: '';
|
||||
}
|
||||
/*# sourceMappingURL=apigoat_doc-public.css.map */
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"version": 3,
|
||||
"mappings": "AACA,AAAA,mBAAmB,CAAC;EAChB,KAAK,EAAE,IAAI;EACX,OAAO,EAAE,QAAQ;EACjB,OAAO,EAAE,YAAY;EACrB,OAAO,EAAE,IAAI;CAChB;;AAED,AAAA,mBAAmB,CAAC,sBAAsB,CAAC;EACvC,KAAK,EAAE,GAAG;EACV,WAAW,EAAE,cAAc;EAC3B,YAAY,EAAE,IAAI;CACrB;;AAED,AAAA,mBAAmB,AAAA,OAAO,EAAE,mBAAmB,AAAA,MAAM,CAAC;EAClD,OAAO,EAAE,GAAG;EACZ,OAAO,EAAE,KAAK;CACjB;;AAED,AAAA,mBAAmB,CAAC,eAAe,CAAC;EAChC,KAAK,EAAE,GAAG;CACb;;AAED,AAAA,mBAAmB,CAAC,eAAe,CAAC,EAAE,AAAA,aAAa,CAAC;EAChD,UAAU,EAAE,IAAI;EAChB,MAAM,EAAE,UAAU;EACrB,OAAO,EAAE,CAAC;CACV;;AAED,AAAA,mBAAmB,CAAC,eAAe,CAAC,EAAE,AAAA,aAAa,GAAG,EAAE,AAAA,oBAAoB,GAAG,CAAC,EAAE,mBAAmB,CAAC,eAAe,CAAC,EAAE,AAAA,aAAa,GAAG,EAAE,AAAA,kBAAkB,GAAG,CAAC,EAAE,mBAAmB,CAAC,eAAe,CAAC,EAAE,AAAA,aAAa,GAAG,EAAE,AAAA,sBAAsB,GAAG,CAAC,CAAC;EACjP,UAAU,EAAE,OAAO;EACnB,KAAK,EAAE,IAAI;EACX,aAAa,EAAE,GAAG;CACrB;;AAED,AAAA,mBAAmB,CAAC,eAAe,CAAC,EAAE,AAAA,aAAa,CAAC,EAAE,CAAC,CAAC,CAAC;EACrD,OAAO,EAAE,KAAK;EACd,OAAO,EAAE,iBAAiB;EAC1B,eAAe,EAAE,IAAI;CACxB;;AAED,AAAA,mBAAmB,CAAC,eAAe,CAAC,EAAE,AAAA,aAAa,GAAG,EAAE,GAAG,CAAC,AAAA,OAAO,CAAC;EACnE,YAAY,EAAE,IAAI;EAClB,OAAO,EAAC,EAAE;CACV",
|
||||
"sources": [
|
||||
"apigoat_doc-public.scss"
|
||||
],
|
||||
"names": [],
|
||||
"file": "apigoat_doc-public.css"
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
|
||||
.wedocs-single-wrap {
|
||||
width: 100%;
|
||||
display: -ms-flex;
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.wedocs-single-wrap .wedocs-single-content {
|
||||
width: 75%;
|
||||
border-left: 1px solid #eee;
|
||||
padding-left: 25px;
|
||||
}
|
||||
|
||||
.wedocs-single-wrap:before, .wedocs-single-wrap:after {
|
||||
content: " ";
|
||||
display: table;
|
||||
}
|
||||
|
||||
.wedocs-single-wrap .wedocs-sidebar {
|
||||
width: 25%;
|
||||
}
|
||||
|
||||
.wedocs-single-wrap .wedocs-sidebar ul.doc-nav-list {
|
||||
list-style: none;
|
||||
margin: 0 12px 0 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.wedocs-single-wrap .wedocs-sidebar ul.doc-nav-list > li.current_page_parent > a, .wedocs-single-wrap .wedocs-sidebar ul.doc-nav-list > li.current_page_item > a, .wedocs-single-wrap .wedocs-sidebar ul.doc-nav-list > li.current_page_ancestor > a {
|
||||
background: #3598DB;
|
||||
color: #fff;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.wedocs-single-wrap .wedocs-sidebar ul.doc-nav-list li a {
|
||||
display: block;
|
||||
padding: 8px 10px 8px 20px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.wedocs-single-wrap .wedocs-sidebar ul.doc-nav-list > li > a:before {
|
||||
margin-right: 10px;
|
||||
content:'';
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
<?php // Silence is golden
|
|
@ -0,0 +1,32 @@
|
|||
(function( $ ) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* All of the code for your public-facing JavaScript source
|
||||
* should reside in this file.
|
||||
*
|
||||
* Note: It has been assumed you will write jQuery code here, so the
|
||||
* $ function reference has been prepared for usage within the scope
|
||||
* of this function.
|
||||
*
|
||||
* This enables you to define handlers, for when the DOM is ready:
|
||||
*
|
||||
* $(function() {
|
||||
*
|
||||
* });
|
||||
*
|
||||
* When the window is loaded:
|
||||
*
|
||||
* $( window ).load(function() {
|
||||
*
|
||||
* });
|
||||
*
|
||||
* ...and/or other possibilities.
|
||||
*
|
||||
* Ideally, it is not considered best practise to attach more than a
|
||||
* single DOM-ready or window-load handler for a particular page.
|
||||
* Although scripts in the WordPress core, Plugins and Themes may be
|
||||
* practising this, we should strive to set a better example in our own work.
|
||||
*/
|
||||
|
||||
})( jQuery );
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Provide a public-facing view for the plugin
|
||||
*
|
||||
* This file is used to markup the public-facing aspects of the plugin.
|
||||
*
|
||||
* @link http://example.com
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @package apigoat_doc
|
||||
* @subpackage apigoat_doc/public/partials
|
||||
*/
|
||||
?>
|
||||
|
||||
<!-- This file should primarily consist of HTML with a little bit of PHP. -->
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Fired when the plugin is uninstalled.
|
||||
*
|
||||
* When populating this file, consider the following flow
|
||||
* of control:
|
||||
*
|
||||
* - This method should be static
|
||||
* - Check if the $_REQUEST content actually is the plugin name
|
||||
* - Run an admin referrer check to make sure it goes through authentication
|
||||
* - Verify the output of $_GET makes sense
|
||||
* - Repeat with other user roles. Best directly by using the links/query string parameters.
|
||||
* - Repeat things for multisite. Once for a single site in the network, once sitewide.
|
||||
*
|
||||
* This file may be updated more in future version of the Boilerplate; however, this is the
|
||||
* general skeleton and outline for how the file should work.
|
||||
*
|
||||
* For more information, see the following discussion:
|
||||
* https://github.com/tommcfarlin/WordPress-Plugin-Boilerplate/pull/123#issuecomment-28541913
|
||||
*
|
||||
* @link http://example.com
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @package apigoat_doc
|
||||
*/
|
||||
|
||||
// If uninstall not called from WordPress, then exit.
|
||||
if (!defined('WP_UNINSTALL_PLUGIN')) {
|
||||
exit;
|
||||
}
|
Loading…
Reference in New Issue