10% content-glass-button

Code Review | CG Button

WordPress plugin CG Button scored10%from 54 tests.

About plugin

  • Plugin page: content-glass-button
  • Plugin version: 1.0.5.6
  • PHP version: 7.4.16
  • WordPress compatibility: 3.1-4.2.2
  • WordPress version: 6.3.1
  • First release: May 20, 2015
  • Latest release: Aug 4, 2015
  • Number of updates: 79
  • Update frequency: every 1.0 days
  • Top authors: Rhizome Networks (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /959 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
Please fix the following installer errors
  • The plugin did not install without errors
    • > Deprecated in wp-content/plugins/content-glass-button/core/HtmlElement.php+12
    Methods with the same name as their class will not be constructors in a future version of PHP; HtmlElement has a deprecated constructor

Server metrics [RAM: ▼1.84MB] [CPU: ▼48.85ms] Passed 4 tests

Server-side resources used by CG Button
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /2.14 ▼1.325.55 ▼36.75
Dashboard /wp-admin2.16 ▼1.147.71 ▼42.14
Posts /wp-admin/edit.php2.17 ▼1.198.33 ▼36.68
Add New Post /wp-admin/post-new.php2.17 ▼3.726.62 ▼79.81
Media Library /wp-admin/upload.php2.17 ▼1.0613.33 ▼22.22
CG Button /wp-admin/options-general.php?page=content-glass-button/core/CG-Button-init.php2.167.52

Server storage [IO: ▲0.08MB] [DB: ▲0.00MB] Passed 3 tests

Analyzing filesystem and database footprints of this plugin
No storage issues were detected
Filesystem: 22 new files
Database: no new tables, 7 new options
New WordPress options
can_compress_scripts
widget_recent-comments
db_upgraded
widget_recent-posts
widget_cgbutton_widget
theysaidso_admin_options
widget_theysaidso_widget

Browser metrics Passed 4 tests

This is an overview of browser requirements for CG Button
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,823 ▲8813.25 ▼1.121.89 ▼0.1340.34 ▼9.47
Dashboard /wp-admin2,212 ▲215.79 ▲0.8795.19 ▼11.2939.03 ▼4.57
Posts /wp-admin/edit.php2,093 ▲71.97 ▼0.0433.34 ▼4.3731.97 ▼2.59
Add New Post /wp-admin/post-new.php1,535 ▲221.04 ▼2.24627.66 ▼55.9060.43 ▲3.83
Media Library /wp-admin/upload.php1,392 ▲14.06 ▼0.1597.22 ▼2.5041.39 ▼3.28
CG Button /wp-admin/options-general.php?page=content-glass-button/core/CG-Button-init.php1,0272.1722.7330.33

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] 50% from 4 tests

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
The following items require your attention
  • The plugin did not uninstall gracefully
    • > Deprecated in wp-content/plugins/content-glass-button/core/HtmlElement.php+12
    Methods with the same name as their class will not be constructors in a future version of PHP; HtmlElement has a deprecated constructor
  • Zombie WordPress options were found after uninstall: 7 options
    • widget_recent-comments
    • widget_cgbutton_widget
    • can_compress_scripts
    • db_upgraded
    • widget_theysaidso_widget
    • widget_recent-posts
    • theysaidso_admin_options

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
These errors were triggered by the plugin
    • > GET request to /wp-admin/options-general.php?page=content-glass-button/core/CG-Button-init.php
    • > Deprecated in wp-content/plugins/content-glass-button/core/HtmlElement.php+12
    Methods with the same name as their class will not be constructors in a future version of PHP; HtmlElement has a deprecated constructor
    • > GET request to /wp-admin/options-general.php?page=content-glass-button/core/CG-Button-init.php
    • > Deprecated in wp-content/plugins/content-glass-button/core/CG-Button-widget.php+25
    Methods with the same name as their class will not be constructors in a future version of PHP; CgButtonWidget has a deprecated constructor
  • 6 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=content-glass-button/core/CG-Button-init.php
    • > Notice in wp-content/plugins/content-glass-button/utils/ModuleUtils.php+181
    Trying to get property 'status' of non-object
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=content-glass-button/core/CG-Button-init.php
    • > Notice in wp-content/plugins/content-glass-button/utils/ModuleUtils.php+273
    Undefined property: stdClass::$button
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=content-glass-button/core/CG-Button-init.php
    • > Notice in wp-content/plugins/content-glass-button/utils/ModuleUtils.php+275
    Trying to get property 'app_id' of non-object
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=content-glass-button/core/CG-Button-init.php
    • > Notice in wp-content/plugins/content-glass-button/core/CG-Button-menu-link.php+59
    Trying to get property 'http_code' of non-object
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=content-glass-button/core/CG-Button-init.php
    • > Notice in wp-content/plugins/content-glass-button/core/CG-Button-menu-link.php+70
    Trying to get property 'message' of non-object
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=content-glass-button/core/CG-Button-init.php
    • > User deprecated in wp-includes/functions.php+5546
    The called constructor method for WP_Widget class in CgButtonWidget is deprecated since version 4.3.0! Use __construct() instead.
    • > GET request to /wp-admin/options-general.php?page=content-glass-button/core/CG-Button-init.php
    • > User notice in wp-includes/functions.php+5905
    Function add_submenu_page was called incorrectly. The seventh parameter passed to add_submenu_page() should be numeric representing menu position. Please see Debugging in WordPress for more information. (This message was added in version 5.3.0.)
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=content-glass-button/core/CG-Button-init.php
    • > Notice in wp-content/plugins/content-glass-button/utils/ModuleUtils.php+203
    Trying to get property 'name' of non-object

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Almost there! Just fix the following items
  • 4× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/content-glass-button/templates/CustomizeButtonScript.php
    • > /wp-content/plugins/content-glass-button/CG-button-plugin.php
    • > /wp-content/plugins/content-glass-button/core/CG-Button-init.php
    • > /wp-content/plugins/content-glass-button/templates/ContentGlassSystemScripts.php
  • 17× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Notice
      Undefined index: CG_SERVER in wp-content/plugins/content-glass-button/templates/ContentGlassSystemScripts.php on line 32
    • > PHP Notice
      Undefined index: label in wp-content/plugins/content-glass-button/templates/CustomizeButtonScript.php on line 3
    • > PHP Notice
      Undefined index: APP_DATA in wp-content/plugins/content-glass-button/templates/ContentGlassSystemScripts.php on line 2
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/content-glass-button/utils/ModuleUtils.php on line 51
    • > PHP Notice
      Undefined index: style in wp-content/plugins/content-glass-button/templates/CustomizeButtonScript.php on line 5
    • > PHP Notice
      Undefined index: XDEBUG in wp-content/plugins/content-glass-button/templates/ContentGlassSystemScripts.php on line 25
    • > PHP Notice
      Undefined index: SESSION_ID in wp-content/plugins/content-glass-button/templates/ContentGlassSystemScripts.php on line 32
    • > PHP Notice
      Undefined index: APP_ID in wp-content/plugins/content-glass-button/templates/ContentGlassSystemScripts.php on line 32
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/content-glass-button/core/CG-Button-widget.php:25
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/content-glass-button/utils/ModuleUtils.php on line 51

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser errors were detected

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
These attributes need your attention:
  • Plugin Name: Write the name of your plugin instead of "Plugin Name" on the first line ( === content-glass-button === )
