Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closes #40 Update CDN cname #42

Open
wants to merge 40 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
c911be9
add Update class
remyperona Oct 29, 2024
aefaf1f
add subscriber
remyperona Oct 29, 2024
4e7d1dc
add service provider
remyperona Oct 29, 2024
92f2b61
add update notice and dismiss system
remyperona Oct 29, 2024
2d6a6a3
add dismiss notices
remyperona Oct 29, 2024
5ef1726
add styling for dismiss button
remyperona Oct 29, 2024
a1f5df0
update composer
remyperona Oct 29, 2024
06e4c4a
fix code styling
remyperona Oct 29, 2024
793ba70
fix test
remyperona Oct 29, 2024
566e4f3
cast to array
remyperona Oct 29, 2024
7947e17
udpate tests
remyperona Oct 29, 2024
f714dc5
ignore composer lock and phpunit cache files
remyperona Oct 29, 2024
bb9e491
remove composer.lock
remyperona Oct 29, 2024
c789acd
fix test
remyperona Oct 29, 2024
c87ef3c
add packages for PHPStan
remyperona Oct 30, 2024
8dbcbd0
add phpstan config
remyperona Oct 30, 2024
6ba6513
remove unnecessary return
remyperona Oct 30, 2024
8f2283d
use empty string instead of null
remyperona Oct 30, 2024
af2dde1
add exit after wp_safe_redirect()
remyperona Oct 30, 2024
d2eafc7
fix typo
remyperona Oct 30, 2024
03f59ec
update unit tests
remyperona Oct 30, 2024
e0ff624
delete new options on uninstall
remyperona Oct 30, 2024
2d8a5ef
update test
remyperona Oct 30, 2024
5bc6f76
add missing newline
remyperona Oct 30, 2024
39e1769
add PHPStan workflow
remyperona Oct 30, 2024
8478b10
add message for success
remyperona Oct 31, 2024
d395948
add test for update notice
remyperona Oct 31, 2024
806bc03
add test for dismiss notice
remyperona Oct 31, 2024
8ac8d43
add constants mocking
remyperona Nov 1, 2024
2d8f666
improve code
remyperona Nov 1, 2024
78f90a3
add tests for update CDN URL
remyperona Nov 1, 2024
3e3c4da
add tests for udpater
remyperona Nov 1, 2024
61ee346
fix naming
remyperona Nov 1, 2024
d1756b3
add constants to scan
remyperona Nov 1, 2024
69edffa
fix spacing
remyperona Nov 1, 2024
3fec69c
fix import
remyperona Nov 1, 2024
b3031af
Merge branch 'develop' into enhancement/40-cdn-change
remyperona Nov 5, 2024
b795e7b
configure export-ignore
remyperona Nov 5, 2024
2a3e503
include constants file in main plugin file
remyperona Nov 5, 2024
e066baf
update install command
remyperona Nov 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// directories
bin export-ignore
tests export-ignore

// files
.gitattributes export-ignore
.github export-ignore
.gitignore export-ignore

composer.lock export-ignore
LICENSE export-ignore
phpcs.xml export-ignore
phpstan.neon.dist export-ignore
README.md export-ignore
39 changes: 39 additions & 0 deletions .github/workflows/lint_phpstan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: PHP Stan lint

on:
pull_request:
branches:
- trunk
- develop
- branch-*
- feature/*
- enhancement/*

jobs:
run:
runs-on: ${{ matrix.operating-system }}

strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest]
php-versions: ['8.2']

name: WPRocket lint with PHP Stan. PHP ${{ matrix.php-versions }} on ${{ matrix.operating-system }}.
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
coverage: none # XDebug can be enabled here 'coverage: xdebug'
tools: composer:v2

- name: Install dependencies
run: composer install --prefer-dist --no-interaction

- name: Lint with PHP Stan
run: composer run-stan -- --error-format=github

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
composer.phar
composer.lock
/vendor/
/src/Dependencies
.phpunit.result.cache
# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
# composer.lock
31 changes: 31 additions & 0 deletions assets/css/settings.css
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,37 @@ h1.rocketcdn-logo {
display: flex;
}

.rocketcdn-is-dismissible {
position: relative;
padding-right: 38px;
}

.rocketcdn-dismiss {
position: absolute;
top: 0;
right: 1px;
border: none;
margin: 0;
padding: 9px;
background: none;
cursor:pointer;
}

.rocketcdn-dismiss::after {
background: none;
color: #787c82;
content: "\f153";
display: block;
font: normal 16px/20px dashicons;
height: 20px;
text-align: center;
width: 20px;
}

.rocketcdn-notice-dismissed {
display: none;
}

.rocketcdn-notice-dismiss {
border: 0;
background: transparent;
Expand Down
29 changes: 28 additions & 1 deletion assets/js/ajax.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
let formNoKey = document.querySelector( '#rocketcdn-no-key' ),
formHasKey = document.querySelector( '#rocketcdn-has-key #rocketcdn_api_key' ),
apiKey = document.getElementById( 'rocketcdn_api_key' ),
clearCache = document.getElementById( 'rocketcdn-purge-cache' );
clearCache = document.getElementById( 'rocketcdn-purge-cache' ),
notices = document.querySelectorAll( '.rocketcdn-dismiss' );

if ( null !== formNoKey ) {
formNoKey.addEventListener( 'submit', ( e ) => {
Expand Down Expand Up @@ -98,6 +99,32 @@
} );
}

notices.forEach( ( notice ) => {
notice.addEventListener( 'click', ( e ) => {
e.preventDefault();

let postData = '';

postData += 'action=rocketcdn_dismiss_notice';
postData += '&nonce=' + rocketcdn_ajax_data.nonce;
postData += '&notice_id=' + e.target.parentElement.getAttribute( 'data-notice' );

const request = sendHTTPRequest( postData );

request.onreadystatechange = () => {
if ( request.readyState === XMLHttpRequest.DONE && 200 === request.status ) {
let responseTxt = JSON.parse(request.responseText);

if ( ! responseTxt.success ) {
return;
}

e.target.parentElement.classList.add( 'rocketcdn-notice-dismissed' );
}
}
} );
} );

document.querySelector( '.rocketcdn-notice-dismiss' ).addEventListener( 'click', ( e ) => {
e.preventDefault();

Expand Down
10 changes: 7 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"sort-packages": true,
"allow-plugins": {
"composer/installers": true,
"dealerdirect/phpcodesniffer-composer-installer": true
"dealerdirect/phpcodesniffer-composer-installer": true,
"phpstan/extension-installer": true
}

},
Expand All @@ -37,12 +38,15 @@
"coenjacobs/mozart": "^0.7",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
"league/container": "^3.3",
"php-stubs/wordpress-tests-stubs": "^6.5",
"phpcompatibility/phpcompatibility-wp": "^2.0",
"phpstan/phpstan": "^0.12",
"phpstan/extension-installer": "^1.3",
"phpstan/phpstan-mockery": "^1.1",
"phpstan/phpstan-phpunit": "^1.4",
"phpunit/php-file-iterator": "2.0.3",
"phpunit/phpunit": "^7.5 || ^8 || ^9",
"roave/security-advisories": "dev-master",
"szepeviktor/phpstan-wordpress": "^0.7.0",
"szepeviktor/phpstan-wordpress": "^1.3",
"wp-coding-standards/wpcs": "^2",
"wp-launchpad/core": "^0.2.6",
"wp-launchpad/framework-options": "^0.1.2",
Expand Down
Loading
Loading