10% ajax-weather

Code Review | Ajax Weather

WordPress plugin Ajax Weather scored10%from 54 tests.

About plugin

  • Plugin page: ajax-weather
  • Plugin version: 1.6
  • PHP version: 7.4.16
  • WordPress compatibility: 3.3.1-3.4.1
  • WordPress version: 6.3.1
  • First release: Jan 30, 2012
  • Latest release: Jul 7, 2012
  • Number of updates: 59
  • Update frequency: every 2.7 days
  • Top authors: softbed (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /7,446 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The following installer errors require your attention
  • Install procedure validation failed for this plugin
    • > Deprecated in wp-content/plugins/ajax-weather/ajax_weather_widget.php+33
    Methods with the same name as their class will not be constructors in a future version of PHP; Ajax_Weather_Widget has a deprecated constructor

Server metrics [RAM: ▼1.92MB] [CPU: ▼61.16ms] Passed 4 tests

Server-side resources used by Ajax Weather
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /2.08 ▼1.385.43 ▼38.31
Dashboard /wp-admin2.10 ▼1.255.18 ▼57.85
Posts /wp-admin/edit.php2.10 ▼1.267.42 ▼46.13
Add New Post /wp-admin/post-new.php2.10 ▼3.795.31 ▼102.34
Media Library /wp-admin/upload.php2.10 ▼1.135.39 ▼29.26

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

Input-output and database impact of this plugin
This plugin was installed successfully
Filesystem: 11 new files
Database: no new tables, 7 new options
New WordPress options
widget_ajax-weather-widget
widget_recent-comments
db_upgraded
widget_theysaidso_widget
theysaidso_admin_options
widget_recent-posts
can_compress_scripts

Browser metrics Passed 4 tests

This is an overview of browser requirements for Ajax Weather
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲314.25 ▼0.101.71 ▼0.1745.19 ▲3.85
Dashboard /wp-admin2,195 ▲185.50 ▼0.1786.40 ▼10.2439.96 ▼0.46
Posts /wp-admin/edit.php2,100 ▼01.97 ▲0.0239.53 ▲0.7137.28 ▲0.83
Add New Post /wp-admin/post-new.php1,526 ▼1123.17 ▲5.00653.47 ▲1.6749.27 ▼33.56
Media Library /wp-admin/upload.php1,397 ▼04.38 ▲0.2297.69 ▼12.1744.94 ▼0.60

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
It is recommended to fix the following
  • This plugin did not uninstall without warnings or errors
    • > Deprecated in wp-content/plugins/ajax-weather/ajax_weather_widget.php+33
    Methods with the same name as their class will not be constructors in a future version of PHP; Ajax_Weather_Widget has a deprecated constructor
  • This plugin did not uninstall successfully, leaving 7 options in the database
    • db_upgraded
    • widget_recent-comments
    • can_compress_scripts
    • widget_theysaidso_widget
    • widget_ajax-weather-widget
    • widget_recent-posts
    • theysaidso_admin_options

Smoke tests 50% 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)
The smoke test was a success, however most plugin functionality was not tested

SRP 0% 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× PHP files output text when accessed directly:
    • > /wp-content/plugins/ajax-weather/service.weather_v1.php
  • 34× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/ajax-weather/logic.weather_bar.php on line 74
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/ajax-weather/class.Weather.php on line 177
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/ajax-weather/class.Weather.php on line 161
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/ajax-weather/logic.weather_bar.php on line 79
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/ajax-weather/class.Weather.php on line 153
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/ajax-weather/class.Weather.php on line 161
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/ajax-weather/class.Weather.php on line 157
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/ajax-weather/class.Weather.php on line 165
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/ajax-weather/class.Weather.php on line 185
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/ajax-weather/class.Weather.php on line 165

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser errors were detected

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 88% 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
Please fix the following attributes:
  • Screenshots: Screenshot #1 (image file name must conform to the format of screenshot-1.jpg) image not found
  • Donate link: Please fix this invalid URI: ""
The official readme.txt might help

ajax-weather/ajax_weather_widget.php 92% from 13 tests

The entry point to "Ajax Weather" version 1.6 is a PHP file that has certain tags in its header comment area
Please take the time to fix the following:
  • Main file name: Name the main plugin file the same as the plugin slug ("ajax-weather.php" instead of "ajax_weather_widget.php")

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,141 lines of code in 8 files:
LanguageFilesBlank linesComment linesLines of code
PHP5119126845
JavaScript31922296

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.23
Average class complexity3.53
▷ Minimum class complexity1.00
▷ Maximum class complexity15.00
Average method complexity2.07
▷ Minimum method complexity1.00
▷ Maximum method complexity7.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes38
▷ Abstract classes37.89%
▷ Concrete classes3592.11%
▷ Final classes00.00%
Methods90
▷ Static methods11.11%
▷ Public methods8594.44%
▷ Protected methods44.44%
▷ Private methods11.11%
Functions1
▷ Named functions1100.00%
▷ Anonymous functions00.00%
Constants6
▷ Global constants583.33%
▷ Class constants116.67%
▷ Public constants1100.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
There were not PNG files found in your plugin