84% page-templates-for-posts

Code Review | Page Templates for Posts

WordPress plugin Page Templates for Posts scored84%from 54 tests.

About plugin

  • Plugin page: page-templates-fo...
  • Plugin version: 1.0
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-3.5
  • WordPress version: 6.3.1
  • First release: Dec 15, 2012
  • Latest release: Dec 15, 2012
  • Number of updates: 2
  • Update frequency: N/A
  • Top authors: Gagan Goraya (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

50+ active /2,355 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.69MB] [CPU: ▼19.00ms] Passed 4 tests

This is a short check of server-side resources used by Page Templates for Posts
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0139.14 ▼6.77
Dashboard /wp-admin3.31 ▲0.0149.58 ▼2.35
Posts /wp-admin/edit.php3.36 ▲0.0046.49 ▼4.39
Add New Post /wp-admin/post-new.php3.09 ▼2.7934.35 ▼62.50
Media Library /wp-admin/upload.php3.23 ▲0.0036.94 ▼0.11

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

Filesystem and database footprint
This plugin installed successfully
Filesystem: 3 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-posts
can_compress_scripts
db_upgraded
widget_recent-comments
theysaidso_admin_options
widget_theysaidso_widget

Browser metrics Passed 4 tests

An overview of browser requirements for Page Templates for Posts
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲6514.48 ▼0.131.79 ▼0.1142.70 ▲3.56
Dashboard /wp-admin2,209 ▲244.87 ▼1.18106.53 ▼1.6943.24 ▼0.33
Posts /wp-admin/edit.php2,086 ▼62.05 ▲0.0538.40 ▼2.0332.84 ▼2.50
Add New Post /wp-admin/post-new.php6,223 ▲4,69018.84 ▼4.37888.90 ▲215.0959.86 ▲3.29
Media Library /wp-admin/upload.php1,382 ▼94.20 ▲0.01101.16 ▲4.1942.28 ▼1.34

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
You still need to fix the following
  • This plugin does not fully uninstall, leaving 6 options in the database
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • can_compress_scripts
    • widget_recent-comments
    • db_upgraded
    • widget_recent-posts

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
Good news, no errors were detected

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Almost there! Just fix the following items
  • 1× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/page-templates-for-posts/templatesforposts.php:16

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine on the user side

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
These attributes need to be fixed:
  • Screenshots: Please add an image for screenshot #1 (A page templates dropdown is available for each of the posts.)
You can look at the official readme.txt

page-templates-for-posts/templatesforposts.php 92% from 13 tests

The principal PHP file in "Page Templates for Posts" v. 1.0 is loaded by WordPress automatically on each request
You should first fix the following items:
  • Main file name: Name the main plugin file the same as the plugin slug ("page-templates-for-posts.php" instead of "templatesforposts.php")

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
Success! There were no dangerous files found in this plugin57 lines of code in 1 file:
LanguageFilesBlank linesComment linesLines of code
PHP1272357

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.64
Average class complexity0.00
▷ Minimum class complexity0.00
▷ Maximum class complexity0.00
Average method complexity0.00
▷ Minimum method complexity0.00
▷ Maximum method complexity0.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes0
▷ Abstract classes00.00%
▷ Concrete classes00.00%
▷ Final classes00.00%
Methods0
▷ Static methods00.00%
▷ Public methods00.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions5
▷ Named functions5100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.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
screenshot-1.png5.43KB2.98KB▼ 45.18%