Skip to content

Commit 06e3f72

Browse files
authored
Merge pull request #524 from MultinetInteractive/master
v5.0.0
2 parents 9ce9689 + a7da3af commit 06e3f72

16 files changed

Lines changed: 336 additions & 216 deletions

File tree

CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,29 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
## [5.0.0](https://github.com/MultinetInteractive/EduAdmin-WordPress/compare/v4.3.0...v5.0.0) (2024-04-08)
6+
7+
8+
### ⚠ BREAKING CHANGES
9+
10+
* Updated required WP and PHP, changes are already made in code (353e4dd7c1bfa5aa31ee67e0572220acca3a6387)
11+
12+
### Bug Fixes
13+
14+
* Updated required WP and PHP, changes are already made in code (353e4dd7c1bfa5aa31ee67e0572220acca3a6387) ([29b0adc](https://github.com/MultinetInteractive/EduAdmin-WordPress/commit/29b0adc497a8d60d906784dd65ef04c824b42184))
15+
16+
## [4.3.0](https://github.com/MultinetInteractive/EduAdmin-WordPress/compare/v4.2.3...v4.3.0) (2024-04-08)
17+
18+
19+
### Features
20+
21+
* Support for EduAdmin Form Reserve/Waiting Lists when the event is fully booked. ([3680b47](https://github.com/MultinetInteractive/EduAdmin-WordPress/commit/3680b4703298c57210f5d025a70fbbf1f6565a3d)), closes [#455](https://github.com/MultinetInteractive/EduAdmin-WordPress/issues/455)
22+
23+
24+
### Bug Fixes
25+
26+
* Only check description if it actually contains anything ([33234df](https://github.com/MultinetInteractive/EduAdmin-WordPress/commit/33234dff3445e6642281cb5aa53ef674485a7fe0))
27+
528
### [4.2.3](https://github.com/MultinetInteractive/EduAdmin-WordPress/compare/v4.2.2...v4.2.3) (2024-02-09)
629

730

PLUGIN-CHECKSUM

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
aba35655ceb67555bb5c2580fbcd8cb6
1+
a8eda52c319500fecae0731cee509ae8

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
"minimum-stability": "dev",
1111
"prefer-stable": true,
1212
"require": {
13-
"php": ">=7.3",
13+
"php": ">=8.1",
1414
"composer/installers": "~2"
1515
},
16-
"version": "2.22.0"
16+
"version": "5.0.0"
1717
}

content/template/data/ogp.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,19 @@
3939
$selected_course = json_decode( EDUAPIHelper()->GetOnDemandCourseDetailInfo( $course_id, $group_by_city ), true );
4040
}
4141

42+
$description = ! empty( $selected_course['CourseDescriptionShort'] ) ?
43+
$selected_course['CourseDescriptionShort'] :
44+
$selected_course['CourseDescription'];
45+
46+
if ( $description == null || strlen( $description ) == 0 ) {
47+
return;
48+
}
49+
4250
$description = wp_strip_all_tags(
4351
str_replace(
4452
[ "<br />", "<br>", "</p>" ],
4553
[ "&#xA;", "&#xA;", "</p>&#xA;&#xA;" ],
46-
! empty( $selected_course['CourseDescriptionShort'] ) ?
47-
$selected_course['CourseDescriptionShort'] :
48-
$selected_course['CourseDescription']
54+
$description
4955
)
5056
);
5157

content/template/detailTemplate/blocks/event-item.php

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,28 @@ class="eventItem<?php echo( $show_more > 0 && $i >= $show_more ? ' showMoreHidde
7272
<?php
7373
}
7474
} else {
75-
if ( $allow_interest_reg_event && false !== $event_interest_page ) {
75+
if ( $use_eduadmin_form ) {
76+
if ( $ev['UseWaitingList'] ) {
77+
?>
78+
<a class="bookButton book-link cta-btn" href="javascript://"
79+
onclick="edu_OpenEduBookingFormModal('<?php echo esc_js( $ev['BookingFormUrl'] ); ?>');"><?php echo esc_html_x( 'Reserve list', 'frontend', 'eduadmin-booking' ); ?></a>
80+
<?php
81+
} else {
82+
?>
83+
<i class="fullBooked"><?php echo esc_html_x( 'Full', 'frontend', 'eduadmin-booking' ); ?></i>
84+
<?php
85+
}
86+
} else {
87+
if ( $allow_interest_reg_event && false !== $event_interest_page ) {
88+
?>
89+
<a class="inquiry-link"
90+
href="<?php echo esc_url( $base_url . '/' . make_slugs( $name ) . '__' . $selected_course['CourseTemplateId'] . '/book/interest/?eid=' . $ev['EventId'] . edu_get_query_string( '&', array( 'eid' ) ) . '&_=' . time() ); ?>"><?php echo esc_html_x( 'Inquiry', 'frontend', 'eduadmin-booking' ); ?></a>
91+
<?php
92+
}
7693
?>
77-
<a class="inquiry-link"
78-
href="<?php echo esc_url( $base_url . '/' . make_slugs( $name ) . '__' . $selected_course['CourseTemplateId'] . '/book/interest/?eid=' . $ev['EventId'] . edu_get_query_string( '&', array( 'eid' ) ) . '&_=' . time() ); ?>"><?php echo esc_html_x( 'Inquiry', 'frontend', 'eduadmin-booking' ); ?></a>
94+
<i class="fullBooked"><?php echo esc_html_x( 'Full', 'frontend', 'eduadmin-booking' ); ?></i>
7995
<?php
8096
}
81-
?>
82-
<i class="fullBooked"><?php echo esc_html_x( 'Full', 'frontend', 'eduadmin-booking' ); ?></i>
83-
<?php
8497
}
8598
} else {
8699
?>

content/template/listTemplate/blocks/event-block-a.php

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,22 @@ class="objectItem <?php echo edu_get_percent_from_values( $spots_left, intval( $
8080
<?php
8181
}
8282
} else {
83-
?>
84-
<i class="fullBooked"><?php _ex( 'Full', 'frontend', 'eduadmin-booking' ); ?></i>
85-
<?php
83+
if ( $use_eduadmin_form ) {
84+
if ( $event['UseWaitingList'] ) {
85+
?>
86+
<a class="bookButton book-link cta-btn" href="javascript://"
87+
onclick="edu_OpenEduBookingFormModal('<?php echo esc_js( $event['BookingFormUrl'] ); ?>');"><?php echo esc_html_x( 'Reserve list', 'frontend', 'eduadmin-booking' ); ?></a>
88+
<?php
89+
} else {
90+
?>
91+
<i class="fullBooked"><?php echo esc_html_x( 'Full', 'frontend', 'eduadmin-booking' ); ?></i>
92+
<?php
93+
}
94+
} else {
95+
?>
96+
<i class="fullBooked"><?php _ex( 'Full', 'frontend', 'eduadmin-booking' ); ?></i>
97+
<?php
98+
}
8699
}
87100
} else {
88101
?>

content/template/listTemplate/blocks/event-block-b.php

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,22 @@ class="objectBlock brick <?php echo edu_get_percent_from_values( $spots_left, $e
7676
<?php
7777
}
7878
} else {
79-
?>
80-
<i class="fullBooked"><?php _ex( 'Full', 'frontend', 'eduadmin-booking' ); ?></i>
81-
<?php
79+
if ( $use_eduadmin_form ) {
80+
if ( $event['UseWaitingList'] ) {
81+
?>
82+
<a class="bookButton book-link cta-btn" href="javascript://"
83+
onclick="edu_OpenEduBookingFormModal('<?php echo esc_js( $event['BookingFormUrl'] ); ?>');"><?php echo esc_html_x( 'Reserve list', 'frontend', 'eduadmin-booking' ); ?></a>
84+
<?php
85+
} else {
86+
?>
87+
<i class="fullBooked"><?php echo esc_html_x( 'Full', 'frontend', 'eduadmin-booking' ); ?></i>
88+
<?php
89+
}
90+
} else {
91+
?>
92+
<i class="fullBooked"><?php _ex( 'Full', 'frontend', 'eduadmin-booking' ); ?></i>
93+
<?php
94+
}
8295
}
8396
} else {
8497
?>

eduadmin.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
* Plugin URI: https://www.eduadmin.se
1010
* Description: EduAdmin plugin to allow visitors to book courses at your website
1111
* Tags: booking, participants, courses, events, eduadmin, lega online
12-
* Version: 4.2.3
12+
* Version: 5.0.0
1313
* GitHub Plugin URI: multinetinteractive/eduadmin-wordpress
1414
* GitHub Plugin URI: https://github.com/multinetinteractive/eduadmin-wordpress
15-
* Requires at least: 5.8
16-
* Tested up to: 6.4
17-
* Requires PHP: 7.0
15+
* Requires at least: 6.0
16+
* Tested up to: 6.6
17+
* Requires PHP: 8.1
1818
* Author: Chris Gårdenberg, MultiNet Interactive AB
1919
* Author URI: https://www.multinet.com
2020
* License: GPL3

includes/edu-text-functions.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ function edu_get_price( $price, $vatPercent, $settings_override = '' ) {
106106
}
107107

108108
function edu_get_percent_from_values( $current_value, $max_value ) {
109+
if ( null === $current_value || null === $max_value ) {
110+
return 'percentUnknown';
111+
}
112+
109113
if ( 0 === $current_value || 0 === $max_value ) {
110114
return 'percentUnknown';
111115
}
@@ -813,7 +817,7 @@ function get_spots_left( $free_spots, $max_spots, $spot_option = 'exactNumbers',
813817
} else {
814818
$lines = explode( "\n", $interval );
815819
foreach ( $lines as $line ) {
816-
if ( stripos( $line, '-' ) > -1 ) {
820+
if ( stripos( $line, '-' ) > - 1 ) {
817821
$range = explode( '-', $line );
818822
$min = intval( $range[0] );
819823
$max = intval( $range[1] );
@@ -822,7 +826,7 @@ function get_spots_left( $free_spots, $max_spots, $spot_option = 'exactNumbers',
822826

823827
return sprintf( _x( '%1$s spots left', 'frontend', 'eduadmin-booking' ), $line );
824828
}
825-
} elseif ( stripos( $line, '+' ) > -1 ) {
829+
} elseif ( stripos( $line, '+' ) > - 1 ) {
826830
/* translators: 1: Number of spots (range) */
827831

828832
return sprintf( _x( '%1$s spots left', 'frontend', 'eduadmin-booking' ), $line );
@@ -965,7 +969,7 @@ function edu_get_date_range( $days, $short, $event, $show_days, $always_show_sch
965969

966970
$total_days = count( $days );
967971

968-
for ( $x = 0; $x < $total_days; $x++ ) {
972+
for ( $x = 0; $x < $total_days; $x ++ ) {
969973
$day = $days[ $x ];
970974

971975
$added_dates[ edu_get_timezoned_date( 'H:i', $day['StartDate'] ) . '-' . edu_get_timezoned_date( 'H:i', $day['EndDate'] ) ][] = $day;
@@ -1177,7 +1181,7 @@ function DateComparer( $a, $b ) {
11771181
return 0;
11781182
}
11791183

1180-
return ( $a_date < $b_date ? -1 : 1 );
1184+
return ( $a_date < $b_date ? - 1 : 1 );
11811185
}
11821186

11831187
function KeySort( $key ) {
@@ -1378,7 +1382,7 @@ function edu_event_listitem_applicationopendate( $application_open_date ) {
13781382
function my_str_split( $string ) {
13791383
$s_array = array();
13801384
$slen = strlen( $string );
1381-
for ( $i = 0; $i < $slen; $i++ ) {
1385+
for ( $i = 0; $i < $slen; $i ++ ) {
13821386
$s_array[ (string) $i ] = $string[ $i ];
13831387
}
13841388

@@ -1932,7 +1936,7 @@ function remove_duplicates( $s_search, $s_replace, $s_subject ) {
19321936
$s_subject = str_replace( $s_search, $s_replace, $s_subject );
19331937
$pos = strpos( $s_subject, $s_search );
19341938

1935-
$i++;
1939+
$i ++;
19361940
if ( $i > 100 ) {
19371941
die( 'removeDuplicates() loop error' );
19381942
}
@@ -1950,6 +1954,6 @@ function edu_starts_with( $haystack, $needle ) {
19501954

19511955
if ( ! function_exists( 'edu_ends_with' ) ) {
19521956
function edu_ends_with( $haystack, $needle ) {
1953-
return substr( $haystack, -strlen( $needle ) ) === $needle;
1957+
return substr( $haystack, - strlen( $needle ) ) === $needle;
19541958
}
19551959
}

includes/eduapi-helper-functions.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function GetCourseDetailInfo( $course_id, $fetch_months, $group_by_city )
5353
';' .
5454
'$orderby=StartDate asc' . ( $group_by_city ? ', City asc' : '' ) .
5555
';' .
56-
'$select=EventId,City,ParticipantNumberLeft,MaxParticipantNumber,StartDate,EndDate,AddressName,LocationId,ParticipantVat,BookingFormUrl,OnDemand,OnDemandPublished,OnDemandAccessDays,ApplicationOpenDate,LastApplicationDate';
56+
'$select=EventId,City,ParticipantNumberLeft,MaxParticipantNumber,StartDate,EndDate,AddressName,LocationId,ParticipantVat,BookingFormUrl,OnDemand,OnDemandPublished,OnDemandAccessDays,ApplicationOpenDate,LastApplicationDate,UseWaitingList';
5757

5858
$expands['CustomFields'] = '$filter=ShowOnWeb;$select=CustomFieldId,CustomFieldName,CustomFieldType,CustomFieldValue,CustomFieldChecked,CustomFieldDate,CustomFieldAlternativeId,CustomFieldAlternativeValue;';
5959

@@ -116,7 +116,7 @@ public function GetOnDemandCourseDetailInfo( $course_id, $group_by_city ) {
116116
';' .
117117
'$orderby=StartDate asc' . ( $group_by_city ? ', City asc' : '' ) .
118118
';' .
119-
'$select=EventId,City,ParticipantNumberLeft,MaxParticipantNumber,StartDate,EndDate,AddressName,LocationId,ParticipantVat,BookingFormUrl,OnDemand,OnDemandPublished,OnDemandAccessDays,ApplicationOpenDate';
119+
'$select=EventId,City,ParticipantNumberLeft,MaxParticipantNumber,StartDate,EndDate,AddressName,LocationId,ParticipantVat,BookingFormUrl,OnDemand,OnDemandPublished,OnDemandAccessDays,ApplicationOpenDate,UseWaitingList';
120120

121121
$expands['CustomFields'] = '$filter=ShowOnWeb;$select=CustomFieldId,CustomFieldName,CustomFieldType,CustomFieldValue,CustomFieldChecked,CustomFieldDate,CustomFieldAlternativeId,CustomFieldAlternativeValue;';
122122

@@ -188,7 +188,7 @@ public function GetCourseList( $attributes, $category_id, $city, $subjectid, $co
188188
';' .
189189
'$orderby=StartDate asc' .
190190
';' .
191-
'$select=EventId,City,ParticipantNumberLeft,MaxParticipantNumber,StartDate,EndDate,AddressName,EventName,ParticipantVat,BookingFormUrl,OnDemand,OnDemandPublished,OnDemandAccessDays,LocationId,ApplicationOpenDate,LastApplicationDate';
191+
'$select=EventId,City,ParticipantNumberLeft,MaxParticipantNumber,StartDate,EndDate,AddressName,EventName,ParticipantVat,BookingFormUrl,OnDemand,OnDemandPublished,OnDemandAccessDays,LocationId,ApplicationOpenDate,LastApplicationDate,UseWaitingList';
192192

193193
$expands['CustomFields'] = '$filter=ShowOnWeb;$select=CustomFieldId,CustomFieldName,CustomFieldType,CustomFieldValue,CustomFieldChecked,CustomFieldDate,CustomFieldAlternativeId,CustomFieldAlternativeValue;';
194194

@@ -303,7 +303,7 @@ public function GetOnDemandCourseList( $attributes, $category_id, $city, $subjec
303303
';' .
304304
'$orderby=StartDate asc' .
305305
';' .
306-
'$select=EventId,City,ParticipantNumberLeft,MaxParticipantNumber,StartDate,EndDate,AddressName,EventName,ParticipantVat,BookingFormUrl,OnDemand,OnDemandPublished,OnDemandAccessDays,LocationId,ApplicationOpenDate';
306+
'$select=EventId,City,ParticipantNumberLeft,MaxParticipantNumber,StartDate,EndDate,AddressName,EventName,ParticipantVat,BookingFormUrl,OnDemand,OnDemandPublished,OnDemandAccessDays,LocationId,ApplicationOpenDate,UseWaitingList';
307307

308308
$expands['CustomFields'] = '$filter=ShowOnWeb;$select=CustomFieldId,CustomFieldName,CustomFieldType,CustomFieldValue,CustomFieldChecked,CustomFieldDate,CustomFieldAlternativeId,CustomFieldAlternativeValue;';
309309

@@ -417,7 +417,7 @@ public function GetEventList( $attributes, $category_id, $city, $subjectid, $cou
417417
';' .
418418
'$orderby=StartDate asc' .
419419
';' .
420-
'$select=EventId,City,ParticipantNumberLeft,MaxParticipantNumber,StartDate,EndDate,AddressName,EventName,ParticipantVat,BookingFormUrl,OnDemand,OnDemandPublished,OnDemandAccessDays,LocationId,ApplicationOpenDate,LastApplicationDate';
420+
'$select=EventId,City,ParticipantNumberLeft,MaxParticipantNumber,StartDate,EndDate,AddressName,EventName,ParticipantVat,BookingFormUrl,OnDemand,OnDemandPublished,OnDemandAccessDays,LocationId,ApplicationOpenDate,LastApplicationDate,UseWaitingList';
421421

422422
$expands['CustomFields'] = '$filter=ShowOnWeb;$select=CustomFieldId,CustomFieldName,CustomFieldType,CustomFieldValue,CustomFieldChecked,CustomFieldDate,CustomFieldAlternativeId,CustomFieldAlternativeValue;';
423423

@@ -456,7 +456,7 @@ public function GetEventList( $attributes, $category_id, $city, $subjectid, $cou
456456
$order = array();
457457
$custom_order = explode( ' ', $custom_order_by_order );
458458
foreach ( $custom_order as $coVal ) {
459-
! isset( $coVal ) || $coVal === "asc" ? array_push( $order, 1 ) : array_push( $order, -1 );
459+
! isset( $coVal ) || $coVal === "asc" ? array_push( $order, 1 ) : array_push( $order, - 1 );
460460
}
461461
}
462462
} else {
@@ -531,7 +531,7 @@ public function GetOnDemandEventList( $attributes, $category_id, $city, $subject
531531
';' .
532532
'$orderby=StartDate asc' .
533533
';' .
534-
'$select=EventId,City,ParticipantNumberLeft,MaxParticipantNumber,StartDate,EndDate,AddressName,EventName,ParticipantVat,BookingFormUrl,OnDemand,OnDemandPublished,OnDemandAccessDays,LocationId,ApplicationOpenDate';
534+
'$select=EventId,City,ParticipantNumberLeft,MaxParticipantNumber,StartDate,EndDate,AddressName,EventName,ParticipantVat,BookingFormUrl,OnDemand,OnDemandPublished,OnDemandAccessDays,LocationId,ApplicationOpenDate,UseWaitingList';
535535

536536
$expands['CustomFields'] = '$filter=ShowOnWeb;$select=CustomFieldId,CustomFieldName,CustomFieldType,CustomFieldValue,CustomFieldChecked,CustomFieldDate,CustomFieldAlternativeId,CustomFieldAlternativeValue;';
537537

@@ -571,7 +571,7 @@ public function GetOnDemandEventList( $attributes, $category_id, $city, $subject
571571
$order = array();
572572
$custom_order = explode( ' ', $custom_order_by_order );
573573
foreach ( $custom_order as $coVal ) {
574-
! isset( $coVal ) || $coVal === "asc" ? array_push( $order, 1 ) : array_push( $order, -1 );
574+
! isset( $coVal ) || $coVal === "asc" ? array_push( $order, 1 ) : array_push( $order, - 1 );
575575
}
576576
}
577577
} else {

0 commit comments

Comments
 (0)