You can take inspiration from this readme.txt

content-glass-button/CG-button-plugin.php 92% from 13 tests

The main file in "CG Button" v. 1.0.5.6 serves as a complement to information provided in readme.txt and as the entry point to the plugin
The following require your attention:
  • Main file name: Name the main plugin file the same as the plugin slug ("content-glass-button.php" instead of "CG-button-plugin.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
Everything looks great! No dangerous files found in this plugin1,266 lines of code in 19 files:
LanguageFilesBlank linesComment linesLines of code
PHP11126227622
JavaScript256134471
HTML4313110
CSS212563

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.16
Average class complexity6.40
▷ Minimum class complexity1.00
▷ Maximum class complexity17.00
Average method complexity1.90
▷ Minimum method complexity1.00
▷ Maximum method complexity8.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes5
▷ Abstract classes00.00%
▷ Concrete classes5100.00%
▷ Final classes00.00%
Methods30
▷ Static methods1240.00%
▷ Public methods2996.67%
▷ Protected methods00.00%
▷ Private methods13.33%
Functions13
▷ Named functions1292.31%
▷ Anonymous functions17.69%
Constants40
▷ Global constants3997.50%
▷ Class constants12.50%
▷ Public constants1100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
2 PNG files occupy 0.01MB with 0.00MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/cg60.png6.38KB3.20KB▼ 49.82%
images/cg17.png0.94KB1.03KB0.00%