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,71 @@
<?php
/**
* Debug Bar Constants Panel - Base class for a Debug Bar Constants Debug Bar Panels.
*
* @package WordPress\Plugins\Debug Bar Constants
* @author Juliette Reinders Folmer <wpplugins_nospam@adviesenzo.nl>
* @link https://github.com/jrfnl/Debug-Bar-Constants
*
* @copyright 2013-2018 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();
}
if ( ! class_exists( 'Debug_Bar_Constants_Panel' ) && class_exists( 'Debug_Bar_Panel' ) ) {
/**
* Base class.
*/
abstract class Debug_Bar_Constants_Panel extends Debug_Bar_Panel {
/**
* Should the tab be visible ?
* You can set conditions here so something will for instance only show on the front- or the
* back-end.
*/
public function prerender() {
$this->set_visible( true );
}
/**
* Helper method to render the output in a table.
*
* @param array $array Array to be shown in the table.
* @param string|null $col1 Label for the first table column.
* @param string|null $col2 Label for the second table column.
* @param string|array|null $class One or more CSS classes to add to the table.
*/
public function dbc_render_table( $array, $col1 = null, $col2 = null, $class = null ) {
$classes = Debug_Bar_Constants_Init::DBC_NAME;
if ( isset( $class ) ) {
if ( is_string( $class ) && '' !== $class ) {
$classes .= ' ' . $class;
} elseif ( ! empty( $class ) && is_array( $class ) ) {
$classes = $classes . ' ' . implode( ' ', $class );
}
}
$col1 = ( isset( $col1 ) ? $col1 : __( 'Name', 'debug-bar-constants' ) );
$col2 = ( isset( $col2 ) ? $col2 : __( 'Value', 'debug-bar-constants' ) );
uksort( $array, 'strnatcasecmp' );
if ( defined( 'Debug_Bar_Pretty_Output::VERSION' ) ) {
echo Debug_Bar_Pretty_Output::get_table( $array, $col1, $col2, $classes ); // WPCS: xss ok.
} else {
// An old version of the pretty output class was loaded.
Debug_Bar_Pretty_Output::render_table( $array, $col1, $col2, $classes );
}
}
} // End of class Debug_Bar_Constants_Panel.
} // End of if class_exists wrapper.

View File

@@ -0,0 +1,124 @@
<?php
/**
* Debug Bar Constants.
*
* @package WordPress\Plugins\Debug Bar Constants
* @author Juliette Reinders Folmer <wpplugins_nospam@adviesenzo.nl>
* @link https://github.com/jrfnl/Debug-Bar-Constants
*
* @copyright 2013-2018 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();
}
if ( ! class_exists( 'Debug_Bar_Constants' ) ) {
/**
* Plugin controller.
*/
class Debug_Bar_Constants {
/**
* Plugin version nr for use with enqueuing styles.
*
* @var string
*/
const DBC_STYLES_VERSION = '2.0.0';
/**
* Plugin version nr for use with enqueuing scripts.
*
* @var string
*/
const DBC_SCRIPT_VERSION = '2.0.0';
/**
* Constructor.
*/
public function __construct() {
spl_autoload_register( array( $this, 'auto_load' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
// Low priority, no need for it to be high up in the list.
add_filter( 'debug_bar_panels', array( $this, 'add_panels' ), 12 );
}
/**
* Auto load our class files.
*
* @param string $class Class name.
*
* @return void
*/
public function auto_load( $class ) {
static $classes = null;
if ( null === $classes ) {
$classes = array(
'debug_bar_constants_panel' => 'class-debug-bar-constants-panel.php',
'debug_bar_wp_constants' => 'class-debug-bar-wp-constants.php',
'debug_bar_wp_class_constants' => 'class-debug-bar-wp-class-constants.php',
'debug_bar_php_constants' => 'class-debug-bar-php-constants.php',
'debug_bar_pretty_output' => 'inc/debug-bar-pretty-output/class-debug-bar-pretty-output.php',
'debug_bar_list_php_classes' => 'inc/debug-bar-pretty-output/class-debug-bar-list-php-classes.php',
);
}
$cn = strtolower( $class );
if ( isset( $classes[ $cn ] ) ) {
include_once plugin_dir_path( __FILE__ ) . $classes[ $cn ];
}
}
/**
* Enqueue js and css files.
*/
public function enqueue_scripts() {
$suffix = ( ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min' );
wp_enqueue_style(
Debug_Bar_Constants_Init::DBC_NAME,
plugins_url( 'css/' . Debug_Bar_Constants_Init::DBC_NAME . $suffix . '.css', __FILE__ ),
array( 'debug-bar' ),
self::DBC_STYLES_VERSION
);
wp_enqueue_script(
Debug_Bar_Constants_Init::DBC_NAME,
plugins_url( 'js/jquery.ui.totop' . $suffix . '.js', __FILE__ ),
array( 'jquery' ),
self::DBC_SCRIPT_VERSION,
true
);
}
/**
* Add the Debug Bar Constant panels to the Debug Bar.
*
* @param array $panels Existing debug bar panels.
*
* @return array
*/
public function add_panels( $panels ) {
$panels[] = new Debug_Bar_WP_Constants();
$panels[] = new Debug_Bar_WP_Class_Constants();
$panels[] = new Debug_Bar_PHP_Constants();
return $panels;
}
} // End of class Debug_Bar_Constants.
} // End of if class_exists wrapper.

View File

@@ -0,0 +1,135 @@
<?php
/**
* Debug Bar PHP Constants - Debug Bar Panel.
*
* @package WordPress\Plugins\Debug Bar Constants
* @author Juliette Reinders Folmer <wpplugins_nospam@adviesenzo.nl>
* @link https://github.com/jrfnl/Debug-Bar-Constants
*
* @copyright 2013-2017 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();
}
if ( ! class_exists( 'Debug_Bar_PHP_Constants' ) && class_exists( 'Debug_Bar_Constants_Panel' ) ) {
/**
* Debug Bar PHP Constants.
*/
class Debug_Bar_PHP_Constants extends Debug_Bar_Constants_Panel {
/**
* Constructor.
*/
public function init() {
$this->title( __( 'PHP Constants', 'debug-bar-constants' ) );
}
/**
* Render the output.
*/
public function render() {
$constants = get_defined_constants( true );
unset( $constants['user'] );
if ( ! empty( $constants ) && is_array( $constants ) ) {
uksort( $constants, 'strnatcasecmp' );
foreach ( $constants as $category => $set ) {
echo '
<h2><a href="#dbcphp-', esc_attr( $category ), '"><span>', esc_html( $category ), ':</span>', (int) count( $set ), '</a></h2>';
}
unset( $category, $set );
foreach ( $constants as $category => $set ) {
if ( ! empty( $set ) && is_array( $set ) ) {
// Set url to correct page in the PHP manual for more info.
$url = $this->get_php_manual_url( $category );
/* TRANSLATORS: %s = the name of a PHP extension. */
$title_attr = sprintf( __( 'Visit the PHP manual page about the %s constants.', 'debug-bar-constants' ), $category );
echo '
<h3 id="dbcphp-', esc_attr( $category ), '"><em>';
if ( ! empty( $url ) ) {
echo '<a href="', esc_url( $url ), '" target="_blank" title="', esc_attr( $title_attr ), '">', esc_html( ucfirst( $category ) ), '</a>';
} else {
echo esc_html( ucfirst( $category ) );
}
echo '</em> ', esc_html__( 'Constants:', 'debug-bar-constants' ), '</h3>';
$this->dbc_render_table( $set );
}
}
unset( $category, $set, $title_attr );
} else {
// Should never happen.
echo '<p>', esc_html__( 'No PHP constants found... this is really weird...', 'debug-bar-constants' ), '</p>';
}
}
/**
* Retrieve the PHP manual URL for the constants page of a specific PHP extension.
*
* Works round some of the peculiarities of the PHP.net URL scheme.
*
* @param string $category The PHP Extension for which to retrieve the URL.
*
* @return string URL
*/
protected function get_php_manual_url( $category ) {
$category = strtolower( $category );
switch ( $category ) {
case 'core':
$url = 'http://php.net/reserved.constants';
break;
case 'date':
$url = 'http://php.net/datetime.constants';
break;
case 'gd':
$url = 'http://php.net/image.constants';
break;
case 'odbc':
$url = 'http://php.net/uodbc.constants';
break;
case 'standard':
$url = ''; // Definitions are all over, part of core.
break;
case 'tokenizer':
$url = 'http://php.net/tokens';
break;
case 'xdebug':
$url = 'http://xdebug.com/docs/';
break;
default:
$url = 'http://php.net/' . rawurlencode( $category ) . '.constants';
break;
}
return $url;
}
} // End of class Debug_Bar_PHP_Constants.
} // End of if class_exists wrapper.

View File

@@ -0,0 +1,109 @@
<?php
/**
* Debug Bar WP Class Constants - Debug Bar Panel.
*
* @package WordPress\Plugins\Debug Bar Constants
* @author Juliette Reinders Folmer <wpplugins_nospam@adviesenzo.nl>
* @link https://github.com/jrfnl/Debug-Bar-Constants
*
* @copyright 2013-2018 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();
}
if ( ! class_exists( 'Debug_Bar_WP_Class_Constants' ) && class_exists( 'Debug_Bar_Constants_Panel' ) ) {
/**
* Debug Bar WP Class Constants.
*/
class Debug_Bar_WP_Class_Constants extends Debug_Bar_Constants_Panel {
/**
* Constructor.
*/
public function init() {
$this->title( __( 'WP Class Constants', 'debug-bar-constants' ) );
}
/**
* Render the output.
*/
public function render() {
$classes = get_declared_classes();
if ( class_exists( 'Debug_Bar_List_PHP_Classes' ) && property_exists( 'Debug_Bar_List_PHP_Classes', 'PHP_classes' ) ) {
$classes = array_udiff( $classes, Debug_Bar_List_PHP_Classes::$PHP_classes, 'strcasecmp' );
}
$constants = array();
if ( ! empty( $classes ) && is_array( $classes ) ) {
// Get the constants info first.
foreach ( $classes as $class ) {
$reflector = new ReflectionClass( $class );
$class_constants = $reflector->getConstants();
if ( ! empty( $class_constants ) && is_array( $class_constants ) ) {
$constants[ $class ] = $class_constants;
}
unset( $class_constants, $reflector );
}
unset( $class );
// Generate the output.
if ( ! empty( $constants ) && is_array( $constants ) ) {
uksort( $constants, 'strnatcasecmp' );
foreach ( $constants as $class => $set ) {
$count = count( $set );
echo '
<h2><a href="#dbcwpc-', esc_attr( $class ), '"><span>', esc_html( $class ), ':</span>', (int) $count, '</a></h2>';
unset( $count );
}
unset( $class, $set );
echo '<p class="dbcwpc-info">';
printf(
/* TRANSLATORS: 1: <strong> open tag; 2: close tag. */
esc_html__( '%1$sPlease note%2$s: these may be both native WordPress classes as well as classes which may be declared by plugins or themes.', 'debug-bar-constants' ),
'<strong>',
'</strong>'
);
echo '<br/>';
printf(
/* TRANSLATORS: 1: interpolates to "<code>class_name::constant_name</code>". */
esc_html__( 'You can use these constants in your code using %1$s.', 'debug-bar-constants' ),
'<code>class_name::constant_name</code>'
);
echo ' ';
printf(
/* TRANSLATORS: 1: link open tag; 2: link close tag. */
esc_html__( 'See the %1$sFAQ%2$s for more information.', 'debug-bar-constants' ),
'<a href="https://wordpress.org/plugins/debug-bar-constants/faq/" target="_blank">',
'</a>'
);
echo '</p>';
foreach ( $constants as $class => $set ) {
echo '
<h3 id="dbcwpc-', esc_attr( $class ), '"><em>', esc_html( ucfirst( $class ) ), '</em> ', esc_html__( 'Constants:', 'debug-bar-constants' ), '</h3>';
$this->dbc_render_table( $set );
}
unset( $class, $set );
}
} else {
// Should never happen.
echo '<p>', esc_html__( 'No classes nor class constants found... this is kinda strange...', 'debug-bar-constants' ), '</p>';
}
}
} // End of class Debug_Bar_WP_Class_Constants.
} // End of if class_exists wrapper.

