94% add-page-from-template

Code Review | Add Page From Template

WordPress plugin Add Page From Template scored 94% 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: 5.9.2
  • 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,425 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.07MB] [CPU: ▼300.12ms] Passed 4 tests

Server-side resources used by Add Page From Template
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.67 ▲0.1552.93 ▲2.75
Dashboard /wp-admin3.52 ▲0.1038.80 ▼5.69
Posts /wp-admin/edit.php3.74 ▲0.1038.82 ▼6.15
Add New Post /wp-admin/post-new.php6.98 ▲0.00106.25 ▼1,191.37
Media Library /wp-admin/upload.php3.39 ▲0.0964.03 ▲38.22
Add Page From Template /wp-admin/options-general.php?page=apft-setting-admin3.3625.35

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

Filesystem and database footprint
The plugin installed successfully
Filesystem: 20 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

Checking browser requirements for Add Page From Template
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,788 ▲4315.83 ▲0.486.39 ▲0.402.11 ▼0.63
Dashboard /wp-admin2,890 ▲296.06 ▼0.11147.44 ▲8.86169.32 ▼2.49
Posts /wp-admin/edit.php2,690 ▲53.24 ▲0.0163.07 ▼5.32218.49 ▲65.61
Add New Post /wp-admin/post-new.php1,714 ▲2420.89 ▲0.31510.83 ▲62.72166.39 ▲7.73
Media Library /wp-admin/upload.php1,703 ▲25.52 ▼0.01158.50 ▲16.51209.80 ▲9.29
Add Page From Template /wp-admin/options-general.php?page=apft-setting-admin1,0732.3857.51127.55

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] Passed 4 tests

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
Uninstaller ran successfully

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Even though everything seems fine, this is not an exhaustive test

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
Please fix the following items
  • 8× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > 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: Call to undefined function add_action() in wp-content/plugins/add-page-from-template/includes/functions.php:11
    • > 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 'AP_Enum' not found in wp-content/plugins/add-page-from-template/includes/class-templatestatus.php:9
    • > 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 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 a shallow check for browser errors
No browser issues were found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 88% from 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
These attributes need your attention:
  • Screenshots: These screenshots have no corresponding images in /assets: #1 (Virtual page would be made.), #2 (Just make a page-foobar.php at your themes/pages directory.)
  • Plugin Name: You should set 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

"Add Page From Template" version 0.4.4.1's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
41 characters long description:
Creates virtural page from template file.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
There were no executable 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

A brief analysis of cyclomatic complexity and code structure for this plugin
No complexity issues detected
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

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
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%