10% chapters

Code Review | Chapters

WordPress plugin Chapters scored10%from 54 tests.

About plugin

  • Plugin page: chapters
  • Plugin version: 2.2
  • PHP version: 7.4.16
  • WordPress compatibility: 3.5-4.0
  • WordPress version: 6.3.1
  • First release: Sep 16, 2013
  • Latest release: Oct 28, 2014
  • Number of updates: 38
  • Update frequency: every 10.7 days
  • Top authors: 3m3 (100%)

Code review

54 tests

User reviews

4 reviews

Install metrics

40+ active /4,075 total downloads

Benchmarks

Plugin footprint 5% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
It is recommended to fix the following installer errors
  • Install procedure validation failed for this plugin
    • > Deprecated in wp-includes/class-wp-hook.php+310
    Non-static method chapitres_database::chapitres_DB_install() should not be called statically

Server metrics [RAM: ▲0.03MB] [CPU: ▼4.79ms] Passed 4 tests

Server-side resources used by Chapters
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.49 ▲0.0339.86 ▼0.28
Dashboard /wp-admin3.33 ▲0.0342.24 ▼5.88
Posts /wp-admin/edit.php3.38 ▲0.0348.27 ▲1.14
Add New Post /wp-admin/post-new.php5.91 ▲0.0381.12 ▼14.13
Media Library /wp-admin/upload.php3.25 ▲0.0333.49 ▲2.33
Chapters /wp-admin/options-general.php?page=chapitres3.2133.42

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

Input-output and database impact of this plugin
No storage issues were detected
Filesystem: 57 new files
Database: 1 new table, 8 new options
New tables
wp_chapitres
New WordPress options
can_compress_scripts
widget_recent-posts
widget_theysaidso_widget
db_upgraded
chapitres_db_version
category_children
widget_recent-comments
theysaidso_admin_options

Browser metrics Passed 4 tests

