10% announcement-bar

Code Review | Announcement Bar

WordPress plugin Announcement Bar scored10%from 54 tests.

About plugin

  • Plugin page: announcement-bar
  • Plugin version: 0.4.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.2-4.2
  • WordPress version: 6.3.1
  • First release: Aug 2, 2011
  • Latest release: Apr 23, 2015
  • Number of updates: 22
  • Update frequency: every 74.6 days
  • Top authors: austyfrosty (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

4,000+ active /13,345 total downloads

Benchmarks

Plugin footprint 58% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
You still need to fix the following installer errors
  • This plugin did not install gracefully
    • > Warning in wp-content/plugins/announcement-bar/announcement.php+226
    Use of undefined constant ANNOUNCEMENT_BAR_POST_TYPE - assumed 'ANNOUNCEMENT_BAR_POST_TYPE' (this will throw an Error in a future version of PHP)

Server metrics [RAM: ▲0.16MB] [CPU: ▼6.42ms] Passed 4 tests

Server-side resources used by Announcement Bar
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.57 ▲0.1138.29 ▼2.45
Dashboard /wp-admin3.49 ▲0.1545.69 ▼14.42
Posts /wp-admin/edit.php3.61 ▲0.2546.62 ▲4.18
Add New Post /wp-admin/post-new.php6.07 ▲0.1981.89 ▼12.97
Media Library /wp-admin/upload.php3.42 ▲0.1941.08 ▲6.07
Announcement Bar /wp-admin/options-general.php?page=announcement-bar3.3029.59
Announcements /wp-admin/edit.php?post_type=announcement3.4636.75
Add New /wp-admin/post-new.php?post_type=announcement3.4542.11

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

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

Browser metrics Passed 4 tests

Checking browser requirements for Announcement Bar
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,837 ▲9114.73 ▲0.371.90 ▲0.2242.31 ▼5.45
Dashboard /wp-admin2,240 ▲554.83 ▼0.0895.65 ▼20.7439.59 ▼4.95
Posts /wp-admin/edit.php2,123 ▲522.12 ▲0.0741.66 ▲3.7434.79 ▼1.74
Add New Post /wp-admin/post-new.php1,562 ▲2923.23 ▲0.11627.42 ▼39.7752.09 ▼1.51
Media Library /wp-admin/upload.php1,422 ▲314.19 ▼0.0494.39 ▼11.3340.92 ▼5.91
Announcement Bar /wp-admin/options-general.php?page=announcement-bar1,8152.5451.6777.30
Announcements /wp-admin/edit.php?post_type=announcement1,1371.9730.7135.38
Add New /wp-admin/post-new.php?post_type=announcement1,5322.5148.8955.02

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] 75% 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 did not uninstall successfully, leaving 7 options in the database
    • theysaidso_admin_options
    • widget_recent-comments
    • widget_theysaidso_widget
    • announcement_bar_settings
    • db_upgraded
    • widget_recent-posts
    • can_compress_scripts

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
    • > GET request to /wp-admin/options-general.php?page=announcement-bar
    • > User deprecated in wp-includes/functions.php+5463
    Function screen_icon is deprecated since version 3.8.0 with no alternative available.
    • > GET request to /wp-admin/options-general.php?page=announcement-bar
    • > User deprecated in wp-includes/functions.php+5463
    Function get_screen_icon is deprecated since version 3.8.0 with no alternative available.

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
  • 4× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr_e() in wp-content/plugins/announcement-bar/css/announcement.css.php:13
    • > PHP Fatal error
      Uncaught Error: Call to undefined function register_activation_hook() in wp-content/plugins/announcement-bar/announcement.php:87
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/announcement-bar/admin/dashboard.php:17
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/announcement-bar/admin/admin.php:10

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
These are user-side errors you should fix
    • > GET request to /wp-admin/options-general.php?page=announcement-bar
    • > Network (severe)
    wp-admin/images/gray-grad.png - Failed to load resource: the server responded with a status of 404 (Not Found)
    • > GET request to /wp-admin/options-general.php?page=announcement-bar
    • > Network (severe)
    wp-content/plugins/announcement-bar/js/cross.gif - 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 uses markdown syntax to describe your plugin to the world
5 plugin tags: announcement bar, stats, announcement, admin, bar

announcement-bar/announcement.php 92% from 13 tests

"Announcement Bar" version 0.4.1's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
You should first fix the following items:
  • Main file name: Name the main plugin file the same as the plugin slug ("announcement-bar.php" instead of "announcement.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
No dangerous file extensions were detected2,587 lines of code in 14 files:
LanguageFilesBlank linesComment linesLines of code
PHP5221317894
JavaScript3150113788
Oracle PL/SQL38074609
PO File16878153
CSS254143

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.24
Average class complexity23.50
▷ Minimum class complexity13.00
▷ Maximum class complexity34.00
Average method complexity2.67
▷ Minimum method complexity1.00
▷ Maximum method complexity8.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes2
▷ Abstract classes00.00%
▷ Concrete classes2100.00%
▷ Final classes00.00%
Methods27
▷ Static methods518.52%
▷ Public methods2696.30%
▷ Protected methods00.00%
▷ Private methods13.70%
Functions26
▷ Named functions26100.00%
▷ Anonymous functions00.00%
Constants8
▷ Global constants675.00%
▷ Class constants225.00%
▷ Public constants2100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
3 PNG files occupy 0.01MB with 0.00MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
js/hv.png2.80KB7.32KB0.00%
admin/announcement.png3.91KB1.25KB▼ 68.01%
js/hs.png2.62KB7.54KB0.00%