62% option-tree

Code Review | OptionTree

WordPress plugin OptionTree scored62%from 54 tests.

About plugin

  • Plugin page: option-tree
  • Plugin version: 2.7.3
  • PHP compatiblity: 5.3.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.8-5.2
  • WordPress version: 6.3.1
  • First release: Oct 19, 2010
  • Latest release: May 19, 2019
  • Number of updates: 126
  • Update frequency: every 26.5 days
  • Top authors: valendesigns (100%)

Code review

54 tests

User reviews

105 reviews

Install metrics

100,000+ active /1,275,837 total downloads

Benchmarks

Plugin footprint 65% 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.43MB] [CPU: ▼26.75ms] Passed 4 tests

A check of server-side resources used by OptionTree
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.63 ▲0.1747.70 ▲9.83
Dashboard /wp-admin4.72 ▲1.3742.58 ▼21.28
Posts /wp-admin/edit.php4.72 ▲1.3638.66 ▼13.38
Add New Post /wp-admin/post-new.php4.72 ▼1.1741.62 ▼74.49
Media Library /wp-admin/upload.php4.72 ▲1.4942.00 ▲2.17
Documentation /wp-admin/admin.php?page=ot-documentation4.7237.93
Theme Options /wp-admin/themes.php?page=ot-theme-options4.7237.10
Settings /wp-admin/admin.php?page=ot-settings4.7240.10

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

A short overview of filesystem and database impact
This plugin was installed successfully
Filesystem: 38 new files
Database: no new tables, 9 new options
New WordPress options
db_upgraded
option_tree_settings
widget_recent-comments
theysaidso_admin_options
widget_recent-posts
option_tree
widget_theysaidso_widget
can_compress_scripts
ot_media_post_ID

Browser metrics Passed 4 tests

An overview of browser requirements for OptionTree
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,824 ▲6314.35 ▼0.031.65 ▼0.3445.14 ▲2.88
Dashboard /wp-admin2,227 ▲505.56 ▼0.0684.90 ▼11.3338.81 ▼12.77
Posts /wp-admin/edit.php2,132 ▲321.96 ▲0.0135.57 ▼4.8033.37 ▼3.19
Add New Post /wp-admin/post-new.php1,628 ▲10224.09 ▲0.95722.11 ▲27.4437.03 ▼29.90
Media Library /wp-admin/upload.php1,432 ▲354.22 ▲0.02108.57 ▼16.1747.68 ▼1.04
Documentation /wp-admin/admin.php?page=ot-documentation2,4454.5579.6563.49
Theme Options /wp-admin/themes.php?page=ot-theme-options1,1264.2262.2632.41
Settings /wp-admin/admin.php?page=ot-settings1,9644.5060.6841.32

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
You still need to fix the following
  • Uninstall procedure had uncaught errors
    • > Notice in wp-content/plugins/option-tree/includes/class-ot-settings.php+395
    Trying to access array offset on value of type bool
  • The uninstall procedure has failed, leaving 9 options in the database
    • option_tree
    • widget_recent-posts
    • option_tree_settings
    • db_upgraded
    • theysaidso_admin_options
    • ot_media_post_ID
    • can_compress_scripts
    • widget_recent-comments
    • widget_theysaidso_widget

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Almost there, just fix the following server-side errors
  • 6 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=ot-settings
    • > Notice in wp-content/plugins/option-tree/includes/class-ot-settings.php+396
    Trying to access array offset on value of type bool

SRP 0% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Please fix the following items
  • 11× PHP files perform the action of outputting non-empty strings when accessed directly (only 10 are shown):
    • > /wp-content/plugins/option-tree/includes/ot-functions-docs-page.php
    • > /wp-content/plugins/option-tree/includes/ot-functions.php
    • > /wp-content/plugins/option-tree/includes/class-ot-settings.php
    • > /wp-content/plugins/option-tree/includes/ot-functions-deprecated.php
    • > /wp-content/plugins/option-tree/includes/ot-functions-settings-page.php
    • > /wp-content/plugins/option-tree/includes/class-ot-post-formats.php
    • > /wp-content/plugins/option-tree/includes/class-ot-meta-box.php
    • > /wp-content/plugins/option-tree/includes/ot-functions-admin.php
    • > /wp-content/plugins/option-tree/includes/ot-functions-compat.php
    • > /wp-content/plugins/option-tree/includes/class-ot-cleanup.php
  • 2× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/option-tree/assets/theme-mode/demo-theme-options.php:8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/option-tree/assets/theme-mode/demo-meta-boxes.php:8

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine on the user side

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
4 plugin tags: meta boxes, theme options, settings, options

option-tree/ot-loader.php 92% from 13 tests

The principal PHP file in "OptionTree" v. 2.7.3 is loaded by WordPress automatically on each request
It is important to fix the following:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("option-tree.php" instead of "ot-loader.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
There were no executable files found in this plugin14,186 lines of code in 22 files:
LanguageFilesBlank linesComment linesLines of code
PHP152,8963,9788,330
CSS2792484,299
JavaScript32031021,114
SVG100379
JSON10064

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.64
Average class complexity63.80
▷ Minimum class complexity9.00
▷ Maximum class complexity153.00
Average method complexity7.00
▷ Minimum method complexity1.00
▷ Maximum method complexity47.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes5
▷ Abstract classes00.00%
▷ Concrete classes5100.00%
▷ Final classes00.00%
Methods53
▷ Static methods00.00%
▷ Public methods4788.68%
▷ Protected methods00.00%
▷ Private methods611.32%
Functions187
▷ Named functions18297.33%
▷ Anonymous functions52.67%
Constants21
▷ Global constants21100.00%
▷ Class constants00.00%
▷ Public constants00.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
10 PNG files occupy 0.03MB with 0.02MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/layout/left-sidebar.png3.90KB2.09KB▼ 46.31%
assets/images/ot-select-hover-rtl.png1.02KB0.14KB▼ 85.91%
assets/images/layout/dual-sidebar.png3.88KB2.09KB▼ 46.20%
assets/images/ot-select-rtl.png1.02KB0.14KB▼ 85.96%
assets/images/ot-select.png1.03KB0.14KB▼ 86.03%