diff --git a/.distignore b/.distignore new file mode 100644 index 0000000..e6dfb0b --- /dev/null +++ b/.distignore @@ -0,0 +1,13 @@ +# Files that should not be copied to SVN. +.distignore +.eslintrc +.git/ +.github +composer.json +composer.lock +node_modules/ +package.json +package-lock.json +phpcs.xml +README.md +vendor/ diff --git a/.eslintrc b/.eslintrc index 719db17..3aa4ad3 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,3 +1,6 @@ { + "env" : { + "jquery": true + }, "extends": [ "plugin:@wordpress/eslint-plugin/recommended" ] } diff --git a/.github/workflows/wp-plugin-ci-full.yml b/.github/workflows/wp-plugin-ci-full.yml index 844ec48..c328d22 100644 --- a/.github/workflows/wp-plugin-ci-full.yml +++ b/.github/workflows/wp-plugin-ci-full.yml @@ -20,17 +20,25 @@ jobs: with: php-version: '8.1' coverage: none - tools: cs2pr + tools: cs2pr, wp-cli - name: Install Composer dependencies uses: ramsey/composer-install@v3 - name: Run PHPCS on all files run: | - vendor/bin/phpcs -q -n --ignore=vendor --standard=WordPress --report=checkstyle $GITHUB_WORKSPACE | cs2pr + vendor/bin/phpcs -q -n --report=checkstyle $GITHUB_WORKSPACE | cs2pr + + - name: Install latest version of dist-archive-command + run: wp package install wp-cli/dist-archive-command:v3.1.0 + + - name: Build plugin + run: | + wp dist-archive . ./shibboleth.zip + mkdir tmp-build + unzip shibboleth.zip -d tmp-build - name: Run plugin check uses: wordpress/plugin-check-action@v1 with: - exclude-directories: '.github' - exclude-files: '.eslintrc' + build-dir: './tmp-build/shibboleth' diff --git a/.github/workflows/wp-plugin-ci.yml b/.github/workflows/wp-plugin-ci.yml index 1a6ef20..5cc25ad 100644 --- a/.github/workflows/wp-plugin-ci.yml +++ b/.github/workflows/wp-plugin-ci.yml @@ -32,4 +32,4 @@ jobs: run: | touch $GITHUB_WORKSPACE/tmp.php export CHANGED_FILES=$(git diff --name-only --diff-filter=AM remotes/origin/${{ github.base_ref }} | tr '\n' ' ') - vendor/bin/phpcs -q -n --ignore=vendor --standard=WordPress --report=checkstyle $GITHUB_WORKSPACE/tmp.php $(echo $CHANGED_FILES) | cs2pr + vendor/bin/phpcs -q -n --report=checkstyle $GITHUB_WORKSPACE/tmp.php $(echo $CHANGED_FILES) | cs2pr diff --git a/assets/css/shibboleth_login_form.css b/assets/css/shibboleth_login_form.css index 99a8d14..92e9aa8 100644 --- a/assets/css/shibboleth_login_form.css +++ b/assets/css/shibboleth_login_form.css @@ -20,7 +20,7 @@ .shibboleth-wrap { position: absolute; - bottom: 20px; + bottom: 20px; padding: 0 24px; margin-left: -24px; margin-right: -24px; @@ -29,7 +29,7 @@ .shibboleth-repositioned .shibboleth-wrap { position: relative; - bottom: auto; + bottom: auto; padding: 0; margin-top: 16px; margin-left: 0; @@ -38,7 +38,7 @@ .shibboleth-form-display .shibboleth-wrap { position: relative; - bottom: auto; + bottom: auto; padding: 0; margin-top: 0; margin-left: 0; @@ -81,8 +81,8 @@ content: ''; height: 1px; position: absolute; - left: 0; - top: 50%; + left: 0; + top: 50%; width: 100%; } .shibboleth-or span { diff --git a/assets/js/shibboleth_login_form.js b/assets/js/shibboleth_login_form.js index 476302a..b795e7e 100644 --- a/assets/js/shibboleth_login_form.js +++ b/assets/js/shibboleth_login_form.js @@ -2,30 +2,28 @@ * Originally from Automattic's Jetpack SSO module (v5.3) * * @see https://github.com/Automattic/jetpack/blob/5.3/modules/sso/jetpack-sso-login.js. - * @package shibboleth + * @package */ -jQuery( document ).ready( - function ( $ ) { - const body = $( 'body' ), - ssoWrap = $( '.shibboleth-wrap' ), - loginForm = $( '#loginform' ), - overflow = $( '
' ); +jQuery(document).ready(function ($) { + const body = $('body'), + ssoWrap = $('.shibboleth-wrap'), + loginForm = $('#loginform'), + overflow = $(''); - // The overflow div is a poor man's clearfloat. We reposition the remember me - // checkbox and the submit button within that to clear the float on the - // remember me checkbox. This is important since we're positioning the SSO - // UI under the submit button. - // - // @TODO: Remove this approach once core ticket 28528 is in and we have more actions in wp-login.php. - // See - https://core.trac.wordpress.org/ticket/28528. - loginForm.append( overflow ); - overflow.append( $( 'p.forgetmenot' ), $( 'p.submit' ) ); + // The overflow div is a poor man's clearfloat. We reposition the remember me + // checkbox and the submit button within that to clear the float on the + // remember me checkbox. This is important since we're positioning the SSO + // UI under the submit button. + // + // @TODO: Remove this approach once core ticket 28528 is in and we have more actions in wp-login.php. + // See - https://core.trac.wordpress.org/ticket/28528. + loginForm.append(overflow); + overflow.append($('p.forgetmenot'), $('p.submit')); - // We reposition the SSO UI at the bottom of the login form which - // fixes a tab order issue. Then we override any styles for absolute - // positioning of the SSO UI. - loginForm.append( ssoWrap ); - body.addClass( 'shibboleth-repositioned' ); - } -); + // We reposition the SSO UI at the bottom of the login form which + // fixes a tab order issue. Then we override any styles for absolute + // positioning of the SSO UI. + loginForm.append(ssoWrap); + body.addClass('shibboleth-repositioned'); +}); diff --git a/composer.json b/composer.json index 9071c4f..3dfaf9b 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,6 @@ { "name": "michaelryanmcneill/shibboleth", + "type": "wordpress-plugin", "description": "Shibboleth plugin for WordPress", "homepage": "https://github.com/michaelryanmcneill/shibboleth", "license": "Apache-2.0", @@ -8,7 +9,8 @@ }, "require": {}, "require-dev" : { - "wp-coding-standards/wpcs": "@stable" + "wp-coding-standards/wpcs": "@stable", + "phpcompatibility/phpcompatibility-wp": "@stable" }, "config": { "allow-plugins": { diff --git a/icon.png b/icon.png deleted file mode 100644 index 5bd629c..0000000 Binary files a/icon.png and /dev/null differ diff --git a/package.json b/package.json new file mode 100644 index 0000000..e468dc6 --- /dev/null +++ b/package.json @@ -0,0 +1,6 @@ +{ + "devDependencies": { + "@wordpress/eslint-plugin": "^24.2.0", + "eslint": "^8.57.1" + } +} diff --git a/phpcs.xml b/phpcs.xml new file mode 100644 index 0000000..4189fd8 --- /dev/null +++ b/phpcs.xml @@ -0,0 +1,69 @@ + +