10% telegram-for-wp

Code Review | Telegram for WP

WordPress plugin Telegram for WP scored 10% from 54 tests.

About plugin

  • Plugin page: telegram-for-wp
  • Plugin version: 1.6.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.5-4.9.4
  • WordPress version: 5.8.1
  • First release: Jun 18, 2015
  • Latest release: Feb 17, 2018
  • Number of updates: 41
  • Update frequency: every 23.8 days
  • Top authors: Amir Mousavi (100%)

Code review

54 tests

User reviews

66 reviews

Install metrics

2,000+ active / 64,467 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
It is recommended to fix the following installer errors
  • This plugin did not install gracefully
    • > Warning in wp-content/plugins/telegram-for-wp/inc/Notifcaster.class.php+318
    "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"?

Server metrics [RAM: ▼1.77MB] [CPU: ▼198.74ms] Passed 4 tests

Server-side resources used by Telegram for WP
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /1.86 ▼0.866.02 ▼18.02
Dashboard /wp-admin1.88 ▼1.186.10 ▼50.53
Posts /wp-admin/edit.php1.88 ▼1.236.11 ▼49.04
Add New Post /wp-admin/post-new.php1.88 ▼3.555.65 ▼667.57
Media Library /wp-admin/upload.php1.88 ▼1.125.95 ▼27.83

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

Filesystem and database footprint
This plugin installed successfully
Filesystem: 16 new files
Database: 1 new table, 1 new option
New tables
wp_twp_logs
New WordPress options
twp_db_version

Browser metrics Passed 4 tests

This is an overview of browser requirements for Telegram for WP
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,698 ▲12715.81 ▲0.1215.45 ▲2.4250.06 ▼6.83
Dashboard /wp-admin2,976 ▲455.92 ▼0.06165.45 ▲0.90149.33 ▲31.07
Posts /wp-admin/edit.php2,762 ▲232.59 ▼0.1271.51 ▲2.1698.29 ▼6.96
Add New Post /wp-admin/post-new.php2,989 ▲1,40824.84 ▲4.60449.82 ▼8.29178.88 ▲63.66
Media Library /wp-admin/upload.php1,844 ▲375.03 ▼0.00148.30 ▼33.35154.92 ▲30.14

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
Please fix the following items
  • This plugin did not uninstall without warnings or errors
    • > Warning in wp-content/plugins/telegram-for-wp/inc/Notifcaster.class.php+318
    "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"?
  • Zombie WordPress options detected upon uninstall: 1 option
    • twp_db_version

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
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
Please fix the following items
  • 1× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/telegram-for-wp/admin/settings-page.php
  • 2× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Warning
      "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in wp-content/plugins/telegram-for-wp/inc/Notifcaster.class.php on line 318
    • > PHP Warning
      "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in wp-content/plugins/telegram-for-wp/Notifcaster.class.php on line 195

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
6 plugin tags: channel, admin, notifications, plugin, email...

telegram-for-wp/twp.php 85% from 13 tests

The main file in "Telegram for WP" v. 1.6.1 serves as a complement to information provided in readme.txt and as the entry point to the plugin
You should first fix the following items:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("telegram-for-wp.php" instead of "twp.php")
  • Text Domain: If you choose to specify the text domain, it must be the same as the plugin slug; optional since WordPress version 4.6

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
Success! There were no dangerous files found in this plugin2,324 lines of code in 12 files:
LanguageFilesBlank linesComment linesLines of code
PHP7703681,732
PO File1149191370
JavaScript32330209
Markdown15013

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.30
Average class complexity24.00
▷ Minimum class complexity12.00
▷ Maximum class complexity36.00
Average method complexity3.00
▷ Minimum method complexity1.00
▷ Maximum method complexity13.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes2
▷ Abstract classes00.00%
▷ Concrete classes2100.00%
▷ Final classes00.00%
Methods21
▷ Static methods00.00%
▷ Public methods1780.95%
▷ Protected methods419.05%
▷ Private methods00.00%
Functions25
▷ Named functions2496.00%
▷ Anonymous functions14.00%
Constants11
▷ Global constants11100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
1 PNG file occupies 0.00MB with 0.00MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
icon.png1.16KB0.59KB▼ 49.16%