View File

@@ -0,0 +1,63 @@
<?php
/**
* Debug Bar WP Constants - Debug Bar Panel.
*
* @package WordPress\Plugins\Debug Bar Constants
* @author Juliette Reinders Folmer <wpplugins_nospam@adviesenzo.nl>
* @link https://github.com/jrfnl/Debug-Bar-Constants
*
* @copyright 2013-2018 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();
}
if ( ! class_exists( 'Debug_Bar_WP_Constants' ) && class_exists( 'Debug_Bar_Constants_Panel' ) ) {
/**
* Debug Bar WP Constants.
*/
class Debug_Bar_WP_Constants extends Debug_Bar_Constants_Panel {
/**
* Constructor.
*/
public function init() {
$this->title( __( 'WP Constants', 'debug-bar-constants' ) );
}
/**
* Limit visibility of the output to super admins on multi-site and
* admins on non multi-site installations.
*/
public function prerender() {
$this->set_visible( is_super_admin() );
}
/**
* Render the output.
*/
public function render() {
$constants = get_defined_constants( true );
if ( isset( $constants['user'] ) && ( ! empty( $constants['user'] ) && is_array( $constants['user'] ) ) ) {
echo '
<h2><span>', esc_html__( 'Constants within WP:', 'debug-bar-constants' ), '</span>', (int) count( $constants['user'] ), '</h2>';
$this->dbc_render_table( $constants['user'] );
} else {
// Should never happen.
echo '<p>', esc_html__( 'No constants found... this is really weird...', 'debug-bar-constants' ), '</p>';
}
}
} // End of class Debug_Bar_WP_Constants.
} // End of if class_exists wrapper.

View File

@@ -0,0 +1,131 @@
/* CSS for plugin: Debug Bar Constants */
#debug-menu-target-Debug_Bar_PHP_Constants h2 a,
#debug-menu-target-Debug_Bar_WP_Class_Constants h2 a {
text-decoration: none !important;
color: inherit !important;
}
#debug-menu-target-Debug_Bar_PHP_Constants h2:hover,
#debug-menu-target-Debug_Bar_WP_Class_Constants h2:hover {
text-shadow: 0 1px 1px rgba( 0, 0, 0, 0.9 );
background: #333;
-webkit-box-shadow: inset -3px 0 6px rgba( 0, 0, 0, 0.4 );
-moz-box-shadow: inset -3px 0 6px rgba( 0, 0, 0, 0.4 );
box-shadow: inset -3px 0 6px rgba( 0, 0, 0, 0.4 );
-moz-border-radius: 8px;
-webkit-border-radius: 8px;
border-radius: 8px;
border: 1px solid #333;
}
#debug-menu-target-Debug_Bar_PHP_Constants h2:hover a,
#debug-menu-target-Debug_Bar_WP_Class_Constants h2:hover a {
color: #FFFFFF !important;
text-shadow: 0 1px 1px rgba( 0, 0, 0, 0.9 );
}
#debug-menu-target-Debug_Bar_PHP_Constants h3,
#debug-menu-target-Debug_Bar_WP_Class_Constants h3 {
font-family: georgia, times, serif;
font-size: 22px;
margin-top: 1.2em;
clear: both;
}
p.dbcwpc-info {
margin: 1em 0;
padding: 0.7em;
background-color: #D8D8D8;
-webkit-box-shadow: inset -3px 0 6px rgba( 0, 0, 0, 0.4 );
-moz-box-shadow: inset -3px 0 6px rgba( 0, 0, 0, 0.4 );
box-shadow: inset -3px 0 6px rgba( 0, 0, 0, 0.4 );
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
border: 1px solid #333333;
clear: both;
}
table.debug-bar-constants,
table.debug-bar-constants th,
table.debug-bar-constants td {
border: 0px none;
}
table.debug-bar-constants {
width: 100%;
border-collapse: collapse;
cell-padding: 1em;
clear: both;
line-height: 1.5;
font-size: 12px;
table-layout: auto;
}
table.debug-bar-constants thead th,
table.debug-bar-constants tfoot th {
padding: 0.7em 5px;
width: auto;
text-align: center;
}
table.debug-bar-constants thead th {
border-bottom: 1px solid #ccc;
}
table.debug-bar-constants tfoot th {
border-top: 1px solid #ccc;
}
table.debug-bar-constants th {
width: 35%;
font-weight: bold;
padding: 2px 2em 2px 5px;
vertical-align: top;
text-align: left;
}
table.debug-bar-constants td {
padding: 2px 5px;
width: 63%;
vertical-align: top;
}
table.debug-bar-constants tr:nth-child(2n+1) {
background-color: #E8E8E8;
}
/*
|--------------------------------------------------------------------------
| UItoTop jQuery Plugin 1.2
| http://www.mattvarone.com/web-design/uitotop-jquery-plugin/
|--------------------------------------------------------------------------
*/
#toTop {
display: none;
text-decoration: none;
position: fixed;
bottom: 10px;
right: 10px;
overflow: hidden;
width: 51px;
height: 51px;
border: none;
text-indent: 100%;
background: url(../images/ui.totop.png) no-repeat left top;
z-index: 99001;
}
#toTopHover {
background: url(../images/ui.totop.png) no-repeat left -51px;
width: 51px;
height: 51px;
display: block;
overflow: hidden;
float: left;
opacity: 0;
-moz-opacity: 0;
filter: alpha(opacity = 0);
z-index: 99001;
}
#toTop:active, #toTop:focus {
outline: none;
}

