Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 13 additions & 0 deletions .distignore
Original file line number Diff line number Diff line change
@@ -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/
3 changes: 3 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"env" : {
"jquery": true
},
"extends": [ "plugin:@wordpress/eslint-plugin/recommended" ]
}
16 changes: 12 additions & 4 deletions .github/workflows/wp-plugin-ci-full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
2 changes: 1 addition & 1 deletion .github/workflows/wp-plugin-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 5 additions & 5 deletions assets/css/shibboleth_login_form.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

.shibboleth-wrap {
position: absolute;
bottom: 20px;
bottom: 20px;
padding: 0 24px;
margin-left: -24px;
margin-right: -24px;
Expand All @@ -29,7 +29,7 @@

.shibboleth-repositioned .shibboleth-wrap {
position: relative;
bottom: auto;
bottom: auto;
padding: 0;
margin-top: 16px;
margin-left: 0;
Expand All @@ -38,7 +38,7 @@

.shibboleth-form-display .shibboleth-wrap {
position: relative;
bottom: auto;
bottom: auto;
padding: 0;
margin-top: 0;
margin-left: 0;
Expand Down Expand Up @@ -81,8 +81,8 @@
content: '';
height: 1px;
position: absolute;
left: 0;
top: 50%;
left: 0;
top: 50%;
width: 100%;
}
.shibboleth-or span {
Expand Down
44 changes: 21 additions & 23 deletions assets/js/shibboleth_login_form.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = $( '<div class="shibboleth-clear"></div>' );
jQuery(document).ready(function ($) {
const body = $('body'),
ssoWrap = $('.shibboleth-wrap'),
loginForm = $('#loginform'),
overflow = $('<div class="shibboleth-clear"></div>');

// 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');
});
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -8,7 +9,8 @@
},
"require": {},
"require-dev" : {
"wp-coding-standards/wpcs": "@stable"
"wp-coding-standards/wpcs": "@stable",
"phpcompatibility/phpcompatibility-wp": "@stable"
},
"config": {
"allow-plugins": {
Expand Down
Binary file removed icon.png
Binary file not shown.
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"devDependencies": {
"@wordpress/eslint-plugin": "^24.2.0",
"eslint": "^8.57.1"
}
}
69 changes: 69 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?xml version="1.0" ?>
<ruleset name="WordPress Plugin: shibboleth">
<arg value="s"/>
<arg name="extensions" value="php"/>
<file>.</file>

<!-- Strip the filepaths down to the relevant bit. -->
<arg name="basepath" value="./"/>

<!-- Check up to 20 files simultaneously. -->
<arg name="parallel" value="20"/>

<!-- Check for PHP and WordPress cross-version compatibility. -->
<config name="minimum_supported_wp_version" value="4.0" />
<config name="testVersion" value="5.6-"/>
<rule ref="PHPCompatibilityWP"/>

<rule ref="WordPress"/>

<rule ref="WordPress.WP.I18n">
<properties>
<property name="text_domain" type="array">
<element value="shibboleth" />
</property>
</properties>
</rule>

<!-- Code quality. -->
<rule ref="Squiz.PHP.InnerFunctions"/>
<rule ref="Squiz.PHP.LowercasePHPFunctions"/>

<!-- Exclude comment alignment spacing (it does not allow overrides). -->
<rule ref="Squiz.Commenting.FunctionComment">
<exclude name="Squiz.Commenting.FunctionComment.SpacingAfterParamType"/>
<exclude name="Squiz.Commenting.FunctionComment.SpacingAfterParamName"/>
</rule>

<!-- Override statement alignment to use a single space. -->
<rule ref="Generic.Formatting.MultipleStatementAlignment">
<properties>
<property name="maxPadding" value="1" />
</properties>
</rule>
<rule ref="WordPress.Arrays.MultipleStatementAlignment">
<properties>
<property name="maxColumn" value="1"/>
</properties>
</rule>

<!-- Forbidden functions. -->
<rule ref="Generic.PHP.ForbiddenFunctions">
<properties>
<property name="forbiddenFunctions" type="array">
<element key="sizeof" value="count"/>
<element key="delete" value="unset"/>
<element key="print" value="echo"/>
<element key="create_function" value="null"/>
<element key="array_push" value="null"/>
<element key="array_key_exists" value="isset"/>
</property>
</properties>
</rule>

<!-- Exclude the Composer Vendor directory. -->
<exclude-pattern>/vendor/*</exclude-pattern>

<!-- Exclude the Node Modules directory. -->
<exclude-pattern>/node_modules/*</exclude-pattern>
</ruleset>