71% accelerated-mobile-pages

Code Review | AMP for WP - Accelerated Mobile Pages

WordPress plugin AMP for WP - Accelerated Mobile Pages scored71%from 54 tests.

About plugin

  • Plugin page: accelerated-mobil...
  • Plugin version: 1.0.92
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0-6.4.1
  • WordPress version: 6.3.1
  • First release: Feb 7, 2016
  • Latest release: Nov 18, 2023
  • Number of updates: 1,450
  • Update frequency: every 2.0 days
  • Top authors: mohammed_kaludi (92.21%)ahmedkaludi (4.55%)ampforwp (3.38%)

Code review

54 tests

User reviews

1282 reviews

Install metrics

100,000+ active /17,389,040 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲11.02MB] [CPU: ▲74.35ms] 50% from 4 tests

An overview of server-side resources used by AMP for WP - Accelerated Mobile Pages
Please take the time to fix the following items
  • RAM: Total memory usage must be kept under 10MB (currently 19.68MB on /wp-admin/admin.php?page=amp_options&tab=32)
  • Extra RAM: Try to keep extra memory usage under 5MB (currently 11.02MB on /wp-admin/admin.php?page=amp_options&tab=32)
PageMemory (MB)CPU Time (ms)
Home /10.25 ▲6.7981.34 ▲46.96
Dashboard /wp-admin16.11 ▲12.81126.56 ▲80.26
Posts /wp-admin/edit.php15.63 ▲12.27145.78 ▲97.81
Add New Post /wp-admin/post-new.php19.15 ▲13.27179.81 ▲77.42
Media Library /wp-admin/upload.php15.43 ▲12.20126.41 ▲92.76
Settings /wp-admin/admin.php?page=amp_options&tab=219.67191.52
Design /wp-admin/admin.php?page=amp_options&tab=2019.68180.62
Documentation /wp-admin/admin.php?page=amp_options&tab=3319.68160.51
AMP /wp-admin/customize.php?autofocus[panel]=amp_panel&return=http%3A%2F%2Fwp.com%2Fwp-admin%2F&customize_amp=119.68214.76
Import / Export /wp-admin/admin.php?page=amp_options&tab=3419.68166.16
Setup /wp-admin/admin.php?page=amp_options&tab=119.68166.99
Extensions /wp-admin/admin.php?page=amp_options&tab=3119.68162.88
Upgrade to Pro /wp-admin/admin.php?page=amp_options&tab=3219.68181.31

Server storage [IO: ▲18.29MB] [DB: ▲0.05MB] Passed 3 tests

Analyzing filesystem and database footprints of this plugin
No storage issues were detected
Filesystem: 1,182 new files
Database: no new tables, 11 new options
New WordPress options
redux_builder_amp
db_upgraded
ampforwp_default_pages_to
redux_builder_amp-transients
widget_theysaidso_widget
can_compress_scripts
widget_recent-comments
widget_ampforwp_amp_code_widget
ampforwp_plugin_info
widget_recent-posts
...

Browser metrics Passed 4 tests

This is an overview of browser requirements for AMP for WP - Accelerated Mobile Pages
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /4,324 ▲1,57713.29 ▼1.424.22 ▲2.4035.65 ▼2.59
Dashboard /wp-admin3,682 ▲1,5055.10 ▼0.57101.70 ▲4.2344.28 ▲4.37
Posts /wp-admin/edit.php3,594 ▲1,4942.57 ▲0.5547.86 ▲7.3434.97 ▼0.03
Add New Post /wp-admin/post-new.php3,447 ▲1,91222.15 ▼1.041,042.14 ▲439.1763.71 ▲12.96
Media Library /wp-admin/upload.php2,889 ▲1,4864.63 ▲0.4997.59 ▼5.1445.45 ▲0.90
Settings /wp-admin/admin.php?page=amp_options&tab=223,2615.84343.26334.82
Design /wp-admin/admin.php?page=amp_options&tab=2023,2755.84366.58102.37
Documentation /wp-admin/admin.php?page=amp_options&tab=3323,2195.45295.9278.09
AMP /wp-admin/customize.php?autofocus[panel]=amp_panel&return=http%3A%2F%2Fwp.com%2Fwp-admin%2F&customize_amp=18,71222.41570.46120.80
Import / Export /wp-admin/admin.php?page=amp_options&tab=3423,2195.53313.49103.63
Setup /wp-admin/admin.php?page=amp_options&tab=123,2195.36298.8880.37
Extensions /wp-admin/admin.php?page=amp_options&tab=3123,2195.30313.7181.66
Upgrade to Pro /wp-admin/admin.php?page=amp_options&tab=3223,2195.41290.6877.40

Uninstaller [IO: ▲0.00MB] [DB: ▲0.06MB] 75% from 4 tests

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
These items require your attention
  • Zombie WordPress options were found after uninstall: 11 options
    • db_upgraded
    • ampforwp_default_pages_to
    • can_compress_scripts
    • widget_recent-comments
    • theysaidso_admin_options
    • widget_ampforwp_amp_code_widget
    • redux_builder_amp-transients
    • widget_theysaidso_widget
    • redux_builder_amp
    • widget_recent-posts
    • ...

Smoke tests 25% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
The smoke test was a success, however most plugin functionality was not tested

