74% embed-office-viewer

Code Review | Document Viewer for Office

WordPress plugin Document Viewer for Office scored74%from 54 tests.

About plugin

  • Plugin page: embed-office-viewer
  • Plugin version: 2.2.8
  • PHP compatiblity: 7.1+
  • PHP version: 7.4.16
  • WordPress version: 6.3.1
  • First release: Nov 13, 2019
  • Latest release: Oct 14, 2023
  • Number of updates: 66
  • Update frequency: every 21.7 days
  • Top authors: shehabulislam (54.55%)abuhayat (46.97%)

Code review

54 tests

User reviews

52 reviews

Install metrics

2,000+ active /31,211 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
Installer ran successfully

Server metrics [RAM: ▲3.98MB] [CPU: ▲20.31ms] Passed 4 tests

Analyzing server-side resources used by Document Viewer for Office
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /7.80 ▲4.3358.31 ▲16.32
Dashboard /wp-admin7.82 ▲4.5171.92 ▲20.99
Posts /wp-admin/edit.php7.82 ▲4.4671.35 ▲21.33
Add New Post /wp-admin/post-new.php8.48 ▲2.60128.92 ▲22.59
Media Library /wp-admin/upload.php7.82 ▲4.5968.88 ▲30.76
Freemius Debug [v.2.5.10] /wp-admin/admin.php?page=freemius7.8255.67

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

Analyzing filesystem and database footprints of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 364 new files
Database: no new tables, 9 new options
New WordPress options
theysaidso_admin_options
widget_recent-comments
widget_recent-posts
fs_active_plugins
fs_accounts
db_upgraded
widget_theysaidso_widget
can_compress_scripts
fs_debug_mode

Browser metrics Passed 4 tests

A check of browser resources used by Document Viewer for Office
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,851 ▲6514.23 ▼0.051.99 ▼0.0529.01 ▼14.53
Dashboard /wp-admin2,215 ▲415.68 ▼0.0485.86 ▼2.9380.40 ▲32.44
Posts /wp-admin/edit.php2,161 ▲612.31 ▲0.3637.50 ▼4.2535.21 ▼5.79
Add New Post /wp-admin/post-new.php1,554 ▲2823.11 ▲0.00643.17 ▼11.7234.45 ▼18.96
Media Library /wp-admin/upload.php1,450 ▲504.39 ▲0.17101.54 ▼1.4472.84 ▲26.33
Freemius Debug [v.2.5.10] /wp-admin/admin.php?page=freemius1,1331.9527.1427.89

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
  • The plugin did not uninstall gracefully
    • > Notice in wp-content/plugins/embed-office-viewer/freemius/includes/class-freemius.php+8486
    Undefined property: stdClass::$plugins
  • Zombie WordPress options detected upon uninstall: 9 options
    • widget_recent-posts
    • fs_debug_mode
    • fs_active_plugins
    • theysaidso_admin_options
    • can_compress_scripts
    • db_upgraded
    • fs_accounts
    • widget_theysaidso_widget
    • widget_recent-comments

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Good news, no errors were detected

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Please fix the following items
  • 11× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/embed-office-viewer/admin/global/free-plugin-list.php on line 2
    • > PHP Fatal error
      require_once(): Failed opening required 'ABSPATHwp-admin/includes/plugin-install.php' (include_path='.:/usr/share/php') in wp-content/plugins/embed-office-viewer/admin/global/free-plugin-list.php on line 2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function EOV\\PostType\\add_action() in wp-content/plugins/embed-office-viewer/inc/PostType/OfficeViewer.php:9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function EOV\\PostType\\add_action() in wp-content/plugins/embed-office-viewer/inc/PostType/OfficeViewer.php:9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_site_url() in wp-content/plugins/embed-office-viewer/admin/codestar-framework/metabox-free.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/embed-office-viewer/admin/global/help-usages.php:6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/embed-office-viewer/embed-office-viewer.php:14
    • > PHP Fatal error
      Uncaught Error: Access to undeclared static property: EOV\\Model\\GlobalChanges::$_instaance in wp-content/plugins/embed-office-viewer/inc/Model/GlobalChanges.php:13
    • > PHP Warning
      require_once(ABSPATHwp-admin/includes/plugin-install.php): failed to open stream: No such file or directory in wp-content/plugins/embed-office-viewer/admin/global/free-plugin-list.php on line 2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function EOV\\Services\\add_shortcode() in wp-content/plugins/embed-office-viewer/inc/Services/Shortcode.php:9

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser errors were detected

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
4 plugin tags: ms word, embed document, pdf, document viewer

embed-office-viewer/embed-office-viewer.php 92% from 13 tests

"Document Viewer for Office" version 2.2.8's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
Please take the time to fix the following:
  • Text Domain: Since WordPress version 4.6 the text domain is optional; if specified, it must be the same as the plugin slug

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
Success! There were no dangerous files found in this plugin68,315 lines of code in 294 files:
LanguageFilesBlank linesComment linesLines of code
PHP22111,45118,74448,258
PO File203,0373,4146,180
Sass1595234,811
CSS202864794,465
JavaScript151,3134844,385
Markdown1680214
SVG2002

PHP code 50% from 2 tests

A short review of cyclomatic complexity and code structure
These items need your attention
  • Class cyclomatic complexity has to be reduced to less than 1000 (currently 3,073)
Cyclomatic complexity
Average complexity per logical line of code0.63
Average class complexity50.95
▷ Minimum class complexity1.00
▷ Maximum class complexity3,073.00
Average method complexity4.91
▷ Minimum method complexity1.00
▷ Maximum method complexity94.00
Code structure
Namespaces4
Interfaces0
Traits0
Classes119
▷ Abstract classes43.36%
▷ Concrete classes11596.64%
▷ Final classes00.00%
Methods1,550
▷ Static methods25916.71%
▷ Public methods1,16174.90%
▷ Protected methods171.10%
▷ Private methods37224.00%
Functions130
▷ Named functions130100.00%
▷ Anonymous functions00.00%
Constants148
▷ Global constants10168.24%
▷ Class constants4731.76%
▷ Public constants47100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
5 PNG files occupy 0.02MB with 0.01MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/skydrive.png0.54KB0.53KB▼ 2.00%
freemius/assets/img/theme-icon.png10.97KB5.78KB▼ 47.37%
img/icon.png1.59KB0.72KB▼ 54.62%
freemius/assets/img/plugin-icon.png9.16KB5.26KB▼ 42.58%
admin/codestar-framework/assets/images/checkerboard.png2.29KB2.54KB0.00%