10% ebook-store

Code Review | Ebook Store

WordPress plugin Ebook Store scored10%from 54 tests.

About plugin

  • Plugin page: ebook-store
  • Plugin version: 5.788
  • PHP version: 7.4.16
  • WordPress compatibility: 3.5.1-6.4.1
  • WordPress version: 6.3.1
  • First release: Mar 12, 2014
  • Latest release: Nov 21, 2023
  • Number of updates: 340
  • Update frequency: every 10.4 days
  • Top authors: motov.net (100%)

Code review

54 tests

User reviews

55 reviews

Install metrics

1,000+ active /125,866 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
You still need to fix the following installer errors
  • Install procedure had errors
    • > Notice in wp-content/plugins/ebook-store/ebook_store.php+62
    Undefined index: do

Server metrics [RAM: ▼1.79MB] [CPU: ▼52.72ms] Passed 4 tests

Server-side resources used by Ebook Store
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /2.20 ▼1.264.34 ▼37.31
Dashboard /wp-admin2.23 ▼1.087.90 ▼43.66
Posts /wp-admin/edit.php2.23 ▼1.146.38 ▼42.46
Add New Post /wp-admin/post-new.php2.23 ▼3.679.15 ▼87.46
Media Library /wp-admin/upload.php2.23 ▼1.016.36 ▼28.61
Publishers /wp-admin/edit.php?post_type=ebook_publisher2.236.52
Ebooks /wp-admin/edit.php?post_type=ebook2.238.13
Add New Ebook /wp-admin/post-new.php?post_type=ebook2.236.25
Ebook Categories /wp-admin/edit-tags.php?taxonomy=ebook_category&post_type=ebook2.237.05
Authors /wp-admin/edit.php?post_type=ebook_author2.236.15
Orders /wp-admin/edit.php?post_type=ebook_order2.236.75
Orders - Reports /wp-admin/edit.php?post_type=ebook&page=ebook-store-order_reports2.236.73
Settings /wp-admin/edit.php?post_type=ebook&page=settings-page2.237.36
Orders - New Issue /wp-admin/edit.php?post_type=ebook&page=ebook-store-add-issue-page2.236.48

Server storage [IO: ▲6.56MB] [DB: ▲0.01MB] Passed 3 tests

A short overview of filesystem and database impact
This plugin was installed successfully
Filesystem: 505 new files
Database: no new tables, 6 new options
New WordPress options
widget_theysaidso_widget
widget_recent-comments
can_compress_scripts
theysaidso_admin_options
db_upgraded
widget_recent-posts

Browser metrics Passed 4 tests

Checking browser requirements for Ebook Store
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,996 ▲24514.22 ▼0.131.82 ▲0.0839.21 ▼4.83
Dashboard /wp-admin2,379 ▲2025.60 ▼0.0392.38 ▼8.5246.05 ▼1.35
Posts /wp-admin/edit.php2,274 ▲1742.12 ▲0.1541.72 ▼0.3338.77 ▲2.41
Add New Post /wp-admin/post-new.php6,331 ▲4,80526.01 ▲2.62840.72 ▲169.2063.73 ▲8.47
Media Library /wp-admin/upload.php1,569 ▲1754.24 ▲0.0798.83 ▼2.4246.52 ▲0.37
Publishers /wp-admin/edit.php?post_type=ebook_publisher1,2792.1236.5034.46
Ebooks /wp-admin/edit.php?post_type=ebook1,3022.0637.3836.93
Add New Ebook /wp-admin/post-new.php?post_type=ebook3,0668.07188.00160.39
Ebook Categories /wp-admin/edit-tags.php?taxonomy=ebook_category&post_type=ebook1,4462.2730.7936.62
Authors /wp-admin/edit.php?post_type=ebook_author1,2792.1337.8532.33
Ebook Store /wp-admin/ebook_options.php260.410.0811.89
Orders /wp-admin/edit.php?post_type=ebook_order1,3172.1338.1832.23
Orders - Reports /wp-admin/edit.php?post_type=ebook&page=ebook-store-order_reports1,5065.5342.6467.61
Settings /wp-admin/edit.php?post_type=ebook&page=settings-page3,6154.0387.5359.97
Orders - New Issue /wp-admin/edit.php?post_type=ebook&page=ebook-store-add-issue-page1,0202.0422.6526.36

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
These items require your attention
  • Uninstall procedure had uncaught errors
    • > Notice in wp-content/plugins/ebook-store/ebook_store.php+62
    Undefined index: do
  • Zombie WordPress options were found after uninstall: 6 options
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-comments
    • db_upgraded
    • widget_theysaidso_widget
    • widget_recent-posts

