84% add-page-from-template

Code Review | Add Page From Template

WordPress plugin Add Page From Template scored84%from 54 tests.

About plugin

  • Plugin page: add-page-from-tem...
  • Plugin version: 0.4.4.1
  • PHP version: 7.4.16
  • WordPress compatibility: 4.2-4.2
  • WordPress version: 6.3.1
  • First release: Dec 10, 2015
  • Latest release: Feb 16, 2016
  • Number of updates: 28
  • Update frequency: every 3.8 days
  • Top authors: hogetan (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /1,702 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
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.02MB] [CPU: ▼6.49ms] Passed 4 tests

A check of server-side resources used by Add Page From Template
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.48 ▲0.0240.02 ▼0.35
Dashboard /wp-admin3.33 ▲0.0347.42 ▼2.52
Posts /wp-admin/edit.php3.38 ▲0.0343.55 ▼5.71
Add New Post /wp-admin/post-new.php5.91 ▲0.0282.40 ▼17.39
Media Library /wp-admin/upload.php3.25 ▲0.0239.18 ▲4.98
Add Page From Template /wp-admin/options-general.php?page=apft-setting-admin3.2231.05

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

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

Browser metrics Passed 4 tests

An overview of browser requirements for Add Page From Template
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,804 ▲5813.53 ▼0.841.84 ▲0.1143.52 ▼2.89
Dashboard /wp-admin2,210 ▲254.85 ▼1.14102.11 ▲0.1437.65 ▼4.40
Posts /wp-admin/edit.php2,093 ▲42.00 ▲0.0037.80 ▼3.0733.91 ▲0.93
Add New Post /wp-admin/post-new.php1,537 ▼023.11 ▼0.18671.77 ▲38.5756.94 ▲10.22
Media Library /wp-admin/upload.php1,392 ▲104.17 ▲0.0097.11 ▼1.3940.73 ▼3.84
Add Page From Template /wp-admin/options-general.php?page=apft-setting-admin8252.0326.3629.53

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
Please fix the following items
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • widget_recent-comments
    • widget_recent-posts
    • can_compress_scripts
    • db_upgraded
    • theysaidso_admin_options
    • 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
Everything seems fine, however this is by no means an exhaustive test

SRP 50% 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
  • 8× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/add-page-from-template/includes/functions.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'AP_Enum' not found in wp-content/plugins/add-page-from-template/includes/class-templatestatus.php:9
    • > PHP Fatal error
      require_once(): Failed opening required '/tmp/wordpress-tests-lib/includes/functions.php' (include_path='.:/usr/share/php') in wp-content/plugins/add-page-from-template/tests/bootstrap.php on line 12
    • > PHP Fatal error
      Uncaught Error: Class 'WP_UnitTestCase' not found in wp-content/plugins/add-page-from-template/tests/test-sample.php:8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_header() in wp-content/plugins/add-page-from-template/tests/pages/page-hoge.php:9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function register_activation_hook() in wp-content/plugins/add-page-from-template/add-page-from-template.php:18
    • > PHP Warning
      require_once(/tmp/wordpress-tests-lib/includes/functions.php): failed to open stream: No such file or directory in wp-content/plugins/add-page-from-template/tests/bootstrap.php on line 12
    • > PHP Fatal error
      Uncaught Error: Class 'WP_UnitTestCase' not found in wp-content/plugins/add-page-from-template/tests/test-loader.php:9

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 88% from 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
Attributes that need to be fixed:
  • Screenshots: These screenshots require images: #1 (Virtual page would be made.), #2 (Just make a page-foobar.php at your themes/pages directory.)
  • Plugin Name: "Plugin Name" should be replaced with the name of your plugin on the first line ( === add-page-from-template === )
You can look at the official readme.txt

add-page-from-template/add-page-from-template.php Passed 13 tests

The main PHP script in "Add Page From Template" version 0.4.4.1 is automatically included on every request by WordPress
41 characters long description:
Creates virtural page from template file.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
Everything looks great! No dangerous files found in this plugin768 lines of code in 15 files:
LanguageFilesBlank linesComment linesLines of code
PHP12139307618
Bourne Shell121691
PO File1101245
XML10014

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.20
Average class complexity5.44
▷ Minimum class complexity1.00
▷ Maximum class complexity15.00
Average method complexity1.75
▷ Minimum method complexity1.00
▷ Maximum method complexity4.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes9
▷ Abstract classes111.11%
▷ Concrete classes888.89%
▷ Final classes225.00%
Methods53
▷ Static methods1120.75%
▷ Public methods4075.47%
▷ Protected methods00.00%
▷ Private methods1324.53%
Functions8
▷ Named functions225.00%
▷ Anonymous functions675.00%
Constants5
▷ Global constants00.00%
▷ Class constants5100.00%
▷ Public constants5100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
2 PNG files occupy 0.18MB with 0.13MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-2.png41.80KB11.83KB▼ 71.70%
screenshot-1.png139.46KB39.96KB▼ 71.35%