10% weixin-robot

Code Review | 微信机器人高级版

WordPress plugin 微信机器人高级版 scored10%from 54 tests.

About plugin

  • Plugin page: weixin-robot
  • Plugin version: 4.6.8
  • PHP version: 7.4.16
  • WordPress compatibility: 3.6-4.7.2
  • WordPress version: 6.3.1
  • First release: Jan 28, 2013
  • Latest release: May 6, 2017
  • Number of updates: 47
  • Update frequency: every 33.3 days
  • Top authors: denishua (55.32%)imhui (46.81%)

Code review

54 tests

User reviews

2 reviews

Install metrics

10+ active /21,768 total downloads

Benchmarks

Plugin footprint 58% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
You still need to fix the following installer errors
  • The plugin did not install without errors
    • > Error in wp-content/plugins/weixin-robot/api/api.php+50
    Uncaught Error: Call to undefined function wpjam_get_setting() in wp-content/plugins/weixin-robot/api/api.php:50
    Stack trace:
    #0 wp-content/plugins/weixin-robot/api/api.php(67): weixin_robot_get_setting()
    #1 wp-content/plugins/weixin-robot/weixin-robot-advanced.php(28): include('/var/www/wordpr...')
    #2 wp-admin/includes/plugin.php(2318): include_once('/var/www/wordpr...')
    #3 wp-admin/includes/plugin.php(663): plugin_sandbox_scrape()

Server metrics [RAM: ▼0.01MB] [CPU: ▼9.22ms] Passed 4 tests

Analyzing server-side resources used by 微信机器人高级版
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0040.00 ▼3.12
Dashboard /wp-admin3.31 ▼0.0455.11 ▼6.19
Posts /wp-admin/edit.php3.36 ▲0.0052.47 ▲5.96
Add New Post /wp-admin/post-new.php5.89 ▲0.0089.49 ▼25.30
Media Library /wp-admin/upload.php3.23 ▲0.0035.94 ▼2.26

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

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

Browser metrics Passed 4 tests

This is an overview of browser requirements for 微信机器人高级版
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,814 ▲6814.38 ▲0.181.89 ▲0.1645.08 ▲3.86
Dashboard /wp-admin2,195 ▲215.63 ▼0.0492.17 ▲8.2341.26 ▼2.84
Posts /wp-admin/edit.php2,100 ▼01.96 ▼0.0337.33 ▼0.1636.81 ▲1.44
Add New Post /wp-admin/post-new.php1,526 ▼023.17 ▲0.04676.38 ▼9.4154.26 ▲3.81
Media Library /wp-admin/upload.php1,397 ▲34.21 ▲0.0596.47 ▼8.5145.81 ▼0.12

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
The following items require your attention
  • Zombie WordPress options detected upon uninstall: 6 options
    • widget_recent-posts
    • widget_recent-comments
    • db_upgraded
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • can_compress_scripts

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
The smoke test was a success, however most plugin functionality was not tested

SRP 50% 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
  • 118× 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 weixin_robot_get_wx_card_ticket() in wp-content/plugins/weixin-robot/template/json/get_weixin_wx_card_ticket.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/weixin-robot/extends/admin/air-quality.php:3
    • > PHP Warning
      Use of undefined constant WEIXIN_ROBOT_PLUGIN_DIR - assumed 'WEIXIN_ROBOT_PLUGIN_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/weixin-robot/admin/admin.php on line 22
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/weixin-robot/extends/admin/renpin.php:3
    • > PHP Warning
      Use of undefined constant WEIXIN_ROBOT_PLUGIN_DIR - assumed 'WEIXIN_ROBOT_PLUGIN_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/weixin-robot/admin/admin.php on line 26
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/weixin-robot/extends/admin/advanced-share.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/weixin-robot/api/api.php:54
    • > PHP Fatal error
      Uncaught Error: Call to undefined function current_time() in wp-content/plugins/weixin-robot/template/json/stats/get_weixin_message_stats.php:2
    • > PHP Warning
      include(WEIXIN_ROBOT_PLUGIN_DIR/template/user/header.php): failed to open stream: No such file or directory in wp-content/plugins/weixin-robot/template/user/profile.php on line 1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/weixin-robot/extends/baidu-map.php:10

User-side errors Passed 1 test

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

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
Attributes that require attention:
  • Screenshots: These screenshots lack descriptions #1, #2, #3 in weixin-robot/assets to your readme.txt
The official readme.txt is a good inspiration

weixin-robot/weixin-robot-advanced.php 85% from 13 tests

The main PHP file in "微信机器人高级版" ver. 4.6.8 adds more information about the plugin and also serves as the entry point for this plugin
The following require your attention:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("weixin-robot.php" instead of "weixin-robot-advanced.php")
  • Description: If Twitter did it, so should we! Keep the description under 140 characters (currently 218 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
There were no executable files found in this plugin11,187 lines of code in 83 files:
LanguageFilesBlank linesComment linesLines of code
PHP782,66089110,379
JavaScript38830722
CSS23086

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.41
Average class complexity21.67
▷ Minimum class complexity3.00
▷ Maximum class complexity44.00
Average method complexity2.63
▷ Minimum method complexity1.00
▷ Maximum method complexity17.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes3
▷ Abstract classes00.00%
▷ Concrete classes3100.00%
▷ Final classes00.00%
Methods38
▷ Static methods00.00%
▷ Public methods3284.21%
▷ Protected methods00.00%
▷ Private methods615.79%
Functions378
▷ Named functions378100.00%
▷ Anonymous functions00.00%
Constants11
▷ Global constants11100.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
70 compressed PNG files occupy 0.08MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
template/static/emotions/12.png1.30KB1.30KB0.08%
template/static/emotions/25.png1.24KB1.30KB0.00%
template/static/emotions/65.png0.80KB0.84KB0.00%
template/static/emotions/54.png1.14KB1.13KB▼ 1.28%
template/static/emotions/63.png0.56KB0.50KB▼ 10.66%