10% qiniu-uploader

Code Review | Qiniu Uploader

WordPress plugin Qiniu Uploader scored 10% from 54 tests.

About plugin

  • Plugin page: qiniu-uploader
  • Plugin version: 0.1
  • PHP version: 7.4.16
  • WordPress compatibility: 2.6-3.5.0
  • WordPress version: 5.8.1
  • First release: Jan 24, 2013
  • Latest release: Jan 25, 2013
  • Number of updates: 5
  • Update frequency: every 0.2 days
  • Top authors: franzcai (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 2,170 total downloads

Benchmarks

Plugin footprint 23% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
You still need to fix the following installer errors
  • Install procedure validation failed for this plugin
    • > Deprecated in wp-content/plugins/qiniu-uploader/qiniu-uploader.php+65
    Methods with the same name as their class will not be constructors in a future version of PHP; qiniu_uploader has a deprecated constructor

Server metrics [RAM: ▼1.84MB] [CPU: ▼202.14ms] Passed 4 tests

A check of server-side resources used by Qiniu Uploader
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /1.79 ▼0.936.68 ▼15.58
Dashboard /wp-admin1.81 ▼1.245.46 ▼44.61
Posts /wp-admin/edit.php1.81 ▼1.294.68 ▼35.72
Add New Post /wp-admin/post-new.php1.81 ▼3.624.44 ▼700.47
Media Library /wp-admin/upload.php1.81 ▼1.195.42 ▼27.77
七牛云储存 /wp-admin/upload.php?page=qiniu-image1.815.36

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

Filesystem and database footprint
There were no storage issued detected upon installing this plugin
Filesystem: 47 new files
Database: 1 new table, 1 new option
New tables
wp_qiniu
New WordPress options
qiniu_db_version

Browser metrics Passed 4 tests

A check of browser resources used by Qiniu Uploader
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,686 ▲9015.95 ▲0.367.47 ▼2.4648.75 ▲1.55
Dashboard /wp-admin2,981 ▲475.88 ▼0.07140.87 ▼5.55131.50 ▲16.46
Posts /wp-admin/edit.php2,744 ▲52.69 ▲0.0064.95 ▼2.1095.99 ▼4.97
Add New Post /wp-admin/post-new.php1,689 ▲18918.50 ▼0.07350.72 ▼15.88112.38 ▲4.21
Media Library /wp-admin/upload.php1,814 ▲75.00 ▲0.01157.96 ▲6.23129.39 ▲4.60
七牛云储存 /wp-admin/upload.php?page=qiniu-image9952.0953.2767.01

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
The following items require your attention
  • This plugin cannot be uninstalled
    • > Deprecated in wp-content/plugins/qiniu-uploader/qiniu-uploader.php+65
    Methods with the same name as their class will not be constructors in a future version of PHP; qiniu_uploader has a deprecated constructor
  • Zombie tables were found after uninstall: 1 table
    • wp_qiniu
  • Zombie WordPress options were found after uninstall: 1 option
    • qiniu_db_version

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Please fix the following server-side errors
    • > GET request to /wp-admin/upload.php?page=qiniu-image
    • > Deprecated in wp-content/plugins/qiniu-uploader/qiniu-uploader.php+65
    Methods with the same name as their class will not be constructors in a future version of PHP; qiniu_uploader has a deprecated constructor
    • > GET request to /wp-admin/upload.php?page=qiniu-image
    • > Deprecated in wp-content/plugins/qiniu-uploader/qiniu-uploader.php+90
    Function create_function() is deprecated
    • > GET request to /wp-admin/upload.php?page=qiniu-image
    • > Deprecated in wp-content/plugins/qiniu-uploader/tinymce/tinymce.php+3
    Methods with the same name as their class will not be constructors in a future version of PHP; add_qiniu_button has a deprecated constructor
    • > GET request to /wp-admin/upload.php?page=qiniu-image
    • > Notice in wp-content/plugins/qiniu-uploader/lib/config.php+3
    Constant DOMAIN already defined
    • > GET request to /wp-admin/upload.php?page=qiniu-image
    • > Notice in wp-content/plugins/qiniu-uploader/lib/config.php+4
    Constant HOST already defined

SRP 0% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Please fix the following
  • 5× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/qiniu-uploader/upload_window.php
    • > /wp-content/plugins/qiniu-uploader/lib/qiniu/qbox/eu_demo.php
    • > /wp-content/plugins/qiniu-uploader/lib/qiniu/qbox/rs_demo.php
    • > /wp-content/plugins/qiniu-uploader/lib/qiniu/qbox/fileop_demo.php
    • > /wp-content/plugins/qiniu-uploader/lib/qiniu/qbox/authtoken_demo.php
  • 13× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Warning
      Use of undefined constant qiniu_URLPATH - assumed 'qiniu_URLPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/qiniu-uploader/upload_window.php on line 4
    • > PHP Warning
      Use of undefined constant qiniu_URLPATH - assumed 'qiniu_URLPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/qiniu-uploader/upload_window.php on line 65
    • > PHP Fatal error
      require_once(): Failed opening required 'qiniu_ABSPATH/lib/config.php' (include_path='.:/usr/share/php') in wp-content/plugins/qiniu-uploader/bootstrap.php on line 7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/qiniu-uploader/tinymce/tinymce.php:9
    • > PHP Warning
      Use of undefined constant QBOX_UP_HOST - assumed 'QBOX_UP_HOST' (this will throw an Error in a future version of PHP) in wp-content/plugins/qiniu-uploader/upload_window.php on line 48
    • > PHP Notice
      Undefined variable: nonce in wp-content/plugins/qiniu-uploader/upload_window.php on line 10
    • > PHP Warning
      Use of undefined constant WP_PLUGIN_DIR - assumed 'WP_PLUGIN_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/qiniu-uploader/qiniu-uploader.php on line 19
    • > PHP Warning
      Use of undefined constant qiniu_URLPATH - assumed 'qiniu_URLPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/qiniu-uploader/upload_window.php on line 12
    • > PHP Notice
      Undefined variable: upToken in wp-content/plugins/qiniu-uploader/upload_window.php on line 9
    • > PHP Warning
      require_once(qiniu_ABSPATH/lib/config.php): failed to open stream: No such file or directory in wp-content/plugins/qiniu-uploader/bootstrap.php on line 7

User-side errors Passed 1 test

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

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
6 plugin tags: download, qiniu, storage, post, upload...

qiniu-uploader/qiniu-uploader.php Passed 13 tests

The primary PHP file in "Qiniu Uploader" version 0.1 is used by WordPress to initiate all plugin functionality
67 characters long description:
upload image to qiniu cloud store and copy the url to current post.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Success! There were no dangerous files found in this plugin2,952 lines of code in 39 files:
LanguageFilesBlank linesComment linesLines of code
PHP262995071,537
JavaScript112843181,204
CSS25222211

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.24
Average class complexity8.58
▷ Minimum class complexity1.00
▷ Maximum class complexity73.00
Average method complexity2.86
▷ Minimum method complexity1.00
▷ Maximum method complexity24.00
Code structure
Namespaces0
Interfaces1
Traits0
Classes11
▷ Abstract classes00.00%
▷ Concrete classes11100.00%
▷ Final classes00.00%
Methods50
▷ Static methods00.00%
▷ Public methods4386.00%
▷ Protected methods12.00%
▷ Private methods612.00%
Functions38
▷ Named functions38100.00%
▷ Anonymous functions00.00%
Constants58
▷ Global constants2644.83%
▷ Class constants3255.17%
▷ Public constants32100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
2 PNG files occupy 0.00MB with 0.00MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
tinymce/qiniu.png2.01KB1.37KB▼ 31.66%
assets/images/XPButtonUploadText_61x22.png1.81KB1.64KB▼ 9.43%