Giter Site home page Giter Site logo

query-monitor-extend's Introduction

WP tested 6.6.1 QM tested up to 3.16.4 License: GPL v3 PHPCS PHPStan

Query Monitor Extend

WordPress plugin with customizations to enhance and extend the already awesome Query Monitor plugin by John Blackbourn.

Panels

Panel Description
ACF Calls to the_field() and get_field(), and Local JSON configuration
Constants User defined constants: get_defined_constants( true )['user']
Files Included files: get_included_files()
$_SERVER Dump of $_SERVER
$_GET Dump of $_GET (if set)
$_POST Dump of $_POST (if set)
Heartbeats Monitors WordPress' Heartbeat
Image Sizes Names, count, width, height, ratio, cropped, and source of WordPress registered image sizes
Paths Constants and functions for WordPress URLs and paths
Time Current time in timezones: UTC, server, WordPress, and browser

Demo

Demos of QMX are available via the WordPress Playground:

See Demos document for more info.

Installing

Recent releases contain zip files for installation as a WordPress plugin and mu-plugin.

Composer

If you prefer to use Composer, you can install this package with the following command.

composer require --dev crstauf/query-monitor-extend

query-monitor-extend's People

Contributors

alewolf avatar crstauf avatar mklepaczewski avatar szepeviktor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

query-monitor-extend's Issues

filesize(): stat failed for /tmp/20-dequeue-gutenberg-css.php

Query Monitor Outputs serveral warnings regarding Query Monitor Extend:

Warning filesize(): stat failed for /tmp/20-dequeue-gutenberg-css.php
wp-content/plugins/query-monitor-extend-version-1.4.2/files/qmx-files-output.php:61
filesize()
do_action('shutdown')
shutdown_action_hook()
1 Plugin: query-monitor-extend-version-1.4.2

Warning filesize(): stat failed for /tmp/20-dequeue-gutenberg-css.php
wp-content/plugins/query-monitor-extend-version-1.4.2/files/qmx-files-output.php:100
filesize()
do_action('shutdown')
shutdown_action_hook()
1 Plugin: query-monitor-extend-version-1.4.2

Warning filesize(): stat failed for /tmp/20-dequeue-gutenberg-css.php
wp-content/plugins/query-monitor-extend-version-1.4.2/files/qmx-files-output.php:113
filesize()
do_action('shutdown')
shutdown_action_hook()
1 Plugin: query-monitor-extend-version-1.4.2

Warning filesize(): stat failed for /tmp/20-dequeue-gutenberg-css.php
wp-content/plugins/query-monitor-extend-version-1.4.2/files/qmx-files-output.php:114
filesize()
do_action('shutdown')
shutdown_action_hook()
1 Plugin: query-monitor-extend-version-1.4.2

Notice Undefined index: groups
wp-content/plugins/query-monitor-extend-version-1.4.2/acf/qmx-acf-output.php:554
apply_filters('qm/output/panel_menus')
do_action('shutdown')
shutdown_action_hook()
1 Plugin: query-monitor-extend-version-1.4.2

PHP Error - Array_key_exists

I have just installed the query_montior extended plugin and I am getting this php error in the query monitor logs:

Warning
Message:
array_key_exists(): The first argument should be either a string or an integer
Count: 4
Location: wp-content/plugins/query-monitor-extend-master/collectors/image_sizes.php:127
Component:
Plugin: query-monitor-extend-master

Can you please take a look?

count(): Parameter must be an array or an object that implements Countable

Query Monitor Outputs an issue whileQuery Monitor Extendis ac
Warning
count(): Parameter must be an array or an object that implements Countable

wp-content/plugins/query-monitor-extend-version-1.4.2/acf/qmx-acf-output.php:554
apply_filters('qm/output/panel_menus')
do_action('shutdown')
shutdown_action_hook()

Plugin: query-monitor-extend-version-1.4.2

Consider breaking into pieces

Rather than one plugin with multiple enhancements and new panels, break each off into its own directory, for use as an mu-plugin.

Example:

qm-extend-constants
- qmx-constants-collector.php
- qmx-constants-output.php

This might not work for all current additions, so carefully evaluate before starting.

php warning in image_sizes collector when size is passed as array to filter__wp_get_attachment_image_src

php 7.4.6
wordpress 5.7.2

the $size parameter can be passed as an array to the 'wp_get_attachment_image_src' filter hook. This throws a php warning in filter__wp_get_attachment_image_src

the Wordpress function get_site_icon_url is an example that can pass $size as an array.