A check of browser resources used by Chapters
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,806 ▲6013.18 ▼1.244.30 ▲2.3640.31 ▼3.51
Dashboard /wp-admin2,207 ▲185.84 ▼0.0696.77 ▼9.3136.75 ▼8.33
Posts /wp-admin/edit.php2,093 ▲42.03 ▼0.0140.10 ▲0.1234.29 ▼3.70
Add New Post /wp-admin/post-new.php1,536 ▲2223.72 ▲6.14664.67 ▲65.7957.12 ▲7.78
Media Library /wp-admin/upload.php1,392 ▲44.20 ▲0.0098.56 ▼0.4541.78 ▼1.40
Chapters /wp-admin/options-general.php?page=chapitres7,1252.3446.36179.27

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
Please fix the following items
  • This plugin cannot be uninstalled
    • > Deprecated in wp-includes/class-wp-hook.php+310
    Non-static method chapitres_database::chapitres_DB_desinstall() should not be called statically
  • This plugin has failed uninstalling correctly, leaving 57 files (0.39MB) in the plugin directory
    • (new file) classes/chapitres_customize.php
    • (new file) images/icone_chapitres_grand.png
    • (new file) classes/chapitres_menu_admin.php
    • (new file) chapitres.php
    • (new file) images/icone_chapitres_petit.png
    • (new file) images/icone_livres_grand.png
    • (new file) classes/wp_walker_nav_menu_checklist.php
    • (new file) images/fleche_bas.png
    • (new file) classes/chapitres_database.php
    • (new file) classes/chapitres_display.php
    • ...
  • Zombie tables detected upon uninstall: 1 table
    • wp_chapitres
  • The uninstall procedure has failed, leaving 8 options in the database
    • widget_theysaidso_widget
    • can_compress_scripts
    • db_upgraded
    • widget_recent-comments
    • recovery_mode_email_last_sent
    • widget_recent-posts
    • theysaidso_admin_options
    • category_children

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
These server-side errors were triggered
    • > GET request to /wp-admin/options-general.php?page=chapitres
    • > User deprecated in wp-includes/functions.php+5463
    Function screen_icon is deprecated since version 3.8.0 with no alternative available.
    • > GET request to /wp-admin/options-general.php?page=chapitres
    • > User deprecated in wp-includes/functions.php+5463
    Function get_screen_icon is deprecated since version 3.8.0 with no alternative available.
    • > GET request to /wp-admin/options-general.php?page=chapitres
    • > Notice in wp-content/plugins/chapters/classes/chapitres_display.php+115
    Undefined variable: tab_contenus
    • > GET request to /wp-admin/options-general.php?page=chapitres
    • > Notice in wp-content/plugins/chapters/classes/chapitres_display.php+149
    Undefined variable: fin_formulaire
    • > GET request to /wp-admin/options-general.php?page=chapitres
    • > Notice in wp-content/plugins/chapters/classes/chapitres_display.php+460
    Undefined variable: contenu_metabox

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Please fix the following
  • 3× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Class 'Walker_Nav_Menu' not found in wp-content/plugins/chapters/classes/wp_walker_nav_menu_checklist.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'Walker_Nav_Menu' not found in wp-content/plugins/chapters/classes/wp_walker_nav_menu_checklist.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'Walker_Nav_Menu' not found in wp-content/plugins/chapters/classes/wp_walker_nav_menu_checklist.php:3

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Please fix the following user-side errors
    • > GET request to /wp-admin/options-general.php?page=chapitres
    • > Network (severe)
    http://fonts.googleapis.com/css?family=Droid+Sans+Thai:bold,normal - Failed to load resource: the server responded with a status of 400 (Bad Request)
    • > GET request to /wp-admin/options-general.php?page=chapitres
    • > Network (severe)
    http://fonts.googleapis.com/css?family=Droid+Serif+Thai:bold,normal - Failed to load resource: the server responded with a status of 400 (Bad Request)
    • > GET request to /wp-admin/options-general.php?page=chapitres
    • > Network (severe)
    http://fonts.googleapis.com/css?family=Miama - Failed to load resource: the server responded with a status of 400 (Bad Request)
    • > GET request to /wp-admin/options-general.php?page=chapitres
    • > Network (severe)
    http://fonts.googleapis.com/css?family=Neuton+Cursive - Failed to load resource: the server responded with a status of 400 (Bad Request)
    • > GET request to /wp-admin/options-general.php?page=chapitres
    • > Network (severe)
    http://fonts.googleapis.com/css?family=Pecita - Failed to load resource: the server responded with a status of 400 (Bad Request)
    • > GET request to /wp-admin/options-general.php?page=chapitres
    • > Console-api (warning) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1 1:28609 "jQuery.Deferred exception: $(...).live is not a function" "TypeError: $(...).live is not a function\n at HTMLDocument.\u003Canonymous> (/wp-content/plugins/chapters/javascript/jquery-chapitres.js?ver=6.3.1:42:33)\n at e (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1:2:26990)\n at t (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1:2:27292)" undefined
    • > GET request to /wp-admin/options-general.php?page=chapitres
    • > Console-api (warning) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1 1:28609 "jQuery.Deferred exception: $(...).live is not a function" "TypeError: $(...).live is not a function\n at HTMLDocument.\u003Canonymous> (/wp-content/plugins/chapters/javascript/chapitres_ajax.js?ver=6.3.1:39:42)\n at e (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1:2:26990)\n at t (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1:2:27292)" undefined
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=chapitres
    • > Javascript (severe) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1 1:28721 Uncaught TypeError: $(...).live is not a function

Optimizations

Plugin configuration 86% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
These attributes need to be fixed:
  • Tags: There are too many tags (15 tag instead of maximum 10)
The official readme.txt is a good inspiration

chapters/chapitres.php 77% from 13 tests

"Chapters" version 2.2's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
It is important to fix the following:
  • Description: Keep the plugin description shorter than 140 characters (currently 588 characters long)
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("chapters.php" instead of "chapitres.php")
  • Text Domain: If you choose to specify the text domain, it must be the same as the plugin slug; optional since WordPress version 4.6

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
Everything looks great! No dangerous files found in this plugin4,182 lines of code in 18 files:
LanguageFilesBlank linesComment linesLines of code
PHP62024221,875
JavaScript3106201994
CSS727100885
PO File2206232428

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.16
Average class complexity38.80
▷ Minimum class complexity14.00
▷ Maximum class complexity59.00
Average method complexity3.65
▷ Minimum method complexity1.00
▷ Maximum method complexity19.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes5
▷ Abstract classes00.00%
▷ Concrete classes5100.00%
▷ Final classes00.00%
Methods72
▷ Static methods00.00%
▷ Public methods6184.72%
▷ Protected methods00.00%
▷ Private methods1115.28%
Functions2
▷ Named functions2100.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
34 PNG files occupy 0.07MB with 0.05MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/icone_livres_petit.png1.76KB0.97KB▼ 44.93%
images/liststyletypes/lower-greek.png1.22KB0.35KB▼ 71.09%
images/liststyletypes/lower-alpha.png1.15KB0.27KB▼ 76.93%
images/liststyletypes/armenian.png1.16KB0.35KB▼ 69.43%
images/liststyletypes/upper-roman.png2.87KB0.23KB▼ 92.06%