78% txt2img

Code Review | txt2img (山寨长微博)

WordPress plugin txt2img (山寨长微博) scored78%from 54 tests.

About plugin

  • Plugin page: txt2img
  • Plugin version: 1.2.1
  • PHP version: 7.4.16
  • WordPress compatibility: 2.7.0-4.0
  • WordPress version: 6.3.1
  • First release: Feb 17, 2012
  • Latest release: Nov 6, 2014
  • Number of updates: 49
  • Update frequency: every 20.3 days
  • Top authors: myst729 (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /2,721 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed gracefully, with no errors

Server metrics [RAM: ▼0.04MB] [CPU: ▼7.71ms] Passed 4 tests

An overview of server-side resources used by txt2img (山寨长微博)
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.49 ▲0.0239.70 ▲3.93
Dashboard /wp-admin3.13 ▼0.1728.32 ▼18.32
Posts /wp-admin/edit.php3.39 ▲0.0343.36 ▼0.86
Add New Post /wp-admin/post-new.php5.91 ▲0.0290.25 ▼5.21
Media Library /wp-admin/upload.php3.20 ▼0.0328.48 ▼6.45

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

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

Browser metrics Passed 4 tests

Checking browser requirements for txt2img (山寨长微博)
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲2814.35 ▼0.261.68 ▲0.1143.43 ▲1.73
Dashboard /wp-admin2,192 ▲155.56 ▼0.1083.40 ▼3.8636.92 ▼7.54
Posts /wp-admin/edit.php2,100 ▼01.97 ▼0.0336.58 ▼0.4929.90 ▼4.47
Add New Post /wp-admin/post-new.php1,526 ▼222.99 ▼0.06602.38 ▼66.5453.45 ▼10.04
Media Library /wp-admin/upload.php1,400 ▼34.19 ▲0.0894.19 ▼10.8944.03 ▼3.10

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
  • The uninstall procedure has failed, leaving 6 options in the database
    • db_upgraded
    • widget_theysaidso_widget
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_recent-comments
    • widget_recent-posts

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 0% 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
Almost there! Just fix the following items
  • 1× PHP files output text when accessed directly:
    • > /wp-content/plugins/txt2img/txt2img_generater.php
  • 10× PHP files trigger server errors when accessed directly:
    • > PHP Notice
      Trying to access array offset on value of type bool in wp-content/plugins/txt2img/txt2img_generater.php on line 9
    • > PHP Notice
      Trying to access array offset on value of type bool in wp-content/plugins/txt2img/txt2img_generater.php on line 10
    • > PHP Warning
      imagettftext(): Could not find/open font in wp-content/plugins/txt2img/txt2img_generater.php on line 16
    • > PHP Notice
      Undefined index: txt2img_pid in wp-content/plugins/txt2img/txt2img_generater.php on line 4
    • > PHP Notice
      Trying to access array offset on value of type bool in wp-content/plugins/txt2img/txt2img_generater.php on line 10
    • > PHP Warning
      imagettfbbox(): Could not find/open font in wp-content/plugins/txt2img/txt2img_generater.php on line 8
    • > PHP Notice
      Trying to access array offset on value of type bool in wp-content/plugins/txt2img/txt2img_generater.php on line 9
    • > PHP Warning
      imagettftext(): Could not find/open font in wp-content/plugins/txt2img/txt2img_generater.php on line 15
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/txt2img/txt2img.php:17
    • > PHP Notice
      Undefined index: txt2img_content in wp-content/plugins/txt2img/txt2img_generater.php on line 5

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

readme.txt 94% from 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
These attributes need your attention:
  • Screenshots: These screenshots have no corresponding images in /assets: #1 (Share to weibo while editing published post/page.), #2 (Preview the image generated from the post.)
The official readme.txt might help

txt2img/txt2img.php Passed 13 tests

The principal PHP file in "txt2img (山寨长微博)" v. 1.2.1 is loaded by WordPress automatically on each request
106 characters long description:
Convert WordPress post/page into image and share on Weibo. 把 WordPress 文章转发成新浪长微博。

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
Everything looks great! No dangerous files found in this plugin256 lines of code in 3 files:
LanguageFilesBlank linesComment linesLines of code
PHP21417228
PO File16628

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.08
Average class complexity0.00
▷ Minimum class complexity0.00
▷ Maximum class complexity0.00
Average method complexity0.00
▷ Minimum method complexity0.00
▷ Maximum method complexity0.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes0
▷ Abstract classes00.00%
▷ Concrete classes00.00%
▷ Final classes00.00%
Methods0
▷ Static methods00.00%
▷ Public methods00.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions5
▷ Named functions5100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.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
4 compressed PNG files occupy 0.03MB
Potential savings
Compression of 4 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-1.png5.38KB5.41KB0.00%
close.png1.05KB1.72KB0.00%
weibo.png1.00KB1.00KB0.00%
screenshot-2.png20.94KB21.12KB0.00%