Debug This

Описание

Debug This is a standalone plugin built, maintained & operated by the friendly folks over at MachoThemes

For admins, developers, and support staff, Debug This provides a ton of information about your WordPress installation, all from the front-end admin bar.

  • The current WP_Query object
  • Blog info and options
  • Embed providers
  • Files in rendered HTML (CSS, images, JavaScript)
  • Фильтры и действия
  • Размеры изображений
  • Глобалы и константы
  • Меню
  • Статистика кеша объектов
  • Plugins, must-use plugins, and dropins
  • Переписать правила
  • Запросы
  • Информация о PHP и сервере
  • Post attachments
  • Типы записей
  • Сценарии и стили
  • Шорткоды
  • Боковые панели и виджеты
  • Таксономии и термины
  • Темы
  • Пользователи
  • WP cron расписания и рабочие места
  • Журнал отладки WP

Debug This helps you save time and effort when trying to figure out what’s going on. Instead of hardcoding debug snippets or writing complex unit
tests for small functionality, you can simply bring to the surface what you need right from the admin bar.

Например, при просмотре одного сообщения вы можете увидеть:

  • Список почтовых вложений,
  • Какие меню и боковые панели отображаются,
  • Тип почтового сообщения, почтовые поля и метаданные,
  • Текущие переменные запроса и строку запроса,
  • Применяются правила перезаписи,
  • the author,
  • Термины,
  • и многое другое.

Now compatible with Kint!

Не теряйтесь в глубоких массивах и объектах. Организуйте и изолируйте свой отладочный вывод, установив этот отличный плагин: n Отладчик Kint

Recommended Plugins

Extend

Debug This Functions

New debug modes can be created easily:

add_debug_extension(
    $mode,
    $menu_label,
    $description,
    $callback,
    $group = 'General'
);

Example

add_debug_extension(
    'actions',
    __('Actions', 'debug-this'),
    __('$wp_actions contains all active registered actions', 'debug-this'),
    'foo_callback',
    'Filters And Actions'
);
function foo_callback($buffer, $template){
    global $wp_actions;
    $debug = print_r($wp_actions, true);
    return $debug;
}

You can add links to the header of a debug mode page. Place this code within your debug callback function.

add_debug_header_link('http://urltolink', 'Link Label');

Extensions can be removed as well using remove_debug_extension($mode);

No PRE Tags

If you don’t want your debug output to be enclosed in PRE tags, simply set the following in your extension:

Debug_This::$no_pre = true;

Saved Queries and Execution Time

Retrieve saved queries and execution time by using the following static properties:

  • Debug_This::$execution_time
  • Debug_This::$queries — SAVEQUERIES must defined as true

URL Helpers

  • Debug_This::get_current_debug_url() — current URL with the debug query
  • Debug_This::get_escape_url() — used for the debug escape link that links to original page URL

Действия WP

  • debug_this — receives the $mode arg — outputs the debug code sent from the extension modes. The default action is set to priority 5. This allows you to prepend or append any output without conflict using less or greater priorities.

Фильтры WP

There are a few filters you can use to customize Debug This to your needs:

  • debug_this_template — receives $template arg — Use your own template
  • debug_this_default_mode — receives $mode arg — Alters the mode for the parent DT admin bar button link.
  • debug_this_output — receives $output, $mode args — Filter debug content before it’s rendered

JavaScript

To access the built-in Debug This JS functionality, enqueue your custom script with the dependency set to debug-this. Your script will inherit a jQuery dependency.

Object: debugThis

  • debugThis.mode — current mode
  • debugThis.defaultMode
  • debugThis.template — current included template
  • debugThis.queryVar — the defined query string variable

Functions:

  • isDebug()
  • getDebugMode() — uses isDebug()

Events:

A jQuery debug-this event is fired from the footer. You can hook into this event with the following;

jQuery(document).bind('debug-this', function(event, debugThis){
    console.log(debugThis);
});

Helper Functions

There are three included functions to help you work with files.

  • debug_this_get_file_ownership($file) — returns array('name' => $name, 'group' => $group)
  • debug_this_get_file_perms($file) — returns string — Example: 0775
  • debug_this_convert_perms_to_rwx($perms) — returns string — converts permission number to RWX format — Example: 0755 folder becomes drwxr-xr-x

Скриншоты

  • The current query, for example.
  • Enhanced display when a Kint debugger plugin is installed (see Description).

Установка

  1. Upload to your plugins folder, usually wp-content/plugins/
  2. Activate the plugin on the plugin screen.
  3. Navigate to the front-end of your website and hover over the ‘Debug This’ menu item in the admin bar.

