Browse Source

Commit inicial

master
Guilherme Capanema 6 years ago
commit
b6c510ab0c
57 changed files with 16547 additions and 0 deletions
  1. +1
    -0
      .gitignore
  2. +339
    -0
      LICENSE.txt
  3. +114
    -0
      README.txt
  4. +129
    -0
      admin/class-reuna-glossario-admin.php
  5. +16
    -0
      admin/css/reuna-glossario-admin.css
  6. +1
    -0
      admin/index.php
  7. +32
    -0
      admin/js/reuna-glossario-admin.js
  8. +23
    -0
      admin/partials/shortcode-metabox.php
  9. +31
    -0
      composer.json
  10. +81
    -0
      composer.lock
  11. +36
    -0
      includes/class-reuna-glossario-activator.php
  12. +36
    -0
      includes/class-reuna-glossario-deactivator.php
  13. +47
    -0
      includes/class-reuna-glossario-i18n.php
  14. +129
    -0
      includes/class-reuna-glossario-loader.php
  15. +222
    -0
      includes/class-reuna-glossario.php
  16. +1
    -0
      includes/index.php
  17. +1
    -0
      index.php
  18. +0
    -0
      languages/reuna-glossario.pot
  19. +3
    -0
      mix-manifest.json
  20. +9724
    -0
      package-lock.json
  21. +26
    -0
      package.json
  22. +109
    -0
      public/class-reuna-glossario-public.php
  23. +1
    -0
      public/dist/css/glossario.css
  24. +1
    -0
      public/index.php
  25. +3
    -0
      public/sass/glossario.scss
  26. +47
    -0
      public/views/post-modal.php
  27. +22
    -0
      public/views/shortcode-output.php
  28. +87
    -0
      reuna-glossario.php
  29. +29
    -0
      tailwind.config.js
  30. +31
    -0
      uninstall.php
  31. +7
    -0
      vendor/autoload.php
  32. +445
    -0
      vendor/composer/ClassLoader.php
  33. +21
    -0
      vendor/composer/LICENSE
  34. +9
    -0
      vendor/composer/autoload_classmap.php
  35. +10
    -0
      vendor/composer/autoload_files.php
  36. +9
    -0
      vendor/composer/autoload_namespaces.php
  37. +10
    -0
      vendor/composer/autoload_psr4.php
  38. +73
    -0
      vendor/composer/autoload_real.php
  39. +35
    -0
      vendor/composer/autoload_static.php
  40. +64
    -0
      vendor/composer/installed.json
  41. +339
    -0
      vendor/johnbillion/extended-cpts/LICENSE
  42. +195
    -0
      vendor/johnbillion/extended-cpts/README.md
  43. +64
    -0
      vendor/johnbillion/extended-cpts/composer.json
  44. +29
    -0
      vendor/johnbillion/extended-cpts/extended-cpts.php
  45. +128
    -0
      vendor/johnbillion/extended-cpts/functions.php
  46. +1341
    -0
      vendor/johnbillion/extended-cpts/src/class-extended-cpt-admin.php
  47. +63
    -0
      vendor/johnbillion/extended-cpts/src/class-extended-cpt-rewrite-testing.php
  48. +782
    -0
      vendor/johnbillion/extended-cpts/src/class-extended-cpt.php
  49. +64
    -0
      vendor/johnbillion/extended-cpts/src/class-extended-rewrite-testing.php
  50. +599
    -0
      vendor/johnbillion/extended-cpts/src/class-extended-taxonomy-admin.php
  51. +35
    -0
      vendor/johnbillion/extended-cpts/src/class-extended-taxonomy-rewrite-testing.php
  52. +241
    -0
      vendor/johnbillion/extended-cpts/src/class-extended-taxonomy.php
  53. +109
    -0
      vendor/johnbillion/extended-cpts/src/class-walker-extendedtaxonomycheckboxes.php
  54. +82
    -0
      vendor/johnbillion/extended-cpts/src/class-walker-extendedtaxonomydropdown.php
  55. +109
    -0
      vendor/johnbillion/extended-cpts/src/class-walker-extendedtaxonomyradios.php
  56. +342
    -0
      vendor/johnbillion/extended-cpts/src/dashicons-codepoints.json
  57. +20
    -0
      webpack.mix.js

+ 1
- 0
.gitignore View File

@ -0,0 +1 @@
node_modules

+ 339
- 0
LICENSE.txt View File

@ -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.

+ 114
- 0
README.txt View File

@ -0,0 +1,114 @@
=== Plugin Name ===
Contributors: (this should be a list of wordpress.org userid's)
Donate link: https://horizontes.info
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 `reuna-glossario.php` to the `/wp-content/plugins/` directory
1. Activate the plugin through the 'Plugins' menu in WordPress
1. Place `<?php do_action('plugin_name_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 ?>`

+ 129
- 0
admin/class-reuna-glossario-admin.php View File

@ -0,0 +1,129 @@
<?php
/**
* The admin-specific functionality of the plugin.
*
* @link https://horizontes.info
* @since 1.0.0
*
* @package Reuna_Glossario
* @subpackage Reuna_Glossario/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 Reuna_Glossario
* @subpackage Reuna_Glossario/admin
* @author Horizontes Coop. <contato@horizontes.info>
*/
class Reuna_Glossario_Admin {
/**
* The ID of this plugin.
*
* @since 1.0.0
* @access private
* @var string $plugin_name The ID of this plugin.
*/
private $plugin_name;
/**
* 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 $plugin_name The name of this plugin.
* @param string $version The version of this plugin.
*/
public function __construct( $plugin_name, $version ) {
$this->plugin_name = $plugin_name;
$this->version = $version;
}
/**
* Register the stylesheets for the admin area.
*
* @since 1.0.0
*/
public function enqueue_styles()
{
wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/reuna-glossario-admin.css', [], $this->version, 'all' );
}
/**
* Register the JavaScript for the admin area.
*
* @since 1.0.0
*/
public function enqueue_scripts()
{
}
public function register_glossario_post_type()
{
register_extended_post_type('glossario', [
'hierarchical' => false,
'public' => false,
'show_ui' => true,
'show_in_rest' => false,
'labels' => [
'name' => 'Glossário',
'singular_name' => 'Termo',
'new_item' => 'Novo termo',
'add_new' => 'Novo termo',
'add_new_item' => 'Adicionar novo termo',
'view_item' => 'Ver termo',
'search_items' => 'Pesquisar termos',
'not_found' => 'Nenhum termo encontrado',
'not_found_in_trash' => 'Nenhum termo encontrado na lixeira',
'all_items' => 'Todos os termos',
'menu_name' => 'Glossário',
],
'supports' => [
'title',
'editor',
'author',
'custom_fields',
'revisions',
],
'menu_icon' => 'dashicons-book',
]);
}
public function display_term_shortcode_after_title()
{
global $post;
require (plugin_dir_path(__FILE__) . 'partials/shortcode-metabox.php');
}
public function wp_query_by_post_title_like($where, $wp_query)
{
global $wpdb;
$post_title_like = $wp_query->get('post_title_like');
if ($post_title_like) {
$where .= ' AND ' . $wpdb->posts . '.post_title LIKE \'' . esc_sql( $wpdb->esc_like( $post_title_like ) ) . '\'';
}
return $where;
}
}

+ 16
- 0
admin/css/reuna-glossario-admin.css View File

@ -0,0 +1,16 @@
body.post-type-glossario #reuna-glossario-shortcode {
color: #fff;
background: transparent;
}
body.post-type-glossario span.shortcode {
display: block;
margin: 2px 0;
}
body.post-type-glossario span.shortcode input {
font-size: 12px;
border: none;
box-shadow: none;
padding: 4px 8px;
margin: 0;
}

+ 1
- 0
admin/index.php View File

@ -0,0 +1 @@
<?php // Silence is golden

+ 32
- 0
admin/js/reuna-glossario-admin.js View File

@ -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 );

+ 23
- 0
admin/partials/shortcode-metabox.php View File

@ -0,0 +1,23 @@
<?php
/**
* The metabox containing the term's shortcode
*
* @link https://horizontes.info
* @since 1.0.0
*
* @package Reuna_Glossario
* @subpackage Reuna_Glossario/admin/partials
*/
?>
<p class="description">
<label for="reuna-glossario-shortcode">
<?php echo esc_html( __( "Copie este shortcode para adicionar o termo ao seu conteúdo:", 'reuna-shortcode' ) ); ?>
</label>
<span class="shortcode wp-ui-highlight">
<input type="text" id="reuna-glossario-shortcode" onfocus="this.select();" readonly="readonly" class="large-text code" value="<?php echo esc_attr( '[glossario id="' . get_the_ID() . '"]' . strtolower(get_the_title()) . '[/glossario]' ); ?>" />
</span>
</p>

+ 31
- 0
composer.json View File

@ -0,0 +1,31 @@
{
"name": "capanema/reuna-glossario",
"type": "wordpress-plugin",
"description": "Implementa função de glossário via shortcode",
"keywords": [
"plugin",
"glossario",
"wordpress"
],
"license": "MIT",
"authors": [
{
"name": "Guilherme Capanema",
"email": "guilherme@horizontes.info"
}
],
"require": {
"php": "^7.2",
"johnbillion/extended-cpts": "^4.3"
},
"config": {
"preferred-install": "dist"
},
"extra": {
"branch-alias": {
"dev-master": "1.1-dev"
}
},
"minimum-stability": "dev",
"prefer-stable": true
}

+ 81
- 0
composer.lock View File