View File

@@ -0,0 +1,2 @@
/* CSS for plugin: Debug Bar Constants */
#debug-menu-target-Debug_Bar_PHP_Constants h2 a,#debug-menu-target-Debug_Bar_WP_Class_Constants h2 a{text-decoration:none !important;color:inherit !important}#debug-menu-target-Debug_Bar_PHP_Constants h2:hover,#debug-menu-target-Debug_Bar_WP_Class_Constants h2:hover{text-shadow:0 1px 1px rgba(0,0,0,0.9);background:#333;-webkit-box-shadow:inset -3px 0 6px rgba(0,0,0,0.4);-moz-box-shadow:inset -3px 0 6px rgba(0,0,0,0.4);box-shadow:inset -3px 0 6px rgba(0,0,0,0.4);-moz-border-radius:8px;-webkit-border-radius:8px;border-radius:8px;border:1px solid #333}#debug-menu-target-Debug_Bar_PHP_Constants h2:hover a,#debug-menu-target-Debug_Bar_WP_Class_Constants h2:hover a{color:#fff !important;text-shadow:0 1px 1px rgba(0,0,0,0.9)}#debug-menu-target-Debug_Bar_PHP_Constants h3,#debug-menu-target-Debug_Bar_WP_Class_Constants h3{font-family:georgia,times,serif;font-size:22px;margin-top:1.2em;clear:both}p.dbcwpc-info{margin:1em 0;padding:.7em;background-color:#d8d8d8;-webkit-box-shadow:inset -3px 0 6px rgba(0,0,0,0.4);-moz-box-shadow:inset -3px 0 6px rgba(0,0,0,0.4);box-shadow:inset -3px 0 6px rgba(0,0,0,0.4);-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;border:1px solid #333;clear:both}table.debug-bar-constants,table.debug-bar-constants th,table.debug-bar-constants td{border:0 none}table.debug-bar-constants{width:100%;border-collapse:collapse;cell-padding:1em;clear:both;line-height:1.5;font-size:12px;table-layout:auto}table.debug-bar-constants thead th,table.debug-bar-constants tfoot th{padding:.7em 5px;width:auto;text-align:center}table.debug-bar-constants thead th{border-bottom:1px solid #ccc}table.debug-bar-constants tfoot th{border-top:1px solid #ccc}table.debug-bar-constants th{width:35%;font-weight:bold;padding:2px 2em 2px 5px;vertical-align:top;text-align:left}table.debug-bar-constants td{padding:2px 5px;width:63%;vertical-align:top}table.debug-bar-constants tr:nth-child(2n+1){background-color:#e8e8e8}#toTop{display:none;text-decoration:none;position:fixed;bottom:10px;right:10px;overflow:hidden;width:51px;height:51px;border:0;text-indent:100%;background:url(../images/ui.totop.png) no-repeat left top;z-index:99001}#toTopHover{background:url(../images/ui.totop.png) no-repeat left -51px;width:51px;height:51px;display:block;overflow:hidden;float:left;opacity:0;-moz-opacity:0;filter:alpha(opacity = 0);z-index:99001}#toTop:active,#toTop:focus{outline:0}

View File

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

View File

@@ -0,0 +1,165 @@
<?php
/**
* Debug Bar Constants, a WordPress plugin.
*
* @package WordPress\Plugins\Debug Bar Constants
* @author Juliette Reinders Folmer <wpplugins_nospam@adviesenzo.nl>
* @link https://github.com/jrfnl/Debug-Bar-Constants
* @version 2.0.0
*
* @copyright 2013-2018 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 Constants
* Plugin URI: https://wordpress.org/plugins/debug-bar-constants/
* Description: Debug Bar Constants adds new panels to Debug Bar that display all the defined constants for the current request. Requires "Debug Bar" plugin.
* Version: 2.0.0
* Author: Juliette Reinders Folmer
* Author URI: http://www.adviesenzo.nl/
* Depends: Debug Bar
* Text Domain: debug-bar-constants
* Domain Path: /languages
* Copyright: 2013-2018 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 ( ! class_exists( 'Debug_Bar_Constants_Init' ) ) {
/**
* Initialize plugin.
*/
class Debug_Bar_Constants_Init {
/**
* Plugin name for use with text-domains and CSS classes.
*
* @var string
*/
const DBC_NAME = 'debug-bar-constants';
/**
* Initialize the plugin.
*
* @return void
*/
public static function init() {
/*
* Initialize the main class.
*
* @internal The wp_installing() function was introduced in WP 4.4.
*/
if ( ( function_exists( 'wp_installing' ) && wp_installing() === false )
|| ( ! function_exists( 'wp_installing' )
&& ( ! defined( 'WP_INSTALLING' ) || WP_INSTALLING === false ) )
) {
include_once plugin_dir_path( __FILE__ ) . 'class-debug-bar-constants.php';
$GLOBALS['debug_bar_constants'] = new Debug_Bar_Constants();
}
// Show admin notice & de-activate itself if debug-bar plugin not active.
add_action( 'admin_init', array( __CLASS__, 'has_debug_bar' ) );
add_action( 'init', array( __CLASS__, 'load_textdomain' ) );
}
/**
* Load the plugin text strings.
*
* Compatible with use of the plugin in the must-use plugins directory.
*
* {@internal No longer needed since WP 4.6, though the language loading in
* WP 4.6 only looks at the `wp-content/languages/` directory and disregards
* any translations which may be included with the plugin.
* This is acceptable for plugins hosted on org, especially if the plugin
* is new and never shipped with it's own translations, but not when the plugin
* is hosted elsewhere.
* Can be removed if/when the minimum required version for this plugin is ever
* upped to 4.6. The `languages` directory can be removed in that case too.
* See: {@link https://core.trac.wordpress.org/ticket/34213} and
* {@link https://core.trac.wordpress.org/ticket/34114} }}
*/
public static function load_textdomain() {
$domain = self::DBC_NAME;
if ( function_exists( '_load_textdomain_just_in_time' ) ) {
return;
}
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 );
}
}
/**
* Check for the Debug Bar plugin being installed & active.
*
* @return void
*/
public static function has_debug_bar() {
$file = plugin_basename( __FILE__ );
if ( is_admin()
&& ( ! class_exists( 'Debug_Bar' ) && current_user_can( 'activate_plugins' ) )
&& is_plugin_active( $file )
) {
add_action( 'admin_notices', array( __CLASS__, 'display_admin_notice' ) );
deactivate_plugins( $file, false, is_network_admin() );
// Add to recently active plugins list.
$insert = array(
$file => time(),
);
if ( ! is_network_admin() ) {
update_option( 'recently_activated', ( $insert + (array) get_option( 'recently_activated' ) ) );
} else {
update_site_option( 'recently_activated', ( $insert + (array) get_site_option( 'recently_activated' ) ) );
}
// Prevent trying to activate again on page reload.
if ( isset( $_GET['activate'] ) ) {
unset( $_GET['activate'] );
}
}
}
/**
* Display admin notice about activation failure when dependency not found.
*
* @return void
*/
public static function display_admin_notice() {
echo '<div class="error"><p>';
printf(
/* translators: 1: strong open tag; 2: strong close tag; 3: link to plugin installation page; 4: link close tag. */
esc_html__( 'Activation failed: Debug Bar must be activated to use the %1$sDebug Bar Constants%2$s Plugin. %3$sVisit your plugins page to install & activate%4$s.', 'debug-bar-constants' ),
'<strong>',
'</strong>',
'<a href="' . esc_url( admin_url( 'plugin-install.php?tab=search&s=debug+bar' ) ) . '">',
'</a>'
);
echo '</p></div>';
}
}
}
add_action( 'plugins_loaded', array( 'Debug_Bar_Constants_Init', 'init' ) );

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

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,7 @@
debug-bar-pretty-output
=======================
Helper classes for WordPress Debug Bar plugins.
* `Debug_Bar_Pretty_Output` - pretty prints variables.
* `Debug_Bar_List_PHP_Classes` - lists all PHP Core and Extension classes.

View File

