57% alemha-watermark

Code Review | Alemha watermarker

WordPress plugin Alemha watermarker scored57%from 54 tests.

About plugin

  • Plugin page: alemha-watermark
  • Plugin version: 1.3.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-4.7.4
  • WordPress version: 6.3.1
  • First release: Oct 19, 2014
  • Latest release: Apr 25, 2017
  • Number of updates: 27
  • Update frequency: every 34.0 days
  • Top authors: mnbaaco (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /4,426 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
Installer ran successfully

Server metrics [RAM: ▼1.83MB] [CPU: ▼52.19ms] Passed 4 tests

This is a short check of server-side resources used by Alemha watermarker
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /2.16 ▼1.305.95 ▼35.51
Dashboard /wp-admin2.18 ▼1.128.41 ▼46.88
Posts /wp-admin/edit.php2.18 ▼1.179.06 ▼39.94
Add New Post /wp-admin/post-new.php2.18 ▼3.718.27 ▼86.44
Media Library /wp-admin/upload.php2.18 ▼1.057.55 ▼31.10
Categories /wp-admin/edit-tags.php?taxonomy=Categories&post_type=watermark2.189.40
All Watermarks /wp-admin/edit.php?post_type=watermark2.188.40
Add New Watermark /wp-admin/post-new.php?post_type=watermark2.187.94

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

How much does this plugin use your filesystem and database?
The plugin installed successfully
Filesystem: 188 new files
Database: no new tables, 6 new options
New WordPress options
can_compress_scripts
db_upgraded
widget_recent-posts
widget_recent-comments
theysaidso_admin_options
widget_theysaidso_widget

Browser metrics Passed 4 tests

This is an overview of browser requirements for Alemha watermarker
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,976 ▲19013.60 ▼0.6910.64 ▲8.5543.29 ▲2.12
Dashboard /wp-admin2,255 ▲785.79 ▲0.2194.65 ▲2.1141.91 ▼0.46
Posts /wp-admin/edit.php2,155 ▲552.39 ▲0.3643.48 ▲6.8133.69 ▼1.29
Add New Post /wp-admin/post-new.php1,578 ▲4123.78 ▲5.53627.59 ▲4.1834.93 ▼30.95
Media Library /wp-admin/upload.php1,467 ▲674.51 ▲0.33100.59 ▲2.8241.63 ▼4.47
Categories /wp-admin/edit-tags.php?taxonomy=Categories&post_type=watermark1,3562.1733.1548.52
All Watermarks /wp-admin/edit.php?post_type=watermark1,1382.3640.9331.29
Add New Watermark /wp-admin/post-new.php?post_type=watermark2,5743.5176.6067.68

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
Please fix the following items
  • Uninstall procedure had uncaught errors
    • > User notice in wp-includes/functions.php+5905
    Function wp_register_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. This notice was triggered by the watermark_ajax handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)
  • This plugin does not fully uninstall, leaving 6 options in the database
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_recent-comments
    • widget_recent-posts
    • widget_theysaidso_widget
    • db_upgraded

Smoke tests 0% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Almost there, just fix the following server-side errors
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=watermark
    • > User notice in wp-includes/functions.php+5905
    Function wp_register_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. This notice was triggered by the watermark_ajax handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=watermark
    • > User notice in wp-includes/functions.php+5905
    Function wp_enqueue_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. This notice was triggered by the watermark_ajax handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=watermark
    • > User notice in wp-includes/functions.php+5905
    Function wp_register_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. This notice was triggered by the image-js handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=watermark
    • > User notice in wp-includes/functions.php+5905
    Function wp_enqueue_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. This notice was triggered by the image-js handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=watermark
    • > Notice in wp-content/plugins/alemha-watermark/views/background_setting.php+14
    Undefined index: label
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=watermark
    • > Notice in wp-content/plugins/alemha-watermark/views/background_setting.php+14
    Undefined variable: class

SRP 0% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Please fix the following items
  • 2× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/alemha-watermark/views/img_upload.php
    • > /wp-content/plugins/alemha-watermark/views/position_setting.php
  • 20× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Warning
      Invalid argument supplied for foreach() in wp-content/plugins/alemha-watermark/views/background_setting.php on line 7
    • > PHP Warning
      Invalid argument supplied for foreach() in wp-content/plugins/alemha-watermark/views/img_upload.php on line 7
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/alemha-watermark/libraries/I18N/Arabic/data/charset/_bug.php:14
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_post_meta() in wp-content/plugins/alemha-watermark/views/font_setting.php:54
    • > PHP Warning
      require_once(ABSPATHwp-admin/includes/class-wp-list-table.php): failed to open stream: No such file or directory in wp-content/plugins/alemha-watermark/helpers/extended_upload.php on line 1
    • > PHP Warning
      Invalid argument supplied for foreach() in wp-content/plugins/alemha-watermark/views/position_setting.php on line 7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_post() in wp-content/plugins/alemha-watermark/controllers/preview_watermark.php:3
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/alemha-watermark/helpers/extended_upload.php on line 1
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/alemha-watermark/libraries/I18N/Arabic/data/charset/_utf8.php:13
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_post_meta() in wp-content/plugins/alemha-watermark/views/background_setting.php:38

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Please fix the following browser errors
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=watermark
    • > Network (severe)
    wp-content/plugins/alemha-watermark/helpers/my-script.js?ver=6.3.1 - Failed to load resource: the server responded with a status of 404 (Not Found)
    • > GET request to /wp-admin/post-new.php?post_type=watermark
    • > Network (severe)
    wp-content/plugins/alemha-watermark/images/noimage.jpg - Failed to load resource: the server responded with a status of 404 (Not Found)

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
10 plugin tags: image, photo, media, signature, picture...

alemha-watermark/alemha-watermarker.php 92% from 13 tests

The main PHP script in "Alemha watermarker" version 1.3.1 is automatically included on every request by WordPress
The following require your attention:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("alemha-watermark.php" instead of "alemha-watermarker.php")

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
Success! There were no dangerous files found in this plugin37,628 lines of code in 150 files:
LanguageFilesBlank linesComment linesLines of code
HTML742,280028,271
PHP421,1334,8445,253
XML952972,928
SVG2131813
CSS1302163
PO File15569125
JavaScript216375

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.31
Average class complexity27.12
▷ Minimum class complexity1.00
▷ Maximum class complexity75.00
Average method complexity4.22
▷ Minimum method complexity1.00
▷ Maximum method complexity59.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes24
▷ Abstract classes00.00%
▷ Concrete classes24100.00%
▷ Final classes00.00%
Methods195
▷ Static methods3216.41%
▷ Public methods15378.46%
▷ Protected methods4121.03%
▷ Private methods10.51%
Functions34
▷ Named functions34100.00%
▷ Anonymous functions00.00%
Constants4
▷ Global constants4100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
7 PNG files occupy 0.11MB with 0.06MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
libraries/I18N/Arabic/Docs/media/background.png0.23KB0.10KB▼ 58.82%
screenshot-2.png16.32KB8.32KB▼ 49.01%
libraries/I18N/Arabic/Docs/media/empty.png0.20KB0.09KB▼ 53.88%
screenshot-4.png63.76KB22.74KB▼ 64.34%
screenshot-3.png14.07KB7.51KB▼ 46.59%