84% rest-api-to-miniprogram

Code Review | REST API TO MiniProgram

WordPress plugin REST API TO MiniProgram scored84%from 54 tests.

About plugin

  • Plugin page: rest-api-to-minip...
  • Plugin version: 4.6.8.1
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.7.1-6.3.1
  • WordPress version: 6.3.1
  • First release: Dec 6, 2018
  • Latest release: Sep 11, 2023
  • Number of updates: 101
  • Update frequency: every 17.3 days
  • Top authors: xjb (100%)

Code review

54 tests

User reviews

3 reviews

Install metrics

1,000+ active /36,439 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Install script ran successfully

Server metrics [RAM: ▲1.94MB] [CPU: ▲10.65ms] Passed 4 tests

A check of server-side resources used by REST API TO MiniProgram
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /5.20 ▲1.7447.99 ▲8.57
Dashboard /wp-admin5.33 ▲2.0255.59 ▲2.15
Posts /wp-admin/edit.php5.32 ▲1.962,177.86 ▲2,130.97
Add New Post /wp-admin/post-new.php8.17 ▲2.29104.22 ▲13.48
Media Library /wp-admin/upload.php5.26 ▲2.0452.81 ▲18.38
基础设置 /wp-admin/admin.php?page=weixinapp_slug4.9837.95
Validation /wp-admin/admin.php?page=minapper_validation_page5.1242.70
扩展设置 /wp-admin/admin.php?page=minapper_expand_settings_page4.9838.10

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

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

Browser metrics Passed 4 tests

A check of browser resources used by REST API TO MiniProgram
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,818 ▲5714.37 ▼0.361.65 ▼0.1544.04 ▼0.27
Dashboard /wp-admin2,221 ▲415.56 ▼0.1083.08 ▼8.5052.32 ▲9.88
Posts /wp-admin/edit.php2,161 ▲611.98 ▼0.0038.83 ▼0.2748.95 ▲7.86
Add New Post /wp-admin/post-new.php1,550 ▲2422.89 ▼0.11643.72 ▲28.1774.61 ▲13.46
Media Library /wp-admin/upload.php1,432 ▲354.22 ▼0.0296.37 ▼3.1049.28 ▲4.43
基础设置 /wp-admin/admin.php?page=weixinapp_slug9012.0028.6383.03
Validation /wp-admin/admin.php?page=minapper_validation_page9042.0025.7752.98
扩展设置 /wp-admin/admin.php?page=minapper_expand_settings_page9042.0224.9253.07

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
The following items require your attention
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • widget_recent-posts
    • db_upgraded
    • widget_theysaidso_widget
    • can_compress_scripts
    • widget_recent-comments
    • theysaidso_admin_options

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Even though everything seems fine, this is not an exhaustive test

SRP 50% 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
  • 14× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'RAM_WxPayNotifyReply' not found in wp-content/plugins/rest-api-to-miniprogram/includes/wxpay/WxPay.Notify.php:8
    • > PHP Warning
      Use of undefined constant REST_API_TO_MINIPROGRAM_PLUGIN_DIR - assumed 'REST_API_TO_MINIPROGRAM_PLUGIN_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/rest-api-to-miniprogram/includes/wxpay/WxPay.JsApiPay.php on line 2
    • > PHP Warning
      require_once(REST_API_TO_MINIPROGRAM_PLUGIN_DIRincludes/wxpay/WxPay.Data.php): failed to open stream: No such file or directory in wp-content/plugins/rest-api-to-miniprogram/includes/wxpay/WxPay.Api.php on line 4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/rest-api-to-miniprogram/includes/filter/ram-custom-category.php:76
    • > PHP Warning
      Use of undefined constant REST_API_TO_MINIPROGRAM_PLUGIN_DIR - assumed 'REST_API_TO_MINIPROGRAM_PLUGIN_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/rest-api-to-miniprogram/includes/wxpay/WxPay.Api.php on line 4
    • > PHP Warning
      Use of undefined constant REST_API_TO_MINIPROGRAM_PLUGIN_DIR - assumed 'REST_API_TO_MINIPROGRAM_PLUGIN_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/rest-api-to-miniprogram/includes/wxpay/WxPay.Data.php on line 5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/rest-api-to-miniprogram/rest-api-to-miniprogram.php:14
    • > PHP Warning
      require_once(REST_API_TO_MINIPROGRAM_PLUGIN_DIRincludes/wxpay/WxPay.Config.php): failed to open stream: No such file or directory in wp-content/plugins/rest-api-to-miniprogram/includes/wxpay/WxPay.Data.php on line 5
    • > PHP Warning
      require_once(REST_API_TO_MINIPROGRAM_PLUGIN_DIRincludes/wxpay/WxPay.Api.php): failed to open stream: No such file or directory in wp-content/plugins/rest-api-to-miniprogram/includes/wxpay/WxPay.JsApiPay.php on line 2
    • > PHP Fatal error
      require_once(): Failed opening required 'REST_API_TO_MINIPROGRAM_PLUGIN_DIRincludes/wxpay/WxPay.Config.php' (include_path='.:/usr/share/php') in wp-content/plugins/rest-api-to-miniprogram/includes/wxpay/WxPay.Data.php on line 5

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 97% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
Attributes that need to be fixed: The official readme.txt might help

rest-api-to-miniprogram/rest-api-to-miniprogram.php Passed 13 tests

The main PHP file in "REST API TO MiniProgram" ver. 4.6.8.1 adds more information about the plugin and also serves as the entry point for this plugin
63 characters long description:
为微慕小程序提供定制化WordPress REST API json 输出

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
Everything looks great! No dangerous files found in this plugin41,016 lines of code in 122 files:
LanguageFilesBlank linesComment linesLines of code
JSON10015,622
PHP713,5783,87112,266
CSS12632995,524
JavaScript371,2098,6314,933
SVG1002,671

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.38
Average class complexity20.99
▷ Minimum class complexity1.00
▷ Maximum class complexity368.00
Average method complexity3.13
▷ Minimum method complexity1.00
▷ Maximum method complexity63.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes72
▷ Abstract classes11.39%
▷ Concrete classes7198.61%
▷ Final classes00.00%
Methods670
▷ Static methods517.61%
▷ Public methods62893.73%
▷ Protected methods324.78%
▷ Private methods101.49%
Functions74
▷ Named functions7297.30%
▷ Anonymous functions22.70%
Constants6
▷ Global constants233.33%
▷ Class constants466.67%
▷ Public constants4100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
22 compressed PNG files occupy 1.35MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
includes/admin/exopite-simple-options/assets/jquery.minicolors.png67.02KB34.31KB▼ 48.80%
includes/admin/exopite-simple-options/assets/images/ui-bg_glass_75_dadada_1x400.png0.11KB0.16KB0.00%
includes/admin/exopite-simple-options/assets/images/ui-icons_222222_256x240.png4.27KB4.11KB▼ 3.78%
includes/admin/exopite-simple-options/assets/images/ui-icons_ffffff_256x240.png4.27KB4.11KB▼ 3.78%
includes/admin/exopite-simple-options/assets/chosen-sprite.png0.53KB0.88KB0.00%