10% ninja-announcements

Code Review | Ninja Announcements Lite

WordPress plugin Ninja Announcements Lite scored10%from 54 tests.

About plugin

  • Plugin page: ninja-announcements
  • Plugin version: 2.3.2
  • PHP version: 7.4.16
  • WordPress compatibility: 3.1-3.4
  • WordPress version: 6.3.1
  • First release: Jul 29, 2010
  • Latest release: Nov 21, 2012
  • Number of updates: 45
  • Update frequency: every 18.8 days
  • Top authors: kstover (84.44%)jameslaws (17.78%)

Code review

54 tests

User reviews

3 reviews

Install metrics

80+ active /18,523 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
    • > Deprecated in wp-content/plugins/ninja-announcements/includes/widget.class.php+254
    Function create_function() is deprecated

Server metrics [RAM: ▼1.95MB] [CPU: ▼56.53ms] Passed 4 tests

This is a short check of server-side resources used by Ninja Announcements Lite
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /2.04 ▼1.425.42 ▼35.54
Dashboard /wp-admin2.06 ▼1.255.16 ▼40.81
Posts /wp-admin/edit.php2.06 ▼1.305.84 ▼44.12
Add New Post /wp-admin/post-new.php2.06 ▼3.835.78 ▼105.63
Media Library /wp-admin/upload.php2.06 ▼1.175.40 ▼28.60
Add New /wp-admin/post-new.php?post_type=ninja_annc2.065.16
Ninja Announcements /wp-admin/edit.php?post_type=ninja_annc2.066.56
Plugin Settings /wp-admin/edit.php?post_type=ninja_annc&page=plugin_settings2.064.87

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

How much does this plugin use your filesystem and database?
No storage issues were detected
Filesystem: 44 new files
Database: no new tables, 8 new options
New WordPress options
theysaidso_admin_options
widget_theysaidso_widget
ninja_annc_settings
widget_recent-posts
widget_ninja_annc_widget
can_compress_scripts
db_upgraded
widget_recent-comments

Browser metrics Passed 4 tests

This is an overview of browser requirements for Ninja Announcements Lite
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,833 ▲9813.23 ▼1.141.53 ▼0.7641.67 ▼3.62
Dashboard /wp-admin2,239 ▲485.10 ▲0.16100.83 ▼1.3767.66 ▲23.47
Posts /wp-admin/edit.php2,116 ▲242.02 ▲0.0138.26 ▼2.7935.28 ▼0.14
Add New Post /wp-admin/post-new.php1,703 ▲18424.55 ▲1.35730.39 ▲133.3477.59 ▲29.81
Media Library /wp-admin/upload.php1,415 ▲244.16 ▼0.08106.12 ▲10.6581.51 ▲37.39
Add New /wp-admin/post-new.php?post_type=ninja_annc2,6847.97187.64141.49
Ninja Announcements /wp-admin/edit.php?post_type=ninja_annc1,1101.9335.2536.79
Plugin Settings /wp-admin/edit.php?post_type=ninja_annc&page=plugin_settings8702.0727.1830.46

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
It is recommended to fix the following
  • This plugin cannot be uninstalled
    • > Deprecated in wp-content/plugins/ninja-announcements/includes/widget.class.php+254
    Function create_function() is deprecated
  • This plugin does not fully uninstall, leaving 8 options in the database
    • widget_recent-posts
    • db_upgraded
    • ninja_annc_settings
    • widget_theysaidso_widget
    • widget_recent-comments
    • can_compress_scripts
    • widget_ninja_annc_widget
    • theysaidso_admin_options

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
Smoke test failed, please fix the following
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/edit.php?post_type=ninja_annc&page=plugin_settings
    • > Deprecated in wp-content/plugins/ninja-announcements/includes/widget.class.php+254
    Function create_function() is deprecated
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/edit.php?post_type=ninja_annc&page=plugin_settings
    • > User deprecated in wp-includes/functions.php+5546
    The called constructor method for WP_Widget class in Ninja_Annc_Widget is deprecated since version 4.3.0! Use __construct() instead.

SRP 50% 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
  • 11× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/ninja-announcements/includes/cpt.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/ninja-announcements/includes/meta-boxes.php:183
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/ninja-announcements/includes/columns.php:3
    • > 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/ninja-announcements/ninja_annc.php on line 29
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/ninja-announcements/includes/display.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/ninja-announcements/includes/plugin-settings.php:6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/ninja-announcements/includes/ajax-functions.php:2
    • > PHP Warning
      Use of undefined constant WP_PLUGIN_URL - assumed 'WP_PLUGIN_URL' (this will throw an Error in a future version of PHP) in wp-content/plugins/ninja-announcements/ninja_annc.php on line 30
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/ninja-announcements/includes/widget.class.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/ninja-announcements/includes/scripts-styles.php:2

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
    • > GET request to /wp-admin/post-new.php?post_type=ninja_annc
    • > Console-api (warning) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1 1:28609 "jQuery.Deferred exception: a(...).live is not a function" "TypeError: a(...).live is not a function\n at HTMLDocument.\u003Canonymous> (/wp-content/plugins/ninja-announcements/js/min/ninja_annc_admin.min.js?ver=6.3.1:5:166)\n at e (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1:2:26990)\n at t (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1:2:27292)" undefined
    • > GET request to /wp-admin/post-new.php?post_type=ninja_annc
    • > Javascript (severe) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1 1:28721 Uncaught TypeError: a(...).live is not a function

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
3 plugin tags: announcement, alert, notice

ninja-announcements/ninja_annc.php 85% from 13 tests

The entry point to "Ninja Announcements Lite" version 2.3.2 is a PHP file that has certain tags in its header comment area
It is important to fix the following:
  • Main file name: The principal plugin file should be the same as the plugin slug ("ninja-announcements.php" instead of "ninja_annc.php")
  • Description: If Twitter did it, so should we! Keep the description under 140 characters (currently 452 characters long)

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
Everything looks great! No dangerous files found in this plugin3,379 lines of code in 20 files:
LanguageFilesBlank linesComment linesLines of code
PHP10132912,068
CSS57051672
JavaScript5126120639

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.41
Average class complexity74.00
▷ Minimum class complexity74.00
▷ Maximum class complexity74.00
Average method complexity19.25
▷ Minimum method complexity1.00
▷ Maximum method complexity71.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods4
▷ Static methods00.00%
▷ Public methods4100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions36
▷ Named functions36100.00%
▷ Anonymous functions00.00%
Constants4
▷ Global constants4100.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
16 compressed PNG files occupy 0.04MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png0.12KB0.14KB0.00%
css/smoothness/images/ui-icons_888888_256x240.png4.27KB4.11KB▼ 3.78%
css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png0.12KB0.14KB0.00%
css/smoothness/images/ui-icons_454545_256x240.png4.27KB4.11KB▼ 3.78%
css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png0.18KB0.08KB▼ 51.67%