84% sectors

Code Review | Sectors - Conditional Templates & Hooks

WordPress plugin Sectors - Conditional Templates & Hooks scored84%from 54 tests.

About plugin

  • Plugin page: sectors
  • Plugin version: 1.2
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.8-5.5
  • WordPress version: 6.3.1
  • First release: Feb 5, 2018
  • Latest release: Sep 1, 2020
  • Number of updates: 11
  • Update frequency: every 85.5 days
  • Top authors: intoxstudio (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /935 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

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

Server metrics [RAM: ▲0.67MB] [CPU: ▼3.10ms] Passed 4 tests

A check of server-side resources used by Sectors - Conditional Templates & Hooks
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.98 ▲0.5244.07 ▲4.91
Dashboard /wp-admin4.04 ▲0.6950.27 ▼11.47
Posts /wp-admin/edit.php4.15 ▲0.8049.03 ▲9.27
Add New Post /wp-admin/post-new.php6.62 ▲0.7390.05 ▼13.70
Media Library /wp-admin/upload.php3.96 ▲0.7340.89 ▲7.85
Sectors /wp-admin/admin.php?page=wpsct3.9538.24
Add New /wp-admin/admin.php?page=wpsct-edit4.0546.38

Server storage [IO: ▲0.52MB] [DB: ▲0.07MB] Passed 3 tests

A short overview of filesystem and database impact
This plugin was installed successfully
Filesystem: 77 new files
Database: no new tables, 8 new options
New WordPress options
widget_theysaidso_widget
theysaidso_admin_options
_ca_condition_type_cache
can_compress_scripts
sct_db_version
db_upgraded
widget_recent-comments
widget_recent-posts

Browser metrics Passed 4 tests

This is an overview of browser requirements for Sectors - Conditional Templates & Hooks
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,817 ▲7114.24 ▼0.111.69 ▼0.0963.92 ▲21.21
Dashboard /wp-admin2,217 ▲405.56 ▼0.0284.74 ▼14.5482.08 ▲37.02
Posts /wp-admin/edit.php2,125 ▲251.98 ▼0.0433.51 ▼6.1231.06 ▼5.33
Add New Post /wp-admin/post-new.php1,702 ▲17422.14 ▼0.97741.63 ▲125.0054.46 ▼5.61
Media Library /wp-admin/upload.php1,422 ▲224.16 ▼0.1099.01 ▲2.0184.37 ▲43.43
Sectors /wp-admin/admin.php?page=wpsct1,0412.0124.6327.59
Add New /wp-admin/admin.php?page=wpsct-edit1,5643.3770.7372.60

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
It is recommended to fix the following
  • Zombie WordPress options detected upon uninstall: 8 options
    • theysaidso_admin_options
    • db_upgraded
    • sct_db_version
    • can_compress_scripts
    • widget_recent-posts
    • _ca_condition_type_cache
    • widget_recent-comments
    • widget_theysaidso_widget

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
The smoke test was a success, however most plugin functionality was not tested

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
The following issues need your attention
  • 14× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Notice
      Undefined variable: post in wp-content/plugins/sectors/view/meta_box_template.php on line 13
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/sectors/lib/wp-content-aware-engine/view/group_template.php:22
    • > PHP Notice
      Trying to get property 'post_name' of non-object in wp-content/plugins/sectors/view/meta_box_template.php on line 14
    • > PHP Notice
      Trying to get property 'post_name' of non-object in wp-content/plugins/sectors/view/meta_box_template.php on line 13
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/sectors/lib/wp-content-aware-engine/view/condition_template.php:10
    • > PHP Notice
      Trying to get property 'post_status' of non-object in wp-content/plugins/sectors/view/meta_box_status.php on line 9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/sectors/view/meta_box_submit.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'SCT_App' not found in wp-content/plugins/sectors/view/meta_box_status.php:9
    • > PHP Notice
      Undefined variable: post in wp-content/plugins/sectors/view/meta_box_status.php on line 9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/sectors/view/meta_box_api.php:11

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
No browser errors were detected

Optimizations

Plugin configuration 97% 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:
  • Donate link: Please fix this invalid URI: ""
You can take inspiration from this readme.txt

sectors/sectors.php Passed 13 tests

The principal PHP file in "Sectors - Conditional Templates & Hooks" v. 1.2 is loaded by WordPress automatically on each request
61 characters long description:
Add templates, actions, and filters depending on the context.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
No dangerous file extensions were detected5,752 lines of code in 58 files:
LanguageFilesBlank linesComment linesLines of code
PHP428842,4704,055
CSS3034837
JavaScript989116783
LESS1111039
JSON20036
Markdown1002

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.42
Average class complexity19.69
▷ Minimum class complexity1.00
▷ Maximum class complexity120.00
Average method complexity3.12
▷ Minimum method complexity1.00
▷ Maximum method complexity33.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes29
▷ Abstract classes26.90%
▷ Concrete classes2793.10%
▷ Final classes622.22%
Methods261
▷ Static methods3714.18%
▷ Public methods21080.46%
▷ Protected methods3814.56%
▷ Private methods134.98%
Functions9
▷ Named functions666.67%
▷ Anonymous functions333.33%
Constants26
▷ Global constants311.54%
▷ Class constants2388.46%
▷ Public constants23100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
1 compressed PNG file occupies 0.00MB
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
assets/img/logo.png0.83KB0.98KB0.00%