Smoke tests 0% 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
  • 14 occurences, only the last one shown
    • > GET request to /wp-admin/edit.php?post_type=ebook&page=ebook-store-add-issue-page
    • > Notice in wp-content/plugins/ebook-store/ebook_store.php+62
    Undefined index: do
  • 14 occurences, only the last one shown
    • > GET request to /wp-admin/edit.php?post_type=ebook&page=ebook-store-add-issue-page
    • > Notice in wp-content/plugins/ebook-store/ebook_store.php+221
    Undefined index: post_type
  • 43 occurences, only the last one shown
    • > GET request to /wp-admin/edit.php?post_type=ebook&page=ebook-store-add-issue-page
    • > Notice in wp-content/plugins/ebook-store/ebook_store.php+75
    Undefined index: task
  • 14 occurences, only the last one shown
    • > GET request to /wp-admin/edit.php?post_type=ebook&page=ebook-store-add-issue-page
    • > Notice in wp-content/plugins/ebook-store/functions.php+1633
    Undefined index: wc_order
  • 14 occurences, only the last one shown
    • > GET request to /wp-admin/edit.php?post_type=ebook&page=ebook-store-add-issue-page
    • > Notice in wp-content/plugins/ebook-store/functions.php+1636
    Undefined index: ebook_key
  • 45 occurences, only the last one shown
    • > GET request to /wp-admin/edit.php?post_type=ebook&page=ebook-store-add-issue-page
    • > Notice in wp-content/plugins/ebook-store/ebook_store_add_issue_page_callback.php+3
    Undefined index: action
  • 15 occurences, only the last one shown
    • > GET request to /wp-admin/edit.php?post_type=ebook&page=ebook-store-add-issue-page
    • > Notice in wp-content/plugins/ebook-store/functions.php+3419
    Undefined index: export
  • 14 occurences, only the last one shown
    • > GET request to /wp-admin/edit.php?post_type=ebook&page=ebook-store-add-issue-page
    • > Notice in wp-content/plugins/ebook-store/functions.php+3197
    Undefined index: woocommerce_product_id
    • > GET request to /wp-admin/post-new.php?post_type=ebook
    • > Notice in wp-content/plugins/ebook-store/functions.php+226
    Undefined index: ebook_order_nonce
    • > GET request to /wp-admin/post-new.php?post_type=ebook
    • > Notice in wp-content/plugins/ebook-store/functions.php+343
    Undefined variable: html
    • > GET request to /wp-admin/post-new.php?post_type=ebook
    • > Notice in wp-content/plugins/ebook-store/functions.php+389
    Undefined variable: paypal_currency
  • 5 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=ebook
    • > Notice in wp-content/plugins/ebook-store/functions.php+421
    Undefined index: url
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=ebook
    • > Notice in wp-content/plugins/ebook-store/functions.php+430
    Undefined index: ebook_price
    • > GET request to /wp-admin/post-new.php?post_type=ebook
    • > Notice in wp-content/plugins/ebook-store/EbookStoreEbook.class.php+16
    Undefined index: file
  • 8 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=ebook
    • > Notice in wp-content/plugins/ebook-store/EbookStoreEbook.class.php+62
    String offset cast occurred
    • > GET request to /wp-admin/post-new.php?post_type=ebook
    • > Notice in wp-content/plugins/ebook-store/EbookStoreEbook.class.php+19
    Undefined index: type
    • > GET request to /wp-admin/post-new.php?post_type=ebook
    • > Notice in wp-content/plugins/ebook-store/EbookStoreEbook.class.php+22
    Undefined index: ebook_wp_custom_attachment
    • > GET request to /wp-admin/post-new.php?post_type=ebook
    • > Notice in wp-content/plugins/ebook-store/EbookStoreEbook.class.php+34
    Undefined index: ebook_wp_custom_attachment_mobi
    • > GET request to /wp-admin/post-new.php?post_type=ebook
    • > Notice in wp-content/plugins/ebook-store/EbookStoreEbook.class.php+34
    Undefined index: ebook_wp_custom_attachment_epub
    • > GET request to /wp-admin/post-new.php?post_type=ebook
    • > Notice in wp-content/plugins/ebook-store/EbookStoreEbook.class.php+34
    Undefined index: ebook_wp_custom_attachment_txt
    • > GET request to /wp-admin/post-new.php?post_type=ebook
    • > Notice in wp-content/plugins/ebook-store/EbookStoreEbook.class.php+34
    Undefined index: ebook_wp_custom_attachment_zip
    • > GET request to /wp-admin/post-new.php?post_type=ebook
    • > Notice in wp-content/plugins/ebook-store/EbookStoreEbook.class.php+34
    Undefined index: ebook_wp_custom_attachment_mp3
    • > GET request to /wp-admin/post-new.php?post_type=ebook
    • > Notice in wp-content/plugins/ebook-store/EbookStoreEbook.class.php+34
    Undefined index: ebook_wp_custom_attachment_mp4
    • > GET request to /wp-admin/post-new.php?post_type=ebook
    • > Notice in wp-content/plugins/ebook-store/functions.php+3533
    Undefined property: EbookStoreEbook::$formats
    • > GET request to /wp-admin/post-new.php?post_type=ebook
    • > Notice in wp-content/plugins/ebook-store/functions.php+3544
    Undefined variable: i
  • 7 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=ebook
    • > Notice in wp-content/plugins/ebook-store/functions.php+3551
    Undefined property: EbookStoreEbook::$files
  • 7 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=ebook
    • > Notice in wp-content/plugins/ebook-store/functions.php+3551
    Trying to access array offset on value of type null
    • > GET request to /wp-admin/post-new.php?post_type=ebook
    • > Notice in wp-content/plugins/ebook-store/functions.php+426
    Undefined variable: ebook_authors
    • > GET request to /wp-admin/post-new.php?post_type=ebook
    • > Notice in wp-content/plugins/ebook-store/functions.php+433
    Undefined variable: ebook_publishers
    • > GET request to /wp-admin/post-new.php?post_type=ebook
    • > Notice in wp-content/plugins/ebook-store/functions.php+435
    Undefined index: ebook_date
    • > GET request to /wp-admin/post-new.php?post_type=ebook
    • > Notice in wp-content/plugins/ebook-store/functions.php+436
    Undefined index: ebook_pages
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=ebook
    • > Notice in wp-content/plugins/ebook-store/functions.php+458
    Undefined index: donate_or_download
    • > GET request to /wp-admin/edit.php?post_type=ebook&page=settings-page
    • > Notice in wp-content/plugins/ebook-store/ebook_options.php+127
    Undefined variable: task
    • > GET request to /wp-admin/edit.php?post_type=ebook&page=settings-page
    • > Notice in wp-content/plugins/ebook-store/ebook_options.php+229
    Undefined index: tab

