Skip to content

Commit

Permalink
Merge pull request #1 from kagg-design/v1.6.0
Browse files Browse the repository at this point in the history
V1.6.0
  • Loading branch information
kagg-design authored Aug 24, 2023
2 parents ab6fad8 + a5ec456 commit f7cb544
Show file tree
Hide file tree
Showing 31 changed files with 486 additions and 403 deletions.
8 changes: 5 additions & 3 deletions .distignore
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
# A set of files and directories you probably don't want in your WordPress.org distribution

# Files
/.DS_Store
/.distignore
/.editorconfig
/.gitignore
/.DS_Store
/.phpcs.cache
/README.md
/Thumbs.db
/auth.json
/composer.json
/composer.lock
/phpcs.xml
/changelog.md
/readme.md

# Directories
/.git
/.github
/.idea
/.wordpress-org
/cache
36 changes: 36 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: CI

on: [ push, pull_request ]

jobs:
run:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ ubuntu-latest ]
php-version: [ '7.0' ]

name: PHP ${{ matrix.php-version }} on ${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}

- name: Setup Composer caching
uses: ramsey/composer-install@v2

- name: Install dependencies
run: |
composer config github-oauth.github.com ${{ secrets.GITHUB_TOKEN }}
composer install
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Run code sniffer
run: composer phpcs
19 changes: 19 additions & 0 deletions .github/workflows/deploy-readme-assets-to-wp-org.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Plugin readme/assets update
on:
push:
branches:
- trunk
jobs:
trunk:
name: Push to trunk
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: WordPress.org plugin asset/readme update
uses: 10up/action-wordpress-plugin-asset-update@stable
env:
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
IGNORE_OTHER_FILES: true
44 changes: 44 additions & 0 deletions .github/workflows/deploy-to-wp-org.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Deploy to WordPress.org
on:
release:
types: [published]
jobs:
tag:
name: New release

runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}

- name: Setup Composer caching
uses: ramsey/composer-install@v2

- name: Install dependencies in prod version
run: |
composer config github-oauth.github.com ${{ secrets.GITHUB_TOKEN }}
composer install --no-dev
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# - name: WordPress Plugin Deploy
# id: deploy
# uses: 10up/action-wordpress-plugin-deploy@stable
# with:
# generate-zip: true
# env:
# SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
# SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}

- name: Upload release asset
uses: softprops/action-gh-release@v1
with:
files: ${{github.workspace}}/${{ github.event.repository.name }}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
.idea/
assets/css/*.min.css
assets/css/*.min.css.map
assets/js/**/*.min.js
assets/js/**/*.min.js.map
cache/
vendor/

Expand Down
Binary file added .wordpress-org/banner-1544x500.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/banner-772x250.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions .wordpress-org/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/screenshot-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -336,4 +336,4 @@ This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.
Public License instead of this License.
54 changes: 54 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# PageSpeed Optimization

PageSpeed Optimization plugin performs optimization of external scripts and styles by moving them to the footer, blocking, or delaying. Loading of delayed scripts or styles begins after the first user interaction - scroll, clock, or mouse enter. Links and fonts can be preloaded to minimize loading time.

During moving, blocking, or delaying, the plugin performs exact calculations of all scripts and styles dependencies across the whole dependency tree. So, any script or style whose position has to be modified will be moved with all dependencies in the proper order. This functionality is unique and does not exist in most top-level caching plugins.

Some scripts can be stored locally: Google AdSense, Google Analytics, Google Maps, Google Tag Manager, and Yandex Metrika. Scripts for the above-mentioned services will be cached on the local server and updated twice daily.

Google Pagespeed Insights (PSI) requires leveraging browser cache when using analytics scripts because they only have a 2-hour cache expiry time. When scripts are stored locally, their cache expiry time is increased, raising the PSI score.

PageSpeed Optimization plugin will get you a higher score on Google Pagespeed Insights and make your website load faster. The most impact can usually be achieved by delaying scripts.

![](./.wordpress-org/banner-772x250.png)

## Features

