62% contextual-advertisement

Code Review | Contextual Advertisement Plugin

WordPress plugin Contextual Advertisement Plugin scored62%from 54 tests.

About plugin

  • Plugin page: contextual-advert...
  • Plugin version: 1.2.6
  • PHP compatiblity: 5.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.4-5.1.1
  • WordPress version: 6.3.1
  • First release: May 31, 2019
  • Latest release: May 31, 2019
  • Number of updates: 2
  • Update frequency: every 1.5 days
  • Top authors: mc2pl (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /573 total downloads

Benchmarks

Plugin footprint 65% 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 gracefully, with no errors

Server metrics [RAM: ▲0.04MB] [CPU: ▼9.86ms] Passed 4 tests

Analyzing server-side resources used by Contextual Advertisement Plugin
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.51 ▲0.0542.97 ▲3.07
Dashboard /wp-admin3.35 ▲0.0149.35 ▼13.12
Posts /wp-admin/edit.php3.46 ▲0.1143.11 ▼10.47
Add New Post /wp-admin/post-new.php5.93 ▲0.0583.26 ▼18.93
Media Library /wp-admin/upload.php3.27 ▲0.0536.62 ▲4.80
Ustawienia /wp-admin/admin.php?page=my-submenu-ustawienia3.29230.64
Statystyki /wp-admin/admin.php?page=my-submenu-statystyki3.29221.27
Zaawansowane /wp-admin/admin.php?page=my-submenu-zaawansowane3.28218.96

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

How much does this plugin use your filesystem and database?
No storage issues were detected
Filesystem: 107 new files
Database: 3 new tables, 6 new options
New tables
context360_credentials
context360_placements
context360_websites
New WordPress options
widget_theysaidso_widget
widget_recent-posts
can_compress_scripts
theysaidso_admin_options
db_upgraded
widget_recent-comments

Browser metrics Passed 4 tests

An overview of browser requirements for Contextual Advertisement Plugin
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,829 ▲8313.29 ▼1.085.86 ▲4.1846.25 ▲2.11
Dashboard /wp-admin2,235 ▲435.86 ▲0.94109.39 ▲1.7640.34 ▼6.10
Posts /wp-admin/edit.php2,118 ▲261.99 ▼0.0534.52 ▼7.3132.55 ▼6.34
Add New Post /wp-admin/post-new.php1,538 ▲2417.75 ▲0.22615.46 ▼4.6350.71 ▲3.64
Media Library /wp-admin/upload.php1,417 ▲264.21 ▲0.0497.82 ▼0.2441.16 ▼3.83
Ustawienia /wp-admin/admin.php?page=my-submenu-ustawienia1,00213.02147.6965.20
Statystyki /wp-admin/admin.php?page=my-submenu-statystyki8262.3530.6726.40
Zaawansowane /wp-admin/admin.php?page=my-submenu-zaawansowane8092.1926.0828.27

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
You still need to fix the following
  • Zombie tables detected upon uninstall: 3 tables
    • context360_websites
    • context360_credentials
    • context360_placements
  • Zombie WordPress options were found after uninstall: 6 options
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-comments
    • db_upgraded
    • widget_theysaidso_widget
    • widget_recent-posts

Smoke tests 25% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 0% 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 items
  • 4× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/contextual-advertisement/views/partial/statistics/chart.php
    • > /wp-content/plugins/contextual-advertisement/views/partial/settings/notice.php
    • > /wp-content/plugins/contextual-advertisement/views/partial/footer.php
    • > /wp-content/plugins/contextual-advertisement/views/partial/header.php
  • 44× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Interface 'Context360\\Model\\WasSuccessfulInterface' not found in wp-content/plugins/contextual-advertisement/src/Model/Statistics/StatisticsList.php:7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function is_admin() in wp-content/plugins/contextual-advertisement/views/permission.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'Context360\\Controller\\AbstractRestController' not found in wp-content/plugins/contextual-advertisement/src/Controller/Rest/PlacementLocationsRestController.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'Context360\\Model\\AbstractValidatableModel' not found in wp-content/plugins/contextual-advertisement/src/Model/Registration/OAuth2Request.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'Context360\\Controller\\AbstractRestController' not found in wp-content/plugins/contextual-advertisement/src/Controller/Rest/RegistrationRestController.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'Context360\\Controller\\AbstractViewController' not found in wp-content/plugins/contextual-advertisement/src/Controller/View/StatisticsViewController.php:15
    • > PHP Fatal error
      Uncaught Error: Class 'Context360\\Service\\AuthorizedApiClient' not found in wp-content/plugins/contextual-advertisement/src/Service/Statistics/StatisticsApiClient.php:12
    • > PHP Fatal error
      Uncaught Error: Interface 'Context360\\Assets\\AssetLoaderInterface' not found in wp-content/plugins/contextual-advertisement/src/Assets/Loaders/AdminAssetsLoader.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'Context360\\Service\\AuthorizedApiClient' not found in wp-content/plugins/contextual-advertisement/src/Service/Placements/PlacementsApiClient.php:12
    • > PHP Fatal error
      Uncaught Error: Call to a member function set() on null in wp-content/plugins/contextual-advertisement/config/config.php:6

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Please fix the following browser errors
    • > GET request to /wp-admin/admin.php?page=my-submenu-statystyki
    • > Javascript (severe) in unknown
    /wp-content/plugins/contextual-advertisement/assets/js/Chart.min.js?ver=1.2.6 6:76630 Uncaught TypeError: Cannot read properties of null (reading 'length')

Optimizations

Plugin configuration 86% from 29 tests

readme.txt 94% 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 require attention:
  • Screenshots: Add images for these screenshots: #1 (This screen shot description corresponds registration), #2 (This screen shot description corresponds placements)
You can take inspiration from this readme.txt

contextual-advertisement/context360.php 77% from 13 tests

The main PHP script in "Contextual Advertisement Plugin" version 1.2.6 is automatically included on every request by WordPress
You should first fix the following items:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("contextual-advertisement.php" instead of "context360.php")
  • Domain Path: The domain path is invalid: folder "/languages" does not exist
  • Text Domain: The text domain is optional since WordPress version 4.6; if you do specify it, it must be the same as the plugin slug

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 plugin3,550 lines of code in 103 files:
LanguageFilesBlank linesComment linesLines of code
PHP968481,0333,067
JavaScript65573269
CSS16032214

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.16
Average class complexity2.36
▷ Minimum class complexity1.00
▷ Maximum class complexity10.00
Average method complexity1.45
▷ Minimum method complexity1.00
▷ Maximum method complexity8.00
Code structure
Namespaces28
Interfaces4
Traits0
Classes76
▷ Abstract classes45.26%
▷ Concrete classes7294.74%
▷ Final classes00.00%
Methods242
▷ Static methods72.89%
▷ Public methods21086.78%
▷ Protected methods2911.98%
▷ Private methods31.24%
Functions50
▷ Named functions24.00%
▷ Anonymous functions4896.00%
Constants28
▷ Global constants00.00%
▷ Class constants28100.00%
▷ Public constants28100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
3 PNG files occupy 0.23MB with 0.14MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/placements.png83.26KB32.91KB▼ 60.48%
assets/images/statistics.png80.25KB31.23KB▼ 61.09%
assets/images/registration.png70.69KB29.07KB▼ 58.88%