10% ultimate-amp

Code Review | Ultimate AMP - WordPress AMP Plugin

WordPress plugin Ultimate AMP - WordPress AMP Plugin scored10%from 54 tests.

About plugin

  • Plugin page: ultimate-amp
  • Plugin version: 1.2.4
  • PHP compatiblity: 5.3+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-5.6
  • WordPress version: 6.3.1
  • First release: Jul 30, 2018
  • Latest release: Nov 26, 2020
  • Number of updates: 18
  • Update frequency: every 47.3 days
  • Top authors: Litonice13 (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /1,537 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
The following installer errors require your attention
  • The plugin cannot be installed
    • > Notice in wp-content/plugins/ultimate-amp/ultimate-amp.php+851
    Trying to access array offset on value of type null

Server metrics [RAM: ▼1.67MB] [CPU: ▼52.48ms] Passed 4 tests

Analyzing server-side resources used by Ultimate AMP - WordPress AMP Plugin
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /2.32 ▼1.158.18 ▼31.60
Dashboard /wp-admin2.34 ▼0.979.12 ▼41.75
Posts /wp-admin/edit.php2.34 ▼1.029.04 ▼42.00
Add New Post /wp-admin/post-new.php2.34 ▼3.559.43 ▼94.56
Media Library /wp-admin/upload.php2.34 ▼0.898.50 ▼23.46
Redux Framework /wp-admin/tools.php?page=redux-about2.348.44
Templates /wp-admin/admin.php?page=uamp_options&tab=52.349.10
Socials /wp-admin/admin.php?page=uamp_options&tab=82.347.63
Welcome to Ultimate AMP /wp-admin/index.php?page=uamp-welcome-page2.348.65
AMP /wp-admin/customize.php?autofocus[panel]=amp_panel&url&return=http%3A%2F%2Fwp.com%2Fwp-admin%2F2.378.68
Global Settings /wp-admin/admin.php?page=uamp_options&tab=12.347.85

Server storage [IO: ▲5.63MB] [DB: ▲0.08MB] Passed 3 tests

Analyzing filesystem and database footprints of this plugin
The plugin installed successfully
Filesystem: 589 new files
Database: no new tables, 9 new options
New WordPress options
redux_version_upgraded_from
widget_recent-comments
uamp_options-transients
db_upgraded
uamp_options
widget_theysaidso_widget
widget_recent-posts
theysaidso_admin_options
can_compress_scripts

Browser metrics Passed 4 tests

Ultimate AMP - WordPress AMP Plugin: an overview of browser usage
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,894 ▲10814.41 ▲0.132.09 ▲0.1842.10 ▼2.79
Dashboard /wp-admin2,299 ▲1255.58 ▲0.01108.67 ▲5.7878.18 ▲38.67
Posts /wp-admin/edit.php2,145 ▲421.98 ▲0.0438.04 ▲1.3429.12 ▼8.14
Add New Post /wp-admin/post-new.php1,560 ▲3223.41 ▲0.28791.87 ▲195.3266.97 ▲6.31
Media Library /wp-admin/upload.php1,445 ▲454.19 ▼0.03101.83 ▼3.55103.59 ▲60.47
Redux Framework /wp-admin/tools.php?page=redux-about1,1213.4579.7270.31
Templates /wp-admin/admin.php?page=uamp_options&tab=51,7094.5092.7993.08
Socials /wp-admin/admin.php?page=uamp_options&tab=81,6453.9176.98109.45
Welcome to Ultimate AMP /wp-admin/index.php?page=uamp-welcome-page8441.9923.7527.51
AMP /wp-admin/customize.php?autofocus[panel]=amp_panel&url&return=http%3A%2F%2Fwp.com%2Fwp-admin%2F7,85522.48577.41122.43
Global Settings /wp-admin/admin.php?page=uamp_options&tab=11,7504.91104.44102.03

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
Please fix the following items
  • This plugin did not uninstall without warnings or errors
    • > Notice in wp-content/plugins/ultimate-amp/ultimate-amp.php+851
    Trying to access array offset on value of type null
  • Zombie WordPress options were found after uninstall: 9 options
    • theysaidso_admin_options
    • widget_recent-comments
    • db_upgraded
    • uamp_options
    • widget_theysaidso_widget
    • uamp_options-transients
    • widget_recent-posts
    • can_compress_scripts
    • redux_version_upgraded_from

Smoke tests 0% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Please fix the following server-side errors
  • 11 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=uamp_options&tab=1
    • > Notice in wp-content/plugins/ultimate-amp/ultimate-amp.php+851
    Trying to access array offset on value of type null
  • 16 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=uamp_options&tab=1
    • > Notice in wp-content/plugins/ultimate-amp/ultimate-amp.php+758
    Undefined index: uamp_endpoint
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=uamp_options&tab=1
    • > Error in wp-includes/Requests/src/Exception/InvalidArgument.php+29
    Uncaught WpOrg\Requests\Exception\InvalidArgument: WpOrg\Requests\Cookie::__construct(): Argument #1 ($name) must be of type string, integer given in wp-includes/Requests/src/Exception/InvalidArgument.php:29
    Stack trace:
    #0 wp-includes/Requests/src/Cookie.php(84): WpOrg\Requests\Exception\InvalidArgument::create()
    #1 wp-includes/class-wp-http.php(472): WpOrg\Requests\Cookie->__construct()
    #2 wp-includes/class-wp-http.php(352): WP_Http::normalize_cookies()
    #3 wp-includes/http.php(150): WP_Http->request()
    #4 wp-content/plugins/ultimate-amp/inc/admin/redux-core/inc/class.p.php(230): wp_remote_request()
    #5 wp-includes/class-wp-hook.php(310): Redux_P->proxy()
    #6 wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters()
    #7 wp-includes/plugin.php(517): WP_Hook->do_action()
    #8 wp-admin/admin-ajax.php(188): do_action()
    #9 {main}

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
Almost there! Just fix the following items
  • 2× PHP files output text when accessed directly:
    • > /wp-content/plugins/ultimate-amp/templates/template-one/inc/page.php
    • > /wp-content/plugins/ultimate-amp/templates/template-one/404.php
  • 126× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/ultimate-amp/inc/admin/redux-core/inc/fields/select/elusive-icons.php:312
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/ultimate-amp/lib/vendor/amp/amp.php:210
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Customize_Section' not found in wp-content/plugins/ultimate-amp/inc/admin/redux-core/inc/extensions/customizer/inc/customizer_devs.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'AMP_Base_Sanitizer' not found in wp-content/plugins/ultimate-amp/lib/vendor/amp/includes/sanitizers/class-amp-blacklist-sanitizer.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Customize_Section' not found in wp-content/plugins/ultimate-amp/inc/admin/redux-core/inc/extensions/customizer/inc/customizer_section.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'AMP_Base_Sanitizer' not found in wp-content/plugins/ultimate-amp/lib/vendor/amp/includes/sanitizers/class-amp-comments-sanitizer.php:13
    • > PHP Fatal error
      Uncaught Error: Call to undefined function post_class() in wp-content/plugins/ultimate-amp/templates/template-one/single-post.php:12
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/ultimate-amp/inc/admin/redux-core/inc/welcome/views/about.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html() in wp-content/plugins/ultimate-amp/inc/admin/redux-core/inc/welcome/views/extensions.php:64
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/ultimate-amp/inc/admin/redux-core/inc/welcome/views/support.php:2

User-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
These are user-side errors you should fix
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=uamp_options&tab=1
    • > Deprecation (warning) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,moxiejs,plupload&ver=6.3.1 1 Listener added for a synchronous 'DOMSubtreeModified' DOM Mutation Event. This event type is deprecated (https://w3c.github.io/uievents/#legacy-event-types) and work is underway to remove it from this browser. Usage of this event listener will cause performance issues today, and represents a risk of future incompatibility. Consider using MutationObserver instead.
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=uamp_options&tab=1
    • > Network (severe)
    wp-admin/admin-ajax.php?action=redux_p&nonce=6380fa19da&url=http%3A%2F%2Flook.redux.io%2Fapi%2Findex.php%3Fjs%26g%261%26v%3D2&proxy=http%3A%2F%2Fwp.com%2Fwp-admin%2Fadmin-ajax.php%3Faction%3Dredux_p%26nonce%3D6380fa19da%26url%3D - Failed to load resource: the server responded with a status of 500 (Internal Server Error)
    • > GET request to /wp-admin/admin.php?page=uamp_options&tab=5
    • > Security (severe) in unknown
    /wp-admin/admin.php?page=uamp_options&tab=5 - Refused to execute script from '/wp-admin/admin-ajax.php?action=redux_p&nonce=6380fa19da&url=http%3A%2F%2Flook.redux.io%2Fapi%2Findex.php%3Fjs%26g%261%26v%3D2&proxy=http%3A%2F%2Fwp.com%2Fwp-admin%2Fadmin-ajax.php%3Faction%3Dredux_p%26nonce%3D6380fa19da%26url%3D' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
    • > GET request to /wp-admin/admin.php?page=uamp_options&tab=8
    • > Security (severe) in unknown
    /wp-admin/admin.php?page=uamp_options&tab=8 - Refused to execute script from '/wp-admin/admin-ajax.php?action=redux_p&nonce=6380fa19da&url=http%3A%2F%2Flook.redux.io%2Fapi%2Findex.php%3Fjs%26g%261%26v%3D2&proxy=http%3A%2F%2Fwp.com%2Fwp-admin%2Fadmin-ajax.php%3Faction%3Dredux_p%26nonce%3D6380fa19da%26url%3D' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
    • > GET request to /wp-admin/customize.php?autofocus[panel]=amp_panel&url&return=http%3A%2F%2Fwp.com%2Fwp-admin%2F
    • > Network (severe)
    wp-content/plugins/ultimate-amp/assets/css/amp-customizer.css?ver=6.3.1 - Failed to load resource: the server responded with a status of 404 (Not Found)
    • > GET request to /wp-admin/customize.php?autofocus[panel]=amp_panel&url&return=http%3A%2F%2Fwp.com%2Fwp-admin%2F
    • > Network (severe)
    wp-content/plugins/ultimate-amp/assets/js/amp-customize-controls.js?ver=0.7.2 - Failed to load resource: the server responded with a status of 404 (Not Found)
    • > GET request to /wp-admin/customize.php?autofocus[panel]=amp_panel&url&return=http%3A%2F%2Fwp.com%2Fwp-admin%2F
    • > Javascript (severe) in unknown
    /wp-admin/customize.php?autofocus[panel]=amp_panel&url&return=http%3A%2F%2Fwp.com%2Fwp-admin%2F 1795:0 Uncaught ReferenceError: ampCustomizeControls is not defined
    • > GET request to /wp-admin/customize.php?autofocus[panel]=amp_panel&url&return=http%3A%2F%2Fwp.com%2Fwp-admin%2F
    • > Security (warning) in unknown
    /?customize_changeset_uuid=df000a7e-ce8b-4e4f-81a1-e18c0512eb05&customize_theme=twentytwentyone&customize_messenger_channel=preview-0 - An iframe which has both allow-scripts and allow-same-origin for its sandbox attribute can escape its sandboxing.
    • > GET request to /wp-admin/customize.php?autofocus[panel]=amp_panel&url&return=http%3A%2F%2Fwp.com%2Fwp-admin%2F
    • > Network (severe)
    wp-content/plugins/ultimate-amp/assets/js/amp-customize-preview.js?ver=0.7.2 - Failed to load resource: the server responded with a status of 404 (Not Found)
    • > GET request to /wp-admin/customize.php?autofocus[panel]=amp_panel&url&return=http%3A%2F%2Fwp.com%2Fwp-admin%2F
    • > Javascript (severe) in unknown
    /?customize_changeset_uuid=df000a7e-ce8b-4e4f-81a1-e18c0512eb05&customize_theme=twentytwentyone&customize_messenger_channel=preview-0 397:0 Uncaught ReferenceError: ampCustomizePreview is not defined
    • > GET request to /wp-admin/admin.php?page=uamp_options&tab=1
    • > Security (severe) in unknown
    /wp-admin/admin.php?page=uamp_options&tab=1 - Refused to execute script from '/wp-admin/admin-ajax.php?action=redux_p&nonce=6380fa19da&url=http%3A%2F%2Flook.redux.io%2Fapi%2Findex.php%3Fjs%26g%261%26v%3D2&proxy=http%3A%2F%2Fwp.com%2Fwp-admin%2Fadmin-ajax.php%3Faction%3Dredux_p%26nonce%3D6380fa19da%26url%3D' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% 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
Please fix the following attributes:
  • Screenshots: These screenshots require images: #1 (Ultimate AMP Menu), #2 (Home/Archive of Ultimate AMP), #3 (Single Post of Ultimate AMP)
You can look at the official readme.txt

ultimate-amp/ultimate-amp.php 92% from 13 tests

The entry point to "Ultimate AMP - WordPress AMP Plugin" version 1.2.4 is a PHP file that has certain tags in its header comment area
Please make the necessary changes and fix the following:
  • Text Domain: If you choose to specify the text domain, it must be the same as the plugin slug; optional since WordPress version 4.6

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
Success! There were no dangerous files found in this plugin66,376 lines of code in 452 files:
LanguageFilesBlank linesComment linesLines of code
PHP2528,21215,87844,130
JavaScript892,6612,11712,365
Sass541,186607,582
SVG400951
JSON11840909
CSS503449377
LESS10053
Markdown11109

PHP code 50% from 2 tests

Analyzing cyclomatic complexity and code structure
The following items need your attention
  • Please reduce cyclomatic complexity of methods to less than 100 (currently 113)
Cyclomatic complexity
Average complexity per logical line of code0.53
Average class complexity30.78
▷ Minimum class complexity1.00
▷ Maximum class complexity882.00
Average method complexity4.98
▷ Minimum method complexity1.00
▷ Maximum method complexity113.00
Code structure
Namespaces5
Interfaces1
Traits0
Classes198
▷ Abstract classes31.52%
▷ Concrete classes19598.48%
▷ Final classes00.00%
Methods1,495
▷ Static methods29019.40%
▷ Public methods1,14976.86%
▷ Protected methods19513.04%
▷ Private methods15110.10%
Functions152
▷ Named functions14092.11%
▷ Anonymous functions127.89%
Constants216
▷ Global constants4118.98%
▷ Class constants17581.02%
▷ Public constants175100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
36 PNG files occupy 0.66MB with 0.26MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
inc/admin/redux-core/assets/css/vendor/jquery-ui-bootstrap/images/ui-icons_ffffff_256x240.png4.27KB4.11KB▼ 3.78%
inc/admin/redux-core/assets/css/vendor/jquery-ui-bootstrap/images/ui-icons_2e83ff_256x240.png4.27KB4.11KB▼ 3.78%
inc/admin/redux-core/assets/img/1col.png2.83KB0.14KB▼ 95.13%
inc/admin/redux-core/assets/css/vendor/jquery-ui-bootstrap/images/ui-icons_222222_256x240.png4.27KB4.11KB▼ 3.78%
inc/admin/redux-core/assets/img/2cl.png2.91KB0.24KB▼ 91.79%