PHP Warning: array_key_exists(): The first argument should be either a string or an integer in /var/www/html/dev.website.com/wp-content/plugins/query-monitor-extend-version-1.2/collectors/image_sizes.php on line 127

backtrace:

    wp-content/plugins/query-monitor-extend-version-1.2/collectors/image_sizes.php:127
       apply_filters('wp_get_attachment_image_src')
    wp-includes/media.php:991
        wp_get_attachment_image_src()
    wp-includes/media.php:1131
        wp_get_attachment_image_url()
    wp-includes/general-template.php:936
        get_site_icon_url()
    wp-includes/general-template.php:3222
        wp_site_icon()
    wp-includes/class-wp-hook.php:292
        do_action('wp_head')
    wp-includes/general-template.php:3009
        wp_head()
    wp-content/themes/Total/header.php:19
        load_template('wp-content/themes/Total/header.php')
    wp-includes/template.php:676
        locate_template()
    wp-includes/general-template.php:48
        get_header()
    wp-content/themes/Total/page.php:13

QM debug log of parameters passed to filter__wp_get_attachment_image_src when php warning is triggered

Array
(
    [image] => Array
        (
            [0] => https://dev.website.com/wp-content/uploads/2018/08/logo_512x512_square-32x32.jpg
            [1] => 32
            [2] => 32
            [3] => 1
        )

    [attachment_id] => 119
    [size] => Array
        (
            [0] => 32
            [1] => 32
        )

)

Fatal error with QM 3.0

Query Monitor Extend triggers a fatal error in the Scripts panel in QM 3.0:

Fatal error: Uncaught Error: Call to undefined method QMX_Output_Html_Assets::get_dependents() in wp-content/plugins/query-monitor-extend/output/assets.php on line 145

This is because I've moved some of the methods out of the output class and into the collector class. Sorry about that, but I can't really maintain backwards compatibility for something that's I'm not really expecting other plugins to extend.

PHP Fatal error: Uncaught Error: Class 'QM_Plugin' not found

This error is caused if someone deactivates Query Monitor plugin. There must be a conditional block that checks whether Query Monitor plugin is active or QM_Plugin class exists before trying to extend the plugin/class to prevent the fatal error. If Query Monitor is not activate or class isn't found, an admin notice saying that this plugin requires Query Monitor should be displayed.

Feature: registered assets

QM has a panel for printed assets, but it could be helpful to have a list of registered assets as well.

image_sizes.php notice

image_sizes.php has the sizes hardcoded (line 14-43)
in cases where a specific size doesn't exist, this will cause a PHP notice.

e.g. a WP page I work on doesnt have the medium_large size, causing errors all the time.

Please make this an apply_filters, so people can filter out or add any additional sizes they want to avoid getting notices.

Post autosave not working anymore

Hi @crstauf ,

I've just find out the following issue.

How to reproduce?

  • Install a brand new wordpress website (right now, it is 5.2.2).
  • Add "Classic Editor" plugin + Active the plugin
  • Add "Query Monitor" plugin + Active the plugin
  • Set WP Writing rules as follow:
    => Default editor for all users = Classic Editor
    => Allow users to switch editors = Yes
  • Create a new user with the role "Editor"
  • Login with the newly created editor user
  • Begin writing a new post using the classic editor => the post will be auto-saved every 60 seconds (the default value for WP autosaving).
  • Save your draft article and exit editing.
  • Add "Query Monitor Extend" plugin + Active the plugin
  • Continue editing your previous post (with the editor user) using the classic editor => the post will not be auto-saved anymore.
  • Try editing the post with the administrator user => the post will be auto-saved.

I also tried editing the post (with the editor user) with the new Guttenberg editor and the autosave seems to be working just fine in that case.

So it seems that the classic editor is the only one being affected here where you're connected with a user that do not have the Administrator role.

I hope this will help.

Best regards,
Stephane.

Versioning with releases

It would be great if you could version with git tags/releases as that would make updating much easier as one would get an email notification by github, once a new version is released

Add count on image size use

wp_get_attachment_image_src filter contains the $size parameter, which can be used to track how many uses of each size there are.

PHP Errors dose not show instead throws an error

I am using Query Monitor & Query Mointor Extended in my localhost . since Query Monitor 3.0 the query monitor extended is not showing php notices in debug bar. instead it just shows like below
image

Conflict with Query Monitor Version 3.3.4

Hi,
It seems there is a conflict with Query Monitor's latest version.
I have to deactivate "Query Monitor Extend" in order to see all the information available in the admin bar : https://ibb.co/0ZGGvjZ
As soon as I reactivate "Query Monitor Extend", nothing is displayed anymore : https://ibb.co/6WBrP89

