Skip to content

Commit

Permalink
Merge pull request #164 from rotaract/dependabot_hotfix
Browse files Browse the repository at this point in the history
Dependabot hotfix
  • Loading branch information
bbenno authored Oct 10, 2023
2 parents 64e8b77 + a5cbe24 commit daa3254
Show file tree
Hide file tree
Showing 11 changed files with 527 additions and 370 deletions.
2 changes: 1 addition & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"bitwise": true,
"curly": true,
"eqeqeq": true,
"esversion": 6,
"esversion": 11,
"forin": false,
"freeze": true,
"futurehostile": true,
Expand Down
29 changes: 11 additions & 18 deletions admin/class-rotaract-appointments-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ public function __construct( string $rotaract_appointments, string $version, Rot
$this->rotaract_appointments = $rotaract_appointments;
$this->version = $version;
$this->elastic_caller = $elastic_caller;

}

/**
Expand All @@ -83,7 +82,6 @@ public function enqueue_styles() {

wp_enqueue_style( '$this->rotaract_appointments', plugins_url( 'css/admin.css', __FILE__ ), array(), $this->version, 'all' );
wp_enqueue_style( 'lc-select-light', plugins_url( 'node_modules/lc-select/themes/light.css', __DIR__ ), array(), $this->lc_select_version, 'all' );

}

/**
Expand All @@ -109,7 +107,6 @@ public function enqueue_scripts() {
),
)
);

}

/**
Expand All @@ -122,7 +119,6 @@ public function enqueue_scripts() {
private function get_partial( string $filename ): string {

return plugin_dir_path( __FILE__ ) . 'partials/' . $filename;

}

/**
Expand All @@ -131,7 +127,6 @@ private function get_partial( string $filename ): string {
public function elastic_missing_notice() {

include $this->get_partial( 'notice-elastic-missing.php' );

}

/**
Expand Down Expand Up @@ -209,7 +204,7 @@ public function admin_menu() {
add_menu_page(
'Rotaract',
'Rotaract',
'administrator',
'manage_options',
'rotaract',
array( $this, 'rotaract_settings_html' ),
plugins_url( 'images/wheel.svg', __DIR__ ),
Expand Down Expand Up @@ -240,7 +235,6 @@ public function rotaract_settings_html() {
settings_errors( 'rotaract_messages' );

include $this->get_partial( 'page-rotaract-settings.php' );

}

/**
Expand All @@ -266,24 +260,24 @@ private function get_palette() {
*
* @param array $args The settings array, defining title, id, callback.
*/
public function rotaract_appointment_section( array $args ) {
public function rotaract_appointment_section( array $args ) { // phpcs:ignore

include $this->get_partial( 'section-rotaract-appointments.php' );

}

/**
* Builds select tag containing grouped appointment owners options.
*
* @param array $args The settings array, defining ...
*/
public function appointment_owners_field( array $args ) {
public function appointment_owners_field( array $args ) { // phpcs:ignore
// Get the value of the setting we've registered with register_setting().
$selected_owners = get_option( 'rotaract_appointment_owners' );

include $this->get_partial( 'field-appointment-owners.php' );
}


/**
* Builds select tag containing grouped appointment options.
*
Expand All @@ -292,7 +286,7 @@ public function appointment_owners_field( array $args ) {
* @param string|null $owner_name The owner's name.
* @param string|null $owner_color Selected color.
*/
private function print_appointment_owners_line( bool $is_new, int $index, string $owner_name = null, string $owner_color = null ) {
private function print_appointment_owners_line( bool $is_new, int $index, string $owner_name = null, string $owner_color = null ) { // phpcs:ignore
$owners = $this->elastic_caller->get_all_owners();
$color_palette = $this->get_palette();

Expand All @@ -304,7 +298,7 @@ private function print_appointment_owners_line( bool $is_new, int $index, string
*
* @param array $args The settings array, defining ...
*/
public function appointment_ics_field( array $args ) {
public function appointment_ics_field( array $args ) { // phpcs:ignore
// Get the value of the setting we've registered with register_setting().
$ics_feeds = get_option( 'rotaract_appointment_ics' );

Expand All @@ -316,10 +310,11 @@ public function appointment_ics_field( array $args ) {
*
* @param bool $is_new True if this intends to be a new owner.
* @param int $index Index of the parameter.
* @param string|null $owner_name The owner's name.
* @param string|null $owner_color Selected color.
* @param string|null $feed_name The feed's name.
* @param string|null $feed_url The feed's url.
* @param string|null $feed_color Selected color.
*/
private function print_ics_line( bool $is_new, int $index, string $feed_name = null, string $feed_url = null, string $feed_color = null ) {
private function print_ics_line( bool $is_new, int $index, string $feed_name = null, string $feed_url = null, string $feed_color = null ) { // phpcs:ignore
$color_palette = $this->get_palette();

include $this->get_partial( 'field-ics-line.php' );
Expand Down Expand Up @@ -380,10 +375,8 @@ public function sanitize_rotaract_appointment_ics( ?array $input ): array {
*
* @param array $args The settings array, defining ...
*/
public function appointment_owners_shortcode_manual( array $args ) {
public function appointment_owners_shortcode_manual( array $args ) { // phpcs:ignore

include $this->get_partial( 'field-shortcode-manual.php' );

}

}
22 changes: 11 additions & 11 deletions admin/js/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ addEventListeners();
* Initializes LC-select targeting the select field.
*/
function lcSelectInit() {
new lc_select(
lc_select(
'select.lc-select',
{
enable_search: true,
Expand Down Expand Up @@ -50,20 +50,20 @@ function addEventListeners() {
// Add Delete Listeners.
const delBtns = document.querySelectorAll( 'button.delete-line' );
delBtns.forEach(
function( delBtn ) {
function (delBtn) {
delBtn.addEventListener( 'click', delLine );
}
);

document.querySelector( 'button.add-owner' )?.addEventListener( 'click', addOwner );
document.querySelector( 'button.add-ics' )?.addEventListener( 'click', addFeed );
document.querySelector( 'button.add-owner' ) ?.addEventListener( 'click', addOwner ); // phpcs:ignore
document.querySelector( 'button.add-ics' ) ?.addEventListener( 'click', addFeed ); // phpcs:ignore
}

/**
* Adds new owner whose events to display.
*/
function addOwner( event = null ) {
if ( event ) {
function addOwner(event = null) {
if (event) {
event.preventDefault();
}

Expand Down Expand Up @@ -107,8 +107,8 @@ function addOwner( event = null ) {
/**
* Adds new ics calendar feeds.
*/
function addFeed( event = null ) {
if ( event ) {
function addFeed(event = null) {
if (event) {
event.preventDefault();
}

Expand Down Expand Up @@ -155,9 +155,9 @@ function addFeed( event = null ) {
/**
* Removes owner selection.
*/
function delLine( event ) {
function delLine(event) {
event.preventDefault();
if ( document.querySelectorAll( '.appointment-line' ).length < 2 ) {
if (document.querySelectorAll( '.appointment-line' ).length < 2) {
addOwner();
}
event.target.closest( '.appointment-line' ).remove();
Expand All @@ -169,7 +169,7 @@ function delLine( event ) {
* @param newValue
* @param targetField
*/
function changeColor( newValue, targetField) {
function changeColor(newValue, targetField) {
const style = targetField.closest( '.appointment-line' ).style;
style.backgroundColor = newValue + '25';
style.borderColor = newValue;
Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,21 @@
"erusev/parsedown": "1.8.0-beta-7"
},
"require-dev": {
"wp-cli/wp-cli-bundle": "^2.6",
"wp-coding-standards/wpcs": "^2.3",
"phpcompatibility/php-compatibility": "^9.3.5",
"dealerdirect/phpcodesniffer-composer-installer": "^1.0.0"
"wp-cli/wp-cli-bundle": "^2.8",
"wp-coding-standards/wpcs": "^3.0",
"phpcompatibility/php-compatibility": "^9.3"
},
"minimum-stability": "stable",
"scripts": {
"lint": "phpcs --standard=phpcs.xml",
"lint": "phpcs . --standard=phpcs.xml",
"translate": "wp i18n make-mo languages"
},
"config": {
"platform": {
"php": "8.0"
},
"allow-plugins": {
"php-http/discovery": true,
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
Expand Down
Loading

0 comments on commit daa3254

Please sign in to comment.