Часто задаваемые вопросы

Как использовать Debug This?

  1. Убедитесь, что панель администратора включена в вашем профиле пользователя.
  2. Visit any page/post/archive on your website and you will see a Debug This menu item on the admin bar.

С какой версией PHP это совместимо?

We’ve tested on PHP >= 5.2.17

Могу ли я запросить новые режимы отладки?

Безусловно! Чтобы поддерживать легкий и эффективный плагин, запросы, которые слишком локализованы для большего блага, могут быть отклонены. Если это произойдет, я с радостью помогу вам создать собственный режим отладки.

Могу ли я изменить плагин или создать собственные режимы отладки?

Yes! Visit the Extend section to find out how you can thoroughly extend Debug This for your own needs.

Отзывы

03.09.2016 4 ответа
Our website is an active community website, and we can't expose the Admin Bar on the front end, even for a few minutes. In order for this plugin to function, the Admin Bar must be enabled on the front end, for at least the Administrator level user. The only way we could do this, is by disabling the Hide Admin Bar plugin, and installing another plugin which hides the Admin Bar to everyone except for Administrator user. We don't have the luxury of exposing our site for any amount of time, and we're not going to spend the time cloning our site to a test sandbox and removing and re-adding some Admin Bar plugin that will work ... JUST so we can use this DEBUG THIS plugin. I hope everyone understands. The plugin is probably great. But it's fundamentally unusable on a seriously deployed website.
03.09.2016 1 ответ
I had a rewrite rule and it was driving me insane! It took me 1 min to work it out with this plugin. Thanks a lot.
Посмотреть все 17 отзывов

Участники и разработчики

«Debug This» — проект с открытым исходным кодом. В развитие плагина внесли свой вклад следующие участники:

Участники

«Debug This» переведён на 1 язык. Благодарим переводчиков за их работу.

Перевести «Debug This» на ваш язык.

Заинтересованы в разработке?

Посмотрите код, проверьте SVN репозиторий, или подпишитесь на журнал разработки по RSS.

Журнал изменений

0.6.4 — 07.01.2022

  • Display bug fix
  • Added: Sanitization and escapes

0.6.3 — October 10, 2019

  • Translation file update

0.6.2 — September 12, 2019

  • Translation ready

0.6.1 — June 19, 2018

  • Fix bug with anonymous functions in Filters report.

0.6 — May 22, 2018

  • Fix bug with static methods in Filters report.

0.5.2 — November 17, 2017

  • Improve error handling.

0.5.1 — December 27, 2016

  • Предотвратите конфликт с Kint Debugger, когда активна панель отладки.

0.5 — December 15, 2016

  • Обновление для WordPress 4.4+
  • Добавьте обработку ошибок.
  • Добавить режим для несериализованных опций.
  • Добавить режим для активных плагинов.
  • Add <pre> tags conditionally (not every mode).
  • Совместимость с плагинами оболочки Kint.
  • Совместимость с настраиваемыми журналами ошибок.
  • Удалите таблицу стилей Bootstrap.
  • Обновите файл POT.

0.4 — August 29, 2015

  • Fix display of global array variables.
  • Fix display of current template.
  • Fix use of a deprecated function.

0.3.2 — April 17, 2015

  • Improve SAVEQUERIES check.

0.3.1 — March 17, 2015

0.3

  • Added advanced remote fetch for buffer
  • Added real saved queries and execution time from original URL — can now be accessed as static properties $queries and $execution_time
  • Added get_current_debug_url() method — exposes current URL with debug query
  • Added post-meta debug mode. Created new menu section for queried object
  • Updated bloginfo mode to true bloginfo values
  • Updated wp-debug mode with better logic
  • Added functionality for adding header links to the debug mode screen via add_debug_header_link($url, $label, $classes = '')
  • Added reset debug log functionality with debug header link for wp-debug mode

0.2.2

  • Added backwards compatibility to 3.3.
  • Added support for no pretty permalinks.

0.2.1

  • Critical fix for PHP <= 5.2 Removed anonymous functions.
  • Fixed undefined $debug notices for all versions.

0.02

  • Added new debug modes: Apache modules, PHP loaded extensions, file permissions, php.ini, $_SERVER, and execution time.
  • Added three functions for getting file ownership and permissions
    • debug_this_get_file_ownership($file)
    • debug_this_get_file_perms($file)
    • debug_this_convert_perms_to_rwx($perms)

0.01

  • Debug This Creation