Versions :

  • WordPress 5.1.1
  • Query Monitor : 3.3.4
  • Query Monitor Extend : 0.0.5

Thanks for your help.
Best regards,
Stephane.

Incompatibility with refactored assets output

Hey. Thanks for plugin!

Unfortunately, it stopped working. Versions used:

  • WordPress 5.0.3
  • Any theme
  • Query Monitor 3.3.1
  • Query Monitor Extend 0.0.5

Screenshot of the main page of Twenty Seventeen theme
screen 20-02-2019 023214

Still have fatal error

2021-12-29T20:50:16+00:00 CRITICAL Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type array, null given in /public_html/wp-content/plugins/query-monitor-extend/collectors/image_sizes.php:133
Stack trace:
#0 /public_html/wp-includes/class-wp-hook.php(305): QMX_Collector_Image_Sizes->filter__wp_get_attachment_image_src()
#1 /public_html/wp-includes/plugin.php(189): WP_Hook->apply_filters()
#2 /public_html/wp-includes/media.php(991): apply_filters()
#3 /public_html/wp-includes/media.php(1131): wp_get_attachment_image_src()
#4 /public_html/wp-includes/general-template.php(936): wp_get_attachment_image_url()
#5 /public_html/wp-includes/general-template.php(977): get_site_icon_url()
#6 /public_html/wp-includes/general-template.php(3223): has_site_icon()
#7 /public_html/wp-includes/class-wp-hook.php(303): wp_site_icon()
#8 /public_html/wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters()
#9 /public_html/wp-includes/plugin.php(470): WP_Hook->do_action()
#10 /public_html/wp-includes/general-template.php(3015): do_action()
#11 /public_html/wp-content/themes/flatsome/header.php(10): wp_head()
#12 /public_html/wp-includes/template.php(770): require_once('...')
#13 /public_html/wp-includes/template.php(716): load_template()
#14 /public_html/wp-includes/general-template.php(48): locate_template()
#15 /public_html/wp-content/themes/flatsome/page-transparent-header-light.php(5): get_header()
#16 /public_html/wp-includes/template-loader.php(106): include('...')
#17 /public_html/wp-blog-header.php(19): require_once('...')
#18 /public_html/index.php(17): require('...')
#19 {main}
  thrown in /public_html/wp-content/plugins/query-monitor-extend/collectors/image_sizes.php on line 133

General System Status:
Web Server: LiteSpeed Enterprise
PHP: LSPHP8.0
Themes: Flatsome
Latest WP, latest Woocommerce
Image Sizes:

thumbnail: 150×150 pixels (cropped to fit)
medium: 400×400 pixels (proportionally resized to fit inside dimensions)
medium_large: 768×0 pixels (proportionally resized to fit inside dimensions)
large: 0×0 pixels (proportionally resized to fit inside dimensions)
1536x1536: 1536×1536 pixels (proportionally resized to fit inside dimensions)
2048x2048: 2048×2048 pixels (proportionally resized to fit inside dimensions)
woocommerce_thumbnail: 400×400 pixels (proportionally resized to fit inside dimensions)
woocommerce_single: 768×0 pixels (proportionally resized to fit inside dimensions)
woocommerce_gallery_thumbnail: 150×150 pixels (cropped to fit)
shop_catalog: 400×400 pixels (proportionally resized to fit inside dimensions)
shop_single: 768×0 pixels (proportionally resized to fit inside dimensions)
shop_thumbnail: 150×150 pixels (cropped to fit)

Division by zero (Query Monitor Extend)

Hi,

Just to let you know of a small warning I saw inside the logs:

[17-Jun-2018 16:41:31 UTC] PHP Warning:  Division by zero in /xxx/wp-content/plugins/query-monitor-extend-master/output/image_sizes.php on line 111
[17-Jun-2018 16:41:31 UTC] PHP Warning:  Division by zero in /xxx/wp-content/plugins/query-monitor-extend-master/output/image_sizes.php on line 111
[17-Jun-2018 16:41:31 UTC] PHP Warning:  Division by zero in /xxx/wp-content/plugins/query-monitor-extend-master/output/image_sizes.php on line 118
[17-Jun-2018 16:41:31 UTC] PHP Warning:  Division by zero in /xxx/wp-content/plugins/query-monitor-extend-master/output/image_sizes.php on line 118
[17-Jun-2018 16:41:31 UTC] PHP Warning:  Division by zero in /xxx/wp-content/plugins/query-monitor-extend-master/output/image_sizes.php on line 120
[17-Jun-2018 16:41:31 UTC] PHP Warning:  Division by zero in /xxx/wp-content/plugins/query-monitor-extend-master/output/image_sizes.php on line 120