SRP 0% 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
The following issues need your attention
  • 17× PHP files output non-empty strings when accessed directly via GET requests (only 10 are shown):
    • > /wp-content/plugins/ebook-store/fpdi/FPDF-master/tutorial/tuto7.php
    • > /wp-content/plugins/ebook-store/fpdi/fpdi-protection-master/local-tests/simple.php
    • > /wp-content/plugins/ebook-store/fpdi/FPDF-master/tutorial/tuto3.php
    • > /wp-content/plugins/ebook-store/fpdi/FPDF-master/tutorial/makefont.php
    • > /wp-content/plugins/ebook-store/fpdi/FPDF-master/tutorial/tuto6.php
    • > /wp-content/plugins/ebook-store/fpdi/FPDF-master/tutorial/tuto5.php
    • > /wp-content/plugins/ebook-store/fpdi/tutorial/tuto3.php
    • > /wp-content/plugins/ebook-store/fpdi/tutorial/makefont.php
    • > /wp-content/plugins/ebook-store/fpdi/tutorial/tuto6.php
    • > /wp-content/plugins/ebook-store/fpdi/tutorial/tuto1.php
  • 69× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'FPDF' not found in wp-content/plugins/ebook-store/fpdi/FPDI-master/src/FpdfTpl.php:18
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_header() in wp-content/plugins/ebook-store/archive-ebook.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function settings_fields() in wp-content/plugins/ebook-store/settings-MailChimp.php:1
    • > PHP Fatal error
      Uncaught Error: Class 'setasign\\Fpdi\\PdfParser\\Type\\PdfType' not found in wp-content/plugins/ebook-store/fpdi/FPDI-master/src/PdfParser/Type/PdfString.php:18
    • > PHP Fatal error
      Uncaught Error: Class 'setasign\\Fpdi\\PdfParser\\PdfParserException' not found in wp-content/plugins/ebook-store/fpdi/FPDI-master/src/PdfParser/Type/PdfTypeException.php:18
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/ebook-store/fpdi/fpdi-protection-master/tests/functional/FpdiProtectionTest.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'setasign\\Fpdi\\PdfParser\\Type\\PdfType' not found in wp-content/plugins/ebook-store/fpdi/FPDI-master/src/PdfParser/Type/PdfDictionary.php:20
    • > PHP Fatal error
      require_once(): Failed opening required 'fpdf_tpl.php' (include_path='.:/usr/share/php') in wp-content/plugins/ebook-store/includes/fpdi/fpdi.php on line 27
    • > PHP Fatal error
      Uncaught Error: Class 'setasign\\Fpdi\\PdfParser\\Type\\PdfType' not found in wp-content/plugins/ebook-store/fpdi/FPDI-master/src/PdfParser/Type/PdfNumeric.php:16
    • > PHP Fatal error
      Uncaught Error: Call to undefined function settings_fields() in wp-content/plugins/ebook-store/settings-General.php:1

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/ebook_options.php
    • > Network (severe)
    wp-admin/ebook_options.php - Failed to load resource: the server responded with a status of 404 (Not Found)
    • > GET request to /wp-admin/edit.php?post_type=ebook&page=settings-page
    • > Console-api (warning) in unknown
    https://v2.zopim.com/w?pJJOUNrd3F2XicGCyKN5BGmHdzK4VVuA 1795:56 "The Zopim widget embed code is invalid. Please email chat@zendesk.com with your account key: pJJOUNrd3F2XicGCyKN5BGmHdzK4VVuA"

