10% cairn

Code Review | Cairn

WordPress plugin Cairn scored10%from 54 tests.

About plugin

  • Plugin page: cairn
  • Plugin version: 0.1.5
  • PHP version: 7.4.16
  • WordPress compatibility: 3.8-3.9
  • WordPress version: 6.3.1
  • First release: Jan 2, 2014
  • Latest release: Apr 16, 2014
  • Number of updates: 17
  • Update frequency: every 6.1 days
  • Top authors: braydonf (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /1,286 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
Please fix the following installer errors
  • This plugin did not install gracefully
    • > Deprecated in wp-content/plugins/cairn/includes/gpg/globals.php+219
    Methods with the same name as their class will not be constructors in a future version of PHP; bdiv has a deprecated constructor

Server metrics [RAM: ▲0.04MB] [CPU: ▼3.22ms] Passed 4 tests

This is a short check of server-side resources used by Cairn
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.23 ▼0.2344.15 ▲0.84
Dashboard /wp-admin3.59 ▲0.2960.85 ▲6.17
Posts /wp-admin/edit.php3.61 ▲0.2656.82 ▲3.08
Add New Post /wp-admin/post-new.php5.74 ▼0.1480.09 ▼22.98
Media Library /wp-admin/upload.php3.51 ▲0.2846.03 ▲8.11

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

Input-output and database impact of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 238 new files
Database: 3 new tables, 7 new options
New tables
wp_posts_set_btc_addresses
wp_posts_set_relationships
wp_posts_set
New WordPress options
widget_recent-posts
can_compress_scripts
widget_theysaidso_widget
bitcoin_exchange_rates
widget_recent-comments
db_upgraded
theysaidso_admin_options

Browser metrics Passed 4 tests

This is an overview of browser requirements for Cairn
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,578 ▼16814.25 ▼0.0228.85 ▲26.993.66 ▼38.56
Dashboard /wp-admin2,221 ▲445.67 ▲0.0198.79 ▲9.1942.95 ▼3.74
Posts /wp-admin/edit.php2,123 ▲202.08 ▲0.1237.66 ▼5.5337.06 ▼2.21
Add New Post /wp-admin/post-new.php1,830 ▲29321.26 ▲2.91646.18 ▲5.1673.88 ▲6.80
Media Library /wp-admin/upload.php1,423 ▲294.30 ▲0.13111.22 ▲10.6954.33 ▲7.58

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
You still need to fix the following
  • Zombie tables detected upon uninstall: 3 tables
    • wp_posts_set_relationships
    • wp_posts_set
    • wp_posts_set_btc_addresses
  • This plugin did not uninstall successfully, leaving 7 options in the database
    • widget_recent-posts
    • can_compress_scripts
    • theysaidso_admin_options
    • db_upgraded
    • widget_recent-comments
    • widget_theysaidso_widget
    • bitcoin_exchange_rates

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though everything seems fine, this is not an exhaustive test

SRP 0% 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 take a closer look at the following
  • 3× PHP files output text when accessed directly:
    • > /wp-content/plugins/cairn/includes/phpqrcode/index.php
    • > /wp-content/plugins/cairn/includes/stripe/test/Stripe.php
    • > /wp-content/plugins/cairn/views/404.php
  • 112× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/cairn/views/fineart.php on line 15
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/cairn/views/post.php on line 9
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/cairn/views/fineart.php on line 20
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/cairn/views/fineart.php on line 15
    • > PHP Fatal error
      Uncaught Error: Class 'StripeTestCase' not found in wp-content/plugins/cairn/includes/stripe/test/Stripe/BalanceTransactionTest.php:3
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/cairn/views/fineart.php on line 15
    • > PHP Warning
      file_put_contents(wp-content/plugins/cairn/includes/phpqrcode/cache/mask_2/mask_21_2.dat): failed to open stream: No such file or directory in /var/www/wordpress/wp-content/plugins/cairn/includes/phpqrcode/qrmask.php on line 155
    • > PHP Warning
      Invalid argument supplied for foreach() in wp-content/plugins/cairn/views/portfolio.php on line 14
    • > PHP Fatal error
      Uncaught Error: Class 'StripeTestCase' not found in wp-content/plugins/cairn/includes/stripe/test/Stripe/InvoiceTest.php:3
    • > PHP Notice
      Undefined variable: item in wp-content/plugins/cairn/views/fineart.php on line 20

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
No browser errors were detected

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
These attributes need your attention:
  • Tags: Please reduce the number of tags, currently 24 tag instead of maximum 10
Please take inspiration from this readme.txt

cairn/cairn.php Passed 13 tests

"Cairn" version 0.1.5's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
29 characters long description:
Art Exhibition Gallery & Shop

Code Analysis 5% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
Please fix the following items
  • Do not include executable or dangerous files in your plugin
    • .crt - Security Certificate in Firefox, IE, Chrome, Safari
      • wp-content/plugins/cairn/includes/stripe/lib/data/ca-certificates.crt
    • .bat - Batch File in Windows
      • wp-content/plugins/cairn/includes/phpqrcode/tools/merge.bat
43,503 lines of code in 171 files:
LanguageFilesBlank linesComment linesLines of code
SVG100018,307
PHP1174,4694,08417,269
JavaScript131,0879423,601
CSS49832,675
EJS2133501,374
JSON210257
YAML1309
Markdown1307
Bourne Shell1002
DOS Batch1002

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.31
Average class complexity22.65
▷ Minimum class complexity1.00
▷ Maximum class complexity292.00
Average method complexity3.97
▷ Minimum method complexity1.00
▷ Maximum method complexity65.00
Code structure
Namespaces0
Interfaces6
Traits0
Classes113
▷ Abstract classes54.42%
▷ Concrete classes10895.58%
▷ Final classes00.00%
Methods908
▷ Static methods43748.13%
▷ Public methods75683.26%
▷ Protected methods13815.20%
▷ Private methods141.54%
Functions13
▷ Named functions13100.00%
▷ Anonymous functions00.00%
Constants152
▷ Global constants15199.34%
▷ Class constants10.66%
▷ Public constants1100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
19 PNG files occupy 0.06MB with 0.01MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
static/images/creative_commons_icons.png8.64KB5.35KB▼ 38.08%
static/images/secure_inv.png0.25KB0.31KB0.00%
static/images/play-buttons-pair.png10.16KB4.38KB▼ 56.88%
static/images/info.png0.70KB0.70KB0.00%
static/images/portfolio_icon_hover.png0.68KB0.60KB▼ 11.35%