[WordPress] 外掛分享: Debug-Bar-Extender

前言介紹

  • 這款 WordPress 外掛「Debug-Bar-Extender」是 2011-03-01 上架。 目前已經下架不再更新,不建議安裝使用。
  • 目前有 700 個安裝啟用數。
  • 上一次更新是 2011-09-02,距離現在已有 4992 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
  • 外掛最低要求 WordPress 3.1 以上版本才可以安裝。
  • 有 5 人給過評分。
  • 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。

外掛協作開發者

tott | automattic |

外掛標籤

debug | debug bar | development |

內容簡介

這個外掛為偵錯列(debug-bar)增加了更多功能,主要針對開發者喜歡除錯(debug)程式碼的人,或測量執行時間以找出程式碼中的錯誤。
它還允許通過在源代碼中添加簡單的代碼片段查找變量。

請注意,本外掛程序應僅用於偵錯或開發環境中使用,並不適用於生產環境的網站。

需求

此外掛需要debug-bar插件 > 0.5和開發人員的大腦才能正常工作。

用法
用法示例:剖析主題的程式迴圈(debug the loop)

按照以下方式將您的檢測點添加到index.php或任何其他模板文件中。

checkpoint('loop start'); ?>

trace_var( $post ); ?>

checkpoint('loop1'); ?>

id="post-">


by





checkpoint('loop2'); ?>

checkpoint('loop end'); ?>


進階用法

查看debug-bar-extender.php文件源代碼,您會注意到有各種過濾器(filter)可以控制預設設置。在多站點安裝(multisite install)上工作且希望使用檢測列而不必每次都調整設置時,這很有用。這裡是如何強制執行php文件中的設置的示例(mu-plugins/):

add_filter( 'debugbarextender_default_settings', 'my_debug_bar_extender_settings' );
//強制實行debug bar設置
function my_debug_bar_extender_settings( $default_settings ) {
$default_settings = array(
'enable_profiler' => 1,
'enable_variable_lookup' => 1,
'track_default_vars' => 0,
'add_default_checkpoints' => 1,
'savequeries_debugmode_enable' => 1,
'use_error_log' => 0,
'allow_url_settings' => 1,
'enable_admin_bar_menu' => 1,
);
return $default_settings;}

原文外掛簡介

This plugins adds more features to the debug-bar and is mainly aimed at developers who like to debug their code or want to measure runtimes to find glitches in their code.
It also allows lookup of variables by adding simple code snippets in your source.
Please note that this plugin should be used solely for debugging or on a development environment and is not intended for use in a production site.
Requirements
This plugin requires the debug-bar plugin >0.5 and a developers’ brain to work correctly.
Usage
Usage example to debug the loop of a theme
Add your checkpoints in the index.php or any other template file as shown below.

checkpoint('loop start'); ?>

trace_var( $post ); ?>

checkpoint('loop1'); ?>

id="post-">

by

checkpoint('loop2'); ?>

checkpoint('loop end'); ?>

Advanced usage
Looking at the source of the debug-bar-extender.php you will notice that there are various filters to control the default settings. This is useful when you are working on a multisite install and want to use the debug bar without having to adjust the settings every time. Here’s an example of how settings enforced by a php file in mu-plugins/ could look like
add_filter( 'debugbarextender_default_settings', 'my_debug_bar_extender_settings' );
// enforce debug bar settings
function my_debug_bar_extender_settings( $default_settings ) {
$default_settings = array(
'enable_profiler' => 1,
'enable_variable_lookup' => 1,
'track_default_vars' => 0,
'add_default_checkpoints' => 1,
'savequeries_debugmode_enable' => 1,
'use_error_log' => 0,
'allow_url_settings' => 1,
'enable_admin_bar_menu' => 1,
);
return $default_settings;
}

add_filter( 'debugbarextender_default_checkpoint_actions', 'my_debug_bar_extender_checkpoints' );
// initiate some default checkpoints
function my_debug_bar_extender_checkpoints( $default_checkpoints ) {
$default_checkpoints = array(
'muplugins_loaded',
'wp_head',
'wp_footer',
'loop_start',
'loop_end',
'shutdown',
);
return $default_checkpoints;
}

