Initial commit

This commit is contained in:
Felix Förtsch
2020-10-20 14:39:50 +02:00
commit 648ded8896
1225 changed files with 216511 additions and 0 deletions

View File

@@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
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.

View File

@@ -0,0 +1,832 @@
<?php
/**
* Debug Bar Shortcodes - Debug Bar Shortcodes Render.
*
* @package WordPress\Plugins\Debug Bar Shortcodes
* @author Juliette Reinders Folmer <wpplugins_nospam@adviesenzo.nl>
* @link https://github.com/jrfnl/Debug-Bar-Shortcodes
* @since 1.0
* @since 2.0 Class renamed - was: Debug_Bar_Shortcodes_Info
*
* @copyright 2013-2016 Juliette Reinders Folmer
* @license http://creativecommons.org/licenses/GPL/2.0/ GNU General Public License, version 2 or higher
*/
// Avoid direct calls to this file.
if ( ! function_exists( 'add_action' ) ) {
header( 'Status: 403 Forbidden' );
header( 'HTTP/1.1 403 Forbidden' );
exit();
}
/**
* The classes in this file extend the functionality provided by the parent plugin "Debug Bar".
*/
if ( ! class_exists( 'Debug_Bar_Shortcodes_Render' ) ) :
/**
* Debug Bar Shortcodes - Debug Bar Panel Renderer.
*/
class Debug_Bar_Shortcodes_Render {
/**
* Plugin name for use in localization, class names etc.
*
* @var string $name
*/
public static $name = 'debug-bar-shortcodes';
/**
* The amount of shortcodes before the table header will be doubled at the bottom of the table.
*
* @var int
*/
public $double_min = 8;
/**
* Render the actual panel.
*/
public function display() {
$shortcodes = $GLOBALS['shortcode_tags'];
$count = count( $shortcodes );
$double = ( ( $count >= $this->double_min ) ? true : false ); // Whether to repeat the row labels at the bottom of the table.
echo '
<h2><span>', esc_html__( 'Total Registered Shortcodes:', 'debug-bar-shortcodes' ), '</span>', absint( $count ), '</h2>';
$output = '';
if ( is_array( $shortcodes ) && ! empty( $shortcodes ) ) {
uksort( $shortcodes, 'strnatcasecmp' );
$is_singular = ( is_main_query() && is_singular() );
$header_row = $this->render_table_header( $is_singular );
$output .= '
<table id="' . esc_attr( self::$name ) . '">
<thead>' . $header_row . '</thead>
' . ( ( true === $double ) ? '<tfoot>' . $header_row . '</tfoot>' : '' ) . '
<tbody>';
$i = 1;
foreach ( $shortcodes as $shortcode => $callback ) {
$sc_info = new Debug_Bar_Shortcode_Info( $shortcode );
$info = $sc_info->get_info_object();
$has_details = $sc_info->has_details();
$class = ( ( $i % 2 ) ? '' : ' class="even"' );
$output .= '
<tr' . $class . '>
<td>' . $i . '</td>
<td class="column-title">
<strong>[<code>' . esc_html( $shortcode ) . '</code>]</strong>
' . $this->render_action_links( $shortcode, $has_details, $info ) . '
</td>
<td>' . $this->determine_callback_type( $callback ) . '</td>';
if ( true === $is_singular ) {
$in_use = $this->has_shortcode( $shortcode );
$output .= '
<td>' . $this->render_image_based_on_bool( array( 'true' => esc_html__( 'Shortcode is used', 'debug-bar-shortcodes' ), 'false' => esc_html__( 'Shortcode not used', 'debug-bar-shortcodes' ) ), $in_use, true ) . '</td>
<td>' . ( ( true === $in_use ) ? $this->find_shortcode_usage( $shortcode ) : '&nbsp;' ) . '</td>';
unset( $in_use );
}
$output .= '
</tr>';
if ( true === $has_details ) {
$class = ( ( $i % 2 ) ? ' class="' . esc_attr( self::$name . '-details' ) . '"' : ' class="even ' . esc_attr( self::$name . '-details' ) . '"' );
$output .= '
<tr' . $class . '>
<td>&nbsp;</td>
<td colspan="' . ( ( true === $is_singular ) ? 4 : 2 ) . '">
' . $this->render_details_table( $shortcode, $info ) . '
</td>
</tr>
';
}
$i++;
}
unset( $shortcode, $callback, $sc_info, $info, $has_details, $class, $i );
$output .= '
</tbody>
</table>';
}
else {
$output = '<p>' . esc_html__( 'No shortcodes found.', 'debug-bar-shortcodes' ) . '</p>';
}
echo $output; // WPCS: xss ok.
}
/**
* Generate the table header/footer row html.
*
* @param bool $is_singular Whether we are viewing a singular page/post/post type.
*
* @return string
*/
private function render_table_header( $is_singular ) {
$output = '<tr>
<th>#</th>
<th>' . esc_html__( 'Shortcode', 'debug-bar-shortcodes' ) . '</th>
<th>' . esc_html__( 'Rendered by', 'debug-bar-shortcodes' ) . '</th>';
if ( true === $is_singular ) {
$output .= '
<th>' . esc_html__( 'In use?', 'debug-bar-shortcodes' ) . '</th>
<th>' . esc_html__( 'Usage', 'debug-bar-shortcodes' ) . '</th>';
}
$output .= '</tr>';
return $output;
}
/**
* Generate the action links for a shortcode.
*
* @param string $shortcode Current shortcode.
* @param bool $has_details Whether or not the $info is equal to the defaults.
* @param \Debug_Bar_Shortcode_Info_Defaults $info Shortcode info.
*
* @return string
*/
private function render_action_links( $shortcode, $has_details, $info ) {
$links = array();
if ( true === $has_details ) {
$links[] = '<a href="#" class="' . esc_attr( self::$name . '-view-details' ) . '" title="' . esc_html__( 'View more detailed information about the shortcode.', 'debug-bar-shortcodes' ) . '">' . esc_html__( 'View details', 'debug-bar-shortcodes' ) . '</a>';
}
else {
$links[] = '<a href="#' . esc_attr( $shortcode ) . '" class="' . esc_attr( self::$name . '-get-details' ) . '" title="' . esc_html__( 'Try and retrieve more detailed information about the shortcode.', 'debug-bar-shortcodes' ) . '">' . esc_html__( 'Retrieve details', 'debug-bar-shortcodes' ) . '</a>';
}
$links[] = '<a href="#' . esc_attr( $shortcode ) . '" class="' . esc_attr( self::$name . '-find' ) . '" title="' . esc_html__( 'Find out where this shortcode is used (if at all)', 'debug-bar-shortcodes' ) . '">' . esc_html__( 'Find uses', 'debug-bar-shortcodes' ) . '</a>';
if ( true === $has_details && '' !== $info->info_url ) {
$links[] = $this->render_view_online_link( $info->info_url );
}
return '<span class="spinner"></span><div class="row-actions">' . implode( ' | ', $links ) . '</div>';
}
/**
* Generate 'View online' link.
*
* @internal Separated from render_action_links() to also be able to use it as supplemental for ajax retrieve.
*
* @param string $url The URL to link to.
*
* @return string
*/
private function render_view_online_link( $url ) {
return '<a href="' . esc_url( $url ) . '" target="_blank" title="' . __( 'View extended info about the shortcode on the web', 'debug-bar-shortcodes' ) . '" class="' . esc_attr( self::$name . '-external-link' ) . '" >' . esc_html__( 'View online', 'debug-bar-shortcodes' ) . '</a>';
}
/**
* Function to retrieve a displayable string representing the callback.
*
* @internal Similar to callback determination in the Debug Bar Actions and Filters plugin,
* keep them in line with each other.
*
* @param mixed $callback A callback.
*
* @return string
*/
private function determine_callback_type( $callback ) {
if ( ( ! is_string( $callback ) && ! is_object( $callback ) ) && ( ! is_array( $callback ) || ( is_array( $callback ) && ( ! is_string( $callback[0] ) && ! is_object( $callback[0] ) ) ) ) ) {
// Type 1 - not a callback.
return '';
}
elseif ( self::is_closure( $callback ) ) {
// Type 2 - closure.
return '[<em>closure</em>]';
}
elseif ( ( is_array( $callback ) || is_object( $callback ) ) && self::is_closure( $callback[0] ) ) {
// Type 3 - closure within an array/object.
return '[<em>closure</em>]';
}
elseif ( is_string( $callback ) && false === strpos( $callback, '::' ) ) {
// Type 4 - simple string function (includes lambda's).
return sanitize_text_field( $callback ) . '()';
}
elseif ( is_string( $callback ) && false !== strpos( $callback, '::' ) ) {
// Type 5 - static class method calls - string.
return '[<em>class</em>] ' . str_replace( '::', ' :: ', sanitize_text_field( $callback ) ) . '()';
}
elseif ( is_array( $callback ) && ( is_string( $callback[0] ) && is_string( $callback[1] ) ) ) {
// Type 6 - static class method calls - array.
return '[<em>class</em>] ' . sanitize_text_field( $callback[0] ) . ' :: ' . sanitize_text_field( $callback[1] ) . '()';
}
elseif ( is_array( $callback ) && ( is_object( $callback[0] ) && is_string( $callback[1] ) ) ) {
// Type 7 - object method calls.
return '[<em>object</em>] ' . get_class( $callback[0] ) . ' -> ' . sanitize_text_field( $callback[1] ) . '()';
}
else {
// Type 8 - undetermined.
return '<pre>' . var_export( $callback, true ) . '</pre>';
}
}
/**
* Whether the current (singular) post contains the specified shortcode.
*
* Freely based on WP native implementation:
* Source http://core.trac.wordpress.org/browser/trunk/src/wp-includes/shortcodes.php#L144
* Last compared against source: 2015-12-14.
*
* @global object $post Current post object.
*
* @static array $matches Regex matches for the post in the form [id] -> [matches].
*
* @param string $shortcode The shortcode to check for.
*
* @return bool
*/
private function has_shortcode( $shortcode ) {
static $matches;
/* Have we got post content ? */
if ( ! is_object( $GLOBALS['post'] ) || ! isset( $GLOBALS['post']->post_content ) || '' === $GLOBALS['post']->post_content ) {
return false;
}
$content = $GLOBALS['post']->post_content; // Current post.
/* Use WP native function if available (WP 3.6+). */
if ( function_exists( 'has_shortcode' ) ) {
return has_shortcode( $content, $shortcode );
}
/* Otherwise use adjusted copy of the native function (WP < 3.6). */
$post_id = $GLOBALS['post']->ID;
// Cache retrieved shortcode matches in a static for efficiency.
if ( ! isset( $matches ) || ( is_array( $matches ) && ! isset( $matches[ $post_id ] ) ) ) {
preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches[ $post_id ], PREG_SET_ORDER );
}
if ( empty( $matches[ $post_id ] ) ) {
return false;
}
foreach ( $matches[ $post_id ] as $found ) {
if ( $shortcode === $found[2] ) {
return true;
}
elseif ( ! empty( $shortcode[5] ) && has_shortcode( $shortcode[5], $shortcode ) ) {
return true;
}
}
return false;
}
/**
* Find the uses of a shortcode within the current post.
*
* @param string $shortcode The requested shortcode.
* @param string|null $content (optional) Content to search through for the shortcode.
* Defaults to the content of the current post/page/etc.
*
* @return string
*/
private function find_shortcode_usage( $shortcode, $content = null ) {
$result = __( 'Not found', 'debug-bar-shortcodes' );
if ( ! isset( $content ) && ( ! isset( $GLOBALS['post'] ) || ! is_object( $GLOBALS['post'] ) || ! isset( $GLOBALS['post']->post_content ) ) ) {
return $result;
}
if ( ! isset( $content ) ) {
$content = $GLOBALS['post']->post_content;
}
$shortcode = preg_quote( $shortcode );
$regex = '`(?:^|[^\[])(\[' . $shortcode . '[^\]]*\])(?:.*?(\[/' . $shortcode . '\])(?:[^\]]|$))?`s';
$count = preg_match_all( $regex, $content, $matches, PREG_SET_ORDER );
if ( is_int( $count ) && $count > 0 ) {
// Only one result, keep it simple.
if ( 1 === $count ) {
$result = '<code>' . esc_html( $matches[0][1] );
if ( isset( $matches[0][2] ) && '' !== $matches[0][2] ) {
$result .= '&hellip;' . esc_html( $matches[0][2] );
}
$result .= '</code>';
}
// More results, let's make it a neat list.
else {
$result = '<ol>';
foreach ( $matches as $match ) {
$result .= '<li><code>' . esc_html( $match[1] );
if ( isset( $match[2] ) && '' !== $match[2] ) {
$result .= '&hellip;' . esc_html( $match[2] );
}
$result .= '</code></li>';
}
unset( $match );
$result .= '</ol>';
}
}
return $result;
}
/**
* Retrieve a html image tag based on a value.
*
* @param array $alt Array with only three allowed keys:
* ['true'] => Alt value for true image.
* ['false'] => Alt value for false image.
* ['null'] => Alt value for null image (status unknown).
* @param bool|null $bool The value to base the output on, either boolean or null.
* @param bool $show_false Whether to show an image if false or to return an empty string.
* @param bool $show_null Whether to show an image if null or to return an empty string.
*
* @return string
*/
private function render_image_based_on_bool( $alt = array(), $bool = null, $show_false = false, $show_null = false ) {
static $images;
if ( ! isset( $images ) ) {
$images = array(
'true' => plugins_url( 'images/badge-circle-check-16.png', __FILE__ ),
'false' => plugins_url( 'images/badge-circle-cross-16.png', __FILE__ ),
'null' => plugins_url( 'images/help.png', __FILE__ ),
);
}
$img = ( ( isset( $bool ) ) ? ( ( true === $bool ) ? $images['true'] : $images['false'] ) : $images['null'] );
$alt_value = '';
if ( isset( $bool ) ) {
if ( true === $bool && isset( $alt['true'] ) ) {
$alt_value = $alt['true'];
}
elseif ( false === $bool && isset( $alt['false'] ) ) {
$alt_value = $alt['false'];
}
}
elseif ( isset( $alt['null'] ) ) {
$alt_value = $alt['null'];
}
$title_tag = '';
$alt_tag = '';
if ( '' !== $alt_value ) {
$title_tag = ' title="' . esc_attr( $alt_value ) . '"';
$alt_tag = ' alt="' . esc_attr( $alt_value ) . '"';
}
$return = '';
if ( ( null === $bool && true === $show_null ) || ( true === $bool || ( false === $bool && true === $show_false ) ) ) {
$return = '<img src="' . esc_url( $img ) . '" width="16" height="16"' . $alt_tag . $title_tag . '/>';
}
return $return;
}
/**
* Generate the html for a shortcode detailed info table.
*
* @param string $shortcode Current shortcode.
* @param \Debug_Bar_Shortcode_Info_Defaults $info Shortcode info.
*
* @return string
*/
private function render_details_table( $shortcode, $info ) {
$rows = array();
if ( '' !== $info->name ) {
$rows['name'] = '
<tr>
<th colspan="2">' . esc_html__( 'Name', 'debug-bar-shortcodes' ) . '</th>
<td>' . esc_html( $info->name ) . '</td>
</tr>';
}
if ( '' !== $info->description ) {
$rows['description'] = '
<tr>
<th colspan="2">' . esc_html__( 'Description', 'debug-bar-shortcodes' ) . '</th>
<td>' . $info->description . '</td>
</tr>';
}
$rows['syntax'] = $this->render_details_syntax_row( $shortcode, $info );
if ( '' !== $info->info_url ) {
$rows['info_url'] = '
<tr>
<th colspan="2">' . esc_html__( 'Info Url', 'debug-bar-shortcodes' ) . '</th>
<td><a href="' . esc_url( $info->info_url ) . '" target="_blank" class="' . esc_attr( self::$name . '-external-link' ) . '">' . esc_html( $info->info_url ) . '</a></td>
</tr>';
}
if ( ! empty( $info->parameters['required'] ) ) {
$rows['rp'] = $this->render_details_parameter_row(
$info,
'required',
__( 'Required parameters', 'debug-bar-shortcodes' )
);
}
if ( ! empty( $info->parameters['optional'] ) ) {
$rows['op'] = $this->render_details_parameter_row(
$info,
'optional',
__( 'Optional parameters', 'debug-bar-shortcodes' )
);
}
/* Ignore the result if syntax is the only info row (as it's always there). */
if ( 1 >= count( $rows ) && isset( $rows['syntax'] ) ) {
$output = '';
}
else {
$output = '
<h4>' . esc_html__( 'Shortcode details', 'debug-bar-shortcodes' ) . '</h4>
<table>' . implode( $rows ) . '
</table>';
}
return $output;
}
/**
* Generate the html for a shortcode detailed info table syntax row.
*
* @param string $shortcode Current shortcode.
* @param \Debug_Bar_Shortcode_Info_Defaults $info Shortcode info.
*
* @return string
*/
private function render_details_syntax_row( $shortcode, $info ) {
$row = '
<tr>
<th colspan="2">' . esc_html__( 'Syntax', 'debug-bar-shortcodes' ) . '</th>
<td>';
if ( isset( $info->self_closing ) ) {
$param = ( ( ! empty( $info->parameters['required'] ) || ! empty( $info->parameters['optional'] ) ) ? ' <em>[parameters]</em> ' : '' );
if ( true === $info->self_closing ) {
$row .= '<code>[' . esc_html( $shortcode ) . $param . ' /]</code>';
}
else {
$row .= '<code>[' . esc_html( $shortcode ) . $param . '] &hellip; [/' . esc_html( $shortcode ) . ']</code>';
}
}
else {
$row .= '<em>' . esc_html__( 'Unknown', 'debug-bar-shortcodes' ) . '</em>';
}
$row .= '</td>
</tr>';
return $row;
}
/**
* Generate the html for a shortcode detailed info table parameter row.
*
* @param \Debug_Bar_Shortcode_Info_Defaults $info Shortcode info.
* @param string $type Parameter type: 'required' or 'optional'.
* @param string $label Parameter label.
*
* @return string
*/
private function render_details_parameter_row( $info, $type, $label ) {
$row = '
<tr class="' . esc_attr( self::$name . '-sc-parameters' ) . '">
<th rowspan="' . count( $info->parameters[ $type ] ) . '">' . esc_html( $label ) . '</th>';
$first = true;
foreach ( $info->parameters[ $type ] as $pm => $explain ) {
if ( true !== $first ) {
$row .= '
<tr>';
}
else {
$first = false;
}
$row .= '
<td>' . esc_html( $pm ) . '</td>
<td>' . esc_html( $explain ) . '</td>
</tr>';
}
return $row;
}
/* ************** METHODS TO HANDLE AJAX REQUESTS ************** */
/**
* Try and retrieve more information about the shortcode from the actual php code.
*
* @param string $shortcode Validated shortcode.
* @param string $action The AJAX action which led to this function being called.
*
* @return void
*/
public function ajax_retrieve_details( $shortcode, $action ) {
$sc_info = new Debug_Bar_Shortcode_Info( $shortcode, true );
if ( false === $sc_info->has_details() ) {
$response = array(
'id' => 0,
'data' => '',
'action' => $action,
);
$this->send_ajax_response( $response );
exit;
}
$info = $sc_info->get_info_object();
$response = array(
'id' => 1,
'data' => $this->render_details_table( $shortcode, $info ),
'action' => $action,
'tr_class' => self::$name . '-details',
);
if ( isset( $info->info_url ) && '' !== $info->info_url ) {
$response['supplemental'] = $this->render_view_online_link( $info->info_url );
}
$this->send_ajax_response( $response );
exit;
}
/**
* Find out if a shortcode is used anywhere.
*
* Liberally nicked from TR All Shortcodes plugin & adjusted based on WP posts-list-table code.
* Source: https://wordpress.org/plugins/tr-all-shortcodes/
* Source: http://core.trac.wordpress.org/browser/trunk/src/wp-admin/includes/class-wp-posts-list-table.php#L473
*
* @param string $shortcode Validated shortcode.
* @param string $action The AJAX action which led to this function being called.
*
* @return void
*/
public function ajax_find_shortcode_uses( $shortcode, $action ) {
// '_' is a wildcard in mysql, so escape it.
$query = $GLOBALS['wpdb']->prepare(
'select * from `' . $GLOBALS['wpdb']->posts . '`
where `post_status` <> "inherit"
and `post_type` <> "attachment"
and `post_content` like %s
order by `post_type` ASC, `post_date` DESC;',
'%[' . str_replace( '_', '\_', $shortcode ) . '%'
);
$posts = $GLOBALS['wpdb']->get_results( $query );
/* Do we have posts ? */
if ( 0 === $GLOBALS['wpdb']->num_rows ) {
$response = array(
'id' => 0,
'data' => '',
'action' => $action,
);
$this->send_ajax_response( $response );
exit;
}
/* Ok, we've found some posts using the shortcode. */
$output = '
<h4>' . __( 'Shortcode found in the following posts/pages/etc:', 'debug-bar-shortcodes' ) . '</h4>
<table>
<thead>
<tr>
<th>#</th>
<th>' . esc_html__( 'Title', 'debug-bar-shortcodes' ) . '</th>
<th>' . esc_html__( 'Post Type', 'debug-bar-shortcodes' ) . '</th>
<th>' . esc_html__( 'Status', 'debug-bar-shortcodes' ) . '</th>
<th>' . esc_html__( 'Author', 'debug-bar-shortcodes' ) . '</th>
<th>' . esc_html__( 'Shortcode usage(s)', 'debug-bar-shortcodes' ) . '</th>
</tr>
</thead>
<tbody>';
foreach ( $posts as $i => $post ) {
$edit_link = get_edit_post_link( $post->ID );
$title = _draft_or_post_title( $post->ID );
$post_type_object = get_post_type_object( $post->post_type );
$can_edit_post = current_user_can( 'edit_post', $post->ID );
$post_status_string = $this->get_post_status_string( $post->post_status );
$actions = array();
if ( $can_edit_post && 'trash' !== $post->post_status ) {
/* translators: no need to translate, WP standard translation will be used. */
$actions['edit'] = '<a href="' . $edit_link . '" title="' . esc_attr( __( 'Edit this item' ) ) . '">';
/* translators: no need to translate, WP standard translation will be used. */
$actions['edit'] .= __( 'Edit' ) . '</a>';
}
if ( $post_type_object->public ) {
if ( in_array( $post->post_status, array( 'pending', 'draft', 'future' ), true ) ) {
if ( $can_edit_post ) {
/* translators: no need to translate, WP standard translation will be used. */
$actions['view'] = '<a href="' . esc_url( apply_filters( 'preview_post_link', set_url_scheme( add_query_arg( 'preview', 'true', get_permalink( $post->ID ) ) ) ) ) . '" title="' . esc_attr( sprintf( __( 'Preview &#8220;%s&#8221;' ), $title ) ) . '" rel="permalink">';
/* translators: no need to translate, WP standard translation will be used. */
$actions['view'] .= __( 'Preview' ) . '</a>';
}
}
elseif ( 'trash' !== $post->post_status ) {
/* translators: no need to translate, WP standard translation will be used. */
$actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View &#8220;%s&#8221;' ), $title ) ) . '" rel="permalink">';
/* translators: no need to translate, WP standard translation will be used. */
$actions['view'] .= __( 'View' ) . '</a>';
}
}
$output .= '
<tr>
<td>' . ( $i + 1 ) . '</td>
<td class="column-title"><strong>' . $title . '</strong>';
if ( ! empty( $actions ) ) {
$output .= '<div class="row-actions">' . implode( ' | ', $actions ) . '</div>';
}
$output .= '
</td>
<td>' . esc_html( $post_type_object->labels->singular_name ) . '</td>
<td>' . esc_html( $post_status_string ) . '</td>
<td>' . esc_html( get_the_author_meta( 'display_name', $post->post_author ) ) . '</td>
<td>' . $this->find_shortcode_usage( $shortcode, $post->post_content ) . '</td>
</tr>';
}
unset( $i, $post );
$output .= '
</tbody>
</table>';
$response = array(
'id' => 1,
'data' => $output,
'action' => $action,
'tr_class' => self::$name . '-uses',
);
$this->send_ajax_response( $response );
exit;
}
/**
* Translate a post status keyword to a human readable localized string.
*
* @param string $post_status The post status to translate.
*
* @return string
*/
private function get_post_status_string( $post_status ) {
switch ( $post_status ) {
case 'publish':
/* translators: no need to translate, WP standard translation will be used. */
$post_status_string = __( 'Published' );
break;
case 'future':
/* translators: no need to translate, WP standard translation will be used. */
$post_status_string = __( 'Scheduled' );
break;
case 'private':
/* translators: no need to translate, WP standard translation will be used. */
$post_status_string = __( 'Private' );
break;
case 'pending':
/* translators: no need to translate, WP standard translation will be used. */
$post_status_string = __( 'Pending Review' );
break;
case 'draft':
case 'auto-draft':
/* translators: no need to translate, WP standard translation will be used. */
$post_status_string = __( 'Draft' );
break;
case 'trash':
/* translators: no need to translate, WP standard translation will be used. */
$post_status_string = __( 'Trash' );
break;
default:
$post_status_string = __( 'Unknown', 'debug-bar-shortcodes' );
break;
}
return $post_status_string;
}
/**
* Send ajax response.
*
* @param array $response Part response in the format:
* [id] => 0 = no result, 1 = result.
* [data] => html string (can be empty if no result).
* [supplemental] => (optional) supplemental info to pass.
* [tr_class] => (optional) class for the wrapping row.
*
* @return void
*/
public function send_ajax_response( $response ) {
$tr_class = '';
if ( isset( $response['tr_class'] ) && '' !== $response['tr_class'] ) {
$tr_class = ' class="' . esc_attr( $response['tr_class'] ) . '"';
}
$data = '';
if ( '' !== $response['data'] ) {
$data = '<tr' . $tr_class . '>
<td>&nbsp;</td>
<td colspan="{colspan}">
' . $response['data'] . '
</td>
</tr>';
}
$supplemental = array();
// Only accounts for the expected new view online link, everything else will be buggered.
if ( isset( $response['supplemental'] ) && '' !== $response['supplemental'] ) {
$supplemental['url_link'] = ' | ' . $response['supplemental'];
}
/* Send the response. */
$ajax_response = new WP_Ajax_Response();
$ajax_response->add(
array(
'what' => self::$name,
'action' => $response['action'],
'id' => $response['id'],
'data' => $data,
'supplemental' => $supplemental,
)
);
$ajax_response->send();
exit;
}
/* ************** HELPER METHODS ************** */
/**
* Check if a callback is a closure.
*
* @param mixed $arg Function name.
*
* @return bool
*/
public static function is_closure( $arg ) {
if ( version_compare( PHP_VERSION, '5.3', '<' ) ) {
return false;
}
include_once plugin_dir_path( __FILE__ ) . 'php53/php5.3-closure-test.php';
return debug_bar_shortcodes_is_closure( $arg );
}
} // End of class Debug_Bar_Shortcodes_Render.
endif; // End of if class_exists wrapper.