Thanks again for this great plugin and extension.

Best regards,
Stephane.

acf collector php notices

Notice | Undefined offset: 0 | 1 |
wp-content/plugins/query-monitor-extend-master/collectors/acf.php:88 | Plugin: query-monitor-extend-master

Notice | Trying to access array offset on value of type null | 1 | 
wp-content/plugins/query-monitor-extend-master/collectors/acf.php:118 | Plugin: query-monitor-extend-master

Row 88 and 118 in acf.php.

Implement cease and detach functionality

The new cease and detach feature was added in johnbillion/query-monitor#590. In QM_Dispatcher::init() there's a check if the user can view QM output, and if not, cease and detach:

https://github.com/johnbillion/query-monitor/blob/d5b622b91f18552e7105e62fa84d3102b08975a4/classes/Dispatcher.php#L128-L132

The do_action( 'qm/cease' ) triggers the QM_Collectors::cease() function, which iterates over all the collectors and calls QM_Collector::discard_data(), which causes the data property to become an empty array, and thus rendering the data array to not have an assets key.

PHP Warning:

wp-includes/formatting.php:1098
   wp_check_invalid_utf8()
wp-includes/formatting.php:4479
   esc_html()
wp-content/plugins/query-monitor-extend/output/html/constants.php:54
   do_action('shutdown')
wp-includes/load.php:1097
   shutdown_action_hook()
Unknown location



Parse error line 47

I'm getting the following error when trying to activate the plugin:

Parse error: syntax error, unexpected ')' in /Users/user/dev/apps/wordpress/wp-content/plugins/query-monitor-extend-master/query-monitor-extend.php on line 47

But, your code looks ok to me...

Custom Post Types collector

More than once I've discovered CPTs from plugins that are setup incorrectly (unnecessary rewrite rules, archive, etc) when researching something else. Creating a panel in QM would help identify these sooner.

Research if there are other plugins for this purpose before starting.

Support for QM 3.10

PHP Fatal error:  Uncaught Error: Failed opening required '/output/Html.php' thrown in /wp-content/mu-plugins/qmx-constants-output.php on line 19

Query Monitor Extend V.1.2 makes a .php warning:

Hi Caleb,

below you can find a full copy of Query Monitor's message (there are no other tips to paste here for replication. I've just updated v.1.1 to v. 1.2. and got this message (I'm running the WP version 5.8.1 and 7.3.32 .php version. Thanks.

Warning array_key_exists(): The first argument should be either a string or an integer 4 -wp-content/plugins/query-monitor-extend-version-1.2/collectors/image_sizes.php:127array_key_exists()wp-content/plugins/query-monitor-extend-version-1.2/collectors/image_sizes.php:127apply_filters('wp_get_attachment_image_src')wp-includes/media.php:991wp_get_attachment_image_src()wp-includes/media.php:1131wp_get_attachment_image_url()wp-includes/general-template.php:936get_site_icon_url()wp-includes/general-template.php:3228wp_site_icon()wp-includes/class-wp-hook.php:303do_action('admin_head')wp-admin/admin-header.php:147 Plugin: query-monitor-extend-version-1.2

Image size ratio

Feature request of my own. I'd like to see the size ratio for each image size. For example:

 Name            | Width | Height | Ratio | Built-in
-----------------+-------+--------+-------+----------
 landscape-large | 300   | 200    | 3:2   |

You can calculate a ratio by using the greatest common denominator:

/**
 * Find the greatest common denominator between two numbers.
 *
 * @param  float $num1 First number.
 * @param  float $num2 Second number.
 * @return float       The GCD.
 */
protected static function gcd( $num1, $num2 ) {
    while ( $num2 != 0 ){
        $t    = $num1 % $num2;
        $num1 = $num2;
        $num2 = $t;
    }

    return $num1;
}

$gcd          = self::gcd( $width, $height );
$width_ratio  = $width / $gcd;
$height_ratio = $height / $gcd;
$image_ratio  = "{$width_ratio}:{$height_ratio}";

Disclaimer: I may add the display of image sizes to QM itself, I'm not sure yet.

Ref: johnbillion/query-monitor#196

Readme

It is not clear the purpose of this plugin as there is no readme

Breaks Customizer

With QM Extend active Customizer does not work - just a blank screen on the right, no Customizer sections on the left except the header with theme name. Turning QME off brings Customizer back immediately.

Tested on 4.6.* and 4.7 nightly

Not work in MultiSite

Network Active but seem query-monitor-extend like un-active... Need to activate on each sites.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.