@ -0,0 +1,81 @@
{
"_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#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "0905d3af779b7b12c0ea6cae0f780bbb",
"packages": [
{
"name": "johnbillion/extended-cpts",
"version": "4.3.3",
"source": {
"type": "git",
"url": "https://github.com/johnbillion/extended-cpts.git",
"reference": "4c4e292781c28a7d8666803f63c44e655cddf7ad"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/johnbillion/extended-cpts/zipball/4c4e292781c28a7d8666803f63c44e655cddf7ad",
"reference": "4c4e292781c28a7d8666803f63c44e655cddf7ad",
"shasum": ""
},
"require": {
"php": "^7.0"
},
"require-dev": {
"automattic/phpcs-neutron-standard": "^1.5",
"dealerdirect/phpcodesniffer-composer-installer": "^0.5",
"johnbillion/falsey-assertequals-detector": "^2",
"johnbillion/php-docs-standards": "^1",
"phpcompatibility/phpcompatibility-wp": "^2",
"phpunit/phpunit": "^6",
"roots/wordpress": "*",
"vlucas/phpdotenv": "^3",
"wp-cli/wp-cli-bundle": "^2.1",
"wp-coding-standards/wpcs": "~2.1.0",
"wp-phpunit/wp-phpunit": "*"
},
"suggest": {
"seravo/wp-custom-bulk-actions": "Custom Bulk Actions",
"wpackagist-plugin/rewrite-testing": "Rewrite Rule Testing"
},
"type": "library",
"extra": {
"wordpress-install-dir": "tests/wordpress"
},
"autoload": {
"psr-4": {
"ExtCPTs\\Tests\\": "tests/phpunit"
},
"files": [
"extended-cpts.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"GPL-2.0+"
],
"authors": [
{
"name": "John Blackbourn",
"homepage": "https://johnblackbourn.com/"
}
],
"description": "A library which provides extended functionality to WordPress custom post types and taxonomies.",
"homepage": "https://github.com/johnbillion/extended-cpts/",
"time": "2020-04-22T16:13:18+00:00"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "dev",
"stability-flags": [],
"prefer-stable": true,
"prefer-lowest": false,
"platform": {
"php": "^7.2"
},
"platform-dev": [],
"plugin-api-version": "1.1.0"
}

+ 36
- 0
includes/class-reuna-glossario-activator.php View File

@ -0,0 +1,36 @@
<?php
/**
* Fired during plugin activation
*
* @link https://horizontes.info
* @since 1.0.0
*
* @package Reuna_Glossario
* @subpackage Reuna_Glossario/includes
*/
/**
* Fired during plugin activation.
*
* This class defines all code necessary to run during the plugin's activation.
*
* @since 1.0.0
* @package Reuna_Glossario
* @subpackage Reuna_Glossario/includes
* @author Horizontes Coop. <contato@horizontes.info>
*/
class Reuna_Glossario_Activator {
/**
* Short Description. (use period)
*
* Long Description.
*
* @since 1.0.0
*/
public static function activate() {
}
}

+ 36
- 0
includes/class-reuna-glossario-deactivator.php View File

@ -0,0 +1,36 @@
<?php
/**
* Fired during plugin deactivation
*
* @link https://horizontes.info
* @since 1.0.0
*
* @package Reuna_Glossario
* @subpackage Reuna_Glossario/includes
*/
/**
* Fired during plugin deactivation.
*
* This class defines all code necessary to run during the plugin's deactivation.
*
* @since 1.0.0
* @package Reuna_Glossario
* @subpackage Reuna_Glossario/includes
* @author Horizontes Coop. <contato@horizontes.info>
*/
class Reuna_Glossario_Deactivator {
/**
* Short Description. (use period)
*
* Long Description.
*
* @since 1.0.0
*/
public static function deactivate() {
}
}

+ 47
- 0
includes/class-reuna-glossario-i18n.php View File

@ -0,0 +1,47 @@
<?php
/**
* Define the internationalization functionality
*
* Loads and defines the internationalization files for this plugin
* so that it is ready for translation.
*
* @link https://horizontes.info
* @since 1.0.0
*
* @package Reuna_Glossario
* @subpackage Reuna_Glossario/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 Reuna_Glossario
* @subpackage Reuna_Glossario/includes
* @author Horizontes Coop. <contato@horizontes.info>
*/
class Reuna_Glossario_i18n {
/**
* Load the plugin text domain for translation.
*
* @since 1.0.0
*/
public function load_plugin_textdomain() {
load_plugin_textdomain(
'reuna-glossario',
false,
dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/'
);
}
}

+ 129
- 0
includes/class-reuna-glossario-loader.php View File

@ -0,0 +1,129 @@
<?php
/**
* Register all actions and filters for the plugin
*
* @link https://horizontes.info
* @since 1.0.0
*
* @package Reuna_Glossario
* @subpackage Reuna_Glossario/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 Reuna_Glossario
* @subpackage Reuna_Glossario/includes
* @author Horizontes Coop. <contato@horizontes.info>
*/
class Reuna_Glossario_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();
}
/**
* 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 );
}
/**
* 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'] );
}
}
}

+ 222
- 0
includes/class-reuna-glossario.php View File

@ -0,0 +1,222 @@
<?php
/**
* The file that defines the core plugin class
*
* A class definition that includes attributes and functions used across both the
* public-facing side of the site and the admin area.
*
* @link https://horizontes.info
* @since 1.0.0
*
* @package Reuna_Glossario
* @subpackage Reuna_Glossario/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 Reuna_Glossario
* @subpackage Reuna_Glossario/includes
* @author Horizontes Coop. <contato@horizontes.info>
*/
class Reuna_Glossario {
/**
* The loader that's responsible for maintaining and registering all hooks that power
* the plugin.
*
* @since 1.0.0
* @access protected
* @var Reuna_Glossario_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 $plugin_name The string used to uniquely identify this plugin.
*/
protected $plugin_name;
/**
* 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( 'REUNA_GLOSSARIO_VERSION' ) ) {
$this->version = REUNA_GLOSSARIO_VERSION;
} else {
$this->version = '1.0.0';
}
$this->plugin_name = 'reuna-glossario';
$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:
*
* - Reuna_Glossario_Loader. Orchestrates the hooks of the plugin.
* - Reuna_Glossario_i18n. Defines internationalization functionality.
* - Reuna_Glossario_Admin. Defines all hooks for the admin area.
* - Reuna_Glossario_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-reuna-glossario-loader.php';
/**
* The class responsible for defining internationalization functionality
* of the plugin.
*/
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-reuna-glossario-i18n.php';
/**
* The class responsible for defining all actions that occur in the admin area.
*/
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-reuna-glossario-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-reuna-glossario-public.php';
$this->loader = new Reuna_Glossario_Loader();
}
/**
* Define the locale for this plugin for internationalization.
*
* Uses the Reuna_Glossario_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 Reuna_Glossario_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 Reuna_Glossario_Admin( $this->get_plugin_name(), $this->get_version() );
$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
$this->loader->add_action( 'init', $plugin_admin, 'register_glossario_post_type', 15 );
$this->loader->add_action( 'edit_form_after_title', $plugin_admin, 'display_term_shortcode_after_title' );
$this->loader->add_action( 'posts_where', $plugin_admin, 'wp_query_by_post_title_like', 10, 2 );
}
/**
* 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 Reuna_Glossario_Public( $this->get_plugin_name(), $this->get_version() );
$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
$this->loader->add_action( 'init', $plugin_public, 'register_glossario_shortcode' );
$this->loader->add_action( 'reuna_handle_glossario_shortcode', $plugin_public, 'output_glossario_post_modal' );
}
/**
* 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_plugin_name() {
return $this->plugin_name;
}
/**
* The reference to the class that orchestrates the hooks with the plugin.
*
* @since 1.0.0
* @return Reuna_Glossario_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;
}
}

+ 1
- 0
includes/index.php View File

@ -0,0 +1 @@
<?php // Silence is golden

+ 1
- 0
index.php View File

@ -0,0 +1 @@
<?php // Silence is golden

+ 0
- 0
languages/reuna-glossario.pot View File


+ 3
- 0
mix-manifest.json View File

@ -0,0 +1,3 @@
{
"/public/dist/css/glossario.css": "/public/dist/css/glossario.css"
}

+ 9724
- 0
package-lock.json
File diff suppressed because it is too large
View File


+ 26
- 0
package.json View File

@ -0,0 +1,26 @@
{
"name": "reuna-glossario",
"version": "1.0.0",
"description": "=== Plugin Name === Contributors: (this should be a list of wordpress.org userid's) Donate link: https://horizontes.info 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",
"main": "index.js",
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "npm run development -- --watch",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"cross-env": "^7.0.2",
"laravel-mix": "^5.0.4",
"sass": "^1.26.9",
"sass-loader": "^8.0.2"
},
"dependencies": {
"tailwindcss": "^1.4.6"
}
}

+ 109
- 0
public/class-reuna-glossario-public.php View File

@ -0,0 +1,109 @@
<?php
/**
* The public-facing functionality of the plugin.
*
* @link https://horizontes.info
* @since 1.0.0
*
* @package Reuna_Glossario
* @subpackage Reuna_Glossario/public
*/
/**
* The public-facing functionality of the plugin.
*
* Defines the plugin name, version, and two examples hooks for how to
* enqueue the public-facing stylesheet and JavaScript.
*
* @package Reuna_Glossario
* @subpackage Reuna_Glossario/public
* @author Horizontes Coop. <contato@horizontes.info>
*/
class Reuna_Glossario_Public {
/**
* The ID of this plugin.
*
* @since 1.0.0
* @access private
* @var string $plugin_name The ID of this plugin.
*/
private $plugin_name;
/**
* 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 $plugin_name The name of the plugin.
* @param string $version The version of this plugin.
*/
public function __construct( $plugin_name, $version ) {
$this->plugin_name = $plugin_name;
$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->plugin_name, plugin_dir_url( __FILE__ ) . 'dist/css/glossario.css', [], $this->version, 'all' );
}
public function register_glossario_shortcode()
{
add_shortcode('glossario', array($this, 'handle_glossario_shortcode'));
}
public function handle_glossario_shortcode($atts, $content = null)
{
$atts = shortcode_atts([
'id' => '',
], $atts);
$args = [
'post_type' => 'glossario',
];
if ($atts['id']) {
$args['page_id'] = $atts['id'];
} else {
$args['post_title_like'] = $content;
}
$glossario_query = new WP_Query($args);
if (! $glossario_query->found_posts) {
return $content;
}
$post = $glossario_query->get_posts()[0];
do_action('reuna_handle_glossario_shortcode', $post);
ob_start();
include plugin_dir_path(__FILE__) . 'views/shortcode-output.php';
return ob_get_clean();
}
public function output_glossario_post_modal($post)
{
add_action('get_footer', function() use ($post) {
require plugin_dir_path(__FILE__) . 'views/post-modal.php';
});
}
}

+ 1
- 0
public/dist/css/glossario.css View File

@ -0,0 +1 @@
.rg-container{width:100%}@media (min-width:640px){.rg-container{max-width:640px}}@media (min-width:768px){.rg-container{max-width:768px}}@media (min-width:1024px){.rg-container{max-width:1024px}}@media (min-width:1280px){.rg-container{max-width:1280px}}.rg-bg-yellow-100{--bg-opacity:1!important;background-color:#faf9f5!important;background-color:rgba(250,249,245,var(--bg-opacity))!important}.rg-border-red-400{--border-opacity:1!important;border-color:#ff746e!important;border-color:rgba(255,116,110,var(--border-opacity))!important}.rg-border-l-8{border-left-width:8px!important}.rg-cursor-pointer{cursor:pointer!important}.rg-font-bold{font-weight:700!important}.rg-h-full{height:100%!important}.rg-text-xl{font-size:1.25rem!important}.rg-text-2xl{font-size:1.5rem!important}.rg-leading-tight{line-height:1.25!important}.rg-mt-2{margin-top:.5rem!important}.rg-mr-2{margin-right:.5rem!important}.rg-mt-5{margin-top:1.25rem!important}.rg-max-w-2xl{max-width:42rem!important}.hover\:rg-opacity-75:hover{opacity:.75!important}.rg-overflow-y-auto{overflow-y:auto!important}.rg-overflow-x-hidden{overflow-x:hidden!important}.rg-px-3{padding-left:.75rem!important;padding-right:.75rem!important}.rg-px-4{padding-left:1rem!important;padding-right:1rem!important}.rg-py-6{padding-top:1.5rem!important;padding-bottom:1.5rem!important}.rg-pt-4{padding-top:1rem!important}.rg-fixed{position:fixed!important}.rg-absolute{position:absolute!important}.rg-relative{position:relative!important}.rg-inset-0{right:0!important;bottom:0!important;left:0!important}.rg-inset-0,.rg-top-0{top:0!important}.rg-right-0{right:0!important}.rg-text-red-400{--text-opacity:1!important;color:#ff746e!important;color:rgba(255,116,110,var(--text-opacity))!important}.hover\:rg-underline:hover{text-decoration:underline!important}.rg-w-full{width:100%!important}.rg-z-40{z-index:40!important}@media (min-width:1024px){.lg\:rg-py-8{padding-top:2rem!important;padding-bottom:2rem!important}.lg\:rg-px-12{padding-left:3rem!important;padding-right:3rem!important}}

+ 1
- 0
public/index.php View File

@ -0,0 +1 @@
<?php // Silence is golden

+ 3
- 0
public/sass/glossario.scss View File

@ -0,0 +1,3 @@
@tailwind components;
@tailwind utilities;

+ 47
- 0
public/views/post-modal.php View File

@ -0,0 +1,47 @@
<?php
/**
* Provide a public-facing view for the plugin
*
* This file is used to markup the public-facing aspects of the plugin.
*
* @link https://horizontes.info
* @since 1.0.0
*
* @package Reuna_Glossario
* @subpackage Reuna_Glossario/public/partials
*/
$slug = get_post_field('post_name', $post);
?>
<div
x-data="{ open: false }"
x-bind:class="{ 'hidden': !open }"
x-on:modal-open="open = true"
x-on:keyup.escape.window="open = false"
x-cloak
class="rg-fixed rg-inset-0 rg-z-40 rg-px-3 rg-w-full rg-h-full rg-overflow-y-auto rg-overflow-x-hidden"
id="modal-glossario-<?php echo $slug ?>"
role="dialog"
aria-labelledby="modal-glossario-<?php echo $slug ?>-label"
>
<div x-on:click.away="open = false" class="rg-relative rg-bg-yellow-100 rg-px-4 lg:rg-px-12 rg-pt-4 rg-py-6 lg:rg-py-8 rg-max-w-2xl rg-border-l-8 rg-border-red-400 modal-dialog">
<button type="button" x-on:click="open = false" class="rg-absolute rg-top-0 rg-right-0 rg-text-2xl rg-text-red-400 hover:rg-opacity-75 rg-mt-2 rg-mr-2" aria-label="{{ __('Fechar', 'sage') }}">
<i class="far fa-times-circle"></i>
</button>
<h2 class="rg-text-xl rg-font-bold rg-leading-tight" id="modal-<?php echo $slug ?>-label">
<?php echo get_the_title($post); ?>
</h2>
<div class="rg-mt-5 content">
<?php echo get_the_content(null, false, $post); ?>
</div>
</div>
<div class="modal-backdrop"></div>
</div>

+ 22
- 0
public/views/shortcode-output.php View File

@ -0,0 +1,22 @@
<?php
/**
* Provide a public-facing view for the plugin
*
* This file is used to markup the public-facing aspects of the plugin.
*
* @link https://horizontes.info
* @since 1.0.0
*
* @package Reuna_Glossario
* @subpackage Reuna_Glossario/public/partials
*/
?>
<span
x-data
x-on:click="document.getElementById('modal-glossario-<?php echo get_post_field('post_name', $post); ?>').dispatchEvent(new Event('modal-open'))"
class="rg-text-red-400 hover:rg-underline rg-cursor-pointer"
>
<?php echo $content; ?>
</span>

+ 87
- 0
reuna-glossario.php View File

@ -0,0 +1,87 @@
<?php
/**
* The plugin bootstrap file
*
* This file is read by WordPress to generate the plugin information in the plugin
* admin area. This file also includes all of the dependencies used by the plugin,
* registers the activation and deactivation functions, and defines a function
* that starts the plugin.
*
* @link https://horizontes.info
* @since 1.0.0
* @package Reuna_Glossario
*
* @wordpress-plugin
* Plugin Name: Instituto Reúna - Glossário
* Plugin URI: https://horizontes.info
* Description: Implementa função de glossário via shortcode
* Version: 1.0.0
* Author: Horizontes Coop.
* Author URI: https://horizontes.info
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Text Domain: reuna-glossario
* 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( 'REUNA_GLOSSARIO_VERSION', '1.0.0' );
/**
* Require the Composer autoloader
*/
require __DIR__.'/vendor/autoload.php';
/**
* The code that runs during plugin activation.
* This action is documented in includes/class-reuna-glossario-activator.php
*/
function activate_reuna_glossario() {
require_once plugin_dir_path( __FILE__ ) . 'includes/class-reuna-glossario-activator.php';
Reuna_Glossario_Activator::activate();
}
/**
* The code that runs during plugin deactivation.
* This action is documented in includes/class-reuna-glossario-deactivator.php
*/
function deactivate_reuna_glossario() {
require_once plugin_dir_path( __FILE__ ) . 'includes/class-reuna-glossario-deactivator.php';
Reuna_Glossario_Deactivator::deactivate();
}
register_activation_hook( __FILE__, 'activate_reuna_glossario' );
register_deactivation_hook( __FILE__, 'deactivate_reuna_glossario' );
/**
* The core plugin class that is used to define internationalization,
* admin-specific hooks, and public-facing site hooks.
*/
require plugin_dir_path( __FILE__ ) . 'includes/class-reuna-glossario.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_reuna_glossario() {
$plugin = new Reuna_Glossario();
$plugin->run();
}
run_reuna_glossario();

+ 29
- 0
tailwind.config.js View File

@ -0,0 +1,29 @@
module.exports = {
prefix: 'rg-',
important: true,
purge: [
'public/views/**/*.php',
],
theme: {
colors: {
transparent: 'transparent',
current: 'currentColor',
black: '#000',
white: '#fff',
red: {
400: '#ff746e',
},
yellow: {
100: '#faf9f5',
},
blue: {
900: '#0e2734',
},
},
extend: {},
},
variants: {},
plugins: [],
}

+ 31
- 0
uninstall.php View File

@ -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 https://horizontes.info
* @since 1.0.0
*
* @package Reuna_Glossario
*/
// If uninstall not called from WordPress, then exit.
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit;
}

+ 7
- 0
vendor/autoload.php View File

@ -0,0 +1,7 @@
<?php
// autoload.php @generated by Composer
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInitf9d3df04348ea4a00ebc5c11c4133c0f::getLoader();

+ 445
- 0
vendor/composer/ClassLoader.php View File

@ -0,0 +1,445 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Autoload;
/**
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
*
* $loader = new \Composer\Autoload\ClassLoader();
*
* // register classes with namespaces
* $loader->add('Symfony\Component', __DIR__.'/component');
* $loader->add('Symfony', __DIR__.'/framework');
*
* // activate the autoloader
* $loader->register();
*
* // to enable searching the include path (eg. for PEAR packages)
* $loader->setUseIncludePath(true);
*
* In this example, if you try to use a class in the Symfony\Component
* namespace or one of its children (Symfony\Component\Console for instance),
* the autoloader will first look for the class under the component/
* directory, and it will then fallback to the framework/ directory if not
* found before giving up.
*
* This class is loosely based on the Symfony UniversalClassLoader.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Jordi Boggiano <j.boggiano@seld.be>
* @see http://www.php-fig.org/psr/psr-0/
* @see http://www.php-fig.org/psr/psr-4/
*/
class ClassLoader
{
// PSR-4
private $prefixLengthsPsr4 = array();
private $prefixDirsPsr4 = array();
private $fallbackDirsPsr4 = array();
// PSR-0
private $prefixesPsr0 = array();
private $fallbackDirsPsr0 = array();
private $useIncludePath = false;
private $classMap = array();
private $classMapAuthoritative = false;
private $missingClasses = array();
private $apcuPrefix;
public function getPrefixes()
{
if (!empty($this->prefixesPsr0)) {
return call_user_func_array('array_merge', $this->prefixesPsr0);
}
return array();
}
public function getPrefixesPsr4()
{
return $this->prefixDirsPsr4;
}
public function getFallbackDirs()
{
return $this->fallbackDirsPsr0;
}
public function getFallbackDirsPsr4()
{
return $this->fallbackDirsPsr4;
}
public function getClassMap()
{
return $this->classMap;
}
/**
* @param array $classMap Class to filename map
*/
public function addClassMap(array $classMap)
{
if ($this->classMap) {
$this->classMap = array_merge($this->classMap, $classMap);
} else {
$this->classMap = $classMap;
}
}
/**
* Registers a set of PSR-0 directories for a given prefix, either
* appending or prepending to the ones previously set for this prefix.
*
* @param string $prefix The prefix
* @param array|string $paths The PSR-0 root directories
* @param bool $prepend Whether to prepend the directories
*/
public function add($prefix, $paths, $prepend = false)
{
if (!$prefix) {
if ($prepend) {
$this->fallbackDirsPsr0 = array_merge(
(array) $paths,
$this->fallbackDirsPsr0
);
} else {
$this->fallbackDirsPsr0 = array_merge(
$this->fallbackDirsPsr0,
(array) $paths
);
}
return;
}
$first = $prefix[0];
if (!isset($this->prefixesPsr0[$first][$prefix])) {
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
return;
}
if ($prepend) {
$this->prefixesPsr0[$first][$prefix] = array_merge(
(array) $paths,
$this->prefixesPsr0[$first][$prefix]
);
} else {
$this->prefixesPsr0[$first][$prefix] = array_merge(
$this->prefixesPsr0[$first][$prefix],
(array) $paths
);
}
}
/**
* Registers a set of PSR-4 directories for a given namespace, either
* appending or prepending to the ones previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param array|string $paths The PSR-4 base directories
* @param bool $prepend Whether to prepend the directories
*
* @throws \InvalidArgumentException
*/
public function addPsr4($prefix, $paths, $prepend = false)
{
if (!$prefix) {
// Register directories for the root namespace.
if ($prepend) {
$this->fallbackDirsPsr4 = array_merge(
(array) $paths,
$this->fallbackDirsPsr4
);
} else {
$this->fallbackDirsPsr4 = array_merge(
$this->fallbackDirsPsr4,
(array) $paths
);
}
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
// Register directories for a new namespace.
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
} elseif ($prepend) {
// Prepend directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
(array) $paths,
$this->prefixDirsPsr4[$prefix]
);
} else {
// Append directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
$this->prefixDirsPsr4[$prefix],
(array) $paths
);
}
}
/**
* Registers a set of PSR-0 directories for a given prefix,
* replacing any others previously set for this prefix.
*
* @param string $prefix The prefix
* @param array|string $paths The PSR-0 base directories
*/
public function set($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr0 = (array) $paths;
} else {
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
}
}
/**
* Registers a set of PSR-4 directories for a given namespace,
* replacing any others previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param array|string $paths The PSR-4 base directories
*
* @throws \InvalidArgumentException
*/
public function setPsr4($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr4 = (array) $paths;
} else {
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
}
}
/**
* Turns on searching the include path for class files.
*
* @param bool $useIncludePath
*/
public function setUseIncludePath($useIncludePath)
{
$this->useIncludePath = $useIncludePath;
}
/**
* Can be used to check if the autoloader uses the include path to check
* for classes.
*
* @return bool
*/
public function getUseIncludePath()
{
return $this->useIncludePath;
}
/**
* Turns off searching the prefix and fallback directories for classes
* that have not been registered with the class map.
*
* @param bool $classMapAuthoritative
*/
public function setClassMapAuthoritative($classMapAuthoritative)
{
$this->classMapAuthoritative = $classMapAuthoritative;
}
/**
* Should class lookup fail if not found in the current class map?
*
* @return bool
*/
public function isClassMapAuthoritative()
{
return $this->classMapAuthoritative;
}
/**
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
*
* @param string|null $apcuPrefix
*/
public function setApcuPrefix($apcuPrefix)
{
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
}
/**
* The APCu prefix in use, or null if APCu caching is not enabled.
*
* @return string|null
*/
public function getApcuPrefix()
{
return $this->apcuPrefix;
}
/**
* Registers this instance as an autoloader.
*
* @param bool $prepend Whether to prepend the autoloader or not
*/
public function register($prepend = false)
{
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
}
/**
* Unregisters this instance as an autoloader.
*/
public function unregister()
{
spl_autoload_unregister(array($this, 'loadClass'));
}
/**
* Loads the given class or interface.
*
* @param string $class The name of the class
* @return bool|null True if loaded, null otherwise
*/
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
includeFile($file);
return true;
}
}
/**
* Finds the path to the file where the class is defined.
*
* @param string $class The name of the class
*
* @return string|false The path if found, false otherwise
*/
public function findFile($class)
{
// class map lookup
if (isset($this->classMap[$class])) {
return $this->classMap[$class];
}
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
return false;
}
if (null !== $this->apcuPrefix) {
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
if ($hit) {
return $file;
}
}
$file = $this->findFileWithExtension($class, '.php');
// Search for Hack files if we are running on HHVM
if (false === $file && defined('HHVM_VERSION')) {
$file = $this->findFileWithExtension($class, '.hh');
}
if (null !== $this->apcuPrefix) {
apcu_add($this->apcuPrefix.$class, $file);
}
if (false === $file) {
// Remember that this class does not exist.
$this->missingClasses[$class] = true;
}
return $file;
}
private function findFileWithExtension($class, $ext)
{
// PSR-4 lookup
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
$first = $class[0];
if (isset($this->prefixLengthsPsr4[$first])) {
$subPath = $class;
while (false !== $lastPos = strrpos($subPath, '\\')) {
$subPath = substr($subPath, 0, $lastPos);
$search = $subPath . '\\';
if (isset($this->prefixDirsPsr4[$search])) {
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
foreach ($this->prefixDirsPsr4[$search] as $dir) {
if (file_exists($file = $dir . $pathEnd)) {
return $file;
}
}
}
}
}
// PSR-4 fallback dirs
foreach ($this->fallbackDirsPsr4 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
return $file;
}
}
// PSR-0 lookup
if (false !== $pos = strrpos($class, '\\')) {
// namespaced class name
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
} else {
// PEAR-like class name
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
}
if (isset($this->prefixesPsr0[$first])) {
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
if (0 === strpos($class, $prefix)) {
foreach ($dirs as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
}
}
}
// PSR-0 fallback dirs
foreach ($this->fallbackDirsPsr0 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
// PSR-0 include paths.
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
return $file;
}
return false;
}
}
/**
* Scope isolated include.
*
* Prevents access to $this/self from included files.
*/
function includeFile($file)
{
include $file;
}