@@ -0,0 +1,690 @@
<?php
/**
* Debug Bar Pretty Output - Helper class for Debug Bar plugins.
*
* Used by the following plugins:
* - Debug Bar Constants
* - Debug Bar Cron (1.0+)
* - Debug Bar Post Types
* - Debug Bar Taxonomies
* - Debug Bar WP Objects (unreleased)
* - Debug Bar Screen Info
*
* @package Debug Bar Pretty Output
* @author Juliette Reinders Folmer <wpplugins_nospam@adviesenzo.nl>
* @link https://github.com/jrfnl/debug-bar-pretty-output
* @version 1.8.0
*
* @copyright 2013-2018 Juliette Reinders Folmer
* @license http://creativecommons.org/licenses/GPL/2.0/ GNU General Public License, version 2 or higher.
*/
if ( ! class_exists( 'Debug_Bar_Pretty_Output' ) && class_exists( 'Debug_Bar_Panel' ) ) {
/**
* Class Debug_Bar_Pretty_Output.
*/
class Debug_Bar_Pretty_Output {
const VERSION = '1.8.0';
const NAME = 'db-pretty-output';
const TBODY_MAX = 10;
/**
* Whether to limit how deep the variable printing will recurse into an array/object.
*
* @var bool|int Set to a positive integer to limit the recursion depth to that depth.
* Defaults to false.
*
* @since 1.4
*/
protected static $limit_recursion = false;
/**
* Set the recursion limit.
*
* Always make sure you also unset the limit after you're done with this class so as not to impact
* other plugins which may be using this printing class.
*
* @since 1.4
*
* @param int $depth Maximum recursion depth.
*/
public static function limit_recursion( $depth ) {
if ( is_int( $depth ) && $depth > 0 ) {
self::$limit_recursion = $depth;
}
}
/**
* Reset the recusion limit to it's default (unlimited).
*
* @since 1.4
*/
public static function unset_recursion_limit() {
self::$limit_recursion = false;
}
/**
* A not-so-pretty method to show pretty output ;-).
*
* @since 1.3
*
* @param mixed $var Variable to show.
* @param string $title Optional. Variable title.
* @param bool $escape Optional. Whether to character escape the textual output.
* @param string $space Internal. Indentation spacing.
* @param bool $short Internal. Short or normal annotation.
* @param int $depth Internal. The depth of the current recursion.
*
* @return string
*/
public static function get_output( $var, $title = '', $escape = true, $space = '', $short = false, $depth = 0 ) {
$output = '';
if ( '' === $space ) {
$output .= '<div class="db-pretty-var">';
}
if ( is_string( $title ) && '' !== $title ) {
$output .= '<h4 style="clear: both;">' . ( ( true === $escape ) ? esc_html( $title ) : $title ) . "</h4>\n";
}
if ( is_array( $var ) ) {
if ( ! empty( $var ) ) {
$output .= 'Array: <br />' . $space . '(<br />';
if ( is_int( self::$limit_recursion ) && $depth > self::$limit_recursion ) {
/* translators: %d = number used as a limit. */
$output .= '... ( ' . sprintf( __( 'output limited at recursion depth %d', 'db-pretty-output' ), self::$limit_recursion ) . ')<br />';
} else {
if ( true !== $short ) {
$spacing = $space . '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
} else {
$spacing = $space . '&nbsp;&nbsp;';
}
foreach ( $var as $key => $value ) {
$output .= $spacing . '[' . ( ( true === $escape ) ? esc_html( $key ) : $key );
if ( true !== $short ) {
$output .= ' ';
switch ( true ) {
case ( is_string( $key ) ):
$output .= '<span style="color: #336600;;"><b><i>(string)</i></b></span>';
break;
case ( is_int( $key ) ):
$output .= '<span style="color: #FF0000;"><b><i>(int)</i></b></span>';
break;
case ( is_float( $key ) ):
$output .= '<span style="color: #990033;"><b><i>(float)</i></b></span>';
break;
default:
$output .= '(' . __( 'unknown', 'db-pretty-output' ) . ')';
break;
}
}
$output .= '] => ';
$output .= self::get_output( $value, '', $escape, $spacing, $short, ++$depth );
}
unset( $key, $value );
}
$output .= $space . ')<br />';
} else {
$output .= 'array()<br />';
}
} elseif ( is_string( $var ) ) {
$output .= self::get_pretty_string( $var, $short, $escape );
} elseif ( is_bool( $var ) ) {
$output .= self::get_pretty_bool( $var, $short );
} elseif ( is_int( $var ) ) {
$output .= self::get_pretty_int( $var, $short );
} elseif ( is_float( $var ) ) {
$output .= self::get_pretty_float( $var, $short );
} elseif ( is_null( $var ) ) {
$output .= self::get_pretty_null( $var, $short );
} elseif ( is_resource( $var ) ) {
$output .= self::get_pretty_resource( $var, $short );
} elseif ( is_object( $var ) ) {
$output .= 'Object: <br />' . $space . '(<br />';
if ( is_int( self::$limit_recursion ) && $depth > self::$limit_recursion ) {
/* translators: %d = number used as a limit. */
$output .= '... ( ' . sprintf( __( 'output limited at recursion depth %d', 'db-pretty-output' ), self::$limit_recursion ) . ')<br />';
} else {
if ( true !== $short ) {
$spacing = $space . '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
} else {
$spacing = $space . '&nbsp;&nbsp;';
}
$output .= self::get_object_info( $var, $escape, $spacing, $short, ++$depth );
}
$output .= $space . ')<br /><br />';
} else {
$output .= esc_html__( 'I haven\'t got a clue what this is: ', 'db-pretty-output' ) . gettype( $var ) . '<br />';
}
if ( '' === $space ) {
$output .= '</div>';
}
return $output;
}
/**
* Convert a string to pretty output.
*
* @since 1.6.0
*
* @param string $string The string to make pretty.
* @param bool $short Short or normal annotation.
* @param bool $escape Whether to character escape the textual output.
*
* @return string
*/
private static function get_pretty_string( $string, $short = false, $escape = true ) {
$output = '<span style="color: #336600;">';
if ( true !== $short ) {
$output .= '<b><i>string[' . strlen( $string ) . ']</i></b> : ';
}
$output .= '&lsquo;';
if ( true === $escape ) {
$output .= str_replace( ' ', ' &nbsp;', esc_html( $string ) );
} else {
$output .= str_replace( ' ', ' &nbsp;', $string );
}
$output .= '&rsquo;</span><br />';
return $output;
}
/**
* Convert a boolean to pretty output.
*
* @since 1.6.0
*
* @param bool $bool The boolean variable to make pretty.
* @param bool $short Short or normal annotation.
*
* @return string
*/
private static function get_pretty_bool( $bool, $short = false ) {
$output = '<span style="color: #000099;">';
if ( true !== $short ) {
$output .= '<b><i>bool</i></b> : ' . $bool . ' ( = ';
} else {
$output .= '<b><i>b</i></b> ';
}
$output .= '<i>';
if ( false === $bool ) {
$output .= '<span style="color: #FF0000;">false</span>';
} elseif ( true === $bool ) {
$output .= '<span style="color: #336600;">true</span>';
} else {
$output .= __( 'undetermined', 'db-pretty-output' );
}
$output .= ' </i>';
if ( true !== $short ) {
$output .= ')';
}
$output .= '</span><br />';
return $output;
}
/**
* Convert an integer to pretty output.
*
* @since 1.6.0
*
* @param int $int The integer to make pretty.
* @param bool $short Short or normal annotation.
*
* @return string
*/
private static function get_pretty_int( $int, $short = false ) {
$output = '<span style="color: #FF0000;">';
if ( true !== $short ) {
$output .= '<b><i>int</i></b> : ';
}
if ( 0 === $int ) {
$output .= '<b>' . $int . '</b>';
} else {
$output .= $int;
}
$output .= "</span><br />\n";
return $output;
}
/**
* Convert a float to pretty output.
*
* @since 1.6.0
*
* @param float $float The float to make pretty.
* @param bool $short Short or normal annotation.
*
* @return string
*/
private static function get_pretty_float( $float, $short = false ) {
$output = '<span style="color: #990033;">';
if ( true !== $short ) {
$output .= '<b><i>float</i></b> : ';
}
$output .= $float . '</span><br />';
return $output;
}
/**
* Convert a null value to pretty output.
*
* @since 1.6.0
*
* @param null $null The null value to make pretty.
* @param bool $short Short or normal annotation.
*
* @return string
*/
private static function get_pretty_null( $null, $short = false ) {
$output = '<span style="color: #666666;">';
if ( true !== $short ) {
$output .= '<b><i>';
}
$output .= 'null';
if ( true !== $short ) {
$output .= '</i></b> : ' . $null . ' ( = <i>NULL</i> )';
}
$output .= '</span><br />';
return $output;
}
/**
* Convert a resource to pretty output.
*
* @since 1.6.0
*
* @param resource $resource The resource to make pretty.
* @param bool $short Short or normal annotation.
*
* @return string
*/
private static function get_pretty_resource( $resource, $short = false ) {
$output = '<span style="color: #666666;">';
if ( true !== $short ) {
$output .= '<b><i>resource</i></b> : ';
}
$output .= $resource;
if ( true !== $short ) {
$output .= ' ( = <i>RESOURCE</i> )';
}
$output .= '</span><br />';
return $output;
}
/**
* Retrieve pretty output about objects.
*
* @todo: get object properties to show the variable type on one line with the 'property'.
* @todo: get scope of methods and properties.
*
* @since 1.3
*
* @param object $obj Object to show.
* @param bool $escape Internal. Whether to character escape the textual output.
* @param string $space Internal. Indentation spacing.
* @param bool $short Internal. Short or normal annotation.
* @param int $depth Internal. The depth of the current recursion.
*
* @return string
*/
private static function get_object_info( $obj, $escape, $space, $short, $depth = 0 ) {
$output = '';
$output .= $space . '<b><i>Class</i></b>: ' . esc_html( get_class( $obj ) ) . ' (<br />';
if ( true !== $short ) {
$spacing = $space . '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
} else {
$spacing = $space . '&nbsp;&nbsp;';
}
$properties = get_object_vars( $obj );
if ( ! empty( $properties ) && is_array( $properties ) ) {
foreach ( $properties as $var => $val ) {
if ( is_array( $val ) ) {
$output .= $spacing . '<b><i>property</i></b>: ' . esc_html( $var ) . "<b><i> (array)</i></b>\n";
$output .= self::get_output( $val, '', $escape, $spacing, $short, $depth );
} else {
$output .= $spacing . '<b><i>property</i></b>: ' . esc_html( $var ) . ' = ';
$output .= self::get_output( $val, '', $escape, $spacing, $short, $depth );
}
}
}
unset( $properties, $var, $val );
$methods = get_class_methods( $obj );
if ( ! empty( $methods ) && is_array( $methods ) ) {
foreach ( $methods as $method ) {
$output .= $spacing . '<b><i>method</i></b>: ' . esc_html( $method ) . "<br />\n";
}
}
unset( $methods, $method );
$output .= $space . ')<br /><br />';
return $output;
}
/**
* Helper Function specific to the Debug bar plugin.
* Retrieves html string of properties in a table and methods in an unordered list.
*
* @since 1.3
*
* @param object $obj Object for which to show the properties and methods.
* @param bool $is_sub Internal. Top level or nested object.
*
* @reurn string
*/
public static function get_ooutput( $obj, $is_sub = false ) {
$properties = get_object_vars( $obj );
$methods = get_class_methods( $obj );
$output = '';
if ( false === $is_sub ) {
$output .= '
<h2><span>' . esc_html__( 'Properties:', 'db-pretty-output' ) . '</span>' . count( $properties ) . '</h2>';
$output .= '
<h2><span>' . esc_html__( 'Methods:', 'db-pretty-output' ) . '</span>' . count( $methods ) . '</h2>';
}
// Properties.
if ( ! empty( $properties ) && is_array( $properties ) ) {
$h = 'h4';
if ( false === $is_sub ) {
$h = 'h3';
}
$output .= '
<' . $h . '>' . esc_html__( 'Object Properties:', 'db-pretty-output' ) . '</' . $h . '>';
uksort( $properties, 'strnatcasecmp' );
$output .= self::get_table( $properties, __( 'Property', 'db-pretty-output' ), __( 'Value', 'db-pretty-output' ) );
}
// Methods.
if ( ! empty( $methods ) && is_array( $methods ) ) {
$output .= '
<h3>' . esc_html__( 'Object Methods:', 'db-pretty-output' ) . '</h3>
<ul class="' . sanitize_html_class( self::NAME ) . '">';
uksort( $methods, 'strnatcasecmp' );
foreach ( $methods as $method ) {
$output .= '<li>' . esc_html( $method ) . '()</li>';
}
unset( $method );
$output .= '</ul>';
}
return $output;
}
/**
* Retrieve the table output.
*
* @since 1.3
*
* @param array $array Array to be shown in the table.
* @param string $col1 Label for the first table column.
* @param string $col2 Label for the second table column.
* @param string|array $class One or more CSS classes to add to the table.
*
* @return string
*/
public static function get_table( $array, $col1, $col2, $class = null ) {
$classes = 'debug-bar-table ' . sanitize_html_class( self::NAME );
if ( isset( $class ) ) {
if ( is_string( $class ) && '' !== $class ) {
$classes .= ' ' . sanitize_html_class( $class );
} elseif ( ! empty( $class ) && is_array( $class ) ) {
$class = array_map( $class, 'sanitize_html_class' );
$classes = $classes . ' ' . implode( ' ', $class );
}
}
$col1 = ( is_string( $col1 ) ) ? $col1 : __( 'Key', 'db-pretty-output' );
$col2 = ( is_string( $col2 ) ) ? $col2 : __( 'Value', 'db-pretty-output' );
$double_it = false;
if ( count( $array ) > self::TBODY_MAX ) {
$double_it = true;
}
$return = self::get_table_start( $col1, $col2, $classes, $double_it );
$return .= self::get_table_rows( $array );
$return .= self::get_table_end();
return $return;
}
/**
* Generate the table header.
*
* @param string $col1 Label for the first table column.
* @param string $col2 Label for the second table column.
* @param string|array $class One or more CSS classes to add to the table.
* @param bool $double_it Whether to repeat the table headers as table footer.
*/
private static function get_table_start( $col1, $col2, $class = null, $double_it = false ) {
$class_string = '';
if ( is_string( $class ) && '' !== $class ) {
$class_string = ' class="' . esc_attr( $class ) . '"';
}
$output = '
<table' . $class_string . '>
<thead>
<tr>
<th>' . esc_html( $col1 ) . '</th>
<th>' . esc_html( $col2 ) . '</th>
</tr>
</thead>';
if ( true === $double_it ) {
$output .= '
<tfoot>
<tr>
<th>' . esc_html( $col1 ) . '</th>
<th>' . esc_html( $col2 ) . '</th>
</tr>
</tfoot>';
}
$output .= '
<tbody>';
return apply_filters( 'db_pretty_output_table_header', $output );
}
/**
* Generate table rows.
*
* @param array $array Array to be shown in the table.
*
* @return string
*/
private static function get_table_rows( $array ) {
$output = '';
foreach ( $array as $key => $value ) {
$output .= self::get_table_row( $key, $value );
}
return $output;
}
/**
* Generate individual table row.
*
* @param mixed $key Item key to use a row label.
* @param mixed $value Value to show.
*
* @return string
*/
private static function get_table_row( $key, $value ) {
$output = '
<tr>
<th>' . esc_html( $key ) . '</th>
<td>';
if ( is_object( $value ) ) {
$output .= self::get_ooutput( $value, true );
} else {
$output .= self::get_output( $value, '', true, '', false );
}
$output .= '</td>
</tr>';
return apply_filters( 'db_pretty_output_table_body_row', $output, $key );
}
/**
* Generate table closing.
*
* @return string
*/
private static function get_table_end() {
return '
</tbody>
</table>
';
}
/**
* Print pretty output.
*
* @deprecated since v1.3 in favour of get_output().
*
* @param mixed $var Variable to show.
* @param string $title Optional. Variable title.
* @param bool $escape Optional. Whether to character escape the textual output.
* @param string $space Internal. Indentation spacing.
* @param bool $short Internal. Short or normal annotation.
* @param string $deprecated Deprecated argument. Do not use.
*/
public static function output( $var, $title = '', $escape = false, $space = '', $short = false, $deprecated = null ) {
_deprecated_function( __CLASS__ . '::' . __METHOD__, __CLASS__ . ' 1.3', __CLASS__ . '::get_output() ' . esc_html__( 'or even better: upgrade your Debug Bar plugins to their current version', 'db-pretty-output' ) );
echo self::get_output( $var, $title, $escape, $space, $short ); // WPCS: xss ok.
}
/**
* Print pretty output about objects.
*
* @deprecated since v1.3 in favour of get_object_info().
*
* @param object $obj Object to show.
* @param bool $escape Internal. Whether to character escape the textual output.
* @param string $space Internal. Indentation spacing.
* @param bool $short Internal. Short or normal annotation.
* @param string $deprecated Deprecated argument. Do not use.
*
* @return void
*/
private static function object_info( $obj, $escape, $space, $short, $deprecated = null ) {
_deprecated_function( __CLASS__ . '::' . __METHOD__, __CLASS__ . ' 1.3', __CLASS__ . '::get_object_info() ' . esc_html__( 'or even better: upgrade your Debug Bar plugins to their current version', 'db-pretty-output' ) );
echo self::get_object_info( $obj, $escape, $space, $short ); // WPCS: xss ok.
}
/**
* Helper Function specific to the Debug bar plugin.
* Outputs properties in a table and methods in an unordered list.
*
* @deprecated since v1.3 in favour of get_ooutput().
*
* @param object $obj Object for which to show the properties and methods.
* @param string $deprecated Deprecated argument. Do not use.
* @param bool $is_sub Internal. Top level or nested object.
*
* @return void
*/
public static function ooutput( $obj, $deprecated = null, $is_sub = false ) {
_deprecated_function( __CLASS__ . '::' . __METHOD__, __CLASS__ . ' 1.3', __CLASS__ . '::get_ooutput() ' . esc_html__( 'or even better: upgrade your Debug Bar plugins to their current version', 'db-pretty-output' ) );
echo self::get_ooutput( $obj, $is_sub ); // WPCS: xss ok.
}
/**
* Render the table output.
*
* @deprecated since v1.3 in favour of get_table().
*
* @param array $array Array to be shown in the table.
* @param string $col1 Label for the first table column.
* @param string $col2 Label for the second table column.
* @param string|array $class One or more CSS classes to add to the table.
* @param string $deprecated Deprecated argument. Do not use.
*
* @return void
*/
public static function render_table( $array, $col1, $col2, $class = null, $deprecated = null ) {
_deprecated_function( __CLASS__ . '::' . __METHOD__, __CLASS__ . ' 1.3', __CLASS__ . '::get_table() ' . esc_html__( 'or even better: upgrade your Debug Bar plugins to their current version', 'db-pretty-output' ) );
echo self::get_table( $array, $col1, $col2, $class ); // WPCS: xss ok.
}
} // End of class Debug_Bar_Pretty_Output.
/* Load text strings for this class. */
if ( function_exists( 'is_textdomain_loaded' ) && function_exists( 'load_plugin_textdomain' ) ) {
if ( ! is_textdomain_loaded( 'db-pretty-output' ) ) {
load_plugin_textdomain( 'db-pretty-output', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
}
}
} // End of if class_exists wrapper.

View File

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

View File

@@ -0,0 +1,128 @@
msgid ""
msgstr ""
"Project-Id-Version: Debug Bar Pretty Output\n"
"POT-Creation-Date: 2016-04-11 20:36+0200\n"
"PO-Revision-Date: 2016-04-11 20:36+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"
#: class-debug-bar-pretty-output.php:101 class-debug-bar-pretty-output.php:208
#, php-format
msgid "output limited at recursion depth %d"
msgstr "output beperkt tot recursiediepte %d"
#: class-debug-bar-pretty-output.php:128
msgid "unknown"
msgstr "onbekend"
#: class-debug-bar-pretty-output.php:162
msgid "undetermined"
msgstr "niet bepaald"
#: class-debug-bar-pretty-output.php:222
msgid "I haven't got a clue what this is: "
msgstr "Geen idee wat dit is:"
#: class-debug-bar-pretty-output.php:307
msgid "Properties:"
msgstr "Eigenschappen:"
#: class-debug-bar-pretty-output.php:310
msgid "Methods:"
msgstr "Methoden:"
#: class-debug-bar-pretty-output.php:321
msgid "Object Properties:"
msgstr "Object eigenschappen:"
#: class-debug-bar-pretty-output.php:324
msgid "Property"
msgstr "Eigenschap"
#: class-debug-bar-pretty-output.php:324 class-debug-bar-pretty-output.php:371
msgid "Value"
msgstr "Waarde"
#: class-debug-bar-pretty-output.php:330
msgid "Object Methods:"
msgstr "Object Methoden:"
#: class-debug-bar-pretty-output.php:370
msgid "Key"
msgstr "Sleutel"
#: class-debug-bar-pretty-output.php:493 class-debug-bar-pretty-output.php:512
#: class-debug-bar-pretty-output.php:530 class-debug-bar-pretty-output.php:549
msgid "or even better: upgrade your Debug Bar plugins to their current version"
msgstr ""
"of better nog: upgrade de geïnstalleerde Debug Bar plugins naar hun huidige "
"versie"
#~ msgid "Empty array()"
#~ msgstr "Leeg array()"
#~ msgid "Name"
#~ msgstr "Naam"
#~ 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,71 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Debug Bar Pretty Output\n"
"POT-Creation-Date: 2016-04-11 20:36+0200\n"
"PO-Revision-Date: 2015-04-18 14:37+0100\n"
"Last-Translator: Juliette Reinders Folmer <wpplugins_nospam@adviesenzo.nl>\n"
"Language-Team: Juliette Reinders Folmer <wpplugins_nospam@adviesenzo.nl>\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"
#: class-debug-bar-pretty-output.php:101 class-debug-bar-pretty-output.php:208
#, php-format
msgid "output limited at recursion depth %d"
msgstr ""
#: class-debug-bar-pretty-output.php:128
msgid "unknown"
msgstr ""
#: class-debug-bar-pretty-output.php:162
msgid "undetermined"
msgstr ""
#: class-debug-bar-pretty-output.php:222
msgid "I haven't got a clue what this is: "
msgstr ""
#: class-debug-bar-pretty-output.php:307
msgid "Properties:"
msgstr ""
#: class-debug-bar-pretty-output.php:310
msgid "Methods:"
msgstr ""
#: class-debug-bar-pretty-output.php:321
msgid "Object Properties:"
msgstr ""
#: class-debug-bar-pretty-output.php:324
msgid "Property"
msgstr ""
#: class-debug-bar-pretty-output.php:324 class-debug-bar-pretty-output.php:371
msgid "Value"
msgstr ""
#: class-debug-bar-pretty-output.php:330
msgid "Object Methods:"
msgstr ""
#: class-debug-bar-pretty-output.php:370
msgid "Key"
msgstr ""
#: class-debug-bar-pretty-output.php:493 class-debug-bar-pretty-output.php:512
#: class-debug-bar-pretty-output.php:530 class-debug-bar-pretty-output.php:549
msgid "or even better: upgrade your Debug Bar plugins to their current version"
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,2 @@
<?php
// Nothing to see here.

View File

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

View File

@@ -0,0 +1,70 @@
/*
|--------------------------------------------------------------------------
| UItoTop jQuery Plugin 1.2 by Matt Varone
| http://www.mattvarone.com/web-design/uitotop-jquery-plugin/
|--------------------------------------------------------------------------
*/
(function($){
$.fn.UItoTop = function(options) {
var defaults = {
text: 'To Top',
min: 200,
inDelay:600,
outDelay:400,
containerID: 'toTop',
containerHoverID: 'toTopHover',
scrollSpeed: 1200,
easingType: 'linear'
},
settings = $.extend(defaults, options),
containerIDhash = '#' + settings.containerID,
containerHoverIDHash = '#'+settings.containerHoverID;
$('body').append('<a href="#" id="'+settings.containerID+'">'+settings.text+'</a>');
$(containerIDhash).hide().on('click.UItoTop',function(){
$('#debug-menu-targets').animate({scrollTop:0}, settings.scrollSpeed, settings.easingType);
$('#'+settings.containerHoverID, this).stop().animate({'opacity': 0 }, settings.inDelay, settings.easingType);
return false;
})
.prepend('<span id="'+settings.containerHoverID+'"></span>')
.hover(function() {
$(containerHoverIDHash, this).stop().animate({
'opacity': 1
}, 600, 'linear');
}, function() {
$(containerHoverIDHash, this).stop().animate({
'opacity': 0
}, 700, 'linear');
});
$('#debug-menu-targets').scroll(function() {
var sd = $('#debug-menu-targets').scrollTop();
if(typeof document.body.style.maxHeight === "undefined") {
$(containerIDhash).css({
'position': 'absolute',
'top': sd + $(window).height() - 50
});
}
if ( sd > settings.min ) {
$(containerIDhash).fadeIn(settings.inDelay);
}
else {
$(containerIDhash).fadeOut(settings.Outdelay);
}
});
};
})(jQuery);
jQuery(document).ready(function() {
/*
var defaults = {
containerID: 'toTop', // fading element id
containerHoverID: 'toTopHover', // fading element hover id
scrollSpeed: 1200,
easingType: 'linear'
};
*/
jQuery('#debug-menu-target-Debug_Bar_PHP_Constants').UItoTop({ easingType: 'swing', scrollSpeed: 300 });
});

View File

@@ -0,0 +1,2 @@
/* UItoTop jQuery Plugin 1.2 | Matt Varone | http://www.mattvarone.com/web-design/uitotop-jquery-plugin */
(function($){$.fn.UItoTop=function(options){var defaults={text:'To Top',min:200,inDelay:600,outDelay:400,containerID:'toTop',containerHoverID:'toTopHover',scrollSpeed:1200,easingType:'linear'},settings=$.extend(defaults,options),containerIDhash='#'+settings.containerID,containerHoverIDHash='#'+settings.containerHoverID;$('body').append('<a href="#" id="'+settings.containerID+'">'+settings.text+'</a>');$(containerIDhash).hide().on('click.UItoTop',function(){$('#debug-menu-targets').animate({scrollTop:0},settings.scrollSpeed,settings.easingType);$('#'+settings.containerHoverID,this).stop().animate({'opacity':0},settings.inDelay,settings.easingType);return false}).prepend('<span id="'+settings.containerHoverID+'"></span>').hover(function(){$(containerHoverIDHash,this).stop().animate({'opacity':1},600,'linear')},function(){$(containerHoverIDHash,this).stop().animate({'opacity':0},700,'linear')});$('#debug-menu-targets').scroll(function(){var sd=$('#debug-menu-targets').scrollTop();if(typeof document.body.style.maxHeight==="undefined"){$(containerIDhash).css({'position':'absolute','top':sd+$(window).height()-50})}if(sd>settings.min){$(containerIDhash).fadeIn(settings.inDelay)}else{$(containerIDhash).fadeOut(settings.Outdelay)}})}})(jQuery);jQuery(document).ready(function(){jQuery('#debug-menu-target-Debug_Bar_PHP_Constants').UItoTop({easingType:'swing',scrollSpeed:300})});

View File

@@ -0,0 +1,22 @@
# UItoTop jQuery Plugin
http://www.mattvarone.com/web-design/uitotop-jquery-plugin/
Ver 1.2
## License
Copyright (C) 2010 Matt Varone
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 3 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, see <http://www.gnu.org/licenses/>.

View File

@@ -0,0 +1,122 @@
msgid ""
msgstr ""
"Project-Id-Version: Debug Bar Constants - a WordPress Plugin\n"
"POT-Creation-Date: 2018-01-16 01:23+0100\n"
"PO-Revision-Date: 2018-01-16 01:24+0100\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 2.0.5\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"
#: class-debug-bar-constants-panel.php:56
msgid "Name"
msgstr "Naam"
#: class-debug-bar-constants-panel.php:57
msgid "Value"
msgstr "Waarde"
#: class-debug-bar-php-constants.php:33
msgid "PHP Constants"
msgstr "PHP Constants"
#: class-debug-bar-php-constants.php:60
#, php-format
msgid "Visit the PHP manual page about the %s constants."
msgstr "Bezoek de PHP handleiding pagina over de %s constants."
#: class-debug-bar-php-constants.php:71
#: class-debug-bar-wp-class-constants.php:97
msgid "Constants:"
msgstr "Constants:"
#: class-debug-bar-php-constants.php:80
msgid "No PHP constants found... this is really weird..."
msgstr "Geen PHP constants gevonden... dit is vreemd..."
#: class-debug-bar-wp-class-constants.php:33
msgid "WP Class Constants"
msgstr "WP Class Constants"
#: class-debug-bar-wp-class-constants.php:76
#, php-format
msgid ""
"%1$sPlease note%2$s: these may be both native WordPress classes as well as "
"classes which may be declared by plugins or themes."
msgstr ""
"%1$sToelichting%2$s: dit kunnen zowel de WordPress eigen classes zijn als "
"ook de classes welke door plugins of themes gedeclareerd zijn."
#: class-debug-bar-wp-class-constants.php:83
#, php-format
msgid "You can use these constants in your code using %1$s."
msgstr "Je kan deze constants in je eigen code gebruiken door middel van %1$s."
#: class-debug-bar-wp-class-constants.php:89
#, php-format
msgid "See the %1$sFAQ%2$s for more information."
msgstr "Lees de %1$sFAQ%2$s voor meer informatie."
#: class-debug-bar-wp-class-constants.php:104
msgid "No classes nor class constants found... this is kinda strange..."
msgstr "Geen classes of class constants gevonden... dit is vreemd..."
#: class-debug-bar-wp-constants.php:33
msgid "WP Constants"
msgstr "WP Constants"
#: class-debug-bar-wp-constants.php:53
msgid "Constants within WP:"
msgstr "Constants binnen WP:"
#: class-debug-bar-wp-constants.php:58
msgid "No constants found... this is really weird..."
msgstr "Geen constants gevonden... dit is vreemd..."
#. translators: 1: strong open tag; 2: strong close tag; 3: link to plugin installation page; 4: link close tag.
#: debug-bar-constants.php:154
#, php-format
msgid ""
"Activation failed: Debug Bar must be activated to use the %1$sDebug Bar "
"Constants%2$s Plugin. %3$sVisit your plugins page to install & activate%4$s."
msgstr ""
"De Debug Bar plugin moet geactiveerd zijn om de %1$sDebug Bar Constants "
"Plugin%2$s te kunnen gebruiken. %3$sGa naar de plugins pagina om deze te "
"activeren%4$s."
#. Plugin Name of the plugin/theme
msgid "Debug Bar Constants"
msgstr "Debug Bar Constants"
#. Plugin URI of the plugin/theme
msgid "https://wordpress.org/plugins/debug-bar-constants/"
msgstr "https://wordpress.org/plugins/debug-bar-constants/"
#. Description of the plugin/theme
msgid ""
"Debug Bar Constants adds new panels to Debug Bar that display all the "
"defined constants for the current request. Requires \"Debug Bar\" plugin."
msgstr ""
"Debug Bar Constants voegt nieuwe panelen toe aan de Debug Bar welke inzicht "
"geven in all gedefinieerde constants voor de huidige pagina. Vereist gebruik "
"van de \"Debug Bar\" plugin."
#. Author of the plugin/theme
msgid "Juliette Reinders Folmer"
msgstr "Juliette Reinders Folmer"
#. Author URI of the plugin/theme
msgid "http://www.adviesenzo.nl/"
msgstr "http://www.adviesenzo.nl/"
#~ msgid "Nothing to display"
#~ msgstr "Niets om weer te geven"

View File

@@ -0,0 +1,116 @@
#, fuzzy
msgid ""
msgstr ""
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
"Project-Id-Version: Debug Bar Constants\n"
"POT-Creation-Date: 2018-01-16 01:23+0100\n"
"PO-Revision-Date: 2017-06-26 16:11+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.0.5\n"
"X-Poedit-Basepath: ..\n"
"X-Poedit-Flags-xgettext: --add-comments=translators:\n"
"X-Poedit-WPHeader: debug-bar-constants.php\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"
"X-Poedit-SearchPath-0: .\n"
"X-Poedit-SearchPathExcluded-0: *.js\n"
"X-Poedit-SearchPathExcluded-1: inc\n"
#: class-debug-bar-constants-panel.php:56
msgid "Name"
msgstr ""
#: class-debug-bar-constants-panel.php:57
msgid "Value"
msgstr ""
#: class-debug-bar-php-constants.php:33
msgid "PHP Constants"
msgstr ""
#: class-debug-bar-php-constants.php:60
#, php-format
msgid "Visit the PHP manual page about the %s constants."
msgstr ""
#: class-debug-bar-php-constants.php:71
#: class-debug-bar-wp-class-constants.php:97
msgid "Constants:"
msgstr ""
#: class-debug-bar-php-constants.php:80
msgid "No PHP constants found... this is really weird..."
msgstr ""
#: class-debug-bar-wp-class-constants.php:33
msgid "WP Class Constants"
msgstr ""
#: class-debug-bar-wp-class-constants.php:76
#, php-format
msgid ""
"%1$sPlease note%2$s: these may be both native WordPress classes as well as "
"classes which may be declared by plugins or themes."
msgstr ""
#: class-debug-bar-wp-class-constants.php:83
#, php-format
msgid "You can use these constants in your code using %1$s."
msgstr ""
#: class-debug-bar-wp-class-constants.php:89
#, php-format
msgid "See the %1$sFAQ%2$s for more information."
msgstr ""
#: class-debug-bar-wp-class-constants.php:104
msgid "No classes nor class constants found... this is kinda strange..."
msgstr ""
#: class-debug-bar-wp-constants.php:33
msgid "WP Constants"
msgstr ""
#: class-debug-bar-wp-constants.php:53
msgid "Constants within WP:"
msgstr ""
#: class-debug-bar-wp-constants.php:58
msgid "No constants found... this is really weird..."
msgstr ""
#. translators: 1: strong open tag; 2: strong close tag; 3: link to plugin installation page; 4: link close tag.
#: debug-bar-constants.php:154
#, php-format
msgid ""
"Activation failed: Debug Bar must be activated to use the %1$sDebug Bar "
"Constants%2$s Plugin. %3$sVisit your plugins page to install & activate%4$s."
msgstr ""
#. Plugin Name of the plugin/theme
msgid "Debug Bar Constants"
msgstr ""
#. Plugin URI of the plugin/theme
msgid "https://wordpress.org/plugins/debug-bar-constants/"
msgstr ""
#. Description of the plugin/theme
msgid ""
"Debug Bar Constants adds new panels to Debug Bar that display all the "
"defined constants for the current request. Requires \"Debug Bar\" plugin."
msgstr ""
#. Author of the plugin/theme
msgid "Juliette Reinders Folmer"
msgstr ""
#. Author URI of the plugin/theme
msgid "http://www.adviesenzo.nl/"
msgstr ""

View File

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

View File

@@ -0,0 +1,259 @@
=== Debug Bar Constants ===
Contributors: jrf
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=995SSNDTCVBJG
Tags: debugbar, debug-bar, Debug Bar, Constants, Debug Bar Constants
Requires at least: 3.4
Tested up to: 4.9
Stable tag: 2.0.0
Requires PHP: 5.2.4
Depends: Debug Bar
License: GPLv2
Debug Bar Constants adds three new panels to the Debug Bar that display the defined WP and PHP constants for the current request.
== Description ==
Debug Bar Constants adds three new panels to the Debug Bar that display the defined constants available to you as a developer for the current request:
* WP Constants
* WP Class Constants
* PHP Constants
= Important =
This plugin requires the [Debug Bar](https://wordpress.org/plugins/debug-bar/) plugin to be installed and activated.
Also note that this plugin should be used solely for debugging and/or in a development environment and is not intended for use on a production site.
***********************************
If you like this plugin, please [rate and/or review](https://wordpress.org/support/view/plugin-reviews/debug-bar-constants) 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-constants) or in the [GitHub repository](https://github.com/jrfnl/Debug-Bar-Constants/issues).
== Frequently Asked Questions ==
= Can it be used on live site ? =
**PLEASE DON'T!** Amongst the defined constants are your database credentials, so you really do not want to do this.
This plugin is only meant to be used for development purposes.
= What are constants ? =
[From PHP.net:](http://php.net/language.constants)
> A constant is an identifier (name) for a simple value. As the name suggests, that value cannot change during the execution of the script. A constant is case-sensitive by default. By convention, constant identifiers are always uppercase.
> Like super globals, the scope of a constant is global. You can access constants anywhere in your script without regard to scope. For more information on scope, read the manual section on [variable scope](http://php.net/language.variables.scope).
= I don't see my constants in the WP Constants list. What gives ? =
Congratulations! Sounds like you're practicing lean programming (or something is going wrong... ;-) ).
The constants you see are the ones available in the current request. If you define constants in a conditionally included file - for instance you only include the file when on a certain page -, these constants will not be available if the conditions have not been met.
= The number of constants is different on each page/most pages. How come ? =
See the previous question.
= What are class constants ? =
[From PHP.net:](http://php.net/language.oop5.constants)
> It is possible to define constant values on a per-class basis remaining the same and unchangeable. Constants differ from normal variables in that you don't use the $ symbol to declare or use them.
> The value must be a constant expression, not (for example) a variable, a property, a result of a mathematical operation, or a function call.
= Why do plugins and themes use class constants instead of normal constants ? =
It's good coding practice to avoid littering the global namespace with your own variables and constants. This is a good way to avoid this.
= Why is it useful to have insight into the defined class constants ? =
If your plugin/theme interacts with other plugins and/or themes, you may want to use their constants.
Example: A plugin might have their version number saved as a class constant (good practice!). On your part, your plugin may have been set up to only work if the related plugin has been upgraded to version x. In that case, you may want to check other plugins version number before your plugin interacts with it.
Don't forget to always check whether the class constant exists before you use it! It may not be available on all pages and surely not on all WP installs.
`
if( defined( 'class_name::constant_name' ) ) {
// Your code here
}
`
= I don't see my class in the WP Class Constants list. What gives ? =
* Depending on how lean you've programmed your plugin/theme, your class may not be included (and therefore not be declared) for the page you are viewing.
* The name of your class may be the same as the name of one of the native/extension PHP classes. PHP is normally configured with a limited number of Extensions. A large number of the available extensions declare classes when they are loaded and the WP Class Constants list is filtered for these classes. It's good practice not to use the names of those PHP native/extension classes for your own classes. Try renaming your class. If that doesn't work, please [let me know](https://github.com/jrfnl/Debug-Bar-Constants/issues) and I'll have a look at it.
= Why are *all* native/extension PHP Classes filtered out - and not just the ones for the extensions loaded on my server -, you ask ? =
Easy: It's bad practise to name your class the same as one of the PHP native/extension classes.
In general, when you're developing a plugin/theme, you are developing for an unknown group of other people with unknown server configurations - including which extensions are(n't) installed -, so you should always make sure that your class will not interfere with any of the PHP native/extension classes.
= I see some PHP classes and their constants in the WP Class Constants list. What gives ? =
I've tried to exclude all PHP classes from this list, however, I might have missed some. Also some new extensions and/or classes may have been introduced in PHP since the last version of this plugin was released.
Please [let me know](https://github.com/jrfnl/Debug-Bar-Constants/issues) which one(s) you found and I'll add it/them to the exclusion list.
= 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.0 =
_Release date: 2018-01-22_
* Improved compatibility with PHP 7.2.
* Improved compatibility with the upcoming v 0.10.0 of the Debug Bar plugin.
* I18n/I10n: Improved text strings for localization.
* Updated the pretty print dependency to v1.8.0.
* Refactoring of part of the code base. No functional changes.
* General housekeeping.
* Added minimum PHP requirement header. (PHP 5.2.4, in line with WP itself.)
* Tested & found compatible WP 4.9.
= 1.7.0 =
_Release date: 2017-07-10_
* Improved usability of the admin notice in case the Debug Bar plugin is not active.
* The plugin will now add itself to the list of "recently active" plugins if it self-deactivates bcause the Debug Bar plugin is not active.
* Defer to just in time loading of translations for WP > 4.5.
* Updated the pretty print dependency to v1.7.0.
* Minor housekeeping.
* The minimum supported WP version is now 3.4, in line with the 0.9 version of the Debug Bar.
* Tested & found compatible WP 4.8.
= 1.6.1 =
_Release date: 2016-04-15_
* Get the leaner loading of text domains right (at last).
= 1.6.0 =
_Release date: 2016-04-12_
* Hard-coded the text domains for compatibility with [GlotPress](https://translate.wordpress.org/projects/wp-plugins/debug-bar-constants).
* Make loading of text-domain compatible with use of the plugin in the `must-use` plugins directory.
* Updated the pretty print class to v1.6.0.
* Minor housekeeping.
* Tested & found compatible WP 4.5.
= 1.5.0.3 =
_Release date: 2016-01-13_
* Fix very minor layout inconsistency in combination with Twenty-Sixteen theme.
* Updated the pretty print class to v1.5.2.
= 1.5.0.2 =
_Release date: 2016-01-10_
* Fix weird table layout on front-end in combination with Twenty-Sixteen theme.
* Leaner loading of text domains.
= 1.5.0.1 =
_Release date: 2015-12-07_
* Fix typo.
= 1.5 =
_Release date: 2015-12-05_
* Updated PHP Classes list for PHP7.
* Fixed (some) links to PHP manual resulting in 404s.
* Tested & found compatible with WP 4.4.
= 1.4 =
_Release date: 2015-04-18_
* Updated the pretty print class to v1.5.0 which now allows for limiting of the recursion depth.
* Tested & found compatible with WP 4.2.
* Minor tidying up.
* Updated language files.
= 1.3.1 =
_Release date: 2014-09-05_
* Fix compatibility with the [Plugin Dependencies](https://wordpress.org/plugins/plugin-dependencies/) plugin.
* Tested & found compatible with WP 4.0.
= 1.3 =
_Release date: 2013-12-02_
* Moved pretty print class to separate repository as several plugins are using it now.
= 1.2.1.2 =
_Release date: 2013-11-30_
* Fixed minor HTML validation issue.
* Fixed auto-disable message display in case the Debug Bar Plugin is not activated.
* Changed style and script file names to comply with current guidelines (.min).
* Tested with WP 3.8-beta1.
= 1.2.1.1 =
_Release date: 2013-10-01_
* Compliance with the [WordPress coding standards](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards).
* Some minor code cleanup inspired by some suggestions by [Maik Penz](https://github.com/goatherd).
= 1.2.1 =
_Release date: 2013-05-27_
* Minor fix to comply with strict standards. Thanks [Azizur Rahman for reporting](https://wordpress.org/support/topic/declaration-of-debug_bar_constantsinit-should-be-compatible-with-debug_bar_p).
= 1.2 =
_Release date: 2013-05-05_
* [New!] Added a panel for Class Constants.
* [Fix] Some left over references to functions not in this plugin.
* Headers for the PHP Constants now link to their PHP manual page.
* Moved more output rendering to the pretty-output class and applied a higher level of abstraction.
= 1.1 =
_Release date: 2013-04-30 / not released_
* [New!] Added auto-deactivation if the Debug Bar plugin is not active.
* [Fix] Removed js debug alert (oops..).
* [Fix] Adjusted the sorting to be case-insensitive.
* [Fix] Some small-HTML/CSS tweaks.
* Added object output helper method.
= 1.0 =
_Release date: 2013-04-28_
* Initial release.
== Upgrade Notice ==
= 1.5 =
* Updated PHP Classes list for PHP7.
= 1.4 =
* Upgrade highly recommended - multi-plugin compatibility issue.
= 1.3 =
* Upgrade highly recommended - multi-plugin compatibility issue.
= 1.2.1.2 =
* Small fixes, nothing exciting.
= 1.2 =
* New! panel for Class Constants. This release also fixes a number of bugs.
= 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.
Don't use this plugin on a live site. This plugin is **only** intended to be used for development purposes.
== Screenshots ==
1. Debug Bar displaying WP Constants
1. Debug Bar displaying WP Class Constants
1. Debug Bar displaying PHP Constants