Skip to content

Commit

Permalink
Update readme.txt file (#44)
Browse files Browse the repository at this point in the history
* Add GH Action PR Template checker

* Closes #40 Update CDN cname (#42)

* Update readme file

---------

Co-authored-by: Mathieu Lamiot <[email protected]>
Co-authored-by: Rémy Perona <[email protected]>
Co-authored-by: Rémy Perona <[email protected]>
  • Loading branch information
4 people authored Nov 18, 2024
1 parent ca4f5fb commit a3a2804
Show file tree
Hide file tree
Showing 48 changed files with 1,290 additions and 5,434 deletions.
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

12 changes: 12 additions & 0 deletions .github/workflows/pr-template-checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: 'PR Template Checker'
on:
pull_request:
types: [edited, opened, synchronize, reopened]

jobs:
task-check:
runs-on: ubuntu-latest
steps:
- uses: wp-media/pr-checklist-action@master
with:
repo-token: "${{ secrets.PR_TEMPLATE_TOKEN }}"
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

0 comments on commit a3a2804

Please sign in to comment.