- Any script or style can be moved from the header to the footer.
- Any script or style can be blocked entirely, preventing its loading.
- Any script or style can be delayed until the first user interaction: scroll, click, or mouse enter.
- Dependencies of moved, blocked, or delayed scripts and styles are correctly calculated across the dependency tree. Therefore, all dependent scripts and styles will be moved in a proper order. This unique feature does not exist in most top-level caching plugins.
- Analytics scripts can be stored locally to improve browser cache time.
- Links and fonts can be preloaded to improve overall page loading time.

## Installation

```
[email protected]:kagg-design/kagg-pagespeed-optimization.git
cd kagg-pagespeed-optimization
composer install --no-dev
```

## Development

```
[email protected]:kagg-design/kagg-pagespeed-optimization.git
cd kagg-pagespeed-optimization
composer install
```

## License

The WordPress Plugin PageSpeed Optimization is licensed under the GPL v2 or later.

> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation.
> This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
> You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
A copy of the license is included in the root of the plugin’s directory. The file is named `LICENSE`.

## Credits

The current version of the PageSpeed Optimization was developed by [KAGG Design](https://kagg.eu/en/).
Binary file removed assets/images/icon-16x16.png
Binary file not shown.
16 changes: 16 additions & 0 deletions assets/images/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 9 additions & 8 deletions assets/js/passive-events.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
( function() {
var supportsPassive = eventListenerOptionsSupported();
const supportsPassive = eventListenerOptionsSupported();

if ( supportsPassive ) {
var addEvent = EventTarget.prototype.addEventListener;
const addEvent = EventTarget.prototype.addEventListener;
overwriteAddEvent( addEvent );
}

function overwriteAddEvent( superMethod ) {
var defaultOptions = {
const defaultOptions = {
passive: true,
capture: false
};

EventTarget.prototype.addEventListener = function( type, listener, options ) {
var usesListenerOptions = typeof options === 'object';
var useCapture = usesListenerOptions ? options.capture : options;
const usesListenerOptions = typeof options === 'object';
const useCapture = usesListenerOptions ? options.capture : options;

options = usesListenerOptions ? options : {};

Expand All @@ -29,9 +29,10 @@
}

function eventListenerOptionsSupported() {
var supported = false;
let supported = false;

try {
var opts = Object.defineProperty( {}, 'passive', {
const opts = Object.defineProperty( {}, 'passive', {
get: function() {
supported = true;
}
Expand All @@ -42,4 +43,4 @@

return supported;
}
} )();
} )();
51 changes: 0 additions & 51 deletions changelog.md

This file was deleted.

19 changes: 11 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"pagespeed insights",
"optimization"
],
"homepage": "https://kagg.eu/en/",
"homepage": "https://wordpress.org/kagg-pagespeed-optimization/",
"type": "wordpress-plugin",
"authors": [
{
Expand All @@ -28,27 +28,30 @@
"minimum-stability": "dev",
"prefer-stable": true,
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
},
"platform": {
"php": "5.6"
"php": "7.0"
}
},
"require": {
"ext-json": "*",
"tedivm/jshrink": "^v1.4"
"tedivm/jshrink": "^v1.6.8"
},
"require-dev": {
"roave/security-advisories": "dev-latest",
"squizlabs/php_codesniffer": "^3.6",
"phpcompatibility/php-compatibility": "^9.3",
"phpcompatibility/phpcompatibility-wp": "^2.1",
"wp-coding-standards/wpcs": "^2.3"
"squizlabs/php_codesniffer": "^3.7.2",
"phpcompatibility/php-compatibility": "^9.3.5",
"phpcompatibility/phpcompatibility-wp": "^2.1.3",
"wp-coding-standards/wpcs": "^3.0.0"
},
"autoload": {
"psr-4": {
"KAGG\\PageSpeed\\Optimization\\": "src/php"
}
},
"scripts": {
"phpcs": "phpcs --colors --standard=phpcs.xml"
"phpcs": "vendor/bin/phpcs --colors --standard=phpcs.xml"
}
}
Loading

0 comments on commit f7cb544

Please sign in to comment.