View File

@@ -0,0 +1,145 @@
<?php
/**
* Debug Bar Shortcodes - Debug Bar Panel.
*
* @package WordPress\Plugins\Debug Bar Shortcodes
* @author Juliette Reinders Folmer <wpplugins_nospam@adviesenzo.nl>
* @link https://github.com/jrfnl/Debug-Bar-Shortcodes
* @since 1.0
* @version 2.0.3
*
* @copyright 2013-2016 Juliette Reinders Folmer
* @license http://creativecommons.org/licenses/GPL/2.0/ GNU General Public License, version 2 or higher
*/
// Avoid direct calls to this file.
if ( ! function_exists( 'add_action' ) ) {
header( 'Status: 403 Forbidden' );
header( 'HTTP/1.1 403 Forbidden' );
exit();
}
/**
* The classes in this file extend the functionality provided by the parent plugin "Debug Bar".
*/
if ( ! class_exists( 'Debug_Bar_Shortcodes' ) && class_exists( 'Debug_Bar_Panel' ) ) :
/**
* Debug Bar Shortcodes - Debug Bar Panel.
*/
class Debug_Bar_Shortcodes extends Debug_Bar_Panel {
const DBS_STYLES_VERSION = '2.0.2';
const DBS_SCRIPT_VERSION = '2.0.2';
const DBS_NAME = 'debug-bar-shortcodes';
/**
* Set up our panel.
*/
public function init() {
$this->load_textdomain( self::DBS_NAME );
$this->title( __( 'Shortcodes', 'debug-bar-shortcodes' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'dbs_enqueue_scripts' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'dbs_enqueue_scripts' ) );
}
/**
* Load the plugin text strings.
*
* Compatible with use of the plugin in the must-use plugins directory.
*
* @param string $domain Text domain to load.
*/
protected function load_textdomain( $domain ) {
if ( is_textdomain_loaded( $domain ) ) {
return;
}
$lang_path = dirname( plugin_basename( __FILE__ ) ) . '/languages';
if ( false === strpos( __FILE__, basename( WPMU_PLUGIN_DIR ) ) ) {
load_plugin_textdomain( $domain, false, $lang_path );
}
else {
load_muplugin_textdomain( $domain, $lang_path );
}
}
/**
* Enqueue our scripts and styles.
*/
public function dbs_enqueue_scripts() {
$suffix = ( ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min' );
wp_enqueue_style(
self::DBS_NAME,
plugins_url( 'css/' . self::DBS_NAME . $suffix . '.css', __FILE__ ),
array( 'debug-bar' ),
self::DBS_STYLES_VERSION
);
wp_enqueue_script(
self::DBS_NAME,
plugins_url( 'js/' . self::DBS_NAME . $suffix . '.js', __FILE__ ),
array( 'jquery', 'wp-ajax-response' ),
self::DBS_SCRIPT_VERSION,
true
);
// Reminder for js @todo jquery-effects-highlight.
wp_localize_script(
self::DBS_NAME,
'i18nDbShortcodes',
$this->dbs_get_javascript_i18n()
);
}
/**
* Retrieve the strings for use in our javascript.
*
* @return array
*/
public function dbs_get_javascript_i18n() {
$strings = array(
'ajaxurl' => admin_url( 'admin-ajax.php' ),
'hide_details' => __( 'Hide details', 'debug-bar-shortcodes' ),
'view_details' => __( 'View details', 'debug-bar-shortcodes' ),
'no_details' => __( 'No details found', 'debug-bar-shortcodes' ),
'hide_use' => __( 'Hide Uses', 'debug-bar-shortcodes' ),
'view_use' => __( 'View Uses', 'debug-bar-shortcodes' ),
'not_in_use' => __( 'Not Used', 'debug-bar-shortcodes' ),
'error' => __( 'Ajax request failed or no proper response received. If you have WP_DEBUG enabled, this might be caused by a php error. The js error console might contain more information.', 'debug-bar-shortcodes' ),
'illegal' => __( 'Illegal request received.', 'debug-bar-shortcodes' ),
'nonce' => wp_create_nonce( self::DBS_NAME ),
'spinner' => admin_url( 'images/wpspin_light.gif' ),
);
return $strings;
}
/**
* Show only if there are registered shortcodes.
*
* Unless someone de-registers the wp standard shortcodes, should always evaluate to true.
*/
public function prerender() {
$this->set_visible( is_array( $GLOBALS['shortcode_tags'] ) && ! empty( $GLOBALS['shortcode_tags'] ) );
}
/**
* Render the panel.
*/
public function render() {
$output_rendering = new Debug_Bar_Shortcodes_Render();
$output_rendering->display();
}
} // End of class Debug_Bar_Shortcodes.
endif; // End of if class_exists wrapper.

View File

@@ -0,0 +1,113 @@
/* CSS for plugin: Debug Bar Shortcodes */
#debug-menu-target-Debug_Bar_Shortcodes h3 {
font-family: georgia, times, serif;
font-size: 22px;
margin-top: 1.2em;
clear: both;
}
table#debug-bar-shortcodes {
width: 100%;
border-collapse: collapse;
cell-padding: 1em;
clear: both;
line-height: 1.5;
font-size: 12px;
table-layout: auto;
}
table#debug-bar-shortcodes thead tr,
table#debug-bar-shortcodes tfoot tr {
background-color: #E8E8E8;
}
table#debug-bar-shortcodes thead th,
table#debug-bar-shortcodes tfoot th {
padding: 0.7em 5px;
width: auto;
text-align: left;
}
table#debug-bar-shortcodes thead th {
border-bottom: 1px solid #ccc;
}
table#debug-bar-shortcodes tfoot th {
border-top: 1px solid #ccc;
}
table#debug-bar-shortcodes th {
font-weight: bold;
padding: 2px 2em 2px 5px;
vertical-align: top;
text-align: left;
}
table#debug-bar-shortcodes td {
padding: 2px 5px;
vertical-align: top;
border: 0 none;
}
/*table.debug-bar-shortcodes tr:nth-child(2n+1) {*/
table#debug-bar-shortcodes tr.even {
background-color: #E8E8E8;
}
table#debug-bar-shortcodes div.row-actions {
visibility: hidden;
}
table#debug-bar-shortcodes td.column-title .spinner {
background: no-repeat scroll 0 0 / 16px 16px rgba(0, 0, 0, 0);
visibility: hidden;
float: right;
height: 16px;
margin: 2px 5px 0;
opacity: 0.7;
width: 16px;
padding-right: 15px;
}
table#debug-bar-shortcodes td.column-title .spinner.is-active {
visibility: visible;
}
table#debug-bar-shortcodes tr.debug-bar-shortcodes-details {
display: none;
}
table#debug-bar-shortcodes td code em {
color: #999999;
}
table#debug-bar-shortcodes td ul,
table#debug-bar-shortcodes td ol {
margin: 0;
padding: 0 0 0 30px;
}
table#debug-bar-shortcodes td h4 {
font-size: 16px;
margin: 8px 0 0 0;
}
table#debug-bar-shortcodes tr.debug-bar-shortcodes-details table,
table#debug-bar-shortcodes tr.debug-bar-shortcodes-uses table {
font-size: 11px;
border-top: 1px solid #999999;
border-bottom: 1px solid #999999;
}
table#debug-bar-shortcodes tr.debug-bar-shortcodes-uses table thead th {
text-align: left;
}
table#debug-bar-shortcodes tr.debug-bar-shortcodes-details table th {
width: 110px;
}
table#debug-bar-shortcodes tr.debug-bar-shortcodes-details table th[colspan] {
width: 200px;
}
table#debug-bar-shortcodes tr.debug-bar-shortcodes-details table tr.debug-bar-shortcodes-sc-parameters {
border-top: 1px solid #999999 !important;
}

View File

@@ -0,0 +1,2 @@
/* CSS for plugin: Debug Bar Shortcodes */
#debug-menu-target-Debug_Bar_Shortcodes h3{font-family:georgia,times,serif;font-size:22px;margin-top:1.2em;clear:both}table#debug-bar-shortcodes{width:100%;border-collapse:collapse;cell-padding:1em;clear:both;line-height:1.5;font-size:12px;table-layout:auto}table#debug-bar-shortcodes thead tr,table#debug-bar-shortcodes tfoot tr{background-color:#e8e8e8}table#debug-bar-shortcodes thead th,table#debug-bar-shortcodes tfoot th{padding:.7em 5px;width:auto;text-align:left}table#debug-bar-shortcodes thead th{border-bottom:1px solid #ccc}table#debug-bar-shortcodes tfoot th{border-top:1px solid #ccc}table#debug-bar-shortcodes th{font-weight:bold;padding:2px 2em 2px 5px;vertical-align:top;text-align:left}table#debug-bar-shortcodes td{padding:2px 5px;vertical-align:top;border:0 none}table#debug-bar-shortcodes tr.even{background-color:#e8e8e8}table#debug-bar-shortcodes div.row-actions{visibility:hidden}table#debug-bar-shortcodes td.column-title .spinner{background:no-repeat scroll 0 0 / 16px 16px rgba(0,0,0,0);visibility:hidden;float:right;height:16px;margin:2px 5px 0;opacity:.7;width:16px;padding-right:15px}table#debug-bar-shortcodes td.column-title .spinner.is-active{visibility:visible}table#debug-bar-shortcodes tr.debug-bar-shortcodes-details{display:none}table#debug-bar-shortcodes td code em{color:#999}table#debug-bar-shortcodes td ul,table#debug-bar-shortcodes td ol{margin:0;padding:0 0 0 30px}table#debug-bar-shortcodes td h4{font-size:16px;margin:8px 0 0 0}table#debug-bar-shortcodes tr.debug-bar-shortcodes-details table,table#debug-bar-shortcodes tr.debug-bar-shortcodes-uses table{font-size:11px;border-top:1px solid #999;border-bottom:1px solid #999}table#debug-bar-shortcodes tr.debug-bar-shortcodes-uses table thead th{text-align:left}table#debug-bar-shortcodes tr.debug-bar-shortcodes-details table th{width:110px}table#debug-bar-shortcodes tr.debug-bar-shortcodes-details table th[colspan]{width:200px}table#debug-bar-shortcodes tr.debug-bar-shortcodes-details table tr.debug-bar-shortcodes-sc-parameters{border-top:1px solid #999 !important}

View File

@@ -0,0 +1,2 @@
<?php
// Nothing to see here.

View File