Wishlist
This is a work in progress, so feel free to pass by on our plugin page and leave us
your suggestions in the comments.

各版本下載點

  • 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
  • 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「Debug-Bar-Extender」來進行安裝。

(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。


最新版本

延伸相關外掛(你可能也想知道)

  • Query Monitor – The developer tools panel for WordPress 》ministrator user). This cookie can be set by defining QM_AUTH_KEY in your wp-config.php file., To learn more about how to use Query Monitor, please...。
  • Debug Bar Rewrite Rules 》Debug Bar Rewrite Rules 外掛能將透過篩選條件改變的 Rewrite Rules 的相關資訊新增至 Debug Bar 的一個新面板中。此外掛是 Debug Bar 的擴充套件,但也可以...。
  • Black Bar 》Black Bar 是一個專為 WordPress 開發人員設計的低調的偵錯列(Debug Bar)。它收集並顯示錯誤、執行的 SQL 查詢、緩慢的動作和掛鈎、主題模板、全域變數,並...。
  • ElasticPress Debugging Add-On 》此外掛會在Debug Bar外掛新增一個ElasticPress面板,讓您可以檢視在每次請求時執行的所有ElasticPress查詢。, 需求條件:, , ElasticPress 3.0+, Debug Bar 1...。
  • Debug Bar Cron 》Debug Bar Cron 將 WP 計劃事件的相關資訊加入 Debug Bar 的新面板中。此外掛為 Debug Bar 的擴展,因此必須安裝 Debug Bar 才能正常運作。, 安裝完成後,您...。
  • Debug Bar Actions and Filters Addon 》這個外掛將會在 Debug Bar 中新增兩個選項卡,以顯示當前請求所連結的鉤子 (Actions and Filters)。Actions 選項卡顯示當前請求所連接的鉤子。Filters 選項卡...。
  • BugFu Console Debugger 》使用瀏覽器控制台(不需要擴充)將您的佈景主題/外掛 PHP 代碼記錄/除錯。專為佈景主題和外掛開發人員製作。, 如何檢查 BugFu 是否運作, 打開您的瀏覽器控制...。
  • Debug Bar List Script & Style Dependencies 》我們都知道在 WordPress 中添加 script 或 style 時,我們應該使用 wp_enqueue_script( $handle, $src, $deps, $ver, $in_footer ) 和 wp_enqueue_style( $ha...。
  • BlackBox Debug Bar 》BlackBox 是像 Symfony 的非侵入式除錯工具列,附加在瀏覽器視窗的頂端。, 它如何協助您開發:, 1. 即時檢視全域變數(GET、POST、COOKIE、SERVER), 2. 除錯...。
  • Debug Bar Transients 》Debug Bar Transients(偵錯條快取)在偵錯條中新增一個面板,顯示有關 WordPress 快取(transients)的資訊。這個外掛是 Debug Bar 的擴充功能,因此需要安...。
  • Debug Bar Post Types 》Debug Bar Post Types為Debug Bar(除錯工具欄)新增一個面板,可顯示有關您網站已註冊的文章類型的詳細信息。, 注意, 使用此外掛程式需要安裝並啟用Debug Ba...。
  • Debug Bar Shortcodes 》Debug Bar Shortcodes 新增一個面板至 Debug Bar,顯示當前請求所註冊的 shortcode。, 此外,它還會顯示以下資訊:, , 由哪個函數/方法呼叫 shortcode, short...。
  • Debug Bar Constants 》Debug Bar Constants 外掛在 Debug Bar 中增加了三個面板,顯示當前請求中作為開發者可用的定義常數:, , WP 常數, WP 類別常數, PHP 常數, , 重要提示, 此外...。
  • Debug Bar Rewrite Rules 》顯示網站當前的重新導向規則。需要安裝 Debug Bar 外掛。。
  • Debug Bar Taxonomies 》Debug Bar Taxonomies 外掛為 Debug Bar 新增了一個面板,可顯示您網站所註冊的分類詳細資訊。, 重要提醒, 您必須先安裝並啟用 Debug Bar 外掛,才能使用本外...。

文章
Filter
Apply Filters
Mastodon