62% cm-ad-changer

Code Review | CM Ad Changer

WordPress plugin CM Ad Changer scored62%from 54 tests.

About plugin

  • Plugin page: cm-ad-changer
  • Plugin version: 1.9.6
  • PHP version: 7.4.16
  • WordPress compatibility: 5.4.0-6.3
  • WordPress version: 6.3.1
  • First release: Nov 18, 2013
  • Latest release: Jul 23, 2023
  • Number of updates: 251
  • Update frequency: every 14.1 days
  • Top authors: CreativeMindsSolutions (100%)

Code review

54 tests

User reviews

15 reviews

Install metrics

300+ active /39,678 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.80MB] [CPU: ▼2.10ms] 75% from 4 tests

A check of server-side resources used by CM Ad Changer
The following require your attention
  • CPU: The total CPU usage must kept under 500.00ms (currently 1,022.21ms on /wp-admin/admin.php?page=cmac_settings)
PageMemory (MB)CPU Time (ms)
Home /4.24 ▲0.7840.71 ▲1.88
Dashboard /wp-admin4.14 ▲0.8450.10 ▲1.78
Posts /wp-admin/edit.php4.19 ▲0.8447.45 ▲1.93
Add New Post /wp-admin/post-new.php6.68 ▲0.7989.97 ▼14.00
Media Library /wp-admin/upload.php4.00 ▲0.7739.60 ▲5.84
User Guide /wp-admin/admin.php?page=cmac_about4.17402.08
Campaigns /wp-admin/admin.php?page=cmac_campaigns4.2547.51
Settings /wp-admin/admin.php?page=cmac_settings4.411,022.21
Upgrade ➤ /wp-admin/admin.php?page=cmac_pro4.0235.41

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

How much does this plugin use your filesystem and database?
The plugin installed successfully
Filesystem: 146 new files
Database: 2 new tables, 7 new options
New tables
wp_cm_campaigns
wp_cm_campaign_images
New WordPress options
db_upgraded
widget_acwidget
widget_recent-posts
can_compress_scripts
widget_recent-comments
widget_theysaidso_widget
theysaidso_admin_options

Browser metrics Passed 4 tests

An overview of browser requirements for CM Ad Changer
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,843 ▲8214.72 ▲0.461.59 ▼0.1740.81 ▼3.73
Dashboard /wp-admin2,252 ▲715.82 ▲0.1783.73 ▼16.5276.94 ▲29.93
Posts /wp-admin/edit.php2,154 ▲542.28 ▲0.3136.56 ▲1.1034.46 ▲1.37
Add New Post /wp-admin/post-new.php1,574 ▲4823.08 ▼0.13665.92 ▲58.6433.13 ▼22.21
Media Library /wp-admin/upload.php1,457 ▲574.43 ▲0.26104.99 ▼4.0378.03 ▲33.00
User Guide /wp-admin/admin.php?page=cmac_about3,91219.24489.31211.51
Campaigns /wp-admin/admin.php?page=cmac_campaigns1,3182.2649.2584.89
Settings /wp-admin/admin.php?page=cmac_settings2,3407.5379.8465.47
Upgrade ➤ /wp-admin/admin.php?page=cmac_pro1,8082.1339.7247.91

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
It is recommended to fix the following
  • This plugin does not fully uninstall, leaving 2 tables in the database
    • wp_cm_campaign_images
    • wp_cm_campaigns
  • Zombie WordPress options were found after uninstall: 7 options
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • widget_acwidget
    • db_upgraded
    • widget_recent-comments
    • can_compress_scripts
    • widget_recent-posts