Optimizations

Plugin configuration 87% from 29 tests

readme.txt 88% from 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
These attributes need your attention:
  • Screenshots: Please add images for these screenshots: #4 (The Add New Order screen. If encryption is enabled, the files will also be delivered encrypted. Email with the files and/or links is also sent.), #5 (PayPal email for receiving payments, WP Affiliates and WooCommerce integration enabler.), #6 (PayPal return to merchant text, currency select and font size settings for the ebook order form.), #7 (License key field and PDF encryption settings for encryption, random password, blank password ability (still encrypted), login email as pdf password feature, PDF master password feature.), #8 (Disable PDF printing, modification, annotation forms, QR code watermarking with transaction / buyer data, buyer info watermark on each page feature. Ability to fill a form upon each order that you can design and add fields as you wish. Ability to require @kindle email for the email delivery mail to be sent directly to the buyer's device.), #9 (Mailchimp integration feature via API key. Link expiration setting and download limit. Email delivery and Attach files feature settings. This way the customer receives email with the files attached or just download links depending on configuration. Optional VAT settings.), #10 (Thank you page template editor, you can redesign it as desired.), #11 (Email delivery email editor, it can be customized/transated to meet your needs.), #12 (The form for the "Fill a form upon order" feature. You can customize the html code and add more fields.), #13 (WooCommerce integration, adding ebook store product type, ability to select which ebook to be delivered with it's additional formats. PDF file can be encrpyted.), #14 (WooCommerce download table for the ebook(s) in the cart. Users can buy multiple ebooks with WooCommerce shopping cart and Ebook Store plugin.)
  • Tags: Please delete some tags, you are using 28 tag instead of maximum 10
You can look at the official readme.txt

ebook-store/ebook_store.php 85% from 13 tests

The principal PHP file in "Ebook Store" v. 5.788 is loaded by WordPress automatically on each request
You should first fix the following items:
  • Description: Please don't use more than 140 characters for the plugin description (currently 590 characters long)
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("ebook-store.php" instead of "ebook_store.php")

Code Analysis 5% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
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/ebook-store/payment_gateways/paypal/cert/api_cert_chain.crt
84,840 lines of code in 290 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript183,7053,64043,533
PHP1553,8978,17120,255
SVG19351812,733
HTML65117234,002
PO File48178322,181
CSS13253791,258
JSON700453
Markdown71210362
YAML110043
XML13720

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.34
Average class complexity12.33
▷ Minimum class complexity1.00
▷ Maximum class complexity339.00
Average method complexity3.71
▷ Minimum method complexity1.00
▷ Maximum method complexity46.00
Code structure
Namespaces11
Interfaces2
Traits2
Classes205
▷ Abstract classes20.98%
▷ Concrete classes20399.02%
▷ Final classes00.00%
Methods871
▷ Static methods384.36%
▷ Public methods71582.09%
▷ Protected methods15217.45%
▷ Private methods40.46%
Functions166
▷ Named functions16096.39%
▷ Anonymous functions63.61%
Constants91
▷ Global constants3032.97%
▷ Class constants6167.03%
▷ Public constants61100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
40 compressed PNG files occupy 0.50MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
includes/ViewerJS/images/toolbarButton-download.png0.50KB0.59KB0.00%
includes/ViewerJS/images/nlnet.png5.27KB3.96KB▼ 24.81%
img/zip.png1.56KB1.48KB▼ 5.14%
fpdi/tutorial/logo.png2.32KB2.26KB▼ 2.57%
img/yt-gray.png73.07KB73.28KB0.00%