10% news-cpt

Code Review | News CPT

WordPress plugin News CPT scored10%from 54 tests.

About plugin

  • Plugin page: news-cpt
  • Plugin version: 1.1.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.1-3.9.1
  • WordPress version: 6.3.1
  • First release: May 25, 2013
  • Latest release: May 17, 2014
  • Number of updates: 7
  • Update frequency: every 54.3 days
  • Top authors: vanjwilson (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

100+ active /9,372 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
Please fix the following installer errors
  • The plugin did not install without errors
    • > Deprecated in wp-content/plugins/news-cpt/news-cpt.php+95
    Methods with the same name as their class will not be constructors in a future version of PHP; News_CTP_Widget has a deprecated constructor

Server metrics [RAM: ▼1.84MB] [CPU: ▼52.05ms] Passed 4 tests

This is a short check of server-side resources used by News CPT
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /2.15 ▼1.319.42 ▼36.63
Dashboard /wp-admin2.17 ▼1.145.49 ▼44.50
Posts /wp-admin/edit.php2.17 ▼1.196.87 ▼38.71
Add New Post /wp-admin/post-new.php2.17 ▼3.726.98 ▼88.36
Media Library /wp-admin/upload.php2.17 ▼1.065.52 ▼29.03
News /wp-admin/edit.php?post_type=news2.175.64
Tags /wp-admin/edit-tags.php?taxonomy=post_tag&post_type=news2.177.30
Add News Item /wp-admin/post-new.php?post_type=news2.176.75
Categories /wp-admin/edit-tags.php?taxonomy=category&post_type=news2.176.28

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

Analyzing filesystem and database footprints of this plugin
This plugin was installed successfully
Filesystem: 9 new files
Database: no new tables, 8 new options
New WordPress options
widget_theysaidso_widget
widget_recent-posts
theysaidso_admin_options
widget_recent-comments
widget_news_cpt_widget
db_upgraded
can_compress_scripts
category_children

Browser metrics Passed 4 tests

Checking browser requirements for News CPT
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,837 ▲10213.15 ▼1.151.81 ▼0.0642.72 ▼12.13
Dashboard /wp-admin2,240 ▲525.82 ▼0.05111.69 ▼6.6679.97 ▲32.01
Posts /wp-admin/edit.php2,129 ▲371.98 ▼0.0439.35 ▼1.0336.21 ▲2.09
Add New Post /wp-admin/post-new.php1,552 ▲1923.11 ▼0.07684.72 ▼10.2266.93 ▲14.25
Media Library /wp-admin/upload.php1,416 ▲344.13 ▼0.08101.51 ▼0.4768.44 ▲23.48
News /wp-admin/edit.php?post_type=news1,1391.9432.7429.12
Tags /wp-admin/edit-tags.php?taxonomy=post_tag&post_type=news1,3412.1326.1432.22
Add News Item /wp-admin/post-new.php?post_type=news2,4097.72179.18127.09
Categories /wp-admin/edit-tags.php?taxonomy=category&post_type=news1,4772.1426.4134.02

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
You still need to fix the following
  • The plugin did not uninstall gracefully
    • > Deprecated in wp-content/plugins/news-cpt/news-cpt.php+95
    Methods with the same name as their class will not be constructors in a future version of PHP; News_CTP_Widget has a deprecated constructor
  • Zombie WordPress options detected upon uninstall: 8 options
    • widget_theysaidso_widget
    • widget_recent-comments
    • db_upgraded
    • widget_recent-posts
    • can_compress_scripts
    • widget_news_cpt_widget
    • category_children
    • theysaidso_admin_options

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Smoke test failed, please fix the following
  • 5 occurences, only the last one shown
    • > GET request to /wp-admin/edit-tags.php?taxonomy=category&post_type=news
    • > Deprecated in wp-content/plugins/news-cpt/news-cpt.php+95
    Methods with the same name as their class will not be constructors in a future version of PHP; News_CTP_Widget has a deprecated constructor
  • 5 occurences, only the last one shown
    • > GET request to /wp-admin/edit-tags.php?taxonomy=category&post_type=news
    • > User deprecated in wp-includes/functions.php+5546
    The called constructor method for WP_Widget class in News_CTP_Widget is deprecated since version 4.3.0! Use __construct() instead.

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
  • 3× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/news-cpt/news-cpt.php:36
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_header() in wp-content/plugins/news-cpt/views/archive-news.php:8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_header() in wp-content/plugins/news-cpt/views/single-news.php:8

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
No browser issues were found

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 your attention:
  • Screenshots: These screenshots require images: #1 (The News tab in the admin menu), #2 (The News tab open to the admin list of News items), #3 (Editing an individual News item), #4 (The Recent News CPT Widget)
The official readme.txt is a good inspiration

news-cpt/news-cpt.php 92% from 13 tests

"News CPT" version 1.1.1's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
Please take the time to fix the following:
  • Description: Keep the plugin description shorter than 140 characters (currently 408 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Success! There were no dangerous files found in this plugin336 lines of code in 3 files:
LanguageFilesBlank linesComment linesLines of code
PHP37873336

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.27
Average class complexity7.00
▷ Minimum class complexity7.00
▷ Maximum class complexity7.00
Average method complexity2.50
▷ Minimum method complexity1.00
▷ Maximum method complexity5.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods4
▷ Static methods00.00%
▷ Public methods4100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions7
▷ Named functions7100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
5 PNG files occupy 0.53MB with 0.30MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-4.png166.55KB47.03KB▼ 71.76%
screenshot-2.png94.48KB26.88KB▼ 71.55%
screenshot-1.png117.78KB34.98KB▼ 70.30%
screenshot-3.png167.97KB51.54KB▼ 69.31%
images/newspaper.png0.57KB0.58KB0.00%