Smoke tests 25% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Even though everything seems fine, this is not 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
  • 2× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/cm-ad-changer/backend/views/admin_about.php
    • > /wp-content/plugins/cm-ad-changer/backend/views/admin_pro.php
  • 24× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_bloginfo() in wp-content/plugins/cm-ad-changer/backend/views/admin_campaigns.php:13
    • > PHP Notice
      Undefined variable: submenus in wp-content/plugins/cm-ad-changer/backend/views/admin_nav.php on line 6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/cm-ad-changer/package/cminds-plugin-config.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function ac_top_menu() in wp-content/plugins/cm-ad-changer/backend/views/admin_error.php:4
    • > PHP Fatal error
      Uncaught Error: Cannot access self:: when no class scope is active in wp-content/plugins/cm-ad-changer/backend/views/admin_nav.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/cm-ad-changer/shared/classes/cmac-widget.php:9
    • > PHP Notice
      Trying to get property 'prefix' of non-object in wp-content/plugins/cm-ad-changer/shared/classes/cmac-data.php on line 35
    • > PHP Warning
      Use of undefined constant CMAC_IMAGES_TABLE - assumed 'CMAC_IMAGES_TABLE' (this will throw an Error in a future version of PHP) in wp-content/plugins/cm-ad-changer/shared/classes/cmac-data.php on line 35
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/cm-ad-changer/package/views/plugin_compare_table.php:51
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/cm-ad-changer/package/cminds-plugin-config.php:4

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
These are user-side errors you should fix
    • > GET request to /wp-admin/admin.php?page=cmac_about
    • > Security (warning) in unknown
    security - Error with Permissions-Policy header: Unrecognized feature: 'ambient-light-sensor'.
    • > GET request to /wp-admin/admin.php?page=cmac_about
    • > Security (warning) in unknown
    security - Error with Permissions-Policy header: Unrecognized feature: 'bluetooth'.
    • > GET request to /wp-admin/admin.php?page=cmac_about
    • > Deprecation (warning) in unknown
    https://static.xx.fbcdn.net/rsrc.php/v3/yQ/r/bnRvNSHX7Ev.js?_nc_x=Ij3Wp8lg5Kz 275 Listener added for a synchronous 'DOMSubtreeModified' DOM Mutation Event. This event type is deprecated (https://w3c.github.io/uievents/#legacy-event-types) and work is underway to remove it from this browser. Usage of this event listener will cause performance issues today, and represents a risk of future incompatibility. Consider using MutationObserver instead.
    • > GET request to /wp-admin/admin.php?page=cmac_about
    • > Console-api (severe) in unknown
    https://static.xx.fbcdn.net/rsrc.php/v3/yQ/r/bnRvNSHX7Ev.js?_nc_x=Ij3Wp8lg5Kz 60:573 "ErrorUtils caught an error:\n\nCannot listen to an undefined element. [Caught in: Tried to listen to element of type click]\n\nSubsequent non-fatal errors won't be logged; see https://fburl.com/debugjs."

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 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
5 plugin tags: ad server, ads, advertising network, campaign manager, banner

cm-ad-changer/cm-ad-changer.php Passed 13 tests

The principal PHP file in "CM Ad Changer" v. 1.9.6 is loaded by WordPress automatically on each request
71 characters long description:
Ad Changer. Manage, Track and Report Advertising Campaigns on your site

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
There were no executable files found in this plugin10,962 lines of code in 63 files:
LanguageFilesBlank linesComment linesLines of code
PHP229926986,219
JavaScript351613962,734
CSS6220482,009

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.42
Average class complexity66.00
▷ Minimum class complexity10.00
▷ Maximum class complexity254.00
Average method complexity4.74
▷ Minimum method complexity1.00
▷ Maximum method complexity54.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes8
▷ Abstract classes00.00%
▷ Concrete classes8100.00%
▷ Final classes00.00%
Methods139
▷ Static methods5539.57%
▷ Public methods12388.49%
▷ Protected methods85.76%
▷ Private methods85.76%
Functions12
▷ Named functions12100.00%
▷ Anonymous functions00.00%
Constants52
▷ Global constants4892.31%
▷ Class constants47.69%
▷ Public constants4100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
69 PNG files occupy 0.60MB with 0.24MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
package/views/tooltip.png16.77KB6.28KB▼ 62.54%
package/views/WPmembership.png35.89KB11.14KB▼ 68.95%
backend/assets/css/images/trash.png0.40KB0.40KB0.00%
backend/assets/css/images/close.png0.95KB1.00KB0.00%
package/views/videolessons.png17.52KB5.86KB▼ 66.55%