+ 21
- 0
vendor/composer/LICENSE View File

@ -0,0 +1,21 @@
Copyright (c) Nils Adermann, Jordi Boggiano
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

+ 9
- 0
vendor/composer/autoload_classmap.php View File

@ -0,0 +1,9 @@
<?php
// autoload_classmap.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
);

+ 10
- 0
vendor/composer/autoload_files.php View File

@ -0,0 +1,10 @@
<?php
// autoload_files.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'a2c48002d05f7782d8b603bd2bcb5252' => $vendorDir . '/johnbillion/extended-cpts/extended-cpts.php',
);

+ 9
- 0
vendor/composer/autoload_namespaces.php View File

@ -0,0 +1,9 @@
<?php
// autoload_namespaces.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
);

+ 10
- 0
vendor/composer/autoload_psr4.php View File

@ -0,0 +1,10 @@
<?php
// autoload_psr4.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'ExtCPTs\\Tests\\' => array($vendorDir . '/johnbillion/extended-cpts/tests/phpunit'),
);

+ 73
- 0
vendor/composer/autoload_real.php View File

@ -0,0 +1,73 @@
<?php
// autoload_real.php @generated by Composer
class ComposerAutoloaderInitf9d3df04348ea4a00ebc5c11c4133c0f
{
private static $loader;
public static function loadClassLoader($class)
{
if ('Composer\Autoload\ClassLoader' === $class) {
require __DIR__ . '/ClassLoader.php';
}
}
/**
* @return \Composer\Autoload\ClassLoader
*/
public static function getLoader()
{
if (null !== self::$loader) {
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInitf9d3df04348ea4a00ebc5c11c4133c0f', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInitf9d3df04348ea4a00ebc5c11c4133c0f', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require_once __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInitf9d3df04348ea4a00ebc5c11c4133c0f::getInitializer($loader));
} else {
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
$loader->set($namespace, $path);
}
$map = require __DIR__ . '/autoload_psr4.php';
foreach ($map as $namespace => $path) {
$loader->setPsr4($namespace, $path);
}
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
}
}
$loader->register(true);
if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInitf9d3df04348ea4a00ebc5c11c4133c0f::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequiref9d3df04348ea4a00ebc5c11c4133c0f($fileIdentifier, $file);
}
return $loader;
}
}
function composerRequiref9d3df04348ea4a00ebc5c11c4133c0f($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file;
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
}
}

+ 35
- 0
vendor/composer/autoload_static.php View File

@ -0,0 +1,35 @@
<?php
// autoload_static.php @generated by Composer
namespace Composer\Autoload;
class ComposerStaticInitf9d3df04348ea4a00ebc5c11c4133c0f
{
public static $files = array (
'a2c48002d05f7782d8b603bd2bcb5252' => __DIR__ . '/..' . '/johnbillion/extended-cpts/extended-cpts.php',
);
public static $prefixLengthsPsr4 = array (
'E' =>
array (
'ExtCPTs\\Tests\\' => 14,
),
);
public static $prefixDirsPsr4 = array (
'ExtCPTs\\Tests\\' =>
array (
0 => __DIR__ . '/..' . '/johnbillion/extended-cpts/tests/phpunit',
),
);
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInitf9d3df04348ea4a00ebc5c11c4133c0f::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitf9d3df04348ea4a00ebc5c11c4133c0f::$prefixDirsPsr4;
}, null, ClassLoader::class);
}
}

+ 64
- 0
vendor/composer/installed.json View File

@ -0,0 +1,64 @@
[
{
"name": "johnbillion/extended-cpts",
"version": "4.3.3",
"version_normalized": "4.3.3.0",
"source": {
"type": "git",
"url": "https://github.com/johnbillion/extended-cpts.git",
"reference": "4c4e292781c28a7d8666803f63c44e655cddf7ad"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/johnbillion/extended-cpts/zipball/4c4e292781c28a7d8666803f63c44e655cddf7ad",
"reference": "4c4e292781c28a7d8666803f63c44e655cddf7ad",
"shasum": ""
},
"require": {
"php": "^7.0"
},
"require-dev": {
"automattic/phpcs-neutron-standard": "^1.5",
"dealerdirect/phpcodesniffer-composer-installer": "^0.5",
"johnbillion/falsey-assertequals-detector": "^2",
"johnbillion/php-docs-standards": "^1",
"phpcompatibility/phpcompatibility-wp": "^2",
"phpunit/phpunit": "^6",
"roots/wordpress": "*",
"vlucas/phpdotenv": "^3",
"wp-cli/wp-cli-bundle": "^2.1",
"wp-coding-standards/wpcs": "~2.1.0",
"wp-phpunit/wp-phpunit": "*"
},
"suggest": {
"seravo/wp-custom-bulk-actions": "Custom Bulk Actions",
"wpackagist-plugin/rewrite-testing": "Rewrite Rule Testing"
},
"time": "2020-04-22T16:13:18+00:00",
"type": "library",
"extra": {
"wordpress-install-dir": "tests/wordpress"
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"ExtCPTs\\Tests\\": "tests/phpunit"
},
"files": [
"extended-cpts.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"GPL-2.0+"
],
"authors": [
{
"name": "John Blackbourn",
"homepage": "https://johnblackbourn.com/"
}
],
"description": "A library which provides extended functionality to WordPress custom post types and taxonomies.",
"homepage": "https://github.com/johnbillion/extended-cpts/"
}
]

+ 339
- 0
vendor/johnbillion/extended-cpts/LICENSE View File

@ -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.
{{description}}
Copyright (C) {{year}} {{fullname}}
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.

+ 195
- 0
vendor/johnbillion/extended-cpts/README.md View File