SRP 0% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Please fix the following
  • 3× PHP files output text when accessed directly:
    • > /wp-content/plugins/accelerated-mobile-pages/install/assets/images/spinner.php
    • > /wp-content/plugins/accelerated-mobile-pages/templates/design-manager/swift/footer.php
    • > /wp-content/plugins/accelerated-mobile-pages/includes/vendor/css-parser/sabberworm/php-css-parser/tests/quickdump.php
  • 82× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Interface 'AmpProject\\RemoteGetRequest' not found in wp-content/plugins/accelerated-mobile-pages/includes/vendor/tool/RemoteRequest/StubbedRemoteGetRequest.php:15
    • > PHP Fatal error
      Uncaught Error: Class 'AmpProject\\Optimizer\\Configuration\\BaseTransformerConfiguration' not found in wp-content/plugins/accelerated-mobile-pages/includes/vendor/tool/Optimizer/Configuration/RewriteAmpUrlsConfiguration.php:20
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/accelerated-mobile-pages/includes/vendor/css-parser/sabberworm/php-css-parser/tests/Sabberworm/CSS/RuleSet/DeclarationBlockTest.php:9
    • > PHP Fatal error
      Uncaught Error: Interface 'WillWashburn\\Stream\\StreamableInterface' not found in wp-content/plugins/accelerated-mobile-pages/includes/vendor/amp/includes/lib/fasterimage/Stream/Stream.php:11
    • > PHP Fatal error
      Uncaught Error: Interface 'AmpProject\\Optimizer\\Transformer' not found in wp-content/plugins/accelerated-mobile-pages/includes/vendor/tool/Optimizer/Transformer/RewriteAmpUrls.php:60
    • > PHP Fatal error
      Uncaught Error: Call to undefined function absint() in wp-content/plugins/accelerated-mobile-pages/includes/vendor/amp/back-compat/templates-v0-3/style.php:66
    • > PHP Fatal error
      Uncaught Error: Class 'AmpProject\\Optimizer\\Configuration\\BaseTransformerConfiguration' not found in wp-content/plugins/accelerated-mobile-pages/includes/vendor/tool/Optimizer/Configuration/PreloadHeroImageConfiguration.php:18
    • > PHP Fatal error
      Uncaught Error: Interface 'AmpProject\\Exception\\AmpException' not found in wp-content/plugins/accelerated-mobile-pages/includes/vendor/tool/Exception/MaxCssByteCountExceeded.php:14
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/accelerated-mobile-pages/includes/options/redux-core/inc/welcome/views/about.php:2
    • > PHP Fatal error
      Uncaught Error: Interface 'AmpProject\\Optimizer\\Error' not found in wp-content/plugins/accelerated-mobile-pages/includes/vendor/tool/Optimizer/Error/CannotAdaptDocumentForSelfHosting.php:13

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Please fix the following browser errors
  • 7 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=amp_options&tab=32
    • > Deprecation (warning) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,wp-polyfill-inert,regenerator-runtime,wp-polyfill,wp-hooks&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.
    • > GET request to /wp-admin/customize.php?autofocus[panel]=amp_panel&return=http%3A%2F%2Fwp.com%2Fwp-admin%2F&customize_amp=1
    • > Security (warning) in unknown
    /?customize_changeset_uuid=61413c23-9d13-4a66-88b1-f63a035d4b93&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.

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
Attributes that need to be fixed: You can take inspiration from this readme.txt

accelerated-mobile-pages/accelerated-moblie-pages.php 92% from 13 tests

The main PHP script in "AMP for WP - Accelerated Mobile Pages" version 1.0.92 is automatically included on every request by WordPress
Please take the time to fix the following:
  • Main file name: Name the main plugin file the same as the plugin slug ("accelerated-mobile-pages.php" instead of "accelerated-moblie-pages.php")

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
Good job! No executable or dangerous file extensions detected178,253 lines of code in 953 files:
LanguageFilesBlank linesComment linesLines of code
PHP55111,86920,418124,013
JavaScript2136,1564,66332,865
CSS1099032939,853
Sass52625605,588
SVG41821,603
Markdown646901,593
JSON618401,139
HTML712612815
LESS38279715
Bourne Shell124055
XML10014

PHP code 50% from 2 tests

An overview of cyclomatic complexity and code structure
These items need your attention
  • Cyclomatic complexity of methods has to be reduced to less than 100 (currently 117)
Cyclomatic complexity
Average complexity per logical line of code0.55
Average class complexity21.50
▷ Minimum class complexity1.00
▷ Maximum class complexity877.00
Average method complexity4.41
▷ Minimum method complexity1.00
▷ Maximum method complexity117.00
Code structure
Namespaces29
Interfaces22
Traits1
Classes327
▷ Abstract classes164.89%
▷ Concrete classes31195.11%
▷ Final classes7122.83%
Methods2,126
▷ Static methods32415.24%
▷ Public methods1,63176.72%
▷ Protected methods1647.71%
▷ Private methods33115.57%
Functions1,056
▷ Named functions99494.13%
▷ Anonymous functions625.87%
Constants652
▷ Global constants263.99%
▷ Class constants62696.01%
▷ Public constants626100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
162 PNG files occupy 3.73MB with 1.35MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/tick.png0.86KB0.90KB0.00%
images/sd-icon.png0.82KB0.83KB0.00%
images/paid-memberships-pro-for-amp.png4.93KB3.64KB▼ 26.16%
includes/options/redux-core/assets/img/menu_icon.png1.41KB0.50KB▼ 64.62%
includes/options/redux-core/inc/fields/upload/blank.png0.90KB0.09KB▼ 89.72%