78% custom-page-templates-setup

Code Review | Custom Page Templates Setup

WordPress plugin Custom Page Templates Setup scored78%from 54 tests.

About plugin

  • Plugin page: custom-page-templ...
  • Plugin version: 1.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.4-4.5.2
  • WordPress version: 6.3.1
  • First release: May 10, 2016
  • Latest release: May 20, 2016
  • Number of updates: 13
  • Update frequency: every 0.8 days
  • Top authors: mrbrownbear (100%)

Code review

54 tests

User reviews

1 review

Install metrics

30+ active /2,171 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
Installer ran successfully

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

Analyzing server-side resources used by Custom Page Templates Setup
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.51 ▲0.0441.76 ▼0.40
Dashboard /wp-admin3.35 ▼0.0048.97 ▼15.97
Posts /wp-admin/edit.php3.46 ▲0.1049.85 ▼1.43
Add New Post /wp-admin/post-new.php5.93 ▲0.0488.46 ▼19.35
Media Library /wp-admin/upload.php3.27 ▲0.0442.92 ▲3.17
Custom Templates /wp-admin/themes.php?page=custom-page-templates3.3836.13

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

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

Browser metrics Passed 4 tests

Checking browser requirements for Custom Page Templates Setup
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,793 ▲4714.35 ▲0.451.53 ▼0.6041.51 ▼2.01
Dashboard /wp-admin2,199 ▲225.62 ▼0.0490.64 ▼0.7339.63 ▼1.07
Posts /wp-admin/edit.php2,104 ▲42.02 ▼0.0134.55 ▼2.6430.08 ▼1.99
Add New Post /wp-admin/post-new.php1,529 ▲123.60 ▲0.49691.57 ▲32.2062.23 ▼2.48
Media Library /wp-admin/upload.php1,401 ▲74.34 ▲0.17102.00 ▼1.1047.18 ▲2.78
Custom Templates /wp-admin/themes.php?page=custom-page-templates8731.9923.3852.84

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
These items require your attention
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_recent-comments
    • widget_theysaidso_widget
    • can_compress_scripts
    • db_upgraded
    • theysaidso_admin_options
    • widget_recent-posts

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Please fix the following server-side errors
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/themes.php?page=custom-page-templates
    • > request to
    • > Notice in wp-config.php+20
    Undefined index: REQUEST_METHOD

SRP 50% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
The following issues need your attention
  • 3× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/custom-page-templates-setup/main.php:18
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/custom-page-templates-setup/cpt_options.php:21
    • > PHP Fatal error
      Uncaught Error: Class 'cpt_functions' not found in wp-content/plugins/custom-page-templates-setup/cpt_page_templater.php:28

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
No browser issues were found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
Attributes that require attention: You can take inspiration from this readme.txt

custom-page-templates-setup/main.php 92% from 13 tests

The main file in "Custom Page Templates Setup" v. 1.1 serves as a complement to information provided in readme.txt and as the entry point to the plugin
Please take the time to fix the following:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("custom-page-templates-setup.php" instead of "main.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
No dangerous file extensions were detected642 lines of code in 5 files:
LanguageFilesBlank linesComment linesLines of code
CSS105359
PHP48052283

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.31
Average class complexity8.33
▷ Minimum class complexity5.00
▷ Maximum class complexity14.00
Average method complexity3.00
▷ Minimum method complexity1.00
▷ Maximum method complexity8.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes3
▷ Abstract classes00.00%
▷ Concrete classes3100.00%
▷ Final classes00.00%
Methods11
▷ Static methods218.18%
▷ Public methods1090.91%
▷ Protected methods00.00%
▷ Private methods19.09%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
1 PNG file occupies 0.01MB with 0.00MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
img/logo.png7.51KB4.11KB▼ 45.26%