84% insert-php-code-snippet

Code Review | Insert PHP Code Snippet

WordPress plugin Insert PHP Code Snippet scored84%from 54 tests.

About plugin

  • Plugin page: insert-php-code-s...
  • Plugin version: 1.3.4
  • PHP version: 7.4.16
  • WordPress compatibility: 2.8-6.3.2
  • WordPress version: 6.3.1
  • First release: Sep 16, 2013
  • Latest release: Oct 26, 2023
  • Number of updates: 26
  • Update frequency: every 142.0 days
  • Top authors: f1logic (100%)

Code review

54 tests

User reviews

631 reviews

Install metrics

100,000+ active /794,150 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
Installer ran successfully

Server metrics [RAM: ▲0.12MB] [CPU: ▼2.53ms] Passed 4 tests

A check of server-side resources used by Insert PHP Code Snippet
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.58 ▲0.1242.52 ▼0.24
Dashboard /wp-admin3.42 ▲0.1146.63 ▼3.02
Posts /wp-admin/edit.php3.54 ▲0.1747.19 ▼0.26
Add New Post /wp-admin/post-new.php6.02 ▲0.1383.36 ▼6.59
Media Library /wp-admin/upload.php3.34 ▲0.1144.03 ▲7.65
About /wp-admin/admin.php?page=insert-php-code-snippet-about3.3534.01
Settings /wp-admin/admin.php?page=insert-php-code-snippet-settings3.3633.14
PHPCode Snippets /wp-admin/admin.php?page=insert-php-code-snippet-manage3.4032.49
Suggest a Feature /wp-admin/admin.php?page=insert-php-code-snippet-suggest-features3.3632.52

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

Input-output and database impact of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 43 new files
Database: 1 new table, 17 new options
New tables
wp_xyz_ips_short_code
New WordPress options
can_compress_scripts
xyz_ips_installed_date
widget_theysaidso_widget
xyz_ips_auto_insert
widget_recent-posts
db_upgraded
xyz_ips_exception_email
xyz_ips_limit
xyz_ips_auto_exception
xyz_ips_credit_dismiss
...

Browser metrics Passed 4 tests

A check of browser resources used by Insert PHP Code Snippet
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,827 ▲6614.17 ▼0.441.72 ▲0.1142.95 ▼2.47
Dashboard /wp-admin2,230 ▲535.58 ▼0.0891.97 ▼5.7576.41 ▲32.99
Posts /wp-admin/edit.php2,135 ▲322.00 ▲0.0335.07 ▼0.3934.72 ▲2.69
Add New Post /wp-admin/post-new.php1,711 ▲18522.23 ▼0.86736.30 ▲52.7065.30 ▲1.60
Media Library /wp-admin/upload.php1,441 ▲414.22 ▲0.11101.34 ▼11.8564.22 ▲18.28
About /wp-admin/admin.php?page=insert-php-code-snippet-about1,5211.6723.5852.10
Settings /wp-admin/admin.php?page=insert-php-code-snippet-settings1,3361.7424.6634.54
PHPCode Snippets /wp-admin/admin.php?page=insert-php-code-snippet-manage1,2221.7024.9133.31
Suggest a Feature /wp-admin/admin.php?page=insert-php-code-snippet-suggest-features1,1231.7024.8430.42

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
It is recommended to fix the following
  • This plugin does not fully uninstall, leaving 11 options in the database
    • theysaidso_admin_options
    • can_compress_scripts
    • xyz_credit_link
    • widget_recent-posts
    • widget_xyz_insert_php_widget
    • xyz_ips_auto_insert
    • db_upgraded
    • xyz_ips_premium_version_ads
    • xyz_ips_auto_exception
    • widget_recent-comments
    • ...

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Please fix the following
  • 1× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/insert-php-code-snippet/admin/admin-notices.php:66

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
There were no browser issues found

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:
  • Tags: Please delete some tags, you are using 15 tag instead of maximum 10
You can take inspiration from this readme.txt

insert-php-code-snippet/insert-php-code-snippet.php 92% from 13 tests

The main PHP file in "Insert PHP Code Snippet" ver. 1.3.4 adds more information about the plugin and also serves as the entry point for this plugin
Please make the necessary changes and fix the following:
  • Description: The description should be shorter than 140 characters (currently 200 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
There were no executable files found in this plugin2,667 lines of code in 24 files:
LanguageFilesBlank linesComment linesLines of code
PHP223061762,153
CSS11453502
JavaScript13012

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.47
Average class complexity19.00
▷ Minimum class complexity19.00
▷ Maximum class complexity19.00
Average method complexity5.50
▷ Minimum method complexity1.00
▷ Maximum method complexity14.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods4
▷ Static methods00.00%
▷ Public methods4100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions26
▷ Named functions26100.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
18 PNG files occupy 0.08MB with 0.04MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/preview.png9.06KB3.56KB▼ 60.69%
images/activate.png2.79KB1.53KB▼ 44.97%
images/new_star.png4.65KB1.93KB▼ 58.47%
images/xyz_logo.png9.26KB3.02KB▼ 67.36%
images/pause.png6.80KB4.51KB▼ 33.71%