[wordpress插件] Debug-Bar-Extender调试栏扩展器

wordpress 插件 文章 2020-04-14 02:00 568 0 全屏看文

AI助手支持GPT4.0

评分
92
描述

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.

此插件需要调试工具插件> 0.5 和开发人员的大脑才能正常工作。

p>

>

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.

将您的检查点添加到index.php或任何其他模板文件中,如下所示。

  <?php if(have_posts()):?>

checkpoint('loop start');

<?php Debug_Bar_Extender :: instance()-> checkpoint('循环开始');

?>

?>

<?php while(have_posts()):the_post();

?>

?>

trace_var( $post );

<?php Debug_Bar_Extender :: instance()-> trace_var($ post);

?>

?>

checkpoint('loop1');

<?php Debug_Bar_Extender :: instance()-> checkpoint('loop1');

?>

?>

id="post-">

id =“ post-<?php the_ID();?>”>

<?php // before_post();

?>

?>

“ rel =” bookmark“ title =” <?php printf(__('永久链接到%s','kubrick'),the_title_attribute('echo =

0')); ?>">

0'));?>“> <?php the_title();

?>

?>

by

<?php the_time(get_option('date_format'))?>通过<?php the_author()?>

<?php the_content(__('阅读本条目的其余部分&raquo;','kubrick'));

?>

?>

<?php the_tags(__('Tags:','kubrick')。'',',','
');

?>

?> <?php printf(__('张贴在%s','kubrick'),get_the_category_list(','));

?> |

?> |

<?php edit_post_link(__('Edit','kubrick'),``,'|');

?>

?> <?php comments_popup_link(__('No Comments»','kubrick'),__('1 Comment»','kubrick'),__('%Comments»','kubrick'));;

?>

?>

<?php after_post();

?>

?>

checkpoint('loop2');

<?php Debug_Bar_Extender :: instance()-> checkpoint('loop2');

?>

?>

<?php结束;

?>

?>

checkpoint('loop end');

<?php Debug_Bar_Extender :: instance()-> 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.

查看debug-bar-extender.php的源代码,您会发现有各种过滤器可以控制默认设置。

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

这是一个示例,说明由mu-plugins /中的php文件执行的设置看起来像

add_filter( 'debugbarextender_default_settings', 'my_debug_bar_extender_settings' );

  add_filter('debugbarextender_default_settings','my_debug_bar_extender_settings');

// enforce debug bar settings

//强制执行调试栏设置

function my_debug_bar_extender_settings( $default_settings ) {    

函数my_debug_bar_extender_settings($ default_settings){    

$default_settings = array(            

$ default_settings =数组(            

'enable_profiler' => 1,            

'enable_profiler'=> 1,            

'enable_variable_lookup' => 1,            

'enable_variable_lookup'=> 1,            

'track_default_vars' => 0,            

'track_default_vars'=> 0,            

'add_default_checkpoints' => 1,            

'add_default_checkpoints'=> 1            

'savequeries_debugmode_enable' => 1,            

'savequeries_debugmode_enable'=> 1,            

'use_error_log' => 0,            

'use_error_log'=> 0,            

'allow_url_settings' => 1,            

'allow_url_settings'=> 1            

'enable_admin_bar_menu' => 1,    

'enable_admin_bar_menu'=> 1    

);    

);    

return $default_settings;

返回$ default_settings;

}

}

add_filter( 'debugbarextender_default_checkpoint_actions', 'my_debug_bar_extender_checkpoints' );

add_filter('debugbarextender_default_checkpoint_actions','my_debug_bar_extender_checkpoints');

// initiate some default checkpoints

//启动一些默认检查点

function my_debug_bar_extender_checkpoints( $default_checkpoints ) {    

函数my_debug_bar_extender_checkpoints($ default_checkpoints){    

$default_checkpoints = array(                    

$ default_checkpoints =数组(                    

'muplugins_loaded',                    

'muplugins_loaded',                    

'wp_head',                    

'wp_head',                    

'wp_footer',                    

'wp_footer',                    

'loop_start',                    

'loop_start',                    

'loop_end',                    

'loop_end',                    

'shutdown',    

'关掉',    

);    

);    

return $default_checkpoints;

返回$ 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.

您在评论中的建议。

下载地址
https://downloads.wordpress.org/plugin/debug-bar-extender.zip
-EOF-

AI助手支持GPT4.0


国内超级便宜服务器

摸鱼人热门新闻聚合

钻级赞助商 我要加入

开发者在线工具

第三方支付技术请加QQ群

相关文章
[wordpress插件] Belgo Meteo比利时流星
[wordpress插件] // $Id: README.txt 27117 2007-12-18 06:35:52Z turmsegler $// $ Id:README.txt 27117 2007-12-18 06:35:52Z turmsegler $
[wordpress插件] CWidget CountdownCWidget倒计时
[wordpress插件] amr cron manager阿姆·克朗经理
[wordpress插件] ChordChartWP和弦图
随便看看
怎么添加小程序支付功能? 4516
教育科技公司申请微信支付被拒绝? 4798
微信公众号免300认证教程 5892
小程序已经上线,作为管理员无法在小程序数据助手查看数据? 5299
小程序广告组件通过审核,但是小程序内没有显示广告? 5067
企业微信通讯录账号被管理员误/恶意删除,怎么办? 9568
问题? 9047
如何快速搭建抽奖助手小程序(无需代码知识) 6177
许涛 大哥在吗, 要解冻小程序的时候提示信息主体不一致, 能帮忙看下吗? 7471
小程序搜一搜全称搜索不显示 麻烦解决一下!谢谢 6793