84% wikipedia-preview

Code Review | Wikipedia Preview

WordPress plugin Wikipedia Preview scored84%from 54 tests.

About plugin

  • Plugin page: wikipedia-preview
  • Plugin version: 1.11.0
  • PHP compatiblity: 5.6.39+
  • PHP version: 7.4.16
  • WordPress compatibility: 6.1-6.3
  • WordPress version: 6.3.1
  • First release: May 25, 2021
  • Latest release: Jul 28, 2023
  • Number of updates: 74
  • Update frequency: every 10.8 days
  • Top authors: wikimediafoundation (100%)

Code review

54 tests

User reviews

28 reviews

Install metrics

600+ active /8,862 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
Install script ran successfully

Server metrics [RAM: ▲0.06MB] [CPU: ▼4.48ms] Passed 4 tests

Server-side resources used by Wikipedia Preview
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.53 ▲0.0743.43 ▼3.17
Dashboard /wp-admin3.37 ▲0.0652.43 ▼5.16
Posts /wp-admin/edit.php3.42 ▲0.0653.67 ▼4.47
Add New Post /wp-admin/post-new.php5.95 ▲0.0693.97 ▼5.10
Media Library /wp-admin/upload.php3.29 ▲0.0640.69 ▲1.49

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

A short overview of filesystem and database impact
No storage issues were detected
Filesystem: 17 new files
Database: no new tables, 7 new options
New WordPress options
wikipediapreview_init_timestamp
db_upgraded
widget_theysaidso_widget
widget_recent-posts
theysaidso_admin_options
can_compress_scripts
widget_recent-comments

Browser metrics Passed 4 tests

Checking browser requirements for Wikipedia Preview
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,859 ▲9813.29 ▼1.3017.55 ▲15.3243.26 ▼6.88
Dashboard /wp-admin2,198 ▲185.63 ▼0.0396.37 ▲5.5642.08 ▼4.74
Posts /wp-admin/edit.php2,100 ▼32.00 ▲0.0536.98 ▼6.8836.62 ▼2.38
Add New Post /wp-admin/post-new.php1,548 ▲2023.57 ▲0.40681.53 ▲32.9052.24 ▼1.53
Media Library /wp-admin/upload.php1,400 ▼04.17 ▼0.0298.62 ▼4.2845.50 ▼3.90

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
You still need to fix the following
  • This plugin does not fully uninstall, leaving 7 options in the database
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • widget_recent-posts
    • wikipediapreview_init_timestamp
    • can_compress_scripts
    • db_upgraded
    • 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
Even though no errors were found, this is by no means an exhaustive test

SRP 50% 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
Please take a closer look at the following
  • 3× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/wikipedia-preview/banner.php:118
    • > PHP Fatal error
      Uncaught Error: Call to undefined function register_activation_hook() in wp-content/plugins/wikipedia-preview/intro.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/wikipedia-preview/wikipediapreview.php:135

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine on the user side

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
5 plugin tags: wiki, facts, popup, card, wikipedia

wikipedia-preview/wikipediapreview.php 92% from 13 tests

"Wikipedia Preview" version 1.11.0's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
The following require your attention:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("wikipedia-preview.php" instead of "wikipediapreview.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
Success! There were no dangerous files found in this plugin857 lines of code in 10 files:
LanguageFilesBlank linesComment linesLines of code
SVG100492
PHP34226313
CSS39048
JavaScript3014

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.16
Average class complexity0.00
▷ Minimum class complexity0.00
▷ Maximum class complexity0.00
Average method complexity0.00
▷ Minimum method complexity0.00
▷ Maximum method complexity0.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes0
▷ Abstract classes00.00%
▷ Concrete classes00.00%
▷ Final classes00.00%
Methods0
▷ Static methods00.00%
▷ Public methods00.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions19
▷ Named functions19100.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
6 PNG files occupy 1.01MB with 0.55MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/Step-3-detailed.png254.58KB108.88KB▼ 57.23%
images/illustration01.png97.34KB34.05KB▼ 65.02%
images/Step-4-detailed.png309.20KB113.63KB▼ 63.25%
images/Step-2-detailed.png202.22KB89.71KB▼ 55.63%
images/wordmark.png1.39KB0.95KB▼ 32.17%