10% templatic-google-amp

Code Review | Templatic-Google-AMP

WordPress plugin Templatic-Google-AMP scored 10% from 54 tests.

About plugin

  • Plugin page: templatic-google-amp
  • Plugin version: 0.0.2
  • PHP version: 7.4.16
  • WordPress compatibility: 3.5-5.0
  • WordPress version: 5.8.1
  • First release: Jun 3, 2016
  • Latest release: Oct 27, 2018
  • Number of updates: 25
  • Update frequency: every 35.0 days
  • Top authors: rbhavesh (100%)

Code review

54 tests

User reviews

1 review

Install metrics

700+ active / 5,189 total downloads

Benchmarks

Plugin footprint 75% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The following installer errors require your attention
  • Install procedure had errors
    • > Notice in wp-content/plugins/templatic-google-amp/templatic-amp.php+42
    Trying to access array offset on value of type bool

Server metrics [RAM: ▲0.02MB] [CPU: ▼137.89ms] Passed 4 tests

A check of server-side resources used by Templatic-Google-AMP
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /2.85 ▲0.1331.98 ▲11.04
Dashboard /wp-admin3.08 ▲0.0244.69 ▼2.48
Posts /wp-admin/edit.php3.13 ▲0.0243.05 ▲0.75
Add New Post /wp-admin/post-new.php5.44 ▲0.0192.27 ▼556.00
Media Library /wp-admin/upload.php3.02 ▲0.0230.66 ▲6.19

Server storage [IO: ▲0.21MB] [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: 36 new files
Database: no new tables, 2 new options
New WordPress options
tmpl_amp_plugin_active
tmpl_amp_settings

Browser metrics Passed 4 tests

This is an overview of browser requirements for Templatic-Google-AMP
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,728 ▲13215.81 ▲0.369.15 ▲1.5648.07 ▲4.07
Dashboard /wp-admin2,979 ▲455.91 ▼0.22132.98 ▼8.39131.27 ▲21.48
Posts /wp-admin/edit.php2,770 ▲342.68 ▲0.0060.34 ▼0.0394.88 ▲11.09
Add New Post /wp-admin/post-new.php1,695 ▼17718.83 ▼0.32374.78 ▲3.46103.05 ▼11.26
Media Library /wp-admin/upload.php1,764 ▼465.00 ▼0.03135.98 ▼24.96144.80 ▲23.84

Uninstaller [IO: ▲0.00MB] [DB: ▲0.01MB] Passed 4 tests

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
The plugin uninstalled successfully, without leaving any zombie files or tables

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Even though everything seems fine, this is not an exhaustive test

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
Please fix the following items
  • 1× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/templatic-google-amp/templates/templatic/style.php
  • 23× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_embed_register_handler() in wp-content/plugins/templatic-google-amp/includes/core/handler/youtube_handler.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function has_post_thumbnail() in wp-content/plugins/templatic-google-amp/templates/templatic/content.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/templatic-google-amp/includes/core/handler/common_filter.php:24
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/templatic-google-amp/templates/templatic/footer.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_title() in wp-content/plugins/templatic-google-amp/templates/templatic/header.php:6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_header() in wp-content/plugins/templatic-google-amp/templates/templatic/page.php:1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/templatic-google-amp/includes/admin/form.php:31
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_embed_register_handler() in wp-content/plugins/templatic-google-amp/includes/core/handler/vimeo_handler.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_header() in wp-content/plugins/templatic-google-amp/templates/templatic/single.php:1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_embed_register_handler() in wp-content/plugins/templatic-google-amp/includes/core/handler/twitter_handler.php:3

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 86% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
These attributes need your attention:
  • Screenshots: Please add images for these screenshots: #1 (This is how you can set the backend settings for AMP), #2 (This is how will see the detail page with amp)
Please take inspiration from this readme.txt

templatic-google-amp/templatic-amp.php 77% from 13 tests

This is the main PHP file of "Templatic-Google-AMP" version 0.0.2, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
Please take the time to fix the following:
  • Main file name: The principal plugin file should be the same as the plugin slug ("templatic-google-amp.php" instead of "templatic-amp.php")
  • Text Domain: Since WordPress version 4.6 the text domain is optional; if specified, it must be the same as the plugin slug
  • Description: The description should be shorter than 140 characters (currently 144 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
Success! There were no dangerous files found in this plugin1,218 lines of code in 30 files:
LanguageFilesBlank linesComment linesLines of code
PHP282241801,074
PO File1363998
CSS11046

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
Great job! No cyclomatic complexity issues were detected in this plugin
Cyclomatic complexity
Average complexity per logical line of code0.30
Average class complexity2.00
▷ Minimum class complexity1.00
▷ Maximum class complexity3.00
Average method complexity1.40
▷ Minimum method complexity1.00
▷ Maximum method complexity3.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes2
▷ Abstract classes00.00%
▷ Concrete classes2100.00%
▷ Final classes00.00%
Methods5
▷ Static methods00.00%
▷ Public methods5100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions29
▷ Named functions29100.00%
▷ Anonymous functions00.00%
Constants5
▷ Global constants5100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
4 PNG files occupy 0.16MB with 0.10MB in potential savings
Potential savings
Compression of 4 random PNG files using pngquant
FileSize - originalSize - compressedSavings
(invalid) screenshot-2.png114.75KB0.00KB▼ 100.00%
assets/images/placeholder-icon.png0.85KB0.82KB▼ 3.12%
(invalid) screenshot-1.png42.39KB0.00KB▼ 100.00%
assets/images/templatic-logo.png1.26KB0.74KB▼ 41.81%