@ -0,0 +1,195 @@
[![Build Status](https://img.shields.io/github/workflow/status/johnbillion/extended-cpts/Test/develop?style=flat-square)](https://github.com/johnbillion/extended-cpts/actions)
[![Stable Release](https://img.shields.io/packagist/v/johnbillion/extended-cpts.svg)](https://packagist.org/packages/johnbillion/extended-cpts)
[![License](https://img.shields.io/badge/license-GPL_v2%2B-blue.svg)](https://github.com/johnbillion/extended-cpts/blob/master/LICENSE)
[![PHP 7](https://img.shields.io/badge/php-7-blue.svg)](https://wordpress.org/support/update-php/)
[![Documentation](https://img.shields.io/badge/documentation-wiki-blue.svg)](https://github.com/johnbillion/extended-cpts/wiki)
# Extended CPTs #
Extended CPTs is a library which provides extended functionality to WordPress custom post types and taxonomies. This allows developers to quickly build post types and taxonomies without having to write the same code again and again.
[See the wiki for full documentation.](https://github.com/johnbillion/extended-cpts/wiki)
Not your first time here? See [Recent Changes for Developers](https://github.com/johnbillion/extended-cpts/wiki/Recent-Changes-for-Developers) to see what features are new in recent versions of Extended CPTs.
## Improved Defaults for Post Types ##
* Automatically generated labels and post updated messages (in English)
* Public post type with admin UI and post thumbnails enabled
* Hierarchical with `page` capability type
* Optimal admin menu placement
## Improved Defaults for Taxonomies ##
* Automatically generated labels and term updated messages (in English)
* Hierarchical public taxonomy with admin UI enabled
## Extended Admin Features ##
* Declarative creation of table columns on the post type listing screen:
* Columns for post meta, taxonomy terms, featured images, post fields, [Posts 2 Posts](https://wordpress.org/plugins/posts-to-posts/) connections, and custom functions
* Sortable columns for post meta, taxonomy terms, and post fields
* User capability restrictions
* Default sort column and sort order
* Declarative creation of table columns on the taxonomy term listing screen:
* Columns for term meta and custom functions
* User capability restrictions
* Filter controls on the post type listing screen to enable filtering posts by post meta, taxonomy terms, post author, and post dates
* Override the 'Featured Image' and 'Enter title here' text
* Several custom meta boxes available for taxonomies on the post editing screen:
* Simplified list of checkboxes
* Radio buttons
* Dropdown menu
* Custom function
* Post types and taxonomies automatically added to the 'At a Glance' section on the dashboard
* Post types optionally added to the 'Recently Published' section on the dashboard
## Extended Front-end Features for Post Types ##
* Specify a custom permalink structure:
* For example `reviews/%year%/%month%/%review%`
* Supports all relevant rewrite tags including dates and custom taxonomies
* Automatic integration with the [Rewrite Rule Testing](https://wordpress.org/plugins/rewrite-testing/) plugin
* Specify public query vars which enable filtering by post meta and post dates
* Specify public query vars which enable sorting by post meta, taxonomy terms, and post fields
* Override default public or private query vars such as `posts_per_page`, `orderby`, `order`, and `nopaging`
* Add the post type to the site's main RSS feed
## Minimum Requirements ##
**PHP:** 7.0
**WordPress:** 4.8
## Installation ##
Extended CPTs is a developer library, not a plugin, which means you need to include it somewhere in your own project.
You can use Composer:
```bash
composer require johnbillion/extended-cpts
```
Or you can download the library and include it manually:
```php
require_once 'extended-cpts/extended-cpts.php';
```
Note that *Extended Taxonomies* is part of this library since version 4.0, so there's no need to include the separate *Extended Taxonomies* library.
## Usage ##
Need a simple post type with no frills? You can register a post type with a single parameter:
```php
add_action( 'init', function() {
register_extended_post_type( 'article' );
} );
```
And you can register a taxonomy with just two parameters:
```php
add_action( 'init', function() {
register_extended_taxonomy( 'location', 'article' );
} );
```
Try it. You'll have a hierarchical public post type with an admin UI, a hierarchical public taxonomy with an admin UI, and all the labels and updated messages for them will be automatically generated.
Or for a bit more functionality:
```php
add_action( 'init', function() {
register_extended_post_type( 'story', [
# Add the post type to the site's main RSS feed:
'show_in_feed' => true,
# Show all posts on the post type archive:
'archive' => [
'nopaging' => true,
],
# Add the post type to the 'Recently Published' section of the dashboard:
'dashboard_activity' => true,
# Add some custom columns to the admin screen:
'admin_cols' => [
'story_featured_image' => [
'title' => 'Illustration',
'featured_image' => 'thumbnail'
],
'story_published' => [
'title_icon' => 'dashicons-calendar-alt',
'meta_key' => 'published_date',
'date_format' => 'd/m/Y'
],
'story_genre' => [
'taxonomy' => 'genre'
],
],
# Add some dropdown filters to the admin screen:
'admin_filters' => [
'story_genre' => [
'taxonomy' => 'genre'
],
'story_rating' => [
'meta_key' => 'star_rating',
],
],
], [
# Override the base names used for labels:
'singular' => 'Story',
'plural' => 'Stories',
'slug' => 'stories',
] );
register_extended_taxonomy( 'genre', 'story', [
# Use radio buttons in the meta box for this taxonomy on the post editing screen:
'meta_box' => 'radio',
# Add a custom column to the admin screen:
'admin_cols' => [
'updated' => [
'title_cb' => function() {
return '<em>Last</em> Updated';
},
'meta_key' => 'updated_date',
'date_format' => 'd/m/Y'
],
],
] );
} );
```
Bam, we now have:
* A 'Stories' post type, with correctly generated labels and post updated messages, three custom columns in the admin area (two of which are sortable), stories added to the main RSS feed, and all stories displayed on the post type archive.
* A 'Genre' taxonomy attached to the 'Stories' post type, with correctly generated labels and term updated messages, and a custom column in the admin area.
The `register_extended_post_type()` and `register_extended_taxonomy()` functions are ultimately wrappers for the `register_post_type()` and `register_taxonomy()` functions in WordPress core, so any of the parameters from those functions can be used.
There's quite a bit more you can do. [See the wiki for full documentation.](https://github.com/johnbillion/extended-cpts/wiki)
## Contributing and Testing ##
Please see [CONTRIBUTING.md](CONTRIBUTING.md) for information on contributing.
## License: GPLv2 or later ##
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.

+ 64
- 0
vendor/johnbillion/extended-cpts/composer.json View File

@ -0,0 +1,64 @@
{
"name": "johnbillion/extended-cpts",
"description": "A library which provides extended functionality to WordPress custom post types and taxonomies.",
"homepage": "https://github.com/johnbillion/extended-cpts/",
"license": "GPL-2.0+",
"authors": [
{
"name": "John Blackbourn",
"homepage": "https://johnblackbourn.com/"
}
],
"config": {
"sort-packages": true,
"preferred-install": "dist"
},
"extra": {
"wordpress-install-dir": "tests/wordpress"
},
"require": {
"php": "^7.0"
},
"require-dev": {
"automattic/phpcs-neutron-standard": "^1.5",
"dealerdirect/phpcodesniffer-composer-installer": "^0.5",
"johnbillion/falsey-assertequals-detector": "^2",
"johnbillion/php-docs-standards": "^1",
"phpcompatibility/phpcompatibility-wp": "^2",
"phpunit/phpunit": "^6",
"roots/wordpress": "*",
"vlucas/phpdotenv": "^3",
"wp-cli/wp-cli-bundle": "^2.1",
"wp-coding-standards/wpcs": "~2.1.0",
"wp-phpunit/wp-phpunit": "*"
},
"scripts": {
"post-update-cmd": [
"@php -r \"! file_exists( 'tests/.env' ) && copy( 'tests/.env.dist', 'tests/.env' );\""
],
"test:cs": [
"vendor/bin/phpcs -nps --colors --report-code --report-summary --report-width=80 --cache=tests/cache/phpcs ."
],
"test:ut": [
"vendor/bin/wp db reset --yes --path=tests/wordpress #",
"export WP_MULTISITE=0 && vendor/bin/phpunit --verbose --colors=always --exclude-group=ms-required",
"export WP_MULTISITE=1 && vendor/bin/phpunit --verbose --colors=always --exclude-group=ms-excluded"
],
"test": [
"@test:cs",
"@test:ut"
]
},
"autoload": {
"psr-4": {
"ExtCPTs\\Tests\\": "tests/phpunit"
},
"files": [
"extended-cpts.php"
]
},
"suggest": {
"seravo/wp-custom-bulk-actions": "Custom Bulk Actions",
"wpackagist-plugin/rewrite-testing": "Rewrite Rule Testing"
}
}

+ 29
- 0
vendor/johnbillion/extended-cpts/extended-cpts.php View File

@ -0,0 +1,29 @@
<?php
declare( strict_types=1 );
/**
* Extended custom post types for WordPress.
*
* @package ExtendedCPTs
* @author John Blackbourn <https://johnblackbourn.com>
* @link https://github.com/johnbillion/extended-cpts
* @copyright 2012-2020 John Blackbourn
* @license GPL v2 or later
* @version 4.3.3
*
* 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.
*/
require_once __DIR__ . '/functions.php';
require_once __DIR__ . '/src/class-extended-cpt.php';
require_once __DIR__ . '/src/class-extended-cpt-admin.php';
require_once __DIR__ . '/src/class-extended-taxonomy.php';
require_once __DIR__ . '/src/class-extended-taxonomy-admin.php';

+ 128
- 0
vendor/johnbillion/extended-cpts/functions.php View File

@ -0,0 +1,128 @@
<?php
declare( strict_types=1 );
/**
* Registers a custom post type.
*
* The `$args` parameter accepts all the standard arguments for `register_post_type()` in addition to several custom
* arguments that provide extended functionality. Some of the default arguments differ from the defaults in
* `register_post_type()`.
*
* @link https://github.com/johnbillion/extended-cpts/wiki/Registering-Post-Types
* @see register_post_type() for default arguments.
*
* @param string $post_type The post type name.
* @param array $args {
* Optional. The post type arguments.
*
* @type array $admin_cols Associative array of admin screen columns to show for this post type.
* @type array $admin_filters Associative array of admin screen filters to show for this post type.
* @type array $archive Associative array of query vars to override on this post type's archive.
* @type bool $dashboard_glance Whether to show this post type on the 'At a Glance' section of the admin
* dashboard. Default true.
* @type bool $dashboard_activity Whether to show this post type on the 'Recently Published' section of the
* admin dashboard. Default false.
* @type string $enter_title_here Placeholder text which appears in the title field for this post type.
* @type string $featured_image Text which replaces the 'Featured Image' phrase for this post type.
* @type bool $quick_edit Whether to show Quick Edit links for this post type. Default true.
* @type bool $show_in_feed Whether to include this post type in the site's main feed. Default false.
* @type array $site_filters Associative array of query vars and their parameters for front end filtering.
* @type array $site_sortables Associative array of query vars and their parameters for front end sorting.
* }
* @param string[] $names {
* Optional. The plural, singular, and slug names.
*
* @type string $plural The plural form of the post type name.
* @type string $singular The singular form of the post type name.
* @type string $slug The slug used in the permalinks for this post type.
* }
* @return Extended_CPT
*/
function register_extended_post_type( string $post_type, array $args = [], array $names = [] ) : Extended_CPT {
if ( ! did_action( 'init' ) ) {
trigger_error( esc_html__( 'Post types must be registered on the "init" hook.', 'extended-cpts' ), E_USER_WARNING );
}
$cpt = new Extended_CPT( $post_type, $args, $names );
if ( is_admin() ) {
new Extended_CPT_Admin( $cpt, $cpt->args );
}
return $cpt;
}
/**
* Registers a custom taxonomy.
*
* The `$args` parameter accepts all the standard arguments for `register_taxonomy()` in addition to several custom
* arguments that provide extended functionality. Some of the default arguments differ from the defaults in
* `register_taxonomy()`.
*
* The `$taxonomy` parameter is used as the taxonomy name and to build the taxonomy labels. This means you can create
* a taxonomy with just two parameters and all labels and term updated messages will be generated for you. Example:
*
* register_extended_taxonomy( 'location', 'post' );
*
* The singular name, plural name, and slug are generated from the taxonomy name. These can be overridden with the
* `$names` parameter if necessary. Example:
*
* register_extended_taxonomy( 'story', 'post', [], [
* 'plural' => 'Stories',
* 'slug' => 'tales',
* ] );
*
* @link https://github.com/johnbillion/extended-cpts/wiki/Registering-taxonomies
* @see register_taxonomy() for default arguments.
*
* @param string $taxonomy The taxonomy name.
* @param string|string[] $object_type Name(s) of the object type(s) for the taxonomy.
* @param array $args {
* Optional. The taxonomy arguments.
*
* @type string $meta_box The name of the custom meta box to use on the post editing screen for this
* taxonomy. Three custom meta boxes are provided: 'radio' for a meta box with radio
* inputs, 'simple' for a meta box with a simplified list of checkboxes, and
* 'dropdown' for a meta box with a dropdown menu. You can also pass the name of a
* callback function, eg my_super_meta_box(), or boolean false to remove the meta
* box. Default null, meaning the standard meta box is used.
* @type bool $checked_ontop Whether to always show checked terms at the top of the meta box. This allows you
* to override WordPress' default behaviour if necessary. Default false if you're
* using a custom meta box (see the $meta_box argument), default true otherwise.
* @type bool $dashboard_glance Whether to show this taxonomy on the 'At a Glance' section of the admin dashboard.
* Default false.
* @type array $admin_cols Associative array of admin screen columns to show for this taxonomy. See the
* `Extended_Taxonomy_Admin::cols()` method for more information.
* @type bool $exclusive This parameter isn't feature complete. All it does currently is set the meta box
* to the 'radio' meta box, thus meaning any given post can only have one term
* associated with it for that taxonomy. 'exclusive' isn't really the right name for
* this, as terms aren't exclusive to a post, but rather each post can exclusively
* have only one term. It's not feature complete because you can edit a post in
* Quick Edit and give it more than one term from the taxonomy.
* @type bool $allow_hierarchy All this does currently is disable hierarchy in the taxonomy's rewrite rules.
* Default false.
* }
* @param string[] $names {
* Optional. The plural, singular, and slug names.
*
* @type string $plural The plural form of the taxonomy name.
* @type string $singular The singular form of the taxonomy name.
* @type string $slug The slug used in the term permalinks for this taxonomy.
* }
* @return Extended_Taxonomy
*/
function register_extended_taxonomy( string $taxonomy, $object_type, array $args = [], array $names = [] ) : Extended_Taxonomy {
if ( ! did_action( 'init' ) ) {
trigger_error( esc_html__( 'Taxonomies must be registered on the "init" hook.', 'extended-cpts' ), E_USER_WARNING );
}
$taxo = new Extended_Taxonomy( $taxonomy, $object_type, $args, $names );
if ( is_admin() ) {
new Extended_Taxonomy_Admin( $taxo, $taxo->args );
}
return $taxo;
}

+ 1341
- 0
vendor/johnbillion/extended-cpts/src/class-extended-cpt-admin.php
File diff suppressed because it is too large
View File


+ 63
- 0
vendor/johnbillion/extended-cpts/src/class-extended-cpt-rewrite-testing.php View File

@ -0,0 +1,63 @@
<?php
declare( strict_types=1 );
/**
* @codeCoverageIgnore
*/
class Extended_CPT_Rewrite_Testing extends Extended_Rewrite_Testing {
/**
* @var Extended_CPT
*/
public $cpt;
public function __construct( Extended_CPT $cpt ) {
$this->cpt = $cpt;
}
public function get_tests() : array {
global $wp_rewrite;
/** @var \WP_Rewrite $wp_rewrite */
if ( ! $wp_rewrite->using_permalinks() ) {
return [];
}
if ( ! isset( $wp_rewrite->extra_permastructs[ $this->cpt->post_type ] ) ) {
return [];
}
$struct = $wp_rewrite->extra_permastructs[ $this->cpt->post_type ];
$pto = get_post_type_object( $this->cpt->post_type );
$name = sprintf( '%s (%s)', $pto->labels->name, $this->cpt->post_type );
$additional = [];
// Post type archive rewrites are generated separately. See the `has_archive` handling in `register_post_type()`.
if ( $pto->has_archive ) {
$archive_slug = ( true === $pto->has_archive ) ? $pto->rewrite['slug'] : $pto->has_archive;
if ( $pto->rewrite['with_front'] ) {
$archive_slug = substr( $wp_rewrite->front, 1 ) . $archive_slug;
} else {
$archive_slug = $wp_rewrite->root . $archive_slug;
}
$additional[ "{$archive_slug}/?$" ] = "index.php?post_type={$this->cpt->post_type}";
if ( $pto->rewrite['feeds'] && $wp_rewrite->feeds ) {
$feeds = '(' . trim( implode( '|', $wp_rewrite->feeds ) ) . ')';
$additional[ "{$archive_slug}/feed/{$feeds}/?$" ] = "index.php?post_type={$this->cpt->post_type}" . '&feed=$matches[1]';
$additional[ "{$archive_slug}/{$feeds}/?$" ] = "index.php?post_type={$this->cpt->post_type}" . '&feed=$matches[1]';
}
if ( $pto->rewrite['pages'] ) {
$additional[ "{$archive_slug}/{$wp_rewrite->pagination_base}/([0-9]{1,})/?$" ] = "index.php?post_type={$this->cpt->post_type}" . '&paged=$matches[1]';
}
}
return [
$name => $this->get_rewrites( $struct, $additional ),
];
}
}

+ 782
- 0
vendor/johnbillion/extended-cpts/src/class-extended-cpt.php View File

@ -0,0 +1,782 @@
<?php
declare( strict_types=1 );
class Extended_CPT {
/**
* Default arguments for custom post types.
*
* The arguments listed are the ones which differ from the defaults in `register_post_type()`.
*
* @var array
*/
protected $defaults = [
'public' => true,
'menu_position' => 6,
'capability_type' => 'page',
'hierarchical' => true,
'supports' => [
'title',
'editor',
'thumbnail',
],
'site_filters' => null, # Custom arg
'site_sortables' => null, # Custom arg
'show_in_feed' => false, # Custom arg
'archive' => null, # Custom arg
'featured_image' => null, # Custom arg
];
/**
* @var string
*/
public $post_type;
/**
* @var string
*/
public $post_slug;
/**
* @var string
*/
public $post_singular;
/**
* @var string
*/
public $post_plural;
/**
* @var string
*/
public $post_singular_low;
/**
* @var string
*/
public $post_plural_low;
/**
* @var array
*/
public $args;
/**
* Class constructor.
*
* @see register_extended_post_type()
*
* @param string $post_type The post type name.
* @param array $args Optional. The post type arguments.
* @param string[] $names Optional. The plural, singular, and slug names.
*/
public function __construct( string $post_type, array $args = [], array $names = [] ) {
/**
* Filter the arguments for this post type.
*
* @since 2.4.0
*
* @param array $args The post type arguments.
*/
$args = apply_filters( "ext-cpts/{$post_type}/args", $args );
/**
* Filter the names for this post type.
*
* @since 2.4.0
*
* @param string[] $names The plural, singular, and slug names (if any were specified).
*/
$names = apply_filters( "ext-cpts/{$post_type}/names", $names );
if ( isset( $names['singular'] ) ) {
$this->post_singular = $names['singular'];
} else {
$this->post_singular = ucwords( str_replace( [
'-',
'_',
], ' ', $post_type ) );
}
if ( isset( $names['slug'] ) ) {
$this->post_slug = $names['slug'];
} elseif ( isset( $names['plural'] ) ) {
$this->post_slug = $names['plural'];
} else {
$this->post_slug = $post_type . 's';
}
if ( isset( $names['plural'] ) ) {
$this->post_plural = $names['plural'];
} else {
$this->post_plural = $this->post_singular . 's';
}
$this->post_type = strtolower( $post_type );
$this->post_slug = strtolower( $this->post_slug );
# Build our base post type names:
# Lower-casing is not forced if the name looks like an initialism, eg. FAQ.
if ( ! preg_match( '/[A-Z]{2,}/', $this->post_singular ) ) {
$this->post_singular_low = strtolower( $this->post_singular );
} else {
$this->post_singular_low = $this->post_singular;
}
if ( ! preg_match( '/[A-Z]{2,}/', $this->post_plural ) ) {
$this->post_plural_low = strtolower( $this->post_plural );
} else {
$this->post_plural_low = $this->post_plural;
}
# Build our labels:
# Why aren't these translatable?
# Answer: https://github.com/johnbillion/extended-cpts/pull/5#issuecomment-33756474
$this->defaults['labels'] = [
'name' => $this->post_plural,
'singular_name' => $this->post_singular,
'menu_name' => $this->post_plural,
'name_admin_bar' => $this->post_singular,
'add_new' => 'Add New',
'add_new_item' => sprintf( 'Add New %s', $this->post_singular ),
'edit_item' => sprintf( 'Edit %s', $this->post_singular ),
'new_item' => sprintf( 'New %s', $this->post_singular ),
'view_item' => sprintf( 'View %s', $this->post_singular ),
'view_items' => sprintf( 'View %s', $this->post_plural ),
'search_items' => sprintf( 'Search %s', $this->post_plural ),
'not_found' => sprintf( 'No %s found.', $this->post_plural_low ),
'not_found_in_trash' => sprintf( 'No %s found in trash.', $this->post_plural_low ),
'parent_item_colon' => sprintf( 'Parent %s:', $this->post_singular ),
'all_items' => sprintf( 'All %s', $this->post_plural ),
'archives' => sprintf( '%s Archives', $this->post_singular ),
'attributes' => sprintf( '%s Attributes', $this->post_singular ),
'insert_into_item' => sprintf( 'Insert into %s', $this->post_singular_low ),
'uploaded_to_this_item' => sprintf( 'Uploaded to this %s', $this->post_singular_low ),
'filter_items_list' => sprintf( 'Filter %s list', $this->post_plural_low ),
'items_list_navigation' => sprintf( '%s list navigation', $this->post_plural ),
'items_list' => sprintf( '%s list', $this->post_plural ),
'item_published' => sprintf( '%s published.', $this->post_singular ),
'item_published_privately' => sprintf( '%s published privately.', $this->post_singular ),
'item_reverted_to_draft' => sprintf( '%s reverted to draft.', $this->post_singular ),
'item_scheduled' => sprintf( '%s scheduled.', $this->post_singular ),
'item_updated' => sprintf( '%s updated.', $this->post_singular ),
];
# Build the featured image labels:
if ( isset( $args['featured_image'] ) ) {
$featured_image_low = strtolower( $args['featured_image'] );
$this->defaults['labels']['featured_image'] = $args['featured_image'];
$this->defaults['labels']['set_featured_image'] = sprintf( 'Set %s', $featured_image_low );
$this->defaults['labels']['remove_featured_image'] = sprintf( 'Remove %s', $featured_image_low );
$this->defaults['labels']['use_featured_image'] = sprintf( 'Use as %s', $featured_image_low );
}
# Only set default rewrites if we need them
if ( isset( $args['public'] ) && ! $args['public'] ) {
$this->defaults['rewrite'] = false;
} else {
$this->defaults['rewrite'] = [
'slug' => $this->post_slug,
'with_front' => false,
];
}
# Merge our args with the defaults:
$this->args = array_merge( $this->defaults, $args );
# This allows the 'labels' and 'rewrite' args to contain all, some, or no values:
foreach ( [ 'labels', 'rewrite' ] as $arg ) {
if ( isset( $args[ $arg ] ) && is_array( $args[ $arg ] ) ) {
$this->args[ $arg ] = array_merge( $this->defaults[ $arg ], $args[ $arg ] );
}
}
# Enable post type archives by default
if ( ! isset( $this->args['has_archive'] ) ) {
$this->args['has_archive'] = $this->args['public'];
}
# Front-end sortables:
if ( $this->args['site_sortables'] && ! is_admin() ) {
add_filter( 'pre_get_posts', [ $this, 'maybe_sort_by_fields' ] );
add_filter( 'posts_clauses', [ $this, 'maybe_sort_by_taxonomy' ], 10, 2 );
}
# Front-end filters:
if ( $this->args['site_filters'] && ! is_admin() ) {
add_action( 'pre_get_posts', [ $this, 'maybe_filter' ] );
add_filter( 'query_vars', [ $this, 'add_query_vars' ] );
}
# Post type in the site's main feed:
if ( $this->args['show_in_feed'] ) {
add_filter( 'request', [ $this, 'add_to_feed' ] );
}
# Post type archive query vars:
if ( $this->args['archive'] && ! is_admin() ) {
add_filter( 'parse_request', [ $this, 'override_private_query_vars' ], 1 );
}
# Custom post type permastruct:
if ( $this->args['rewrite'] && ! empty( $this->args['rewrite']['permastruct'] ) ) {
add_action( 'registered_post_type', [ $this, 'registered_post_type' ], 1, 2 );
add_filter( 'post_type_link', [ $this, 'post_type_link' ], 1, 4 );
}
# Rewrite testing:
if ( $this->args['rewrite'] ) {
add_filter( 'rewrite_testing_tests', [ $this, 'rewrite_testing_tests' ], 1 );
}
# Register post type:
$this->register_post_type();
/**
* Fired when the extended post type instance is set up.
*
* @since 3.1.0
*
* @param Extended_CPT $instance The extended post type instance.
*/
do_action( "ext-cpts/{$post_type}/instance", $this );
}
/**
* Set the relevant query vars for filtering posts by our front-end filters.
*
* @param WP_Query $wp_query The current WP_Query object.
*/
public function maybe_filter( WP_Query $wp_query ) {
if ( empty( $wp_query->query['post_type'] ) || ! in_array( $this->post_type, (array) $wp_query->query['post_type'], true ) ) {
return;
}
$vars = self::get_filter_vars( $wp_query->query, $this->args['site_filters'], $this->post_type );
if ( empty( $vars ) ) {
return;
}
foreach ( $vars as $key => $value ) {
if ( is_array( $value ) ) {
$query = $wp_query->get( $key );
if ( empty( $query ) ) {
$query = [];
}
$value = array_merge( $query, $value );
}
$wp_query->set( $key, $value );
}
}
/**
* Set the relevant query vars for sorting posts by our front-end sortables.
*
* @param WP_Query $wp_query The current WP_Query object.
*/
public function maybe_sort_by_fields( WP_Query $wp_query ) {
if ( empty( $wp_query->query['post_type'] ) || ! in_array( $this->post_type, (array) $wp_query->query['post_type'], true ) ) {
return;
}
// If we've not specified an order:
if ( empty( $wp_query->query['orderby'] ) ) {
// Loop over our sortables to find the default sort field (if there is one):
foreach ( $this->args['site_sortables'] as $id => $col ) {
if ( is_array( $col ) && isset( $col['default'] ) ) {
// @TODO Don't set 'order' if 'orderby' is an array (WP 4.0+)
$wp_query->query['orderby'] = $id;
$wp_query->query['order'] = ( 'desc' === strtolower( $col['default'] ) ? 'desc' : 'asc' );
break;
}
}
}
$sort = self::get_sort_field_vars( $wp_query->query, $this->args['site_sortables'] );
if ( empty( $sort ) ) {
return;
}
foreach ( $sort as $key => $value ) {
$wp_query->set( $key, $value );
}
}
/**
* Filter the query's SQL clauses so we can sort posts by taxonomy terms.
*
* @param string[] $clauses Array of the current query's SQL clauses.
* @param WP_Query $wp_query The current `WP_Query` object.
* @return string[] Array of SQL clauses.
*/
public function maybe_sort_by_taxonomy( array $clauses, WP_Query $wp_query ) : array {
if ( empty( $wp_query->query['post_type'] ) || ! in_array( $this->post_type, (array) $wp_query->query['post_type'], true ) ) {
return $clauses;
}
$sort = self::get_sort_taxonomy_clauses( $clauses, $wp_query->query, $this->args['site_sortables'] );
if ( empty( $sort ) ) {
return $clauses;
}
return array_merge( $clauses, $sort );
}
/**
* Get the array of private query vars for the given filters, to apply to the current query in order to filter it by the
* given public query vars.
*
* @param array $query The public query vars, usually from `$wp_query->query`.
* @param array $filters The filters valid for this query (usually the value of the `admin_filters` or
* `site_filters` argument when registering an extended post type).
* @param string $post_type The post type name.
* @return array The list of private query vars to apply to the query.
*/
public static function get_filter_vars( array $query, array $filters, string $post_type ) : array {
$return = [];
foreach ( $filters as $filter_key => $filter ) {
$meta_query = [];
$date_query = [];
if ( ! isset( $query[ $filter_key ] ) || ( '' === $query[ $filter_key ] ) ) {
continue;
}
if ( isset( $filter['cap'] ) && ! current_user_can( $filter['cap'] ) ) {
continue;
}
$hook = "ext-cpts/{$post_type}/filter-query/{$filter_key}";
if ( has_filter( $hook ) ) {
/**
* Allows a filter's private query vars to be overridden.
*
* @since 4.3.0
*
* @param array $return The private query vars.
* @param array $query The public query vars.
* @param array $filter The filter arguments.
*/
$return = apply_filters( $hook, $return, $query, $filter );
continue;
}
if ( isset( $filter['meta_key'] ) ) {
$meta_query = [
'key' => $filter['meta_key'],
'value' => wp_unslash( $query[ $filter_key ] ),
];
} elseif ( isset( $filter['meta_search_key'] ) ) {
$meta_query = [
'key' => $filter['meta_search_key'],
'value' => wp_unslash( $query[ $filter_key ] ),
'compare' => 'LIKE',
];
} elseif ( isset( $filter['meta_key_exists'] ) ) {
$meta_query = [
'key' => wp_unslash( $query[ $filter_key ] ),
'compare' => 'EXISTS',
];
} elseif ( isset( $filter['meta_exists'] ) ) {
$meta_query = [
'key' => wp_unslash( $query[ $filter_key ] ),
'compare' => 'NOT IN',
'value' => [ '', '0', 'false', 'null' ],
];
} elseif ( isset( $filter['post_date'] ) ) {
$date_query = [
$filter['post_date'] => wp_unslash( $query[ $filter_key ] ),
'inclusive' => true,
];
} else {
continue;
}
if ( isset( $filter['meta_query'] ) ) {
$meta_query = array_merge( $meta_query, $filter['meta_query'] );
}
if ( isset( $filter['date_query'] ) ) {
$date_query = array_merge( $date_query, $filter['date_query'] );
}
if ( ! empty( $meta_query ) ) {
$return['meta_query'][] = $meta_query;
}
if ( ! empty( $date_query ) ) {
$return['date_query'][] = $date_query;
}
}
return $return;
}
/**
* Get the array of private and public query vars for the given sortables, to apply to the current query in order to
* sort it by the requested orderby field.
*
* @param array $vars The public query vars, usually from `$wp_query->query`.
* @param array $sortables The sortables valid for this query (usually the value of the `admin_cols` or
* `site_sortables` argument when registering an extended post type.
* @return array The list of private and public query vars to apply to the query.
*/
public static function get_sort_field_vars( array $vars, array $sortables ) : array {
if ( ! isset( $vars['orderby'] ) ) {
return [];
}
if ( ! is_string( $vars['orderby'] ) ) {
return [];
}
if ( ! isset( $sortables[ $vars['orderby'] ] ) ) {
return [];
}
$orderby = $sortables[ $vars['orderby'] ];
if ( ! is_array( $orderby ) ) {
return [];
}
if ( isset( $orderby['sortable'] ) && ! $orderby['sortable'] ) {
return [];
}
$return = [];
if ( isset( $orderby['meta_key'] ) ) {
$return['meta_key'] = $orderby['meta_key'];
$return['orderby'] = 'meta_value';
// @TODO meta_value_num
} elseif ( isset( $orderby['post_field'] ) ) {
$field = str_replace( 'post_', '', $orderby['post_field'] );
$return['orderby'] = $field;
}
if ( isset( $vars['order'] ) ) {
$return['order'] = $vars['order'];
}
return $return;
}
/**
* Get the array of SQL clauses for the given sortables, to apply to the current query in order to
* sort it by the requested orderby field.
*
* @param array $clauses The query's SQL clauses.
* @param array $vars The public query vars, usually from `$wp_query->query`.
* @param array $sortables The sortables valid for this query (usually the value of the `admin_cols` or
* `site_sortables` argument when registering an extended post type).
* @return array The list of SQL clauses to apply to the query.
*/
public static function get_sort_taxonomy_clauses( array $clauses, array $vars, array $sortables ) : array {
global $wpdb;
if ( ! isset( $vars['orderby'] ) ) {
return [];
}
if ( ! is_string( $vars['orderby'] ) ) {
return [];
}
if ( ! isset( $sortables[ $vars['orderby'] ] ) ) {
return [];
}
$orderby = $sortables[ $vars['orderby'] ];
if ( ! is_array( $orderby ) ) {
return [];
}
if ( isset( $orderby['sortable'] ) && ! $orderby['sortable'] ) {
return [];
}
if ( ! isset( $orderby['taxonomy'] ) ) {
return [];
}
# Taxonomy term ordering courtesy of http://scribu.net/wordpress/sortable-taxonomy-columns.html
$clauses['join'] .= "
LEFT OUTER JOIN {$wpdb->term_relationships} as ext_cpts_tr
ON ( {$wpdb->posts}.ID = ext_cpts_tr.object_id )
LEFT OUTER JOIN {$wpdb->term_taxonomy} as ext_cpts_tt
ON ( ext_cpts_tr.term_taxonomy_id = ext_cpts_tt.term_taxonomy_id )
LEFT OUTER JOIN {$wpdb->terms} as ext_cpts_t
ON ( ext_cpts_tt.term_id = ext_cpts_t.term_id )
";
$clauses['where'] .= $wpdb->prepare( ' AND ( taxonomy = %s OR taxonomy IS NULL )', $orderby['taxonomy'] );
$clauses['groupby'] = 'ext_cpts_tr.object_id';
$clauses['orderby'] = 'GROUP_CONCAT( ext_cpts_t.name ORDER BY name ASC ) ';
$clauses['orderby'] .= ( isset( $vars['order'] ) && ( 'ASC' === strtoupper( $vars['order'] ) ) ) ? 'ASC' : 'DESC';
return $clauses;
}
/**
* Add our filter names to the public query vars.
*
* @param string[] $vars Public query variables.
* @return string[] Updated public query variables.
*/
public function add_query_vars( array $vars ) : array {
$filters = array_keys( $this->args['site_filters'] );
return array_merge( $vars, $filters );
}
/**
* Add our post type to the feed.
*
* @param array $vars Request parameters.
* @return array Updated request parameters.
*/
public function add_to_feed( array $vars ) : array {
# If it's not a feed, we're not interested:
if ( ! isset( $vars['feed'] ) ) {
return $vars;
}
if ( ! isset( $vars['post_type'] ) ) {
$vars['post_type'] = [
'post',
$this->post_type,
];
} elseif ( is_array( $vars['post_type'] ) && ( count( $vars['post_type'] ) > 1 ) ) {
$vars['post_type'][] = $this->post_type;
}
return $vars;
}
/**
* Add to or override our post type archive's private query vars.
*
* @param WP $wp The WP request object.
* @return WP Updated WP request object.
*/
public function override_private_query_vars( WP $wp ) : WP {
# If it's not our post type, bail out:
if ( ! isset( $wp->query_vars['post_type'] ) || ( $this->post_type !== $wp->query_vars['post_type'] ) ) {
return $wp;
}
# If it's a single post, bail out:
if ( isset( $wp->query_vars['name'] ) ) {
return $wp;
}
# Set the vars:
foreach ( $this->args['archive'] as $var => $value ) {
$wp->query_vars[ $var ] = $value;
}
return $wp;
}
/**
* Action fired after a CPT is registered in order to set up the custom permalink structure for the post type.
*
* @param string $post_type Post type name.
* @param WP_Post_Type $post_type_object Post type object.
*/
public function registered_post_type( string $post_type, WP_Post_Type $post_type_object ) {
if ( $post_type !== $this->post_type ) {
return;
}
$struct = str_replace( "%{$this->post_type}_slug%", $this->post_slug, $post_type_object->rewrite['permastruct'] );
$struct = str_replace( '%postname%', "%{$this->post_type}%", $struct );
add_permastruct( $this->post_type, $struct, $post_type_object->rewrite );
}
/**
* Filter the post type permalink in order to populate its rewrite tags.
*
* @param string $post_link The post's permalink.
* @param WP_Post $post The post in question.
* @param bool $leavename Whether to keep the post name.
* @param bool $sample Is it a sample permalink.
* @return string The post's permalink.
*/
public function post_type_link( string $post_link, WP_Post $post, bool $leavename, bool $sample ) : string {
# If it's not our post type, bail out:
if ( $this->post_type !== $post->post_type ) {
return $post_link;
}
$date = explode( ' ', mysql2date( 'Y m d H i s', $post->post_date ) );
$replacements = [
'%year%' => $date[0],
'%monthnum%' => $date[1],
'%day%' => $date[2],
'%hour%' => $date[3],
'%minute%' => $date[4],
'%second%' => $date[5],
'%post_id%' => $post->ID,
];
if ( false !== strpos( $post_link, '%author%' ) ) {
$replacements['%author%'] = get_userdata( (int) $post->post_author )->user_nicename;
}
foreach ( get_object_taxonomies( $post ) as $tax ) {
if ( false === strpos( $post_link, "%{$tax}%" ) ) {
continue;
}
$terms = get_the_terms( $post, $tax );
if ( $terms ) {
/**
* Filter the term that gets used in the `$tax` permalink token.
* @TODO make this more betterer ^
*
* @param WP_Term $term The `$tax` term to use in the permalink.
* @param WP_Term[] $terms Array of all `$tax` terms associated with the post.
* @param WP_Post $post The post in question.
*/
$term_object = apply_filters( "post_link_{$tax}", reset( $terms ), $terms, $post );
$term = get_term( $term_object, $tax )->slug;
} else {
$term = $post->post_type;
/**
* Filter the default term name that gets used in the `$tax` permalink token.
* @TODO make this more betterer ^
*
* @param string $term The `$tax` term name to use in the permalink.
* @param WP_Post $post The post in question.
*/
$default_term_name = apply_filters( "default_{$tax}", get_option( "default_{$tax}", '' ), $post );
if ( $default_term_name ) {
$default_term = get_term( $default_term_name, $tax );
if ( ! is_wp_error( $default_term ) ) {
$term = $default_term->slug;
}
}
}
$replacements[ "%{$tax}%" ] = $term;
}
$post_link = str_replace( array_keys( $replacements ), $replacements, $post_link );
return $post_link;
}
/**
* Add our rewrite tests to the Rewrite Rule Testing tests array.
*
* @codeCoverageIgnore
*
* @param array $tests The existing rewrite rule tests.
* @return array Updated rewrite rule tests.
*/
public function rewrite_testing_tests( array $tests ) : array {
require_once __DIR__ . '/class-extended-rewrite-testing.php';
require_once __DIR__ . '/class-extended-cpt-rewrite-testing.php';
$extended = new Extended_CPT_Rewrite_Testing( $this );
return array_merge( $tests, $extended->get_tests() );
}
/**
* Registers our post type.
*
* The only difference between this and regular `register_post_type()` calls is this will trigger an error of
* `E_USER_ERROR` level if a `WP_Error` is returned.
*
*/
public function register_post_type() {
if ( ! isset( $this->args['query_var'] ) || ( true === $this->args['query_var'] ) ) {
$query_var = $this->post_type;
} else {
$query_var = $this->args['query_var'];
}
$existing = get_post_type_object( $this->post_type );
$taxonomies = get_taxonomies( [
'query_var' => $query_var,
], 'objects' );
if ( $query_var && count( $taxonomies ) ) {
// https://core.trac.wordpress.org/ticket/35089
foreach ( $taxonomies as $tax ) {
if ( $tax->query_var === $query_var ) {
trigger_error( esc_html( sprintf(
/* translators: %s: Post type query variable name */
__( 'Post type query var "%s" clashes with a taxonomy query var of the same name', 'extended-cpts' ),
$query_var
) ), E_USER_ERROR );
}
}
}
if ( empty( $existing ) ) {
$cpt = register_post_type( $this->post_type, $this->args );
if ( is_wp_error( $cpt ) ) {
trigger_error( esc_html( $cpt->get_error_message() ), E_USER_ERROR );
}
} else {
# This allows us to call `register_extended_post_type()` on an existing post type to add custom functionality
# to the post type.
$this->extend( $existing );
}
}
/**
* Extends an existing post type object. Currently only handles labels.
*
* @param WP_Post_Type $pto A post type object.
*/
public function extend( WP_Post_Type $pto ) {
# Merge core with overridden labels
$this->args['labels'] = array_merge( (array) get_post_type_labels( $pto ), $this->args['labels'] );
$GLOBALS['wp_post_types'][ $pto->name ]->labels = (object) $this->args['labels'];
}
/**
* Helper function for registering a taxonomy and adding it to this post type.
*
* Accepts the same parameters as `register_extended_taxonomy()`, minus the `$object_type` parameter.
*
* Example usage:
*
* $events = register_extended_post_type( 'event' );
* $location = $events->add_taxonomy( 'location' );
*
* @param string $taxonomy The taxonomy name.
* @param array $args Optional. The taxonomy arguments.
* @param array $names Optional. An associative array of the plural, singular, and slug names.
* @return WP_Taxonomy Taxonomy object.
*/
public function add_taxonomy( string $taxonomy, array $args = [], array $names = [] ) : WP_Taxonomy {
if ( taxonomy_exists( $taxonomy ) ) {
register_taxonomy_for_object_type( $taxonomy, $this->post_type );
} else {
register_extended_taxonomy( $taxonomy, $this->post_type, $args, $names );
}
return get_taxonomy( $taxonomy );
}
}

+ 64
- 0
vendor/johnbillion/extended-cpts/src/class-extended-rewrite-testing.php View File

@ -0,0 +1,64 @@
<?php
declare( strict_types=1 );
/**
* @codeCoverageIgnore
*/
abstract class Extended_Rewrite_Testing {
abstract public function get_tests() : array;
public function get_rewrites( array $struct, array $additional ) : array {
global $wp_rewrite;
if ( ! $wp_rewrite->using_permalinks() ) {
return [];
}
$new = [];
$rules = $wp_rewrite->generate_rewrite_rules(
$struct['struct'],
$struct['ep_mask'],
$struct['paged'],
$struct['feed'],
$struct['forcomments'],
$struct['walk_dirs'],
$struct['endpoints']
);
$rules = array_merge( $rules, $additional );
$feedregex = implode( '|', $wp_rewrite->feeds );
$replace = [
'(.+?)' => 'hello',
'.+?' => 'hello',
'([^/]+)' => 'world',
'[^/]+' => 'world',
'(?:/([0-9]+))?' => '/456',
'([0-9]{4})' => date( 'Y' ),
'[0-9]{4}' => date( 'Y' ),
'([0-9]{1,2})' => date( 'm' ),
'[0-9]{1,2}' => date( 'm' ),
'([0-9]{1,})' => '123',
'[0-9]{1,}' => '789',
'([0-9]+)' => date( 'd' ),
'[0-9]+' => date( 'd' ),
"({$feedregex})" => end( $wp_rewrite->feeds ),
'/?' => '/',
'$' => '',
];
foreach ( $rules as $regex => $result ) {
$regex = str_replace( array_keys( $replace ), $replace, $regex );
// Change '$2' to '$matches[2]'
$result = preg_replace( '/\$([0-9]+)/', '\$matches[$1]', $result );
$new[ "/{$regex}" ] = $result;
if ( false !== strpos( $regex, $replace['(?:/([0-9]+))?'] ) ) {
// Add an extra rule for this optional block
$regex = str_replace( $replace['(?:/([0-9]+))?'], '', $regex );
$new[ "/{$regex}" ] = $result;
}
}
return $new;
}
}

+ 599
- 0
vendor/johnbillion/extended-cpts/src/class-extended-taxonomy-admin.php View File

@ -0,0 +1,599 @@
<?php
declare( strict_types=1 );
class Extended_Taxonomy_Admin {
/**
* Default arguments for custom taxonomies.
*
* @var array
*/
protected $defaults = [
'meta_box' => null, # Custom arg
'dashboard_glance' => false, # Custom arg
'checked_ontop' => null, # Custom arg
'admin_cols' => null, # Custom arg
'required' => false, # Custom arg
];
/**
* @var Extended_Taxonomy
*/
public $taxo;
/**
* @var array
*/
public $args;
/**
* @var array
*/
protected $_cols;
/**
* @var array
*/
protected $the_cols = null;
/**
* Class constructor.
*
* @param Extended_Taxonomy $taxo An extended taxonomy object.
* @param array $args Optional. The admin arguments.
*/
public function __construct( Extended_Taxonomy $taxo, array $args = [] ) {
$this->taxo = $taxo;
# Merge our args with the defaults:
$this->args = array_merge( $this->defaults, $args );
# Set checked on top to false unless we're using the default meta box:
if ( null === $this->args['checked_ontop'] ) {
$this->args['checked_ontop'] = empty( $this->args['meta_box'] );
}
# Meta boxes:
if ( $this->taxo->args['exclusive'] || isset( $this->args['meta_box'] ) ) {
add_action( 'add_meta_boxes', [ $this, 'meta_boxes' ], 10, 2 );
}
# 'At a Glance' dashboard panels:
if ( $this->args['dashboard_glance'] ) {
add_filter( 'dashboard_glance_items', [ $this, 'glance_items' ] );
}
# Term updated messages:
add_filter( 'term_updated_messages', [ $this, 'term_updated_messages' ], 1, 2 );
# Admin columns:
if ( $this->args['admin_cols'] ) {
add_filter( "manage_edit-{$this->taxo->taxonomy}_columns", [ $this, '_log_default_cols' ], 0 );
add_filter( "manage_edit-{$this->taxo->taxonomy}_columns", [ $this, 'cols' ] );
add_action( "manage_{$this->taxo->taxonomy}_custom_column", [ $this, 'col' ], 10, 3 );
}
}
/**
* Logs the default columns so we don't remove any custom columns added by other plugins.
*
* @param array $cols The default columns for this taxonomy screen
* @return array The default columns for this taxonomy screen
*/
public function _log_default_cols( array $cols ) {
$this->_cols = $cols;
return $this->_cols;
}
/**
* Add columns to the admin screen for this taxonomy.
*
* Each item in the `admin_cols` array is either a string name of an existing column, or an associative
* array of information for a custom column.
*
* Defining a custom column is easy. Just define an array which includes the column title, column
* type, and optional callback function. You can display columns for term meta or custom functions.
*
* The example below adds two columns; one which displays the value of the term's `term_updated` meta
* key, and one which calls a custom callback function:
*
* register_extended_taxonomy( 'foo', 'bar', array(
* 'admin_cols' => array(
* 'foo_updated' => array(
* 'title' => 'Updated',
* 'meta_key' => 'term_updated'
* ),
* 'foo_bar' => array(
* 'title' => 'Example',
* 'function' => 'my_custom_callback'
* )
* )
* ) );
*
* That's all you need to do. The columns will handle safely outputting the data
* (escaping text, and comma-separating taxonomy terms). No more messing about with all of those
* annoyingly named column filters and actions.
*
* Each item in the `admin_cols` array must contain one of the following elements which defines the column type:
*
* - meta_key - A term meta key
* - function - The name of a callback function
*
* The value for the corresponding term meta are safely escaped and output into the column.
*
* There are a few optional elements:
*
* - title - Generated from the field if not specified.
* - function - The name of a callback function for the column (eg. `my_function`) which gets called
* instead of the built-in function for handling that column. The function is passed the term ID as
* its first parameter.
* - date_format - This is used with the `meta_key` column type. The value of the meta field will be
* treated as a timestamp if this is present. Unix and MySQL format timestamps are supported in the
* meta value. Pass in boolean true to format the date according to the 'Date Format' setting, or pass
* in a valid date formatting string (eg. `d/m/Y H:i:s`).
* - cap - A capability required in order for this column to be displayed to the current user. Defaults
* to null, meaning the column is shown to all users.
*
* Note that sortable admin columns are not yet supported.
*
* @param array $cols Associative array of columns
* @return array Updated array of columns
*/
public function cols( array $cols ) : array {
// This function gets called multiple times, so let's cache it for efficiency:
if ( isset( $this->the_cols ) ) {
return $this->the_cols;
}
$new_cols = [];
$keep = [
'cb',
'name',
'description',
'slug',
];
# Add existing columns we want to keep:
foreach ( $cols as $id => $title ) {
if ( in_array( $id, $keep, true ) && ! isset( $this->args['admin_cols'][ $id ] ) ) {
$new_cols[ $id ] = $title;
}
}
# Add our custom columns:
foreach ( array_filter( $this->args['admin_cols'] ) as $id => $col ) {
if ( is_string( $col ) && isset( $cols[ $col ] ) ) {
# Existing (ie. built-in) column with id as the value
$new_cols[ $col ] = $cols[ $col ];
} elseif ( is_string( $col ) && isset( $cols[ $id ] ) ) {
# Existing (ie. built-in) column with id as the key and title as the value
$new_cols[ $id ] = esc_html( $col );
} elseif ( is_array( $col ) ) {
if ( isset( $col['cap'] ) && ! current_user_can( $col['cap'] ) ) {
continue;
}
if ( isset( $col['title_cb'] ) ) {
$new_cols[ $id ] = call_user_func( $col['title_cb'], $col );
} else {
$title = esc_html( $col['title'] ?? $this->get_item_title( $col ) ?? $id );
if ( isset( $col['title_icon'] ) ) {
$title = sprintf(
'<span class="dashicons %s" aria-hidden="true"></span><span class="screen-reader-text">%s</span>',
esc_attr( $col['title_icon'] ),
$title
);
}
$new_cols[ $id ] = $title;
}
}
}
# Re-add any custom columns:
$custom = array_diff_key( $cols, $this->_cols );
$new_cols = array_merge( $new_cols, $custom );
$this->the_cols = $new_cols;
return $this->the_cols;
}
/**
* Output the column data for our custom columns.
*
* @param string $string Blank string.
* @param string $col Name of the column.
* @param int $term_id Term ID.
*/
public function col( string $string, string $col, int $term_id ) {
# Shorthand:
$c = $this->args['admin_cols'];
# We're only interested in our custom columns:
$custom_cols = array_filter( array_keys( $c ) );
if ( ! in_array( $col, $custom_cols, true ) ) {
return;
}
if ( isset( $c[ $col ]['function'] ) ) {
call_user_func( $c[ $col ]['function'], $term_id );
} elseif ( isset( $c[ $col ]['meta_key'] ) ) {
$this->col_term_meta( $c[ $col ]['meta_key'], $c[ $col ], $term_id );
}
}
/**
* Output column data for a term meta field.
*
* @param string $meta_key The term meta key
* @param array $args Array of arguments for this field
* @param int $term_id Term ID.
*/
public function col_term_meta( string $meta_key, array $args, int $term_id ) {
$vals = get_term_meta( $term_id, $meta_key, false );
$echo = [];
sort( $vals );
if ( isset( $args['date_format'] ) ) {
if ( true === $args['date_format'] ) {
$args['date_format'] = get_option( 'date_format' );
}
foreach ( $vals as $val ) {
if ( is_numeric( $val ) ) {
$echo[] = date( $args['date_format'], $val );
} elseif ( ! empty( $val ) ) {
$echo[] = mysql2date( $args['date_format'], $val );
}
}
} else {
foreach ( $vals as $val ) {
if ( ! empty( $val ) || ( '0' === $val ) ) {
$echo[] = $val;
}
}
}
if ( empty( $echo ) ) {
echo '&#8212;';
} else {
echo esc_html( implode( ', ', $echo ) );
}
}
/**
* Returns a sensible title for the current item (usually the arguments array for a column)
*
* @param array $item An array of arguments
* @return string The item title
*/
protected function get_item_title( array $item ) : string {
if ( isset( $item['meta_key'] ) ) {
return ucwords( trim( str_replace( [ '_', '-' ], ' ', $item['meta_key'] ) ) );
} else {
return '';
}
}
/**
* Removes the default meta box from the post editing screen and adds our custom meta box.
*
* @param string $object_type The object type (eg. the post type)
* @param mixed $object The object (eg. a WP_Post object)
*/
public function meta_boxes( string $object_type, $object ) {
if ( ! is_a( $object, 'WP_Post' ) ) {
return;
}
$post_type = $object_type;
$post = $object;
$taxos = get_post_taxonomies( $post );
if ( in_array( $this->taxo->taxonomy, $taxos, true ) ) {
$tax = get_taxonomy( $this->taxo->taxonomy );
# Remove default meta box:
if ( $this->taxo->args['hierarchical'] ) {
remove_meta_box( "{$this->taxo->taxonomy}div", $post_type, 'side' );
} else {
remove_meta_box( "tagsdiv-{$this->taxo->taxonomy}", $post_type, 'side' );
}
if ( ! current_user_can( $tax->cap->assign_terms ) ) {
return;
}
if ( $this->args['meta_box'] ) {
# Set the 'meta_box' argument to the actual meta box callback function name:
if ( 'simple' === $this->args['meta_box'] ) {
if ( $this->taxo->args['exclusive'] ) {
$this->args['meta_box'] = [ $this, 'meta_box_radio' ];
} else {
$this->args['meta_box'] = [ $this, 'meta_box_simple' ];
}
} elseif ( 'radio' === $this->args['meta_box'] ) {
$this->taxo->args['exclusive'] = true;
$this->args['meta_box'] = [ $this, 'meta_box_radio' ];
} elseif ( 'dropdown' === $this->args['meta_box'] ) {
$this->taxo->args['exclusive'] = true;
$this->args['meta_box'] = [ $this, 'meta_box_dropdown' ];
}
# Add the meta box, using the plural or singular taxonomy label where relevant:
if ( $this->taxo->args['exclusive'] ) {
add_meta_box( "{$this->taxo->taxonomy}div", $tax->labels->singular_name, $this->args['meta_box'], $post_type, 'side' );
} else {
add_meta_box( "{$this->taxo->taxonomy}div", $tax->labels->name, $this->args['meta_box'], $post_type, 'side' );
}
} elseif ( false !== $this->args['meta_box'] ) {
# This must be an 'exclusive' taxonomy. Add the radio meta box:
add_meta_box( "{$this->taxo->taxonomy}div", $tax->labels->singular_name, [ $this, 'meta_box_radio' ], $post_type, 'side' );
}
}
}
/**
* Displays the 'radio' meta box on the post editing screen.
*
* Uses the Walker_ExtendedTaxonomyRadios class for the walker.
*
* @param WP_Post $post The post object.
* @param array $meta_box The meta box arguments.
*/
public function meta_box_radio( WP_Post $post, array $meta_box ) {
require_once __DIR__ . '/class-walker-extendedtaxonomyradios.php';
$walker = new Walker_ExtendedTaxonomyRadios();
$this->do_meta_box( $post, $walker, true, 'checklist' );
}
/**
* Displays the 'dropdown' meta box on the post editing screen.
*
* Uses the Walker_ExtendedTaxonomyDropdown class for the walker.
*
* @param WP_Post $post The post object.
* @param array $meta_box The meta box arguments.
*/
public function meta_box_dropdown( WP_Post $post, array $meta_box ) {
require_once __DIR__ . '/class-walker-extendedtaxonomydropdown.php';
$walker = new Walker_ExtendedTaxonomyDropdown();
$this->do_meta_box( $post, $walker, true, 'dropdown' );
}
/**
* Displays the 'simple' meta box on the post editing screen.
*
* @param WP_Post $post The post object.
* @param array $meta_box The meta box arguments.
*/
public function meta_box_simple( WP_Post $post, array $meta_box ) {
$this->do_meta_box( $post );
}
/**
* Displays a meta box on the post editing screen.
*
* @param WP_Post $post The post object.
* @param Walker $walker Optional. A term walker.
* @param bool $show_none Optional. Whether to include a 'none' item in the term list. Default false.
* @param string $type Optional. The taxonomy list type (checklist or dropdown). Default 'checklist'.
*/
protected function do_meta_box( WP_Post $post, Walker $walker = null, bool $show_none = false, string $type = 'checklist' ) {
$taxonomy = $this->taxo->taxonomy;
$tax = get_taxonomy( $taxonomy );
$selected = wp_get_object_terms( $post->ID, $taxonomy, [
'fields' => 'ids',
] );
if ( $show_none ) {
if ( isset( $tax->labels->no_item ) ) {
$none = $tax->labels->no_item;
} else {
$none = esc_html__( 'Not specified', 'extended-cpts' );
}
} else {
$none = '';
}
/**
* Execute code before the taxonomy meta box content outputs to the page.
*
* @since 2.0.0
*
* @param WP_Taxonomy $tax The current taxonomy object.
* @param WP_Post $post The current post object.
* @param string $type The taxonomy list type ('checklist' or 'dropdown').
*/
do_action( 'ext-taxos/meta_box/before', $tax, $post, $type );
?>
<div id="taxonomy-<?php echo esc_attr( $taxonomy ); ?>" class="categorydiv">
<?php
switch ( $type ) {
case 'dropdown':
printf(
'<label for="%1$s" class="screen-reader-text">%2$s</label>',
esc_attr( "{$taxonomy}dropdown" ),
esc_html( $tax->labels->singular_name )
);
wp_dropdown_categories( [
'option_none_value' => ( is_taxonomy_hierarchical( $taxonomy ) ? '-1' : '' ),
'show_option_none' => $none,
'hide_empty' => false,
'hierarchical' => true,
'show_count' => false,
'orderby' => 'name',
'selected' => reset( $selected ),
'id' => "{$taxonomy}dropdown",
'name' => "tax_input[{$taxonomy}]",
'taxonomy' => $taxonomy,
'walker' => $walker,
'required' => $this->args['required'],
] );
break;
case 'checklist':
default:
?>
<style type="text/css">
/* Style for the 'none' item: */
#<?php echo esc_attr( $taxonomy ); ?>-0 {
color: #888;
border-top: 1px solid #eee;
margin-top: 5px;
padding-top: 5px;
}
</style>
<input type="hidden" name="tax_input[<?php echo esc_attr( $taxonomy ); ?>][]" value="0" />
<ul id="<?php echo esc_attr( $taxonomy ); ?>checklist" class="list:<?php echo esc_attr( $taxonomy ); ?> categorychecklist form-no-clear">
<?php
# Standard WP Walker_Category_Checklist does not cut it
if ( ! $walker ) {
require_once __DIR__ . '/class-walker-extendedtaxonomycheckboxes.php';
$walker = new Walker_ExtendedTaxonomyCheckboxes();
}
# Output the terms:
wp_terms_checklist( $post->ID, [
'taxonomy' => $taxonomy,
'walker' => $walker,
'selected_cats' => $selected,
'checked_ontop' => $this->args['checked_ontop'],
] );
# Output the 'none' item:
if ( $show_none ) {
$output = '';
$o = (object) [
'term_id' => 0,
'name' => $none,
'slug' => 'none',
];
if ( empty( $selected ) ) {
$_selected = [ 0 ];
} else {
$_selected = $selected;
}
$args = [
'taxonomy' => $taxonomy,
'selected_cats' => $_selected,
'disabled' => false,
];
$walker->start_el( $output, $o, 1, $args );
$walker->end_el( $output, $o, 1, $args );
echo $output; // WPCS: XSS ok.
}
?>
</ul>
<?php
break;
}
?>
</div>
<?php
/**
* Execute code after the taxonomy meta box content outputs to the page.
*
* @since 2.0.0
*
* @param WP_Taxonomy $tax The current taxonomy object.
* @param WP_Post $post The current post object.
* @param string $type The taxonomy list type ('checklist' or 'dropdown').
*/
do_action( 'ext-taxos/meta_box/after', $tax, $post, $type );
}
/**
* Adds our taxonomy to the 'At a Glance' widget on the dashboard.
*
* @param string[] $items Array of items to display on the widget.
* @return string[] Updated array of items.
*/
public function glance_items( array $items ) : array {
$taxonomy = get_taxonomy( $this->taxo->taxonomy );
if ( ! current_user_can( $taxonomy->cap->manage_terms ) ) {
return $items;
}
if ( $taxonomy->_builtin ) {
return $items;
}
# Get the labels and format the counts:
$count = wp_count_terms( $this->taxo->taxonomy );
$text = self::n( $taxonomy->labels->singular_name, $taxonomy->labels->name, $count );
$num = number_format_i18n( $count );
# This is absolutely not localisable. WordPress 3.8 didn't add a new taxonomy label.
$url = add_query_arg( [
'taxonomy' => $this->taxo->taxonomy,
'post_type' => reset( $taxonomy->object_type ),
], admin_url( 'edit-tags.php' ) );
$text = '<a href="' . esc_url( $url ) . '" class="taxo-' . esc_attr( $this->taxo->taxonomy ) . '-count">' . esc_html( $num . ' ' . $text ) . '</a>';
# Go!
$items[] = $text;
return $items;
}
/**
* Adds our term updated messages.
*
* The messages are as follows:
*
* 1 => "Term added."
* 2 => "Term deleted."
* 3 => "Term updated."
* 4 => "Term not added."
* 5 => "Term not updated."
* 6 => "Terms deleted."
*
* @param array[] $messages An array of term updated message arrays keyed by taxonomy name.
* @return array[] Updated array of term updated messages.
*/
public function term_updated_messages( array $messages ) : array {
$messages[ $this->taxo->taxonomy ] = [
1 => esc_html( sprintf( '%s added.', $this->taxo->tax_singular ) ),
2 => esc_html( sprintf( '%s deleted.', $this->taxo->tax_singular ) ),
3 => esc_html( sprintf( '%s updated.', $this->taxo->tax_singular ) ),
4 => esc_html( sprintf( '%s not added.', $this->taxo->tax_singular ) ),
5 => esc_html( sprintf( '%s not updated.', $this->taxo->tax_singular ) ),
6 => esc_html( sprintf( '%s deleted.', $this->taxo->tax_plural ) ),
];
return $messages;
}
/**
* A non-localised version of _n()
*
* @param string $single The text that will be used if $number is 1
* @param string $plural The text that will be used if $number is not 1
* @param int $number The number to compare against to use either $single or $plural
* @return string Either $single or $plural text
*/
public static function n( $single, $plural, $number ) {
return ( 1 === intval( $number ) ) ? $single : $plural;
}
}

+ 35
- 0
vendor/johnbillion/extended-cpts/src/class-extended-taxonomy-rewrite-testing.php View File

@ -0,0 +1,35 @@
<?php
declare( strict_types=1 );
class Extended_Taxonomy_Rewrite_Testing extends Extended_Rewrite_Testing {
/**
* @var Extended_Taxonomy
*/
public $taxo;
public function __construct( Extended_Taxonomy $taxo ) {
$this->taxo = $taxo;
}
public function get_tests() : array {
global $wp_rewrite;
if ( ! $wp_rewrite->using_permalinks() ) {
return [];
}
if ( ! isset( $wp_rewrite->extra_permastructs[ $this->taxo->taxonomy ] ) ) {
return [];
}
$struct = $wp_rewrite->extra_permastructs[ $this->taxo->taxonomy ];
$tax = get_taxonomy( $this->taxo->taxonomy );
$name = sprintf( '%s (%s)', $tax->labels->name, $this->taxo->taxonomy );
return [
$name => $this->get_rewrites( $struct, [] ),
];
}
}

+ 241
- 0
vendor/johnbillion/extended-cpts/src/class-extended-taxonomy.php View File

@ -0,0 +1,241 @@
<?php
declare( strict_types=1 );
class Extended_Taxonomy {
/**
* Default arguments for custom taxonomies.
* Several of these differ from the defaults in WordPress' register_taxonomy() function.
*
* @var array
*/
protected $defaults = [
'public' => true,
'show_ui' => true,
'hierarchical' => true,
'query_var' => true,
'exclusive' => false, # Custom arg
'allow_hierarchy' => false, # Custom arg
];
/**
* @var string
*/
public $taxonomy;
/**
* @var array
*/
public $object_type;
/**
* @var string
*/
public $tax_slug;
/**
* @var string
*/
public $tax_singular;
/**
* @var string
*/
public $tax_plural;
/**
* @var string
*/
public $tax_singular_low;
/**
* @var string
*/
public $tax_plural_low;
/**
* @var array
*/
public $args;
/**
* Class constructor.
*
* @see register_extended_taxonomy()
*
* @param string $taxonomy The taxonomy name.
* @param array|string $object_type Name(s) of the object type(s) for the taxonomy.
* @param array $args Optional. The taxonomy arguments.
* @param string[] $names Optional. An associative array of the plural, singular, and slug names.
*/
public function __construct( string $taxonomy, $object_type, array $args = [], array $names = [] ) {
/**
* Filter the arguments for this taxonomy.
*
* @since 2.0.0
*
* @param array $args The taxonomy arguments.
*/
$args = apply_filters( "ext-taxos/{$taxonomy}/args", $args );
/**
* Filter the names for this taxonomy.
*
* @since 2.0.0
*
* @param string[] $names The plural, singular, and slug names (if any were specified).
*/
$names = apply_filters( "ext-taxos/{$taxonomy}/names", $names );
if ( isset( $names['singular'] ) ) {
$this->tax_singular = $names['singular'];
} else {
$this->tax_singular = ucwords( str_replace( [ '-', '_' ], ' ', $taxonomy ) );
}
if ( isset( $names['slug'] ) ) {
$this->tax_slug = $names['slug'];
} elseif ( isset( $names['plural'] ) ) {
$this->tax_slug = $names['plural'];
} else {
$this->tax_slug = $taxonomy . 's';
}
if ( isset( $names['plural'] ) ) {
$this->tax_plural = $names['plural'];
} else {
$this->tax_plural = ucwords( str_replace( [ '-', '_' ], ' ', $this->tax_slug ) );
}
$this->object_type = (array) $object_type;
$this->taxonomy = strtolower( $taxonomy );
$this->tax_slug = strtolower( $this->tax_slug );
# Build our base taxonomy names:
# Lower-casing is not forced if the name looks like an initialism, eg. FAQ.
if ( ! preg_match( '/[A-Z]{2,}/', $this->tax_singular ) ) {
$this->tax_singular_low = strtolower( $this->tax_singular );
} else {
$this->tax_singular_low = $this->tax_singular;
}
if ( ! preg_match( '/[A-Z]{2,}/', $this->tax_plural ) ) {
$this->tax_plural_low = strtolower( $this->tax_plural );
} else {
$this->tax_plural_low = $this->tax_plural;
}
# Build our labels:
$this->defaults['labels'] = [
'menu_name' => $this->tax_plural,
'name' => $this->tax_plural,
'singular_name' => $this->tax_singular,
'search_items' => sprintf( 'Search %s', $this->tax_plural ),
'popular_items' => sprintf( 'Popular %s', $this->tax_plural ),
'all_items' => sprintf( 'All %s', $this->tax_plural ),
'parent_item' => sprintf( 'Parent %s', $this->tax_singular ),
'parent_item_colon' => sprintf( 'Parent %s:', $this->tax_singular ),
'edit_item' => sprintf( 'Edit %s', $this->tax_singular ),
'view_item' => sprintf( 'View %s', $this->tax_singular ),
'update_item' => sprintf( 'Update %s', $this->tax_singular ),
'add_new_item' => sprintf( 'Add New %s', $this->tax_singular ),
'new_item_name' => sprintf( 'New %s Name', $this->tax_singular ),
'separate_items_with_commas' => sprintf( 'Separate %s with commas', $this->tax_plural_low ),
'add_or_remove_items' => sprintf( 'Add or remove %s', $this->tax_plural_low ),
'choose_from_most_used' => sprintf( 'Choose from most used %s', $this->tax_plural_low ),
'not_found' => sprintf( 'No %s found', $this->tax_plural_low ),
'no_terms' => sprintf( 'No %s', $this->tax_plural_low ),
'items_list_navigation' => sprintf( '%s list navigation', $this->tax_plural ),
'items_list' => sprintf( '%s list', $this->tax_plural ),
'most_used' => 'Most Used',
'back_to_items' => sprintf( '&larr; Back to %s', $this->tax_plural ),
'no_item' => sprintf( 'No %s', $this->tax_singular_low ), # Custom label
'filter_by' => sprintf( 'Filter by %s', $this->tax_singular_low ), # Custom label
];
# Only set rewrites if we need them
if ( isset( $args['public'] ) && ! $args['public'] ) {
$this->defaults['rewrite'] = false;
} else {
$this->defaults['rewrite'] = [
'slug' => $this->tax_slug,
'with_front' => false,
'hierarchical' => isset( $args['allow_hierarchy'] ) ? $args['allow_hierarchy'] : $this->defaults['allow_hierarchy'],
];
}
# Merge our args with the defaults:
$this->args = array_merge( $this->defaults, $args );
# This allows the 'labels' arg to contain some, none or all labels:
if ( isset( $args['labels'] ) ) {
$this->args['labels'] = array_merge( $this->defaults['labels'], $args['labels'] );
}
# Rewrite testing:
if ( $this->args['rewrite'] ) {
add_filter( 'rewrite_testing_tests', [ $this, 'rewrite_testing_tests' ], 1 );
}
# Register taxonomy:
$this->register_taxonomy();
/**
* Fired when the extended taxonomy instance is set up.
*
* @since 4.0.0
*
* @param Extended_Taxonomy $instance The extended taxonomy instance.
*/
do_action( "ext-taxos/{$taxonomy}/instance", $this );
}
/**
* Add our rewrite tests to the Rewrite Rule Testing tests array.
*
* @codeCoverageIgnore
*
* @param array $tests The existing rewrite rule tests.
* @return array Updated rewrite rule tests.
*/
public function rewrite_testing_tests( array $tests ) : array {
require_once __DIR__ . '/class-extended-rewrite-testing.php';
require_once __DIR__ . '/class-extended-taxonomy-rewrite-testing.php';
$extended = new Extended_Taxonomy_Rewrite_Testing( $this );
return array_merge( $tests, $extended->get_tests() );
}
/**
* Registers our taxonomy.
*/
public function register_taxonomy() {
if ( true === $this->args['query_var'] ) {
$query_var = $this->taxonomy;
} else {
$query_var = $this->args['query_var'];
}
$post_types = get_post_types( [
'query_var' => $query_var,
] );
if ( $query_var && count( $post_types ) ) {
trigger_error( esc_html( sprintf(
/* translators: %s: Taxonomy query variable name */
__( 'Taxonomy query var "%s" clashes with a post type query var of the same name', 'extended-cpts' ),
$query_var
) ), E_USER_ERROR );
} elseif ( in_array( $query_var, [ 'type', 'tab' ], true ) ) {
trigger_error( esc_html( sprintf(
/* translators: %s: Taxonomy query variable name */
__( 'Taxonomy query var "%s" is not allowed', 'extended-cpts' ),
$query_var
) ), E_USER_ERROR );
} else {
register_taxonomy( $this->taxonomy, $this->object_type, $this->args );
}
}
}

+ 109
- 0
vendor/johnbillion/extended-cpts/src/class-walker-extendedtaxonomycheckboxes.php View File

@ -0,0 +1,109 @@
<?php
declare( strict_types=1 );
/**
* Walker to output an unordered list of category checkbox <input> elements properly.
*
* @uses Walker
*/
class Walker_ExtendedTaxonomyCheckboxes extends Walker {
/**
* @var string
*/
public $tree_type = 'category';
/**
* @var array
*/
public $db_fields = [
'parent' => 'parent',
'id' => 'term_id',
];
/**
* @var string
*/
public $field = null;
/**
* Class constructor.
*
* @param array $args Optional arguments.
*/
public function __construct( $args = null ) {
if ( $args && isset( $args['field'] ) ) {
$this->field = $args['field'];
}
}
/**
* Starts the list before the elements are added.
*
* @param string $output Passed by reference. Used to append additional content.
* @param int $depth Depth of term in reference to parents.
* @param array $args Optional arguments.
*/
public function start_lvl( &$output, $depth = 0, $args = [] ) {
$indent = str_repeat( "\t", $depth );
$output .= "$indent<ul class='children'>\n";
}
/**
* Ends the list of after the elements are added.
*
* @param string $output Passed by reference. Used to append additional content.
* @param int $depth Depth of term in reference to parents.
* @param array $args Optional arguments.
*/
public function end_lvl( &$output, $depth = 0, $args = [] ) {
$indent = str_repeat( "\t", $depth );
$output .= "$indent</ul>\n";
}
/**
* Start the element output.
*
* @param string $output Passed by reference. Used to append additional content.
* @param object $object Term data object.
* @param int $depth Depth of term in reference to parents.
* @param array $args Optional arguments.
* @param int $current_object_id Current object ID.
*/
public function start_el( &$output, $object, $depth = 0, $args = [], $current_object_id = 0 ) {
$tax = get_taxonomy( $args['taxonomy'] );
if ( $this->field ) {
$value = $object->{$this->field};
} else {
$value = $tax->hierarchical ? $object->term_id : $object->name;
}
if ( empty( $object->term_id ) && ! $tax->hierarchical ) {
$value = '';
}
$output .= "\n<li id='{$args['taxonomy']}-{$object->term_id}'>" .
'<label class="selectit">' .
'<input value="' . esc_attr( $value ) . '" type="checkbox" name="tax_input[' . esc_attr( $args['taxonomy'] ) . '][]" ' .
'id="in-' . esc_attr( $args['taxonomy'] ) . '-' . intval( $object->term_id ) . '"' .
checked( in_array( $object->term_id, (array) $args['selected_cats'] ), true, false ) .
disabled( empty( $args['disabled'] ), false, false ) .
' /> ' .
esc_html( apply_filters( 'the_category', $object->name ) ) .
'</label>';
}
/**
* Ends the element output, if needed.
*
* @param string $output Passed by reference. Used to append additional content.
* @param object $object Term data object.
* @param int $depth Depth of term in reference to parents.
* @param array $args Optional arguments.
*/
public function end_el( &$output, $object, $depth = 0, $args = [] ) {
$output .= "</li>\n";
}
}

+ 82
- 0
vendor/johnbillion/extended-cpts/src/class-walker-extendedtaxonomydropdown.php View File

@ -0,0 +1,82 @@
<?php
declare( strict_types=1 );
/**
* A term walker class for a dropdown menu.
*
* @uses Walker
*/
class Walker_ExtendedTaxonomyDropdown extends Walker {
/**
* @var string
*/
public $tree_type = 'category';
/**
* @var array
*/
public $db_fields = [
'parent' => 'parent',
'id' => 'term_id',
];
/**
* @var string
*/
public $field = null;
/**
* Class constructor.
*
* @param array $args Optional arguments.
*/
public function __construct( $args = null ) {
if ( $args && isset( $args['field'] ) ) {
$this->field = $args['field'];
}
}
/**
* Start the element output.
*
* @param string $output Passed by reference. Used to append additional content.
* @param object $object Term data object.
* @param int $depth Depth of term in reference to parents.
* @param array $args Optional arguments.
* @param int $current_object_id Current object ID.
*/
public function start_el( &$output, $object, $depth = 0, $args = [], $current_object_id = 0 ) {
$pad = str_repeat( '&nbsp;', $depth * 3 );
$tax = get_taxonomy( $args['taxonomy'] );
if ( $this->field ) {
$value = $object->{$this->field};
} else {
$value = $tax->hierarchical ? $object->term_id : $object->name;
}
if ( empty( $object->term_id ) && ! $tax->hierarchical ) {
$value = '';
}
$cat_name = apply_filters( 'list_cats', $object->name, $object );
$output .= "\t<option class=\"level-{$depth}\" value=\"" . esc_attr( $value ) . '"';
if ( isset( $args['selected_cats'] ) && in_array( $value, (array) $args['selected_cats'] ) ) {
$output .= ' selected="selected"';
} elseif ( isset( $args['selected'] ) && in_array( $object->term_id, (array) $args['selected'] ) ) {
$output .= ' selected="selected"';
}
$output .= '>';
$output .= $pad . esc_html( $cat_name );
if ( $args['show_count'] ) {
$output .= '&nbsp;&nbsp;(' . esc_html( number_format_i18n( $object->count ) ) . ')';
}
$output .= "</option>\n";
}
}

+ 109
- 0
vendor/johnbillion/extended-cpts/src/class-walker-extendedtaxonomyradios.php View File

@ -0,0 +1,109 @@
<?php
declare( strict_types=1 );
/**
* A term walker class for radio buttons.
*
* @uses Walker
*/
class Walker_ExtendedTaxonomyRadios extends Walker {
/**
* @var string
*/
public $tree_type = 'category';
/**
* @var array
*/
public $db_fields = [
'parent' => 'parent',
'id' => 'term_id',
];
/**
* @var string
*/
public $field = null;
/**
* Class constructor.
*
* @param array $args Optional arguments.
*/
public function __construct( $args = null ) {
if ( $args && isset( $args['field'] ) ) {
$this->field = $args['field'];
}
}
/**
* Starts the list before the elements are added.
*
* @param string $output Passed by reference. Used to append additional content.
* @param int $depth Depth of term in reference to parents.
* @param array $args Optional arguments.
*/
public function start_lvl( &$output, $depth = 0, $args = [] ) {
$indent = str_repeat( "\t", $depth );
$output .= "{$indent}<ul class='children'>\n";
}
/**
* Ends the list of after the elements are added.
*
* @param string $output Passed by reference. Used to append additional content.
* @param int $depth Depth of term in reference to parents.
* @param array $args Optional arguments.
*/
public function end_lvl( &$output, $depth = 0, $args = [] ) {
$indent = str_repeat( "\t", $depth );
$output .= "{$indent}</ul>\n";
}
/**
* Start the element output.
*
* @param string $output Passed by reference. Used to append additional content.
* @param object $object Term data object.
* @param int $depth Depth of term in reference to parents.
* @param array $args Optional arguments.
* @param int $current_object_id Current object ID.
*/
public function start_el( &$output, $object, $depth = 0, $args = [], $current_object_id = 0 ) {
$tax = get_taxonomy( $args['taxonomy'] );
if ( $this->field ) {
$value = $object->{$this->field};
} else {
$value = $tax->hierarchical ? $object->term_id : $object->name;
}
if ( empty( $object->term_id ) && ! $tax->hierarchical ) {
$value = '';
}
$output .= "\n<li id='{$args['taxonomy']}-{$object->term_id}'>" .
'<label class="selectit">' .
'<input value="' . esc_attr( $value ) . '" type="radio" name="tax_input[' . esc_attr( $args['taxonomy'] ) . '][]" ' .
'id="in-' . esc_attr( $args['taxonomy'] ) . '-' . esc_attr( $object->term_id ) . '"' .
checked( in_array( $object->term_id, (array) $args['selected_cats'] ), true, false ) .
disabled( empty( $args['disabled'] ), false, false ) .
' /> ' .
esc_html( apply_filters( 'the_category', $object->name ) ) .
'</label>';
}
/**
* Ends the element output, if needed.
*
* @param string $output Passed by reference. Used to append additional content.
* @param object $object Term data object.
* @param int $depth Depth of term in reference to parents.
* @param array $args Optional arguments.
*/
public function end_el( &$output, $object, $depth = 0, $args = [] ) {
$output .= "</li>\n";
}
}

+ 342
- 0
vendor/johnbillion/extended-cpts/src/dashicons-codepoints.json View File

@ -0,0 +1,342 @@
{
"menu": 62259,
"admin-site": 62233,
"dashboard": 61990,
"admin-media": 61700,
"admin-page": 61701,
"admin-comments": 61697,
"admin-appearance": 61696,
"admin-plugins": 61702,
"admin-users": 61712,
"admin-tools": 61703,
"admin-settings": 61704,
"admin-network": 61714,
"admin-generic": 61713,
"admin-home": 61698,
"admin-collapse": 61768,
"filter": 62774,
"admin-customizer": 62784,
"admin-multisite": 62785,
"admin-links": 61699,
"admin-post": 61705,
"format-image": 61736,
"format-gallery": 61793,
"format-audio": 61735,
"format-video": 61734,
"format-chat": 61733,
"format-status": 61744,
"format-aside": 61731,
"format-quote": 61730,
"welcome-write-blog": 61721,
"welcome-add-page": 61747,
"welcome-view-site": 61717,
"welcome-widgets-menus": 61718,
"welcome-comments": 61719,
"welcome-learn-more": 61720,
"image-crop": 61797,
"image-rotate": 62769,
"image-rotate-left": 61798,
"image-rotate-right": 61799,
"image-flip-vertical": 61800,
"image-flip-horizontal": 61801,
"image-filter": 62771,
"undo": 61809,
"redo": 61810,
"editor-bold": 61952,
"editor-italic": 61953,
"editor-ul": 61955,
"editor-ol": 61956,
"editor-quote": 61957,
"editor-alignleft": 61958,
"editor-aligncenter": 61959,
"editor-alignright": 61960,
"editor-insertmore": 61961,
"editor-spellcheck": 61968,
"editor-expand": 61969,
"editor-contract": 62726,
"editor-kitchensink": 61970,
"editor-underline": 61971,
"editor-justify": 61972,
"editor-textcolor": 61973,
"editor-paste-word": 61974,
"editor-paste-text": 61975,
"editor-removeformatting": 61976,
"editor-video": 61977,
"editor-customchar": 61984,
"editor-outdent": 61985,
"editor-indent": 61986,
"editor-help": 61987,
"editor-strikethrough": 61988,
"editor-unlink": 61989,
"editor-rtl": 62240,
"editor-break": 62580,
"editor-code": 62581,
"editor-code-duplicate": 62612,
"editor-paragraph": 62582,
"editor-table": 62773,
"align-left": 61749,
"align-right": 61750,
"align-center": 61748,
"align-none": 61752,
"lock": 61792,
"lock-duplicate": 62229,
"unlock": 62760,
"calendar": 61765,
"calendar-alt": 62728,
"visibility": 61815,
"hidden": 62768,
"post-status": 61811,
"edit": 62564,
"edit-large": 62247,
"sticky": 62775,
"external": 62724,
"arrow-up": 61762,
"arrow-up-duplicate": 61763,
"arrow-down": 61760,
"arrow-left": 61761,
"arrow-right": 61753,
"arrow-up-alt": 62274,
"arrow-down-alt": 62278,
"arrow-left-alt": 62272,
"arrow-right-alt": 62276,
"arrow-up-alt2": 62275,
"arrow-down-alt2": 62279,
"arrow-left-alt2": 62273,
"arrow-right-alt2": 62277,
"leftright": 61993,
"sort": 61782,
"randomize": 62723,
"list-view": 61795,
"excerpt-view": 61796,
"grid-view": 62729,
"move": 62789,
"hammer": 62216,
"art": 62217,
"migrate": 62224,
"performance": 62225,
"universal-access": 62595,
"universal-access-alt": 62727,
"tickets": 62598,
"nametag": 62596,
"clipboard": 62593,
"heart": 62599,
"megaphone": 62600,
"schedule": 62601,
"wordpress": 61728,
"wordpress-alt": 62244,
"pressthis": 61783,
"update": 62563,
"screenoptions": 61824,
"cart": 61812,
"feedback": 61813,
"translation": 62246,
"tag": 62243,
"category": 62232,
"archive": 62592,
"tagcloud": 62585,
"text": 62584,
"media-archive": 62721,
"media-audio": 62720,
"media-code": 62617,
"media-default": 62616,
"media-document": 62615,
"media-interactive": 62614,
"media-spreadsheet": 62613,
"media-text": 62609,
"media-video": 62608,
"playlist-audio": 62610,
"playlist-video": 62611,
"controls-play": 62754,
"controls-pause": 62755,
"controls-forward": 62745,
"controls-skipforward": 62743,
"controls-back": 62744,
"controls-skipback": 62742,
"controls-repeat": 62741,
"controls-volumeon": 62753,
"controls-volumeoff": 62752,
"yes": 61767,
"no": 61784,
"no-alt": 62261,
"plus": 61746,
"plus-alt": 62722,
"plus-alt2": 62787,
"minus": 62560,
"dismiss": 61779,
"marker": 61785,
"star-filled": 61781,
"star-half": 62553,
"star-empty": 61780,
"flag": 61991,
"info": 62280,
"warning": 62772,
"share": 62007,
"share1": 62007,
"share-alt": 62016,
"share-alt2": 62018,
"twitter": 62209,
"rss": 62211,
"email": 62565,
"email-alt": 62566,
"facebook": 62212,
"facebook-alt": 62213,
"networking": 62245,
"googleplus": 62562,
"location": 62000,
"location-alt": 62001,
"camera": 62214,
"images-alt": 62002,
"images-alt2": 62003,
"video-alt": 62004,
"video-alt2": 62005,
"video-alt3": 62006,
"vault": 61816,
"shield": 62258,
"shield-alt": 62260,
"sos": 62568,
"search": 61817,
"slides": 61825,
"analytics": 61827,
"chart-pie": 61828,
"chart-bar": 61829,
"chart-line": 62008,
"chart-area": 62009,
"groups": 62215,
"businessman": 62264,
"id": 62262,
"id-alt": 62263,
"products": 62226,
"awards": 62227,
"forms": 62228,
"testimonial": 62579,
"portfolio": 62242,
"book": 62256,
"book-alt": 62257,
"download": 62230,
"upload": 62231,
"backup": 62241,
"clock": 62569,
"lightbulb": 62265,
"microphone": 62594,
"desktop": 62578,
"laptop": 62791,
"tablet": 62577,
"smartphone": 62576,
"phone": 62757,
"smiley": 62248,
"index-card": 62736,
"carrot": 62737,
"building": 62738,
"store": 62739,
"album": 62740,
"palmtree": 62759,
"tickets-alt": 62756,
"money": 62758,
"thumbs-up": 62761,
"thumbs-down": 62786,
"layout": 62776,
"paperclip": 62790,
"email-alt2": 62567,
"menu-alt": 61992,
"trash": 61826,
"heading": 61710,
"insert": 61711,
"align-full-width": 61716,
"button": 61722,
"align-wide": 61723,
"ellipsis": 61724,
"buddicons-activity": 62546,
"buddicons-buddypress-logo": 62536,
"buddicons-community": 62547,
"buddicons-forums": 62537,
"buddicons-friends": 62548,
"buddicons-groups": 62550,
"buddicons-pm": 62551,
"buddicons-replies": 62545,
"buddicons-topics": 62544,
"buddicons-tracking": 62549,
"admin-site-alt": 61725,
"admin-site-alt2": 61726,
"admin-site-alt3": 61727,
"rest-api": 61732,
"yes-alt": 61738,
"buddicons-bbpress-logo": 62583,
"tide": 61709,
"editor-ol-rtl": 61740,
"instagram": 61741,
"businessperson": 61742,
"businesswoman": 61743,
"color-picker": 61745,
"camera-alt": 61737,
"editor-ltr": 61708,
"cloud": 61814,
"twitter-alt": 62210,
"menu-alt2": 62249,
"menu-alt3": 62281,
"plugins-checked": 62597,
"text-page": 61729,
"update-alt": 61715,
"code-standards": 61754,
"align-pull-left": 61706,
"align-pull-right": 61707,
"block-default": 61739,
"cloud-saved": 61751,
"cloud-upload": 61755,
"columns": 61756,
"cover-image": 61757,
"embed-audio": 61758,
"embed-generic": 61759,
"embed-photo": 61764,
"embed-post": 61766,
"embed-video": 61769,
"exit": 61770,
"html": 61771,
"info-outline": 61772,
"insert-after": 61773,
"insert-before": 61774,
"remove": 61775,
"shortcode": 61776,
"table-col-after": 61777,
"table-col-before": 61778,
"table-col-delete": 61786,
"table-row-after": 61787,
"table-row-before": 61788,
"table-row-delete": 61789,
"saved": 61790,
"airplane": 61791,
"amazon": 61794,
"bank": 61802,
"beer": 61804,
"bell": 61805,
"calculator": 61806,
"coffee": 61807,
"database-add": 61808,
"database-export": 61818,
"database-import": 61819,
"database-remove": 61820,
"database-view": 61821,
"database": 61822,
"drumstick": 61823,
"edit-page": 61830,
"food": 61831,
"fullscreen-alt": 61832,
"fullscreen-exit-alt": 61833,
"games": 61834,
"google": 61835,
"hourglass": 61836,
"linkedin": 61837,
"money-alt": 61838,
"open-folder": 61839,
"pdf": 61840,
"pets": 61841,
"pinterest": 61842,
"printer": 61843,
"privacy": 61844,
"reddit": 61845,
"spotify": 61846,
"superhero-alt": 61847,
"superhero": 61848,
"twitch": 61849,
"whatsapp": 61850,
"youtube": 61851
}

+ 20
- 0
webpack.mix.js View File

@ -0,0 +1,20 @@
let mix = require('laravel-mix');
let tailwindcss = require('tailwindcss');
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
| Mix provides a clean, fluent API for defining some Webpack build steps
| for your Laravel application. By default, we are compiling the Sass
| file for your application, as well as bundling up your JS files.
|
*/
mix.sass('public/sass/glossario.scss', 'public/dist/css')
.options({
processCssUrls: false,
postCss: [ tailwindcss('tailwind.config.js') ],
});