@@ -0,0 +1,171 @@
<?php
/**
* Debug Bar Shortcodes, a WordPress plugin.
*
* @package WordPress\Plugins\Debug Bar Shortcodes
* @author Juliette Reinders Folmer <wpplugins_nospam@adviesenzo.nl>
* @link https://github.com/jrfnl/Debug-Bar-Shortcodes
* @since 1.0
* @version 2.0.3
*
* @copyright 2013-2016 Juliette Reinders Folmer
* @license http://creativecommons.org/licenses/GPL/2.0/ GNU General Public License, version 2 or higher
*
* @wordpress-plugin
* Plugin Name: Debug Bar Shortcodes
* Plugin URI: https://wordpress.org/plugins/debug-bar-shortcodes/
* Description: Debug Bar Shortcodes adds a new panel to Debug Bar that displays all the registered shortcodes for the current request. Requires "Debug Bar" plugin.
* Version: 2.0.3
* Author: Juliette Reinders Folmer
* Author URI: http://www.adviesenzo.nl/
* Depends: Debug Bar
* Text Domain: debug-bar-shortcodes
* Domain Path: /languages/
* Copyright: 2013-2016 Juliette Reinders Folmer
*/
// Avoid direct calls to this file.
if ( ! function_exists( 'add_action' ) ) {
header( 'Status: 403 Forbidden' );
header( 'HTTP/1.1 403 Forbidden' );
exit();
}
if ( ! function_exists( 'debug_bar_shortcodes_has_parent_plugin' ) ) {
/**
* Show admin notice & de-activate if debug-bar plugin not active.
*/
function debug_bar_shortcodes_has_parent_plugin() {
if ( is_admin() && ( ! class_exists( 'Debug_Bar' ) && current_user_can( 'activate_plugins' ) ) ) {
add_action( 'admin_notices', create_function( null, 'echo \'<div class="error"><p>\' . sprintf( __( \'Activation failed: Debug Bar must be activated to use the <strong>Debug Bar Shortcodes</strong> Plugin. %sVisit your plugins page to activate.\', \'debug-bar-shortcodes\' ), \'<a href="\' . admin_url( \'plugins.php#debug-bar\' ) . \'">\' ) . \'</a></p></div>\';' ) );
deactivate_plugins( plugin_basename( __FILE__ ) );
if ( isset( $_GET['activate'] ) ) {
unset( $_GET['activate'] );
}
}
}
add_action( 'admin_init', 'debug_bar_shortcodes_has_parent_plugin' );
}
if ( ! function_exists( 'debug_bar_shortcodes_autoload' ) ) {
/**
* Auto load our class files.
*
* @param string $class Class name.
*
* @return void
*/
function debug_bar_shortcodes_autoload( $class ) {
static $classes = null;
if ( null === $classes ) {
$classes = array(
'debug_bar_shortcodes' => 'class-debug-bar-shortcodes.php',
'debug_bar_shortcodes_render' => 'class-debug-bar-shortcodes-render.php',
'debug_bar_shortcode_info' => 'shortcode-info/class-shortcode-info.php',
'debug_bar_shortcode_info_defaults' => 'shortcode-info/class-shortcode-info-defaults.php',
'debug_bar_shortcode_info_audio' => 'shortcode-info/class-shortcode-info-audio.php',
'debug_bar_shortcode_info_caption' => 'shortcode-info/class-shortcode-info-caption.php',
'debug_bar_shortcode_info_embed' => 'shortcode-info/class-shortcode-info-embed.php',
'debug_bar_shortcode_info_gallery' => 'shortcode-info/class-shortcode-info-gallery.php',
'debug_bar_shortcode_info_playlist' => 'shortcode-info/class-shortcode-info-playlist.php',
'debug_bar_shortcode_info_video' => 'shortcode-info/class-shortcode-info-video.php',
'debug_bar_shortcode_info_wp_caption' => 'shortcode-info/class-shortcode-info-wp-caption.php',
'debug_bar_shortcode_info_lhr' => 'shortcode-info/class-shortcode-info-lhr.php',
'debug_bar_shortcode_info_reflection' => 'shortcode-info/class-shortcode-info-reflection.php',
'debug_bar_shortcode_info_from_file' => 'shortcode-info/class-shortcode-info-from-file.php',
'debug_bar_shortcode_info_shortcake' => 'shortcode-info/class-shortcode-info-shortcake.php',
'debug_bar_shortcode_info_validator' => 'shortcode-info/class-shortcode-info-validator.php',
);
}
$classname = strtolower( $class );
if ( isset( $classes[ $classname ] ) ) {
include_once plugin_dir_path( __FILE__ ) . $classes[ $classname ];
}
}
spl_autoload_register( 'debug_bar_shortcodes_autoload' );
}
if ( ! function_exists( 'debug_bar_shortcodes_panel' ) ) {
/**
* Add the Debug Bar Shortcodes panel to the Debug Bar.
*
* @param array $panels Existing debug bar panels.
*
* @return array
*/
function debug_bar_shortcodes_panel( $panels ) {
$panels[] = new Debug_Bar_Shortcodes();
return $panels;
}
add_filter( 'debug_bar_panels', 'debug_bar_shortcodes_panel' );
}
if ( ! function_exists( 'debug_bar_shortcodes_ajax' ) ) {
/**
* Verify validity of ajax request and pass it to the internal handler.
*/
function debug_bar_shortcodes_do_ajax() {
// Verify this is a valid ajax request.
if ( ! isset( $_POST['dbs-nonce'] ) || false === wp_verify_nonce( $_POST['dbs-nonce'], 'debug-bar-shortcodes' ) ) {
exit( '-1' );
}
// Verify we have received the data needed to do anything.
if ( ! isset( $_POST['shortcode'] ) || '' === trim( wp_unslash( $_POST['shortcode'] ) ) ) {
exit( '-1' );
}
$output_rendering = new Debug_Bar_Shortcodes_Render();
$shortcode = trim( wp_unslash( $_POST['shortcode'] ) );
$action = trim( wp_unslash( $_POST['action'] ) );
// Exit early if this is a non-existent shortcode - shouldn't happen, but hack knows ;-).
if ( false === shortcode_exists( $shortcode ) ) {
$response = array(
'id' => 0,
'data' => '',
'action' => $action,
);
$output_rendering->send_ajax_response( $response );
exit;
}
// Send the request to our handler.
switch ( $action ) {
case 'debug-bar-shortcodes-find':
$output_rendering->ajax_find_shortcode_uses( $shortcode, $action );
break;
case 'debug-bar-shortcodes-retrieve':
$output_rendering->ajax_retrieve_details( $shortcode, $action );
break;
default:
// Intentionally empty.
break;
}
/*
No valid action received (redundancy, can't really happen as WP wouldn't then call this
function, but would return 0 and exit already.
*/
exit( '-1' );
}
/* Add our ajax actions. */
add_action( 'wp_ajax_debug-bar-shortcodes-find', 'debug_bar_shortcodes_do_ajax' );
add_action( 'wp_ajax_debug-bar-shortcodes-retrieve', 'debug_bar_shortcodes_do_ajax' );
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 753 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 760 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 761 B

View File

@@ -0,0 +1,2 @@
<?php
// Nothing to see here.

View File

@@ -0,0 +1,2 @@
<?php
// Nothing to see here.

View File

@@ -0,0 +1,215 @@
jQuery( document ).ready( function() {
var dbsTable = jQuery( '#debug-bar-shortcodes' );
/* Make sure the spinner also works in the front-end */
dbsTable.find( 'span.spinner' ).css({ 'background-image': 'url("' + i18nDbShortcodes.spinner + '")' });
/* Show/hide action links */
/* @todo Keep the action links visible on associated debug-bar-shortcodes-details and
debug-bar-shortcodes-uses rows */
dbsTable.on( 'mouseenter.dbs-action-links', 'tr', function() {
jQuery( this ).find( 'div.row-actions' ).css({ 'visibility': 'visible' });
})
.on( 'mouseleave.dbs-action-links', 'tr', function() {
jQuery( this ).find( 'div.row-actions' ).css({ 'visibility': 'hidden' });
});
/* Show/hide details */
dbsTable.on( 'click', 'a.debug-bar-shortcodes-view-details', function( event ) {
var targetTr = jQuery( this ).closest( 'tr' ).next( 'tr.debug-bar-shortcodes-details' );
event.preventDefault();
if ( jQuery( this ).text() === i18nDbShortcodes.view_details ) {
targetTr.show();
jQuery( this ).text( i18nDbShortcodes.hide_details );
}
else {
targetTr.hide();
jQuery( this ).text( i18nDbShortcodes.view_details );
}
});
/* Show/hide group of found uses */
dbsTable.on( 'click', 'a.debug-bar-shortcodes-view-use', function( event ) {
var targetTr;
event.preventDefault();
targetTr = jQuery( this ).closest( 'tr' ).next( 'tr' );
if ( targetTr.hasClass( 'debug-bar-shortcodes-details' ) ) {
targetTr = targetTr.next( 'tr' );
}
if ( targetTr.hasClass( 'debug-bar-shortcodes-uses' ) ) {
if ( jQuery( this ).text() === i18nDbShortcodes.view_use ) {
targetTr.show();
jQuery( this ).text( i18nDbShortcodes.hide_use );
}
else {
targetTr.hide();
jQuery( this ).text( i18nDbShortcodes.view_use );
}
}
});
/* Retrieve & show details if there were none */
dbsTable.on( 'click', 'a.debug-bar-shortcodes-get-details', function( event ) {
var eventTarget, targetShortcode, spinner;
event.preventDefault();
eventTarget = jQuery( this );
targetShortcode = this.hash.substring( 1 );
spinner = eventTarget.closest( 'td.column-title' ).find( 'span.spinner' );
spinner.addClass( 'is-active' );
jQuery.ajax({
url: ( ajaxurl ) ? ajaxurl : i18nDbShortcodes.ajaxurl,
type: 'post',
data: {
'action': 'debug-bar-shortcodes-retrieve',
'dbs-nonce': i18nDbShortcodes.nonce,
'shortcode': targetShortcode
},
success: function( response ) {
var resData, nrOfColumns, supplemental;
// Handle errors
// -1 is nonce error, no proper response received
// 0 no wp ajax action hook found for this action
if ( 'string' === typeof( response ) ) {
// Remove all retrieve details links to prevent user trying it again.
jQuery( 'a.debug-bar-shortcodes-get-details' ).remove();
alert( i18nDbShortcodes.illegal );
}
else {
resData = wpAjax.parseAjaxResponse( response, 'ajax-response' );
if ( ! resData.responses || 1 > resData.responses.length || resData.errors ) {
// Didn't receive a proper response or received a WP error response
console.log( 'Received response: ' + response );
alert( i18nDbShortcodes.error );
}
else if ( '1' !== resData.responses[0].id || ! resData.responses[0].data || 0 === resData.responses[0].data.length ) {
// No info found
/* @todo Usability: row actions are hidden on mouseleave, so this feedback may not be seen
figure out a way to make this easier to see
(make row actions visible & highlight kind of thing, but is not so easy to do */
eventTarget.replaceWith( i18nDbShortcodes.no_details );
}
else {
// Found some ;-)
nrOfColumns = ( eventTarget.closest( 'tr' ).find( 'td' ).length - 1 );
resData = resData.responses[0];
supplemental = resData.supplemental;
resData = resData.data;
resData = resData.replace( /\{colspan\}/g, nrOfColumns );
if ( eventTarget.closest( 'tr' ).hasClass( 'even' ) ) {
resData = jQuery( resData ).addClass( 'even' );
}
eventTarget.closest( 'tr' ).after( resData );
eventTarget.text( i18nDbShortcodes.view_details )
.removeClass( 'debug-bar-shortcodes-get-details' )
.addClass( 'debug-bar-shortcodes-view-details' ).click();
if ( supplemental.url_link ) {
eventTarget.closest( 'div.row-actions' ).append( supplemental.url_link );
}
}
}
spinner.removeClass( 'is-active' );
},
error: handleAjaxError
});
});
/* Find all uses of the shortcodes */
dbsTable.on( 'click', 'a.debug-bar-shortcodes-find', function( event ) {
var eventTarget, targetShortcode, spinner;
event.preventDefault();
eventTarget = jQuery( this );
targetShortcode = this.hash.substring( 1 );
spinner = eventTarget.closest( 'td.column-title' ).find( 'span.spinner' );
spinner.addClass( 'is-active' );
jQuery.ajax({
url: ( ajaxurl ) ? ajaxurl : i18nDbShortcodes.ajaxurl,
type: 'post',
data: {
'action': 'debug-bar-shortcodes-find',
'dbs-nonce': i18nDbShortcodes.nonce,
'shortcode': targetShortcode
},
success: function( response ) {
var resData, nrOfColumns, nextTr;
// Handle errors
// -1 is nonce error, no proper response received
// 0 no wp ajax action hook found for this action
if ( 'string' === typeof( response ) ) {
// Remove all find links to prevent user trying it again.
jQuery( 'a.debug-bar-shortcodes-find' ).remove();
alert( i18nDbShortcodes.illegal );
}
else {
resData = wpAjax.parseAjaxResponse( response, 'ajax-response' );
if ( ! resData.responses || 1 > resData.responses.length || resData.errors ) {
// Didn't receive a proper response or received a WP error response
console.log( 'Received response: ' + response );
alert( i18nDbShortcodes.error );
}
else if ( '1' !== resData.responses[0].id || ! resData.responses[0].data || 0 === resData.responses[0].data.length ) {
// No uses found
/* @todo Usability: row actions are hidden on mouseleave, so this feedback may not be seen
figure out a way to make this easier to see
(make row actions visible & highlight kind of thing, but is not so easy to do */
eventTarget.replaceWith( i18nDbShortcodes.not_in_use );
}
else {
// Found some ;-)
nrOfColumns = ( eventTarget.closest( 'tr' ).find( 'td' ).length - 1 );
resData = resData.responses[0];
resData = resData.data;
resData = resData.replace( /\{colspan\}/g, nrOfColumns );
nextTr = eventTarget.closest( 'tr' ).next( 'tr' );
if ( nextTr.hasClass( 'debug-bar-shortcodes-details' ) ) {
nextTr = nextTr.next( 'tr' );
}
if ( eventTarget.closest( 'tr' ).hasClass( 'even' ) ) {
resData = jQuery( resData ).addClass( 'even' );
}
nextTr.before( resData );
eventTarget.text( i18nDbShortcodes.hide_use )
.removeClass( 'debug-bar-shortcodes-find' )
.addClass( 'debug-bar-shortcodes-view-use' );
}
}
spinner.removeClass( 'is-active' );
},
error: handleAjaxError
});
});
function handleAjaxError( response ) {
/* Triggered by http errors and by various jQuery errors such as:
- 'junk after document element'
- 'not well-formed'
- 'undefined entity'
*/
if ( 'undefined' !== typeof( response ) ) {
console.log( 'Received response: ' + response );
}
dbsTable.find( 'span.spinner' ).removeClass( 'is-active' );
alert( i18nDbShortcodes.error );
}
});

View File

@@ -0,0 +1 @@
jQuery(document).ready(function(){var dbsTable=jQuery("#debug-bar-shortcodes");dbsTable.find("span.spinner").css({"background-image":'url("'+i18nDbShortcodes.spinner+'")'});dbsTable.on("mouseenter.dbs-action-links","tr",function(){jQuery(this).find("div.row-actions").css({"visibility":"visible"})}).on("mouseleave.dbs-action-links","tr",function(){jQuery(this).find("div.row-actions").css({"visibility":"hidden"})});dbsTable.on("click","a.debug-bar-shortcodes-view-details",function(event){var targetTr=jQuery(this).closest("tr").next("tr.debug-bar-shortcodes-details");event.preventDefault();if(jQuery(this).text()===i18nDbShortcodes.view_details){targetTr.show();jQuery(this).text(i18nDbShortcodes.hide_details)}else{targetTr.hide();jQuery(this).text(i18nDbShortcodes.view_details)}});dbsTable.on("click","a.debug-bar-shortcodes-view-use",function(event){var targetTr;event.preventDefault();targetTr=jQuery(this).closest("tr").next("tr");if(targetTr.hasClass("debug-bar-shortcodes-details")){targetTr=targetTr.next("tr")}if(targetTr.hasClass("debug-bar-shortcodes-uses")){if(jQuery(this).text()===i18nDbShortcodes.view_use){targetTr.show();jQuery(this).text(i18nDbShortcodes.hide_use)}else{targetTr.hide();jQuery(this).text(i18nDbShortcodes.view_use)}}});dbsTable.on("click","a.debug-bar-shortcodes-get-details",function(event){var eventTarget,targetShortcode,spinner;event.preventDefault();eventTarget=jQuery(this);targetShortcode=this.hash.substring(1);spinner=eventTarget.closest("td.column-title").find("span.spinner");spinner.addClass("is-active");jQuery.ajax({url:(ajaxurl)?ajaxurl:i18nDbShortcodes.ajaxurl,type:"post",data:{"action":"debug-bar-shortcodes-retrieve","dbs-nonce":i18nDbShortcodes.nonce,"shortcode":targetShortcode},success:function(response){var resData,nrOfColumns,supplemental;if("string"===typeof(response)){jQuery("a.debug-bar-shortcodes-get-details").remove();alert(i18nDbShortcodes.illegal)}else{resData=wpAjax.parseAjaxResponse(response,"ajax-response");if(!resData.responses||1>resData.responses.length||resData.errors){console.log("Received response: "+response);alert(i18nDbShortcodes.error)}else{if("1"!==resData.responses[0].id||!resData.responses[0].data||0===resData.responses[0].data.length){eventTarget.replaceWith(i18nDbShortcodes.no_details)}else{nrOfColumns=(eventTarget.closest("tr").find("td").length-1);resData=resData.responses[0];supplemental=resData.supplemental;resData=resData.data;resData=resData.replace(/\{colspan\}/g,nrOfColumns);if(eventTarget.closest("tr").hasClass("even")){resData=jQuery(resData).addClass("even")}eventTarget.closest("tr").after(resData);eventTarget.text(i18nDbShortcodes.view_details).removeClass("debug-bar-shortcodes-get-details").addClass("debug-bar-shortcodes-view-details").click();if(supplemental.url_link){eventTarget.closest("div.row-actions").append(supplemental.url_link)}}}}spinner.removeClass("is-active")},error:handleAjaxError})});dbsTable.on("click","a.debug-bar-shortcodes-find",function(event){var eventTarget,targetShortcode,spinner;event.preventDefault();eventTarget=jQuery(this);targetShortcode=this.hash.substring(1);spinner=eventTarget.closest("td.column-title").find("span.spinner");spinner.addClass("is-active");jQuery.ajax({url:(ajaxurl)?ajaxurl:i18nDbShortcodes.ajaxurl,type:"post",data:{"action":"debug-bar-shortcodes-find","dbs-nonce":i18nDbShortcodes.nonce,"shortcode":targetShortcode},success:function(response){var resData,nrOfColumns,nextTr;if("string"===typeof(response)){jQuery("a.debug-bar-shortcodes-find").remove();alert(i18nDbShortcodes.illegal)}else{resData=wpAjax.parseAjaxResponse(response,"ajax-response");if(!resData.responses||1>resData.responses.length||resData.errors){console.log("Received response: "+response);alert(i18nDbShortcodes.error)}else{if("1"!==resData.responses[0].id||!resData.responses[0].data||0===resData.responses[0].data.length){eventTarget.replaceWith(i18nDbShortcodes.not_in_use)}else{nrOfColumns=(eventTarget.closest("tr").find("td").length-1);resData=resData.responses[0];resData=resData.data;resData=resData.replace(/\{colspan\}/g,nrOfColumns);nextTr=eventTarget.closest("tr").next("tr");if(nextTr.hasClass("debug-bar-shortcodes-details")){nextTr=nextTr.next("tr")}if(eventTarget.closest("tr").hasClass("even")){resData=jQuery(resData).addClass("even")}nextTr.before(resData);eventTarget.text(i18nDbShortcodes.hide_use).removeClass("debug-bar-shortcodes-find").addClass("debug-bar-shortcodes-view-use")}}}spinner.removeClass("is-active")},error:handleAjaxError})});function handleAjaxError(response){if("undefined"!==typeof(response)){console.log("Received response: "+response)}dbsTable.find("span.spinner").removeClass("is-active");alert(i18nDbShortcodes.error)}});

View File

@@ -0,0 +1,2 @@
<?php
// Nothing to see here.

View File

@@ -0,0 +1,590 @@
msgid ""
msgstr ""
"Project-Id-Version: Debug Bar Shortcodes - a WordPress Plugin\n"
"POT-Creation-Date: 2016-04-29 09:16+0200\n"
"PO-Revision-Date: 2016-04-29 09:17+0200\n"
"Last-Translator: Juliette Reinders Folmer <wpplugins_nospam@adviesenzo.nl>\n"
"Language-Team: Juliette Reinders Folmer <wpplugins_nospam@adviesenzo.nl>\n"
"Language: nl_NL\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.8.7\n"
"X-Poedit-KeywordsList: __;esc_html__;esc_html_e;esc_attr__;esc_attr_e;_e\n"
"X-Poedit-Basepath: .\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Poedit-SourceCharset: UTF-8\n"
"X-Poedit-SearchPath-0: .\n"
"X-Poedit-SearchPath-1: ..\n"
"X-Poedit-SearchPathExcluded-0: *.js\n"
#: class-debug-bar-shortcodes-render.php:58
msgid "Total Registered Shortcodes:"
msgstr "Totaal geregistreerde Shortcodes:"
#: class-debug-bar-shortcodes-render.php:97
msgid "Shortcode is used"
msgstr "Shortcode wordt gebruikt"
#: class-debug-bar-shortcodes-render.php:97
msgid "Shortcode not used"
msgstr "Shortcode wordt niet gebruikt"
#: class-debug-bar-shortcodes-render.php:126
msgid "No shortcodes found."
msgstr "Geen shortcodes gevonden."
#: class-debug-bar-shortcodes-render.php:143
msgid "Shortcode"
msgstr "Shortcode"
#: class-debug-bar-shortcodes-render.php:144
msgid "Rendered by"
msgstr "Callback functie"
#: class-debug-bar-shortcodes-render.php:148
msgid "In use?"
msgstr "In gebruik?"
#: class-debug-bar-shortcodes-render.php:149
msgid "Usage"
msgstr "Gebruik"
#: class-debug-bar-shortcodes-render.php:171
msgid "View more detailed information about the shortcode."
msgstr "Bekijk meer gedetailleerde informatie over deze shortcode."
#: class-debug-bar-shortcodes-render.php:171 class-debug-bar-shortcodes.php:112
msgid "View details"
msgstr "Bekijk details"
#: class-debug-bar-shortcodes-render.php:174
msgid "Try and retrieve more detailed information about the shortcode."
msgstr ""
"Probeer meer gedetailleerde informatie over deze shortcode op te halen."
#: class-debug-bar-shortcodes-render.php:174
msgid "Retrieve details"
msgstr "Haal details op"
#: class-debug-bar-shortcodes-render.php:177
msgid "Find out where this shortcode is used (if at all)"
msgstr "Vind uit waar deze shortcode gebruikt wordt (als überhaupt)"
#: class-debug-bar-shortcodes-render.php:177
msgid "Find uses"
msgstr "Vind gebruik"
#: class-debug-bar-shortcodes-render.php:197
msgid "View extended info about the shortcode on the web"
msgstr "Bekijk uitgebreidere informatie over de shortcode op het web"
#: class-debug-bar-shortcodes-render.php:197
msgid "View online"
msgstr "Bekijk online"
#: class-debug-bar-shortcodes-render.php:312
msgid "Not found"
msgstr "Niet gevonden"
#: class-debug-bar-shortcodes-render.php:425
msgid "Name"
msgstr "Naam"
#: class-debug-bar-shortcodes-render.php:434
msgid "Description"
msgstr "Omschrijving"
#: class-debug-bar-shortcodes-render.php:446
msgid "Info Url"
msgstr "Info Url"
#: class-debug-bar-shortcodes-render.php:456
msgid "Required parameters"
msgstr "Verplichte parameters"
#: class-debug-bar-shortcodes-render.php:465
msgid "Optional parameters"
msgstr "Optionele parameters"
#: class-debug-bar-shortcodes-render.php:476
msgid "Shortcode details"
msgstr "Shortcode details"
#: class-debug-bar-shortcodes-render.php:495
msgid "Syntax"
msgstr "Syntax"
#: class-debug-bar-shortcodes-render.php:508
#: class-debug-bar-shortcodes-render.php:755
msgid "Unknown"
msgstr "Onbekend"
#: class-debug-bar-shortcodes-render.php:630
msgid "Shortcode found in the following posts/pages/etc:"
msgstr "Shortcode gevonden in de volgende berichten/pagina's/etc:"
#: class-debug-bar-shortcodes-render.php:635
msgid "Title"
msgstr "Titel"
#: class-debug-bar-shortcodes-render.php:636
msgid "Post Type"
msgstr "Post Type"
#: class-debug-bar-shortcodes-render.php:637
msgid "Status"
msgstr "Status"
#: class-debug-bar-shortcodes-render.php:638
msgid "Author"
msgstr "Auteur"
#: class-debug-bar-shortcodes-render.php:639
msgid "Shortcode usage(s)"
msgstr "Gevonden gebruik"
#. translators: no need to translate, WP standard translation will be used.
#: class-debug-bar-shortcodes-render.php:655
msgid "Edit this item"
msgstr ""
#. translators: no need to translate, WP standard translation will be used.
#: class-debug-bar-shortcodes-render.php:657
msgid "Edit"
msgstr ""
#. translators: no need to translate, WP standard translation will be used.
#: class-debug-bar-shortcodes-render.php:663
#, php-format
msgid "Preview &#8220;%s&#8221;"
msgstr ""
#. translators: no need to translate, WP standard translation will be used.
#: class-debug-bar-shortcodes-render.php:666
msgid "Preview"
msgstr ""
#. translators: no need to translate, WP standard translation will be used.
#: class-debug-bar-shortcodes-render.php:672
#, php-format
msgid "View &#8220;%s&#8221;"
msgstr ""
#. translators: no need to translate, WP standard translation will be used.
#: class-debug-bar-shortcodes-render.php:674
msgid "View"
msgstr ""
#. translators: no need to translate, WP standard translation will be used.
#: class-debug-bar-shortcodes-render.php:725
msgid "Published"
msgstr ""
#. translators: no need to translate, WP standard translation will be used.
#: class-debug-bar-shortcodes-render.php:730
msgid "Scheduled"
msgstr ""
#. translators: no need to translate, WP standard translation will be used.
#: class-debug-bar-shortcodes-render.php:735
msgid "Private"
msgstr ""
#. translators: no need to translate, WP standard translation will be used.
#: class-debug-bar-shortcodes-render.php:740
msgid "Pending Review"
msgstr ""
#. translators: no need to translate, WP standard translation will be used.
#: class-debug-bar-shortcodes-render.php:746
msgid "Draft"
msgstr ""
#. translators: no need to translate, WP standard translation will be used.
#: class-debug-bar-shortcodes-render.php:751
msgid "Trash"
msgstr ""
#: class-debug-bar-shortcodes.php:45
msgid "Shortcodes"
msgstr "Shortcodes"
#: class-debug-bar-shortcodes.php:111
msgid "Hide details"
msgstr "Verberg details"
#: class-debug-bar-shortcodes.php:113
msgid "No details found"
msgstr "Geen details gevonden"
#: class-debug-bar-shortcodes.php:114
msgid "Hide Uses"
msgstr "Verberg gebruik"
#: class-debug-bar-shortcodes.php:115
msgid "View Uses"
msgstr "Bekijk gebruik"
#: class-debug-bar-shortcodes.php:116
msgid "Not Used"
msgstr "Niet in gebruik"
#: class-debug-bar-shortcodes.php:117
msgid ""
"Ajax request failed or no proper response received. If you have WP_DEBUG "
"enabled, this might be caused by a php error. The js error console might "
"contain more information."
msgstr ""
#: class-debug-bar-shortcodes.php:118
msgid "Illegal request received."
msgstr "Illegaal verzoek ontvangen."
#: shortcode-info/class-shortcode-info-audio.php:41
msgid "Audio Media"
msgstr ""
#: shortcode-info/class-shortcode-info-audio.php:42
msgid ""
"The Audio feature allows you to embed audio files and play them back. This "
"was added as of WordPress 3.6."
msgstr ""
#. translators: %s = file format.
#: shortcode-info/class-shortcode-info-audio.php:45
#, php-format
msgid "Source of %s fallback file"
msgstr ""
#: shortcode-info/class-shortcode-info-audio.php:48
msgid ""
"The source of your audio file. If not included it will auto-populate with "
"the first audio file attached to the post."
msgstr ""
#: shortcode-info/class-shortcode-info-audio.php:54
msgid "Allows for the looping of media. Defaults to \"off\"."
msgstr ""
#: shortcode-info/class-shortcode-info-audio.php:55
#: shortcode-info/class-shortcode-info-video.php:65
msgid ""
"Causes the media to automatically play as soon as the media file is ready. "
"Defaults to \"off\"."
msgstr ""
#: shortcode-info/class-shortcode-info-audio.php:56
msgid ""
"Specifies if and how the audio should be loaded when the page loads. "
"Defaults to \"none\"."
msgstr ""
#: shortcode-info/class-shortcode-info-caption.php:41
msgid "Wrap captions around content"
msgstr ""
#: shortcode-info/class-shortcode-info-caption.php:42
msgid ""
"The Caption feature allows you to wrap captions around content. This is "
"primarily used with individual images."
msgstr ""
#: shortcode-info/class-shortcode-info-caption.php:45
msgid "The actual text of your caption."
msgstr ""
#: shortcode-info/class-shortcode-info-caption.php:46
msgid "How wide the caption should be in pixels."
msgstr ""
#: shortcode-info/class-shortcode-info-caption.php:50
msgid "A unique HTML ID that you can change to use within your CSS."
msgstr ""
#: shortcode-info/class-shortcode-info-caption.php:51
msgid ""
"The alignment of the caption within the post. Valid values are: alignnone "
"(default), aligncenter, alignright, and alignleft."
msgstr ""
#: shortcode-info/class-shortcode-info-embed.php:41
msgid "Embed videos, images, and other content"
msgstr ""
#: shortcode-info/class-shortcode-info-embed.php:42
msgid ""
"You can opt to wrap a URL in the [embed] shortcode. It will accomplish the "
"same effect as having it on a line of it's own, but does not require the "
"\"Auto-embeds\" setting to be enabled. It also allows you to set a maximum "
"(but not fixed) width and height.If WordPress fails to embed your URL you "
"will get a hyperlink to the URL."
msgstr ""
#. translators: %s = height/weight.
#: shortcode-info/class-shortcode-info-embed.php:45
#, php-format
msgid "Maximum %s for the embedded object."
msgstr ""
#: shortcode-info/class-shortcode-info-embed.php:48
#: shortcode-info/class-shortcode-info-video.php:48
msgid "height"
msgstr "hoogte"
#: shortcode-info/class-shortcode-info-embed.php:49
#: shortcode-info/class-shortcode-info-video.php:49
msgid "width"
msgstr "breedte"
#: shortcode-info/class-shortcode-info-gallery.php:41
msgid "Image Gallery"
msgstr ""
#: shortcode-info/class-shortcode-info-gallery.php:42
msgid ""
"The Gallery feature allows you to add one or more image galleries to your "
"posts and pages."
msgstr ""
#: shortcode-info/class-shortcode-info-gallery.php:45
msgid ""
"Specify how to sort the display thumbnails. The default is \"menu_order\"."
msgstr ""
#: shortcode-info/class-shortcode-info-gallery.php:46
msgid "Specify the sort order used to display thumbnails. ASC or DESC."
msgstr ""
#: shortcode-info/class-shortcode-info-gallery.php:47
msgid ""
"Specify the number of columns. The gallery will include a break tag at the "
"end of each row, and calculate the column width as appropriate. The default "
"value is 3. If columns is set to 0, no row breaks will be included."
msgstr ""
#: shortcode-info/class-shortcode-info-gallery.php:48
msgid ""
"Specify the post ID. The gallery will display images which are attached to "
"that post. The default behavior, if no ID is specified, is to display images "
"attached to the current post."
msgstr ""
#: shortcode-info/class-shortcode-info-gallery.php:49
msgid ""
"specify the image size to use for the thumbnail display. Valid values "
"include \"thumbnail\", \"medium\", \"large\", \"full\". The default value is "
"\"thumbnail\"."
msgstr ""
#: shortcode-info/class-shortcode-info-gallery.php:50
msgid ""
"The name of the XHTML tag used to enclose each item in the gallery. The "
"default is \"dl\"."
msgstr ""
#: shortcode-info/class-shortcode-info-gallery.php:51
msgid ""
"The name of the XHTML tag used to enclose each thumbnail icon in the "
"gallery. The default is \"dt\"."
msgstr ""
#: shortcode-info/class-shortcode-info-gallery.php:52
msgid ""
"The name of the XHTML tag used to enclose each caption. The default is \"dd"
"\"."
msgstr ""
#: shortcode-info/class-shortcode-info-gallery.php:53
msgid ""
"You can set it to \"file\" so each image will link to the image file. The "
"default value links to the attachment's permalink."
msgstr ""
#: shortcode-info/class-shortcode-info-gallery.php:54
msgid ""
"Comma separated attachment IDs to show only the images from these "
"attachments. "
msgstr ""
#: shortcode-info/class-shortcode-info-gallery.php:55
msgid ""
"Comma separated attachment IDs excludes the images from these attachments. "
"Please note that include and exclude cannot be used together."
msgstr ""
#: shortcode-info/class-shortcode-info-lhr.php:50
msgid "No information available"
msgstr "Geen informatie beschikbaar"
#: shortcode-info/class-shortcode-info-playlist.php:41
msgid "Media Playlist"
msgstr ""
#: shortcode-info/class-shortcode-info-playlist.php:42
msgid ""
"The playlist shortcode implements the functionality of displaying a "
"collection of WordPress audio or video files in a post using a simple "
"Shortcode."
msgstr ""
#: shortcode-info/class-shortcode-info-playlist.php:45
msgid ""
"Type of playlist to display. Accepts \"audio\" or \"video\". Defaults to "
"\"audio\"."
msgstr ""
#: shortcode-info/class-shortcode-info-playlist.php:46
msgid ""
"Designates ascending or descending order of items in the playlist. Accepts "
"\"ASC\", \"DESC\". Defaults to \"ASC\"."
msgstr ""
#: shortcode-info/class-shortcode-info-playlist.php:47
msgid ""
"Any column, or columns, to sort the playlist by. Accepts \"rand\" to play "
"the list in random order. Defaults to \"menu_order ID\". If `$ids` are "
"passed, this defaults to the order of the $ids array ('post__in')."
msgstr ""
#: shortcode-info/class-shortcode-info-playlist.php:48
msgid ""
"If an explicit `$ids` array is not present, this parameter will determine "
"which attachments are used for the playlist. Defaults to the current post ID."
msgstr ""
#: shortcode-info/class-shortcode-info-playlist.php:49
msgid ""
"Create a playlist out of these explicit attachment IDs. If empty, a playlist "
"will be created from all `$type` attachments of `$id`."
msgstr ""
#: shortcode-info/class-shortcode-info-playlist.php:50
msgid "List of specific attachment IDs to exclude from the playlist."
msgstr ""
#: shortcode-info/class-shortcode-info-playlist.php:51
msgid ""
"Playlist style to use. Accepts \"light\" or \"dark\". Defaults to \"light\"."
msgstr ""
#: shortcode-info/class-shortcode-info-playlist.php:52
msgid "Whether to show or hide the playlist. Defaults to (bool) true."
msgstr ""
#: shortcode-info/class-shortcode-info-playlist.php:53
msgid ""
"Whether to show or hide the numbers next to entries in the playlist. "
"Defaults to (bool) true."
msgstr ""
#: shortcode-info/class-shortcode-info-playlist.php:54
msgid ""
"Show or hide the video or audio thumbnail (Featured Image/post thumbnail). "
"Defaults to (bool) true."
msgstr ""
#: shortcode-info/class-shortcode-info-playlist.php:55
msgid ""
"Whether to show or hide artist name in the playlist. Defaults to (bool) true."
msgstr ""
#: shortcode-info/class-shortcode-info-video.php:41
msgid "Video Media"
msgstr ""
#: shortcode-info/class-shortcode-info-video.php:42
msgid ""
"The Video feature allows you to embed video files and play them back. This "
"was added as of WordPress 3.6."
msgstr ""
#. translators: %s = height/weight.
#: shortcode-info/class-shortcode-info-video.php:45
#, php-format
msgid ""
"Defines %s of the media. Value is automatically detected on file upload."
msgstr ""
#. translators: %s = file extension.
#: shortcode-info/class-shortcode-info-video.php:53
#, php-format
msgid "Source of %s fallback file."
msgstr ""
#: shortcode-info/class-shortcode-info-video.php:56
msgid ""
"The source of your video file. If not included it will auto-populate with "
"the first video file attached to the post."
msgstr ""
#: shortcode-info/class-shortcode-info-video.php:63
msgid ""
"Defines image to show as placeholder before the media plays. Defaults to "
"\"none\"."
msgstr ""
#: shortcode-info/class-shortcode-info-video.php:64
msgid "Allows for the looping of media. Defaults to \"off\""
msgstr ""
#: shortcode-info/class-shortcode-info-video.php:66
msgid ""
"Specifies if and how the video should be loaded when the page loads. "
"Defaults to \"metadata\"."
msgstr ""
#~ msgid "Value"
#~ msgstr "Waarde"
#~ msgid "WP Constants"
#~ msgstr "WP Constants"
#~ msgid "Constants within WP:"
#~ msgstr "Constants binnen WP:"
#~ msgid "No constants found... this is really weird..."
#~ msgstr "Geen constants gevonden... dit is vreemd..."
#~ msgid "WP Class Constants"
#~ msgstr "WP Class Constants"
#~ msgid ""
#~ "<strong>Please note</strong>: these may be both native WordPress classes "
#~ "as well as classes which may be declared by plugins or Themes.<br />You "
#~ "can use these constants in your code using <code>class_name::"
#~ "constant_name</code>."
#~ msgstr ""
#~ "<strong>Toelichting:</strong>: dit kunnen zowel de WordPress eigen "
#~ "classes zijn als ook de classes welke door plugins of themes gedeclareerd "
#~ "zijn.<br />Je kan deze constants in je eigen code gebruiken door middel "
#~ "van <code>class_name::constant_name</code>."
#~ msgid "See the <a %s>FAQ</a> for more information."
#~ msgstr "Lees de <a %s>FAQ</a> voor meer informatie."
#~ msgid "Constants:"
#~ msgstr "Constants:"
#~ msgid "No classes nor class constants found... this is kinda strange..."
#~ msgstr "Geen classes of class constants gevonden... dit is vreemd..."
#~ msgid "PHP Constants"
#~ msgstr "PHP Constants"
#~ msgid "Visit the PHP manual page about the %s constants."
#~ msgstr "Bezoek de PHP handleiding pagina over de %s constants."
#~ msgid "No PHP constants found... this is really weird..."
#~ msgstr "Geen PHP constants gevonden... dit is vreemd..."
#~ msgid ""
#~ "Debug Bar must be activated to use the Debug Bar Constants Plugin. <a "
#~ "href=\"%s\">Visit your plugins page to activate</a>."
#~ msgstr ""
#~ "Debug Bar moet geactiveerd zijn om de Debug Bar Constants Plugin te "
#~ "kunnen gebruiken. <a href=\"%s\">Ga naar de plugins pagina om deze te "
#~ "activeren</a>."
#~ msgid "Nothing to display"
#~ msgstr "Niets om weer te geven"

View File

@@ -0,0 +1,537 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Debug Bar Shortcodes\n"
"POT-Creation-Date: 2016-04-29 09:16+0200\n"
"PO-Revision-Date: 2015-04-18 18:21+0100\n"
"Last-Translator: Juliette Reinders Folmer <wpplugins_nospam@adviesenzo.nl>\n"
"Language-Team: \n"
"Language: en_US\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.8.7\n"
"X-Poedit-Basepath: ..\n"
"X-Poedit-SourceCharset: UTF-8\n"
"X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
"esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
"_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Poedit-SearchPath-0: .\n"
"X-Poedit-SearchPathExcluded-0: *.js\n"
"X-Poedit-SearchPathExcluded-1: inc/debug-bar-pretty-output/*\n"
#: class-debug-bar-shortcodes-render.php:58
msgid "Total Registered Shortcodes:"
msgstr ""
#: class-debug-bar-shortcodes-render.php:97
msgid "Shortcode is used"
msgstr ""
#: class-debug-bar-shortcodes-render.php:97
msgid "Shortcode not used"
msgstr ""
#: class-debug-bar-shortcodes-render.php:126
msgid "No shortcodes found."
msgstr ""
#: class-debug-bar-shortcodes-render.php:143
msgid "Shortcode"
msgstr ""
#: class-debug-bar-shortcodes-render.php:144
msgid "Rendered by"
msgstr ""
#: class-debug-bar-shortcodes-render.php:148
msgid "In use?"
msgstr ""
#: class-debug-bar-shortcodes-render.php:149
msgid "Usage"
msgstr ""
#: class-debug-bar-shortcodes-render.php:171
msgid "View more detailed information about the shortcode."
msgstr ""
#: class-debug-bar-shortcodes-render.php:171 class-debug-bar-shortcodes.php:112
msgid "View details"
msgstr ""
#: class-debug-bar-shortcodes-render.php:174
msgid "Try and retrieve more detailed information about the shortcode."
msgstr ""
#: class-debug-bar-shortcodes-render.php:174
msgid "Retrieve details"
msgstr ""
#: class-debug-bar-shortcodes-render.php:177
msgid "Find out where this shortcode is used (if at all)"
msgstr ""
#: class-debug-bar-shortcodes-render.php:177
msgid "Find uses"
msgstr ""
#: class-debug-bar-shortcodes-render.php:197
msgid "View extended info about the shortcode on the web"
msgstr ""
#: class-debug-bar-shortcodes-render.php:197
msgid "View online"
msgstr ""
#: class-debug-bar-shortcodes-render.php:312
msgid "Not found"
msgstr ""
#: class-debug-bar-shortcodes-render.php:425
msgid "Name"
msgstr ""
#: class-debug-bar-shortcodes-render.php:434
msgid "Description"
msgstr ""
#: class-debug-bar-shortcodes-render.php:446
msgid "Info Url"
msgstr ""
#: class-debug-bar-shortcodes-render.php:456
msgid "Required parameters"
msgstr ""
#: class-debug-bar-shortcodes-render.php:465
msgid "Optional parameters"
msgstr ""
#: class-debug-bar-shortcodes-render.php:476
msgid "Shortcode details"
msgstr ""
#: class-debug-bar-shortcodes-render.php:495
msgid "Syntax"
msgstr ""
#: class-debug-bar-shortcodes-render.php:508
#: class-debug-bar-shortcodes-render.php:755
msgid "Unknown"
msgstr ""
#: class-debug-bar-shortcodes-render.php:630
msgid "Shortcode found in the following posts/pages/etc:"
msgstr ""
#: class-debug-bar-shortcodes-render.php:635
msgid "Title"
msgstr ""
#: class-debug-bar-shortcodes-render.php:636
msgid "Post Type"
msgstr ""
#: class-debug-bar-shortcodes-render.php:637
msgid "Status"
msgstr ""
#: class-debug-bar-shortcodes-render.php:638
msgid "Author"
msgstr ""
#: class-debug-bar-shortcodes-render.php:639
msgid "Shortcode usage(s)"
msgstr ""
#. translators: no need to translate, WP standard translation will be used.
#: class-debug-bar-shortcodes-render.php:655
msgid "Edit this item"
msgstr ""
#. translators: no need to translate, WP standard translation will be used.
#: class-debug-bar-shortcodes-render.php:657
msgid "Edit"
msgstr ""
#. translators: no need to translate, WP standard translation will be used.
#: class-debug-bar-shortcodes-render.php:663
#, php-format
msgid "Preview &#8220;%s&#8221;"
msgstr ""
#. translators: no need to translate, WP standard translation will be used.
#: class-debug-bar-shortcodes-render.php:666
msgid "Preview"
msgstr ""
#. translators: no need to translate, WP standard translation will be used.
#: class-debug-bar-shortcodes-render.php:672
#, php-format
msgid "View &#8220;%s&#8221;"
msgstr ""
#. translators: no need to translate, WP standard translation will be used.
#: class-debug-bar-shortcodes-render.php:674
msgid "View"
msgstr ""
#. translators: no need to translate, WP standard translation will be used.
#: class-debug-bar-shortcodes-render.php:725
msgid "Published"
msgstr ""
#. translators: no need to translate, WP standard translation will be used.
#: class-debug-bar-shortcodes-render.php:730
msgid "Scheduled"
msgstr ""
#. translators: no need to translate, WP standard translation will be used.
#: class-debug-bar-shortcodes-render.php:735
msgid "Private"
msgstr ""
#. translators: no need to translate, WP standard translation will be used.
#: class-debug-bar-shortcodes-render.php:740
msgid "Pending Review"
msgstr ""
#. translators: no need to translate, WP standard translation will be used.
#: class-debug-bar-shortcodes-render.php:746
msgid "Draft"
msgstr ""
#. translators: no need to translate, WP standard translation will be used.
#: class-debug-bar-shortcodes-render.php:751
msgid "Trash"
msgstr ""
#: class-debug-bar-shortcodes.php:45
msgid "Shortcodes"
msgstr ""
#: class-debug-bar-shortcodes.php:111
msgid "Hide details"
msgstr ""
#: class-debug-bar-shortcodes.php:113
msgid "No details found"
msgstr ""
#: class-debug-bar-shortcodes.php:114
msgid "Hide Uses"
msgstr ""
#: class-debug-bar-shortcodes.php:115
msgid "View Uses"
msgstr ""
#: class-debug-bar-shortcodes.php:116
msgid "Not Used"
msgstr ""
#: class-debug-bar-shortcodes.php:117
msgid ""
"Ajax request failed or no proper response received. If you have WP_DEBUG "
"enabled, this might be caused by a php error. The js error console might "
"contain more information."
msgstr ""
#: class-debug-bar-shortcodes.php:118
msgid "Illegal request received."
msgstr ""
#: shortcode-info/class-shortcode-info-audio.php:41
msgid "Audio Media"
msgstr ""
#: shortcode-info/class-shortcode-info-audio.php:42
msgid ""
"The Audio feature allows you to embed audio files and play them back. This "
"was added as of WordPress 3.6."
msgstr ""
#. translators: %s = file format.
#: shortcode-info/class-shortcode-info-audio.php:45
#, php-format
msgid "Source of %s fallback file"
msgstr ""
#: shortcode-info/class-shortcode-info-audio.php:48
msgid ""
"The source of your audio file. If not included it will auto-populate with "
"the first audio file attached to the post."
msgstr ""
#: shortcode-info/class-shortcode-info-audio.php:54
msgid "Allows for the looping of media. Defaults to \"off\"."
msgstr ""
#: shortcode-info/class-shortcode-info-audio.php:55
#: shortcode-info/class-shortcode-info-video.php:65
msgid ""
"Causes the media to automatically play as soon as the media file is ready. "
"Defaults to \"off\"."
msgstr ""
#: shortcode-info/class-shortcode-info-audio.php:56
msgid ""
"Specifies if and how the audio should be loaded when the page loads. "
"Defaults to \"none\"."
msgstr ""
#: shortcode-info/class-shortcode-info-caption.php:41
msgid "Wrap captions around content"
msgstr ""
#: shortcode-info/class-shortcode-info-caption.php:42
msgid ""
"The Caption feature allows you to wrap captions around content. This is "
"primarily used with individual images."
msgstr ""
#: shortcode-info/class-shortcode-info-caption.php:45
msgid "The actual text of your caption."
msgstr ""
#: shortcode-info/class-shortcode-info-caption.php:46
msgid "How wide the caption should be in pixels."
msgstr ""
#: shortcode-info/class-shortcode-info-caption.php:50
msgid "A unique HTML ID that you can change to use within your CSS."
msgstr ""
#: shortcode-info/class-shortcode-info-caption.php:51
msgid ""
"The alignment of the caption within the post. Valid values are: alignnone "
"(default), aligncenter, alignright, and alignleft."
msgstr ""
#: shortcode-info/class-shortcode-info-embed.php:41
msgid "Embed videos, images, and other content"
msgstr ""
#: shortcode-info/class-shortcode-info-embed.php:42
msgid ""
"You can opt to wrap a URL in the [embed] shortcode. It will accomplish the "
"same effect as having it on a line of it's own, but does not require the "
"\"Auto-embeds\" setting to be enabled. It also allows you to set a maximum "
"(but not fixed) width and height.If WordPress fails to embed your URL you "
"will get a hyperlink to the URL."
msgstr ""
#. translators: %s = height/weight.
#: shortcode-info/class-shortcode-info-embed.php:45
#, php-format
msgid "Maximum %s for the embedded object."
msgstr ""
#: shortcode-info/class-shortcode-info-embed.php:48
#: shortcode-info/class-shortcode-info-video.php:48
msgid "height"
msgstr ""
#: shortcode-info/class-shortcode-info-embed.php:49
#: shortcode-info/class-shortcode-info-video.php:49
msgid "width"
msgstr ""
#: shortcode-info/class-shortcode-info-gallery.php:41
msgid "Image Gallery"
msgstr ""
#: shortcode-info/class-shortcode-info-gallery.php:42
msgid ""
"The Gallery feature allows you to add one or more image galleries to your "
"posts and pages."
msgstr ""
#: shortcode-info/class-shortcode-info-gallery.php:45
msgid ""
"Specify how to sort the display thumbnails. The default is \"menu_order\"."
msgstr ""
#: shortcode-info/class-shortcode-info-gallery.php:46
msgid "Specify the sort order used to display thumbnails. ASC or DESC."
msgstr ""
#: shortcode-info/class-shortcode-info-gallery.php:47
msgid ""
"Specify the number of columns. The gallery will include a break tag at the "
"end of each row, and calculate the column width as appropriate. The default "
"value is 3. If columns is set to 0, no row breaks will be included."
msgstr ""
#: shortcode-info/class-shortcode-info-gallery.php:48
msgid ""
"Specify the post ID. The gallery will display images which are attached to "
"that post. The default behavior, if no ID is specified, is to display images "
"attached to the current post."
msgstr ""
#: shortcode-info/class-shortcode-info-gallery.php:49
msgid ""
"specify the image size to use for the thumbnail display. Valid values "
"include \"thumbnail\", \"medium\", \"large\", \"full\". The default value is "
"\"thumbnail\"."
msgstr ""
#: shortcode-info/class-shortcode-info-gallery.php:50
msgid ""
"The name of the XHTML tag used to enclose each item in the gallery. The "
"default is \"dl\"."
msgstr ""
#: shortcode-info/class-shortcode-info-gallery.php:51
msgid ""
"The name of the XHTML tag used to enclose each thumbnail icon in the "
"gallery. The default is \"dt\"."
msgstr ""
#: shortcode-info/class-shortcode-info-gallery.php:52
msgid ""
"The name of the XHTML tag used to enclose each caption. The default is \"dd"
"\"."
msgstr ""
#: shortcode-info/class-shortcode-info-gallery.php:53
msgid ""
"You can set it to \"file\" so each image will link to the image file. The "
"default value links to the attachment's permalink."
msgstr ""
#: shortcode-info/class-shortcode-info-gallery.php:54
msgid ""
"Comma separated attachment IDs to show only the images from these "
"attachments. "
msgstr ""
#: shortcode-info/class-shortcode-info-gallery.php:55
msgid ""
"Comma separated attachment IDs excludes the images from these attachments. "
"Please note that include and exclude cannot be used together."
msgstr ""
#: shortcode-info/class-shortcode-info-lhr.php:50
msgid "No information available"
msgstr ""
#: shortcode-info/class-shortcode-info-playlist.php:41
msgid "Media Playlist"
msgstr ""
#: shortcode-info/class-shortcode-info-playlist.php:42
msgid ""
"The playlist shortcode implements the functionality of displaying a "
"collection of WordPress audio or video files in a post using a simple "
"Shortcode."
msgstr ""
#: shortcode-info/class-shortcode-info-playlist.php:45
msgid ""
"Type of playlist to display. Accepts \"audio\" or \"video\". Defaults to "
"\"audio\"."
msgstr ""
#: shortcode-info/class-shortcode-info-playlist.php:46
msgid ""
"Designates ascending or descending order of items in the playlist. Accepts "
"\"ASC\", \"DESC\". Defaults to \"ASC\"."
msgstr ""
#: shortcode-info/class-shortcode-info-playlist.php:47
msgid ""
"Any column, or columns, to sort the playlist by. Accepts \"rand\" to play "
"the list in random order. Defaults to \"menu_order ID\". If `$ids` are "
"passed, this defaults to the order of the $ids array ('post__in')."
msgstr ""
#: shortcode-info/class-shortcode-info-playlist.php:48
msgid ""
"If an explicit `$ids` array is not present, this parameter will determine "
"which attachments are used for the playlist. Defaults to the current post ID."
msgstr ""
#: shortcode-info/class-shortcode-info-playlist.php:49
msgid ""
"Create a playlist out of these explicit attachment IDs. If empty, a playlist "
"will be created from all `$type` attachments of `$id`."
msgstr ""
#: shortcode-info/class-shortcode-info-playlist.php:50
msgid "List of specific attachment IDs to exclude from the playlist."
msgstr ""
#: shortcode-info/class-shortcode-info-playlist.php:51
msgid ""
"Playlist style to use. Accepts \"light\" or \"dark\". Defaults to \"light\"."
msgstr ""
#: shortcode-info/class-shortcode-info-playlist.php:52
msgid "Whether to show or hide the playlist. Defaults to (bool) true."
msgstr ""
#: shortcode-info/class-shortcode-info-playlist.php:53
msgid ""
"Whether to show or hide the numbers next to entries in the playlist. "
"Defaults to (bool) true."
msgstr ""
#: shortcode-info/class-shortcode-info-playlist.php:54
msgid ""
"Show or hide the video or audio thumbnail (Featured Image/post thumbnail). "
"Defaults to (bool) true."
msgstr ""
#: shortcode-info/class-shortcode-info-playlist.php:55
msgid ""
"Whether to show or hide artist name in the playlist. Defaults to (bool) true."
msgstr ""
#: shortcode-info/class-shortcode-info-video.php:41
msgid "Video Media"
msgstr ""
#: shortcode-info/class-shortcode-info-video.php:42
msgid ""
"The Video feature allows you to embed video files and play them back. This "
"was added as of WordPress 3.6."
msgstr ""
#. translators: %s = height/weight.
#: shortcode-info/class-shortcode-info-video.php:45
#, php-format
msgid ""
"Defines %s of the media. Value is automatically detected on file upload."
msgstr ""
#. translators: %s = file extension.
#: shortcode-info/class-shortcode-info-video.php:53
#, php-format
msgid "Source of %s fallback file."
msgstr ""
#: shortcode-info/class-shortcode-info-video.php:56
msgid ""
"The source of your video file. If not included it will auto-populate with "
"the first video file attached to the post."
msgstr ""
#: shortcode-info/class-shortcode-info-video.php:63
msgid ""
"Defines image to show as placeholder before the media plays. Defaults to "
"\"none\"."
msgstr ""
#: shortcode-info/class-shortcode-info-video.php:64
msgid "Allows for the looping of media. Defaults to \"off\""
msgstr ""
#: shortcode-info/class-shortcode-info-video.php:66
msgid ""
"Specifies if and how the video should be loaded when the page loads. "
"Defaults to \"metadata\"."
msgstr ""

View File

@@ -0,0 +1,2 @@
<?php
// Nothing to see here.

View File

@@ -0,0 +1,2 @@
<?php
// Nothing to see here.

View File

@@ -0,0 +1,28 @@
<?php
/**
* Debug Bar Shortcodes - is_closure test.
*
* @package WordPress\Plugins\Debug Bar Shortcodes
* @author Juliette Reinders Folmer <wpplugins_nospam@adviesenzo.nl>
* @link https://github.com/jrfnl/Debug-Bar-Shortcodes
* @since 1.0
*
* @copyright 2013-2016 Juliette Reinders Folmer
* @license http://creativecommons.org/licenses/GPL/2.0/ GNU General Public License, version 2 or higher
*/
if ( ! function_exists( 'debug_bar_shortcodes_is_closure' ) ) {
/**
* Check if a callback is a closure.
*
* @param mixed $arg Function name.
*
* @return bool
*/
function debug_bar_shortcodes_is_closure( $arg ) {
$test = function() {
};
$is_closure = ( $arg instanceof $test );
return $is_closure;
}
}

View File

@@ -0,0 +1,237 @@
=== Debug Bar Shortcodes ===
Contributors: jrf
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=995SSNDTCVBJG
Tags: debugbar, debug-bar, Debug Bar, Shortcodes, Debug Bar Shortcodes, shortcode list, list shortcodes, shortcodes reference
Requires at least: 3.6
Tested up to: 4.4
Stable tag: 2.0.3
Depends: Debug Bar
License: GPLv2
Debug Bar Shortcodes adds a new panel to the Debug Bar that displays the registered shortcodes for the current request.
== Description ==
Debug Bar Shortcodes adds a new panel to the [Debug Bar](https://wordpress.org/plugins/debug-bar/) that displays the registered shortcodes for the current request.
Additionally it will show you:
* Which function/method is called by the shortcode
* Whether the shortcode is used on the current post/page/post type and how (only when on singular)
* Any additional information available about the shortcode, such as a description, which parameters it takes, whether or not it is self-closing.
_Want to control the additional information displayed about your own shortcodes ? You can! See the [FAQ](https://wordpress.org/plugins/debug-bar-shortcodes/faq/) for more info._
* Find out all pages/posts/etc on which a shortcode is used
This plugin is compatible with the [LRH-Shortcode list](https://wordpress.org/plugins/lrh-shortcode-list/) and the [Shortcake/Shortcode UI](https://wordpress.org/plugins/shortcode-ui/) plugins. Additional information about a shortcode provided to these plugins will be taken into account and made available through this plugin too.
= Why is it useful to have insight into the shortcodes ? =
There are a number of typical uses I can think of:
* If you are a **_blog author_**:
- to know which shortcodes you can use in your posts/pages.
- if you switch plugins or remove a plugin, to know in which posts/pages you need to remove/replace old shortcodes
* If you are a **_web designer / web master_**:
- if you switch plugins or remove a plugin, to know in which posts/pages you need to remove/replace old shortcodes.
- to know which shortcodes you can use in theme files.
- to avoid name conflicts for website specific shortcodes.
* If you are a **_developer_**:
- to avoid name conflicts with shortcodes registered by other plugins/themes.
- to check whether your shortcode registers properly and whether the conditionals are applied correctly.
= Important =
This plugin requires the [Debug Bar](https://wordpress.org/plugins/debug-bar/) plugin to be installed and activated.
= Credits =
* The additional information functionality is inspired by [LRH-Shortcode list](https://wordpress.org/plugins/lrh-shortcode-list/) and [Shortcode reference](https://wordpress.org/plugins/shortcode-reference/).
* The finding of shortcode uses throughout the site is inspired by [TR All Shortcodes](https://wordpress.org/plugins/tr-all-shortcodes/)
------------------
If you like this plugin, please [rate and/or review](https://wordpress.org/support/view/plugin-reviews/debug-bar-shortcodes) it. If you have ideas on how to make the plugin even better or if you have found any bugs, please report these in the [Support Forum](https://wordpress.org/support/plugin/debug-bar-shortcodes) or in the [GitHub repository](https://github.com/jrfnl/Debug-Bar-Shortcodes/issues).
== Frequently Asked Questions ==
= Can it be used on a live site ? =
This plugin is only meant to be used for development purposes, but shouldn't cause any issues if run on a production site.
= What are shortcodes ? =
> A shortcode is a WordPress-specific code that lets you do nifty things with very little effort. Shortcodes can embed files or create objects that would normally require lots of complicated, ugly code in just one line. Shortcode = shortcut.
[Source](http://en.support.wordpress.com/shortcodes/)
For more information about using shortcodes in WordPress:
- [WP Codex on shortcodes](http://codex.wordpress.org/Shortcode)
- [WP Codex on the Shortcode API](http://codex.wordpress.org/Shortcode_API)
= Why is my shortcode not listed ? =
There are two possibilities here:
* Either your shortcode has [not been properly registered](http://codex.wordpress.org/Function_Reference/add_shortcode) using the ShortCode API.
* Or your shortcode might only be registered conditionally and the current page does not meet those conditions.
= The number of shortcodes differs depending on the requested page. How come ? =
See the previous answer.
= I'm using shortcode *abc* in page *xyz* and it doesn't show as used! =
To determine whether a shortcode is used in a page, only the _**post content**_ is evaluated. If you add content to the page using shortcodes in other areas (for example: widgets) or via the theme, those uses will not be recognized.
= Can I use these shortcodes in the theme I'm building ? =
Generally speaking you can. However, don't forget to always [check whether the shortcode is registered](http://codex.wordpress.org/Function_Reference/shortcode_exists) before you use it! It may not be available on all pages and surely not on all WP installs.
`
if ( shortcode_exists( 'shortcode' ) ) {
/* Your code here */
// echo do_shortcode( 'some content containing a [shortcode /]' );
}
`
= I'm a developer and would like to enrich the information displayed by this plugin about my shortcode. =
I've tried to make this as easy and painless as possible.
Just add a filter to enrich the information this plugin has about your shortcode. The easiest way is to use the `db_shortcodes_info_{shortcode}` filter which will only be applied to your shortcode.
`
add_filter( 'db_shortcodes_info_{your_shortcode}', 'filter_my_shortcode_info' );
function filter_my_shortcode_info( $info ) {
// enrich the object
return $info;
}
`
The `$info` object you receive and are expected to return will contain the currently known information about the shortcode.
`$info` is expected to contain (a selection of) the following parameters:
`stdClass(
$name = (string) 'Friendly name for your shortcode',
$description = (string) 'Description of your shortcode',
$self_closing = (bool) true/bool, // whether the shortcode is self-closing
$parameters = array(
'required' => array(
(string) 'attribute_name' => (string) 'attribute description',
),
'optional' => array(
(string) 'attribute_name' => (string) 'attribute description',
),
),
$info_url = '',
)
`
If you happen to already provide similar information using the `sim_{shortcode}` filter for the [LHR-Shortcode list](https://wordpress.org/plugins/lrh-shortcode-list/) plugin, no need to do anything extra, that information will be picked up by this plugin.
Similarly, if you provide information for the [Shortcake/Shortcode UI](https://wordpress.org/plugins/shortcode-ui/) feature plugin, that information will be used automatically to enrich the available information.
= Hang on - the filter behaviour has changed ?!? =
In version 1.0 of the plugin `$info` variable passed to the filter was an array. This has changed in version 2.0.
I'm aware that this is a backward compatibility break, but I've done some quite extensive searches and considering I did not find any plugin using the filter (yet), I decided this backward compatibility break would have little to no effect and therefore would be safe to implement.
If you *did* already have a filter in place, sorry I didn't find your plugin/theme! Not to worry though, I've tried to make it really easy to upgrade your code.
First off, you'll need to change the `add_filter()` hook in code and your function signature to now received two variables. The first variable will be the new object, but the second variable will still be an array in the format which was passed in 1.0 so you can continue to use that in your function to enrich the information.
Secondly, as all this plugin uses are the properties of the object, you can just cast your array to an object in the return and it'll work again.
Old code for v1.0:
`
add_filter( 'db_shortcodes_info_{your_shortcode}', 'filter_my_shortcode_info' );
function filter_my_shortcode_info( $info ) {
// enrich the array
return $info;
}
`
Updated code for v2.0:
`
add_filter( 'db_shortcodes_info_{your_shortcode}', 'filter_my_shortcode_info', 10, 2 );
function filter_my_shortcode_info( $info_object, $info ) {
// enrich the array
return (object) $info;
}
`
= Why won't the plugin activate ? =
Have you read what it says in the beautifully red bar at the top of your plugins page ? As it says there, the Debug Bar plugin needs to be active for this plugin to work. If the Debug Bar plugin is not active, this plugin will automatically de-activate itself.
== Changelog ==
= 2.0.3 (2016-04-29) =
* Make loading of text-domain compatible with use of the plugin in the `must-use` plugins directory.
* Minor housekeeping.
* Tested & found compatible WP 4.5.
= 2.0.2 (2016-01-10) =
* Fix spinner for ajax request which had stopped working since WP 4.2.
= 2.0.1 (2015-12-26) =
* Fix weird table layout on front-end in combination with Twenty-Sixteen theme.
= 2.0 (2015-12-14) =
IMPORTANT: if you are a plugin/theme developer and you were using the `'db_shortcodes_info_{your_shortcode}'` filter: the behaviour of this filter has changed from passing an array, to passing an object. Please read the [FAQ](https://wordpress.org/plugins/debug-bar-shortcodes/faq/) for information on how to deal with this change !
* Enhancement: Added support for shortcode information available through [Shortcake](https://wordpress.org/plugins/shortcode-ui/).
* Enhancement: At least try and detect the plugin url if more than one plugin was found in the same directory.
* Bug Fix: Information was not obtained for shortcodes with a closure as callback. (Reflection object was not obtained for closures.)
* Compatibility fix: Minor html change to fix layout for WP 4.4.
* Usability: Improved table header alignment.
* Usability: Row actions now visible on hover over row, not just title.
* Usability: Improved compatibility with Glotpress / WP translations.
* Minor housekeeping.
* Tested & found compatible WP 4.4.
= 1.0.3 (2014-12-18) =
* Added: more detailed information about the WP native `playlist` shortcode.
* Tested & found compatible WP 4.1.
= 1.0.2 (2014-09-05) =
* Fix compatibility with the [Plugin Dependencies](https://wordpress.org/plugins/plugin-dependencies/) plugin.
* Tested & found compatible WP 4.0.
= 1.0.1 (2014-04-19) =
* Fixed: better finding of shortcodes within post content.
* Fixed: minor html error.
* Fixed: minor PHP error.
= 1.0 (2013-12-22) =
* Initial release.
== Upgrade Notice ==
= 2.0 =
* Added ShortCake support.
= 1.0 =
* Initial release.
== Installation ==
1. Install Debug Bar if not already installed (https://wordpress.org/plugins/debug-bar/)
1. Extract the .zip file for this plugin and upload its contents to the `/wp-content/plugins/` directory. Alternatively, you can install directly from the Plugin directory within your WordPress Install.
1. Activate the plugin through the "Plugins" menu in WordPress.
Be careful when you use this plugin on a live site. This plugin is intended for development purposes.
== Screenshots ==
1. Debug Bar displaying Shortcodes
1. Debug Bar displaying Shortcodes on web front-end singular
1. Debug Bar Shortcodes - Example of detailed information about a shortcode if provided by the author
1. Debug Bar Shortcodes - Example of detailed information about a shortcode based on information retrieved from the shortcode documentation
1. Debug Bar Shortcodes - Example of shortcode usage found throughout the site

View File

@@ -0,0 +1,61 @@
<?php
/**
* Debug Bar Shortcodes - Debug Bar Shortcode Info Audio.
*
* @package WordPress\Plugins\Debug Bar Shortcodes
* @subpackage WordPress\Plugins\Debug Bar Shortcodes\Shortcode Info
* @author Juliette Reinders Folmer <wpplugins_nospam@adviesenzo.nl>
* @link https://github.com/jrfnl/Debug-Bar-Shortcodes
* @since 2.0
*
* @copyright 2013-2016 Juliette Reinders Folmer
* @license http://creativecommons.org/licenses/GPL/2.0/ GNU General Public License, version 2 or higher
*/
if ( ! class_exists( 'Debug_Bar_Shortcode_Info_Audio' ) ) :
/**
* Information on the standard WP [audio] shortcode.
*/
class Debug_Bar_Shortcode_Info_Audio extends Debug_Bar_Shortcode_Info_Defaults {
/**
* Whether the shortcode is self-closing or not.
*
* @var bool|null $self_closing
*/
public $self_closing = true;
/**
* Info URL.
*
* @var string $info_url
*/
public $info_url = 'http://codex.wordpress.org/Audio_Shortcode';
/**
* Constructor - set some properties which need to be translated.
*/
public function __construct() {
$this->name = __( 'Audio Media', 'debug-bar-shortcodes' );
$this->description = __( 'The Audio feature allows you to embed audio files and play them back. This was added as of WordPress 3.6.', 'debug-bar-shortcodes' );
/* translators: %s = file format. */
$string = __( 'Source of %s fallback file', 'debug-bar-shortcodes' );
$this->parameters['optional'] = array(
'src' => __( 'The source of your audio file. If not included it will auto-populate with the first audio file attached to the post.', 'debug-bar-shortcodes' ),
'mp3' => sprintf( $string, 'mp3' ),
'm4a' => sprintf( $string, 'm4a' ),
'ogg' => sprintf( $string, 'ogg' ),
'wav' => sprintf( $string, 'wav' ),
'wma' => sprintf( $string, 'wma' ),
'loop' => __( 'Allows for the looping of media. Defaults to "off".', 'debug-bar-shortcodes' ),
'autoplay' => __( 'Causes the media to automatically play as soon as the media file is ready. Defaults to "off".', 'debug-bar-shortcodes' ),
'preload' => __( 'Specifies if and how the audio should be loaded when the page loads. Defaults to "none".', 'debug-bar-shortcodes' ),
);
}
} // End of class.
endif; // End of if class_exists.

View File

@@ -0,0 +1,56 @@
<?php
/**
* Debug Bar Shortcodes - Debug Bar Shortcode Info Caption.
*
* @package WordPress\Plugins\Debug Bar Shortcodes
* @subpackage WordPress\Plugins\Debug Bar Shortcodes\Shortcode Info
* @author Juliette Reinders Folmer <wpplugins_nospam@adviesenzo.nl>
* @link https://github.com/jrfnl/Debug-Bar-Shortcodes
* @since 2.0
*
* @copyright 2013-2016 Juliette Reinders Folmer
* @license http://creativecommons.org/licenses/GPL/2.0/ GNU General Public License, version 2 or higher
*/
if ( ! class_exists( 'Debug_Bar_Shortcode_Info_Caption' ) ) :
/**
* Information on the standard WP [caption] shortcode.
*/
class Debug_Bar_Shortcode_Info_Caption extends Debug_Bar_Shortcode_Info_Defaults {
/**
* Whether the shortcode is self-closing or not.
*
* @var bool|null $self_closing
*/
public $self_closing = false;
/**
* Info URL.
*
* @var string $info_url
*/
public $info_url = 'http://codex.wordpress.org/Caption_Shortcode';
/**
* Constructor - set some properties which need to be translated.
*/
public function __construct() {
$this->name = __( 'Wrap captions around content', 'debug-bar-shortcodes' );
$this->description = __( 'The Caption feature allows you to wrap captions around content. This is primarily used with individual images.', 'debug-bar-shortcodes' );
$this->parameters['required'] = array(
'caption' => __( 'The actual text of your caption.', 'debug-bar-shortcodes' ),
'width' => __( 'How wide the caption should be in pixels.', 'debug-bar-shortcodes' ),
);
$this->parameters['optional'] = array(
'id' => __( 'A unique HTML ID that you can change to use within your CSS.', 'debug-bar-shortcodes' ),
'align' => __( 'The alignment of the caption within the post. Valid values are: alignnone (default), aligncenter, alignright, and alignleft.', 'debug-bar-shortcodes' ),
);
}
} // End of class.
endif; // End of if class_exists.

View File

@@ -0,0 +1,73 @@
<?php
/**
* Debug Bar Shortcodes - Debug Bar Shortcode Info Defaults.
*
* @package WordPress\Plugins\Debug Bar Shortcodes
* @subpackage WordPress\Plugins\Debug Bar Shortcodes\Shortcode Info
* @author Juliette Reinders Folmer <wpplugins_nospam@adviesenzo.nl>
* @link https://github.com/jrfnl/Debug-Bar-Shortcodes
* @since 2.0
*
* @copyright 2013-2016 Juliette Reinders Folmer
* @license http://creativecommons.org/licenses/GPL/2.0/ GNU General Public License, version 2 or higher
*/
if ( ! class_exists( 'Debug_Bar_Shortcode_Info_Defaults' ) ) :
/**
* Shortcode Info defaults.
*/
class Debug_Bar_Shortcode_Info_Defaults {
/**
* Friendly name for the shortcode.
*
* @var string $name
*/
public $name = '';
/**
* Longer description of what the shortcode is for.
*
* @var string $description
*/
public $description = '';
/**
* Whether the shortcode is self-closing or not.
* - `true` if of form: [shortcode],
* - `false` if of form: [shortcode]...[/shortcode]
* Defaults to `null` (=unknown)
*
* @var bool|null $self_closing
*/
public $self_closing;
/**
* Parameters which can be passed to the shortcode.
*
* Array format:
* - [required] => array Required parameters.
* Array format:
* - key = name of the parameter.
* - value = description of the parameter.
* - [optional] => array Optional parameters.
* Follows same format as for required parameters.
*
* @var array $parameters
*/
public $parameters = array(
'required' => array(),
'optional' => array(),
);
/**
* Info URL.
*
* @var string $info_url
*/
public $info_url = '';
} // End of class.
endif; // End of if class_exists.

View File

@@ -0,0 +1,54 @@
<?php
/**
* Debug Bar Shortcodes - Debug Bar Shortcode Info Embed.
*
* @package WordPress\Plugins\Debug Bar Shortcodes
* @subpackage WordPress\Plugins\Debug Bar Shortcodes\Shortcode Info
* @author Juliette Reinders Folmer <wpplugins_nospam@adviesenzo.nl>
* @link https://github.com/jrfnl/Debug-Bar-Shortcodes
* @since 2.0
*
* @copyright 2013-2016 Juliette Reinders Folmer
* @license http://creativecommons.org/licenses/GPL/2.0/ GNU General Public License, version 2 or higher
*/
if ( ! class_exists( 'Debug_Bar_Shortcode_Info_Embed' ) ) :
/**
* Information on the standard WP [embed] shortcode.
*/
class Debug_Bar_Shortcode_Info_Embed extends Debug_Bar_Shortcode_Info_Defaults {
/**
* Whether the shortcode is self-closing or not.
*
* @var bool|null $self_closing
*/
public $self_closing = false;
/**
* Info URL.
*
* @var string $info_url
*/
public $info_url = 'http://codex.wordpress.org/Embed_Shortcode';
/**
* Constructor - set some properties which need to be translated.
*/
public function __construct() {
$this->name = __( 'Embed videos, images, and other content', 'debug-bar-shortcodes' );
$this->description = __( 'You can opt to wrap a URL in the [embed] shortcode. It will accomplish the same effect as having it on a line of it\'s own, but does not require the "Auto-embeds" setting to be enabled. It also allows you to set a maximum (but not fixed) width and height.If WordPress fails to embed your URL you will get a hyperlink to the URL.', 'debug-bar-shortcodes' );
/* translators: %s = height/weight. */
$string = __( 'Maximum %s for the embedded object.', 'debug-bar-shortcodes' );
$this->parameters['optional'] = array(
'height' => sprintf( $string, __( 'height', 'debug-bar-shortcodes' ) ),
'width' => sprintf( $string, __( 'width', 'debug-bar-shortcodes' ) ),
);
}
} // End of class.
endif; // End of if class_exists.

View File

@@ -0,0 +1,316 @@
<?php
/**
* Debug Bar Shortcodes - Debug Bar Shortcode Info From File.
*
* @package WordPress\Plugins\Debug Bar Shortcodes
* @subpackage WordPress\Plugins\Debug Bar Shortcodes\Shortcode Info
* @author Juliette Reinders Folmer <wpplugins_nospam@adviesenzo.nl>
* @link https://github.com/jrfnl/Debug-Bar-Shortcodes
* @since 2.0
*
* @copyright 2013-2016 Juliette Reinders Folmer
* @license http://creativecommons.org/licenses/GPL/2.0/ GNU General Public License, version 2 or higher
*/
if ( ! class_exists( 'Debug_Bar_Shortcode_Info_From_File' ) ) :
/**
* Information on a shortcode based on documentation found for the function the
* shortcode points to.
*/
class Debug_Bar_Shortcode_Info_From_File extends Debug_Bar_Shortcode_Info_Reflection {
/**
* Constructor - set the properties.
*
* @param string $shortcode The shortcode for which to retrieve info.
*/
public function __construct( $shortcode = '' ) {
parent::__construct( $shortcode );
$this->set_info_properties();
}
/**
* Enrich shortcode information.
*
* If a Reflection object can be obtained for the function/method the shortcode points to,
* use the documentation of that function to enrich the available information.
*/
private function set_info_properties() {
if ( $this->reflection_object instanceof ReflectionFunctionAbstract ) {
$this->description = nl2br( $this->strip_comment_markers( $this->reflection_object->getDocComment() ) );
$this->self_closing = true;
if ( $this->reflection_object->getNumberOfRequiredParameters() > 1 ) {
$this->self_closing = false;
}
$this->info_url = $this->get_plugin_url_from_file( $this->reflection_object->getFileName() );
}
}
/**
* Strip all comment markings and extra whitespace from a comment string.
*
* Strips for each line of the comment:
* - '/*[*]', '//', '#', '*' from the beginning of a line.
* - '*\/' from the end of a line.
* - spaces and tabs from the beginning of a line.
* - carriage returns (\r) from the end of a line.
* - merges any combination of spaces and tabs into one space.
*
* @param string $comment The comment string to examine.
*
* @return string
*/
private function strip_comment_markers( $comment ) {
static $search = array(
'`(^[\s]*(/\*+[\s]*(?:\*[ \t]*)?)|[\s]*(\*+/)[\s]*$|^[\s]*(\*+[ \t]*)|^[\s]*(/{2,})[\s]*|^[\s]*(#+)[\s]*)`m',
'`^([ \t]+)`m',
'`(\r)+[\n]?$`m',
'`([ \t\r]{2,})`',
);
static $replace = array(
'',
'',
'',
' ',
);
// Parse out all the line endings and comment delimiters.
$comment = trim( preg_replace( $search, $replace, trim( $comment ) ) );
return $comment;
}
/**
* Get the URL where you can find more information about the shortcode.
*
* Inspired by Shortcode reference, heavily adjusted to work more accurately.
* Source: https://wordpress.org/plugins/shortcode-reference/
*
* @param string $path_to_file Path to file containing the callback function.
*
* @return string URL.
*/
protected function get_plugin_url_from_file( $path_to_file ) {
/* Make sure the paths use the same slashing to make them comparable. */
$path_to_file = str_replace( array( '/', '\\' ), DIRECTORY_SEPARATOR, $path_to_file );
$wp_abs_path = str_replace( array( '/', '\\' ), DIRECTORY_SEPARATOR, ABSPATH );
$wp_includes_path = str_replace( array( '/', '\\' ), DIRECTORY_SEPARATOR, ABSPATH . WPINC ) . DIRECTORY_SEPARATOR;
$wp_plugins_path = str_replace( array( '/', '\\' ), DIRECTORY_SEPARATOR, WP_PLUGIN_DIR ) . DIRECTORY_SEPARATOR;
$wp_mu_plugins_path = str_replace( array( '/', '\\' ), DIRECTORY_SEPARATOR, WPMU_PLUGIN_DIR ) . DIRECTORY_SEPARATOR;
/* Check what type of file this is. */
if ( false !== strpos( $path_to_file, $wp_includes_path ) ) {
// WP native.
return 'http://codex.wordpress.org/index.php?title=Special:Search&search=' . urlencode( $this->shortcode ) . '_Shortcode';
}
$is_plugin = strpos( $path_to_file, $wp_plugins_path );
$is_mu_plugin = strpos( $path_to_file, $wp_mu_plugins_path );
$plugin_data = array();
$plugin_basename = '';
/* Is this a plugin in the normal plugin directory ? */
if ( false !== $is_plugin ) {
// Plugin in the plugins directory.
$relative_path = substr( $path_to_file, ( $is_plugin + strlen( $wp_plugins_path ) ) );
if ( function_exists( 'get_plugins' ) && false !== strpos( $relative_path, DIRECTORY_SEPARATOR ) ) {
// Subdirectory plugin.
$folder = substr( $relative_path, 0, strpos( $relative_path, DIRECTORY_SEPARATOR ) );
$folder = DIRECTORY_SEPARATOR . $folder . DIRECTORY_SEPARATOR;
$plugins = get_plugins( $folder );
/*
We'd expect only one file in the directory to have plugin data, otherwise we have
a problem as we won't know which file is the parent of the one containing the shortcode.
*/
if ( is_array( $plugins ) && 1 === count( $plugins ) ) {
// Only one item, but we don't know the key, use foreach to set the variables we need.
foreach ( $plugins as $plugin_basename => $plugin_data ) {
break;
}
}
/*
So in the case of several plugins within a directory - check if the file containing
the shortcode callback is one of the plugin main files. If so, accept.
Otherwise, ignore altogether.
*/
else {
$found = false;
foreach ( $plugins as $plugin_basename => $plugin_data ) {
if ( false !== strpos( $relative_path, DIRECTORY_SEPARATOR . $plugin_basename ) ) {
$found = true;
break;
}
}
if ( false === $found ) {
unset( $plugin_basename, $plugin_data );
}
unset( $found );
}
unset( $plugins, $folder );
}
elseif ( function_exists( 'get_plugin_data' ) ) {
// File directly in the plugins dir, just get straight plugin_data.
$plugin_basename = $relative_path;
$plugin_data = get_plugin_data( $path_to_file, false, false );
}
unset( $relative_path );
}
/* Is this a plugin in the mu plugin directory ? (`get_plugin_data()` only available on admin side.) */
elseif ( function_exists( 'get_plugin_data' ) && false !== $is_mu_plugin ) {
$relative_path = substr( $path_to_file, ( $is_mu_plugin + strlen( $wp_mu_plugins_path ) ) );
if ( false !== strpos( $relative_path, DIRECTORY_SEPARATOR ) ) {
// Subdirectory file, presume the mu-dir plugin bootstrap file is called directory-name.php.
$relative_path = substr( $relative_path, 0, strpos( $relative_path, DIRECTORY_SEPARATOR ) ) . '.php';
}
$plugin_basename = $relative_path;
$plugin_data = get_plugin_data( $wp_mu_plugins_path . $relative_path, false, false );
unset( $relative_path );
}
/* Let's see if we've got some results. */
if ( is_array( $plugin_data ) && ! empty( $plugin_data ) ) {
if ( isset( $plugin_data['PluginURI'] ) && trim( $plugin_data['PluginURI'] ) !== '' ) {
return trim( $plugin_data['PluginURI'] );
}
elseif ( isset( $plugin_data['AuthorURI'] ) && trim( $plugin_data['AuthorURI'] ) !== '' ) {
return trim( $plugin_data['AuthorURI'] );
}
}
/* Not exited yet ? Ok, then we didn't have either or the info items, let's try another way. */
if ( '' !== $plugin_basename ) {
$uri = $this->wp_repo_exists( $plugin_basename );
if ( false !== $uri ) {
return $uri;
}
else {
return 'http://www.google.com/search?q=Wordpress+' . urlencode( '"' . $plugin_basename . '"' ) . '+shortcode+' . urlencode( '"' . $this->shortcode . '"' );
}
}
/*
If all else fails, Google is your friend, but let's try not to reveal our server path.
*/
$is_wp = strpos( $path_to_file, $wp_abs_path );
if ( false !== $is_wp ) {
$sort_of_safe_path = substr( $path_to_file, ( $is_wp + strlen( $wp_abs_path ) ) );
return 'http://www.google.com/search?q=Wordpress+' . urlencode( '"' . $sort_of_safe_path . '"' ) . '+shortcode+' . urlencode( '"' . $this->shortcode . '"' );
}
return 'http://www.google.com/search?q=Wordpress+shortcode+' . urlencode( '"' . $this->shortcode . '"' );
}
/**
* Try to check if a wp plugin repository exists for a given plugin.
*
* @todo check WP for alternative way to do this, i.e. using flexible http_base class or something
* which will auto switch depending on call methods available.
*
* @param string $plugin_basename Plugin basename in the format dir/file.php.
*
* @return string|false URL or false if unsuccessful.
*/
private function wp_repo_exists( $plugin_basename ) {
if ( ! extension_loaded( 'curl' ) || '' === $plugin_basename ) {
// May be check using another method ? Nah, google is good enough.
return false;
}
/* Set up curl. */
$curl = curl_init();
// Issue a HEAD request.
curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $curl, CURLOPT_HEADER, true );
curl_setopt( $curl, CURLOPT_NOBODY, true );
// Follow any redirects.
$open_basedir = ini_get( 'open_basedir' );
if ( false === $this->ini_get_bool( 'safe_mode' ) && ( ( ! isset( $open_basedir ) || empty( $open_basedir ) ) || 'none' === $open_basedir ) ) {
curl_setopt( $curl, CURLOPT_FOLLOWLOCATION, true );
curl_setopt( $curl, CURLOPT_MAXREDIRS, 5 );
}
unset( $open_basedir );
// Bypass servers which refuse curl.
curl_setopt( $curl, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)' );
// Set a time-out.
curl_setopt( $curl, CURLOPT_CONNECTTIMEOUT, 5 );
curl_setopt( $curl, CURLOPT_TIMEOUT, 10 );
/* Figure out what the repo should be called. */
if ( strpos( $plugin_basename, DIRECTORY_SEPARATOR ) ) {
$plugin_basename = substr( $plugin_basename, 0, strpos( $plugin_basename, DIRECTORY_SEPARATOR ) );
}
if ( strpos( $plugin_basename, '.php' ) ) {
$plugin_basename = substr( $plugin_basename, 0, strpos( $plugin_basename, '.php' ) );
}
/* Check if it exists. */
if ( '' !== $plugin_basename ) {
$plugin_uri = 'https://wordpress.org/plugins/' . urlencode( $plugin_basename );
/* Get the http headers for the given url. */
curl_setopt( $curl, CURLOPT_URL, $plugin_uri );
$header = curl_exec( $curl );
/* If we didn't get an error, interpret the headers. */
if ( ( false !== $header && ! empty( $header ) ) && ( 0 === curl_errno( $curl ) ) ) {
/* Get the http status. */
$statuscode = curl_getinfo( $curl, CURLINFO_HTTP_CODE );
if ( false === $statuscode && preg_match( '/^HTTP\/1\.[01] (\d\d\d)/', $header, $matches ) ) {
$statuscode = (int) $matches[1];
}
/* No http error response, so presume valid uri. */
if ( 400 > $statuscode ) {
curl_close( $curl );
return $plugin_uri;
}
}
}
curl_close( $curl );
return false;
}
/* ************** HELPER METHODS ************** */
/**
* Test a boolean PHP ini value.
*
* @since 3.0
*
* @param string $ini_key Key of the value you want to get.
*
* @return bool
*/
private function ini_get_bool( $ini_key ) {
$value = ini_get( $ini_key );
switch ( strtolower( $value ) ) {
case 'on':
case 'yes':
case 'true':
return 'assert.active' !== $ini_key;
default:
return (bool) (int) $value;
}
}
} // End of class.
endif; // End of if class_exists.

View File

@@ -0,0 +1,60 @@
<?php
/**
* Debug Bar Shortcodes - Debug Bar Shortcode Info Gallery.
*
* @package WordPress\Plugins\Debug Bar Shortcodes
* @subpackage WordPress\Plugins\Debug Bar Shortcodes\Shortcode Info
* @author Juliette Reinders Folmer <wpplugins_nospam@adviesenzo.nl>
* @link https://github.com/jrfnl/Debug-Bar-Shortcodes
* @since 2.0
*
* @copyright 2013-2016 Juliette Reinders Folmer
* @license http://creativecommons.org/licenses/GPL/2.0/ GNU General Public License, version 2 or higher
*/
if ( ! class_exists( 'Debug_Bar_Shortcode_Info_Gallery' ) ) :
/**
* Information on the standard WP [gallery] shortcode.
*/
class Debug_Bar_Shortcode_Info_Gallery extends Debug_Bar_Shortcode_Info_Defaults {
/**
* Whether the shortcode is self-closing or not.
*
* @var bool|null $self_closing
*/
public $self_closing = true;
/**
* Info URL.
*
* @var string $info_url
*/
public $info_url = 'http://codex.wordpress.org/Gallery_Shortcode';
/**
* Constructor - set some properties which need to be translated.
*/
public function __construct() {
$this->name = __( 'Image Gallery', 'debug-bar-shortcodes' );
$this->description = __( 'The Gallery feature allows you to add one or more image galleries to your posts and pages.', 'debug-bar-shortcodes' );
$this->parameters['optional'] = array(
'orderby' => __( 'Specify how to sort the display thumbnails. The default is "menu_order".', 'debug-bar-shortcodes' ),
'order' => __( 'Specify the sort order used to display thumbnails. ASC or DESC.', 'debug-bar-shortcodes' ),
'columns' => __( 'Specify the number of columns. The gallery will include a break tag at the end of each row, and calculate the column width as appropriate. The default value is 3. If columns is set to 0, no row breaks will be included.', 'debug-bar-shortcodes' ),
'id' => __( 'Specify the post ID. The gallery will display images which are attached to that post. The default behavior, if no ID is specified, is to display images attached to the current post.', 'debug-bar-shortcodes' ),
'size' => __( 'specify the image size to use for the thumbnail display. Valid values include "thumbnail", "medium", "large", "full". The default value is "thumbnail".', 'debug-bar-shortcodes' ),
'itemtag' => __( 'The name of the XHTML tag used to enclose each item in the gallery. The default is "dl".', 'debug-bar-shortcodes' ),
'icontag' => __( 'The name of the XHTML tag used to enclose each thumbnail icon in the gallery. The default is "dt".', 'debug-bar-shortcodes' ),
'captiontag' => __( 'The name of the XHTML tag used to enclose each caption. The default is "dd".', 'debug-bar-shortcodes' ),
'link' => __( 'You can set it to "file" so each image will link to the image file. The default value links to the attachment\'s permalink.', 'debug-bar-shortcodes' ),
'include' => __( 'Comma separated attachment IDs to show only the images from these attachments. ', 'debug-bar-shortcodes' ),
'exclude' => __( 'Comma separated attachment IDs excludes the images from these attachments. Please note that include and exclude cannot be used together.', 'debug-bar-shortcodes' ),
);
}
} // End of class.
endif; // End of if class_exists.

View File

@@ -0,0 +1,117 @@
<?php
/**
* Debug Bar Shortcodes - Debug Bar Shortcode Info LHR.
*
* @package WordPress\Plugins\Debug Bar Shortcodes
* @subpackage WordPress\Plugins\Debug Bar Shortcodes\Shortcode Info
* @author Juliette Reinders Folmer <wpplugins_nospam@adviesenzo.nl>
* @link https://github.com/jrfnl/Debug-Bar-Shortcodes
* @since 2.0
*
* @copyright 2013-2016 Juliette Reinders Folmer
* @license http://creativecommons.org/licenses/GPL/2.0/ GNU General Public License, version 2 or higher
*/
if ( ! class_exists( 'Debug_Bar_Shortcode_Info_LHR' ) ) :
/**
* Information on a shortcode provided in the lhr shortcode plugin format.
*
* @see [LHR-Shortcode list](https://wordpress.org/plugins/lrh-shortcode-list/)
*/
class Debug_Bar_Shortcode_Info_LHR extends Debug_Bar_Shortcode_Info_Defaults {
/**
* LHR Defaults
*
* @var array $lhr_defaults
*/
private $lhr_defaults = array();
/**
* Info array as retrieved by running the LHR `sim_{$shortcode}` filter.
*
* This info is in the LHR format and has not been validated.
*
* @var array $lhr_info
*/
private $lhr_info;
/**
* Constructor - set the properties based on the lhr shortcode filter.
*
* @param string $shortcode The shortcode for which to retrieve info.
*/
public function __construct( $shortcode = '' ) {
$this->lhr_defaults = array(
'scTag' => $shortcode,
'scName' => $shortcode,
'scDesc' => __( 'No information available', 'debug-bar-shortcodes' ),
'scSelfCls' => 'u', // Unknown.
'scReqP' => array(),
'scOptP' => array(),
);
$this->lhr_info = apply_filters( 'sim_' . $shortcode, $this->lhr_defaults );
$this->set_name();
$this->set_description();
$this->set_self_closing();
$this->set_parameters( 'scReqP', 'required' );
$this->set_parameters( 'scOptP', 'optional' );
}
/**
* Set the name property if the LHR filter provided us with usable information.
*/
private function set_name() {
$this->set_string_property( 'scName', 'name' );
}
/**
* Set the description property if the LHR filter provided us with usable information.
*/
private function set_description() {
$this->set_string_property( 'scDesc', 'description' );
}
/**
* Set the self_closing property if the LHR filter provided us with usable information.
*/
private function set_self_closing() {
if ( is_bool( $this->lhr_info['scSelfCls'] ) ) {
$this->self_closing = $this->lhr_info['scSelfCls'];
}
}
/**
* Set the parameter property if the LHR filter provided us with usable information.
*
* @param string $lhr_key The array key for the LHR array.
* @param string $type The parameter type.
*/
private function set_parameters( $lhr_key, $type ) {
if ( is_array( $this->lhr_info[ $lhr_key ] ) && ! empty( $this->lhr_info[ $lhr_key ] ) ) {
$this->parameters[ $type ] = $this->lhr_info[ $lhr_key ];
}
}
/**
* Test and set a string property.
*
* @param string $key The array key for the LHR array.
* @param string $property The name of the property to set.
*/
private function set_string_property( $key, $property ) {
if ( is_string( $this->lhr_info[ $key ] ) && $this->lhr_info[ $key ] !== $this->lhr_defaults[ $key ] ) {
$this->{$property} = $this->lhr_info[ $key ];
}
}
} // End of class.
endif; // End of if class_exists.

View File

@@ -0,0 +1,60 @@
<?php
/**
* Debug Bar Shortcodes - Debug Bar Shortcode Info Playlist.
*
* @package WordPress\Plugins\Debug Bar Shortcodes
* @subpackage WordPress\Plugins\Debug Bar Shortcodes\Shortcode Info
* @author Juliette Reinders Folmer <wpplugins_nospam@adviesenzo.nl>
* @link https://github.com/jrfnl/Debug-Bar-Shortcodes
* @since 2.0
*
* @copyright 2013-2016 Juliette Reinders Folmer
* @license http://creativecommons.org/licenses/GPL/2.0/ GNU General Public License, version 2 or higher
*/
if ( ! class_exists( 'Debug_Bar_Shortcode_Info_Playlist' ) ) :
/**
* Information on the standard WP [playlist] shortcode.
*/
class Debug_Bar_Shortcode_Info_Playlist extends Debug_Bar_Shortcode_Info_Defaults {
/**
* Whether the shortcode is self-closing or not.
*
* @var bool|null $self_closing
*/
public $self_closing = true;
/**
* Info URL.
*
* @var string $info_url
*/
public $info_url = 'http://codex.wordpress.org/Playlist_Shortcode';
/**
* Constructor - set some properties which need to be translated.
*/
public function __construct() {
$this->name = __( 'Media Playlist', 'debug-bar-shortcodes' );
$this->description = __( 'The playlist shortcode implements the functionality of displaying a collection of WordPress audio or video files in a post using a simple Shortcode.', 'debug-bar-shortcodes' );
$this->parameters['optional'] = array(
'type' => __( 'Type of playlist to display. Accepts "audio" or "video". Defaults to "audio".', 'debug-bar-shortcodes' ),
'order' => __( 'Designates ascending or descending order of items in the playlist. Accepts "ASC", "DESC". Defaults to "ASC".', 'debug-bar-shortcodes' ),
'orderby' => __( 'Any column, or columns, to sort the playlist by. Accepts "rand" to play the list in random order. Defaults to "menu_order ID". If `$ids` are passed, this defaults to the order of the $ids array (\'post__in\').', 'debug-bar-shortcodes' ),
'id' => __( 'If an explicit `$ids` array is not present, this parameter will determine which attachments are used for the playlist. Defaults to the current post ID.', 'debug-bar-shortcodes' ),
'ids' => __( 'Create a playlist out of these explicit attachment IDs. If empty, a playlist will be created from all `$type` attachments of `$id`.', 'debug-bar-shortcodes' ),
'exclude' => __( 'List of specific attachment IDs to exclude from the playlist.', 'debug-bar-shortcodes' ),
'style' => __( 'Playlist style to use. Accepts "light" or "dark". Defaults to "light".', 'debug-bar-shortcodes' ),
'tracklist' => __( 'Whether to show or hide the playlist. Defaults to (bool) true.', 'debug-bar-shortcodes' ),
'tracknumbers' => __( 'Whether to show or hide the numbers next to entries in the playlist. Defaults to (bool) true.', 'debug-bar-shortcodes' ),
'images' => __( 'Show or hide the video or audio thumbnail (Featured Image/post thumbnail). Defaults to (bool) true.', 'debug-bar-shortcodes' ),
'artists' => __( 'Whether to show or hide artist name in the playlist. Defaults to (bool) true.', 'debug-bar-shortcodes' ),
);
}
} // End of class.
endif; // End of if class_exists.

View File

@@ -0,0 +1,93 @@
<?php
/**
* Debug Bar Shortcodes - Debug Bar Shortcode Info Reflection.
*
* @package WordPress\Plugins\Debug Bar Shortcodes
* @subpackage WordPress\Plugins\Debug Bar Shortcodes\Shortcode Info
* @author Juliette Reinders Folmer <wpplugins_nospam@adviesenzo.nl>
* @link https://github.com/jrfnl/Debug-Bar-Shortcodes
* @since 2.0
*
* @copyright 2013-2016 Juliette Reinders Folmer
* @license http://creativecommons.org/licenses/GPL/2.0/ GNU General Public License, version 2 or higher
*/
if ( ! class_exists( 'Debug_Bar_Shortcode_Info_Reflection' ) ) :
/**
* Retrieve information on a shortcode using Reflection.
*
* Utility class. Not meant to be called directly, but meant to be extended.
*/
class Debug_Bar_Shortcode_Info_Reflection extends Debug_Bar_Shortcode_Info_Defaults {
/**
* The current shortcode.
*
* @var string $shortcode
*/
protected $shortcode = '';
/**
* Reflection object for the function being called for the current shortcode.
*
* @var object $reflection_object
*/
protected $reflection_object;
/**
* Constructor - set the properties.
*
* @param string $shortcode The shortcode for which to retrieve info.
*/
public function __construct( $shortcode = '' ) {
if ( ! empty( $shortcode ) && is_string( $shortcode ) ) {
$this->shortcode = $shortcode;
}
$this->set_reflection_object();
}
/**
* Retrieve a Reflection object for the file a shortcode is in.
*
* @uses $this->shortcode
* @uses $this->reflection_object
*/
private function set_reflection_object() {
$shortcodes = $GLOBALS['shortcode_tags'];
if ( empty( $this->shortcode ) || ! isset( $shortcodes[ $this->shortcode ] ) ) {
// Not a registered shortcode.
return;
}
$callback = $shortcodes[ $this->shortcode ];
if ( ! is_string( $callback ) && ( ! is_array( $callback ) || ( is_array( $callback ) && ( ! is_string( $callback[0] ) && ! is_object( $callback[0] ) ) ) ) && ( ! is_object( $callback ) || ( is_object( $callback ) && ! Debug_Bar_Shortcodes_Render::is_closure( $callback ) ) ) ) {
// Not a valid callback.
return;
}
/* Set up reflection. */
if ( ( is_string( $callback ) && false === strpos( $callback, '::' ) ) || ( is_object( $callback ) && Debug_Bar_Shortcodes_Render::is_closure( $callback ) ) ) {
$this->reflection_object = new ReflectionFunction( $callback );
}
elseif ( is_string( $callback ) && false !== strpos( $callback, '::' ) ) {
$this->reflection_object = new ReflectionMethod( $callback );
}
elseif ( is_array( $callback ) ) {
$this->reflection_object = new ReflectionMethod( $callback[0], $callback[1] );
}
if ( isset( $this->reflection_object ) && false === $this->reflection_object->isUserDefined() ) {
// Not a user defined callback, i.e. native PHP, nothing to find out about it (shouldn't ever happen).
$this->reflection_object = null;
}
}
} // End of class.
endif; // End of if class_exists.

View File

@@ -0,0 +1,143 @@
<?php
/**
* Debug Bar Shortcodes - Debug Bar Shortcode Info Shortcake.
*
* @package WordPress\Plugins\Debug Bar Shortcodes
* @subpackage WordPress\Plugins\Debug Bar Shortcodes\Shortcode Info
* @author Juliette Reinders Folmer <wpplugins_nospam@adviesenzo.nl>
* @link https://github.com/jrfnl/Debug-Bar-Shortcodes
* @since 2.0
*
* @copyright 2013-2016 Juliette Reinders Folmer
* @license http://creativecommons.org/licenses/GPL/2.0/ GNU General Public License, version 2 or higher
*/
if ( ! class_exists( 'Debug_Bar_Shortcode_Info_Shortcake' ) ) :
/**
* Information on a shortcode based on what's available through the Shortcake UI registration.
*
* @see [Shortcake](https://wordpress.org/plugins/shortcode-ui/)
* @see https://github.com/wp-shortcake/Shortcake/
*
* @todo Potentially provide support for shortcake ui registrations from other plugins even
* when shortcake itself is not available. I.e. run their hooks to obtain the info.
*
* Current implementation based on Shortcake 0.6.2.
*/
class Debug_Bar_Shortcode_Info_Shortcake extends Debug_Bar_Shortcode_Info_From_File {
/**
* Shortcode as registered in Shortcake.
*
* @var array
*/
private $shortcake;
/**
* Constructor - set the properties.
*
* @param string $shortcode The shortcode for which to retrieve info.
*/
public function __construct( $shortcode = '' ) {
$shortcake = shortcode_ui_get_register_shortcode( $shortcode );
if ( ! isset( $shortcake ) ) {
return;
}
$this->shortcake = $shortcake;
Debug_Bar_Shortcode_Info_Reflection::__construct( $shortcode ); // Skip parent, do grandparent.
$this->set_name();
$this->set_description();
$this->set_self_closing();
$this->set_parameters();
$this->set_info_url();
}
/**
* Set the name property if Shortcake provided us with usable information.
*/
private function set_name() {
if ( ! empty( $this->shortcake['label'] ) && ( is_string( $this->shortcake['label'] ) && $this->shortcake['label'] !== $this->shortcode ) ) {
$this->name = $this->shortcake['label'];
}
}
/**
* Set the description property if Shortcake provided us with usable information.
*
* @internal Description field support does not exist yet within Shortcake.
* @see https://github.com/wp-shortcake/Shortcake/issues/386
*/
private function set_description() {
if ( ! empty( $this->shortcake['description'] ) && is_string( $this->shortcake['description'] ) ) {
$this->description = $this->shortcake['description'];
}
}
/**
* Set the self_closing property if Shortcake provided us with usable information.
*/
private function set_self_closing() {
if ( ! empty( $this->shortcake['inner_content'] ) && is_array( $this->shortcake['inner_content'] ) ) {
$this->self_closing = false;
}
else {
$this->self_closing = true;
}
}
/**
* Set the parameter property if Shortcake provided us with usable information.
*/
private function set_parameters() {
if ( ! empty( $this->shortcake['attrs'] ) && is_array( $this->shortcake['attrs'] ) ) {
foreach ( $this->shortcake['attrs'] as $attr_array ) {
if ( ! isset( $attr_array['attr'] ) ) {
continue;
}
$text = '';
foreach ( array( 'label', 'description' ) as $key ) {
if ( ! empty( $attr_array[ $key ] ) && is_string( $attr_array[ $key ] ) ) {
$text .= $attr_array[ $key ] . '. ';
}
}
unset( $key );
// Does not exist yet - issue https://github.com/wp-shortcake/Shortcake/issues/132 .
if ( isset( $attr_array['required'] ) && true === $attr_array['required'] ) {
$this->parameters['required'][ $attr_array['attr'] ] = $text;
}
else {
$this->parameters['optional'][ $attr_array['attr'] ] = $text;
}
}
}
}
/**
* Set the info URL.
*
* @internal Maybe move this to an ajax call once Shortcake is used more as is expensive.
*/
private function set_info_url() {
if ( $this->reflection_object instanceof ReflectionFunctionAbstract ) {
$this->info_url = $this->get_plugin_url_from_file( $this->reflection_object->getFileName() );
}
}
} // End of class.
endif; // End of if class_exists.

View File

@@ -0,0 +1,125 @@
<?php
/**
* Debug Bar Shortcodes - Debug Bar Shortcode Info Validator.
*
* @package WordPress\Plugins\Debug Bar Shortcodes
* @subpackage WordPress\Plugins\Debug Bar Shortcodes\Shortcode Info
* @author Juliette Reinders Folmer <wpplugins_nospam@adviesenzo.nl>
* @link https://github.com/jrfnl/Debug-Bar-Shortcodes
* @since 2.0
*
* @copyright 2013-2016 Juliette Reinders Folmer
* @license http://creativecommons.org/licenses/GPL/2.0/ GNU General Public License, version 2 or higher
*/
if ( ! class_exists( 'Debug_Bar_Shortcode_Info_Validator' ) ) :
/**
* Retrieve information on a shortcode using Reflection.
*
* Utility class. Not meant to be called directly, but meant to be extended.
*/
class Debug_Bar_Shortcode_Info_Validator extends Debug_Bar_Shortcode_Info_Defaults {
/**
* Unvalidated shortcode info.
*
* @var object $dirty
*/
private $dirty;
/**
* Validate the shortcode info before using it to make sure that it's still in a usable form.
*
* @param object|array $info Shortcode info.
*/
public function __construct( $info ) {
if ( is_object( $info ) ) {
$this->dirty = $info;
}
elseif ( is_array( $info ) && ! empty( $info ) ) {
$this->dirty = (object) $info;
}
else {
// No valid input received, will effectively return the default properties.
return;
}
$this->validate_name();
$this->validate_description();
$this->validate_self_closing();
$this->validate_parameters();
$this->validate_info_url();
unset( $this->dirty );
}
/**
* Validate a shortcode name.
*/
private function validate_name() {
if ( isset( $this->dirty->name ) && is_string( $this->dirty->name ) && '' !== trim( $this->dirty->name ) ) {
$this->name = sanitize_text_field( trim( $this->dirty->name ) );
}
}
/**
* Validate a shortcode description.
*/
private function validate_description() {
if ( isset( $this->dirty->description ) && is_string( $this->dirty->description ) && '' !== trim( $this->dirty->description ) ) {
$this->description = wp_kses( trim( $this->dirty->description ), array( 'br' => array() ) );
}
}
/**
* Validate the self_closing information.
*/
private function validate_self_closing() {
if ( isset( $this->dirty->self_closing ) ) {
// Work around flacky behaviour of PHP for the FILTER_NULL_ON_FAILURE flag.
if ( is_bool( $this->dirty->self_closing ) ) {
$this->self_closing = $this->dirty->self_closing;
}
elseif ( function_exists( 'filter_var' ) ) {
$this->self_closing = filter_var( $this->dirty->self_closing, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE );
}
}
}
/**
* Validate the shortcode parameters information.
*/
private function validate_parameters() {
if ( ! empty( $this->dirty->parameters ) && is_array( $this->dirty->parameters ) ) {
foreach ( $this->parameters as $k => $v ) {
if ( ! empty( $this->dirty->parameters[ $k ] ) && is_array( $this->dirty->parameters[ $k ] ) ) {
foreach ( $this->dirty->parameters[ $k ] as $attr => $explanation ) {
if ( ( ( is_string( $attr ) && '' !== trim( $attr ) ) || ( is_int( $attr ) && $attr >= 0 ) ) && ( is_string( $explanation ) && '' !== trim( $explanation ) ) ) {
$this->parameters[ $k ][ sanitize_key( trim( $attr ) ) ] = sanitize_text_field( trim( $explanation ) );
}
}
unset( $attr, $explanation );
}
}
unset( $k, $v );
}
}
/**
* Validate the shortcode info URL.
*/
private function validate_info_url() {
if ( ( isset( $this->dirty->info_url ) && is_string( $this->dirty->info_url ) && preg_match( '`http(s?)://(.+)`i', $this->dirty->info_url ) ) ) {
$this->info_url = esc_url_raw( trim( $this->dirty->info_url ) );
}
}
} // End of class.
endif; // End of if class_exists.

View File

@@ -0,0 +1,71 @@
<?php
/**
* Debug Bar Shortcodes - Debug Bar Shortcode Info Video.
*
* @package WordPress\Plugins\Debug Bar Shortcodes
* @subpackage WordPress\Plugins\Debug Bar Shortcodes\Shortcode Info
* @author Juliette Reinders Folmer <wpplugins_nospam@adviesenzo.nl>
* @link https://github.com/jrfnl/Debug-Bar-Shortcodes
* @since 2.0
*
* @copyright 2013-2016 Juliette Reinders Folmer
* @license http://creativecommons.org/licenses/GPL/2.0/ GNU General Public License, version 2 or higher
*/
if ( ! class_exists( 'Debug_Bar_Shortcode_Info_Video' ) ) :
/**
* Information on the standard WP [video] shortcode.
*/
class Debug_Bar_Shortcode_Info_Video extends Debug_Bar_Shortcode_Info_Defaults {
/**
* Whether the shortcode is self-closing or not.
*
* @var bool|null $self_closing
*/
public $self_closing = true;
/**
* Info URL.
*
* @var string $info_url
*/
public $info_url = 'http://codex.wordpress.org/Video_Shortcode';
/**
* Constructor - set some properties which need to be translated.
*/
public function __construct() {
$this->name = __( 'Video Media', 'debug-bar-shortcodes' );
$this->description = __( 'The Video feature allows you to embed video files and play them back. This was added as of WordPress 3.6.', 'debug-bar-shortcodes' );
/* translators: %s = height/weight. */
$string = __( 'Defines %s of the media. Value is automatically detected on file upload.', 'debug-bar-shortcodes' );
$this->parameters['required'] = array(
'height' => sprintf( $string, __( 'height', 'debug-bar-shortcodes' ) ),
'width' => sprintf( $string, __( 'width', 'debug-bar-shortcodes' ) ),
);
/* translators: %s = file extension. */
$string = __( 'Source of %s fallback file.', 'debug-bar-shortcodes' );
$this->parameters['optional'] = array(
'src' => __( 'The source of your video file. If not included it will auto-populate with the first video file attached to the post.', 'debug-bar-shortcodes' ),
'mp4' => sprintf( $string, 'mp4' ),
'm4v' => sprintf( $string, 'm4v' ),
'webm' => sprintf( $string, 'webm' ),
'ogv' => sprintf( $string, 'ogv' ),
'wmv' => sprintf( $string, 'wmv' ),
'flv' => sprintf( $string, 'flv' ),
'poster' => __( 'Defines image to show as placeholder before the media plays. Defaults to "none".', 'debug-bar-shortcodes' ),
'loop' => __( 'Allows for the looping of media. Defaults to "off"', 'debug-bar-shortcodes' ),
'autoplay' => __( 'Causes the media to automatically play as soon as the media file is ready. Defaults to "off".', 'debug-bar-shortcodes' ),
'preload' => __( 'Specifies if and how the video should be loaded when the page loads. Defaults to "metadata".', 'debug-bar-shortcodes' ),
);
}
} // End of class.
endif; // End of if class_exists.

View File

@@ -0,0 +1,23 @@
<?php
/**
* Debug Bar Shortcodes - Debug Bar Shortcode Info WP Caption.
*
* @package WordPress\Plugins\Debug Bar Shortcodes
* @subpackage WordPress\Plugins\Debug Bar Shortcodes\Shortcode Info
* @author Juliette Reinders Folmer <wpplugins_nospam@adviesenzo.nl>
* @link https://github.com/jrfnl/Debug-Bar-Shortcodes
* @since 2.0
*
* @copyright 2013-2016 Juliette Reinders Folmer
* @license http://creativecommons.org/licenses/GPL/2.0/ GNU General Public License, version 2 or higher
*/
if ( ! class_exists( 'Debug_Bar_Shortcode_Info_WP_Caption' ) ) :
/**
* Information on the standard WP [wp_caption] shortcode.
*/
class Debug_Bar_Shortcode_Info_WP_Caption extends Debug_Bar_Shortcode_Info_Caption {
}
endif; // End of if class_exists.

View File

@@ -0,0 +1,274 @@
<?php
/**
* Debug Bar Shortcodes - Debug Bar Shortcode Info.
*
* @package WordPress\Plugins\Debug Bar Shortcodes
* @subpackage WordPress\Plugins\Debug Bar Shortcodes\Shortcode Info
* @author Juliette Reinders Folmer <wpplugins_nospam@adviesenzo.nl>
* @link https://github.com/jrfnl/Debug-Bar-Shortcodes
* @since 2.0
*
* @copyright 2013-2016 Juliette Reinders Folmer
* @license http://creativecommons.org/licenses/GPL/2.0/ GNU General Public License, version 2 or higher
*/
if ( ! class_exists( 'Debug_Bar_Shortcode_Info' ) ) :
/**
* Retrieve shortcode info.
*/
class Debug_Bar_Shortcode_Info {
/**
* The shortcode this object applies to.
*
* @var string $shortcode
*/
protected $shortcode = '';
/**
* Defaults.
*
* @var \Debug_Bar_Shortcode_Info_Defaults $defaults
*/
protected $defaults;
/**
* Shortcode info object.
*
* Can be of type Debug_Bar_Shortcode_Info_Defaults (or one of it's children), but doesn't have to be.
*
* @var object $info
*/
protected $info;
/**
* The names of the shortcodes which are included with WP by default.
*
* @var array $wp_shortcodes
*/
protected $wp_shortcodes = array(
'audio',
'video',
'caption',
'wp_caption',
'gallery',
'embed',
'playlist',
);
/**
* Try and enrich the shortcode with additional information.
*
* @param string $shortcode Current shortcode.
* @param bool $use_reflection Whether or not to get additional information from the function documentation.
* Defaults to false.
*/
public function __construct( $shortcode, $use_reflection = false ) {
$this->defaults = new Debug_Bar_Shortcode_Info_Defaults();
$this->info = $this->defaults;
// Bail out if we didn't receive a valid shortcode.
if ( empty( $shortcode ) || ! is_string( $shortcode ) ) {
return;
}
$this->shortcode = $shortcode;
// Low priority to allow override by better data.
add_filter( 'db_shortcodes_info_' . $this->shortcode, array( $this, 'lhr_shortcode_info' ), 8 );
add_filter( 'db_shortcodes_info_' . $this->shortcode, array( $this, 'shortcake_shortcode_info' ), 9 );
add_filter( 'db_shortcodes_info_' . $this->shortcode, array( $this, 'wp_shortcode_info' ), 10 );
if ( true === $use_reflection && true === $this->is_registered() ) {
add_filter( 'db_shortcodes_info_' . $this->shortcode, array( $this, 'shortcode_info_from_documentation' ), 12 );
}
/*
* Casts objects to array before passing them into the filter for backwards compatibility
* with the original (pre-2.0) documentation.
*
* @todo document filters
*/
$info = (object) apply_filters( 'db_shortcodes_info', $this->defaults, $this->shortcode, (array) $this->defaults );
$info = (object) apply_filters( 'db_shortcodes_info_' . $this->shortcode, $info, (array) $info );
// Make sure that the information is usable.
$this->info = new Debug_Bar_Shortcode_Info_Validator( $info );
}
/**
* Get the info object for this shortcode.
*
* @return \Debug_Bar_Shortcode_Info_Defaults
*/
public function get_info_object() {
return $this->info;
}
/**
* Check whether the shortcode has details beyond the defaults.
*
* @return bool True if it has, false otherwise.
*/
public function has_details() {
return ( (array) $this->info !== (array) $this->defaults );
}
/**
* Check whether the shortcode has been registered in WP.
*
* @return bool True if registered, false otherwise.
*/
public function is_registered() {
return ( ! empty( $this->shortcode ) && isset( $GLOBALS['shortcode_tags'][ $this->shortcode ] ) );
}
/* ************** METHODS TO RETRIEVE SHORTCODE INFO ************** */
/**
* Get potentially provided info for a shortcode in the lhr shortcode plugin format.
*
* @param object $info Shortcode info.
*
* @return object Updated shortcode info.
*/
public function lhr_shortcode_info( $info ) {
// If the current shortcode is native to WP Core, don't use the lhr info as the info
// in this plugin is better.
if ( in_array( $this->shortcode, $this->wp_shortcodes, true ) || false === has_filter( 'sim_' . $this->shortcode ) ) {
return $info;
}
$additional = new Debug_Bar_Shortcode_Info_LHR( $this->shortcode );
return $this->merge_info_objects( $additional, $info );
}
/**
* Get potentially provided info for a shortcode based on the Shortcake UI registration.
*
* @param object $info Shortcode info.
*
* @return object Updated shortcode info.
*/
public function shortcake_shortcode_info( $info ) {
// Bail out if Shortcake is not available.
if ( ! function_exists( 'shortcode_ui_get_register_shortcode' ) ) {
return $info;
}
$additional = new Debug_Bar_Shortcode_Info_Shortcake( $this->shortcode );
return $this->merge_info_objects( $additional, $info );
}
/**
* Enrich the information for the standard WP shortcodes.
*
* @param object $info Shortcode info.
*
* @return object Updated shortcode info.
*/
public function wp_shortcode_info( $info ) {
// Return early if not a WP Core native shortcode.
if ( ! in_array( $this->shortcode, $this->wp_shortcodes, true ) ) {
return $info;
}
$class = 'Debug_Bar_Shortcode_Info_' . $this->shortcode;
$additional = new $class;
return $this->merge_info_objects( $additional, $info );
}
/**
* Conditionally retrieve additional info about a shortcode based on the function/method documentation.
*
* @param object $info Shortcode info.
*
* @return object Updated shortcode info.
*/
public function shortcode_info_from_documentation( $info ) {
$additional = new Debug_Bar_Shortcode_Info_From_File( $this->shortcode );
return $this->merge_info_objects( $additional, $info );
}
/* ************** HELPER METHODS ************** */
/**
* Merge two info objects into one making sure that the old values are not overruled by 'empties'.
*
* The received value *could* be an array if someone still uses the old filter logic.
*
* @param object|array $new The new values.
* @param object|array $old The old values.
*
* @return object
*/
public function merge_info_objects( $new, $old ) {
// Filter out the empties, but preserve the value for self_closing (which could be false).
$new_filtered = array_filter( (array) $new );
$new_filtered['self_closing'] = isset( $new->self_closing ) ? $new->self_closing : null;
return (object) $this->array_merge_recursive_distinct( (array) $old, $new_filtered );
}
/**
* Recursively merge a variable number of arrays, using the left array as base,
* giving priority to the right array.
*
* Difference with native array_merge_recursive():
* `array_merge_recursive()` converts values with duplicate keys to arrays rather than
* overwriting the value in the first array with the duplicate value in the second array.
*
* `array_merge_recursive_distinct()` does not change the data types of the values in the arrays.
* Matching keys' values in the second array overwrite those in the first array, as is the
* case with array_merge.
*
* Freely based on information found on http://www.php.net/manual/en/function.array-merge-recursive.php.
*
* @params array $arrays 2 or more arrays to merge.
*
* @return array
*/
private function array_merge_recursive_distinct() {
$arrays = func_get_args();
if ( count( $arrays ) < 2 ) {
if ( empty( $arrays ) ) {
return array();
}
else {
return $arrays[0];
}
}
$merged = array_shift( $arrays );
foreach ( $arrays as $array ) {
foreach ( $array as $key => $value ) {
if ( is_array( $value ) && ( isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) ) {
$merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value );
}
else {
$merged[ $key ] = $value;
}
}
unset( $key, $value );
}
return $merged;
}
} // End of class.
endif; // End of if class_exists.

View File

@@ -0,0 +1,2 @@
<?php
// Nothing to see here.