[wordpress插件] Debug This调试这个

wordpress 插件 文章 2020-04-14 07:50 567 0 全屏看文

AI助手支持GPT4.0

评分
94
描述

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

调试是一个独立的插件,由友好的人员在 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.

对于管理员,开发人员和支持人员,调试此可从前端管理栏中提供大量有关WordPress安装的信息。

    • The current WP_Query object
    • 当前WP_Query对象

    • Blog info and options
    • 博客信息和选项

    • Embed providers
    • 嵌入式提供商

    • Files in rendered HTML (CSS, images, JavaScript)
    • 呈现的HTML文件(CSS,图像,JavaScript)

    • Filters and actions
    • 过滤器和操作

    • Images sizes
    • 图片大小

    • Globals and constants
    • 全局变量和常量

    • Menus
    • 菜单

    • Object cache stats
    • 对象缓存统计信息

    • Plugins, must-use plugins, and dropins
    • 插件,必须使用的插件和dropins

    • Rewrite rules
    • 重写规则

    • Queries
    • 查询

    • PHP and server information
    • PHP和服务器信息

    • Post attachments
    • 帖子附件

    • Post types
    • 帖子类型

    • Scripts and styles enqueued
    • 排队的脚本和样式

    • Shortcodes
    • 简码

    • Sidebars and widgets
    • 侧边栏和小部件

    • Taxonomies and terms
    • 分类法和术语

    • Themes
    • 主题

    • Users
    • 用户

    • WP cron schedules and jobs
    • WP cron的时间表和工作

    • WP debug log
    • 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.

    测试小功能,您可以直接从管理栏中显示所需的内容。

    For example, when viewing a single post, you can see:

    例如,查看单个帖子时,您可以看到:

      • a list of post attachments,
      • 帖子附件列表,

      • which menus and sidebars are being displayed,
      • 正在显示哪些菜单和侧边栏,

      • the post type, post fields, and meta data,
      • 帖子类型,帖子字段和元数据

      • the current query variables and query string,
      • 当前查询变量和查询字符串,

      • the rewrite rules applied,
      • 应用的重写规则,

      • the author,
      • 作者

      • the terms,
      • 条款

      • and much more.
      • 还有更多

      Now compatible with Kint!

      现在与Kint兼容!

      Don’t get lost in deep arrays and objects.

      不要迷失在深层阵列和对象中。

      Organize and isolate your debugging output by installing this great plugin:

      通过安装此出色的插件来组织和隔离调试输出:

      Kint Debugger

      调试器

      Recommended Plugins

      推荐插件

        Extend

        扩展

        Debug This Functions

        调试此功能

        New debug modes can be created easily:

        可以轻松创建新的调试模式:

        add_debug_extension(    

          add_debug_extension(    

        $mode,    

        $模式,    

        $menu_label,    

        $ menu_label,    

        $description,    

        $ description,    

        $callback,    

        $ callback,    

        $group = 'General'

        $ group ='常规'

        );

        );

        Example

        示例

        add_debug_extension(    

          add_debug_extension(    

        'actions',    

        “动作”,    

        __('Actions', 'debug-this'),    

        __('Actions','debug-this'),    

        __('$wp_actions contains all active registered actions', 'debug-this'),    

        __('$ wp_actions包含所有活动的已注册动作','debug-this'),    

        'foo_callback',    

        'foo_callback',    

        'Filters And Actions'

        “过滤条件和操作”

        );

        );

        function foo_callback($buffer, $template){    

        函数foo_callback($ buffer,$ template){    

        global $wp_actions;    

        全局$ wp_actions;    

        $debug = print_r($wp_actions, true);    

        $ debug = print_r($ wp_actions,true);    

        return $debug;

        返回$ 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');

          add_debug_header_link('http:// urltolink','链接标签');

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

        扩展名也可以使用 remove_debug_extension($ mode); 删除

        No PRE Tags

        没有PRE标签

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

        如果您不希望调试输出包含在PRE标签中,只需在扩展名中设置以下内容即可:

        Debug_This::$no_pre = true;

          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 :: $ execution_time

          • Debug_This::$queries – SAVEQUERIES must defined as true
          • Debug_This :: $ queries –必须将SAVEQUERIES定义为true

          URL Helpers

          URL帮助器

            • Debug_This::get_current_debug_url() – current URL with the debug query
            • Debug_This :: get_current_debug_url() –带有调试查询的当前URL

            • Debug_This::get_escape_url() – used for the debug escape link that links to original page URL
            • Debug_This :: get_escape_url() –用于链接到原始页面URL的调试转义链接

            WP Actions

            WP操作

              • debug_this – receives the $mode arg – outputs the debug code sent from the extension modes.

              • debug_this –接收$ mode arg –输出从扩展模式发送的调试代码。

                The default action is set to priority 5. This allows you to prepend or append any output without conflict using less or greater priorities.

              • 默认操作设置为优先级5。这允许您使用较小或较大的优先级在没有冲突的情况下添加或追加任何输出。

              WP Filters

              WP过滤器

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

              可以使用一些过滤器来自定义Debug This来满足您的需求:

                • debug_this_template – receives $template arg – Use your own template
                • debug_this_template –收到$ template arg –使用您自己的模板

                • debug_this_default_mode – receives $mode arg – Alters the mode for the parent DT admin bar button link.
                • debug_this_default_mode –接收$ mode arg –更改父级DT管理栏按钮链接的模式。

                • debug_this_output – receives $output, $mode args – Filter debug content before it’s rendered
                • debug_this_output –接收$ output,$ mode args –在呈现调试内容之前对其进行过滤

                JavaScript

                JavaScript

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

                要访问内置的Debug This JS功能,请在自定义脚本中将依赖项设置为 debug-this

                Your script will inherit a jQuery dependency.

                您的脚本将继承jQuery依赖项。

                Object: debugThis

                对象:debugThis

                  • debugThis.mode – current mode
                  • debugThis.mode –当前模式

                  • debugThis.defaultMode
                  • debugThis.defaultMode

                  • debugThis.template – current included template
                  • debugThis.template –当前包含的模板

                  • debugThis.queryVar – the defined query string variable
                  • debugThis.queryVar –定义的查询字符串变量

                  Functions:

                  功能

                    • isDebug()
                    • isDebug()

                    • getDebugMode() – uses isDebug()
                    • getDebugMode() –使用 isDebug()

                    Events:

                    事件:

                    A jQuery debug-this event is fired from the footer.

                    从页脚触发jQuery debug-this 事件。

                    You can hook into this event with the following;

                    您可以通过以下方法加入此事件;

                    jQuery(document).bind('debug-this', function(event, debugThis){    

                      jQuery(document).bind('debug-this',function(event,debugThis){    

                    console.log(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_ownership($ file) –返回 array('name'=> $ name,'group'=> $ group)

                      • debug_this_get_file_perms($file) – returns string – Example: 0775
                      • debug_this_get_file_perms($ file) –返回字符串–示例:0775

                      • debug_this_convert_perms_to_rwx($perms) – returns string – converts permission number to RWX format – Example: 0755 folder becomes drwxr-xr-x
                      • debug_this_convert_perms_to_rwx($ perms) –返回字符串–将权限号转换为RWX格式–示例:0755文件夹变为drwxr-xr-x

安装步骤

    1. Upload to your plugins folder, usually wp-content/plugins/
    2. 上传到您的插件文件夹,通常为 wp-content / plugins /

    3. Activate the plugin on the plugin screen.
    4. 在插件屏幕上激活插件。

    5. Navigate to the front-end of your website and hover over the ‘Debug This’ menu item in the admin bar.
    6. 导航到网站的前端,并将鼠标悬停在管理栏中的“调试此”菜单项上。

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

AI助手支持GPT4.0