10% oplao-weather-professional-weather-widget

Code Review | Oplao Weather Widget

WordPress plugin Oplao Weather Widget scored10%from 54 tests.

About plugin

  • Plugin page: oplao-weather-pro...
  • Plugin version: 1.1.6
  • PHP version: 7.4.16
  • WordPress compatibility: 3.5-4.7.2
  • WordPress version: 6.3.1
  • First release: Feb 7, 2017
  • Latest release: Feb 8, 2017
  • Number of updates: 22
  • Update frequency: every 0.4 days
  • Top authors: oplao (100%)

Code review

54 tests

User reviews

1 review

Install metrics

60+ active /3,180 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 cannot be installed
    • > Deprecated in wp-content/plugins/oplao-weather-professional-weather-widget/widget.php+4
    Methods with the same name as their class will not be constructors in a future version of PHP; OplaoWeatherWidget has a deprecated constructor

Server metrics [RAM: ▼1.66MB] [CPU: ▼49.61ms] Passed 4 tests

This is a short check of server-side resources used by Oplao Weather Widget
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /2.33 ▼1.136.25 ▼35.41
Dashboard /wp-admin2.35 ▼0.967.85 ▼42.79
Posts /wp-admin/edit.php2.35 ▼1.017.20 ▼38.87
Add New Post /wp-admin/post-new.php2.35 ▼3.547.97 ▼81.35
Media Library /wp-admin/upload.php2.35 ▼0.886.48 ▼27.15
Oplao Weather /wp-admin/options-general.php?page=oplao-weather2.356.42

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

A short overview of filesystem and database impact
The plugin installed successfully
Filesystem: 167 new files
Database: no new tables, 7 new options
New WordPress options
can_compress_scripts
widget_oplaoweatherwidget
theysaidso_admin_options
widget_recent-posts
widget_theysaidso_widget
widget_recent-comments
db_upgraded

Browser metrics Passed 4 tests

This is an overview of browser requirements for Oplao Weather Widget
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,840 ▲10513.24 ▼1.144.85 ▲3.1942.52 ▼1.99
Dashboard /wp-admin2,210 ▲225.88 ▲1.02102.47 ▼5.3040.47 ▼6.49
Posts /wp-admin/edit.php2,093 ▲12.02 ▲0.0533.88 ▼5.5235.13 ▼1.27
Add New Post /wp-admin/post-new.php1,534 ▲1423.15 ▲0.17660.18 ▼18.3954.47 ▼15.03
Media Library /wp-admin/upload.php1,392 ▲14.20 ▼0.0396.19 ▼6.2140.50 ▼6.30
Oplao Weather /wp-admin/options-general.php?page=oplao-weather7892.0425.8925.97

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
Please fix the following items
  • The plugin did not uninstall gracefully
    • > Deprecated in wp-content/plugins/oplao-weather-professional-weather-widget/widget.php+4
    Methods with the same name as their class will not be constructors in a future version of PHP; OplaoWeatherWidget has a deprecated constructor
  • The uninstall procedure has failed, leaving 7 options in the database
    • widget_recent-posts
    • widget_recent-comments
    • widget_theysaidso_widget
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_oplaoweatherwidget
    • db_upgraded

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Almost there, just fix the following server-side errors
    • > GET request to /wp-admin/options-general.php?page=oplao-weather
    • > Deprecated in wp-content/plugins/oplao-weather-professional-weather-widget/widget.php+4
    Methods with the same name as their class will not be constructors in a future version of PHP; OplaoWeatherWidget has a deprecated constructor
    • > GET request to /wp-admin/options-general.php?page=oplao-weather
    • > Deprecated in wp-content/plugins/oplao-weather-professional-weather-widget/widget.php+220
    Function create_function() is deprecated

SRP 0% 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
  • 2× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/oplao-weather-professional-weather-widget/inc/Current.php
    • > /wp-content/plugins/oplao-weather-professional-weather-widget/inc/Forcast.php
  • 42× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Notice
      Undefined property: stdClass::$current in wp-content/plugins/oplao-weather-professional-weather-widget/inc/Current.php on line 33
    • > PHP Notice
      Trying to get property 'temp_c' of non-object in wp-content/plugins/oplao-weather-professional-weather-widget/inc/Current.php on line 26
    • > PHP Notice
      Undefined property: stdClass::$current in wp-content/plugins/oplao-weather-professional-weather-widget/inc/Current.php on line 33
    • > PHP Notice
      Undefined property: stdClass::$current in wp-content/plugins/oplao-weather-professional-weather-widget/inc/Current.php on line 26
    • > PHP Notice
      Trying to get property 'wind_dir' of non-object in wp-content/plugins/oplao-weather-professional-weather-widget/inc/Current.php on line 38
    • > PHP Notice
      Undefined property: stdClass::$current in wp-content/plugins/oplao-weather-professional-weather-widget/inc/Current.php on line 30
    • > PHP Notice
      Undefined property: stdClass::$current in wp-content/plugins/oplao-weather-professional-weather-widget/inc/Current.php on line 36
    • > PHP Notice
      Undefined property: stdClass::$current in wp-content/plugins/oplao-weather-professional-weather-widget/inc/Current.php on line 37
    • > PHP Notice
      Undefined property: stdClass::$current in wp-content/plugins/oplao-weather-professional-weather-widget/inc/Current.php on line 38
    • > PHP Notice
      Trying to get property 'humidity' of non-object in wp-content/plugins/oplao-weather-professional-weather-widget/inc/Current.php on line 39

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine on the user side

Optimizations

Plugin configuration 83% from 29 tests

readme.txt 81% from 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
These attributes need your attention:
  • Screenshots: These screenshots require images: #6 (Basic tall layout), #7 (Basic tall layout), #8 (Basic tall layout)
  • Tags: You are using too many tags: 11 tag instead of maximum 10
  • Plugin Name: Please specify the plugin name on the first line ( === oplao-weather-professional-weather-widget === )
The official readme.txt might help

oplao-weather-professional-weather-widget/oplao-weather.php 85% from 13 tests

"Oplao Weather Widget" version 1.1.6's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
It is important to fix the following:
  • 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
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("oplao-weather-professional-weather-widget.php" instead of "oplao-weather.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
Everything looks great! No dangerous files found in this plugin9,844 lines of code in 16 files:
LanguageFilesBlank linesComment linesLines of code
SVG6007,750
CSS2258151,114
PHP615757979
HTML1001
JavaScript12330

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.36
Average class complexity26.00
▷ Minimum class complexity8.00
▷ Maximum class complexity44.00
Average method complexity6.00
▷ Minimum method complexity1.00
▷ Maximum method complexity28.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes2
▷ Abstract classes00.00%
▷ Concrete classes2100.00%
▷ Final classes00.00%
Methods10
▷ Static methods550.00%
▷ Public methods10100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions16
▷ Named functions16100.00%
▷ Anonymous functions00.00%
Constants3
▷ Global constants00.00%
▷ Class constants3100.00%
▷ Public constants3100.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
131 PNG files occupy 4.86MB with 3.65MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
img/large/326_day_lg.png30.38KB7.80KB▼ 74.33%
img/large/293_night_lg.png31.98KB7.78KB▼ 75.67%
img/large/122_day_lg.png25.61KB6.70KB▼ 73.83%
img/large/356_day_lg.png32.40KB7.83KB▼ 75.82%
img/large/353_night_lg.png28.98KB7.10KB▼ 75.50%