10% rt-prettyphoto

Code Review | Royal PrettyPhoto

WordPress plugin Royal PrettyPhoto scored 10% from 54 tests.

About plugin

  • Plugin page: rt-prettyphoto
  • Plugin version: 1.3
  • PHP version: 7.4.16
  • WordPress compatibility: 3.3-4.2.2
  • WordPress version: 5.9.2
  • First release: Aug 1, 2013
  • Latest release: May 10, 2015
  • Number of updates: 20
  • Update frequency: every 32.4 days
  • Top authors: royaltechbd (100%)

Code review

54 tests

User reviews

18 reviews

Install metrics

2,000+ active / 30,259 total downloads

Benchmarks

Plugin footprint 58% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
It is recommended to fix the following installer errors
  • The plugin cannot be installed
    • > Deprecated in wp-content/plugins/rt-prettyphoto/rt-prettyphoto.php+135
    Unparenthesized `a ? b : c ? d : e` is deprecated. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)`

Server metrics [RAM: ▼2.42MB] [CPU: ▼347.74ms] Passed 4 tests

Server-side resources used by Royal PrettyPhoto
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /1.95 ▼1.564.24 ▼47.75
Dashboard /wp-admin1.97 ▼1.444.02 ▼28.78
Posts /wp-admin/edit.php1.97 ▼1.674.23 ▼33.75
Add New Post /wp-admin/post-new.php1.97 ▼5.004.20 ▼1,280.68
Media Library /wp-admin/upload.php1.97 ▼1.333.55 ▼18.91
Royal PrettyPhoto /wp-admin/options-general.php?page=royal_pretty_photo1.974.14

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

Input-output and database impact of this plugin
The plugin installed successfully
Filesystem: 12 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

A check of browser resources used by Royal PrettyPhoto
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,917 ▲17516.26 ▲0.729.61 ▲3.432.38 ▲0.22
Dashboard /wp-admin2,899 ▲386.21 ▲0.06116.21 ▼14.36156.85 ▼4.58
Posts /wp-admin/edit.php2,699 ▲83.25 ▲0.0161.64 ▼3.87133.60 ▼6.88
Add New Post /wp-admin/post-new.php1,670 ▲916.55 ▲0.40413.40 ▲21.25159.60 ▲8.21
Media Library /wp-admin/upload.php1,709 ▲85.54 ▲0.02133.12 ▼1.19184.70 ▲0.61
Royal PrettyPhoto /wp-admin/options-general.php?page=royal_pretty_photo1,3062.7661.85111.77

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 without warnings or errors
    • > Deprecated in wp-content/plugins/rt-prettyphoto/rt-prettyphoto.php+135
    Unparenthesized `a ? b : c ? d : e` is deprecated. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)`

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Smoke test failed, please fix the following
    • > GET request to /wp-admin/options-general.php?page=royal_pretty_photo
    • > Deprecated in wp-content/plugins/rt-prettyphoto/rt-prettyphoto.php+135
    Unparenthesized `a ? b : c ? d : e` is deprecated. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)`
    • > GET request to /wp-admin/options-general.php?page=royal_pretty_photo
    • > User notice in wp-includes/functions.php+5768
    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 rt-wpp-plugin-active handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)
    • > GET request to /wp-admin/options-general.php?page=royal_pretty_photo
    • > User notice in wp-includes/functions.php+5768
    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 rt-wpp-plugin-script-active handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)
    • > GET request to /wp-admin/options-general.php?page=royal_pretty_photo
    • > User notice in wp-includes/functions.php+5768
    wp_enqueue_style 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 rt-wpp-plugin-style handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)
    • > GET request to /wp-admin/options-general.php?page=royal_pretty_photo
    • > User deprecated in wp-includes/functions.php+5326
    screen_icon is deprecated since version 3.8.0 with no alternative available.
    • > GET request to /wp-admin/options-general.php?page=royal_pretty_photo
    • > User deprecated in wp-includes/functions.php+5326
    get_screen_icon is deprecated since version 3.8.0 with no alternative available.
  • 8 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=royal_pretty_photo
    • > Notice in wp-content/plugins/rt-prettyphoto/rt-prettyphoto.php+218
    Trying to access array offset on value of type bool

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
Please fix the following items
  • 1× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/rt-prettyphoto/rt-prettyphoto.php:13

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

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
These attributes need your attention:
  • Plugin Name: "Plugin Name" should be replaced with the name of your plugin on the first line ( === rt-prettyphoto === )
The official readme.txt is a good inspiration

rt-prettyphoto/rt-prettyphoto.php Passed 13 tests

The main PHP script in "Royal PrettyPhoto" version 1.3 is automatically included on every request by WordPress
83 characters long description:
This plugin will automatic add lightbox in wordpress post/page without disturbance.

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
There were no executable files found in this plugin1,069 lines of code in 4 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript218395636
PHP113549263
CSS100170

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.12
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%
Functions12
▷ Named functions12100.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.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
6 PNG files occupy 0.01MB with 0.01MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/prettyPhoto/default/default_thumb.png1.50KB0.61KB▼ 59.47%
images/prettyPhoto/default/sprite_y.png1.13KB0.13KB▼ 88.81%
images/prettyPhoto/default/sprite_prev.png1.34KB0.38KB▼ 71.73%
images/prettyPhoto/default/sprite.png6.53KB3.21KB▼ 50.87%
images/prettyPhoto/default/sprite_next.png1.33KB0.39KB▼ 70.69%