78% posts-api-wp

Code Review | Posts API WP

WordPress plugin Posts API WP scored78%from 54 tests.

About plugin

  • Plugin page: posts-api-wp
  • Plugin version: 1.0.2
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-6.0.2
  • WordPress version: 6.3.1
  • First release: Sep 16, 2022
  • Latest release: Sep 21, 2022
  • Number of updates: 8
  • Update frequency: every 0.9 days
  • Top authors: octagonsimon (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /512 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
This plugin's installer ran successfully

Server metrics [RAM: ▲0.08MB] [CPU: ▼6.54ms] Passed 4 tests

Server-side resources used by Posts API WP
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.54 ▲0.0837.69 ▼7.79
Dashboard /wp-admin3.38 ▲0.0743.59 ▼11.88
Posts /wp-admin/edit.php3.49 ▲0.1344.65 ▼0.92
Add New Post /wp-admin/post-new.php5.98 ▲0.0998.11 ▼5.55
Media Library /wp-admin/upload.php3.30 ▲0.0737.51 ▲5.90
Configure API /wp-admin/admin.php?page=posts-api-wp-config-api3.3429.56
How To Use /wp-admin/admin.php?page=posts-api-wp-how-to-use3.2731.42
Posts API WP /wp-admin/admin.php?page=posts-api-wp3.2630.80

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

Filesystem and database footprint
There were no storage issued detected upon installing this plugin
Filesystem: 32 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-posts
db_upgraded
widget_theysaidso_widget
can_compress_scripts
theysaidso_admin_options
widget_recent-comments

Browser metrics Passed 4 tests

A check of browser resources used by Posts API WP
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,939 ▲18213.61 ▼0.795.01 ▲3.0337.72 ▼4.93
Dashboard /wp-admin2,240 ▲524.86 ▼1.01102.31 ▼8.6270.84 ▲24.18
Posts /wp-admin/edit.php2,117 ▲282.02 ▼0.0139.72 ▲3.5836.67 ▲2.30
Add New Post /wp-admin/post-new.php1,704 ▲17024.70 ▲1.55694.96 ▲26.8269.70 ▲18.86
Media Library /wp-admin/upload.php1,413 ▲254.25 ▼0.14101.33 ▼1.9173.87 ▲27.39
Configure API /wp-admin/admin.php?page=posts-api-wp-config-api1,3112.0428.8149.53
How To Use /wp-admin/admin.php?page=posts-api-wp-how-to-use8362.0329.0835.95
Posts API WP /wp-admin/admin.php?page=posts-api-wp9462.0227.1544.81

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
  • Zombie WordPress options were found after uninstall: 6 options
    • db_upgraded
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-comments
    • widget_theysaidso_widget
    • widget_recent-posts

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though no errors were found, this is by no means an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Please take a closer look at the following
  • 3× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/posts-api-wp/public/partials/posts-api-wp-public-display.php
    • > /wp-content/plugins/posts-api-wp/admin/pages/footer.php
    • > /wp-content/plugins/posts-api-wp/admin/partials/posts-api-wp-admin-display.php
  • 1× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/posts-api-wp/templates/template-get-posts.php:30

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
There were no browser issues found

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
4 plugin tags: posts, api, wp-posts, endpoint

posts-api-wp/posts-api-wp.php 92% from 13 tests

The main file in "Posts API WP" v. 1.0.2 serves as a complement to information provided in readme.txt and as the entry point to the plugin
The following require your attention:
  • Description: Keep the plugin description shorter than 140 characters (currently 203 characters long)

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 plugin1,124 lines of code in 23 files:
LanguageFilesBlank linesComment linesLines of code
PHP17176641757
CSS2438234
JavaScript2117470
HTML20063

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
Great job! No cyclomatic complexity issues were detected in this plugin
Cyclomatic complexity
Average complexity per logical line of code0.53
Average class complexity2.12
▷ Minimum class complexity1.00
▷ Maximum class complexity5.00
Average method complexity1.28
▷ Minimum method complexity1.00
▷ Maximum method complexity4.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes8
▷ Abstract classes00.00%
▷ Concrete classes8100.00%
▷ Final classes00.00%
Methods32
▷ Static methods26.25%
▷ Public methods2784.38%
▷ Protected methods00.00%
▷ Private methods515.62%
Functions10
▷ Named functions880.00%
▷ Anonymous functions220.00%
Constants2
▷ Global constants2100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
3 PNG files occupy 0.01MB with 0.00MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/img/logo-menu.png0.71KB1.07KB0.00%
admin/img/logo-main.png5.08KB2.95KB▼ 41.99%
admin/img/exclamation-triangle.png6.17KB2.76KB▼ 55.37%